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

Unified Diff: third_party/WebKit/Source/platform/text/BidiResolver.h

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/platform/text/BidiResolver.h
diff --git a/third_party/WebKit/Source/platform/text/BidiResolver.h b/third_party/WebKit/Source/platform/text/BidiResolver.h
index a76274264eece986780476166d7b7547f9edecce..0083194b3d4d0472f6ded9ec1851686a7e20d643 100644
--- a/third_party/WebKit/Source/platform/text/BidiResolver.h
+++ b/third_party/WebKit/Source/platform/text/BidiResolver.h
@@ -130,12 +130,12 @@ struct BidiStatus final {
// direction. Uses TextDirection as it only has two possibilities instead of
// WTF::Unicode::Direction which has 19.
BidiStatus(TextDirection textDirection, bool isOverride) {
- WTF::Unicode::CharDirection direction = textDirection == LTR
+ WTF::Unicode::CharDirection direction = textDirection == TextDirection::Ltr
? WTF::Unicode::LeftToRight
: WTF::Unicode::RightToLeft;
eor = lastStrong = last = direction;
- context = BidiContext::create(textDirection == LTR ? 0 : 1, direction,
- isOverride);
+ context = BidiContext::create(textDirection == TextDirection::Ltr ? 0 : 1,
+ direction, isOverride);
}
BidiStatus(WTF::Unicode::CharDirection eorDir,
@@ -153,7 +153,7 @@ struct BidiStatus final {
bool isOverride,
unsigned char level) {
WTF::Unicode::CharDirection direction;
- if (textDirection == RTL) {
+ if (textDirection == TextDirection::Rtl) {
level = nextGreaterOddLevel(level);
direction = WTF::Unicode::RightToLeft;
} else {
@@ -255,8 +255,9 @@ class BidiResolver final {
void setStatus(const BidiStatus s) {
ASSERT(s.context);
m_status = s;
- m_paragraphDirectionality =
- s.context->dir() == WTF::Unicode::LeftToRight ? LTR : RTL;
+ m_paragraphDirectionality = s.context->dir() == WTF::Unicode::LeftToRight
+ ? TextDirection::Ltr
+ : TextDirection::Rtl;
}
MidpointState<Iterator>& midpointState() { return m_midpointState; }
@@ -552,8 +553,9 @@ void BidiResolver<Iterator, Run, IsolatedRun>::applyL1Rule(
return;
bool shouldReorder =
- trailingSpaceRun !=
- (m_paragraphDirectionality == LTR ? runs.lastRun() : runs.firstRun());
+ trailingSpaceRun != (m_paragraphDirectionality == TextDirection::Ltr
+ ? runs.lastRun()
+ : runs.firstRun());
if (firstSpace != trailingSpaceRun->start()) {
BidiContext* baseContext = context();
while (BidiContext* parent = baseContext->parent())
@@ -571,7 +573,7 @@ void BidiResolver<Iterator, Run, IsolatedRun>::applyL1Rule(
return;
}
- if (m_paragraphDirectionality == LTR) {
+ if (m_paragraphDirectionality == TextDirection::Ltr) {
runs.moveRunToEnd(trailingSpaceRun);
trailingSpaceRun->m_level = 0;
} else {
@@ -750,19 +752,19 @@ BidiResolver<Iterator, Run, IsolatedRun>::determineDirectionalityInternal(
if (charDirection == WTF::Unicode::LeftToRight) {
if (hasStrongDirectionality)
*hasStrongDirectionality = true;
- return LTR;
+ return TextDirection::Ltr;
}
if (charDirection == WTF::Unicode::RightToLeft ||
charDirection == WTF::Unicode::RightToLeftArabic) {
if (hasStrongDirectionality)
*hasStrongDirectionality = true;
- return RTL;
+ return TextDirection::Rtl;
}
increment();
}
if (hasStrongDirectionality)
*hasStrongDirectionality = false;
- return LTR;
+ return TextDirection::Ltr;
}
inline TextDirection directionForCharacter(UChar32 character) {
@@ -770,8 +772,8 @@ inline TextDirection directionForCharacter(UChar32 character) {
WTF::Unicode::direction(character);
if (charDirection == WTF::Unicode::RightToLeft ||
charDirection == WTF::Unicode::RightToLeftArabic)
- return RTL;
- return LTR;
+ return TextDirection::Rtl;
+ return TextDirection::Ltr;
}
template <class Iterator, class Run, class IsolatedRun>

Powered by Google App Engine
This is Rietveld 408576698