Changeset 162050 in webkit


Ignore:
Timestamp:
Jan 14, 2014 10:43:39 PM (10 years ago)
Author:
mihnea@adobe.com
Message:

[CSSRegions] Incorrect repaint of fixed element with transformed parent
https://bugs.webkit.org/show_bug.cgi?id=125756

Reviewed by Simon Fraser.

Source/WebCore:

When collecting the layers for fixed positioned elements with named flow
as a containing block, use layers collection at named flow layer level
instead of relying on the positioned elements collection.

With this approach, there are situations with nested named flows laid out in
auto-height regions and thus assuming 2 step layouts, in which is enough to lay
out the inner named flow once instead of twice with a performance gain.
In such situations, the layers lists for the inner named flow are not yet updated
when collectFixedPositionedLayers is called to paint the fixed positioned layers.
Therefore I called updateLayerListsIfNeeded for all named flows layers, via the flow thread controller, before inspecting the named flow layers to avoid hitting the assertions when
accessing the named flows layers lists.

Tests: fast/regions/repaint/fixed-in-named-flow-cb-changed.html

fast/regions/repaint/fixed-in-named-flow-cb-changed2.html

  • rendering/FlowThreadController.cpp:

(WebCore::FlowThreadController::updateNamedFlowsLayerListsIfNeeded):
(WebCore::FlowThreadController::collectFixedPositionedLayers):

  • rendering/FlowThreadController.h:
  • rendering/RenderLayer.cpp:

(WebCore::RenderLayer::paintFixedLayersInNamedFlows):

LayoutTests:

Add tests for a fixed positioned element with a parent that:

  1. dynamically gets a transform, in which case the fixed positioned element should be positioned

relative to its parent

  1. dynamically loses its transform, in which case the fixed positioned element should be positioned

relative to the view.

  • fast/regions/repaint/fixed-in-named-flow-cb-changed-expected.html: Added.
  • fast/regions/repaint/fixed-in-named-flow-cb-changed.html: Added.
  • fast/regions/repaint/fixed-in-named-flow-cb-changed2-expected.html: Added.
  • fast/regions/repaint/fixed-in-named-flow-cb-changed2.html: Added.
