[SCM] WebKit Debian packaging branch, debian/experimental, updated. upstream/1.3.3-9427-gc2be6fc
hyatt at apple.com
hyatt at apple.com
Wed Dec 22 13:58:35 UTC 2010
The following commit has been merged in the debian/experimental branch:
commit c0fa1631e18d46bcfd60dbcab193070c3228a963
Author: hyatt at apple.com <hyatt at apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date: Thu Sep 30 20:01:33 2010 +0000
https://bugs.webkit.org/show_bug.cgi?id=46928
Reviewed by Beth Dakin.
Add isLeftToRightDirection() to RenderStyle and change callers that did direction() == LTR and direction() == RTL to use this instead.
* css/CSSStyleSelector.cpp:
(WebCore::CSSStyleSelector::isLeftPage):
(WebCore::CSSStyleSelector::applyProperty):
* editing/Editor.cpp:
(WebCore::Editor::hasBidiSelection):
* editing/VisiblePosition.cpp:
(WebCore::VisiblePosition::leftVisuallyDistinctCandidate):
(WebCore::VisiblePosition::rightVisuallyDistinctCandidate):
* html/canvas/CanvasRenderingContext2D.cpp:
(WebCore::CanvasRenderingContext2D::drawTextInternal):
* rendering/InlineBox.h:
(WebCore::InlineBox::isLeftToRightDirection):
(WebCore::InlineBox::caretLeftmostOffset):
(WebCore::InlineBox::caretRightmostOffset):
* rendering/InlineFlowBox.cpp:
(WebCore::InlineFlowBox::determineSpacingForFlowBoxes):
(WebCore::InlineFlowBox::placeBoxesInInlineDirection):
(WebCore::InlineFlowBox::paintTextDecorations):
* rendering/InlineIterator.h:
(WebCore::InlineIterator::direction):
* rendering/InlineTextBox.cpp:
(WebCore::InlineTextBox::selectionRect):
(WebCore::InlineTextBox::placeEllipsisBox):
(WebCore::InlineTextBox::paint):
(WebCore::InlineTextBox::paintSelection):
(WebCore::InlineTextBox::paintCompositionBackground):
(WebCore::InlineTextBox::paintDecoration):
(WebCore::InlineTextBox::paintSpellingOrGrammarMarker):
(WebCore::InlineTextBox::paintTextMatchMarker):
(WebCore::InlineTextBox::computeRectForReplacementMarker):
(WebCore::InlineTextBox::textPos):
(WebCore::InlineTextBox::offsetForPosition):
(WebCore::InlineTextBox::positionForOffset):
* rendering/RenderBlock.cpp:
(WebCore::RenderBlock::adjustPositionedBlock):
(WebCore::RenderBlock::determineLogicalLeftPositionForChild):
(WebCore::RenderBlock::paintColumnRules):
(WebCore::RenderBlock::paintColumnContents):
(WebCore::RenderBlock::getHorizontalSelectionGapInfo):
(WebCore::RenderBlock::logicalLeftOffsetForLine):
(WebCore::RenderBlock::logicalRightOffsetForLine):
(WebCore::RenderBlock::rightmostPosition):
(WebCore::RenderBlock::leftmostPosition):
(WebCore::RenderBlock::columnRectAt):
(WebCore::RenderBlock::layoutColumns):
(WebCore::getBorderPaddingMargin):
(WebCore::RenderBlock::localCaretRect):
(WebCore::RenderBlock::marginStartForChild):
(WebCore::RenderBlock::marginEndForChild):
(WebCore::RenderBlock::setMarginStartForChild):
(WebCore::RenderBlock::setMarginEndForChild):
* rendering/RenderBlockLineLayout.cpp:
(WebCore::getBorderPaddingMargin):
(WebCore::RenderBlock::constructLine):
(WebCore::RenderBlock::computeInlineDirectionPositionsForLine):
(WebCore::RenderBlock::determineStartPosition):
(WebCore::RenderBlock::skipTrailingWhitespace):
(WebCore::RenderBlock::skipLeadingWhitespace):
(WebCore::RenderBlock::findNextLineBreak):
(WebCore::RenderBlock::checkLinesForTextOverflow):
* rendering/RenderBox.cpp:
(WebCore::RenderBox::marginStart):
(WebCore::RenderBox::marginEnd):
(WebCore::RenderBox::setMarginStart):
(WebCore::RenderBox::setMarginEnd):
(WebCore::RenderBox::scrollWidth):
(WebCore::RenderBox::computeInlineDirectionMargins):
(WebCore::RenderBox::containingBlockWidthForPositioned):
(WebCore::RenderBox::computePositionedLogicalWidthUsing):
(WebCore::RenderBox::computePositionedLogicalWidthReplaced):
(WebCore::RenderBox::localCaretRect):
* rendering/RenderBoxModelObject.cpp:
(WebCore::RenderBoxModelObject::relativePositionOffsetX):
* rendering/RenderFieldset.cpp:
(WebCore::RenderFieldset::layoutLegend):
* rendering/RenderFileUploadControl.cpp:
(WebCore::RenderFileUploadControl::paintObject):
* rendering/RenderFlexibleBox.cpp:
(WebCore::FlexBoxIterator::FlexBoxIterator):
(WebCore::RenderFlexibleBox::layoutHorizontalBox):
(WebCore::RenderFlexibleBox::layoutVerticalBox):
* rendering/RenderLayer.cpp:
(WebCore::RenderLayer::computeScrollDimensions):
* rendering/RenderListBox.cpp:
(WebCore::RenderListBox::paintItemForeground):
* rendering/RenderListItem.cpp:
(WebCore::RenderListItem::positionListMarker):
(WebCore::RenderListItem::markerTextWithSuffix):
* rendering/RenderListMarker.cpp:
(WebCore::RenderListMarker::paint):
(WebCore::RenderListMarker::updateMargins):
(WebCore::RenderListMarker::suffix):
* rendering/RenderMarquee.cpp:
(WebCore::RenderMarquee::computePosition):
* rendering/RenderMeter.cpp:
(WebCore::RenderMeter::valuePartRect):
* rendering/RenderProgress.cpp:
(WebCore::RenderProgress::valuePartRect):
* rendering/RenderTable.cpp:
(WebCore::RenderTable::calcBorderLeft):
(WebCore::RenderTable::calcBorderRight):
* rendering/RenderTableCell.cpp:
(WebCore::RenderTableCell::clippedOverflowRectForRepaint):
(WebCore::RenderTableCell::borderHalfLeft):
(WebCore::RenderTableCell::borderHalfRight):
(WebCore::RenderTableCell::collectBorderStyles):
(WebCore::RenderTableCell::paintCollapsedBorder):
* rendering/RenderTableSection.cpp:
(WebCore::RenderTableSection::layoutRows):
(WebCore::RenderTableSection::recalcOuterBorder):
(WebCore::RenderTableSection::paintObject):
(WebCore::RenderTableSection::nodeAtPoint):
* rendering/RenderText.cpp:
(WebCore::RenderText::localCaretRect):
(WebCore::RenderText::positionLineBox):
* rendering/RenderTextControlSingleLine.cpp:
(WebCore::RenderTextControlSingleLine::forwardEvent):
* rendering/RenderThemeMac.mm:
(WebCore::RenderThemeMac::levelIndicatorFor):
(WebCore::RenderThemeMac::paintProgressBar):
* rendering/RenderTreeAsText.cpp:
(WebCore::writeTextRun):
* rendering/SVGInlineTextBox.cpp:
(WebCore::SVGInlineTextBox::measureCharacter):
(WebCore::SVGInlineTextBox::buildLayoutInformation):
* rendering/SVGRenderTreeAsText.cpp:
(WebCore::writeSVGInlineTextBox):
* rendering/SVGTextLayoutUtilities.cpp:
(WebCore::svgTextRunForInlineTextBox):
* rendering/style/RenderStyle.cpp:
(WebCore::RenderStyle::borderStartWidth):
(WebCore::RenderStyle::borderEndWidth):
(WebCore::RenderStyle::marginStart):
(WebCore::RenderStyle::marginEnd):
(WebCore::RenderStyle::marginStartUsing):
(WebCore::RenderStyle::marginEndUsing):
(WebCore::RenderStyle::paddingStart):
(WebCore::RenderStyle::paddingEnd):
* rendering/style/RenderStyle.h:
(WebCore::InheritedFlags::isLeftToRightDirection):
* wml/WMLTableElement.cpp:
(WebCore::WMLTableElement::alignCells):
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@68817 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index c087e27..ee3ecac 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,5 +1,156 @@
2010-09-30 David Hyatt <hyatt at apple.com>
+ Reviewed by Beth Dakin.
+
+ https://bugs.webkit.org/show_bug.cgi?id=46928
+
+ Add isLeftToRightDirection() to RenderStyle and change callers that did direction() == LTR and direction() == RTL to use this instead.
+
+ * css/CSSStyleSelector.cpp:
+ (WebCore::CSSStyleSelector::isLeftPage):
+ (WebCore::CSSStyleSelector::applyProperty):
+ * editing/Editor.cpp:
+ (WebCore::Editor::hasBidiSelection):
+ * editing/VisiblePosition.cpp:
+ (WebCore::VisiblePosition::leftVisuallyDistinctCandidate):
+ (WebCore::VisiblePosition::rightVisuallyDistinctCandidate):
+ * html/canvas/CanvasRenderingContext2D.cpp:
+ (WebCore::CanvasRenderingContext2D::drawTextInternal):
+ * rendering/InlineBox.h:
+ (WebCore::InlineBox::isLeftToRightDirection):
+ (WebCore::InlineBox::caretLeftmostOffset):
+ (WebCore::InlineBox::caretRightmostOffset):
+ * rendering/InlineFlowBox.cpp:
+ (WebCore::InlineFlowBox::determineSpacingForFlowBoxes):
+ (WebCore::InlineFlowBox::placeBoxesInInlineDirection):
+ (WebCore::InlineFlowBox::paintTextDecorations):
+ * rendering/InlineIterator.h:
+ (WebCore::InlineIterator::direction):
+ * rendering/InlineTextBox.cpp:
+ (WebCore::InlineTextBox::selectionRect):
+ (WebCore::InlineTextBox::placeEllipsisBox):
+ (WebCore::InlineTextBox::paint):
+ (WebCore::InlineTextBox::paintSelection):
+ (WebCore::InlineTextBox::paintCompositionBackground):
+ (WebCore::InlineTextBox::paintDecoration):
+ (WebCore::InlineTextBox::paintSpellingOrGrammarMarker):
+ (WebCore::InlineTextBox::paintTextMatchMarker):
+ (WebCore::InlineTextBox::computeRectForReplacementMarker):
+ (WebCore::InlineTextBox::textPos):
+ (WebCore::InlineTextBox::offsetForPosition):
+ (WebCore::InlineTextBox::positionForOffset):
+ * rendering/RenderBlock.cpp:
+ (WebCore::RenderBlock::adjustPositionedBlock):
+ (WebCore::RenderBlock::determineLogicalLeftPositionForChild):
+ (WebCore::RenderBlock::paintColumnRules):
+ (WebCore::RenderBlock::paintColumnContents):
+ (WebCore::RenderBlock::getHorizontalSelectionGapInfo):
+ (WebCore::RenderBlock::logicalLeftOffsetForLine):
+ (WebCore::RenderBlock::logicalRightOffsetForLine):
+ (WebCore::RenderBlock::rightmostPosition):
+ (WebCore::RenderBlock::leftmostPosition):
+ (WebCore::RenderBlock::columnRectAt):
+ (WebCore::RenderBlock::layoutColumns):
+ (WebCore::getBorderPaddingMargin):
+ (WebCore::RenderBlock::localCaretRect):
+ (WebCore::RenderBlock::marginStartForChild):
+ (WebCore::RenderBlock::marginEndForChild):
+ (WebCore::RenderBlock::setMarginStartForChild):
+ (WebCore::RenderBlock::setMarginEndForChild):
+ * rendering/RenderBlockLineLayout.cpp:
+ (WebCore::getBorderPaddingMargin):
+ (WebCore::RenderBlock::constructLine):
+ (WebCore::RenderBlock::computeInlineDirectionPositionsForLine):
+ (WebCore::RenderBlock::determineStartPosition):
+ (WebCore::RenderBlock::skipTrailingWhitespace):
+ (WebCore::RenderBlock::skipLeadingWhitespace):
+ (WebCore::RenderBlock::findNextLineBreak):
+ (WebCore::RenderBlock::checkLinesForTextOverflow):
+ * rendering/RenderBox.cpp:
+ (WebCore::RenderBox::marginStart):
+ (WebCore::RenderBox::marginEnd):
+ (WebCore::RenderBox::setMarginStart):
+ (WebCore::RenderBox::setMarginEnd):
+ (WebCore::RenderBox::scrollWidth):
+ (WebCore::RenderBox::computeInlineDirectionMargins):
+ (WebCore::RenderBox::containingBlockWidthForPositioned):
+ (WebCore::RenderBox::computePositionedLogicalWidthUsing):
+ (WebCore::RenderBox::computePositionedLogicalWidthReplaced):
+ (WebCore::RenderBox::localCaretRect):
+ * rendering/RenderBoxModelObject.cpp:
+ (WebCore::RenderBoxModelObject::relativePositionOffsetX):
+ * rendering/RenderFieldset.cpp:
+ (WebCore::RenderFieldset::layoutLegend):
+ * rendering/RenderFileUploadControl.cpp:
+ (WebCore::RenderFileUploadControl::paintObject):
+ * rendering/RenderFlexibleBox.cpp:
+ (WebCore::FlexBoxIterator::FlexBoxIterator):
+ (WebCore::RenderFlexibleBox::layoutHorizontalBox):
+ (WebCore::RenderFlexibleBox::layoutVerticalBox):
+ * rendering/RenderLayer.cpp:
+ (WebCore::RenderLayer::computeScrollDimensions):
+ * rendering/RenderListBox.cpp:
+ (WebCore::RenderListBox::paintItemForeground):
+ * rendering/RenderListItem.cpp:
+ (WebCore::RenderListItem::positionListMarker):
+ (WebCore::RenderListItem::markerTextWithSuffix):
+ * rendering/RenderListMarker.cpp:
+ (WebCore::RenderListMarker::paint):
+ (WebCore::RenderListMarker::updateMargins):
+ (WebCore::RenderListMarker::suffix):
+ * rendering/RenderMarquee.cpp:
+ (WebCore::RenderMarquee::computePosition):
+ * rendering/RenderMeter.cpp:
+ (WebCore::RenderMeter::valuePartRect):
+ * rendering/RenderProgress.cpp:
+ (WebCore::RenderProgress::valuePartRect):
+ * rendering/RenderTable.cpp:
+ (WebCore::RenderTable::calcBorderLeft):
+ (WebCore::RenderTable::calcBorderRight):
+ * rendering/RenderTableCell.cpp:
+ (WebCore::RenderTableCell::clippedOverflowRectForRepaint):
+ (WebCore::RenderTableCell::borderHalfLeft):
+ (WebCore::RenderTableCell::borderHalfRight):
+ (WebCore::RenderTableCell::collectBorderStyles):
+ (WebCore::RenderTableCell::paintCollapsedBorder):
+ * rendering/RenderTableSection.cpp:
+ (WebCore::RenderTableSection::layoutRows):
+ (WebCore::RenderTableSection::recalcOuterBorder):
+ (WebCore::RenderTableSection::paintObject):
+ (WebCore::RenderTableSection::nodeAtPoint):
+ * rendering/RenderText.cpp:
+ (WebCore::RenderText::localCaretRect):
+ (WebCore::RenderText::positionLineBox):
+ * rendering/RenderTextControlSingleLine.cpp:
+ (WebCore::RenderTextControlSingleLine::forwardEvent):
+ * rendering/RenderThemeMac.mm:
+ (WebCore::RenderThemeMac::levelIndicatorFor):
+ (WebCore::RenderThemeMac::paintProgressBar):
+ * rendering/RenderTreeAsText.cpp:
+ (WebCore::writeTextRun):
+ * rendering/SVGInlineTextBox.cpp:
+ (WebCore::SVGInlineTextBox::measureCharacter):
+ (WebCore::SVGInlineTextBox::buildLayoutInformation):
+ * rendering/SVGRenderTreeAsText.cpp:
+ (WebCore::writeSVGInlineTextBox):
+ * rendering/SVGTextLayoutUtilities.cpp:
+ (WebCore::svgTextRunForInlineTextBox):
+ * rendering/style/RenderStyle.cpp:
+ (WebCore::RenderStyle::borderStartWidth):
+ (WebCore::RenderStyle::borderEndWidth):
+ (WebCore::RenderStyle::marginStart):
+ (WebCore::RenderStyle::marginEnd):
+ (WebCore::RenderStyle::marginStartUsing):
+ (WebCore::RenderStyle::marginEndUsing):
+ (WebCore::RenderStyle::paddingStart):
+ (WebCore::RenderStyle::paddingEnd):
+ * rendering/style/RenderStyle.h:
+ (WebCore::InheritedFlags::isLeftToRightDirection):
+ * wml/WMLTableElement.cpp:
+ (WebCore::WMLTableElement::alignCells):
+
+2010-09-30 David Hyatt <hyatt at apple.com>
+
Reviewed by Simon Fraser.
https://bugs.webkit.org/show_bug.cgi?id=46923
diff --git a/WebCore/css/CSSStyleSelector.cpp b/WebCore/css/CSSStyleSelector.cpp
index eafa250..86b93b4 100644
--- a/WebCore/css/CSSStyleSelector.cpp
+++ b/WebCore/css/CSSStyleSelector.cpp
@@ -3012,7 +3012,7 @@ void CSSStyleSelector::matchPageRulesForList(CSSRuleDataList* rules, bool isLeft
bool CSSStyleSelector::isLeftPage(int pageIndex) const
{
bool isFirstPageLeft = false;
- if (m_rootElementStyle->direction() == RTL)
+ if (!m_rootElementStyle->isLeftToRightDirection())
isFirstPageLeft = true;
return (pageIndex + (isFirstPageLeft ? 1 : 0)) % 2;
@@ -4190,9 +4190,9 @@ void CSSStyleSelector::applyProperty(int id, CSSValue *value)
return;
int id = primitiveValue->getIdent();
if (id == CSSValueStart)
- m_style->setTextAlign(m_style->direction() == LTR ? LEFT : RIGHT);
+ m_style->setTextAlign(m_style->isLeftToRightDirection() ? LEFT : RIGHT);
else if (id == CSSValueEnd)
- m_style->setTextAlign(m_style->direction() == LTR ? RIGHT : LEFT);
+ m_style->setTextAlign(m_style->isLeftToRightDirection() ? RIGHT : LEFT);
else
m_style->setTextAlign(*primitiveValue);
return;
diff --git a/WebCore/editing/Editor.cpp b/WebCore/editing/Editor.cpp
index 69ba7f4..63c466e 100644
--- a/WebCore/editing/Editor.cpp
+++ b/WebCore/editing/Editor.cpp
@@ -643,7 +643,7 @@ bool Editor::hasBidiSelection() const
return false;
RenderStyle* style = renderer->style();
- if (style->direction() == RTL)
+ if (!style->isLeftToRightDirection())
return true;
return toRenderBlock(renderer)->containsNonZeroBidiLevel();
diff --git a/WebCore/editing/VisiblePosition.cpp b/WebCore/editing/VisiblePosition.cpp
index 1b4a514..a1f9918 100644
--- a/WebCore/editing/VisiblePosition.cpp
+++ b/WebCore/editing/VisiblePosition.cpp
@@ -123,9 +123,9 @@ Position VisiblePosition::leftVisuallyDistinctCandidate() const
while (true) {
if ((renderer->isReplaced() || renderer->isBR()) && offset == box->caretRightmostOffset())
- return box->direction() == LTR ? previousVisuallyDistinctCandidate(m_deepPosition) : nextVisuallyDistinctCandidate(m_deepPosition);
+ return box->isLeftToRightDirection() ? previousVisuallyDistinctCandidate(m_deepPosition) : nextVisuallyDistinctCandidate(m_deepPosition);
- offset = box->direction() == LTR ? renderer->previousOffset(offset) : renderer->nextOffset(offset);
+ offset = box->isLeftToRightDirection() ? renderer->previousOffset(offset) : renderer->nextOffset(offset);
int caretMinOffset = box->caretMinOffset();
int caretMaxOffset = box->caretMaxOffset();
@@ -133,7 +133,7 @@ Position VisiblePosition::leftVisuallyDistinctCandidate() const
if (offset > caretMinOffset && offset < caretMaxOffset)
break;
- if (box->direction() == LTR ? offset < caretMinOffset : offset > caretMaxOffset) {
+ if (box->isLeftToRightDirection() ? offset < caretMinOffset : offset > caretMaxOffset) {
// Overshot to the left.
InlineBox* prevBox = box->prevLeafChild();
if (!prevBox)
@@ -259,9 +259,9 @@ Position VisiblePosition::rightVisuallyDistinctCandidate() const
while (true) {
if ((renderer->isReplaced() || renderer->isBR()) && offset == box->caretLeftmostOffset())
- return box->direction() == LTR ? nextVisuallyDistinctCandidate(m_deepPosition) : previousVisuallyDistinctCandidate(m_deepPosition);
+ return box->isLeftToRightDirection() ? nextVisuallyDistinctCandidate(m_deepPosition) : previousVisuallyDistinctCandidate(m_deepPosition);
- offset = box->direction() == LTR ? renderer->nextOffset(offset) : renderer->previousOffset(offset);
+ offset = box->isLeftToRightDirection() ? renderer->nextOffset(offset) : renderer->previousOffset(offset);
int caretMinOffset = box->caretMinOffset();
int caretMaxOffset = box->caretMaxOffset();
@@ -269,7 +269,7 @@ Position VisiblePosition::rightVisuallyDistinctCandidate() const
if (offset > caretMinOffset && offset < caretMaxOffset)
break;
- if (box->direction() == LTR ? offset > caretMaxOffset : offset < caretMinOffset) {
+ if (box->isLeftToRightDirection() ? offset > caretMaxOffset : offset < caretMinOffset) {
// Overshot to the right.
InlineBox* nextBox = box->nextLeafChild();
if (!nextBox)
diff --git a/WebCore/html/canvas/CanvasRenderingContext2D.cpp b/WebCore/html/canvas/CanvasRenderingContext2D.cpp
index 161a891..58b19a2 100644
--- a/WebCore/html/canvas/CanvasRenderingContext2D.cpp
+++ b/WebCore/html/canvas/CanvasRenderingContext2D.cpp
@@ -1749,7 +1749,7 @@ void CanvasRenderingContext2D::drawTextInternal(const String& text, float x, flo
// FIXME: Need to turn off font smoothing.
RenderStyle* computedStyle = canvas()->computedStyle();
- bool rtl = computedStyle ? computedStyle->direction() == RTL : false;
+ bool rtl = computedStyle ? !computedStyle->isLeftToRightDirection() : false;
bool override = computedStyle ? computedStyle->unicodeBidi() == Override : false;
unsigned length = text.length();
diff --git a/WebCore/rendering/InlineBox.h b/WebCore/rendering/InlineBox.h
index 1cd88ff..e4f10e5 100644
--- a/WebCore/rendering/InlineBox.h
+++ b/WebCore/rendering/InlineBox.h
@@ -251,8 +251,9 @@ public:
unsigned char bidiLevel() const { return m_bidiEmbeddingLevel; }
void setBidiLevel(unsigned char level) { m_bidiEmbeddingLevel = level; }
TextDirection direction() const { return m_bidiEmbeddingLevel % 2 ? RTL : LTR; }
- int caretLeftmostOffset() const { return direction() == LTR ? caretMinOffset() : caretMaxOffset(); }
- int caretRightmostOffset() const { return direction() == LTR ? caretMaxOffset() : caretMinOffset(); }
+ bool isLeftToRightDirection() const { return direction() == LTR; }
+ int caretLeftmostOffset() const { return isLeftToRightDirection() ? caretMinOffset() : caretMaxOffset(); }
+ int caretRightmostOffset() const { return isLeftToRightDirection() ? caretMaxOffset() : caretMinOffset(); }
virtual void clearTruncation() { }
diff --git a/WebCore/rendering/InlineFlowBox.cpp b/WebCore/rendering/InlineFlowBox.cpp
index 588d054..5577b22 100644
--- a/WebCore/rendering/InlineFlowBox.cpp
+++ b/WebCore/rendering/InlineFlowBox.cpp
@@ -209,7 +209,7 @@ void InlineFlowBox::determineSpacingForFlowBoxes(bool lastLine, RenderObject* en
// The root inline box never has borders/margins/padding.
if (parent()) {
- bool ltr = renderer()->style()->direction() == LTR;
+ bool ltr = renderer()->style()->isLeftToRightDirection();
// Check to see if all initial lines are unconstructed. If so, then
// we know the inline began on this line (unless we are a continuation).
@@ -309,7 +309,7 @@ int InlineFlowBox::placeBoxesInInlineDirection(int xPos, bool& needsWordSpacing,
xPos += text->logicalWidth();
} else {
if (curr->renderer()->isPositioned()) {
- if (curr->renderer()->parent()->style()->direction() == LTR)
+ if (curr->renderer()->parent()->style()->isLeftToRightDirection())
curr->setX(xPos);
else
// Our offset that we cache needs to be from the edge of the right border box and
@@ -945,7 +945,7 @@ void InlineFlowBox::paintTextDecorations(PaintInfo& paintInfo, int tx, int ty, b
if (rootLine->ellipsisBox()) {
int ellipsisX = m_x + rootLine->ellipsisBox()->x();
int ellipsisWidth = rootLine->ellipsisBox()->logicalWidth();
- bool ltr = renderer()->style()->direction() == LTR;
+ bool ltr = renderer()->style()->isLeftToRightDirection();
if (rootLine == this) {
// Trim w and x so that the underline isn't drawn underneath the ellipsis.
// ltr: is our right edge farther right than the right edge of the ellipsis.
diff --git a/WebCore/rendering/InlineIterator.h b/WebCore/rendering/InlineIterator.h
index 9310ea8..0f53901 100644
--- a/WebCore/rendering/InlineIterator.h
+++ b/WebCore/rendering/InlineIterator.h
@@ -220,7 +220,7 @@ ALWAYS_INLINE WTF::Unicode::Direction InlineIterator::direction() const
return WTF::Unicode::direction(c);
if (obj && obj->isListMarker())
- return obj->style()->direction() == LTR ? WTF::Unicode::LeftToRight : WTF::Unicode::RightToLeft;
+ return obj->style()->isLeftToRightDirection() ? WTF::Unicode::LeftToRight : WTF::Unicode::RightToLeft;
return WTF::Unicode::OtherNeutral;
}
diff --git a/WebCore/rendering/InlineTextBox.cpp b/WebCore/rendering/InlineTextBox.cpp
index 68bff3c..ed12a6e 100644
--- a/WebCore/rendering/InlineTextBox.cpp
+++ b/WebCore/rendering/InlineTextBox.cpp
@@ -137,7 +137,7 @@ IntRect InlineTextBox::selectionRect(int tx, int ty, int startPos, int endPos)
ePos = len;
}
- IntRect r = enclosingIntRect(f.selectionRectForText(TextRun(characters, len, textObj->allowTabs(), textPos(), m_toAdd, direction() == RTL, m_dirOverride),
+ IntRect r = enclosingIntRect(f.selectionRectForText(TextRun(characters, len, textObj->allowTabs(), textPos(), m_toAdd, !isLeftToRightDirection(), m_dirOverride),
IntPoint(tx + m_x, ty + selTop), selHeight, sPos, ePos));
if (r.x() > tx + m_x + m_logicalWidth)
r.setWidth(0);
@@ -198,7 +198,7 @@ int InlineTextBox::placeEllipsisBox(bool flowIsLTR, int visibleLeftEdge, int vis
// The inline box may have different directionality than it's parent. Since truncation
// behavior depends both on both the parent and the inline block's directionality, we
// must keep track of these separately.
- bool ltr = direction() == LTR;
+ bool ltr = isLeftToRightDirection();
if (ltr != flowIsLTR) {
// Width in pixels of the visible portion of the box, excluding the ellipsis.
int visibleBoxWidth = visibleRightEdge - visibleLeftEdge - ellipsisWidth;
@@ -382,8 +382,7 @@ void InlineTextBox::paint(PaintInfo& paintInfo, int tx, int ty)
return;
if (m_truncation != cNoTruncation) {
- TextDirection flowDirection = renderer()->containingBlock()->style()->direction();
- if (flowDirection != direction()) {
+ if (renderer()->containingBlock()->style()->isLeftToRightDirection() != isLeftToRightDirection()) {
// Make the visible fragment of text hug the edge closest to the rest of the run by moving the origin
// at which we start drawing text.
// e.g. In the case of LTR text truncated in an RTL Context, the correct behavior is:
@@ -395,7 +394,7 @@ void InlineTextBox::paint(PaintInfo& paintInfo, int tx, int ty)
int widthOfVisibleText = toRenderText(renderer())->width(m_start, m_truncation, textPos(), m_firstLine);
int widthOfHiddenText = m_logicalWidth - widthOfVisibleText;
// FIXME: The hit testing logic also needs to take this translation int account.
- tx += direction() == LTR ? widthOfHiddenText : -widthOfHiddenText;
+ tx += isLeftToRightDirection() ? widthOfHiddenText : -widthOfHiddenText;
}
}
@@ -504,7 +503,7 @@ void InlineTextBox::paint(PaintInfo& paintInfo, int tx, int ty)
int baseline = renderer()->style(m_firstLine)->font().ascent();
IntPoint textOrigin(m_x + tx, m_y + ty + baseline);
- TextRun textRun(characters, length, textRenderer()->allowTabs(), textPos(), m_toAdd, direction() == RTL, m_dirOverride || styleToUse->visuallyOrdered());
+ TextRun textRun(characters, length, textRenderer()->allowTabs(), textPos(), m_toAdd, !isLeftToRightDirection(), m_dirOverride || styleToUse->visuallyOrdered());
int sPos = 0;
int ePos = 0;
@@ -635,7 +634,7 @@ void InlineTextBox::paintSelection(GraphicsContext* context, int tx, int ty, Ren
context->clip(IntRect(m_x + tx, y + ty, m_logicalWidth, h));
context->drawHighlightForText(font, TextRun(characters, length, textRenderer()->allowTabs(), textPos(), m_toAdd,
- direction() == RTL, m_dirOverride || style->visuallyOrdered()),
+ !isLeftToRightDirection(), m_dirOverride || style->visuallyOrdered()),
IntPoint(m_x + tx, y + ty), h, c, style->colorSpace(), sPos, ePos);
context->restore();
}
@@ -658,7 +657,7 @@ void InlineTextBox::paintCompositionBackground(GraphicsContext* context, int tx,
int y = selectionTop();
int h = selectionHeight();
context->drawHighlightForText(font, TextRun(textRenderer()->text()->characters() + m_start, m_len, textRenderer()->allowTabs(), textPos(), m_toAdd,
- direction() == RTL, m_dirOverride || style->visuallyOrdered()),
+ !isLeftToRightDirection(), m_dirOverride || style->visuallyOrdered()),
IntPoint(m_x + tx, y + ty), h, c, style->colorSpace(), sPos, ePos);
context->restore();
}
@@ -694,7 +693,7 @@ void InlineTextBox::paintDecoration(GraphicsContext* context, int tx, int ty, in
int width = m_logicalWidth;
if (m_truncation != cNoTruncation) {
width = toRenderText(renderer())->width(m_start, m_truncation, textPos(), m_firstLine);
- if (direction() == RTL)
+ if (!isLeftToRightDirection())
tx += (m_logicalWidth - width);
}
@@ -813,7 +812,7 @@ void InlineTextBox::paintSpellingOrGrammarMarker(GraphicsContext* pt, int tx, in
// Calculate start & width
IntPoint startPoint(tx + m_x, ty + selectionTop());
- TextRun run(textRenderer()->text()->characters() + m_start, m_len, textRenderer()->allowTabs(), textPos(), m_toAdd, direction() == RTL, m_dirOverride || style->visuallyOrdered());
+ TextRun run(textRenderer()->text()->characters() + m_start, m_len, textRenderer()->allowTabs(), textPos(), m_toAdd, !isLeftToRightDirection(), m_dirOverride || style->visuallyOrdered());
int h = selectionHeight();
IntRect markerRect = enclosingIntRect(font.selectionRectForText(run, startPoint, h, startPosition, endPosition));
@@ -858,7 +857,7 @@ void InlineTextBox::paintTextMatchMarker(GraphicsContext* pt, int tx, int ty, co
int sPos = max(marker.startOffset - m_start, (unsigned)0);
int ePos = min(marker.endOffset - m_start, (unsigned)m_len);
- TextRun run(textRenderer()->text()->characters() + m_start, m_len, textRenderer()->allowTabs(), textPos(), m_toAdd, direction() == RTL, m_dirOverride || style->visuallyOrdered());
+ TextRun run(textRenderer()->text()->characters() + m_start, m_len, textRenderer()->allowTabs(), textPos(), m_toAdd, !isLeftToRightDirection(), m_dirOverride || style->visuallyOrdered());
// Always compute and store the rect associated with this marker. The computed rect is in absolute coordinates.
IntRect markerRect = enclosingIntRect(font.selectionRectForText(run, IntPoint(m_x, y), h, sPos, ePos));
@@ -886,7 +885,7 @@ void InlineTextBox::computeRectForReplacementMarker(int /*tx*/, int /*ty*/, cons
int sPos = max(marker.startOffset - m_start, (unsigned)0);
int ePos = min(marker.endOffset - m_start, (unsigned)m_len);
- TextRun run(textRenderer()->text()->characters() + m_start, m_len, textRenderer()->allowTabs(), textPos(), m_toAdd, direction() == RTL, m_dirOverride || style->visuallyOrdered());
+ TextRun run(textRenderer()->text()->characters() + m_start, m_len, textRenderer()->allowTabs(), textPos(), m_toAdd, !isLeftToRightDirection(), m_dirOverride || style->visuallyOrdered());
IntPoint startPoint = IntPoint(m_x, y);
// Compute and store the rect associated with this marker.
@@ -1031,7 +1030,7 @@ int InlineTextBox::textPos() const
return 0;
RenderBlock* blockElement = renderer()->containingBlock();
- return direction() == RTL ? x() - blockElement->borderRight() - blockElement->paddingRight()
+ return !isLeftToRightDirection() ? x() - blockElement->borderRight() - blockElement->paddingRight()
: x() - blockElement->borderLeft() - blockElement->paddingLeft();
}
@@ -1043,7 +1042,7 @@ int InlineTextBox::offsetForPosition(int _x, bool includePartialGlyphs) const
RenderText* text = toRenderText(renderer());
RenderStyle* style = text->style(m_firstLine);
const Font* f = &style->font();
- return f->offsetForPosition(TextRun(textRenderer()->text()->characters() + m_start, m_len, textRenderer()->allowTabs(), textPos(), m_toAdd, direction() == RTL, m_dirOverride || style->visuallyOrdered()),
+ return f->offsetForPosition(TextRun(textRenderer()->text()->characters() + m_start, m_len, textRenderer()->allowTabs(), textPos(), m_toAdd, !isLeftToRightDirection(), m_dirOverride || style->visuallyOrdered()),
_x - m_x, includePartialGlyphs);
}
@@ -1057,10 +1056,10 @@ int InlineTextBox::positionForOffset(int offset) const
RenderText* text = toRenderText(renderer());
const Font& f = text->style(m_firstLine)->font();
- int from = direction() == RTL ? offset - m_start : 0;
- int to = direction() == RTL ? m_len : offset - m_start;
+ int from = !isLeftToRightDirection() ? offset - m_start : 0;
+ int to = !isLeftToRightDirection() ? m_len : offset - m_start;
// FIXME: Do we need to add rightBearing here?
- return enclosingIntRect(f.selectionRectForText(TextRun(text->text()->characters() + m_start, m_len, textRenderer()->allowTabs(), textPos(), m_toAdd, direction() == RTL, m_dirOverride),
+ return enclosingIntRect(f.selectionRectForText(TextRun(text->text()->characters() + m_start, m_len, textRenderer()->allowTabs(), textPos(), m_toAdd, !isLeftToRightDirection(), m_dirOverride),
IntPoint(m_x, 0), 0, from, to)).right();
}
diff --git a/WebCore/rendering/RenderBlock.cpp b/WebCore/rendering/RenderBlock.cpp
index 6119af7..0d235b0 100644
--- a/WebCore/rendering/RenderBlock.cpp
+++ b/WebCore/rendering/RenderBlock.cpp
@@ -1324,7 +1324,7 @@ bool RenderBlock::expandsToEncloseOverhangingFloats() const
void RenderBlock::adjustPositionedBlock(RenderBox* child, const MarginInfo& marginInfo)
{
if (child->style()->hasStaticX()) {
- if (style()->direction() == LTR)
+ if (style()->isLeftToRightDirection())
child->layer()->setStaticX(borderLeft() + paddingLeft());
else
child->layer()->setStaticX(borderRight() + paddingRight());
@@ -1655,7 +1655,7 @@ void RenderBlock::determineLogicalLeftPositionForChild(RenderBox* child)
// Some objects (e.g., tables, horizontal rules, overflow:auto blocks) avoid floats. They need
// to shift over as necessary to dodge any floats that might get in the way.
if (child->avoidsFloats()) {
- int startOff = style()->direction() == LTR ? logicalLeftOffsetForLine(logicalHeight(), false) : totalAvailableLogicalWidth - logicalRightOffsetForLine(logicalHeight(), false);
+ int startOff = style()->isLeftToRightDirection() ? logicalLeftOffsetForLine(logicalHeight(), false) : totalAvailableLogicalWidth - logicalRightOffsetForLine(logicalHeight(), false);
if (style()->textAlign() != WEBKIT_CENTER && !child->style()->marginStartUsing(style()).isAuto()) {
if (childMarginStart < 0)
startOff += childMarginStart;
@@ -1671,7 +1671,7 @@ void RenderBlock::determineLogicalLeftPositionForChild(RenderBox* child)
}
}
- setLogicalLeftForChild(child, style()->direction() == LTR ? newPosition : totalAvailableLogicalWidth - newPosition - logicalWidthForChild(child));
+ setLogicalLeftForChild(child, style()->isLeftToRightDirection() ? newPosition : totalAvailableLogicalWidth - newPosition - logicalWidthForChild(child));
}
void RenderBlock::setCollapsedBottomMargin(const MarginInfo& marginInfo)
@@ -2123,14 +2123,14 @@ void RenderBlock::paintColumnRules(PaintInfo& paintInfo, int tx, int ty)
// We need to do multiple passes, breaking up our child painting into strips.
ColumnInfo* colInfo = columnInfo();
unsigned colCount = columnCount(colInfo);
- int currXOffset = style()->direction() == LTR ? 0 : contentWidth();
+ int currXOffset = style()->isLeftToRightDirection() ? 0 : contentWidth();
int ruleAdd = borderLeft() + paddingLeft();
- int ruleX = style()->direction() == LTR ? 0 : contentWidth();
+ int ruleX = style()->isLeftToRightDirection() ? 0 : contentWidth();
for (unsigned i = 0; i < colCount; i++) {
IntRect colRect = columnRectAt(colInfo, i);
// Move to the next position.
- if (style()->direction() == LTR) {
+ if (style()->isLeftToRightDirection()) {
ruleX += colRect.width() + colGap / 2;
currXOffset += colRect.width() + colGap;
} else {
@@ -2145,7 +2145,7 @@ void RenderBlock::paintColumnRules(PaintInfo& paintInfo, int tx, int ty)
int ruleTop = ty + borderTop() + paddingTop();
int ruleBottom = ruleTop + contentHeight();
drawLineForBoxSide(paintInfo.context, ruleStart, ruleTop, ruleEnd, ruleBottom,
- style()->direction() == LTR ? BSLeft : BSRight, ruleColor, ruleStyle, 0, 0);
+ style()->isLeftToRightDirection() ? BSLeft : BSRight, ruleColor, ruleStyle, 0, 0);
}
ruleX = currXOffset;
@@ -2161,7 +2161,7 @@ void RenderBlock::paintColumnContents(PaintInfo& paintInfo, int tx, int ty, bool
unsigned colCount = columnCount(colInfo);
if (!colCount)
return;
- int currXOffset = style()->direction() == LTR ? 0 : contentWidth() - columnRectAt(colInfo, 0).width();
+ int currXOffset = style()->isLeftToRightDirection() ? 0 : contentWidth() - columnRectAt(colInfo, 0).width();
int currYOffset = 0;
for (unsigned i = 0; i < colCount; i++) {
// For each rect, we clip to the rect, and then we adjust our coords.
@@ -2189,7 +2189,7 @@ void RenderBlock::paintColumnContents(PaintInfo& paintInfo, int tx, int ty, bool
}
// Move to the next position.
- if (style()->direction() == LTR)
+ if (style()->isLeftToRightDirection())
currXOffset += colRect.width() + colGap;
else
currXOffset -= (colRect.width() + colGap);
@@ -2804,7 +2804,7 @@ IntRect RenderBlock::fillRightSelectionGap(RenderObject* selObj, int xPos, int y
void RenderBlock::getHorizontalSelectionGapInfo(SelectionState state, bool& leftGap, bool& rightGap)
{
- bool ltr = style()->direction() == LTR;
+ bool ltr = style()->isLeftToRightDirection();
leftGap = (state == RenderObject::SelectionInside) ||
(state == RenderObject::SelectionEnd && ltr) ||
(state == RenderObject::SelectionStart && !ltr);
@@ -3227,7 +3227,7 @@ int RenderBlock::logicalLeftOffsetForLine(int y, int fixedOffset, bool applyText
}
}
- if (applyTextIndent && style()->direction() == LTR) {
+ if (applyTextIndent && style()->isLeftToRightDirection()) {
int cw = 0;
if (style()->textIndent().isPercent())
cw = containingBlock()->availableLogicalWidth();
@@ -3256,7 +3256,7 @@ int RenderBlock::logicalRightOffsetForLine(int y, int fixedOffset, bool applyTex
}
}
- if (applyTextIndent && style()->direction() == RTL) {
+ if (applyTextIndent && !style()->isLeftToRightDirection()) {
int cw = 0;
if (style()->textIndent().isPercent())
cw = containingBlock()->availableLogicalWidth();
@@ -3451,7 +3451,7 @@ int RenderBlock::rightmostPosition(bool includeOverflowInterior, bool includeSel
if (hasColumns()) {
// This only matters for LTR
- if (style()->direction() == LTR) {
+ if (style()->isLeftToRightDirection()) {
ColumnInfo* colInfo = columnInfo();
unsigned count = columnCount(colInfo);
if (count)
@@ -3479,7 +3479,7 @@ int RenderBlock::rightmostPosition(bool includeOverflowInterior, bool includeSel
// If this node is a root editable element, then the rightmostPosition should account for a caret at the end.
// FIXME: Need to find another way to do this, since scrollbars could show when we don't want them to.
- if (node() && node()->isContentEditable() && node() == node()->rootEditableElement() && style()->direction() == LTR && !paddingRight())
+ if (node() && node()->isContentEditable() && node() == node()->rootEditableElement() && style()->isLeftToRightDirection() && !paddingRight())
childRightEdge += 1;
right = max(right, childRightEdge + paddingRight() + relativeOffset);
}
@@ -3552,7 +3552,7 @@ int RenderBlock::leftmostPosition(bool includeOverflowInterior, bool includeSelf
if (hasColumns()) {
// This only matters for RTL
- if (style()->direction() == RTL) {
+ if (!style()->isLeftToRightDirection()) {
ColumnInfo* colInfo = columnInfo();
unsigned count = columnCount(colInfo);
if (count)
@@ -4422,7 +4422,7 @@ IntRect RenderBlock::columnRectAt(ColumnInfo* colInfo, unsigned index) const
int colHeight = colInfo->columnHeight();
int colTop = borderTop() + paddingTop();
int colGap = columnGap();
- int colLeft = style()->direction() == LTR ?
+ int colLeft = style()->isLeftToRightDirection() ?
borderLeft() + paddingLeft() + (index * (colWidth + colGap))
: borderLeft() + paddingLeft() + contentWidth() - colWidth - (index * (colWidth + colGap));
return IntRect(colLeft, colTop, colWidth, colHeight);
@@ -4464,8 +4464,8 @@ bool RenderBlock::layoutColumns(bool hasSpecifiedPageHeight, int pageHeight, Lay
if (columnCount(colInfo)) {
IntRect lastRect = columnRectAt(colInfo, columnCount(colInfo) - 1);
- int overflowLeft = style()->direction() == RTL ? min(0, lastRect.x()) : 0;
- int overflowRight = style()->direction() == LTR ? max(width(), lastRect.x() + lastRect.width()) : 0;
+ int overflowLeft = !style()->isLeftToRightDirection() ? min(0, lastRect.x()) : 0;
+ int overflowRight = style()->isLeftToRightDirection() ? max(width(), lastRect.x() + lastRect.width()) : 0;
int overflowHeight = borderTop() + paddingTop() + colInfo->columnHeight();
setLogicalHeight(overflowHeight + borderBottom() + paddingBottom() + horizontalScrollbarHeight());
@@ -4711,7 +4711,7 @@ static int getBorderPaddingMargin(const RenderBoxModelObject* child, bool endOfI
{
RenderStyle* cstyle = child->style();
int result = 0;
- bool leftSide = (cstyle->direction() == LTR) ? !endOfInline : endOfInline;
+ bool leftSide = (cstyle->isLeftToRightDirection()) ? !endOfInline : endOfInline;
result += getBPMWidth((leftSide ? child->marginLeft() : child->marginRight()),
(leftSide ? cstyle->marginLeft() :
cstyle->marginRight()));
@@ -5733,7 +5733,7 @@ IntRect RenderBlock::localCaretRect(InlineBox* inlineBox, int caretOffset, int*
switch (currentStyle->textAlign()) {
case TAAUTO:
case JUSTIFY:
- if (currentStyle->direction() == RTL)
+ if (!currentStyle->isLeftToRightDirection())
alignment = alignRight;
break;
case LEFT:
@@ -6069,26 +6069,26 @@ int RenderBlock::marginAfterForChild(RenderBoxModelObject* child) const
int RenderBlock::marginStartForChild(RenderBoxModelObject* child) const
{
if (style()->isVerticalBlockFlow())
- return style()->direction() == LTR ? child->marginLeft() : child->marginRight();
- return style()->direction() == LTR ? child->marginTop() : child->marginBottom();
+ return style()->isLeftToRightDirection() ? child->marginLeft() : child->marginRight();
+ return style()->isLeftToRightDirection() ? child->marginTop() : child->marginBottom();
}
int RenderBlock::marginEndForChild(RenderBoxModelObject* child) const
{
if (style()->isVerticalBlockFlow())
- return style()->direction() == LTR ? child->marginRight() : child->marginLeft();
- return style()->direction() == LTR ? child->marginBottom() : child->marginTop();
+ return style()->isLeftToRightDirection() ? child->marginRight() : child->marginLeft();
+ return style()->isLeftToRightDirection() ? child->marginBottom() : child->marginTop();
}
void RenderBlock::setMarginStartForChild(RenderBox* child, int margin)
{
if (style()->isVerticalBlockFlow()) {
- if (style()->direction() == LTR)
+ if (style()->isLeftToRightDirection())
child->setMarginLeft(margin);
else
child->setMarginRight(margin);
} else {
- if (style()->direction() == LTR)
+ if (style()->isLeftToRightDirection())
child->setMarginTop(margin);
else
child->setMarginBottom(margin);
@@ -6098,12 +6098,12 @@ void RenderBlock::setMarginStartForChild(RenderBox* child, int margin)
void RenderBlock::setMarginEndForChild(RenderBox* child, int margin)
{
if (style()->isVerticalBlockFlow()) {
- if (style()->direction() == LTR)
+ if (style()->isLeftToRightDirection())
child->setMarginRight(margin);
else
child->setMarginLeft(margin);
} else {
- if (style()->direction() == LTR)
+ if (style()->isLeftToRightDirection())
child->setMarginBottom(margin);
else
child->setMarginTop(margin);
diff --git a/WebCore/rendering/RenderBlockLineLayout.cpp b/WebCore/rendering/RenderBlockLineLayout.cpp
index 560be70..68fad63 100644
--- a/WebCore/rendering/RenderBlockLineLayout.cpp
+++ b/WebCore/rendering/RenderBlockLineLayout.cpp
@@ -57,7 +57,7 @@ const unsigned cMaxLineDepth = 200;
static int getBorderPaddingMargin(RenderBoxModelObject* child, bool endOfInline)
{
- bool leftSide = (child->style()->direction() == LTR) ? !endOfInline : endOfInline;
+ bool leftSide = (child->style()->isLeftToRightDirection()) ? !endOfInline : endOfInline;
if (leftSide)
return child->marginLeft() + child->paddingLeft() + child->borderLeft();
return child->marginRight() + child->paddingRight() + child->borderRight();
@@ -244,7 +244,7 @@ RootInlineBox* RenderBlock::constructLine(unsigned runCount, BidiRun* firstRun,
// Create a box for our object.
bool isOnlyRun = (runCount == 1);
if (runCount == 2 && !r->m_object->isListMarker())
- isOnlyRun = ((style()->direction() == RTL) ? lastRun : firstRun)->m_object->isListMarker();
+ isOnlyRun = (!style()->isLeftToRightDirection() ? lastRun : firstRun)->m_object->isListMarker();
InlineBox* box = createInlineBoxForRenderer(r->m_object, false, isOnlyRun);
r->m_box = box;
@@ -363,7 +363,7 @@ void RenderBlock::computeInlineDirectionPositionsForLine(RootInlineBox* lineBox,
case WEBKIT_LEFT:
// The direction of the block should determine what happens with wide lines. In
// particular with RTL blocks, wide lines should still spill out to the left.
- if (style()->direction() == LTR) {
+ if (style()->isLeftToRightDirection()) {
if (totWidth > availableWidth && trailingSpaceRun)
trailingSpaceRun->m_box->setLogicalWidth(max(0, trailingSpaceRun->m_box->logicalWidth() - totWidth + availableWidth));
} else {
@@ -385,7 +385,7 @@ void RenderBlock::computeInlineDirectionPositionsForLine(RootInlineBox* lineBox,
case TAAUTO:
numSpaces = 0;
// for right to left fall through to right aligned
- if (style()->direction() == LTR) {
+ if (style()->isLeftToRightDirection()) {
if (totWidth > availableWidth && trailingSpaceRun)
trailingSpaceRun->m_box->setLogicalWidth(max(0, trailingSpaceRun->m_box->logicalWidth() - totWidth + availableWidth));
break;
@@ -395,7 +395,7 @@ void RenderBlock::computeInlineDirectionPositionsForLine(RootInlineBox* lineBox,
// Wide lines spill out of the block based off direction.
// So even if text-align is right, if direction is LTR, wide lines should overflow out of the right
// side of the block.
- if (style()->direction() == LTR) {
+ if (style()->isLeftToRightDirection()) {
if (trailingSpaceRun) {
totWidth -= trailingSpaceRun->m_box->logicalWidth();
trailingSpaceRun->m_box->setLogicalWidth(0);
@@ -418,7 +418,7 @@ void RenderBlock::computeInlineDirectionPositionsForLine(RootInlineBox* lineBox,
trailingSpaceWidth = min(trailingSpaceRun->m_box->logicalWidth(), (availableWidth - totWidth + 1) / 2);
trailingSpaceRun->m_box->setLogicalWidth(max(0, trailingSpaceWidth));
}
- if (style()->direction() == LTR)
+ if (style()->isLeftToRightDirection())
x += max((availableWidth - totWidth) / 2, 0);
else
x += totWidth > availableWidth ? (availableWidth - totWidth) : (availableWidth - totWidth) / 2 - trailingSpaceWidth;
@@ -1039,7 +1039,7 @@ RootInlineBox* RenderBlock::determineStartPosition(bool& firstLine, bool& fullLa
pos = last->lineBreakPos();
resolver.setStatus(last->lineBreakBidiStatus());
} else {
- bool ltr = style()->direction() == LTR
+ bool ltr = style()->isLeftToRightDirection()
#if ENABLE(SVG)
|| (style()->unicodeBidi() == UBNormal && isSVGText())
#endif
@@ -1252,16 +1252,16 @@ void RenderBlock::skipTrailingWhitespace(InlineIterator& iterator, bool isLineEm
// A relative positioned inline encloses us. In this case, we also have to determine our
// position as though we were an inline. Set |staticX| and |staticY| on the relative positioned
// inline so that we can obtain the value later.
- toRenderInline(c)->layer()->setStaticX(style()->direction() == LTR ? logicalLeftOffsetForLine(height(), false) : logicalRightOffsetForLine(height(), false));
+ toRenderInline(c)->layer()->setStaticX(style()->isLeftToRightDirection() ? logicalLeftOffsetForLine(height(), false) : logicalRightOffsetForLine(height(), false));
toRenderInline(c)->layer()->setStaticY(height());
}
RenderBox* box = toRenderBox(object);
if (box->style()->hasStaticX()) {
if (box->style()->isOriginalDisplayInlineType())
- box->layer()->setStaticX(style()->direction() == LTR ? logicalLeftOffsetForLine(height(), false) : width() - logicalRightOffsetForLine(height(), false));
+ box->layer()->setStaticX(style()->isLeftToRightDirection() ? logicalLeftOffsetForLine(height(), false) : width() - logicalRightOffsetForLine(height(), false));
else
- box->layer()->setStaticX(style()->direction() == LTR ? borderLeft() + paddingLeft() : borderRight() + paddingRight());
+ box->layer()->setStaticX(style()->isLeftToRightDirection() ? borderLeft() + paddingLeft() : borderRight() + paddingRight());
}
if (box->style()->hasStaticY())
@@ -1288,16 +1288,16 @@ int RenderBlock::skipLeadingWhitespace(InlineBidiResolver& resolver, bool firstL
// A relative positioned inline encloses us. In this case, we also have to determine our
// position as though we were an inline. Set |staticX| and |staticY| on the relative positioned
// inline so that we can obtain the value later.
- toRenderInline(c)->layer()->setStaticX(style()->direction() == LTR ? logicalLeftOffsetForLine(height(), firstLine) : logicalRightOffsetForLine(height(), firstLine));
+ toRenderInline(c)->layer()->setStaticX(style()->isLeftToRightDirection() ? logicalLeftOffsetForLine(height(), firstLine) : logicalRightOffsetForLine(height(), firstLine));
toRenderInline(c)->layer()->setStaticY(height());
}
RenderBox* box = toRenderBox(object);
if (box->style()->hasStaticX()) {
if (box->style()->isOriginalDisplayInlineType())
- box->layer()->setStaticX(style()->direction() == LTR ? logicalLeftOffsetForLine(height(), firstLine) : width() - logicalRightOffsetForLine(height(), firstLine));
+ box->layer()->setStaticX(style()->isLeftToRightDirection() ? logicalLeftOffsetForLine(height(), firstLine) : width() - logicalRightOffsetForLine(height(), firstLine));
else
- box->layer()->setStaticX(style()->direction() == LTR ? borderLeft() + paddingLeft() : borderRight() + paddingRight());
+ box->layer()->setStaticX(style()->isLeftToRightDirection() ? borderLeft() + paddingLeft() : borderRight() + paddingRight());
}
if (box->style()->hasStaticY())
@@ -1498,7 +1498,7 @@ InlineIterator RenderBlock::findNextLineBreak(InlineBidiResolver& resolver, bool
bool isInlineType = box->style()->isOriginalDisplayInlineType();
bool needToSetStaticX = box->style()->hasStaticX();
if (box->style()->hasStaticX() && !isInlineType) {
- box->layer()->setStaticX(o->parent()->style()->direction() == LTR ?
+ box->layer()->setStaticX(o->parent()->style()->isLeftToRightDirection() ?
borderLeft() + paddingLeft() :
borderRight() + paddingRight());
needToSetStaticX = false;
@@ -2035,7 +2035,7 @@ void RenderBlock::checkLinesForTextOverflow()
// if the right edge of a line box exceeds that. For RTL, we use the left edge of the padding box and
// check the left edge of the line box to see if it is less
// Include the scrollbar for overflow blocks, which means we want to use "contentWidth()"
- bool ltr = style()->direction() == LTR;
+ bool ltr = style()->isLeftToRightDirection();
for (RootInlineBox* curr = firstRootBox(); curr; curr = curr->nextRootBox()) {
int blockRightEdge = logicalRightOffsetForLine(curr->y(), curr == firstRootBox());
int blockLeftEdge = logicalLeftOffsetForLine(curr->y(), curr == firstRootBox());
diff --git a/WebCore/rendering/RenderBox.cpp b/WebCore/rendering/RenderBox.cpp
index cba86f4..195ae2b 100644
--- a/WebCore/rendering/RenderBox.cpp
+++ b/WebCore/rendering/RenderBox.cpp
@@ -118,26 +118,26 @@ int RenderBox::marginAfter() const
int RenderBox::marginStart() const
{
if (style()->isVerticalBlockFlow())
- return style()->direction() == LTR ? m_marginLeft : m_marginRight;
- return style()->direction() == LTR ? m_marginTop : m_marginBottom;
+ return style()->isLeftToRightDirection() ? m_marginLeft : m_marginRight;
+ return style()->isLeftToRightDirection() ? m_marginTop : m_marginBottom;
}
int RenderBox::marginEnd() const
{
if (style()->isVerticalBlockFlow())
- return style()->direction() == LTR ? m_marginRight : m_marginLeft;
- return style()->direction() == LTR ? m_marginBottom : m_marginTop;
+ return style()->isLeftToRightDirection() ? m_marginRight : m_marginLeft;
+ return style()->isLeftToRightDirection() ? m_marginBottom : m_marginTop;
}
void RenderBox::setMarginStart(int margin)
{
if (style()->isVerticalBlockFlow()) {
- if (style()->direction() == LTR)
+ if (style()->isLeftToRightDirection())
m_marginLeft = margin;
else
m_marginRight = margin;
} else {
- if (style()->direction() == LTR)
+ if (style()->isLeftToRightDirection())
m_marginTop = margin;
else
m_marginBottom = margin;
@@ -147,12 +147,12 @@ void RenderBox::setMarginStart(int margin)
void RenderBox::setMarginEnd(int margin)
{
if (style()->isVerticalBlockFlow()) {
- if (style()->direction() == LTR)
+ if (style()->isLeftToRightDirection())
m_marginRight = margin;
else
m_marginLeft = margin;
} else {
- if (style()->direction() == LTR)
+ if (style()->isLeftToRightDirection())
m_marginBottom = margin;
else
m_marginTop = margin;
@@ -387,7 +387,7 @@ int RenderBox::scrollWidth() const
if (hasOverflowClip())
return layer()->scrollWidth();
// For objects with visible overflow, this matches IE.
- if (style()->direction() == LTR)
+ if (style()->isLeftToRightDirection())
return max(clientWidth(), rightmostPosition(true, false) - borderLeft());
return clientWidth() - min(0, leftmostPosition(true, false) - borderLeft());
}
@@ -1586,8 +1586,8 @@ void RenderBox::computeInlineDirectionMargins(RenderBlock* containingBlock, int
}
// Case Three: The object is being pushed to the end of the containing block's available logical width.
- bool pushToEndFromTextAlign = !marginEndLength.isAuto() && ((containingBlockStyle->direction() == RTL && containingBlockStyle->textAlign() == WEBKIT_LEFT)
- || (containingBlockStyle->direction() == LTR && containingBlockStyle->textAlign() == WEBKIT_RIGHT));
+ bool pushToEndFromTextAlign = !marginEndLength.isAuto() && ((!containingBlockStyle->isLeftToRightDirection() && containingBlockStyle->textAlign() == WEBKIT_LEFT)
+ || (containingBlockStyle->isLeftToRightDirection() && containingBlockStyle->textAlign() == WEBKIT_RIGHT));
if ((marginStartLength.isAuto() && childWidth < containerWidth) || pushToEndFromTextAlign) {
containingBlock->setMarginEndForChild(this, marginEndLength.calcValue(containerWidth));
containingBlock->setMarginStartForChild(this, containerWidth - childWidth - containingBlock->marginEndForChild(this));
@@ -1958,7 +1958,7 @@ int RenderBox::containingBlockWidthForPositioned(const RenderBoxModelObject* con
int fromLeft;
int fromRight;
- if (containingBlock->style()->direction() == LTR) {
+ if (containingBlock->style()->isLeftToRightDirection()) {
fromLeft = first->logicalLeft() + first->borderLogicalLeft();
fromRight = last->logicalLeft() + last->logicalWidth() - last->borderLogicalRight();
} else {
@@ -2300,7 +2300,7 @@ void RenderBox::computePositionedLogicalWidthUsing(Length width, const RenderBox
// positioned, inline because right now, it is using the xPos
// of the first line box when really it should use the last line box. When
// this is fixed elsewhere, this block should be removed.
- if (containerBlock->isRenderInline() && containerBlock->style()->direction() == RTL) {
+ if (containerBlock->isRenderInline() && !containerBlock->style()->isLeftToRightDirection()) {
const RenderInline* flow = toRenderInline(containerBlock);
InlineFlowBox* firstLine = flow->firstLineBox();
InlineFlowBox* lastLine = flow->lastLineBox();
@@ -2706,7 +2706,7 @@ void RenderBox::computePositionedLogicalWidthReplaced()
// positioned, inline containing block because right now, it is using the xPos
// of the first line box when really it should use the last line box. When
// this is fixed elsewhere, this block should be removed.
- if (containerBlock->isRenderInline() && containerBlock->style()->direction() == RTL) {
+ if (containerBlock->isRenderInline() && !containerBlock->style()->isLeftToRightDirection()) {
const RenderInline* flow = toRenderInline(containerBlock);
InlineFlowBox* firstLine = flow->firstLineBox();
InlineFlowBox* lastLine = flow->lastLineBox();
@@ -2860,9 +2860,9 @@ IntRect RenderBox::localCaretRect(InlineBox* box, int caretOffset, int* extraWid
// FIXME: What about border and padding?
IntRect rect(x(), y(), caretWidth, height());
- TextDirection direction = box ? box->direction() : style()->direction();
+ bool ltr = box ? box->isLeftToRightDirection() : style()->isLeftToRightDirection();
- if ((!caretOffset) ^ (direction == LTR))
+ if ((!caretOffset) ^ ltr)
rect.move(IntSize(width() - caretWidth, 0));
if (box) {
diff --git a/WebCore/rendering/RenderBoxModelObject.cpp b/WebCore/rendering/RenderBoxModelObject.cpp
index f7d2447..02a2847 100644
--- a/WebCore/rendering/RenderBoxModelObject.cpp
+++ b/WebCore/rendering/RenderBoxModelObject.cpp
@@ -324,7 +324,7 @@ int RenderBoxModelObject::relativePositionOffsetX() const
// call availableWidth on our containing block.
if (!style()->left().isAuto()) {
RenderBlock* cb = containingBlock();
- if (!style()->right().isAuto() && containingBlock()->style()->direction() == RTL)
+ if (!style()->right().isAuto() && !containingBlock()->style()->isLeftToRightDirection())
return -style()->right().calcValue(cb->availableWidth());
return style()->left().calcValue(cb->availableWidth());
}
diff --git a/WebCore/rendering/RenderFieldset.cpp b/WebCore/rendering/RenderFieldset.cpp
index d3b88c1..074f2d5 100644
--- a/WebCore/rendering/RenderFieldset.cpp
+++ b/WebCore/rendering/RenderFieldset.cpp
@@ -72,7 +72,7 @@ RenderObject* RenderFieldset::layoutLegend(bool relayoutChildren)
legend->layoutIfNeeded();
int xPos;
- if (style()->direction() == RTL) {
+ if (!style()->isLeftToRightDirection()) {
switch (legend->style()->textAlign()) {
case LEFT:
xPos = borderLeft() + paddingLeft();
diff --git a/WebCore/rendering/RenderFileUploadControl.cpp b/WebCore/rendering/RenderFileUploadControl.cpp
index cdb0470..b6159e3 100644
--- a/WebCore/rendering/RenderFileUploadControl.cpp
+++ b/WebCore/rendering/RenderFileUploadControl.cpp
@@ -213,14 +213,14 @@ void RenderFileUploadControl::paintObject(PaintInfo& paintInfo, int tx, int ty)
const String& displayedFilename = fileTextValue();
unsigned length = displayedFilename.length();
const UChar* string = displayedFilename.characters();
- TextRun textRun(string, length, false, 0, 0, style()->direction() == RTL, style()->unicodeBidi() == Override);
+ TextRun textRun(string, length, false, 0, 0, !style()->isLeftToRightDirection(), style()->unicodeBidi() == Override);
// Determine where the filename should be placed
int contentLeft = tx + borderLeft() + paddingLeft();
int buttonAndIconWidth = m_button->renderBox()->width() + afterButtonSpacing
+ (m_fileChooser->icon() ? iconWidth + iconFilenameSpacing : 0);
int textX;
- if (style()->direction() == LTR)
+ if (style()->isLeftToRightDirection())
textX = contentLeft + buttonAndIconWidth;
else
textX = contentLeft + contentWidth() - buttonAndIconWidth - style()->font().width(textRun);
@@ -239,7 +239,7 @@ void RenderFileUploadControl::paintObject(PaintInfo& paintInfo, int tx, int ty)
// Determine where the icon should be placed
int iconY = ty + borderTop() + paddingTop() + (contentHeight() - iconHeight) / 2;
int iconX;
- if (style()->direction() == LTR)
+ if (style()->isLeftToRightDirection())
iconX = contentLeft + m_button->renderBox()->width() + afterButtonSpacing;
else
iconX = contentLeft + contentWidth() - m_button->renderBox()->width() - afterButtonSpacing - iconWidth;
diff --git a/WebCore/rendering/RenderFlexibleBox.cpp b/WebCore/rendering/RenderFlexibleBox.cpp
index 18f2f36..1c303d6 100644
--- a/WebCore/rendering/RenderFlexibleBox.cpp
+++ b/WebCore/rendering/RenderFlexibleBox.cpp
@@ -39,7 +39,7 @@ public:
FlexBoxIterator(RenderFlexibleBox* parent)
{
box = parent;
- if (box->style()->boxOrient() == HORIZONTAL && box->style()->direction() == RTL)
+ if (box->style()->boxOrient() == HORIZONTAL && !box->style()->isLeftToRightDirection())
forward = box->style()->boxDirection() != BNORMAL;
else
forward = box->style()->boxDirection() == BNORMAL;
@@ -417,7 +417,7 @@ void RenderFlexibleBox::layoutHorizontalBox(bool relayoutChildren)
if (child->isPositioned()) {
child->containingBlock()->insertPositionedObject(child);
if (child->style()->hasStaticX()) {
- if (style()->direction() == LTR)
+ if (style()->isLeftToRightDirection())
child->layer()->setStaticX(xPos);
else child->layer()->setStaticX(width() - xPos);
}
@@ -575,8 +575,8 @@ void RenderFlexibleBox::layoutHorizontalBox(bool relayoutChildren)
RenderBlock::finishDelayUpdateScrollInfo();
- if (remainingSpace > 0 && ((style()->direction() == LTR && style()->boxPack() != BSTART) ||
- (style()->direction() == RTL && style()->boxPack() != BEND))) {
+ if (remainingSpace > 0 && ((style()->isLeftToRightDirection() && style()->boxPack() != BSTART)
+ || (!style()->isLeftToRightDirection() && style()->boxPack() != BEND))) {
// Children must be repositioned.
int offset = 0;
if (style()->boxPack() == BJUSTIFY) {
@@ -645,7 +645,7 @@ void RenderFlexibleBox::layoutVerticalBox(bool relayoutChildren)
{
int xPos = borderLeft() + paddingLeft();
int yPos = borderTop() + paddingTop();
- if (style()->direction() == RTL)
+ if (!style()->isLeftToRightDirection())
xPos = width() - paddingRight() - borderRight();
int toAdd = borderBottom() + paddingBottom() + horizontalScrollbarHeight();
bool heightSpecified = false;
@@ -688,7 +688,7 @@ void RenderFlexibleBox::layoutVerticalBox(bool relayoutChildren)
if (child->isPositioned()) {
child->containingBlock()->insertPositionedObject(child);
if (child->style()->hasStaticX()) {
- if (style()->direction() == LTR)
+ if (style()->isLeftToRightDirection())
child->layer()->setStaticX(borderLeft()+paddingLeft());
else
child->layer()->setStaticX(borderRight()+paddingRight());
@@ -727,13 +727,13 @@ void RenderFlexibleBox::layoutVerticalBox(bool relayoutChildren)
childX += child->marginLeft() + max(0, (contentWidth() - (child->width() + child->marginLeft() + child->marginRight()))/2);
break;
case BEND:
- if (style()->direction() == RTL)
+ if (!style()->isLeftToRightDirection())
childX += child->marginLeft();
else
childX += contentWidth() - child->marginRight() - child->width();
break;
default: // BSTART/BSTRETCH
- if (style()->direction() == LTR)
+ if (style()->isLeftToRightDirection())
childX += child->marginLeft();
else
childX += contentWidth() - child->marginRight() - child->width();
diff --git a/WebCore/rendering/RenderLayer.cpp b/WebCore/rendering/RenderLayer.cpp
index 1b4b1da..0bf0bd6 100644
--- a/WebCore/rendering/RenderLayer.cpp
+++ b/WebCore/rendering/RenderLayer.cpp
@@ -1960,7 +1960,7 @@ void RenderLayer::computeScrollDimensions(bool* needHBar, bool* needVBar)
m_scrollDimensionsDirty = false;
- bool ltr = renderer()->style()->direction() == LTR;
+ bool ltr = renderer()->style()->isLeftToRightDirection();
int clientWidth = box->clientWidth();
int clientHeight = box->clientHeight();
diff --git a/WebCore/rendering/RenderListBox.cpp b/WebCore/rendering/RenderListBox.cpp
index 39442e1..caf82a2 100644
--- a/WebCore/rendering/RenderListBox.cpp
+++ b/WebCore/rendering/RenderListBox.cpp
@@ -334,7 +334,7 @@ void RenderListBox::paintItemForeground(PaintInfo& paintInfo, int tx, int ty, in
unsigned length = itemText.length();
const UChar* string = itemText.characters();
- TextRun textRun(string, length, 0, 0, 0, itemStyle->direction() == RTL, itemStyle->unicodeBidi() == Override, false, false);
+ TextRun textRun(string, length, 0, 0, 0, !itemStyle->isLeftToRightDirection(), itemStyle->unicodeBidi() == Override, false, false);
// Draw the item text
if (itemStyle->visibility() != HIDDEN)
diff --git a/WebCore/rendering/RenderListItem.cpp b/WebCore/rendering/RenderListItem.cpp
index b414f38..c248c5f 100644
--- a/WebCore/rendering/RenderListItem.cpp
+++ b/WebCore/rendering/RenderListItem.cpp
@@ -261,7 +261,7 @@ void RenderListItem::positionListMarker()
// FIXME: Inline flows in the line box hierarchy that have self-painting layers should act as cutoff points
// and really shouldn't keep propagating overflow up. This won't really break anything other than repainting
// not being as tight as it could be though.
- if (style()->direction() == LTR) {
+ if (style()->isLeftToRightDirection()) {
int leftLineOffset = logicalLeftOffsetForLine(yOffset, logicalLeftOffsetForLine(yOffset, false), false);
markerXPos = leftLineOffset - xOffset - paddingLeft() - borderLeft() + m_marker->marginLeft();
m_marker->inlineBoxWrapper()->adjustPosition(markerXPos - markerOldX, 0);
@@ -326,12 +326,12 @@ String RenderListItem::markerTextWithSuffix() const
const String markerSuffix = m_marker->suffix();
Vector<UChar> resultVector;
- if (m_marker->style()->direction() == RTL)
+ if (!m_marker->style()->isLeftToRightDirection())
resultVector.append(markerSuffix.characters(), markerSuffix.length());
resultVector.append(markerText.characters(), markerText.length());
- if (m_marker->style()->direction() == LTR)
+ if (m_marker->style()->isLeftToRightDirection())
resultVector.append(markerSuffix.characters(), markerSuffix.length());
return String::adopt(resultVector);
diff --git a/WebCore/rendering/RenderListMarker.cpp b/WebCore/rendering/RenderListMarker.cpp
index 18811df..6d055c6 100644
--- a/WebCore/rendering/RenderListMarker.cpp
+++ b/WebCore/rendering/RenderListMarker.cpp
@@ -1257,7 +1257,7 @@ void RenderListMarker::paint(PaintInfo& paintInfo, int tx, int ty)
const Font& font = style()->font();
const UChar suffix = listMarkerSuffix(type, m_listItem->value());
- if (style()->direction() == LTR) {
+ if (style()->isLeftToRightDirection()) {
int width = font.width(textRun);
context->drawText(style()->font(), textRun, marker.location());
UChar suffixSpace[2] = { suffix, ' ' };
@@ -1444,7 +1444,7 @@ void RenderListMarker::updateMargins()
if (isInside()) {
if (isImage()) {
- if (style()->direction() == LTR)
+ if (style()->isLeftToRightDirection())
marginRight = cMarkerPadding;
else
marginLeft = cMarkerPadding;
@@ -1452,7 +1452,7 @@ void RenderListMarker::updateMargins()
case Disc:
case Circle:
case Square:
- if (style()->direction() == LTR) {
+ if (style()->isLeftToRightDirection()) {
marginLeft = -1;
marginRight = font.ascent() - minPreferredLogicalWidth() + 1;
} else {
@@ -1464,7 +1464,7 @@ void RenderListMarker::updateMargins()
break;
}
} else {
- if (style()->direction() == LTR) {
+ if (style()->isLeftToRightDirection()) {
if (isImage())
marginLeft = -minPreferredLogicalWidth() - cMarkerPadding;
else {
@@ -1532,7 +1532,7 @@ String RenderListMarker::suffix() const
// If the suffix is not ' ', an extra space is needed
if (suffix != ' ') {
- if (style()->direction() == LTR)
+ if (style()->isLeftToRightDirection())
resultVector.append(' ');
else
resultVector.prepend(' ');
diff --git a/WebCore/rendering/RenderMarquee.cpp b/WebCore/rendering/RenderMarquee.cpp
index bb917f8..43eb514 100644
--- a/WebCore/rendering/RenderMarquee.cpp
+++ b/WebCore/rendering/RenderMarquee.cpp
@@ -110,7 +110,7 @@ int RenderMarquee::computePosition(EMarqueeDirection dir, bool stopAtContentEdge
ASSERT(box);
RenderStyle* s = box->style();
if (isHorizontal()) {
- bool ltr = s->direction() == LTR;
+ bool ltr = s->isLeftToRightDirection();
int clientWidth = box->clientWidth();
int contentWidth = ltr ? box->rightmostPosition(true, false) : box->leftmostPosition(true, false);
if (ltr)
diff --git a/WebCore/rendering/RenderMeter.cpp b/WebCore/rendering/RenderMeter.cpp
index 226d605..f60e350 100644
--- a/WebCore/rendering/RenderMeter.cpp
+++ b/WebCore/rendering/RenderMeter.cpp
@@ -105,7 +105,7 @@ IntRect RenderMeter::valuePartRect() const
if (rect.height() <= rect.width()) {
int width = static_cast<int>(rect.width()*valueRatio());
- if (style()->direction() == RTL) {
+ if (!style()->isLeftToRightDirection()) {
rect.setX(rect.x() + (rect.width() - width));
rect.setWidth(width);
} else
diff --git a/WebCore/rendering/RenderProgress.cpp b/WebCore/rendering/RenderProgress.cpp
index d6e2dc7..d2e9424 100644
--- a/WebCore/rendering/RenderProgress.cpp
+++ b/WebCore/rendering/RenderProgress.cpp
@@ -137,7 +137,7 @@ void RenderProgress::updateAnimationState()
IntRect RenderProgress::valuePartRect() const
{
IntRect rect(borderLeft() + paddingLeft(), borderTop() + paddingTop(), lround((width() - borderLeft() - paddingLeft() - borderRight() - paddingRight()) * position()), height() - borderTop() - paddingTop() - borderBottom() - paddingBottom());
- if (style()->direction() == RTL)
+ if (!style()->isLeftToRightDirection())
rect.setX(width() - borderRight() - paddingRight() - rect.width());
return rect;
}
diff --git a/WebCore/rendering/RenderTable.cpp b/WebCore/rendering/RenderTable.cpp
index 12319f8..f7477c4 100644
--- a/WebCore/rendering/RenderTable.cpp
+++ b/WebCore/rendering/RenderTable.cpp
@@ -732,7 +732,7 @@ int RenderTable::calcBorderLeft() const
if (tb.style() > BHIDDEN)
borderWidth = tb.width();
- int leftmostColumn = style()->direction() == RTL ? numEffCols() - 1 : 0;
+ int leftmostColumn = !style()->isLeftToRightDirection() ? numEffCols() - 1 : 0;
RenderTableCol* colGroup = colElement(leftmostColumn);
if (colGroup) {
const BorderValue& gb = style()->borderLeft();
@@ -791,7 +791,7 @@ int RenderTable::calcBorderRight() const
if (tb.style() > BHIDDEN)
borderWidth = tb.width();
- int rightmostColumn = style()->direction() == RTL ? 0 : numEffCols() - 1;
+ int rightmostColumn = !style()->isLeftToRightDirection() ? 0 : numEffCols() - 1;
RenderTableCol* colGroup = colElement(rightmostColumn);
if (colGroup) {
const BorderValue& gb = style()->borderRight();
diff --git a/WebCore/rendering/RenderTableCell.cpp b/WebCore/rendering/RenderTableCell.cpp
index 7bc80ae..735b82f 100644
--- a/WebCore/rendering/RenderTableCell.cpp
+++ b/WebCore/rendering/RenderTableCell.cpp
@@ -237,7 +237,7 @@ IntRect RenderTableCell::clippedOverflowRectForRepaint(RenderBoxModelObject* rep
if (!table()->collapseBorders() || table()->needsSectionRecalc())
return RenderBlock::clippedOverflowRectForRepaint(repaintContainer);
- bool rtl = table()->style()->direction() == RTL;
+ bool rtl = !table()->style()->isLeftToRightDirection();
int outlineSize = style()->outlineSize();
int left = max(borderHalfLeft(true), outlineSize);
int right = max(borderHalfRight(true), outlineSize);
@@ -714,7 +714,7 @@ int RenderTableCell::borderAfter() const
int RenderTableCell::borderHalfLeft(bool outer) const
{
- CollapsedBorderValue border = collapsedLeftBorder(table()->style()->direction() == RTL);
+ CollapsedBorderValue border = collapsedLeftBorder(!table()->style()->isLeftToRightDirection());
if (border.exists())
return (border.width() + (outer ? 0 : 1)) / 2; // Give the extra pixel to top and left.
return 0;
@@ -722,7 +722,7 @@ int RenderTableCell::borderHalfLeft(bool outer) const
int RenderTableCell::borderHalfRight(bool outer) const
{
- CollapsedBorderValue border = collapsedRightBorder(table()->style()->direction() == RTL);
+ CollapsedBorderValue border = collapsedRightBorder(!table()->style()->isLeftToRightDirection());
if (border.exists())
return (border.width() + (outer ? 1 : 0)) / 2;
return 0;
@@ -834,7 +834,7 @@ static void addBorderStyle(RenderTableCell::CollapsedBorderStyles& borderStyles,
void RenderTableCell::collectBorderStyles(CollapsedBorderStyles& borderStyles) const
{
- bool rtl = table()->style()->direction() == RTL;
+ bool rtl = !table()->style()->isLeftToRightDirection();
addBorderStyle(borderStyles, collapsedLeftBorder(rtl));
addBorderStyle(borderStyles, collapsedRightBorder(rtl));
addBorderStyle(borderStyles, collapsedTopBorder());
@@ -861,7 +861,7 @@ void RenderTableCell::paintCollapsedBorder(GraphicsContext* graphicsContext, int
if (!table()->currentBorderStyle())
return;
- bool rtl = table()->style()->direction() == RTL;
+ bool rtl = !table()->style()->isLeftToRightDirection();
CollapsedBorderValue leftVal = collapsedLeftBorder(rtl);
CollapsedBorderValue rightVal = collapsedRightBorder(rtl);
CollapsedBorderValue topVal = collapsedTopBorder();
diff --git a/WebCore/rendering/RenderTableSection.cpp b/WebCore/rendering/RenderTableSection.cpp
index cc9fc5c..7c4d0c4 100644
--- a/WebCore/rendering/RenderTableSection.cpp
+++ b/WebCore/rendering/RenderTableSection.cpp
@@ -605,7 +605,7 @@ int RenderTableSection::layoutRows(int toAdd)
IntRect oldCellRect(cell->x(), cell->y() , cell->width(), cell->height());
- if (style()->direction() == RTL)
+ if (!style()->isLeftToRightDirection())
cell->setLocation(table()->columnPositions()[nEffCols] - table()->columnPositions()[table()->colToEffCol(cell->col() + cell->colSpan())] + hspacing, m_rowPos[rindx]);
else
cell->setLocation(table()->columnPositions()[c] + hspacing, m_rowPos[rindx]);
@@ -911,7 +911,7 @@ int RenderTableSection::calcOuterBorderRight(bool rtl) const
void RenderTableSection::recalcOuterBorder()
{
- bool rtl = table()->style()->direction() == RTL;
+ bool rtl = !table()->style()->isLeftToRightDirection();
m_outerBorderTop = calcOuterBorderTop();
m_outerBorderBottom = calcOuterBorderBottom();
m_outerBorderLeft = calcOuterBorderLeft(rtl);
@@ -1043,7 +1043,7 @@ void RenderTableSection::paintObject(PaintInfo& paintInfo, int tx, int ty)
unsigned startcol = 0;
unsigned endcol = totalCols;
// FIXME: Implement RTL.
- if (!m_hasOverflowingCell && style()->direction() == LTR) {
+ if (!m_hasOverflowingCell && style()->isLeftToRightDirection()) {
int relativeX = x - tx;
int left = relativeX - os;
Vector<int>& columnPos = table()->columnPositions();
@@ -1223,7 +1223,7 @@ bool RenderTableSection::nodeAtPoint(const HitTestRequest& request, HitTestResul
--leftrow;
Vector<int>& columnPos = table()->columnPositions();
- bool rtl = style()->direction() == RTL;
+ bool rtl = !style()->isLeftToRightDirection();
int relativeX = xPos - tx;
if (rtl)
relativeX = columnPos[columnPos.size() - 1] - relativeX;
diff --git a/WebCore/rendering/RenderText.cpp b/WebCore/rendering/RenderText.cpp
index fada8b4..c9ddc4b 100644
--- a/WebCore/rendering/RenderText.cpp
+++ b/WebCore/rendering/RenderText.cpp
@@ -511,7 +511,7 @@ IntRect RenderText::localCaretRect(InlineBox* inlineBox, int caretOffset, int* e
switch (cbStyle->textAlign()) {
case TAAUTO:
case JUSTIFY:
- rightAligned = cbStyle->direction() == RTL;
+ rightAligned = !cbStyle->isLeftToRightDirection();
break;
case RIGHT:
case WEBKIT_RIGHT:
@@ -1224,7 +1224,7 @@ void RenderText::positionLineBox(InlineBox* box)
return;
}
- m_containsReversedText |= s->direction() == RTL;
+ m_containsReversedText |= !s->isLeftToRightDirection();
}
unsigned RenderText::width(unsigned from, unsigned len, int xPos, bool firstLine, HashSet<const SimpleFontData*>* fallbackFonts, GlyphOverflow* glyphOverflow) const
diff --git a/WebCore/rendering/RenderTextControlSingleLine.cpp b/WebCore/rendering/RenderTextControlSingleLine.cpp
index 2eea33b..75da999 100644
--- a/WebCore/rendering/RenderTextControlSingleLine.cpp
+++ b/WebCore/rendering/RenderTextControlSingleLine.cpp
@@ -368,7 +368,7 @@ void RenderTextControlSingleLine::forwardEvent(Event* event)
if (event->type() == eventNames().blurEvent) {
if (innerTextRenderer) {
if (RenderLayer* innerLayer = innerTextRenderer->layer())
- innerLayer->scrollToOffset(style()->direction() == RTL ? innerLayer->scrollWidth() : 0, 0);
+ innerLayer->scrollToOffset(!style()->isLeftToRightDirection() ? innerLayer->scrollWidth() : 0, 0);
}
capsLockStateMayHaveChanged();
diff --git a/WebCore/rendering/RenderThemeMac.mm b/WebCore/rendering/RenderThemeMac.mm
index 7982834..fd2aa8c 100644
--- a/WebCore/rendering/RenderThemeMac.mm
+++ b/WebCore/rendering/RenderThemeMac.mm
@@ -905,7 +905,7 @@ NSLevelIndicatorCell* RenderThemeMac::levelIndicatorFor(const RenderMeter* rende
}
[cell setLevelIndicatorStyle:levelIndicatorStyleFor(style->appearance())];
- [cell setBaseWritingDirection:style->direction() == LTR ? NSWritingDirectionLeftToRight : NSWritingDirectionRightToLeft];
+ [cell setBaseWritingDirection:style->isLeftToRightDirection() ? NSWritingDirectionLeftToRight : NSWritingDirectionRightToLeft];
[cell setMinValue:element->min()];
[cell setMaxValue:element->max()];
RetainPtr<NSNumber> valueObject = [NSNumber numberWithDouble:value];
@@ -959,7 +959,7 @@ bool RenderThemeMac::paintProgressBar(RenderObject* renderObject, const PaintInf
paintInfo.context->save();
- if (renderProgress->style()->direction() == RTL) {
+ if (!renderProgress->style()->isLeftToRightDirection()) {
paintInfo.context->translate(2 * rect.x() + rect.width(), 0);
paintInfo.context->scale(FloatSize(-1, 1));
}
diff --git a/WebCore/rendering/RenderTreeAsText.cpp b/WebCore/rendering/RenderTreeAsText.cpp
index ab6247b..6d42f5f 100644
--- a/WebCore/rendering/RenderTreeAsText.cpp
+++ b/WebCore/rendering/RenderTreeAsText.cpp
@@ -440,8 +440,8 @@ static void writeTextRun(TextStream& ts, const RenderText& o, const InlineTextBo
if (o.containingBlock()->isTableCell())
y -= toRenderTableCell(o.containingBlock())->intrinsicPaddingBefore();
ts << "text run at (" << run.m_x << "," << y << ") width " << run.m_logicalWidth;
- if (run.direction() == RTL || run.m_dirOverride) {
- ts << (run.direction() == RTL ? " RTL" : " LTR");
+ if (!run.isLeftToRightDirection() || run.m_dirOverride) {
+ ts << (!run.isLeftToRightDirection() ? " RTL" : " LTR");
if (run.m_dirOverride)
ts << " override";
}
diff --git a/WebCore/rendering/SVGInlineTextBox.cpp b/WebCore/rendering/SVGInlineTextBox.cpp
index c367598..3cade42 100644
--- a/WebCore/rendering/SVGInlineTextBox.cpp
+++ b/WebCore/rendering/SVGInlineTextBox.cpp
@@ -67,7 +67,7 @@ void SVGInlineTextBox::measureCharacter(RenderStyle* style, int position, int& c
{
ASSERT(style);
- int offset = direction() == RTL ? end() - position : start() + position;
+ int offset = !isLeftToRightDirection() ? end() - position : start() + position;
int extraCharsAvailable = len() - position - 1;
const UChar* characters = textRenderer()->characters();
@@ -647,7 +647,6 @@ void SVGInlineTextBox::buildLayoutInformation(SVGCharacterLayoutInfo& info, SVGL
const Font& font = style->font();
const UChar* characters = textRenderer->characters();
- TextDirection textDirection = direction();
unsigned startPosition = start();
unsigned endPosition = end();
unsigned length = len();
@@ -717,10 +716,10 @@ void SVGInlineTextBox::buildLayoutInformation(SVGCharacterLayoutInfo& info, SVGL
// Take letter & word spacing and kerning into account
float spacing = font.letterSpacing() + calculateCSSKerning(lengthContext, style);
- const UChar* currentCharacter = characters + (textDirection == RTL ? endPosition - i : startPosition + i);
+ const UChar* currentCharacter = characters + (!isLeftToRightDirection() ? endPosition - i : startPosition + i);
const UChar* lastCharacter = 0;
- if (textDirection == RTL) {
+ if (!isLeftToRightDirection()) {
if (i < endPosition)
lastCharacter = characters + endPosition - i + 1;
} else {
diff --git a/WebCore/rendering/SVGRenderTreeAsText.cpp b/WebCore/rendering/SVGRenderTreeAsText.cpp
index 4e26f52..d67dbf5 100644
--- a/WebCore/rendering/SVGRenderTreeAsText.cpp
+++ b/WebCore/rendering/SVGRenderTreeAsText.cpp
@@ -484,8 +484,8 @@ static inline void writeSVGInlineTextBox(TextStream& ts, SVGInlineTextBox* textB
else
ts << " width " << cummulatedWidthOfInlineBoxCharacterRange(range);
- if (textBox->direction() == RTL || textBox->m_dirOverride) {
- ts << (textBox->direction() == RTL ? " RTL" : " LTR");
+ if (!textBox->isLeftToRightDirection() || textBox->m_dirOverride) {
+ ts << (!textBox->isLeftToRightDirection() ? " RTL" : " LTR");
if (textBox->m_dirOverride)
ts << " override";
diff --git a/WebCore/rendering/SVGTextLayoutUtilities.cpp b/WebCore/rendering/SVGTextLayoutUtilities.cpp
index 2debf28..946e105 100644
--- a/WebCore/rendering/SVGTextLayoutUtilities.cpp
+++ b/WebCore/rendering/SVGTextLayoutUtilities.cpp
@@ -300,7 +300,7 @@ TextRun svgTextRunForInlineTextBox(const UChar* characters, int length, const Re
, false /* allowTabs */
, 0 /* xPos, only relevant with allowTabs=true */
, 0 /* padding, only relevant for justified text, not relevant for SVG */
- , textBox->direction() == RTL
+ , !textBox->isLeftToRightDirection()
, textBox->m_dirOverride || style->visuallyOrdered() /* directionalOverride */);
#if ENABLE(SVG_FONTS)
diff --git a/WebCore/rendering/style/RenderStyle.cpp b/WebCore/rendering/style/RenderStyle.cpp
index 623a298..6b4ee3d 100644
--- a/WebCore/rendering/style/RenderStyle.cpp
+++ b/WebCore/rendering/style/RenderStyle.cpp
@@ -1141,15 +1141,15 @@ unsigned short RenderStyle::borderAfterWidth() const
unsigned short RenderStyle::borderStartWidth() const
{
if (isVerticalBlockFlow())
- return direction() == LTR ? borderLeftWidth() : borderRightWidth();
- return direction() == LTR ? borderTopWidth() : borderBottomWidth();
+ return isLeftToRightDirection() ? borderLeftWidth() : borderRightWidth();
+ return isLeftToRightDirection() ? borderTopWidth() : borderBottomWidth();
}
unsigned short RenderStyle::borderEndWidth() const
{
if (isVerticalBlockFlow())
- return direction() == LTR ? borderRightWidth() : borderLeftWidth();
- return direction() == LTR ? borderBottomWidth() : borderTopWidth();
+ return isLeftToRightDirection() ? borderRightWidth() : borderLeftWidth();
+ return isLeftToRightDirection() ? borderBottomWidth() : borderTopWidth();
}
Length RenderStyle::marginBefore() const
@@ -1219,29 +1219,29 @@ Length RenderStyle::marginAfterUsing(const RenderStyle* otherStyle) const
Length RenderStyle::marginStart() const
{
if (isVerticalBlockFlow())
- return direction() == LTR ? marginLeft() : marginRight();
- return direction() == LTR ? marginTop() : marginBottom();
+ return isLeftToRightDirection() ? marginLeft() : marginRight();
+ return isLeftToRightDirection() ? marginTop() : marginBottom();
}
Length RenderStyle::marginEnd() const
{
if (isVerticalBlockFlow())
- return direction() == LTR ? marginRight() : marginLeft();
- return direction() == LTR ? marginBottom() : marginTop();
+ return isLeftToRightDirection() ? marginRight() : marginLeft();
+ return isLeftToRightDirection() ? marginBottom() : marginTop();
}
Length RenderStyle::marginStartUsing(const RenderStyle* otherStyle) const
{
if (otherStyle->isVerticalBlockFlow())
- return otherStyle->direction() == LTR ? marginLeft() : marginRight();
- return otherStyle->direction() == LTR ? marginTop() : marginBottom();
+ return otherStyle->isLeftToRightDirection() ? marginLeft() : marginRight();
+ return otherStyle->isLeftToRightDirection() ? marginTop() : marginBottom();
}
Length RenderStyle::marginEndUsing(const RenderStyle* otherStyle) const
{
if (otherStyle->isVerticalBlockFlow())
- return otherStyle->direction() == LTR ? marginRight() : marginLeft();
- return otherStyle->direction() == LTR ? marginBottom() : marginTop();
+ return otherStyle->isLeftToRightDirection() ? marginRight() : marginLeft();
+ return otherStyle->isLeftToRightDirection() ? marginBottom() : marginTop();
}
Length RenderStyle::paddingBefore() const
@@ -1279,15 +1279,15 @@ Length RenderStyle::paddingAfter() const
Length RenderStyle::paddingStart() const
{
if (isVerticalBlockFlow())
- return direction() == LTR ? paddingLeft() : paddingRight();
- return direction() == LTR ? paddingTop() : paddingBottom();
+ return isLeftToRightDirection() ? paddingLeft() : paddingRight();
+ return isLeftToRightDirection() ? paddingTop() : paddingBottom();
}
Length RenderStyle::paddingEnd() const
{
if (isVerticalBlockFlow())
- return direction() == LTR ? paddingRight() : paddingLeft();
- return direction() == LTR ? paddingBottom() : paddingTop();
+ return isLeftToRightDirection() ? paddingRight() : paddingLeft();
+ return isLeftToRightDirection() ? paddingBottom() : paddingTop();
}
} // namespace WebCore
diff --git a/WebCore/rendering/style/RenderStyle.h b/WebCore/rendering/style/RenderStyle.h
index 920d485..d62cbb7 100644
--- a/WebCore/rendering/style/RenderStyle.h
+++ b/WebCore/rendering/style/RenderStyle.h
@@ -476,6 +476,8 @@ public:
float effectiveZoom() const { return rareInheritedData->m_effectiveZoom; }
TextDirection direction() const { return static_cast<TextDirection>(inherited_flags._direction); }
+ bool isLeftToRightDirection() const { return direction() == LTR; }
+
Length lineHeight() const { return inherited->line_height; }
int computedLineHeight() const
{
diff --git a/WebCore/wml/WMLTableElement.cpp b/WebCore/wml/WMLTableElement.cpp
index eb22503..ed3522d 100644
--- a/WebCore/wml/WMLTableElement.cpp
+++ b/WebCore/wml/WMLTableElement.cpp
@@ -231,7 +231,7 @@ void WMLTableElement::alignCells(Vector<WMLElement*>& columnElements, WMLElement
bool rtl = false;
if (RenderObject* renderer = rowElement->renderer()) {
if (RenderStyle* style = renderer->style())
- rtl = style->direction() == RTL;
+ rtl = !style->isLeftToRightDirection();
}
rowElement->setAttribute(HTMLNames::alignAttr, rtl ? "right" : "left");
--
WebKit Debian packaging
More information about the Pkg-webkit-commits
mailing list