OSDN Git Service

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