Changeset 154973 in webkit


Ignore:
Timestamp:
Sep 3, 2013 1:21:16 AM (11 years ago)
Author:
mihnea@adobe.com
Message:

[CSS Regions] position: fixed is computed relative to the first region, not the viewport
https://bugs.webkit.org/show_bug.cgi?id=111176

Reviewed by David Hyatt.

Source/WebCore:

Fixed positioned elements inside a named flow should be positioned and sized relative to the viewport,
not on the first region, as described in the spec: http://dev.w3.org/csswg/css-regions/#the-flow-into-property.
While the flow thread will still act as containing block for the fixed positioned elements, the painting and hit
testing for the fixed positioned elements is done by RenderView. The layers for the fixed positioned elements
are collected by the flow thread.

Tests: fast/regions/element-in-named-flow-absolute-from-fixed.html

fast/regions/element-in-named-flow-fixed-from-absolute.html
fast/regions/element-inflow-fixed-from-outflow-static.html
fast/regions/element-outflow-static-from-inflow-fixed.html
fast/regions/fixed-element-transformed-parent.html
fast/regions/fixed-in-named-flow-scroll.html
fast/regions/fixed-inside-fixed-in-named-flow.html
fast/regions/fixed-inside-named-flow-zIndex.html
fast/regions/fixed-pos-elem-in-namedflow-noregions.html
fast/regions/fixed-pos-region-in-nested-flow.html

  • rendering/FlowThreadController.cpp:

(WebCore::FlowThreadController::collectFixedPositionedLayers):
Return the list of layers for the fixed positioned elements with named flows as containing blocks.
Used in RenderLayer:: paintFixedLayersInNamedFlows and RenderLayer:: hitTestFixedLayersInNamedFlows.

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

(WebCore::RenderBox::mapLocalToContainer):
(WebCore::RenderBox::containingBlockLogicalWidthForPositioned):
(WebCore::RenderBox::containingBlockLogicalHeightForPositioned):
For fixed positioned elements, width and height are given by the view instead of the first region.

  • rendering/RenderLayer.cpp:

(WebCore::accumulateOffsetTowardsAncestor):
Modified for the fixed positioned elements inside named flows with the named flows as containing block
to take into account the view scroll.
(WebCore::compareZIndex):
Moved upwards because it is used in RenderLayer::paintFixedLayersInNamedFlows.
(WebCore::RenderLayer::paintFixedLayersInNamedFlows):
Paint the list of fixed layers directly from the RenderView instead of painting them through regions -> named flows.
(WebCore::RenderLayer::paintLayerContents):
(WebCore::RenderLayer::paintList):
(WebCore::RenderLayer::hitTestFixedLayersInNamedFlows):
Hit test the layers for the fix positioned elements inside named flows from the RenderView layer
instead of the region -> named flow layer.
(WebCore::RenderLayer::hitTestLayer):
(WebCore::RenderLayer::calculateRects):

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

(WebCore::RenderLayerCompositor::updateLayerTreeGeometry):
We do not support yet the accelerated compositing for elements in named flows,
so bail out early here. We need to revisit fixed elements once we finish accelerated compositing for elements in named flows.

  • rendering/RenderObject.cpp:

(WebCore::RenderObject::fixedPositionedWithNamedFlowContainingBlock):
(WebCore::hasFixedPosInNamedFlowContainingBlock):
(WebCore::RenderObject::containerForRepaint):
Changed to take into account that RenderView should be the repaintContainer for the
fixed positioned elements with named flow as the containing block.

  • rendering/RenderObject.h:

LayoutTests:

