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

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

Issue 2555923002: Changed TextDirection to an enum class and renamed its members (Closed)
Patch Set: Rebase after reopen Created 4 years 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 a322079d7a9be257d1d8c0f87715bde40bd44d69..0e2ce137dbbf6105e3cfc105a6cd17678cb98e43 100644
--- a/third_party/WebKit/Source/core/layout/LayoutText.cpp
+++ b/third_party/WebKit/Source/core/layout/LayoutText.cpp
@@ -1089,7 +1089,7 @@ void LayoutText::computePreferredLogicalWidths(
BidiResolver<TextRunIterator, BidiCharacterRun> bidiResolver;
BidiCharacterRun* run;
TextDirection textDirection = styleToUse.direction();
- if ((is8Bit() && textDirection == LTR) ||
+ if ((is8Bit() && textDirection == TextDirection::Ltr) ||
isOverride(styleToUse.unicodeBidi())) {
run = 0;
} else {
@@ -1202,13 +1202,17 @@ void LayoutText::computePreferredLogicalWidths(
float wordTrailingSpaceWidth = 0;
if (isSpace &&
(f.getFontDescription().getTypesettingFeatures() & Kerning)) {
- ASSERT(textDirection >= 0 && textDirection <= 1);
- if (!cachedWordTrailingSpaceWidth[textDirection])
- cachedWordTrailingSpaceWidth[textDirection] =
+ const unsigned textDirectionIndex =
+ static_cast<unsigned>(textDirection);
+ DCHECK_GE(textDirectionIndex, 0U);
+ DCHECK_LE(textDirectionIndex, 1U);
+ if (!cachedWordTrailingSpaceWidth[textDirectionIndex])
+ cachedWordTrailingSpaceWidth[textDirectionIndex] =
f.width(constructTextRun(f, &spaceCharacter, 1, styleToUse,
textDirection)) +
wordSpacing;
- wordTrailingSpaceWidth = cachedWordTrailingSpaceWidth[textDirection];
+ wordTrailingSpaceWidth =
+ cachedWordTrailingSpaceWidth[textDirectionIndex];
}
float w;

Powered by Google App Engine
This is Rietveld 408576698