Changeset 124772 in webkit


Ignore:
Timestamp:
Aug 6, 2012, 8:24:17 AM (13 years ago)
Author:
commit-queue@webkit.org
Message:

[CSS Regions] Add the NamedFlow.getRegions() API
https://bugs.webkit.org/show_bug.cgi?id=93240

Patch by Andrei Bucur <abucur@adobe.com> on 2012-08-06
Reviewed by Andreas Kling.

Source/WebCore:

This patch adds the NamedFlow.getRegions() API call as specified by http://www.w3.org/TR/2012/WD-css3-regions-20120503/#dom-named-flow .
For now, WebKit supports only one type of regions, Element. The Region interface will be introduced when other interfaces will be capable
of becoming regions.

New test: fast/regions/webkit-named-flow-get-regions.html

  • dom/WebKitNamedFlow.cpp:

(WebCore::WebKitNamedFlow::getRegionsByContent): Add a check not to include the pseudo-elements that are regions; those don't have a node attached.
(WebCore::WebKitNamedFlow::getRegions):
(WebCore):

  • dom/WebKitNamedFlow.h:

(WebKitNamedFlow):

  • dom/WebKitNamedFlow.idl:

LayoutTests:

Link to spec: http://www.w3.org/TR/2012/WD-css3-regions-20120503/#dom-named-flow
The test also verifies the regions are returned in document order.

  • fast/regions/webkit-named-flow-get-regions-expected.txt: Added.
  • fast/regions/webkit-named-flow-get-regions.html: Added.
Location:
trunk
Files:
2 added
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r124771 r124772  
     12012-08-06  Andrei Bucur  <abucur@adobe.com>
     2
     3        [CSS Regions] Add the NamedFlow.getRegions() API
     4        https://bugs.webkit.org/show_bug.cgi?id=93240
     5
     6        Reviewed by Andreas Kling.
     7
     8        Link to spec: http://www.w3.org/TR/2012/WD-css3-regions-20120503/#dom-named-flow
     9        The test also verifies the regions are returned in document order.
     10
     11        * fast/regions/webkit-named-flow-get-regions-expected.txt: Added.
     12        * fast/regions/webkit-named-flow-get-regions.html: Added.
     13
    1142012-08-06  Andrei Bucur  <abucur@adobe.com>
    215
  • trunk/Source/WebCore/ChangeLog

    r124771 r124772  
     12012-08-06  Andrei Bucur  <abucur@adobe.com>
     2
     3        [CSS Regions] Add the NamedFlow.getRegions() API
     4        https://bugs.webkit.org/show_bug.cgi?id=93240
     5
     6        Reviewed by Andreas Kling.
     7
     8        This patch adds the NamedFlow.getRegions() API call as specified by http://www.w3.org/TR/2012/WD-css3-regions-20120503/#dom-named-flow .
     9        For now, WebKit supports only one type of regions, Element. The Region interface will be introduced when other interfaces will be capable
     10        of becoming regions.
     11
     12        New test: fast/regions/webkit-named-flow-get-regions.html
     13
     14        * dom/WebKitNamedFlow.cpp:
     15        (WebCore::WebKitNamedFlow::getRegionsByContent): Add a check not to include the pseudo-elements that are regions; those don't have a node attached.
     16        (WebCore::WebKitNamedFlow::getRegions):
     17        (WebCore):
     18        * dom/WebKitNamedFlow.h:
     19        (WebKitNamedFlow):
     20        * dom/WebKitNamedFlow.idl:
     21
    1222012-08-06  Andrei Bucur  <abucur@adobe.com>
    223
  • trunk/Source/WebCore/dom/WebKitNamedFlow.cpp

    r124350 r124772  
    118118        for (RenderRegionList::const_iterator iter = regionList.begin(); iter != regionList.end(); ++iter) {
    119119            const RenderRegion* renderRegion = *iter;
    120             if (!renderRegion->isValid())
     120            // FIXME: Pseudo-elements are not included in the list
     121            if (!renderRegion->isValid() || !renderRegion->node())
    121122                continue;
    122123            if (m_parentFlowThread->objectInFlowRegion(contentNode->renderer(), renderRegion))
    123124                regionNodes.append(renderRegion->node());
    124125        }
     126    }
     127
     128    return StaticNodeList::adopt(regionNodes);
     129}
     130
     131PassRefPtr<NodeList> WebKitNamedFlow::getRegions()
     132{
     133    Vector<RefPtr<Node> > regionNodes;
     134
     135    if (m_flowManager->document())
     136        m_flowManager->document()->updateLayoutIgnorePendingStylesheets();
     137
     138    // The renderer may be destroyed or created after the style update.
     139    // Because this is called from JS, where the wrapper keeps a reference to the NamedFlow, no guard is necessary.
     140    if (!m_parentFlowThread)
     141        return StaticNodeList::adopt(regionNodes);
     142
     143    const RenderRegionList& regionList = m_parentFlowThread->renderRegionList();
     144    for (RenderRegionList::const_iterator iter = regionList.begin(); iter != regionList.end(); ++iter) {
     145        const RenderRegion* renderRegion = *iter;
     146        // FIXME: Pseudo-elements are not included in the list
     147        if (!renderRegion->isValid() || !renderRegion->node())
     148            continue;
     149        regionNodes.append(renderRegion->node());
    125150    }
    126151
  • trunk/Source/WebCore/dom/WebKitNamedFlow.h

    r124350 r124772  
    5757    int firstEmptyRegionIndex() const;
    5858    PassRefPtr<NodeList> getRegionsByContent(Node*);
     59    PassRefPtr<NodeList> getRegions();
    5960    PassRefPtr<NodeList> getContent();
    6061
  • trunk/Source/WebCore/dom/WebKitNamedFlow.idl

    r124350 r124772  
    3838        readonly attribute long firstEmptyRegionIndex;
    3939        NodeList getRegionsByContent(in Node contentNode);
     40        NodeList getRegions();
    4041        NodeList getContent();
    4142       
Note: See TracChangeset for help on using the changeset viewer.