Bug 1174521 - Backout the second part of bug 1143570 to fix the regression; r=roc
☠☠ backed out by e20e65a1f5e8 ☠ ☠
authorEhsan Akhgari <ehsan@mozilla.com>
Wed, 17 Jun 2015 00:42:15 -0400
changeset 249312 b857e7a2ab265aa623df42e9d6ec24c9858c8324
parent 249311 842c06221e6a1b2a3db5059aeed92a2703c5f625
child 249313 d09603b88a08cfd2c169151e5f87707614593955
push id28923
push userryanvm@gmail.com
push dateWed, 17 Jun 2015 18:57:11 +0000
treeherdermozilla-central@099d6cd6725e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersroc
bugs1174521, 1143570
milestone41.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 1174521 - Backout the second part of bug 1143570 to fix the regression; r=roc
layout/generic/nsBlockFrame.cpp
layout/generic/nsBlockFrame.h
layout/generic/test/bug1174521.html
layout/generic/test/mochitest.ini
layout/generic/test/test_bug1174521.html
--- a/layout/generic/nsBlockFrame.cpp
+++ b/layout/generic/nsBlockFrame.cpp
@@ -5354,26 +5354,24 @@ nsBlockInFlowLineIterator::nsBlockInFlow
     // rline_end. So we can safely increment it (i.e. move it to one line
     // earlier) to start searching there.
     ++rline;
     while (line != line_end || rline != rline_end) {
       if (line != line_end) {
         if (line->Contains(child)) {
           *aFoundValidLine = true;
           mLine = line;
-          aFrame->SetLineCursor(line.get());
           return;
         }
         ++line;
       }
       if (rline != rline_end) {
         if (rline->Contains(child)) {
           *aFoundValidLine = true;
           mLine = rline;
-          aFrame->SetLineCursor(rline.get());
           return;
         }
         ++rline;
       }
     }
     // Didn't find the line
   }
 
@@ -6521,18 +6519,19 @@ void nsBlockFrame::ClearLineCursor()
 }
 
 void nsBlockFrame::SetupLineCursor()
 {
   if (GetStateBits() & NS_BLOCK_HAS_LINE_CURSOR
       || mLines.empty()) {
     return;
   }
-
-  SetLineCursor(mLines.front());
+   
+  Properties().Set(LineCursorProperty(), mLines.front());
+  AddStateBits(NS_BLOCK_HAS_LINE_CURSOR);
 }
 
 nsLineBox* nsBlockFrame::GetFirstLineContaining(nscoord y)
 {
   if (!(GetStateBits() & NS_BLOCK_HAS_LINE_CURSOR)) {
     return nullptr;
   }
 
@@ -6550,17 +6549,17 @@ nsLineBox* nsBlockFrame::GetFirstLineCon
   }
   while ((cursorArea.IsEmpty() || cursorArea.YMost() <= y)
          && cursor != mLines.back()) {
     cursor = cursor.next();
     cursorArea = cursor->GetVisualOverflowArea();
   }
 
   if (cursor.get() != property) {
-    SetLineCursor(cursor.get());
+    props.Set(LineCursorProperty(), cursor.get());
   }
 
   return cursor.get();
 }
 
 /* virtual */ void
 nsBlockFrame::ChildIsDirty(nsIFrame* aChild)
 {
--- a/layout/generic/nsBlockFrame.h
+++ b/layout/generic/nsBlockFrame.h
@@ -372,20 +372,16 @@ protected:
   }
 #endif
 
   NS_DECLARE_FRAME_PROPERTY(LineCursorProperty, nullptr)
   nsLineBox* GetLineCursor() {
     return (GetStateBits() & NS_BLOCK_HAS_LINE_CURSOR) ?
       static_cast<nsLineBox*>(Properties().Get(LineCursorProperty())) : nullptr;
   }
