summaryrefslogtreecommitdiffstats
path: root/WebCore/rendering/style
diff options
context:
space:
mode:
Diffstat (limited to 'WebCore/rendering/style')
-rw-r--r--WebCore/rendering/style/RenderStyle.cpp52
-rw-r--r--WebCore/rendering/style/RenderStyle.h16
-rw-r--r--WebCore/rendering/style/StyleRareNonInheritedData.cpp12
-rw-r--r--WebCore/rendering/style/StyleRareNonInheritedData.h4
4 files changed, 67 insertions, 17 deletions
diff --git a/WebCore/rendering/style/RenderStyle.cpp b/WebCore/rendering/style/RenderStyle.cpp
index 4b77d6b..623a298 100644
--- a/WebCore/rendering/style/RenderStyle.cpp
+++ b/WebCore/rendering/style/RenderStyle.cpp
@@ -323,8 +323,8 @@ StyleDifference RenderStyle::diff(const RenderStyle* other, unsigned& changedCon
if (rareNonInheritedData.get() != other->rareNonInheritedData.get()) {
if (rareNonInheritedData->m_appearance != other->rareNonInheritedData->m_appearance ||
- rareNonInheritedData->marginTopCollapse != other->rareNonInheritedData->marginTopCollapse ||
- rareNonInheritedData->marginBottomCollapse != other->rareNonInheritedData->marginBottomCollapse ||
+ rareNonInheritedData->marginBeforeCollapse != other->rareNonInheritedData->marginBeforeCollapse ||
+ rareNonInheritedData->marginAfterCollapse != other->rareNonInheritedData->marginAfterCollapse ||
rareNonInheritedData->lineClamp != other->rareNonInheritedData->lineClamp ||
rareNonInheritedData->textOverflow != other->rareNonInheritedData->textOverflow)
return StyleDifferenceLayout;
@@ -789,7 +789,7 @@ CounterDirectiveMap& RenderStyle::accessCounterDirectives()
const AtomicString& RenderStyle::hyphenString() const
{
- ASSERT(hyphens() == HyphensAuto);
+ ASSERT(hyphens() != HyphensNone);
const AtomicString& hyphenationString = rareInheritedData.get()->hyphenationString;
if (!hyphenationString.isNull())
@@ -1184,6 +1184,38 @@ Length RenderStyle::marginAfter() const
return marginBottom();
}
+Length RenderStyle::marginBeforeUsing(const RenderStyle* otherStyle) const
+{
+ switch (otherStyle->blockFlow()) {
+ case TopToBottomBlockFlow:
+ return marginTop();
+ case BottomToTopBlockFlow:
+ return marginBottom();
+ case LeftToRightBlockFlow:
+ return marginLeft();
+ case RightToLeftBlockFlow:
+ return marginRight();
+ }
+ ASSERT_NOT_REACHED();
+ return marginTop();
+}
+
+Length RenderStyle::marginAfterUsing(const RenderStyle* otherStyle) const
+{
+ switch (otherStyle->blockFlow()) {
+ case TopToBottomBlockFlow:
+ return marginBottom();
+ case BottomToTopBlockFlow:
+ return marginTop();
+ case LeftToRightBlockFlow:
+ return marginRight();
+ case RightToLeftBlockFlow:
+ return marginLeft();
+ }
+ ASSERT_NOT_REACHED();
+ return marginBottom();
+}
+
Length RenderStyle::marginStart() const
{
if (isVerticalBlockFlow())
@@ -1198,6 +1230,20 @@ Length RenderStyle::marginEnd() const
return direction() == LTR ? marginBottom() : marginTop();
}
+Length RenderStyle::marginStartUsing(const RenderStyle* otherStyle) const
+{
+ if (otherStyle->isVerticalBlockFlow())
+ return otherStyle->direction() == LTR ? marginLeft() : marginRight();
+ return otherStyle->direction() == LTR ? marginTop() : marginBottom();
+}
+
+Length RenderStyle::marginEndUsing(const RenderStyle* otherStyle) const
+{
+ if (otherStyle->isVerticalBlockFlow())
+ return otherStyle->direction() == LTR ? marginRight() : marginLeft();
+ return otherStyle->direction() == LTR ? marginBottom() : marginTop();
+}
+
Length RenderStyle::paddingBefore() const
{
switch (blockFlow()) {
diff --git a/WebCore/rendering/style/RenderStyle.h b/WebCore/rendering/style/RenderStyle.h
index e6e6318..6ecbd56 100644
--- a/WebCore/rendering/style/RenderStyle.h
+++ b/WebCore/rendering/style/RenderStyle.h
@@ -598,6 +598,10 @@ public:
Length marginAfter() const;
Length marginStart() const;
Length marginEnd() const;
+ Length marginStartUsing(const RenderStyle* otherStyle) const;
+ Length marginEndUsing(const RenderStyle* otherStyle) const;
+ Length marginBeforeUsing(const RenderStyle* otherStyle) const;
+ Length marginAfterUsing(const RenderStyle* otherStyle) const;
LengthBox paddingBox() const { return surround->padding; }
Length paddingTop() const { return surround->padding.top(); }
@@ -661,8 +665,8 @@ public:
EUserDrag userDrag() const { return static_cast<EUserDrag>(rareNonInheritedData->userDrag); }
EUserSelect userSelect() const { return static_cast<EUserSelect>(rareInheritedData->userSelect); }
bool textOverflow() const { return rareNonInheritedData->textOverflow; }
- EMarginCollapse marginTopCollapse() const { return static_cast<EMarginCollapse>(rareNonInheritedData->marginTopCollapse); }
- EMarginCollapse marginBottomCollapse() const { return static_cast<EMarginCollapse>(rareNonInheritedData->marginBottomCollapse); }
+ EMarginCollapse marginBeforeCollapse() const { return static_cast<EMarginCollapse>(rareNonInheritedData->marginBeforeCollapse); }
+ EMarginCollapse marginAfterCollapse() const { return static_cast<EMarginCollapse>(rareNonInheritedData->marginAfterCollapse); }
EWordBreak wordBreak() const { return static_cast<EWordBreak>(rareInheritedData->wordBreak); }
EWordWrap wordWrap() const { return static_cast<EWordWrap>(rareInheritedData->wordWrap); }
ENBSPMode nbspMode() const { return static_cast<ENBSPMode>(rareInheritedData->nbspMode); }
@@ -1018,8 +1022,8 @@ public:
void setUserDrag(EUserDrag d) { SET_VAR(rareNonInheritedData, userDrag, d); }
void setUserSelect(EUserSelect s) { SET_VAR(rareInheritedData, userSelect, s); }
void setTextOverflow(bool b) { SET_VAR(rareNonInheritedData, textOverflow, b); }
- void setMarginTopCollapse(EMarginCollapse c) { SET_VAR(rareNonInheritedData, marginTopCollapse, c); }
- void setMarginBottomCollapse(EMarginCollapse c) { SET_VAR(rareNonInheritedData, marginBottomCollapse, c); }
+ void setMarginBeforeCollapse(EMarginCollapse c) { SET_VAR(rareNonInheritedData, marginBeforeCollapse, c); }
+ void setMarginAfterCollapse(EMarginCollapse c) { SET_VAR(rareNonInheritedData, marginAfterCollapse, c); }
void setWordBreak(EWordBreak b) { SET_VAR(rareInheritedData, wordBreak, b); }
void setWordWrap(EWordWrap b) { SET_VAR(rareInheritedData, wordWrap, b); }
void setNBSPMode(ENBSPMode b) { SET_VAR(rareInheritedData, nbspMode, b); }
@@ -1250,8 +1254,8 @@ public:
static EUserDrag initialUserDrag() { return DRAG_AUTO; }
static EUserSelect initialUserSelect() { return SELECT_TEXT; }
static bool initialTextOverflow() { return false; }
- static EMarginCollapse initialMarginTopCollapse() { return MCOLLAPSE; }
- static EMarginCollapse initialMarginBottomCollapse() { return MCOLLAPSE; }
+ static EMarginCollapse initialMarginBeforeCollapse() { return MCOLLAPSE; }
+ static EMarginCollapse initialMarginAfterCollapse() { return MCOLLAPSE; }
static EWordBreak initialWordBreak() { return NormalWordBreak; }
static EWordWrap initialWordWrap() { return NormalWordWrap; }
static ENBSPMode initialNBSPMode() { return NBNORMAL; }
diff --git a/WebCore/rendering/style/StyleRareNonInheritedData.cpp b/WebCore/rendering/style/StyleRareNonInheritedData.cpp
index e293984..e0f7f7a 100644
--- a/WebCore/rendering/style/StyleRareNonInheritedData.cpp
+++ b/WebCore/rendering/style/StyleRareNonInheritedData.cpp
@@ -37,8 +37,8 @@ StyleRareNonInheritedData::StyleRareNonInheritedData()
, m_counterDirectives(0)
, userDrag(RenderStyle::initialUserDrag())
, textOverflow(RenderStyle::initialTextOverflow())
- , marginTopCollapse(MCOLLAPSE)
- , marginBottomCollapse(MCOLLAPSE)
+ , marginBeforeCollapse(MCOLLAPSE)
+ , marginAfterCollapse(MCOLLAPSE)
, matchNearestMailBlockquoteColor(RenderStyle::initialMatchNearestMailBlockquoteColor())
, m_appearance(RenderStyle::initialAppearance())
, m_borderFit(RenderStyle::initialBorderFit())
@@ -73,8 +73,8 @@ StyleRareNonInheritedData::StyleRareNonInheritedData(const StyleRareNonInherited
, m_counterDirectives(0)
, userDrag(o.userDrag)
, textOverflow(o.textOverflow)
- , marginTopCollapse(o.marginTopCollapse)
- , marginBottomCollapse(o.marginBottomCollapse)
+ , marginBeforeCollapse(o.marginBeforeCollapse)
+ , marginAfterCollapse(o.marginAfterCollapse)
, matchNearestMailBlockquoteColor(o.matchNearestMailBlockquoteColor)
, m_appearance(o.m_appearance)
, m_borderFit(o.m_borderFit)
@@ -118,8 +118,8 @@ bool StyleRareNonInheritedData::operator==(const StyleRareNonInheritedData& o) c
&& m_counterDirectives == o.m_counterDirectives
&& userDrag == o.userDrag
&& textOverflow == o.textOverflow
- && marginTopCollapse == o.marginTopCollapse
- && marginBottomCollapse == o.marginBottomCollapse
+ && marginBeforeCollapse == o.marginBeforeCollapse
+ && marginAfterCollapse == o.marginAfterCollapse
&& matchNearestMailBlockquoteColor == o.matchNearestMailBlockquoteColor
&& m_appearance == o.m_appearance
&& m_borderFit == o.m_borderFit
diff --git a/WebCore/rendering/style/StyleRareNonInheritedData.h b/WebCore/rendering/style/StyleRareNonInheritedData.h
index 6003ea4..3f693f9 100644
--- a/WebCore/rendering/style/StyleRareNonInheritedData.h
+++ b/WebCore/rendering/style/StyleRareNonInheritedData.h
@@ -98,8 +98,8 @@ public:
unsigned userDrag : 2; // EUserDrag
bool textOverflow : 1; // Whether or not lines that spill out should be truncated with "..."
- unsigned marginTopCollapse : 2; // EMarginCollapse
- unsigned marginBottomCollapse : 2; // EMarginCollapse
+ unsigned marginBeforeCollapse : 2; // EMarginCollapse
+ unsigned marginAfterCollapse : 2; // EMarginCollapse
unsigned matchNearestMailBlockquoteColor : 1; // EMatchNearestMailBlockquoteColor, FIXME: This property needs to be eliminated. It should never have been added.
unsigned m_appearance : 6; // EAppearance
unsigned m_borderFit : 1; // EBorderFit