Changeset 168363 in webkit


Ignore:
Timestamp:
May 6, 2014 10:30:40 AM (10 years ago)
Author:
abucur@adobe.com
Message:

[CSS Regions] Optimize the number of regions invalidations
https://bugs.webkit.org/show_bug.cgi?id=132611

Reviewed by David Hyatt.

Source/WebCore:
It is possible to invalidate the region chain of a flow thread
during the layout of the region when its height is not final.

This patch places the check after the height of the region
is determined, reducing the number of invalidations.

Tests: Less invalidations and repaints in the repaint tests for
the flow threads.

  • rendering/RenderBlockFlow.cpp:

(WebCore::RenderBlockFlow::updateLogicalHeight):

  • rendering/RenderNamedFlowFragment.cpp:

(WebCore::RenderNamedFlowFragment::layoutBlock):
(WebCore::RenderNamedFlowFragment::invalidateRegionIfNeeded):

  • rendering/RenderNamedFlowFragment.h:

LayoutTests:
Because there are less region invalidations there are less repaints
of the flow threads.

  • fast/regions/repaint/repaint-regions-overflow-expected.txt:
Location:
trunk
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r168360 r168363  
     12014-05-06  Andrei Bucur  <abucur@adobe.com>
     2
     3        [CSS Regions] Optimize the number of regions invalidations
     4        https://bugs.webkit.org/show_bug.cgi?id=132611
     5
     6        Reviewed by David Hyatt.
     7
     8        Because there are less region invalidations there are less repaints
     9        of the flow threads.
     10
     11        * fast/regions/repaint/repaint-regions-overflow-expected.txt:
     12
    1132014-05-06  Chris Fleizach  <cfleizach@apple.com>
    214
  • trunk/LayoutTests/fast/regions/repaint/repaint-regions-overflow-expected.txt

    r163021 r168363  
    77(repaint rects
    88  (rect 106 306 300 160)
    9   (rect 14 72 300 210)
    10   (rect 106 122 300 210)
    11   (rect 14 298 300 18)
    12   (rect 106 348 300 18)
    139  (rect 14 56 300 260)
    1410  (rect 106 106 300 260)
     
    1713  (rect 14 56 300 260)
    1814  (rect 106 106 300 260)
    19   (rect 14 56 300 260)
    20   (rect 106 106 300 260)
    2115)
    2216
  • trunk/Source/WebCore/ChangeLog

    r168362 r168363  
     12014-05-06  Andrei Bucur  <abucur@adobe.com>
     2
     3        [CSS Regions] Optimize the number of regions invalidations
     4        https://bugs.webkit.org/show_bug.cgi?id=132611
     5
     6        Reviewed by David Hyatt.
     7
     8        It is possible to invalidate the region chain of a flow thread
     9        during the layout of the region when its height is not final.
     10
     11        This patch places the check after the height of the region
     12        is determined, reducing the number of invalidations.
     13
     14        Tests: Less invalidations and repaints in the repaint tests for
     15        the flow threads.
     16
     17        * rendering/RenderBlockFlow.cpp:
     18        (WebCore::RenderBlockFlow::updateLogicalHeight):
     19        * rendering/RenderNamedFlowFragment.cpp:
     20        (WebCore::RenderNamedFlowFragment::layoutBlock):
     21        (WebCore::RenderNamedFlowFragment::invalidateRegionIfNeeded):
     22        * rendering/RenderNamedFlowFragment.h:
     23
    1242014-05-03  Sam Weinig  <sam@webkit.org>
    225
  • trunk/Source/WebCore/rendering/RenderBlockFlow.cpp

    r167870 r168363  
    29262926    RenderBlock::updateLogicalHeight();
    29272927
    2928     if (renderNamedFlowFragment())
     2928    if (renderNamedFlowFragment()) {
    29292929        renderNamedFlowFragment()->setLogicalHeight(std::max<LayoutUnit>(0, logicalHeight() - borderAndPaddingLogicalHeight()));
     2930        renderNamedFlowFragment()->invalidateRegionIfNeeded();
     2931    }
    29302932}
    29312933
  • trunk/Source/WebCore/rendering/RenderNamedFlowFragment.cpp

    r168306 r168363  
    263263
    264264    if (isValid()) {
    265         LayoutRect oldRegionRect(flowThreadPortionRect());
    266         if (!isHorizontalWritingMode())
    267             oldRegionRect = oldRegionRect.transposedRect();
    268 
    269265        if (m_flowThread->inOverflowLayoutPhase() || m_flowThread->inFinalLayoutPhase()) {
    270266            computeOverflowFromFlowThread();
     
    277273            return;
    278274        }
    279 
    280         if ((oldRegionRect.width() != pageLogicalWidth() || oldRegionRect.height() != pageLogicalHeight()) && !m_flowThread->inFinalLayoutPhase()) {
    281             // This can happen even if we are in the inConstrainedLayoutPhase and it will trigger a pathological layout of the flow thread.
    282             m_flowThread->invalidateRegions();
    283         }
     275    }
     276}
     277
     278void RenderNamedFlowFragment::invalidateRegionIfNeeded()
     279{
     280    if (!isValid())
     281        return;
     282
     283    LayoutRect oldRegionRect(flowThreadPortionRect());
     284    if (!isHorizontalWritingMode())
     285        oldRegionRect = oldRegionRect.transposedRect();
     286
     287    if ((oldRegionRect.width() != pageLogicalWidth() || oldRegionRect.height() != pageLogicalHeight()) && !m_flowThread->inFinalLayoutPhase()) {
     288        // This can happen even if we are in the inConstrainedLayoutPhase and it will trigger a pathological layout of the flow thread.
     289        m_flowThread->invalidateRegions();
    284290    }
    285291}
  • trunk/Source/WebCore/rendering/RenderNamedFlowFragment.h

    r167930 r168363  
    119119    virtual void absoluteQuadsForBoxInRegion(Vector<FloatQuad>&, bool*, const RenderBox*, float, float) override;
    120120
     121    void invalidateRegionIfNeeded();
     122
    121123private:
    122124    virtual const char* renderName() const override { return "RenderNamedFlowFragment"; }
Note: See TracChangeset for help on using the changeset viewer.