#include "TextRenderingMode.h"
#include "ThemeTypes.h"
#include "UnicodeBidi.h"
+#include "WritingMode.h"
#if ENABLE(CSS_SHADERS)
#include "CustomFilterOperation.h"
#include "CSSValue.h"
#include "RenderStyleConstants.h"
#include "TextDirection.h"
+#include "WritingMode.h"
#include <wtf/PassRefPtr.h>
#include <wtf/RefPtr.h>
class FillLayer;
class CSSValue;
class Animation;
+class RenderStyle;
class StyleImage;
class StyleResolver;
class NinePieceImage;
#include "config.h"
#include "LengthBox.h"
-#include "RenderStyle.h"
-
namespace WebCore {
-Length LengthBox::logicalLeft(const RenderStyle* style) const
+Length LengthBox::logicalLeft(WritingMode writingMode) const
{
- return style->isHorizontalWritingMode() ? m_left : m_top;
+ return isHorizontalWritingMode(writingMode) ? m_left : m_top;
}
-Length LengthBox::logicalRight(const RenderStyle* style) const
+Length LengthBox::logicalRight(WritingMode writingMode) const
{
- return style->isHorizontalWritingMode() ? m_right : m_bottom;
+ return isHorizontalWritingMode(writingMode) ? m_right : m_bottom;
}
-Length LengthBox::before(const RenderStyle* style) const
+Length LengthBox::before(WritingMode writingMode) const
{
- switch (style->writingMode()) {
+ switch (writingMode) {
case TopToBottomWritingMode:
return m_top;
case BottomToTopWritingMode:
return m_top;
}
-Length LengthBox::after(const RenderStyle* style) const
+Length LengthBox::after(WritingMode writingMode) const
{
- switch (style->writingMode()) {
+ switch (writingMode) {
case TopToBottomWritingMode:
return m_bottom;
case BottomToTopWritingMode:
return m_bottom;
}
-Length LengthBox::start(const RenderStyle* style) const
+Length LengthBox::start(WritingMode writingMode, TextDirection direction) const
{
- if (style->isHorizontalWritingMode())
- return style->isLeftToRightDirection() ? m_left : m_right;
- return style->isLeftToRightDirection() ? m_top : m_bottom;
+ if (isHorizontalWritingMode(writingMode))
+ return isLeftToRightDirection(direction) ? m_left : m_right;
+ return isLeftToRightDirection(direction) ? m_top : m_bottom;
}
-Length LengthBox::end(const RenderStyle* style) const
+Length LengthBox::end(WritingMode writingMode, TextDirection direction) const
{
- if (style->isHorizontalWritingMode())
- return style->isLeftToRightDirection() ? m_right : m_left;
- return style->isLeftToRightDirection() ? m_bottom : m_top;
+ if (isHorizontalWritingMode(writingMode))
+ return isLeftToRightDirection(direction) ? m_right : m_left;
+ return isLeftToRightDirection(direction) ? m_bottom : m_top;
}
} // namespace WebCore
#define LengthBox_h
#include "Length.h"
+#include "TextDirection.h"
+#include "WritingMode.h"
namespace WebCore {
Length top() const { return m_top; }
Length bottom() const { return m_bottom; }
- Length logicalLeft(const RenderStyle*) const;
- Length logicalRight(const RenderStyle*) const;
+ Length logicalLeft(WritingMode) const;
+ Length logicalRight(WritingMode) const;
- Length before(const RenderStyle*) const;
- Length after(const RenderStyle*) const;
- Length start(const RenderStyle*) const;
- Length end(const RenderStyle*) const;
+ Length before(WritingMode) const;
+ Length after(WritingMode) const;
+ Length start(WritingMode, TextDirection) const;
+ Length end(WritingMode, TextDirection) const;
bool operator==(const LengthBox& o) const
{
#include "config.h"
#include "FractionalLayoutBoxExtent.h"
-#include "RenderStyle.h"
-
namespace WebCore {
-FractionalLayoutUnit FractionalLayoutBoxExtent::logicalTop(const RenderStyle* style) const
+FractionalLayoutUnit FractionalLayoutBoxExtent::logicalTop(WritingMode writingMode) const
{
- return style->isHorizontalWritingMode() ? m_top : m_left;
+ return isHorizontalWritingMode(writingMode) ? m_top : m_left;
}
-FractionalLayoutUnit FractionalLayoutBoxExtent::logicalBottom(const RenderStyle* style) const
+FractionalLayoutUnit FractionalLayoutBoxExtent::logicalBottom(WritingMode writingMode) const
{
- return style->isHorizontalWritingMode() ? m_bottom : m_right;
+ return isHorizontalWritingMode(writingMode) ? m_bottom : m_right;
}
-FractionalLayoutUnit FractionalLayoutBoxExtent::logicalLeft(const RenderStyle* style) const
+FractionalLayoutUnit FractionalLayoutBoxExtent::logicalLeft(WritingMode writingMode) const
{
- return style->isHorizontalWritingMode() ? m_left : m_top;
+ return isHorizontalWritingMode(writingMode) ? m_left : m_top;
}
-FractionalLayoutUnit FractionalLayoutBoxExtent::logicalRight(const RenderStyle* style) const
+FractionalLayoutUnit FractionalLayoutBoxExtent::logicalRight(WritingMode writingMode) const
{
- return style->isHorizontalWritingMode() ? m_right : m_bottom;
+ return isHorizontalWritingMode(writingMode) ? m_right : m_bottom;
}
-FractionalLayoutUnit FractionalLayoutBoxExtent::before(const RenderStyle* style) const
+FractionalLayoutUnit FractionalLayoutBoxExtent::before(WritingMode writingMode) const
{
- switch (style->writingMode()) {
+ switch (writingMode) {
case TopToBottomWritingMode:
return m_top;
case BottomToTopWritingMode:
return m_top;
}
-FractionalLayoutUnit FractionalLayoutBoxExtent::after(const RenderStyle* style) const
+FractionalLayoutUnit FractionalLayoutBoxExtent::after(WritingMode writingMode) const
{
- switch (style->writingMode()) {
+ switch (writingMode) {
case TopToBottomWritingMode:
return m_bottom;
case BottomToTopWritingMode:
return m_bottom;
}
-FractionalLayoutUnit FractionalLayoutBoxExtent::start(const RenderStyle* style) const
+FractionalLayoutUnit FractionalLayoutBoxExtent::start(WritingMode writingMode, TextDirection direction) const
{
- if (style->isHorizontalWritingMode())
- return style->isLeftToRightDirection() ? m_left : m_right;
- return style->isLeftToRightDirection() ? m_top : m_bottom;
+ if (isHorizontalWritingMode(writingMode))
+ return isLeftToRightDirection(direction) ? m_left : m_right;
+ return isLeftToRightDirection(direction) ? m_top : m_bottom;
}
-FractionalLayoutUnit FractionalLayoutBoxExtent::end(const RenderStyle* style) const
+FractionalLayoutUnit FractionalLayoutBoxExtent::end(WritingMode writingMode, TextDirection direction) const
{
- if (style->isHorizontalWritingMode())
- return style->isLeftToRightDirection() ? m_right : m_left;
- return style->isLeftToRightDirection() ? m_bottom : m_top;
+ if (isHorizontalWritingMode(writingMode))
+ return isLeftToRightDirection(direction) ? m_right : m_left;
+ return isLeftToRightDirection(direction) ? m_bottom : m_top;
}
-void FractionalLayoutBoxExtent::setBefore(const RenderStyle* style, FractionalLayoutUnit value)
+void FractionalLayoutBoxExtent::setBefore(WritingMode writingMode, FractionalLayoutUnit value)
{
- switch (style->writingMode()) {
+ switch (writingMode) {
case TopToBottomWritingMode:
m_top = value;
break;
}
}
-void FractionalLayoutBoxExtent::setAfter(const RenderStyle* style, FractionalLayoutUnit value)
+void FractionalLayoutBoxExtent::setAfter(WritingMode writingMode, FractionalLayoutUnit value)
{
- switch (style->writingMode()) {
+ switch (writingMode) {
case TopToBottomWritingMode:
m_bottom = value;
break;
}
}
-void FractionalLayoutBoxExtent::setStart(const RenderStyle* style, FractionalLayoutUnit value)
+void FractionalLayoutBoxExtent::setStart(WritingMode writingMode, TextDirection direction, FractionalLayoutUnit value)
{
- if (style->isHorizontalWritingMode()) {
- if (style->isLeftToRightDirection())
+ if (isHorizontalWritingMode(writingMode)) {
+ if (isLeftToRightDirection(direction))
m_left = value;
else
m_right = value;
} else {
- if (style->isLeftToRightDirection())
+ if (isLeftToRightDirection(direction))
m_top = value;
else
m_bottom = value;
}
}
-void FractionalLayoutBoxExtent::setEnd(const RenderStyle* style, FractionalLayoutUnit value)
+void FractionalLayoutBoxExtent::setEnd(WritingMode writingMode, TextDirection direction, FractionalLayoutUnit value)
{
- if (style->isHorizontalWritingMode()) {
- if (style->isLeftToRightDirection())
+ if (isHorizontalWritingMode(writingMode)) {
+ if (isLeftToRightDirection(direction))
m_right = value;
else
m_left = value;
} else {
- if (style->isLeftToRightDirection())
+ if (isLeftToRightDirection(direction))
m_bottom = value;
else
m_top = value;
}
}
-FractionalLayoutUnit& FractionalLayoutBoxExtent::mutableLogicalLeft(const RenderStyle* style)
+FractionalLayoutUnit& FractionalLayoutBoxExtent::mutableLogicalLeft(WritingMode writingMode)
{
- return style->isHorizontalWritingMode() ? m_left : m_top;
+ return isHorizontalWritingMode(writingMode) ? m_left : m_top;
}
-FractionalLayoutUnit& FractionalLayoutBoxExtent::mutableLogicalRight(const RenderStyle* style)
+FractionalLayoutUnit& FractionalLayoutBoxExtent::mutableLogicalRight(WritingMode writingMode)
{
- return style->isHorizontalWritingMode() ? m_right : m_bottom;
+ return isHorizontalWritingMode(writingMode) ? m_right : m_bottom;
}
-FractionalLayoutUnit& FractionalLayoutBoxExtent::mutableBefore(const RenderStyle* style)
+FractionalLayoutUnit& FractionalLayoutBoxExtent::mutableBefore(WritingMode writingMode)
{
- return style->isHorizontalWritingMode() ? (style->isFlippedBlocksWritingMode() ? m_bottom : m_top) :
- (style->isFlippedBlocksWritingMode() ? m_right: m_left);
+ return isHorizontalWritingMode(writingMode) ? (isFlippedBlocksWritingMode(writingMode) ? m_bottom : m_top) :
+ (isFlippedBlocksWritingMode(writingMode) ? m_right: m_left);
}
-FractionalLayoutUnit& FractionalLayoutBoxExtent::mutableAfter(const RenderStyle* style)
+FractionalLayoutUnit& FractionalLayoutBoxExtent::mutableAfter(WritingMode writingMode)
{
- return style->isHorizontalWritingMode() ? (style->isFlippedBlocksWritingMode() ? m_top : m_bottom) :
- (style->isFlippedBlocksWritingMode() ? m_left: m_right);
+ return isHorizontalWritingMode(writingMode) ? (isFlippedBlocksWritingMode(writingMode) ? m_top : m_bottom) :
+ (isFlippedBlocksWritingMode(writingMode) ? m_left: m_right);
}
} // namespace WebCore
#define FractionalLayoutBoxExtent_h
#include "FractionalLayoutUnit.h"
+#include "TextDirection.h"
+#include "WritingMode.h"
namespace WebCore {
-class RenderStyle;
-
class FractionalLayoutBoxExtent {
public:
FractionalLayoutBoxExtent() : m_top(0), m_right(0), m_bottom(0), m_left(0) { }
inline void setBottom(FractionalLayoutUnit value) { m_bottom = value; }
inline void setLeft(FractionalLayoutUnit value) { m_left = value; }
- FractionalLayoutUnit logicalTop(const RenderStyle*) const;
- FractionalLayoutUnit logicalBottom(const RenderStyle*) const;
- FractionalLayoutUnit logicalLeft(const RenderStyle*) const;
- FractionalLayoutUnit logicalRight(const RenderStyle*) const;
+ FractionalLayoutUnit logicalTop(WritingMode) const;
+ FractionalLayoutUnit logicalBottom(WritingMode) const;
+ FractionalLayoutUnit logicalLeft(WritingMode) const;
+ FractionalLayoutUnit logicalRight(WritingMode) const;
- FractionalLayoutUnit before(const RenderStyle*) const;
- FractionalLayoutUnit after(const RenderStyle*) const;
- FractionalLayoutUnit start(const RenderStyle*) const;
- FractionalLayoutUnit end(const RenderStyle*) const;
+ FractionalLayoutUnit before(WritingMode) const;
+ FractionalLayoutUnit after(WritingMode) const;
+ FractionalLayoutUnit start(WritingMode, TextDirection) const;
+ FractionalLayoutUnit end(WritingMode, TextDirection) const;
- void setBefore(const RenderStyle*, FractionalLayoutUnit);
- void setAfter(const RenderStyle*, FractionalLayoutUnit);
- void setStart(const RenderStyle*, FractionalLayoutUnit);
- void setEnd(const RenderStyle*, FractionalLayoutUnit);
+ void setBefore(WritingMode, FractionalLayoutUnit);
+ void setAfter(WritingMode, FractionalLayoutUnit);
+ void setStart(WritingMode, TextDirection, FractionalLayoutUnit);
+ void setEnd(WritingMode, TextDirection, FractionalLayoutUnit);
- FractionalLayoutUnit& mutableLogicalLeft(const RenderStyle*);
- FractionalLayoutUnit& mutableLogicalRight(const RenderStyle*);
+ FractionalLayoutUnit& mutableLogicalLeft(WritingMode);
+ FractionalLayoutUnit& mutableLogicalRight(WritingMode);
- FractionalLayoutUnit& mutableBefore(const RenderStyle*);
- FractionalLayoutUnit& mutableAfter(const RenderStyle*);
+ FractionalLayoutUnit& mutableBefore(WritingMode);
+ FractionalLayoutUnit& mutableAfter(WritingMode);
private:
FractionalLayoutUnit m_top;
namespace WebCore {
- enum TextDirection { RTL, LTR };
+enum TextDirection { RTL, LTR };
+
+inline bool isLeftToRightDirection(TextDirection direction) { return direction == LTR; }
}
--- /dev/null
+/*
+ * Copyright (c) 2012, Google Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following disclaimer
+ * in the documentation and/or other materials provided with the
+ * distribution.
+ * * Neither the name of Google Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef WritingMode_h
+#define WritingMode_h
+
+namespace WebCore {
+
+enum WritingMode {
+ TopToBottomWritingMode, RightToLeftWritingMode, LeftToRightWritingMode, BottomToTopWritingMode
+};
+
+// Lines have horizontal orientation; modes horizontal-tb or horizontal-bt.
+inline bool isHorizontalWritingMode(WritingMode writingMode)
+{
+ return writingMode == TopToBottomWritingMode || writingMode == BottomToTopWritingMode;
+}
+
+// Bottom of the line occurs earlier in the block; modes vertical-lr or horizontal-bt.
+inline bool isFlippedLinesWritingMode(WritingMode writingMode)
+{
+ return writingMode == LeftToRightWritingMode || writingMode == BottomToTopWritingMode;
+}
+
+// Block progression increases in the opposite direction to normal; modes vertical-rl or horizontal-bt.
+inline bool isFlippedBlocksWritingMode(WritingMode writingMode)
+{
+ return writingMode == RightToLeftWritingMode || writingMode == BottomToTopWritingMode;
+}
+
+} // namespace WebCore
+
+#endif // WritingMode_h
FractionalLayoutBoxExtent borderOutsets = style->borderImageOutsets();
- LayoutUnit borderOutsetLogicalTop = borderOutsets.logicalTop(style);
- LayoutUnit borderOutsetLogicalBottom = borderOutsets.logicalBottom(style);
- LayoutUnit borderOutsetLogicalLeft = borderOutsets.logicalLeft(style);
- LayoutUnit borderOutsetLogicalRight = borderOutsets.logicalRight(style);
+ LayoutUnit borderOutsetLogicalTop = borderOutsets.logicalTop(style->writingMode());
+ LayoutUnit borderOutsetLogicalBottom = borderOutsets.logicalBottom(style->writingMode());
+ LayoutUnit borderOutsetLogicalLeft = borderOutsets.logicalLeft(style->writingMode());
+ LayoutUnit borderOutsetLogicalRight = borderOutsets.logicalRight(style->writingMode());
// Similar to how glyph overflow works, if our lines are flipped, then it's actually the opposite border that applies, since
// the line is "upside down" in terms of block coordinates. vertical-rl and horizontal-bt are the flipped line modes.
const LayoutUnit bordersPlusPadding = borderAndPaddingLogicalWidth();
const Length marginLogicalLeft = isHorizontal ? style()->marginLeft() : style()->marginTop();
const Length marginLogicalRight = isHorizontal ? style()->marginRight() : style()->marginBottom();
- LayoutUnit& marginLogicalLeftAlias = m_marginBox.mutableLogicalLeft(style());
- LayoutUnit& marginLogicalRightAlias = m_marginBox.mutableLogicalRight(style());
+ LayoutUnit& marginLogicalLeftAlias = m_marginBox.mutableLogicalLeft(style()->writingMode());
+ LayoutUnit& marginLogicalRightAlias = m_marginBox.mutableLogicalRight(style()->writingMode());
Length logicalLeftLength = style()->logicalLeft();
Length logicalRightLength = style()->logicalRight();
const LayoutUnit bordersPlusPadding = borderAndPaddingLogicalHeight();
const Length marginBefore = styleToUse->marginBefore();
const Length marginAfter = styleToUse->marginAfter();
- LayoutUnit& marginBeforeAlias = m_marginBox.mutableBefore(styleToUse);
- LayoutUnit& marginAfterAlias = m_marginBox.mutableAfter(styleToUse);
+ LayoutUnit& marginBeforeAlias = m_marginBox.mutableBefore(styleToUse->writingMode());
+ LayoutUnit& marginAfterAlias = m_marginBox.mutableAfter(styleToUse->writingMode());
Length logicalTopLength = styleToUse->logicalTop();
Length logicalBottomLength = styleToUse->logicalBottom();
Length logicalRight = style()->logicalRight();
Length marginLogicalLeft = isHorizontal ? style()->marginLeft() : style()->marginTop();
Length marginLogicalRight = isHorizontal ? style()->marginRight() : style()->marginBottom();
- LayoutUnit& marginLogicalLeftAlias = m_marginBox.mutableLogicalLeft(style());
- LayoutUnit& marginLogicalRightAlias = m_marginBox.mutableLogicalRight(style());
+ LayoutUnit& marginLogicalLeftAlias = m_marginBox.mutableLogicalLeft(style()->writingMode());
+ LayoutUnit& marginLogicalRightAlias = m_marginBox.mutableLogicalRight(style()->writingMode());
/*-----------------------------------------------------------------------*\
* 1. The used value of 'width' is determined as for inline replaced
// Variables to solve.
Length marginBefore = style()->marginBefore();
Length marginAfter = style()->marginAfter();
- LayoutUnit& marginBeforeAlias = m_marginBox.mutableBefore(style());
- LayoutUnit& marginAfterAlias = m_marginBox.mutableAfter(style());
+ LayoutUnit& marginBeforeAlias = m_marginBox.mutableBefore(style()->writingMode());
+ LayoutUnit& marginAfterAlias = m_marginBox.mutableAfter(style()->writingMode());
Length logicalTop = style()->logicalTop();
Length logicalBottom = style()->logicalBottom();
void setMarginLeft(LayoutUnit margin) { m_marginBox.setLeft(margin); }
void setMarginRight(LayoutUnit margin) { m_marginBox.setRight(margin); }
- virtual LayoutUnit marginLogicalLeft() const { return m_marginBox.logicalLeft(style()); }
- virtual LayoutUnit marginLogicalRight() const { return m_marginBox.logicalRight(style()); }
+ virtual LayoutUnit marginLogicalLeft() const { return m_marginBox.logicalLeft(style()->writingMode()); }
+ virtual LayoutUnit marginLogicalRight() const { return m_marginBox.logicalRight(style()->writingMode()); }
- virtual LayoutUnit marginBefore(const RenderStyle* overrideStyle = 0) const OVERRIDE { return m_marginBox.before(overrideStyle ? overrideStyle : style()); }
- virtual LayoutUnit marginAfter(const RenderStyle* overrideStyle = 0) const OVERRIDE { return m_marginBox.after(overrideStyle ? overrideStyle : style()); }
- virtual LayoutUnit marginStart(const RenderStyle* overrideStyle = 0) const OVERRIDE { return m_marginBox.start(overrideStyle ? overrideStyle : style()); }
- virtual LayoutUnit marginEnd(const RenderStyle* overrideStyle = 0) const OVERRIDE { return m_marginBox.end(overrideStyle ? overrideStyle : style()); }
- void setMarginBefore(LayoutUnit value, const RenderStyle* overrideStyle = 0) { m_marginBox.setBefore(overrideStyle ? overrideStyle : style(), value); }
- void setMarginAfter(LayoutUnit value, const RenderStyle* overrideStyle = 0) { m_marginBox.setAfter(overrideStyle ? overrideStyle : style(), value); }
- void setMarginStart(LayoutUnit value, const RenderStyle* overrideStyle = 0) { m_marginBox.setStart(overrideStyle ? overrideStyle : style(), value); }
- void setMarginEnd(LayoutUnit value, const RenderStyle* overrideStyle = 0) { m_marginBox.setEnd(overrideStyle ? overrideStyle : style(), value); }
+ virtual LayoutUnit marginBefore(const RenderStyle* overrideStyle = 0) const OVERRIDE { return m_marginBox.before((overrideStyle ? overrideStyle : style())->writingMode()); }
+ virtual LayoutUnit marginAfter(const RenderStyle* overrideStyle = 0) const OVERRIDE { return m_marginBox.after((overrideStyle ? overrideStyle : style())->writingMode()); }
+ virtual LayoutUnit marginStart(const RenderStyle* overrideStyle = 0) const OVERRIDE
+ {
+ const RenderStyle* styleToUse = overrideStyle ? overrideStyle : style();
+ return m_marginBox.start(styleToUse->writingMode(), styleToUse->direction());
+ }
+ virtual LayoutUnit marginEnd(const RenderStyle* overrideStyle = 0) const OVERRIDE
+ {
+ const RenderStyle* styleToUse = overrideStyle ? overrideStyle : style();
+ return m_marginBox.end(styleToUse->writingMode(), styleToUse->direction());
+ }
+ void setMarginBefore(LayoutUnit value, const RenderStyle* overrideStyle = 0) { m_marginBox.setBefore((overrideStyle ? overrideStyle : style())->writingMode(), value); }
+ void setMarginAfter(LayoutUnit value, const RenderStyle* overrideStyle = 0) { m_marginBox.setAfter((overrideStyle ? overrideStyle : style())->writingMode(), value); }
+ void setMarginStart(LayoutUnit value, const RenderStyle* overrideStyle = 0)
+ {
+ const RenderStyle* styleToUse = overrideStyle ? overrideStyle : style();
+ m_marginBox.setStart(styleToUse->writingMode(), styleToUse->direction(), value);
+ }
+ void setMarginEnd(LayoutUnit value, const RenderStyle* overrideStyle = 0)
+ {
+ const RenderStyle* styleToUse = overrideStyle ? overrideStyle : style();
+ m_marginBox.setEnd(styleToUse->writingMode(), styleToUse->direction(), value);
+ }
// The following five functions are used to implement collapsing margins.
// All objects know their maximal positive and negative margins. The
Length bottom() const { return surround->offset.bottom(); }
// Accessors for positioned object edges that take into account writing mode.
- Length logicalLeft() const { return surround->offset.logicalLeft(this); }
- Length logicalRight() const { return surround->offset.logicalRight(this); }
- Length logicalTop() const { return surround->offset.before(this); }
- Length logicalBottom() const { return surround->offset.after(this); }
+ Length logicalLeft() const { return surround->offset.logicalLeft(writingMode()); }
+ Length logicalRight() const { return surround->offset.logicalRight(writingMode()); }
+ Length logicalTop() const { return surround->offset.before(writingMode()); }
+ Length logicalBottom() const { return surround->offset.after(writingMode()); }
// Whether or not a positioned element requires normal flow x/y to be computed
// to determine its position.
Length marginBottom() const { return surround->margin.bottom(); }
Length marginLeft() const { return surround->margin.left(); }
Length marginRight() const { return surround->margin.right(); }
- Length marginBefore() const { return surround->margin.before(this); }
- Length marginAfter() const { return surround->margin.after(this); }
- Length marginStart() const { return surround->margin.start(this); }
- Length marginEnd() const { return surround->margin.end(this); }
- Length marginStartUsing(const RenderStyle* otherStyle) const { return surround->margin.start(otherStyle); }
- Length marginEndUsing(const RenderStyle* otherStyle) const { return surround->margin.end(otherStyle); }
- Length marginBeforeUsing(const RenderStyle* otherStyle) const { return surround->margin.before(otherStyle); }
- Length marginAfterUsing(const RenderStyle* otherStyle) const { return surround->margin.after(otherStyle); }
+ Length marginBefore() const { return surround->margin.before(writingMode()); }
+ Length marginAfter() const { return surround->margin.after(writingMode()); }
+ Length marginStart() const { return surround->margin.start(writingMode(), direction()); }
+ Length marginEnd() const { return surround->margin.end(writingMode(), direction()); }
+ Length marginStartUsing(const RenderStyle* otherStyle) const { return surround->margin.start(otherStyle->writingMode(), otherStyle->direction()); }
+ Length marginEndUsing(const RenderStyle* otherStyle) const { return surround->margin.end(otherStyle->writingMode(), otherStyle->direction()); }
+ Length marginBeforeUsing(const RenderStyle* otherStyle) const { return surround->margin.before(otherStyle->writingMode()); }
+ Length marginAfterUsing(const RenderStyle* otherStyle) const { return surround->margin.after(otherStyle->writingMode()); }
LengthBox paddingBox() const { return surround->padding; }
Length paddingTop() const { return surround->padding.top(); }
Length paddingBottom() const { return surround->padding.bottom(); }
Length paddingLeft() const { return surround->padding.left(); }
Length paddingRight() const { return surround->padding.right(); }
- Length paddingBefore() const { return surround->padding.before(this); }
- Length paddingAfter() const { return surround->padding.after(this); }
- Length paddingStart() const { return surround->padding.start(this); }
- Length paddingEnd() const { return surround->padding.end(this); }
+ Length paddingBefore() const { return surround->padding.before(writingMode()); }
+ Length paddingAfter() const { return surround->padding.after(writingMode()); }
+ Length paddingStart() const { return surround->padding.start(writingMode(), direction()); }
+ Length paddingEnd() const { return surround->padding.end(writingMode(), direction()); }
ECursor cursor() const { return static_cast<ECursor>(inherited_flags._cursor_style); }
TAUTO, TFIXED
};
-// CSS Text Layout Module Level 3: Vertical writing support
-enum WritingMode {
- TopToBottomWritingMode, RightToLeftWritingMode, LeftToRightWritingMode, BottomToTopWritingMode
-};
-
enum TextCombine {
TextCombineNone, TextCombineHorizontal
};