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

Unified Diff: Source/core/style/ComputedStyle.h

Issue 1070143002: [Alignment] Single class for holding the alignment data. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 5 years, 8 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 side-by-side diff with in-line comments
Download patch
Index: Source/core/style/ComputedStyle.h
diff --git a/Source/core/style/ComputedStyle.h b/Source/core/style/ComputedStyle.h
index 117eb9acff7061d06b03cf4cd9f82a48bec7634d..b26ef6f0726a8a8c7d7bb9dbde80da7778fbb250 100644
--- a/Source/core/style/ComputedStyle.h
+++ b/Source/core/style/ComputedStyle.h
@@ -737,25 +737,25 @@ public:
float flexGrow() const { return rareNonInheritedData->m_flexibleBox->m_flexGrow; }
float flexShrink() const { return rareNonInheritedData->m_flexibleBox->m_flexShrink; }
const Length& flexBasis() const { return rareNonInheritedData->m_flexibleBox->m_flexBasis; }
- ContentPosition alignContent() const { return static_cast<ContentPosition>(rareNonInheritedData->m_alignContent); }
- ContentDistributionType alignContentDistribution() const { return static_cast<ContentDistributionType>(rareNonInheritedData->m_alignContentDistribution); }
- OverflowAlignment alignContentOverflowAlignment() const { return static_cast<OverflowAlignment>(rareNonInheritedData->m_alignContentOverflowAlignment); }
- ItemPosition alignItems() const { return static_cast<ItemPosition>(rareNonInheritedData->m_alignItems); }
- OverflowAlignment alignItemsOverflowAlignment() const { return static_cast<OverflowAlignment>(rareNonInheritedData->m_alignItemsOverflowAlignment); }
- ItemPosition alignSelf() const { return static_cast<ItemPosition>(rareNonInheritedData->m_alignSelf); }
- OverflowAlignment alignSelfOverflowAlignment() const { return static_cast<OverflowAlignment>(rareNonInheritedData->m_alignSelfOverflowAlignment); }
+ ContentPosition alignContent() const { return rareNonInheritedData->m_alignContent.m_contentPosition; }
+ ContentDistributionType alignContentDistribution() const { return rareNonInheritedData->m_alignContent.m_distribution; }
+ OverflowAlignment alignContentOverflowAlignment() const { return rareNonInheritedData->m_alignContent.m_overflow; }
+ ItemPosition alignItems() const { return rareNonInheritedData->m_alignItems.m_itemPosition; }
+ OverflowAlignment alignItemsOverflowAlignment() const { return rareNonInheritedData->m_alignItems.m_overflow; }
+ ItemPosition alignSelf() const { return rareNonInheritedData->m_alignSelf.m_itemPosition; }
+ OverflowAlignment alignSelfOverflowAlignment() const { return rareNonInheritedData->m_alignSelf.m_overflow; }
EFlexDirection flexDirection() const { return static_cast<EFlexDirection>(rareNonInheritedData->m_flexibleBox->m_flexDirection); }
bool isColumnFlexDirection() const { return flexDirection() == FlowColumn || flexDirection() == FlowColumnReverse; }
bool isReverseFlexDirection() const { return flexDirection() == FlowRowReverse || flexDirection() == FlowColumnReverse; }
EFlexWrap flexWrap() const { return static_cast<EFlexWrap>(rareNonInheritedData->m_flexibleBox->m_flexWrap); }
- ContentPosition justifyContent() const { return static_cast<ContentPosition>(rareNonInheritedData->m_justifyContent); }
- ContentDistributionType justifyContentDistribution() const { return static_cast<ContentDistributionType>(rareNonInheritedData->m_justifyContentDistribution); }
- OverflowAlignment justifyContentOverflowAlignment() const { return static_cast<OverflowAlignment>(rareNonInheritedData->m_justifyContentOverflowAlignment); }
- ItemPosition justifyItems() const { return static_cast<ItemPosition>(rareNonInheritedData->m_justifyItems); }
- OverflowAlignment justifyItemsOverflowAlignment() const { return static_cast<OverflowAlignment>(rareNonInheritedData->m_justifyItemsOverflowAlignment); }
- ItemPositionType justifyItemsPositionType() const { return static_cast<ItemPositionType>(rareNonInheritedData->m_justifyItemsPositionType); }
- ItemPosition justifySelf() const { return static_cast<ItemPosition>(rareNonInheritedData->m_justifySelf); }
- OverflowAlignment justifySelfOverflowAlignment() const { return static_cast<OverflowAlignment>(rareNonInheritedData->m_justifySelfOverflowAlignment); }
+ ContentPosition justifyContent() const { return rareNonInheritedData->m_justifyContent.m_contentPosition; }
+ ContentDistributionType justifyContentDistribution() const { return rareNonInheritedData->m_justifyContent.m_distribution; }
+ OverflowAlignment justifyContentOverflowAlignment() const { return rareNonInheritedData->m_justifyContent.m_overflow; }
+ ItemPosition justifyItems() const { return rareNonInheritedData->m_justifyItems.m_itemPosition; }
+ OverflowAlignment justifyItemsOverflowAlignment() const { return rareNonInheritedData->m_justifyItems.m_overflow; }
+ ItemPositionType justifyItemsPositionType() const { return rareNonInheritedData->m_justifyItems.m_positionType; }
+ ItemPosition justifySelf() const { return rareNonInheritedData->m_justifySelf.m_itemPosition; }
+ OverflowAlignment justifySelfOverflowAlignment() const { return rareNonInheritedData->m_justifySelf.m_overflow; }
const Vector<GridTrackSize>& gridTemplateColumns() const { return rareNonInheritedData->m_grid->m_gridTemplateColumns; }
const Vector<GridTrackSize>& gridTemplateRows() const { return rareNonInheritedData->m_grid->m_gridTemplateRows; }
@@ -1228,23 +1228,23 @@ public:
// We restrict the smallest value to int min + 2 because we use int min and int min + 1 as special values in a hash set.
void setOrder(int o) { SET_VAR(rareNonInheritedData, m_order, max(std::numeric_limits<int>::min() + 2, o)); }
void addCallbackSelector(const String& selector);
- void setAlignContent(ContentPosition p) { SET_VAR(rareNonInheritedData, m_alignContent, p); }
- void setAlignContentDistribution(ContentDistributionType p) { SET_VAR(rareNonInheritedData, m_alignContentDistribution, p); }
- void setAlignContentOverflowAlignment(OverflowAlignment overflowAlignment) { SET_VAR(rareNonInheritedData, m_alignContentOverflowAlignment, overflowAlignment); }
- void setAlignItems(ItemPosition a) { SET_VAR(rareNonInheritedData, m_alignItems, a); }
- void setAlignItemsOverflowAlignment(OverflowAlignment overflowAlignment) { SET_VAR(rareNonInheritedData, m_alignItemsOverflowAlignment, overflowAlignment); }
- void setAlignSelf(ItemPosition a) { SET_VAR(rareNonInheritedData, m_alignSelf, a); }
- void setAlignSelfOverflowAlignment(OverflowAlignment overflowAlignment) { SET_VAR(rareNonInheritedData, m_alignSelfOverflowAlignment, overflowAlignment); }
+ void setAlignContent(ContentPosition p) { SET_VAR(rareNonInheritedData, m_alignContent.m_contentPosition, p); }
+ void setAlignContentDistribution(ContentDistributionType p) { SET_VAR(rareNonInheritedData, m_alignContent.m_distribution, p); }
+ void setAlignContentOverflowAlignment(OverflowAlignment overflowAlignment) { SET_VAR(rareNonInheritedData, m_alignContent.m_overflow, overflowAlignment); }
+ void setAlignItems(ItemPosition a) { SET_VAR(rareNonInheritedData, m_alignItems.m_itemPosition, a); }
+ void setAlignItemsOverflowAlignment(OverflowAlignment overflowAlignment) { SET_VAR(rareNonInheritedData, m_alignItems.m_overflow, overflowAlignment); }
+ void setAlignSelf(ItemPosition a) { SET_VAR(rareNonInheritedData, m_alignSelf.m_itemPosition, a); }
+ void setAlignSelfOverflowAlignment(OverflowAlignment overflowAlignment) { SET_VAR(rareNonInheritedData, m_alignSelf.m_overflow, overflowAlignment); }
void setFlexDirection(EFlexDirection direction) { SET_VAR(rareNonInheritedData.access()->m_flexibleBox, m_flexDirection, direction); }
void setFlexWrap(EFlexWrap w) { SET_VAR(rareNonInheritedData.access()->m_flexibleBox, m_flexWrap, w); }
- void setJustifyContent(ContentPosition p) { SET_VAR(rareNonInheritedData, m_justifyContent, p); }
- void setJustifyContentDistribution(ContentDistributionType p) { SET_VAR(rareNonInheritedData, m_justifyContentDistribution, p); }
- void setJustifyContentOverflowAlignment(OverflowAlignment overflowAlignment) { SET_VAR(rareNonInheritedData, m_justifyContentOverflowAlignment, overflowAlignment); }
- void setJustifyItems(ItemPosition justifyItems) { SET_VAR(rareNonInheritedData, m_justifyItems, justifyItems); }
- void setJustifyItemsOverflowAlignment(OverflowAlignment overflowAlignment) { SET_VAR(rareNonInheritedData, m_justifyItemsOverflowAlignment, overflowAlignment); }
- void setJustifyItemsPositionType(ItemPositionType positionType) { SET_VAR(rareNonInheritedData, m_justifyItemsPositionType, positionType); }
- void setJustifySelf(ItemPosition justifySelf) { SET_VAR(rareNonInheritedData, m_justifySelf, justifySelf); }
- void setJustifySelfOverflowAlignment(OverflowAlignment overflowAlignment) { SET_VAR(rareNonInheritedData, m_justifySelfOverflowAlignment, overflowAlignment); }
+ void setJustifyContent(ContentPosition p) { SET_VAR(rareNonInheritedData, m_justifyContent.m_contentPosition, p); }
+ void setJustifyContentDistribution(ContentDistributionType p) { SET_VAR(rareNonInheritedData, m_justifyContent.m_distribution, p); }
+ void setJustifyContentOverflowAlignment(OverflowAlignment overflowAlignment) { SET_VAR(rareNonInheritedData, m_justifyContent.m_overflow, overflowAlignment); }
+ void setJustifyItems(ItemPosition justifyItems) { SET_VAR(rareNonInheritedData, m_justifyItems.m_itemPosition, justifyItems); }
+ void setJustifyItemsOverflowAlignment(OverflowAlignment overflowAlignment) { SET_VAR(rareNonInheritedData, m_justifyItems.m_overflow, overflowAlignment); }
+ void setJustifyItemsPositionType(ItemPositionType positionType) { SET_VAR(rareNonInheritedData, m_justifyItems.m_positionType, positionType); }
+ void setJustifySelf(ItemPosition justifySelf) { SET_VAR(rareNonInheritedData, m_justifySelf.m_itemPosition, justifySelf); }
+ void setJustifySelfOverflowAlignment(OverflowAlignment overflowAlignment) { SET_VAR(rareNonInheritedData, m_justifySelf.m_overflow, overflowAlignment); }
void setGridAutoColumns(const GridTrackSize& length) { SET_VAR(rareNonInheritedData.access()->m_grid, m_gridAutoColumns, length); }
void setGridAutoRows(const GridTrackSize& length) { SET_VAR(rareNonInheritedData.access()->m_grid, m_gridAutoRows, length); }
void setGridTemplateColumns(const Vector<GridTrackSize>& lengths) { SET_VAR(rareNonInheritedData.access()->m_grid, m_gridTemplateColumns, lengths); }
@@ -1366,6 +1366,13 @@ public:
bool requiresAcceleratedCompositingForExternalReasons(bool b) { return rareNonInheritedData->m_requiresAcceleratedCompositingForExternalReasons; }
void setRequiresAcceleratedCompositingForExternalReasons(bool b) { SET_VAR(rareNonInheritedData, m_requiresAcceleratedCompositingForExternalReasons, b); }
+ StyleAlignmentData alignContentData() const { return rareNonInheritedData->m_alignContent; }
+ StyleAlignmentData alignItemsData() const { return rareNonInheritedData->m_alignItems; }
+ StyleAlignmentData alignSelfData() const { return rareNonInheritedData->m_alignSelf; }
+ StyleAlignmentData justifyContentData() const { return rareNonInheritedData->m_justifyContent; }
+ StyleAlignmentData justifyItemsData() const { return rareNonInheritedData->m_justifyItems; }
+ StyleAlignmentData justifySelfData() const { return rareNonInheritedData->m_justifySelf; }
+
const SVGComputedStyle& svgStyle() const { return *m_svgStyle.get(); }
SVGComputedStyle& accessSVGStyle() { return *m_svgStyle.access(); }

Powered by Google App Engine
This is Rietveld 408576698