Skip to content
Permalink
Browse files
Convert ExpansionBehavior to a struct of left/right expansion behaviors
https://bugs.webkit.org/show_bug.cgi?id=240554

Patch by Kiet Ho <tho22@apple.com> on 2022-05-20
Reviewed by Myles C. Maxfield.

* Tools/TestWebKitAPI/Tests/WebCore/ComplexTextController.cpp:
(TestWebKitAPI::TEST_F):
* Source/WebKit/WebProcess/WebCoreSupport/win/WebPopupMenuWin.cpp:
(WebKit::WebPopupMenu::setUpPlatformData):

No new tests, no functional changes made.

* Source/WebCore/html/canvas/CanvasRenderingContext2D.cpp:
(WebCore::CanvasRenderingContext2D::measureText):
(WebCore::CanvasRenderingContext2D::drawTextInternal):
* Source/WebCore/html/canvas/CanvasRenderingContext2DBase.cpp:
(WebCore::CanvasRenderingContext2DBase::drawText):
(WebCore::CanvasRenderingContext2DBase::measureTextInternal):
* Source/WebCore/layout/formattingContexts/inline/InlineLine.cpp:
(WebCore::Layout::Line::applyRunExpansion):
* Source/WebCore/layout/formattingContexts/inline/display/InlineDisplayBox.h:
* Source/WebCore/layout/formattingContexts/inline/text/TextUtil.cpp:
(WebCore::Layout::TextUtil::fallbackFontsForText):
* Source/WebCore/platform/graphics/ComplexTextController.cpp:
(WebCore::ComplexTextController::adjustGlyphsAndAdvances):
* Source/WebCore/platform/graphics/FontCascade.cpp:
(WebCore::FontCascade::expansionOpportunityCountInternal):
* Source/WebCore/platform/graphics/TextRun.h:
(WebCore::TextRun::TextRun):
* Source/WebCore/platform/graphics/WidthIterator.cpp:
(WebCore::WidthIterator::WidthIterator):
(WebCore::WidthIterator::calculateAdditionalWidth const):
* Source/WebCore/platform/text/TextFlags.h:
(WebCore::ExpansionBehavior::ExpansionBehavior):
(WebCore::ExpansionBehavior::allowLeftOnly):
(WebCore::ExpansionBehavior::forceLeftOnly):
(WebCore::ExpansionBehavior::allowRightOnly):
* Source/WebCore/platform/win/PopupMenuWin.cpp:
(WebCore::PopupMenuWin::paint):
* Source/WebCore/rendering/LegacyEllipsisBox.cpp:
(WebCore::LegacyEllipsisBox::paint):
(WebCore::LegacyEllipsisBox::selectionRect const):
(WebCore::LegacyEllipsisBox::paintSelection):
* Source/WebCore/rendering/LegacyInlineTextBox.cpp:
(WebCore::LegacyInlineTextBox::expansionBehavior const):
* Source/WebCore/rendering/LegacyLineLayout.cpp:
(WebCore::expansionBehaviorForInlineTextBox):
(WebCore::applyExpansionBehavior):
* Source/WebCore/rendering/RenderBlock.h:
* Source/WebCore/rendering/RenderFileUploadControl.cpp:
(WebCore::RenderFileUploadControl::paintObject):
(WebCore::RenderFileUploadControl::computeIntrinsicLogicalWidths const):
* Source/WebCore/rendering/RenderImage.cpp:
(WebCore::RenderImage::paintReplaced):
* Source/WebCore/rendering/RenderListBox.cpp:
(WebCore::RenderListBox::updateFromElement):
(WebCore::RenderListBox::paintItemForeground):
* Source/WebCore/rendering/RenderTextControl.cpp:
(WebCore::RenderTextControl::getAverageCharWidth):
* Source/WebCore/rendering/svg/SVGInlineTextBox.cpp:
(WebCore::SVGInlineTextBox::constructTextRun const):
* Source/WebCore/rendering/svg/SVGTextMetrics.cpp:
(WebCore::SVGTextMetrics::constructTextRun):

Canonical link: https://commits.webkit.org/250833@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@294607 268f45cc-cd09-0410-ab3c-d52691b4dbfc
  • Loading branch information
