Changeset 63653 in webkit


Ignore:
Timestamp:
Jul 19, 2010 7:06:01 AM (14 years ago)
Author:
andreas.kling@nokia.com
Message:

2010-07-19 Andreas Kling <andreas.kling@nokia.com>

Reviewed by Kenneth Rohde Christiansen.

CSS3 background: Number of layers should be determined by background-image element count
https://bugs.webkit.org/show_bug.cgi?id=41201

Manual test: css3-background-layer-count.html

Spec link:
http://www.w3.org/TR/css3-background/#layering

  • manual-tests/css3-background-layer-count.html: Added.
  • rendering/style/FillLayer.cpp: (WebCore::FillLayer::fillUnsetProperties): Don't repeat image properties, they determine the total number of layers. (WebCore::FillLayer::cullEmptyLayers): Change culling logic to discard all layers after the first one without an image set.
  • rendering/style/RenderStyle.h: (WebCore::InheritedFlags::adjustBackgroundLayers): Call fillUnsetProperties() before cullEmptyLayers() (WebCore::InheritedFlags::adjustMaskLayers): Ditto.
Location:
trunk/WebCore
Files:
1 added
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/WebCore/ChangeLog

    r63652 r63653  
     12010-07-19  Andreas Kling  <andreas.kling@nokia.com>
     2
     3        Reviewed by Kenneth Rohde Christiansen.
     4
     5        CSS3 background: Number of layers should be determined by background-image element count
     6        https://bugs.webkit.org/show_bug.cgi?id=41201
     7
     8        Manual test: css3-background-layer-count.html
     9
     10        Spec link:
     11        http://www.w3.org/TR/css3-background/#layering
     12
     13        * manual-tests/css3-background-layer-count.html: Added.
     14        * rendering/style/FillLayer.cpp:
     15        (WebCore::FillLayer::fillUnsetProperties): Don't repeat
     16        image properties, they determine the total number of layers.
     17        (WebCore::FillLayer::cullEmptyLayers): Change culling logic
     18        to discard all layers after the first one without an image set.
     19        * rendering/style/RenderStyle.h:
     20        (WebCore::InheritedFlags::adjustBackgroundLayers): Call
     21        fillUnsetProperties() before cullEmptyLayers()
     22        (WebCore::InheritedFlags::adjustMaskLayers): Ditto.
     23
    1242010-07-19  Andreas Kling  <andreas.kling@nokia.com>
    225
  • trunk/WebCore/rendering/style/FillLayer.cpp

    r63213 r63653  
    130130{
    131131    FillLayer* curr;
    132     for (curr = this; curr && curr->isImageSet(); curr = curr->next()) { }
    133     if (curr && curr != this) {
    134         // We need to fill in the remaining values with the pattern specified.
    135         for (FillLayer* pattern = this; curr; curr = curr->next()) {
    136             curr->m_image = pattern->m_image;
    137             pattern = pattern->next();
    138             if (pattern == curr || !pattern)
    139                 pattern = this;
    140         }
    141     }
    142    
    143132    for (curr = this; curr && curr->isXPositionSet(); curr = curr->next()) { }
    144133    if (curr && curr != this) {
     
    244233void FillLayer::cullEmptyLayers()
    245234{
     235    // CSS3 background layering: the number of background layers is determined
     236    // by the number of values in the 'background-image' property.
     237    // http://www.w3.org/TR/css3-background/#layering
     238
    246239    FillLayer* next;
    247240    for (FillLayer* p = this; p; p = next) {
    248241        next = p->m_next;
    249         if (next && !next->isImageSet() &&
    250             !next->isXPositionSet() && !next->isYPositionSet() &&
    251             !next->isAttachmentSet() && !next->isClipSet() &&
    252             !next->isCompositeSet() && !next->isOriginSet() &&
    253             !next->isRepeatXSet() && !next->isRepeatYSet()
    254             && !next->isSizeSet()) {
     242        if (!next)
     243            break;
     244
     245        bool anyAttributeSet = next->isXPositionSet()
     246            || next->isYPositionSet()
     247            || next->isAttachmentSet()
     248            || next->isClipSet()
     249            || next->isCompositeSet()
     250            || next->isOriginSet()
     251            || next->isRepeatXSet()
     252            || next->isRepeatYSet()
     253            || next->isSizeSet();
     254
     255        if (!next->isImageSet() || !anyAttributeSet) {
    255256            delete next;
    256257            p->m_next = 0;
  • trunk/WebCore/rendering/style/RenderStyle.h

    r62677 r63653  
    873873    {
    874874        if (backgroundLayers()->next()) {
     875            accessBackgroundLayers()->fillUnsetProperties();
    875876            accessBackgroundLayers()->cullEmptyLayers();
    876             accessBackgroundLayers()->fillUnsetProperties();
    877877        }
    878878    }
     
    884884    {
    885885        if (maskLayers()->next()) {
     886            accessMaskLayers()->fillUnsetProperties();
    886887            accessMaskLayers()->cullEmptyLayers();
    887             accessMaskLayers()->fillUnsetProperties();
    888888        }
    889889    }
Note: See TracChangeset for help on using the changeset viewer.