Bug 847130 - Do DestroyOverflowLines() if the last line was removed instead of always RemoveOverflowLines() and SetOverflowLines() when there's lines remaining. r=dbaron, a=bajaj
authorMats Palmgren <matspal@gmail.com>
Mon, 04 Mar 2013 00:46:56 +0100
changeset 127712 a932e85257c342a62d5f15a28af11dfbbc56548c
parent 127711 460c676949cef52da2cf6590543d4e7ca67136b9
child 127713 e9fc89ba0f15888d7bc2c17875480396627379e5
push id2258
push userryanvm@gmail.com
push dateMon, 11 Mar 2013 20:43:26 +0000
treeherdermozilla-beta@a932e85257c3 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersdbaron, bajaj
bugs847130
milestone20.0
Bug 847130 - Do DestroyOverflowLines() if the last line was removed instead of always RemoveOverflowLines() and SetOverflowLines() when there's lines remaining. r=dbaron, a=bajaj
layout/generic/crashtests/847130.xhtml
layout/generic/crashtests/crashtests.list
layout/generic/nsBlockFrame.cpp
new file mode 100644
--- /dev/null
+++ b/layout/generic/crashtests/847130.xhtml
@@ -0,0 +1,15 @@
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<script>
+
+function boom()
+{
+  document.getElementById("x").appendChild(document.createElementNS("http://www.w3.org/1999/xhtml", "span"));
+}
+
+</script>
+</head>
+<body onload="boom();">
+<div style="-moz-column-count: 15;"><div style="-moz-column-count: 15;" id="x"><td style="display: block; height: 2.5em;"></td></div></div>
+</body>
+</html>
--- a/layout/generic/crashtests/crashtests.list
+++ b/layout/generic/crashtests/crashtests.list
@@ -395,8 +395,9 @@ test-pref(layout.css.flexbox.enabled,tru
 load 762764-1.html
 load 786740-1.html
 asserts(12) test-pref(layout.css.flexbox.enabled,true) load 798020-1.html
 test-pref(layout.css.flexbox.enabled,true) load 798235-1.html
 test-pref(layout.css.flexbox.enabled,true) load 799207-1.html
 asserts(12) test-pref(layout.css.flexbox.enabled,true) load 799207-2.html
 test-pref(layout.css.flexbox.enabled,true) load 804089-1.xhtml
 load 840818.html
+load 847130.xhtml
--- a/layout/generic/nsBlockFrame.cpp
+++ b/layout/generic/nsBlockFrame.cpp
@@ -5423,23 +5423,20 @@ nsBlockFrame::DoRemoveFrame(nsIFrame* aD
         // cases...
 #ifdef NOISY_BLOCK_INVALIDATE
         nsRect visOverflow(cur->GetVisualOverflowArea());
         printf("%p invalidate 10 (%d, %d, %d, %d)\n",
                this, visOverflow.x, visOverflow.y,
                visOverflow.width, visOverflow.height);
 #endif
       } else {
-        // XXX update searchingOverflowList directly, remove only when empty
-        FrameLines* overflowLines = RemoveOverflowLines();
         line = overflowLines->mLines.erase(line);
-        if (!overflowLines->mLines.empty()) {
-          SetOverflowLines(overflowLines);
-        } else {
-          delete overflowLines;
+        if (overflowLines->mLines.empty()) {
+          DestroyOverflowLines();
+          overflowLines = nullptr;
           // We just invalidated our iterators.  Since we were in
           // the overflow lines list, which is now empty, set them
           // so we're at the end of the regular line list.
           line_start = mLines.begin();
           line_end = mLines.end();
           line = line_end;
         }
       }
@@ -5564,24 +5561,21 @@ nsBlockFrame::StealFrame(nsPresContext* 
         // Register removal with the line boxes
         line->NoteFrameRemoved(frame);
         if (line->GetChildCount() > 0) {
            line->MarkDirty();
         } else {
           // Remove the line box
           nsLineBox* lineBox = line;
           if (searchingOverflowList) {
-            // Erase line, but avoid making the overflow line list empty
-            // XXX update overflowLines directly, remove only when empty
-            RemoveOverflowLines();
+            // Erase the line, destroy the property if it was the last one.
             line = overflowLines->mLines.erase(line);
-            if (!overflowLines->mLines.empty()) {
-              SetOverflowLines(overflowLines);
-            } else {
-              delete overflowLines;
+            if (overflowLines->mLines.empty()) {
+              DestroyOverflowLines();
+              overflowLines = nullptr;
               // We just invalidated our iterators.  Since we were in
               // the overflow lines list, which is now empty, set them
               // so we're at the end of the regular line list.
               line_start = mLines.begin();
               line_end = mLines.end();
               line = line_end;
             }
           } else {