forked from mirrors/gecko-dev
Bug 463104: elementFromPoint should accept floating point coordinates. r=bz
This commit is contained in:
parent
c48615d849
commit
431e038108
8 changed files with 40 additions and 13 deletions
|
|
@ -115,8 +115,8 @@ class Link;
|
|||
} // namespace mozilla
|
||||
|
||||
#define NS_IDOCUMENT_IID \
|
||||
{ 0x94fb5716, 0xff00, 0x4b97, \
|
||||
{ 0x90, 0x01, 0x91, 0x65, 0x1a, 0x5f, 0xbe, 0x64 } }
|
||||
{ 0x5a428059, 0x4f29, 0x4d7c, \
|
||||
{ 0x93, 0xae, 0x7c, 0x68, 0xd6, 0x5a, 0x86, 0x45 } }
|
||||
|
||||
// Flag for AddStyleSheet().
|
||||
#define NS_STYLESHEET_FROM_CATALOG (1 << 0)
|
||||
|
|
@ -985,7 +985,7 @@ public:
|
|||
*
|
||||
* @see nsIDOMWindowUtils::elementFromPoint
|
||||
*/
|
||||
virtual nsresult ElementFromPointHelper(PRInt32 aX, PRInt32 aY,
|
||||
virtual nsresult ElementFromPointHelper(float aX, float aY,
|
||||
PRBool aIgnoreRootScrollFrame,
|
||||
PRBool aFlushLayout,
|
||||
nsIDOMElement** aReturn) = 0;
|
||||
|
|
|
|||
|
|
@ -2622,13 +2622,13 @@ nsDocument::GetActiveElement(nsIDOMElement **aElement)
|
|||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDocument::ElementFromPoint(PRInt32 aX, PRInt32 aY, nsIDOMElement** aReturn)
|
||||
nsDocument::ElementFromPoint(float aX, float aY, nsIDOMElement** aReturn)
|
||||
{
|
||||
return ElementFromPointHelper(aX, aY, PR_FALSE, PR_TRUE, aReturn);
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsDocument::ElementFromPointHelper(PRInt32 aX, PRInt32 aY,
|
||||
nsDocument::ElementFromPointHelper(float aX, float aY,
|
||||
PRBool aIgnoreRootScrollFrame,
|
||||
PRBool aFlushLayout,
|
||||
nsIDOMElement** aReturn)
|
||||
|
|
|
|||
|
|
@ -873,7 +873,7 @@ public:
|
|||
virtual NS_HIDDEN_(nsresult) GetContentListFor(nsIContent* aContent,
|
||||
nsIDOMNodeList** aResult);
|
||||
|
||||
virtual NS_HIDDEN_(nsresult) ElementFromPointHelper(PRInt32 aX, PRInt32 aY,
|
||||
virtual NS_HIDDEN_(nsresult) ElementFromPointHelper(float aX, float aY,
|
||||
PRBool aIgnoreRootScrollFrame,
|
||||
PRBool aFlushLayout,
|
||||
nsIDOMElement** aReturn);
|
||||
|
|
|
|||
|
|
@ -72,6 +72,7 @@ _TEST_FILES = test_bug1682.html \
|
|||
test_bug403868.xhtml \
|
||||
test_bug404320.html \
|
||||
$(warning test_bug435128.html disabled because it takes 60 seconds) \
|
||||
test_bug463104.html \
|
||||
test_bug468353.html \
|
||||
test_form-parsing.html \
|
||||
test_viewport.html \
|
||||
|
|
|
|||
26
content/html/document/test/test_bug463104.html
Normal file
26
content/html/document/test/test_bug463104.html
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>Noninteger coordinates test</title>
|
||||
<script type="text/javascript" src="/MochiKit/packed.js"></script>
|
||||
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
|
||||
</head>
|
||||
<body>
|
||||
<div id="a" style="position: fixed; left: 5.5px; top: 5.5px; width: 100px; height: 100px; background: blue"></div>
|
||||
<p style="margin-top: 110px">
|
||||
<script>
|
||||
var a = document.getElementById("a");
|
||||
isnot(a, document.elementFromPoint(5, 5), "a shouldn't be found");
|
||||
isnot(a, document.elementFromPoint(5.25, 5.25), "a shouldn't be found");
|
||||
is(a, document.elementFromPoint(5.5, 5.5), "a should be found");
|
||||
is(a, document.elementFromPoint(5.75, 5.75), "a should be found");
|
||||
is(a, document.elementFromPoint(6, 6), "a should be found");
|
||||
is(a, document.elementFromPoint(105, 105), "a should be found");
|
||||
is(a, document.elementFromPoint(105.25, 105.25), "a should be found");
|
||||
isnot(a, document.elementFromPoint(105.5, 105.5), "a shouldn't be found");
|
||||
isnot(a, document.elementFromPoint(105.75, 105.75), "a shouldn't be found");
|
||||
isnot(a, document.elementFromPoint(106, 106), "a shouldn't be found");
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
|
@ -607,7 +607,7 @@ nsDOMWindowUtils::SendSimpleGestureEvent(const nsAString& aType,
|
|||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDOMWindowUtils::ElementFromPoint(PRInt32 aX, PRInt32 aY,
|
||||
nsDOMWindowUtils::ElementFromPoint(float aX, float aY,
|
||||
PRBool aIgnoreRootScrollFrame,
|
||||
PRBool aFlushLayout,
|
||||
nsIDOMElement** aReturn)
|
||||
|
|
|
|||
|
|
@ -52,7 +52,7 @@ interface nsIDOMEvent;
|
|||
interface nsITransferable;
|
||||
interface nsIQueryContentEventResult;
|
||||
|
||||
[scriptable, uuid(1e9d7efa-997d-42c0-acdf-f5f1cc8eb539)]
|
||||
[scriptable, uuid(25ada920-d727-45b6-ac70-847a3aa9c7cf)]
|
||||
interface nsIDOMWindowUtils : nsISupports {
|
||||
|
||||
/**
|
||||
|
|
@ -298,8 +298,8 @@ interface nsIDOMWindowUtils : nsISupports {
|
|||
* null for coordinates outside of the viewport.
|
||||
* @param aFlushLayout flushes layout if true. Otherwise, no flush occurs.
|
||||
*/
|
||||
nsIDOMElement elementFromPoint(in long aX,
|
||||
in long aY,
|
||||
nsIDOMElement elementFromPoint(in float aX,
|
||||
in float aY,
|
||||
in boolean aIgnoreRootScrollFrame,
|
||||
in boolean aFlushLayout);
|
||||
|
||||
|
|
|
|||
|
|
@ -43,7 +43,7 @@
|
|||
interface nsIBoxObject;
|
||||
interface nsIDOMLocation;
|
||||
|
||||
[scriptable, uuid(B7E9211B-F29F-4E2D-9762-6BCBC64E5C05)]
|
||||
[scriptable, uuid(42c27ca5-6065-42b6-ad9e-b748c1acd250)]
|
||||
interface nsIDOMNSDocument : nsISupports
|
||||
{
|
||||
readonly attribute DOMString characterSet;
|
||||
|
|
@ -87,9 +87,9 @@ interface nsIDOMNSDocument : nsISupports
|
|||
* Callers from XUL documents should wait until the onload event has fired
|
||||
* before calling this method.
|
||||
*
|
||||
* <a href="http://dev.w3.org/cvsweb/~checkout~/csswg/cssom/Overview.html?content-type=text/html;%20charset=utf-8#documentlayout-elementfrompoint">preliminary spec</a>
|
||||
* See <http://www.w3.org/TR/cssom-view/#the-documentview-interface>
|
||||
*/
|
||||
nsIDOMElement elementFromPoint(in long x, in long y);
|
||||
nsIDOMElement elementFromPoint(in float x, in float y);
|
||||
|
||||
/**
|
||||
* Release the current mouse capture if it is on an element within this
|
||||
|
|
|
|||
Loading…
Reference in a new issue