Changeset 57526 in webkit


Ignore:
Timestamp:
Apr 13, 2010 11:10:40 AM (14 years ago)
Author:
hyatt@apple.com
Message:

https://bugs.webkit.org/show_bug.cgi?id=37510, clean up StyleBackgroundData

Reviewed by Oliver Hunt.

  • rendering/style/RenderStyle.cpp:

(WebCore::RenderStyle::RenderStyle):
(WebCore::RenderStyle::operator==):
(WebCore::RenderStyle::diff):

  • rendering/style/RenderStyle.h:

(WebCore::):
(WebCore::InheritedFlags::hasBackground):
(WebCore::InheritedFlags::hasBackgroundImage):
(WebCore::InheritedFlags::hasFixedBackgroundImage):
(WebCore::InheritedFlags::outlineWidth):
(WebCore::InheritedFlags::outlineStyle):
(WebCore::InheritedFlags::outlineStyleIsAuto):
(WebCore::InheritedFlags::outlineColor):
(WebCore::InheritedFlags::backgroundColor):
(WebCore::InheritedFlags::backgroundImage):
(WebCore::InheritedFlags::backgroundRepeatX):
(WebCore::InheritedFlags::backgroundRepeatY):
(WebCore::InheritedFlags::backgroundComposite):
(WebCore::InheritedFlags::backgroundAttachment):
(WebCore::InheritedFlags::backgroundClip):
(WebCore::InheritedFlags::backgroundOrigin):
(WebCore::InheritedFlags::backgroundXPosition):
(WebCore::InheritedFlags::backgroundYPosition):
(WebCore::InheritedFlags::backgroundSizeType):
(WebCore::InheritedFlags::backgroundSizeLength):
(WebCore::InheritedFlags::accessBackgroundLayers):
(WebCore::InheritedFlags::backgroundLayers):
(WebCore::InheritedFlags::outlineOffset):
(WebCore::InheritedFlags::resetOutline):
(WebCore::InheritedFlags::setBackgroundColor):
(WebCore::InheritedFlags::setBackgroundXPosition):
(WebCore::InheritedFlags::setBackgroundYPosition):
(WebCore::InheritedFlags::setBackgroundSize):
(WebCore::InheritedFlags::setBackgroundSizeLength):
(WebCore::InheritedFlags::setOutlineWidth):
(WebCore::InheritedFlags::setOutlineStyle):
(WebCore::InheritedFlags::setOutlineColor):
(WebCore::InheritedFlags::clearBackgroundLayers):
(WebCore::InheritedFlags::inheritBackgroundLayers):
(WebCore::InheritedFlags::setOutlineOffset):

  • rendering/style/StyleBackgroundData.h:

(WebCore::StyleBackgroundData::background):
(WebCore::StyleBackgroundData::color):
(WebCore::StyleBackgroundData::outline):