tuankiet65 authored and webkit-commit-queue committed May 21, 2022
1 parent fbf1615 commit ab2fbd6f38327d405c675d65a9f458172bef6b8a
Showing 24 changed files with 148 additions and 108 deletions.
@@ -207,7 +207,7 @@ Ref<TextMetrics> CanvasRenderingContext2D::measureText(const String& text)
const RenderStyle* computedStyle;
auto direction = toTextDirection(state().direction, &computedStyle);
bool override = computedStyle && isOverride(computedStyle->unicodeBidi());
TextRun textRun(normalizedText, 0, 0, AllowRightExpansion, direction, override, true);
TextRun textRun(normalizedText, 0, 0, ExpansionBehavior::allowRightOnly(), direction, override, true);
return measureTextInternal(textRun);
}

@@ -240,7 +240,7 @@ void CanvasRenderingContext2D::drawTextInternal(const String& text, double x, do
const RenderStyle* computedStyle;
auto direction = toTextDirection(state().direction, &computedStyle);
bool override = computedStyle && isOverride(computedStyle->unicodeBidi());
TextRun textRun(normalizedText, 0, 0, AllowRightExpansion, direction, override, true);
TextRun textRun(normalizedText, 0, 0, ExpansionBehavior::allowRightOnly(), direction, override, true);
drawTextUnchecked(textRun, x, y, fill, maxWidth);
}

@@ -2398,7 +2398,7 @@ void CanvasRenderingContext2DBase::drawText(const String& text, double x, double

String normalizedText = normalizeSpaces(text);
auto direction = (state().direction == Direction::Rtl) ? TextDirection::RTL : TextDirection::LTR;
TextRun textRun(normalizedText, 0, 0, AllowRightExpansion, direction, false, true);
TextRun textRun(normalizedText, 0, 0, ExpansionBehavior::allowRightOnly(), direction, false, true);
drawTextUnchecked(textRun, x, y, fill, maxWidth);
}

