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