Changeset 98805 in webkit


Ignore:
Timestamp:
Oct 29, 2011 7:52:05 AM (12 years ago)
Author:
robert@webkit.org
Message:

CSS 2.1 failure: dynamic-top-change-001 to 004 fail
https://bugs.webkit.org/show_bug.cgi?id=68149

Reviewed by David Hyatt.

Source/WebCore:

In these tests a child inherits its top value from its parent and the parent's top value
is later updated by an onload event. The updated value is expected to cascade to the child.

The tests were failing because updating the value did not cascade immediately to the child inheriting it, though
it could be forced eventually with a full recalculation of the RenderStyle by changing the zoom factor
or opening the inspector.

The fix is to let the parent RenderStyle know that a child inherits a property explicitly and
recalculate children's style if the parent ever changes. This only happens if the property is inherited
explicitly, it does not apply to cases where the property is inherited by default.

  • css/CSSStyleSelector.cpp:

(WebCore::CSSStyleSelector::applyProperty):

  • dom/Node.cpp:

(WebCore::Node::diff):

  • rendering/style/RenderStyle.cpp:

(WebCore::RenderStyle::RenderStyle):

  • rendering/style/RenderStyle.h:

(WebCore::InheritedFlags::setHasExplicitlyInheritedProperties):
(WebCore::InheritedFlags::hasExplicitlyInheritedProperties):

LayoutTests:

  • css2.1/20110323/dynamic-top-change-001.htm: Added.
  • css2.1/20110323/dynamic-top-change-002.htm: Added.
  • css2.1/20110323/dynamic-top-change-003.htm: Added.
  • css2.1/20110323/dynamic-top-change-004.htm: Added.
  • fast/table/border-collapsing/cached-change-tbody-border-color-expected.png: See https://bugs.webkit.org/show_bug.cgi?id=68149#c15
  • platform/chromium-linux/css2.1/20110323/dynamic-top-change-001-expected.png: Added.
  • platform/chromium-linux/css2.1/20110323/dynamic-top-change-001-expected.txt: Added.
  • platform/chromium-linux/css2.1/20110323/dynamic-top-change-002-expected.png: Added.
  • platform/chromium-linux/css2.1/20110323/dynamic-top-change-002-expected.txt: Added.
  • platform/chromium-linux/css2.1/20110323/dynamic-top-change-003-expected.png: Added.
  • platform/chromium-linux/css2.1/20110323/dynamic-top-change-003-expected.txt: Added.
  • platform/chromium-linux/css2.1/20110323/dynamic-top-change-004-expected.png: Added.
  • platform/chromium-linux/css2.1/20110323/dynamic-top-change-004-expected.txt: Added.
