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

Unified Diff: third_party/WebKit/Source/core/layout/line/InlineTextBox.cpp

Issue 1927703002: Revert of Fix InlineTextBox::characterWidths() not to measure every substring (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@2661
Patch Set: Created 4 years, 8 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/core/layout/line/InlineTextBox.cpp
diff --git a/third_party/WebKit/Source/core/layout/line/InlineTextBox.cpp b/third_party/WebKit/Source/core/layout/line/InlineTextBox.cpp
index a0c1174ccb9df065faea866e7cb808255e31cf6a..1f0885bd07d47f6b58737da6df75919f2e6c22a5 100644
--- a/third_party/WebKit/Source/core/layout/line/InlineTextBox.cpp
+++ b/third_party/WebKit/Source/core/layout/line/InlineTextBox.cpp
@@ -30,7 +30,6 @@
#include "core/layout/line/AbstractInlineTextBox.h"
#include "core/layout/line/EllipsisBox.h"
#include "core/paint/InlineTextBoxPainter.h"
-#include "platform/fonts/CharacterRange.h"
#include "platform/fonts/FontCache.h"
#include "platform/fonts/shaping/SimpleShaper.h"
#include "wtf/Vector.h"
@@ -545,13 +544,15 @@
const ComputedStyle& styleToUse = getLineLayoutItem().styleRef(isFirstLineStyle());
const Font& font = styleToUse.font();
- TextRun textRun = constructTextRun(styleToUse, font);
- Vector<CharacterRange> ranges = font.individualCharacterRanges(textRun);
- DCHECK_EQ(ranges.size(), m_len);
-
- widths.resize(ranges.size());
- for (unsigned i = 0; i < ranges.size(); i++)
- widths[i] = ranges[i].width();
+ float lastWidth = 0;
+ widths.resize(m_len);
+ for (unsigned i = 0; i < m_len; i++) {
+ StringView substringView = getLineLayoutItem().text().createView();
+ substringView.narrow(start(), 1 + i);
+ TextRun textRun = constructTextRun(styleToUse, font, substringView, m_len);
+ widths[i] = font.width(textRun, nullptr, nullptr) - lastWidth;
+ lastWidth = font.width(textRun, nullptr, nullptr);
+ }
}
TextRun InlineTextBox::constructTextRun(const ComputedStyle& style, const Font& font, StringBuilder* charactersWithHyphen) const
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698