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

Unified Diff: third_party/WebKit/Source/core/layout/LayoutText.cpp

Issue 2865923002: Move LocaleForLineBreakIterator() to ComputedStyle (Closed)
Patch Set: Revert ng changes Created 3 years, 7 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/layout/LayoutText.cpp
diff --git a/third_party/WebKit/Source/core/layout/LayoutText.cpp b/third_party/WebKit/Source/core/layout/LayoutText.cpp
index c7b873fe8e40d46f38d3c45bf8ad62b7b85ba2b0..bdaf79bb322b4b8c94d1469109a19b4a92a7de09 100644
--- a/third_party/WebKit/Source/core/layout/LayoutText.cpp
+++ b/third_party/WebKit/Source/core/layout/LayoutText.cpp
@@ -1040,7 +1040,7 @@ static float MinWordFragmentWidthForBreakAll(
EWordBreak break_all_or_break_word) {
DCHECK_GT(length, 0);
LazyLineBreakIterator break_iterator(layout_text->GetText(),
- LocaleForLineBreakIterator(style));
+ style.LocaleForLineBreakIterator());
int next_breakable = -1;
float min = std::numeric_limits<float>::max();
int end = start + length;
@@ -1110,30 +1110,6 @@ static float MaxWordFragmentWidth(LayoutText* layout_text,
return max_fragment_width + layout_text->HyphenWidth(font, text_direction);
}
-AtomicString LocaleForLineBreakIterator(const ComputedStyle& style) {
- LineBreakIteratorMode mode = LineBreakIteratorMode::kDefault;
- switch (style.GetLineBreak()) {
- default:
- NOTREACHED();
- // Fall through.
- case kLineBreakAuto:
- case kLineBreakAfterWhiteSpace:
- return style.Locale();
- case kLineBreakNormal:
- mode = LineBreakIteratorMode::kNormal;
- break;
- case kLineBreakStrict:
- mode = LineBreakIteratorMode::kStrict;
- break;
- case kLineBreakLoose:
- mode = LineBreakIteratorMode::kLoose;
- break;
- }
- if (const LayoutLocale* locale = style.GetFontDescription().Locale())
- return locale->LocaleWithBreakKeyword(mode);
- return style.Locale();
-}
-
void LayoutText::ComputePreferredLogicalWidths(
float lead_width,
HashSet<const SimpleFontData*>& fallback_fonts,
@@ -1163,7 +1139,7 @@ void LayoutText::ComputePreferredLogicalWidths(
float word_spacing = style_to_use.WordSpacing();
int len = TextLength();
LazyLineBreakIterator break_iterator(
- text_, LocaleForLineBreakIterator(style_to_use));
+ text_, style_to_use.LocaleForLineBreakIterator());
bool needs_word_spacing = false;
bool ignoring_spaces = false;
bool is_space = false;

Powered by Google App Engine
This is Rietveld 408576698