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