Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(608)

Unified Diff: third_party/WebKit/Source/core/paint/InlineTextBoxPainter.cpp

Issue 2248803002: Fix when there are justification opportunities inside text-combine-upright (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/core/paint/InlineTextBoxPainter.cpp
diff --git a/third_party/WebKit/Source/core/paint/InlineTextBoxPainter.cpp b/third_party/WebKit/Source/core/paint/InlineTextBoxPainter.cpp
index 9e74d8870ff8e39ae217993f09952965ee6b3776..b6107277a258d9ea674cc8db726ea469ef737d89 100644
--- a/third_party/WebKit/Source/core/paint/InlineTextBoxPainter.cpp
+++ b/third_party/WebKit/Source/core/paint/InlineTextBoxPainter.cpp
@@ -106,6 +106,15 @@ void InlineTextBoxPainter::paint(const PaintInfo& paintInfo, const LayoutPoint&
boxOrigin.move(adjustedPaintOffset.x(), adjustedPaintOffset.y());
LayoutRect boxRect(boxOrigin, LayoutSize(m_inlineTextBox.logicalWidth(), m_inlineTextBox.logicalHeight()));
+ int length = m_inlineTextBox.len();
+ StringView string = StringView(m_inlineTextBox.getLineLayoutItem().text(), m_inlineTextBox.start(), length);
+ int maximumLength = m_inlineTextBox.getLineLayoutItem().textLength() - m_inlineTextBox.start();
+
+ StringBuilder charactersWithHyphen;
+ TextRun textRun = m_inlineTextBox.constructTextRun(styleToUse, styleToUse.font(), string, maximumLength, m_inlineTextBox.hasHyphen() ? &charactersWithHyphen : 0);
+ if (m_inlineTextBox.hasHyphen())
+ length = textRun.length();
+
kojii 2016/08/16 05:59:56 This block is simply a move from line 152 so that
bool shouldRotate = false;
LayoutTextCombine* combinedText = nullptr;
if (!m_inlineTextBox.isHorizontal()) {
@@ -117,6 +126,19 @@ void InlineTextBoxPainter::paint(const PaintInfo& paintInfo, const LayoutPoint&
if (combinedText) {
combinedText->updateFont();
boxRect.setWidth(combinedText->inlineWidthForLayout());
+ // Justfication applies to before and after the combined text as if
+ // it is an ideographic character, and is prohibited inside the
+ // combined text.
+ if (float expansion = textRun.expansion()) {
+ textRun.setExpansion(0);
+ if (textRun.allowsLeadingExpansion()) {
+ if (textRun.allowsTrailingExpansion())
+ expansion /= 2;
+ LayoutSize offset = LayoutSize(LayoutUnit(), LayoutUnit::fromFloatRound(expansion));
+ boxOrigin.move(offset);
+ boxRect.move(offset);
+ }
+ }
} else {
shouldRotate = true;
context.concatCTM(TextPainter::rotation(boxRect, TextPainter::Clockwise));
@@ -149,15 +171,6 @@ void InlineTextBoxPainter::paint(const PaintInfo& paintInfo, const LayoutPoint&
}
// 2. Now paint the foreground, including text and decorations like underline/overline (in quirks mode only).
- int length = m_inlineTextBox.len();
- StringView string = StringView(m_inlineTextBox.getLineLayoutItem().text(), m_inlineTextBox.start(), length);
- int maximumLength = m_inlineTextBox.getLineLayoutItem().textLength() - m_inlineTextBox.start();
-
- StringBuilder charactersWithHyphen;
- TextRun textRun = m_inlineTextBox.constructTextRun(styleToUse, font, string, maximumLength, m_inlineTextBox.hasHyphen() ? &charactersWithHyphen : 0);
- if (m_inlineTextBox.hasHyphen())
- length = textRun.length();
-
int selectionStart = 0;
int selectionEnd = 0;
if (paintSelectedTextOnly || paintSelectedTextSeparately)
« no previous file with comments | « third_party/WebKit/Source/core/layout/LayoutBlockFlowLine.cpp ('k') | third_party/WebKit/Source/platform/text/TextRun.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698