Title: [265338] trunk
Revision
265338
Author
mmaxfi...@apple.com
Date
2020-08-06 11:03:01 -0700 (Thu, 06 Aug 2020)

Log Message

Rename LeadingExpansion and TrailingExpansion to LeftExpansion and RightExpansion
https://bugs.webkit.org/show_bug.cgi?id=215211

Reviewed by Darin Adler.

"Leading" and "Trailing" are terms-of-art which represent logical order.
However, the behavior of these flags operates in visual order.
Instead, we should rename them to their visual order analogues: left and right.

No new tests because there is no behavior change.

* html/canvas/CanvasRenderingContext2D.cpp:
(WebCore::CanvasRenderingContext2D::measureText):
(WebCore::CanvasRenderingContext2D::drawTextInternal):
* layout/inlineformatting/InlineLineBuilder.cpp:
(WebCore::Layout::LineBuilder::justifyRuns):
(WebCore::Layout::LineBuilder::Run::expand):
(WebCore::Layout::LineBuilder::Run::visuallyCollapseTrailingWhitespace):
* platform/graphics/ComplexTextController.cpp:
(WebCore::expansionLocation):
(WebCore::ComplexTextController::adjustGlyphsAndAdvances):
* platform/graphics/FontCascade.cpp:
(WebCore::FontCascade::expansionOpportunityCountInternal):
(WebCore::FontCascade::leftExpansionOpportunity):
(WebCore::FontCascade::rightExpansionOpportunity):
(WebCore::FontCascade::leadingExpansionOpportunity): Deleted.
(WebCore::FontCascade::trailingExpansionOpportunity): Deleted.
* platform/graphics/FontCascade.h:
* platform/graphics/WidthIterator.cpp:
(WebCore::WidthIterator::WidthIterator):
(WebCore::expansionLocation):
(WebCore::WidthIterator::advanceInternal):
* platform/text/TextFlags.h:
* rendering/ComplexLineLayout.cpp:
(WebCore::expansionBehaviorForInlineTextBox):
(WebCore::applyExpansionBehavior):
* rendering/EllipsisBox.cpp:
(WebCore::EllipsisBox::paint):
(WebCore::EllipsisBox::selectionRect):
(WebCore::EllipsisBox::paintSelection):
* rendering/InlineBox.h:
(WebCore::InlineBox::setCanHaveLeftExpansion):
(WebCore::InlineBox::setCanHaveRightExpansion):
(WebCore::InlineBox::setForceRightExpansion):
(WebCore::InlineBox::setForceLeftExpansion):
(WebCore::InlineBox::InlineBoxBitfields::InlineBoxBitfields):
(WebCore::InlineBox::hasSelectedChildren const):
(WebCore::InlineBox::setHasSelectedChildren):
(WebCore::InlineBox::canHaveLeftExpansion const):
(WebCore::InlineBox::canHaveRightExpansion const):
(WebCore::InlineBox::forceRightExpansion const):
(WebCore::InlineBox::forceLeftExpansion const):
(WebCore::InlineBox::setCanHaveLeadingExpansion): Deleted.
(WebCore::InlineBox::setCanHaveTrailingExpansion): Deleted.
(WebCore::InlineBox::setForceTrailingExpansion): Deleted.
(WebCore::InlineBox::setForceLeadingExpansion): Deleted.
(WebCore::InlineBox::canHaveLeadingExpansion const): Deleted.
(WebCore::InlineBox::canHaveTrailingExpansion const): Deleted.
(WebCore::InlineBox::forceTrailingExpansion const): Deleted.
(WebCore::InlineBox::forceLeadingExpansion const): Deleted.
* rendering/InlineTextBox.cpp:
(WebCore::InlineTextBox::expansionBehavior const):
* rendering/InlineTextBox.h:
* rendering/RenderFileUploadControl.cpp:
(WebCore::RenderFileUploadControl::paintObject):
(WebCore::RenderFileUploadControl::computeIntrinsicLogicalWidths const):
* rendering/RenderListBox.cpp:
(WebCore::RenderListBox::updateFromElement):
(WebCore::RenderListBox::paintItemForeground):
* rendering/RenderTextControl.cpp:
(WebCore::RenderTextControl::getAverageCharWidth):
* rendering/SimpleLineLayout.cpp:
(WebCore::SimpleLineLayout::expansionBehavior):
* rendering/SimpleLineLayout.h:
* rendering/SimpleLineLayoutFunctions.cpp:
(WebCore::SimpleLineLayout::initializeInlineTextBox):
* rendering/svg/SVGInlineTextBox.cpp:
(WebCore::SVGInlineTextBox::constructTextRun const):
* rendering/svg/SVGTextMetrics.cpp:
(WebCore::SVGTextMetrics::constructTextRun):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (265337 => 265338)


--- trunk/Source/WebCore/ChangeLog	2020-08-06 17:58:13 UTC (rev 265337)
+++ trunk/Source/WebCore/ChangeLog	2020-08-06 18:03:01 UTC (rev 265338)
@@ -1,3 +1,86 @@
+2020-08-06  Myles C. Maxfield  <mmaxfi...@apple.com>
+
+        Rename LeadingExpansion and TrailingExpansion to LeftExpansion and RightExpansion
+        https://bugs.webkit.org/show_bug.cgi?id=215211
+
+        Reviewed by Darin Adler.
+
+        "Leading" and "Trailing" are terms-of-art which represent logical order.
+        However, the behavior of these flags operates in visual order.
+        Instead, we should rename them to their visual order analogues: left and right.
+
+        No new tests because there is no behavior change.
+
+        * html/canvas/CanvasRenderingContext2D.cpp:
+        (WebCore::CanvasRenderingContext2D::measureText):
+        (WebCore::CanvasRenderingContext2D::drawTextInternal):
+        * layout/inlineformatting/InlineLineBuilder.cpp:
+        (WebCore::Layout::LineBuilder::justifyRuns):
+        (WebCore::Layout::LineBuilder::Run::expand):
+        (WebCore::Layout::LineBuilder::Run::visuallyCollapseTrailingWhitespace):
+        * platform/graphics/ComplexTextController.cpp:
+        (WebCore::expansionLocation):
+        (WebCore::ComplexTextController::adjustGlyphsAndAdvances):
+        * platform/graphics/FontCascade.cpp:
+        (WebCore::FontCascade::expansionOpportunityCountInternal):
+        (WebCore::FontCascade::leftExpansionOpportunity):
+        (WebCore::FontCascade::rightExpansionOpportunity):
+        (WebCore::FontCascade::leadingExpansionOpportunity): Deleted.
+        (WebCore::FontCascade::trailingExpansionOpportunity): Deleted.
+        * platform/graphics/FontCascade.h:
+        * platform/graphics/WidthIterator.cpp:
+        (WebCore::WidthIterator::WidthIterator):
+        (WebCore::expansionLocation):
+        (WebCore::WidthIterator::advanceInternal):
+        * platform/text/TextFlags.h:
+        * rendering/ComplexLineLayout.cpp:
+        (WebCore::expansionBehaviorForInlineTextBox):
+        (WebCore::applyExpansionBehavior):
+        * rendering/EllipsisBox.cpp:
+        (WebCore::EllipsisBox::paint):
+        (WebCore::EllipsisBox::selectionRect):
+        (WebCore::EllipsisBox::paintSelection):
+        * rendering/InlineBox.h:
+        (WebCore::InlineBox::setCanHaveLeftExpansion):
+        (WebCore::InlineBox::setCanHaveRightExpansion):
+        (WebCore::InlineBox::setForceRightExpansion):
+        (WebCore::InlineBox::setForceLeftExpansion):
+        (WebCore::InlineBox::InlineBoxBitfields::InlineBoxBitfields):
+        (WebCore::InlineBox::hasSelectedChildren const):
+        (WebCore::InlineBox::setHasSelectedChildren):
+        (WebCore::InlineBox::canHaveLeftExpansion const):
+        (WebCore::InlineBox::canHaveRightExpansion const):
+        (WebCore::InlineBox::forceRightExpansion const):
+        (WebCore::InlineBox::forceLeftExpansion const):
+        (WebCore::InlineBox::setCanHaveLeadingExpansion): Deleted.
+        (WebCore::InlineBox::setCanHaveTrailingExpansion): Deleted.
+        (WebCore::InlineBox::setForceTrailingExpansion): Deleted.
+        (WebCore::InlineBox::setForceLeadingExpansion): Deleted.
+        (WebCore::InlineBox::canHaveLeadingExpansion const): Deleted.
+        (WebCore::InlineBox::canHaveTrailingExpansion const): Deleted.
+        (WebCore::InlineBox::forceTrailingExpansion const): Deleted.
+        (WebCore::InlineBox::forceLeadingExpansion const): Deleted.
+        * rendering/InlineTextBox.cpp:
+        (WebCore::InlineTextBox::expansionBehavior const):
+        * rendering/InlineTextBox.h:
+        * rendering/RenderFileUploadControl.cpp:
+        (WebCore::RenderFileUploadControl::paintObject):
+        (WebCore::RenderFileUploadControl::computeIntrinsicLogicalWidths const):
+        * rendering/RenderListBox.cpp:
+        (WebCore::RenderListBox::updateFromElement):
+        (WebCore::RenderListBox::paintItemForeground):
+        * rendering/RenderTextControl.cpp:
+        (WebCore::RenderTextControl::getAverageCharWidth):
+        * rendering/SimpleLineLayout.cpp:
+        (WebCore::SimpleLineLayout::expansionBehavior):
+        * rendering/SimpleLineLayout.h:
+        * rendering/SimpleLineLayoutFunctions.cpp:
+        (WebCore::SimpleLineLayout::initializeInlineTextBox):
+        * rendering/svg/SVGInlineTextBox.cpp:
+        (WebCore::SVGInlineTextBox::constructTextRun const):
+        * rendering/svg/SVGTextMetrics.cpp:
+        (WebCore::SVGTextMetrics::constructTextRun):
+
 2020-08-06  Chris Dumez  <cdu...@apple.com>
 
         DynamicsCompressorNode.reduction attribute should be a float, not an AudioParam

