⚠ Archived content — this site is no longer maintained.   Current WebKit documentation is at docs.webkit.org.

Changeset 177128 in webkit


Ignore:
Timestamp:
Dec 10, 2014, 7:29:29 PM (12 years ago)
Author:
Alan Bujtas
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.

  1. 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:
Location:
trunk
Files:
4 added
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r177122 r177128  
     12014-12-10  Zalan Bujtas  <zalan@apple.com>
     2
     3        Continuously repainting large parts of Huffington Post.
     4        https://bugs.webkit.org/show_bug.cgi?id=139468
     5
     6        Reviewed by Antti Koivisto.
     7
     8        This patch eliminates redundant repaint requests for inlines when neither the parent
     9        block flow nor any of the inline children are dirty.
     10        Previously,
     11        1. simple line layout always recalculated inline content positions regardless of whether
     12        the content needed relayout at all; as a result, it always triggered full repaint.
     13        2. inline tree layout ignored the needslayout flag on the last line and treated it dirty
     14        (unless it broke cleanly (<div>foo<br></div>)).
     15        This was an ancient workaround for an editing/insert use case, but it seems not to be the case anymore.
     16
     17        * fast/repaint/implicitly-positioned-block-repaint-complex-line-layout-expected.txt: Added.
     18        * fast/repaint/implicitly-positioned-block-repaint-complex-line-layout.html: Added.
     19        * fast/repaint/implicitly-positioned-block-repaint-simple-line-layout-expected.txt: Added.
     20        * fast/repaint/implicitly-positioned-block-repaint-simple-line-layout.html: Added.
     21        * platform/mac/fast/line-grid/line-align-right-edges-expected.txt:
     22
    1232014-12-10  Alexey Proskuryakov  <ap@apple.com>
    224
  • trunk/LayoutTests/platform/mac/fast/line-grid/line-align-right-edges-expected.txt

    r109267 r177128  
    2222layer at (342,308) size 300x30
    2323  RenderBlock (positioned) {DIV} at (334,300) size 300x30 [bgcolor=#DDDDDD]
    24     RenderText {#text} at (170,3) size 120x24
    25       text run at (170,3) width 120: "X X X"
     24    RenderText {#text} at (161,3) size 120x24
     25      text run at (161,3) width 120: "X X X"
  • trunk/Source/WebCore/ChangeLog

    r177126 r177128  
     12014-12-10  Zalan Bujtas  <zalan@apple.com>
     2
     3        Continuously repainting large parts of Huffington Post.
     4        https://bugs.webkit.org/show_bug.cgi?id=139468
     5
     6        Reviewed by Antti Koivisto.
     7
     8        This patch eliminates redundant repaint requests for inlines when neither the parent
     9        block flow nor any of the inline children are dirty.
     10        Previously,
     11        1. simple line layout always recalculated inline content positions regardless of whether
     12        the content needed relayout at all; as a result, it always triggered full repaint.
     13        2. inline tree layout ignored the needslayout flag on the last line and treated it dirty
     14        (unless it broke cleanly (<div>foo<br></div>)).
     15        This was an ancient workaround for an editing/insert use case, but it seems not to be the case anymore.
     16
     17        Tests: fast/repaint/implicitly-positioned-block-repaint-complex-line-layout.html
     18               fast/repaint/implicitly-positioned-block-repaint-simple-line-layout.html
     19
     20        * rendering/RenderBlockFlow.cpp:
     21        (WebCore::RenderBlockFlow::layoutInlineChildren):
     22        (WebCore::RenderBlockFlow::layoutSimpleLines): Check if we need to trigger layout at all.
     23        * rendering/RenderBlockFlow.h:
     24        * rendering/RenderBlockLineLayout.cpp:
     25        (WebCore::RenderBlockFlow::determineStartPosition): Remove the last line dirty hack. If it
     26        happens to introduce regression, we should fix it at the caller site to make the line dirty.
     27
    1282014-12-10  Anders Carlsson  <andersca@apple.com>
    229
  • trunk/Source/WebCore/rendering/RenderBlockFlow.cpp

    r177049 r177128  
    638638
    639639    if (m_lineLayoutPath == SimpleLinesPath) {
    640         deleteLineBoxesBeforeSimpleLineLayout();
    641         layoutSimpleLines(repaintLogicalTop, repaintLogicalBottom);
     640        layoutSimpleLines(relayoutChildren, repaintLogicalTop, repaintLogicalBottom);
    642641        return;
    643642    }
     
    34883487}
    34893488
    3490 void RenderBlockFlow::layoutSimpleLines(LayoutUnit& repaintLogicalTop, LayoutUnit& repaintLogicalBottom)
    3491 {
     3489void RenderBlockFlow::layoutSimpleLines(bool relayoutChildren, LayoutUnit& repaintLogicalTop, LayoutUnit& repaintLogicalBottom)
     3490{
     3491    bool needsLayout = selfNeedsLayout() || relayoutChildren || !m_simpleLineLayout;
     3492    if (needsLayout) {
     3493        deleteLineBoxesBeforeSimpleLineLayout();
     3494        m_simpleLineLayout = SimpleLineLayout::create(*this);
     3495    }
    34923496    ASSERT(!m_lineBoxes.firstLineBox());
    3493 
    3494     m_simpleLineLayout = SimpleLineLayout::create(*this);
    34953497
    34963498    LayoutUnit lineLayoutHeight = SimpleLineLayout::computeFlowHeight(*this, *m_simpleLineLayout);
    34973499    LayoutUnit lineLayoutTop = borderAndPaddingBefore();
    3498 
    34993500    repaintLogicalTop = lineLayoutTop;
    3500     repaintLogicalBottom = lineLayoutTop + lineLayoutHeight;
    3501 
     3501    repaintLogicalBottom = needsLayout ? repaintLogicalTop + lineLayoutHeight : repaintLogicalTop;
    35023502    setLogicalHeight(lineLayoutTop + lineLayoutHeight + borderAndPaddingAfter());
    35033503}
  • trunk/Source/WebCore/rendering/RenderBlockFlow.h

    r177021 r177128  
    543543
    544544    void layoutLineBoxes(bool relayoutChildren, LayoutUnit& repaintLogicalTop, LayoutUnit& repaintLogicalBottom);
    545     void layoutSimpleLines(LayoutUnit& repaintLogicalTop, LayoutUnit& repaintLogicalBottom);
     545    void layoutSimpleLines(bool relayoutChildren, LayoutUnit& repaintLogicalTop, LayoutUnit& repaintLogicalBottom);
    546546
    547547    virtual std::unique_ptr<RootInlineBox> createRootInlineBox(); // Subclassed by RenderSVGText.
  • trunk/Source/WebCore/rendering/RenderBlockLineLayout.cpp

    r174875 r177128  
    16261626                }
    16271627            }
    1628         } else {
    1629             // No dirty lines were found.
    1630             // If the last line didn't break cleanly, treat it as dirty.
    1631             if (lastRootBox() && !lastRootBox()->endsWithBreak())
    1632                 curr = lastRootBox();
    1633         }
    1634 
     1628        }
    16351629        // If we have no dirty lines, then last is just the last root box.
    16361630        last = curr ? curr->prevRootBox() : lastRootBox();
Note: See TracChangeset for help on using the changeset viewer.