Support forcing expansion opportunities at the beginning and ending of a run
authormmaxfield@apple.com <mmaxfield@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 1 Apr 2015 16:58:20 +0000 (16:58 +0000)
committermmaxfield@apple.com <mmaxfield@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 1 Apr 2015 16:58:20 +0000 (16:58 +0000)
commitddc56f969912c6842d795224ba9e8623441751fa
tree4fb7202a5e71cf96cf523769ca77a0e5dbc17087
parent28a411ad4749382827515a436fe94ef80b52eb7d
Support forcing expansion opportunities at the beginning and ending of a run
https://bugs.webkit.org/show_bug.cgi?id=143292

Reviewed by David Hyatt.

Migrate ExpansionBehavior to an enum comprised of two values: one for leading behavior
and one for trailing behavior. Each of these two values can take on a value of
"force," "forbid," and neither. All calls that interact with justification are
migrated to use this new structure.

Note that in this terminology, "leading" and "trailing" are with respect to the order
that elements get laid out in a line. Therefore, leading is always on the left, since
lines get laid out that way regardless of their bidi attributes.

This is getting ready for https://bugs.webkit.org/show_bug.cgi?id=142608

No new tests because there is no behavior change.

* platform/graphics/FontCascade.cpp:
(WebCore::FontCascade::expansionOpportunityCountInternal): Migrate to these new
values.
(WebCore::FontCascade::expansionOpportunityCount): Ditto.
(WebCore::FontCascade::leadingExpansionOpportunity): Returns whether one is present
or not.
(WebCore::FontCascade::trailingExpansionOpportunity): Ditto.
* platform/graphics/FontCascade.h:
* platform/graphics/GlyphBuffer.h: New leading expansion field.
(WebCore::GlyphBuffer::setLeadingExpansion):
(WebCore::GlyphBuffer::leadingExpansion):
* platform/graphics/TextRun.h: m_expansionBehavior needs more bits.
(WebCore::TextRun::expansionBehavior):
(WebCore::TextRun::allowsLeadingExpansion): Deleted.
(WebCore::TextRun::allowsTrailingExpansion): Deleted.
* platform/graphics/WidthIterator.cpp: Update to support new type.
(WebCore::WidthIterator::WidthIterator):
(WebCore::expansionLocation): Where should we insert expansions?
(WebCore::WidthIterator::advanceInternal): Use expansionLocation()
* platform/graphics/cocoa/FontCascadeCocoa.mm:
(WebCore::FontCascade::adjustSelectionRectForComplexText):
(WebCore::FontCascade::getGlyphsAndAdvancesForComplexText):
* platform/graphics/mac/ComplexTextController.cpp: Same as WidthIterator
(WebCore::ComplexTextController::ComplexTextController):
(WebCore::ComplexTextController::advance):
(WebCore::expansionLocation):
(WebCore::ComplexTextController::adjustGlyphsAndAdvances):
* platform/graphics/mac/ComplexTextController.h:
(WebCore::ComplexTextController::leadingExpansion):
* platform/text/TextFlags.h: Add new enum values
* rendering/InlineBox.h: Update to include new values.
(WebCore::InlineBox::InlineBoxBitfields::InlineBoxBitfields):
(WebCore::InlineBox::canHaveTrailingExpansion):
(WebCore::InlineBox::setCanHaveTrailingExpansion):
(WebCore::InlineBox::setForceTrailingExpansion):
(WebCore::InlineBox::forceTrailingExpansion):
(WebCore::InlineBox::setForceLeadingExpansion):
(WebCore::InlineBox::forceLeadingExpansion):
* rendering/InlineTextBox.h:
* rendering/RenderBlockLineLayout.cpp: Update to use new FontCascade signatures.
(WebCore::expansionBehaviorForInlineTextBox):
(WebCore::applyExpansionBehavior):
(WebCore::RenderBlockFlow::computeInlineDirectionPositionsForSegment):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@182236 268f45cc-cd09-0410-ab3c-d52691b4dbfc
13 files changed:
Source/WebCore/ChangeLog
Source/WebCore/platform/graphics/FontCascade.cpp
Source/WebCore/platform/graphics/FontCascade.h
Source/WebCore/platform/graphics/GlyphBuffer.h
Source/WebCore/platform/graphics/TextRun.h
Source/WebCore/platform/graphics/WidthIterator.cpp
Source/WebCore/platform/graphics/cocoa/FontCascadeCocoa.mm
Source/WebCore/platform/graphics/mac/ComplexTextController.cpp
Source/WebCore/platform/graphics/mac/ComplexTextController.h
Source/WebCore/platform/text/TextFlags.h
Source/WebCore/rendering/InlineBox.h
Source/WebCore/rendering/InlineTextBox.h
Source/WebCore/rendering/RenderBlockLineLayout.cpp