OSDN Git Service

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