WebKit Bugzilla
Attachment 346670 Details for
Bug 188350
: Use a 1-byte enum class for TextDirection
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch
bug-188350-20180806175807.patch (text/plain), 124.41 KB, created by
Alex Christensen
on 2018-08-06 17:58:08 PDT
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
Alex Christensen
Created:
2018-08-06 17:58:08 PDT
Size:
124.41 KB
patch
obsolete
>Index: Source/WebCore/ChangeLog >=================================================================== >--- Source/WebCore/ChangeLog (revision 234619) >+++ Source/WebCore/ChangeLog (working copy) >@@ -1,3 +1,164 @@ >+2018-08-06 Alex Christensen <achristensen@webkit.org> >+ >+ Use a 1-byte enum class for TextDirection >+ https://bugs.webkit.org/show_bug.cgi?id=188350 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ * Modules/notifications/Notification.h: >+ * css/CSSPrimitiveValueMappings.h: >+ (WebCore::CSSPrimitiveValue::CSSPrimitiveValue): >+ (WebCore::CSSPrimitiveValue::operator TextDirection const): >+ * css/ElementRuleCollector.cpp: >+ (WebCore::ElementRuleCollector::matchAllRules): >+ * dom/Document.cpp: >+ (WebCore::Document::updateTitleFromTitleElement): >+ (WebCore::Document::setTitle): >+ * dom/Position.cpp: >+ (WebCore::Position::primaryDirection const): >+ * dom/Range.cpp: >+ (WebCore::Range::collectSelectionRectsWithoutUnionInteriorLines const): >+ * editing/Editing.cpp: >+ (WebCore::directionOfEnclosingBlock): >+ * editing/Editor.cpp: >+ (WebCore::Editor::baseWritingDirectionForSelectionStart const): >+ * editing/FrameSelection.cpp: >+ (WebCore::FrameSelection::willBeModified): >+ (WebCore::FrameSelection::modifyExtendingRight): >+ (WebCore::FrameSelection::modifyExtendingForward): >+ (WebCore::FrameSelection::modifyMovingRight): >+ (WebCore::FrameSelection::modifyExtendingLeft): >+ (WebCore::FrameSelection::modifyExtendingBackward): >+ (WebCore::FrameSelection::modifyMovingLeft): >+ (WebCore::FrameSelection::textSelectionIntent): >+ (WebCore::FrameSelection::modify): >+ * editing/VisiblePosition.cpp: >+ (WebCore::VisiblePosition::leftVisuallyDistinctCandidate const): >+ (WebCore::VisiblePosition::rightVisuallyDistinctCandidate const): >+ * editing/VisibleUnits.cpp: >+ (WebCore::visualWordPosition): >+ (WebCore::leftWordPosition): >+ (WebCore::rightWordPosition): >+ (WebCore::leftBoundaryOfLine): >+ (WebCore::rightBoundaryOfLine): >+ * html/HTMLElement.cpp: >+ (WebCore::HTMLElement::directionalityIfhasDirAutoAttribute const): >+ (WebCore::HTMLElement::directionality const): >+ * html/HTMLInputElement.cpp: >+ (WebCore::HTMLInputElement::setupDateTimeChooserParameters): >+ * html/HTMLTextFormControlElement.cpp: >+ (WebCore::HTMLTextFormControlElement::directionForFormData const): >+ (WebCore::HTMLTextFormControlElement::adjustInnerTextStyle const): >+ * html/HTMLTitleElement.cpp: >+ (WebCore::HTMLTitleElement::computedTextWithDirection): >+ * html/canvas/CanvasRenderingContext2D.cpp: >+ (WebCore::CanvasRenderingContext2D::toTextDirection const): >+ (WebCore::CanvasRenderingContext2D::direction const): >+ (WebCore::CanvasRenderingContext2D::textOffset): >+ * html/shadow/SliderThumbElement.cpp: >+ (WebCore::RenderSliderContainer::layout): >+ * html/shadow/TextControlInnerElements.cpp: >+ (WebCore::TextControlInnerElement::resolveCustomStyle): >+ * page/Chrome.cpp: >+ (WebCore::Chrome::setToolTip): >+ * page/FrameView.cpp: >+ (WebCore::paginationModeForRenderStyle): >+ * page/Settings.yaml: >+ * platform/RectEdges.h: >+ (WebCore::RectEdges::start): >+ (WebCore::RectEdges::end): >+ (WebCore::RectEdges::start const): >+ (WebCore::RectEdges::end const): >+ (WebCore::RectEdges::setStart): >+ (WebCore::RectEdges::setEnd): >+ * platform/UserInterfaceLayoutDirection.h: >+ * platform/graphics/ComplexTextController.cpp: >+ (WebCore::ComplexTextController::computeExpansionOpportunity): >+ * platform/graphics/FontCascade.cpp: >+ (WebCore::FontCascade::expansionOpportunityCountInternal): >+ (WebCore::FontCascade::leadingExpansionOpportunity): >+ (WebCore::FontCascade::trailingExpansionOpportunity): >+ * platform/graphics/GraphicsContext.cpp: >+ (WebCore::GraphicsContext::drawBidiText): >+ * platform/graphics/TextRun.h: >+ (WebCore::TextRun::TextRun): >+ (WebCore::TextRun::rtl const): >+ (WebCore::TextRun::ltr const): >+ (WebCore::TextRun::setDirection): >+ * platform/graphics/WidthIterator.cpp: >+ (WebCore::WidthIterator::WidthIterator): >+ * platform/ios/SelectionRect.cpp: >+ (WebCore::SelectionRect::SelectionRect): >+ * platform/text/BidiResolver.h: >+ (WebCore::BidiStatus::BidiStatus): >+ * platform/text/StringWithDirection.h: >+ * platform/text/WritingMode.h: >+ (WebCore::isLeftToRightDirection): >+ (WebCore::isVerticalWritingMode): >+ (WebCore::isFlippedWritingMode): >+ (WebCore::mapLogicalSideToPhysicalSide): >+ * rendering/HitTestResult.cpp: >+ (WebCore::HitTestResult::spellingToolTip const): >+ (WebCore::HitTestResult::title const): >+ (WebCore::HitTestResult::innerTextIfTruncated const): >+ * rendering/InlineBox.h: >+ (WebCore::InlineBox::direction const): >+ (WebCore::InlineBox::isLeftToRightDirection const): >+ * rendering/InlineFlowBox.cpp: >+ (WebCore::InlineFlowBox::paintFillLayer): >+ * rendering/InlineIterator.h: >+ (WebCore::embedCharFromDirection): >+ * rendering/InlineTextBox.cpp: >+ (WebCore::InlineTextBox::paint): >+ (WebCore::mirrorRTLSegment): >+ * rendering/RenderBlock.cpp: >+ (WebCore::RenderBlock::constructTextRun): >+ * rendering/RenderBlockLineLayout.cpp: >+ (WebCore::determineDirectionality): >+ (WebCore::RenderBlockFlow::textAlignmentForLine const): >+ (WebCore::RenderBlockFlow::updateLogicalWidthForAlignment): >+ (WebCore::RenderBlockFlow::handleTrailingSpaces): >+ (WebCore::RenderBlockFlow::layoutRunsAndFloatsInRange): >+ * rendering/RenderBox.cpp: >+ (WebCore::computeInlineStaticDistance): >+ (WebCore::RenderBox::computePositionedLogicalWidthUsing const): >+ (WebCore::RenderBox::computePositionedLogicalWidthReplaced const): >+ * rendering/RenderDeprecatedFlexibleBox.cpp: >+ (WebCore::RenderDeprecatedFlexibleBox::applyLineClamp): >+ * rendering/RenderFragmentedFlow.cpp: >+ (WebCore::RenderFragmentedFlow::updateLogicalWidth): >+ (WebCore::RenderFragmentedFlow::updateFragmentsFragmentedFlowPortionRect): >+ * rendering/RenderLayerModelObject.cpp: >+ (WebCore::RenderLayerModelObject::shouldPlaceBlockDirectionScrollbarOnLeft const): >+ * rendering/RenderMarquee.cpp: >+ (WebCore::RenderMarquee::direction const): >+ * rendering/RenderMenuList.cpp: >+ (WebCore::RenderMenuList::adjustInnerStyle): >+ (RenderMenuList::clientPaddingLeft const): >+ (RenderMenuList::clientPaddingRight const): >+ * rendering/RenderThemeIOS.mm: >+ (WebCore::RenderThemeIOS::popupInternalPaddingBox const): >+ (WebCore::RenderThemeIOS::paintMenuListButtonDecorations): >+ * rendering/RenderThemeMac.mm: >+ (WebCore::RenderThemeMac::paintMenuListButtonDecorations): >+ (WebCore::RenderThemeMac::popupInternalPaddingBox const): >+ (WebCore::RenderThemeMac::setPopupButtonCellState): >+ (WebCore::RenderThemeMac::paintSearchFieldCancelButton): >+ (WebCore::RenderThemeMac::paintSearchFieldResultsButton): >+ * rendering/mathml/RenderMathMLBlock.cpp: >+ (WebCore::RenderMathMLBlock::mirrorIfNeeded const): >+ * rendering/mathml/RenderMathMLOperator.cpp: >+ (WebCore::RenderMathMLOperator::layoutBlock): >+ * rendering/style/RenderStyle.cpp: >+ (WebCore::RenderStyle::RenderStyle): >+ * rendering/style/RenderStyle.h: >+ (WebCore::RenderStyle::isLeftToRightDirection const): >+ (WebCore::RenderStyle::initialDirection): >+ * testing/InternalSettings.cpp: >+ (WebCore::InternalSettings::systemLayoutDirection): >+ (WebCore::InternalSettings::setSystemLayoutDirection): >+ * testing/Internals.h: >+ > 2018-08-06 Alex Christensen <achristensen@webkit.org> > > Use enum classes and OptionSets for PaintPhase and PaintBehavior >Index: Source/WebCore/Modules/notifications/Notification.h >=================================================================== >--- Source/WebCore/Modules/notifications/Notification.h (revision 234618) >+++ Source/WebCore/Modules/notifications/Notification.h (working copy) >@@ -73,7 +73,7 @@ public: > const String& tag() const { return m_tag; } > const URL& icon() const { return m_icon; } > >- TextDirection direction() const { return m_direction == Direction::Rtl ? RTL : LTR; } >+ TextDirection direction() const { return m_direction == Direction::Rtl ? TextDirection::RTL : TextDirection::LTR; } > > WEBCORE_EXPORT void dispatchClickEvent(); > WEBCORE_EXPORT void dispatchCloseEvent(); >Index: Source/WebCore/accessibility/atk/WebKitAccessibleInterfaceText.cpp >=================================================================== >--- Source/WebCore/accessibility/atk/WebKitAccessibleInterfaceText.cpp (revision 234618) >+++ Source/WebCore/accessibility/atk/WebKitAccessibleInterfaceText.cpp (working copy) >@@ -335,7 +335,7 @@ static int offsetAdjustmentForListItem(c > // We need to adjust the offsets for the list item marker in > // Left-To-Right text, since we expose it together with the text. > RenderObject* renderer = object->renderer(); >- if (is<RenderListItem>(renderer) && renderer->style().direction() == LTR) >+ if (is<RenderListItem>(renderer) && renderer->style().direction() == TextDirection::LTR) > return downcast<RenderListItem>(*renderer).markerTextWithSuffix().length(); > > return 0; >@@ -462,7 +462,7 @@ static gchar* webkitAccessibleTextGetTex > RenderObject* objRenderer = coreObject->renderer(); > if (is<RenderListItem>(objRenderer)) { > String markerText = downcast<RenderListItem>(*objRenderer).markerTextWithSuffix(); >- ret = objRenderer->style().direction() == LTR ? markerText + ret : ret + markerText; >+ ret = objRenderer->style().direction() == TextDirection::LTR ? markerText + ret : ret + markerText; > if (endOffset == -1) > actualEndOffset = ret.length() + markerText.length(); > } >@@ -905,11 +905,11 @@ static char* webkitAccessibleTextLineFor > RenderObject* renderer = coreObject->renderer(); > if (renderer->isListItem()) { > // For Left-to-Right, the list item marker is at the beginning of the exposed text. >- if (renderer->style().direction() == LTR && isFirstVisiblePositionInNode(selectedLine.visibleStart(), node)) >+ if (renderer->style().direction() == TextDirection::LTR && isFirstVisiblePositionInNode(selectedLine.visibleStart(), node)) > *startOffset = 0; > > // For Right-to-Left, the list item marker is at the end of the exposed text. >- if (renderer->style().direction() == RTL && isLastVisiblePositionInNode(selectedLine.visibleEnd(), node)) >+ if (renderer->style().direction() == TextDirection::RTL && isLastVisiblePositionInNode(selectedLine.visibleEnd(), node)) > *endOffset = accessibilityObjectLength(coreObject); > } > >Index: Source/WebCore/css/CSSPrimitiveValueMappings.h >=================================================================== >--- Source/WebCore/css/CSSPrimitiveValueMappings.h (revision 234618) >+++ Source/WebCore/css/CSSPrimitiveValueMappings.h (working copy) >@@ -3150,10 +3150,10 @@ template<> inline CSSPrimitiveValue::CSS > { > m_primitiveUnitType = CSS_VALUE_ID; > switch (e) { >- case LTR: >+ case TextDirection::LTR: > m_value.valueID = CSSValueLtr; > break; >- case RTL: >+ case TextDirection::RTL: > m_value.valueID = CSSValueRtl; > break; > } >@@ -3165,15 +3165,15 @@ template<> inline CSSPrimitiveValue::ope > > switch (m_value.valueID) { > case CSSValueLtr: >- return LTR; >+ return TextDirection::LTR; > case CSSValueRtl: >- return RTL; >+ return TextDirection::RTL; > default: > break; > } > > ASSERT_NOT_REACHED(); >- return LTR; >+ return TextDirection::LTR; > } > > template<> inline CSSPrimitiveValue::CSSPrimitiveValue(WritingMode e) >Index: Source/WebCore/css/ElementRuleCollector.cpp >=================================================================== >--- Source/WebCore/css/ElementRuleCollector.cpp (revision 234618) >+++ Source/WebCore/css/ElementRuleCollector.cpp (working copy) >@@ -518,7 +518,7 @@ void ElementRuleCollector::matchAllRules > bool isAuto; > TextDirection textDirection = downcast<HTMLElement>(styledElement).directionalityIfhasDirAutoAttribute(isAuto); > if (isAuto) >- m_result.addMatchedProperties(textDirection == LTR ? leftToRightDeclaration() : rightToLeftDeclaration()); >+ m_result.addMatchedProperties(textDirection == TextDirection::LTR ? leftToRightDeclaration() : rightToLeftDeclaration()); > } > } > >Index: Source/WebCore/dom/Document.cpp >=================================================================== >--- Source/WebCore/dom/Document.cpp (revision 234618) >+++ Source/WebCore/dom/Document.cpp (working copy) >@@ -1514,7 +1514,7 @@ void Document::updateTitleFromTitleEleme > updateTitle(downcast<HTMLTitleElement>(*m_titleElement).textWithDirection()); > else if (is<SVGTitleElement>(*m_titleElement)) { > // FIXME: Does the SVG title element have a text direction? >- updateTitle({ downcast<SVGTitleElement>(*m_titleElement).textContent(), LTR }); >+ updateTitle({ downcast<SVGTitleElement>(*m_titleElement).textContent(), TextDirection::LTR }); > } > } > >@@ -1546,7 +1546,7 @@ void Document::setTitle(const String& ti > else if (is<SVGTitleElement>(m_titleElement.get())) > downcast<SVGTitleElement>(*m_titleElement).setTextContent(title); > else >- updateTitle({ title, LTR }); >+ updateTitle({ title, TextDirection::LTR }); > } > > template<typename> struct TitleTraits; >Index: Source/WebCore/dom/Position.cpp >=================================================================== >--- Source/WebCore/dom/Position.cpp (revision 234618) >+++ Source/WebCore/dom/Position.cpp (working copy) >@@ -1388,10 +1388,10 @@ void Position::getInlineBoxAndOffset(EAf > TextDirection Position::primaryDirection() const > { > if (!m_anchorNode->renderer()) >- return LTR; >+ return TextDirection::LTR; > if (auto* blockFlow = lineageOfType<RenderBlockFlow>(*m_anchorNode->renderer()).first()) > return blockFlow->style().direction(); >- return LTR; >+ return TextDirection::LTR; > } > > #if ENABLE(TREE_DEBUGGING) >Index: Source/WebCore/dom/Range.cpp >=================================================================== >--- Source/WebCore/dom/Range.cpp (revision 234618) >+++ Source/WebCore/dom/Range.cpp (working copy) >@@ -1431,7 +1431,7 @@ int Range::collectSelectionRectsWithoutU > if (rects[j].lineNumber() != rects[j - 1].lineNumber()) > continue; > SelectionRect& previousRect = rects[j - 1]; >- bool previousRectMayNotReachRightEdge = (previousRect.direction() == LTR && previousRect.containsEnd()) || (previousRect.direction() == RTL && previousRect.containsStart()); >+ bool previousRectMayNotReachRightEdge = (previousRect.direction() == TextDirection::LTR && previousRect.containsEnd()) || (previousRect.direction() == TextDirection::RTL && previousRect.containsStart()); > if (previousRectMayNotReachRightEdge) > continue; > int adjustedWidth = rects[j].logicalLeft() - previousRect.logicalLeft(); >@@ -1446,10 +1446,10 @@ int Range::collectSelectionRectsWithoutU > SelectionRect& selectionRect = rects[i]; > if (!selectionRect.isLineBreak() && selectionRect.lineNumber() >= maxLineNumber) > continue; >- if (selectionRect.direction() == RTL && selectionRect.isFirstOnLine()) { >+ if (selectionRect.direction() == TextDirection::RTL && selectionRect.isFirstOnLine()) { > selectionRect.setLogicalWidth(selectionRect.logicalWidth() + selectionRect.logicalLeft() - selectionRect.minX()); > selectionRect.setLogicalLeft(selectionRect.minX()); >- } else if (selectionRect.direction() == LTR && selectionRect.isLastOnLine()) >+ } else if (selectionRect.direction() == TextDirection::LTR && selectionRect.isLastOnLine()) > selectionRect.setLogicalWidth(selectionRect.maxX() - selectionRect.logicalLeft()); > } > >Index: Source/WebCore/editing/Editing.cpp >=================================================================== >--- Source/WebCore/editing/Editing.cpp (revision 234618) >+++ Source/WebCore/editing/Editing.cpp (working copy) >@@ -362,10 +362,10 @@ TextDirection directionOfEnclosingBlock( > { > auto block = enclosingBlock(position.containerNode()); > if (!block) >- return LTR; >+ return TextDirection::LTR; > auto renderer = block->renderer(); > if (!renderer) >- return LTR; >+ return TextDirection::LTR; > return renderer->style().direction(); > } > >Index: Source/WebCore/editing/Editor.cpp >=================================================================== >--- Source/WebCore/editing/Editor.cpp (revision 234618) >+++ Source/WebCore/editing/Editor.cpp (working copy) >@@ -1762,9 +1762,9 @@ WritingDirection Editor::baseWritingDire > } > > switch (renderer->style().direction()) { >- case LTR: >+ case TextDirection::LTR: > return LeftToRightWritingDirection; >- case RTL: >+ case TextDirection::RTL: > return RightToLeftWritingDirection; > } > >Index: Source/WebCore/editing/FrameSelection.cpp >=================================================================== >--- Source/WebCore/editing/FrameSelection.cpp (revision 234618) >+++ Source/WebCore/editing/FrameSelection.cpp (working copy) >@@ -633,7 +633,7 @@ void FrameSelection::willBeModified(EAlt > } else { > switch (direction) { > case DirectionRight: >- if (directionOfSelection() == LTR) >+ if (directionOfSelection() == TextDirection::LTR) > baseIsStart = true; > else > baseIsStart = false; >@@ -642,7 +642,7 @@ void FrameSelection::willBeModified(EAlt > baseIsStart = true; > break; > case DirectionLeft: >- if (directionOfSelection() == LTR) >+ if (directionOfSelection() == TextDirection::LTR) > baseIsStart = false; > else > baseIsStart = true; >@@ -718,23 +718,23 @@ VisiblePosition FrameSelection::modifyEx > // The difference between modifyExtendingRight and modifyExtendingForward is: > // modifyExtendingForward always extends forward logically. > // modifyExtendingRight behaves the same as modifyExtendingForward except for extending character or word, >- // it extends forward logically if the enclosing block is LTR direction, >- // but it extends backward logically if the enclosing block is RTL direction. >+ // it extends forward logically if the enclosing block is TextDirection::LTR, >+ // but it extends backward logically if the enclosing block is TextDirection::RTL. > switch (granularity) { > case CharacterGranularity: >- if (directionOfEnclosingBlock() == LTR) >+ if (directionOfEnclosingBlock() == TextDirection::LTR) > pos = pos.next(CannotCrossEditingBoundary); > else > pos = pos.previous(CannotCrossEditingBoundary); > break; > case WordGranularity: >- if (directionOfEnclosingBlock() == LTR) >+ if (directionOfEnclosingBlock() == TextDirection::LTR) > pos = nextWordPositionForPlatform(pos); > else > pos = previousWordPosition(pos); > break; > case LineBoundary: >- if (directionOfEnclosingBlock() == LTR) >+ if (directionOfEnclosingBlock() == TextDirection::LTR) > pos = modifyExtendingForward(granularity); > else > pos = modifyExtendingBackward(granularity); >@@ -753,7 +753,7 @@ VisiblePosition FrameSelection::modifyEx > break; > } > #if ENABLE(USERSELECT_ALL) >- adjustPositionForUserSelectAll(pos, directionOfEnclosingBlock() == LTR); >+ adjustPositionForUserSelectAll(pos, directionOfEnclosingBlock() == TextDirection::LTR); > #endif > return pos; > } >@@ -798,7 +798,7 @@ VisiblePosition FrameSelection::modifyEx > break; > } > #if ENABLE(USERSELECT_ALL) >- adjustPositionForUserSelectAll(pos, directionOfEnclosingBlock() == LTR); >+ adjustPositionForUserSelectAll(pos, directionOfEnclosingBlock() == TextDirection::LTR); > #endif > return pos; > } >@@ -811,7 +811,7 @@ VisiblePosition FrameSelection::modifyMo > switch (granularity) { > case CharacterGranularity: > if (isRange()) { >- if (directionOfSelection() == LTR) >+ if (directionOfSelection() == TextDirection::LTR) > pos = VisiblePosition(m_selection.end(), m_selection.affinity()); > else > pos = VisiblePosition(m_selection.start(), m_selection.affinity()); >@@ -935,23 +935,23 @@ VisiblePosition FrameSelection::modifyEx > // The difference between modifyExtendingLeft and modifyExtendingBackward is: > // modifyExtendingBackward always extends backward logically. > // modifyExtendingLeft behaves the same as modifyExtendingBackward except for extending character or word, >- // it extends backward logically if the enclosing block is LTR direction, >- // but it extends forward logically if the enclosing block is RTL direction. >+ // it extends backward logically if the enclosing block is TextDirection::LTR, >+ // but it extends forward logically if the enclosing block is TextDirection::RTL. > switch (granularity) { > case CharacterGranularity: >- if (directionOfEnclosingBlock() == LTR) >+ if (directionOfEnclosingBlock() == TextDirection::LTR) > pos = pos.previous(CannotCrossEditingBoundary); > else > pos = pos.next(CannotCrossEditingBoundary); > break; > case WordGranularity: >- if (directionOfEnclosingBlock() == LTR) >+ if (directionOfEnclosingBlock() == TextDirection::LTR) > pos = previousWordPosition(pos); > else > pos = nextWordPositionForPlatform(pos); > break; > case LineBoundary: >- if (directionOfEnclosingBlock() == LTR) >+ if (directionOfEnclosingBlock() == TextDirection::LTR) > pos = modifyExtendingBackward(granularity); > else > pos = modifyExtendingForward(granularity); >@@ -969,7 +969,7 @@ VisiblePosition FrameSelection::modifyEx > break; > } > #if ENABLE(USERSELECT_ALL) >- adjustPositionForUserSelectAll(pos, !(directionOfEnclosingBlock() == LTR)); >+ adjustPositionForUserSelectAll(pos, !(directionOfEnclosingBlock() == TextDirection::LTR)); > #endif > return pos; > } >@@ -1019,7 +1019,7 @@ VisiblePosition FrameSelection::modifyEx > break; > } > #if ENABLE(USERSELECT_ALL) >- adjustPositionForUserSelectAll(pos, !(directionOfEnclosingBlock() == LTR)); >+ adjustPositionForUserSelectAll(pos, !(directionOfEnclosingBlock() == TextDirection::LTR)); > #endif > return pos; > } >@@ -1032,7 +1032,7 @@ VisiblePosition FrameSelection::modifyMo > switch (granularity) { > case CharacterGranularity: > if (isRange()) >- if (directionOfSelection() == LTR) >+ if (directionOfSelection() == TextDirection::LTR) > pos = VisiblePosition(m_selection.start(), m_selection.affinity()); > else > pos = VisiblePosition(m_selection.end(), m_selection.affinity()); >@@ -1154,7 +1154,7 @@ AXTextStateChangeIntent FrameSelection:: > bool flip = false; > if (alter == FrameSelection::AlterationMove) { > intent.type = AXTextStateChangeTypeSelectionMove; >- flip = isRange() && directionOfSelection() == RTL; >+ flip = isRange() && directionOfSelection() == TextDirection::RTL; > } else > intent.type = AXTextStateChangeTypeSelectionExtend; > switch (granularity) { >@@ -1375,7 +1375,7 @@ bool FrameSelection::modify(EAlteration > setExtent(position, userTriggered); > else { > TextDirection textDirection = directionOfEnclosingBlock(); >- if (direction == DirectionForward || (textDirection == LTR && direction == DirectionRight) || (textDirection == RTL && direction == DirectionLeft)) >+ if (direction == DirectionForward || (textDirection == TextDirection::LTR && direction == DirectionRight) || (textDirection == TextDirection::RTL && direction == DirectionLeft)) > setEnd(position, userTriggered); > else > setStart(position, userTriggered); >Index: Source/WebCore/editing/VisiblePosition.cpp >=================================================================== >--- Source/WebCore/editing/VisiblePosition.cpp (revision 234618) >+++ Source/WebCore/editing/VisiblePosition.cpp (working copy) >@@ -127,7 +127,7 @@ Position VisiblePosition::leftVisuallyDi > int offset; > p.getInlineBoxAndOffset(m_affinity, primaryDirection, box, offset); > if (!box) >- return primaryDirection == LTR ? previousVisuallyDistinctCandidate(m_deepPosition) : nextVisuallyDistinctCandidate(m_deepPosition); >+ return primaryDirection == TextDirection::LTR ? previousVisuallyDistinctCandidate(m_deepPosition) : nextVisuallyDistinctCandidate(m_deepPosition); > > RenderObject* renderer = &box->renderer(); > >@@ -138,7 +138,7 @@ Position VisiblePosition::leftVisuallyDi > if (!renderer->node()) { > box = box->prevLeafChild(); > if (!box) >- return primaryDirection == LTR ? previousVisuallyDistinctCandidate(m_deepPosition) : nextVisuallyDistinctCandidate(m_deepPosition); >+ return primaryDirection == TextDirection::LTR ? previousVisuallyDistinctCandidate(m_deepPosition) : nextVisuallyDistinctCandidate(m_deepPosition); > renderer = &box->renderer(); > offset = box->caretRightmostOffset(); > continue; >@@ -156,7 +156,7 @@ Position VisiblePosition::leftVisuallyDi > // Overshot to the left. > InlineBox* prevBox = box->prevLeafChildIgnoringLineBreak(); > if (!prevBox) { >- Position positionOnLeft = primaryDirection == LTR ? previousVisuallyDistinctCandidate(m_deepPosition) : nextVisuallyDistinctCandidate(m_deepPosition); >+ Position positionOnLeft = primaryDirection == TextDirection::LTR ? previousVisuallyDistinctCandidate(m_deepPosition) : nextVisuallyDistinctCandidate(m_deepPosition); > if (positionOnLeft.isNull()) > return Position(); > >@@ -183,10 +183,10 @@ Position VisiblePosition::leftVisuallyDi > if (box->direction() == primaryDirection) { > if (!prevBox) { > InlineBox* logicalStart = nullptr; >- if (primaryDirection == LTR ? box->root().getLogicalStartBoxWithNode(logicalStart) : box->root().getLogicalEndBoxWithNode(logicalStart)) { >+ if (primaryDirection == TextDirection::LTR ? box->root().getLogicalStartBoxWithNode(logicalStart) : box->root().getLogicalEndBoxWithNode(logicalStart)) { > box = logicalStart; > renderer = &box->renderer(); >- offset = primaryDirection == LTR ? box->caretMinOffset() : box->caretMaxOffset(); >+ offset = primaryDirection == TextDirection::LTR ? box->caretMinOffset() : box->caretMaxOffset(); > } > break; > } >@@ -247,7 +247,7 @@ Position VisiblePosition::leftVisuallyDi > level = box->bidiLevel(); > } > renderer = &box->renderer(); >- offset = primaryDirection == LTR ? box->caretMinOffset() : box->caretMaxOffset(); >+ offset = primaryDirection == TextDirection::LTR ? box->caretMinOffset() : box->caretMaxOffset(); > } > break; > } >@@ -297,7 +297,7 @@ Position VisiblePosition::rightVisuallyD > int offset; > p.getInlineBoxAndOffset(m_affinity, primaryDirection, box, offset); > if (!box) >- return primaryDirection == LTR ? nextVisuallyDistinctCandidate(m_deepPosition) : previousVisuallyDistinctCandidate(m_deepPosition); >+ return primaryDirection == TextDirection::LTR ? nextVisuallyDistinctCandidate(m_deepPosition) : previousVisuallyDistinctCandidate(m_deepPosition); > > RenderObject* renderer = &box->renderer(); > >@@ -308,7 +308,7 @@ Position VisiblePosition::rightVisuallyD > if (!renderer->node()) { > box = box->nextLeafChild(); > if (!box) >- return primaryDirection == LTR ? nextVisuallyDistinctCandidate(m_deepPosition) : previousVisuallyDistinctCandidate(m_deepPosition); >+ return primaryDirection == TextDirection::LTR ? nextVisuallyDistinctCandidate(m_deepPosition) : previousVisuallyDistinctCandidate(m_deepPosition); > renderer = &box->renderer(); > offset = box->caretLeftmostOffset(); > continue; >@@ -326,7 +326,7 @@ Position VisiblePosition::rightVisuallyD > // Overshot to the right. > InlineBox* nextBox = box->nextLeafChildIgnoringLineBreak(); > if (!nextBox) { >- Position positionOnRight = primaryDirection == LTR ? nextVisuallyDistinctCandidate(m_deepPosition) : previousVisuallyDistinctCandidate(m_deepPosition); >+ Position positionOnRight = primaryDirection == TextDirection::LTR ? nextVisuallyDistinctCandidate(m_deepPosition) : previousVisuallyDistinctCandidate(m_deepPosition); > if (positionOnRight.isNull()) > return Position(); > >@@ -353,10 +353,10 @@ Position VisiblePosition::rightVisuallyD > if (box->direction() == primaryDirection) { > if (!nextBox) { > InlineBox* logicalEnd = nullptr; >- if (primaryDirection == LTR ? box->root().getLogicalEndBoxWithNode(logicalEnd) : box->root().getLogicalStartBoxWithNode(logicalEnd)) { >+ if (primaryDirection == TextDirection::LTR ? box->root().getLogicalEndBoxWithNode(logicalEnd) : box->root().getLogicalStartBoxWithNode(logicalEnd)) { > box = logicalEnd; > renderer = &box->renderer(); >- offset = primaryDirection == LTR ? box->caretMaxOffset() : box->caretMinOffset(); >+ offset = primaryDirection == TextDirection::LTR ? box->caretMaxOffset() : box->caretMinOffset(); > } > break; > } >@@ -420,7 +420,7 @@ Position VisiblePosition::rightVisuallyD > level = box->bidiLevel(); > } > renderer = &box->renderer(); >- offset = primaryDirection == LTR ? box->caretMaxOffset() : box->caretMinOffset(); >+ offset = primaryDirection == TextDirection::LTR ? box->caretMaxOffset() : box->caretMinOffset(); > } > break; > } >Index: Source/WebCore/editing/VisibleUnits.cpp >=================================================================== >--- Source/WebCore/editing/VisibleUnits.cpp (revision 234618) >+++ Source/WebCore/editing/VisibleUnits.cpp (working copy) >@@ -408,7 +408,7 @@ static VisiblePosition visualWordPositio > > bool isWordBreak; > bool boxHasSameDirectionalityAsBlock = box->direction() == blockDirection; >- bool movingBackward = (direction == MoveLeft && box->direction() == LTR) || (direction == MoveRight && box->direction() == RTL); >+ bool movingBackward = (direction == MoveLeft && box->direction() == TextDirection::LTR) || (direction == MoveRight && box->direction() == TextDirection::RTL); > if ((skipsSpaceWhenMovingRight && boxHasSameDirectionalityAsBlock) > || (!skipsSpaceWhenMovingRight && movingBackward)) { > bool logicalStartInRenderer = offsetInBox == static_cast<int>(textBox.start()) && previousBoxInDifferentLine; >@@ -439,7 +439,7 @@ VisiblePosition leftWordPosition(const V > // FIXME: How should we handle a non-editable position? > if (leftWordBreak.isNull() && isEditablePosition(visiblePosition.deepEquivalent())) { > TextDirection blockDirection = directionOfEnclosingBlock(visiblePosition.deepEquivalent()); >- leftWordBreak = blockDirection == LTR ? startOfEditableContent(visiblePosition) : endOfEditableContent(visiblePosition); >+ leftWordBreak = blockDirection == TextDirection::LTR ? startOfEditableContent(visiblePosition) : endOfEditableContent(visiblePosition); > } > return leftWordBreak; > } >@@ -452,7 +452,7 @@ VisiblePosition rightWordPosition(const > // FIXME: How should we handle a non-editable position? > if (rightWordBreak.isNull() && isEditablePosition(visiblePosition.deepEquivalent())) { > TextDirection blockDirection = directionOfEnclosingBlock(visiblePosition.deepEquivalent()); >- rightWordBreak = blockDirection == LTR ? endOfEditableContent(visiblePosition) : startOfEditableContent(visiblePosition); >+ rightWordBreak = blockDirection == TextDirection::LTR ? endOfEditableContent(visiblePosition) : startOfEditableContent(visiblePosition); > } > return rightWordBreak; > } >@@ -1529,12 +1529,12 @@ bool isEndOfEditableOrNonEditableContent > > VisiblePosition leftBoundaryOfLine(const VisiblePosition& c, TextDirection direction, bool* reachedBoundary) > { >- return direction == LTR ? logicalStartOfLine(c, reachedBoundary) : logicalEndOfLine(c, reachedBoundary); >+ return direction == TextDirection::LTR ? logicalStartOfLine(c, reachedBoundary) : logicalEndOfLine(c, reachedBoundary); > } > > VisiblePosition rightBoundaryOfLine(const VisiblePosition& c, TextDirection direction, bool* reachedBoundary) > { >- return direction == LTR ? logicalEndOfLine(c, reachedBoundary) : logicalStartOfLine(c, reachedBoundary); >+ return direction == TextDirection::LTR ? logicalEndOfLine(c, reachedBoundary) : logicalStartOfLine(c, reachedBoundary); > } > > static bool directionIsDownstream(SelectionDirection direction) >Index: Source/WebCore/editing/atk/FrameSelectionAtk.cpp >=================================================================== >--- Source/WebCore/editing/atk/FrameSelectionAtk.cpp (revision 234618) >+++ Source/WebCore/editing/atk/FrameSelectionAtk.cpp (working copy) >@@ -43,7 +43,7 @@ static void emitTextSelectionChange(Acce > // the list item marker is exposed through the text of the accessible list item rather > // than through a separate accessible object. > RenderObject* renderer = object->renderer(); >- if (is<RenderListItem>(renderer) && renderer->style().direction() == LTR) >+ if (is<RenderListItem>(renderer) && renderer->style().direction() == TextDirection::LTR) > offset += downcast<RenderListItem>(*renderer).markerTextWithSuffix().length(); > > g_signal_emit_by_name(axObject, "text-caret-moved", offset); >Index: Source/WebCore/html/HTMLElement.cpp >=================================================================== >--- Source/WebCore/html/HTMLElement.cpp (revision 234618) >+++ Source/WebCore/html/HTMLElement.cpp (working copy) >@@ -800,7 +800,7 @@ TextDirection HTMLElement::directionalit > { > if (!(selfOrAncestorHasDirAutoAttribute() && hasDirectionAuto())) { > isAuto = false; >- return LTR; >+ return TextDirection::LTR; > } > > isAuto = true; >@@ -815,7 +815,7 @@ TextDirection HTMLElement::directionalit > UCharDirection textDirection = textElement.value().defaultWritingDirection(&hasStrongDirectionality); > if (strongDirectionalityTextNode) > *strongDirectionalityTextNode = hasStrongDirectionality ? &textElement : nullptr; >- return (textDirection == U_LEFT_TO_RIGHT) ? LTR : RTL; >+ return (textDirection == U_LEFT_TO_RIGHT) ? TextDirection::LTR : TextDirection::RTL; > } > > RefPtr<Node> node = firstChild(); >@@ -842,14 +842,14 @@ TextDirection HTMLElement::directionalit > if (hasStrongDirectionality) { > if (strongDirectionalityTextNode) > *strongDirectionalityTextNode = node.get(); >- return (textDirection == U_LEFT_TO_RIGHT) ? LTR : RTL; >+ return (textDirection == U_LEFT_TO_RIGHT) ? TextDirection::LTR : TextDirection::RTL; > } > } > node = NodeTraversal::next(*node, this); > } > if (strongDirectionalityTextNode) > *strongDirectionalityTextNode = nullptr; >- return LTR; >+ return TextDirection::LTR; > } > > void HTMLElement::dirAttributeChanged(const AtomicString& value) >Index: Source/WebCore/html/HTMLInputElement.cpp >=================================================================== >--- Source/WebCore/html/HTMLInputElement.cpp (revision 234618) >+++ Source/WebCore/html/HTMLInputElement.cpp (working copy) >@@ -2098,7 +2098,7 @@ bool HTMLInputElement::setupDateTimeChoo > else > parameters.anchorRectInRootView = IntRect(); > parameters.currentValue = value(); >- parameters.isAnchorElementRTL = computedStyle()->direction() == RTL; >+ parameters.isAnchorElementRTL = computedStyle()->direction() == TextDirection::RTL; > #if ENABLE(DATALIST_ELEMENT) > if (auto dataList = this->dataList()) { > Ref<HTMLCollection> options = dataList->options(); >Index: Source/WebCore/html/HTMLTextFormControlElement.cpp >=================================================================== >--- Source/WebCore/html/HTMLTextFormControlElement.cpp (revision 234618) >+++ Source/WebCore/html/HTMLTextFormControlElement.cpp (working copy) >@@ -775,7 +775,7 @@ String HTMLTextFormControlElement::direc > if (equalLettersIgnoringASCIICase(dirAttributeValue, "auto")) { > bool isAuto; > TextDirection textDirection = static_cast<const HTMLElement*>(element)->directionalityIfhasDirAutoAttribute(isAuto); >- return textDirection == RTL ? "rtl" : "ltr"; >+ return textDirection == TextDirection::RTL ? "rtl" : "ltr"; > } > } > >@@ -837,7 +837,7 @@ void HTMLTextFormControlElement::adjustI > break; > } > >- textBlockStyle.setDirection(LTR); >+ textBlockStyle.setDirection(TextDirection::LTR); > } > #endif > } >Index: Source/WebCore/html/HTMLTitleElement.cpp >=================================================================== >--- Source/WebCore/html/HTMLTitleElement.cpp (revision 234618) >+++ Source/WebCore/html/HTMLTitleElement.cpp (working copy) >@@ -80,7 +80,7 @@ String HTMLTitleElement::text() const > > StringWithDirection HTMLTitleElement::computedTextWithDirection() > { >- TextDirection direction = LTR; >+ auto direction = TextDirection::LTR; > if (auto* computedStyle = this->computedStyle()) > direction = computedStyle->direction(); > else >Index: Source/WebCore/html/canvas/CanvasRenderingContext2D.cpp >=================================================================== >--- Source/WebCore/html/canvas/CanvasRenderingContext2D.cpp (revision 234618) >+++ Source/WebCore/html/canvas/CanvasRenderingContext2D.cpp (working copy) >@@ -295,21 +295,21 @@ inline TextDirection CanvasRenderingCont > *computedStyle = style; > switch (direction) { > case Direction::Inherit: >- return style ? style->direction() : LTR; >+ return style ? style->direction() : TextDirection::LTR; > case Direction::Rtl: >- return RTL; >+ return TextDirection::RTL; > case Direction::Ltr: >- return LTR; >+ return TextDirection::LTR; > } > ASSERT_NOT_REACHED(); >- return LTR; >+ return TextDirection::LTR; > } > > CanvasDirection CanvasRenderingContext2D::direction() const > { > if (state().direction == Direction::Inherit) > canvas().document().updateStyleIfNeeded(); >- return toTextDirection(state().direction) == RTL ? CanvasDirection::Rtl : CanvasDirection::Ltr; >+ return toTextDirection(state().direction) == TextDirection::RTL ? CanvasDirection::Rtl : CanvasDirection::Ltr; > } > > void CanvasRenderingContext2D::setDirection(CanvasDirection direction) >@@ -429,7 +429,7 @@ FloatPoint CanvasRenderingContext2D::tex > break; > } > >- bool isRTL = direction == RTL; >+ bool isRTL = direction == TextDirection::RTL; > auto align = state().textAlign; > if (align == StartTextAlign) > align = isRTL ? RightTextAlign : LeftTextAlign; >Index: Source/WebCore/html/shadow/SliderThumbElement.cpp >=================================================================== >--- Source/WebCore/html/shadow/SliderThumbElement.cpp (revision 234618) >+++ Source/WebCore/html/shadow/SliderThumbElement.cpp (working copy) >@@ -171,7 +171,7 @@ void RenderSliderContainer::layout() > // FIXME: Work around rounding issues in RTL vertical sliders. We want them to > // render identically to LTR vertical sliders. We can remove this work around when > // subpixel rendering is enabled on all ports. >- mutableStyle().setDirection(LTR); >+ mutableStyle().setDirection(TextDirection::LTR); > } > > RenderBox* thumb = input.sliderThumbElement() ? input.sliderThumbElement()->renderBox() : nullptr; >Index: Source/WebCore/html/shadow/TextControlInnerElements.cpp >=================================================================== >--- Source/WebCore/html/shadow/TextControlInnerElements.cpp (revision 234618) >+++ Source/WebCore/html/shadow/TextControlInnerElements.cpp (working copy) >@@ -109,7 +109,7 @@ std::optional<ElementStyle> TextControlI > newStyle->setFlexGrow(1); > newStyle->setMinWidth(Length { 0, Fixed }); // Needed for correct shrinking. > newStyle->setDisplay(DisplayType::Block); >- newStyle->setDirection(LTR); >+ newStyle->setDirection(TextDirection::LTR); > // We don't want the shadow DOM to be editable, so we set this block to read-only in case the input itself is editable. > newStyle->setUserModify(UserModify::ReadOnly); > >Index: Source/WebCore/page/Chrome.cpp >=================================================================== >--- Source/WebCore/page/Chrome.cpp (revision 234618) >+++ Source/WebCore/page/Chrome.cpp (working copy) >@@ -356,7 +356,7 @@ void Chrome::setToolTip(const HitTestRes > if (form->renderer()) > toolTipDirection = form->renderer()->style().direction(); > else >- toolTipDirection = LTR; >+ toolTipDirection = TextDirection::LTR; > } > } > } >@@ -367,7 +367,7 @@ void Chrome::setToolTip(const HitTestRes > // FIXME: Need to pass this URL through userVisibleString once that's in WebCore > toolTip = result.absoluteLinkURL().string(); > // URL always display as LTR. >- toolTipDirection = LTR; >+ toolTipDirection = TextDirection::LTR; > } > } > >@@ -389,7 +389,7 @@ void Chrome::setToolTip(const HitTestRes > // implementations don't use text direction information for > // ChromeClient::setToolTip. We'll work on tooltip text > // direction during bidi cleanup in form inputs. >- toolTipDirection = LTR; >+ toolTipDirection = TextDirection::LTR; > } > } > } >Index: Source/WebCore/page/FrameView.cpp >=================================================================== >--- Source/WebCore/page/FrameView.cpp (revision 234619) >+++ Source/WebCore/page/FrameView.cpp (working copy) >@@ -162,7 +162,7 @@ Pagination::Mode paginationModeForRender > // is horizontal, then we use TextDirection to choose between those options. If the WritingMode > // is vertical, then the direction of the verticality dictates the choice. > if (overflow == Overflow::PagedX) { >- if ((isHorizontalWritingMode && textDirection == LTR) || writingMode == LeftToRightWritingMode) >+ if ((isHorizontalWritingMode && textDirection == TextDirection::LTR) || writingMode == LeftToRightWritingMode) > return Pagination::LeftToRightPaginated; > return Pagination::RightToLeftPaginated; > } >@@ -170,7 +170,7 @@ Pagination::Mode paginationModeForRender > // paged-y always corresponds to TopToBottomPaginated or BottomToTopPaginated. If the WritingMode > // is horizontal, then the direction of the horizontality dictates the choice. If the WritingMode > // is vertical, then we use TextDirection to choose between those options. >- if (writingMode == TopToBottomWritingMode || (!isHorizontalWritingMode && textDirection == RTL)) >+ if (writingMode == TopToBottomWritingMode || (!isHorizontalWritingMode && textDirection == TextDirection::RTL)) > return Pagination::TopToBottomPaginated; > return Pagination::BottomToTopPaginated; > } >Index: Source/WebCore/page/Settings.yaml >=================================================================== >--- Source/WebCore/page/Settings.yaml (revision 234618) >+++ Source/WebCore/page/Settings.yaml (working copy) >@@ -508,7 +508,7 @@ userInterfaceDirectionPolicy: > initial: UserInterfaceDirectionPolicy::Content > systemLayoutDirection: > type: TextDirection >- initial: LTR >+ initial: TextDirection::LTR > > allowContentSecurityPolicySourceStarToMatchAnyProtocol: > initial: false >Index: Source/WebCore/platform/RectEdges.h >=================================================================== >--- Source/WebCore/platform/RectEdges.h (revision 234618) >+++ Source/WebCore/platform/RectEdges.h (working copy) >@@ -59,18 +59,18 @@ public: > > T& before(WritingMode writingMode) { return at(mapLogicalSideToPhysicalSide(writingMode, LogicalBoxSide::Before)); } > T& after(WritingMode writingMode) { return at(mapLogicalSideToPhysicalSide(writingMode, LogicalBoxSide::After)); } >- T& start(WritingMode writingMode, TextDirection direction = LTR) { return at(mapLogicalSideToPhysicalSide(makeTextFlow(writingMode, direction), LogicalBoxSide::Start)); } >- T& end(WritingMode writingMode, TextDirection direction = LTR) { return at(mapLogicalSideToPhysicalSide(makeTextFlow(writingMode, direction), LogicalBoxSide::End)); } >+ T& start(WritingMode writingMode, TextDirection direction = TextDirection::LTR) { return at(mapLogicalSideToPhysicalSide(makeTextFlow(writingMode, direction), LogicalBoxSide::Start)); } >+ T& end(WritingMode writingMode, TextDirection direction = TextDirection::LTR) { return at(mapLogicalSideToPhysicalSide(makeTextFlow(writingMode, direction), LogicalBoxSide::End)); } > > const T& before(WritingMode writingMode) const { return at(mapLogicalSideToPhysicalSide(writingMode, LogicalBoxSide::Before)); } > const T& after(WritingMode writingMode) const { return at(mapLogicalSideToPhysicalSide(writingMode, LogicalBoxSide::After)); } >- const T& start(WritingMode writingMode, TextDirection direction = LTR) const { return at(mapLogicalSideToPhysicalSide(makeTextFlow(writingMode, direction), LogicalBoxSide::Start)); } >- const T& end(WritingMode writingMode, TextDirection direction = LTR) const { return at(mapLogicalSideToPhysicalSide(makeTextFlow(writingMode, direction), LogicalBoxSide::End)); } >+ const T& start(WritingMode writingMode, TextDirection direction = TextDirection::LTR) const { return at(mapLogicalSideToPhysicalSide(makeTextFlow(writingMode, direction), LogicalBoxSide::Start)); } >+ const T& end(WritingMode writingMode, TextDirection direction = TextDirection::LTR) const { return at(mapLogicalSideToPhysicalSide(makeTextFlow(writingMode, direction), LogicalBoxSide::End)); } > > void setBefore(const T& before, WritingMode writingMode) { this->before(writingMode) = before; } > void setAfter(const T& after, WritingMode writingMode) { this->after(writingMode) = after; } >- void setStart(const T& start, WritingMode writingMode, TextDirection direction = LTR) { this->start(writingMode, direction) = start; } >- void setEnd(const T& end, WritingMode writingMode, TextDirection direction = LTR) { this->end(writingMode, direction) = end; } >+ void setStart(const T& start, WritingMode writingMode, TextDirection direction = TextDirection::LTR) { this->start(writingMode, direction) = start; } >+ void setEnd(const T& end, WritingMode writingMode, TextDirection direction = TextDirection::LTR) { this->end(writingMode, direction) = end; } > > bool operator==(const RectEdges& other) const { return m_sides == other.m_sides; } > bool operator!=(const RectEdges& other) const { return m_sides != other.m_sides; } >Index: Source/WebCore/platform/UserInterfaceLayoutDirection.h >=================================================================== >--- Source/WebCore/platform/UserInterfaceLayoutDirection.h (revision 234618) >+++ Source/WebCore/platform/UserInterfaceLayoutDirection.h (working copy) >@@ -23,13 +23,10 @@ > * THE POSSIBILITY OF SUCH DAMAGE. > */ > >-#ifndef UserInterfaceLayoutDirection_h >-#define UserInterfaceLayoutDirection_h >+#pragma once > > namespace WebCore { > >-enum class UserInterfaceLayoutDirection { LTR, RTL }; >+enum class UserInterfaceLayoutDirection : uint8_t { LTR, RTL }; > > } // namespace WebCore >- >-#endif // UserInterfaceLayoutDirection_h >Index: Source/WebCore/platform/graphics/ComplexTextController.cpp >=================================================================== >--- Source/WebCore/platform/graphics/ComplexTextController.cpp (revision 234618) >+++ Source/WebCore/platform/graphics/ComplexTextController.cpp (working copy) >@@ -128,7 +128,7 @@ void ComplexTextController::computeExpan > if (!m_expansion) > m_expansionPerOpportunity = 0; > else { >- unsigned expansionOpportunityCount = FontCascade::expansionOpportunityCount(m_run.text(), m_run.ltr() ? LTR : RTL, m_run.expansionBehavior()).first; >+ unsigned expansionOpportunityCount = FontCascade::expansionOpportunityCount(m_run.text(), m_run.ltr() ? TextDirection::LTR : TextDirection::RTL, m_run.expansionBehavior()).first; > > if (!expansionOpportunityCount) > m_expansionPerOpportunity = 0; >Index: Source/WebCore/platform/graphics/FontCascade.cpp >=================================================================== >--- Source/WebCore/platform/graphics/FontCascade.cpp (revision 234618) >+++ Source/WebCore/platform/graphics/FontCascade.cpp (working copy) >@@ -1074,7 +1074,7 @@ std::pair<unsigned, bool> FontCascade::e > ++count; > isAfterExpansion = true; > } >- if (direction == LTR) { >+ if (direction == TextDirection::LTR) { > for (unsigned i = 0; i < length; ++i) { > if (treatAsSpace(characters[i])) { > count++; >@@ -1111,7 +1111,7 @@ std::pair<unsigned, bool> FontCascade::e > ++count; > isAfterExpansion = true; > } >- if (direction == LTR) { >+ if (direction == TextDirection::LTR) { > for (unsigned i = 0; i < length; ++i) { > UChar32 character = characters[i]; > if (treatAsSpace(character)) { >@@ -1182,7 +1182,7 @@ bool FontCascade::leadingExpansionOpport > return false; > > UChar32 initialCharacter; >- if (direction == LTR) { >+ if (direction == TextDirection::LTR) { > initialCharacter = stringView[0]; > if (U16_IS_LEAD(initialCharacter) && stringView.length() > 1 && U16_IS_TRAIL(stringView[1])) > initialCharacter = U16_GET_SUPPLEMENTARY(initialCharacter, stringView[1]); >@@ -1201,7 +1201,7 @@ bool FontCascade::trailingExpansionOppor > return false; > > UChar32 finalCharacter; >- if (direction == LTR) { >+ if (direction == TextDirection::LTR) { > finalCharacter = stringView[stringView.length() - 1]; > if (U16_IS_TRAIL(finalCharacter) && stringView.length() > 1 && U16_IS_LEAD(stringView[stringView.length() - 2])) > finalCharacter = U16_GET_SUPPLEMENTARY(stringView[stringView.length() - 2], finalCharacter); >Index: Source/WebCore/platform/graphics/GraphicsContext.cpp >=================================================================== >--- Source/WebCore/platform/graphics/GraphicsContext.cpp (revision 234618) >+++ Source/WebCore/platform/graphics/GraphicsContext.cpp (working copy) >@@ -683,7 +683,7 @@ void GraphicsContext::drawBidiText(const > while (bidiRun) { > TextRun subrun = run.subRun(bidiRun->start(), bidiRun->stop() - bidiRun->start()); > bool isRTL = bidiRun->level() % 2; >- subrun.setDirection(isRTL ? RTL : LTR); >+ subrun.setDirection(isRTL ? TextDirection::RTL : TextDirection::LTR); > subrun.setDirectionalOverride(bidiRun->dirOverride(false)); > > float width = font.drawText(*this, subrun, currPoint, 0, std::nullopt, customFontNotReadyAction); >Index: Source/WebCore/platform/graphics/TextRun.h >=================================================================== >--- Source/WebCore/platform/graphics/TextRun.h (revision 234618) >+++ Source/WebCore/platform/graphics/TextRun.h (working copy) >@@ -44,7 +44,7 @@ struct WidthIterator; > class TextRun { > WTF_MAKE_FAST_ALLOCATED; > public: >- explicit TextRun(const String& text, float xpos = 0, float expansion = 0, ExpansionBehavior expansionBehavior = DefaultExpansion, TextDirection direction = LTR, bool directionalOverride = false, bool characterScanForCodePath = true) >+ explicit TextRun(const String& text, float xpos = 0, float expansion = 0, ExpansionBehavior expansionBehavior = DefaultExpansion, TextDirection direction = TextDirection::LTR, bool directionalOverride = false, bool characterScanForCodePath = true) > : m_text(text) > , m_tabSize(0) > , m_xpos(xpos) >@@ -52,14 +52,14 @@ public: > , m_expansion(expansion) > , m_expansionBehavior(expansionBehavior) > , m_allowTabs(false) >- , m_direction(direction) >+ , m_direction(static_cast<unsigned>(direction)) > , m_directionalOverride(directionalOverride) > , m_characterScanForCodePath(characterScanForCodePath) > , m_disableSpacing(false) > { > } > >- explicit TextRun(StringView stringView, float xpos = 0, float expansion = 0, ExpansionBehavior expansionBehavior = DefaultExpansion, TextDirection direction = LTR, bool directionalOverride = false, bool characterScanForCodePath = true) >+ explicit TextRun(StringView stringView, float xpos = 0, float expansion = 0, ExpansionBehavior expansionBehavior = DefaultExpansion, TextDirection direction = TextDirection::LTR, bool directionalOverride = false, bool characterScanForCodePath = true) > : TextRun(stringView.toStringWithoutCopying(), xpos, expansion, expansionBehavior, direction, directionalOverride, characterScanForCodePath) > { > } >@@ -103,14 +103,14 @@ public: > float expansion() const { return m_expansion; } > ExpansionBehavior expansionBehavior() const { return m_expansionBehavior; } > TextDirection direction() const { return static_cast<TextDirection>(m_direction); } >- bool rtl() const { return m_direction == RTL; } >- bool ltr() const { return m_direction == LTR; } >+ bool rtl() const { return static_cast<TextDirection>(m_direction) == TextDirection::RTL; } >+ bool ltr() const { return static_cast<TextDirection>(m_direction) == TextDirection::LTR; } > bool directionalOverride() const { return m_directionalOverride; } > bool characterScanForCodePath() const { return m_characterScanForCodePath; } > bool spacingDisabled() const { return m_disableSpacing; } > > void disableSpacing() { m_disableSpacing = true; } >- void setDirection(TextDirection direction) { m_direction = direction; } >+ void setDirection(TextDirection direction) { m_direction = static_cast<unsigned>(direction); } > void setDirectionalOverride(bool override) { m_directionalOverride = override; } > void setCharacterScanForCodePath(bool scan) { m_characterScanForCodePath = scan; } > StringView text() const { return m_text; } >Index: Source/WebCore/platform/graphics/WidthIterator.cpp >=================================================================== >--- Source/WebCore/platform/graphics/WidthIterator.cpp (revision 234618) >+++ Source/WebCore/platform/graphics/WidthIterator.cpp (working copy) >@@ -53,7 +53,7 @@ WidthIterator::WidthIterator(const FontC > if (!m_expansion) > m_expansionPerOpportunity = 0; > else { >- unsigned expansionOpportunityCount = FontCascade::expansionOpportunityCount(m_run.text(), m_run.ltr() ? LTR : RTL, run.expansionBehavior()).first; >+ unsigned expansionOpportunityCount = FontCascade::expansionOpportunityCount(m_run.text(), m_run.ltr() ? TextDirection::LTR : TextDirection::RTL, run.expansionBehavior()).first; > > if (!expansionOpportunityCount) > m_expansionPerOpportunity = 0; >Index: Source/WebCore/platform/ios/SelectionRect.cpp >=================================================================== >--- Source/WebCore/platform/ios/SelectionRect.cpp (revision 234618) >+++ Source/WebCore/platform/ios/SelectionRect.cpp (working copy) >@@ -32,7 +32,7 @@ namespace WebCore { > > SelectionRect::SelectionRect(const IntRect& rect, bool isHorizontal, int pageNumber) > : m_rect(rect) >- , m_direction(LTR) >+ , m_direction(TextDirection::LTR) > , m_minX(0) > , m_maxX(0) > , m_maxY(0) >@@ -72,7 +72,7 @@ SelectionRect::SelectionRect(const IntRe > } > > SelectionRect::SelectionRect() >- : m_direction(LTR) >+ : m_direction(TextDirection::LTR) > , m_minX(0) > , m_maxX(0) > , m_maxY(0) >Index: Source/WebCore/platform/text/BidiResolver.h >=================================================================== >--- Source/WebCore/platform/text/BidiResolver.h (revision 234618) >+++ Source/WebCore/platform/text/BidiResolver.h (working copy) >@@ -86,10 +86,10 @@ struct BidiStatus { > // Creates a BidiStatus representing a new paragraph root with a default direction. > // Uses TextDirection as it only has two possibilities instead of UCharDirection which has at least 19. > BidiStatus(TextDirection direction, bool isOverride) >- : eor(direction == LTR ? U_LEFT_TO_RIGHT : U_RIGHT_TO_LEFT) >+ : eor(direction == TextDirection::LTR ? U_LEFT_TO_RIGHT : U_RIGHT_TO_LEFT) > , lastStrong(eor) > , last(eor) >- , context(BidiContext::create(direction == LTR ? 0 : 1, eor, isOverride)) >+ , context(BidiContext::create(direction == TextDirection::LTR ? 0 : 1, eor, isOverride)) > { > } > >Index: Source/WebCore/platform/text/StringWithDirection.h >=================================================================== >--- Source/WebCore/platform/text/StringWithDirection.h (revision 234618) >+++ Source/WebCore/platform/text/StringWithDirection.h (working copy) >@@ -47,7 +47,7 @@ namespace WebCore { > > struct StringWithDirection { > String string; >- TextDirection direction { LTR }; >+ TextDirection direction { TextDirection::LTR }; > }; > > inline bool operator==(const StringWithDirection& a, const StringWithDirection& b) >Index: Source/WebCore/platform/text/WritingMode.h >=================================================================== >--- Source/WebCore/platform/text/WritingMode.h (revision 234618) >+++ Source/WebCore/platform/text/WritingMode.h (working copy) >@@ -33,11 +33,11 @@ > > namespace WebCore { > >-enum TextDirection { LTR, RTL }; >+enum class TextDirection : uint8_t { LTR, RTL }; > > inline bool isLeftToRightDirection(TextDirection direction) > { >- return direction == LTR; >+ return direction == TextDirection::LTR; > } > > enum WritingMode { >@@ -47,19 +47,19 @@ enum WritingMode { > RightToLeftWritingMode = 3, // vertical-rl > }; > >-#define MAKE_TEXT_FLOW(writingMode, direction) ((writingMode) << 1 | (direction)) >+#define MAKE_TEXT_FLOW(writingMode, direction) ((writingMode) << 1 | static_cast<unsigned>(direction)) > > // Define the text flow in terms of the writing mode and the text direction. The first > // part is the line growing direction and the second part is the block growing direction. > enum TextFlow { >- InlineEastBlockSouth = MAKE_TEXT_FLOW(TopToBottomWritingMode, LTR), >- InlineWestBlockSouth = MAKE_TEXT_FLOW(TopToBottomWritingMode, RTL), >- InlineEastBlockNorth = MAKE_TEXT_FLOW(BottomToTopWritingMode, LTR), >- InlineWestBlockNorth = MAKE_TEXT_FLOW(BottomToTopWritingMode, RTL), >- InlineSouthBlockEast = MAKE_TEXT_FLOW(LeftToRightWritingMode, LTR), >- InlineSouthBlockWest = MAKE_TEXT_FLOW(LeftToRightWritingMode, RTL), >- InlineNorthBlockEast = MAKE_TEXT_FLOW(RightToLeftWritingMode, LTR), >- InlineNorthBlockWest = MAKE_TEXT_FLOW(RightToLeftWritingMode, RTL) >+ InlineEastBlockSouth = MAKE_TEXT_FLOW(TopToBottomWritingMode, TextDirection::LTR), >+ InlineWestBlockSouth = MAKE_TEXT_FLOW(TopToBottomWritingMode, TextDirection::RTL), >+ InlineEastBlockNorth = MAKE_TEXT_FLOW(BottomToTopWritingMode, TextDirection::LTR), >+ InlineWestBlockNorth = MAKE_TEXT_FLOW(BottomToTopWritingMode, TextDirection::RTL), >+ InlineSouthBlockEast = MAKE_TEXT_FLOW(LeftToRightWritingMode, TextDirection::LTR), >+ InlineSouthBlockWest = MAKE_TEXT_FLOW(LeftToRightWritingMode, TextDirection::RTL), >+ InlineNorthBlockEast = MAKE_TEXT_FLOW(RightToLeftWritingMode, TextDirection::LTR), >+ InlineNorthBlockWest = MAKE_TEXT_FLOW(RightToLeftWritingMode, TextDirection::RTL) > }; > > inline TextFlow makeTextFlow(WritingMode writingMode, TextDirection direction) >@@ -91,13 +91,13 @@ inline bool isVerticalTextFlow(TextFlow > // Lines have vertical orientation; modes vertical-lr or vertical-rl. > inline bool isVerticalWritingMode(WritingMode writingMode) > { >- return isVerticalTextFlow(makeTextFlow(writingMode, LTR)); >+ return isVerticalTextFlow(makeTextFlow(writingMode, TextDirection::LTR)); > } > > // Block progression increases in the opposite direction to normal; modes vertical-rl or horizontal-bt. > inline bool isFlippedWritingMode(WritingMode writingMode) > { >- return isFlippedTextFlow(makeTextFlow(writingMode, LTR)); >+ return isFlippedTextFlow(makeTextFlow(writingMode, TextDirection::LTR)); > } > > // Lines have horizontal orientation; modes horizontal-tb or horizontal-bt. >@@ -161,7 +161,7 @@ inline PhysicalBoxSide mapLogicalSideToP > inline PhysicalBoxSide mapLogicalSideToPhysicalSide(WritingMode writingMode, LogicalBoxSide logicalSide) > { > // Set the direction such that side is mirrored if isFlippedWritingMode() is true >- TextDirection direction = isFlippedWritingMode(writingMode) ? RTL : LTR; >+ TextDirection direction = isFlippedWritingMode(writingMode) ? TextDirection::RTL : TextDirection::LTR; > return mapLogicalSideToPhysicalSide(makeTextFlow(writingMode, direction), logicalSide); > } > >Index: Source/WebCore/platform/win/PopupMenuWin.cpp >=================================================================== >--- Source/WebCore/platform/win/PopupMenuWin.cpp (revision 234618) >+++ Source/WebCore/platform/win/PopupMenuWin.cpp (working copy) >@@ -657,7 +657,7 @@ void PopupMenuWin::paint(const IntRect& > // Draw the item text > if (itemStyle.isVisible()) { > int textX = 0; >- if (client()->menuStyle().textDirection() == LTR) { >+ if (client()->menuStyle().textDirection() == TextDirection::LTR) { > textX = std::max<int>(0, client()->clientPaddingLeft() - client()->clientInsetLeft()); > if (RenderTheme::singleton().popupOptionSupportsTextIndent()) > textX += minimumIntValueForLength(itemStyle.textIndent(), itemRect.width()); >Index: Source/WebCore/rendering/HitTestResult.cpp >=================================================================== >--- Source/WebCore/rendering/HitTestResult.cpp (revision 234618) >+++ Source/WebCore/rendering/HitTestResult.cpp (working copy) >@@ -220,7 +220,7 @@ String HitTestResult::selectedText() con > > String HitTestResult::spellingToolTip(TextDirection& dir) const > { >- dir = LTR; >+ dir = TextDirection::LTR; > // Return the tool tip string associated with this point, if any. Only markers associated with bad grammar > // currently supply strings, but maybe someday markers associated with misspelled words will also. > if (!m_innerNonSharedNode) >@@ -251,7 +251,7 @@ String HitTestResult::replacedString() c > > String HitTestResult::title(TextDirection& dir) const > { >- dir = LTR; >+ dir = TextDirection::LTR; > // Find the title in the nearest enclosing DOM node. > // For <area> tags in image maps, walk the tree for the <area>, not the <img> using it. > for (Node* titleNode = m_innerNode.get(); titleNode; titleNode = titleNode->parentInComposedTree()) { >@@ -290,7 +290,7 @@ String HitTestResult::innerTextIfTruncat > } > } > >- dir = LTR; >+ dir = TextDirection::LTR; > return String(); > } > >Index: Source/WebCore/rendering/InlineBox.h >=================================================================== >--- Source/WebCore/rendering/InlineBox.h (revision 234618) >+++ Source/WebCore/rendering/InlineBox.h (working copy) >@@ -218,8 +218,8 @@ public: > > unsigned char bidiLevel() const { return m_bitfields.bidiEmbeddingLevel(); } > void setBidiLevel(unsigned char level) { m_bitfields.setBidiEmbeddingLevel(level); } >- TextDirection direction() const { return bidiLevel() % 2 ? RTL : LTR; } >- bool isLeftToRightDirection() const { return direction() == LTR; } >+ TextDirection direction() const { return bidiLevel() % 2 ? TextDirection::RTL : TextDirection::LTR; } >+ bool isLeftToRightDirection() const { return direction() == TextDirection::LTR; } > int caretLeftmostOffset() const { return isLeftToRightDirection() ? caretMinOffset() : caretMaxOffset(); } > int caretRightmostOffset() const { return isLeftToRightDirection() ? caretMaxOffset() : caretMinOffset(); } > >Index: Source/WebCore/rendering/InlineFlowBox.cpp >=================================================================== >--- Source/WebCore/rendering/InlineFlowBox.cpp (revision 234619) >+++ Source/WebCore/rendering/InlineFlowBox.cpp (working copy) >@@ -1251,7 +1251,7 @@ void InlineFlowBox::paintFillLayer(const > // the previous line left off. > LayoutUnit logicalOffsetOnLine = 0; > LayoutUnit totalLogicalWidth; >- if (renderer().style().direction() == LTR) { >+ if (renderer().style().direction() == TextDirection::LTR) { > for (InlineFlowBox* curr = prevLineBox(); curr; curr = curr->prevLineBox()) > logicalOffsetOnLine += curr->logicalWidth(); > totalLogicalWidth = logicalOffsetOnLine; >Index: Source/WebCore/rendering/InlineIterator.h >=================================================================== >--- Source/WebCore/rendering/InlineIterator.h (revision 234618) >+++ Source/WebCore/rendering/InlineIterator.h (working copy) >@@ -142,8 +142,8 @@ inline bool operator!=(const InlineItera > static inline UCharDirection embedCharFromDirection(TextDirection direction, EUnicodeBidi unicodeBidi) > { > if (unicodeBidi == Embed) >- return direction == RTL ? U_RIGHT_TO_LEFT_EMBEDDING : U_LEFT_TO_RIGHT_EMBEDDING; >- return direction == RTL ? U_RIGHT_TO_LEFT_OVERRIDE : U_LEFT_TO_RIGHT_OVERRIDE; >+ return direction == TextDirection::RTL ? U_RIGHT_TO_LEFT_EMBEDDING : U_LEFT_TO_RIGHT_EMBEDDING; >+ return direction == TextDirection::RTL ? U_RIGHT_TO_LEFT_OVERRIDE : U_LEFT_TO_RIGHT_OVERRIDE; > } > > template <class Observer> >Index: Source/WebCore/rendering/InlineTextBox.cpp >=================================================================== >--- Source/WebCore/rendering/InlineTextBox.cpp (revision 234619) >+++ Source/WebCore/rendering/InlineTextBox.cpp (working copy) >@@ -593,7 +593,7 @@ void InlineTextBox::paint(PaintInfo& pai > if (!isHorizontal()) { > textDecorationSelectionClipOutRect.move(0, logicalWidthBeforeRange); > textDecorationSelectionClipOutRect.setHeight(logicalSelectionWidth); >- } else if (direction() == RTL) { >+ } else if (direction() == TextDirection::RTL) { > textDecorationSelectionClipOutRect.move(logicalWidthAfterRange, 0); > textDecorationSelectionClipOutRect.setWidth(logicalSelectionWidth); > } else { >@@ -1139,7 +1139,7 @@ void InlineTextBox::paintCompositionUnde > > static inline void mirrorRTLSegment(float logicalWidth, TextDirection direction, float& start, float width) > { >- if (direction == LTR) >+ if (direction == TextDirection::LTR) > return; > start = logicalWidth - width - start; > } >Index: Source/WebCore/rendering/RenderBlock.cpp >=================================================================== >--- Source/WebCore/rendering/RenderBlock.cpp (revision 234619) >+++ Source/WebCore/rendering/RenderBlock.cpp (working copy) >@@ -3095,7 +3095,7 @@ const char* RenderBlock::renderName() co > > TextRun RenderBlock::constructTextRun(StringView stringView, const RenderStyle& style, ExpansionBehavior expansion, TextRunFlags flags) > { >- TextDirection textDirection = LTR; >+ auto textDirection = TextDirection::LTR; > bool directionalOverride = style.rtlOrdering() == Order::Visual; > if (flags != DefaultTextRunFlags) { > if (flags & RespectDirection) >Index: Source/WebCore/rendering/RenderBlockLineLayout.cpp >=================================================================== >--- Source/WebCore/rendering/RenderBlockLineLayout.cpp (revision 234618) >+++ Source/WebCore/rendering/RenderBlockLineLayout.cpp (working copy) >@@ -60,11 +60,11 @@ static void determineDirectionality(Text > if (UChar current = iter.current()) { > UCharDirection charDirection = u_charDirection(current); > if (charDirection == U_LEFT_TO_RIGHT) { >- dir = LTR; >+ dir = TextDirection::LTR; > return; > } > if (charDirection == U_RIGHT_TO_LEFT || charDirection == U_RIGHT_TO_LEFT_ARABIC) { >- dir = RTL; >+ dir = TextDirection::RTL; > return; > } > } >@@ -348,7 +348,7 @@ TextAlignMode RenderBlockFlow::textAlign > #if ENABLE(CSS3_TEXT) > TextJustify textJustify = style().textJustify(); > if (alignment == TextAlignMode::Justify && textJustify == TextJustify::None) >- return style().direction() == LTR ? TextAlignMode::Left : TextAlignMode::Right; >+ return style().direction() == TextDirection::LTR ? TextAlignMode::Left : TextAlignMode::Right; > #endif > > if (endsWithSoftBreak) >@@ -650,13 +650,13 @@ void RenderBlockFlow::updateLogicalWidth > } > FALLTHROUGH; > case TextAlignMode::Start: >- if (direction == LTR) >+ if (direction == TextDirection::LTR) > updateLogicalWidthForLeftAlignedBlock(style().isLeftToRightDirection(), trailingSpaceRun, logicalLeft, totalLogicalWidth, availableLogicalWidth); > else > updateLogicalWidthForRightAlignedBlock(style().isLeftToRightDirection(), trailingSpaceRun, logicalLeft, totalLogicalWidth, availableLogicalWidth); > break; > case TextAlignMode::End: >- if (direction == LTR) >+ if (direction == TextDirection::LTR) > updateLogicalWidthForRightAlignedBlock(style().isLeftToRightDirection(), trailingSpaceRun, logicalLeft, totalLogicalWidth, availableLogicalWidth); > else > updateLogicalWidthForLeftAlignedBlock(style().isLeftToRightDirection(), trailingSpaceRun, logicalLeft, totalLogicalWidth, availableLogicalWidth); >@@ -1061,7 +1061,7 @@ inline BidiRun* RenderBlockFlow::handleT > return nullptr; > > TextDirection direction = style().direction(); >- bool shouldReorder = trailingSpaceRun != (direction == LTR ? bidiRuns.lastRun() : bidiRuns.firstRun()); >+ bool shouldReorder = trailingSpaceRun != (direction == TextDirection::LTR ? bidiRuns.lastRun() : bidiRuns.firstRun()); > if (firstSpace != trailingSpaceRun->start()) { > BidiContext* baseContext = currentContext; > while (BidiContext* parent = baseContext->parent()) >@@ -1070,7 +1070,7 @@ inline BidiRun* RenderBlockFlow::handleT > std::unique_ptr<BidiRun> newTrailingRun = std::make_unique<BidiRun>(firstSpace, trailingSpaceRun->m_stop, trailingSpaceRun->renderer(), baseContext, U_OTHER_NEUTRAL); > trailingSpaceRun->m_stop = firstSpace; > trailingSpaceRun = newTrailingRun.get(); >- if (direction == LTR) >+ if (direction == TextDirection::LTR) > bidiRuns.appendRun(WTFMove(newTrailingRun)); > else > bidiRuns.prependRun(WTFMove(newTrailingRun)); >@@ -1079,7 +1079,7 @@ inline BidiRun* RenderBlockFlow::handleT > if (!shouldReorder) > return trailingSpaceRun; > >- if (direction == LTR) { >+ if (direction == TextDirection::LTR) { > bidiRuns.moveRunToEnd(trailingSpaceRun); > trailingSpaceRun->m_level = 0; > } else { >@@ -1378,7 +1378,7 @@ void RenderBlockFlow::layoutRunsAndFloat > if (lastRootBox()) > lastRootBox()->setLineBreakInfo(end.renderer(), end.offset(), resolver.status()); > } else { >- VisualDirectionOverride override = (styleToUse.rtlOrdering() == Order::Visual ? (styleToUse.direction() == LTR ? VisualLeftToRightOverride : VisualRightToLeftOverride) : NoVisualOverride); >+ VisualDirectionOverride override = (styleToUse.rtlOrdering() == Order::Visual ? (styleToUse.direction() == TextDirection::LTR ? VisualLeftToRightOverride : VisualRightToLeftOverride) : NoVisualOverride); > > if (isNewUBAParagraph && styleToUse.unicodeBidi() == Plaintext && !resolver.context()->parent()) { > TextDirection direction = styleToUse.direction(); >Index: Source/WebCore/rendering/RenderBox.cpp >=================================================================== >--- Source/WebCore/rendering/RenderBox.cpp (revision 234619) >+++ Source/WebCore/rendering/RenderBox.cpp (working copy) >@@ -3330,7 +3330,7 @@ static void computeInlineStaticDistance( > // both "left" and "right" properties are "auto", we can consider that one of > // them (depending on the direction) is simply "0". > if (parent->isRenderGrid() && parent == child->containingBlock()) { >- if (parentDirection == LTR) >+ if (parentDirection == TextDirection::LTR) > logicalLeft.setValue(Fixed, 0); > else > logicalRight.setValue(Fixed, 0); >@@ -3338,7 +3338,7 @@ static void computeInlineStaticDistance( > } > > // FIXME: The static distance computation has not been patched for mixed writing modes yet. >- if (parentDirection == LTR) { >+ if (parentDirection == TextDirection::LTR) { > LayoutUnit staticPosition = child->layer()->staticInlinePosition() - containerBlock.borderLogicalLeft(); > for (auto* current = parent; current && current != &containerBlock; current = current->container()) { > if (!is<RenderBox>(*current)) >@@ -3597,7 +3597,7 @@ void RenderBox::computePositionedLogical > } else { > // Use the containing block's direction rather than the parent block's > // per CSS 2.1 reference test abspos-non-replaced-width-margin-000. >- if (containerDirection == LTR) { >+ if (containerDirection == TextDirection::LTR) { > marginLogicalLeftValue = 0; > marginLogicalRightValue = availableSpace; // will be negative > } else { >@@ -3620,7 +3620,7 @@ void RenderBox::computePositionedLogical > > // Use the containing block's direction rather than the parent block's > // per CSS 2.1 reference test abspos-non-replaced-width-margin-000. >- if (containerDirection == RTL) >+ if (containerDirection == TextDirection::RTL) > logicalLeftValue = (availableSpace + logicalLeftValue) - marginLogicalLeftValue - marginLogicalRightValue; > } > } else { >@@ -4095,7 +4095,7 @@ void RenderBox::computePositionedLogical > } else { > // Use the containing block's direction rather than the parent block's > // per CSS 2.1 reference test abspos-replaced-width-margin-000. >- if (containerDirection == LTR) { >+ if (containerDirection == TextDirection::LTR) { > marginLogicalLeftAlias = 0; > marginLogicalRightAlias = difference; // will be negative > } else { >@@ -4143,7 +4143,7 @@ void RenderBox::computePositionedLogical > logicalRightValue = valueForLength(logicalRight, containerLogicalWidth); > logicalLeftValue = valueForLength(logicalLeft, containerLogicalWidth); > // If the containing block is right-to-left, then push the left position as far to the right as possible >- if (containerDirection == RTL) { >+ if (containerDirection == TextDirection::RTL) { > int totalLogicalWidth = computedValues.m_extent + logicalLeftValue + logicalRightValue + marginLogicalLeftAlias + marginLogicalRightAlias; > logicalLeftValue = containerLogicalWidth - (totalLogicalWidth - logicalLeftValue); > } >Index: Source/WebCore/rendering/RenderDeprecatedFlexibleBox.cpp >=================================================================== >--- Source/WebCore/rendering/RenderDeprecatedFlexibleBox.cpp (revision 234618) >+++ Source/WebCore/rendering/RenderDeprecatedFlexibleBox.cpp (working copy) >@@ -976,7 +976,7 @@ void RenderDeprecatedFlexibleBox::applyL > child->layoutIfNeeded(); > > // FIXME: For now don't support RTL. >- if (style().direction() != LTR) >+ if (style().direction() != TextDirection::LTR) > continue; > > // Get the last line >Index: Source/WebCore/rendering/RenderFragmentedFlow.cpp >=================================================================== >--- Source/WebCore/rendering/RenderFragmentedFlow.cpp (revision 234618) >+++ Source/WebCore/rendering/RenderFragmentedFlow.cpp (working copy) >@@ -168,7 +168,7 @@ void RenderFragmentedFlow::updateLogical > // If the fragments have non-uniform logical widths, then insert inset information for the RenderFragmentedFlow. > for (auto& fragment : m_fragmentList) { > LayoutUnit fragmentLogicalWidth = fragment->pageLogicalWidth(); >- LayoutUnit logicalLeft = style().direction() == LTR ? LayoutUnit() : logicalWidth - fragmentLogicalWidth; >+ LayoutUnit logicalLeft = style().direction() == TextDirection::LTR ? LayoutUnit() : logicalWidth - fragmentLogicalWidth; > fragment->setRenderBoxFragmentInfo(this, logicalLeft, fragmentLogicalWidth, false); > } > } >@@ -787,7 +787,7 @@ void RenderFragmentedFlow::updateFragmen > LayoutUnit fragmentLogicalWidth = fragment->pageLogicalWidth(); > LayoutUnit fragmentLogicalHeight = std::min<LayoutUnit>(RenderFragmentedFlow::maxLogicalHeight() - logicalHeight, fragment->logicalHeightOfAllFragmentedFlowContent()); > >- LayoutRect fragmentRect(style().direction() == LTR ? LayoutUnit() : logicalWidth() - fragmentLogicalWidth, logicalHeight, fragmentLogicalWidth, fragmentLogicalHeight); >+ LayoutRect fragmentRect(style().direction() == TextDirection::LTR ? LayoutUnit() : logicalWidth() - fragmentLogicalWidth, logicalHeight, fragmentLogicalWidth, fragmentLogicalHeight); > > fragment->setFragmentedFlowPortionRect(isHorizontalWritingMode() ? fragmentRect : fragmentRect.transposedRect()); > >Index: Source/WebCore/rendering/RenderLayerModelObject.cpp >=================================================================== >--- Source/WebCore/rendering/RenderLayerModelObject.cpp (revision 234618) >+++ Source/WebCore/rendering/RenderLayerModelObject.cpp (working copy) >@@ -245,7 +245,7 @@ bool RenderLayerModelObject::shouldPlace > case UserInterfaceDirectionPolicy::Content: > return style().shouldPlaceBlockDirectionScrollbarOnLeft(); > case UserInterfaceDirectionPolicy::System: >- return settings().systemLayoutDirection() == RTL; >+ return settings().systemLayoutDirection() == TextDirection::RTL; > } > ASSERT_NOT_REACHED(); > return style().shouldPlaceBlockDirectionScrollbarOnLeft(); >Index: Source/WebCore/rendering/RenderMarquee.cpp >=================================================================== >--- Source/WebCore/rendering/RenderMarquee.cpp (revision 234618) >+++ Source/WebCore/rendering/RenderMarquee.cpp (working copy) >@@ -104,9 +104,9 @@ MarqueeDirection RenderMarquee::directio > if (result == MarqueeDirection::Auto) > result = MarqueeDirection::Backward; > if (result == MarqueeDirection::Forward) >- result = (dir == LTR) ? MarqueeDirection::Right : MarqueeDirection::Left; >+ result = (dir == TextDirection::LTR) ? MarqueeDirection::Right : MarqueeDirection::Left; > if (result == MarqueeDirection::Backward) >- result = (dir == LTR) ? MarqueeDirection::Left : MarqueeDirection::Right; >+ result = (dir == TextDirection::LTR) ? MarqueeDirection::Left : MarqueeDirection::Right; > > // Now we have the real direction. Next we check to see if the increment is negative. > // If so, then we reverse the direction. >Index: Source/WebCore/rendering/RenderMenuList.cpp >=================================================================== >--- Source/WebCore/rendering/RenderMenuList.cpp (revision 234618) >+++ Source/WebCore/rendering/RenderMenuList.cpp (working copy) >@@ -128,15 +128,15 @@ void RenderMenuList::adjustInnerStyle() > // Items in the popup will not respect the CSS text-align and direction properties, > // so we must adjust our own style to match. > innerStyle.setTextAlign(TextAlignMode::Left); >- TextDirection direction = (m_buttonText && m_buttonText->text().defaultWritingDirection() == U_RIGHT_TO_LEFT) ? RTL : LTR; >+ TextDirection direction = (m_buttonText && m_buttonText->text().defaultWritingDirection() == U_RIGHT_TO_LEFT) ? TextDirection::RTL : TextDirection::LTR; > innerStyle.setDirection(direction); > #if PLATFORM(IOS) > } else if (document().page()->chrome().selectItemAlignmentFollowsMenuWritingDirection()) { >- innerStyle.setTextAlign(style().direction() == LTR ? TextAlignMode::Left : TextAlignMode::Right); >+ innerStyle.setTextAlign(style().direction() == TextDirection::LTR ? TextAlignMode::Left : TextAlignMode::Right); > TextDirection direction; > EUnicodeBidi unicodeBidi; > if (multiple() && selectedOptionCount(*this) != 1) { >- direction = (m_buttonText && m_buttonText->text().defaultWritingDirection() == U_RIGHT_TO_LEFT) ? RTL : LTR; >+ direction = (m_buttonText && m_buttonText->text().defaultWritingDirection() == U_RIGHT_TO_LEFT) ? TextDirection::RTL : TextDirection::LTR; > unicodeBidi = UBNormal; > } else if (m_optionStyle) { > direction = m_optionStyle->direction(); >@@ -579,7 +579,7 @@ const int endOfLinePadding = 2; > > LayoutUnit RenderMenuList::clientPaddingLeft() const > { >- if ((style().appearance() == MenulistPart || style().appearance() == MenulistButtonPart) && style().direction() == RTL) { >+ if ((style().appearance() == MenulistPart || style().appearance() == MenulistButtonPart) && style().direction() == TextDirection::RTL) { > // For these appearance values, the theme applies padding to leave room for the > // drop-down button. But leaving room for the button inside the popup menu itself > // looks strange, so we return a small default padding to avoid having a large empty >@@ -593,7 +593,7 @@ LayoutUnit RenderMenuList::clientPadding > > LayoutUnit RenderMenuList::clientPaddingRight() const > { >- if ((style().appearance() == MenulistPart || style().appearance() == MenulistButtonPart) && style().direction() == LTR) >+ if ((style().appearance() == MenulistPart || style().appearance() == MenulistButtonPart) && style().direction() == TextDirection::LTR) > return endOfLinePadding; > > return paddingRight() + m_innerBlock->paddingRight(); >Index: Source/WebCore/rendering/RenderThemeGtk.cpp >=================================================================== >--- Source/WebCore/rendering/RenderThemeGtk.cpp (revision 234618) >+++ Source/WebCore/rendering/RenderThemeGtk.cpp (working copy) >@@ -360,10 +360,10 @@ static GtkStateFlags themePartStateFlags > { > unsigned stateFlags = 0; > switch (renderObject.style().direction()) { >- case RTL: >+ case TextDirection::RTL: > stateFlags |= GTK_STATE_FLAG_DIR_RTL; > break; >- case LTR: >+ case TextDirection::LTR: > stateFlags |= GTK_STATE_FLAG_DIR_LTR; > break; > } >@@ -420,9 +420,9 @@ static GtkStateFlags themePartStateFlags > static GtkTextDirection gtkTextDirection(TextDirection direction) > { > switch (direction) { >- case RTL: >+ case TextDirection::RTL: > return GTK_TEXT_DIR_RTL; >- case LTR: >+ case TextDirection::LTR: > return GTK_TEXT_DIR_LTR; > default: > return GTK_TEXT_DIR_NONE; >@@ -804,8 +804,8 @@ LengthBox RenderThemeGtk::popupInternalP > padding.bottom = comboContentsBox.bottom + boxContentsBox.bottom + buttonContentsBox.bottom + buttonBoxContentsBox.bottom; > > auto arrowSize = comboWidget.arrow().preferredSize(); >- return LengthBox(padding.top, padding.right + (style.direction() == LTR ? arrowSize.width() : 0), >- padding.bottom, padding.left + (style.direction() == RTL ? arrowSize.width() : 0)); >+ return LengthBox(padding.top, padding.right + (style.direction() == TextDirection::LTR ? arrowSize.width() : 0), >+ padding.bottom, padding.left + (style.direction() == TextDirection::RTL ? arrowSize.width() : 0)); > } > > bool RenderThemeGtk::paintMenuList(const RenderObject& renderObject, const PaintInfo& paintInfo, const FloatRect& rect) >@@ -846,8 +846,8 @@ LengthBox RenderThemeGtk::popupInternalP > gtk_style_context_get_style(context.get(), "interior-focus", &interiorFocus, "focus-line-width", &focusWidth, "focus-padding", &focusPad, nullptr); > focusWidth = interiorFocus ? focusWidth + focusPad : 0; > >- return { borderWidth.top + focusWidth, borderWidth.right + focusWidth + (style.direction() == LTR ? minArrowSize : 0), >- borderWidth.bottom + focusWidth, borderWidth.left + focusWidth + (style.direction() == RTL ? minArrowSize : 0) }; >+ return { borderWidth.top + focusWidth, borderWidth.right + focusWidth + (style.direction() == TextDirection::LTR ? minArrowSize : 0), >+ borderWidth.bottom + focusWidth, borderWidth.left + focusWidth + (style.direction() == TextDirection::RTL ? minArrowSize : 0) }; > } > > bool RenderThemeGtk::paintMenuList(const RenderObject& renderObject, const PaintInfo& paintInfo, const FloatRect& r) >@@ -1296,7 +1296,7 @@ bool RenderThemeGtk::paintSliderTrack(co > } > > if (part == SliderHorizontalPart) { >- if (renderObject.style().direction() == RTL) { >+ if (renderObject.style().direction() == TextDirection::RTL) { > contentsRect.move(thumbLocation.x(), 0); > contentsRect.setWidth(contentsRect.width() - thumbLocation.x()); > } else >@@ -1524,7 +1524,7 @@ bool RenderThemeGtk::paintProgressBar(co > #if GTK_CHECK_VERSION(3, 20, 0) > RenderTheme::InnerSpinButtonLayout RenderThemeGtk::innerSpinButtonLayout(const RenderObject& renderObject) const > { >- return renderObject.style().direction() == RTL ? InnerSpinButtonLayout::HorizontalUpLeft : InnerSpinButtonLayout::HorizontalUpRight; >+ return renderObject.style().direction() == TextDirection::RTL ? InnerSpinButtonLayout::HorizontalUpLeft : InnerSpinButtonLayout::HorizontalUpRight; > } > > void RenderThemeGtk::adjustInnerSpinButtonStyle(StyleResolver&, RenderStyle& style, const Element*) const >@@ -1546,12 +1546,12 @@ bool RenderThemeGtk::paintInnerSpinButto > > IntRect iconRect = rect; > iconRect.setWidth(iconRect.width() / 2); >- if (renderObject.style().direction() == RTL) >+ if (renderObject.style().direction() == TextDirection::RTL) > up.render(paintInfo.context().platformContext()->cr(), iconRect); > else > down.render(paintInfo.context().platformContext()->cr(), iconRect); > iconRect.move(iconRect.width(), 0); >- if (renderObject.style().direction() == RTL) >+ if (renderObject.style().direction() == TextDirection::RTL) > down.render(paintInfo.context().platformContext()->cr(), iconRect); > else > up.render(paintInfo.context().platformContext()->cr(), iconRect); >@@ -1985,7 +1985,7 @@ IntRect RenderThemeGtk::calculateProgres > const auto& renderProgress = downcast<RenderProgress>(renderObject); > if (renderProgress.isDeterminate()) { > int progressWidth = progressRect.width() * renderProgress.position(); >- if (renderObject.style().direction() == RTL) >+ if (renderObject.style().direction() == TextDirection::RTL) > progressRect.setX(progressRect.x() + progressRect.width() - progressWidth); > progressRect.setWidth(progressWidth); > return progressRect; >Index: Source/WebCore/rendering/RenderThemeIOS.mm >=================================================================== >--- Source/WebCore/rendering/RenderThemeIOS.mm (revision 234618) >+++ Source/WebCore/rendering/RenderThemeIOS.mm (working copy) >@@ -547,7 +547,7 @@ const float MenuListButtonPaddingAfter = > LengthBox RenderThemeIOS::popupInternalPaddingBox(const RenderStyle& style) const > { > if (style.appearance() == MenulistButtonPart) { >- if (style.direction() == RTL) >+ if (style.direction() == TextDirection::RTL) > return { 0, 0, 0, static_cast<int>(MenuListButtonPaddingAfter + style.borderTopWidth()) }; > return { 0, static_cast<int>(MenuListButtonPaddingAfter + style.borderTopWidth()), 0, 0 }; > } >@@ -648,7 +648,7 @@ void RenderThemeIOS::adjustMenuListButto > bool RenderThemeIOS::paintMenuListButtonDecorations(const RenderBox& box, const PaintInfo& paintInfo, const FloatRect& rect) > { > auto& style = box.style(); >- bool isRTL = style.direction() == RTL; >+ bool isRTL = style.direction() == TextDirection::RTL; > float borderTopWidth = style.borderTopWidth(); > FloatRect clip(rect.x() + style.borderLeftWidth(), rect.y() + style.borderTopWidth(), rect.width() - style.borderLeftWidth() - style.borderRightWidth(), rect.height() - style.borderTopWidth() - style.borderBottomWidth()); > CGContextRef cgContext = paintInfo.context().platformContext(); >Index: Source/WebCore/rendering/RenderThemeMac.mm >=================================================================== >--- Source/WebCore/rendering/RenderThemeMac.mm (revision 234619) >+++ Source/WebCore/rendering/RenderThemeMac.mm (working copy) >@@ -1484,7 +1484,7 @@ void RenderThemeMac::paintMenuListButton > > bool RenderThemeMac::paintMenuListButtonDecorations(const RenderBox& renderer, const PaintInfo& paintInfo, const FloatRect& rect) > { >- bool isRTL = renderer.style().direction() == RTL; >+ bool isRTL = renderer.style().direction() == TextDirection::RTL; > IntRect bounds = IntRect(rect.x() + renderer.style().borderLeftWidth(), > rect.y() + renderer.style().borderTopWidth(), > rect.width() - renderer.style().borderLeftWidth() - renderer.style().borderRightWidth(), >@@ -1593,7 +1593,7 @@ void RenderThemeMac::adjustMenuListStyle > LengthBox RenderThemeMac::popupInternalPaddingBox(const RenderStyle& style) const > { > if (style.appearance() == MenulistPart) { >- const int* padding = popupButtonPadding(controlSizeForFont(style), style.direction() == RTL); >+ const int* padding = popupButtonPadding(controlSizeForFont(style), style.direction() == TextDirection::RTL); > return { static_cast<int>(padding[topPadding] * style.effectiveZoom()), > static_cast<int>(padding[rightPadding] * style.effectiveZoom()), > static_cast<int>(padding[bottomPadding] * style.effectiveZoom()), >@@ -1604,7 +1604,7 @@ LengthBox RenderThemeMac::popupInternalP > float arrowWidth = baseArrowWidth * (style.computedFontPixelSize() / baseFontSize); > float rightPadding = ceilf(arrowWidth + (arrowPaddingBefore + arrowPaddingAfter + paddingBeforeSeparator) * style.effectiveZoom()); > float leftPadding = styledPopupPaddingLeft * style.effectiveZoom(); >- if (style.direction() == RTL) >+ if (style.direction() == TextDirection::RTL) > std::swap(rightPadding, leftPadding); > return { static_cast<int>(styledPopupPaddingTop * style.effectiveZoom()), > static_cast<int>(rightPadding), >@@ -1651,7 +1651,7 @@ void RenderThemeMac::setPopupButtonCellS > // Set the control size based off the rectangle we're painting into. > setControlSize(popupButton, popupButtonSizes(), buttonSize, o.style().effectiveZoom()); > >- popupButton.userInterfaceLayoutDirection = o.style().direction() == LTR ? NSUserInterfaceLayoutDirectionLeftToRight : NSUserInterfaceLayoutDirectionRightToLeft; >+ popupButton.userInterfaceLayoutDirection = o.style().direction() == TextDirection::LTR ? NSUserInterfaceLayoutDirectionLeftToRight : NSUserInterfaceLayoutDirectionRightToLeft; > > // Update the various states we respond to. > updateCheckedState(popupButton, o); >@@ -1932,7 +1932,7 @@ bool RenderThemeMac::paintSearchFieldCan > FloatRect localBounds = adjustedCancelButtonRect([search cancelButtonRectForBounds:NSRect(snappedIntRect(inputBox.contentBoxRect()))]); > // Adjust position based on the content direction. > float adjustedXPosition; >- if (box.style().direction() == RTL) >+ if (box.style().direction() == TextDirection::RTL) > adjustedXPosition = inputBox.contentBoxRect().x(); > else > adjustedXPosition = inputBox.contentBoxRect().maxX() - localBounds.size().width(); >@@ -2068,7 +2068,7 @@ bool RenderThemeMac::paintSearchFieldRes > FloatRect localBounds = adjustedResultButtonRect([search searchButtonRectForBounds:NSRect(snappedIntRect(inputBox.contentBoxRect()))]); > // Adjust position based on the content direction. > float adjustedXPosition; >- if (box.style().direction() == RTL) >+ if (box.style().direction() == TextDirection::RTL) > adjustedXPosition = inputBox.contentBoxRect().maxX() - localBounds.size().width(); > else > adjustedXPosition = inputBox.contentBoxRect().x(); >Index: Source/WebCore/rendering/RenderThemeWin.cpp >=================================================================== >--- Source/WebCore/rendering/RenderThemeWin.cpp (revision 234618) >+++ Source/WebCore/rendering/RenderThemeWin.cpp (working copy) >@@ -758,9 +758,9 @@ void RenderThemeWin::adjustMenuListButto > { > // These are the paddings needed to place the text correctly in the <select> box > const int dropDownBoxPaddingTop = 2; >- const int dropDownBoxPaddingRight = style.direction() == LTR ? 4 + dropDownButtonWidth : 4; >+ const int dropDownBoxPaddingRight = style.direction() == TextDirection::LTR ? 4 + dropDownButtonWidth : 4; > const int dropDownBoxPaddingBottom = 2; >- const int dropDownBoxPaddingLeft = style.direction() == LTR ? 4 : 4 + dropDownButtonWidth; >+ const int dropDownBoxPaddingLeft = style.direction() == TextDirection::LTR ? 4 : 4 + dropDownButtonWidth; > // The <select> box must be at least 12px high for the button to render nicely on Windows > const int dropDownBoxMinHeight = 12; > >@@ -794,7 +794,7 @@ bool RenderThemeWin::paintMenuListButton > // leaving space for the text field's 1px border > IntRect buttonRect(rect); > buttonRect.inflate(-borderThickness); >- if (renderer.style().direction() == LTR) >+ if (renderer.style().direction() == TextDirection::LTR) > buttonRect.setX(buttonRect.maxX() - dropDownButtonWidth); > buttonRect.setWidth(dropDownButtonWidth); > >Index: Source/WebCore/rendering/mathml/RenderMathMLBlock.cpp >=================================================================== >--- Source/WebCore/rendering/mathml/RenderMathMLBlock.cpp (revision 234619) >+++ Source/WebCore/rendering/mathml/RenderMathMLBlock.cpp (working copy) >@@ -89,7 +89,7 @@ LayoutUnit RenderMathMLBlock::mathAxisHe > > LayoutUnit RenderMathMLBlock::mirrorIfNeeded(LayoutUnit horizontalOffset, LayoutUnit boxWidth) const > { >- if (style().direction() == RTL) >+ if (style().direction() == TextDirection::RTL) > return logicalWidth() - boxWidth - horizontalOffset; > > return horizontalOffset; >Index: Source/WebCore/rendering/mathml/RenderMathMLOperator.cpp >=================================================================== >--- Source/WebCore/rendering/mathml/RenderMathMLOperator.cpp (revision 234618) >+++ Source/WebCore/rendering/mathml/RenderMathMLOperator.cpp (working copy) >@@ -238,7 +238,7 @@ void RenderMathMLOperator::layoutBlock(b > setLogicalWidth(width); > > // We then move the children to take spacing into account. >- LayoutPoint horizontalShift(style().direction() == LTR ? leadingSpaceValue : -leadingSpaceValue, 0); >+ LayoutPoint horizontalShift(style().direction() == TextDirection::LTR ? leadingSpaceValue : -leadingSpaceValue, 0); > for (auto* child = firstChildBox(); child; child = child->nextSiblingBox()) > child->setLocation(child->location() + horizontalShift); > } >Index: Source/WebCore/rendering/style/RenderStyle.cpp >=================================================================== >--- Source/WebCore/rendering/style/RenderStyle.cpp (revision 234618) >+++ Source/WebCore/rendering/style/RenderStyle.cpp (working copy) >@@ -152,7 +152,7 @@ RenderStyle::RenderStyle(CreateDefaultSt > #if ENABLE(CURSOR_VISIBILITY) > m_inheritedFlags.cursorVisibility = static_cast<unsigned>(initialCursorVisibility()); > #endif >- m_inheritedFlags.direction = initialDirection(); >+ m_inheritedFlags.direction = static_cast<unsigned>(initialDirection()); > m_inheritedFlags.whiteSpace = static_cast<unsigned>(initialWhiteSpace()); > m_inheritedFlags.borderCollapse = static_cast<unsigned>(initialBorderCollapse()); > m_inheritedFlags.rtlOrdering = static_cast<unsigned>(initialRTLOrdering()); >Index: Source/WebCore/rendering/style/RenderStyle.h >=================================================================== >--- Source/WebCore/rendering/style/RenderStyle.h (revision 234618) >+++ Source/WebCore/rendering/style/RenderStyle.h (working copy) >@@ -388,7 +388,7 @@ public: > TextZoom textZoom() const { return static_cast<TextZoom>(m_rareInheritedData->textZoom); } > > TextDirection direction() const { return static_cast<TextDirection>(m_inheritedFlags.direction); } >- bool isLeftToRightDirection() const { return direction() == LTR; } >+ bool isLeftToRightDirection() const { return direction() == TextDirection::LTR; } > bool hasExplicitlySetDirection() const { return m_nonInheritedFlags.hasExplicitlySetDirection; } > > const Length& specifiedLineHeight() const; >@@ -1442,7 +1442,7 @@ public: > static CaptionSide initialCaptionSide() { return CaptionSide::Top; } > static ColumnAxis initialColumnAxis() { return ColumnAxis::Auto; } > static ColumnProgression initialColumnProgression() { return ColumnProgression::Normal; } >- static TextDirection initialDirection() { return LTR; } >+ static TextDirection initialDirection() { return TextDirection::LTR; } > static WritingMode initialWritingMode() { return TopToBottomWritingMode; } > static TextCombine initialTextCombine() { return TextCombine::None; } > static TextOrientation initialTextOrientation() { return TextOrientation::Mixed; } >Index: Source/WebCore/testing/InternalSettings.cpp >=================================================================== >--- Source/WebCore/testing/InternalSettings.cpp (revision 234618) >+++ Source/WebCore/testing/InternalSettings.cpp (working copy) >@@ -820,9 +820,9 @@ ExceptionOr<String> InternalSettings::sy > if (!m_page) > return Exception { InvalidAccessError }; > switch (settings().systemLayoutDirection()) { >- case LTR: >+ case TextDirection::LTR: > return String { "LTR"_s }; >- case RTL: >+ case TextDirection::RTL: > return String { "RTL"_s }; > } > ASSERT_NOT_REACHED(); >@@ -834,11 +834,11 @@ ExceptionOr<void> InternalSettings::setS > if (!m_page) > return Exception { InvalidAccessError }; > if (equalLettersIgnoringASCIICase(direction, "ltr")) { >- settings().setSystemLayoutDirection(LTR); >+ settings().setSystemLayoutDirection(TextDirection::LTR); > return { }; > } > if (equalLettersIgnoringASCIICase(direction, "rtl")) { >- settings().setSystemLayoutDirection(RTL); >+ settings().setSystemLayoutDirection(TextDirection::RTL); > return { }; > } > return Exception { InvalidAccessError }; >Index: Source/WebCore/testing/Internals.h >=================================================================== >--- Source/WebCore/testing/Internals.h (revision 234618) >+++ Source/WebCore/testing/Internals.h (working copy) >@@ -614,7 +614,7 @@ public: > > RefPtr<GCObservation> observeGC(JSC::JSValue); > >- enum class UserInterfaceLayoutDirection { LTR, RTL }; >+ enum class UserInterfaceLayoutDirection : uint8_t { LTR, RTL }; > void setUserInterfaceLayoutDirection(UserInterfaceLayoutDirection); > > bool userPrefersReducedMotion() const; >Index: Source/WebKit/ChangeLog >=================================================================== >--- Source/WebKit/ChangeLog (revision 234619) >+++ Source/WebKit/ChangeLog (working copy) >@@ -1,3 +1,22 @@ >+2018-08-06 Alex Christensen <achristensen@webkit.org> >+ >+ Use a 1-byte enum class for TextDirection >+ https://bugs.webkit.org/show_bug.cgi?id=188350 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ * Shared/WebPopupItem.cpp: >+ (WebKit::WebPopupItem::WebPopupItem): >+ * UIProcess/ios/WKContentViewInteraction.mm: >+ (-[WKContentView webSelectionRectsForSelectionRects:]): >+ * UIProcess/mac/WebPopupMenuProxyMac.mm: >+ (WebKit::WebPopupMenuProxyMac::populate): >+ (WebKit::WebPopupMenuProxyMac::showPopupMenu): >+ * WebProcess/WebCoreSupport/WebPopupMenu.cpp: >+ (WebKit::WebPopupMenu::show): >+ * WebProcess/WebPage/ios/WebPageIOS.mm: >+ (WebKit::WebPage::getAssistedNodeInformation): >+ > 2018-08-06 Alex Christensen <achristensen@webkit.org> > > Use enum classes and OptionSets for PaintPhase and PaintBehavior >Index: Source/WebKit/Shared/WebPopupItem.cpp >=================================================================== >--- Source/WebKit/Shared/WebPopupItem.cpp (revision 234618) >+++ Source/WebKit/Shared/WebPopupItem.cpp (working copy) >@@ -35,7 +35,7 @@ namespace WebKit { > > WebPopupItem::WebPopupItem() > : m_type(Item) >- , m_textDirection(LTR) >+ , m_textDirection(TextDirection::LTR) > , m_hasTextDirectionOverride(false) > , m_isEnabled(true) > , m_isSelected(false) >@@ -44,7 +44,7 @@ WebPopupItem::WebPopupItem() > > WebPopupItem::WebPopupItem(Type type) > : m_type(type) >- , m_textDirection(LTR) >+ , m_textDirection(TextDirection::LTR) > , m_hasTextDirectionOverride(false) > , m_isEnabled(true) > , m_isLabel(false) >Index: Source/WebKit/UIProcess/API/Cocoa/WKWebView.mm >=================================================================== >--- Source/WebKit/UIProcess/API/Cocoa/WKWebView.mm (revision 234618) >+++ Source/WebKit/UIProcess/API/Cocoa/WKWebView.mm (working copy) >@@ -574,7 +574,7 @@ // We are in the View's initializati > pageConfiguration->preferenceValues().set(WebKit::WebPreferencesKey::inlineMediaPlaybackRequiresPlaysInlineAttributeKey(), WebKit::WebPreferencesStore::Value(!![_configuration _inlineMediaPlaybackRequiresPlaysInlineAttribute])); > pageConfiguration->preferenceValues().set(WebKit::WebPreferencesKey::allowsPictureInPictureMediaPlaybackKey(), WebKit::WebPreferencesStore::Value(!![_configuration allowsPictureInPictureMediaPlayback] && shouldAllowPictureInPictureMediaPlayback())); > pageConfiguration->preferenceValues().set(WebKit::WebPreferencesKey::userInterfaceDirectionPolicyKey(), WebKit::WebPreferencesStore::Value(static_cast<uint32_t>(WebCore::UserInterfaceDirectionPolicy::Content))); >- pageConfiguration->preferenceValues().set(WebKit::WebPreferencesKey::systemLayoutDirectionKey(), WebKit::WebPreferencesStore::Value(static_cast<uint32_t>(WebCore::LTR))); >+ pageConfiguration->preferenceValues().set(WebKit::WebPreferencesKey::systemLayoutDirectionKey(), WebKit::WebPreferencesStore::Value(static_cast<uint32_t>(WebCore::TextDirection::LTR))); > pageConfiguration->preferenceValues().set(WebKit::WebPreferencesKey::allowSettingAnyXHRHeaderFromFileURLsKey(), WebKit::WebPreferencesStore::Value(shouldAllowSettingAnyXHRHeaderFromFileURLs())); > #if USE(SYSTEM_PREVIEW) > pageConfiguration->preferenceValues().set(WebKit::WebPreferencesKey::systemPreviewEnabledKey(), WebKit::WebPreferencesStore::Value(!![_configuration _systemPreviewEnabled])); >Index: Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm >=================================================================== >--- Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm (revision 234618) >+++ Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm (working copy) >@@ -1766,7 +1766,7 @@ - (NSArray *)webSelectionRectsForSelecti > const WebCore::SelectionRect& coreRect = selectionRects[i]; > WebSelectionRect *webRect = [WebSelectionRect selectionRect]; > webRect.rect = coreRect.rect(); >- webRect.writingDirection = coreRect.direction() == LTR ? WKWritingDirectionLeftToRight : WKWritingDirectionRightToLeft; >+ webRect.writingDirection = coreRect.direction() == TextDirection::LTR ? WKWritingDirectionLeftToRight : WKWritingDirectionRightToLeft; > webRect.isLineBreak = coreRect.isLineBreak(); > webRect.isFirstOnLine = coreRect.isFirstOnLine(); > webRect.isLastOnLine = coreRect.isLastOnLine(); >Index: Source/WebKit/UIProcess/mac/WebPopupMenuProxyMac.mm >=================================================================== >--- Source/WebKit/UIProcess/mac/WebPopupMenuProxyMac.mm (revision 234618) >+++ Source/WebKit/UIProcess/mac/WebPopupMenuProxyMac.mm (working copy) >@@ -73,9 +73,9 @@ void WebPopupMenuProxyMac::populate(cons > NSMenuItem *menuItem = [m_popup lastItem]; > > RetainPtr<NSMutableParagraphStyle> paragraphStyle = adoptNS([[NSParagraphStyle defaultParagraphStyle] mutableCopy]); >- NSWritingDirection writingDirection = items[i].m_textDirection == LTR ? NSWritingDirectionLeftToRight : NSWritingDirectionRightToLeft; >+ NSWritingDirection writingDirection = items[i].m_textDirection == TextDirection::LTR ? NSWritingDirectionLeftToRight : NSWritingDirectionRightToLeft; > [paragraphStyle setBaseWritingDirection:writingDirection]; >- [paragraphStyle setAlignment:menuTextDirection == LTR ? NSTextAlignmentLeft : NSTextAlignmentRight]; >+ [paragraphStyle setAlignment:menuTextDirection == TextDirection::LTR ? NSTextAlignmentLeft : NSTextAlignmentRight]; > RetainPtr<NSMutableDictionary> attributes = adoptNS([[NSMutableDictionary alloc] initWithObjectsAndKeys: > paragraphStyle.get(), NSParagraphStyleAttributeName, > font, NSFontAttributeName, >@@ -111,10 +111,10 @@ void WebPopupMenuProxyMac::showPopupMenu > > [m_popup attachPopUpWithFrame:rect inView:m_webView]; > [m_popup selectItemAtIndex:selectedIndex]; >- [m_popup setUserInterfaceLayoutDirection:textDirection == LTR ? NSUserInterfaceLayoutDirectionLeftToRight : NSUserInterfaceLayoutDirectionRightToLeft]; >+ [m_popup setUserInterfaceLayoutDirection:textDirection == TextDirection::LTR ? NSUserInterfaceLayoutDirectionLeftToRight : NSUserInterfaceLayoutDirectionRightToLeft]; > > NSMenu *menu = [m_popup menu]; >- [menu setUserInterfaceLayoutDirection:textDirection == LTR ? NSUserInterfaceLayoutDirectionLeftToRight : NSUserInterfaceLayoutDirectionRightToLeft]; >+ [menu setUserInterfaceLayoutDirection:textDirection == TextDirection::LTR ? NSUserInterfaceLayoutDirectionLeftToRight : NSUserInterfaceLayoutDirectionRightToLeft]; > > // These values were borrowed from AppKit to match their placement of the menu. > const int popOverHorizontalAdjust = -13; >@@ -129,18 +129,18 @@ void WebPopupMenuProxyMac::showPopupMenu > if (titleFrame.size.width <= 0 || titleFrame.size.height <= 0) > titleFrame = rect; > float verticalOffset = roundf((NSMaxY(rect) - NSMaxY(titleFrame)) + NSHeight(titleFrame)) + 1; >- if (textDirection == LTR) >+ if (textDirection == TextDirection::LTR) > location = NSMakePoint(NSMinX(rect) + popOverHorizontalAdjust, NSMaxY(rect) - verticalOffset); > else > location = NSMakePoint(NSMaxX(rect) - popOverHorizontalAdjust, NSMaxY(rect) - verticalOffset); > } else { >- if (textDirection == LTR) >+ if (textDirection == TextDirection::LTR) > location = NSMakePoint(NSMinX(rect) + popUnderHorizontalAdjust, NSMaxY(rect) + popUnderVerticalAdjust); > else > location = NSMakePoint(NSMaxX(rect) - popUnderHorizontalAdjust, NSMaxY(rect) + popUnderVerticalAdjust); > } > RetainPtr<NSView> dummyView = adoptNS([[NSView alloc] initWithFrame:rect]); >- [dummyView.get() setUserInterfaceLayoutDirection:textDirection == LTR ? NSUserInterfaceLayoutDirectionLeftToRight : NSUserInterfaceLayoutDirectionRightToLeft]; >+ [dummyView.get() setUserInterfaceLayoutDirection:textDirection == TextDirection::LTR ? NSUserInterfaceLayoutDirectionLeftToRight : NSUserInterfaceLayoutDirectionRightToLeft]; > [m_webView addSubview:dummyView.get()]; > location = [dummyView convertPoint:location fromView:m_webView]; > >Index: Source/WebKit/WebProcess/WebCoreSupport/WebPopupMenu.cpp >=================================================================== >--- Source/WebKit/WebProcess/WebCoreSupport/WebPopupMenu.cpp (revision 234618) >+++ Source/WebKit/WebProcess/WebCoreSupport/WebPopupMenu.cpp (working copy) >@@ -112,7 +112,7 @@ void WebPopupMenu::show(const IntRect& r > PlatformPopupMenuData platformData; > setUpPlatformData(pageCoordinates, platformData); > >- WebProcess::singleton().parentProcessConnection()->send(Messages::WebPageProxy::ShowPopupMenu(pageCoordinates, m_popupClient->menuStyle().textDirection(), items, index, platformData), m_page->pageID()); >+ WebProcess::singleton().parentProcessConnection()->send(Messages::WebPageProxy::ShowPopupMenu(pageCoordinates, static_cast<uint64_t>(m_popupClient->menuStyle().textDirection()), items, index, platformData), m_page->pageID()); > } > > void WebPopupMenu::hide() >Index: Source/WebKit/WebProcess/WebPage/ios/WebPageIOS.mm >=================================================================== >--- Source/WebKit/WebProcess/WebPage/ios/WebPageIOS.mm (revision 234618) >+++ Source/WebKit/WebProcess/WebPage/ios/WebPageIOS.mm (working copy) >@@ -2311,7 +2311,7 @@ void WebPage::getAssistedNodeInformation > bool inFixed = false; > renderer->localToContainerPoint(FloatPoint(), nullptr, UseTransforms, &inFixed); > information.insideFixedPosition = inFixed; >- information.isRTL = renderer->style().direction() == RTL; >+ information.isRTL = renderer->style().direction() == TextDirection::RTL; > > FrameView* frameView = elementFrame.view(); > if (inFixed && elementFrame.isMainFrame() && !frameView->frame().settings().visualViewportEnabled()) { >Index: Source/WebKitLegacy/ios/ChangeLog >=================================================================== >--- Source/WebKitLegacy/ios/ChangeLog (revision 234618) >+++ Source/WebKitLegacy/ios/ChangeLog (working copy) >@@ -1,3 +1,18 @@ >+2018-08-06 Alex Christensen <achristensen@webkit.org> >+ >+ Use a 1-byte enum class for TextDirection >+ https://bugs.webkit.org/show_bug.cgi?id=188350 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ * WebCoreSupport/WebFrameIOS.mm: >+ (-[WebFrame selectionRectsForCoreRange:]): >+ * WebCoreSupport/WebVisiblePosition.mm: >+ (-[WebVisiblePosition textDirection]): >+ (-[WebVisiblePosition directionIsDownstream:]): >+ * WebView/WebPDFViewIOS.mm: >+ (-[WebPDFView _checkPDFTitle]): >+ > 2018-07-04 Tim Horton <timothy_horton@apple.com> > > Introduce PLATFORM(IOSMAC) >Index: Source/WebKitLegacy/ios/WebCoreSupport/WebFrameIOS.mm >=================================================================== >--- Source/WebKitLegacy/ios/WebCoreSupport/WebFrameIOS.mm (revision 234618) >+++ Source/WebKitLegacy/ios/WebCoreSupport/WebFrameIOS.mm (working copy) >@@ -220,7 +220,7 @@ - (NSArray *)selectionRectsForCoreRange: > SelectionRect &coreRect = rects[i]; > WebSelectionRect *webRect = [WebSelectionRect selectionRect]; > webRect.rect = static_cast<CGRect>(coreRect.rect()); >- webRect.writingDirection = coreRect.direction() == LTR ? WKWritingDirectionLeftToRight : WKWritingDirectionRightToLeft; >+ webRect.writingDirection = coreRect.direction() == TextDirection::LTR ? WKWritingDirectionLeftToRight : WKWritingDirectionRightToLeft; > webRect.isLineBreak = coreRect.isLineBreak(); > webRect.isFirstOnLine = coreRect.isFirstOnLine(); > webRect.isLastOnLine = coreRect.isLastOnLine(); >Index: Source/WebKitLegacy/ios/WebCoreSupport/WebVisiblePosition.mm >=================================================================== >--- Source/WebKitLegacy/ios/WebCoreSupport/WebVisiblePosition.mm (revision 234618) >+++ Source/WebKitLegacy/ios/WebCoreSupport/WebVisiblePosition.mm (working copy) >@@ -132,7 +132,7 @@ - (NSString *)description > - (TextDirection)textDirection > { > // TODO: implement >- return LTR; >+ return TextDirection::LTR; > } > > - (BOOL)directionIsDownstream:(WebTextAdjustmentDirection)direction >@@ -144,11 +144,9 @@ - (BOOL)directionIsDownstream:(WebTextAd > return YES; > > >- if ([self textDirection] == LTR) { >+ if ([self textDirection] == TextDirection::LTR) > return (direction == WebTextAdjustmentRight); >- } else { >- return (direction == WebTextAdjustmentLeft); >- } >+ return (direction == WebTextAdjustmentLeft); > } > > - (WebVisiblePosition *)positionByMovingInDirection:(WebTextAdjustmentDirection)direction amount:(UInt32)amount withAffinityDownstream:(BOOL)affinityDownstream >Index: Source/WebKitLegacy/ios/WebView/WebPDFViewIOS.mm >=================================================================== >--- Source/WebKitLegacy/ios/WebView/WebPDFViewIOS.mm (revision 234618) >+++ Source/WebKitLegacy/ios/WebView/WebPDFViewIOS.mm (working copy) >@@ -299,7 +299,7 @@ - (void)_checkPDFTitle > if ([title length]) { > [_title release]; > _title = [title copy]; >- core([self _frame])->loader().client().dispatchDidReceiveTitle({ title, LTR }); >+ core([self _frame])->loader().client().dispatchDidReceiveTitle({ title, TextDirection::LTR }); > } > } > >Index: Source/WebKitLegacy/mac/ChangeLog >=================================================================== >--- Source/WebKitLegacy/mac/ChangeLog (revision 234619) >+++ Source/WebKitLegacy/mac/ChangeLog (working copy) >@@ -1,3 +1,18 @@ >+2018-08-06 Alex Christensen <achristensen@webkit.org> >+ >+ Use a 1-byte enum class for TextDirection >+ https://bugs.webkit.org/show_bug.cgi?id=188350 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ * WebCoreSupport/PopupMenuMac.mm: >+ (PopupMenuMac::populate): >+ (PopupMenuMac::show): >+ * WebCoreSupport/WebFrameLoaderClient.mm: >+ (WebFrameLoaderClient::transitionToCommittedForNewPage): >+ * WebView/WebFrame.mm: >+ (-[WebFrame _dispatchDidReceiveTitle:]): >+ > 2018-08-06 Alex Christensen <achristensen@webkit.org> > > Use enum classes and OptionSets for PaintPhase and PaintBehavior >Index: Source/WebKitLegacy/mac/WebCoreSupport/PopupMenuMac.mm >=================================================================== >--- Source/WebKitLegacy/mac/WebCoreSupport/PopupMenuMac.mm (revision 234618) >+++ Source/WebKitLegacy/mac/WebCoreSupport/PopupMenuMac.mm (working copy) >@@ -67,7 +67,7 @@ void PopupMenuMac::populate() > [m_popup addItemWithTitle:@""]; > > TextDirection menuTextDirection = m_client->menuStyle().textDirection(); >- [m_popup setUserInterfaceLayoutDirection:menuTextDirection == LTR ? NSUserInterfaceLayoutDirectionLeftToRight : NSUserInterfaceLayoutDirectionRightToLeft]; >+ [m_popup setUserInterfaceLayoutDirection:menuTextDirection == TextDirection::LTR ? NSUserInterfaceLayoutDirectionLeftToRight : NSUserInterfaceLayoutDirectionRightToLeft]; > > ASSERT(m_client); > int size = m_client->listSize(); >@@ -90,8 +90,8 @@ void PopupMenuMac::populate() > } > > RetainPtr<NSMutableParagraphStyle> paragraphStyle = adoptNS([[NSParagraphStyle defaultParagraphStyle] mutableCopy]); >- [paragraphStyle setAlignment:menuTextDirection == LTR ? NSTextAlignmentLeft : NSTextAlignmentRight]; >- NSWritingDirection writingDirection = style.textDirection() == LTR ? NSWritingDirectionLeftToRight : NSWritingDirectionRightToLeft; >+ [paragraphStyle setAlignment:menuTextDirection == TextDirection::LTR ? NSTextAlignmentLeft : NSTextAlignmentRight]; >+ NSWritingDirection writingDirection = style.textDirection() == TextDirection::LTR ? NSWritingDirectionLeftToRight : NSWritingDirectionRightToLeft; > [paragraphStyle setBaseWritingDirection:writingDirection]; > if (style.hasTextDirectionOverride()) { > RetainPtr<NSNumber> writingDirectionValue = adoptNS([[NSNumber alloc] initWithInteger:writingDirection + NSWritingDirectionOverride]); >@@ -146,10 +146,10 @@ void PopupMenuMac::show(const IntRect& r > > [m_popup attachPopUpWithFrame:r inView:view]; > [m_popup selectItemAtIndex:index]; >- [m_popup setUserInterfaceLayoutDirection:textDirection == LTR ? NSUserInterfaceLayoutDirectionLeftToRight : NSUserInterfaceLayoutDirectionRightToLeft]; >+ [m_popup setUserInterfaceLayoutDirection:textDirection == TextDirection::LTR ? NSUserInterfaceLayoutDirectionLeftToRight : NSUserInterfaceLayoutDirectionRightToLeft]; > > NSMenu *menu = [m_popup menu]; >- [menu setUserInterfaceLayoutDirection:textDirection == LTR ? NSUserInterfaceLayoutDirectionLeftToRight : NSUserInterfaceLayoutDirectionRightToLeft]; >+ [menu setUserInterfaceLayoutDirection:textDirection == TextDirection::LTR ? NSUserInterfaceLayoutDirectionLeftToRight : NSUserInterfaceLayoutDirectionRightToLeft]; > > NSPoint location; > CTFontRef font = m_client->menuStyle().font().primaryFont().getCTFont(); >@@ -168,7 +168,7 @@ void PopupMenuMac::show(const IntRect& r > vertOffset += CTFontGetDescent(font) - CTFontGetDescent(defaultFont.get()); > vertOffset = fminf(NSHeight(r), vertOffset); > #if __MAC_OS_X_VERSION_MIN_REQUIRED >= 101200 >- if (textDirection == LTR) >+ if (textDirection == TextDirection::LTR) > location = NSMakePoint(NSMinX(r) + popOverHorizontalAdjust, NSMaxY(r) - vertOffset); > else > location = NSMakePoint(NSMaxX(r) - popOverHorizontalAdjust, NSMaxY(r) - vertOffset); >@@ -177,7 +177,7 @@ void PopupMenuMac::show(const IntRect& r > #endif > } else { > #if __MAC_OS_X_VERSION_MIN_REQUIRED >= 101200 >- if (textDirection == LTR) >+ if (textDirection == TextDirection::LTR) > location = NSMakePoint(NSMinX(r) + popUnderHorizontalAdjust, NSMaxY(r) + popUnderVerticalAdjust); > else > location = NSMakePoint(NSMaxX(r) - popUnderHorizontalAdjust, NSMaxY(r) + popUnderVerticalAdjust); >@@ -193,7 +193,7 @@ void PopupMenuMac::show(const IntRect& r > Ref<PopupMenuMac> protector(*this); > > RetainPtr<NSView> dummyView = adoptNS([[NSView alloc] initWithFrame:r]); >- [dummyView.get() setUserInterfaceLayoutDirection:textDirection == LTR ? NSUserInterfaceLayoutDirectionLeftToRight : NSUserInterfaceLayoutDirectionRightToLeft]; >+ [dummyView.get() setUserInterfaceLayoutDirection:textDirection == TextDirection::LTR ? NSUserInterfaceLayoutDirectionLeftToRight : NSUserInterfaceLayoutDirectionRightToLeft]; > [view addSubview:dummyView.get()]; > location = [dummyView convertPoint:location fromView:view]; > >Index: Source/WebKitLegacy/mac/WebCoreSupport/WebFrameLoaderClient.mm >=================================================================== >--- Source/WebKitLegacy/mac/WebCoreSupport/WebFrameLoaderClient.mm (revision 234618) >+++ Source/WebKitLegacy/mac/WebCoreSupport/WebFrameLoaderClient.mm (working copy) >@@ -1494,7 +1494,7 @@ void WebFrameLoaderClient::transitionToC > // like the ones that Safari uses for bookmarks it is the only way the DocumentLoader > // will get the proper title. > if (auto* documentLoader = [dataSource _documentLoader]) >- documentLoader->setTitle({ [dataSource pageTitle], LTR }); >+ documentLoader->setTitle({ [dataSource pageTitle], TextDirection::LTR }); > > if (auto* ownerElement = coreFrame->ownerElement()) > coreFrame->view()->setCanHaveScrollbars(ownerElement->scrollingMode() != ScrollbarAlwaysOff); >Index: Source/WebKitLegacy/mac/WebView/WebFrame.mm >=================================================================== >--- Source/WebKitLegacy/mac/WebView/WebFrame.mm (revision 234619) >+++ Source/WebKitLegacy/mac/WebView/WebFrame.mm (working copy) >@@ -2337,7 +2337,7 @@ - (void)_dispatchDidReceiveTitle:(NSStri > Frame* coreFrame = _private->coreFrame; > if (!coreFrame) > return; >- coreFrame->loader().client().dispatchDidReceiveTitle({ title, LTR }); >+ coreFrame->loader().client().dispatchDidReceiveTitle({ title, TextDirection::LTR }); > } > > #endif // PLATFORM(IOS) >Index: Tools/ChangeLog >=================================================================== >--- Tools/ChangeLog (revision 234618) >+++ Tools/ChangeLog (working copy) >@@ -1,3 +1,18 @@ >+2018-08-06 Alex Christensen <achristensen@webkit.org> >+ >+ Use a 1-byte enum class for TextDirection >+ https://bugs.webkit.org/show_bug.cgi?id=188350 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ * TestWebKitAPI/Tests/WebCore/ComplexTextController.cpp: >+ (TestWebKitAPI::TEST_F): >+ * TestWebKitAPI/Tests/WebCore/StringWithDirection.cpp: >+ (WebCore::operator<<): >+ (TestWebKitAPI::TEST): >+ * TestWebKitAPI/Tests/WebKitCocoa/CommandBackForward.mm: >+ (TEST_F): >+ > 2018-08-06 Wenson Hsieh <wenson_hsieh@apple.com> > > [iOS] Caret disappears after resigning and becoming first responder if active focus state is retained >Index: Tools/TestWebKitAPI/Tests/WebCore/ComplexTextController.cpp >=================================================================== >--- Tools/TestWebKitAPI/Tests/WebCore/ComplexTextController.cpp (revision 234618) >+++ Tools/TestWebKitAPI/Tests/WebCore/ComplexTextController.cpp (working copy) >@@ -352,7 +352,7 @@ TEST_F(ComplexTextControllerTest, TotalW > > UChar characters[] = { 0x644, ' ', 0x644, ' ', 0x644 }; > size_t charactersLength = WTF_ARRAY_LENGTH(characters); >- TextRun textRun(StringView(characters, charactersLength), 0, 14, DefaultExpansion, RTL); >+ TextRun textRun(StringView(characters, charactersLength), 0, 14, DefaultExpansion, TextDirection::RTL); > auto run = ComplexTextController::ComplexTextRun::create(advances, origins, { 5, 6, 7, 8, 9 }, { 4, 3, 2, 1, 0 }, initialAdvance, font.primaryFont(), characters, 0, charactersLength, 0, 5, false); > Vector<Ref<ComplexTextController::ComplexTextRun>> runs; > runs.append(WTFMove(run)); >Index: Tools/TestWebKitAPI/Tests/WebCore/StringWithDirection.cpp >=================================================================== >--- Tools/TestWebKitAPI/Tests/WebCore/StringWithDirection.cpp (revision 234618) >+++ Tools/TestWebKitAPI/Tests/WebCore/StringWithDirection.cpp (working copy) >@@ -31,49 +31,66 @@ > > using namespace WebCore; > >+namespace WebCore { >+ >+std::ostream& operator<<(std::ostream& os, const TextDirection& direction) >+{ >+ switch (direction) { >+ case TextDirection::LTR: >+ os << "TextDirection::LTR"; >+ break; >+ case TextDirection::RTL: >+ os << "TextDirection::RTL"; >+ break; >+ } >+ return os; >+} >+ >+} >+ > namespace TestWebKitAPI { > > TEST(StringWithDirection, TruncateAtEndWithLeftToRightString) > { >- StringWithDirection string { "Cappuccino", LTR }; >+ StringWithDirection string { "Cappuccino", TextDirection::LTR }; > StringWithDirection result; > > result = truncateFromEnd(string, 0); >- EXPECT_EQ(LTR, result.direction); >+ EXPECT_EQ(TextDirection::LTR, result.direction); > EXPECT_EQ("", result.string); > > result = truncateFromEnd(string, 1); >- EXPECT_EQ(LTR, result.direction); >+ EXPECT_EQ(TextDirection::LTR, result.direction); > EXPECT_EQ("C", result.string); > > result = truncateFromEnd(string, 2); >- EXPECT_EQ(LTR, result.direction); >+ EXPECT_EQ(TextDirection::LTR, result.direction); > EXPECT_EQ("Ca", result.string); > > result = truncateFromEnd(string, 1000); >- EXPECT_EQ(LTR, result.direction); >+ EXPECT_EQ(TextDirection::LTR, result.direction); > EXPECT_EQ("Cappuccino", result.string); > } > > TEST(StringWithDirection, TruncateAtEndWithRightToLeftString) > { >- StringWithDirection string { String::fromUTF8("קָפּ×ּצִ'×× ×Ö¹"), RTL }; >+ StringWithDirection string { String::fromUTF8("קָפּ×ּצִ'×× ×Ö¹"), TextDirection::RTL }; > StringWithDirection result; > > result = truncateFromEnd(string, 0); >- EXPECT_EQ(RTL, result.direction); >+ EXPECT_EQ(TextDirection::RTL, result.direction); > EXPECT_EQ("", result.string); > > result = truncateFromEnd(string, 1); >- EXPECT_EQ(RTL, result.direction); >+ EXPECT_EQ(TextDirection::RTL, result.direction); > EXPECT_EQ(String::fromUTF8("×§"), result.string); > > result = truncateFromEnd(string, 2); >- EXPECT_EQ(RTL, result.direction); >+ EXPECT_EQ(TextDirection::RTL, result.direction); > EXPECT_EQ(String::fromUTF8("×§Ö¸"), result.string); > > result = truncateFromEnd(string, 1000); >- EXPECT_EQ(RTL, result.direction); >+ EXPECT_EQ(TextDirection::RTL, result.direction); > EXPECT_EQ(String::fromUTF8("קָפּ×ּצִ'×× ×Ö¹"), result.string); > } > >Index: Tools/TestWebKitAPI/Tests/WebKitCocoa/CommandBackForward.mm >=================================================================== >--- Tools/TestWebKitAPI/Tests/WebKitCocoa/CommandBackForward.mm (revision 234618) >+++ Tools/TestWebKitAPI/Tests/WebKitCocoa/CommandBackForward.mm (working copy) >@@ -223,7 +223,7 @@ TEST_F(WebKit2_CommandBackForwardTestWKW > > #endif > >-TEST_F(WebKit2_CommandBackForwardTestWKView, LTR) >+TEST_F(WebKit2_CommandBackForwardTestWKView, TextDirection::LTR) > { > EXPECT_EQ(NSUserInterfaceLayoutDirectionLeftToRight, [webView userInterfaceLayoutDirection]); >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 188350
:
346644
|
346645
|
346650
|
346670
|
346675
|
346710