Changeset 166781 in webkit


Ignore:
Timestamp:
Apr 4, 2014 8:05:43 AM (10 years ago)
Author:
mihnea@adobe.com
Message:

[CSSRegions] Region's behaviour not updated when becoming valid from invalid
https://bugs.webkit.org/show_bug.cgi?id=131211

Reviewed by Andrei Bucur.

Source/WebCore:

When a region becomes valid again from invalid, it was part of a dependency cycle and the dependency cycle was broken,
it needs to behave like a valid region again: if it has autoheight then it should compute its height based on the
named flow content, if it has region styling then it should apply the additional style to the flowed content.

Added a new method, updateRegionFlags, that is used to ensure that auto-height and region-styling flags
are properly set in several situations. Checking the behaviour, autoheight or styling, is done only
if the region is valid.

Tests: fast/regions/auto-size/autoheight-region-valid-from-invalid.html

fast/regions/region-styling/region-withstyling-valid-from-invalid.html

  • rendering/RenderNamedFlowFragment.cpp:

(WebCore::RenderNamedFlowFragment::updateRegionFlags):
(WebCore::RenderNamedFlowFragment::styleDidChange):
(WebCore::RenderNamedFlowFragment::updateRegionHasAutoLogicalHeightFlag):
(WebCore::RenderNamedFlowFragment::checkRegionStyle):
(WebCore::RenderNamedFlowFragment::attachRegion):
(WebCore::RenderNamedFlowFragment::detachRegion):

  • rendering/RenderNamedFlowFragment.h:
  • rendering/RenderNamedFlowThread.cpp:

(WebCore::RenderNamedFlowThread::addFragmentToNamedFlowThread):

LayoutTests:

Add tests for auto-height and region styling behaviour.

  • fast/regions/auto-size/autoheight-region-valid-from-invalid-expected.html: Added.
  • fast/regions/auto-size/autoheight-region-valid-from-invalid.html: Added.
  • fast/regions/region-styling/region-withstyling-valid-from-invalid-expected.html: Added.
  • fast/regions/region-styling/region-withstyling-valid-from-invalid.html: Added.
