WebCore/rendering/style/RenderStyle.h
changeset 0 4f2f89ce4247
equal deleted inserted replaced
-1:000000000000 0:4f2f89ce4247
       
     1 /*
       
     2  * Copyright (C) 2000 Lars Knoll (knoll@kde.org)
       
     3  *           (C) 2000 Antti Koivisto (koivisto@kde.org)
       
     4  *           (C) 2000 Dirk Mueller (mueller@kde.org)
       
     5  * Copyright (C) 2003, 2005, 2006, 2007, 2008, 2009, 2010 Apple Inc. All rights reserved.
       
     6  * Copyright (C) 2006 Graham Dennis (graham.dennis@gmail.com)
       
     7  *
       
     8  * This library is free software; you can redistribute it and/or
       
     9  * modify it under the terms of the GNU Library General Public
       
    10  * License as published by the Free Software Foundation; either
       
    11  * version 2 of the License, or (at your option) any later version.
       
    12  *
       
    13  * This library is distributed in the hope that it will be useful,
       
    14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
       
    15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
       
    16  * Library General Public License for more details.
       
    17  *
       
    18  * You should have received a copy of the GNU Library General Public License
       
    19  * along with this library; see the file COPYING.LIB.  If not, write to
       
    20  * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
       
    21  * Boston, MA 02110-1301, USA.
       
    22  *
       
    23  */
       
    24 
       
    25 #ifndef RenderStyle_h
       
    26 #define RenderStyle_h
       
    27 
       
    28 #include "TransformationMatrix.h"
       
    29 #include "AnimationList.h"
       
    30 #include "BorderData.h"
       
    31 #include "BorderValue.h"
       
    32 #include "CSSHelper.h"
       
    33 #include "CSSImageGeneratorValue.h"
       
    34 #include "CSSPrimitiveValue.h"
       
    35 #include "CSSPropertyNames.h"
       
    36 #include "CSSReflectionDirection.h"
       
    37 #include "CSSValueList.h"
       
    38 #include "CachedImage.h"
       
    39 #include "CollapsedBorderValue.h"
       
    40 #include "Color.h"
       
    41 #include "ColorSpace.h"
       
    42 #include "ContentData.h"
       
    43 #include "CounterDirectives.h"
       
    44 #include "CursorList.h"
       
    45 #include "DataRef.h"
       
    46 #include "FillLayer.h"
       
    47 #include "FloatPoint.h"
       
    48 #include "Font.h"
       
    49 #include "GraphicsTypes.h"
       
    50 #include "IntRect.h"
       
    51 #include "Length.h"
       
    52 #include "LengthBox.h"
       
    53 #include "LengthSize.h"
       
    54 #include "LineClampValue.h"
       
    55 #include "NinePieceImage.h"
       
    56 #include "OutlineValue.h"
       
    57 #include "Pair.h"
       
    58 #include "RenderStyleConstants.h"
       
    59 #include "ShadowData.h"
       
    60 #include "StyleBackgroundData.h"
       
    61 #include "StyleBoxData.h"
       
    62 #include "StyleFlexibleBoxData.h"
       
    63 #include "StyleInheritedData.h"
       
    64 #include "StyleMarqueeData.h"
       
    65 #include "StyleMultiColData.h"
       
    66 #include "StyleRareInheritedData.h"
       
    67 #include "StyleRareNonInheritedData.h"
       
    68 #include "StyleReflection.h"
       
    69 #include "StyleSurroundData.h"
       
    70 #include "StyleTransformData.h"
       
    71 #include "StyleVisualData.h"
       
    72 #include "TextDirection.h"
       
    73 #include "ThemeTypes.h"
       
    74 #include "TimingFunction.h"
       
    75 #include "TransformOperations.h"
       
    76 #include <wtf/OwnPtr.h>
       
    77 #include <wtf/RefCounted.h>
       
    78 #include <wtf/StdLibExtras.h>
       
    79 #include <wtf/Vector.h>
       
    80 
       
    81 #if ENABLE(DASHBOARD_SUPPORT)
       
    82 #include "StyleDashboardRegion.h"
       
    83 #endif
       
    84 
       
    85 #if ENABLE(SVG)
       
    86 #include "SVGRenderStyle.h"
       
    87 #endif
       
    88 
       
    89 #if ENABLE(XBL)
       
    90 #include "BindingURI.h"
       
    91 #endif
       
    92 
       
    93 #if COMPILER(WINSCW)
       
    94 #define compareEqual(t, u)      ((t) == (u))
       
    95 #else
       
    96 template<typename T, typename U> inline bool compareEqual(const T& t, const U& u) { return t == static_cast<T>(u); }
       
    97 #endif
       
    98 
       
    99 #define SET_VAR(group, variable, value) \
       
   100     if (!compareEqual(group->variable, value)) \
       
   101         group.access()->variable = value;
       
   102 
       
   103 namespace WebCore {
       
   104 
       
   105 using std::max;
       
   106 
       
   107 class CSSStyleSelector;
       
   108 class CSSValueList;
       
   109 class CachedImage;
       
   110 class Pair;
       
   111 class StringImpl;
       
   112 class StyleImage;
       
   113 
       
   114 typedef Vector<RefPtr<RenderStyle>, 4> PseudoStyleCache;
       
   115 
       
   116 class RenderStyle: public RefCounted<RenderStyle> {
       
   117     friend class AnimationBase; // Used by CSS animations. We can't allow them to animate based off visited colors.
       
   118     friend class ApplyStyleCommand; // Editing has to only reveal unvisited info.
       
   119     friend class CSSStyleSelector; // Sets members directly.
       
   120     friend class CSSComputedStyleDeclaration; // Ignores visited styles, so needs to be able to see unvisited info.
       
   121     friend class PropertyWrapperMaybeInvalidColor; // Used by CSS animations. We can't allow them to animate based off visited colors.
       
   122     friend class RenderSVGResource; // FIXME: Needs to alter the visited state by hand. Should clean the SVG code up and move it into RenderStyle perhaps.
       
   123     friend class RenderTreeAsText; // FIXME: Only needed so the render tree can keep lying and dump the wrong colors.  Rebaselining would allow this to be yanked.
       
   124 protected:
       
   125 
       
   126     // The following bitfield is 32-bits long, which optimizes padding with the
       
   127     // int refCount in the base class. Beware when adding more bits.
       
   128     bool m_affectedByAttributeSelectors : 1;
       
   129     bool m_unique : 1;
       
   130 
       
   131     // Bits for dynamic child matching.
       
   132     bool m_affectedByEmpty : 1;
       
   133     bool m_emptyState : 1;
       
   134 
       
   135     // We optimize for :first-child and :last-child.  The other positional child selectors like nth-child or
       
   136     // *-child-of-type, we will just give up and re-evaluate whenever children change at all.
       
   137     bool m_childrenAffectedByFirstChildRules : 1;
       
   138     bool m_childrenAffectedByLastChildRules : 1;
       
   139     bool m_childrenAffectedByDirectAdjacentRules : 1;
       
   140     bool m_childrenAffectedByForwardPositionalRules : 1;
       
   141     bool m_childrenAffectedByBackwardPositionalRules : 1;
       
   142     bool m_firstChildState : 1;
       
   143     bool m_lastChildState : 1;
       
   144     unsigned m_childIndex : 21; // Plenty of bits to cache an index.
       
   145 
       
   146     // non-inherited attributes
       
   147     DataRef<StyleBoxData> m_box;
       
   148     DataRef<StyleVisualData> visual;
       
   149     DataRef<StyleBackgroundData> m_background;
       
   150     DataRef<StyleSurroundData> surround;
       
   151     DataRef<StyleRareNonInheritedData> rareNonInheritedData;
       
   152 
       
   153     // inherited attributes
       
   154     DataRef<StyleRareInheritedData> rareInheritedData;
       
   155     DataRef<StyleInheritedData> inherited;
       
   156 
       
   157     // list of associated pseudo styles
       
   158     OwnPtr<PseudoStyleCache> m_cachedPseudoStyles;
       
   159 
       
   160 #if ENABLE(SVG)
       
   161     DataRef<SVGRenderStyle> m_svgStyle;
       
   162 #endif
       
   163 
       
   164 // !START SYNC!: Keep this in sync with the copy constructor in RenderStyle.cpp
       
   165 
       
   166     // inherit
       
   167     struct InheritedFlags {
       
   168         bool operator==(const InheritedFlags& other) const
       
   169         {
       
   170             return (_empty_cells == other._empty_cells) &&
       
   171                    (_caption_side == other._caption_side) &&
       
   172                    (_list_style_type == other._list_style_type) &&
       
   173                    (_list_style_position == other._list_style_position) &&
       
   174                    (_visibility == other._visibility) &&
       
   175                    (_text_align == other._text_align) &&
       
   176                    (_text_transform == other._text_transform) &&
       
   177                    (_text_decorations == other._text_decorations) &&
       
   178                    (_text_transform == other._text_transform) &&
       
   179                    (_cursor_style == other._cursor_style) &&
       
   180                    (_direction == other._direction) &&
       
   181                    (_border_collapse == other._border_collapse) &&
       
   182                    (_white_space == other._white_space) &&
       
   183                    (_box_direction == other._box_direction) &&
       
   184                    (_visuallyOrdered == other._visuallyOrdered) &&
       
   185                    (_htmlHacks == other._htmlHacks) &&
       
   186                    (_force_backgrounds_to_white == other._force_backgrounds_to_white) &&
       
   187                    (_pointerEvents == other._pointerEvents) &&
       
   188                    (_insideLink == other._insideLink);
       
   189         }
       
   190 
       
   191         bool operator!=(const InheritedFlags& other) const { return !(*this == other); }
       
   192 
       
   193         unsigned _empty_cells : 1; // EEmptyCell
       
   194         unsigned _caption_side : 2; // ECaptionSide
       
   195         unsigned _list_style_type : 7; // EListStyleType
       
   196         unsigned _list_style_position : 1; // EListStylePosition
       
   197         unsigned _visibility : 2; // EVisibility
       
   198         unsigned _text_align : 3; // ETextAlign
       
   199         unsigned _text_transform : 2; // ETextTransform
       
   200         unsigned _text_decorations : 4;
       
   201         unsigned _cursor_style : 6; // ECursor
       
   202         unsigned _direction : 1; // TextDirection
       
   203         bool _border_collapse : 1 ;
       
   204         unsigned _white_space : 3; // EWhiteSpace
       
   205         unsigned _box_direction : 1; // EBoxDirection (CSS3 box_direction property, flexible box layout module)
       
   206         // 34 bits
       
   207         
       
   208         // non CSS2 inherited
       
   209         bool _visuallyOrdered : 1;
       
   210         bool _htmlHacks : 1;
       
   211         bool _force_backgrounds_to_white : 1;
       
   212         unsigned _pointerEvents : 4; // EPointerEvents
       
   213         unsigned _insideLink : 2; // EInsideLink
       
   214         // 43 bits
       
   215     } inherited_flags;
       
   216 
       
   217 // don't inherit
       
   218     struct NonInheritedFlags {
       
   219         bool operator==(const NonInheritedFlags& other) const
       
   220         {
       
   221             return _effectiveDisplay == other._effectiveDisplay
       
   222                 && _originalDisplay == other._originalDisplay
       
   223                 && _overflowX == other._overflowX
       
   224                 && _overflowY == other._overflowY
       
   225                 && _vertical_align == other._vertical_align
       
   226                 && _clear == other._clear
       
   227                 && _position == other._position
       
   228                 && _floating == other._floating
       
   229                 && _table_layout == other._table_layout
       
   230                 && _page_break_before == other._page_break_before
       
   231                 && _page_break_after == other._page_break_after
       
   232                 && _page_break_inside == other._page_break_inside
       
   233                 && _styleType == other._styleType
       
   234                 && _affectedByHover == other._affectedByHover
       
   235                 && _affectedByActive == other._affectedByActive
       
   236                 && _affectedByDrag == other._affectedByDrag
       
   237                 && _pseudoBits == other._pseudoBits
       
   238                 && _unicodeBidi == other._unicodeBidi
       
   239                 && _isLink == other._isLink;
       
   240         }
       
   241 
       
   242         bool operator!=(const NonInheritedFlags& other) const { return !(*this == other); }
       
   243 
       
   244         unsigned _effectiveDisplay : 5; // EDisplay
       
   245         unsigned _originalDisplay : 5; // EDisplay
       
   246         unsigned _overflowX : 3; // EOverflow
       
   247         unsigned _overflowY : 3; // EOverflow
       
   248         unsigned _vertical_align : 4; // EVerticalAlign
       
   249         unsigned _clear : 2; // EClear
       
   250         unsigned _position : 2; // EPosition
       
   251         unsigned _floating : 2; // EFloat
       
   252         unsigned _table_layout : 1; // ETableLayout
       
   253 
       
   254         unsigned _page_break_before : 2; // EPageBreak
       
   255         unsigned _page_break_after : 2; // EPageBreak
       
   256         unsigned _page_break_inside : 2; // EPageBreak
       
   257 
       
   258         unsigned _styleType : 6; // PseudoId
       
   259         bool _affectedByHover : 1;
       
   260         bool _affectedByActive : 1;
       
   261         bool _affectedByDrag : 1;
       
   262         unsigned _pseudoBits : 7;
       
   263         unsigned _unicodeBidi : 2; // EUnicodeBidi
       
   264         bool _isLink : 1;
       
   265         // 50 bits
       
   266     } noninherited_flags;
       
   267 
       
   268 // !END SYNC!
       
   269 
       
   270 protected:
       
   271     void setBitDefaults()
       
   272     {
       
   273         inherited_flags._empty_cells = initialEmptyCells();
       
   274         inherited_flags._caption_side = initialCaptionSide();
       
   275         inherited_flags._list_style_type = initialListStyleType();
       
   276         inherited_flags._list_style_position = initialListStylePosition();
       
   277         inherited_flags._visibility = initialVisibility();
       
   278         inherited_flags._text_align = initialTextAlign();
       
   279         inherited_flags._text_transform = initialTextTransform();
       
   280         inherited_flags._text_decorations = initialTextDecoration();
       
   281         inherited_flags._cursor_style = initialCursor();
       
   282         inherited_flags._direction = initialDirection();
       
   283         inherited_flags._border_collapse = initialBorderCollapse();
       
   284         inherited_flags._white_space = initialWhiteSpace();
       
   285         inherited_flags._visuallyOrdered = initialVisuallyOrdered();
       
   286         inherited_flags._htmlHacks=false;
       
   287         inherited_flags._box_direction = initialBoxDirection();
       
   288         inherited_flags._force_backgrounds_to_white = false;
       
   289         inherited_flags._pointerEvents = initialPointerEvents();
       
   290         inherited_flags._insideLink = NotInsideLink;
       
   291 
       
   292         noninherited_flags._effectiveDisplay = noninherited_flags._originalDisplay = initialDisplay();
       
   293         noninherited_flags._overflowX = initialOverflowX();
       
   294         noninherited_flags._overflowY = initialOverflowY();
       
   295         noninherited_flags._vertical_align = initialVerticalAlign();
       
   296         noninherited_flags._clear = initialClear();
       
   297         noninherited_flags._position = initialPosition();
       
   298         noninherited_flags._floating = initialFloating();
       
   299         noninherited_flags._table_layout = initialTableLayout();
       
   300         noninherited_flags._page_break_before = initialPageBreak();
       
   301         noninherited_flags._page_break_after = initialPageBreak();
       
   302         noninherited_flags._page_break_inside = initialPageBreak();
       
   303         noninherited_flags._styleType = NOPSEUDO;
       
   304         noninherited_flags._affectedByHover = false;
       
   305         noninherited_flags._affectedByActive = false;
       
   306         noninherited_flags._affectedByDrag = false;
       
   307         noninherited_flags._pseudoBits = 0;
       
   308         noninherited_flags._unicodeBidi = initialUnicodeBidi();
       
   309         noninherited_flags._isLink = false;
       
   310     }
       
   311 
       
   312 private:
       
   313     RenderStyle();
       
   314     // used to create the default style.
       
   315     RenderStyle(bool);
       
   316     RenderStyle(const RenderStyle&);
       
   317 
       
   318 public:
       
   319     static PassRefPtr<RenderStyle> create();
       
   320     static PassRefPtr<RenderStyle> createDefaultStyle();
       
   321     static PassRefPtr<RenderStyle> clone(const RenderStyle*);
       
   322 
       
   323     ~RenderStyle();
       
   324 
       
   325     void inheritFrom(const RenderStyle* inheritParent);
       
   326 
       
   327     PseudoId styleType() const { return static_cast<PseudoId>(noninherited_flags._styleType); }
       
   328     void setStyleType(PseudoId styleType) { noninherited_flags._styleType = styleType; }
       
   329 
       
   330     RenderStyle* getCachedPseudoStyle(PseudoId) const;
       
   331     RenderStyle* addCachedPseudoStyle(PassRefPtr<RenderStyle>);
       
   332 
       
   333     const PseudoStyleCache* cachedPseudoStyles() const { return m_cachedPseudoStyles.get(); }
       
   334 
       
   335     bool affectedByHoverRules() const { return noninherited_flags._affectedByHover; }
       
   336     bool affectedByActiveRules() const { return noninherited_flags._affectedByActive; }
       
   337     bool affectedByDragRules() const { return noninherited_flags._affectedByDrag; }
       
   338 
       
   339     void setAffectedByHoverRules(bool b) { noninherited_flags._affectedByHover = b; }
       
   340     void setAffectedByActiveRules(bool b) { noninherited_flags._affectedByActive = b; }
       
   341     void setAffectedByDragRules(bool b) { noninherited_flags._affectedByDrag = b; }
       
   342 
       
   343     bool operator==(const RenderStyle& other) const;
       
   344     bool operator!=(const RenderStyle& other) const { return !(*this == other); }
       
   345     bool isFloating() const { return !(noninherited_flags._floating == FNONE); }
       
   346     bool hasMargin() const { return surround->margin.nonZero(); }
       
   347     bool hasBorder() const { return surround->border.hasBorder(); }
       
   348     bool hasPadding() const { return surround->padding.nonZero(); }
       
   349     bool hasOffset() const { return surround->offset.nonZero(); }
       
   350 
       
   351     bool hasBackgroundImage() const { return m_background->background().hasImage(); }
       
   352     bool hasFixedBackgroundImage() const { return m_background->background().hasFixedImage(); }
       
   353     bool hasAppearance() const { return appearance() != NoControlPart; }
       
   354 
       
   355     bool visuallyOrdered() const { return inherited_flags._visuallyOrdered; }
       
   356     void setVisuallyOrdered(bool b) { inherited_flags._visuallyOrdered = b; }
       
   357 
       
   358     bool isStyleAvailable() const;
       
   359 
       
   360     bool hasAnyPublicPseudoStyles() const;
       
   361     bool hasPseudoStyle(PseudoId pseudo) const;
       
   362     void setHasPseudoStyle(PseudoId pseudo);
       
   363 
       
   364     // attribute getter methods
       
   365 
       
   366     EDisplay display() const { return static_cast<EDisplay>(noninherited_flags._effectiveDisplay); }
       
   367     EDisplay originalDisplay() const { return static_cast<EDisplay>(noninherited_flags._originalDisplay); }
       
   368 
       
   369     Length left() const { return surround->offset.left(); }
       
   370     Length right() const { return surround->offset.right(); }
       
   371     Length top() const { return surround->offset.top(); }
       
   372     Length bottom() const { return surround->offset.bottom(); }
       
   373 
       
   374     // Whether or not a positioned element requires normal flow x/y to be computed
       
   375     // to determine its position.
       
   376     bool hasStaticX() const { return (left().isAuto() && right().isAuto()) || left().isStatic() || right().isStatic(); }
       
   377     bool hasStaticY() const { return (top().isAuto() && bottom().isAuto()) || top().isStatic(); }
       
   378 
       
   379     EPosition position() const { return static_cast<EPosition>(noninherited_flags._position); }
       
   380     EFloat floating() const { return static_cast<EFloat>(noninherited_flags._floating); }
       
   381 
       
   382     Length width() const { return m_box->width(); }
       
   383     Length height() const { return m_box->height(); }
       
   384     Length minWidth() const { return m_box->minWidth(); }
       
   385     Length maxWidth() const { return m_box->maxWidth(); }
       
   386     Length minHeight() const { return m_box->minHeight(); }
       
   387     Length maxHeight() const { return m_box->maxHeight(); }
       
   388 
       
   389     const BorderData& border() const { return surround->border; }
       
   390     const BorderValue& borderLeft() const { return surround->border.left(); }
       
   391     const BorderValue& borderRight() const { return surround->border.right(); }
       
   392     const BorderValue& borderTop() const { return surround->border.top(); }
       
   393     const BorderValue& borderBottom() const { return surround->border.bottom(); }
       
   394 
       
   395     const NinePieceImage& borderImage() const { return surround->border.image(); }
       
   396 
       
   397     const IntSize& borderTopLeftRadius() const { return surround->border.topLeft(); }
       
   398     const IntSize& borderTopRightRadius() const { return surround->border.topRight(); }
       
   399     const IntSize& borderBottomLeftRadius() const { return surround->border.bottomLeft(); }
       
   400     const IntSize& borderBottomRightRadius() const { return surround->border.bottomRight(); }
       
   401     bool hasBorderRadius() const { return surround->border.hasBorderRadius(); }
       
   402 
       
   403     unsigned short borderLeftWidth() const { return surround->border.borderLeftWidth(); }
       
   404     EBorderStyle borderLeftStyle() const { return surround->border.left().style(); }
       
   405     bool borderLeftIsTransparent() const { return surround->border.left().isTransparent(); }
       
   406     unsigned short borderRightWidth() const { return surround->border.borderRightWidth(); }
       
   407     EBorderStyle borderRightStyle() const { return surround->border.right().style(); }
       
   408     bool borderRightIsTransparent() const { return surround->border.right().isTransparent(); }
       
   409     unsigned short borderTopWidth() const { return surround->border.borderTopWidth(); }
       
   410     EBorderStyle borderTopStyle() const { return surround->border.top().style(); }
       
   411     bool borderTopIsTransparent() const { return surround->border.top().isTransparent(); }
       
   412     unsigned short borderBottomWidth() const { return surround->border.borderBottomWidth(); }
       
   413     EBorderStyle borderBottomStyle() const { return surround->border.bottom().style(); }
       
   414     bool borderBottomIsTransparent() const { return surround->border.bottom().isTransparent(); }
       
   415 
       
   416     unsigned short outlineSize() const { return max(0, outlineWidth() + outlineOffset()); }
       
   417     unsigned short outlineWidth() const
       
   418     {
       
   419         if (m_background->outline().style() == BNONE)
       
   420             return 0;
       
   421         return m_background->outline().width();
       
   422     }
       
   423     bool hasOutline() const { return outlineWidth() > 0 && outlineStyle() > BHIDDEN; }
       
   424     EBorderStyle outlineStyle() const { return m_background->outline().style(); }
       
   425     bool outlineStyleIsAuto() const { return m_background->outline().isAuto(); }
       
   426     
       
   427     EOverflow overflowX() const { return static_cast<EOverflow>(noninherited_flags._overflowX); }
       
   428     EOverflow overflowY() const { return static_cast<EOverflow>(noninherited_flags._overflowY); }
       
   429 
       
   430     EVisibility visibility() const { return static_cast<EVisibility>(inherited_flags._visibility); }
       
   431     EVerticalAlign verticalAlign() const { return static_cast<EVerticalAlign>(noninherited_flags._vertical_align); }
       
   432     Length verticalAlignLength() const { return m_box->verticalAlign(); }
       
   433 
       
   434     Length clipLeft() const { return visual->clip.left(); }
       
   435     Length clipRight() const { return visual->clip.right(); }
       
   436     Length clipTop() const { return visual->clip.top(); }
       
   437     Length clipBottom() const { return visual->clip.bottom(); }
       
   438     LengthBox clip() const { return visual->clip; }
       
   439     bool hasClip() const { return visual->hasClip; }
       
   440 
       
   441     EUnicodeBidi unicodeBidi() const { return static_cast<EUnicodeBidi>(noninherited_flags._unicodeBidi); }
       
   442 
       
   443     EClear clear() const { return static_cast<EClear>(noninherited_flags._clear); }
       
   444     ETableLayout tableLayout() const { return static_cast<ETableLayout>(noninherited_flags._table_layout); }
       
   445 
       
   446     const Font& font() const { return inherited->font; }
       
   447     const FontDescription& fontDescription() const { return inherited->font.fontDescription(); }
       
   448     int fontSize() const { return inherited->font.pixelSize(); }
       
   449 
       
   450     Length textIndent() const { return rareInheritedData->indent; }
       
   451     ETextAlign textAlign() const { return static_cast<ETextAlign>(inherited_flags._text_align); }
       
   452     ETextTransform textTransform() const { return static_cast<ETextTransform>(inherited_flags._text_transform); }
       
   453     int textDecorationsInEffect() const { return inherited_flags._text_decorations; }
       
   454     int textDecoration() const { return visual->textDecoration; }
       
   455     int wordSpacing() const { return inherited->font.wordSpacing(); }
       
   456     int letterSpacing() const { return inherited->font.letterSpacing(); }
       
   457 
       
   458     float zoom() const { return visual->m_zoom; }
       
   459     float effectiveZoom() const { return rareInheritedData->m_effectiveZoom; }
       
   460 
       
   461     TextDirection direction() const { return static_cast<TextDirection>(inherited_flags._direction); }
       
   462     Length lineHeight() const { return inherited->line_height; }
       
   463     int computedLineHeight() const
       
   464     {
       
   465         Length lh = lineHeight();
       
   466 
       
   467         // Negative value means the line height is not set.  Use the font's built-in spacing.
       
   468         if (lh.isNegative())
       
   469             return font().lineSpacing();
       
   470 
       
   471         if (lh.isPercent())
       
   472             return lh.calcMinValue(fontSize());
       
   473 
       
   474         return lh.value();
       
   475     }
       
   476 
       
   477     EWhiteSpace whiteSpace() const { return static_cast<EWhiteSpace>(inherited_flags._white_space); }
       
   478     static bool autoWrap(EWhiteSpace ws)
       
   479     {
       
   480         // Nowrap and pre don't automatically wrap.
       
   481         return ws != NOWRAP && ws != PRE;
       
   482     }
       
   483 
       
   484     bool autoWrap() const
       
   485     {
       
   486         return autoWrap(whiteSpace());
       
   487     }
       
   488 
       
   489     static bool preserveNewline(EWhiteSpace ws)
       
   490     {
       
   491         // Normal and nowrap do not preserve newlines.
       
   492         return ws != NORMAL && ws != NOWRAP;
       
   493     }
       
   494 
       
   495     bool preserveNewline() const
       
   496     {
       
   497         return preserveNewline(whiteSpace());
       
   498     }
       
   499 
       
   500     static bool collapseWhiteSpace(EWhiteSpace ws)
       
   501     {
       
   502         // Pre and prewrap do not collapse whitespace.
       
   503         return ws != PRE && ws != PRE_WRAP;
       
   504     }
       
   505 
       
   506     bool collapseWhiteSpace() const
       
   507     {
       
   508         return collapseWhiteSpace(whiteSpace());
       
   509     }
       
   510 
       
   511     bool isCollapsibleWhiteSpace(UChar c) const
       
   512     {
       
   513         switch (c) {
       
   514             case ' ':
       
   515             case '\t':
       
   516                 return collapseWhiteSpace();
       
   517             case '\n':
       
   518                 return !preserveNewline();
       
   519         }
       
   520         return false;
       
   521     }
       
   522 
       
   523     bool breakOnlyAfterWhiteSpace() const
       
   524     {
       
   525         return whiteSpace() == PRE_WRAP || khtmlLineBreak() == AFTER_WHITE_SPACE;
       
   526     }
       
   527 
       
   528     bool breakWords() const
       
   529     {
       
   530         return wordBreak() == BreakWordBreak || wordWrap() == BreakWordWrap;
       
   531     }
       
   532 
       
   533     StyleImage* backgroundImage() const { return m_background->background().image(); }
       
   534     EFillRepeat backgroundRepeatX() const { return static_cast<EFillRepeat>(m_background->background().repeatX()); }
       
   535     EFillRepeat backgroundRepeatY() const { return static_cast<EFillRepeat>(m_background->background().repeatY()); }
       
   536     CompositeOperator backgroundComposite() const { return static_cast<CompositeOperator>(m_background->background().composite()); }
       
   537     EFillAttachment backgroundAttachment() const { return static_cast<EFillAttachment>(m_background->background().attachment()); }
       
   538     EFillBox backgroundClip() const { return static_cast<EFillBox>(m_background->background().clip()); }
       
   539     EFillBox backgroundOrigin() const { return static_cast<EFillBox>(m_background->background().origin()); }
       
   540     Length backgroundXPosition() const { return m_background->background().xPosition(); }
       
   541     Length backgroundYPosition() const { return m_background->background().yPosition(); }
       
   542     EFillSizeType backgroundSizeType() const { return m_background->background().sizeType(); }
       
   543     LengthSize backgroundSizeLength() const { return m_background->background().sizeLength(); }
       
   544     FillLayer* accessBackgroundLayers() { return &(m_background.access()->m_background); }
       
   545     const FillLayer* backgroundLayers() const { return &(m_background->background()); }
       
   546 
       
   547     StyleImage* maskImage() const { return rareNonInheritedData->m_mask.image(); }
       
   548     EFillRepeat maskRepeatX() const { return static_cast<EFillRepeat>(rareNonInheritedData->m_mask.repeatX()); }
       
   549     EFillRepeat maskRepeatY() const { return static_cast<EFillRepeat>(rareNonInheritedData->m_mask.repeatY()); }
       
   550     CompositeOperator maskComposite() const { return static_cast<CompositeOperator>(rareNonInheritedData->m_mask.composite()); }
       
   551     EFillAttachment maskAttachment() const { return static_cast<EFillAttachment>(rareNonInheritedData->m_mask.attachment()); }
       
   552     EFillBox maskClip() const { return static_cast<EFillBox>(rareNonInheritedData->m_mask.clip()); }
       
   553     EFillBox maskOrigin() const { return static_cast<EFillBox>(rareNonInheritedData->m_mask.origin()); }
       
   554     Length maskXPosition() const { return rareNonInheritedData->m_mask.xPosition(); }
       
   555     Length maskYPosition() const { return rareNonInheritedData->m_mask.yPosition(); }
       
   556     EFillSizeType maskSizeType() const { return rareNonInheritedData->m_mask.sizeType(); }
       
   557     LengthSize maskSizeLength() const { return rareNonInheritedData->m_mask.sizeLength(); }
       
   558     FillLayer* accessMaskLayers() { return &(rareNonInheritedData.access()->m_mask); }
       
   559     const FillLayer* maskLayers() const { return &(rareNonInheritedData->m_mask); }
       
   560     const NinePieceImage& maskBoxImage() const { return rareNonInheritedData->m_maskBoxImage; }
       
   561 
       
   562     // returns true for collapsing borders, false for separate borders
       
   563     bool borderCollapse() const { return inherited_flags._border_collapse; }
       
   564     short horizontalBorderSpacing() const { return inherited->horizontal_border_spacing; }
       
   565     short verticalBorderSpacing() const { return inherited->vertical_border_spacing; }
       
   566     EEmptyCell emptyCells() const { return static_cast<EEmptyCell>(inherited_flags._empty_cells); }
       
   567     ECaptionSide captionSide() const { return static_cast<ECaptionSide>(inherited_flags._caption_side); }
       
   568 
       
   569     short counterIncrement() const { return rareNonInheritedData->m_counterIncrement; }
       
   570     short counterReset() const { return rareNonInheritedData->m_counterReset; }
       
   571 
       
   572     EListStyleType listStyleType() const { return static_cast<EListStyleType>(inherited_flags._list_style_type); }
       
   573     StyleImage* listStyleImage() const { return inherited->list_style_image.get(); }
       
   574     EListStylePosition listStylePosition() const { return static_cast<EListStylePosition>(inherited_flags._list_style_position); }
       
   575 
       
   576     Length marginTop() const { return surround->margin.top(); }
       
   577     Length marginBottom() const { return surround->margin.bottom(); }
       
   578     Length marginLeft() const { return surround->margin.left(); }
       
   579     Length marginRight() const { return surround->margin.right(); }
       
   580 
       
   581     LengthBox paddingBox() const { return surround->padding; }
       
   582     Length paddingTop() const { return surround->padding.top(); }
       
   583     Length paddingBottom() const { return surround->padding.bottom(); }
       
   584     Length paddingLeft() const { return surround->padding.left(); }
       
   585     Length paddingRight() const { return surround->padding.right(); }
       
   586 
       
   587     ECursor cursor() const { return static_cast<ECursor>(inherited_flags._cursor_style); }
       
   588 
       
   589     CursorList* cursors() const { return rareInheritedData->cursorData.get(); }
       
   590 
       
   591     EInsideLink insideLink() const { return static_cast<EInsideLink>(inherited_flags._insideLink); }
       
   592     bool isLink() const { return noninherited_flags._isLink; }
       
   593 
       
   594     short widows() const { return rareInheritedData->widows; }
       
   595     short orphans() const { return rareInheritedData->orphans; }
       
   596     EPageBreak pageBreakInside() const { return static_cast<EPageBreak>(noninherited_flags._page_break_inside); }
       
   597     EPageBreak pageBreakBefore() const { return static_cast<EPageBreak>(noninherited_flags._page_break_before); }
       
   598     EPageBreak pageBreakAfter() const { return static_cast<EPageBreak>(noninherited_flags._page_break_after); }
       
   599 
       
   600     // CSS3 Getter Methods
       
   601 #if ENABLE(XBL)
       
   602     BindingURI* bindingURIs() const { return rareNonInheritedData->bindingURI; }
       
   603 #endif
       
   604 
       
   605     int outlineOffset() const
       
   606     {
       
   607         if (m_background->outline().style() == BNONE)
       
   608             return 0;
       
   609         return m_background->outline().offset();
       
   610     }
       
   611 
       
   612     const ShadowData* textShadow() const { return rareInheritedData->textShadow; }
       
   613     float textStrokeWidth() const { return rareInheritedData->textStrokeWidth; }
       
   614     ColorSpace colorSpace() const { return static_cast<ColorSpace>(rareInheritedData->colorSpace); }
       
   615     float opacity() const { return rareNonInheritedData->opacity; }
       
   616     ControlPart appearance() const { return static_cast<ControlPart>(rareNonInheritedData->m_appearance); }
       
   617     EBoxAlignment boxAlign() const { return static_cast<EBoxAlignment>(rareNonInheritedData->flexibleBox->align); }
       
   618     EBoxDirection boxDirection() const { return static_cast<EBoxDirection>(inherited_flags._box_direction); }
       
   619     float boxFlex() { return rareNonInheritedData->flexibleBox->flex; }
       
   620     unsigned int boxFlexGroup() const { return rareNonInheritedData->flexibleBox->flex_group; }
       
   621     EBoxLines boxLines() { return static_cast<EBoxLines>(rareNonInheritedData->flexibleBox->lines); }
       
   622     unsigned int boxOrdinalGroup() const { return rareNonInheritedData->flexibleBox->ordinal_group; }
       
   623     EBoxOrient boxOrient() const { return static_cast<EBoxOrient>(rareNonInheritedData->flexibleBox->orient); }
       
   624     EBoxAlignment boxPack() const { return static_cast<EBoxAlignment>(rareNonInheritedData->flexibleBox->pack); }
       
   625 
       
   626     const ShadowData* boxShadow() const { return rareNonInheritedData->m_boxShadow.get(); }
       
   627     void getBoxShadowExtent(int &top, int &right, int &bottom, int &left) const;
       
   628     void getBoxShadowHorizontalExtent(int &left, int &right) const;
       
   629     void getBoxShadowVerticalExtent(int &top, int &bottom) const;
       
   630 
       
   631     StyleReflection* boxReflect() const { return rareNonInheritedData->m_boxReflect.get(); }
       
   632     EBoxSizing boxSizing() const { return m_box->boxSizing(); }
       
   633     Length marqueeIncrement() const { return rareNonInheritedData->marquee->increment; }
       
   634     int marqueeSpeed() const { return rareNonInheritedData->marquee->speed; }
       
   635     int marqueeLoopCount() const { return rareNonInheritedData->marquee->loops; }
       
   636     EMarqueeBehavior marqueeBehavior() const { return static_cast<EMarqueeBehavior>(rareNonInheritedData->marquee->behavior); }
       
   637     EMarqueeDirection marqueeDirection() const { return static_cast<EMarqueeDirection>(rareNonInheritedData->marquee->direction); }
       
   638     EUserModify userModify() const { return static_cast<EUserModify>(rareInheritedData->userModify); }
       
   639     EUserDrag userDrag() const { return static_cast<EUserDrag>(rareNonInheritedData->userDrag); }
       
   640     EUserSelect userSelect() const { return static_cast<EUserSelect>(rareInheritedData->userSelect); }
       
   641     bool textOverflow() const { return rareNonInheritedData->textOverflow; }
       
   642     EMarginCollapse marginTopCollapse() const { return static_cast<EMarginCollapse>(rareNonInheritedData->marginTopCollapse); }
       
   643     EMarginCollapse marginBottomCollapse() const { return static_cast<EMarginCollapse>(rareNonInheritedData->marginBottomCollapse); }
       
   644     EWordBreak wordBreak() const { return static_cast<EWordBreak>(rareInheritedData->wordBreak); }
       
   645     EWordWrap wordWrap() const { return static_cast<EWordWrap>(rareInheritedData->wordWrap); }
       
   646     ENBSPMode nbspMode() const { return static_cast<ENBSPMode>(rareInheritedData->nbspMode); }
       
   647     EKHTMLLineBreak khtmlLineBreak() const { return static_cast<EKHTMLLineBreak>(rareInheritedData->khtmlLineBreak); }
       
   648     EMatchNearestMailBlockquoteColor matchNearestMailBlockquoteColor() const { return static_cast<EMatchNearestMailBlockquoteColor>(rareNonInheritedData->matchNearestMailBlockquoteColor); }
       
   649     const AtomicString& highlight() const { return rareInheritedData->highlight; }
       
   650     Hyphens hyphens() const { return static_cast<Hyphens>(rareInheritedData->hyphens); }
       
   651     const AtomicString& hyphenateCharacter() const { return rareInheritedData->hyphenateCharacter; }
       
   652     EBorderFit borderFit() const { return static_cast<EBorderFit>(rareNonInheritedData->m_borderFit); }
       
   653     EResize resize() const { return static_cast<EResize>(rareInheritedData->resize); }
       
   654     float columnWidth() const { return rareNonInheritedData->m_multiCol->m_width; }
       
   655     bool hasAutoColumnWidth() const { return rareNonInheritedData->m_multiCol->m_autoWidth; }
       
   656     unsigned short columnCount() const { return rareNonInheritedData->m_multiCol->m_count; }
       
   657     bool hasAutoColumnCount() const { return rareNonInheritedData->m_multiCol->m_autoCount; }
       
   658     bool specifiesColumns() const { return !hasAutoColumnCount() || !hasAutoColumnWidth(); }
       
   659     float columnGap() const { return rareNonInheritedData->m_multiCol->m_gap; }
       
   660     bool hasNormalColumnGap() const { return rareNonInheritedData->m_multiCol->m_normalGap; }
       
   661     EBorderStyle columnRuleStyle() const { return rareNonInheritedData->m_multiCol->m_rule.style(); }
       
   662     unsigned short columnRuleWidth() const { return rareNonInheritedData->m_multiCol->ruleWidth(); }
       
   663     bool columnRuleIsTransparent() const { return rareNonInheritedData->m_multiCol->m_rule.isTransparent(); }
       
   664     bool columnSpan() const { return rareNonInheritedData->m_multiCol->m_columnSpan; }
       
   665     EPageBreak columnBreakBefore() const { return static_cast<EPageBreak>(rareNonInheritedData->m_multiCol->m_breakBefore); }
       
   666     EPageBreak columnBreakInside() const { return static_cast<EPageBreak>(rareNonInheritedData->m_multiCol->m_breakInside); }
       
   667     EPageBreak columnBreakAfter() const { return static_cast<EPageBreak>(rareNonInheritedData->m_multiCol->m_breakAfter); }
       
   668     const TransformOperations& transform() const { return rareNonInheritedData->m_transform->m_operations; }
       
   669     Length transformOriginX() const { return rareNonInheritedData->m_transform->m_x; }
       
   670     Length transformOriginY() const { return rareNonInheritedData->m_transform->m_y; }
       
   671     float transformOriginZ() const { return rareNonInheritedData->m_transform->m_z; }
       
   672     bool hasTransform() const { return !rareNonInheritedData->m_transform->m_operations.operations().isEmpty(); }
       
   673     
       
   674     // Return true if any transform related property (currently transform, transformStyle3D or perspective) 
       
   675     // indicates that we are transforming
       
   676     bool hasTransformRelatedProperty() const { return hasTransform() || preserves3D() || hasPerspective(); }
       
   677 
       
   678     enum ApplyTransformOrigin { IncludeTransformOrigin, ExcludeTransformOrigin };
       
   679     void applyTransform(TransformationMatrix&, const IntSize& borderBoxSize, ApplyTransformOrigin = IncludeTransformOrigin) const;
       
   680 
       
   681     bool hasMask() const { return rareNonInheritedData->m_mask.hasImage() || rareNonInheritedData->m_maskBoxImage.hasImage(); }
       
   682     // End CSS3 Getters
       
   683 
       
   684     // Apple-specific property getter methods
       
   685     EPointerEvents pointerEvents() const { return static_cast<EPointerEvents>(inherited_flags._pointerEvents); }
       
   686     const AnimationList* animations() const { return rareNonInheritedData->m_animations.get(); }
       
   687     const AnimationList* transitions() const { return rareNonInheritedData->m_transitions.get(); }
       
   688 
       
   689     AnimationList* accessAnimations();
       
   690     AnimationList* accessTransitions();
       
   691 
       
   692     bool hasAnimations() const { return rareNonInheritedData->m_animations && rareNonInheritedData->m_animations->size() > 0; }
       
   693     bool hasTransitions() const { return rareNonInheritedData->m_transitions && rareNonInheritedData->m_transitions->size() > 0; }
       
   694 
       
   695     // return the first found Animation (including 'all' transitions)
       
   696     const Animation* transitionForProperty(int property) const;
       
   697 
       
   698     ETransformStyle3D transformStyle3D() const { return rareNonInheritedData->m_transformStyle3D; }
       
   699     bool preserves3D() const { return rareNonInheritedData->m_transformStyle3D == TransformStyle3DPreserve3D; }
       
   700 
       
   701     EBackfaceVisibility backfaceVisibility() const { return rareNonInheritedData->m_backfaceVisibility; }
       
   702     float perspective() const { return rareNonInheritedData->m_perspective; }
       
   703     bool hasPerspective() const { return rareNonInheritedData->m_perspective > 0; }
       
   704     Length perspectiveOriginX() const { return rareNonInheritedData->m_perspectiveOriginX; }
       
   705     Length perspectiveOriginY() const { return rareNonInheritedData->m_perspectiveOriginY; }
       
   706     LengthSize pageSize() const { return rareNonInheritedData->m_pageSize; }
       
   707     PageSizeType pageSizeType() const { return rareNonInheritedData->m_pageSizeType; }
       
   708     
       
   709 #if USE(ACCELERATED_COMPOSITING)
       
   710     // When set, this ensures that styles compare as different. Used during accelerated animations.
       
   711     bool isRunningAcceleratedAnimation() const { return rareNonInheritedData->m_runningAcceleratedAnimation; }
       
   712 #endif
       
   713 
       
   714     const LineClampValue& lineClamp() const { return rareNonInheritedData->lineClamp; }
       
   715     bool textSizeAdjust() const { return rareInheritedData->textSizeAdjust; }
       
   716     ETextSecurity textSecurity() const { return static_cast<ETextSecurity>(rareInheritedData->textSecurity); }
       
   717 
       
   718 #if ENABLE(HAPTICS)
       
   719     EHapticTapType hapticTapType() const { return inherited->hapticTapType; }
       
   720     EHapticTapStrength hapticTapStrength() const { return inherited->hapticTapStrength; }
       
   721 #endif
       
   722 
       
   723 // attribute setter methods
       
   724 
       
   725     void setDisplay(EDisplay v) { noninherited_flags._effectiveDisplay = v; }
       
   726     void setOriginalDisplay(EDisplay v) { noninherited_flags._originalDisplay = v; }
       
   727     void setPosition(EPosition v) { noninherited_flags._position = v; }
       
   728     void setFloating(EFloat v) { noninherited_flags._floating = v; }
       
   729 
       
   730     void setLeft(Length v) { SET_VAR(surround, offset.m_left, v) }
       
   731     void setRight(Length v) { SET_VAR(surround, offset.m_right, v) }
       
   732     void setTop(Length v) { SET_VAR(surround, offset.m_top, v) }
       
   733     void setBottom(Length v) { SET_VAR(surround, offset.m_bottom, v) }
       
   734 
       
   735     void setWidth(Length v) { SET_VAR(m_box, m_width, v) }
       
   736     void setHeight(Length v) { SET_VAR(m_box, m_height, v) }
       
   737 
       
   738     void setMinWidth(Length v) { SET_VAR(m_box, m_minWidth, v) }
       
   739     void setMaxWidth(Length v) { SET_VAR(m_box, m_maxWidth, v) }
       
   740     void setMinHeight(Length v) { SET_VAR(m_box, m_minHeight, v) }
       
   741     void setMaxHeight(Length v) { SET_VAR(m_box, m_maxHeight, v) }
       
   742 
       
   743 #if ENABLE(DASHBOARD_SUPPORT)
       
   744     Vector<StyleDashboardRegion> dashboardRegions() const { return rareNonInheritedData->m_dashboardRegions; }
       
   745     void setDashboardRegions(Vector<StyleDashboardRegion> regions) { SET_VAR(rareNonInheritedData, m_dashboardRegions, regions); }
       
   746 
       
   747     void setDashboardRegion(int type, const String& label, Length t, Length r, Length b, Length l, bool append)
       
   748     {
       
   749         StyleDashboardRegion region;
       
   750         region.label = label;
       
   751         region.offset.m_top = t;
       
   752         region.offset.m_right = r;
       
   753         region.offset.m_bottom = b;
       
   754         region.offset.m_left = l;
       
   755         region.type = type;
       
   756         if (!append)
       
   757             rareNonInheritedData.access()->m_dashboardRegions.clear();
       
   758         rareNonInheritedData.access()->m_dashboardRegions.append(region);
       
   759     }
       
   760 #endif
       
   761 
       
   762     void resetBorder() { resetBorderImage(); resetBorderTop(); resetBorderRight(); resetBorderBottom(); resetBorderLeft(); resetBorderRadius(); }
       
   763     void resetBorderTop() { SET_VAR(surround, border.m_top, BorderValue()) }
       
   764     void resetBorderRight() { SET_VAR(surround, border.m_right, BorderValue()) }
       
   765     void resetBorderBottom() { SET_VAR(surround, border.m_bottom, BorderValue()) }
       
   766     void resetBorderLeft() { SET_VAR(surround, border.m_left, BorderValue()) }
       
   767     void resetBorderImage() { SET_VAR(surround, border.m_image, NinePieceImage()) }
       
   768     void resetBorderRadius() { resetBorderTopLeftRadius(); resetBorderTopRightRadius(); resetBorderBottomLeftRadius(); resetBorderBottomRightRadius(); }
       
   769     void resetBorderTopLeftRadius() { SET_VAR(surround, border.m_topLeft, initialBorderRadius()) }
       
   770     void resetBorderTopRightRadius() { SET_VAR(surround, border.m_topRight, initialBorderRadius()) }
       
   771     void resetBorderBottomLeftRadius() { SET_VAR(surround, border.m_bottomLeft, initialBorderRadius()) }
       
   772     void resetBorderBottomRightRadius() { SET_VAR(surround, border.m_bottomRight, initialBorderRadius()) }
       
   773 
       
   774     void resetOutline() { SET_VAR(m_background, m_outline, OutlineValue()) }
       
   775 
       
   776     void setBackgroundColor(const Color& v) { SET_VAR(m_background, m_color, v) }
       
   777 
       
   778     void setBackgroundXPosition(Length l) { SET_VAR(m_background, m_background.m_xPosition, l) }
       
   779     void setBackgroundYPosition(Length l) { SET_VAR(m_background, m_background.m_yPosition, l) }
       
   780     void setBackgroundSize(EFillSizeType b) { SET_VAR(m_background, m_background.m_sizeType, b) }
       
   781     void setBackgroundSizeLength(LengthSize l) { SET_VAR(m_background, m_background.m_sizeLength, l) }
       
   782     
       
   783     void setBorderImage(const NinePieceImage& b) { SET_VAR(surround, border.m_image, b) }
       
   784 
       
   785     void setBorderTopLeftRadius(const IntSize& s) { SET_VAR(surround, border.m_topLeft, s) }
       
   786     void setBorderTopRightRadius(const IntSize& s) { SET_VAR(surround, border.m_topRight, s) }
       
   787     void setBorderBottomLeftRadius(const IntSize& s) { SET_VAR(surround, border.m_bottomLeft, s) }
       
   788     void setBorderBottomRightRadius(const IntSize& s) { SET_VAR(surround, border.m_bottomRight, s) }
       
   789 
       
   790     void setBorderRadius(const IntSize& s)
       
   791     {
       
   792         setBorderTopLeftRadius(s);
       
   793         setBorderTopRightRadius(s);
       
   794         setBorderBottomLeftRadius(s);
       
   795         setBorderBottomRightRadius(s);
       
   796     }
       
   797     
       
   798     void getBorderRadiiForRect(const IntRect&, IntSize& topLeft, IntSize& topRight, IntSize& bottomLeft, IntSize& bottomRight) const;
       
   799     void getInnerBorderRadiiForRectWithBorderWidths(const IntRect&, unsigned short topWidth, 
       
   800                             unsigned short bottomWidth, unsigned short leftWidth, unsigned short rightWidth, 
       
   801                             IntSize& innerTopLeft, IntSize& innerTopRight, IntSize& innerBottomLeft, 
       
   802                             IntSize& innerBottomRight) const;
       
   803 
       
   804     void setBorderLeftWidth(unsigned short v) { SET_VAR(surround, border.m_left.m_width, v) }
       
   805     void setBorderLeftStyle(EBorderStyle v) { SET_VAR(surround, border.m_left.m_style, v) }
       
   806     void setBorderLeftColor(const Color& v) { SET_VAR(surround, border.m_left.m_color, v) }
       
   807     void setBorderRightWidth(unsigned short v) { SET_VAR(surround, border.m_right.m_width, v) }
       
   808     void setBorderRightStyle(EBorderStyle v) { SET_VAR(surround, border.m_right.m_style, v) }
       
   809     void setBorderRightColor(const Color& v) { SET_VAR(surround, border.m_right.m_color, v) }
       
   810     void setBorderTopWidth(unsigned short v) { SET_VAR(surround, border.m_top.m_width, v) }
       
   811     void setBorderTopStyle(EBorderStyle v) { SET_VAR(surround, border.m_top.m_style, v) }
       
   812     void setBorderTopColor(const Color& v) { SET_VAR(surround, border.m_top.m_color, v) }
       
   813     void setBorderBottomWidth(unsigned short v) { SET_VAR(surround, border.m_bottom.m_width, v) }
       
   814     void setBorderBottomStyle(EBorderStyle v) { SET_VAR(surround, border.m_bottom.m_style, v) }
       
   815     void setBorderBottomColor(const Color& v) { SET_VAR(surround, border.m_bottom.m_color, v) }
       
   816     void setOutlineWidth(unsigned short v) { SET_VAR(m_background, m_outline.m_width, v) }
       
   817 
       
   818     void setOutlineStyle(EBorderStyle v, bool isAuto = false)
       
   819     {
       
   820         SET_VAR(m_background, m_outline.m_style, v)
       
   821         SET_VAR(m_background, m_outline.m_isAuto, isAuto)
       
   822     }
       
   823 
       
   824     void setOutlineColor(const Color& v) { SET_VAR(m_background, m_outline.m_color, v) }
       
   825 
       
   826     void setOverflowX(EOverflow v) { noninherited_flags._overflowX = v; }
       
   827     void setOverflowY(EOverflow v) { noninherited_flags._overflowY = v; }
       
   828     void setVisibility(EVisibility v) { inherited_flags._visibility = v; }
       
   829     void setVerticalAlign(EVerticalAlign v) { noninherited_flags._vertical_align = v; }
       
   830     void setVerticalAlignLength(Length l) { SET_VAR(m_box, m_verticalAlign, l) }
       
   831 
       
   832     void setHasClip(bool b = true) { SET_VAR(visual, hasClip, b) }
       
   833     void setClipLeft(Length v) { SET_VAR(visual, clip.m_left, v) }
       
   834     void setClipRight(Length v) { SET_VAR(visual, clip.m_right, v) }
       
   835     void setClipTop(Length v) { SET_VAR(visual, clip.m_top, v) }
       
   836     void setClipBottom(Length v) { SET_VAR(visual, clip.m_bottom, v) }
       
   837     void setClip(Length top, Length right, Length bottom, Length left);
       
   838     void setClip(LengthBox box) { SET_VAR(visual, clip, box) }
       
   839 
       
   840     void setUnicodeBidi(EUnicodeBidi b) { noninherited_flags._unicodeBidi = b; }
       
   841 
       
   842     void setClear(EClear v) { noninherited_flags._clear = v; }
       
   843     void setTableLayout(ETableLayout v) { noninherited_flags._table_layout = v; }
       
   844 
       
   845     bool setFontDescription(const FontDescription& v)
       
   846     {
       
   847         if (inherited->font.fontDescription() != v) {
       
   848             inherited.access()->font = Font(v, inherited->font.letterSpacing(), inherited->font.wordSpacing());
       
   849             return true;
       
   850         }
       
   851         return false;
       
   852     }
       
   853 
       
   854     // Only used for blending font sizes when animating.
       
   855     void setBlendedFontSize(int);
       
   856 
       
   857     void setColor(const Color& v) { SET_VAR(inherited, color, v) }
       
   858     void setTextIndent(Length v) { SET_VAR(rareInheritedData, indent, v) }
       
   859     void setTextAlign(ETextAlign v) { inherited_flags._text_align = v; }
       
   860     void setTextTransform(ETextTransform v) { inherited_flags._text_transform = v; }
       
   861     void addToTextDecorationsInEffect(int v) { inherited_flags._text_decorations |= v; }
       
   862     void setTextDecorationsInEffect(int v) { inherited_flags._text_decorations = v; }
       
   863     void setTextDecoration(int v) { SET_VAR(visual, textDecoration, v); }
       
   864     void setDirection(TextDirection v) { inherited_flags._direction = v; }
       
   865     void setLineHeight(Length v) { SET_VAR(inherited, line_height, v) }
       
   866     void setZoom(float f) { SET_VAR(visual, m_zoom, f); setEffectiveZoom(effectiveZoom() * zoom()); }
       
   867     void setEffectiveZoom(float f) { SET_VAR(rareInheritedData, m_effectiveZoom, f) }
       
   868 
       
   869     void setWhiteSpace(EWhiteSpace v) { inherited_flags._white_space = v; }
       
   870 
       
   871     void setWordSpacing(int v) { inherited.access()->font.setWordSpacing(v); }
       
   872     void setLetterSpacing(int v) { inherited.access()->font.setLetterSpacing(v); }
       
   873 
       
   874     void clearBackgroundLayers() { m_background.access()->m_background = FillLayer(BackgroundFillLayer); }
       
   875     void inheritBackgroundLayers(const FillLayer& parent) { m_background.access()->m_background = parent; }
       
   876 
       
   877     void adjustBackgroundLayers()
       
   878     {
       
   879         if (backgroundLayers()->next()) {
       
   880             accessBackgroundLayers()->fillUnsetProperties();
       
   881             accessBackgroundLayers()->cullEmptyLayers();
       
   882         }
       
   883     }
       
   884 
       
   885     void clearMaskLayers() { rareNonInheritedData.access()->m_mask = FillLayer(MaskFillLayer); }
       
   886     void inheritMaskLayers(const FillLayer& parent) { rareNonInheritedData.access()->m_mask = parent; }
       
   887 
       
   888     void adjustMaskLayers()
       
   889     {
       
   890         if (maskLayers()->next()) {
       
   891             accessMaskLayers()->fillUnsetProperties();
       
   892             accessMaskLayers()->cullEmptyLayers();
       
   893         }
       
   894     }
       
   895 
       
   896     void setMaskBoxImage(const NinePieceImage& b) { SET_VAR(rareNonInheritedData, m_maskBoxImage, b) }
       
   897     void setMaskXPosition(Length l) { SET_VAR(rareNonInheritedData, m_mask.m_xPosition, l) }
       
   898     void setMaskYPosition(Length l) { SET_VAR(rareNonInheritedData, m_mask.m_yPosition, l) }
       
   899     void setMaskSize(LengthSize l) { SET_VAR(rareNonInheritedData, m_mask.m_sizeLength, l) }
       
   900 
       
   901     void setBorderCollapse(bool collapse) { inherited_flags._border_collapse = collapse; }
       
   902     void setHorizontalBorderSpacing(short v) { SET_VAR(inherited, horizontal_border_spacing, v) }
       
   903     void setVerticalBorderSpacing(short v) { SET_VAR(inherited, vertical_border_spacing, v) }
       
   904     void setEmptyCells(EEmptyCell v) { inherited_flags._empty_cells = v; }
       
   905     void setCaptionSide(ECaptionSide v) { inherited_flags._caption_side = v; }
       
   906 
       
   907     void setCounterIncrement(short v) { SET_VAR(rareNonInheritedData, m_counterIncrement, v) }
       
   908     void setCounterReset(short v) { SET_VAR(rareNonInheritedData, m_counterReset, v) }
       
   909 
       
   910     void setListStyleType(EListStyleType v) { inherited_flags._list_style_type = v; }
       
   911     void setListStyleImage(StyleImage* v) { if (inherited->list_style_image != v) inherited.access()->list_style_image = v; }
       
   912     void setListStylePosition(EListStylePosition v) { inherited_flags._list_style_position = v; }
       
   913 
       
   914     void resetMargin() { SET_VAR(surround, margin, LengthBox(Fixed)) }
       
   915     void setMarginTop(Length v) { SET_VAR(surround, margin.m_top, v) }
       
   916     void setMarginBottom(Length v) { SET_VAR(surround, margin.m_bottom, v) }
       
   917     void setMarginLeft(Length v) { SET_VAR(surround, margin.m_left, v) }
       
   918     void setMarginRight(Length v) { SET_VAR(surround, margin.m_right, v) }
       
   919 
       
   920     void resetPadding() { SET_VAR(surround, padding, LengthBox(Auto)) }
       
   921     void setPaddingBox(const LengthBox& b) { SET_VAR(surround, padding, b) }
       
   922     void setPaddingTop(Length v) { SET_VAR(surround, padding.m_top, v) }
       
   923     void setPaddingBottom(Length v) { SET_VAR(surround, padding.m_bottom, v) }
       
   924     void setPaddingLeft(Length v) { SET_VAR(surround, padding.m_left, v) }
       
   925     void setPaddingRight(Length v) { SET_VAR(surround, padding.m_right, v) }
       
   926 
       
   927     void setCursor(ECursor c) { inherited_flags._cursor_style = c; }
       
   928     void addCursor(CachedImage*, const IntPoint& = IntPoint());
       
   929     void setCursorList(PassRefPtr<CursorList>);
       
   930     void clearCursorList();
       
   931 
       
   932     void setInsideLink(EInsideLink insideLink) { inherited_flags._insideLink = insideLink; }
       
   933     void setIsLink(bool b) { noninherited_flags._isLink = b; }
       
   934 
       
   935     bool forceBackgroundsToWhite() const { return inherited_flags._force_backgrounds_to_white; }
       
   936     void setForceBackgroundsToWhite(bool b=true) { inherited_flags._force_backgrounds_to_white = b; }
       
   937 
       
   938     bool htmlHacks() const { return inherited_flags._htmlHacks; }
       
   939     void setHtmlHacks(bool b=true) { inherited_flags._htmlHacks = b; }
       
   940 
       
   941     bool hasAutoZIndex() const { return m_box->hasAutoZIndex(); }
       
   942     void setHasAutoZIndex() { SET_VAR(m_box, m_hasAutoZIndex, true); SET_VAR(m_box, m_zIndex, 0) }
       
   943     int zIndex() const { return m_box->zIndex(); }
       
   944     void setZIndex(int v) { SET_VAR(m_box, m_hasAutoZIndex, false); SET_VAR(m_box, m_zIndex, v) }
       
   945 
       
   946     void setWidows(short w) { SET_VAR(rareInheritedData, widows, w); }
       
   947     void setOrphans(short o) { SET_VAR(rareInheritedData, orphans, o); }
       
   948     void setPageBreakInside(EPageBreak b) { noninherited_flags._page_break_inside = b; }
       
   949     void setPageBreakBefore(EPageBreak b) { noninherited_flags._page_break_before = b; }
       
   950     void setPageBreakAfter(EPageBreak b) { noninherited_flags._page_break_after = b; }
       
   951 
       
   952     // CSS3 Setters
       
   953 #if ENABLE(XBL)
       
   954     void deleteBindingURIs() { SET_VAR(rareNonInheritedData, bindingURI, static_cast<BindingURI*>(0)); }
       
   955     void inheritBindingURIs(BindingURI* other) { SET_VAR(rareNonInheritedData, bindingURI, other->copy()); }
       
   956     void addBindingURI(StringImpl* uri);
       
   957 #endif
       
   958 
       
   959     void setOutlineOffset(int v) { SET_VAR(m_background, m_outline.m_offset, v) }
       
   960     void setTextShadow(ShadowData* val, bool add=false);
       
   961     void setTextStrokeColor(const Color& c) { SET_VAR(rareInheritedData, textStrokeColor, c) }
       
   962     void setTextStrokeWidth(float w) { SET_VAR(rareInheritedData, textStrokeWidth, w) }
       
   963     void setTextFillColor(const Color& c) { SET_VAR(rareInheritedData, textFillColor, c) }
       
   964     void setColorSpace(ColorSpace space) { SET_VAR(rareInheritedData, colorSpace, space) }
       
   965     void setOpacity(float f) { SET_VAR(rareNonInheritedData, opacity, f); }
       
   966     void setAppearance(ControlPart a) { SET_VAR(rareNonInheritedData, m_appearance, a); }
       
   967     void setBoxAlign(EBoxAlignment a) { SET_VAR(rareNonInheritedData.access()->flexibleBox, align, a); }
       
   968     void setBoxDirection(EBoxDirection d) { inherited_flags._box_direction = d; }
       
   969     void setBoxFlex(float f) { SET_VAR(rareNonInheritedData.access()->flexibleBox, flex, f); }
       
   970     void setBoxFlexGroup(unsigned int fg) { SET_VAR(rareNonInheritedData.access()->flexibleBox, flex_group, fg); }
       
   971     void setBoxLines(EBoxLines l) { SET_VAR(rareNonInheritedData.access()->flexibleBox, lines, l); }
       
   972     void setBoxOrdinalGroup(unsigned int og) { SET_VAR(rareNonInheritedData.access()->flexibleBox, ordinal_group, og); }
       
   973     void setBoxOrient(EBoxOrient o) { SET_VAR(rareNonInheritedData.access()->flexibleBox, orient, o); }
       
   974     void setBoxPack(EBoxAlignment p) { SET_VAR(rareNonInheritedData.access()->flexibleBox, pack, p); }
       
   975     void setBoxShadow(ShadowData* val, bool add=false);
       
   976     void setBoxReflect(PassRefPtr<StyleReflection> reflect) { if (rareNonInheritedData->m_boxReflect != reflect) rareNonInheritedData.access()->m_boxReflect = reflect; }
       
   977     void setBoxSizing(EBoxSizing s) { SET_VAR(m_box, m_boxSizing, s); }
       
   978     void setMarqueeIncrement(const Length& f) { SET_VAR(rareNonInheritedData.access()->marquee, increment, f); }
       
   979     void setMarqueeSpeed(int f) { SET_VAR(rareNonInheritedData.access()->marquee, speed, f); }
       
   980     void setMarqueeDirection(EMarqueeDirection d) { SET_VAR(rareNonInheritedData.access()->marquee, direction, d); }
       
   981     void setMarqueeBehavior(EMarqueeBehavior b) { SET_VAR(rareNonInheritedData.access()->marquee, behavior, b); }
       
   982     void setMarqueeLoopCount(int i) { SET_VAR(rareNonInheritedData.access()->marquee, loops, i); }
       
   983     void setUserModify(EUserModify u) { SET_VAR(rareInheritedData, userModify, u); }
       
   984     void setUserDrag(EUserDrag d) { SET_VAR(rareNonInheritedData, userDrag, d); }
       
   985     void setUserSelect(EUserSelect s) { SET_VAR(rareInheritedData, userSelect, s); }
       
   986     void setTextOverflow(bool b) { SET_VAR(rareNonInheritedData, textOverflow, b); }
       
   987     void setMarginTopCollapse(EMarginCollapse c) { SET_VAR(rareNonInheritedData, marginTopCollapse, c); }
       
   988     void setMarginBottomCollapse(EMarginCollapse c) { SET_VAR(rareNonInheritedData, marginBottomCollapse, c); }
       
   989     void setWordBreak(EWordBreak b) { SET_VAR(rareInheritedData, wordBreak, b); }
       
   990     void setWordWrap(EWordWrap b) { SET_VAR(rareInheritedData, wordWrap, b); }
       
   991     void setNBSPMode(ENBSPMode b) { SET_VAR(rareInheritedData, nbspMode, b); }
       
   992     void setKHTMLLineBreak(EKHTMLLineBreak b) { SET_VAR(rareInheritedData, khtmlLineBreak, b); }
       
   993     void setMatchNearestMailBlockquoteColor(EMatchNearestMailBlockquoteColor c) { SET_VAR(rareNonInheritedData, matchNearestMailBlockquoteColor, c); }
       
   994     void setHighlight(const AtomicString& h) { SET_VAR(rareInheritedData, highlight, h); }
       
   995     void setHyphens(Hyphens h) { SET_VAR(rareInheritedData, hyphens, h); }
       
   996     void setHyphenateCharacter(const AtomicString& h) { SET_VAR(rareInheritedData, hyphenateCharacter, h); }
       
   997     void setBorderFit(EBorderFit b) { SET_VAR(rareNonInheritedData, m_borderFit, b); }
       
   998     void setResize(EResize r) { SET_VAR(rareInheritedData, resize, r); }
       
   999     void setColumnWidth(float f) { SET_VAR(rareNonInheritedData.access()->m_multiCol, m_autoWidth, false); SET_VAR(rareNonInheritedData.access()->m_multiCol, m_width, f); }
       
  1000     void setHasAutoColumnWidth() { SET_VAR(rareNonInheritedData.access()->m_multiCol, m_autoWidth, true); SET_VAR(rareNonInheritedData.access()->m_multiCol, m_width, 0); }
       
  1001     void setColumnCount(unsigned short c) { SET_VAR(rareNonInheritedData.access()->m_multiCol, m_autoCount, false); SET_VAR(rareNonInheritedData.access()->m_multiCol, m_count, c); }
       
  1002     void setHasAutoColumnCount() { SET_VAR(rareNonInheritedData.access()->m_multiCol, m_autoCount, true); SET_VAR(rareNonInheritedData.access()->m_multiCol, m_count, 0); }
       
  1003     void setColumnGap(float f) { SET_VAR(rareNonInheritedData.access()->m_multiCol, m_normalGap, false); SET_VAR(rareNonInheritedData.access()->m_multiCol, m_gap, f); }
       
  1004     void setHasNormalColumnGap() { SET_VAR(rareNonInheritedData.access()->m_multiCol, m_normalGap, true); SET_VAR(rareNonInheritedData.access()->m_multiCol, m_gap, 0); }
       
  1005     void setColumnRuleColor(const Color& c) { SET_VAR(rareNonInheritedData.access()->m_multiCol, m_rule.m_color, c); }
       
  1006     void setColumnRuleStyle(EBorderStyle b) { SET_VAR(rareNonInheritedData.access()->m_multiCol, m_rule.m_style, b); }
       
  1007     void setColumnRuleWidth(unsigned short w) { SET_VAR(rareNonInheritedData.access()->m_multiCol, m_rule.m_width, w); }
       
  1008     void resetColumnRule() { SET_VAR(rareNonInheritedData.access()->m_multiCol, m_rule, BorderValue()) }
       
  1009     void setColumnSpan(bool b) { SET_VAR(rareNonInheritedData.access()->m_multiCol, m_columnSpan, b); }
       
  1010     void setColumnBreakBefore(EPageBreak p) { SET_VAR(rareNonInheritedData.access()->m_multiCol, m_breakBefore, p); }
       
  1011     void setColumnBreakInside(EPageBreak p) { SET_VAR(rareNonInheritedData.access()->m_multiCol, m_breakInside, p); }
       
  1012     void setColumnBreakAfter(EPageBreak p) { SET_VAR(rareNonInheritedData.access()->m_multiCol, m_breakAfter, p); }
       
  1013     void inheritColumnPropertiesFrom(RenderStyle* parent) { rareNonInheritedData.access()->m_multiCol = parent->rareNonInheritedData->m_multiCol; }
       
  1014     void setTransform(const TransformOperations& ops) { SET_VAR(rareNonInheritedData.access()->m_transform, m_operations, ops); }
       
  1015     void setTransformOriginX(Length l) { SET_VAR(rareNonInheritedData.access()->m_transform, m_x, l); }
       
  1016     void setTransformOriginY(Length l) { SET_VAR(rareNonInheritedData.access()->m_transform, m_y, l); }
       
  1017     void setTransformOriginZ(float f) { SET_VAR(rareNonInheritedData.access()->m_transform, m_z, f); }
       
  1018     // End CSS3 Setters
       
  1019 
       
  1020 #if ENABLE(HAPTICS)  
       
  1021     void setHapticTapType(EHapticTapType b) { SET_VAR(inherited, hapticTapType, b); }
       
  1022     void setHapticTapStrength(EHapticTapStrength b) { SET_VAR(inherited, hapticTapStrength, b); }
       
  1023 #endif  
       
  1024 
       
  1025     // Apple-specific property setters
       
  1026     void setPointerEvents(EPointerEvents p) { inherited_flags._pointerEvents = p; }
       
  1027 
       
  1028     void clearAnimations()
       
  1029     {
       
  1030         rareNonInheritedData.access()->m_animations.clear();
       
  1031     }
       
  1032 
       
  1033     void clearTransitions()
       
  1034     {
       
  1035         rareNonInheritedData.access()->m_transitions.clear();
       
  1036     }
       
  1037 
       
  1038     void inheritAnimations(const AnimationList* parent) { rareNonInheritedData.access()->m_animations = parent ? adoptPtr(new AnimationList(*parent)) : PassOwnPtr<AnimationList>(); }
       
  1039     void inheritTransitions(const AnimationList* parent) { rareNonInheritedData.access()->m_transitions = parent ? adoptPtr(new AnimationList(*parent)) : PassOwnPtr<AnimationList>(); }
       
  1040     void adjustAnimations();
       
  1041     void adjustTransitions();
       
  1042 
       
  1043     void setTransformStyle3D(ETransformStyle3D b) { SET_VAR(rareNonInheritedData, m_transformStyle3D, b); }
       
  1044     void setBackfaceVisibility(EBackfaceVisibility b) { SET_VAR(rareNonInheritedData, m_backfaceVisibility, b); }
       
  1045     void setPerspective(float p) { SET_VAR(rareNonInheritedData, m_perspective, p); }
       
  1046     void setPerspectiveOriginX(Length l) { SET_VAR(rareNonInheritedData, m_perspectiveOriginX, l); }
       
  1047     void setPerspectiveOriginY(Length l) { SET_VAR(rareNonInheritedData, m_perspectiveOriginY, l); }
       
  1048     void setPageSize(LengthSize s) { SET_VAR(rareNonInheritedData, m_pageSize, s); }
       
  1049     void setPageSizeType(PageSizeType t) { SET_VAR(rareNonInheritedData, m_pageSizeType, t); }
       
  1050     void resetPageSizeType() { SET_VAR(rareNonInheritedData, m_pageSizeType, PAGE_SIZE_AUTO); }
       
  1051 
       
  1052 #if USE(ACCELERATED_COMPOSITING)
       
  1053     void setIsRunningAcceleratedAnimation(bool b = true) { SET_VAR(rareNonInheritedData, m_runningAcceleratedAnimation, b); }
       
  1054 #endif
       
  1055 
       
  1056     void setLineClamp(LineClampValue c) { SET_VAR(rareNonInheritedData, lineClamp, c); }
       
  1057     void setTextSizeAdjust(bool b) { SET_VAR(rareInheritedData, textSizeAdjust, b); }
       
  1058     void setTextSecurity(ETextSecurity aTextSecurity) { SET_VAR(rareInheritedData, textSecurity, aTextSecurity); }
       
  1059 
       
  1060 #if ENABLE(SVG)
       
  1061     const SVGRenderStyle* svgStyle() const { return m_svgStyle.get(); }
       
  1062     SVGRenderStyle* accessSVGStyle() { return m_svgStyle.access(); }
       
  1063     
       
  1064     float fillOpacity() const { return svgStyle()->fillOpacity(); }
       
  1065     void setFillOpacity(float f) { accessSVGStyle()->setFillOpacity(f); }
       
  1066     
       
  1067     float strokeOpacity() const { return svgStyle()->strokeOpacity(); }
       
  1068     void setStrokeOpacity(float f) { accessSVGStyle()->setStrokeOpacity(f); }
       
  1069     
       
  1070     float floodOpacity() const { return svgStyle()->floodOpacity(); }
       
  1071     void setFloodOpacity(float f) { accessSVGStyle()->setFloodOpacity(f); }
       
  1072 #endif
       
  1073 
       
  1074     const ContentData* contentData() const { return rareNonInheritedData->m_content.get(); }
       
  1075     bool contentDataEquivalent(const RenderStyle* otherStyle) const { return const_cast<RenderStyle*>(this)->rareNonInheritedData->contentDataEquivalent(*const_cast<RenderStyle*>(otherStyle)->rareNonInheritedData); }
       
  1076     void clearContent();
       
  1077     void setContent(PassRefPtr<StringImpl>, bool add = false);
       
  1078     void setContent(PassRefPtr<StyleImage>, bool add = false);
       
  1079     void setContent(CounterContent*, bool add = false);
       
  1080 
       
  1081     const CounterDirectiveMap* counterDirectives() const;
       
  1082     CounterDirectiveMap& accessCounterDirectives();
       
  1083 
       
  1084     const AtomicString& hyphenString() const;
       
  1085 
       
  1086     bool inheritedNotEqual(const RenderStyle*) const;
       
  1087 
       
  1088     StyleDifference diff(const RenderStyle*, unsigned& changedContextSensitiveProperties) const;
       
  1089 
       
  1090     bool isDisplayReplacedType() const
       
  1091     {
       
  1092         return display() == INLINE_BLOCK || display() == INLINE_BOX || display() == INLINE_TABLE;
       
  1093     }
       
  1094 
       
  1095     bool isDisplayInlineType() const
       
  1096     {
       
  1097         return display() == INLINE || isDisplayReplacedType();
       
  1098     }
       
  1099 
       
  1100     bool isOriginalDisplayInlineType() const
       
  1101     {
       
  1102         return originalDisplay() == INLINE || originalDisplay() == INLINE_BLOCK ||
       
  1103                originalDisplay() == INLINE_BOX || originalDisplay() == INLINE_TABLE;
       
  1104     }
       
  1105 
       
  1106     // To tell if this style matched attribute selectors. This makes it impossible to share.
       
  1107     bool affectedByAttributeSelectors() const { return m_affectedByAttributeSelectors; }
       
  1108     void setAffectedByAttributeSelectors() { m_affectedByAttributeSelectors = true; }
       
  1109 
       
  1110     bool unique() const { return m_unique; }
       
  1111     void setUnique() { m_unique = true; }
       
  1112 
       
  1113     // Methods for indicating the style is affected by dynamic updates (e.g., children changing, our position changing in our sibling list, etc.)
       
  1114     bool affectedByEmpty() const { return m_affectedByEmpty; }
       
  1115     bool emptyState() const { return m_emptyState; }
       
  1116     void setEmptyState(bool b) { m_affectedByEmpty = true; m_unique = true; m_emptyState = b; }
       
  1117     bool childrenAffectedByPositionalRules() const { return childrenAffectedByForwardPositionalRules() || childrenAffectedByBackwardPositionalRules(); }
       
  1118     bool childrenAffectedByFirstChildRules() const { return m_childrenAffectedByFirstChildRules; }
       
  1119     void setChildrenAffectedByFirstChildRules() { m_childrenAffectedByFirstChildRules = true; }
       
  1120     bool childrenAffectedByLastChildRules() const { return m_childrenAffectedByLastChildRules; }
       
  1121     void setChildrenAffectedByLastChildRules() { m_childrenAffectedByLastChildRules = true; }
       
  1122     bool childrenAffectedByDirectAdjacentRules() const { return m_childrenAffectedByDirectAdjacentRules; }
       
  1123     void setChildrenAffectedByDirectAdjacentRules() { m_childrenAffectedByDirectAdjacentRules = true; }
       
  1124     bool childrenAffectedByForwardPositionalRules() const { return m_childrenAffectedByForwardPositionalRules; }
       
  1125     void setChildrenAffectedByForwardPositionalRules() { m_childrenAffectedByForwardPositionalRules = true; }
       
  1126     bool childrenAffectedByBackwardPositionalRules() const { return m_childrenAffectedByBackwardPositionalRules; }
       
  1127     void setChildrenAffectedByBackwardPositionalRules() { m_childrenAffectedByBackwardPositionalRules = true; }
       
  1128     bool firstChildState() const { return m_firstChildState; }
       
  1129     void setFirstChildState() { m_firstChildState = true; }
       
  1130     bool lastChildState() const { return m_lastChildState; }
       
  1131     void setLastChildState() { m_lastChildState = true; }
       
  1132     unsigned childIndex() const { return m_childIndex; }
       
  1133     void setChildIndex(unsigned index) { m_childIndex = index; }
       
  1134 
       
  1135     const Color visitedDependentColor(int colorProperty) const;
       
  1136 
       
  1137     // Initial values for all the properties
       
  1138     static bool initialBorderCollapse() { return false; }
       
  1139     static EBorderStyle initialBorderStyle() { return BNONE; }
       
  1140     static NinePieceImage initialNinePieceImage() { return NinePieceImage(); }
       
  1141     static IntSize initialBorderRadius() { return IntSize(0, 0); }
       
  1142     static ECaptionSide initialCaptionSide() { return CAPTOP; }
       
  1143     static EClear initialClear() { return CNONE; }
       
  1144     static TextDirection initialDirection() { return LTR; }
       
  1145     static EDisplay initialDisplay() { return INLINE; }
       
  1146     static EEmptyCell initialEmptyCells() { return SHOW; }
       
  1147     static EFloat initialFloating() { return FNONE; }
       
  1148     static EListStylePosition initialListStylePosition() { return OUTSIDE; }
       
  1149     static EListStyleType initialListStyleType() { return Disc; }
       
  1150     static EOverflow initialOverflowX() { return OVISIBLE; }
       
  1151     static EOverflow initialOverflowY() { return OVISIBLE; }
       
  1152     static EPageBreak initialPageBreak() { return PBAUTO; }
       
  1153     static EPosition initialPosition() { return StaticPosition; }
       
  1154     static ETableLayout initialTableLayout() { return TAUTO; }
       
  1155     static EUnicodeBidi initialUnicodeBidi() { return UBNormal; }
       
  1156     static ETextTransform initialTextTransform() { return TTNONE; }
       
  1157     static EVisibility initialVisibility() { return VISIBLE; }
       
  1158     static EWhiteSpace initialWhiteSpace() { return NORMAL; }
       
  1159     static short initialHorizontalBorderSpacing() { return 0; }
       
  1160     static short initialVerticalBorderSpacing() { return 0; }
       
  1161     static ECursor initialCursor() { return CURSOR_AUTO; }
       
  1162     static Color initialColor() { return Color::black; }
       
  1163     static StyleImage* initialListStyleImage() { return 0; }
       
  1164     static unsigned short initialBorderWidth() { return 3; }
       
  1165     static int initialLetterWordSpacing() { return 0; }
       
  1166     static Length initialSize() { return Length(); }
       
  1167     static Length initialMinSize() { return Length(0, Fixed); }
       
  1168     static Length initialMaxSize() { return Length(undefinedLength, Fixed); }
       
  1169     static Length initialOffset() { return Length(); }
       
  1170     static Length initialMargin() { return Length(Fixed); }
       
  1171     static Length initialPadding() { return Length(Fixed); }
       
  1172     static Length initialTextIndent() { return Length(Fixed); }
       
  1173     static EVerticalAlign initialVerticalAlign() { return BASELINE; }
       
  1174     static int initialWidows() { return 2; }
       
  1175     static int initialOrphans() { return 2; }
       
  1176     static Length initialLineHeight() { return Length(-100.0, Percent); }
       
  1177     static ETextAlign initialTextAlign() { return TAAUTO; }
       
  1178     static ETextDecoration initialTextDecoration() { return TDNONE; }
       
  1179     static float initialZoom() { return 1.0f; }
       
  1180     static int initialOutlineOffset() { return 0; }
       
  1181     static float initialOpacity() { return 1.0f; }
       
  1182     static EBoxAlignment initialBoxAlign() { return BSTRETCH; }
       
  1183     static EBoxDirection initialBoxDirection() { return BNORMAL; }
       
  1184     static EBoxLines initialBoxLines() { return SINGLE; }
       
  1185     static EBoxOrient initialBoxOrient() { return HORIZONTAL; }
       
  1186     static EBoxAlignment initialBoxPack() { return BSTART; }
       
  1187     static float initialBoxFlex() { return 0.0f; }
       
  1188     static int initialBoxFlexGroup() { return 1; }
       
  1189     static int initialBoxOrdinalGroup() { return 1; }
       
  1190     static EBoxSizing initialBoxSizing() { return CONTENT_BOX; }
       
  1191     static StyleReflection* initialBoxReflect() { return 0; }
       
  1192     static int initialMarqueeLoopCount() { return -1; }
       
  1193     static int initialMarqueeSpeed() { return 85; }
       
  1194     static Length initialMarqueeIncrement() { return Length(6, Fixed); }
       
  1195     static EMarqueeBehavior initialMarqueeBehavior() { return MSCROLL; }
       
  1196     static EMarqueeDirection initialMarqueeDirection() { return MAUTO; }
       
  1197     static EUserModify initialUserModify() { return READ_ONLY; }
       
  1198     static EUserDrag initialUserDrag() { return DRAG_AUTO; }
       
  1199     static EUserSelect initialUserSelect() { return SELECT_TEXT; }
       
  1200     static bool initialTextOverflow() { return false; }
       
  1201     static EMarginCollapse initialMarginTopCollapse() { return MCOLLAPSE; }
       
  1202     static EMarginCollapse initialMarginBottomCollapse() { return MCOLLAPSE; }
       
  1203     static EWordBreak initialWordBreak() { return NormalWordBreak; }
       
  1204     static EWordWrap initialWordWrap() { return NormalWordWrap; }
       
  1205     static ENBSPMode initialNBSPMode() { return NBNORMAL; }
       
  1206     static EKHTMLLineBreak initialKHTMLLineBreak() { return LBNORMAL; }
       
  1207     static EMatchNearestMailBlockquoteColor initialMatchNearestMailBlockquoteColor() { return BCNORMAL; }
       
  1208     static const AtomicString& initialHighlight() { return nullAtom; }
       
  1209     static Hyphens initialHyphens() { return HyphensManual; }
       
  1210     static const AtomicString& initialHyphenateCharacter() { return nullAtom; }
       
  1211     static EBorderFit initialBorderFit() { return BorderFitBorder; }
       
  1212     static EResize initialResize() { return RESIZE_NONE; }
       
  1213     static ControlPart initialAppearance() { return NoControlPart; }
       
  1214     static bool initialVisuallyOrdered() { return false; }
       
  1215     static float initialTextStrokeWidth() { return 0; }
       
  1216     static unsigned short initialColumnCount() { return 1; }
       
  1217     static bool initialColumnSpan() { return false; }
       
  1218     static const TransformOperations& initialTransform() { DEFINE_STATIC_LOCAL(TransformOperations, ops, ()); return ops; }
       
  1219     static Length initialTransformOriginX() { return Length(50.0, Percent); }
       
  1220     static Length initialTransformOriginY() { return Length(50.0, Percent); }
       
  1221     static EPointerEvents initialPointerEvents() { return PE_AUTO; }
       
  1222     static float initialTransformOriginZ() { return 0; }
       
  1223     static ETransformStyle3D initialTransformStyle3D() { return TransformStyle3DFlat; }
       
  1224     static EBackfaceVisibility initialBackfaceVisibility() { return BackfaceVisibilityVisible; }
       
  1225     static float initialPerspective() { return 0; }
       
  1226     static Length initialPerspectiveOriginX() { return Length(50.0, Percent); }
       
  1227     static Length initialPerspectiveOriginY() { return Length(50.0, Percent); }
       
  1228     static Color initialBackgroundColor() { return Color::transparent; }
       
  1229 
       
  1230 #if ENABLE(HAPTICS)
       
  1231     static EHapticTapType initialHapticTapType() { return HBUTTON; }
       
  1232     static EHapticTapStrength initialHapticTapStrength() { return HNONE; }
       
  1233 #endif
       
  1234 
       
  1235     // Keep these at the end.
       
  1236     static LineClampValue initialLineClamp() { return LineClampValue(); }
       
  1237     static bool initialTextSizeAdjust() { return true; }
       
  1238     static ETextSecurity initialTextSecurity() { return TSNONE; }
       
  1239 #if ENABLE(DASHBOARD_SUPPORT)
       
  1240     static const Vector<StyleDashboardRegion>& initialDashboardRegions();
       
  1241     static const Vector<StyleDashboardRegion>& noneDashboardRegions();
       
  1242 #endif
       
  1243 
       
  1244 private:
       
  1245     // Color accessors are all private to make sure callers use visitedDependentColor instead to access them.
       
  1246     const Color& borderLeftColor() const { return surround->border.left().color(); }
       
  1247     const Color& borderRightColor() const { return surround->border.right().color(); }
       
  1248     const Color& borderTopColor() const { return surround->border.top().color(); }
       
  1249     const Color& borderBottomColor() const { return surround->border.bottom().color(); }
       
  1250     const Color& backgroundColor() const { return m_background->color(); }
       
  1251     const Color& color() const { return inherited->color; }
       
  1252     const Color& columnRuleColor() const { return rareNonInheritedData->m_multiCol->m_rule.color(); }
       
  1253     const Color& outlineColor() const { return m_background->outline().color(); }
       
  1254     const Color& textFillColor() const { return rareInheritedData->textFillColor; }
       
  1255     const Color& textStrokeColor() const { return rareInheritedData->textStrokeColor; }
       
  1256     
       
  1257     const Color colorIncludingFallback(int colorProperty, EBorderStyle borderStyle) const;
       
  1258 };
       
  1259 
       
  1260 } // namespace WebCore
       
  1261 
       
  1262 #endif // RenderStyle_h