@@ -2520,7 +2520,7 @@ Ref<TextMetrics> CanvasRenderingContext2DBase::measureTextInternal(const String&
{
String normalizedText = normalizeSpaces(text);
auto direction = (state().direction == Direction::Rtl) ? TextDirection::RTL : TextDirection::LTR;
TextRun textRun(normalizedText, 0, 0, AllowRightExpansion, direction, false, true);
TextRun textRun(normalizedText, 0, 0, ExpansionBehavior::allowRightOnly(), direction, false, true);
return measureTextInternal(textRun);
}

@@ -115,15 +115,16 @@ void Line::applyRunExpansion(InlineLayoutUnit horizontalAvailableSpace)
auto hangingTrailingContentLength = m_hangingTrailingContent.length();
for (size_t runIndex = 0; runIndex < m_runs.size(); ++runIndex) {
auto& run = m_runs[runIndex];
int expansionBehavior = DefaultExpansion;
auto expansionBehavior = ExpansionBehavior::defaultBehavior();
size_t expansionOpportunitiesInRun = 0;

// FIXME: Check why we don't apply expansion when whitespace is preserved.
if (run.isText() && (!TextUtil::shouldPreserveSpacesAndTabs(run.layoutBox()) || hangingTrailingContentLength)) {
if (run.hasTextCombine())
expansionBehavior = ForbidLeftExpansion | ForbidRightExpansion;
expansionBehavior = ExpansionBehavior::forbidAll();
else {
expansionBehavior = (runIsAfterExpansion ? ForbidLeftExpansion : AllowLeftExpansion) | AllowRightExpansion;
expansionBehavior.setLeft(runIsAfterExpansion ? ExpansionBehavior::Behavior::Forbid : ExpansionBehavior::Behavior::Allow);
expansionBehavior.setRight(ExpansionBehavior::Behavior::Allow);
auto& textContent = *run.textContent();
// Trailing hanging whitespace sequence is ignored when computing the expansion opportunities.
auto hangingTrailingContentInCurrentRun = std::min(textContent.length, hangingTrailingContentLength);
@@ -141,11 +142,9 @@ void Line::applyRunExpansion(InlineLayoutUnit horizontalAvailableSpace)
if (run.isText() || run.isBox())
lastRunIndexWithContent = runIndex;
}
// Need to fix up the last run's trailing expansion.
// Forbid right expansion in the last run to prevent trailing expansion at the end of the line.
if (lastRunIndexWithContent && runsExpansionOpportunities[*lastRunIndexWithContent]) {
// Turn off the trailing bits first and add the forbid trailing expansion.
auto leadingExpansion = runsExpansionBehaviors[*lastRunIndexWithContent] & LeftExpansionMask;
runsExpansionBehaviors[*lastRunIndexWithContent] = leadingExpansion | ForbidRightExpansion;
runsExpansionBehaviors[*lastRunIndexWithContent].setRight(ExpansionBehavior::Behavior::Forbid);
if (runIsAfterExpansion) {
// When the last run has an after expansion (e.g. CJK ideograph) we need to remove this trailing expansion opportunity.
// Note that this is not about trailing collapsible whitespace as at this point we trimmed them all.
@@ -156,7 +156,7 @@ struct Box {
const std::optional<Text>& text() const { return m_text; }

struct Expansion {
ExpansionBehavior behavior { DefaultExpansion };
ExpansionBehavior behavior = ExpansionBehavior::defaultBehavior();
float horizontalExpansion { 0 };
};
Expansion expansion() const { return m_expansion; }
@@ -161,8 +161,8 @@ TextUtil::FallbackFontList TextUtil::fallbackFontsForText(StringView textContent
};

if (includeHyphen == IncludeHyphen::Yes)
collectFallbackFonts(TextRun { StringView(style.hyphenString().string()), { }, { }, DefaultExpansion, style.direction() });
collectFallbackFonts(TextRun { textContent, { }, { }, DefaultExpansion, style.direction() });
collectFallbackFonts(TextRun { StringView(style.hyphenString().string()), { }, { }, ExpansionBehavior::defaultBehavior(), style.direction() });
collectFallbackFonts(TextRun { textContent, { }, { }, ExpansionBehavior::defaultBehavior(), style.direction() });
return fallbackFonts;
}

@@ -673,13 +673,13 @@ static inline std::pair<bool, bool> expansionLocation(bool ideograph, bool treat

void ComplexTextController::adjustGlyphsAndAdvances()
{
bool afterExpansion = (m_run.expansionBehavior() & LeftExpansionMask) == ForbidLeftExpansion;
bool afterExpansion = m_run.expansionBehavior().left() == ExpansionBehavior::Behavior::Forbid;
size_t runCount = m_complexTextRuns.size();
bool hasExtraSpacing = (m_font.letterSpacing() || m_font.wordSpacing() || m_expansion) && !m_run.spacingDisabled();
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;
bool runForcesLeftExpansion = m_run.expansionBehavior().left() == ExpansionBehavior::Behavior::Force;
bool runForcesRightExpansion = m_run.expansionBehavior().right() == ExpansionBehavior::Behavior::Force;
bool runForbidsLeftExpansion = m_run.expansionBehavior().left() == ExpansionBehavior::Behavior::Forbid;
bool runForbidsRightExpansion = m_run.expansionBehavior().right() == ExpansionBehavior::Behavior::Forbid;

// We are iterating in glyph order, not string order. Compare this to WidthIterator::advanceInternal()
for (size_t runIndex = 0; runIndex < runCount; ++runIndex) {
@@ -962,8 +962,8 @@ bool FontCascade::isCJKIdeographOrSymbol(UChar32 c)
std::pair<unsigned, bool> FontCascade::expansionOpportunityCountInternal(const LChar* characters, unsigned length, TextDirection direction, ExpansionBehavior expansionBehavior)
{
unsigned count = 0;
bool isAfterExpansion = (expansionBehavior & LeftExpansionMask) == ForbidLeftExpansion;
if ((expansionBehavior & LeftExpansionMask) == ForceLeftExpansion) {
bool isAfterExpansion = expansionBehavior.left() == ExpansionBehavior::Behavior::Forbid;
if (expansionBehavior.left() == ExpansionBehavior::Behavior::Force) {
++count;
isAfterExpansion = true;
}
@@ -984,10 +984,10 @@ std::pair<unsigned, bool> FontCascade::expansionOpportunityCountInternal(const L
isAfterExpansion = false;
}
}
if (!isAfterExpansion && (expansionBehavior & RightExpansionMask) == ForceRightExpansion) {
if (!isAfterExpansion && expansionBehavior.right() == ExpansionBehavior::Behavior::Force) {
++count;
isAfterExpansion = true;
} else if (isAfterExpansion && (expansionBehavior & RightExpansionMask) == ForbidRightExpansion) {
} else if (isAfterExpansion && expansionBehavior.right() == ExpansionBehavior::Behavior::Forbid) {
ASSERT(count);
--count;
isAfterExpansion = false;
@@ -998,8 +998,8 @@ std::pair<unsigned, bool> FontCascade::expansionOpportunityCountInternal(const L
std::pair<unsigned, bool> FontCascade::expansionOpportunityCountInternal(const UChar* characters, unsigned length, TextDirection direction, ExpansionBehavior expansionBehavior)
{
unsigned count = 0;
bool isAfterExpansion = (expansionBehavior & LeftExpansionMask) == ForbidLeftExpansion;
if ((expansionBehavior & LeftExpansionMask) == ForceLeftExpansion) {
bool isAfterExpansion = expansionBehavior.left() == ExpansionBehavior::Behavior::Forbid;
if (expansionBehavior.left() == ExpansionBehavior::Behavior::Force) {
++count;
isAfterExpansion = true;
}
@@ -1046,10 +1046,10 @@ std::pair<unsigned, bool> FontCascade::expansionOpportunityCountInternal(const U
isAfterExpansion = false;
}
}
if (!isAfterExpansion && (expansionBehavior & RightExpansionMask) == ForceRightExpansion) {
if (!isAfterExpansion && expansionBehavior.right() == ExpansionBehavior::Behavior::Force) {
++count;
isAfterExpansion = true;
} else if (isAfterExpansion && (expansionBehavior & RightExpansionMask) == ForbidRightExpansion) {
} else if (isAfterExpansion && expansionBehavior.right() == ExpansionBehavior::Behavior::Forbid) {
ASSERT(count);
--count;
isAfterExpansion = false;
@@ -34,9 +34,10 @@ struct ExpectedTextRunSize {
float float1;
float float2;
float float3;
unsigned bitfields : 9;
ExpansionBehavior expansionBehavior;
unsigned bitfields : 5;
};

static_assert(sizeof(TextRun) == sizeof(ExpectedTextRunSize), "TextRun is not of expected size");
static_assert(sizeof(TextRun) == sizeof(ExpectedTextRunSize), "TextRun should be small");

}
@@ -43,7 +43,7 @@ struct GlyphData;
class TextRun {
WTF_MAKE_FAST_ALLOCATED;
public:
explicit TextRun(const String& text, float xpos = 0, float expansion = 0, ExpansionBehavior expansionBehavior = DefaultExpansion, TextDirection direction = TextDirection::LTR, bool directionalOverride = false, bool characterScanForCodePath = true)
explicit TextRun(const String& text, float xpos = 0, float expansion = 0, ExpansionBehavior expansionBehavior = ExpansionBehavior::defaultBehavior(), TextDirection direction = TextDirection::LTR, bool directionalOverride = false, bool characterScanForCodePath = true)
: m_text(text)
, m_tabSize(0)
, m_xpos(xpos)
@@ -59,7 +59,7 @@ class TextRun {
ASSERT(!m_text.isNull());
}

explicit TextRun(StringView stringView, float xpos = 0, float expansion = 0, ExpansionBehavior expansionBehavior = DefaultExpansion, TextDirection direction = TextDirection::LTR, bool directionalOverride = false, bool characterScanForCodePath = true)
explicit TextRun(StringView stringView, float xpos = 0, float expansion = 0, ExpansionBehavior expansionBehavior = ExpansionBehavior::defaultBehavior(), TextDirection direction = TextDirection::LTR, bool directionalOverride = false, bool characterScanForCodePath = true)
: TextRun(stringView.toStringWithoutCopying(), xpos, expansion, expansionBehavior, direction, directionalOverride, characterScanForCodePath)
{
}
@@ -128,7 +128,7 @@ class TextRun {
float m_horizontalGlyphStretch;

float m_expansion;
unsigned m_expansionBehavior : 4;
ExpansionBehavior m_expansionBehavior;
unsigned m_allowTabs : 1;
unsigned m_direction : 1;
unsigned m_directionalOverride : 1; // Was this direction set by an override character.
@@ -41,7 +41,7 @@ WidthIterator::WidthIterator(const FontCascade& font, const TextRun& run, HashSe
, m_run(run)
, m_fallbackFonts(fallbackFonts)
, m_expansion(run.expansion())
, m_isAfterExpansion((run.expansionBehavior() & LeftExpansionMask) == ForbidLeftExpansion)
, m_isAfterExpansion(run.expansionBehavior().left() == ExpansionBehavior::Behavior::Forbid)
, m_accountForGlyphBounds(accountForGlyphBounds)
, m_enableKerning(font.enableKerning())
, m_requiresShaping(font.requiresShaping())
@@ -381,10 +381,10 @@ auto WidthIterator::calculateAdditionalWidth(GlyphBuffer& glyphBuffer, GlyphBuff
if (!m_run.ltr())
std::swap(isLeftmostCharacter, isRightmostCharacter);

bool forceLeftExpansion = isLeftmostCharacter && (m_run.expansionBehavior() & LeftExpansionMask) == ForceLeftExpansion;
bool forceRightExpansion = isRightmostCharacter && (m_run.expansionBehavior() & RightExpansionMask) == ForceRightExpansion;
bool forbidLeftExpansion = isLeftmostCharacter && (m_run.expansionBehavior() & LeftExpansionMask) == ForbidLeftExpansion;
bool forbidRightExpansion = isRightmostCharacter && (m_run.expansionBehavior() & RightExpansionMask) == ForbidRightExpansion;
bool forceLeftExpansion = isLeftmostCharacter && m_run.expansionBehavior().left() == ExpansionBehavior::Behavior::Force;
bool forceRightExpansion = isRightmostCharacter && m_run.expansionBehavior().right() == ExpansionBehavior::Behavior::Force;
bool forbidLeftExpansion = isLeftmostCharacter && m_run.expansionBehavior().left() == ExpansionBehavior::Behavior::Forbid;
bool forbidRightExpansion = isRightmostCharacter && m_run.expansionBehavior().right() == ExpansionBehavior::Behavior::Forbid;

bool isIdeograph = FontCascade::canExpandAroundIdeographsInComplexText() && FontCascade::isCJKIdeographOrSymbol(character);

@@ -58,20 +58,59 @@ enum class NonCJKGlyphOrientation : uint8_t {
Upright
};

enum ExpansionBehaviorFlags {
ForbidRightExpansion = 0 << 0,
AllowRightExpansion = 1 << 0,
ForceRightExpansion = 2 << 0,
RightExpansionMask = 3 << 0,
class ExpansionBehavior {
public:
enum class Behavior : uint8_t {
Forbid,
Allow,
Force
};

ExpansionBehavior() = default;

ExpansionBehavior(Behavior left, Behavior right)
: m_left(static_cast<uint8_t>(left))
, m_right(static_cast<uint8_t>(right))
{
}

static const ExpansionBehavior defaultBehavior()
{
return { };
}

static const ExpansionBehavior allowRightOnly()
{
return { Behavior::Forbid, Behavior::Allow };
}

static const ExpansionBehavior allowLeftOnly()
{
return { Behavior::Allow, Behavior::Forbid };
}

static const ExpansionBehavior forceLeftOnly()
{
return { Behavior::Force, Behavior::Forbid };
}

static const ExpansionBehavior forbidAll()
{
return { Behavior::Forbid, Behavior::Forbid };
}

Behavior left() const { return static_cast<Behavior>(m_left); }
void setLeft(Behavior behavior) { m_left = static_cast<uint8_t>(behavior); }

ForbidLeftExpansion = 0 << 2,
AllowLeftExpansion = 1 << 2,
ForceLeftExpansion = 2 << 2,
LeftExpansionMask = 3 << 2,
Behavior right() const { return static_cast<Behavior>(m_right); }
void setRight(Behavior behavior) { m_right = static_cast<uint8_t>(behavior); }

DefaultExpansion = AllowRightExpansion | ForbidLeftExpansion,
private:
// Default behavior follows the previous implementation:
// forbids left and allows right expansions.
uint8_t m_left : 2 { static_cast<uint8_t>(Behavior::Forbid) };
uint8_t m_right : 2 { static_cast<uint8_t>(Behavior::Allow) };
};
typedef unsigned ExpansionBehavior;

enum FontSynthesisValues {
FontSynthesisNone = 0x0,
@@ -644,7 +644,7 @@ void PopupMenuWin::paint(const IntRect& damageRect, HDC hdc)

String itemText = client()->itemText(index);

TextRun textRun(itemText, 0, 0, AllowLeftExpansion, itemStyle.textDirection(), itemStyle.hasTextDirectionOverride());
TextRun textRun(itemText, 0, 0, ExpansionBehavior::allowLeftOnly(), itemStyle.textDirection(), itemStyle.hasTextDirectionOverride());
context.setFillColor(optionTextColor);

FontCascade itemFont = m_font;
@@ -70,7 +70,7 @@ void LegacyEllipsisBox::paint(PaintInfo& paintInfo, const LayoutPoint& paintOffs
}

// FIXME: Why is this always LTR? Fix by passing correct text run flags below.
context.drawText(font, RenderBlock::constructTextRun(m_str, lineStyle, AllowRightExpansion), LayoutPoint(x() + paintOffset.x(), y() + paintOffset.y() + lineStyle.metricsOfPrimaryFont().ascent()));
context.drawText(font, RenderBlock::constructTextRun(m_str, lineStyle, ExpansionBehavior::allowRightOnly()), LayoutPoint(x() + paintOffset.x(), y() + paintOffset.y() + lineStyle.metricsOfPrimaryFont().ascent()));

// Restore the regular fill color.
if (textColor != context.fillColor())
@@ -119,7 +119,7 @@ IntRect LegacyEllipsisBox::selectionRect() const
const LegacyRootInlineBox& 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, AllowRightExpansion), selectionRect);
font.adjustSelectionRectForText(RenderBlock::constructTextRun(m_str, lineStyle, ExpansionBehavior::allowRightOnly()), selectionRect);
// FIXME: use directional pixel snapping instead.
return enclosingIntRect(selectionRect);
}
@@ -140,7 +140,7 @@ void LegacyEllipsisBox::paintSelection(GraphicsContext& context, const LayoutPoi
GraphicsContextStateSaver stateSaver(context);
// FIXME: Why is this always LTR? Fix by passing correct text run flags below.
LayoutRect selectionRect { LayoutUnit(x() + paintOffset.x()), rootBox.selectionTop() + paintOffset.y(), 0_lu, rootBox.selectionHeight() };
TextRun run = RenderBlock::constructTextRun(m_str, style, AllowRightExpansion);
TextRun run = RenderBlock::constructTextRun(m_str, style, ExpansionBehavior::allowRightOnly());
font.adjustSelectionRectForText(run, selectionRect);
context.fillRect(snapRectToDevicePixelsWithWritingDirection(selectionRect, renderer().document().deviceScaleFactor(), run.ltr()), c);
}
@@ -488,23 +488,23 @@ const RenderCombineText* LegacyInlineTextBox::combinedText() const

ExpansionBehavior LegacyInlineTextBox::expansionBehavior() const
{
ExpansionBehavior leftBehavior;
ExpansionBehavior behavior;

if (forceLeftExpansion())
leftBehavior = ForceLeftExpansion;
behavior.setLeft(ExpansionBehavior::Behavior::Force);
else if (canHaveLeftExpansion())
leftBehavior = AllowLeftExpansion;
behavior.setLeft(ExpansionBehavior::Behavior::Allow);
else
leftBehavior = ForbidLeftExpansion;
behavior.setLeft(ExpansionBehavior::Behavior::Forbid);

ExpansionBehavior rightBehavior;
if (forceRightExpansion())
rightBehavior = ForceRightExpansion;
behavior.setRight(ExpansionBehavior::Behavior::Force);
else if (expansion() && nextLeafOnLine() && !nextLeafOnLine()->isLineBreak())
rightBehavior = AllowRightExpansion;
behavior.setRight(ExpansionBehavior::Behavior::Allow);
else
rightBehavior = ForbidRightExpansion;
behavior.setRight(ExpansionBehavior::Behavior::Forbid);

return leftBehavior | rightBehavior;
return behavior;
}

#if ENABLE(TREE_DEBUGGING)

0 comments on commit ab2fbd6

Please sign in to comment.