Location:
trunk/WebCore
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/WebCore/ChangeLog

    r57522 r57526  
     12010-04-13  David Hyatt  <hyatt@apple.com>
     2
     3        Reviewed by Oliver Hunt.
     4
     5        https://bugs.webkit.org/show_bug.cgi?id=37510, clean up StyleBackgroundData
     6
     7        * rendering/style/RenderStyle.cpp:
     8        (WebCore::RenderStyle::RenderStyle):
     9        (WebCore::RenderStyle::operator==):
     10        (WebCore::RenderStyle::diff):
     11        * rendering/style/RenderStyle.h:
     12        (WebCore::):
     13        (WebCore::InheritedFlags::hasBackground):
     14        (WebCore::InheritedFlags::hasBackgroundImage):
     15        (WebCore::InheritedFlags::hasFixedBackgroundImage):
     16        (WebCore::InheritedFlags::outlineWidth):
     17        (WebCore::InheritedFlags::outlineStyle):
     18        (WebCore::InheritedFlags::outlineStyleIsAuto):
     19        (WebCore::InheritedFlags::outlineColor):
     20        (WebCore::InheritedFlags::backgroundColor):
     21        (WebCore::InheritedFlags::backgroundImage):
     22        (WebCore::InheritedFlags::backgroundRepeatX):
     23        (WebCore::InheritedFlags::backgroundRepeatY):
     24        (WebCore::InheritedFlags::backgroundComposite):
     25        (WebCore::InheritedFlags::backgroundAttachment):
     26        (WebCore::InheritedFlags::backgroundClip):
     27        (WebCore::InheritedFlags::backgroundOrigin):
     28        (WebCore::InheritedFlags::backgroundXPosition):
     29        (WebCore::InheritedFlags::backgroundYPosition):
     30        (WebCore::InheritedFlags::backgroundSizeType):
     31        (WebCore::InheritedFlags::backgroundSizeLength):
     32        (WebCore::InheritedFlags::accessBackgroundLayers):
     33        (WebCore::InheritedFlags::backgroundLayers):
     34        (WebCore::InheritedFlags::outlineOffset):
     35        (WebCore::InheritedFlags::resetOutline):
     36        (WebCore::InheritedFlags::setBackgroundColor):
     37        (WebCore::InheritedFlags::setBackgroundXPosition):
     38        (WebCore::InheritedFlags::setBackgroundYPosition):
     39        (WebCore::InheritedFlags::setBackgroundSize):
     40        (WebCore::InheritedFlags::setBackgroundSizeLength):
     41        (WebCore::InheritedFlags::setOutlineWidth):
     42        (WebCore::InheritedFlags::setOutlineStyle):
     43        (WebCore::InheritedFlags::setOutlineColor):
     44        (WebCore::InheritedFlags::clearBackgroundLayers):
     45        (WebCore::InheritedFlags::inheritBackgroundLayers):
     46        (WebCore::InheritedFlags::setOutlineOffset):
     47        * rendering/style/StyleBackgroundData.h:
     48        (WebCore::StyleBackgroundData::background):
     49        (WebCore::StyleBackgroundData::color):
     50        (WebCore::StyleBackgroundData::outline):
     51
    1522010-04-13  Stephan Aßmus  <superstippi@gmx.de>
    253
  • trunk/WebCore/rendering/style/RenderStyle.cpp

    r57484 r57526  
    7474    , box(defaultStyle()->box)
    7575    , visual(defaultStyle()->visual)
    76     , background(defaultStyle()->background)
     76    , m_background(defaultStyle()->m_background)
    7777    , surround(defaultStyle()->surround)
    7878    , rareNonInheritedData(defaultStyle()->rareNonInheritedData)
     
    104104    box.init();
    105105    visual.init();
    106     background.init();
     106    m_background.init();
    107107    surround.init();
    108108    rareNonInheritedData.init();
     
    135135    , box(o.box)
    136136    , visual(o.visual)
    137     , background(o.background)
     137    , m_background(o.m_background)
    138138    , surround(o.surround)
    139139    , rareNonInheritedData(o.rareNonInheritedData)
     
    170170            box == o.box &&
    171171            visual == o.visual &&
    172             background == o.background &&
     172            m_background == o.m_background &&
    173173            surround == o.surround &&
    174174            rareNonInheritedData == o.rareNonInheritedData &&
     
    503503        inherited_flags._insideLink != other->inherited_flags._insideLink ||
    504504        surround->border != other->surround->border ||
    505         *background.get() != *other->background.get() ||
     505        *m_background.get() != *other->m_background.get() ||
    506506        visual->textDecoration != other->visual->textDecoration ||
    507507        rareInheritedData->userModify != other->rareInheritedData->userModify ||
  • trunk/WebCore/rendering/style/RenderStyle.h

    r57482 r57526  
    138138    DataRef<StyleBoxData> box;
    139139    DataRef<StyleVisualData> visual;
    140     DataRef<StyleBackgroundData> background;
     140    DataRef<StyleBackgroundData> m_background;
    141141    DataRef<StyleSurroundData> surround;
    142142    DataRef<StyleRareNonInheritedData> rareNonInheritedData;
     
    345345        if (backgroundColor().isValid() && backgroundColor().alpha() > 0)
    346346            return true;
    347         return background->m_background.hasImage();
    348     }
    349     bool hasBackgroundImage() const { return background->m_background.hasImage(); }
    350     bool hasFixedBackgroundImage() const { return background->m_background.hasFixedImage(); }
     347        return m_background->background().hasImage();
     348    }
     349    bool hasBackgroundImage() const { return m_background->background().hasImage(); }
     350    bool hasFixedBackgroundImage() const { return m_background->background().hasFixedImage(); }
    351351    bool hasAppearance() const { return appearance() != NoControlPart; }
    352352
     
    419419    unsigned short outlineWidth() const
    420420    {
    421         if (background->m_outline.style() == BNONE)
     421        if (m_background->outline().style() == BNONE)
    422422            return 0;
    423         return background->m_outline.width();
     423        return m_background->outline().width();
    424424    }
    425425    bool hasOutline() const { return outlineWidth() > 0 && outlineStyle() > BHIDDEN; }
    426     EBorderStyle outlineStyle() const { return background->m_outline.style(); }
    427     bool outlineStyleIsAuto() const { return background->m_outline.isAuto(); }
    428     const Color& outlineColor() const { return background->m_outline.color(); }
     426    EBorderStyle outlineStyle() const { return m_background->outline().style(); }
     427    bool outlineStyleIsAuto() const { return m_background->outline().isAuto(); }
     428    const Color& outlineColor() const { return m_background->outline().color(); }
    429429
    430430    EOverflow overflowX() const { return static_cast<EOverflow>(noninherited_flags._overflowX); }
     
    535535    }
    536536
    537     const Color& backgroundColor() const { return background->m_color; }
    538     StyleImage* backgroundImage() const { return background->m_background.image(); }
    539     EFillRepeat backgroundRepeatX() const { return static_cast<EFillRepeat>(background->m_background.repeatX()); }
    540     EFillRepeat backgroundRepeatY() const { return static_cast<EFillRepeat>(background->m_background.repeatY()); }
    541     CompositeOperator backgroundComposite() const { return static_cast<CompositeOperator>(background->m_background.composite()); }
    542     EFillAttachment backgroundAttachment() const { return static_cast<EFillAttachment>(background->m_background.attachment()); }
    543     EFillBox backgroundClip() const { return static_cast<EFillBox>(background->m_background.clip()); }
    544     EFillBox backgroundOrigin() const { return static_cast<EFillBox>(background->m_background.origin()); }
    545     Length backgroundXPosition() const { return background->m_background.xPosition(); }
    546     Length backgroundYPosition() const { return background->m_background.yPosition(); }
    547     EFillSizeType backgroundSizeType() const { return background->m_background.sizeType(); }
    548     LengthSize backgroundSizeLength() const { return background->m_background.sizeLength(); }
    549     FillLayer* accessBackgroundLayers() { return &(background.access()->m_background); }
    550     const FillLayer* backgroundLayers() const { return &(background->m_background); }
     537    const Color& backgroundColor() const { return m_background->color(); }
     538    StyleImage* backgroundImage() const { return m_background->background().image(); }
     539    EFillRepeat backgroundRepeatX() const { return static_cast<EFillRepeat>(m_background->background().repeatX()); }
     540    EFillRepeat backgroundRepeatY() const { return static_cast<EFillRepeat>(m_background->background().repeatY()); }
     541    CompositeOperator backgroundComposite() const { return static_cast<CompositeOperator>(m_background->background().composite()); }
     542    EFillAttachment backgroundAttachment() const { return static_cast<EFillAttachment>(m_background->background().attachment()); }
     543    EFillBox backgroundClip() const { return static_cast<EFillBox>(m_background->background().clip()); }
     544    EFillBox backgroundOrigin() const { return static_cast<EFillBox>(m_background->background().origin()); }
     545    Length backgroundXPosition() const { return m_background->background().xPosition(); }
     546    Length backgroundYPosition() const { return m_background->background().yPosition(); }
     547    EFillSizeType backgroundSizeType() const { return m_background->background().sizeType(); }
     548    LengthSize backgroundSizeLength() const { return m_background->background().sizeLength(); }
     549    FillLayer* accessBackgroundLayers() { return &(m_background.access()->m_background); }
     550    const FillLayer* backgroundLayers() const { return &(m_background->background()); }
    551551
    552552    StyleImage* maskImage() const { return rareNonInheritedData->m_mask.image(); }
     
    610610    int outlineOffset() const
    611611    {
    612         if (background->m_outline.style() == BNONE)
     612        if (m_background->outline().style() == BNONE)
    613613            return 0;
    614         return background->m_outline.offset();
     614        return m_background->outline().offset();
    615615    }
    616616
     
    769769    void resetBorderBottomRightRadius() { SET_VAR(surround, border.m_bottomRight, initialBorderRadius()) }
    770770
    771     void resetOutline() { SET_VAR(background, m_outline, OutlineValue()) }
    772 
    773     void setBackgroundColor(const Color& v) { SET_VAR(background, m_color, v) }
    774 
    775     void setBackgroundXPosition(Length l) { SET_VAR(background, m_background.m_xPosition, l) }
    776     void setBackgroundYPosition(Length l) { SET_VAR(background, m_background.m_yPosition, l) }
    777     void setBackgroundSize(EFillSizeType b) { SET_VAR(background, m_background.m_sizeType, b) }
    778     void setBackgroundSizeLength(LengthSize l) { SET_VAR(background, m_background.m_sizeLength, l) }
     771    void resetOutline() { SET_VAR(m_background, m_outline, OutlineValue()) }
     772
     773    void setBackgroundColor(const Color& v) { SET_VAR(m_background, m_color, v) }
     774
     775    void setBackgroundXPosition(Length l) { SET_VAR(m_background, m_background.m_xPosition, l) }
     776    void setBackgroundYPosition(Length l) { SET_VAR(m_background, m_background.m_yPosition, l) }
     777    void setBackgroundSize(EFillSizeType b) { SET_VAR(m_background, m_background.m_sizeType, b) }
     778    void setBackgroundSizeLength(LengthSize l) { SET_VAR(m_background, m_background.m_sizeLength, l) }
    779779   
    780780    void setBorderImage(const NinePieceImage& b) { SET_VAR(surround, border.m_image, b) }
     
    807807    void setBorderBottomStyle(EBorderStyle v) { SET_VAR(surround, border.m_bottom.m_style, v) }
    808808    void setBorderBottomColor(const Color& v) { SET_VAR(surround, border.m_bottom.m_color, v) }
    809     void setOutlineWidth(unsigned short v) { SET_VAR(background, m_outline.m_width, v) }
     809    void setOutlineWidth(unsigned short v) { SET_VAR(m_background, m_outline.m_width, v) }
    810810
    811811    void setOutlineStyle(EBorderStyle v, bool isAuto = false)
    812812    {
    813         SET_VAR(background, m_outline.m_style, v)
    814         SET_VAR(background, m_outline.m_isAuto, isAuto)
    815     }
    816 
    817     void setOutlineColor(const Color& v) { SET_VAR(background, m_outline.m_color, v) }
     813        SET_VAR(m_background, m_outline.m_style, v)
     814        SET_VAR(m_background, m_outline.m_isAuto, isAuto)
     815    }
     816
     817    void setOutlineColor(const Color& v) { SET_VAR(m_background, m_outline.m_color, v) }
    818818
    819819    void setOverflowX(EOverflow v) { noninherited_flags._overflowX = v; }
     
    864864    void setLetterSpacing(int v) { inherited.access()->font.setLetterSpacing(v); }
    865865
    866     void clearBackgroundLayers() { background.access()->m_background = FillLayer(BackgroundFillLayer); }
    867     void inheritBackgroundLayers(const FillLayer& parent) { background.access()->m_background = parent; }
     866    void clearBackgroundLayers() { m_background.access()->m_background = FillLayer(BackgroundFillLayer); }
     867    void inheritBackgroundLayers(const FillLayer& parent) { m_background.access()->m_background = parent; }
    868868
    869869    void adjustBackgroundLayers()
     
    949949#endif
    950950
    951     void setOutlineOffset(int v) { SET_VAR(background, m_outline.m_offset, v) }
     951    void setOutlineOffset(int v) { SET_VAR(m_background, m_outline.m_offset, v) }
    952952    void setTextShadow(ShadowData* val, bool add=false);
    953953    void setTextStrokeColor(const Color& c) { SET_VAR(rareInheritedData, textStrokeColor, c) }
  • trunk/WebCore/rendering/style/StyleBackgroundData.h

    r36587 r57526  
    4646    }
    4747
     48    const FillLayer& background() const { return m_background; }
     49    const Color& color() const { return m_color; }
     50    const OutlineValue& outline() const { return m_outline; }
     51
     52private:
     53    friend class RenderStyle;
     54
     55    StyleBackgroundData();
     56    StyleBackgroundData(const StyleBackgroundData&);
     57
    4858    FillLayer m_background;
    4959    Color m_color;
    5060    OutlineValue m_outline;
    51 
    52 private:
    53     StyleBackgroundData();
    54     StyleBackgroundData(const StyleBackgroundData&);   
    5561};
    5662
Note: See TracChangeset for help on using the changeset viewer.