-  void SetLineCursor(nsLineBox* aCursor) {
-    Properties().Set(LineCursorProperty(), aCursor);
-    AddStateBits(NS_BLOCK_HAS_LINE_CURSOR);
-  }
 
   nsLineBox* NewLineBox(nsIFrame* aFrame, bool aIsBlock) {
     return NS_NewLineBox(PresContext()->PresShell(), aFrame, aIsBlock);
   }
   nsLineBox* NewLineBox(nsLineBox* aFromLine, nsIFrame* aFrame, int32_t aCount) {
     return NS_NewLineBox(PresContext()->PresShell(), aFromLine, aFrame, aCount);
   }
   void FreeLineBox(nsLineBox* aLine) {
new file mode 100644
--- /dev/null
+++ b/layout/generic/test/bug1174521.html
@@ -0,0 +1,14 @@
+<!DOCTYPE html>
+<html>
+  <body>
+    <div>
+      <div style="float: left; padding-top: 10px">
+        <a href="#" onclick="parent.postMessage({msg: 'DONE'}, '*'); return false;">test</a>
+      </div>
+    </div>
+    <div style="position: absolute">
+      A
+    </div>
+    B
+  </body>
+</html>
--- a/layout/generic/test/mochitest.ini
+++ b/layout/generic/test/mochitest.ini
@@ -9,16 +9,17 @@ support-files =
   plugin_clipping_helper_transformed.xhtml
   plugin_clipping_helper_table.xhtml
   plugin_clipping_lib.js
   plugin_focus_helper.html
   file_BrokenImageReference.png
   file_Dolske.png
   file_IconTestServer.sjs
   file_LoadingImageReference.png
+  bug1174521.html
 
 [test_bug240933.html]
 [test_bug263683.html]
 [test_bug288789.html]
 [test_bug290397.html]
 [test_bug323656.html]
 [test_bug344830.html]
 support-files = bug344830_testembed.svg
@@ -92,16 +93,17 @@ skip-if = buildapp == 'b2g' #Bug 931116,
 [test_bug791616.html]
 skip-if = buildapp == 'b2g' # b2g(Target should not have scrolled - got 114.10000610351562, expected 115.39999389648438) b2g-debug(Target should not have scrolled - got 114.10000610351562, expected 115.39999389648438) b2g-desktop(Target should not have scrolled - got 114.10000610351562, expected 115.39999389648438)
 [test_bug831780.html]
 [test_bug841361.html]
 [test_bug904810.html]
 [test_bug938772.html]
 [test_bug970363.html]
 [test_bug1062406.html]
+[test_bug1174521.html]
 [test_contained_plugin_transplant.html]
 skip-if = os=='win' || e10s
 [test_image_selection.html]
 [test_image_selection_2.html]
 [test_invalidate_during_plugin_paint.html]
 skip-if = buildapp == 'mulet' || buildapp == 'b2g' || toolkit == 'android' || e10s # b2g(plugins not supported) b2g-debug(plugins not supported) b2g-desktop(plugins not supported)
 [test_movement_by_characters.html]
 [test_movement_by_words.html]
new file mode 100644
--- /dev/null
+++ b/layout/generic/test/test_bug1174521.html
@@ -0,0 +1,38 @@
+<!DOCTYPE HTML>
+<html>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=1174521
+-->
+<head>
+  <title>Test for Bug 1174521</title>
+  <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+  <script type="application/javascript" src="/tests/SimpleTest/EventUtils.js"></script>
+  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
+</head>
+<body>
+<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1174521">Mozilla Bug 1174521</a>
+<div id="content">
+  <iframe src="bug1174521.html"></iframe>
+</div>
+<pre id="test">
+<script type="application/javascript">
+
+  onload = function() {
+    var iframe = document.querySelector("iframe");
+    var win = iframe.contentWindow;
+    var doc = iframe.contentDocument;
+    var link = doc.querySelector("a");
+    setTimeout(function() {
+      synthesizeMouseAtCenter(link, {}, win);
+    }, 0);
+  };
+
+  onmessage = function(e) {
+    ok(e.data.msg, "DONE", "We should be able to click the link");
+    SimpleTest.finish();
+  };
+
+</script>
+</pre>
+</body>
+</html>