Added new tests and changed the existing ones that were relying on incorrect positioning
for fixed elements.

  • fast/regions/element-in-named-flow-absolute-from-fixed-expected.txt: Added.
  • fast/regions/element-in-named-flow-absolute-from-fixed.html: Added.
  • fast/regions/element-in-named-flow-fixed-from-absolute-expected.txt: Added.
  • fast/regions/element-in-named-flow-fixed-from-absolute.html: Added.
  • fast/regions/element-inflow-fixed-from-outflow-static-expected.txt: Added.
  • fast/regions/element-inflow-fixed-from-outflow-static.html: Added.
  • fast/regions/element-outflow-static-from-inflow-fixed-expected.txt: Added.
  • fast/regions/element-outflow-static-from-inflow-fixed.html: Added.
  • fast/regions/fixed-element-transformed-parent-expected.txt: Added.
  • fast/regions/fixed-element-transformed-parent.html: Added.
  • fast/regions/fixed-in-named-flow-scroll-expected.txt: Added.
  • fast/regions/fixed-in-named-flow-scroll.html: Added.
  • fast/regions/fixed-inside-fixed-in-named-flow-expected.html: Added.
  • fast/regions/fixed-inside-fixed-in-named-flow.html: Added.
  • fast/regions/fixed-inside-named-flow-zIndex-expected.html: Added.
  • fast/regions/fixed-inside-named-flow-zIndex.html: Added.
  • fast/regions/fixed-pos-elem-in-namedflow-noregions-expected.html: Added.
  • fast/regions/fixed-pos-elem-in-namedflow-noregions.html: Added.
  • fast/regions/fixed-pos-elem-in-region-expected.html:
  • fast/regions/fixed-pos-elem-in-region.html:
  • fast/regions/fixed-pos-region-in-nested-flow-expected.html: Added.
  • fast/regions/fixed-pos-region-in-nested-flow.html: Added.
