diff options
Diffstat (limited to 'WebCore/rendering/style')
-rw-r--r-- | WebCore/rendering/style/RenderStyle.cpp | 30 | ||||
-rw-r--r-- | WebCore/rendering/style/RenderStyle.h | 2 |
2 files changed, 32 insertions, 0 deletions
diff --git a/WebCore/rendering/style/RenderStyle.cpp b/WebCore/rendering/style/RenderStyle.cpp index a6e7d59..0ea3673 100644 --- a/WebCore/rendering/style/RenderStyle.cpp +++ b/WebCore/rendering/style/RenderStyle.cpp @@ -1332,6 +1332,36 @@ Length RenderStyle::marginEndUsing(const RenderStyle* otherStyle) const return otherStyle->isLeftToRightDirection() ? marginBottom() : marginTop(); } +void RenderStyle::setMarginStart(Length margin) +{ + if (isHorizontalWritingMode()) { + if (isLeftToRightDirection()) + setMarginLeft(margin); + else + setMarginRight(margin); + } else { + if (isLeftToRightDirection()) + setMarginTop(margin); + else + setMarginBottom(margin); + } +} + +void RenderStyle::setMarginEnd(Length margin) +{ + if (isHorizontalWritingMode()) { + if (isLeftToRightDirection()) + setMarginRight(margin); + else + setMarginLeft(margin); + } else { + if (isLeftToRightDirection()) + setMarginBottom(margin); + else + setMarginTop(margin); + } +} + Length RenderStyle::paddingBefore() const { switch (writingMode()) { diff --git a/WebCore/rendering/style/RenderStyle.h b/WebCore/rendering/style/RenderStyle.h index 75dc58f..c206acd 100644 --- a/WebCore/rendering/style/RenderStyle.h +++ b/WebCore/rendering/style/RenderStyle.h @@ -985,6 +985,8 @@ public: void setMarginBottom(Length v) { SET_VAR(surround, margin.m_bottom, v) } void setMarginLeft(Length v) { SET_VAR(surround, margin.m_left, v) } void setMarginRight(Length v) { SET_VAR(surround, margin.m_right, v) } + void setMarginStart(Length); + void setMarginEnd(Length); void resetPadding() { SET_VAR(surround, padding, LengthBox(Auto)) } void setPaddingBox(const LengthBox& b) { SET_VAR(surround, padding, b) } |