Changeset 157567 in webkit


Ignore:
Timestamp:
Oct 17, 2013 2:02:19 AM (11 years ago)
Author:
mihnea@adobe.com
Message:

[CSS Regions] Anonymous nested regions
https://bugs.webkit.org/show_bug.cgi?id=119135

Reviewed by David Hyatt.

Source/WebCore:

Tests: fast/regions/table-caption-as-region.html

fast/regions/table-cell-as-region.html

This patch allows any non-replaced block to behave like a region. When an element is styled with the
-webkit-flow-from property, instead of making the renderer a RenderRegion, we let the original
renderer be created the same way and we add a region as an anonymous child for the renderer.
The anonymous block child, modeled by the new RenderNamedFlowFragment class, will be responsible
for the fragmentation of the named flow thread content.

A RenderBlockFlow object will keep a reference to a RenderNamedFlowFragment(RenderRegion) inside its
rare data structures.

Contains code contributed by Catalin Badea.

  • CMakeLists.txt:
  • GNUmakefile.list.am:
  • WebCore.vcxproj/WebCore.vcxproj:
  • WebCore.xcodeproj/project.pbxproj:
  • dom/Element.cpp: Changed to take the anonymous region into account.

(WebCore::Element::renderRegion):
(WebCore::Element::webkitGetRegionFlowRanges):

  • dom/WebKitNamedFlow.cpp: Ditto.

(WebCore::WebKitNamedFlow::firstEmptyRegionIndex):
(WebCore::WebKitNamedFlow::getRegionsByContent):
(WebCore::WebKitNamedFlow::getRegions):

  • inspector/InspectorOverlay.cpp: Take into account the new model for regions, with an anonymous region inside a block.

(WebCore::buildObjectForRegionHighlight):
(WebCore::buildObjectForElementInfo):

  • rendering/RenderBlock.cpp:

(WebCore::RenderBlock::computeShapeSize): For a render named flow fragment, there is no need to recompute the shape inside
we can take it from the parent.
(WebCore::RenderBlock::renderName): Make the block that contains a render named flow fragment (region) report RenderRegion.
A future patch that will change this will need to rebase a lot of tests.

  • rendering/RenderBlockFlow.cpp:

(WebCore::RenderBlockFlow::insertedIntoTree): Create the anonymous region if needed (change of -webkit-flow-from determines Node reattach).
(WebCore::RenderBlockFlow::willBeDestroyed): Clean-up the anonymous region if necessary.
(WebCore::RenderBlockFlow::clearFloats): Small style change to make sure that check-webkit-style reports 0 failures on RenderBlockFlow.cpp.
(WebCore::RenderBlockFlow::layoutBlock):
(WebCore::RenderBlockFlow::styleDidChange): Update the style of the anonymous region too.
(WebCore::RenderBlockFlow::createRenderNamedFlowFragmentIfNeeded): Helper function to create the anonymous region
and to add it as a child to the block.
(WebCore::RenderBlockFlow::canHaveChildren):
(WebCore::RenderBlockFlow::canHaveGeneratedChildren):
(WebCore::RenderBlockFlow::namedFlowFragmentNeedsUpdate): Force a layout of the anonymous region if the
parent block has percentage height (similar to RenderBlock::updateBlockChildDirtyBitsBeforeLayout)
(WebCore::RenderBlockFlow::updateLogicalHeight): Update the logical height of anonymous region when the height of parent is updated.
(WebCore::RenderBlockFlow::setRenderNamedFlowFragment):

  • rendering/RenderBlockFlow.h:

(WebCore::RenderBlockFlow::RenderBlockFlowRareData::RenderBlockFlowRareData):
(WebCore::RenderBlockFlow::renderNamedFlowFragment):

  • rendering/RenderElement.cpp:

(WebCore::RenderElement::createFor): Remove the direct creation of RenderRegion objects since they will be
created as anonymous children of block flow objects.

  • rendering/RenderElement.h:

(WebCore::RenderElement::generatingElement): Account for anonymous region if necessary.

  • rendering/RenderFlowThread.cpp:

(WebCore::RenderFlowThread::adjustedPositionRelativeToOffsetParent): Take anonymous region into account
and use the anonymous region parent offset/border.

  • rendering/RenderLayer.cpp:

(WebCore::RenderLayer::shouldBeNormalFlowOnly): Check for style instead of isRenderRegion since
the parent of the anonymous region will get the layer.

  • rendering/RenderListItem.cpp:

(WebCore::RenderListItem::insertedIntoTree): Call RenderBlockFlow method instead.

  • rendering/RenderNamedFlowFragment.cpp: Added. Model the behaviour of the anonymous region.

Has RenderRegion as a base class.
(WebCore::RenderNamedFlowFragment::RenderNamedFlowFragment):
(WebCore::RenderNamedFlowFragment::~RenderNamedFlowFragment):
(WebCore::RenderNamedFlowFragment::setStyleForNamedFlowFragment):
(WebCore::RenderNamedFlowFragment::styleDidChange):
(WebCore::RenderNamedFlowFragment::shouldHaveAutoLogicalHeight):
(WebCore::RenderNamedFlowFragment::maxPageLogicalHeight):

  • rendering/RenderNamedFlowFragment.h: Added.

(WebCore::RenderNamedFlowFragment::isPseudoElementRegion):
(WebCore::RenderNamedFlowFragment::renderName):
(WebCore::toRenderNamedFlowFragment):

  • rendering/RenderObject.cpp:

(WebCore::RenderObject::isRenderNamedFlowFragmentContainer):

  • rendering/RenderObject.h:

(WebCore::RenderObject::isRenderNamedFlowFragment):

  • rendering/RenderRegion.h:
  • rendering/RenderTableCaption.cpp: Call RenderBlockFlow method instead.