Location:
trunk
Files:
20 added
12 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r154960 r154973  
     12013-09-03  Mihnea Ovidenie  <mihnea@adobe.com>
     2
     3        [CSS Regions] position: fixed is computed relative to the first region, not the viewport
     4        https://bugs.webkit.org/show_bug.cgi?id=111176
     5
     6        Reviewed by David Hyatt.
     7
     8        Added new tests and changed the existing ones that were relying on incorrect positioning
     9        for fixed elements.
     10
     11        * fast/regions/element-in-named-flow-absolute-from-fixed-expected.txt: Added.
     12        * fast/regions/element-in-named-flow-absolute-from-fixed.html: Added.
     13        * fast/regions/element-in-named-flow-fixed-from-absolute-expected.txt: Added.
     14        * fast/regions/element-in-named-flow-fixed-from-absolute.html: Added.
     15        * fast/regions/element-inflow-fixed-from-outflow-static-expected.txt: Added.
     16        * fast/regions/element-inflow-fixed-from-outflow-static.html: Added.
     17        * fast/regions/element-outflow-static-from-inflow-fixed-expected.txt: Added.
     18        * fast/regions/element-outflow-static-from-inflow-fixed.html: Added.
     19        * fast/regions/fixed-element-transformed-parent-expected.txt: Added.
     20        * fast/regions/fixed-element-transformed-parent.html: Added.
     21        * fast/regions/fixed-in-named-flow-scroll-expected.txt: Added.
     22        * fast/regions/fixed-in-named-flow-scroll.html: Added.
     23        * fast/regions/fixed-inside-fixed-in-named-flow-expected.html: Added.
     24        * fast/regions/fixed-inside-fixed-in-named-flow.html: Added.
     25        * fast/regions/fixed-inside-named-flow-zIndex-expected.html: Added.
     26        * fast/regions/fixed-inside-named-flow-zIndex.html: Added.
     27        * fast/regions/fixed-pos-elem-in-namedflow-noregions-expected.html: Added.
     28        * fast/regions/fixed-pos-elem-in-namedflow-noregions.html: Added.
     29        * fast/regions/fixed-pos-elem-in-region-expected.html:
     30        * fast/regions/fixed-pos-elem-in-region.html:
     31        * fast/regions/fixed-pos-region-in-nested-flow-expected.html: Added.
     32        * fast/regions/fixed-pos-region-in-nested-flow.html: Added.
     33
    1342013-09-02  Anton Obzhirov  <a.obzhirov@samsung.com>
    235
  • trunk/LayoutTests/fast/regions/fixed-pos-elem-in-region-expected.html

    r121557 r154973  
    33    <head>
    44        <style>
    5             #green { position: fixed; width: 50px; height: 50px; top: 125px; left: 75px; background-color: green; }
     5            #green { position: fixed; width: 20%; height: 20%; top: 150px; left: 125px; background-color: green; }
    66        </style>
    77    </head>
     
    99        <p>Test for <a href="https://bugs.webkit.org/show_bug.cgi?id=88133">WebKit Bug 88133</a> Collecting a fixed positioned element in a named flow causes WebKit to crash.</p>
    1010        <p>This test collects a fixed position element inside a named flow and flows it into a region.</p>
     11        <p>The fixed positioned element should be positioned and sized relative to the viewport.</p>
    1112        <p>The test passes if it does not crash or assert and there is no red rectangle visible.</p>
    1213        <div id="green"></div>
  • trunk/LayoutTests/fast/regions/fixed-pos-elem-in-region.html

    r121557 r154973  
    33    <head>
    44        <style>
    5             #red { position: fixed; width: 50px; height: 50px; top: 125px; left: 75px; background-color: red; }
    6             #fixed { -webkit-flow-into: flow; position: fixed; width: 50px; height: 50px; background-color: green; top: 25px; left: 25px; }
    7             #region { -webkit-flow-from: flow; width: 100px; height: 100px; position: absolute; top: 100px; left: 50px; }
     5            #red { position: absolute; width: 20%; height: 20%; top: 150px; left: 125px; background-color: red; }
     6            #fixed { -webkit-flow-into: flow; position: fixed; width: 20%; height: 20%; background-color: green; top: 150px; left: 125px; }
     7            #region { -webkit-flow-from: flow; width: 200px; height: 200px; position: absolute; top: 150px; left: 150px; }
    88        </style>
    99    </head>
     
    1111        <p>Test for <a href="https://bugs.webkit.org/show_bug.cgi?id=88133">WebKit Bug 88133</a> Collecting a fixed positioned element in a named flow causes WebKit to crash.</p>
    1212        <p>This test collects a fixed position element inside a named flow and flows it into a region.</p>
     13        <p>The fixed positioned element should be positioned and sized relative to the viewport.</p>
    1314        <p>The test passes if it does not crash or assert and there is no red rectangle visible.</p>
    1415        <div id="red"></div>
  • trunk/Source/WebCore/ChangeLog

    r154971 r154973  
     12013-09-03  Mihnea Ovidenie  <mihnea@adobe.com>
     2
     3        [CSS Regions] position: fixed is computed relative to the first region, not the viewport
     4        https://bugs.webkit.org/show_bug.cgi?id=111176
     5
     6        Reviewed by David Hyatt.
     7
     8        Fixed positioned elements inside a named flow should be positioned and sized relative to the viewport,
     9        not on the first region, as described in the spec: http://dev.w3.org/csswg/css-regions/#the-flow-into-property.
     10        While the flow thread will still act as containing block for the fixed positioned elements, the painting and hit
     11        testing for the fixed positioned elements is done by RenderView. The layers for the fixed positioned elements
     12        are collected by the flow thread.
     13 
     14        Tests: fast/regions/element-in-named-flow-absolute-from-fixed.html
     15               fast/regions/element-in-named-flow-fixed-from-absolute.html
     16               fast/regions/element-inflow-fixed-from-outflow-static.html
     17               fast/regions/element-outflow-static-from-inflow-fixed.html
     18               fast/regions/fixed-element-transformed-parent.html
     19               fast/regions/fixed-in-named-flow-scroll.html
     20               fast/regions/fixed-inside-fixed-in-named-flow.html
     21               fast/regions/fixed-inside-named-flow-zIndex.html
     22               fast/regions/fixed-pos-elem-in-namedflow-noregions.html
     23               fast/regions/fixed-pos-region-in-nested-flow.html
     24
     25        * rendering/FlowThreadController.cpp:
     26        (WebCore::FlowThreadController::collectFixedPositionedLayers):
     27        Return the list of layers for the fixed positioned elements with named flows as containing blocks.
     28        Used in RenderLayer:: paintFixedLayersInNamedFlows and RenderLayer:: hitTestFixedLayersInNamedFlows.
     29        * rendering/FlowThreadController.h:
     30        * rendering/RenderBox.cpp:
     31        (WebCore::RenderBox::mapLocalToContainer):
     32        (WebCore::RenderBox::containingBlockLogicalWidthForPositioned):
     33        (WebCore::RenderBox::containingBlockLogicalHeightForPositioned):
     34        For fixed positioned elements, width and height are given by the view instead of the first region.
     35        * rendering/RenderLayer.cpp:
     36        (WebCore::accumulateOffsetTowardsAncestor):
     37        Modified for the fixed positioned elements inside named flows with the named flows as containing block
     38        to take into account the view scroll.
     39        (WebCore::compareZIndex):
     40        Moved upwards because it is used in RenderLayer::paintFixedLayersInNamedFlows.
     41        (WebCore::RenderLayer::paintFixedLayersInNamedFlows):
     42        Paint the list of fixed layers directly from the RenderView instead of painting them through regions -> named flows.
     43        (WebCore::RenderLayer::paintLayerContents):
     44        (WebCore::RenderLayer::paintList):
     45        (WebCore::RenderLayer::hitTestFixedLayersInNamedFlows):
     46        Hit test the layers for the fix positioned elements inside named flows from the RenderView layer
     47        instead of the region -> named flow layer.
     48        (WebCore::RenderLayer::hitTestLayer):
     49        (WebCore::RenderLayer::calculateRects):
     50        * rendering/RenderLayer.h:
     51        * rendering/RenderLayerCompositor.cpp:
     52        (WebCore::RenderLayerCompositor::updateLayerTreeGeometry):
     53        We do not support yet the accelerated compositing for elements in named flows,
     54        so bail out early here. We need to revisit fixed elements once we finish accelerated compositing for elements in named flows.
     55        * rendering/RenderObject.cpp:
     56        (WebCore::RenderObject::fixedPositionedWithNamedFlowContainingBlock):
     57        (WebCore::hasFixedPosInNamedFlowContainingBlock):
     58        (WebCore::RenderObject::containerForRepaint):
     59        Changed to take into account that RenderView should be the repaintContainer for the
     60        fixed positioned elements with named flow as the containing block.
     61        * rendering/RenderObject.h:
     62
    1632013-09-03  Arvid Nilsson  <anilsson@rim.com>
    264
  • trunk/Source/WebCore/rendering/FlowThreadController.cpp

    r154580 r154973  
    3434#include "NamedFlowCollection.h"
    3535#include "RenderFlowThread.h"
     36#include "RenderLayer.h"
    3637#include "RenderNamedFlowThread.h"
    3738#include "StyleInheritedData.h"
     
    283284}
    284285
     286// Collect the fixed positioned layers that have the named flows as containing block
     287// These layers are painted and hit-tested starting from RenderView not from regions.
     288void FlowThreadController::collectFixedPositionedLayers(Vector<RenderLayer*>& fixedPosLayers) const
     289{
     290    for (RenderNamedFlowThreadList::const_iterator iter = m_renderNamedFlowThreadList->begin(); iter != m_renderNamedFlowThreadList->end(); ++iter) {
     291        RenderNamedFlowThread* flowRenderer = *iter;
     292
     293        // If the named flow does not have any regions attached, a fixed element should not be
     294        // displayed even if the fixed element is positioned/sized by the viewport.
     295        if (!flowRenderer->hasRegions())
     296            continue;
     297
     298        // Iterate over the fixed positioned elements in the flow thread
     299        TrackedRendererListHashSet* positionedDescendants = flowRenderer->positionedObjects();
     300        if (positionedDescendants) {
     301            TrackedRendererListHashSet::iterator end = positionedDescendants->end();
     302            for (TrackedRendererListHashSet::iterator it = positionedDescendants->begin(); it != end; ++it) {
     303                RenderBox* box = *it;
     304                if (!box->fixedPositionedWithNamedFlowContainingBlock())
     305                    continue;
     306                fixedPosLayers.append(box->layer());
     307            }
     308        }
     309    }
     310}
     311
    285312#ifndef NDEBUG
    286313bool FlowThreadController::isAutoLogicalHeightRegionsCountConsistent() const
  • trunk/Source/WebCore/rendering/FlowThreadController.h

    r154200 r154973  
    3838
    3939class RenderFlowThread;
     40class RenderLayer;
    4041class RenderNamedFlowThread;
    4142
     
    8081    void updateFlowThreadsIntoFinalPhase();
    8182
     83    // Collect the fixed positioned layers that have the named flows as containing block
     84    // These layers are painted and hit-tested by RenderView
     85    void collectFixedPositionedLayers(Vector<RenderLayer*>& fixedPosLayers) const;
     86
    8287#if USE(ACCELERATED_COMPOSITING)
    8388    void updateRenderFlowThreadLayersIfNeeded();
  • trunk/Source/WebCore/rendering/RenderBox.cpp

    r154937 r154973  
    18401840    mode &= ~ApplyContainerFlip;
    18411841
    1842     o->mapLocalToContainer(repaintContainer, transformState, mode, wasFixed);
     1842    // For fixed positioned elements inside out-of-flow named flows, we do not want to
     1843    // map their position further to regions based on their coordinates inside the named flows.
     1844    if (!o->isOutOfFlowRenderFlowThread() || !fixedPositionedWithNamedFlowContainingBlock())
     1845        o->mapLocalToContainer(repaintContainer, transformState, mode, wasFixed);
     1846    else
     1847        o->mapLocalToContainer(toRenderLayerModelObject(o), transformState, mode, wasFixed);
    18431848}
    18441849
     
    29682973            return toRenderBox(containingBlock)->clientLogicalWidth();
    29692974
     2975        if (containingBlock->isRenderNamedFlowThread() && style()->position() == FixedPosition)
     2976            return containingBlock->view().clientLogicalWidth();
     2977
    29702978        const RenderBlock* cb = toRenderBlock(containingBlock);
    29712979        RenderBoxRegionInfo* boxInfo = 0;
     
    30223030        LayoutUnit result = cb->clientLogicalHeight();
    30233031        RenderFlowThread* flowThread = flowThreadContainingBlock();
    3024         if (flowThread && containingBlock->isRenderFlowThread() && flowThread->isHorizontalWritingMode() == containingBlock->isHorizontalWritingMode())
     3032        if (flowThread && containingBlock->isRenderFlowThread() && flowThread->isHorizontalWritingMode() == containingBlock->isHorizontalWritingMode()) {
     3033            if (containingBlock->isRenderNamedFlowThread() && style()->position() == FixedPosition)
     3034                return containingBlock->view().clientLogicalHeight();
    30253035            return toRenderFlowThread(containingBlock)->contentLogicalHeightOfFirstRegion();
     3036        }
    30263037        return result;
    30273038    }
  • trunk/Source/WebCore/rendering/RenderLayer.cpp

    r154954 r154973  
    5656#include "FloatPoint3D.h"
    5757#include "FloatRect.h"
     58#include "FlowThreadController.h"
    5859#include "FocusController.h"
    5960#include "Frame.h"
     
    8182#include "RenderInline.h"
    8283#include "RenderMarquee.h"
     84#include "RenderNamedFlowThread.h"
    8385#include "RenderReplica.h"
    8486#include "RenderSVGResourceClipper.h"
     
    19521954        }
    19531955    }
    1954    
     1956
     1957    if (position == FixedPosition && fixedFlowThreadContainer) {
     1958        ASSERT(ancestorLayer);
     1959        if (ancestorLayer->isOutOfFlowRenderFlowThread()) {
     1960            location += toSize(layer->location());
     1961            return ancestorLayer;
     1962        }
     1963
     1964        if (ancestorLayer == renderer.view().layer()) {
     1965            // Add location in flow thread coordinates.
     1966            location += toSize(layer->location());
     1967
     1968            // Add flow thread offset in view coordinates since the view may be scrolled.
     1969            FloatPoint absPos = renderer.view().localToAbsolute(FloatPoint(), IsFixed);
     1970            location += LayoutSize(absPos.x(), absPos.y());
     1971            return ancestorLayer;
     1972        }
     1973    }
     1974
    19551975    RenderLayer* parentLayer;
    19561976    if (position == AbsolutePosition || position == FixedPosition) {
     
    37713791#endif
    37723792
     3793// Helper for the sorting of layers by z-index.
     3794static inline bool compareZIndex(RenderLayer* first, RenderLayer* second)
     3795{
     3796    return first->zIndex() < second->zIndex();
     3797}
     3798
     3799// Paint the layers associated with the fixed positioned elements in named flows.
     3800// These layers should not be painted in a similar way as the other elements collected in
     3801// named flows - regions -> named flows - since we do not want them to be clipped to the
     3802// regions viewport.
     3803void RenderLayer::paintFixedLayersInNamedFlows(GraphicsContext* context, const LayerPaintingInfo& paintingInfo, PaintLayerFlags paintFlags)
     3804{
     3805    if (!isRootLayer())
     3806        return;
     3807
     3808    // Get the named flows for the view
     3809    if (!renderer().view().hasRenderNamedFlowThreads())
     3810        return;
     3811
     3812    // Collect the fixed layers in a list to be painted
     3813    Vector<RenderLayer*> fixedLayers;
     3814    renderer().view().flowThreadController().collectFixedPositionedLayers(fixedLayers);
     3815
     3816    // Sort the fixed layers list
     3817    std::stable_sort(fixedLayers.begin(), fixedLayers.end(), compareZIndex);
     3818
     3819    // Paint the layers
     3820    for (size_t i = 0; i < fixedLayers.size(); ++i) {
     3821        RenderLayer* fixedLayer = fixedLayers.at(i);
     3822        fixedLayer->paintLayer(context, paintingInfo, paintFlags);
     3823    }
     3824}
     3825
    37733826void RenderLayer::paintLayerContents(GraphicsContext* context, const LayerPaintingInfo& paintingInfo, PaintLayerFlags paintFlags)
    37743827{
     
    38003853    updateLayerListsIfNeeded();
    38013854
     3855    // Do not paint the fixed positioned layers if the paint root is the named flow,
     3856    // if the paint originates at region level.
     3857    if (paintingInfo.rootLayer->isOutOfFlowRenderFlowThread()
     3858        && renderer().fixedPositionedWithNamedFlowContainingBlock())
     3859        return;
     3860
    38023861    LayoutPoint offsetFromRoot;
    38033862    convertToLayerCoords(paintingInfo.rootLayer, offsetFromRoot);
     
    38913950        // Now walk the sorted list of children with positive z-indices.
    38923951        paintList(posZOrderList(), context, localPaintingInfo, localPaintFlags);
     3952
     3953        // Paint the fixed elements from flow threads
     3954        paintFixedLayersInNamedFlows(context, localPaintingInfo, localPaintFlags);
    38933955    }
    38943956
     
    39644026        if (childLayer->isOutOfFlowRenderFlowThread())
    39654027            continue;
     4028
    39664029        if (!childLayer->isPaginated())
    39674030            childLayer->paintLayer(context, paintingInfo, paintFlags);
     
    44534516}
    44544517
     4518RenderLayer* RenderLayer::hitTestFixedLayersInNamedFlows(RenderLayer* /*rootLayer*/,
     4519    const HitTestRequest& request, HitTestResult& result,
     4520    const LayoutRect& hitTestRect, const HitTestLocation& hitTestLocation,
     4521    const HitTestingTransformState* transformState,
     4522    double* zOffsetForDescendants, double* zOffset,
     4523    const HitTestingTransformState* unflattenedTransformState,
     4524    bool depthSortDescendants)
     4525{
     4526    if (!isRootLayer())
     4527        return 0;
     4528
     4529    // Get the named flows for the view
     4530    if (!renderer().view().hasRenderNamedFlowThreads())
     4531        return 0;
     4532
     4533    Vector<RenderLayer*> fixedLayers;
     4534    renderer().view().flowThreadController().collectFixedPositionedLayers(fixedLayers);
     4535
     4536    // Sort the fixed layers list
     4537    std::stable_sort(fixedLayers.begin(), fixedLayers.end(), compareZIndex);
     4538
     4539    // Hit test the layers
     4540    RenderLayer* resultLayer = 0;
     4541    for (int i = fixedLayers.size() - 1; i >= 0; --i) {
     4542        RenderLayer* fixedLayer = fixedLayers.at(i);
     4543
     4544        HitTestResult tempResult(result.hitTestLocation());
     4545        RenderLayer* hitLayer = fixedLayer->hitTestLayer(fixedLayer->renderer().flowThreadContainingBlock()->layer(), 0, request, tempResult,
     4546            hitTestRect, hitTestLocation, false, transformState, zOffsetForDescendants);
     4547
     4548        // If it a rect-based test, we can safely append the temporary result since it might had hit
     4549        // nodes but not necesserily had hitLayer set.
     4550        if (result.isRectBasedTest())
     4551            result.append(tempResult);
     4552
     4553        if (isHitCandidate(hitLayer, depthSortDescendants, zOffset, unflattenedTransformState)) {
     4554            resultLayer = hitLayer;
     4555            if (!result.isRectBasedTest())
     4556                result = tempResult;
     4557            if (!depthSortDescendants)
     4558                break;
     4559        }
     4560    }
     4561
     4562    return resultLayer;
     4563}
     4564
    44554565// hitTestLocation and hitTestRect are relative to rootLayer.
    44564566// A 'flattening' layer is one preserves3D() == false.
     
    44664576{
    44674577    if (!isSelfPaintingLayer() && !hasSelfPaintingLayerDescendant())
     4578        return 0;
     4579
     4580    // Prevent hitting the fixed layers inside the flow thread when hitting through regions.
     4581    if (renderer().fixedPositionedWithNamedFlowContainingBlock() && hitTestLocation.region())
    44684582        return 0;
    44694583
     
    45434657    RenderLayer* candidateLayer = 0;
    45444658
     4659    // Check the fixed positioned layers within flow threads that are positioned by the view.
     4660    RenderLayer* hitLayer = hitTestFixedLayersInNamedFlows(rootLayer, request, result, hitTestRect, hitTestLocation,
     4661        localTransformState.get(), zOffsetForDescendantsPtr, zOffset, unflattenedTransformState.get(), depthSortDescendants);
     4662    if (hitLayer) {
     4663        if (!depthSortDescendants)
     4664            return hitLayer;
     4665        candidateLayer = hitLayer;
     4666    }
     4667
    45454668    // Begin by walking our list of positive layers from highest z-index down to the lowest z-index.
    4546     RenderLayer* hitLayer = hitTestList(posZOrderList(), rootLayer, request, result, hitTestRect, hitTestLocation,
     4669    hitLayer = hitTestList(posZOrderList(), rootLayer, request, result, hitTestRect, hitTestLocation,
    45474670                                        localTransformState.get(), zOffsetForDescendantsPtr, zOffset, unflattenedTransformState.get(), depthSortDescendants);
    45484671    if (hitLayer) {
     
    50635186    else
    50645187        convertToLayerCoords(clipRectsContext.rootLayer, offset);
     5188
     5189    // If the view is scrolled, the flow thread is not scrolled with it and we should
     5190    // take the scroll offset into account.
     5191    if (clipRectsContext.rootLayer->isOutOfFlowRenderFlowThread() && !clipRectsContext.region) {
     5192        FloatPoint absPos = renderer().view().localToAbsolute(FloatPoint(), IsFixed);
     5193        offset += LayoutSize(absPos.x(), absPos.y());
     5194    }
     5195
    50655196    layerBounds = LayoutRect(offset, size());
    50665197
     
    55845715        compositor().layerWasAdded(m_parent, this);
    55855716#endif
    5586 }
    5587 
    5588 // Helper for the sorting of layers by z-index.
    5589 static inline bool compareZIndex(RenderLayer* first, RenderLayer* second)
    5590 {
    5591     return first->zIndex() < second->zIndex();
    55925717}
    55935718
  • trunk/Source/WebCore/rendering/RenderLayer.h

    r154937 r154973  
    945945
    946946    void paintLayer(GraphicsContext*, const LayerPaintingInfo&, PaintLayerFlags);
     947    void paintFixedLayersInNamedFlows(GraphicsContext*, const LayerPaintingInfo&, PaintLayerFlags);
    947948    void paintLayerContentsAndReflection(GraphicsContext*, const LayerPaintingInfo&, PaintLayerFlags);
    948949    void paintLayerByApplyingTransform(GraphicsContext*, const LayerPaintingInfo&, PaintLayerFlags, const LayoutPoint& translationOffset = LayoutPoint());
     
    984985                                          const HitTestingTransformState* transformState, double* zOffset,
    985986                                          const Vector<RenderLayer*>& columnLayers, size_t columnIndex);
     987
     988    RenderLayer* hitTestFixedLayersInNamedFlows(RenderLayer* rootLayer,
     989        const HitTestRequest&, HitTestResult&,
     990        const LayoutRect& hitTestRect, const HitTestLocation&,
     991        const HitTestingTransformState*,
     992        double* zOffsetForDescendants, double* zOffset,
     993        const HitTestingTransformState* unflattenedTransformState,
     994        bool depthSortDescendants);
    986995
    987996    PassRefPtr<HitTestingTransformState> createLocalTransformState(RenderLayer* rootLayer, RenderLayer* containerLayer,
  • trunk/Source/WebCore/rendering/RenderLayerCompositor.cpp

    r154937 r154973  
    14441444void RenderLayerCompositor::updateLayerTreeGeometry(RenderLayer* layer, int depth)
    14451445{
     1446    // FIXME: fixed positioned elements inside a named flow are not composited yet.
     1447    if (layer->isOutOfFlowRenderFlowThread())
     1448        return;
     1449
    14461450    if (RenderLayerBacking* layerBacking = layer->backing()) {
    14471451        // The compositing state of all our children has been updated already, so now
  • trunk/Source/WebCore/rendering/RenderObject.cpp

    r154937 r154973  
    623623    ASSERT_NOT_REACHED();
    624624    return 0;
     625}
     626
     627bool RenderObject::fixedPositionedWithNamedFlowContainingBlock() const
     628{
     629    return ((flowThreadState() == RenderObject::InsideOutOfFlowThread)
     630        && (style()->position() == FixedPosition)
     631        && (containingBlock()->isOutOfFlowRenderFlowThread()));
     632}
     633
     634static bool hasFixedPosInNamedFlowContainingBlock(const RenderObject* renderer)
     635{
     636    ASSERT(renderer->flowThreadState() != RenderObject::NotInsideFlowThread);
     637
     638    RenderObject* curr = const_cast<RenderObject*>(renderer);
     639    while (curr) {
     640        if (curr->fixedPositionedWithNamedFlowContainingBlock())
     641            return true;
     642        curr = curr->containingBlock();
     643    }
     644
     645    return false;
    625646}
    626647
     
    13061327    RenderFlowThread* parentRenderFlowThread = flowThreadContainingBlock();
    13071328    if (parentRenderFlowThread) {
     1329        // If the element has a fixed positioned element with named flow as CB along the CB chain
     1330        // then the repaint container is not the flow thread.
     1331        if (hasFixedPosInNamedFlowContainingBlock(this))
     1332            return repaintContainer;
    13081333        // The ancestor document will do the reparenting when the repaint propagates further up.
    13091334        // We're just a seamless child document, and we don't need to do the hacking.
  • trunk/Source/WebCore/rendering/RenderObject.h

    r154877 r154973  
    212212    RenderBoxModelObject* enclosingBoxModelObject() const;
    213213
     214    bool fixedPositionedWithNamedFlowContainingBlock() const;
    214215    // Function to return our enclosing flow thread if we are contained inside one. This
    215216    // function follows the containing block chain.
Note: See TracChangeset for help on using the changeset viewer.