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