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