Changeset 128861 in webkit


Ignore:
Timestamp:
Sep 18, 2012 1:39:59 AM (12 years ago)
Author:
mihnea@adobe.com
Message:

[CSSRegions]Flag auto-height regions
https://bugs.webkit.org/show_bug.cgi?id=96267

Reviewed by Julien Chaffraix.

Source/WebCore:

The regions having auto logical height should be flagged so that their height will computed as part of a 2 pass-layout mechanism.
A valid region is flagged as having auto logical height if:

  • has auto logical height and is part of the normal flow
  • has auto logical height, is not part of normal flow and does not have logical top/bottom specified

An invalid region (part of circular dependency) will not be marked even if its style matches the above situations.

Test: fast/regions/autoheight-regions-mark.html

  • rendering/FlowThreadController.cpp: Keep a counter of auto logical height valid regions.

(WebCore::FlowThreadController::FlowThreadController):
(WebCore::FlowThreadController::layoutRenderNamedFlowThreads): Verify that the current number of auto logical height regions is correct by iterating over all the regions attached to the flow threads
and compute the number of auto logical height regions on the spot.
(WebCore):
(WebCore::FlowThreadController::isAutoLogicalHeightRegionsFlagConsistent): Helper function that is used to verify the number of auto logical height regions.

  • rendering/FlowThreadController.h:

(WebCore::FlowThreadController::hasAutoLogicalHeightRegions):
(WebCore::FlowThreadController::incrementAutoLogicalHeightRegions):
(WebCore::FlowThreadController::decrementAutoLogicalHeightRegions):
(FlowThreadController):

  • rendering/RenderFlowThread.cpp:

(WebCore):
(WebCore::RenderFlowThread::autoLogicalHeightRegionsCount): Helper function that is used to count the number of regions marked as having auto logical height.

  • rendering/RenderFlowThread.h:
  • rendering/RenderRegion.cpp:

(WebCore::RenderRegion::RenderRegion):
(WebCore::RenderRegion::updateRegionHasAutoLogicalHeightFlag):
(WebCore):
(WebCore::RenderRegion::styleDidChange): For a region that is attached to a flow thread, verify whether the style change modified its auto logical height appearance.
(WebCore::RenderRegion::attachRegion): Handle the case of attaching region to a flow thread and the detach/attach sequence when the region is moved in the render tree.
(WebCore::RenderRegion::detachRegion):

  • rendering/RenderRegion.h:

(WebCore::RenderRegion::shouldHaveAutoLogicalHeight):
(WebCore::RenderRegion::hasAutoLogicalHeight):
(RenderRegion):

  • rendering/RenderTreeAsText.cpp: For the regions that use auto logical height, modify the output to reflect that.

(WebCore::writeRenderNamedFlowThreads):

LayoutTests:

The regions having auto logical height should be flagged so that their height will computed as part of a 2 pass-layout mechanism.
Added a test that checks whether a region in several situations is marked properly.

  • fast/regions/autoheight-regions-mark.html: Added.
  • platform/mac/fast/regions/autoheight-regions-mark-expected.png: Added.
  • platform/mac/fast/regions/autoheight-regions-mark-expected.txt: Added.
  • platform/chromium/TestExpectations:
