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 Apple Inc. All rights reserved.
6 * Copyright (C) 2006 Graham Dennis (graham.dennis@gmail.com)
7 *
8 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Library General Public
10 * License as published by the Free Software Foundation; either
11 * version 2 of the License, or (at your option) any later version.
12 *
13 * This library is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * Library General Public License for more details.
17 *
18 * You should have received a copy of the GNU Library General Public License
19 * along with this library; see the file COPYING.LIB. If not, write to
20 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
21 * Boston, MA 02110-1301, USA.
22 *
23 */
24
25 #ifndef RenderStyle_h
26 #define RenderStyle_h
27
28 #include "TransformationMatrix.h"
29 #include "AnimationList.h"
30 #include "BorderData.h"
31 #include "BorderValue.h"
32 #include "CSSHelper.h"
33 #include "CSSImageGeneratorValue.h"
34 #include "CSSPrimitiveValue.h"
35 #include "CSSReflectionDirection.h"
36 #include "CSSValueList.h"
37 #include "CachedImage.h"
38 #include "CollapsedBorderValue.h"
39 #include "Color.h"
40 #include "ColorSpace.h"
41 #include "ContentData.h"
42 #include "CounterDirectives.h"
43 #include "CursorList.h"
44 #include "DataRef.h"
45 #include "FillLayer.h"
46 #include "FloatPoint.h"
47 #include "Font.h"
48 #include "GraphicsTypes.h"
49 #include "IntRect.h"
50 #include "Length.h"
51 #include "LengthBox.h"
52 #include "LengthSize.h"
53 #include "LineClampValue.h"
54 #include "NinePieceImage.h"
55 #include "OutlineValue.h"
56 #include "Pair.h"
57 #include "RenderStyleConstants.h"
58 #include "ShadowData.h"
59 #include "StyleBackgroundData.h"
60 #include "StyleBoxData.h"
61 #include "StyleFlexibleBoxData.h"
62 #include "StyleInheritedData.h"
63 #include "StyleMarqueeData.h"
64 #include "StyleMultiColData.h"
65 #include "StyleRareInheritedData.h"
66 #include "StyleRareNonInheritedData.h"
67 #include "StyleReflection.h"
68 #include "StyleSurroundData.h"
69 #include "StyleTransformData.h"
70 #include "StyleVisualData.h"
71 #include "TextDirection.h"
72 #include "ThemeTypes.h"
73 #include "TimingFunction.h"
74 #include "TransformOperations.h"
75 #include <wtf/OwnPtr.h>
76 #include <wtf/RefCounted.h>
77 #include <wtf/StdLibExtras.h>
78 #include <wtf/Vector.h>
79
80 #if ENABLE(DASHBOARD_SUPPORT)
81 #include "StyleDashboardRegion.h"
82 #endif
83
84 #if ENABLE(SVG)
85 #include "SVGRenderStyle.h"
86 #endif
87
88 #if ENABLE(XBL)
89 #include "BindingURI.h"
90 #endif
91
92 #if COMPILER(WINSCW)
93 #define compareEqual(t, u) ((t) == (u))
94 #else
compareEqual(const T & t,const U & u)95 template<typename T, typename U> inline bool compareEqual(const T& t, const U& u) { return t == static_cast<T>(u); }
96 #endif
97
98 #define SET_VAR(group, variable, value) \
99 if (!compareEqual(group->variable, value)) \
100 group.access()->variable = value;
101
102 namespace WebCore {
103
104 using std::max;
105
106 class CSSStyleSelector;
107 class CSSValueList;
108 class CachedImage;
109 class Pair;
110 class StringImpl;
111 class StyleImage;
112
113 class RenderStyle: public RefCounted<RenderStyle> {
114 friend class CSSStyleSelector;
115 protected:
116
117 // The following bitfield is 32-bits long, which optimizes padding with the
118 // int refCount in the base class. Beware when adding more bits.
119 unsigned m_pseudoState : 3; // PseudoState
120 bool m_affectedByAttributeSelectors : 1;
121 bool m_unique : 1;
122
123 // Bits for dynamic child matching.
124 bool m_affectedByEmpty : 1;
125 bool m_emptyState : 1;
126
127 // We optimize for :first-child and :last-child. The other positional child selectors like nth-child or
128 // *-child-of-type, we will just give up and re-evaluate whenever children change at all.
129 bool m_childrenAffectedByFirstChildRules : 1;
130 bool m_childrenAffectedByLastChildRules : 1;
131 bool m_childrenAffectedByDirectAdjacentRules : 1;
132 bool m_childrenAffectedByForwardPositionalRules : 1;
133 bool m_childrenAffectedByBackwardPositionalRules : 1;
134 bool m_firstChildState : 1;
135 bool m_lastChildState : 1;
136 unsigned m_childIndex : 18; // Plenty of bits to cache an index.
137
138 // non-inherited attributes
139 DataRef<StyleBoxData> box;
140 DataRef<StyleVisualData> visual;
141 DataRef<StyleBackgroundData> background;
142 DataRef<StyleSurroundData> surround;
143 DataRef<StyleRareNonInheritedData> rareNonInheritedData;
144
145 // inherited attributes
146 DataRef<StyleRareInheritedData> rareInheritedData;
147 DataRef<StyleInheritedData> inherited;
148
149 // list of associated pseudo styles
150 RefPtr<RenderStyle> m_cachedPseudoStyle;
151
152 #if ENABLE(SVG)
153 DataRef<SVGRenderStyle> m_svgStyle;
154 #endif
155
156 // !START SYNC!: Keep this in sync with the copy constructor in RenderStyle.cpp
157
158 // inherit
159 struct InheritedFlags {
160 bool operator==(const InheritedFlags& other) const
161 {
162 return (_empty_cells == other._empty_cells) &&
163 (_caption_side == other._caption_side) &&
164 (_list_style_type == other._list_style_type) &&
165 (_list_style_position == other._list_style_position) &&
166 (_visibility == other._visibility) &&
167 (_text_align == other._text_align) &&
168 (_text_transform == other._text_transform) &&
169 (_text_decorations == other._text_decorations) &&
170 (_text_transform == other._text_transform) &&
171 (_cursor_style == other._cursor_style) &&
172 (_direction == other._direction) &&
173 (_border_collapse == other._border_collapse) &&
174 (_white_space == other._white_space) &&
175 (_box_direction == other._box_direction) &&
176 (_visuallyOrdered == other._visuallyOrdered) &&
177 (_htmlHacks == other._htmlHacks) &&
178 (_force_backgrounds_to_white == other._force_backgrounds_to_white) &&
179 (_pointerEvents == other._pointerEvents);
180 }
181
182 bool operator!=(const InheritedFlags& other) const { return !(*this == other); }
183
184 unsigned _empty_cells : 1; // EEmptyCell
185 unsigned _caption_side : 2; // ECaptionSide
186 unsigned _list_style_type : 7; // EListStyleType
187 unsigned _list_style_position : 1; // EListStylePosition
188 unsigned _visibility : 2; // EVisibility
189 unsigned _text_align : 3; // ETextAlign
190 unsigned _text_transform : 2; // ETextTransform
191 unsigned _text_decorations : 4;
192 unsigned _cursor_style : 6; // ECursor
193 unsigned _direction : 1; // TextDirection
194 bool _border_collapse : 1 ;
195 unsigned _white_space : 3; // EWhiteSpace
196 unsigned _box_direction : 1; // EBoxDirection (CSS3 box_direction property, flexible box layout module)
197 // 34 bits
198
199 // non CSS2 inherited
200 bool _visuallyOrdered : 1;
201 bool _htmlHacks : 1;
202 bool _force_backgrounds_to_white : 1;
203 unsigned _pointerEvents : 4; // EPointerEvents
204 // 41 bits
205 } inherited_flags;
206
207 // don't inherit
208 struct NonInheritedFlags {
209 bool operator==(const NonInheritedFlags& other) const
210 {
211 return _effectiveDisplay == other._effectiveDisplay
212 && _originalDisplay == other._originalDisplay
213 && _overflowX == other._overflowX
214 && _overflowY == other._overflowY
215 && _vertical_align == other._vertical_align
216 && _clear == other._clear
217 && _position == other._position
218 && _floating == other._floating
219 && _table_layout == other._table_layout
220 && _page_break_before == other._page_break_before
221 && _page_break_after == other._page_break_after
222 && _page_break_inside == other._page_break_inside
223 && _styleType == other._styleType
224 && _affectedByHover == other._affectedByHover
225 && _affectedByActive == other._affectedByActive
226 && _affectedByDrag == other._affectedByDrag
227 && _pseudoBits == other._pseudoBits
228 && _unicodeBidi == other._unicodeBidi;
229 }
230
231 bool operator!=(const NonInheritedFlags& other) const { return !(*this == other); }
232
233 unsigned _effectiveDisplay : 5; // EDisplay
234 unsigned _originalDisplay : 5; // EDisplay
235 unsigned _overflowX : 3; // EOverflow
236 unsigned _overflowY : 3; // EOverflow
237 unsigned _vertical_align : 4; // EVerticalAlign
238 unsigned _clear : 2; // EClear
239 unsigned _position : 2; // EPosition
240 unsigned _floating : 2; // EFloat
241 unsigned _table_layout : 1; // ETableLayout
242
243 unsigned _page_break_before : 2; // EPageBreak
244 unsigned _page_break_after : 2; // EPageBreak
245 unsigned _page_break_inside : 2; // EPageBreak
246
247 unsigned _styleType : 5; // PseudoId
248 bool _affectedByHover : 1;
249 bool _affectedByActive : 1;
250 bool _affectedByDrag : 1;
251 unsigned _pseudoBits : 7;
252 unsigned _unicodeBidi : 2; // EUnicodeBidi
253 // 50 bits
254 } noninherited_flags;
255
256 // !END SYNC!
257
258 protected:
setBitDefaults()259 void setBitDefaults()
260 {
261 inherited_flags._empty_cells = initialEmptyCells();
262 inherited_flags._caption_side = initialCaptionSide();
263 inherited_flags._list_style_type = initialListStyleType();
264 inherited_flags._list_style_position = initialListStylePosition();
265 inherited_flags._visibility = initialVisibility();
266 inherited_flags._text_align = initialTextAlign();
267 inherited_flags._text_transform = initialTextTransform();
268 inherited_flags._text_decorations = initialTextDecoration();
269 inherited_flags._cursor_style = initialCursor();
270 inherited_flags._direction = initialDirection();
271 inherited_flags._border_collapse = initialBorderCollapse();
272 inherited_flags._white_space = initialWhiteSpace();
273 inherited_flags._visuallyOrdered = initialVisuallyOrdered();
274 inherited_flags._htmlHacks=false;
275 inherited_flags._box_direction = initialBoxDirection();
276 inherited_flags._force_backgrounds_to_white = false;
277 inherited_flags._pointerEvents = initialPointerEvents();
278
279 noninherited_flags._effectiveDisplay = noninherited_flags._originalDisplay = initialDisplay();
280 noninherited_flags._overflowX = initialOverflowX();
281 noninherited_flags._overflowY = initialOverflowY();
282 noninherited_flags._vertical_align = initialVerticalAlign();
283 noninherited_flags._clear = initialClear();
284 noninherited_flags._position = initialPosition();
285 noninherited_flags._floating = initialFloating();
286 noninherited_flags._table_layout = initialTableLayout();
287 noninherited_flags._page_break_before = initialPageBreak();
288 noninherited_flags._page_break_after = initialPageBreak();
289 noninherited_flags._page_break_inside = initialPageBreak();
290 noninherited_flags._styleType = NOPSEUDO;
291 noninherited_flags._affectedByHover = false;
292 noninherited_flags._affectedByActive = false;
293 noninherited_flags._affectedByDrag = false;
294 noninherited_flags._pseudoBits = 0;
295 noninherited_flags._unicodeBidi = initialUnicodeBidi();
296 }
297
298 protected:
299 RenderStyle();
300 // used to create the default style.
301 RenderStyle(bool);
302 RenderStyle(const RenderStyle&);
303
304 public:
305 static PassRefPtr<RenderStyle> create();
306 static PassRefPtr<RenderStyle> createDefaultStyle();
307 static PassRefPtr<RenderStyle> clone(const RenderStyle*);
308
309 ~RenderStyle();
310
311 void inheritFrom(const RenderStyle* inheritParent);
312
styleType()313 PseudoId styleType() const { return static_cast<PseudoId>(noninherited_flags._styleType); }
setStyleType(PseudoId styleType)314 void setStyleType(PseudoId styleType) { noninherited_flags._styleType = styleType; }
315
316 RenderStyle* getCachedPseudoStyle(PseudoId) const;
317 RenderStyle* addCachedPseudoStyle(PassRefPtr<RenderStyle>);
318
319 typedef Vector<RenderStyle*, 10> PseudoStyleCache;
320 void getPseudoStyleCache(PseudoStyleCache&) const;
321
affectedByHoverRules()322 bool affectedByHoverRules() const { return noninherited_flags._affectedByHover; }
affectedByActiveRules()323 bool affectedByActiveRules() const { return noninherited_flags._affectedByActive; }
affectedByDragRules()324 bool affectedByDragRules() const { return noninherited_flags._affectedByDrag; }
325
setAffectedByHoverRules(bool b)326 void setAffectedByHoverRules(bool b) { noninherited_flags._affectedByHover = b; }
setAffectedByActiveRules(bool b)327 void setAffectedByActiveRules(bool b) { noninherited_flags._affectedByActive = b; }
setAffectedByDragRules(bool b)328 void setAffectedByDragRules(bool b) { noninherited_flags._affectedByDrag = b; }
329
330 bool operator==(const RenderStyle& other) const;
331 bool operator!=(const RenderStyle& other) const { return !(*this == other); }
isFloating()332 bool isFloating() const { return !(noninherited_flags._floating == FNONE); }
hasMargin()333 bool hasMargin() const { return surround->margin.nonZero(); }
hasBorder()334 bool hasBorder() const { return surround->border.hasBorder(); }
hasPadding()335 bool hasPadding() const { return surround->padding.nonZero(); }
hasOffset()336 bool hasOffset() const { return surround->offset.nonZero(); }
337
hasBackground()338 bool hasBackground() const
339 {
340 if (backgroundColor().isValid() && backgroundColor().alpha() > 0)
341 return true;
342 return background->m_background.hasImage();
343 }
hasBackgroundImage()344 bool hasBackgroundImage() const { return background->m_background.hasImage(); }
hasFixedBackgroundImage()345 bool hasFixedBackgroundImage() const { return background->m_background.hasFixedImage(); }
hasAppearance()346 bool hasAppearance() const { return appearance() != NoControlPart; }
347
visuallyOrdered()348 bool visuallyOrdered() const { return inherited_flags._visuallyOrdered; }
setVisuallyOrdered(bool b)349 void setVisuallyOrdered(bool b) { inherited_flags._visuallyOrdered = b; }
350
351 bool isStyleAvailable() const;
352
353 bool hasPseudoStyle(PseudoId pseudo) const;
354 void setHasPseudoStyle(PseudoId pseudo);
355
356 // attribute getter methods
357
display()358 EDisplay display() const { return static_cast<EDisplay>(noninherited_flags._effectiveDisplay); }
originalDisplay()359 EDisplay originalDisplay() const { return static_cast<EDisplay>(noninherited_flags._originalDisplay); }
360
left()361 Length left() const { return surround->offset.left(); }
right()362 Length right() const { return surround->offset.right(); }
top()363 Length top() const { return surround->offset.top(); }
bottom()364 Length bottom() const { return surround->offset.bottom(); }
365
366 // Whether or not a positioned element requires normal flow x/y to be computed
367 // to determine its position.
hasStaticX()368 bool hasStaticX() const { return (left().isAuto() && right().isAuto()) || left().isStatic() || right().isStatic(); }
hasStaticY()369 bool hasStaticY() const { return (top().isAuto() && bottom().isAuto()) || top().isStatic(); }
370
position()371 EPosition position() const { return static_cast<EPosition>(noninherited_flags._position); }
floating()372 EFloat floating() const { return static_cast<EFloat>(noninherited_flags._floating); }
373
width()374 Length width() const { return box->width; }
height()375 Length height() const { return box->height; }
minWidth()376 Length minWidth() const { return box->min_width; }
maxWidth()377 Length maxWidth() const { return box->max_width; }
minHeight()378 Length minHeight() const { return box->min_height; }
maxHeight()379 Length maxHeight() const { return box->max_height; }
380
border()381 const BorderData& border() const { return surround->border; }
borderLeft()382 const BorderValue& borderLeft() const { return surround->border.left; }
borderRight()383 const BorderValue& borderRight() const { return surround->border.right; }
borderTop()384 const BorderValue& borderTop() const { return surround->border.top; }
borderBottom()385 const BorderValue& borderBottom() const { return surround->border.bottom; }
386
borderImage()387 const NinePieceImage& borderImage() const { return surround->border.image; }
388
borderTopLeftRadius()389 const IntSize& borderTopLeftRadius() const { return surround->border.topLeft; }
borderTopRightRadius()390 const IntSize& borderTopRightRadius() const { return surround->border.topRight; }
borderBottomLeftRadius()391 const IntSize& borderBottomLeftRadius() const { return surround->border.bottomLeft; }
borderBottomRightRadius()392 const IntSize& borderBottomRightRadius() const { return surround->border.bottomRight; }
hasBorderRadius()393 bool hasBorderRadius() const { return surround->border.hasBorderRadius(); }
394
borderLeftWidth()395 unsigned short borderLeftWidth() const { return surround->border.borderLeftWidth(); }
borderLeftStyle()396 EBorderStyle borderLeftStyle() const { return surround->border.left.style(); }
borderLeftColor()397 const Color& borderLeftColor() const { return surround->border.left.color; }
borderLeftIsTransparent()398 bool borderLeftIsTransparent() const { return surround->border.left.isTransparent(); }
borderRightWidth()399 unsigned short borderRightWidth() const { return surround->border.borderRightWidth(); }
borderRightStyle()400 EBorderStyle borderRightStyle() const { return surround->border.right.style(); }
borderRightColor()401 const Color& borderRightColor() const { return surround->border.right.color; }
borderRightIsTransparent()402 bool borderRightIsTransparent() const { return surround->border.right.isTransparent(); }
borderTopWidth()403 unsigned short borderTopWidth() const { return surround->border.borderTopWidth(); }
borderTopStyle()404 EBorderStyle borderTopStyle() const { return surround->border.top.style(); }
borderTopColor()405 const Color& borderTopColor() const { return surround->border.top.color; }
borderTopIsTransparent()406 bool borderTopIsTransparent() const { return surround->border.top.isTransparent(); }
borderBottomWidth()407 unsigned short borderBottomWidth() const { return surround->border.borderBottomWidth(); }
borderBottomStyle()408 EBorderStyle borderBottomStyle() const { return surround->border.bottom.style(); }
borderBottomColor()409 const Color& borderBottomColor() const { return surround->border.bottom.color; }
borderBottomIsTransparent()410 bool borderBottomIsTransparent() const { return surround->border.bottom.isTransparent(); }
411
outlineSize()412 unsigned short outlineSize() const { return max(0, outlineWidth() + outlineOffset()); }
outlineWidth()413 unsigned short outlineWidth() const
414 {
415 if (background->m_outline.style() == BNONE)
416 return 0;
417 return background->m_outline.width;
418 }
hasOutline()419 bool hasOutline() const { return outlineWidth() > 0 && outlineStyle() > BHIDDEN; }
outlineStyle()420 EBorderStyle outlineStyle() const { return background->m_outline.style(); }
outlineStyleIsAuto()421 bool outlineStyleIsAuto() const { return background->m_outline._auto; }
outlineColor()422 const Color& outlineColor() const { return background->m_outline.color; }
423
overflowX()424 EOverflow overflowX() const { return static_cast<EOverflow>(noninherited_flags._overflowX); }
overflowY()425 EOverflow overflowY() const { return static_cast<EOverflow>(noninherited_flags._overflowY); }
426
visibility()427 EVisibility visibility() const { return static_cast<EVisibility>(inherited_flags._visibility); }
verticalAlign()428 EVerticalAlign verticalAlign() const { return static_cast<EVerticalAlign>(noninherited_flags._vertical_align); }
verticalAlignLength()429 Length verticalAlignLength() const { return box->vertical_align; }
430
clipLeft()431 Length clipLeft() const { return visual->clip.left(); }
clipRight()432 Length clipRight() const { return visual->clip.right(); }
clipTop()433 Length clipTop() const { return visual->clip.top(); }
clipBottom()434 Length clipBottom() const { return visual->clip.bottom(); }
clip()435 LengthBox clip() const { return visual->clip; }
hasClip()436 bool hasClip() const { return visual->hasClip; }
437
unicodeBidi()438 EUnicodeBidi unicodeBidi() const { return static_cast<EUnicodeBidi>(noninherited_flags._unicodeBidi); }
439
clear()440 EClear clear() const { return static_cast<EClear>(noninherited_flags._clear); }
tableLayout()441 ETableLayout tableLayout() const { return static_cast<ETableLayout>(noninherited_flags._table_layout); }
442
font()443 const Font& font() const { return inherited->font; }
fontDescription()444 const FontDescription& fontDescription() const { return inherited->font.fontDescription(); }
fontSize()445 int fontSize() const { return inherited->font.pixelSize(); }
446
color()447 const Color& color() const { return inherited->color; }
textIndent()448 Length textIndent() const { return inherited->indent; }
textAlign()449 ETextAlign textAlign() const { return static_cast<ETextAlign>(inherited_flags._text_align); }
textTransform()450 ETextTransform textTransform() const { return static_cast<ETextTransform>(inherited_flags._text_transform); }
textDecorationsInEffect()451 int textDecorationsInEffect() const { return inherited_flags._text_decorations; }
textDecoration()452 int textDecoration() const { return visual->textDecoration; }
wordSpacing()453 int wordSpacing() const { return inherited->font.wordSpacing(); }
letterSpacing()454 int letterSpacing() const { return inherited->font.letterSpacing(); }
455
zoom()456 float zoom() const { return visual->m_zoom; }
effectiveZoom()457 float effectiveZoom() const { return inherited->m_effectiveZoom; }
458
direction()459 TextDirection direction() const { return static_cast<TextDirection>(inherited_flags._direction); }
lineHeight()460 Length lineHeight() const { return inherited->line_height; }
computedLineHeight()461 int computedLineHeight() const
462 {
463 Length lh = lineHeight();
464
465 // Negative value means the line height is not set. Use the font's built-in spacing.
466 if (lh.isNegative())
467 return font().lineSpacing();
468
469 if (lh.isPercent())
470 return lh.calcMinValue(fontSize());
471
472 return lh.value();
473 }
474
whiteSpace()475 EWhiteSpace whiteSpace() const { return static_cast<EWhiteSpace>(inherited_flags._white_space); }
autoWrap(EWhiteSpace ws)476 static bool autoWrap(EWhiteSpace ws)
477 {
478 // Nowrap and pre don't automatically wrap.
479 return ws != NOWRAP && ws != PRE;
480 }
481
autoWrap()482 bool autoWrap() const
483 {
484 return autoWrap(whiteSpace());
485 }
486
preserveNewline(EWhiteSpace ws)487 static bool preserveNewline(EWhiteSpace ws)
488 {
489 // Normal and nowrap do not preserve newlines.
490 return ws != NORMAL && ws != NOWRAP;
491 }
492
preserveNewline()493 bool preserveNewline() const
494 {
495 return preserveNewline(whiteSpace());
496 }
497
collapseWhiteSpace(EWhiteSpace ws)498 static bool collapseWhiteSpace(EWhiteSpace ws)
499 {
500 // Pre and prewrap do not collapse whitespace.
501 return ws != PRE && ws != PRE_WRAP;
502 }
503
collapseWhiteSpace()504 bool collapseWhiteSpace() const
505 {
506 return collapseWhiteSpace(whiteSpace());
507 }
508
isCollapsibleWhiteSpace(UChar c)509 bool isCollapsibleWhiteSpace(UChar c) const
510 {
511 switch (c) {
512 case ' ':
513 case '\t':
514 return collapseWhiteSpace();
515 case '\n':
516 return !preserveNewline();
517 }
518 return false;
519 }
520
breakOnlyAfterWhiteSpace()521 bool breakOnlyAfterWhiteSpace() const
522 {
523 return whiteSpace() == PRE_WRAP || khtmlLineBreak() == AFTER_WHITE_SPACE;
524 }
525
breakWords()526 bool breakWords() const
527 {
528 return wordBreak() == BreakWordBreak || wordWrap() == BreakWordWrap;
529 }
530
backgroundColor()531 const Color& backgroundColor() const { return background->m_color; }
backgroundImage()532 StyleImage* backgroundImage() const { return background->m_background.m_image.get(); }
backgroundRepeatX()533 EFillRepeat backgroundRepeatX() const { return static_cast<EFillRepeat>(background->m_background.m_repeatX); }
backgroundRepeatY()534 EFillRepeat backgroundRepeatY() const { return static_cast<EFillRepeat>(background->m_background.m_repeatY); }
backgroundComposite()535 CompositeOperator backgroundComposite() const { return static_cast<CompositeOperator>(background->m_background.m_composite); }
backgroundAttachment()536 EFillAttachment backgroundAttachment() const { return static_cast<EFillAttachment>(background->m_background.m_attachment); }
backgroundClip()537 EFillBox backgroundClip() const { return static_cast<EFillBox>(background->m_background.m_clip); }
backgroundOrigin()538 EFillBox backgroundOrigin() const { return static_cast<EFillBox>(background->m_background.m_origin); }
backgroundXPosition()539 Length backgroundXPosition() const { return background->m_background.m_xPosition; }
backgroundYPosition()540 Length backgroundYPosition() const { return background->m_background.m_yPosition; }
backgroundSizeType()541 EFillSizeType backgroundSizeType() const { return static_cast<EFillSizeType>(background->m_background.m_sizeType); }
backgroundSizeLength()542 LengthSize backgroundSizeLength() const { return background->m_background.m_sizeLength; }
accessBackgroundLayers()543 FillLayer* accessBackgroundLayers() { return &(background.access()->m_background); }
backgroundLayers()544 const FillLayer* backgroundLayers() const { return &(background->m_background); }
545
maskImage()546 StyleImage* maskImage() const { return rareNonInheritedData->m_mask.m_image.get(); }
maskRepeatX()547 EFillRepeat maskRepeatX() const { return static_cast<EFillRepeat>(rareNonInheritedData->m_mask.m_repeatX); }
maskRepeatY()548 EFillRepeat maskRepeatY() const { return static_cast<EFillRepeat>(rareNonInheritedData->m_mask.m_repeatY); }
maskComposite()549 CompositeOperator maskComposite() const { return static_cast<CompositeOperator>(rareNonInheritedData->m_mask.m_composite); }
maskAttachment()550 EFillAttachment maskAttachment() const { return static_cast<EFillAttachment>(rareNonInheritedData->m_mask.m_attachment); }
maskClip()551 EFillBox maskClip() const { return static_cast<EFillBox>(rareNonInheritedData->m_mask.m_clip); }
maskOrigin()552 EFillBox maskOrigin() const { return static_cast<EFillBox>(rareNonInheritedData->m_mask.m_origin); }
maskXPosition()553 Length maskXPosition() const { return rareNonInheritedData->m_mask.m_xPosition; }
maskYPosition()554 Length maskYPosition() const { return rareNonInheritedData->m_mask.m_yPosition; }
maskSize()555 LengthSize maskSize() const { return rareNonInheritedData->m_mask.m_sizeLength; }
accessMaskLayers()556 FillLayer* accessMaskLayers() { return &(rareNonInheritedData.access()->m_mask); }
maskLayers()557 const FillLayer* maskLayers() const { return &(rareNonInheritedData->m_mask); }
maskBoxImage()558 const NinePieceImage& maskBoxImage() const { return rareNonInheritedData->m_maskBoxImage; }
559
560 // returns true for collapsing borders, false for separate borders
borderCollapse()561 bool borderCollapse() const { return inherited_flags._border_collapse; }
horizontalBorderSpacing()562 short horizontalBorderSpacing() const { return inherited->horizontal_border_spacing; }
verticalBorderSpacing()563 short verticalBorderSpacing() const { return inherited->vertical_border_spacing; }
emptyCells()564 EEmptyCell emptyCells() const { return static_cast<EEmptyCell>(inherited_flags._empty_cells); }
captionSide()565 ECaptionSide captionSide() const { return static_cast<ECaptionSide>(inherited_flags._caption_side); }
566
counterIncrement()567 short counterIncrement() const { return visual->counterIncrement; }
counterReset()568 short counterReset() const { return visual->counterReset; }
569
listStyleType()570 EListStyleType listStyleType() const { return static_cast<EListStyleType>(inherited_flags._list_style_type); }
listStyleImage()571 StyleImage* listStyleImage() const { return inherited->list_style_image.get(); }
listStylePosition()572 EListStylePosition listStylePosition() const { return static_cast<EListStylePosition>(inherited_flags._list_style_position); }
573
marginTop()574 Length marginTop() const { return surround->margin.top(); }
marginBottom()575 Length marginBottom() const { return surround->margin.bottom(); }
marginLeft()576 Length marginLeft() const { return surround->margin.left(); }
marginRight()577 Length marginRight() const { return surround->margin.right(); }
578
paddingBox()579 LengthBox paddingBox() const { return surround->padding; }
paddingTop()580 Length paddingTop() const { return surround->padding.top(); }
paddingBottom()581 Length paddingBottom() const { return surround->padding.bottom(); }
paddingLeft()582 Length paddingLeft() const { return surround->padding.left(); }
paddingRight()583 Length paddingRight() const { return surround->padding.right(); }
584
cursor()585 ECursor cursor() const { return static_cast<ECursor>(inherited_flags._cursor_style); }
586
cursors()587 CursorList* cursors() const { return inherited->cursorData.get(); }
588
widows()589 short widows() const { return inherited->widows; }
orphans()590 short orphans() const { return inherited->orphans; }
pageBreakInside()591 EPageBreak pageBreakInside() const { return static_cast<EPageBreak>(noninherited_flags._page_break_inside); }
pageBreakBefore()592 EPageBreak pageBreakBefore() const { return static_cast<EPageBreak>(noninherited_flags._page_break_before); }
pageBreakAfter()593 EPageBreak pageBreakAfter() const { return static_cast<EPageBreak>(noninherited_flags._page_break_after); }
594
595 // CSS3 Getter Methods
596 #if ENABLE(XBL)
bindingURIs()597 BindingURI* bindingURIs() const { return rareNonInheritedData->bindingURI; }
598 #endif
599
outlineOffset()600 int outlineOffset() const
601 {
602 if (background->m_outline.style() == BNONE)
603 return 0;
604 return background->m_outline._offset;
605 }
606
textShadow()607 ShadowData* textShadow() const { return rareInheritedData->textShadow; }
textStrokeColor()608 const Color& textStrokeColor() const { return rareInheritedData->textStrokeColor; }
textStrokeWidth()609 float textStrokeWidth() const { return rareInheritedData->textStrokeWidth; }
textFillColor()610 const Color& textFillColor() const { return rareInheritedData->textFillColor; }
colorSpace()611 ColorSpace colorSpace() const { return static_cast<ColorSpace>(rareInheritedData->colorSpace); }
opacity()612 float opacity() const { return rareNonInheritedData->opacity; }
appearance()613 ControlPart appearance() const { return static_cast<ControlPart>(rareNonInheritedData->m_appearance); }
boxAlign()614 EBoxAlignment boxAlign() const { return static_cast<EBoxAlignment>(rareNonInheritedData->flexibleBox->align); }
boxDirection()615 EBoxDirection boxDirection() const { return static_cast<EBoxDirection>(inherited_flags._box_direction); }
boxFlex()616 float boxFlex() { return rareNonInheritedData->flexibleBox->flex; }
boxFlexGroup()617 unsigned int boxFlexGroup() const { return rareNonInheritedData->flexibleBox->flex_group; }
boxLines()618 EBoxLines boxLines() { return static_cast<EBoxLines>(rareNonInheritedData->flexibleBox->lines); }
boxOrdinalGroup()619 unsigned int boxOrdinalGroup() const { return rareNonInheritedData->flexibleBox->ordinal_group; }
boxOrient()620 EBoxOrient boxOrient() const { return static_cast<EBoxOrient>(rareNonInheritedData->flexibleBox->orient); }
boxPack()621 EBoxAlignment boxPack() const { return static_cast<EBoxAlignment>(rareNonInheritedData->flexibleBox->pack); }
622
boxShadow()623 ShadowData* boxShadow() const { return rareNonInheritedData->m_boxShadow.get(); }
624 void getBoxShadowExtent(int &top, int &right, int &bottom, int &left) const;
625 void getBoxShadowHorizontalExtent(int &left, int &right) const;
626 void getBoxShadowVerticalExtent(int &top, int &bottom) const;
627
boxReflect()628 StyleReflection* boxReflect() const { return rareNonInheritedData->m_boxReflect.get(); }
boxSizing()629 EBoxSizing boxSizing() const { return static_cast<EBoxSizing>(box->boxSizing); }
marqueeIncrement()630 Length marqueeIncrement() const { return rareNonInheritedData->marquee->increment; }
marqueeSpeed()631 int marqueeSpeed() const { return rareNonInheritedData->marquee->speed; }
marqueeLoopCount()632 int marqueeLoopCount() const { return rareNonInheritedData->marquee->loops; }
marqueeBehavior()633 EMarqueeBehavior marqueeBehavior() const { return static_cast<EMarqueeBehavior>(rareNonInheritedData->marquee->behavior); }
marqueeDirection()634 EMarqueeDirection marqueeDirection() const { return static_cast<EMarqueeDirection>(rareNonInheritedData->marquee->direction); }
userModify()635 EUserModify userModify() const { return static_cast<EUserModify>(rareInheritedData->userModify); }
userDrag()636 EUserDrag userDrag() const { return static_cast<EUserDrag>(rareNonInheritedData->userDrag); }
userSelect()637 EUserSelect userSelect() const { return static_cast<EUserSelect>(rareInheritedData->userSelect); }
textOverflow()638 bool textOverflow() const { return rareNonInheritedData->textOverflow; }
marginTopCollapse()639 EMarginCollapse marginTopCollapse() const { return static_cast<EMarginCollapse>(rareNonInheritedData->marginTopCollapse); }
marginBottomCollapse()640 EMarginCollapse marginBottomCollapse() const { return static_cast<EMarginCollapse>(rareNonInheritedData->marginBottomCollapse); }
wordBreak()641 EWordBreak wordBreak() const { return static_cast<EWordBreak>(rareInheritedData->wordBreak); }
wordWrap()642 EWordWrap wordWrap() const { return static_cast<EWordWrap>(rareInheritedData->wordWrap); }
nbspMode()643 ENBSPMode nbspMode() const { return static_cast<ENBSPMode>(rareInheritedData->nbspMode); }
khtmlLineBreak()644 EKHTMLLineBreak khtmlLineBreak() const { return static_cast<EKHTMLLineBreak>(rareInheritedData->khtmlLineBreak); }
matchNearestMailBlockquoteColor()645 EMatchNearestMailBlockquoteColor matchNearestMailBlockquoteColor() const { return static_cast<EMatchNearestMailBlockquoteColor>(rareNonInheritedData->matchNearestMailBlockquoteColor); }
highlight()646 const AtomicString& highlight() const { return rareInheritedData->highlight; }
borderFit()647 EBorderFit borderFit() const { return static_cast<EBorderFit>(rareNonInheritedData->m_borderFit); }
resize()648 EResize resize() const { return static_cast<EResize>(rareInheritedData->resize); }
columnWidth()649 float columnWidth() const { return rareNonInheritedData->m_multiCol->m_width; }
hasAutoColumnWidth()650 bool hasAutoColumnWidth() const { return rareNonInheritedData->m_multiCol->m_autoWidth; }
columnCount()651 unsigned short columnCount() const { return rareNonInheritedData->m_multiCol->m_count; }
hasAutoColumnCount()652 bool hasAutoColumnCount() const { return rareNonInheritedData->m_multiCol->m_autoCount; }
columnGap()653 float columnGap() const { return rareNonInheritedData->m_multiCol->m_gap; }
hasNormalColumnGap()654 bool hasNormalColumnGap() const { return rareNonInheritedData->m_multiCol->m_normalGap; }
columnRuleColor()655 const Color& columnRuleColor() const { return rareNonInheritedData->m_multiCol->m_rule.color; }
columnRuleStyle()656 EBorderStyle columnRuleStyle() const { return rareNonInheritedData->m_multiCol->m_rule.style(); }
columnRuleWidth()657 unsigned short columnRuleWidth() const { return rareNonInheritedData->m_multiCol->ruleWidth(); }
columnRuleIsTransparent()658 bool columnRuleIsTransparent() const { return rareNonInheritedData->m_multiCol->m_rule.isTransparent(); }
columnBreakBefore()659 EPageBreak columnBreakBefore() const { return static_cast<EPageBreak>(rareNonInheritedData->m_multiCol->m_breakBefore); }
columnBreakInside()660 EPageBreak columnBreakInside() const { return static_cast<EPageBreak>(rareNonInheritedData->m_multiCol->m_breakInside); }
columnBreakAfter()661 EPageBreak columnBreakAfter() const { return static_cast<EPageBreak>(rareNonInheritedData->m_multiCol->m_breakAfter); }
transform()662 const TransformOperations& transform() const { return rareNonInheritedData->m_transform->m_operations; }
transformOriginX()663 Length transformOriginX() const { return rareNonInheritedData->m_transform->m_x; }
transformOriginY()664 Length transformOriginY() const { return rareNonInheritedData->m_transform->m_y; }
transformOriginZ()665 float transformOriginZ() const { return rareNonInheritedData->m_transform->m_z; }
hasTransform()666 bool hasTransform() const { return !rareNonInheritedData->m_transform->m_operations.operations().isEmpty(); }
667
668 // Return true if any transform related property (currently transform, transformStyle3D or perspective)
669 // indicates that we are transforming
hasTransformRelatedProperty()670 bool hasTransformRelatedProperty() const { return hasTransform() || preserves3D() || hasPerspective(); }
671
672 enum ApplyTransformOrigin { IncludeTransformOrigin, ExcludeTransformOrigin };
673 void applyTransform(TransformationMatrix&, const IntSize& borderBoxSize, ApplyTransformOrigin = IncludeTransformOrigin) const;
674
hasMask()675 bool hasMask() const { return rareNonInheritedData->m_mask.hasImage() || rareNonInheritedData->m_maskBoxImage.hasImage(); }
676 // End CSS3 Getters
677
678 // Apple-specific property getter methods
pointerEvents()679 EPointerEvents pointerEvents() const { return static_cast<EPointerEvents>(inherited_flags._pointerEvents); }
animations()680 const AnimationList* animations() const { return rareNonInheritedData->m_animations.get(); }
transitions()681 const AnimationList* transitions() const { return rareNonInheritedData->m_transitions.get(); }
682
683 AnimationList* accessAnimations();
684 AnimationList* accessTransitions();
685
hasAnimations()686 bool hasAnimations() const { return rareNonInheritedData->m_animations && rareNonInheritedData->m_animations->size() > 0; }
hasTransitions()687 bool hasTransitions() const { return rareNonInheritedData->m_transitions && rareNonInheritedData->m_transitions->size() > 0; }
688
689 // return the first found Animation (including 'all' transitions)
690 const Animation* transitionForProperty(int property) const;
691
transformStyle3D()692 ETransformStyle3D transformStyle3D() const { return rareNonInheritedData->m_transformStyle3D; }
preserves3D()693 bool preserves3D() const { return rareNonInheritedData->m_transformStyle3D == TransformStyle3DPreserve3D; }
694
backfaceVisibility()695 EBackfaceVisibility backfaceVisibility() const { return rareNonInheritedData->m_backfaceVisibility; }
perspective()696 float perspective() const { return rareNonInheritedData->m_perspective; }
hasPerspective()697 bool hasPerspective() const { return rareNonInheritedData->m_perspective > 0; }
perspectiveOriginX()698 Length perspectiveOriginX() const { return rareNonInheritedData->m_perspectiveOriginX; }
perspectiveOriginY()699 Length perspectiveOriginY() const { return rareNonInheritedData->m_perspectiveOriginY; }
700
701 #if USE(ACCELERATED_COMPOSITING)
702 // When set, this ensures that styles compare as different. Used during accelerated animations.
isRunningAcceleratedAnimation()703 bool isRunningAcceleratedAnimation() const { return rareNonInheritedData->m_runningAcceleratedAnimation; }
704 #endif
705
lineClamp()706 const LineClampValue& lineClamp() const { return rareNonInheritedData->lineClamp; }
textSizeAdjust()707 bool textSizeAdjust() const { return rareInheritedData->textSizeAdjust; }
textSecurity()708 ETextSecurity textSecurity() const { return static_cast<ETextSecurity>(rareInheritedData->textSecurity); }
709
710 #ifdef ANDROID_CSS_TAP_HIGHLIGHT_COLOR
tapHighlightColor()711 Color tapHighlightColor() const { return rareInheritedData->tapHighlightColor; }
712 #endif
713
714 // attribute setter methods
715
setDisplay(EDisplay v)716 void setDisplay(EDisplay v) { noninherited_flags._effectiveDisplay = v; }
setOriginalDisplay(EDisplay v)717 void setOriginalDisplay(EDisplay v) { noninherited_flags._originalDisplay = v; }
setPosition(EPosition v)718 void setPosition(EPosition v) { noninherited_flags._position = v; }
setFloating(EFloat v)719 void setFloating(EFloat v) { noninherited_flags._floating = v; }
720
setLeft(Length v)721 void setLeft(Length v) { SET_VAR(surround, offset.m_left, v) }
setRight(Length v)722 void setRight(Length v) { SET_VAR(surround, offset.m_right, v) }
setTop(Length v)723 void setTop(Length v) { SET_VAR(surround, offset.m_top, v) }
setBottom(Length v)724 void setBottom(Length v) { SET_VAR(surround, offset.m_bottom, v) }
725
setWidth(Length v)726 void setWidth(Length v) { SET_VAR(box, width, v) }
setHeight(Length v)727 void setHeight(Length v) { SET_VAR(box, height, v) }
728
setMinWidth(Length v)729 void setMinWidth(Length v) { SET_VAR(box, min_width, v) }
setMaxWidth(Length v)730 void setMaxWidth(Length v) { SET_VAR(box, max_width, v) }
setMinHeight(Length v)731 void setMinHeight(Length v) { SET_VAR(box, min_height, v) }
setMaxHeight(Length v)732 void setMaxHeight(Length v) { SET_VAR(box, max_height, v) }
733
734 #if ENABLE(DASHBOARD_SUPPORT)
dashboardRegions()735 Vector<StyleDashboardRegion> dashboardRegions() const { return rareNonInheritedData->m_dashboardRegions; }
setDashboardRegions(Vector<StyleDashboardRegion> regions)736 void setDashboardRegions(Vector<StyleDashboardRegion> regions) { SET_VAR(rareNonInheritedData, m_dashboardRegions, regions); }
737
setDashboardRegion(int type,const String & label,Length t,Length r,Length b,Length l,bool append)738 void setDashboardRegion(int type, const String& label, Length t, Length r, Length b, Length l, bool append)
739 {
740 StyleDashboardRegion region;
741 region.label = label;
742 region.offset.m_top = t;
743 region.offset.m_right = r;
744 region.offset.m_bottom = b;
745 region.offset.m_left = l;
746 region.type = type;
747 if (!append)
748 rareNonInheritedData.access()->m_dashboardRegions.clear();
749 rareNonInheritedData.access()->m_dashboardRegions.append(region);
750 }
751 #endif
752
resetBorder()753 void resetBorder() { resetBorderImage(); resetBorderTop(); resetBorderRight(); resetBorderBottom(); resetBorderLeft(); resetBorderRadius(); }
resetBorderTop()754 void resetBorderTop() { SET_VAR(surround, border.top, BorderValue()) }
resetBorderRight()755 void resetBorderRight() { SET_VAR(surround, border.right, BorderValue()) }
resetBorderBottom()756 void resetBorderBottom() { SET_VAR(surround, border.bottom, BorderValue()) }
resetBorderLeft()757 void resetBorderLeft() { SET_VAR(surround, border.left, BorderValue()) }
resetBorderImage()758 void resetBorderImage() { SET_VAR(surround, border.image, NinePieceImage()) }
resetBorderRadius()759 void resetBorderRadius() { resetBorderTopLeftRadius(); resetBorderTopRightRadius(); resetBorderBottomLeftRadius(); resetBorderBottomRightRadius(); }
resetBorderTopLeftRadius()760 void resetBorderTopLeftRadius() { SET_VAR(surround, border.topLeft, initialBorderRadius()) }
resetBorderTopRightRadius()761 void resetBorderTopRightRadius() { SET_VAR(surround, border.topRight, initialBorderRadius()) }
resetBorderBottomLeftRadius()762 void resetBorderBottomLeftRadius() { SET_VAR(surround, border.bottomLeft, initialBorderRadius()) }
resetBorderBottomRightRadius()763 void resetBorderBottomRightRadius() { SET_VAR(surround, border.bottomRight, initialBorderRadius()) }
764
resetOutline()765 void resetOutline() { SET_VAR(background, m_outline, OutlineValue()) }
766
setBackgroundColor(const Color & v)767 void setBackgroundColor(const Color& v) { SET_VAR(background, m_color, v) }
768
setBackgroundXPosition(Length l)769 void setBackgroundXPosition(Length l) { SET_VAR(background, m_background.m_xPosition, l) }
setBackgroundYPosition(Length l)770 void setBackgroundYPosition(Length l) { SET_VAR(background, m_background.m_yPosition, l) }
setBackgroundSize(EFillSizeType b)771 void setBackgroundSize(EFillSizeType b) { SET_VAR(background, m_background.m_sizeType, b) }
setBackgroundSizeLength(LengthSize l)772 void setBackgroundSizeLength(LengthSize l) { SET_VAR(background, m_background.m_sizeLength, l) }
773
setBorderImage(const NinePieceImage & b)774 void setBorderImage(const NinePieceImage& b) { SET_VAR(surround, border.image, b) }
775
setBorderTopLeftRadius(const IntSize & s)776 void setBorderTopLeftRadius(const IntSize& s) { SET_VAR(surround, border.topLeft, s) }
setBorderTopRightRadius(const IntSize & s)777 void setBorderTopRightRadius(const IntSize& s) { SET_VAR(surround, border.topRight, s) }
setBorderBottomLeftRadius(const IntSize & s)778 void setBorderBottomLeftRadius(const IntSize& s) { SET_VAR(surround, border.bottomLeft, s) }
setBorderBottomRightRadius(const IntSize & s)779 void setBorderBottomRightRadius(const IntSize& s) { SET_VAR(surround, border.bottomRight, s) }
780
setBorderRadius(const IntSize & s)781 void setBorderRadius(const IntSize& s)
782 {
783 setBorderTopLeftRadius(s);
784 setBorderTopRightRadius(s);
785 setBorderBottomLeftRadius(s);
786 setBorderBottomRightRadius(s);
787 }
788
789 void getBorderRadiiForRect(const IntRect&, IntSize& topLeft, IntSize& topRight, IntSize& bottomLeft, IntSize& bottomRight) const;
790
setBorderLeftWidth(unsigned short v)791 void setBorderLeftWidth(unsigned short v) { SET_VAR(surround, border.left.width, v) }
setBorderLeftStyle(EBorderStyle v)792 void setBorderLeftStyle(EBorderStyle v) { SET_VAR(surround, border.left.m_style, v) }
setBorderLeftColor(const Color & v)793 void setBorderLeftColor(const Color& v) { SET_VAR(surround, border.left.color, v) }
setBorderRightWidth(unsigned short v)794 void setBorderRightWidth(unsigned short v) { SET_VAR(surround, border.right.width, v) }
setBorderRightStyle(EBorderStyle v)795 void setBorderRightStyle(EBorderStyle v) { SET_VAR(surround, border.right.m_style, v) }
setBorderRightColor(const Color & v)796 void setBorderRightColor(const Color& v) { SET_VAR(surround, border.right.color, v) }
setBorderTopWidth(unsigned short v)797 void setBorderTopWidth(unsigned short v) { SET_VAR(surround, border.top.width, v) }
setBorderTopStyle(EBorderStyle v)798 void setBorderTopStyle(EBorderStyle v) { SET_VAR(surround, border.top.m_style, v) }
setBorderTopColor(const Color & v)799 void setBorderTopColor(const Color& v) { SET_VAR(surround, border.top.color, v) }
setBorderBottomWidth(unsigned short v)800 void setBorderBottomWidth(unsigned short v) { SET_VAR(surround, border.bottom.width, v) }
setBorderBottomStyle(EBorderStyle v)801 void setBorderBottomStyle(EBorderStyle v) { SET_VAR(surround, border.bottom.m_style, v) }
setBorderBottomColor(const Color & v)802 void setBorderBottomColor(const Color& v) { SET_VAR(surround, border.bottom.color, v) }
setOutlineWidth(unsigned short v)803 void setOutlineWidth(unsigned short v) { SET_VAR(background, m_outline.width, v) }
804
805 void setOutlineStyle(EBorderStyle v, bool isAuto = false)
806 {
807 SET_VAR(background, m_outline.m_style, v)
808 SET_VAR(background, m_outline._auto, isAuto)
809 }
810
setOutlineColor(const Color & v)811 void setOutlineColor(const Color& v) { SET_VAR(background, m_outline.color, v) }
812
setOverflowX(EOverflow v)813 void setOverflowX(EOverflow v) { noninherited_flags._overflowX = v; }
setOverflowY(EOverflow v)814 void setOverflowY(EOverflow v) { noninherited_flags._overflowY = v; }
setVisibility(EVisibility v)815 void setVisibility(EVisibility v) { inherited_flags._visibility = v; }
setVerticalAlign(EVerticalAlign v)816 void setVerticalAlign(EVerticalAlign v) { noninherited_flags._vertical_align = v; }
setVerticalAlignLength(Length l)817 void setVerticalAlignLength(Length l) { SET_VAR(box, vertical_align, l) }
818
819 void setHasClip(bool b = true) { SET_VAR(visual, hasClip, b) }
setClipLeft(Length v)820 void setClipLeft(Length v) { SET_VAR(visual, clip.m_left, v) }
setClipRight(Length v)821 void setClipRight(Length v) { SET_VAR(visual, clip.m_right, v) }
setClipTop(Length v)822 void setClipTop(Length v) { SET_VAR(visual, clip.m_top, v) }
setClipBottom(Length v)823 void setClipBottom(Length v) { SET_VAR(visual, clip.m_bottom, v) }
824 void setClip(Length top, Length right, Length bottom, Length left);
825
setUnicodeBidi(EUnicodeBidi b)826 void setUnicodeBidi(EUnicodeBidi b) { noninherited_flags._unicodeBidi = b; }
827
setClear(EClear v)828 void setClear(EClear v) { noninherited_flags._clear = v; }
setTableLayout(ETableLayout v)829 void setTableLayout(ETableLayout v) { noninherited_flags._table_layout = v; }
830
setFontDescription(const FontDescription & v)831 bool setFontDescription(const FontDescription& v)
832 {
833 if (inherited->font.fontDescription() != v) {
834 inherited.access()->font = Font(v, inherited->font.letterSpacing(), inherited->font.wordSpacing());
835 return true;
836 }
837 return false;
838 }
839
840 // Only used for blending font sizes when animating.
841 void setBlendedFontSize(int);
842
setColor(const Color & v)843 void setColor(const Color& v) { SET_VAR(inherited, color, v) }
setTextIndent(Length v)844 void setTextIndent(Length v) { SET_VAR(inherited, indent, v) }
setTextAlign(ETextAlign v)845 void setTextAlign(ETextAlign v) { inherited_flags._text_align = v; }
setTextTransform(ETextTransform v)846 void setTextTransform(ETextTransform v) { inherited_flags._text_transform = v; }
addToTextDecorationsInEffect(int v)847 void addToTextDecorationsInEffect(int v) { inherited_flags._text_decorations |= v; }
setTextDecorationsInEffect(int v)848 void setTextDecorationsInEffect(int v) { inherited_flags._text_decorations = v; }
setTextDecoration(int v)849 void setTextDecoration(int v) { SET_VAR(visual, textDecoration, v); }
setDirection(TextDirection v)850 void setDirection(TextDirection v) { inherited_flags._direction = v; }
setLineHeight(Length v)851 void setLineHeight(Length v) { SET_VAR(inherited, line_height, v) }
setZoom(float f)852 void setZoom(float f) { SET_VAR(visual, m_zoom, f); setEffectiveZoom(effectiveZoom() * zoom()); }
setEffectiveZoom(float f)853 void setEffectiveZoom(float f) { SET_VAR(inherited, m_effectiveZoom, f) }
854
setWhiteSpace(EWhiteSpace v)855 void setWhiteSpace(EWhiteSpace v) { inherited_flags._white_space = v; }
856
setWordSpacing(int v)857 void setWordSpacing(int v) { inherited.access()->font.setWordSpacing(v); }
setLetterSpacing(int v)858 void setLetterSpacing(int v) { inherited.access()->font.setLetterSpacing(v); }
859
clearBackgroundLayers()860 void clearBackgroundLayers() { background.access()->m_background = FillLayer(BackgroundFillLayer); }
inheritBackgroundLayers(const FillLayer & parent)861 void inheritBackgroundLayers(const FillLayer& parent) { background.access()->m_background = parent; }
862
adjustBackgroundLayers()863 void adjustBackgroundLayers()
864 {
865 if (backgroundLayers()->next()) {
866 accessBackgroundLayers()->cullEmptyLayers();
867 accessBackgroundLayers()->fillUnsetProperties();
868 }
869 }
870
clearMaskLayers()871 void clearMaskLayers() { rareNonInheritedData.access()->m_mask = FillLayer(MaskFillLayer); }
inheritMaskLayers(const FillLayer & parent)872 void inheritMaskLayers(const FillLayer& parent) { rareNonInheritedData.access()->m_mask = parent; }
873
adjustMaskLayers()874 void adjustMaskLayers()
875 {
876 if (maskLayers()->next()) {
877 accessMaskLayers()->cullEmptyLayers();
878 accessMaskLayers()->fillUnsetProperties();
879 }
880 }
881
setMaskBoxImage(const NinePieceImage & b)882 void setMaskBoxImage(const NinePieceImage& b) { SET_VAR(rareNonInheritedData, m_maskBoxImage, b) }
setMaskXPosition(Length l)883 void setMaskXPosition(Length l) { SET_VAR(rareNonInheritedData, m_mask.m_xPosition, l) }
setMaskYPosition(Length l)884 void setMaskYPosition(Length l) { SET_VAR(rareNonInheritedData, m_mask.m_yPosition, l) }
setMaskSize(LengthSize l)885 void setMaskSize(LengthSize l) { SET_VAR(rareNonInheritedData, m_mask.m_sizeLength, l) }
886
setBorderCollapse(bool collapse)887 void setBorderCollapse(bool collapse) { inherited_flags._border_collapse = collapse; }
setHorizontalBorderSpacing(short v)888 void setHorizontalBorderSpacing(short v) { SET_VAR(inherited, horizontal_border_spacing, v) }
setVerticalBorderSpacing(short v)889 void setVerticalBorderSpacing(short v) { SET_VAR(inherited, vertical_border_spacing, v) }
setEmptyCells(EEmptyCell v)890 void setEmptyCells(EEmptyCell v) { inherited_flags._empty_cells = v; }
setCaptionSide(ECaptionSide v)891 void setCaptionSide(ECaptionSide v) { inherited_flags._caption_side = v; }
892
setCounterIncrement(short v)893 void setCounterIncrement(short v) { SET_VAR(visual, counterIncrement, v) }
setCounterReset(short v)894 void setCounterReset(short v) { SET_VAR(visual, counterReset, v) }
895
setListStyleType(EListStyleType v)896 void setListStyleType(EListStyleType v) { inherited_flags._list_style_type = v; }
setListStyleImage(StyleImage * v)897 void setListStyleImage(StyleImage* v) { if (inherited->list_style_image != v) inherited.access()->list_style_image = v; }
setListStylePosition(EListStylePosition v)898