Location:
trunk
Files:
4 added
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r162049 r162050  
     12014-01-14  Mihnea Ovidenie  <mihnea@adobe.com>
     2
     3        [CSSRegions] Incorrect repaint of fixed element with transformed parent
     4        https://bugs.webkit.org/show_bug.cgi?id=125756
     5
     6        Reviewed by Simon Fraser.
     7
     8        Add tests for a fixed positioned element with a parent that:
     9        1. dynamically gets a transform, in which case the fixed positioned element should be positioned
     10        relative to its parent
     11        2. dynamically loses its transform, in which case the fixed positioned element should be positioned
     12        relative to the view.
     13
     14        * fast/regions/repaint/fixed-in-named-flow-cb-changed-expected.html: Added.
     15        * fast/regions/repaint/fixed-in-named-flow-cb-changed.html: Added.
     16        * fast/regions/repaint/fixed-in-named-flow-cb-changed2-expected.html: Added.
     17        * fast/regions/repaint/fixed-in-named-flow-cb-changed2.html: Added.
     18
    1192014-01-14  Brent Fulgham  <bfulgham@apple.com>
    220
  • trunk/Source/WebCore/ChangeLog

    r162049 r162050  
     12014-01-14  Mihnea Ovidenie  <mihnea@adobe.com>
     2
     3        [CSSRegions] Incorrect repaint of fixed element with transformed parent
     4        https://bugs.webkit.org/show_bug.cgi?id=125756
     5
     6        Reviewed by Simon Fraser.
     7
     8        When collecting the layers for fixed positioned elements with named flow
     9        as a containing block, use layers collection at named flow layer level
     10        instead of relying on the positioned elements collection.
     11
     12        With this approach, there are situations with nested named flows laid out in
     13        auto-height regions and thus assuming 2 step layouts, in which is enough to lay
     14        out the inner named flow once instead of twice with a performance gain.
     15        In such situations, the layers lists for the inner named flow are not yet updated
     16        when collectFixedPositionedLayers is called to paint the fixed positioned layers.
     17        Therefore I called updateLayerListsIfNeeded for all named flows layers, via the flow thread controller, before inspecting the named flow layers to avoid hitting the assertions when
     18        accessing the named flows layers lists.
     19
     20        Tests: fast/regions/repaint/fixed-in-named-flow-cb-changed.html
     21               fast/regions/repaint/fixed-in-named-flow-cb-changed2.html
     22
     23        * rendering/FlowThreadController.cpp:
     24        (WebCore::FlowThreadController::updateNamedFlowsLayerListsIfNeeded):
     25        (WebCore::FlowThreadController::collectFixedPositionedLayers):
     26        * rendering/FlowThreadController.h:
     27        * rendering/RenderLayer.cpp:
     28        (WebCore::RenderLayer::paintFixedLayersInNamedFlows):
     29
    1302014-01-14  Brent Fulgham  <bfulgham@apple.com>
    231
  • trunk/Source/WebCore/rendering/FlowThreadController.cpp

    r161960 r162050  
    280280}
    281281
     282void FlowThreadController::updateNamedFlowsLayerListsIfNeeded()
     283{
     284    for (auto iter = m_renderNamedFlowThreadList->begin(), end = m_renderNamedFlowThreadList->end(); iter != end; ++iter) {
     285        RenderNamedFlowThread* flowRenderer = *iter;
     286        flowRenderer->layer()->updateLayerListsIfNeeded();
     287    }
     288}
     289
    282290static inline bool compareZIndex(RenderLayer* first, RenderLayer* second)
    283291{
     
    297305            continue;
    298306
    299         // Iterate over the fixed positioned elements in the flow thread
    300         TrackedRendererListHashSet* positionedDescendants = flowRenderer->positionedObjects();
    301         if (positionedDescendants) {
    302             for (auto it = positionedDescendants->begin(), end = positionedDescendants->end(); it != end; ++it) {
    303                 RenderBox* box = *it;
    304                 if (!box->fixedPositionedWithNamedFlowContainingBlock())
     307        RenderLayer* flowThreadLayer = flowRenderer->layer();
     308        if (Vector<RenderLayer*>* negZOrderList = flowThreadLayer->negZOrderList()) {
     309            for (size_t i = 0, size = negZOrderList->size(); i < size; ++i) {
     310                RenderLayer* currLayer = negZOrderList->at(i);
     311                if (currLayer->renderer().style().position() != FixedPosition)
    305312                    continue;
    306                 fixedPosLayers.append(box->layer());
     313                fixedPosLayers.append(currLayer);
     314            }
     315        }
     316
     317        if (Vector<RenderLayer*>* posZOrderList = flowThreadLayer->posZOrderList()) {
     318            for (size_t i = 0, size = posZOrderList->size(); i < size; ++i) {
     319                RenderLayer* currLayer = posZOrderList->at(i);
     320                if (currLayer->renderer().style().position() != FixedPosition)
     321                    continue;
     322                fixedPosLayers.append(currLayer);
    307323            }
    308324        }
  • trunk/Source/WebCore/rendering/FlowThreadController.h

    r156876 r162050  
    8181    void updateFlowThreadsIntoFinalPhase();
    8282
     83    void updateNamedFlowsLayerListsIfNeeded();
    8384    // Collect the fixed positioned layers that have the named flows as containing block
    8485    // These layers are painted and hit-tested by RenderView
  • trunk/Source/WebCore/rendering/RenderLayer.cpp

    r161960 r162050  
    40584058        return;
    40594059
     4060    // Ensure the flow threads hierarchy is up-to-date before using it.
     4061    renderer().view().flowThreadController().updateNamedFlowsLayerListsIfNeeded();
     4062
    40604063    // Collect the fixed layers in a list to be painted
    40614064    Vector<RenderLayer*> fixedLayers;
Note: See TracChangeset for help on using the changeset viewer.