Bug 646757. Don't snap display item bounds during hit-testing. r=tnikkel
authorRobert O'Callahan <robert@ocallahan.org>
Tue, 31 May 2011 09:44:10 +1200
changeset 70362 dd66203ac8aa19d145f47c9e22175ace04163c7f
parent 70361 b55b6d578d4d7aca7480b70e36f66cde21b13b7e
child 70363 2c64357fcbf39d4e8e1cab7bda31efaaea455bdd
push id20298
push usermlamouri@mozilla.com
push dateTue, 31 May 2011 10:20:04 +0000
treeherdermozilla-central@630b62652f17 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerstnikkel
bugs646757
milestone7.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 646757. Don't snap display item bounds during hit-testing. r=tnikkel
layout/base/nsDisplayList.cpp
layout/base/tests/Makefile.in
layout/base/tests/test_bug646757.html
--- a/layout/base/nsDisplayList.cpp
+++ b/layout/base/nsDisplayList.cpp
@@ -81,17 +81,17 @@ nsDisplayListBuilder::nsDisplayListBuild
       mHadToIgnoreSuppression(PR_FALSE),
       mIsAtRootOfPseudoStackingContext(PR_FALSE),
       mIncludeAllOutOfFlows(PR_FALSE),
       mSelectedFramesOnly(PR_FALSE),
       mAccurateVisibleRegions(PR_FALSE),
       mInTransform(PR_FALSE),
       mSyncDecodeImages(PR_FALSE),
       mIsPaintingToWindow(PR_FALSE),
-      mSnappingEnabled(PR_TRUE),
+      mSnappingEnabled(mMode != EVENT_DELIVERY),
       mHasDisplayPort(PR_FALSE),
       mHasFixedItems(PR_FALSE)
 {
   MOZ_COUNT_CTOR(nsDisplayListBuilder);
   PL_InitArenaPool(&mPool, "displayListArena", 1024,
                    NS_MAX(NS_ALIGNMENT_OF(void*),NS_ALIGNMENT_OF(double))-1);
 
   nsPresContext* pc = aReferenceFrame->PresContext();
--- a/layout/base/tests/Makefile.in
+++ b/layout/base/tests/Makefile.in
@@ -153,16 +153,17 @@ DEFINES += -D_IMPL_NS_LAYOUT
 		test_mozPaintCount.html \
 		test_scroll_selection_into_view.html \
 		test_bug583889.html \
 		bug583889_inner1.html \
 		bug583889_inner2.html \
 		test_bug582771.html \
 		test_bug603550.html \
 		test_bug629838.html \
+		test_bug646757.html \
 		$(NULL)
 
 # Tests for bugs 441782, 467672 and 570378 don't pass reliably on Windows, because of bug 469208
 ifeq (,$(filter windows,$(MOZ_WIDGET_TOOLKIT)))
 _TEST_FILES += \
 		bidi_numeral_test.js \
 		test_bug332655-1.html \
 		test_bug332655-2.html \
new file mode 100644
--- /dev/null
+++ b/layout/base/tests/test_bug646757.html
@@ -0,0 +1,44 @@
+<!DOCTYPE HTML>
+<html>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=646757
+-->
+<head>
+  <title>Test for Bug 646757</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 style="margin:0" id="body">
+<div style="height:20.3px; width:400px; background:pink" id="d1"></div>
+<div style="height:20px; width:400px; background:yellow" id="d2"></div>
+<div style="height:9.7px; width:400px;" id="space1"></div>
+<div style="height:20.7px; width:400px; background:pink" id="d3"></div>
+<div style="height:20px; width:400px; background:yellow" id="d4"></div>
+<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=646757">Mozilla Bug 646757</a>
+<p id="display"></p>
+<div id="content" style="display: none">
+  
+</div>
+<pre id="test">
+<script class="testbody" type="text/javascript">
+function testPoint(x, y, id) {
+  is(document.elementFromPoint(x, y).id, id,
+     "checking element at " + x + "," + y);
+}
+
+/** Test for Bug 646757 **/
+testPoint(200, 20, "d1");
+testPoint(200, 20.2, "d1");
+testPoint(200, 20.4, "d2");
+testPoint(200, 21, "d2");
+
+testPoint(200, 70, "d3");
+testPoint(200, 70.6, "d3");
+testPoint(200, 70.8, "d4");
+testPoint(200, 71, "d4");
+</script>
+</pre>
+</body>
+</html>
+