Location:
trunk
Files:
12 added
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r98800 r98805  
     12011-10-27  Robert Hogan  <robert@webkit.org>
     2
     3        CSS 2.1 failure: dynamic-top-change-001 to 004 fail
     4        https://bugs.webkit.org/show_bug.cgi?id=68149
     5
     6        Reviewed by David Hyatt.
     7
     8        * css2.1/20110323/dynamic-top-change-001.htm: Added.
     9        * css2.1/20110323/dynamic-top-change-002.htm: Added.
     10        * css2.1/20110323/dynamic-top-change-003.htm: Added.
     11        * css2.1/20110323/dynamic-top-change-004.htm: Added.
     12        * fast/table/border-collapsing/cached-change-tbody-border-color-expected.png:
     13          See https://bugs.webkit.org/show_bug.cgi?id=68149#c15
     14        * platform/chromium-linux/css2.1/20110323/dynamic-top-change-001-expected.png: Added.
     15        * platform/chromium-linux/css2.1/20110323/dynamic-top-change-001-expected.txt: Added.
     16        * platform/chromium-linux/css2.1/20110323/dynamic-top-change-002-expected.png: Added.
     17        * platform/chromium-linux/css2.1/20110323/dynamic-top-change-002-expected.txt: Added.
     18        * platform/chromium-linux/css2.1/20110323/dynamic-top-change-003-expected.png: Added.
     19        * platform/chromium-linux/css2.1/20110323/dynamic-top-change-003-expected.txt: Added.
     20        * platform/chromium-linux/css2.1/20110323/dynamic-top-change-004-expected.png: Added.
     21        * platform/chromium-linux/css2.1/20110323/dynamic-top-change-004-expected.txt: Added.
     22
    1232011-10-28  Antti Koivisto  <antti@apple.com>
    224
  • trunk/Source/WebCore/ChangeLog

    r98803 r98805  
     12011-10-28  Robert Hogan  <robert@webkit.org>
     2
     3        CSS 2.1 failure: dynamic-top-change-001 to 004 fail
     4        https://bugs.webkit.org/show_bug.cgi?id=68149
     5
     6        Reviewed by David Hyatt.
     7
     8        In these tests a child inherits its top value from its parent and the parent's top value
     9        is later updated by an onload event. The updated value is expected to cascade to the child.
     10
     11        The tests were failing because updating the value did not cascade immediately to the child inheriting it, though
     12        it could be forced eventually with a full recalculation of the RenderStyle by changing the zoom factor
     13        or opening the inspector.
     14
     15        The fix is to let the parent RenderStyle know that a child inherits a property explicitly and
     16        recalculate children's style if the parent ever changes. This only happens if the property is inherited
     17        explicitly, it does not apply to cases where the property is inherited by default.
     18
     19        * css/CSSStyleSelector.cpp:
     20        (WebCore::CSSStyleSelector::applyProperty):
     21        * dom/Node.cpp:
     22        (WebCore::Node::diff):
     23        * rendering/style/RenderStyle.cpp:
     24        (WebCore::RenderStyle::RenderStyle):
     25        * rendering/style/RenderStyle.h:
     26        (WebCore::InheritedFlags::setHasExplicitlyInheritedProperties):
     27        (WebCore::InheritedFlags::hasExplicitlyInheritedProperties):
     28
    1292011-10-29  Antti Koivisto  <antti@apple.com>
    230
  • trunk/Source/WebCore/css/CSSStyleSelector.cpp

    r98803 r98805  
    24972497
    24982498    CSSPropertyID property = static_cast<CSSPropertyID>(id);
     2499
     2500    if (isInherit && m_parentStyle && !m_parentStyle->hasExplicitlyInheritedProperties() && !CSSProperty::isInheritedProperty(property))
     2501        m_parentStyle->setHasExplicitlyInheritedProperties();
    24992502
    25002503    // check lookup table for implementations and use when available
  • trunk/Source/WebCore/dom/Node.cpp

    r98659 r98805  
    303303Node::StyleChange Node::diff(const RenderStyle* s1, const RenderStyle* s2)
    304304{
    305     // FIXME: The behavior of this function is just totally wrong.  It doesn't handle
    306     // explicit inheritance of non-inherited properties and so you end up not re-resolving
    307     // style in cases where you need to.
    308305    StyleChange ch = NoInherit;
    309306    EDisplay display1 = s1 ? s1->display() : NONE;
     
    325322    else if (s1->inheritedNotEqual(s2))
    326323        ch = Inherit;
    327    
     324    else if (s1->hasExplicitlyInheritedProperties() || s2->hasExplicitlyInheritedProperties())
     325        ch = Inherit;
     326
    328327    // For nth-child and other positional rules, treat styles as different if they have
    329328    // changed positionally in the DOM. This way subsequent sibling resolutions won't be confused
  • trunk/Source/WebCore/rendering/style/RenderStyle.cpp

    r98542 r98805  
    8686    , m_firstChildState(false)
    8787    , m_lastChildState(false)
     88    , m_explicitInheritance(false)
    8889    , m_childIndex(0)
    8990    , m_box(defaultStyle()->m_box)
     
    115116    , m_firstChildState(false)
    116117    , m_lastChildState(false)
     118    , m_explicitInheritance(false)
    117119    , m_childIndex(0)
    118120{
     
    155157    , m_firstChildState(false)
    156158    , m_lastChildState(false)
     159    , m_explicitInheritance(false)
    157160    , m_childIndex(0)
    158161    , m_box(o.m_box)
  • trunk/Source/WebCore/rendering/style/RenderStyle.h

    r98748 r98805  
    144144    bool m_firstChildState : 1;
    145145    bool m_lastChildState : 1;
    146     unsigned m_childIndex : 21; // Plenty of bits to cache an index.
     146    bool m_explicitInheritance : 1;
     147    unsigned m_childIndex : 20; // Plenty of bits to cache an index.
    147148
    148149    // non-inherited attributes
     
    164165#endif
    165166
    166 // !START SYNC!: Keep this in sync with the copy constructor in RenderStyle.cpp
     167// !START SYNC!: Keep this in sync with the copy constructor in RenderStyle.cpp and implicitlyInherited() in CSSStyleSelector.cpp
    167168
    168169    // inherit
     
    13531354    Color visitedDependentColor(int colorProperty) const;
    13541355
     1356    void setHasExplicitlyInheritedProperties() { m_explicitInheritance = true; }
     1357    bool hasExplicitlyInheritedProperties() const { return m_explicitInheritance; }
     1358   
    13551359    // Initial values for all the properties
    13561360    static EBorderCollapse initialBorderCollapse() { return BSEPARATE; }
Note: See TracChangeset for help on using the changeset viewer.