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

Side by Side Diff: Source/core/layout/style/LayoutStyle.h

Issue 889563002: Make RenderObject::style() return a const object (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Fixed web/mac/WebSubstringUtil.mm 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: |explicitInheritance| should be moved to ElementRareData.
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 LayoutS tyle::copyNonInheritedFrom() 273 // If you add more style bits here, you will also need to update LayoutS tyle::copyNonInheritedFrom()
(...skipping 486 matching lines...) Expand 10 before | Expand all | Expand 10 after
759 bool isGridAutoFlowAlgorithmSparse() const { return (rareNonInheritedData->m _grid->m_gridAutoFlow & InternalAutoFlowAlgorithmSparse) == InternalAutoFlowAlgo rithmSparse; } 760 bool isGridAutoFlowAlgorithmSparse() const { return (rareNonInheritedData->m _grid->m_gridAutoFlow & InternalAutoFlowAlgorithmSparse) == InternalAutoFlowAlgo rithmSparse; }
760 bool isGridAutoFlowAlgorithmDense() const { return (rareNonInheritedData->m_ grid->m_gridAutoFlow & InternalAutoFlowAlgorithmDense) == InternalAutoFlowAlgori thmDense; } 761 bool isGridAutoFlowAlgorithmDense() const { return (rareNonInheritedData->m_ grid->m_gridAutoFlow & InternalAutoFlowAlgorithmDense) == InternalAutoFlowAlgori thmDense; }
761 const GridTrackSize& gridAutoColumns() const { return rareNonInheritedData-> m_grid->m_gridAutoColumns; } 762 const GridTrackSize& gridAutoColumns() const { return rareNonInheritedData-> m_grid->m_gridAutoColumns; }
762 const GridTrackSize& gridAutoRows() const { return rareNonInheritedData->m_g rid->m_gridAutoRows; } 763 const GridTrackSize& gridAutoRows() const { return rareNonInheritedData->m_g rid->m_gridAutoRows; }
763 764
764 const GridPosition& gridColumnStart() const { return rareNonInheritedData->m _gridItem->m_gridColumnStart; } 765 const GridPosition& gridColumnStart() const { return rareNonInheritedData->m _gridItem->m_gridColumnStart; }
765 const GridPosition& gridColumnEnd() const { return rareNonInheritedData->m_g ridItem->m_gridColumnEnd; } 766 const GridPosition& gridColumnEnd() const { return rareNonInheritedData->m_g ridItem->m_gridColumnEnd; }
766 const GridPosition& gridRowStart() const { return rareNonInheritedData->m_gr idItem->m_gridRowStart; } 767 const GridPosition& gridRowStart() const { return rareNonInheritedData->m_gr idItem->m_gridRowStart; }
767 const GridPosition& gridRowEnd() const { return rareNonInheritedData->m_grid Item->m_gridRowEnd; } 768 const GridPosition& gridRowEnd() const { return rareNonInheritedData->m_grid Item->m_gridRowEnd; }
768 769
769 ShadowList* boxShadow() const { return rareNonInheritedData->m_boxShadow.get (); } 770 ShadowList* boxShadow() const { return rareNonInheritedData->m_boxShadow.get (); }
pdr. 2015/02/18 22:30:57 Returning non-const pointers from const objects ca
770 771
771 EBoxDecorationBreak boxDecorationBreak() const { return m_box->boxDecoration Break(); } 772 EBoxDecorationBreak boxDecorationBreak() const { return m_box->boxDecoration Break(); }
772 StyleReflection* boxReflect() const { return rareNonInheritedData->m_boxRefl ect.get(); } 773 StyleReflection* boxReflect() const { return rareNonInheritedData->m_boxRefl ect.get(); }
773 bool reflectionDataEquivalent(const LayoutStyle* otherStyle) const { return rareNonInheritedData->reflectionDataEquivalent(*otherStyle->rareNonInheritedData ); } 774 bool reflectionDataEquivalent(const LayoutStyle* otherStyle) const { return rareNonInheritedData->reflectionDataEquivalent(*otherStyle->rareNonInheritedData ); }
774 775
775 // FIXME: reflections should belong to this helper function but they are cur rently handled 776 // FIXME: reflections should belong to this helper function but they are cur rently handled
776 // through their self-painting layers. So the rendering code doesn't account for them. 777 // through their self-painting layers. So the rendering code doesn't account for them.
777 bool hasVisualOverflowingEffect() const { return boxShadow() || hasBorderIma geOutsets() || hasOutline(); } 778 bool hasVisualOverflowingEffect() const { return boxShadow() || hasBorderIma geOutsets() || hasOutline(); }
778 779
779 EBoxSizing boxSizing() const { return m_box->boxSizing(); } 780 EBoxSizing boxSizing() const { return m_box->boxSizing(); }
(...skipping 670 matching lines...) Expand 10 before | Expand all | Expand 10 after
1450 { 1451 {
1451 if (v == writingMode()) 1452 if (v == writingMode())
1452 return false; 1453 return false;
1453 1454
1454 inherited_flags.m_writingMode = v; 1455 inherited_flags.m_writingMode = v;
1455 return true; 1456 return true;
1456 } 1457 }
1457 1458
1458 // A unique style is one that has matches something that makes it impossible to share. 1459 // A unique style is one that has matches something that makes it impossible to share.
1459 bool unique() const { return noninherited_flags.unique; } 1460 bool unique() const { return noninherited_flags.unique; }
1460 void setUnique() { noninherited_flags.unique = true; } 1461 void setUnique() const { noninherited_flags.unique = true; }
1461 1462
1462 bool isSharable() const; 1463 bool isSharable() const;
1463 1464
1464 bool emptyState() const { return noninherited_flags.emptyState; } 1465 bool emptyState() const { return noninherited_flags.emptyState; }
1465 void setEmptyState(bool b) { setUnique(); noninherited_flags.emptyState = b; } 1466 void setEmptyState(bool b) { setUnique(); noninherited_flags.emptyState = b; }
1466 1467
1467 Color visitedDependentColor(int colorProperty) const; 1468 Color visitedDependentColor(int colorProperty) const;
1468 1469
1469 void setHasExplicitlyInheritedProperties() { noninherited_flags.explicitInhe ritance = true; } 1470 void setHasExplicitlyInheritedProperties() const { noninherited_flags.explic itInheritance = true; }
1470 bool hasExplicitlyInheritedProperties() const { return noninherited_flags.ex plicitInheritance; } 1471 bool hasExplicitlyInheritedProperties() const { return noninherited_flags.ex plicitInheritance; }
1471 1472
1472 bool hasBoxDecorations() const { return hasBorder() || hasBorderRadius() || hasOutline() || hasAppearance() || boxShadow() || hasFilter() || resize() != RES IZE_NONE; } 1473 bool hasBoxDecorations() const { return hasBorder() || hasBorderRadius() || hasOutline() || hasAppearance() || boxShadow() || hasFilter() || resize() != RES IZE_NONE; }
1473 1474
1474 bool borderObscuresBackground() const; 1475 bool borderObscuresBackground() const;
1475 void getBorderEdgeInfo(BorderEdge edges[], bool includeLogicalLeftEdge = tru e, bool includeLogicalRightEdge = true) const; 1476 void getBorderEdgeInfo(BorderEdge edges[], bool includeLogicalLeftEdge = tru e, bool includeLogicalRightEdge = true) const;
1476 1477
1477 // Initial values for all the properties 1478 // Initial values for all the properties
1478 static EBorderCollapse initialBorderCollapse() { return BSEPARATE; } 1479 static EBorderCollapse initialBorderCollapse() { return BSEPARATE; }
1479 static EBorderStyle initialBorderStyle() { return BNONE; } 1480 static EBorderStyle initialBorderStyle() { return BNONE; }
(...skipping 371 matching lines...) Expand 10 before | Expand all | Expand 10 after
1851 } 1852 }
1852 1853
1853 inline bool LayoutStyle::hasPseudoElementStyle() const 1854 inline bool LayoutStyle::hasPseudoElementStyle() const
1854 { 1855 {
1855 return noninherited_flags.pseudoBits & PSEUDO_ELEMENT_MASK; 1856 return noninherited_flags.pseudoBits & PSEUDO_ELEMENT_MASK;
1856 } 1857 }
1857 1858
1858 } // namespace blink 1859 } // namespace blink
1859 1860
1860 #endif // LayoutStyle_h 1861 #endif // LayoutStyle_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698