Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(122)

Side by Side Diff: Source/core/rendering/style/RenderStyle.h

Issue 889563002: Make RenderObject::style() return a const object (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Fix a crashers (everything is building!) Created 5 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2000 Lars Knoll (knoll@kde.org) 2 * Copyright (C) 2000 Lars Knoll (knoll@kde.org)
3 * (C) 2000 Antti Koivisto (koivisto@kde.org) 3 * (C) 2000 Antti Koivisto (koivisto@kde.org)
4 * (C) 2000 Dirk Mueller (mueller@kde.org) 4 * (C) 2000 Dirk Mueller (mueller@kde.org)
5 * Copyright (C) 2003, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All r ights reserved. 5 * Copyright (C) 2003, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All r ights reserved.
6 * Copyright (C) 2006 Graham Dennis (graham.dennis@gmail.com) 6 * Copyright (C) 2006 Graham Dennis (graham.dennis@gmail.com)
7 * 7 *
8 * This library is free software; you can redistribute it and/or 8 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Library General Public 9 * modify it under the terms of the GNU Library General Public
10 * License as published by the Free Software Foundation; either 10 * License as published by the Free Software Foundation; either
(...skipping 240 matching lines...) Expand 10 before | Expand all | Expand 10 after
251 mutable unsigned hasViewportUnits : 1; 251 mutable unsigned hasViewportUnits : 1;
252 252
253 // 32 bits 253 // 32 bits
254 254
255 unsigned pageBreakBefore : 2; // EPageBreak 255 unsigned pageBreakBefore : 2; // EPageBreak
256 unsigned pageBreakAfter : 2; // EPageBreak 256 unsigned pageBreakAfter : 2; // EPageBreak
257 unsigned pageBreakInside : 2; // EPageBreak 257 unsigned pageBreakInside : 2; // EPageBreak
258 258
259 unsigned styleType : 6; // PseudoId 259 unsigned styleType : 6; // PseudoId
260 unsigned pseudoBits : 8; 260 unsigned pseudoBits : 8;
261 unsigned explicitInheritance : 1; // Explicitly inherits a non-inherited property 261 // FIXME: This should be moved to ElementRateData.
rune 2015/01/29 23:16:32 ElementRareData.
Julien - ping for review 2015/02/10 07:33:19 Done.
262 unsigned unique : 1; // Style can not be shared. 262 mutable unsigned explicitInheritance : 1; // Explicitly inherits a non-i nherited property
263 mutable unsigned unique : 1; // Style can not be shared.
263 264
264 unsigned emptyState : 1; 265 unsigned emptyState : 1;
265 266
266 unsigned affectedByFocus : 1; 267 unsigned affectedByFocus : 1;
267 unsigned affectedByHover : 1; 268 unsigned affectedByHover : 1;
268 unsigned affectedByActive : 1; 269 unsigned affectedByActive : 1;
269 unsigned affectedByDrag : 1; 270 unsigned affectedByDrag : 1;
270 271
271 unsigned isLink : 1; 272 unsigned isLink : 1;
272 // If you add more style bits here, you will also need to update RenderS tyle::copyNonInheritedFrom() 273 // If you add more style bits here, you will also need to update RenderS tyle::copyNonInheritedFrom()
(...skipping 604 matching lines...) Expand 10 before | Expand all | Expand 10 after
877 bool hasPerspective() const { return rareNonInheritedData->m_perspective > 0 ; } 878 bool hasPerspective() const { return rareNonInheritedData->m_perspective > 0 ; }
878 const LengthPoint& perspectiveOrigin() const { return rareNonInheritedData-> m_perspectiveOrigin; } 879 const LengthPoint& perspectiveOrigin() const { return rareNonInheritedData-> m_perspectiveOrigin; }
879 const Length& perspectiveOriginX() const { return perspectiveOrigin().x(); } 880 const Length& perspectiveOriginX() const { return perspectiveOrigin().x(); }
880 const Length& perspectiveOriginY() const { return perspectiveOrigin().y(); } 881 const Length& perspectiveOriginY() const { return perspectiveOrigin().y(); }
881 const LengthSize& pageSize() const { return rareNonInheritedData->m_pageSize ; } 882 const LengthSize& pageSize() const { return rareNonInheritedData->m_pageSize ; }
882 PageSizeType pageSizeType() const { return static_cast<PageSizeType>(rareNon InheritedData->m_pageSizeType); } 883 PageSizeType pageSizeType() const { return static_cast<PageSizeType>(rareNon InheritedData->m_pageSizeType); }
883 884
884 bool hasCurrentOpacityAnimation() const { return rareNonInheritedData->m_has CurrentOpacityAnimation; } 885 bool hasCurrentOpacityAnimation() const { return rareNonInheritedData->m_has CurrentOpacityAnimation; }
885 bool hasCurrentTransformAnimation() const { return rareNonInheritedData->m_h asCurrentTransformAnimation; } 886 bool hasCurrentTransformAnimation() const { return rareNonInheritedData->m_h asCurrentTransformAnimation; }
886 bool hasCurrentFilterAnimation() const { return rareNonInheritedData->m_hasC urrentFilterAnimation; } 887 bool hasCurrentFilterAnimation() const { return rareNonInheritedData->m_hasC urrentFilterAnimation; }
887 bool shouldCompositeForCurrentAnimations() { return hasCurrentOpacityAnimati on() || hasCurrentTransformAnimation() || hasCurrentFilterAnimation(); } 888 bool shouldCompositeForCurrentAnimations() const { return hasCurrentOpacityA nimation() || hasCurrentTransformAnimation() || hasCurrentFilterAnimation(); }
888 889
889 bool isRunningOpacityAnimationOnCompositor() const { return rareNonInherited Data->m_runningOpacityAnimationOnCompositor; } 890 bool isRunningOpacityAnimationOnCompositor() const { return rareNonInherited Data->m_runningOpacityAnimationOnCompositor; }
890 bool isRunningTransformAnimationOnCompositor() const { return rareNonInherit edData->m_runningTransformAnimationOnCompositor; } 891 bool isRunningTransformAnimationOnCompositor() const { return rareNonInherit edData->m_runningTransformAnimationOnCompositor; }
891 bool isRunningFilterAnimationOnCompositor() const { return rareNonInheritedD ata->m_runningFilterAnimationOnCompositor; } 892 bool isRunningFilterAnimationOnCompositor() const { return rareNonInheritedD ata->m_runningFilterAnimationOnCompositor; }
892 bool isRunningAnimationOnCompositor() { return isRunningOpacityAnimationOnCo mpositor() || isRunningTransformAnimationOnCompositor() || isRunningFilterAnimat ionOnCompositor(); } 893 bool isRunningAnimationOnCompositor() const { return isRunningOpacityAnimati onOnCompositor() || isRunningTransformAnimationOnCompositor() || isRunningFilter AnimationOnCompositor(); }
893 894
894 LineBoxContain lineBoxContain() const { return rareInheritedData->m_lineBoxC ontain; } 895 LineBoxContain lineBoxContain() const { return rareInheritedData->m_lineBoxC ontain; }
895 const LineClampValue& lineClamp() const { return rareNonInheritedData->lineC lamp; } 896 const LineClampValue& lineClamp() const { return rareNonInheritedData->lineC lamp; }
896 Color tapHighlightColor() const { return rareInheritedData->tapHighlightColo r; } 897 Color tapHighlightColor() const { return rareInheritedData->tapHighlightColo r; }
897 ETextSecurity textSecurity() const { return static_cast<ETextSecurity>(rareI nheritedData->textSecurity); } 898 ETextSecurity textSecurity() const { return static_cast<ETextSecurity>(rareI nheritedData->textSecurity); }
898 899
899 WritingMode writingMode() const { return static_cast<WritingMode>(inherited_ flags.m_writingMode); } 900 WritingMode writingMode() const { return static_cast<WritingMode>(inherited_ flags.m_writingMode); }
900 bool isHorizontalWritingMode() const { return blink::isHorizontalWritingMode (writingMode()); } 901 bool isHorizontalWritingMode() const { return blink::isHorizontalWritingMode (writingMode()); }
901 bool isFlippedLinesWritingMode() const { return blink::isFlippedLinesWriting Mode(writingMode()); } 902 bool isFlippedLinesWritingMode() const { return blink::isFlippedLinesWriting Mode(writingMode()); }
902 bool isFlippedBlocksWritingMode() const { return blink::isFlippedBlocksWriti ngMode(writingMode()); } 903 bool isFlippedBlocksWritingMode() const { return blink::isFlippedBlocksWriti ngMode(writingMode()); }
(...skipping 366 matching lines...) Expand 10 before | Expand all | Expand 10 after
1269 void setColumnGap(float f) { SET_VAR(rareNonInheritedData.access()->m_multiC ol, m_normalGap, false); SET_VAR(rareNonInheritedData.access()->m_multiCol, m_ga p, f); } 1270 void setColumnGap(float f) { SET_VAR(rareNonInheritedData.access()->m_multiC ol, m_normalGap, false); SET_VAR(rareNonInheritedData.access()->m_multiCol, m_ga p, f); }
1270 void setHasNormalColumnGap() { SET_VAR(rareNonInheritedData.access()->m_mult iCol, m_normalGap, true); SET_VAR(rareNonInheritedData.access()->m_multiCol, m_g ap, 0); } 1271 void setHasNormalColumnGap() { SET_VAR(rareNonInheritedData.access()->m_mult iCol, m_normalGap, true); SET_VAR(rareNonInheritedData.access()->m_multiCol, m_g ap, 0); }
1271 void setColumnRuleColor(const StyleColor& c) { SET_BORDERVALUE_COLOR(rareNon InheritedData.access()->m_multiCol, m_rule, c); } 1272 void setColumnRuleColor(const StyleColor& c) { SET_BORDERVALUE_COLOR(rareNon InheritedData.access()->m_multiCol, m_rule, c); }
1272 void setColumnRuleStyle(EBorderStyle b) { SET_VAR(rareNonInheritedData.acces s()->m_multiCol, m_rule.m_style, b); } 1273 void setColumnRuleStyle(EBorderStyle b) { SET_VAR(rareNonInheritedData.acces s()->m_multiCol, m_rule.m_style, b); }
1273 void setColumnRuleWidth(unsigned short w) { SET_VAR(rareNonInheritedData.acc ess()->m_multiCol, m_rule.m_width, w); } 1274 void setColumnRuleWidth(unsigned short w) { SET_VAR(rareNonInheritedData.acc ess()->m_multiCol, m_rule.m_width, w); }
1274 void setColumnSpan(ColumnSpan columnSpan) { SET_VAR(rareNonInheritedData.acc ess()->m_multiCol, m_columnSpan, columnSpan); } 1275 void setColumnSpan(ColumnSpan columnSpan) { SET_VAR(rareNonInheritedData.acc ess()->m_multiCol, m_columnSpan, columnSpan); }
1275 void setColumnBreakBefore(EPageBreak p) { SET_VAR(rareNonInheritedData.acces s()->m_multiCol, m_breakBefore, p); } 1276 void setColumnBreakBefore(EPageBreak p) { SET_VAR(rareNonInheritedData.acces s()->m_multiCol, m_breakBefore, p); }
1276 // For valid values of column-break-inside see http://www.w3.org/TR/css3-mul ticol/#break-before-break-after-break-inside 1277 // For valid values of column-break-inside see http://www.w3.org/TR/css3-mul ticol/#break-before-break-after-break-inside
1277 void setColumnBreakInside(EPageBreak p) { ASSERT(p == PBAUTO || p == PBAVOID ); SET_VAR(rareNonInheritedData.access()->m_multiCol, m_breakInside, p); } 1278 void setColumnBreakInside(EPageBreak p) { ASSERT(p == PBAUTO || p == PBAVOID ); SET_VAR(rareNonInheritedData.access()->m_multiCol, m_breakInside, p); }
1278 void setColumnBreakAfter(EPageBreak p) { SET_VAR(rareNonInheritedData.access ()->m_multiCol, m_breakAfter, p); } 1279 void setColumnBreakAfter(EPageBreak p) { SET_VAR(rareNonInheritedData.access ()->m_multiCol, m_breakAfter, p); }
1279 void inheritColumnPropertiesFrom(RenderStyle* parent) { rareNonInheritedData .access()->m_multiCol = parent->rareNonInheritedData->m_multiCol; } 1280 void inheritColumnPropertiesFrom(const RenderStyle& parent) { rareNonInherit edData.access()->m_multiCol = parent.rareNonInheritedData->m_multiCol; }
1280 void setHasInlineTransform(bool b) { SET_VAR(rareNonInheritedData, m_hasInli neTransform, b); } 1281 void setHasInlineTransform(bool b) { SET_VAR(rareNonInheritedData, m_hasInli neTransform, b); }
1281 void setTransform(const TransformOperations& ops) { SET_VAR(rareNonInherited Data.access()->m_transform, m_operations, ops); } 1282 void setTransform(const TransformOperations& ops) { SET_VAR(rareNonInherited Data.access()->m_transform, m_operations, ops); }
1282 void setTransformOriginX(const Length& v) { setTransformOrigin(TransformOrig in(v, transformOriginY(), transformOriginZ())); } 1283 void setTransformOriginX(const Length& v) { setTransformOrigin(TransformOrig in(v, transformOriginY(), transformOriginZ())); }
1283 void setTransformOriginY(const Length& v) { setTransformOrigin(TransformOrig in(transformOriginX(), v, transformOriginZ())); } 1284 void setTransformOriginY(const Length& v) { setTransformOrigin(TransformOrig in(transformOriginX(), v, transformOriginZ())); }
1284 void setTransformOriginZ(float f) { setTransformOrigin(TransformOrigin(trans formOriginX(), transformOriginY(), f)); } 1285 void setTransformOriginZ(float f) { setTransformOrigin(TransformOrigin(trans formOriginX(), transformOriginY(), f)); }
1285 void setTransformOrigin(const TransformOrigin& o) { SET_VAR(rareNonInherited Data.access()->m_transform, m_origin, o); } 1286 void setTransformOrigin(const TransformOrigin& o) { SET_VAR(rareNonInherited Data.access()->m_transform, m_origin, o); }
1286 void setSpeak(ESpeak s) { SET_VAR(rareInheritedData, speak, s); } 1287 void setSpeak(ESpeak s) { SET_VAR(rareInheritedData, speak, s); }
1287 void setTextCombine(TextCombine v) { SET_VAR(rareNonInheritedData, m_textCom bine, v); } 1288 void setTextCombine(TextCombine v) { SET_VAR(rareNonInheritedData, m_textCom bine, v); }
1288 void setTextDecorationColor(const StyleColor& c) { SET_VAR(rareNonInheritedD ata, m_textDecorationColor, c); } 1289 void setTextDecorationColor(const StyleColor& c) { SET_VAR(rareNonInheritedD ata, m_textDecorationColor, c); }
1289 void setTextEmphasisColor(const StyleColor& c) { SET_VAR_WITH_SETTER(rareInh eritedData, textEmphasisColor, setTextEmphasisColor, c); } 1290 void setTextEmphasisColor(const StyleColor& c) { SET_VAR_WITH_SETTER(rareInh eritedData, textEmphasisColor, setTextEmphasisColor, c); }
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after
1448 { 1449 {
1449 if (v == writingMode()) 1450 if (v == writingMode())
1450 return false; 1451 return false;
1451 1452
1452 inherited_flags.m_writingMode = v; 1453 inherited_flags.m_writingMode = v;
1453 return true; 1454 return true;
1454 } 1455 }
1455 1456
1456 // A unique style is one that has matches something that makes it impossible to share. 1457 // A unique style is one that has matches something that makes it impossible to share.
1457 bool unique() const { return noninherited_flags.unique; } 1458 bool unique() const { return noninherited_flags.unique; }
1458 void setUnique() { noninherited_flags.unique = true; } 1459 void setUnique() const { noninherited_flags.unique = true; }
1459 1460
1460 bool isSharable() const; 1461 bool isSharable() const;
1461 1462
1462 bool emptyState() const { return noninherited_flags.emptyState; } 1463 bool emptyState() const { return noninherited_flags.emptyState; }
1463 void setEmptyState(bool b) { setUnique(); noninherited_flags.emptyState = b; } 1464 void setEmptyState(bool b) { setUnique(); noninherited_flags.emptyState = b; }
1464 1465
1465 Color visitedDependentColor(int colorProperty) const; 1466 Color visitedDependentColor(int colorProperty) const;
1466 1467
1467 void setHasExplicitlyInheritedProperties() { noninherited_flags.explicitInhe ritance = true; } 1468 void setHasExplicitlyInheritedProperties() const { noninherited_flags.explic itInheritance = true; }
1468 bool hasExplicitlyInheritedProperties() const { return noninherited_flags.ex plicitInheritance; } 1469 bool hasExplicitlyInheritedProperties() const { return noninherited_flags.ex plicitInheritance; }
1469 1470
1470 bool hasBoxDecorations() const { return hasBorder() || hasBorderRadius() || hasOutline() || hasAppearance() || boxShadow() || hasFilter() || resize() != RES IZE_NONE; } 1471 bool hasBoxDecorations() const { return hasBorder() || hasBorderRadius() || hasOutline() || hasAppearance() || boxShadow() || hasFilter() || resize() != RES IZE_NONE; }
1471 1472
1472 bool borderObscuresBackground() const; 1473 bool borderObscuresBackground() const;
1473 void getBorderEdgeInfo(BorderEdge edges[], bool includeLogicalLeftEdge = tru e, bool includeLogicalRightEdge = true) const; 1474 void getBorderEdgeInfo(BorderEdge edges[], bool includeLogicalLeftEdge = tru e, bool includeLogicalRightEdge = true) const;
1474 1475
1475 // Initial values for all the properties 1476 // Initial values for all the properties
1476 static EBorderCollapse initialBorderCollapse() { return BSEPARATE; } 1477 static EBorderCollapse initialBorderCollapse() { return BSEPARATE; }
1477 static EBorderStyle initialBorderStyle() { return BNONE; } 1478 static EBorderStyle initialBorderStyle() { return BNONE; }
(...skipping 373 matching lines...) Expand 10 before | Expand all | Expand 10 after
1851 inline bool RenderStyle::hasPseudoElementStyle() const 1852 inline bool RenderStyle::hasPseudoElementStyle() const
1852 { 1853 {
1853 return noninherited_flags.pseudoBits & PSEUDO_ELEMENT_MASK; 1854 return noninherited_flags.pseudoBits & PSEUDO_ELEMENT_MASK;
1854 } 1855 }
1855 1856
1856 float calcBorderRadiiConstraintScaleFor(const FloatRect&, const FloatRoundedRect ::Radii&); 1857 float calcBorderRadiiConstraintScaleFor(const FloatRect&, const FloatRoundedRect ::Radii&);
1857 1858
1858 } // namespace blink 1859 } // namespace blink
1859 1860
1860 #endif // RenderStyle_h 1861 #endif // RenderStyle_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698