(WebCore::RenderTableCaption::insertedIntoTree):

  • rendering/RenderTreeAsText.cpp:

(WebCore::write):
(WebCore::writeRenderRegionList):

  • rendering/shapes/ShapeInfo.h:

(WebCore::ShapeInfo::shapeSize):

  • style/StyleResolveTree.cpp:

(WebCore::Style::elementInsideRegionNeedsRenderer):

LayoutTests:

Add new tests for making a table-cell and a table-caption a region.
Change expected results for repaint tests of fixed elements since the parent of the region gets layer.

  • fast/regions/element-in-named-flow-absolute-from-fixed-expected.txt:
  • fast/regions/element-in-named-flow-fixed-from-absolute-expected.txt:
  • fast/regions/element-inflow-fixed-from-outflow-static-expected.txt:
  • fast/regions/element-outflow-static-from-inflow-fixed-expected.txt:
  • fast/regions/table-caption-as-region-expected.html: Added.
  • fast/regions/table-caption-as-region.html: Added.
  • fast/regions/table-cell-as-region-expected.html: Added.
  • fast/regions/table-cell-as-region.html: Added.
Location:
trunk
Files:
6 added
28 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r157564 r157567  
     12013-10-17  Mihnea Ovidenie  <mihnea@adobe.com>
     2
     3        [CSS Regions] Anonymous nested regions
     4        https://bugs.webkit.org/show_bug.cgi?id=119135
     5
     6        Reviewed by David Hyatt.
     7
     8        Add new tests for making a table-cell and a table-caption a region.
     9        Change expected results for repaint tests of fixed elements since the parent of the region gets layer.
     10
     11        * fast/regions/element-in-named-flow-absolute-from-fixed-expected.txt:
     12        * fast/regions/element-in-named-flow-fixed-from-absolute-expected.txt:
     13        * fast/regions/element-inflow-fixed-from-outflow-static-expected.txt:
     14        * fast/regions/element-outflow-static-from-inflow-fixed-expected.txt:
     15        * fast/regions/table-caption-as-region-expected.html: Added.
     16        * fast/regions/table-caption-as-region.html: Added.
     17        * fast/regions/table-cell-as-region-expected.html: Added.
     18        * fast/regions/table-cell-as-region.html: Added.
     19
    1202013-10-17  Krzysztof Czech  <k.czech@samsung.com>
    221
  • trunk/LayoutTests/fast/regions/element-in-named-flow-absolute-from-fixed-expected.txt

    r155026 r157567  
    11(repaint rects
    22  (rect 50 100 50 50)
    3   (rect 100 100 200 200)
    43  (rect 150 200 50 50)
    54)
  • trunk/LayoutTests/fast/regions/element-in-named-flow-fixed-from-absolute-expected.txt

    r155026 r157567  
    11(repaint rects
    22  (rect 150 200 50 50)
    3   (rect 100 100 200 200)
    43  (rect 50 100 50 50)
    54)
  • trunk/LayoutTests/fast/regions/element-inflow-fixed-from-outflow-static-expected.txt

    r155026 r157567  
    11(repaint rects
    22  (rect 300 300 50 50)
    3   (rect 100 100 200 200)
    43  (rect 50 100 50 50)
    54)
  • trunk/LayoutTests/fast/regions/element-outflow-static-from-inflow-fixed-expected.txt

    r155026 r157567  
    22  (rect 50 100 50 50)
    33  (rect 300 300 50 50)
    4   (rect 100 100 200 200)
    54)
    65
  • trunk/Source/WebCore/CMakeLists.txt

    r157430 r157567  
    21322132    rendering/RenderMultiColumnFlowThread.cpp
    21332133    rendering/RenderMultiColumnSet.cpp
     2134    rendering/RenderNamedFlowFragment.cpp
    21342135    rendering/RenderNamedFlowThread.cpp
    21352136    rendering/RenderObject.cpp
  • trunk/Source/WebCore/ChangeLog

    r157564 r157567  
     12013-10-17  Mihnea Ovidenie  <mihnea@adobe.com>
     2
     3        [CSS Regions] Anonymous nested regions
     4        https://bugs.webkit.org/show_bug.cgi?id=119135
     5
     6        Reviewed by David Hyatt.
     7
     8        Tests: fast/regions/table-caption-as-region.html
     9               fast/regions/table-cell-as-region.html
     10
     11        This patch allows any non-replaced block to behave like a region. When an element is styled with the
     12        -webkit-flow-from property, instead of making the renderer a RenderRegion, we let the original
     13        renderer be created the same way and we add a region as an anonymous child for the renderer.
     14        The anonymous block child, modeled by the new RenderNamedFlowFragment class, will be responsible
     15        for the fragmentation of the named flow thread content.
     16
     17        A RenderBlockFlow object will keep a reference to a RenderNamedFlowFragment(RenderRegion) inside its
     18        rare data structures.
     19
     20        Contains code contributed by Catalin Badea.
     21 
     22        * CMakeLists.txt:
     23        * GNUmakefile.list.am:
     24        * WebCore.vcxproj/WebCore.vcxproj:
     25        * WebCore.xcodeproj/project.pbxproj:
     26        * dom/Element.cpp: Changed to take the anonymous region into account.
     27        (WebCore::Element::renderRegion):
     28        (WebCore::Element::webkitGetRegionFlowRanges):
     29        * dom/WebKitNamedFlow.cpp: Ditto.
     30        (WebCore::WebKitNamedFlow::firstEmptyRegionIndex):
     31        (WebCore::WebKitNamedFlow::getRegionsByContent):
     32        (WebCore::WebKitNamedFlow::getRegions):
     33        * inspector/InspectorOverlay.cpp: Take into account the new model for regions, with an anonymous region inside a block.
     34        (WebCore::buildObjectForRegionHighlight):
     35        (WebCore::buildObjectForElementInfo):
     36        * rendering/RenderBlock.cpp:
     37        (WebCore::RenderBlock::computeShapeSize): For a render named flow fragment, there is no need to recompute the shape inside
     38        we can take it from the parent.
     39        (WebCore::RenderBlock::renderName): Make the block that contains a render named flow fragment (region) report RenderRegion.
     40        A future patch that will change this will need to rebase a lot of tests.
     41        * rendering/RenderBlockFlow.cpp:
     42        (WebCore::RenderBlockFlow::insertedIntoTree): Create the anonymous region if needed (change of -webkit-flow-from determines Node reattach).
     43        (WebCore::RenderBlockFlow::willBeDestroyed): Clean-up the anonymous region if necessary.
     44        (WebCore::RenderBlockFlow::clearFloats): Small style change to make sure that check-webkit-style reports 0 failures on RenderBlockFlow.cpp.
     45        (WebCore::RenderBlockFlow::layoutBlock):
     46        (WebCore::RenderBlockFlow::styleDidChange): Update the style of the anonymous region too.
     47        (WebCore::RenderBlockFlow::createRenderNamedFlowFragmentIfNeeded): Helper function to create the anonymous region
     48        and to add it as a child to the block.
     49        (WebCore::RenderBlockFlow::canHaveChildren):
     50        (WebCore::RenderBlockFlow::canHaveGeneratedChildren):
     51        (WebCore::RenderBlockFlow::namedFlowFragmentNeedsUpdate): Force a layout of the anonymous region if the
     52        parent block has percentage height (similar to RenderBlock::updateBlockChildDirtyBitsBeforeLayout)
     53        (WebCore::RenderBlockFlow::updateLogicalHeight): Update the logical height of anonymous region when the height of parent is updated.
     54        (WebCore::RenderBlockFlow::setRenderNamedFlowFragment):
     55        * rendering/RenderBlockFlow.h:
     56        (WebCore::RenderBlockFlow::RenderBlockFlowRareData::RenderBlockFlowRareData):
     57        (WebCore::RenderBlockFlow::renderNamedFlowFragment):
     58        * rendering/RenderElement.cpp:
     59        (WebCore::RenderElement::createFor): Remove the direct creation of RenderRegion objects since they will be
     60        created as anonymous children of block flow objects.
     61        * rendering/RenderElement.h:
     62        (WebCore::RenderElement::generatingElement): Account for anonymous region if necessary.
     63        * rendering/RenderFlowThread.cpp:
     64        (WebCore::RenderFlowThread::adjustedPositionRelativeToOffsetParent): Take anonymous region into account
     65        and use the anonymous region parent offset/border.
     66        * rendering/RenderLayer.cpp:
     67        (WebCore::RenderLayer::shouldBeNormalFlowOnly): Check for style instead of isRenderRegion since
     68        the parent of the anonymous region will get the layer.
     69        * rendering/RenderListItem.cpp:
     70        (WebCore::RenderListItem::insertedIntoTree): Call RenderBlockFlow method instead.
     71        * rendering/RenderNamedFlowFragment.cpp: Added. Model the behaviour of the anonymous region.
     72        Has RenderRegion as a base class.
     73        (WebCore::RenderNamedFlowFragment::RenderNamedFlowFragment):
     74        (WebCore::RenderNamedFlowFragment::~RenderNamedFlowFragment):
     75        (WebCore::RenderNamedFlowFragment::setStyleForNamedFlowFragment):
     76        (WebCore::RenderNamedFlowFragment::styleDidChange):
     77        (WebCore::RenderNamedFlowFragment::shouldHaveAutoLogicalHeight):
     78        (WebCore::RenderNamedFlowFragment::maxPageLogicalHeight):
     79        * rendering/RenderNamedFlowFragment.h: Added.
     80        (WebCore::RenderNamedFlowFragment::isPseudoElementRegion):
     81        (WebCore::RenderNamedFlowFragment::renderName):
     82        (WebCore::toRenderNamedFlowFragment):
     83        * rendering/RenderObject.cpp:
     84        (WebCore::RenderObject::isRenderNamedFlowFragmentContainer):
     85        * rendering/RenderObject.h:
     86        (WebCore::RenderObject::isRenderNamedFlowFragment):
     87        * rendering/RenderRegion.h:
     88        * rendering/RenderTableCaption.cpp: Call RenderBlockFlow method instead.
     89        (WebCore::RenderTableCaption::insertedIntoTree):
     90        * rendering/RenderTreeAsText.cpp:
     91        (WebCore::write):
     92        (WebCore::writeRenderRegionList):
     93        * rendering/shapes/ShapeInfo.h:
     94        (WebCore::ShapeInfo::shapeSize):
     95        * style/StyleResolveTree.cpp:
     96        (WebCore::Style::elementInsideRegionNeedsRenderer):
     97
    1982013-10-17  Krzysztof Czech  <k.czech@samsung.com>
    299
  • trunk/Source/WebCore/GNUmakefile.list.am

    r157445 r157567  
    43924392        Source/WebCore/rendering/RenderMultiColumnSet.cpp \
    43934393        Source/WebCore/rendering/RenderMultiColumnSet.h \
     4394    Source/WebCore/rendering/RenderNamedFlowFragment.cpp \
     4395    Source/WebCore/rendering/RenderNamedFlowFragment.h \
    43944396        Source/WebCore/rendering/RenderNamedFlowThread.cpp \
    43954397        Source/WebCore/rendering/RenderNamedFlowThread.h \
  • trunk/Source/WebCore/WebCore.vcxproj/WebCore.vcxproj

    r157445 r157567  
    1002510025      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Production|x64'">true</ExcludedFromBuild>
    1002610026    </ClCompile>
     10027    <ClCompile Include="..\rendering\RenderNamedFlowFragment.cpp" />
    1002710028    <ClCompile Include="..\rendering\RenderNamedFlowThread.cpp" />
    1002810029    <ClCompile Include="..\rendering\RenderObject.cpp">
     
    1947219473    <ClInclude Include="..\rendering\RenderMultiColumnFlowThread.h" />
    1947319474    <ClInclude Include="..\rendering\RenderMultiColumnSet.h" />
     19475    <ClInclude Include="..\rendering\RenderNamedFlowFragment.h" />
    1947419476    <ClInclude Include="..\rendering\RenderNamedFlowThread.h" />
    1947519477    <ClInclude Include="..\rendering\RenderObject.h" />
  • trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj

    r157524 r157567  
    27922792                8AA61D00144D595B00F37350 /* WebKitCSSRegionRule.h in Headers */ = {isa = PBXBuildFile; fileRef = 8AA61CFE144D595B00F37350 /* WebKitCSSRegionRule.h */; };
    27932793                8AB4BC77126FDB7100DEB727 /* IgnoreDestructiveWriteCountIncrementer.h in Headers */ = {isa = PBXBuildFile; fileRef = 8AB4BC76126FDB7100DEB727 /* IgnoreDestructiveWriteCountIncrementer.h */; };
     2794                8AC822FC180FC03300FB64D5 /* RenderNamedFlowFragment.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 8AC822FA180FC03300FB64D5 /* RenderNamedFlowFragment.cpp */; };
     2795                8AC822FD180FC03300FB64D5 /* RenderNamedFlowFragment.h in Headers */ = {isa = PBXBuildFile; fileRef = 8AC822FB180FC03300FB64D5 /* RenderNamedFlowFragment.h */; };
    27942796                8AD0A59414C88336000D83C5 /* JSWebKitCSSRegionRule.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 8ACC24CD148E24B200EFCC0D /* JSWebKitCSSRegionRule.cpp */; };
    27952797                8AD0A59514C88336000D83C5 /* JSWebKitCSSRegionRule.h in Headers */ = {isa = PBXBuildFile; fileRef = 8ACC24CE148E24B200EFCC0D /* JSWebKitCSSRegionRule.h */; };
     
    93769378                8AA61CFE144D595B00F37350 /* WebKitCSSRegionRule.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebKitCSSRegionRule.h; sourceTree = "<group>"; };
    93779379                8AB4BC76126FDB7100DEB727 /* IgnoreDestructiveWriteCountIncrementer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IgnoreDestructiveWriteCountIncrementer.h; sourceTree = "<group>"; };
     9380                8AC822FA180FC03300FB64D5 /* RenderNamedFlowFragment.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = RenderNamedFlowFragment.cpp; sourceTree = "<group>"; };
     9381                8AC822FB180FC03300FB64D5 /* RenderNamedFlowFragment.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RenderNamedFlowFragment.h; sourceTree = "<group>"; };
    93789382                8ACC24CD148E24B200EFCC0D /* JSWebKitCSSRegionRule.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSWebKitCSSRegionRule.cpp; sourceTree = "<group>"; };
    93799383                8ACC24CE148E24B200EFCC0D /* JSWebKitCSSRegionRule.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSWebKitCSSRegionRule.h; sourceTree = "<group>"; };
     
    2063020634                                BCE32B9D1517C22700F542EC /* RenderMultiColumnSet.cpp */,
    2063120635                                BCE32B9B1517C0B100F542EC /* RenderMultiColumnSet.h */,
     20636                                8AC822FA180FC03300FB64D5 /* RenderNamedFlowFragment.cpp */,
     20637                                8AC822FB180FC03300FB64D5 /* RenderNamedFlowFragment.h */,
    2063220638                                BC85F23E1519187300BC17BE /* RenderNamedFlowThread.cpp */,
    2063320639                                BC85F23C151915E000BC17BE /* RenderNamedFlowThread.h */,
     
    2227522281                                316FE0800E6CCC2800BF6088 /* DOMWebKitCSSKeyframesRule.h in Headers */,
    2227622282                                078E091817D14D1C00420AA1 /* MediaStreamTrack.h in Headers */,
     22283                                8AC822FD180FC03300FB64D5 /* RenderNamedFlowFragment.h in Headers */,
    2227722284                                316FE0820E6CCC2800BF6088 /* DOMWebKitCSSKeyframesRuleInternal.h in Headers */,
    2227822285                                498391500F1E76B400C23782 /* DOMWebKitCSSMatrix.h in Headers */,
     
    2723427241                                43F6FD9613BCD0B100224052 /* SVGAnimatedInteger.cpp in Sources */,
    2723527242                                1A3586E115264F950022A659 /* SVGAnimatedIntegerOptionalInteger.cpp in Sources */,
     27243                                8AC822FC180FC03300FB64D5 /* RenderNamedFlowFragment.cpp in Sources */,
    2723627244                                4381763B13A697D4007D1187 /* SVGAnimatedLength.cpp in Sources */,
    2723727245                                431A2FD713B7707A007791E4 /* SVGAnimatedLengthList.cpp in Sources */,
  • trunk/Source/WebCore/dom/Element.cpp

    r157535 r157567  
    7575#include "PointerLockController.h"
    7676#include "PseudoElement.h"
     77#include "RenderNamedFlowFragment.h"
    7778#include "RenderRegion.h"
    7879#include "RenderTheme.h"
     
    27062707RenderRegion* Element::renderRegion() const
    27072708{
    2708     if (renderer() && renderer()->isRenderRegion())
    2709         return toRenderRegion(renderer());
     2709    if (renderer() && renderer()->isRenderNamedFlowFragmentContainer())
     2710        return toRenderBlockFlow(renderer())->renderNamedFlowFragment();
    27102711
    27112712    return 0;
     
    27642765
    27652766    Vector<RefPtr<Range> > rangeObjects;
    2766     if (document().cssRegionsEnabled() && renderer() && renderer()->isRenderRegion()) {
    2767         RenderRegion* region = toRenderRegion(renderer());
     2767    if (document().cssRegionsEnabled() && renderer() && renderer()->isRenderNamedFlowFragmentContainer()) {
     2768        RenderNamedFlowFragment* region = toRenderBlockFlow(renderer())->renderNamedFlowFragment();
    27682769        if (region->isValid())
    27692770            region->getRanges(rangeObjects);
  • trunk/Source/WebCore/dom/WebKitNamedFlow.cpp

    r156413 r157567  
    3333#include "EventNames.h"
    3434#include "NamedFlowCollection.h"
     35#include "RenderNamedFlowFragment.h"
    3536#include "RenderNamedFlowThread.h"
    3637#include "RenderRegion.h"
     
    103104    RenderRegionList::const_iterator iter = regionList.begin();
    104105    for (int index = 0; iter != regionList.end(); ++index, ++iter) {
    105         const RenderRegion* renderRegion = *iter;
    106106        // FIXME: Pseudo-elements are not included in the list.
    107107        // They will be included when we will properly support the Region interface
    108108        // http://dev.w3.org/csswg/css-regions/#the-region-interface
    109         if (renderRegion->isPseudoElement())
     109        const RenderNamedFlowFragment* renderRegion = toRenderNamedFlowFragment(*iter);
     110        if (renderRegion->isPseudoElementRegion())
    110111            continue;
    111112        countNonPseudoRegions++;
     
    134135        const RenderRegionList& regionList = m_parentFlowThread->renderRegionList();
    135136        for (auto iter = regionList.begin(), end = regionList.end(); iter != end; ++iter) {
    136             const RenderRegion* renderRegion = *iter;
    137137            // FIXME: Pseudo-elements are not included in the list.
    138138            // They will be included when we will properly support the Region interface
    139139            // http://dev.w3.org/csswg/css-regions/#the-region-interface
    140             if (renderRegion->isPseudoElement())
     140            const RenderNamedFlowFragment* renderRegion = toRenderNamedFlowFragment(*iter);
     141            if (renderRegion->isPseudoElementRegion())
    141142                continue;
    142143            if (m_parentFlowThread->objectInFlowRegion(contentNode->renderer(), renderRegion)) {
     
    164165    const RenderRegionList& regionList = m_parentFlowThread->renderRegionList();
    165166    for (auto iter = regionList.begin(), end = regionList.end(); iter != end; ++iter) {
    166         const RenderRegion* renderRegion = *iter;
    167167        // FIXME: Pseudo-elements are not included in the list.
    168168        // They will be included when we will properly support the Region interface
    169169        // http://dev.w3.org/csswg/css-regions/#the-region-interface
    170         if (renderRegion->isPseudoElement())
     170        const RenderNamedFlowFragment* renderRegion = toRenderNamedFlowFragment(*iter);
     171        if (renderRegion->isPseudoElementRegion())
    171172            continue;
    172173        ASSERT(renderRegion->generatingElement());
  • trunk/Source/WebCore/inspector/InspectorOverlay.cpp

    r157199 r157567  
    4848#include "RenderFlowThread.h"
    4949#include "RenderInline.h"
     50#include "RenderNamedFlowFragment.h"
    5051#include "RenderNamedFlowThread.h"
    5152#include "RenderRegion.h"
     
    391392        return nullptr;
    392393
    393     LayoutRect borderBox = region->borderBoxRect();
    394     borderBox.setWidth(borderBox.width() + region->verticalScrollbarWidth());
    395     borderBox.setHeight(borderBox.height() + region->horizontalScrollbarHeight());
     394    RenderBlockFlow* regionContainer = toRenderBlockFlow(region->parent());
     395    LayoutRect borderBox = regionContainer->borderBoxRect();
     396    borderBox.setWidth(borderBox.width() + regionContainer->verticalScrollbarWidth());
     397    borderBox.setHeight(borderBox.height() + regionContainer->horizontalScrollbarHeight());
    396398
    397399    // Create incoming and outgoing boxes that we use to chain the regions toghether.
     
    408410    outgoingRectBox.move(0, -linkBoxVerticalOffset);
    409411
    410     FloatQuad borderRectQuad = region->localToAbsoluteQuad(FloatRect(borderBox));
    411     FloatQuad incomingRectQuad = region->localToAbsoluteQuad(FloatRect(incomingRectBox));
    412     FloatQuad outgoingRectQuad = region->localToAbsoluteQuad(FloatRect(outgoingRectBox));
     412    FloatQuad borderRectQuad = regionContainer->localToAbsoluteQuad(FloatRect(borderBox));
     413    FloatQuad incomingRectQuad = regionContainer->localToAbsoluteQuad(FloatRect(incomingRectBox));
     414    FloatQuad outgoingRectQuad = regionContainer->localToAbsoluteQuad(FloatRect(outgoingRectBox));
    413415
    414416    contentsQuadToPage(mainView, containingView, borderRectQuad);
     
    561563    elementInfo->setString("nodeHeight", String::number(modelObject ? adjustForAbsoluteZoom(modelObject->pixelSnappedOffsetHeight(), modelObject) : boundingBox.height()));
    562564   
    563     if (renderer->isRenderRegion()) {
    564         RenderRegion* region = toRenderRegion(renderer);
     565    if (renderer->isRenderNamedFlowFragmentContainer()) {
     566        RenderNamedFlowFragment* region = toRenderBlockFlow(renderer)->renderNamedFlowFragment();
    565567        RenderFlowThread* flowThread = region->flowThread();
    566568        if (flowThread && flowThread->isRenderNamedFlowThread()) {
  • trunk/Source/WebCore/rendering/RenderBlock.cpp

    r157535 r157567  
    14751475{
    14761476    ShapeInsideInfo* shapeInsideInfo = this->shapeInsideInfo();
    1477     if (shapeInsideInfo) {
     1477    if (!shapeInsideInfo)
     1478        return;
     1479
     1480    if (isRenderNamedFlowFragment()) {
     1481        ShapeInsideInfo* parentShapeInsideInfo = toRenderBlock(parent())->shapeInsideInfo();
     1482        ASSERT(parentShapeInsideInfo);
     1483        shapeInsideInfo->setShapeSize(parentShapeInsideInfo->shapeSize().width(), parentShapeInsideInfo->shapeSize().height());
     1484    } else {
    14781485        bool percentageLogicalHeightResolvable = percentageLogicalHeightIsResolvableFromBlock(this, false);
    14791486        shapeInsideInfo->setShapeSize(logicalWidth(), percentageLogicalHeightResolvable ? logicalHeight() : LayoutUnit());
     
    58685875    if (isBody())
    58695876        return "RenderBody"; // FIXME: Temporary hack until we know that the regression tests pass.
    5870    
     5877
     5878    if (isRenderNamedFlowFragmentContainer())
     5879        return "RenderRegion";
    58715880    if (isFloating())
    58725881        return "RenderBlock (floating)";
  • trunk/Source/WebCore/rendering/RenderBlockFlow.cpp

    r157408 r157567  
    3030#include "RenderFlowThread.h"
    3131#include "RenderLayer.h"
     32#include "RenderNamedFlowFragment.h"
    3233#include "RenderView.h"
    3334#include "VerticalPositionCache.h"
     
    9495}
    9596
     97void RenderBlockFlow::insertedIntoTree()
     98{
     99    RenderBlock::insertedIntoTree();
     100    createRenderNamedFlowFragmentIfNeeded();
     101}
     102
    96103void RenderBlockFlow::willBeDestroyed()
    97104{
    98105    if (lineGridBox())
    99106        lineGridBox()->destroy(renderArena());
    100 
     107    if (renderNamedFlowFragment())
     108        setRenderNamedFlowFragment(0);
    101109    RenderBlock::willBeDestroyed();
    102110}
     
    120128    // Inline blocks are covered by the isReplaced() check in the avoidFloats method.
    121129    if (avoidsFloats() || isRoot() || isRenderView() || isFloatingOrOutOfFlowPositioned() || isTableCell()) {
    122         if (m_floatingObjects) {
     130        if (m_floatingObjects)
    123131            m_floatingObjects->clear();
    124         }
    125132        if (!oldIntrudingFloatSet.isEmpty())
    126133            markAllDescendantsWithFloatsForLayout();
     
    269276        relayoutChildren = true;
    270277    if (updateShapesBeforeBlockLayout())
     278        relayoutChildren = true;
     279    if (namedFlowFragmentNeedsUpdate())
    271280        relayoutChildren = true;
    272281
     
    15341543        parentBlock->markSiblingsWithFloatsForLayout();
    15351544    }
     1545
     1546    if (renderNamedFlowFragment())
     1547        renderNamedFlowFragment()->setStyleForNamedFlowFragment(style());
    15361548}
    15371549
     
    23522364}
    23532365
     2366void RenderBlockFlow::createRenderNamedFlowFragmentIfNeeded()
     2367{
     2368    if (renderNamedFlowFragment() || isRenderNamedFlowFragment())
     2369        return;
     2370
     2371    if (document().cssRegionsEnabled() && style()->isDisplayRegionType() && !style()->regionThread().isEmpty()) {
     2372        RenderNamedFlowFragment* flowFragment = new RenderNamedFlowFragment(document());
     2373        flowFragment->setStyleForNamedFlowFragment(style());
     2374        setRenderNamedFlowFragment(flowFragment);
     2375        addChild(renderNamedFlowFragment());
     2376    }
     2377}
     2378
     2379bool RenderBlockFlow::canHaveChildren() const
     2380{
     2381    return !renderNamedFlowFragment() ? RenderBlock::canHaveChildren() : renderNamedFlowFragment()->canHaveChildren();
     2382}
     2383
     2384bool RenderBlockFlow::canHaveGeneratedChildren() const
     2385{
     2386    return !renderNamedFlowFragment() ? RenderBlock::canHaveGeneratedChildren() : renderNamedFlowFragment()->canHaveGeneratedChildren();
     2387}
     2388
     2389bool RenderBlockFlow::namedFlowFragmentNeedsUpdate() const
     2390{
     2391    if (!isRenderNamedFlowFragmentContainer())
     2392        return false;
     2393
     2394    return hasRelativeLogicalHeight() && !isRenderView();
     2395}
     2396
     2397void RenderBlockFlow::updateLogicalHeight()
     2398{
     2399    RenderBlock::updateLogicalHeight();
     2400
     2401    if (renderNamedFlowFragment())
     2402        renderNamedFlowFragment()->setLogicalHeight(max<LayoutUnit>(0, logicalHeight() - borderAndPaddingLogicalHeight()));
     2403}
     2404
     2405void RenderBlockFlow::setRenderNamedFlowFragment(RenderNamedFlowFragment* flowFragment)
     2406{
     2407    if (!m_rareData)
     2408        m_rareData = adoptPtr(new RenderBlockFlowRareData(this));
     2409    if (m_rareData->m_renderNamedFlowFragment)
     2410        m_rareData->m_renderNamedFlowFragment->destroy();
     2411    m_rareData->m_renderNamedFlowFragment = flowFragment;
     2412}
    23542413
    23552414} // namespace WebCore
  • trunk/Source/WebCore/rendering/RenderBlockFlow.h

    r157408 r157567  
    2929
    3030class LineBreaker;
     31class RenderNamedFlowFragment;
    3132
    3233class RenderBlockFlow : public RenderBlock {
     
    3940
    4041protected:
     42    virtual void insertedIntoTree() OVERRIDE;
    4143    virtual void willBeDestroyed() OVERRIDE;
    4244   
     
    5759
    5860    virtual void dirtyLinesFromChangedChild(RenderObject* child) OVERRIDE FINAL { lineBoxes().dirtyLinesFromChangedChild(this, child); }
    59 
     61    virtual void updateLogicalHeight() OVERRIDE;
    6062public:
    6163    class MarginValues {
     
    9496            , m_lineBreakToAvoidWidow(-1)
    9597            , m_lineGridBox(0)
     98            , m_renderNamedFlowFragment(0)
    9699            , m_discardMarginBefore(false)
    97100            , m_discardMarginAfter(false)
     
    120123        int m_lineBreakToAvoidWidow;
    121124        RootInlineBox* m_lineGridBox;
     125        RenderNamedFlowFragment* m_renderNamedFlowFragment;
    122126
    123127        bool m_discardMarginBefore : 1;
     
    225229    bool relayoutToAvoidWidows(LayoutStateMaintainer&);
    226230
     231    virtual bool canHaveGeneratedChildren() const OVERRIDE;
     232
    227233    RootInlineBox* lineGridBox() const { return m_rareData ? m_rareData->m_lineGridBox : 0; }
    228234    void setLineGridBox(RootInlineBox* box)
     
    235241    }
    236242    void layoutLineGridBox();
     243
     244    RenderNamedFlowFragment* renderNamedFlowFragment() const { return m_rareData ? m_rareData->m_renderNamedFlowFragment : 0; }
     245    void setRenderNamedFlowFragment(RenderNamedFlowFragment*);
    237246
    238247    bool containsFloats() const OVERRIDE { return m_floatingObjects && !m_floatingObjects->set().isEmpty(); }
     
    403412
    404413// END METHODS DEFINED IN RenderBlockLineLayout
    405    
     414
     415    bool namedFlowFragmentNeedsUpdate() const;
     416    virtual bool canHaveChildren() const OVERRIDE;
     417
    406418public:
    407419    // FIXME-BLOCKFLOW: These can be made protected again once all callers have been moved here.
    408420    void adjustLinePositionForPagination(RootInlineBox*, LayoutUnit& deltaOffset, RenderFlowThread*); // Computes a deltaOffset value that put a line at the top of the next page if it doesn't fit on the current page.
    409421    void updateRegionForLine(RootInlineBox*) const;
     422    void createRenderNamedFlowFragmentIfNeeded();
    410423
    411424protected:
  • trunk/Source/WebCore/rendering/RenderElement.cpp

    r157535 r157567  
    148148    if (element.hasTagName(HTMLNames::rtTag) && style.display() == BLOCK)
    149149        return new RenderRubyText(element);
    150     if (document.cssRegionsEnabled() && style.isDisplayRegionType() && !style.regionThread().isEmpty())
    151         return new RenderRegion(element, nullptr);
    152150    switch (style.display()) {
    153151    case NONE:
  • trunk/Source/WebCore/rendering/RenderElement.h

    r157515 r157567  
    4444    Element* element() const { return toElement(RenderObject::node()); }
    4545    Element* nonPseudoElement() const { return toElement(RenderObject::nonPseudoNode()); }
    46     Element* generatingElement() const { return toElement(RenderObject::generatingNode()); }
     46    Element* generatingElement() const;
    4747
    4848    RenderObject* firstChild() const { return m_firstChild; }
     
    259259}
    260260
     261inline Element* RenderElement::generatingElement() const
     262{
     263    if (isRenderNamedFlowFragment() && parent())
     264        return toRenderElement(parent())->generatingElement();
     265    return toElement(RenderObject::generatingNode());
     266}
     267
    261268// This will catch anyone doing an unnecessary cast.
    262269void toRenderElement(const RenderElement*);
  • trunk/Source/WebCore/rendering/RenderFlowThread.cpp

    r157408 r157567  
    520520    if (startRegion) {
    521521        // Take into account the offset coordinates of the region.
    522         RenderBoxModelObject* currObject = startRegion;
     522        RenderBoxModelObject* startRegionBox = startRegion->isRenderNamedFlowFragment() ? toRenderBoxModelObject(startRegion->parent()) : startRegion;
     523        RenderBoxModelObject* currObject = startRegionBox;
    523524        RenderBoxModelObject* currOffsetParent;
    524525        while ((currOffsetParent = currObject->offsetParent())) {
     
    574575            LayoutUnit regionLogicalTop = startRegion->pageLogicalTopForOffset(top);
    575576            LayoutUnit topRelativeToRegion = top - regionLogicalTop;
    576             referencePoint.setY(startRegion->offsetTop() + topRelativeToRegion);
     577            referencePoint.setY(startRegionBox->offsetTop() + topRelativeToRegion);
    577578           
    578579            // Since the top has been overriden, check if the
     
    586587        // Since we're looking for the offset relative to the body, we must also
    587588        // take into consideration the borders of the region.
    588         referencePoint.move(startRegion->borderLeft(), startRegion->borderTop());
     589        referencePoint.move(startRegionBox->borderLeft(), startRegionBox->borderTop());
    589590    }
    590591   
  • trunk/Source/WebCore/rendering/RenderLayer.cpp

    r157535 r157567  
    59495949        && !isTransparent()
    59505950        && !needsCompositedScrolling()
    5951         && !renderer().isRenderRegion()
     5951        && !renderer().style()->hasStyleRegion()
    59525952        ;
    59535953}
  • trunk/Source/WebCore/rendering/RenderListItem.cpp

    r157535 r157567  
    8282void RenderListItem::insertedIntoTree()
    8383{
    84     RenderBlock::insertedIntoTree();
     84    RenderBlockFlow::insertedIntoTree();
    8585
    8686    updateListMarkerNumbers();
  • trunk/Source/WebCore/rendering/RenderObject.cpp

    r157535 r157567  
    25592559}
    25602560
     2561bool RenderObject::isRenderNamedFlowFragmentContainer() const
     2562{
     2563    if (!isRenderBlockFlow())
     2564        return false;
     2565
     2566    return toRenderBlockFlow(this)->renderNamedFlowFragment();
     2567}
     2568
    25612569#if ENABLE(SVG)
    25622570
  • trunk/Source/WebCore/rendering/RenderObject.h

    r157535 r157567  
    330330    virtual bool isRenderImage() const { return false; }
    331331    virtual bool isRenderRegion() const { return false; }
     332    virtual bool isRenderNamedFlowFragment() const { return false; }
    332333    virtual bool isReplica() const { return false; }
    333334
     
    362363    bool isInFlowRenderFlowThread() const { return isRenderFlowThread() && !isOutOfFlowPositioned(); }
    363364    bool isOutOfFlowRenderFlowThread() const { return isRenderFlowThread() && isOutOfFlowPositioned(); }
     365    bool isRenderNamedFlowFragmentContainer() const;
    364366
    365367    virtual bool isRenderMultiColumnBlock() const { return false; }
  • trunk/Source/WebCore/rendering/RenderRegion.h

    r157408 r157567  
    4646class RenderRegion : public RenderBlockFlow {
    4747public:
    48     RenderRegion(Element&, RenderFlowThread*);
    49 
    5048    virtual bool isRenderRegion() const OVERRIDE FINAL { return true; }
    5149
     
    9290    virtual LayoutUnit pageLogicalWidth() const;
    9391    virtual LayoutUnit pageLogicalHeight() const;
    94     LayoutUnit maxPageLogicalHeight() const;
     92    virtual LayoutUnit maxPageLogicalHeight() const;
    9593
    9694    LayoutUnit logicalTopOfFlowThreadContentRect(const LayoutRect&) const;
     
    149147    LayoutRect rectFlowPortionForBox(const RenderBox*, const LayoutRect&) const;
    150148
     149    virtual bool canHaveChildren() const OVERRIDE { return false; }
     150    virtual bool canHaveGeneratedChildren() const OVERRIDE { return true; }
     151
    151152protected:
     153    RenderRegion(Element&, RenderFlowThread*);
    152154    RenderRegion(Document&, RenderFlowThread*);
     155
    153156    RenderOverflow* ensureOverflowForBox(const RenderBox*);
    154157
     
    174177private:
    175178    virtual const char* renderName() const { return "RenderRegion"; }
    176 
    177     virtual bool canHaveChildren() const OVERRIDE { return false; }
    178     virtual bool canHaveGeneratedChildren() const OVERRIDE { return true; }
    179179
    180180    virtual void insertedIntoTree() OVERRIDE;
  • trunk/Source/WebCore/rendering/RenderTableCaption.cpp

    r157408 r157567  
    4242void RenderTableCaption::insertedIntoTree()
    4343{
    44     RenderBlock::insertedIntoTree();
     44    RenderBlockFlow::insertedIntoTree();
    4545
    4646    table()->addCaption(this);
  • trunk/Source/WebCore/rendering/RenderTreeAsText.cpp

    r156779 r157567  
    576576        }
    577577    } else {
    578         for (RenderObject* child = toRenderElement(o).firstChild(); child; child = child->nextSibling()) {
    579             if (child->hasLayer())
    580                 continue;
    581             write(ts, *child, indent + 1, behavior);
     578        if (!o.isRenderNamedFlowFragmentContainer()) {
     579            for (RenderObject* child = toRenderElement(o).firstChild(); child; child = child->nextSibling()) {
     580                if (child->hasLayer())
     581                    continue;
     582                write(ts, *child, indent + 1, behavior);
     583            }
    582584        }
    583585    }
     
    669671        ts << "RenderRegion";
    670672        if (renderRegion->generatingElement()) {
    671             String tagName = getTagName(renderRegion->element());
     673            String tagName = getTagName(renderRegion->generatingElement());
    672674            if (!tagName.isEmpty())
    673675                ts << " {" << tagName << "}";
  • trunk/Source/WebCore/rendering/shapes/ShapeInfo.h

    r156176 r157567  
    104104    bool shapeSizeDirty() { return !m_shape.get(); }
    105105    const RenderType* owner() const { return m_renderer; }
     106    LayoutSize shapeSize() const { return m_shapeLogicalSize; }
    106107
    107108protected:
  • trunk/Source/WebCore/style/StyleResolveTree.cpp

    r157535 r157567  
    167167    const RenderObject* parentRenderer = renderingParentNode ? renderingParentNode->renderer() : 0;
    168168
    169     bool parentIsRegion = parentRenderer && !parentRenderer->canHaveChildren() && parentRenderer->isRenderRegion();
     169    bool parentIsRegion = parentRenderer && !parentRenderer->canHaveChildren() && parentRenderer->isRenderNamedFlowFragmentContainer();
    170170    bool parentIsNonRenderedInsideRegion = !parentRenderer && element.parentElement() && element.parentElement()->isInsideRegion();
    171171    if (!parentIsRegion && !parentIsNonRenderedInsideRegion)
Note: See TracChangeset for help on using the changeset viewer.