Location:
trunk
Files:
4 added
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r166778 r166781  
     12014-04-04  Mihnea Ovidenie  <mihnea@adobe.com>
     2
     3        [CSSRegions] Region's behaviour not updated when becoming valid from invalid
     4        https://bugs.webkit.org/show_bug.cgi?id=131211
     5
     6        Reviewed by Andrei Bucur.
     7
     8        Add tests for auto-height and region styling behaviour.
     9
     10        * fast/regions/auto-size/autoheight-region-valid-from-invalid-expected.html: Added.
     11        * fast/regions/auto-size/autoheight-region-valid-from-invalid.html: Added.
     12        * fast/regions/region-styling/region-withstyling-valid-from-invalid-expected.html: Added.
     13        * fast/regions/region-styling/region-withstyling-valid-from-invalid.html: Added.
     14
    1152014-04-04  Sergio Villar Senin  <svillar@igalia.com>
    216
  • trunk/Source/WebCore/ChangeLog

    r166780 r166781  
     12014-04-04  Mihnea Ovidenie  <mihnea@adobe.com>
     2
     3        [CSSRegions] Region's behaviour not updated when becoming valid from invalid
     4        https://bugs.webkit.org/show_bug.cgi?id=131211
     5
     6        Reviewed by Andrei Bucur.
     7
     8        When a region becomes valid again from invalid, it was part of a dependency cycle and the dependency cycle was broken,
     9        it needs to behave like a valid region again: if it has autoheight then it should compute its height based on the
     10        named flow content, if it has region styling then it should apply the additional style to the flowed content.
     11
     12        Added a new method, updateRegionFlags, that is used to ensure that auto-height and region-styling flags
     13        are properly set in several situations. Checking the behaviour, autoheight or styling, is done only
     14        if the region is valid.
     15
     16        Tests: fast/regions/auto-size/autoheight-region-valid-from-invalid.html
     17               fast/regions/region-styling/region-withstyling-valid-from-invalid.html
     18
     19        * rendering/RenderNamedFlowFragment.cpp:
     20        (WebCore::RenderNamedFlowFragment::updateRegionFlags):
     21        (WebCore::RenderNamedFlowFragment::styleDidChange):
     22        (WebCore::RenderNamedFlowFragment::updateRegionHasAutoLogicalHeightFlag):
     23        (WebCore::RenderNamedFlowFragment::checkRegionStyle):
     24        (WebCore::RenderNamedFlowFragment::attachRegion):
     25        (WebCore::RenderNamedFlowFragment::detachRegion):
     26        * rendering/RenderNamedFlowFragment.h:
     27        * rendering/RenderNamedFlowThread.cpp:
     28        (WebCore::RenderNamedFlowThread::addFragmentToNamedFlowThread):
     29
    1302014-04-04  Raphael Kubo da Costa  <raphael.kubo.da.costa@intel.com>
    231
  • trunk/Source/WebCore/rendering/RenderNamedFlowFragment.cpp

    r166301 r166781  
    6868}
    6969
     70void RenderNamedFlowFragment::updateRegionFlags()
     71{
     72    checkRegionStyle();
     73    updateRegionHasAutoLogicalHeightFlag();
     74}
     75
    7076void RenderNamedFlowFragment::styleDidChange(StyleDifference diff, const RenderStyle* oldStyle)
    7177{
    7278    RenderRegion::styleDidChange(diff, oldStyle);
    7379
    74     // If the region is not attached to any thread, there is no need to check
    75     // whether the region has region styling since no content will be displayed
    76     // into the region.
    77     if (!m_flowThread) {
    78         setHasCustomRegionStyle(false);
    79         return;
    80     }
    81 
    82     updateRegionHasAutoLogicalHeightFlag();
    83 
    84     checkRegionStyle();
     80    if (!isValid())
     81        return;
     82
     83    updateRegionFlags();
    8584
    8685    if (parent() && parent()->needsLayout())
     
    121120void RenderNamedFlowFragment::updateRegionHasAutoLogicalHeightFlag()
    122121{
    123     ASSERT(m_flowThread);
    124 
    125     if (!isValid())
    126         return;
     122    ASSERT(isValid());
    127123
    128124    bool didHaveAutoLogicalHeight = m_hasAutoLogicalHeight;
    129125    m_hasAutoLogicalHeight = shouldHaveAutoLogicalHeight();
    130     if (m_hasAutoLogicalHeight != didHaveAutoLogicalHeight) {
    131         if (m_hasAutoLogicalHeight)
    132             incrementAutoLogicalHeightCount();
    133         else {
    134             clearComputedAutoHeight();
    135             decrementAutoLogicalHeightCount();
    136         }
     126    if (didHaveAutoLogicalHeight == m_hasAutoLogicalHeight)
     127        return;
     128
     129    if (m_hasAutoLogicalHeight)
     130        incrementAutoLogicalHeightCount();
     131    else {
     132        clearComputedAutoHeight();
     133        decrementAutoLogicalHeightCount();
    137134    }
    138135}
     
    339336void RenderNamedFlowFragment::checkRegionStyle()
    340337{
    341     ASSERT(m_flowThread);
     338    ASSERT(isValid());
     339
    342340    bool customRegionStyle = false;
    343341
     
    509507    RenderRegion::attachRegion();
    510508
    511     if (documentBeingDestroyed() || !m_flowThread)
    512         return;
    513 
    514     // The region just got attached to the flow thread, lets check whether
    515     // it has region styling rules associated.
    516     checkRegionStyle();
    517 
    518     if (!isValid())
    519         return;
    520 
    521     m_hasAutoLogicalHeight = shouldHaveAutoLogicalHeight();
    522     if (hasAutoLogicalHeight())
    523         incrementAutoLogicalHeightCount();
     509    if (documentBeingDestroyed() || !isValid())
     510        return;
     511
     512    updateRegionFlags();
    524513}
    525514
    526515void RenderNamedFlowFragment::detachRegion()
    527516{
    528     if (m_flowThread && hasAutoLogicalHeight())
     517    if (hasAutoLogicalHeight()) {
     518        ASSERT(isValid());
     519        m_hasAutoLogicalHeight = false;
     520        clearComputedAutoHeight();
    529521        decrementAutoLogicalHeightCount();
     522    }
    530523   
    531524    RenderRegion::detachRegion();
  • trunk/Source/WebCore/rendering/RenderNamedFlowFragment.h

    r165542 r166781  
    8181
    8282    bool hasCustomRegionStyle() const { return m_hasCustomRegionStyle; }
    83     void setHasCustomRegionStyle(bool hasCustomRegionStyle) { m_hasCustomRegionStyle = hasCustomRegionStyle; }
    8483    void clearObjectStyleInRegion(const RenderObject*);
    8584
     
    116115    virtual void updateLogicalHeight() override;
    117116
    118 // FIXME: Temporarily public until we move all the CSSRegions functionality from RenderRegion to here.
    119 public:
    120     void checkRegionStyle();
     117    void updateRegionFlags();
    121118
    122119private:
     
    126123    void computeChildrenStyleInRegion(RenderElement&);
    127124    void setObjectStyleInRegion(RenderObject*, PassRefPtr<RenderStyle>, bool objectRegionStyleCached);
     125
     126    void checkRegionStyle();
     127    void setHasCustomRegionStyle(bool hasCustomRegionStyle) { m_hasCustomRegionStyle = hasCustomRegionStyle; }
    128128
    129129    void updateRegionHasAutoLogicalHeightFlag();
  • trunk/Source/WebCore/rendering/RenderNamedFlowThread.cpp

    r166354 r166781  
    220220
    221221    renderNamedFlowFragment->setIsValid(true);
     222    renderNamedFlowFragment->updateRegionFlags();
    222223    addFragmentToList(m_regionList, renderNamedFlowFragment);
    223224
Note: See TracChangeset for help on using the changeset viewer.