OSDN Git Service

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