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

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

Issue 2925293003: Cleanup TextDirection (Closed)
Patch Set: unsigned to uint8_t Created 3 years, 6 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 | « third_party/WebKit/Source/platform/geometry/LayoutRectOutsets.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/platform/text/TextDirection.h
diff --git a/third_party/WebKit/Source/platform/text/TextDirection.h b/third_party/WebKit/Source/platform/text/TextDirection.h
index 62448c7380f133833a273429ff97141ddeb25866..5d33442be96ad91de36119c70fa37b97d4f55fcb 100644
--- a/third_party/WebKit/Source/platform/text/TextDirection.h
+++ b/third_party/WebKit/Source/platform/text/TextDirection.h
@@ -26,13 +26,28 @@
#ifndef TextDirection_h
#define TextDirection_h
+#include <cstdint>
+
namespace blink {
-enum class TextDirection : unsigned { kRtl, kLtr };
+// The direction of text in bidirectional scripts such as Arabic or Hebrew.
+//
+// Used for explicit directions such as in the HTML dir attribute or the CSS
+// 'direction' property.
+// https://html.spec.whatwg.org/multipage/dom.html#the-dir-attribute
+// https://drafts.csswg.org/css-writing-modes/#direction
+//
+// Also used for resolved directions by UAX#9 UNICODE BIDIRECTIONAL ALGORITHM.
+// http://unicode.org/reports/tr9/
+enum class TextDirection : uint8_t { kLtr = 0, kRtl = 1 };
-inline bool IsLeftToRightDirection(TextDirection direction) {
+inline bool IsLtr(TextDirection direction) {
return direction == TextDirection::kLtr;
}
+
+inline bool IsRtl(TextDirection direction) {
+ return direction != TextDirection::kLtr;
+}
}
#endif
« no previous file with comments | « third_party/WebKit/Source/platform/geometry/LayoutRectOutsets.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698