5582520e49642b6fafb6325cb8b5223e37994c03
[platform/framework/web/crosswalk.git] / src / third_party / WebKit / Source / core / 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, 2011 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 "core/CSSPropertyNames.h"
29 #include "core/animation/css/CSSAnimationData.h"
30 #include "core/animation/css/CSSTransitionData.h"
31 #include "core/css/CSSLineBoxContainValue.h"
32 #include "core/css/CSSPrimitiveValue.h"
33 #include "core/rendering/style/BorderValue.h"
34 #include "core/rendering/style/CounterDirectives.h"
35 #include "core/rendering/style/DataRef.h"
36 #include "core/rendering/style/LineClampValue.h"
37 #include "core/rendering/style/NinePieceImage.h"
38 #include "core/rendering/style/OutlineValue.h"
39 #include "core/rendering/style/RenderStyleConstants.h"
40 #include "core/rendering/style/SVGRenderStyle.h"
41 #include "core/rendering/style/ShapeValue.h"
42 #include "core/rendering/style/StyleBackgroundData.h"
43 #include "core/rendering/style/StyleBoxData.h"
44 #include "core/rendering/style/StyleDeprecatedFlexibleBoxData.h"
45 #include "core/rendering/style/StyleDifference.h"
46 #include "core/rendering/style/StyleFilterData.h"
47 #include "core/rendering/style/StyleFlexibleBoxData.h"
48 #include "core/rendering/style/StyleGridData.h"
49 #include "core/rendering/style/StyleGridItemData.h"
50 #include "core/rendering/style/StyleInheritedData.h"
51 #include "core/rendering/style/StyleMultiColData.h"
52 #include "core/rendering/style/StyleRareInheritedData.h"
53 #include "core/rendering/style/StyleRareNonInheritedData.h"
54 #include "core/rendering/style/StyleReflection.h"
55 #include "core/rendering/style/StyleSurroundData.h"
56 #include "core/rendering/style/StyleTransformData.h"
57 #include "core/rendering/style/StyleVisualData.h"
58 #include "core/rendering/style/StyleWillChangeData.h"
59 #include "core/rendering/style/TransformOrigin.h"
60 #include "platform/Length.h"
61 #include "platform/LengthBox.h"
62 #include "platform/LengthPoint.h"
63 #include "platform/LengthSize.h"
64 #include "platform/ThemeTypes.h"
65 #include "platform/fonts/FontBaseline.h"
66 #include "platform/fonts/FontDescription.h"
67 #include "platform/geometry/FloatRoundedRect.h"
68 #include "platform/geometry/LayoutBoxExtent.h"
69 #include "platform/geometry/RoundedRect.h"
70 #include "platform/graphics/Color.h"
71 #include "platform/graphics/GraphicsTypes.h"
72 #include "platform/scroll/ScrollableArea.h"
73 #include "platform/text/TextDirection.h"
74 #include "platform/text/UnicodeBidi.h"
75 #include "platform/transforms/TransformOperations.h"
76 #include "wtf/Forward.h"
77 #include "wtf/OwnPtr.h"
78 #include "wtf/RefCounted.h"
79 #include "wtf/StdLibExtras.h"
80 #include "wtf/Vector.h"
81
82 template<typename T, typename U> inline bool compareEqual(const T& t, const U& u) { return t == static_cast<T>(u); }
83
84 #define SET_VAR(group, variable, value) \
85     if (!compareEqual(group->variable, value)) \
86         group.access()->variable = value
87
88 #define SET_VAR_WITH_SETTER(group, getter, setter, value)    \
89     if (!compareEqual(group->getter(), value)) \
90         group.access()->setter(value)
91
92 #define SET_BORDERVALUE_COLOR(group, variable, value) \
93     if (!compareEqual(group->variable.color(), value)) \
94         group.access()->variable.setColor(value)
95
96 namespace blink {
97
98 using std::max;
99
100 class FilterOperations;
101
102 class AppliedTextDecoration;
103 class BorderData;
104 struct BorderEdge;
105 class CounterContent;
106 class Font;
107 class FontMetrics;
108 class ShadowList;
109 class StyleImage;
110 class StyleInheritedData;
111 class StyleResolver;
112 class TransformationMatrix;
113
114 class ContentData;
115
116 typedef Vector<RefPtr<RenderStyle>, 4> PseudoStyleCache;
117
118 class RenderStyle: public RefCounted<RenderStyle> {
119     friend class AnimatedStyleBuilder; // Used by Web Animations CSS. Sets the color styles
120     friend class CSSAnimatableValueFactory; // Used by Web Animations CSS. Gets visited and unvisited colors separately.
121     friend class CSSPropertyEquality; // Used by CSS animations. We can't allow them to animate based off visited colors.
122     friend class ApplyStyleCommand; // Editing has to only reveal unvisited info.
123     friend class EditingStyle; // Editing has to only reveal unvisited info.
124     friend class CSSComputedStyleDeclaration; // Ignores visited styles, so needs to be able to see unvisited info.
125     friend class StyleBuilderFunctions; // Sets color styles
126     friend class CachedUAStyle; // Saves Border/Background information for later comparison.
127
128     // FIXME: When we stop resolving currentColor at style time, these can be removed.
129     friend class CSSToStyleMap;
130     friend class FilterOperationResolver;
131     friend class StyleBuilderConverter;
132     friend class StyleResolverState;
133     friend class StyleResolver;
134 protected:
135
136     // non-inherited attributes
137     DataRef<StyleBoxData> m_box;
138     DataRef<StyleVisualData> visual;
139     DataRef<StyleBackgroundData> m_background;
140     DataRef<StyleSurroundData> surround;
141     DataRef<StyleRareNonInheritedData> rareNonInheritedData;
142
143     // inherited attributes
144     DataRef<StyleRareInheritedData> rareInheritedData;
145     DataRef<StyleInheritedData> inherited;
146
147     // list of associated pseudo styles
148     OwnPtr<PseudoStyleCache> m_cachedPseudoStyles;
149
150     DataRef<SVGRenderStyle> m_svgStyle;
151
152 // !START SYNC!: Keep this in sync with the copy constructor in RenderStyle.cpp and implicitlyInherited() in StyleResolver.cpp
153
154     // inherit
155     struct InheritedFlags {
156         bool operator==(const InheritedFlags& other) const
157         {
158             return (_empty_cells == other._empty_cells)
159                 && (_caption_side == other._caption_side)
160                 && (_list_style_type == other._list_style_type)
161                 && (_list_style_position == other._list_style_position)
162                 && (_visibility == other._visibility)
163                 && (_text_align == other._text_align)
164                 && (_text_transform == other._text_transform)
165                 && (m_textUnderline == other.m_textUnderline)
166                 && (_cursor_style == other._cursor_style)
167                 && (_direction == other._direction)
168                 && (_white_space == other._white_space)
169                 && (_border_collapse == other._border_collapse)
170                 && (_box_direction == other._box_direction)
171                 && (m_rtlOrdering == other.m_rtlOrdering)
172                 && (m_printColorAdjust == other.m_printColorAdjust)
173                 && (_pointerEvents == other._pointerEvents)
174                 && (_insideLink == other._insideLink)
175                 && (m_writingMode == other.m_writingMode);
176         }
177
178         bool operator!=(const InheritedFlags& other) const { return !(*this == other); }
179
180         unsigned _empty_cells : 1; // EEmptyCell
181         unsigned _caption_side : 2; // ECaptionSide
182         unsigned _list_style_type : 7; // EListStyleType
183         unsigned _list_style_position : 1; // EListStylePosition
184         unsigned _visibility : 2; // EVisibility
185         unsigned _text_align : 4; // ETextAlign
186         unsigned _text_transform : 2; // ETextTransform
187         unsigned m_textUnderline : 1;
188         unsigned _cursor_style : 6; // ECursor
189         unsigned _direction : 1; // TextDirection
190         unsigned _white_space : 3; // EWhiteSpace
191         unsigned _border_collapse : 1; // EBorderCollapse
192         unsigned _box_direction : 1; // EBoxDirection (CSS3 box_direction property, flexible box layout module)
193         // 32 bits
194
195         // non CSS2 inherited
196         unsigned m_rtlOrdering : 1; // Order
197         unsigned m_printColorAdjust : PrintColorAdjustBits;
198         unsigned _pointerEvents : 4; // EPointerEvents
199         unsigned _insideLink : 2; // EInsideLink
200
201         // CSS Text Layout Module Level 3: Vertical writing support
202         unsigned m_writingMode : 2; // WritingMode
203         // 42 bits
204     } inherited_flags;
205
206 // don't inherit
207     struct NonInheritedFlags {
208         bool operator==(const NonInheritedFlags& other) const
209         {
210             return effectiveDisplay == other.effectiveDisplay
211                 && originalDisplay == other.originalDisplay
212                 && overflowX == other.overflowX
213                 && overflowY == other.overflowY
214                 && verticalAlign == other.verticalAlign
215                 && clear == other.clear
216                 && position == other.position
217                 && floating == other.floating
218                 && tableLayout == other.tableLayout
219                 && pageBreakBefore == other.pageBreakBefore
220                 && pageBreakAfter == other.pageBreakAfter
221                 && pageBreakInside == other.pageBreakInside
222                 && styleType == other.styleType
223                 && affectedByFocus == other.affectedByFocus
224                 && affectedByHover == other.affectedByHover
225                 && affectedByActive == other.affectedByActive
226                 && affectedByDrag == other.affectedByDrag
227                 && pseudoBits == other.pseudoBits
228                 && unicodeBidi == other.unicodeBidi
229                 && explicitInheritance == other.explicitInheritance
230                 && unique == other.unique
231                 && emptyState == other.emptyState
232                 && firstChildState == other.firstChildState
233                 && lastChildState == other.lastChildState
234                 && isLink == other.isLink;
235         }
236
237         bool operator!=(const NonInheritedFlags& other) const { return !(*this == other); }
238
239         unsigned effectiveDisplay : 5; // EDisplay
240         unsigned originalDisplay : 5; // EDisplay
241         unsigned overflowX : 3; // EOverflow
242         unsigned overflowY : 3; // EOverflow
243         unsigned verticalAlign : 4; // EVerticalAlign
244         unsigned clear : 2; // EClear
245         unsigned position : 3; // EPosition
246         unsigned floating : 2; // EFloat
247         unsigned tableLayout : 1; // ETableLayout
248         unsigned unicodeBidi : 3; // EUnicodeBidi
249
250         // This is set if we used viewport units when resolving a length.
251         // It is mutable so we can pass around const RenderStyles to resolve lengths.
252         mutable unsigned hasViewportUnits : 1;
253
254         // 32 bits
255
256         unsigned pageBreakBefore : 2; // EPageBreak
257         unsigned pageBreakAfter : 2; // EPageBreak
258         unsigned pageBreakInside : 2; // EPageBreak
259
260         unsigned styleType : 6; // PseudoId
261         unsigned pseudoBits : 8;
262         unsigned explicitInheritance : 1; // Explicitly inherits a non-inherited property
263         unsigned unique : 1; // Style can not be shared.
264
265         unsigned emptyState : 1;
266         unsigned firstChildState : 1;
267         unsigned lastChildState : 1;
268
269         unsigned affectedByFocus : 1;
270         unsigned affectedByHover : 1;
271         unsigned affectedByActive : 1;
272         unsigned affectedByDrag : 1;
273
274         unsigned isLink : 1;
275         // If you add more style bits here, you will also need to update RenderStyle::copyNonInheritedFrom()
276         // 62 bits
277     } noninherited_flags;
278
279 // !END SYNC!
280
281 protected:
282     void setBitDefaults()
283     {
284         inherited_flags._empty_cells = initialEmptyCells();
285         inherited_flags._caption_side = initialCaptionSide();
286         inherited_flags._list_style_type = initialListStyleType();
287         inherited_flags._list_style_position = initialListStylePosition();
288         inherited_flags._visibility = initialVisibility();
289         inherited_flags._text_align = initialTextAlign();
290         inherited_flags._text_transform = initialTextTransform();
291         inherited_flags.m_textUnderline = false;
292         inherited_flags._cursor_style = initialCursor();
293         inherited_flags._direction = initialDirection();
294         inherited_flags._white_space = initialWhiteSpace();
295         inherited_flags._border_collapse = initialBorderCollapse();
296         inherited_flags.m_rtlOrdering = initialRTLOrdering();
297         inherited_flags._box_direction = initialBoxDirection();
298         inherited_flags.m_printColorAdjust = initialPrintColorAdjust();
299         inherited_flags._pointerEvents = initialPointerEvents();
300         inherited_flags._insideLink = NotInsideLink;
301         inherited_flags.m_writingMode = initialWritingMode();
302
303         noninherited_flags.effectiveDisplay = noninherited_flags.originalDisplay = initialDisplay();
304         noninherited_flags.overflowX = initialOverflowX();
305         noninherited_flags.overflowY = initialOverflowY();
306         noninherited_flags.verticalAlign = initialVerticalAlign();
307         noninherited_flags.clear = initialClear();
308         noninherited_flags.position = initialPosition();
309         noninherited_flags.floating = initialFloating();
310         noninherited_flags.tableLayout = initialTableLayout();
311         noninherited_flags.unicodeBidi = initialUnicodeBidi();
312         noninherited_flags.pageBreakBefore = initialPageBreak();
313         noninherited_flags.pageBreakAfter = initialPageBreak();
314         noninherited_flags.pageBreakInside = initialPageBreak();
315         noninherited_flags.styleType = NOPSEUDO;
316         noninherited_flags.pseudoBits = 0;
317         noninherited_flags.explicitInheritance = false;
318         noninherited_flags.unique = false;
319         noninherited_flags.emptyState = false;
320         noninherited_flags.firstChildState = false;
321         noninherited_flags.lastChildState = false;
322         noninherited_flags.hasViewportUnits = false;
323         noninherited_flags.affectedByFocus = false;
324         noninherited_flags.affectedByHover = false;
325         noninherited_flags.affectedByActive = false;
326         noninherited_flags.affectedByDrag = false;
327         noninherited_flags.isLink = false;
328     }
329
330 private:
331     ALWAYS_INLINE RenderStyle();
332
333     enum DefaultStyleTag {
334         DefaultStyle
335     };
336     ALWAYS_INLINE explicit RenderStyle(DefaultStyleTag);
337     ALWAYS_INLINE RenderStyle(const RenderStyle&);
338
339 public:
340     static PassRefPtr<RenderStyle> create();
341     static PassRefPtr<RenderStyle> createDefaultStyle();
342     static PassRefPtr<RenderStyle> createAnonymousStyleWithDisplay(const RenderStyle* parentStyle, EDisplay);
343     static PassRefPtr<RenderStyle> clone(const RenderStyle*);
344
345     // Computes how the style change should be propagated down the tree.
346     static StyleRecalcChange stylePropagationDiff(const RenderStyle* oldStyle, const RenderStyle* newStyle);
347
348     static ItemPosition resolveAlignment(const RenderStyle* parentStyle, const RenderStyle* childStyle, ItemPosition resolvedAutoPositionForRenderer);
349     static ItemPosition resolveJustification(const RenderStyle* parentStyle, const RenderStyle* childStyle, ItemPosition resolvedAutoPositionForRenderer);
350
351     StyleDifference visualInvalidationDiff(const RenderStyle&) const;
352
353     enum IsAtShadowBoundary {
354         AtShadowBoundary,
355         NotAtShadowBoundary,
356     };
357
358     void inheritFrom(const RenderStyle* inheritParent, IsAtShadowBoundary = NotAtShadowBoundary);
359     void copyNonInheritedFrom(const RenderStyle*);
360
361     PseudoId styleType() const { return static_cast<PseudoId>(noninherited_flags.styleType); }
362     void setStyleType(PseudoId styleType) { noninherited_flags.styleType = styleType; }
363
364     RenderStyle* getCachedPseudoStyle(PseudoId) const;
365     RenderStyle* addCachedPseudoStyle(PassRefPtr<RenderStyle>);
366     void removeCachedPseudoStyle(PseudoId);
367
368     const PseudoStyleCache* cachedPseudoStyles() const { return m_cachedPseudoStyles.get(); }
369
370     void setHasViewportUnits(bool hasViewportUnits = true) const { noninherited_flags.hasViewportUnits = hasViewportUnits; }
371     bool hasViewportUnits() const { return noninherited_flags.hasViewportUnits; }
372
373     bool affectedByFocus() const { return noninherited_flags.affectedByFocus; }
374     bool affectedByHover() const { return noninherited_flags.affectedByHover; }
375     bool affectedByActive() const { return noninherited_flags.affectedByActive; }
376     bool affectedByDrag() const { return noninherited_flags.affectedByDrag; }
377
378     void setAffectedByFocus() { noninherited_flags.affectedByFocus = true; }
379     void setAffectedByHover() { noninherited_flags.affectedByHover = true; }
380     void setAffectedByActive() { noninherited_flags.affectedByActive = true; }
381     void setAffectedByDrag() { noninherited_flags.affectedByDrag = true; }
382
383     bool operator==(const RenderStyle& other) const;
384     bool operator!=(const RenderStyle& other) const { return !(*this == other); }
385     bool isFloating() const { return noninherited_flags.floating != NoFloat; }
386     bool hasMargin() const { return surround->margin.nonZero(); }
387     bool hasBorder() const { return surround->border.hasBorder(); }
388     bool hasPadding() const { return surround->padding.nonZero(); }
389     bool hasOffset() const { return surround->offset.nonZero(); }
390     bool hasMarginBeforeQuirk() const { return marginBefore().quirk(); }
391     bool hasMarginAfterQuirk() const { return marginAfter().quirk(); }
392
393     bool hasBackgroundImage() const { return m_background->background().hasImage(); }
394     bool hasFixedBackgroundImage() const { return m_background->background().hasFixedImage(); }
395
396     bool hasEntirelyFixedBackground() const;
397
398     bool hasAppearance() const { return appearance() != NoControlPart; }
399
400     bool hasBackground() const
401     {
402         Color color = visitedDependentColor(CSSPropertyBackgroundColor);
403         if (color.alpha())
404             return true;
405         return hasBackgroundImage();
406     }
407
408     LayoutBoxExtent imageOutsets(const NinePieceImage&) const;
409     bool hasBorderImageOutsets() const
410     {
411         return borderImage().hasImage() && borderImage().outset().nonZero();
412     }
413     LayoutBoxExtent borderImageOutsets() const
414     {
415         return imageOutsets(borderImage());
416     }
417
418     LayoutBoxExtent maskBoxImageOutsets() const
419     {
420         return imageOutsets(maskBoxImage());
421     }
422
423     bool hasFilterOutsets() const { return hasFilter() && filter().hasOutsets(); }
424     FilterOutsets filterOutsets() const { return hasFilter() ? filter().outsets() : FilterOutsets(); }
425
426     Order rtlOrdering() const { return static_cast<Order>(inherited_flags.m_rtlOrdering); }
427     void setRTLOrdering(Order o) { inherited_flags.m_rtlOrdering = o; }
428
429     bool isStyleAvailable() const;
430
431     bool hasAnyPublicPseudoStyles() const;
432     bool hasPseudoStyle(PseudoId pseudo) const;
433     void setHasPseudoStyle(PseudoId pseudo);
434     bool hasUniquePseudoStyle() const;
435     bool hasPseudoElementStyle() const;
436
437     // attribute getter methods
438
439     EDisplay display() const { return static_cast<EDisplay>(noninherited_flags.effectiveDisplay); }
440     EDisplay originalDisplay() const { return static_cast<EDisplay>(noninherited_flags.originalDisplay); }
441
442     const Length& left() const { return surround->offset.left(); }
443     const Length& right() const { return surround->offset.right(); }
444     const Length& top() const { return surround->offset.top(); }
445     const Length& bottom() const { return surround->offset.bottom(); }
446
447     // Accessors for positioned object edges that take into account writing mode.
448     const Length& logicalLeft() const { return surround->offset.logicalLeft(writingMode()); }
449     const Length& logicalRight() const { return surround->offset.logicalRight(writingMode()); }
450     const Length& logicalTop() const { return surround->offset.before(writingMode()); }
451     const Length& logicalBottom() const { return surround->offset.after(writingMode()); }
452
453     // Whether or not a positioned element requires normal flow x/y to be computed
454     // to determine its position.
455     bool hasAutoLeftAndRight() const { return left().isAuto() && right().isAuto(); }
456     bool hasAutoTopAndBottom() const { return top().isAuto() && bottom().isAuto(); }
457     bool hasStaticInlinePosition(bool horizontal) const { return horizontal ? hasAutoLeftAndRight() : hasAutoTopAndBottom(); }
458     bool hasStaticBlockPosition(bool horizontal) const { return horizontal ? hasAutoTopAndBottom() : hasAutoLeftAndRight(); }
459
460     EPosition position() const { return static_cast<EPosition>(noninherited_flags.position); }
461     bool hasOutOfFlowPosition() const { return position() == AbsolutePosition || position() == FixedPosition; }
462     bool hasInFlowPosition() const { return position() == RelativePosition; }
463     bool hasViewportConstrainedPosition() const { return position() == FixedPosition; }
464     EFloat floating() const { return static_cast<EFloat>(noninherited_flags.floating); }
465
466     const Length& width() const { return m_box->width(); }
467     const Length& height() const { return m_box->height(); }
468     const Length& minWidth() const { return m_box->minWidth(); }
469     const Length& maxWidth() const { return m_box->maxWidth(); }
470     const Length& minHeight() const { return m_box->minHeight(); }
471     const Length& maxHeight() const { return m_box->maxHeight(); }
472
473     const Length& logicalWidth() const { return isHorizontalWritingMode() ? width() : height(); }
474     const Length& logicalHeight() const { return isHorizontalWritingMode() ? height() : width(); }
475     const Length& logicalMinWidth() const { return isHorizontalWritingMode() ? minWidth() : minHeight(); }
476     const Length& logicalMaxWidth() const { return isHorizontalWritingMode() ? maxWidth() : maxHeight(); }
477     const Length& logicalMinHeight() const { return isHorizontalWritingMode() ? minHeight() : minWidth(); }
478     const Length& logicalMaxHeight() const { return isHorizontalWritingMode() ? maxHeight() : maxWidth(); }
479
480     const BorderData& border() const { return surround->border; }
481     const BorderValue& borderLeft() const { return surround->border.left(); }
482     const BorderValue& borderRight() const { return surround->border.right(); }
483     const BorderValue& borderTop() const { return surround->border.top(); }
484     const BorderValue& borderBottom() const { return surround->border.bottom(); }
485
486     const BorderValue& borderBefore() const;
487     const BorderValue& borderAfter() const;
488     const BorderValue& borderStart() const;
489     const BorderValue& borderEnd() const;
490
491     const NinePieceImage& borderImage() const { return surround->border.image(); }
492     StyleImage* borderImageSource() const { return surround->border.image().image(); }
493     const LengthBox& borderImageSlices() const { return surround->border.image().imageSlices(); }
494     const BorderImageLengthBox& borderImageWidth() const { return surround->border.image().borderSlices(); }
495     const BorderImageLengthBox& borderImageOutset() const { return surround->border.image().outset(); }
496
497     const LengthSize& borderTopLeftRadius() const { return surround->border.topLeft(); }
498     const LengthSize& borderTopRightRadius() const { return surround->border.topRight(); }
499     const LengthSize& borderBottomLeftRadius() const { return surround->border.bottomLeft(); }
500     const LengthSize& borderBottomRightRadius() const { return surround->border.bottomRight(); }
501     bool hasBorderRadius() const { return surround->border.hasBorderRadius(); }
502
503     unsigned borderLeftWidth() const { return surround->border.borderLeftWidth(); }
504     EBorderStyle borderLeftStyle() const { return surround->border.left().style(); }
505     bool borderLeftIsTransparent() const { return surround->border.left().isTransparent(); }
506     unsigned borderRightWidth() const { return surround->border.borderRightWidth(); }
507     EBorderStyle borderRightStyle() const { return surround->border.right().style(); }
508     bool borderRightIsTransparent() const { return surround->border.right().isTransparent(); }
509     unsigned borderTopWidth() const { return surround->border.borderTopWidth(); }
510     EBorderStyle borderTopStyle() const { return surround->border.top().style(); }
511     bool borderTopIsTransparent() const { return surround->border.top().isTransparent(); }
512     unsigned borderBottomWidth() const { return surround->border.borderBottomWidth(); }
513     EBorderStyle borderBottomStyle() const { return surround->border.bottom().style(); }
514     bool borderBottomIsTransparent() const { return surround->border.bottom().isTransparent(); }
515
516     unsigned short borderBeforeWidth() const;
517     unsigned short borderAfterWidth() const;
518     unsigned short borderStartWidth() const;
519     unsigned short borderEndWidth() const;
520
521     unsigned short outlineSize() const { return max(0, outlineWidth() + outlineOffset()); }
522     unsigned short outlineWidth() const
523     {
524         if (m_background->outline().style() == BNONE)
525             return 0;
526         return m_background->outline().width();
527     }
528     bool hasOutline() const { return outlineWidth() > 0 && outlineStyle() > BHIDDEN; }
529     EBorderStyle outlineStyle() const { return m_background->outline().style(); }
530     OutlineIsAuto outlineStyleIsAuto() const { return static_cast<OutlineIsAuto>(m_background->outline().isAuto()); }
531
532     EOverflow overflowX() const { return static_cast<EOverflow>(noninherited_flags.overflowX); }
533     EOverflow overflowY() const { return static_cast<EOverflow>(noninherited_flags.overflowY); }
534     // It's sufficient to just check one direction, since it's illegal to have visible on only one overflow value.
535     bool isOverflowVisible() const { ASSERT(overflowX() != OVISIBLE || overflowX() == overflowY()); return overflowX() == OVISIBLE; }
536     bool isOverflowPaged() const { return overflowY() == OPAGEDX || overflowY() == OPAGEDY; }
537
538     EVisibility visibility() const { return static_cast<EVisibility>(inherited_flags._visibility); }
539     EVerticalAlign verticalAlign() const { return static_cast<EVerticalAlign>(noninherited_flags.verticalAlign); }
540     const Length& verticalAlignLength() const { return m_box->verticalAlign(); }
541
542     const Length& clipLeft() const { return visual->clip.left(); }
543     const Length& clipRight() const { return visual->clip.right(); }
544     const Length& clipTop() const { return visual->clip.top(); }
545     const Length& clipBottom() const { return visual->clip.bottom(); }
546     const LengthBox& clip() const { return visual->clip; }
547     bool hasAutoClip() const { return visual->hasAutoClip; }
548
549     EUnicodeBidi unicodeBidi() const { return static_cast<EUnicodeBidi>(noninherited_flags.unicodeBidi); }
550
551     EClear clear() const { return static_cast<EClear>(noninherited_flags.clear); }
552     ETableLayout tableLayout() const { return static_cast<ETableLayout>(noninherited_flags.tableLayout); }
553     bool isFixedTableLayout() const { return tableLayout() == TFIXED && !logicalWidth().isAuto(); }
554
555     const Font& font() const;
556     const FontMetrics& fontMetrics() const;
557     const FontDescription& fontDescription() const;
558     float specifiedFontSize() const;
559     float computedFontSize() const;
560     int fontSize() const;
561     FontWeight fontWeight() const;
562     FontStretch fontStretch() const;
563
564     float textAutosizingMultiplier() const { return inherited->textAutosizingMultiplier; }
565
566     const Length& textIndent() const { return rareInheritedData->indent; }
567     TextIndentLine textIndentLine() const { return static_cast<TextIndentLine>(rareInheritedData->m_textIndentLine); }
568     TextIndentType textIndentType() const { return static_cast<TextIndentType>(rareInheritedData->m_textIndentType); }
569     ETextAlign textAlign() const { return static_cast<ETextAlign>(inherited_flags._text_align); }
570     TextAlignLast textAlignLast() const { return static_cast<TextAlignLast>(rareInheritedData->m_textAlignLast); }
571     TextJustify textJustify() const { return static_cast<TextJustify>(rareInheritedData->m_textJustify); }
572     ETextTransform textTransform() const { return static_cast<ETextTransform>(inherited_flags._text_transform); }
573     TextDecoration textDecorationsInEffect() const;
574     const Vector<AppliedTextDecoration>& appliedTextDecorations() const;
575     TextDecoration textDecoration() const { return static_cast<TextDecoration>(visual->textDecoration); }
576     TextUnderlinePosition textUnderlinePosition() const { return static_cast<TextUnderlinePosition>(rareInheritedData->m_textUnderlinePosition); }
577     TextDecorationStyle textDecorationStyle() const { return static_cast<TextDecorationStyle>(rareNonInheritedData->m_textDecorationStyle); }
578     float wordSpacing() const;
579     float letterSpacing() const;
580
581     float zoom() const { return visual->m_zoom; }
582     float effectiveZoom() const { return rareInheritedData->m_effectiveZoom; }
583
584     TextDirection direction() const { return static_cast<TextDirection>(inherited_flags._direction); }
585     bool isLeftToRightDirection() const { return direction() == LTR; }
586
587     const Length& specifiedLineHeight() const;
588     Length lineHeight() const;
589     int computedLineHeight() const;
590
591     EWhiteSpace whiteSpace() const { return static_cast<EWhiteSpace>(inherited_flags._white_space); }
592     static bool autoWrap(EWhiteSpace ws)
593     {
594         // Nowrap and pre don't automatically wrap.
595         return ws != NOWRAP && ws != PRE;
596     }
597
598     bool autoWrap() const
599     {
600         return autoWrap(whiteSpace());
601     }
602
603     static bool preserveNewline(EWhiteSpace ws)
604     {
605         // Normal and nowrap do not preserve newlines.
606         return ws != NORMAL && ws != NOWRAP;
607     }
608
609     bool preserveNewline() const
610     {
611         return preserveNewline(whiteSpace());
612     }
613
614     static bool collapseWhiteSpace(EWhiteSpace ws)
615     {
616         // Pre and prewrap do not collapse whitespace.
617         return ws != PRE && ws != PRE_WRAP;
618     }
619
620     bool collapseWhiteSpace() const
621     {
622         return collapseWhiteSpace(whiteSpace());
623     }
624
625     bool isCollapsibleWhiteSpace(UChar c) const
626     {
627         switch (c) {
628             case ' ':
629             case '\t':
630                 return collapseWhiteSpace();
631             case '\n':
632                 return !preserveNewline();
633         }
634         return false;
635     }
636
637     bool breakOnlyAfterWhiteSpace() const
638     {
639         return whiteSpace() == PRE_WRAP || lineBreak() == LineBreakAfterWhiteSpace;
640     }
641
642     bool breakWords() const
643     {
644         return wordBreak() == BreakWordBreak || overflowWrap() == BreakOverflowWrap;
645     }
646
647     EFillRepeat backgroundRepeatX() const { return static_cast<EFillRepeat>(m_background->background().repeatX()); }
648     EFillRepeat backgroundRepeatY() const { return static_cast<EFillRepeat>(m_background->background().repeatY()); }
649     CompositeOperator backgroundComposite() const { return static_cast<CompositeOperator>(m_background->background().composite()); }
650     EFillAttachment backgroundAttachment() const { return static_cast<EFillAttachment>(m_background->background().attachment()); }
651     EFillBox backgroundClip() const { return static_cast<EFillBox>(m_background->background().clip()); }
652     EFillBox backgroundOrigin() const { return static_cast<EFillBox>(m_background->background().origin()); }
653     const Length& backgroundXPosition() const { return m_background->background().xPosition(); }
654     const Length& backgroundYPosition() const { return m_background->background().yPosition(); }
655     EFillSizeType backgroundSizeType() const { return m_background->background().sizeType(); }
656     const LengthSize& backgroundSizeLength() const { return m_background->background().sizeLength(); }
657     FillLayer& accessBackgroundLayers() { return m_background.access()->m_background; }
658     const FillLayer& backgroundLayers() const { return m_background->background(); }
659
660     StyleImage* maskImage() const { return rareNonInheritedData->m_mask.image(); }
661     EFillRepeat maskRepeatX() const { return static_cast<EFillRepeat>(rareNonInheritedData->m_mask.repeatX()); }
662     EFillRepeat maskRepeatY() const { return static_cast<EFillRepeat>(rareNonInheritedData->m_mask.repeatY()); }
663     CompositeOperator maskComposite() const { return static_cast<CompositeOperator>(rareNonInheritedData->m_mask.composite()); }
664     EFillBox maskClip() const { return static_cast<EFillBox>(rareNonInheritedData->m_mask.clip()); }
665     EFillBox maskOrigin() const { return static_cast<EFillBox>(rareNonInheritedData->m_mask.origin()); }
666     const Length& maskXPosition() const { return rareNonInheritedData->m_mask.xPosition(); }
667     const Length& maskYPosition() const { return rareNonInheritedData->m_mask.yPosition(); }
668     EFillSizeType maskSizeType() const { return rareNonInheritedData->m_mask.sizeType(); }
669     const LengthSize& maskSizeLength() const { return rareNonInheritedData->m_mask.sizeLength(); }
670     FillLayer& accessMaskLayers() { return rareNonInheritedData.access()->m_mask; }
671     const FillLayer& maskLayers() const { return rareNonInheritedData->m_mask; }
672
673     const NinePieceImage& maskBoxImage() const { return rareNonInheritedData->m_maskBoxImage; }
674     StyleImage* maskBoxImageSource() const { return rareNonInheritedData->m_maskBoxImage.image(); }
675     const LengthBox& maskBoxImageSlices() const { return rareNonInheritedData->m_maskBoxImage.imageSlices(); }
676     bool maskBoxImageSlicesFill() const { return rareNonInheritedData->m_maskBoxImage.fill(); }
677     const BorderImageLengthBox& maskBoxImageWidth() const { return rareNonInheritedData->m_maskBoxImage.borderSlices(); }
678     const BorderImageLengthBox& maskBoxImageOutset() const { return rareNonInheritedData->m_maskBoxImage.outset(); }
679
680     EBorderCollapse borderCollapse() const { return static_cast<EBorderCollapse>(inherited_flags._border_collapse); }
681     short horizontalBorderSpacing() const;
682     short verticalBorderSpacing() const;
683     EEmptyCell emptyCells() const { return static_cast<EEmptyCell>(inherited_flags._empty_cells); }
684     ECaptionSide captionSide() const { return static_cast<ECaptionSide>(inherited_flags._caption_side); }
685
686     EListStyleType listStyleType() const { return static_cast<EListStyleType>(inherited_flags._list_style_type); }
687     StyleImage* listStyleImage() const;
688     EListStylePosition listStylePosition() const { return static_cast<EListStylePosition>(inherited_flags._list_style_position); }
689
690     const Length& marginTop() const { return surround->margin.top(); }
691     const Length& marginBottom() const { return surround->margin.bottom(); }
692     const Length& marginLeft() const { return surround->margin.left(); }
693     const Length& marginRight() const { return surround->margin.right(); }
694     const Length& marginBefore() const { return surround->margin.before(writingMode()); }
695     const Length& marginAfter() const { return surround->margin.after(writingMode()); }
696     const Length& marginStart() const { return surround->margin.start(writingMode(), direction()); }
697     const Length& marginEnd() const { return surround->margin.end(writingMode(), direction()); }
698     const Length& marginStartUsing(const RenderStyle* otherStyle) const { return surround->margin.start(otherStyle->writingMode(), otherStyle->direction()); }
699     const Length& marginEndUsing(const RenderStyle* otherStyle) const { return surround->margin.end(otherStyle->writingMode(), otherStyle->direction()); }
700     const Length& marginBeforeUsing(const RenderStyle* otherStyle) const { return surround->margin.before(otherStyle->writingMode()); }
701     const Length& marginAfterUsing(const RenderStyle* otherStyle) const { return surround->margin.after(otherStyle->writingMode()); }
702
703     const LengthBox& paddingBox() const { return surround->padding; }
704     const Length& paddingTop() const { return surround->padding.top(); }
705     const Length& paddingBottom() const { return surround->padding.bottom(); }
706     const Length& paddingLeft() const { return surround->padding.left(); }
707     const Length& paddingRight() const { return surround->padding.right(); }
708     const Length& paddingBefore() const { return surround->padding.before(writingMode()); }
709     const Length& paddingAfter() const { return surround->padding.after(writingMode()); }
710     const Length& paddingStart() const { return surround->padding.start(writingMode(), direction()); }
711     const Length& paddingEnd() const { return surround->padding.end(writingMode(), direction()); }
712
713     ECursor cursor() const { return static_cast<ECursor>(inherited_flags._cursor_style); }
714     CursorList* cursors() const { return rareInheritedData->cursorData.get(); }
715
716     EInsideLink insideLink() const { return static_cast<EInsideLink>(inherited_flags._insideLink); }
717     bool isLink() const { return noninherited_flags.isLink; }
718
719     short widows() const { return rareInheritedData->widows; }
720     short orphans() const { return rareInheritedData->orphans; }
721     bool hasAutoWidows() const { return rareInheritedData->m_hasAutoWidows; }
722     bool hasAutoOrphans() const { return rareInheritedData->m_hasAutoOrphans; }
723     EPageBreak pageBreakInside() const { return static_cast<EPageBreak>(noninherited_flags.pageBreakInside); }
724     EPageBreak pageBreakBefore() const { return static_cast<EPageBreak>(noninherited_flags.pageBreakBefore); }
725     EPageBreak pageBreakAfter() const { return static_cast<EPageBreak>(noninherited_flags.pageBreakAfter); }
726
727     // CSS3 Getter Methods
728
729     int outlineOffset() const
730     {
731         if (m_background->outline().style() == BNONE)
732             return 0;
733         return m_background->outline().offset();
734     }
735
736     ShadowList* textShadow() const { return rareInheritedData->textShadow.get(); }
737     void getTextShadowExtent(LayoutUnit& top, LayoutUnit& right, LayoutUnit& bottom, LayoutUnit& left) const { getShadowExtent(textShadow(), top, right, bottom, left); }
738     void getTextShadowHorizontalExtent(LayoutUnit& left, LayoutUnit& right) const { getShadowHorizontalExtent(textShadow(), left, right); }
739     void getTextShadowVerticalExtent(LayoutUnit& top, LayoutUnit& bottom) const { getShadowVerticalExtent(textShadow(), top, bottom); }
740     void getTextShadowInlineDirectionExtent(LayoutUnit& logicalLeft, LayoutUnit& logicalRight) { getShadowInlineDirectionExtent(textShadow(), logicalLeft, logicalRight); }
741     void getTextShadowBlockDirectionExtent(LayoutUnit& logicalTop, LayoutUnit& logicalBottom) { getShadowBlockDirectionExtent(textShadow(), logicalTop, logicalBottom); }
742
743     float textStrokeWidth() const { return rareInheritedData->textStrokeWidth; }
744     float opacity() const { return rareNonInheritedData->opacity; }
745     bool hasOpacity() const { return opacity() < 1.0f; }
746     ControlPart appearance() const { return static_cast<ControlPart>(rareNonInheritedData->m_appearance); }
747     EBoxAlignment boxAlign() const { return static_cast<EBoxAlignment>(rareNonInheritedData->m_deprecatedFlexibleBox->align); }
748     EBoxDirection boxDirection() const { return static_cast<EBoxDirection>(inherited_flags._box_direction); }
749     float boxFlex() const { return rareNonInheritedData->m_deprecatedFlexibleBox->flex; }
750     unsigned boxFlexGroup() const { return rareNonInheritedData->m_deprecatedFlexibleBox->flexGroup; }
751     EBoxLines boxLines() const { return static_cast<EBoxLines>(rareNonInheritedData->m_deprecatedFlexibleBox->lines); }
752     unsigned boxOrdinalGroup() const { return rareNonInheritedData->m_deprecatedFlexibleBox->ordinalGroup; }
753     EBoxOrient boxOrient() const { return static_cast<EBoxOrient>(rareNonInheritedData->m_deprecatedFlexibleBox->orient); }
754     EBoxPack boxPack() const { return static_cast<EBoxPack>(rareNonInheritedData->m_deprecatedFlexibleBox->pack); }
755
756     int order() const { return rareNonInheritedData->m_order; }
757     const Vector<String>& callbackSelectors() const { return rareNonInheritedData->m_callbackSelectors; }
758     float flexGrow() const { return rareNonInheritedData->m_flexibleBox->m_flexGrow; }
759     float flexShrink() const { return rareNonInheritedData->m_flexibleBox->m_flexShrink; }
760     const Length& flexBasis() const { return rareNonInheritedData->m_flexibleBox->m_flexBasis; }
761     EAlignContent alignContent() const { return static_cast<EAlignContent>(rareNonInheritedData->m_alignContent); }
762     ItemPosition alignItems() const { return static_cast<ItemPosition>(rareNonInheritedData->m_alignItems); }
763     OverflowAlignment alignItemsOverflowAlignment() const { return static_cast<OverflowAlignment>(rareNonInheritedData->m_alignItemsOverflowAlignment); }
764     ItemPosition alignSelf() const { return static_cast<ItemPosition>(rareNonInheritedData->m_alignSelf); }
765     OverflowAlignment alignSelfOverflowAlignment() const { return static_cast<OverflowAlignment>(rareNonInheritedData->m_alignSelfOverflowAlignment); }
766     EFlexDirection flexDirection() const { return static_cast<EFlexDirection>(rareNonInheritedData->m_flexibleBox->m_flexDirection); }
767     bool isColumnFlexDirection() const { return flexDirection() == FlowColumn || flexDirection() == FlowColumnReverse; }
768     bool isReverseFlexDirection() const { return flexDirection() == FlowRowReverse || flexDirection() == FlowColumnReverse; }
769     EFlexWrap flexWrap() const { return static_cast<EFlexWrap>(rareNonInheritedData->m_flexibleBox->m_flexWrap); }
770     ContentPosition justifyContent() const { return static_cast<ContentPosition>(rareNonInheritedData->m_justifyContent); }
771     ContentDistributionType justifyContentDistribution() const { return static_cast<ContentDistributionType>(rareNonInheritedData->m_justifyContentDistribution); }
772     OverflowAlignment justifyContentOverflowAlignment() const { return static_cast<OverflowAlignment>(rareNonInheritedData->m_justifyContentOverflowAlignment); }
773     ItemPosition justifyItems() const { return static_cast<ItemPosition>(rareNonInheritedData->m_justifyItems); }
774     OverflowAlignment justifyItemsOverflowAlignment() const { return static_cast<OverflowAlignment>(rareNonInheritedData->m_justifyItemsOverflowAlignment); }
775     ItemPositionType justifyItemsPositionType() const { return static_cast<ItemPositionType>(rareNonInheritedData->m_justifyItemsPositionType); }
776     ItemPosition justifySelf() const { return static_cast<ItemPosition>(rareNonInheritedData->m_justifySelf); }
777     OverflowAlignment justifySelfOverflowAlignment() const { return static_cast<OverflowAlignment>(rareNonInheritedData->m_justifySelfOverflowAlignment); }
778
779     const Vector<GridTrackSize>& gridTemplateColumns() const { return rareNonInheritedData->m_grid->m_gridTemplateColumns; }
780     const Vector<GridTrackSize>& gridTemplateRows() const { return rareNonInheritedData->m_grid->m_gridTemplateRows; }
781     const NamedGridLinesMap& namedGridColumnLines() const { return rareNonInheritedData->m_grid->m_namedGridColumnLines; }
782     const NamedGridLinesMap& namedGridRowLines() const { return rareNonInheritedData->m_grid->m_namedGridRowLines; }
783     const OrderedNamedGridLines& orderedNamedGridColumnLines() const { return rareNonInheritedData->m_grid->m_orderedNamedGridColumnLines; }
784     const OrderedNamedGridLines& orderedNamedGridRowLines() const { return rareNonInheritedData->m_grid->m_orderedNamedGridRowLines; }
785     const NamedGridAreaMap& namedGridArea() const { return rareNonInheritedData->m_grid->m_namedGridArea; }
786     size_t namedGridAreaRowCount() const { return rareNonInheritedData->m_grid->m_namedGridAreaRowCount; }
787     size_t namedGridAreaColumnCount() const { return rareNonInheritedData->m_grid->m_namedGridAreaColumnCount; }
788     GridAutoFlow gridAutoFlow() const { return static_cast<GridAutoFlow>(rareNonInheritedData->m_grid->m_gridAutoFlow); }
789     bool isGridAutoFlowDirectionRow() const { return (rareNonInheritedData->m_grid->m_gridAutoFlow & InternalAutoFlowDirectionRow) == InternalAutoFlowDirectionRow; }
790     bool isGridAutoFlowDirectionColumn() const { return (rareNonInheritedData->m_grid->m_gridAutoFlow & InternalAutoFlowDirectionColumn) == InternalAutoFlowDirectionColumn; }
791     bool isGridAutoFlowAlgorithmSparse() const { return (rareNonInheritedData->m_grid->m_gridAutoFlow & InternalAutoFlowAlgorithmSparse) == InternalAutoFlowAlgorithmSparse; }
792     bool isGridAutoFlowAlgorithmDense() const { return (rareNonInheritedData->m_grid->m_gridAutoFlow & InternalAutoFlowAlgorithmDense) == InternalAutoFlowAlgorithmDense; }
793     bool isGridAutoFlowAlgorithmStack() const { return (rareNonInheritedData->m_grid->m_gridAutoFlow & InternalAutoFlowAlgorithmStack) == InternalAutoFlowAlgorithmStack; }
794     const GridTrackSize& gridAutoColumns() const { return rareNonInheritedData->m_grid->m_gridAutoColumns; }
795     const GridTrackSize& gridAutoRows() const { return rareNonInheritedData->m_grid->m_gridAutoRows; }
796
797     const GridPosition& gridColumnStart() const { return rareNonInheritedData->m_gridItem->m_gridColumnStart; }
798     const GridPosition& gridColumnEnd() const { return rareNonInheritedData->m_gridItem->m_gridColumnEnd; }
799     const GridPosition& gridRowStart() const { return rareNonInheritedData->m_gridItem->m_gridRowStart; }
800     const GridPosition& gridRowEnd() const { return rareNonInheritedData->m_gridItem->m_gridRowEnd; }
801
802     ShadowList* boxShadow() const { return rareNonInheritedData->m_boxShadow.get(); }
803     void getBoxShadowExtent(LayoutUnit& top, LayoutUnit& right, LayoutUnit& bottom, LayoutUnit& left) const { getShadowExtent(boxShadow(), top, right, bottom, left); }
804     LayoutBoxExtent getBoxShadowInsetExtent() const { return getShadowInsetExtent(boxShadow()); }
805     void getBoxShadowHorizontalExtent(LayoutUnit& left, LayoutUnit& right) const { getShadowHorizontalExtent(boxShadow(), left, right); }
806     void getBoxShadowVerticalExtent(LayoutUnit& top, LayoutUnit& bottom) const { getShadowVerticalExtent(boxShadow(), top, bottom); }
807     void getBoxShadowInlineDirectionExtent(LayoutUnit& logicalLeft, LayoutUnit& logicalRight) { getShadowInlineDirectionExtent(boxShadow(), logicalLeft, logicalRight); }
808     void getBoxShadowBlockDirectionExtent(LayoutUnit& logicalTop, LayoutUnit& logicalBottom) { getShadowBlockDirectionExtent(boxShadow(), logicalTop, logicalBottom); }
809
810     EBoxDecorationBreak boxDecorationBreak() const { return m_box->boxDecorationBreak(); }
811     StyleReflection* boxReflect() const { return rareNonInheritedData->m_boxReflect.get(); }
812     bool reflectionDataEquivalent(const RenderStyle* otherStyle) const { return rareNonInheritedData->reflectionDataEquivalent(*otherStyle->rareNonInheritedData); }
813
814     // FIXME: reflections should belong to this helper function but they are currently handled
815     // through their self-painting layers. So the rendering code doesn't account for them.
816     bool hasVisualOverflowingEffect() const { return boxShadow() || hasBorderImageOutsets() || hasOutline(); }
817
818     EBoxSizing boxSizing() const { return m_box->boxSizing(); }
819     EUserModify userModify() const { return static_cast<EUserModify>(rareInheritedData->userModify); }
820     EUserDrag userDrag() const { return static_cast<EUserDrag>(rareNonInheritedData->userDrag); }
821     EUserSelect userSelect() const { return static_cast<EUserSelect>(rareInheritedData->userSelect); }
822     TextOverflow textOverflow() const { return static_cast<TextOverflow>(rareNonInheritedData->textOverflow); }
823     EMarginCollapse marginBeforeCollapse() const { return static_cast<EMarginCollapse>(rareNonInheritedData->marginBeforeCollapse); }
824     EMarginCollapse marginAfterCollapse() const { return static_cast<EMarginCollapse>(rareNonInheritedData->marginAfterCollapse); }
825     EWordBreak wordBreak() const { return static_cast<EWordBreak>(rareInheritedData->wordBreak); }
826     EOverflowWrap overflowWrap() const { return static_cast<EOverflowWrap>(rareInheritedData->overflowWrap); }
827     LineBreak lineBreak() const { return static_cast<LineBreak>(rareInheritedData->lineBreak); }
828     const AtomicString& highlight() const { return rareInheritedData->highlight; }
829     const AtomicString& hyphenationString() const { return rareInheritedData->hyphenationString; }
830     const AtomicString& locale() const { return rareInheritedData->locale; }
831     EResize resize() const { return static_cast<EResize>(rareNonInheritedData->m_resize); }
832     bool hasInlinePaginationAxis() const
833     {
834         // If the pagination axis is parallel with the writing mode inline axis, columns may be laid
835         // out along the inline axis, just like for regular multicol. Otherwise, we need to lay out
836         // along the block axis.
837         if (isOverflowPaged())
838             return (overflowY() == OPAGEDX) == isHorizontalWritingMode();
839         return false;
840     }
841     float columnWidth() const { return rareNonInheritedData->m_multiCol->m_width; }
842     bool hasAutoColumnWidth() const { return rareNonInheritedData->m_multiCol->m_autoWidth; }
843     unsigned short columnCount() const { return rareNonInheritedData->m_multiCol->m_count; }
844     bool hasAutoColumnCount() const { return rareNonInheritedData->m_multiCol->m_autoCount; }
845     bool specifiesColumns() const { return !hasAutoColumnCount() || !hasAutoColumnWidth(); }
846     ColumnFill columnFill() const { return static_cast<ColumnFill>(rareNonInheritedData->m_multiCol->m_fill); }
847     float columnGap() const { return rareNonInheritedData->m_multiCol->m_gap; }
848     bool hasNormalColumnGap() const { return rareNonInheritedData->m_multiCol->m_normalGap; }
849     EBorderStyle columnRuleStyle() const { return rareNonInheritedData->m_multiCol->m_rule.style(); }
850     unsigned short columnRuleWidth() const { return rareNonInheritedData->m_multiCol->ruleWidth(); }
851     bool columnRuleIsTransparent() const { return rareNonInheritedData->m_multiCol->m_rule.isTransparent(); }
852     ColumnSpan columnSpan() const { return static_cast<ColumnSpan>(rareNonInheritedData->m_multiCol->m_columnSpan); }
853     EPageBreak columnBreakBefore() const { return static_cast<EPageBreak>(rareNonInheritedData->m_multiCol->m_breakBefore); }
854     EPageBreak columnBreakInside() const { return static_cast<EPageBreak>(rareNonInheritedData->m_multiCol->m_breakInside); }
855     EPageBreak columnBreakAfter() const { return static_cast<EPageBreak>(rareNonInheritedData->m_multiCol->m_breakAfter); }
856     bool hasInlineTransform() const { return rareNonInheritedData->m_hasInlineTransform; }
857     const TransformOperations& transform() const { return rareNonInheritedData->m_transform->m_operations; }
858     const TransformOrigin& transformOrigin() const { return rareNonInheritedData->m_transform->m_origin; }
859     const Length& transformOriginX() const { return transformOrigin().x(); }
860     const Length& transformOriginY() const { return transformOrigin().y(); }
861     float transformOriginZ() const { return transformOrigin().z(); }
862     bool hasTransform() const { return !rareNonInheritedData->m_transform->m_operations.operations().isEmpty(); }
863     bool transformDataEquivalent(const RenderStyle& otherStyle) const { return rareNonInheritedData->m_transform == otherStyle.rareNonInheritedData->m_transform; }
864
865     TextEmphasisFill textEmphasisFill() const { return static_cast<TextEmphasisFill>(rareInheritedData->textEmphasisFill); }
866     TextEmphasisMark textEmphasisMark() const;
867     const AtomicString& textEmphasisCustomMark() const { return rareInheritedData->textEmphasisCustomMark; }
868     TextEmphasisPosition textEmphasisPosition() const { return static_cast<TextEmphasisPosition>(rareInheritedData->textEmphasisPosition); }
869     const AtomicString& textEmphasisMarkString() const;
870
871     RubyPosition rubyPosition() const { return static_cast<RubyPosition>(rareInheritedData->m_rubyPosition); }
872
873     TextOrientation textOrientation() const { return static_cast<TextOrientation>(rareInheritedData->m_textOrientation); }
874
875     ObjectFit objectFit() const { return static_cast<ObjectFit>(rareNonInheritedData->m_objectFit); }
876     LengthPoint objectPosition() const { return rareNonInheritedData->m_objectPosition; }
877
878     // Return true if any transform related property (currently transform, transformStyle3D or perspective)
879     // indicates that we are transforming
880     bool hasTransformRelatedProperty() const { return hasTransform() || preserves3D() || hasPerspective(); }
881
882     enum ApplyTransformOrigin { IncludeTransformOrigin, ExcludeTransformOrigin };
883     void applyTransform(TransformationMatrix&, const LayoutSize& borderBoxSize, ApplyTransformOrigin = IncludeTransformOrigin) const;
884     void applyTransform(TransformationMatrix&, const FloatRect& boundingBox, ApplyTransformOrigin = IncludeTransformOrigin) const;
885
886     bool hasMask() const { return rareNonInheritedData->m_mask.hasImage() || rareNonInheritedData->m_maskBoxImage.hasImage(); }
887
888     TextCombine textCombine() const { return static_cast<TextCombine>(rareNonInheritedData->m_textCombine); }
889     bool hasTextCombine() const { return textCombine() != TextCombineNone; }
890
891     unsigned tabSize() const { return rareInheritedData->m_tabSize; }
892
893     // End CSS3 Getters
894
895     WrapFlow wrapFlow() const { return static_cast<WrapFlow>(rareNonInheritedData->m_wrapFlow); }
896     WrapThrough wrapThrough() const { return static_cast<WrapThrough>(rareNonInheritedData->m_wrapThrough); }
897
898     // Apple-specific property getter methods
899     EPointerEvents pointerEvents() const { return static_cast<EPointerEvents>(inherited_flags._pointerEvents); }
900     const CSSAnimationData* animations() const { return rareNonInheritedData->m_animations.get(); }
901     const CSSTransitionData* transitions() const { return rareNonInheritedData->m_transitions.get(); }
902
903     CSSAnimationData& accessAnimations();
904     CSSTransitionData& accessTransitions();
905
906     ETransformStyle3D transformStyle3D() const { return static_cast<ETransformStyle3D>(rareNonInheritedData->m_transformStyle3D); }
907     bool preserves3D() const { return rareNonInheritedData->m_transformStyle3D == TransformStyle3DPreserve3D; }
908
909     EBackfaceVisibility backfaceVisibility() const { return static_cast<EBackfaceVisibility>(rareNonInheritedData->m_backfaceVisibility); }
910     float perspective() const { return rareNonInheritedData->m_perspective; }
911     bool hasPerspective() const { return rareNonInheritedData->m_perspective > 0; }
912     const LengthPoint& perspectiveOrigin() const { return rareNonInheritedData->m_perspectiveOrigin; }
913     const Length& perspectiveOriginX() const { return perspectiveOrigin().x(); }
914     const Length& perspectiveOriginY() const { return perspectiveOrigin().y(); }
915     const LengthSize& pageSize() const { return rareNonInheritedData->m_pageSize; }
916     PageSizeType pageSizeType() const { return static_cast<PageSizeType>(rareNonInheritedData->m_pageSizeType); }
917
918     bool hasCurrentOpacityAnimation() const { return rareNonInheritedData->m_hasCurrentOpacityAnimation; }
919     bool hasCurrentTransformAnimation() const { return rareNonInheritedData->m_hasCurrentTransformAnimation; }
920     bool hasCurrentFilterAnimation() const { return rareNonInheritedData->m_hasCurrentFilterAnimation; }
921     bool shouldCompositeForCurrentAnimations() { return hasCurrentOpacityAnimation() || hasCurrentTransformAnimation() || hasCurrentFilterAnimation(); }
922
923     bool isRunningOpacityAnimationOnCompositor() const { return rareNonInheritedData->m_runningOpacityAnimationOnCompositor; }
924     bool isRunningTransformAnimationOnCompositor() const { return rareNonInheritedData->m_runningTransformAnimationOnCompositor; }
925     bool isRunningFilterAnimationOnCompositor() const { return rareNonInheritedData->m_runningFilterAnimationOnCompositor; }
926     bool isRunningAnimationOnCompositor() { return isRunningOpacityAnimationOnCompositor() || isRunningTransformAnimationOnCompositor() || isRunningFilterAnimationOnCompositor(); }
927
928     LineBoxContain lineBoxContain() const { return rareInheritedData->m_lineBoxContain; }
929     const LineClampValue& lineClamp() const { return rareNonInheritedData->lineClamp; }
930     Color tapHighlightColor() const { return rareInheritedData->tapHighlightColor; }
931     ETextSecurity textSecurity() const { return static_cast<ETextSecurity>(rareInheritedData->textSecurity); }
932
933     WritingMode writingMode() const { return static_cast<WritingMode>(inherited_flags.m_writingMode); }
934     bool isHorizontalWritingMode() const { return blink::isHorizontalWritingMode(writingMode()); }
935     bool isFlippedLinesWritingMode() const { return blink::isFlippedLinesWritingMode(writingMode()); }
936     bool slowIsFlippedBlocksWritingMode() const { return blink::isFlippedBlocksWritingMode(writingMode()); }
937
938     EImageRendering imageRendering() const { return static_cast<EImageRendering>(rareInheritedData->m_imageRendering); }
939
940     ESpeak speak() const { return static_cast<ESpeak>(rareInheritedData->speak); }
941
942     FilterOperations& mutableFilter() { return rareNonInheritedData.access()->m_filter.access()->m_operations; }
943     const FilterOperations& filter() const { return rareNonInheritedData->m_filter->m_operations; }
944     bool hasFilter() const { return !rareNonInheritedData->m_filter->m_operations.operations().isEmpty(); }
945
946     WebBlendMode blendMode() const;
947     void setBlendMode(WebBlendMode v);
948     bool hasBlendMode() const;
949
950     EIsolation isolation() const;
951     void setIsolation(EIsolation v);
952     bool hasIsolation() const;
953
954     bool shouldPlaceBlockDirectionScrollbarOnLogicalLeft() const { return !isLeftToRightDirection() && isHorizontalWritingMode(); }
955
956     TouchAction touchAction() const { return static_cast<TouchAction>(rareNonInheritedData->m_touchAction); }
957     TouchActionDelay touchActionDelay() const { return static_cast<TouchActionDelay>(rareInheritedData->m_touchActionDelay); }
958
959     ScrollBehavior scrollBehavior() const { return static_cast<ScrollBehavior>(rareNonInheritedData->m_scrollBehavior); }
960
961     const Vector<CSSPropertyID>& willChangeProperties() const { return rareNonInheritedData->m_willChange->m_properties; }
962     bool willChangeContents() const { return rareNonInheritedData->m_willChange->m_contents; }
963     bool willChangeScrollPosition() const { return rareNonInheritedData->m_willChange->m_scrollPosition; }
964     bool hasWillChangeCompositingHint() const;
965     bool subtreeWillChangeContents() const { return rareInheritedData->m_subtreeWillChangeContents; }
966
967 // attribute setter methods
968
969     void setDisplay(EDisplay v) { noninherited_flags.effectiveDisplay = v; }
970     void setOriginalDisplay(EDisplay v) { noninherited_flags.originalDisplay = v; }
971     void setPosition(EPosition v) { noninherited_flags.position = v; }
972     void setFloating(EFloat v) { noninherited_flags.floating = v; }
973
974     void setLeft(const Length& v) { SET_VAR(surround, offset.m_left, v); }
975     void setRight(const Length& v) { SET_VAR(surround, offset.m_right, v); }
976     void setTop(const Length& v) { SET_VAR(surround, offset.m_top, v); }
977     void setBottom(const Length& v) { SET_VAR(surround, offset.m_bottom, v); }
978
979     void setWidth(const Length& v) { SET_VAR(m_box, m_width, v); }
980     void setHeight(const Length& v) { SET_VAR(m_box, m_height, v); }
981
982     void setLogicalWidth(const Length& v)
983     {
984         if (isHorizontalWritingMode()) {
985             SET_VAR(m_box, m_width, v);
986         } else {
987             SET_VAR(m_box, m_height, v);
988         }
989     }
990
991     void setLogicalHeight(const Length& v)
992     {
993         if (isHorizontalWritingMode()) {
994             SET_VAR(m_box, m_height, v);
995         } else {
996             SET_VAR(m_box, m_width, v);
997         }
998     }
999
1000     void setMinWidth(const Length& v) { SET_VAR(m_box, m_minWidth, v); }
1001     void setMaxWidth(const Length& v) { SET_VAR(m_box, m_maxWidth, v); }
1002     void setMinHeight(const Length& v) { SET_VAR(m_box, m_minHeight, v); }
1003     void setMaxHeight(const Length& v) { SET_VAR(m_box, m_maxHeight, v); }
1004
1005     DraggableRegionMode getDraggableRegionMode() const { return rareNonInheritedData->m_draggableRegionMode; }
1006     void setDraggableRegionMode(DraggableRegionMode v) { SET_VAR(rareNonInheritedData, m_draggableRegionMode, v); }
1007
1008     void resetBorder()
1009     {
1010         resetBorderImage();
1011         resetBorderTop();
1012         resetBorderRight();
1013         resetBorderBottom();
1014         resetBorderLeft();
1015         resetBorderTopLeftRadius();
1016         resetBorderTopRightRadius();
1017         resetBorderBottomLeftRadius();
1018         resetBorderBottomRightRadius();
1019     }
1020     void resetBorderTop() { SET_VAR(surround, border.m_top, BorderValue()); }
1021     void resetBorderRight() { SET_VAR(surround, border.m_right, BorderValue()); }
1022     void resetBorderBottom() { SET_VAR(surround, border.m_bottom, BorderValue()); }
1023     void resetBorderLeft() { SET_VAR(surround, border.m_left, BorderValue()); }
1024     void resetBorderImage() { SET_VAR(surround, border.m_image, NinePieceImage()); }
1025     void resetBorderTopLeftRadius() { SET_VAR(surround, border.m_topLeft, initialBorderRadius()); }
1026     void resetBorderTopRightRadius() { SET_VAR(surround, border.m_topRight, initialBorderRadius()); }
1027     void resetBorderBottomLeftRadius() { SET_VAR(surround, border.m_bottomLeft, initialBorderRadius()); }
1028     void resetBorderBottomRightRadius() { SET_VAR(surround, border.m_bottomRight, initialBorderRadius()); }
1029
1030     void setBackgroundColor(const StyleColor& v) { SET_VAR(m_background, m_color, v); }
1031
1032     void setBackgroundXPosition(const Length& length) { SET_VAR(m_background, m_background.m_xPosition, length); }
1033     void setBackgroundYPosition(const Length& length) { SET_VAR(m_background, m_background.m_yPosition, length); }
1034     void setBackgroundSize(EFillSizeType b) { SET_VAR(m_background, m_background.m_sizeType, b); }
1035     void setBackgroundSizeLength(const LengthSize& s) { SET_VAR(m_background, m_background.m_sizeLength, s); }
1036
1037     void setBorderImage(const NinePieceImage& b) { SET_VAR(surround, border.m_image, b); }
1038     void setBorderImageSource(PassRefPtr<StyleImage>);
1039     void setBorderImageSlices(const LengthBox&);
1040     void setBorderImageWidth(const BorderImageLengthBox&);
1041     void setBorderImageOutset(const BorderImageLengthBox&);
1042
1043     void setBorderTopLeftRadius(const LengthSize& s) { SET_VAR(surround, border.m_topLeft, s); }
1044     void setBorderTopRightRadius(const LengthSize& s) { SET_VAR(surround, border.m_topRight, s); }
1045     void setBorderBottomLeftRadius(const LengthSize& s) { SET_VAR(surround, border.m_bottomLeft, s); }
1046     void setBorderBottomRightRadius(const LengthSize& s) { SET_VAR(surround, border.m_bottomRight, s); }
1047
1048     void setBorderRadius(const LengthSize& s)
1049     {
1050         setBorderTopLeftRadius(s);
1051         setBorderTopRightRadius(s);
1052         setBorderBottomLeftRadius(s);
1053         setBorderBottomRightRadius(s);
1054     }
1055     void setBorderRadius(const IntSize& s)
1056     {
1057         setBorderRadius(LengthSize(Length(s.width(), Fixed), Length(s.height(), Fixed)));
1058     }
1059
1060     RoundedRect getRoundedBorderFor(const LayoutRect& borderRect, bool includeLogicalLeftEdge = true, bool includeLogicalRightEdge = true) const;
1061     RoundedRect getRoundedInnerBorderFor(const LayoutRect& borderRect, bool includeLogicalLeftEdge = true, bool includeLogicalRightEdge = true) const;
1062
1063     RoundedRect getRoundedInnerBorderFor(const LayoutRect& borderRect,
1064         int topWidth, int bottomWidth, int leftWidth, int rightWidth, bool includeLogicalLeftEdge, bool includeLogicalRightEdge) const;
1065
1066     void setBorderLeftWidth(unsigned v) { SET_VAR(surround, border.m_left.m_width, v); }
1067     void setBorderLeftStyle(EBorderStyle v) { SET_VAR(surround, border.m_left.m_style, v); }
1068     void setBorderLeftColor(const StyleColor& v) { SET_BORDERVALUE_COLOR(surround, border.m_left, v); }
1069     void setBorderRightWidth(unsigned v) { SET_VAR(surround, border.m_right.m_width, v); }
1070     void setBorderRightStyle(EBorderStyle v) { SET_VAR(surround, border.m_right.m_style, v); }
1071     void setBorderRightColor(const StyleColor& v) { SET_BORDERVALUE_COLOR(surround, border.m_right, v); }
1072     void setBorderTopWidth(unsigned v) { SET_VAR(surround, border.m_top.m_width, v); }
1073     void setBorderTopStyle(EBorderStyle v) { SET_VAR(surround, border.m_top.m_style, v); }
1074     void setBorderTopColor(const StyleColor& v) { SET_BORDERVALUE_COLOR(surround, border.m_top, v); }
1075     void setBorderBottomWidth(unsigned v) { SET_VAR(surround, border.m_bottom.m_width, v); }
1076     void setBorderBottomStyle(EBorderStyle v) { SET_VAR(surround, border.m_bottom.m_style, v); }
1077     void setBorderBottomColor(const StyleColor& v) { SET_BORDERVALUE_COLOR(surround, border.m_bottom, v); }
1078
1079     void setOutlineWidth(unsigned short v) { SET_VAR(m_background, m_outline.m_width, v); }
1080     void setOutlineStyleIsAuto(OutlineIsAuto isAuto) { SET_VAR(m_background, m_outline.m_isAuto, isAuto); }
1081     void setOutlineStyle(EBorderStyle v) { SET_VAR(m_background, m_outline.m_style, v); }
1082     void setOutlineColor(const StyleColor& v) { SET_BORDERVALUE_COLOR(m_background, m_outline, v); }
1083     bool isOutlineEquivalent(const RenderStyle* otherStyle) const
1084     {
1085         // No other style, so we don't have an outline then we consider them to be the same.
1086         if (!otherStyle)
1087             return !hasOutline();
1088         return m_background->outline().visuallyEqual(otherStyle->m_background->outline());
1089     }
1090     void setOutlineFromStyle(const RenderStyle& o)
1091     {
1092         ASSERT(!isOutlineEquivalent(&o));
1093         m_background.access()->m_outline = o.m_background->m_outline;
1094     }
1095
1096     void setOverflowX(EOverflow v) { noninherited_flags.overflowX = v; }
1097     void setOverflowY(EOverflow v) { noninherited_flags.overflowY = v; }
1098     void setVisibility(EVisibility v) { inherited_flags._visibility = v; }
1099     void setVerticalAlign(EVerticalAlign v) { noninherited_flags.verticalAlign = v; }
1100     void setVerticalAlignLength(const Length& length) { setVerticalAlign(LENGTH); SET_VAR(m_box, m_verticalAlign, length); }
1101
1102     void setHasAutoClip() { SET_VAR(visual, hasAutoClip, true); SET_VAR(visual, clip, RenderStyle::initialClip()); }
1103     void setClip(const LengthBox& box) { SET_VAR(visual, hasAutoClip, false); SET_VAR(visual, clip, box); }
1104
1105     void setUnicodeBidi(EUnicodeBidi b) { noninherited_flags.unicodeBidi = b; }
1106
1107     void setClear(EClear v) { noninherited_flags.clear = v; }
1108     void setTableLayout(ETableLayout v) { noninherited_flags.tableLayout = v; }
1109
1110     bool setFontDescription(const FontDescription&);
1111     // Only used for blending font sizes when animating and for text autosizing.
1112     void setFontSize(float);
1113     void setFontStretch(FontStretch);
1114     void setFontWeight(FontWeight);
1115
1116     void setTextAutosizingMultiplier(float v)
1117     {
1118         SET_VAR(inherited, textAutosizingMultiplier, v);
1119         setFontSize(fontDescription().specifiedSize());
1120     }
1121
1122     void setColor(const Color&);
1123     void setTextIndent(const Length& v) { SET_VAR(rareInheritedData, indent, v); }
1124     void setTextIndentLine(TextIndentLine v) { SET_VAR(rareInheritedData, m_textIndentLine, v); }
1125     void setTextIndentType(TextIndentType v) { SET_VAR(rareInheritedData, m_textIndentType, v); }
1126     void setTextAlign(ETextAlign v) { inherited_flags._text_align = v; }
1127     void setTextAlignLast(TextAlignLast v) { SET_VAR(rareInheritedData, m_textAlignLast, v); }
1128     void setTextJustify(TextJustify v) { SET_VAR(rareInheritedData, m_textJustify, v); }
1129     void setTextTransform(ETextTransform v) { inherited_flags._text_transform = v; }
1130     void applyTextDecorations();
1131     void clearAppliedTextDecorations();
1132     void setTextDecoration(TextDecoration v) { SET_VAR(visual, textDecoration, v); }
1133     void setTextUnderlinePosition(TextUnderlinePosition v) { SET_VAR(rareInheritedData, m_textUnderlinePosition, v); }
1134     void setTextDecorationStyle(TextDecorationStyle v) { SET_VAR(rareNonInheritedData, m_textDecorationStyle, v); }
1135     void setDirection(TextDirection v) { inherited_flags._direction = v; }
1136     void setLineHeight(const Length& specifiedLineHeight);
1137     bool setZoom(float);
1138     bool setEffectiveZoom(float);
1139
1140     void setImageRendering(EImageRendering v) { SET_VAR(rareInheritedData, m_imageRendering, v); }
1141
1142     void setWhiteSpace(EWhiteSpace v) { inherited_flags._white_space = v; }
1143
1144     // FIXME: Remove these two and replace them with respective FontBuilder calls.
1145     void setWordSpacing(float);
1146     void setLetterSpacing(float);
1147
1148     void adjustBackgroundLayers()
1149     {
1150         if (backgroundLayers().next()) {
1151             accessBackgroundLayers().cullEmptyLayers();
1152             accessBackgroundLayers().fillUnsetProperties();
1153         }
1154     }
1155
1156     void adjustMaskLayers()
1157     {
1158         if (maskLayers().next()) {
1159             accessMaskLayers().cullEmptyLayers();
1160             accessMaskLayers().fillUnsetProperties();
1161         }
1162     }
1163
1164     void setMaskImage(PassRefPtr<StyleImage> v) { rareNonInheritedData.access()->m_mask.setImage(v); }
1165
1166     void setMaskBoxImage(const NinePieceImage& b) { SET_VAR(rareNonInheritedData, m_maskBoxImage, b); }
1167     void setMaskBoxImageSource(PassRefPtr<StyleImage> v) { rareNonInheritedData.access()->m_maskBoxImage.setImage(v); }
1168     void setMaskBoxImageSlices(const LengthBox& slices)
1169     {
1170         rareNonInheritedData.access()->m_maskBoxImage.setImageSlices(slices);
1171     }
1172     void setMaskBoxImageSlicesFill(bool fill)
1173     {
1174         rareNonInheritedData.access()->m_maskBoxImage.setFill(fill);
1175     }
1176     void setMaskBoxImageWidth(const BorderImageLengthBox& slices)
1177     {
1178         rareNonInheritedData.access()->m_maskBoxImage.setBorderSlices(slices);
1179     }
1180     void setMaskBoxImageOutset(const BorderImageLengthBox& outset)
1181     {
1182         rareNonInheritedData.access()->m_maskBoxImage.setOutset(outset);
1183     }
1184     void setMaskXPosition(const Length& length) { SET_VAR(rareNonInheritedData, m_mask.m_xPosition, length); }
1185     void setMaskYPosition(const Length& length) { SET_VAR(rareNonInheritedData, m_mask.m_yPosition, length); }
1186     void setMaskSize(const LengthSize& s) { SET_VAR(rareNonInheritedData, m_mask.m_sizeLength, s); }
1187
1188     void setBorderCollapse(EBorderCollapse collapse) { inherited_flags._border_collapse = collapse; }
1189     void setHorizontalBorderSpacing(short);
1190     void setVerticalBorderSpacing(short);
1191     void setEmptyCells(EEmptyCell v) { inherited_flags._empty_cells = v; }
1192     void setCaptionSide(ECaptionSide v) { inherited_flags._caption_side = v; }
1193
1194     void setListStyleType(EListStyleType v) { inherited_flags._list_style_type = v; }
1195     void setListStyleImage(PassRefPtr<StyleImage>);
1196     void setListStylePosition(EListStylePosition v) { inherited_flags._list_style_position = v; }
1197
1198     void setMarginTop(const Length& v) { SET_VAR(surround, margin.m_top, v); }
1199     void setMarginBottom(const Length& v) { SET_VAR(surround, margin.m_bottom, v); }
1200     void setMarginLeft(const Length& v) { SET_VAR(surround, margin.m_left, v); }
1201     void setMarginRight(const Length& v) { SET_VAR(surround, margin.m_right, v); }
1202     void setMarginStart(const Length&);
1203     void setMarginEnd(const Length&);
1204
1205     void resetPadding() { SET_VAR(surround, padding, LengthBox(Auto)); }
1206     void setPaddingBox(const LengthBox& b) { SET_VAR(surround, padding, b); }
1207     void setPaddingTop(const Length& v) { SET_VAR(surround, padding.m_top, v); }
1208     void setPaddingBottom(const Length& v) { SET_VAR(surround, padding.m_bottom, v); }
1209     void setPaddingLeft(const Length& v) { SET_VAR(surround, padding.m_left, v); }
1210     void setPaddingRight(const Length& v) { SET_VAR(surround, padding.m_right, v); }
1211
1212     void setCursor(ECursor c) { inherited_flags._cursor_style = c; }
1213     void addCursor(PassRefPtr<StyleImage>, const IntPoint& hotSpot = IntPoint());
1214     void setCursorList(PassRefPtr<CursorList>);
1215     void clearCursorList();
1216
1217     void setInsideLink(EInsideLink insideLink) { inherited_flags._insideLink = insideLink; }
1218     void setIsLink(bool b) { noninherited_flags.isLink = b; }
1219
1220     PrintColorAdjust printColorAdjust() const { return static_cast<PrintColorAdjust>(inherited_flags.m_printColorAdjust); }
1221     void setPrintColorAdjust(PrintColorAdjust value) { inherited_flags.m_printColorAdjust = value; }
1222
1223     bool hasAutoZIndex() const { return m_box->hasAutoZIndex(); }
1224     void setHasAutoZIndex() { SET_VAR(m_box, m_hasAutoZIndex, true); SET_VAR(m_box, m_zIndex, 0); }
1225     int zIndex() const { return m_box->zIndex(); }
1226     void setZIndex(int v) { SET_VAR(m_box, m_hasAutoZIndex, false); SET_VAR(m_box, m_zIndex, v); }
1227
1228     void setHasAutoWidows() { SET_VAR(rareInheritedData, m_hasAutoWidows, true); SET_VAR(rareInheritedData, widows, initialWidows()); }
1229     void setWidows(short w) { SET_VAR(rareInheritedData, m_hasAutoWidows, false); SET_VAR(rareInheritedData, widows, w); }
1230
1231     void setHasAutoOrphans() { SET_VAR(rareInheritedData, m_hasAutoOrphans, true); SET_VAR(rareInheritedData, orphans, initialOrphans()); }
1232     void setOrphans(short o) { SET_VAR(rareInheritedData, m_hasAutoOrphans, false); SET_VAR(rareInheritedData, orphans, o); }
1233
1234     // For valid values of page-break-inside see http://www.w3.org/TR/CSS21/page.html#page-break-props
1235     void setPageBreakInside(EPageBreak b) { ASSERT(b == PBAUTO || b == PBAVOID); noninherited_flags.pageBreakInside = b; }
1236     void setPageBreakBefore(EPageBreak b) { noninherited_flags.pageBreakBefore = b; }
1237     void setPageBreakAfter(EPageBreak b) { noninherited_flags.pageBreakAfter = b; }
1238
1239     // CSS3 Setters
1240     void setOutlineOffset(int v) { SET_VAR(m_background, m_outline.m_offset, v); }
1241     void setTextShadow(PassRefPtr<ShadowList>);
1242     void setTextStrokeColor(const StyleColor& c) { SET_VAR_WITH_SETTER(rareInheritedData, textStrokeColor, setTextStrokeColor, c); }
1243     void setTextStrokeWidth(float w) { SET_VAR(rareInheritedData, textStrokeWidth, w); }
1244     void setTextFillColor(const StyleColor& c) { SET_VAR_WITH_SETTER(rareInheritedData, textFillColor, setTextFillColor, c); }
1245     void setOpacity(float f) { float v = clampTo<float>(f, 0, 1); SET_VAR(rareNonInheritedData, opacity, v); }
1246     void setAppearance(ControlPart a) { SET_VAR(rareNonInheritedData, m_appearance, a); }
1247     // For valid values of box-align see http://www.w3.org/TR/2009/WD-css3-flexbox-20090723/#alignment
1248     void setBoxAlign(EBoxAlignment a) { SET_VAR(rareNonInheritedData.access()->m_deprecatedFlexibleBox, align, a); }
1249     void setBoxDecorationBreak(EBoxDecorationBreak b) { SET_VAR(m_box, m_boxDecorationBreak, b); }
1250     void setBoxDirection(EBoxDirection d) { inherited_flags._box_direction = d; }
1251     void setBoxFlex(float f) { SET_VAR(rareNonInheritedData.access()->m_deprecatedFlexibleBox, flex, f); }
1252     void setBoxFlexGroup(unsigned fg) { SET_VAR(rareNonInheritedData.access()->m_deprecatedFlexibleBox, flexGroup, fg); }
1253     void setBoxLines(EBoxLines l) { SET_VAR(rareNonInheritedData.access()->m_deprecatedFlexibleBox, lines, l); }
1254     void setBoxOrdinalGroup(unsigned og) { SET_VAR(rareNonInheritedData.access()->m_deprecatedFlexibleBox, ordinalGroup, og); }
1255     void setBoxOrient(EBoxOrient o) { SET_VAR(rareNonInheritedData.access()->m_deprecatedFlexibleBox, orient, o); }
1256     void setBoxPack(EBoxPack p) { SET_VAR(rareNonInheritedData.access()->m_deprecatedFlexibleBox, pack, p); }
1257     void setBoxShadow(PassRefPtr<ShadowList>);
1258     void setBoxReflect(PassRefPtr<StyleReflection> reflect) { if (rareNonInheritedData->m_boxReflect != reflect) rareNonInheritedData.access()->m_boxReflect = reflect; }
1259     void setBoxSizing(EBoxSizing s) { SET_VAR(m_box, m_boxSizing, s); }
1260     void setFlexGrow(float f) { SET_VAR(rareNonInheritedData.access()->m_flexibleBox, m_flexGrow, f); }
1261     void setFlexShrink(float f) { SET_VAR(rareNonInheritedData.access()->m_flexibleBox, m_flexShrink, f); }
1262     void setFlexBasis(const Length& length) { SET_VAR(rareNonInheritedData.access()->m_flexibleBox, m_flexBasis, length); }
1263     // We restrict the smallest value to int min + 2 because we use int min and int min + 1 as special values in a hash set.
1264     void setOrder(int o) { SET_VAR(rareNonInheritedData, m_order, max(std::numeric_limits<int>::min() + 2, o)); }
1265     void addCallbackSelector(const String& selector);
1266     void setAlignContent(EAlignContent p) { SET_VAR(rareNonInheritedData, m_alignContent, p); }
1267     void setAlignItems(ItemPosition a) { SET_VAR(rareNonInheritedData, m_alignItems, a); }
1268     void setAlignItemsOverflowAlignment(OverflowAlignment overflowAlignment) { SET_VAR(rareNonInheritedData, m_alignItemsOverflowAlignment, overflowAlignment); }
1269     void setAlignSelf(ItemPosition a) { SET_VAR(rareNonInheritedData, m_alignSelf, a); }
1270     void setAlignSelfOverflowAlignment(OverflowAlignment overflowAlignment) { SET_VAR(rareNonInheritedData, m_alignSelfOverflowAlignment, overflowAlignment); }
1271     void setFlexDirection(EFlexDirection direction) { SET_VAR(rareNonInheritedData.access()->m_flexibleBox, m_flexDirection, direction); }
1272     void setFlexWrap(EFlexWrap w) { SET_VAR(rareNonInheritedData.access()->m_flexibleBox, m_flexWrap, w); }
1273     void setJustifyContent(ContentPosition p) { SET_VAR(rareNonInheritedData, m_justifyContent, p); }
1274     void setJustifyContentDistribution(ContentDistributionType p) { SET_VAR(rareNonInheritedData, m_justifyContentDistribution, p); }
1275     void setJustifyContentOverflowAlignment(OverflowAlignment overflowAlignment) { SET_VAR(rareNonInheritedData, m_justifyContentOverflowAlignment, overflowAlignment); }
1276     void setJustifyItems(ItemPosition justifyItems) { SET_VAR(rareNonInheritedData, m_justifyItems, justifyItems); }
1277     void setJustifyItemsOverflowAlignment(OverflowAlignment overflowAlignment) { SET_VAR(rareNonInheritedData, m_justifyItemsOverflowAlignment, overflowAlignment); }
1278     void setJustifyItemsPositionType(ItemPositionType positionType) { SET_VAR(rareNonInheritedData, m_justifyItemsPositionType, positionType); }
1279     void setJustifySelf(ItemPosition justifySelf) { SET_VAR(rareNonInheritedData, m_justifySelf, justifySelf); }
1280     void setJustifySelfOverflowAlignment(OverflowAlignment overflowAlignment) { SET_VAR(rareNonInheritedData, m_justifySelfOverflowAlignment, overflowAlignment); }
1281     void setGridAutoColumns(const GridTrackSize& length) { SET_VAR(rareNonInheritedData.access()->m_grid, m_gridAutoColumns, length); }
1282     void setGridAutoRows(const GridTrackSize& length) { SET_VAR(rareNonInheritedData.access()->m_grid, m_gridAutoRows, length); }
1283     void setGridTemplateColumns(const Vector<GridTrackSize>& lengths) { SET_VAR(rareNonInheritedData.access()->m_grid, m_gridTemplateColumns, lengths); }
1284     void setGridTemplateRows(const Vector<GridTrackSize>& lengths) { SET_VAR(rareNonInheritedData.access()->m_grid, m_gridTemplateRows, lengths); }
1285     void setNamedGridColumnLines(const NamedGridLinesMap& namedGridColumnLines) { SET_VAR(rareNonInheritedData.access()->m_grid, m_namedGridColumnLines, namedGridColumnLines); }
1286     void setNamedGridRowLines(const NamedGridLinesMap& namedGridRowLines) { SET_VAR(rareNonInheritedData.access()->m_grid, m_namedGridRowLines, namedGridRowLines); }
1287     void setOrderedNamedGridColumnLines(const OrderedNamedGridLines& orderedNamedGridColumnLines) { SET_VAR(rareNonInheritedData.access()->m_grid, m_orderedNamedGridColumnLines, orderedNamedGridColumnLines); }
1288     void setOrderedNamedGridRowLines(const OrderedNamedGridLines& orderedNamedGridRowLines) { SET_VAR(rareNonInheritedData.access()->m_grid, m_orderedNamedGridRowLines, orderedNamedGridRowLines); }
1289     void setNamedGridArea(const NamedGridAreaMap& namedGridArea) { SET_VAR(rareNonInheritedData.access()->m_grid, m_namedGridArea, namedGridArea); }
1290     void setNamedGridAreaRowCount(size_t rowCount) { SET_VAR(rareNonInheritedData.access()->m_grid, m_namedGridAreaRowCount, rowCount); }
1291     void setNamedGridAreaColumnCount(size_t columnCount) { SET_VAR(rareNonInheritedData.access()->m_grid, m_namedGridAreaColumnCount, columnCount); }
1292     void setGridAutoFlow(GridAutoFlow flow) { SET_VAR(rareNonInheritedData.access()->m_grid, m_gridAutoFlow, flow); }
1293
1294     void setGridColumnStart(const GridPosition& columnStartPosition) { SET_VAR(rareNonInheritedData.access()->m_gridItem, m_gridColumnStart, columnStartPosition); }
1295     void setGridColumnEnd(const GridPosition& columnEndPosition) { SET_VAR(rareNonInheritedData.access()->m_gridItem, m_gridColumnEnd, columnEndPosition); }
1296     void setGridRowStart(const GridPosition& rowStartPosition) { SET_VAR(rareNonInheritedData.access()->m_gridItem, m_gridRowStart, rowStartPosition); }
1297     void setGridRowEnd(const GridPosition& rowEndPosition) { SET_VAR(rareNonInheritedData.access()->m_gridItem, m_gridRowEnd, rowEndPosition); }
1298
1299     void setUserModify(EUserModify u) { SET_VAR(rareInheritedData, userModify, u); }
1300     void setUserDrag(EUserDrag d) { SET_VAR(rareNonInheritedData, userDrag, d); }
1301     void setUserSelect(EUserSelect s) { SET_VAR(rareInheritedData, userSelect, s); }
1302     void setTextOverflow(TextOverflow overflow) { SET_VAR(rareNonInheritedData, textOverflow, overflow); }
1303     void setMarginBeforeCollapse(EMarginCollapse c) { SET_VAR(rareNonInheritedData, marginBeforeCollapse, c); }
1304     void setMarginAfterCollapse(EMarginCollapse c) { SET_VAR(rareNonInheritedData, marginAfterCollapse, c); }
1305     void setWordBreak(EWordBreak b) { SET_VAR(rareInheritedData, wordBreak, b); }
1306     void setOverflowWrap(EOverflowWrap b) { SET_VAR(rareInheritedData, overflowWrap, b); }
1307     void setLineBreak(LineBreak b) { SET_VAR(rareInheritedData, lineBreak, b); }
1308     void setHighlight(const AtomicString& h) { SET_VAR(rareInheritedData, highlight, h); }
1309     void setHyphens(Hyphens h) { SET_VAR(rareInheritedData, hyphens, h); }
1310     void setHyphenationString(const AtomicString& h) { SET_VAR(rareInheritedData, hyphenationString, h); }
1311     void setLocale(const AtomicString& locale) { SET_VAR(rareInheritedData, locale, locale); }
1312     void setResize(EResize r) { SET_VAR(rareNonInheritedData, m_resize, r); }
1313     void setColumnWidth(float f) { SET_VAR(rareNonInheritedData.access()->m_multiCol, m_autoWidth, false); SET_VAR(rareNonInheritedData.access()->m_multiCol, m_width, f); }
1314     void setHasAutoColumnWidth() { SET_VAR(rareNonInheritedData.access()->m_multiCol, m_autoWidth, true); SET_VAR(rareNonInheritedData.access()->m_multiCol, m_width, 0); }
1315     void setColumnCount(unsigned short c) { SET_VAR(rareNonInheritedData.access()->m_multiCol, m_autoCount, false); SET_VAR(rareNonInheritedData.access()->m_multiCol, m_count, c); }
1316     void setHasAutoColumnCount() { SET_VAR(rareNonInheritedData.access()->m_multiCol, m_autoCount, true); SET_VAR(rareNonInheritedData.access()->m_multiCol, m_count, 0); }
1317     void setColumnFill(ColumnFill columnFill) { SET_VAR(rareNonInheritedData.access()->m_multiCol, m_fill, columnFill); }
1318     void setColumnGap(float f) { SET_VAR(rareNonInheritedData.access()->m_multiCol, m_normalGap, false); SET_VAR(rareNonInheritedData.access()->m_multiCol, m_gap, f); }
1319     void setHasNormalColumnGap() { SET_VAR(rareNonInheritedData.access()->m_multiCol, m_normalGap, true); SET_VAR(rareNonInheritedData.access()->m_multiCol, m_gap, 0); }
1320     void setColumnRuleColor(const StyleColor& c) { SET_BORDERVALUE_COLOR(rareNonInheritedData.access()->m_multiCol, m_rule, c); }
1321     void setColumnRuleStyle(EBorderStyle b) { SET_VAR(rareNonInheritedData.access()->m_multiCol, m_rule.m_style, b); }
1322     void setColumnRuleWidth(unsigned short w) { SET_VAR(rareNonInheritedData.access()->m_multiCol, m_rule.m_width, w); }
1323     void resetColumnRule() { SET_VAR(rareNonInheritedData.access()->m_multiCol, m_rule, BorderValue()); }
1324     void setColumnSpan(ColumnSpan columnSpan) { SET_VAR(rareNonInheritedData.access()->m_multiCol, m_columnSpan, columnSpan); }
1325     void setColumnBreakBefore(EPageBreak p) { SET_VAR(rareNonInheritedData.access()->m_multiCol, m_breakBefore, p); }
1326     // For valid values of column-break-inside see http://www.w3.org/TR/css3-multicol/#break-before-break-after-break-inside
1327     void setColumnBreakInside(EPageBreak p) { ASSERT(p == PBAUTO || p == PBAVOID); SET_VAR(rareNonInheritedData.access()->m_multiCol, m_breakInside, p); }
1328     void setColumnBreakAfter(EPageBreak p) { SET_VAR(rareNonInheritedData.access()->m_multiCol, m_breakAfter, p); }
1329     void inheritColumnPropertiesFrom(RenderStyle* parent) { rareNonInheritedData.access()->m_multiCol = parent->rareNonInheritedData->m_multiCol; }
1330     void setHasInlineTransform(bool b) { SET_VAR(rareNonInheritedData, m_hasInlineTransform, b); }
1331     void setTransform(const TransformOperations& ops) { SET_VAR(rareNonInheritedData.access()->m_transform, m_operations, ops); }
1332     void setTransformOriginX(const Length& v) { setTransformOrigin(TransformOrigin(v, transformOriginY(), transformOriginZ())); }
1333     void setTransformOriginY(const Length& v) { setTransformOrigin(TransformOrigin(transformOriginX(), v, transformOriginZ())); }
1334     void setTransformOriginZ(float f) { setTransformOrigin(TransformOrigin(transformOriginX(), transformOriginY(), f)); }
1335     void setTransformOrigin(const TransformOrigin& o) { SET_VAR(rareNonInheritedData.access()->m_transform, m_origin, o); }
1336     void setSpeak(ESpeak s) { SET_VAR(rareInheritedData, speak, s); }
1337     void setTextCombine(TextCombine v) { SET_VAR(rareNonInheritedData, m_textCombine, v); }
1338     void setTextDecorationColor(const StyleColor& c) { SET_VAR(rareNonInheritedData, m_textDecorationColor, c); }
1339     void setTextEmphasisColor(const StyleColor& c) { SET_VAR_WITH_SETTER(rareInheritedData, textEmphasisColor, setTextEmphasisColor, c); }
1340     void setTextEmphasisFill(TextEmphasisFill fill) { SET_VAR(rareInheritedData, textEmphasisFill, fill); }
1341     void setTextEmphasisMark(TextEmphasisMark mark) { SET_VAR(rareInheritedData, textEmphasisMark, mark); }
1342     void setTextEmphasisCustomMark(const AtomicString& mark) { SET_VAR(rareInheritedData, textEmphasisCustomMark, mark); }
1343     void setTextEmphasisPosition(TextEmphasisPosition position) { SET_VAR(rareInheritedData, textEmphasisPosition, position); }
1344     bool setTextOrientation(TextOrientation);
1345
1346     void setObjectFit(ObjectFit f) { SET_VAR(rareNonInheritedData, m_objectFit, f); }
1347     void setObjectPosition(LengthPoint position) { SET_VAR(rareNonInheritedData, m_objectPosition, position); }
1348
1349     void setRubyPosition(RubyPosition position) { SET_VAR(rareInheritedData, m_rubyPosition, position); }
1350
1351     void setFilter(const FilterOperations& ops) { SET_VAR(rareNonInheritedData.access()->m_filter, m_operations, ops); }
1352
1353     void setTabSize(unsigned size) { SET_VAR(rareInheritedData, m_tabSize, size); }
1354
1355     // End CSS3 Setters
1356
1357     void setWrapFlow(WrapFlow wrapFlow) { SET_VAR(rareNonInheritedData, m_wrapFlow, wrapFlow); }
1358     void setWrapThrough(WrapThrough wrapThrough) { SET_VAR(rareNonInheritedData, m_wrapThrough, wrapThrough); }
1359
1360     // Apple-specific property setters
1361     void setPointerEvents(EPointerEvents p) { inherited_flags._pointerEvents = p; }
1362
1363     void clearAnimations()
1364     {
1365         rareNonInheritedData.access()->m_animations.clear();
1366     }
1367
1368     void clearTransitions()
1369     {
1370         rareNonInheritedData.access()->m_transitions.clear();
1371     }
1372
1373     void setTransformStyle3D(ETransformStyle3D b) { SET_VAR(rareNonInheritedData, m_transformStyle3D, b); }
1374     void setBackfaceVisibility(EBackfaceVisibility b) { SET_VAR(rareNonInheritedData, m_backfaceVisibility, b); }
1375     void setPerspective(float p) { SET_VAR(rareNonInheritedData, m_perspective, p); }
1376     void setPerspectiveOriginX(const Length& v) { setPerspectiveOrigin(LengthPoint(v, perspectiveOriginY())); }
1377     void setPerspectiveOriginY(const Length& v) { setPerspectiveOrigin(LengthPoint(perspectiveOriginX(), v)); }
1378     void setPerspectiveOrigin(const LengthPoint& p) { SET_VAR(rareNonInheritedData, m_perspectiveOrigin, p); }
1379     void setPageSize(const LengthSize& s) { SET_VAR(rareNonInheritedData, m_pageSize, s); }
1380     void setPageSizeType(PageSizeType t) { SET_VAR(rareNonInheritedData, m_pageSizeType, t); }
1381     void resetPageSizeType() { SET_VAR(rareNonInheritedData, m_pageSizeType, PAGE_SIZE_AUTO); }
1382
1383     void setHasCurrentOpacityAnimation(bool b = true) { SET_VAR(rareNonInheritedData, m_hasCurrentOpacityAnimation, b); }
1384     void setHasCurrentTransformAnimation(bool b = true) { SET_VAR(rareNonInheritedData, m_hasCurrentTransformAnimation, b); }
1385     void setHasCurrentFilterAnimation(bool b = true) { SET_VAR(rareNonInheritedData, m_hasCurrentFilterAnimation, b); }
1386
1387     void setIsRunningOpacityAnimationOnCompositor(bool b = true) { SET_VAR(rareNonInheritedData, m_runningOpacityAnimationOnCompositor, b); }
1388     void setIsRunningTransformAnimationOnCompositor(bool b = true) { SET_VAR(rareNonInheritedData, m_runningTransformAnimationOnCompositor, b); }
1389     void setIsRunningFilterAnimationOnCompositor(bool b = true) { SET_VAR(rareNonInheritedData, m_runningFilterAnimationOnCompositor, b); }
1390
1391     void setLineBoxContain(LineBoxContain c) { SET_VAR(rareInheritedData, m_lineBoxContain, c); }
1392     void setLineClamp(LineClampValue c) { SET_VAR(rareNonInheritedData, lineClamp, c); }
1393     void setTapHighlightColor(const Color& c) { SET_VAR(rareInheritedData, tapHighlightColor, c); }
1394     void setTextSecurity(ETextSecurity aTextSecurity) { SET_VAR(rareInheritedData, textSecurity, aTextSecurity); }
1395     void setTouchAction(TouchAction t) { SET_VAR(rareNonInheritedData, m_touchAction, t); }
1396     void setTouchActionDelay(TouchActionDelay t) { SET_VAR(rareInheritedData, m_touchActionDelay, t); }
1397
1398     void setScrollBehavior(ScrollBehavior b) { SET_VAR(rareNonInheritedData, m_scrollBehavior, b); }
1399
1400     void setWillChangeProperties(const Vector<CSSPropertyID>& properties) { SET_VAR(rareNonInheritedData.access()->m_willChange, m_properties, properties); }
1401     void setWillChangeContents(bool b) { SET_VAR(rareNonInheritedData.access()->m_willChange, m_contents, b); }
1402     void setWillChangeScrollPosition(bool b) { SET_VAR(rareNonInheritedData.access()->m_willChange, m_scrollPosition, b); }
1403     void setSubtreeWillChangeContents(bool b) { SET_VAR(rareInheritedData, m_subtreeWillChangeContents, b); }
1404
1405     bool requiresAcceleratedCompositingForExternalReasons(bool b) { return rareNonInheritedData->m_requiresAcceleratedCompositingForExternalReasons; }
1406     void setRequiresAcceleratedCompositingForExternalReasons(bool b) { SET_VAR(rareNonInheritedData, m_requiresAcceleratedCompositingForExternalReasons, b); }
1407
1408     const SVGRenderStyle& svgStyle() const { return *m_svgStyle.get(); }
1409     SVGRenderStyle& accessSVGStyle() { return *m_svgStyle.access(); }
1410
1411     const SVGPaintType& fillPaintType() const { return svgStyle().fillPaintType(); }
1412     Color fillPaintColor() const { return svgStyle().fillPaintColor(); }
1413     float fillOpacity() const { return svgStyle().fillOpacity(); }
1414     void setFillOpacity(float f) { accessSVGStyle().setFillOpacity(f); }
1415
1416     const SVGPaintType& strokePaintType() const { return svgStyle().strokePaintType(); }
1417     Color strokePaintColor() const { return svgStyle().strokePaintColor(); }
1418     float strokeOpacity() const { return svgStyle().strokeOpacity(); }
1419     void setStrokeOpacity(float f) { accessSVGStyle().setStrokeOpacity(f); }
1420     SVGLength* strokeWidth() const { return svgStyle().strokeWidth(); }
1421     void setStrokeWidth(PassRefPtr<SVGLength> w) { accessSVGStyle().setStrokeWidth(w); }
1422     SVGLengthList* strokeDashArray() const { return svgStyle().strokeDashArray(); }
1423     void setStrokeDashArray(PassRefPtr<SVGLengthList> array) { accessSVGStyle().setStrokeDashArray(array); }
1424     SVGLength* strokeDashOffset() const { return svgStyle().strokeDashOffset(); }
1425     void setStrokeDashOffset(PassRefPtr<SVGLength> d) { accessSVGStyle().setStrokeDashOffset(d); }
1426     float strokeMiterLimit() const { return svgStyle().strokeMiterLimit(); }
1427     void setStrokeMiterLimit(float f) { accessSVGStyle().setStrokeMiterLimit(f); }
1428
1429     float floodOpacity() const { return svgStyle().floodOpacity(); }
1430     void setFloodOpacity(float f) { accessSVGStyle().setFloodOpacity(f); }
1431
1432     float stopOpacity() const { return svgStyle().stopOpacity(); }
1433     void setStopOpacity(float f) { accessSVGStyle().setStopOpacity(f); }
1434
1435     void setStopColor(const Color& c) { accessSVGStyle().setStopColor(c); }
1436     void setFloodColor(const Color& c) { accessSVGStyle().setFloodColor(c); }
1437     void setLightingColor(const Color& c) { accessSVGStyle().setLightingColor(c); }
1438
1439     SVGLength* baselineShiftValue() const { return svgStyle().baselineShiftValue(); }
1440     void setBaselineShiftValue(PassRefPtr<SVGLength> s) { accessSVGStyle().setBaselineShiftValue(s); }
1441
1442     void setShapeOutside(PassRefPtr<ShapeValue> value)
1443     {
1444         if (rareNonInheritedData->m_shapeOutside == value)
1445             return;
1446         rareNonInheritedData.access()->m_shapeOutside = value;
1447     }
1448     ShapeValue* shapeOutside() const { return rareNonInheritedData->m_shapeOutside.get(); }
1449
1450     static ShapeValue* initialShapeOutside() { return 0; }
1451
1452     void setClipPath(PassRefPtr<ClipPathOperation> operation)
1453     {
1454         if (rareNonInheritedData->m_clipPath != operation)
1455             rareNonInheritedData.access()->m_clipPath = operation;
1456     }
1457     ClipPathOperation* clipPath() const { return rareNonInheritedData->m_clipPath.get(); }
1458
1459     static ClipPathOperation* initialClipPath() { return 0; }
1460
1461     const Length& shapeMargin() const { return rareNonInheritedData->m_shapeMargin; }
1462     void setShapeMargin(const Length& shapeMargin) { SET_VAR(rareNonInheritedData, m_shapeMargin, shapeMargin); }
1463     static Length initialShapeMargin() { return Length(0, Fixed); }
1464
1465     float shapeImageThreshold() const { return rareNonInheritedData->m_shapeImageThreshold; }
1466     void setShapeImageThreshold(float shapeImageThreshold)
1467     {
1468         float clampedShapeImageThreshold = clampTo<float>(shapeImageThreshold, 0, 1);
1469         SET_VAR(rareNonInheritedData, m_shapeImageThreshold, clampedShapeImageThreshold);
1470     }
1471     static float initialShapeImageThreshold() { return 0; }
1472
1473     bool hasContent() const { return contentData(); }
1474     const ContentData* contentData() const { return rareNonInheritedData->m_content.get(); }
1475     bool contentDataEquivalent(const RenderStyle* otherStyle) const { return const_cast<RenderStyle*>(this)->rareNonInheritedData->contentDataEquivalent(*const_cast<RenderStyle*>(otherStyle)->rareNonInheritedData); }
1476     void clearContent();
1477     void setContent(const String&, bool add = false);
1478     void setContent(PassRefPtr<StyleImage>, bool add = false);
1479     void setContent(PassOwnPtr<CounterContent>, bool add = false);
1480     void setContent(QuoteType, bool add = false);
1481
1482     const CounterDirectiveMap* counterDirectives() const;
1483     CounterDirectiveMap& accessCounterDirectives();
1484     const CounterDirectives getCounterDirectives(const AtomicString& identifier) const;
1485
1486     QuotesData* quotes() const { return rareInheritedData->quotes.get(); }
1487     void setQuotes(PassRefPtr<QuotesData>);
1488
1489     const AtomicString& hyphenString() const;
1490
1491     bool inheritedNotEqual(const RenderStyle*) const;
1492     bool inheritedDataShared(const RenderStyle*) const;
1493
1494     bool isDisplayReplacedType() const { return isDisplayReplacedType(display()); }
1495     bool isDisplayInlineType() const { return isDisplayInlineType(display()); }
1496     bool isOriginalDisplayInlineType() const { return isDisplayInlineType(originalDisplay()); }
1497     bool isDisplayFlexibleOrGridBox() const { return isDisplayFlexibleBox(display()) || isDisplayGridBox(display()); }
1498     bool isDisplayFlexibleBox() const { return isDisplayFlexibleBox(display()); }
1499
1500
1501     bool setWritingMode(WritingMode v)
1502     {
1503         if (v == writingMode())
1504             return false;
1505
1506         inherited_flags.m_writingMode = v;
1507         return true;
1508     }
1509
1510     // A unique style is one that has matches something that makes it impossible to share.
1511     bool unique() const { return noninherited_flags.unique; }
1512     void setUnique() { noninherited_flags.unique = true; }
1513
1514     bool isSharable() const;
1515
1516     bool emptyState() const { return noninherited_flags.emptyState; }
1517     void setEmptyState(bool b) { setUnique(); noninherited_flags.emptyState = b; }
1518     bool firstChildState() const { return noninherited_flags.firstChildState; }
1519     void setFirstChildState() { setUnique(); noninherited_flags.firstChildState = true; }
1520     bool lastChildState() const { return noninherited_flags.lastChildState; }
1521     void setLastChildState() { setUnique(); noninherited_flags.lastChildState = true; }
1522
1523     StyleColor visitedDependentDecorationStyleColor() const;
1524     Color visitedDependentDecorationColor() const;
1525     Color visitedDependentColor(int colorProperty) const;
1526
1527     void setHasExplicitlyInheritedProperties() { noninherited_flags.explicitInheritance = true; }
1528     bool hasExplicitlyInheritedProperties() const { return noninherited_flags.explicitInheritance; }
1529
1530     bool hasBoxDecorations() const { return hasBorder() || hasBorderRadius() || hasOutline() || hasAppearance() || boxShadow() || hasFilter(); }
1531
1532     bool borderObscuresBackground() const;
1533     void getBorderEdgeInfo(BorderEdge edges[], bool includeLogicalLeftEdge = true, bool includeLogicalRightEdge = true) const;
1534
1535     // Initial values for all the properties
1536     static EBorderCollapse initialBorderCollapse() { return BSEPARATE; }
1537     static EBorderStyle initialBorderStyle() { return BNONE; }
1538     static OutlineIsAuto initialOutlineStyleIsAuto() { return AUTO_OFF; }
1539     static NinePieceImage initialNinePieceImage() { return NinePieceImage(); }
1540     static LengthSize initialBorderRadius() { return LengthSize(Length(0, Fixed), Length(0, Fixed)); }
1541     static ECaptionSide initialCaptionSide() { return CAPTOP; }
1542     static EClear initialClear() { return CNONE; }
1543     static LengthBox initialClip() { return LengthBox(); }
1544     static TextDirection initialDirection() { return LTR; }
1545     static WritingMode initialWritingMode() { return TopToBottomWritingMode; }
1546     static TextCombine initialTextCombine() { return TextCombineNone; }
1547     static TextOrientation initialTextOrientation() { return TextOrientationVerticalRight; }
1548     static ObjectFit initialObjectFit() { return ObjectFitFill; }
1549     static LengthPoint initialObjectPosition() { return LengthPoint(Length(50.0, Percent), Length(50.0, Percent)); }
1550     static EDisplay initialDisplay() { return INLINE; }
1551     static EEmptyCell initialEmptyCells() { return SHOW; }
1552     static EFloat initialFloating() { return NoFloat; }
1553     static EListStylePosition initialListStylePosition() { return OUTSIDE; }
1554     static EListStyleType initialListStyleType() { return Disc; }
1555     static EOverflow initialOverflowX() { return OVISIBLE; }
1556     static EOverflow initialOverflowY() { return OVISIBLE; }
1557     static EPageBreak initialPageBreak() { return PBAUTO; }
1558     static EPosition initialPosition() { return StaticPosition; }
1559     static ETableLayout initialTableLayout() { return TAUTO; }
1560     static EUnicodeBidi initialUnicodeBidi() { return UBNormal; }
1561     static ETextTransform initialTextTransform() { return TTNONE; }
1562     static EVisibility initialVisibility() { return VISIBLE; }
1563     static EWhiteSpace initialWhiteSpace() { return NORMAL; }
1564     static short initialHorizontalBorderSpacing() { return 0; }
1565     static short initialVerticalBorderSpacing() { return 0; }
1566     static ECursor initialCursor() { return CURSOR_AUTO; }
1567     static Color initialColor() { return Color::black; }
1568     static StyleImage* initialListStyleImage() { return 0; }
1569     static unsigned initialBorderWidth() { return 3; }
1570     static unsigned short initialColumnRuleWidth() { return 3; }
1571     static unsigned short initialOutlineWidth() { return 3; }
1572     static float initialLetterWordSpacing() { return 0.0f; }
1573     static Length initialSize() { return Length(); }
1574     static Length initialMinSize() { return Length(Fixed); }
1575     static Length initialMaxSize() { return Length(MaxSizeNone); }
1576     static Length initialOffset() { return Length(); }
1577     static Length initialMargin() { return Length(Fixed); }
1578     static Length initialPadding() { return Length(Fixed); }
1579     static Length initialTextIndent() { return Length(Fixed); }
1580     static TextIndentLine initialTextIndentLine() { return TextIndentFirstLine; }
1581     static TextIndentType initialTextIndentType() { return TextIndentNormal; }
1582     static EVerticalAlign initialVerticalAlign() { return BASELINE; }
1583     static short initialWidows() { return 2; }
1584     static short initialOrphans() { return 2; }
1585     static Length initialLineHeight() { return Length(-100.0, Percent); }
1586     static ETextAlign initialTextAlign() { return TASTART; }
1587     static TextAlignLast initialTextAlignLast() { return TextAlignLastAuto; }
1588     static TextJustify initialTextJustify() { return TextJustifyAuto; }
1589     static TextDecoration initialTextDecoration() { return TextDecorationNone; }
1590     static TextUnderlinePosition initialTextUnderlinePosition() { return TextUnderlinePositionAuto; }
1591     static TextDecorationStyle initialTextDecorationStyle() { return TextDecorationStyleSolid; }
1592     static float initialZoom() { return 1.0f; }
1593     static int initialOutlineOffset() { return 0; }
1594     static float initialOpacity() { return 1.0f; }
1595     static EBoxAlignment initialBoxAlign() { return BSTRETCH; }
1596     static EBoxDecorationBreak initialBoxDecorationBreak() { return DSLICE; }
1597     static EBoxDirection initialBoxDirection() { return BNORMAL; }
1598     static EBoxLines initialBoxLines() { return SINGLE; }
1599     static EBoxOrient initialBoxOrient() { return HORIZONTAL; }
1600     static EBoxPack initialBoxPack() { return Start; }
1601     static float initialBoxFlex() { return 0.0f; }
1602     static unsigned initialBoxFlexGroup() { return 1; }
1603     static unsigned initialBoxOrdinalGroup() { return 1; }
1604     static EBoxSizing initialBoxSizing() { return CONTENT_BOX; }
1605     static StyleReflection* initialBoxReflect() { return 0; }
1606     static float initialFlexGrow() { return 0; }
1607     static float initialFlexShrink() { return 1; }
1608     static Length initialFlexBasis() { return Length(Auto); }
1609     static int initialOrder() { return 0; }
1610     static EAlignContent initialAlignContent() { return AlignContentStretch; }
1611     static ItemPosition initialAlignItems() { return ItemPositionAuto; }
1612     static OverflowAlignment initialAlignItemsOverflowAlignment() { return OverflowAlignmentDefault; }
1613     static ItemPosition initialAlignSelf() { return ItemPositionAuto; }
1614     static OverflowAlignment initialAlignSelfOverflowAlignment() { return OverflowAlignmentDefault; }
1615     static EFlexDirection initialFlexDirection() { return FlowRow; }
1616     static EFlexWrap initialFlexWrap() { return FlexNoWrap; }
1617     static ContentPosition initialJustifyContent() { return ContentPositionAuto; }
1618     static ContentDistributionType initialJustifyContentDistribution() { return ContentDistributionDefault; }
1619     static OverflowAlignment initialJustifyContentOverflowAlignment() { return OverflowAlignmentDefault; }
1620     static ItemPosition initialJustifyItems() { return ItemPositionAuto; }
1621     static OverflowAlignment initialJustifyItemsOverflowAlignment() { return OverflowAlignmentDefault; }
1622     static ItemPositionType initialJustifyItemsPositionType() { return NonLegacyPosition; }
1623     static ItemPosition initialJustifySelf() { return ItemPositionAuto; }
1624     static OverflowAlignment initialJustifySelfOverflowAlignment() { return OverflowAlignmentDefault; }
1625     static EUserModify initialUserModify() { return READ_ONLY; }
1626     static EUserDrag initialUserDrag() { return DRAG_AUTO; }
1627     static EUserSelect initialUserSelect() { return SELECT_TEXT; }
1628     static TextOverflow initialTextOverflow() { return TextOverflowClip; }
1629     static EMarginCollapse initialMarginBeforeCollapse() { return MCOLLAPSE; }
1630     static EMarginCollapse initialMarginAfterCollapse() { return MCOLLAPSE; }
1631     static EWordBreak initialWordBreak() { return NormalWordBreak; }
1632     static EOverflowWrap initialOverflowWrap() { return NormalOverflowWrap; }
1633     static LineBreak initialLineBreak() { return LineBreakAuto; }
1634     static const AtomicString& initialHighlight() { return nullAtom; }
1635     static ESpeak initialSpeak() { return SpeakNormal; }
1636     static const AtomicString& initialHyphenationString() { return nullAtom; }
1637     static const AtomicString& initialLocale() { return nullAtom; }
1638     static EResize initialResize() { return RESIZE_NONE; }
1639     static ControlPart initialAppearance() { return NoControlPart; }
1640     static Order initialRTLOrdering() { return LogicalOrder; }
1641     static float initialTextStrokeWidth() { return 0; }
1642     static unsigned short initialColumnCount() { return 1; }
1643     static ColumnFill initialColumnFill() { return ColumnFillBalance; }
1644     static ColumnSpan initialColumnSpan() { return ColumnSpanNone; }
1645     static const TransformOperations& initialTransform() { DEFINE_STATIC_LOCAL(TransformOperations, ops, ()); return ops; }
1646     static Length initialTransformOriginX() { return Length(50.0, Percent); }
1647     static Length initialTransformOriginY() { return Length(50.0, Percent); }
1648     static float initialTransformOriginZ() { return 0; }
1649     static TransformOrigin initialTransformOrigin() { return TransformOrigin(Length(50.0, Percent), Length(50.0, Percent), 0); }
1650     static EPointerEvents initialPointerEvents() { return PE_AUTO; }
1651     static ETransformStyle3D initialTransformStyle3D() { return TransformStyle3DFlat; }
1652     static EBackfaceVisibility initialBackfaceVisibility() { return BackfaceVisibilityVisible; }
1653     static float initialPerspective() { return 0; }
1654     static Length initialPerspectiveOriginX() { return Length(50.0, Percent); }
1655     static Length initialPerspectiveOriginY() { return Length(50.0, Percent); }
1656     static LengthPoint initialPerspectiveOrigin() { return LengthPoint(Length(50.0, Percent), Length(50.0, Percent)); }
1657     static Color initialBackgroundColor() { return Color::transparent; }
1658     static TextEmphasisFill initialTextEmphasisFill() { return TextEmphasisFillFilled; }
1659     static TextEmphasisMark initialTextEmphasisMark() { return TextEmphasisMarkNone; }
1660     static const AtomicString& initialTextEmphasisCustomMark() { return nullAtom; }
1661     static TextEmphasisPosition initialTextEmphasisPosition() { return TextEmphasisPositionOver; }
1662     static RubyPosition initialRubyPosition() { return RubyPositionBefore; }
1663     static LineBoxContain initialLineBoxContain() { return LineBoxContainBlock | LineBoxContainInline | LineBoxContainReplaced; }
1664     static ImageOrientationEnum initialImageOrientation() { return OriginTopLeft; }
1665     static EImageRendering initialImageRendering() { return ImageRenderingAuto; }
1666     static ImageResolutionSource initialImageResolutionSource() { return ImageResolutionSpecified; }
1667     static ImageResolutionSnap initialImageResolutionSnap() { return ImageResolutionNoSnap; }
1668     static float initialImageResolution() { return 1; }
1669     static StyleImage* initialBorderImageSource() { return 0; }
1670     static StyleImage* initialMaskBoxImageSource() { return 0; }
1671     static PrintColorAdjust initialPrintColorAdjust() { return PrintColorAdjustEconomy; }
1672     static TouchAction initialTouchAction() { return TouchActionAuto; }
1673     static TouchActionDelay initialTouchActionDelay() { return TouchActionDelayScript; }
1674     static ShadowList* initialBoxShadow() { return 0; }
1675     static ShadowList* initialTextShadow() { return 0; }
1676     static ScrollBehavior initialScrollBehavior() { return ScrollBehaviorInstant; }
1677
1678     // The initial value is 'none' for grid tracks.
1679     static Vector<GridTrackSize> initialGridTemplateColumns() { return Vector<GridTrackSize>(); }
1680     static Vector<GridTrackSize> initialGridTemplateRows() { return Vector<GridTrackSize>(); }
1681
1682     static GridAutoFlow initialGridAutoFlow() { return AutoFlowRow; }
1683
1684     static GridTrackSize initialGridAutoColumns() { return GridTrackSize(Length(Auto)); }
1685     static GridTrackSize initialGridAutoRows() { return GridTrackSize(Length(Auto)); }
1686
1687     static NamedGridLinesMap initialNamedGridColumnLines() { return NamedGridLinesMap(); }
1688     static NamedGridLinesMap initialNamedGridRowLines() { return NamedGridLinesMap(); }
1689
1690     static OrderedNamedGridLines initialOrderedNamedGridColumnLines() { return OrderedNamedGridLines(); }
1691     static OrderedNamedGridLines initialOrderedNamedGridRowLines() { return OrderedNamedGridLines(); }
1692
1693     static NamedGridAreaMap initialNamedGridArea() { return NamedGridAreaMap(); }
1694     static size_t initialNamedGridAreaCount() { return 0; }
1695
1696     // 'auto' is the default.
1697     static GridPosition initialGridColumnStart() { return GridPosition(); }
1698     static GridPosition initialGridColumnEnd() { return GridPosition(); }
1699     static GridPosition initialGridRowStart() { return GridPosition(); }
1700     static GridPosition initialGridRowEnd() { return GridPosition(); }
1701
1702     static unsigned initialTabSize() { return 8; }
1703
1704     static WrapFlow initialWrapFlow() { return WrapFlowAuto; }
1705     static WrapThrough initialWrapThrough() { return WrapThroughWrap; }
1706
1707     static QuotesData* initialQuotes() { return 0; }
1708
1709     // Keep these at the end.
1710     // FIXME: Why? Seems these should all be one big sorted list.
1711     static LineClampValue initialLineClamp() { return LineClampValue(); }
1712     static ETextSecurity initialTextSecurity() { return TSNONE; }
1713     static Color initialTapHighlightColor();
1714     static const FilterOperations& initialFilter() { DEFINE_STATIC_LOCAL(FilterOperations, ops, ()); return ops; }
1715     static WebBlendMode initialBlendMode() { return WebBlendModeNormal; }
1716     static EIsolation initialIsolation() { return IsolationAuto; }
1717 private:
1718     void setVisitedLinkColor(const Color&);
1719     void setVisitedLinkBackgroundColor(const StyleColor& v) { SET_VAR(rareNonInheritedData, m_visitedLinkBackgroundColor, v); }
1720     void setVisitedLinkBorderLeftColor(const StyleColor& v) { SET_VAR(rareNonInheritedData, m_visitedLinkBorderLeftColor, v); }
1721     void setVisitedLinkBorderRightColor(const StyleColor& v) { SET_VAR(rareNonInheritedData, m_visitedLinkBorderRightColor, v); }
1722     void setVisitedLinkBorderBottomColor(const StyleColor& v) { SET_VAR(rareNonInheritedData, m_visitedLinkBorderBottomColor, v); }
1723     void setVisitedLinkBorderTopColor(const StyleColor& v) { SET_VAR(rareNonInheritedData, m_visitedLinkBorderTopColor, v); }
1724     void setVisitedLinkOutlineColor(const StyleColor& v) { SET_VAR(rareNonInheritedData, m_visitedLinkOutlineColor, v); }
1725     void setVisitedLinkColumnRuleColor(const StyleColor& v) { SET_VAR(rareNonInheritedData.access()->m_multiCol, m_visitedLinkColumnRuleColor, v); }
1726     void setVisitedLinkTextDecorationColor(const StyleColor& v) { SET_VAR(rareNonInheritedData, m_visitedLinkTextDecorationColor, v); }
1727     void setVisitedLinkTextEmphasisColor(const StyleColor& v) { SET_VAR_WITH_SETTER(rareInheritedData, visitedLinkTextEmphasisColor, setVisitedLinkTextEmphasisColor, v); }
1728     void setVisitedLinkTextFillColor(const StyleColor& v) { SET_VAR_WITH_SETTER(rareInheritedData, visitedLinkTextFillColor, setVisitedLinkTextFillColor, v); }
1729     void setVisitedLinkTextStrokeColor(const StyleColor& v) { SET_VAR_WITH_SETTER(rareInheritedData, visitedLinkTextStrokeColor, setVisitedLinkTextStrokeColor, v); }
1730
1731     void inheritUnicodeBidiFrom(const RenderStyle* parent) { noninherited_flags.unicodeBidi = parent->noninherited_flags.unicodeBidi; }
1732     void getShadowExtent(const ShadowList*, LayoutUnit& top, LayoutUnit& right, LayoutUnit& bottom, LayoutUnit& left) const;
1733     LayoutBoxExtent getShadowInsetExtent(const ShadowList*) const;
1734     void getShadowHorizontalExtent(const ShadowList*, LayoutUnit& left, LayoutUnit& right) const;
1735     void getShadowVerticalExtent(const ShadowList*, LayoutUnit& top, LayoutUnit& bottom) const;
1736     void getShadowInlineDirectionExtent(const ShadowList* shadow, LayoutUnit& logicalLeft, LayoutUnit& logicalRight) const
1737     {
1738         return isHorizontalWritingMode() ? getShadowHorizontalExtent(shadow, logicalLeft, logicalRight) : getShadowVerticalExtent(shadow, logicalLeft, logicalRight);
1739     }
1740     void getShadowBlockDirectionExtent(const ShadowList* shadow, LayoutUnit& logicalTop, LayoutUnit& logicalBottom) const
1741     {
1742         return isHorizontalWritingMode() ? getShadowVerticalExtent(shadow, logicalTop, logicalBottom) : getShadowHorizontalExtent(shadow, logicalTop, logicalBottom);
1743     }
1744
1745     bool isDisplayFlexibleBox(EDisplay display) const
1746     {
1747         return display == FLEX || display == INLINE_FLEX;
1748     }
1749
1750     bool isDisplayGridBox(EDisplay display) const
1751     {
1752         return display == GRID || display == INLINE_GRID;
1753     }
1754
1755     bool isDisplayReplacedType(EDisplay display) const
1756     {
1757         return display == INLINE_BLOCK || display == INLINE_BOX || display == INLINE_FLEX
1758             || display == INLINE_TABLE || display == INLINE_GRID;
1759     }
1760
1761     bool isDisplayInlineType(EDisplay display) const
1762     {
1763         return display == INLINE || isDisplayReplacedType(display);
1764     }
1765
1766     // Color accessors are all private to make sure callers use visitedDependentColor instead to access them.
1767     StyleColor borderLeftColor() const { return surround->border.left().color(); }
1768     StyleColor borderRightColor() const { return surround->border.right().color(); }
1769     StyleColor borderTopColor() const { return surround->border.top().color(); }
1770     StyleColor borderBottomColor() const { return surround->border.bottom().color(); }
1771     StyleColor backgroundColor() const { return m_background->color(); }
1772     Color color() const;
1773     StyleColor columnRuleColor() const { return rareNonInheritedData->m_multiCol->m_rule.color(); }
1774     StyleColor outlineColor() const { return m_background->outline().color(); }
1775     StyleColor textEmphasisColor() const { return rareInheritedData->textEmphasisColor(); }
1776     StyleColor textFillColor() const { return rareInheritedData->textFillColor(); }
1777     StyleColor textStrokeColor() const { return rareInheritedData->textStrokeColor(); }
1778     Color visitedLinkColor() const;
1779     StyleColor visitedLinkBackgroundColor() const { return rareNonInheritedData->m_visitedLinkBackgroundColor; }
1780     StyleColor visitedLinkBorderLeftColor() const { return rareNonInheritedData->m_visitedLinkBorderLeftColor; }
1781     StyleColor visitedLinkBorderRightColor() const { return rareNonInheritedData->m_visitedLinkBorderRightColor; }
1782     StyleColor visitedLinkBorderBottomColor() const { return rareNonInheritedData->m_visitedLinkBorderBottomColor; }
1783     StyleColor visitedLinkBorderTopColor() const { return rareNonInheritedData->m_visitedLinkBorderTopColor; }
1784     StyleColor visitedLinkOutlineColor() const { return rareNonInheritedData->m_visitedLinkOutlineColor; }
1785     StyleColor visitedLinkColumnRuleColor() const { return rareNonInheritedData->m_multiCol->m_visitedLinkColumnRuleColor; }
1786     StyleColor textDecorationColor() const { return rareNonInheritedData->m_textDecorationColor; }
1787     StyleColor visitedLinkTextDecorationColor() const { return rareNonInheritedData->m_visitedLinkTextDecorationColor; }
1788     StyleColor visitedLinkTextEmphasisColor() const { return rareInheritedData->visitedLinkTextEmphasisColor(); }
1789     StyleColor visitedLinkTextFillColor() const { return rareInheritedData->visitedLinkTextFillColor(); }
1790     StyleColor visitedLinkTextStrokeColor() const { return rareInheritedData->visitedLinkTextStrokeColor(); }
1791
1792     Color colorIncludingFallback(int colorProperty, bool visitedLink) const;
1793
1794     Color stopColor() const { return svgStyle().stopColor(); }
1795     Color floodColor() const { return svgStyle().floodColor(); }
1796     Color lightingColor() const { return svgStyle().lightingColor(); }
1797
1798     void appendContent(PassOwnPtr<ContentData>);
1799     void addAppliedTextDecoration(const AppliedTextDecoration&);
1800
1801     bool diffNeedsFullLayoutAndPaintInvalidation(const RenderStyle& other) const;
1802     bool diffNeedsFullLayout(const RenderStyle& other) const;
1803     bool diffNeedsPaintInvalidationLayer(const RenderStyle& other) const;
1804     bool diffNeedsPaintInvalidationObject(const RenderStyle& other) const;
1805     void updatePropertySpecificDifferences(const RenderStyle& other, StyleDifference&) const;
1806 };
1807
1808 // FIXME: Reduce/remove the dependency on zoom adjusted int values.
1809 // The float or LayoutUnit versions of layout values should be used.
1810 inline int adjustForAbsoluteZoom(int value, float zoomFactor)
1811 {
1812     if (zoomFactor == 1)
1813         return value;
1814     // Needed because computeLengthInt truncates (rather than rounds) when scaling up.
1815     float fvalue = value;
1816     if (zoomFactor > 1) {
1817         if (value < 0)
1818             fvalue -= 0.5f;
1819         else
1820             fvalue += 0.5f;
1821     }
1822
1823     return roundForImpreciseConversion<int>(fvalue / zoomFactor);
1824 }
1825
1826 inline int adjustForAbsoluteZoom(int value, const RenderStyle* style)
1827 {
1828     return adjustForAbsoluteZoom(value, style->effectiveZoom());
1829 }
1830
1831 inline float adjustFloatForAbsoluteZoom(float value, const RenderStyle& style)
1832 {
1833     return value / style.effectiveZoom();
1834 }
1835
1836 inline double adjustDoubleForAbsoluteZoom(double value, const RenderStyle& style)
1837 {
1838     return value / style.effectiveZoom();
1839 }
1840
1841 inline LayoutUnit adjustLayoutUnitForAbsoluteZoom(LayoutUnit value, const RenderStyle& style)
1842 {
1843     return value / style.effectiveZoom();
1844 }
1845
1846 inline double adjustScrollForAbsoluteZoom(double scrollOffset, float zoomFactor)
1847 {
1848     return scrollOffset / zoomFactor;
1849 }
1850
1851 inline double adjustScrollForAbsoluteZoom(double scrollOffset, const RenderStyle& style)
1852 {
1853     return adjustScrollForAbsoluteZoom(scrollOffset, style.effectiveZoom());
1854 }
1855
1856 inline bool RenderStyle::setZoom(float f)
1857 {
1858     if (compareEqual(visual->m_zoom, f))
1859         return false;
1860     visual.access()->m_zoom = f;
1861     setEffectiveZoom(effectiveZoom() * zoom());
1862     return true;
1863 }
1864
1865 inline bool RenderStyle::setEffectiveZoom(float f)
1866 {
1867     if (compareEqual(rareInheritedData->m_effectiveZoom, f))
1868         return false;
1869     rareInheritedData.access()->m_effectiveZoom = f;
1870     return true;
1871 }
1872
1873 inline bool RenderStyle::isSharable() const
1874 {
1875     if (unique())
1876         return false;
1877     if (hasUniquePseudoStyle())
1878         return false;
1879     return true;
1880 }
1881
1882 inline bool RenderStyle::setTextOrientation(TextOrientation textOrientation)
1883 {
1884     if (compareEqual(rareInheritedData->m_textOrientation, textOrientation))
1885         return false;
1886
1887     rareInheritedData.access()->m_textOrientation = textOrientation;
1888     return true;
1889 }
1890
1891 inline bool RenderStyle::hasAnyPublicPseudoStyles() const
1892 {
1893     return PUBLIC_PSEUDOID_MASK & noninherited_flags.pseudoBits;
1894 }
1895
1896 inline bool RenderStyle::hasPseudoStyle(PseudoId pseudo) const
1897 {
1898     ASSERT(pseudo > NOPSEUDO);
1899     ASSERT(pseudo < FIRST_INTERNAL_PSEUDOID);
1900     return (1 << (pseudo - 1)) & noninherited_flags.pseudoBits;
1901 }
1902
1903 inline void RenderStyle::setHasPseudoStyle(PseudoId pseudo)
1904 {
1905     ASSERT(pseudo > NOPSEUDO);
1906     ASSERT(pseudo < FIRST_INTERNAL_PSEUDOID);
1907     noninherited_flags.pseudoBits |= 1 << (pseudo - 1);
1908 }
1909
1910 inline bool RenderStyle::hasPseudoElementStyle() const
1911 {
1912     return noninherited_flags.pseudoBits & PSEUDO_ELEMENT_MASK;
1913 }
1914
1915 float calcBorderRadiiConstraintScaleFor(const FloatRect&, const FloatRoundedRect::Radii&);
1916
1917 } // namespace blink
1918
1919 #endif // RenderStyle_h