- Revision
- 177128
- Author
- [email protected]
- Date
- 2014-12-10 19:29:29 -0800 (Wed, 10 Dec 2014)
Log Message
Continuously repainting large parts of Huffington Post.
https://bugs.webkit.org/show_bug.cgi?id=139468
Reviewed by Antti Koivisto.
This patch eliminates redundant repaint requests for inlines when neither the parent
block flow nor any of the inline children are dirty.
Previously,
1. simple line layout always recalculated inline content positions regardless of whether
the content needed relayout at all; as a result, it always triggered full repaint.
2. inline tree layout ignored the needslayout flag on the last line and treated it dirty
(unless it broke cleanly (<div>foo<br></div>)).
This was an ancient workaround for an editing/insert use case, but it seems not to be the case anymore.
Source/WebCore:
Tests: fast/repaint/implicitly-positioned-block-repaint-complex-line-layout.html
fast/repaint/implicitly-positioned-block-repaint-simple-line-layout.html
* rendering/RenderBlockFlow.cpp:
(WebCore::RenderBlockFlow::layoutInlineChildren):
(WebCore::RenderBlockFlow::layoutSimpleLines): Check if we need to trigger layout at all.
* rendering/RenderBlockFlow.h:
* rendering/RenderBlockLineLayout.cpp:
(WebCore::RenderBlockFlow::determineStartPosition): Remove the last line dirty hack. If it
happens to introduce regression, we should fix it at the caller site to make the line dirty.
LayoutTests:
* fast/repaint/implicitly-positioned-block-repaint-complex-line-layout-expected.txt: Added.
* fast/repaint/implicitly-positioned-block-repaint-complex-line-layout.html: Added.
* fast/repaint/implicitly-positioned-block-repaint-simple-line-layout-expected.txt: Added.
* fast/repaint/implicitly-positioned-block-repaint-simple-line-layout.html: Added.
* platform/mac/fast/line-grid/line-align-right-edges-expected.txt:
Modified Paths
Added Paths
Diff
Modified: trunk/LayoutTests/ChangeLog (177127 => 177128)
--- trunk/LayoutTests/ChangeLog 2014-12-11 03:04:58 UTC (rev 177127)
+++ trunk/LayoutTests/ChangeLog 2014-12-11 03:29:29 UTC (rev 177128)
@@ -1,3 +1,25 @@
+2014-12-10 Zalan Bujtas <[email protected]>
+
+ Continuously repainting large parts of Huffington Post.
+ https://bugs.webkit.org/show_bug.cgi?id=139468
+
+ Reviewed by Antti Koivisto.
+
+ This patch eliminates redundant repaint requests for inlines when neither the parent
+ block flow nor any of the inline children are dirty.
+ Previously,
+ 1. simple line layout always recalculated inline content positions regardless of whether
+ the content needed relayout at all; as a result, it always triggered full repaint.
+ 2. inline tree layout ignored the needslayout flag on the last line and treated it dirty
+ (unless it broke cleanly (<div>foo<br></div>)).
+ This was an ancient workaround for an editing/insert use case, but it seems not to be the case anymore.
+
+ * fast/repaint/implicitly-positioned-block-repaint-complex-line-layout-expected.txt: Added.
+ * fast/repaint/implicitly-positioned-block-repaint-complex-line-layout.html: Added.
+ * fast/repaint/implicitly-positioned-block-repaint-simple-line-layout-expected.txt: Added.
+ * fast/repaint/implicitly-positioned-block-repaint-simple-line-layout.html: Added.
+ * platform/mac/fast/line-grid/line-align-right-edges-expected.txt:
+
2014-12-10 Alexey Proskuryakov <[email protected]>
Remove expectations that were incorrectly landed in http://trac.webkit.org/changeset/176778
Added: trunk/LayoutTests/fast/repaint/implicitly-positioned-block-repaint-complex-line-layout-expected.txt (0 => 177128)
--- trunk/LayoutTests/fast/repaint/implicitly-positioned-block-repaint-complex-line-layout-expected.txt (rev 0)
+++ trunk/LayoutTests/fast/repaint/implicitly-positioned-block-repaint-complex-line-layout-expected.txt 2014-12-11 03:29:29 UTC (rev 177128)
@@ -0,0 +1,7 @@
+PASS window.internals.repaintRectsAsText().indexOf('8 541 180 18') is -1
+PASS successfullyParsed is true
+
+TEST COMPLETE
+this is scrolling and should be repainted.
+this should not be repainting
+
Added: trunk/LayoutTests/fast/repaint/implicitly-positioned-block-repaint-complex-line-layout.html (0 => 177128)
--- trunk/LayoutTests/fast/repaint/implicitly-positioned-block-repaint-complex-line-layout.html (rev 0)
+++ trunk/LayoutTests/fast/repaint/implicitly-positioned-block-repaint-complex-line-layout.html 2014-12-11 03:29:29 UTC (rev 177128)
@@ -0,0 +1,56 @@
+<html>
+<head>
+<script>jsTestIsAsync = true;</script>
+<script src=""
+
+<script>
+window._onload_ = function() {
+ if (window.internals) {
+ internals.settings.setSimpleLineLayoutEnabled(false)
+ window.internals.startTrackingRepaints();
+ }
+ setTimeout(function() {
+ document.querySelector('#scroll_inner').style.left = "100px";
+ if (!window.testRunner || !window.internals)
+ return;
+
+ shouldBe("window.internals.repaintRectsAsText().indexOf('8 541 180 18')", "-1");
+ window.internals.stopTrackingRepaints();
+ finishJSTest();
+ }, 10);
+}
+</script>
+<style>
+#scroll_container {
+ width: 200px;
+ white-space: nowrap;
+ overflow: hidden;
+ border: 1px solid black;
+}
+#scroll_inner {
+ position: relative;
+}
+
+#innocent_repaint_victim {
+ position: absolute;
+ border: 1px solid green;
+}
+</style>
+</head>
+<body>
+<div id="scroll_container">
+ <span id="scroll_inner">
+ this is scrolling and should be repainted.
+ </span>
+</div>
+
+<!-- padding 512px so we get to the next tile -->
+<div style="height: 512px;"></div>
+
+<div id="innocent_repaint_victim">
+ this should not be repainting
+</div>
+<pre id="repaints"></pre>
+</body>
+<script src=""
+</html>
Added: trunk/LayoutTests/fast/repaint/implicitly-positioned-block-repaint-simple-line-layout-expected.txt (0 => 177128)
--- trunk/LayoutTests/fast/repaint/implicitly-positioned-block-repaint-simple-line-layout-expected.txt (rev 0)
+++ trunk/LayoutTests/fast/repaint/implicitly-positioned-block-repaint-simple-line-layout-expected.txt 2014-12-11 03:29:29 UTC (rev 177128)
@@ -0,0 +1,7 @@
+PASS window.internals.repaintRectsAsText().indexOf('8 541 180 18') is -1
+PASS successfullyParsed is true
+
+TEST COMPLETE
+this is scrolling and should be repainted.
+this should not be repainting
+
Added: trunk/LayoutTests/fast/repaint/implicitly-positioned-block-repaint-simple-line-layout.html (0 => 177128)
--- trunk/LayoutTests/fast/repaint/implicitly-positioned-block-repaint-simple-line-layout.html (rev 0)
+++ trunk/LayoutTests/fast/repaint/implicitly-positioned-block-repaint-simple-line-layout.html 2014-12-11 03:29:29 UTC (rev 177128)
@@ -0,0 +1,55 @@
+<html>
+<head>
+<script>jsTestIsAsync = true;</script>
+<script src=""
+
+<script>
+window._onload_ = function() {
+ if (window.internals)
+ window.internals.startTrackingRepaints();
+
+ setTimeout(function() {
+ document.querySelector('#scroll_inner').style.left = "100px";
+ if (!window.testRunner || !window.internals)
+ return;
+
+ shouldBe("window.internals.repaintRectsAsText().indexOf('8 541 180 18')", "-1");
+ window.internals.stopTrackingRepaints();
+ finishJSTest();
+ }, 10);
+}
+</script>
+<style>
+#scroll_container {
+ width: 200px;
+ white-space: nowrap;
+ overflow: hidden;
+ border: 1px solid black;
+}
+#scroll_inner {
+ position: relative;
+}
+
+#innocent_repaint_victim {
+ position: absolute;
+ border: 1px solid green;
+}
+</style>
+</head>
+<body>
+<div id="scroll_container">
+ <span id="scroll_inner">
+ this is scrolling and should be repainted.
+ </span>
+</div>
+
+<!-- padding 512px so we get to the next tile -->
+<div style="height: 512px;"></div>
+
+<div id="innocent_repaint_victim">
+ this should not be repainting
+</div>
+<pre id="repaints"></pre>
+</body>
+<script src=""
+</html>
Modified: trunk/LayoutTests/platform/mac/fast/line-grid/line-align-right-edges-expected.txt (177127 => 177128)
--- trunk/LayoutTests/platform/mac/fast/line-grid/line-align-right-edges-expected.txt 2014-12-11 03:04:58 UTC (rev 177127)
+++ trunk/LayoutTests/platform/mac/fast/line-grid/line-align-right-edges-expected.txt 2014-12-11 03:29:29 UTC (rev 177128)
@@ -21,5 +21,5 @@
text run at (360,33) width 216: "X X X X X"
layer at (342,308) size 300x30
RenderBlock (positioned) {DIV} at (334,300) size 300x30 [bgcolor=#DDDDDD]
- RenderText {#text} at (170,3) size 120x24
- text run at (170,3) width 120: "X X X"
+ RenderText {#text} at (161,3) size 120x24
+ text run at (161,3) width 120: "X X X"
Modified: trunk/Source/WebCore/ChangeLog (177127 => 177128)
--- trunk/Source/WebCore/ChangeLog 2014-12-11 03:04:58 UTC (rev 177127)
+++ trunk/Source/WebCore/ChangeLog 2014-12-11 03:29:29 UTC (rev 177128)
@@ -1,3 +1,30 @@
+2014-12-10 Zalan Bujtas <[email protected]>
+
+ Continuously repainting large parts of Huffington Post.
+ https://bugs.webkit.org/show_bug.cgi?id=139468
+
+ Reviewed by Antti Koivisto.
+
+ This patch eliminates redundant repaint requests for inlines when neither the parent
+ block flow nor any of the inline children are dirty.
+ Previously,
+ 1. simple line layout always recalculated inline content positions regardless of whether
+ the content needed relayout at all; as a result, it always triggered full repaint.
+ 2. inline tree layout ignored the needslayout flag on the last line and treated it dirty
+ (unless it broke cleanly (<div>foo<br></div>)).
+ This was an ancient workaround for an editing/insert use case, but it seems not to be the case anymore.
+
+ Tests: fast/repaint/implicitly-positioned-block-repaint-complex-line-layout.html
+ fast/repaint/implicitly-positioned-block-repaint-simple-line-layout.html
+
+ * rendering/RenderBlockFlow.cpp:
+ (WebCore::RenderBlockFlow::layoutInlineChildren):
+ (WebCore::RenderBlockFlow::layoutSimpleLines): Check if we need to trigger layout at all.
+ * rendering/RenderBlockFlow.h:
+ * rendering/RenderBlockLineLayout.cpp:
+ (WebCore::RenderBlockFlow::determineStartPosition): Remove the last line dirty hack. If it
+ happens to introduce regression, we should fix it at the caller site to make the line dirty.
+
2014-12-10 Anders Carlsson <[email protected]>
Add an empty storage namespace provider
Modified: trunk/Source/WebCore/rendering/RenderBlockFlow.cpp (177127 => 177128)
--- trunk/Source/WebCore/rendering/RenderBlockFlow.cpp 2014-12-11 03:04:58 UTC (rev 177127)
+++ trunk/Source/WebCore/rendering/RenderBlockFlow.cpp 2014-12-11 03:29:29 UTC (rev 177128)
@@ -637,8 +637,7 @@
m_lineLayoutPath = SimpleLineLayout::canUseFor(*this) ? SimpleLinesPath : LineBoxesPath;
if (m_lineLayoutPath == SimpleLinesPath) {
- deleteLineBoxesBeforeSimpleLineLayout();
- layoutSimpleLines(repaintLogicalTop, repaintLogicalBottom);
+ layoutSimpleLines(relayoutChildren, repaintLogicalTop, repaintLogicalBottom);
return;
}
@@ -3487,18 +3486,19 @@
ASSERT_NOT_REACHED();
}
-void RenderBlockFlow::layoutSimpleLines(LayoutUnit& repaintLogicalTop, LayoutUnit& repaintLogicalBottom)
+void RenderBlockFlow::layoutSimpleLines(bool relayoutChildren, LayoutUnit& repaintLogicalTop, LayoutUnit& repaintLogicalBottom)
{
+ bool needsLayout = selfNeedsLayout() || relayoutChildren || !m_simpleLineLayout;
+ if (needsLayout) {
+ deleteLineBoxesBeforeSimpleLineLayout();
+ m_simpleLineLayout = SimpleLineLayout::create(*this);
+ }
ASSERT(!m_lineBoxes.firstLineBox());
- m_simpleLineLayout = SimpleLineLayout::create(*this);
-
LayoutUnit lineLayoutHeight = SimpleLineLayout::computeFlowHeight(*this, *m_simpleLineLayout);
LayoutUnit lineLayoutTop = borderAndPaddingBefore();
-
repaintLogicalTop = lineLayoutTop;
- repaintLogicalBottom = lineLayoutTop + lineLayoutHeight;
-
+ repaintLogicalBottom = needsLayout ? repaintLogicalTop + lineLayoutHeight : repaintLogicalTop;
setLogicalHeight(lineLayoutTop + lineLayoutHeight + borderAndPaddingAfter());
}
Modified: trunk/Source/WebCore/rendering/RenderBlockFlow.h (177127 => 177128)
--- trunk/Source/WebCore/rendering/RenderBlockFlow.h 2014-12-11 03:04:58 UTC (rev 177127)
+++ trunk/Source/WebCore/rendering/RenderBlockFlow.h 2014-12-11 03:29:29 UTC (rev 177128)
@@ -542,7 +542,7 @@
void adjustIntrinsicLogicalWidthsForColumns(LayoutUnit& minLogicalWidth, LayoutUnit& maxLogicalWidth) const;
void layoutLineBoxes(bool relayoutChildren, LayoutUnit& repaintLogicalTop, LayoutUnit& repaintLogicalBottom);
- void layoutSimpleLines(LayoutUnit& repaintLogicalTop, LayoutUnit& repaintLogicalBottom);
+ void layoutSimpleLines(bool relayoutChildren, LayoutUnit& repaintLogicalTop, LayoutUnit& repaintLogicalBottom);
virtual std::unique_ptr<RootInlineBox> createRootInlineBox(); // Subclassed by RenderSVGText.
InlineFlowBox* createLineBoxes(RenderObject*, const LineInfo&, InlineBox* childBox);
Modified: trunk/Source/WebCore/rendering/RenderBlockLineLayout.cpp (177127 => 177128)
--- trunk/Source/WebCore/rendering/RenderBlockLineLayout.cpp 2014-12-11 03:04:58 UTC (rev 177127)
+++ trunk/Source/WebCore/rendering/RenderBlockLineLayout.cpp 2014-12-11 03:29:29 UTC (rev 177128)
@@ -1625,13 +1625,7 @@
curr = prevRootBox;
}
}
- } else {
- // No dirty lines were found.
- // If the last line didn't break cleanly, treat it as dirty.
- if (lastRootBox() && !lastRootBox()->endsWithBreak())
- curr = lastRootBox();
}
-
// If we have no dirty lines, then last is just the last root box.
last = curr ? curr->prevRootBox() : lastRootBox();
}