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

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: Using the StyleConverter. 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 db7dca53bae36444aff9bafa21e4a60f80140108..56dacf4f7645b650fb347d5787d9f4acb59cd012 100644
--- a/Source/core/style/ComputedStyle.h
+++ b/Source/core/style/ComputedStyle.h
@@ -40,6 +40,7 @@
#include "core/style/OutlineValue.h"
#include "core/style/SVGComputedStyle.h"
#include "core/style/ShapeValue.h"
+#include "core/style/StyleAlignmentData.h"
#include "core/style/StyleBackgroundData.h"
#include "core/style/StyleBoxData.h"
#include "core/style/StyleDeprecatedFlexibleBoxData.h"
@@ -737,25 +738,31 @@ 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); }
+ const StyleAlignmentData& alignContent() const { return rareNonInheritedData->m_alignContent; }
+ ContentPosition alignContentPosition() const { return static_cast<ContentPosition>(rareNonInheritedData->m_alignContent.m_contentPosition); }
+ ContentDistributionType alignContentDistribution() const { return static_cast<ContentDistributionType>(rareNonInheritedData->m_alignContent.m_distribution); }
+ OverflowAlignment alignContentOverflowAlignment() const { return static_cast<OverflowAlignment>(rareNonInheritedData->m_alignContent.m_overflow); }
+ const StyleAlignmentData& alignItems() const { return rareNonInheritedData->m_alignItems; }
+ ItemPosition alignItemsPosition() const { return static_cast<ItemPosition>(rareNonInheritedData->m_alignItems.m_itemPosition); }
+ OverflowAlignment alignItemsOverflowAlignment() const { return static_cast<OverflowAlignment>(rareNonInheritedData->m_alignItems.m_overflow); }
+ const StyleAlignmentData& alignSelf() const { return rareNonInheritedData->m_alignSelf; }
+ ItemPosition alignSelfPosition() const { return static_cast<ItemPosition>(rareNonInheritedData->m_alignSelf.m_itemPosition); }
+ OverflowAlignment alignSelfOverflowAlignment() const { return static_cast<OverflowAlignment>(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); }
+ const StyleAlignmentData& justifyContent() const { return rareNonInheritedData->m_justifyContent; }
+ ContentPosition justifyContentPosition() const { return static_cast<ContentPosition>(rareNonInheritedData->m_justifyContent.m_contentPosition); }
+ ContentDistributionType justifyContentDistribution() const { return static_cast<ContentDistributionType>(rareNonInheritedData->m_justifyContent.m_distribution); }
+ OverflowAlignment justifyContentOverflowAlignment() const { return static_cast<OverflowAlignment>(rareNonInheritedData->m_justifyContent.m_overflow); }
+ const StyleAlignmentData& justifyItems() const { return rareNonInheritedData->m_justifyItems; }
+ ItemPosition justifyItemsPosition() const { return static_cast<ItemPosition>(rareNonInheritedData->m_justifyItems.m_itemPosition); }
+ OverflowAlignment justifyItemsOverflowAlignment() const { return static_cast<OverflowAlignment>(rareNonInheritedData->m_justifyItems.m_overflow); }
+ ItemPositionType justifyItemsPositionType() const { return static_cast<ItemPositionType>(rareNonInheritedData->m_justifyItems.m_positionType); }
+ const StyleAlignmentData& justifySelf() const { return rareNonInheritedData->m_justifySelf; }
+ ItemPosition justifySelfPosition() const { return static_cast<ItemPosition>(rareNonInheritedData->m_justifySelf.m_itemPosition); }
+ OverflowAlignment justifySelfOverflowAlignment() const { return static_cast<OverflowAlignment>(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; }
@@ -1229,23 +1236,29 @@ 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(const StyleAlignmentData& data) { SET_VAR(rareNonInheritedData, m_alignContent, data); }
+ void setAlignContent(ContentPosition position) { SET_VAR(rareNonInheritedData, m_alignContent.m_contentPosition, position); }
+ void setAlignContent(ContentDistributionType distribution) { SET_VAR(rareNonInheritedData, m_alignContent.m_distribution, distribution); }
+ void setAlignContent(OverflowAlignment overflowAlignment) { SET_VAR(rareNonInheritedData, m_alignContent.m_overflow, overflowAlignment); }
+ void setAlignItems(const StyleAlignmentData& data) { SET_VAR(rareNonInheritedData, m_alignItems, data); }
+ void setAlignItems(ItemPosition position) { SET_VAR(rareNonInheritedData, m_alignItems.m_itemPosition, position); }
+ void setAlignItems(OverflowAlignment overflow) { SET_VAR(rareNonInheritedData, m_alignItems.m_overflow, overflow); }
+ void setAlignSelf(const StyleAlignmentData& data) { SET_VAR(rareNonInheritedData, m_alignSelf, data); }
+ void setAlignSelf(ItemPosition position) { SET_VAR(rareNonInheritedData, m_alignSelf.m_itemPosition, position); }
+ void setAlignSelf(OverflowAlignment overflow) { SET_VAR(rareNonInheritedData, m_alignSelf.m_overflow, overflow); }
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(const StyleAlignmentData& data) { SET_VAR(rareNonInheritedData, m_justifyContent, data); }
+ void setJustifyContent(ContentPosition position) { SET_VAR(rareNonInheritedData, m_justifyContent.m_contentPosition, position); }
+ void setJustifyContent(ContentDistributionType distribution) { SET_VAR(rareNonInheritedData, m_justifyContent.m_distribution, distribution); }
+ void setJustifyContent(OverflowAlignment overflowAlignment) { SET_VAR(rareNonInheritedData, m_justifyContent.m_overflow, overflowAlignment); }
+ void setJustifyItems(const StyleAlignmentData& data) { SET_VAR(rareNonInheritedData, m_justifyItems, data); }
+ void setJustifyItems(ItemPosition position) { SET_VAR(rareNonInheritedData, m_justifyItems.m_itemPosition, position); }
+ void setJustifyItems(OverflowAlignment overflow) { SET_VAR(rareNonInheritedData, m_justifyItems.m_overflow, overflow); }
+ void setJustifyItems(ItemPositionType positionType) { SET_VAR(rareNonInheritedData, m_justifyItems.m_positionType, positionType); }
+ void setJustifySelf(const StyleAlignmentData& data) { SET_VAR(rareNonInheritedData, m_justifySelf, data); }
+ void setJustifySelf(ItemPosition position) { SET_VAR(rareNonInheritedData, m_justifySelf.m_itemPosition, position); }
+ void setJustifySelf(OverflowAlignment overflow) { SET_VAR(rareNonInheritedData, m_justifySelf.m_overflow, overflow); }
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); }
@@ -1574,23 +1587,14 @@ public:
static float initialFlexShrink() { return 1; }
static Length initialFlexBasis() { return Length(Auto); }
static int initialOrder() { return 0; }
- static ContentPosition initialAlignContent() { return ContentPositionAuto; }
- static ContentDistributionType initialAlignContentDistribution() { return ContentDistributionDefault; }
- static OverflowAlignment initialAlignContentOverflowAlignment() { return OverflowAlignmentDefault; }
- static ItemPosition initialAlignItems() { return ItemPositionAuto; }
- static OverflowAlignment initialAlignItemsOverflowAlignment() { return OverflowAlignmentDefault; }
- static ItemPosition initialAlignSelf() { return ItemPositionAuto; }
- static OverflowAlignment initialAlignSelfOverflowAlignment() { return OverflowAlignmentDefault; }
+ static StyleAlignmentData initialAlignContent() { return StyleAlignmentData(ContentPositionAuto, ContentDistributionDefault, OverflowAlignmentDefault); }
+ static StyleAlignmentData initialAlignItems() { return StyleAlignmentData(ItemPositionAuto, OverflowAlignmentDefault); }
+ static StyleAlignmentData initialAlignSelf() { return StyleAlignmentData(ItemPositionAuto, OverflowAlignmentDefault); }
static EFlexDirection initialFlexDirection() { return FlowRow; }
static EFlexWrap initialFlexWrap() { return FlexNoWrap; }
- static ContentPosition initialJustifyContent() { return ContentPositionAuto; }
- static ContentDistributionType initialJustifyContentDistribution() { return ContentDistributionDefault; }
- static OverflowAlignment initialJustifyContentOverflowAlignment() { return OverflowAlignmentDefault; }
- static ItemPosition initialJustifyItems() { return ItemPositionAuto; }
- static OverflowAlignment initialJustifyItemsOverflowAlignment() { return OverflowAlignmentDefault; }
- static ItemPositionType initialJustifyItemsPositionType() { return NonLegacyPosition; }
- static ItemPosition initialJustifySelf() { return ItemPositionAuto; }
- static OverflowAlignment initialJustifySelfOverflowAlignment() { return OverflowAlignmentDefault; }
+ static StyleAlignmentData initialJustifyContent() { return StyleAlignmentData(ContentPositionAuto, ContentDistributionDefault, OverflowAlignmentDefault); }
+ static StyleAlignmentData initialJustifyItems() { return StyleAlignmentData(ItemPositionAuto, OverflowAlignmentDefault); }
+ static StyleAlignmentData initialJustifySelf() { return StyleAlignmentData(ItemPositionAuto, OverflowAlignmentDefault); }
static EUserModify initialUserModify() { return READ_ONLY; }
static EUserDrag initialUserDrag() { return DRAG_AUTO; }
static EUserSelect initialUserSelect() { return SELECT_TEXT; }

Powered by Google App Engine
This is Rietveld 408576698