Location:
trunk
Files:
3 added
10 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r128856 r128861  
     12012-09-18  Mihnea Ovidenie  <mihnea@adobe.com>
     2
     3        [CSSRegions]Flag auto-height regions
     4        https://bugs.webkit.org/show_bug.cgi?id=96267
     5
     6        Reviewed by Julien Chaffraix.
     7
     8        The regions having auto logical height should be flagged so that their height will computed as part of a 2 pass-layout mechanism.
     9        Added a test that checks whether a region in several situations is marked properly.
     10
     11        * fast/regions/autoheight-regions-mark.html: Added.
     12        * platform/mac/fast/regions/autoheight-regions-mark-expected.png: Added.
     13        * platform/mac/fast/regions/autoheight-regions-mark-expected.txt: Added.
     14        * platform/chromium/TestExpectations:
     15
    1162012-09-18  Shinya Kawanaka  <shinyak@chromium.org>
    217
  • trunk/LayoutTests/platform/chromium/TestExpectations

    r128847 r128861  
    24902490BUGWK74219 : fast/regions/positioned-objects-block-static-spanning-regions.html = PASS IMAGE
    24912491
     2492BUGWK96267 : fast/regions/autoheight-regions-mark.html = PASS
     2493
    24922494BUGWK74137 SNOWLEOPARD : fast/regions/outline-sides-in-region.html = PASS TIMEOUT
    24932495BUGWK83824 MAC : fast/regions/region-overflow-break.html = IMAGE
  • trunk/Source/WebCore/ChangeLog

    r128856 r128861  
     12012-09-18  Mihnea Ovidenie  <mihnea@adobe.com>
     2
     3        [CSSRegions]Flag auto-height regions
     4        https://bugs.webkit.org/show_bug.cgi?id=96267
     5
     6        Reviewed by Julien Chaffraix.
     7
     8        The regions having auto logical height should be flagged so that their height will computed as part of a 2 pass-layout mechanism.
     9        A valid region is flagged as having auto logical height if:
     10        - has auto logical height and is part of the normal flow
     11        - has auto logical height, is not part of normal flow and does not have logical top/bottom specified
     12
     13        An invalid region (part of circular dependency) will not be marked even if its style matches the above situations.
     14
     15        Test: fast/regions/autoheight-regions-mark.html
     16
     17        * rendering/FlowThreadController.cpp: Keep a counter of auto logical height valid regions.
     18        (WebCore::FlowThreadController::FlowThreadController):
     19        (WebCore::FlowThreadController::layoutRenderNamedFlowThreads): Verify that the current number of auto logical height regions is correct by iterating over all the regions attached to the flow threads
     20        and compute the number of auto logical height regions on the spot.
     21        (WebCore):
     22        (WebCore::FlowThreadController::isAutoLogicalHeightRegionsFlagConsistent): Helper function that is used to verify the number of auto logical height regions.
     23        * rendering/FlowThreadController.h:
     24        (WebCore::FlowThreadController::hasAutoLogicalHeightRegions):
     25        (WebCore::FlowThreadController::incrementAutoLogicalHeightRegions):
     26        (WebCore::FlowThreadController::decrementAutoLogicalHeightRegions):
     27        (FlowThreadController):
     28        * rendering/RenderFlowThread.cpp:
     29        (WebCore):
     30        (WebCore::RenderFlowThread::autoLogicalHeightRegionsCount): Helper function that is used to count the number of regions marked as having auto logical height.
     31        * rendering/RenderFlowThread.h:
     32        * rendering/RenderRegion.cpp:
     33        (WebCore::RenderRegion::RenderRegion):
     34        (WebCore::RenderRegion::updateRegionHasAutoLogicalHeightFlag):
     35        (WebCore):
     36        (WebCore::RenderRegion::styleDidChange): For a region that is attached to a flow thread, verify whether the style change modified its auto logical height appearance.
     37        (WebCore::RenderRegion::attachRegion): Handle the case of attaching region to a flow thread and the detach/attach sequence when the region is moved in the render tree.
     38        (WebCore::RenderRegion::detachRegion):
     39        * rendering/RenderRegion.h:
     40        (WebCore::RenderRegion::shouldHaveAutoLogicalHeight):
     41        (WebCore::RenderRegion::hasAutoLogicalHeight):
     42        (RenderRegion):
     43        * rendering/RenderTreeAsText.cpp: For the regions that use auto logical height, modify the output to reflect that.
     44        (WebCore::writeRenderNamedFlowThreads):
     45
    1462012-09-18  Shinya Kawanaka  <shinyak@chromium.org>
    247
  • trunk/Source/WebCore/rendering/FlowThreadController.cpp

    r126961 r128861  
    5050    , m_currentRenderFlowThread(0)
    5151    , m_isRenderNamedFlowThreadOrderDirty(false)
     52    , m_autoLogicalHeightRegionsCount(0)
    5253{
    5354}
     
    9899{
    99100    ASSERT(m_renderNamedFlowThreadList);
     101
     102    ASSERT(isAutoLogicalHeightRegionsFlagConsistent());
    100103
    101104    // Remove the left-over flow threads.
     
    157160}
    158161
     162#ifndef NDEBUG
     163bool FlowThreadController::isAutoLogicalHeightRegionsFlagConsistent() const
     164{
     165    if (!hasRenderNamedFlowThreads())
     166        return !hasAutoLogicalHeightRegions();
     167
     168    // Count the number of auto height regions
     169    unsigned autoLogicalHeightRegions = 0;
     170    for (RenderNamedFlowThreadList::iterator iter = m_renderNamedFlowThreadList->begin(); iter != m_renderNamedFlowThreadList->end(); ++iter) {
     171        RenderNamedFlowThread* flowRenderer = *iter;
     172        autoLogicalHeightRegions += flowRenderer->autoLogicalHeightRegionsCount();
     173    }
     174
     175    return autoLogicalHeightRegions == m_autoLogicalHeightRegionsCount;
     176}
     177#endif
     178
    159179} // namespace WebCore
  • trunk/Source/WebCore/rendering/FlowThreadController.h

    r128572 r128861  
    6868    void unregisterNamedFlowContentNode(Node*);
    6969
     70    bool hasAutoLogicalHeightRegions() const { return m_autoLogicalHeightRegionsCount; }
     71    void incrementAutoLogicalHeightRegions() { ++m_autoLogicalHeightRegionsCount; }
     72    void decrementAutoLogicalHeightRegions() { ASSERT(m_autoLogicalHeightRegionsCount > 0); --m_autoLogicalHeightRegionsCount; }
     73
     74#ifndef NDEBUG
     75    bool isAutoLogicalHeightRegionsFlagConsistent() const;
     76#endif
     77
    7078protected:
    7179    FlowThreadController(RenderView*);
     
    7583    RenderFlowThread* m_currentRenderFlowThread;
    7684    bool m_isRenderNamedFlowThreadOrderDirty;
     85    unsigned m_autoLogicalHeightRegionsCount;
    7786    OwnPtr<RenderNamedFlowThreadList> m_renderNamedFlowThreadList;
    7887    // maps a content node to its render flow thread.
  • trunk/Source/WebCore/rendering/RenderFlowThread.cpp

    r128201 r128861  
    755755}
    756756
     757#ifndef NDEBUG
     758unsigned RenderFlowThread::autoLogicalHeightRegionsCount() const
     759{
     760    unsigned autoLogicalHeightRegions = 0;
     761    for (RenderRegionList::const_iterator iter = m_regionList.begin(); iter != m_regionList.end(); ++iter) {
     762        const RenderRegion* region = *iter;
     763        if (!region->isValid()) {
     764            ASSERT(!region->hasAutoLogicalHeight());
     765            continue;
     766        }
     767
     768        if (region->hasAutoLogicalHeight())
     769            autoLogicalHeightRegions++;
     770    }
     771
     772    return autoLogicalHeightRegions;
     773}
     774#endif
     775
    757776CurrentRenderFlowThreadMaintainer::CurrentRenderFlowThreadMaintainer(RenderFlowThread* renderFlowThread)
    758777        : m_renderFlowThread(renderFlowThread)
  • trunk/Source/WebCore/rendering/RenderFlowThread.h

    r128335 r128861  
    132132    bool pageLogicalHeightChanged() const { return m_pageLogicalHeightChanged; }
    133133
     134#ifndef NDEBUG
     135    unsigned autoLogicalHeightRegionsCount() const;
     136#endif
     137
    134138protected:
    135139    virtual const char* renderName() const = 0;
  • trunk/Source/WebCore/rendering/RenderRegion.cpp

    r128416 r128861  
    5050    , m_isValid(false)
    5151    , m_hasCustomRegionStyle(false)
     52    , m_hasAutoLogicalHeight(false)
    5253    , m_regionState(RegionUndefined)
    5354{
     
    173174}
    174175
     176void RenderRegion::updateRegionHasAutoLogicalHeightFlag()
     177{
     178    ASSERT(m_flowThread);
     179
     180    if (!isValid())
     181        return;
     182
     183    bool didHaveAutoLogicalHeight = m_hasAutoLogicalHeight;
     184    m_hasAutoLogicalHeight = shouldHaveAutoLogicalHeight();
     185    if (m_hasAutoLogicalHeight != didHaveAutoLogicalHeight) {
     186        if (m_hasAutoLogicalHeight)
     187            view()->flowThreadController()->incrementAutoLogicalHeightRegions();
     188        else
     189            view()->flowThreadController()->decrementAutoLogicalHeightRegions();
     190    }
     191}
     192
    175193void RenderRegion::styleDidChange(StyleDifference diff, const RenderStyle* oldStyle)
    176194{
     
    186204
    187205    checkRegionStyle();
     206    updateRegionHasAutoLogicalHeightFlag();
    188207}
    189208
     
    283302    // it has region styling rules associated.
    284303    checkRegionStyle();
     304
     305    if (!isValid())
     306        return;
     307
     308    m_hasAutoLogicalHeight = shouldHaveAutoLogicalHeight();
     309    if (hasAutoLogicalHeight())
     310        view()->flowThreadController()->incrementAutoLogicalHeightRegions();
    285311}
    286312
    287313void RenderRegion::detachRegion()
    288314{
    289     if (m_flowThread)
     315    if (m_flowThread) {
    290316        m_flowThread->removeRegionFromThread(this);
     317        if (hasAutoLogicalHeight()) {
     318            ASSERT(isValid());
     319            view()->flowThreadController()->decrementAutoLogicalHeightRegions();
     320        }
     321    }
    291322    m_flowThread = 0;
    292323}
  • trunk/Source/WebCore/rendering/RenderRegion.h

    r128416 r128861  
    115115    virtual LayoutUnit logicalHeightOfAllFlowThreadContent() const;
    116116
     117    bool shouldHaveAutoLogicalHeight() const
     118    {
     119        bool hasSpecifiedEndpointsForHeight = style()->logicalTop().isSpecified() && style()->logicalBottom().isSpecified();
     120        bool hasAnchoredEndpointsForHeight = isOutOfFlowPositioned() && hasSpecifiedEndpointsForHeight;
     121        return style()->logicalHeight().isAuto() && !hasAnchoredEndpointsForHeight;
     122    }
     123    bool hasAutoLogicalHeight() const { return m_hasAutoLogicalHeight; }
     124
    117125    // The top of the nearest page inside the region. For RenderRegions, this is just the logical top of the
    118126    // flow thread portion we contain. For sets, we have to figure out the top of the nearest column or
     
    155163
    156164    void checkRegionStyle();
     165    void updateRegionHasAutoLogicalHeightFlag();
    157166
    158167protected:
     
    186195    RenderObjectRegionStyleMap m_renderObjectRegionStyle;
    187196
    188     bool m_isValid;
    189     bool m_hasCustomRegionStyle;
     197    bool m_isValid : 1;
     198    bool m_hasCustomRegionStyle : 1;
     199    bool m_hasAutoLogicalHeight : 1;
    190200    RegionState m_regionState;
    191201};
  • trunk/Source/WebCore/rendering/RenderTreeAsText.cpp

    r128564 r128861  
    695695                    if (renderRegion->hasCustomRegionStyle())
    696696                        ts << " region style: 1";
     697                    if (renderRegion->hasAutoLogicalHeight())
     698                        ts << " hasAutoLogicalHeight";
    697699                }
    698700                if (!renderRegion->isValid())
Note: See TracChangeset for help on using the changeset viewer.