Modified: trunk/Source/WebCore/html/canvas/CanvasRenderingContext2D.cpp (265337 => 265338)


--- trunk/Source/WebCore/html/canvas/CanvasRenderingContext2D.cpp	2020-08-06 17:58:13 UTC (rev 265337)
+++ trunk/Source/WebCore/html/canvas/CanvasRenderingContext2D.cpp	2020-08-06 18:03:01 UTC (rev 265338)
@@ -385,7 +385,7 @@
     auto direction = toTextDirection(state().direction, &computedStyle);
     bool override = computedStyle ? isOverride(computedStyle->unicodeBidi()) : false;
 
-    TextRun textRun(normalizedText, 0, 0, AllowTrailingExpansion, direction, override, true);
+    TextRun textRun(normalizedText, 0, 0, AllowRightExpansion, direction, override, true);
     auto& font = fontProxy();
     auto& fontMetrics = font.fontMetrics();
 
@@ -498,7 +498,7 @@
     auto direction = toTextDirection(state().direction, &computedStyle);
     bool override = computedStyle ? isOverride(computedStyle->unicodeBidi()) : false;
 
-    TextRun textRun(normalizedText, 0, 0, AllowTrailingExpansion, direction, override, true);
+    TextRun textRun(normalizedText, 0, 0, AllowRightExpansion, direction, override, true);
     float fontWidth = fontProxy.width(textRun);
     bool useMaxWidth = maxWidth && maxWidth.value() < fontWidth;
     float width = useMaxWidth ? maxWidth.value() : fontWidth;

Modified: trunk/Source/WebCore/layout/inlineformatting/InlineLineBuilder.cpp (265337 => 265338)


--- trunk/Source/WebCore/layout/inlineformatting/InlineLineBuilder.cpp	2020-08-06 17:58:13 UTC (rev 265337)
+++ trunk/Source/WebCore/layout/inlineformatting/InlineLineBuilder.cpp	2020-08-06 18:03:01 UTC (rev 265338)
@@ -228,8 +228,8 @@
     // Need to fix up the last run's trailing expansion.
     if (lastRunWithContent && lastRunWithContent->hasExpansionOpportunity()) {
         // Turn off the trailing bits first and add the forbid trailing expansion.
-        auto leadingExpansion = lastRunWithContent->expansionBehavior() & LeadingExpansionMask;
-        lastRunWithContent->setExpansionBehavior(leadingExpansion | ForbidTrailingExpansion);
+        auto leftExpansion = lastRunWithContent->expansionBehavior() & LeftExpansionMask;
+        lastRunWithContent->setExpansionBehavior(leftExpansion | ForbidRightExpansion);
     }
     // Nothing to distribute?
     if (!expansionOpportunityCount)
@@ -825,7 +825,7 @@
 
     if (m_trailingWhitespaceType == TrailingWhitespace::None) {
         m_trailingWhitespaceWidth = { };
-        setExpansionBehavior(AllowLeadingExpansion | AllowTrailingExpansion);
+        setExpansionBehavior(AllowLeftExpansion | AllowRightExpansion);
         m_textContent->expand(inlineTextItem.length());
         return;
     }
@@ -879,7 +879,7 @@
         ASSERT(m_expansionOpportunityCount);
         m_expansionOpportunityCount--;
     }
-    setExpansionBehavior(AllowLeadingExpansion | AllowTrailingExpansion);
+    setExpansionBehavior(AllowLeftExpansion | AllowRightExpansion);
 }
 
 void LineBuilder::Run::setExpansionBehavior(ExpansionBehavior expansionBehavior)

Modified: trunk/Source/WebCore/platform/graphics/ComplexTextController.cpp (265337 => 265338)


--- trunk/Source/WebCore/platform/graphics/ComplexTextController.cpp	2020-08-06 17:58:13 UTC (rev 265337)
+++ trunk/Source/WebCore/platform/graphics/ComplexTextController.cpp	2020-08-06 18:03:01 UTC (rev 265338)
@@ -647,7 +647,7 @@
     }
 }
 
-static inline std::pair<bool, bool> expansionLocation(bool ideograph, bool treatAsSpace, bool ltr, bool isAfterExpansion, bool forbidLeadingExpansion, bool forbidTrailingExpansion, bool forceLeadingExpansion, bool forceTrailingExpansion)
+static inline std::pair<bool, bool> expansionLocation(bool ideograph, bool treatAsSpace, bool ltr, bool isAfterExpansion, bool forbidLeftExpansion, bool forbidRightExpansion, bool forceLeftExpansion, bool forceRightExpansion)
 {
     bool expandLeft = ideograph;
     bool expandRight = ideograph;
@@ -659,15 +659,15 @@
     }
     if (isAfterExpansion)
         expandLeft = false;
-    ASSERT(!forbidLeadingExpansion || !forceLeadingExpansion);
-    ASSERT(!forbidTrailingExpansion || !forceTrailingExpansion);
-    if (forbidLeadingExpansion)
+    ASSERT(!forbidLeftExpansion || !forceLeftExpansion);
+    ASSERT(!forbidRightExpansion || !forceRightExpansion);
+    if (forbidLeftExpansion)
         expandLeft = false;
-    if (forbidTrailingExpansion)
+    if (forbidRightExpansion)
         expandRight = false;
-    if (forceLeadingExpansion)
+    if (forceLeftExpansion)
         expandLeft = true;
-    if (forceTrailingExpansion)
+    if (forceRightExpansion)
         expandRight = true;
     return std::make_pair(expandLeft, expandRight);
 }
@@ -674,13 +674,13 @@
 
 void ComplexTextController::adjustGlyphsAndAdvances()
 {
-    bool afterExpansion = (m_run.expansionBehavior() & LeadingExpansionMask) == ForbidLeadingExpansion;
+    bool afterExpansion = (m_run.expansionBehavior() & LeftExpansionMask) == ForbidLeftExpansion;
     size_t runCount = m_complexTextRuns.size();
     bool hasExtraSpacing = (m_font.letterSpacing() || m_font.wordSpacing() || m_expansion) && !m_run.spacingDisabled();
-    bool runForcesLeadingExpansion = (m_run.expansionBehavior() & LeadingExpansionMask) == ForceLeadingExpansion;
-    bool runForcesTrailingExpansion = (m_run.expansionBehavior() & TrailingExpansionMask) == ForceTrailingExpansion;
-    bool runForbidsLeadingExpansion = (m_run.expansionBehavior() & LeadingExpansionMask) == ForbidLeadingExpansion;
-    bool runForbidsTrailingExpansion = (m_run.expansionBehavior() & TrailingExpansionMask) == ForbidTrailingExpansion;
+    bool runForcesLeftExpansion = (m_run.expansionBehavior() & LeftExpansionMask) == ForceLeftExpansion;
+    bool runForcesRightExpansion = (m_run.expansionBehavior() & RightExpansionMask) == ForceRightExpansion;
+    bool runForbidsLeftExpansion = (m_run.expansionBehavior() & LeftExpansionMask) == ForbidLeftExpansion;
+    bool runForbidsRightExpansion = (m_run.expansionBehavior() & RightExpansionMask) == ForbidRightExpansion;
 
     // We are iterating in glyph order, not string order. Compare this to WidthIterator::advanceInternal()
     for (size_t runIndex = 0; runIndex < runCount; ++runIndex) {
@@ -740,25 +740,25 @@
                 bool isFirstCharacter = !(characterIndex + complexTextRun.stringLocation());
                 bool isLastCharacter = characterIndexInRun + 1 == m_run.length() || (U16_IS_LEAD(ch) && characterIndexInRun + 2 == m_run.length() && U16_IS_TRAIL(*(cp + characterIndex + 1)));
 
-                bool forceLeadingExpansion = false; // On the left, regardless of m_run.ltr()
-                bool forceTrailingExpansion = false; // On the right, regardless of m_run.ltr()
-                bool forbidLeadingExpansion = false;
-                bool forbidTrailingExpansion = false;
-                if (runForcesLeadingExpansion)
-                    forceLeadingExpansion = m_run.ltr() ? isFirstCharacter : isLastCharacter;
-                if (runForcesTrailingExpansion)
-                    forceTrailingExpansion = m_run.ltr() ? isLastCharacter : isFirstCharacter;
-                if (runForbidsLeadingExpansion)
-                    forbidLeadingExpansion = m_run.ltr() ? isFirstCharacter : isLastCharacter;
-                if (runForbidsTrailingExpansion)
-                    forbidTrailingExpansion = m_run.ltr() ? isLastCharacter : isFirstCharacter;
+                bool forceLeftExpansion = false; // On the left, regardless of m_run.ltr()
+                bool forceRightExpansion = false; // On the right, regardless of m_run.ltr()
+                bool forbidLeftExpansion = false;
+                bool forbidRightExpansion = false;
+                if (runForcesLeftExpansion)
+                    forceLeftExpansion = m_run.ltr() ? isFirstCharacter : isLastCharacter;
+                if (runForcesRightExpansion)
+                    forceRightExpansion = m_run.ltr() ? isLastCharacter : isFirstCharacter;
+                if (runForbidsLeftExpansion)
+                    forbidLeftExpansion = m_run.ltr() ? isFirstCharacter : isLastCharacter;
+                if (runForbidsRightExpansion)
+                    forbidRightExpansion = m_run.ltr() ? isLastCharacter : isFirstCharacter;
                 // Handle justification and word-spacing.
                 static bool expandAroundIdeographs = FontCascade::canExpandAroundIdeographsInComplexText();
                 bool ideograph = expandAroundIdeographs && FontCascade::isCJKIdeographOrSymbol(ch);
-                if (treatAsSpace || ideograph || forceLeadingExpansion || forceTrailingExpansion) {
+                if (treatAsSpace || ideograph || forceLeftExpansion || forceRightExpansion) {
                     // Distribute the run's total expansion evenly over all expansion opportunities in the run.
                     if (m_expansion) {
-                        auto [expandLeft, expandRight] = expansionLocation(ideograph, treatAsSpace, m_run.ltr(), afterExpansion, forbidLeadingExpansion, forbidTrailingExpansion, forceLeadingExpansion, forceTrailingExpansion);
+                        auto [expandLeft, expandRight] = expansionLocation(ideograph, treatAsSpace, m_run.ltr(), afterExpansion, forbidLeftExpansion, forbidRightExpansion, forceLeftExpansion, forceRightExpansion);
                         if (expandLeft) {
                             m_expansion -= m_expansionPerOpportunity;
                             // Increase previous width

Modified: trunk/Source/WebCore/platform/graphics/FontCascade.cpp (265337 => 265338)


--- trunk/Source/WebCore/platform/graphics/FontCascade.cpp	2020-08-06 17:58:13 UTC (rev 265337)
+++ trunk/Source/WebCore/platform/graphics/FontCascade.cpp	2020-08-06 18:03:01 UTC (rev 265338)
@@ -1086,8 +1086,8 @@
 std::pair<unsigned, bool> FontCascade::expansionOpportunityCountInternal(const LChar* characters, unsigned length, TextDirection direction, ExpansionBehavior expansionBehavior)
 {
     unsigned count = 0;
-    bool isAfterExpansion = (expansionBehavior & LeadingExpansionMask) == ForbidLeadingExpansion;
-    if ((expansionBehavior & LeadingExpansionMask) == ForceLeadingExpansion) {
+    bool isAfterExpansion = (expansionBehavior & LeftExpansionMask) == ForbidLeftExpansion;
+    if ((expansionBehavior & LeftExpansionMask) == ForceLeftExpansion) {
         ++count;
         isAfterExpansion = true;
     }
@@ -1108,10 +1108,10 @@
                 isAfterExpansion = false;
         }
     }
-    if (!isAfterExpansion && (expansionBehavior & TrailingExpansionMask) == ForceTrailingExpansion) {
+    if (!isAfterExpansion && (expansionBehavior & RightExpansionMask) == ForceRightExpansion) {
         ++count;
         isAfterExpansion = true;
-    } else if (isAfterExpansion && (expansionBehavior & TrailingExpansionMask) == ForbidTrailingExpansion) {
+    } else if (isAfterExpansion && (expansionBehavior & RightExpansionMask) == ForbidRightExpansion) {
         ASSERT(count);
         --count;
         isAfterExpansion = false;
@@ -1123,8 +1123,8 @@
 {
     static bool expandAroundIdeographs = canExpandAroundIdeographsInComplexText();
     unsigned count = 0;
-    bool isAfterExpansion = (expansionBehavior & LeadingExpansionMask) == ForbidLeadingExpansion;
-    if ((expansionBehavior & LeadingExpansionMask) == ForceLeadingExpansion) {
+    bool isAfterExpansion = (expansionBehavior & LeftExpansionMask) == ForbidLeftExpansion;
+    if ((expansionBehavior & LeftExpansionMask) == ForceLeftExpansion) {
         ++count;
         isAfterExpansion = true;
     }
@@ -1171,10 +1171,10 @@
             isAfterExpansion = false;
         }
     }
-    if (!isAfterExpansion && (expansionBehavior & TrailingExpansionMask) == ForceTrailingExpansion) {
+    if (!isAfterExpansion && (expansionBehavior & RightExpansionMask) == ForceRightExpansion) {
         ++count;
         isAfterExpansion = true;
-    } else if (isAfterExpansion && (expansionBehavior & TrailingExpansionMask) == ForbidTrailingExpansion) {
+    } else if (isAfterExpansion && (expansionBehavior & RightExpansionMask) == ForbidRightExpansion) {
         ASSERT(count);
         --count;
         isAfterExpansion = false;
@@ -1193,7 +1193,7 @@
     return expansionOpportunityCountInternal(stringView.characters16(), stringView.length(), direction, expansionBehavior);
 }
 
-bool FontCascade::leadingExpansionOpportunity(const StringView& stringView, TextDirection direction)
+bool FontCascade::leftExpansionOpportunity(const StringView& stringView, TextDirection direction)
 {
     if (!stringView.length())
         return false;
@@ -1212,7 +1212,7 @@
     return canExpandAroundIdeographsInComplexText() && isCJKIdeographOrSymbol(initialCharacter);
 }
 
-bool FontCascade::trailingExpansionOpportunity(const StringView& stringView, TextDirection direction)
+bool FontCascade::rightExpansionOpportunity(const StringView& stringView, TextDirection direction)
 {
     if (!stringView.length())
         return false;

Modified: trunk/Source/WebCore/platform/graphics/FontCascade.h (265337 => 265338)


--- trunk/Source/WebCore/platform/graphics/FontCascade.h	2020-08-06 17:58:13 UTC (rev 265337)
+++ trunk/Source/WebCore/platform/graphics/FontCascade.h	2020-08-06 18:03:01 UTC (rev 265338)
@@ -174,10 +174,8 @@
 
     // Whether or not there is an expansion opportunity just before the first character
     // Note that this does not take a isAfterExpansion flag; this assumes that isAfterExpansion is false
-    // Here, "Leading" and "Trailing" are relevant after the line has been rearranged for bidi.
-    // ("Leading" means "left" and "Trailing" means "right.")
-    static bool leadingExpansionOpportunity(const StringView&, TextDirection);
-    static bool trailingExpansionOpportunity(const StringView&, TextDirection);
+    static bool leftExpansionOpportunity(const StringView&, TextDirection);
+    static bool rightExpansionOpportunity(const StringView&, TextDirection);
 
     WEBCORE_EXPORT static void setShouldUseSmoothing(bool);
     WEBCORE_EXPORT static bool shouldUseSmoothing();

Modified: trunk/Source/WebCore/platform/graphics/WidthIterator.cpp (265337 => 265338)


--- trunk/Source/WebCore/platform/graphics/WidthIterator.cpp	2020-08-06 17:58:13 UTC (rev 265337)
+++ trunk/Source/WebCore/platform/graphics/WidthIterator.cpp	2020-08-06 18:03:01 UTC (rev 265338)
@@ -39,7 +39,7 @@
     , m_run(run)
     , m_fallbackFonts(fallbackFonts)
     , m_expansion(run.expansion())
-    , m_isAfterExpansion((run.expansionBehavior() & LeadingExpansionMask) == ForbidLeadingExpansion)
+    , m_isAfterExpansion((run.expansionBehavior() & LeftExpansionMask) == ForbidLeftExpansion)
     , m_accountForGlyphBounds(accountForGlyphBounds)
     , m_enableKerning(font->enableKerning())
     , m_requiresShaping(font->requiresShaping())
@@ -139,7 +139,7 @@
     return afterWidth - beforeWidth;
 }
 
-static inline std::pair<bool, bool> expansionLocation(bool ideograph, bool treatAsSpace, bool ltr, bool isAfterExpansion, bool forbidLeadingExpansion, bool forbidTrailingExpansion, bool forceLeadingExpansion, bool forceTrailingExpansion)
+static inline std::pair<bool, bool> expansionLocation(bool ideograph, bool treatAsSpace, bool ltr, bool isAfterExpansion, bool forbidLeftExpansion, bool forbidRightExpansion, bool forceLeftExpansion, bool forceRightExpansion)
 {
     bool expandLeft = ideograph;
     bool expandRight = ideograph;
@@ -155,15 +155,15 @@
         else
             expandRight = false;
     }
-    ASSERT(!forbidLeadingExpansion || !forceLeadingExpansion);
-    ASSERT(!forbidTrailingExpansion || !forceTrailingExpansion);
-    if (forbidLeadingExpansion)
+    ASSERT(!forbidLeftExpansion || !forceLeftExpansion);
+    ASSERT(!forbidRightExpansion || !forceRightExpansion);
+    if (forbidLeftExpansion)
         expandLeft = false;
-    if (forbidTrailingExpansion)
+    if (forbidRightExpansion)
         expandRight = false;
-    if (forceLeadingExpansion)
+    if (forceLeftExpansion)
         expandLeft = true;
-    if (forceTrailingExpansion)
+    if (forceRightExpansion)
         expandRight = true;
     return std::make_pair(expandLeft, expandRight);
 }
@@ -175,10 +175,10 @@
     bool rtl = m_run.rtl();
     bool hasExtraSpacing = (m_font->letterSpacing() || m_font->wordSpacing() || m_expansion) && !m_run.spacingDisabled();
 
-    bool runForcesLeadingExpansion = (m_run.expansionBehavior() & LeadingExpansionMask) == ForceLeadingExpansion;
-    bool runForcesTrailingExpansion = (m_run.expansionBehavior() & TrailingExpansionMask) == ForceTrailingExpansion;
-    bool runForbidsLeadingExpansion = (m_run.expansionBehavior() & LeadingExpansionMask) == ForbidLeadingExpansion;
-    bool runForbidsTrailingExpansion = (m_run.expansionBehavior() & TrailingExpansionMask) == ForbidTrailingExpansion;
+    bool runForcesLeftExpansion = (m_run.expansionBehavior() & LeftExpansionMask) == ForceLeftExpansion;
+    bool runForcesRightExpansion = (m_run.expansionBehavior() & RightExpansionMask) == ForceRightExpansion;
+    bool runForbidsLeftExpansion = (m_run.expansionBehavior() & LeftExpansionMask) == ForbidLeftExpansion;
+    bool runForbidsRightExpansion = (m_run.expansionBehavior() & RightExpansionMask) == ForbidRightExpansion;
     float widthSinceLastRounding = m_runWidthSoFar;
     float leftoverJustificationWidth = 0;
     m_runWidthSoFar = floorf(m_runWidthSoFar);
@@ -262,23 +262,23 @@
             static bool expandAroundIdeographs = FontCascade::canExpandAroundIdeographsInComplexText();
             bool treatAsSpace = FontCascade::treatAsSpace(character);
             bool currentIsLastCharacter = currentCharacterIndex + advanceLength == static_cast<size_t>(m_run.length());
-            bool forceLeadingExpansion = false; // On the left, regardless of m_run.ltr()
-            bool forceTrailingExpansion = false; // On the right, regardless of m_run.ltr()
-            bool forbidLeadingExpansion = false;
-            bool forbidTrailingExpansion = false;
-            if (runForcesLeadingExpansion)
-                forceLeadingExpansion = m_run.ltr() ? !currentCharacterIndex : currentIsLastCharacter;
-            if (runForcesTrailingExpansion)
-                forceTrailingExpansion = m_run.ltr() ? currentIsLastCharacter : !currentCharacterIndex;
-            if (runForbidsLeadingExpansion)
-                forbidLeadingExpansion = m_run.ltr() ? !currentCharacterIndex : currentIsLastCharacter;
-            if (runForbidsTrailingExpansion)
-                forbidTrailingExpansion = m_run.ltr() ? currentIsLastCharacter : !currentCharacterIndex;
+            bool forceLeftExpansion = false; // On the left, regardless of m_run.ltr()
+            bool forceRightExpansion = false; // On the right, regardless of m_run.ltr()
+            bool forbidLeftExpansion = false;
+            bool forbidRightExpansion = false;
+            if (runForcesLeftExpansion)
+                forceLeftExpansion = m_run.ltr() ? !currentCharacterIndex : currentIsLastCharacter;
+            if (runForcesRightExpansion)
+                forceRightExpansion = m_run.ltr() ? currentIsLastCharacter : !currentCharacterIndex;
+            if (runForbidsLeftExpansion)
+                forbidLeftExpansion = m_run.ltr() ? !currentCharacterIndex : currentIsLastCharacter;
+            if (runForbidsRightExpansion)
+                forbidRightExpansion = m_run.ltr() ? currentIsLastCharacter : !currentCharacterIndex;
             bool ideograph = (expandAroundIdeographs && FontCascade::isCJKIdeographOrSymbol(character));
-            if (treatAsSpace || ideograph || forceLeadingExpansion || forceTrailingExpansion) {
+            if (treatAsSpace || ideograph || forceLeftExpansion || forceRightExpansion) {
                 // Distribute the run's total expansion evenly over all expansion opportunities in the run.
                 if (m_expansion) {
-                    auto [expandLeft, expandRight] = expansionLocation(ideograph, treatAsSpace, m_run.ltr(), m_isAfterExpansion, forbidLeadingExpansion, forbidTrailingExpansion, forceLeadingExpansion, forceTrailingExpansion);
+                    auto [expandLeft, expandRight] = expansionLocation(ideograph, treatAsSpace, m_run.ltr(), m_isAfterExpansion, forbidLeftExpansion, forbidRightExpansion, forceLeftExpansion, forceRightExpansion);
                     if (expandLeft) {
                         if (m_run.ltr()) {
                             // Increase previous width

Modified: trunk/Source/WebCore/platform/text/TextFlags.h (265337 => 265338)


--- trunk/Source/WebCore/platform/text/TextFlags.h	2020-08-06 17:58:13 UTC (rev 265337)
+++ trunk/Source/WebCore/platform/text/TextFlags.h	2020-08-06 18:03:01 UTC (rev 265338)
@@ -61,20 +61,18 @@
     Upright
 };
 
-// Here, "Leading" and "Trailing" are relevant after the line has been rearranged for bidi.
-// ("Leading" means "left" and "Trailing" means "right.")
 enum ExpansionBehaviorFlags {
-    ForbidTrailingExpansion = 0 << 0,
-    AllowTrailingExpansion = 1 << 0,
-    ForceTrailingExpansion = 2 << 0,
-    TrailingExpansionMask = 3 << 0,
+    ForbidRightExpansion = 0 << 0,
+    AllowRightExpansion = 1 << 0,
+    ForceRightExpansion = 2 << 0,
+    RightExpansionMask = 3 << 0,
 
-    ForbidLeadingExpansion = 0 << 2,
-    AllowLeadingExpansion = 1 << 2,
-    ForceLeadingExpansion = 2 << 2,
-    LeadingExpansionMask = 3 << 2,
+    ForbidLeftExpansion = 0 << 2,
+    AllowLeftExpansion = 1 << 2,
+    ForceLeftExpansion = 2 << 2,
+    LeftExpansionMask = 3 << 2,
 
-    DefaultExpansion = AllowTrailingExpansion | ForbidLeadingExpansion,
+    DefaultExpansion = AllowRightExpansion | ForbidLeftExpansion,
 };
 typedef unsigned ExpansionBehavior;
 

Modified: trunk/Source/WebCore/platform/win/PopupMenuWin.cpp (265337 => 265338)


--- trunk/Source/WebCore/platform/win/PopupMenuWin.cpp	2020-08-06 17:58:13 UTC (rev 265337)
+++ trunk/Source/WebCore/platform/win/PopupMenuWin.cpp	2020-08-06 18:03:01 UTC (rev 265338)
@@ -643,7 +643,7 @@
 
         String itemText = client()->itemText(index);
 
-        TextRun textRun(itemText, 0, 0, AllowTrailingExpansion, itemStyle.textDirection(), itemStyle.hasTextDirectionOverride());
+        TextRun textRun(itemText, 0, 0, AllowLeftExpansion, itemStyle.textDirection(), itemStyle.hasTextDirectionOverride());
         context.setFillColor(optionTextColor);
 
         FontCascade itemFont = m_font;

Modified: trunk/Source/WebCore/rendering/ComplexLineLayout.cpp (265337 => 265338)


--- trunk/Source/WebCore/rendering/ComplexLineLayout.cpp	2020-08-06 17:58:13 UTC (rev 265337)
+++ trunk/Source/WebCore/rendering/ComplexLineLayout.cpp	2020-08-06 18:03:01 UTC (rev 265338)
@@ -734,11 +734,11 @@
 {
     // Tatechuyoko is modeled as the Object Replacement Character (U+FFFC), which can never have expansion opportunities inside nor intrinsically adjacent to it.
     if (textBox.renderer().style().textCombine() == TextCombine::Horizontal)
-        return ForbidLeadingExpansion | ForbidTrailingExpansion;
+        return ForbidLeftExpansion | ForbidRightExpansion;
 
     ExpansionBehavior result = 0;
-    bool setLeadingExpansion = false;
-    bool setTrailingExpansion = false;
+    bool setLeftExpansion = false;
+    bool setRightExpansion = false;
     if (textAlign == TextAlignMode::Justify) {
         // If the next box is ruby, and we're justifying, and the first box in the ruby base has a leading expansion, and we are a text box, then force a trailing expansion.
         if (nextRun && is<RenderRubyRun>(nextRun->renderer()) && downcast<RenderRubyRun>(nextRun->renderer()).rubyBase() && nextRun->renderer().style().collapseWhiteSpace()) {
@@ -746,10 +746,10 @@
             if (rubyBase.firstRootBox() && !rubyBase.firstRootBox()->nextRootBox()) {
                 if (auto* leafChild = rubyBase.firstRootBox()->firstLeafDescendant()) {
                     if (is<InlineTextBox>(*leafChild)) {
-                        // FIXME: This leadingExpansionOpportunity doesn't actually work because it doesn't perform the UBA
-                        if (FontCascade::leadingExpansionOpportunity(downcast<RenderText>(leafChild->renderer()).stringView(), leafChild->direction())) {
-                            setTrailingExpansion = true;
-                            result |= ForceTrailingExpansion;
+                        // FIXME: This leftExpansionOpportunity doesn't actually work because it doesn't perform the UBA
+                        if (FontCascade::leftExpansionOpportunity(downcast<RenderText>(leafChild->renderer()).stringView(), leafChild->direction())) {
+                            setRightExpansion = true;
+                            result |= ForceRightExpansion;
                         }
                     }
                 }
@@ -761,10 +761,10 @@
             if (rubyBase.firstRootBox() && !rubyBase.firstRootBox()->nextRootBox()) {
                 if (auto* leafChild = rubyBase.firstRootBox()->lastLeafDescendant()) {
                     if (is<InlineTextBox>(*leafChild)) {
-                        // FIXME: This leadingExpansionOpportunity doesn't actually work because it doesn't perform the UBA
-                        if (FontCascade::trailingExpansionOpportunity(downcast<RenderText>(leafChild->renderer()).stringView(), leafChild->direction())) {
-                            setLeadingExpansion = true;
-                            result |= ForceLeadingExpansion;
+                        // FIXME: This leftExpansionOpportunity doesn't actually work because it doesn't perform the UBA
+                        if (FontCascade::rightExpansionOpportunity(downcast<RenderText>(leafChild->renderer()).stringView(), leafChild->direction())) {
+                            setLeftExpansion = true;
+                            result |= ForceLeftExpansion;
                         }
                     }
                 }
@@ -774,46 +774,46 @@
         if (is<RenderRubyBase>(block)) {
             RenderRubyBase& rubyBase = downcast<RenderRubyBase>(block);
             if (&textBox == rubyBase.firstRootBox()->firstLeafDescendant()) {
-                setLeadingExpansion = true;
-                result |= ForbidLeadingExpansion;
+                setLeftExpansion = true;
+                result |= ForbidLeftExpansion;
             } if (&textBox == rubyBase.firstRootBox()->lastLeafDescendant()) {
-                setTrailingExpansion = true;
-                result |= ForbidTrailingExpansion;
+                setRightExpansion = true;
+                result |= ForbidRightExpansion;
             }
         }
     }
-    if (!setLeadingExpansion)
-        result |= isAfterExpansion ? ForbidLeadingExpansion : AllowLeadingExpansion;
-    if (!setTrailingExpansion)
-        result |= AllowTrailingExpansion;
+    if (!setLeftExpansion)
+        result |= isAfterExpansion ? ForbidLeftExpansion : AllowLeftExpansion;
+    if (!setRightExpansion)
+        result |= AllowRightExpansion;
     return result;
 }
 
 static inline void applyExpansionBehavior(InlineTextBox& textBox, ExpansionBehavior expansionBehavior)
 {
-    switch (expansionBehavior & LeadingExpansionMask) {
-    case ForceLeadingExpansion:
-        textBox.setForceLeadingExpansion();
+    switch (expansionBehavior & LeftExpansionMask) {
+    case ForceLeftExpansion:
+        textBox.setForceLeftExpansion();
         break;
-    case ForbidLeadingExpansion:
-        textBox.setCanHaveLeadingExpansion(false);
+    case ForbidLeftExpansion:
+        textBox.setCanHaveLeftExpansion(false);
         break;
-    case AllowLeadingExpansion:
-        textBox.setCanHaveLeadingExpansion(true);
+    case AllowLeftExpansion:
+        textBox.setCanHaveLeftExpansion(true);
         break;
     default:
         ASSERT_NOT_REACHED();
         break;
     }
-    switch (expansionBehavior & TrailingExpansionMask) {
-    case ForceTrailingExpansion:
-        textBox.setForceTrailingExpansion();
+    switch (expansionBehavior & RightExpansionMask) {
+    case ForceRightExpansion:
+        textBox.setForceRightExpansion();
         break;
-    case ForbidTrailingExpansion:
-        textBox.setCanHaveTrailingExpansion(false);
+    case ForbidRightExpansion:
+        textBox.setCanHaveRightExpansion(false);
         break;
-    case AllowTrailingExpansion:
-        textBox.setCanHaveTrailingExpansion(true);
+    case AllowRightExpansion:
+        textBox.setCanHaveRightExpansion(true);
         break;
     default:
         ASSERT_NOT_REACHED();

Modified: trunk/Source/WebCore/rendering/EllipsisBox.cpp (265337 => 265338)


--- trunk/Source/WebCore/rendering/EllipsisBox.cpp	2020-08-06 17:58:13 UTC (rev 265337)
+++ trunk/Source/WebCore/rendering/EllipsisBox.cpp	2020-08-06 18:03:01 UTC (rev 265338)
@@ -70,7 +70,7 @@
     }
 
     // FIXME: Why is this always LTR? Fix by passing correct text run flags below.
-    context.drawText(font, RenderBlock::constructTextRun(m_str, lineStyle, AllowTrailingExpansion), LayoutPoint(x() + paintOffset.x(), y() + paintOffset.y() + lineStyle.fontMetrics().ascent()));
+    context.drawText(font, RenderBlock::constructTextRun(m_str, lineStyle, AllowRightExpansion), LayoutPoint(x() + paintOffset.x(), y() + paintOffset.y() + lineStyle.fontMetrics().ascent()));
 
     // Restore the regular fill color.
     if (textColor != context.fillColor())
@@ -119,7 +119,7 @@
     const RootInlineBox& rootBox = root();
     // FIXME: Why is this always LTR? Fix by passing correct text run flags below.
     LayoutRect selectionRect { LayoutUnit(x()), LayoutUnit(y() + rootBox.selectionTopAdjustedForPrecedingBlock()), 0_lu, rootBox.selectionHeightAdjustedForPrecedingBlock() };
-    font.adjustSelectionRectForText(RenderBlock::constructTextRun(m_str, lineStyle, AllowTrailingExpansion), selectionRect);
+    font.adjustSelectionRectForText(RenderBlock::constructTextRun(m_str, lineStyle, AllowRightExpansion), selectionRect);
     // FIXME: use directional pixel snapping instead.
     return enclosingIntRect(selectionRect);
 }
@@ -140,7 +140,7 @@
     GraphicsContextStateSaver stateSaver(context);
     // FIXME: Why is this always LTR? Fix by passing correct text run flags below.
     LayoutRect selectionRect { LayoutUnit(x() + paintOffset.x()), LayoutUnit(y() + paintOffset.y() + rootBox.selectionTop()), 0_lu, rootBox.selectionHeight() };
-    TextRun run = RenderBlock::constructTextRun(m_str, style, AllowTrailingExpansion);
+    TextRun run = RenderBlock::constructTextRun(m_str, style, AllowRightExpansion);
     font.adjustSelectionRectForText(run, selectionRect);
     context.fillRect(snapRectToDevicePixelsWithWritingDirection(selectionRect, renderer().document().deviceScaleFactor(), run.ltr()), c);
 }

Modified: trunk/Source/WebCore/rendering/InlineBox.h (265337 => 265338)


--- trunk/Source/WebCore/rendering/InlineBox.h	2020-08-06 17:58:13 UTC (rev 265337)
+++ trunk/Source/WebCore/rendering/InlineBox.h	2020-08-06 18:03:01 UTC (rev 265338)
@@ -281,10 +281,10 @@
     float expansion() const { return m_expansion; }
 
     void setHasHyphen(bool hasHyphen) { m_bitfields.setHasEllipsisBoxOrHyphen(hasHyphen); }
-    void setCanHaveLeadingExpansion(bool canHaveLeadingExpansion) { m_bitfields.setHasSelectedChildrenOrCanHaveLeadingExpansion(canHaveLeadingExpansion); }
-    void setCanHaveTrailingExpansion(bool canHaveTrailingExpansion) { m_bitfields.setCanHaveTrailingExpansion(canHaveTrailingExpansion); }
-    void setForceTrailingExpansion() { m_bitfields.setForceTrailingExpansion(true); }
-    void setForceLeadingExpansion() { m_bitfields.setForceLeadingExpansion(true); }
+    void setCanHaveLeftExpansion(bool canHaveLeftExpansion) { m_bitfields.setHasSelectedChildrenOrCanHaveLeftExpansion(canHaveLeftExpansion); }
+    void setCanHaveRightExpansion(bool canHaveRightExpansion) { m_bitfields.setCanHaveRightExpansion(canHaveRightExpansion); }
+    void setForceRightExpansion() { m_bitfields.setForceRightExpansion(true); }
+    void setForceLeftExpansion() { m_bitfields.setForceLeftExpansion(true); }
 
 private:
     InlineBox* m_nextOnLine { nullptr }; // The next element on the same line as us.
@@ -317,14 +317,14 @@
             , m_hasVirtualLogicalHeight(false)
             , m_isHorizontal(isHorizontal)
             , m_endsWithBreak(false)
-            , m_hasSelectedChildrenOrCanHaveLeadingExpansion(false)
-            , m_canHaveTrailingExpansion(false)
+            , m_hasSelectedChildrenOrCanHaveLeftExpansion(false)
+            , m_canHaveRightExpansion(false)
             , m_knownToHaveNoOverflow(true)  
             , m_hasEllipsisBoxOrHyphen(false)
             , m_dirOverride(false)
             , m_behavesLikeText(false)
-            , m_forceTrailingExpansion(false)
-            , m_forceLeadingExpansion(false)
+            , m_forceRightExpansion(false)
+            , m_forceLeftExpansion(false)
             , m_determinedIfNextOnLineExists(false)
             , m_nextOnLineExists(false)
         {
@@ -349,15 +349,15 @@
         // for RootInlineBox
         ADD_BOOLEAN_BITFIELD(endsWithBreak, EndsWithBreak); // Whether the line ends with a <br>.
         // shared between RootInlineBox and InlineTextBox
-        ADD_BOOLEAN_BITFIELD(hasSelectedChildrenOrCanHaveLeadingExpansion, HasSelectedChildrenOrCanHaveLeadingExpansion);
-        ADD_BOOLEAN_BITFIELD(canHaveTrailingExpansion, CanHaveTrailingExpansion);
+        ADD_BOOLEAN_BITFIELD(hasSelectedChildrenOrCanHaveLeftExpansion, HasSelectedChildrenOrCanHaveLeftExpansion);
+        ADD_BOOLEAN_BITFIELD(canHaveRightExpansion, CanHaveRightExpansion);
         ADD_BOOLEAN_BITFIELD(knownToHaveNoOverflow, KnownToHaveNoOverflow);
         ADD_BOOLEAN_BITFIELD(hasEllipsisBoxOrHyphen, HasEllipsisBoxOrHyphen);
         // for InlineTextBox
         ADD_BOOLEAN_BITFIELD(dirOverride, DirOverride);
         ADD_BOOLEAN_BITFIELD(behavesLikeText, BehavesLikeText); // Whether or not this object represents text with a non-zero height. Includes non-image list markers, text boxes, br.
-        ADD_BOOLEAN_BITFIELD(forceTrailingExpansion, ForceTrailingExpansion);
-        ADD_BOOLEAN_BITFIELD(forceLeadingExpansion, ForceLeadingExpansion);
+        ADD_BOOLEAN_BITFIELD(forceRightExpansion, ForceRightExpansion);
+        ADD_BOOLEAN_BITFIELD(forceLeftExpansion, ForceLeftExpansion);
 
     private:
         mutable unsigned m_determinedIfNextOnLineExists : 1;
@@ -398,16 +398,16 @@
     bool endsWithBreak() const { return m_bitfields.endsWithBreak(); }
     void setEndsWithBreak(bool endsWithBreak) { m_bitfields.setEndsWithBreak(endsWithBreak); }
     bool hasEllipsisBox() const { return m_bitfields.hasEllipsisBoxOrHyphen(); }
-    bool hasSelectedChildren() const { return m_bitfields.hasSelectedChildrenOrCanHaveLeadingExpansion(); }
-    void setHasSelectedChildren(bool hasSelectedChildren) { m_bitfields.setHasSelectedChildrenOrCanHaveLeadingExpansion(hasSelectedChildren); }
+    bool hasSelectedChildren() const { return m_bitfields.hasSelectedChildrenOrCanHaveLeftExpansion(); }
+    void setHasSelectedChildren(bool hasSelectedChildren) { m_bitfields.setHasSelectedChildrenOrCanHaveLeftExpansion(hasSelectedChildren); }
     void setHasEllipsisBox(bool hasEllipsisBox) { m_bitfields.setHasEllipsisBoxOrHyphen(hasEllipsisBox); }
 
     // For InlineTextBox
     bool hasHyphen() const { return m_bitfields.hasEllipsisBoxOrHyphen(); }
-    bool canHaveLeadingExpansion() const { return m_bitfields.hasSelectedChildrenOrCanHaveLeadingExpansion(); }
-    bool canHaveTrailingExpansion() const { return m_bitfields.canHaveTrailingExpansion(); }
-    bool forceTrailingExpansion() const { return m_bitfields.forceTrailingExpansion(); }
-    bool forceLeadingExpansion() const { return m_bitfields.forceLeadingExpansion(); }
+    bool canHaveLeftExpansion() const { return m_bitfields.hasSelectedChildrenOrCanHaveLeftExpansion(); }
+    bool canHaveRightExpansion() const { return m_bitfields.canHaveRightExpansion(); }
+    bool forceRightExpansion() const { return m_bitfields.forceRightExpansion(); }
+    bool forceLeftExpansion() const { return m_bitfields.forceLeftExpansion(); }
     
     // For InlineFlowBox and InlineTextBox
     bool extracted() const { return m_bitfields.extracted(); }

Modified: trunk/Source/WebCore/rendering/InlineTextBox.cpp (265337 => 265338)


--- trunk/Source/WebCore/rendering/InlineTextBox.cpp	2020-08-06 17:58:13 UTC (rev 265337)
+++ trunk/Source/WebCore/rendering/InlineTextBox.cpp	2020-08-06 18:03:01 UTC (rev 265338)
@@ -1440,23 +1440,23 @@
 
 ExpansionBehavior InlineTextBox::expansionBehavior() const
 {
-    ExpansionBehavior leadingBehavior;
-    if (forceLeadingExpansion())
-        leadingBehavior = ForceLeadingExpansion;
-    else if (canHaveLeadingExpansion())
-        leadingBehavior = AllowLeadingExpansion;
+    ExpansionBehavior leftBehavior;
+    if (forceLeftExpansion())
+        leftBehavior = ForceLeftExpansion;
+    else if (canHaveLeftExpansion())
+        leftBehavior = AllowLeftExpansion;
     else
-        leadingBehavior = ForbidLeadingExpansion;
+        leftBehavior = ForbidLeftExpansion;
 
-    ExpansionBehavior trailingBehavior;
-    if (forceTrailingExpansion())
-        trailingBehavior = ForceTrailingExpansion;
+    ExpansionBehavior rightBehavior;
+    if (forceRightExpansion())
+        rightBehavior = ForceRightExpansion;
     else if (expansion() && nextLeafOnLine() && !nextLeafOnLine()->isLineBreak())
-        trailingBehavior = AllowTrailingExpansion;
+        rightBehavior = AllowRightExpansion;
     else
-        trailingBehavior = ForbidTrailingExpansion;
+        rightBehavior = ForbidRightExpansion;
 
-    return leadingBehavior | trailingBehavior;
+    return leftBehavior | rightBehavior;
 }
 
 #if ENABLE(TREE_DEBUGGING)

Modified: trunk/Source/WebCore/rendering/InlineTextBox.h (265337 => 265338)


--- trunk/Source/WebCore/rendering/InlineTextBox.h	2020-08-06 17:58:13 UTC (rev 265337)
+++ trunk/Source/WebCore/rendering/InlineTextBox.h	2020-08-06 18:03:01 UTC (rev 265338)
@@ -80,14 +80,14 @@
 
     using InlineBox::hasHyphen;
     using InlineBox::setHasHyphen;
-    using InlineBox::canHaveLeadingExpansion;
-    using InlineBox::setCanHaveLeadingExpansion;
-    using InlineBox::canHaveTrailingExpansion;
-    using InlineBox::setCanHaveTrailingExpansion;
-    using InlineBox::forceTrailingExpansion;
-    using InlineBox::setForceTrailingExpansion;
-    using InlineBox::forceLeadingExpansion;
-    using InlineBox::setForceLeadingExpansion;
+    using InlineBox::canHaveLeftExpansion;
+    using InlineBox::setCanHaveLeftExpansion;
+    using InlineBox::canHaveRightExpansion;
+    using InlineBox::setCanHaveRightExpansion;
+    using InlineBox::forceRightExpansion;
+    using InlineBox::setForceRightExpansion;
+    using InlineBox::forceLeftExpansion;
+    using InlineBox::setForceLeftExpansion;
 
     static inline bool compareByStart(const InlineTextBox* first, const InlineTextBox* second) { return first->start() < second->start(); }
 

Modified: trunk/Source/WebCore/rendering/RenderFileUploadControl.cpp (265337 => 265338)


--- trunk/Source/WebCore/rendering/RenderFileUploadControl.cpp	2020-08-06 17:58:13 UTC (rev 265337)
+++ trunk/Source/WebCore/rendering/RenderFileUploadControl.cpp	2020-08-06 18:03:01 UTC (rev 265338)
@@ -134,7 +134,7 @@
     if (paintInfo.phase == PaintPhase::Foreground) {
         const String& displayedFilename = fileTextValue();
         const FontCascade& font = style().fontCascade();
-        TextRun textRun = constructTextRun(displayedFilename, style(), AllowTrailingExpansion, RespectDirection | RespectDirectionOverride);
+        TextRun textRun = constructTextRun(displayedFilename, style(), AllowRightExpansion, RespectDirection | RespectDirectionOverride);
 
 #if PLATFORM(IOS_FAMILY)
         int iconHeight = nodeHeight(uploadButton());
@@ -203,10 +203,10 @@
     const String characterAsString = String(&character, 1);
     const FontCascade& font = style().fontCascade();
     // FIXME: Remove the need for this const_cast by making constructTextRun take a const RenderObject*.
-    float minDefaultLabelWidth = defaultWidthNumChars * font.width(constructTextRun(characterAsString, style(), AllowTrailingExpansion));
+    float minDefaultLabelWidth = defaultWidthNumChars * font.width(constructTextRun(characterAsString, style(), AllowRightExpansion));
 
     const String label = theme().fileListDefaultLabel(inputElement().multiple());
-    float defaultLabelWidth = font.width(constructTextRun(label, style(), AllowTrailingExpansion));
+    float defaultLabelWidth = font.width(constructTextRun(label, style(), AllowRightExpansion));
     if (HTMLInputElement* button = uploadButton())
         if (RenderObject* buttonRenderer = button->renderer())
             defaultLabelWidth += buttonRenderer->maxPreferredLogicalWidth() + afterButtonSpacing;

Modified: trunk/Source/WebCore/rendering/RenderListBox.cpp (265337 => 265338)


--- trunk/Source/WebCore/rendering/RenderListBox.cpp	2020-08-06 17:58:13 UTC (rev 265337)
+++ trunk/Source/WebCore/rendering/RenderListBox.cpp	2020-08-06 18:03:01 UTC (rev 265338)
@@ -148,7 +148,7 @@
             if (text.isEmpty())
                 continue;
             text = applyTextTransform(style(), text, ' ');
-            auto textRun = constructTextRun(text, style(), AllowTrailingExpansion);
+            auto textRun = constructTextRun(text, style(), AllowRightExpansion);
             width = std::max(width, selectFont().width(textRun));
         }
         // FIXME: Is ceiling right here, or should we be doing some kind of rounding instead?
@@ -435,7 +435,7 @@
 
     paintInfo.context().setFillColor(textColor);
 
-    TextRun textRun(itemText, 0, 0, AllowTrailingExpansion, itemStyle.direction(), isOverride(itemStyle.unicodeBidi()), true);
+    TextRun textRun(itemText, 0, 0, AllowRightExpansion, itemStyle.direction(), isOverride(itemStyle.unicodeBidi()), true);
     FontCascade itemFont = style().fontCascade();
     LayoutRect r = itemBoundingBoxRect(paintOffset, listIndex);
     r.move(itemOffsetForAlignment(textRun, &itemStyle, itemFont, r));

Modified: trunk/Source/WebCore/rendering/RenderTextControl.cpp (265337 => 265338)


--- trunk/Source/WebCore/rendering/RenderTextControl.cpp	2020-08-06 17:58:13 UTC (rev 265337)
+++ trunk/Source/WebCore/rendering/RenderTextControl.cpp	2020-08-06 18:03:01 UTC (rev 265338)
@@ -142,7 +142,7 @@
     const UChar ch = '0';
     const String str = String(&ch, 1);
     const FontCascade& font = style().fontCascade();
-    TextRun textRun = constructTextRun(str, style(), AllowTrailingExpansion);
+    TextRun textRun = constructTextRun(str, style(), AllowRightExpansion);
     return font.width(textRun);
 }
 

Modified: trunk/Source/WebCore/rendering/SimpleLineLayout.cpp (265337 => 265338)


--- trunk/Source/WebCore/rendering/SimpleLineLayout.cpp	2020-08-06 17:58:13 UTC (rev 265337)
+++ trunk/Source/WebCore/rendering/SimpleLineLayout.cpp	2020-08-06 18:03:01 UTC (rev 265338)
@@ -878,8 +878,8 @@
 static ExpansionBehavior expansionBehavior(bool isAfterExpansion, bool lastRunOnLine)
 {
     ExpansionBehavior expansionBehavior;
-    expansionBehavior = isAfterExpansion ? ForbidLeadingExpansion : AllowLeadingExpansion;
-    expansionBehavior |= lastRunOnLine ? ForbidTrailingExpansion : AllowTrailingExpansion;
+    expansionBehavior = isAfterExpansion ? ForbidLeftExpansion : AllowLeftExpansion;
+    expansionBehavior |= lastRunOnLine ? ForbidRightExpansion : AllowRightExpansion;
     return expansionBehavior;
 }
 

Modified: trunk/Source/WebCore/rendering/SimpleLineLayout.h (265337 => 265338)


--- trunk/Source/WebCore/rendering/SimpleLineLayout.h	2020-08-06 17:58:13 UTC (rev 265337)
+++ trunk/Source/WebCore/rendering/SimpleLineLayout.h	2020-08-06 18:03:01 UTC (rev 265338)
@@ -70,7 +70,7 @@
     float logicalRight;
     // TODO: Move these optional items out of SimpleLineLayout::Run to a supplementary structure.
     float expansion { 0 };
-    ExpansionBehavior expansionBehavior { ForbidLeadingExpansion | ForbidTrailingExpansion };
+    ExpansionBehavior expansionBehavior { ForbidLeftExpansion | ForbidRightExpansion };
 };
 
 struct SimpleLineStrut {

Modified: trunk/Source/WebCore/rendering/SimpleLineLayoutFunctions.cpp (265337 => 265338)


--- trunk/Source/WebCore/rendering/SimpleLineLayoutFunctions.cpp	2020-08-06 17:58:13 UTC (rev 265337)
+++ trunk/Source/WebCore/rendering/SimpleLineLayoutFunctions.cpp	2020-08-06 18:03:01 UTC (rev 265338)
@@ -277,12 +277,12 @@
     inlineTextBox.setExpansionWithoutGrowing(run.expansion());
 
     auto expansionBehavior = run.expansionBehavior();
-    inlineTextBox.setCanHaveLeadingExpansion(expansionBehavior & AllowLeadingExpansion);
-    inlineTextBox.setCanHaveTrailingExpansion(expansionBehavior & AllowTrailingExpansion);
-    if (expansionBehavior & ForceTrailingExpansion)
-        inlineTextBox.setForceTrailingExpansion();
-    if (expansionBehavior & ForceLeadingExpansion)
-        inlineTextBox.setForceLeadingExpansion();
+    inlineTextBox.setCanHaveLeftExpansion(expansionBehavior & AllowLeftExpansion);
+    inlineTextBox.setCanHaveRightExpansion(expansionBehavior & AllowRightExpansion);
+    if (expansionBehavior & ForceRightExpansion)
+        inlineTextBox.setForceRightExpansion();
+    if (expansionBehavior & ForceLeftExpansion)
+        inlineTextBox.setForceLeftExpansion();
 }
 
 void generateLineBoxTree(RenderBlockFlow& flow, const Layout& layout)

Modified: trunk/Source/WebCore/rendering/svg/SVGInlineTextBox.cpp (265337 => 265338)


--- trunk/Source/WebCore/rendering/svg/SVGInlineTextBox.cpp	2020-08-06 17:58:13 UTC (rev 265337)
+++ trunk/Source/WebCore/rendering/svg/SVGInlineTextBox.cpp	2020-08-06 18:03:01 UTC (rev 265338)
@@ -391,7 +391,7 @@
     TextRun run(StringView(renderer().text()).substring(fragment.characterOffset, fragment.length)
                 , 0 /* xPos, only relevant with allowTabs=true */
                 , 0 /* padding, only relevant for justified text, not relevant for SVG */
-                , AllowTrailingExpansion
+                , AllowRightExpansion
                 , direction()
                 , dirOverride() || style.rtlOrdering() == Order::Visual /* directionalOverride */);
 

Modified: trunk/Source/WebCore/rendering/svg/SVGTextMetrics.cpp (265337 => 265338)


--- trunk/Source/WebCore/rendering/svg/SVGTextMetrics.cpp	2020-08-06 17:58:13 UTC (rev 265337)
+++ trunk/Source/WebCore/rendering/svg/SVGTextMetrics.cpp	2020-08-06 18:03:01 UTC (rev 265338)
@@ -66,7 +66,7 @@
     TextRun run(StringView(text.text()).substring(position, length)
                 , 0 /* xPos, only relevant with allowTabs=true */
                 , 0 /* padding, only relevant for justified text, not relevant for SVG */
-                , AllowTrailingExpansion
+                , AllowRightExpansion
                 , style.direction()
                 , isOverride(style.unicodeBidi()) /* directionalOverride */);
 

Modified: trunk/Source/WebKit/WebProcess/WebCoreSupport/win/WebPopupMenuWin.cpp (265337 => 265338)


--- trunk/Source/WebKit/WebProcess/WebCoreSupport/win/WebPopupMenuWin.cpp	2020-08-06 17:58:13 UTC (rev 265337)
+++ trunk/Source/WebKit/WebProcess/WebCoreSupport/win/WebPopupMenuWin.cpp	2020-08-06 18:03:01 UTC (rev 265338)
@@ -111,7 +111,7 @@
 
         String itemText = m_popupClient->itemText(index);
 
-        TextRun textRun(itemText, 0, 0, AllowTrailingExpansion, itemStyle.textDirection(), itemStyle.hasTextDirectionOverride());
+        TextRun textRun(itemText, 0, 0, AllowRightExpansion, itemStyle.textDirection(), itemStyle.hasTextDirectionOverride());
 
         notSelectedBackingStoreContext->setFillColor(optionTextColor);
         selectedBackingStoreContext->setFillColor(activeOptionTextColor);

Modified: trunk/Tools/TestWebKitAPI/Tests/WebCore/ComplexTextController.cpp (265337 => 265338)


--- trunk/Tools/TestWebKitAPI/Tests/WebCore/ComplexTextController.cpp	2020-08-06 17:58:13 UTC (rev 265337)
+++ trunk/Tools/TestWebKitAPI/Tests/WebCore/ComplexTextController.cpp	2020-08-06 18:03:01 UTC (rev 265338)
@@ -261,7 +261,7 @@
     EXPECT_NEAR(glyphBuffer.advanceAt(3).height(), 12.368896925859, 0.0001);
 }
 
-TEST_F(ComplexTextControllerTest, LeadingExpansion)
+TEST_F(ComplexTextControllerTest, LeftExpansion)
 {
     FontCascadeDescription description;
     description.setOneFamily("Times");
@@ -271,7 +271,7 @@
 
     UChar characters[] = { 'a' };
     size_t charactersLength = WTF_ARRAY_LENGTH(characters);
-    TextRun textRun(StringView(characters, charactersLength), 0, 100, ForceLeadingExpansion);
+    TextRun textRun(StringView(characters, charactersLength), 0, 100, ForceLeftExpansion);
     auto run = ComplexTextController::ComplexTextRun::create({ FloatSize(24, 0) }, { }, { 16 }, { 0 }, FloatSize(), font.primaryFont(), characters, 0, charactersLength, 0, 1, true);
     Vector<Ref<ComplexTextController::ComplexTextRun>> runs;
     runs.append(WTFMove(run));
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to