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

Unified Diff: third_party/WebKit/Source/core/editing/InlineBoxTraversal.cpp

Issue 2943053002: Introduce Find{Left,Right}BidiRun() and utilize in AdjustInlineBoxPositionForTextDirection() (Closed)
Patch Set: 2017-06-16T13:52:56 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
Index: third_party/WebKit/Source/core/editing/InlineBoxTraversal.cpp
diff --git a/third_party/WebKit/Source/core/editing/InlineBoxTraversal.cpp b/third_party/WebKit/Source/core/editing/InlineBoxTraversal.cpp
index f85c063f9600c5516641a6243309a8fe79ddfda5..fccec0eae520758a21e2c8fac23f8c3b457762bb 100644
--- a/third_party/WebKit/Source/core/editing/InlineBoxTraversal.cpp
+++ b/third_party/WebKit/Source/core/editing/InlineBoxTraversal.cpp
@@ -47,6 +47,16 @@ struct TraverseRightIgnoringLineBreak {
};
template <typename TraversalStrategy>
+InlineBox* FindBidiRun(const InlineBox& start, unsigned bidi_level) {
+ for (InlineBox* runner = TraversalStrategy::Forward(start); runner;
+ runner = TraversalStrategy::Forward(*runner)) {
+ if (runner->BidiLevel() <= bidi_level)
+ return runner;
+ }
+ return nullptr;
+}
+
+template <typename TraversalStrategy>
InlineBox* FindBoudnaryOfBidiRun(const InlineBox& start, unsigned bidi_level) {
InlineBox* result = const_cast<InlineBox*>(&start);
for (InlineBox* runner = TraversalStrategy::Forward(start); runner;
@@ -73,6 +83,16 @@ InlineBox* FindBoudnaryOfEntireBidiRun(const InlineBox& start,
} // namespace
+InlineBox* InlineBoxTraversal::FindLeftBidiRun(const InlineBox& box,
+ unsigned bidi_level) {
+ return FindBidiRun<TraverseLeft>(box, bidi_level);
+}
+
+InlineBox* InlineBoxTraversal::FindRightBidiRun(const InlineBox& box,
+ unsigned bidi_level) {
+ return FindBidiRun<TraverseRight>(box, bidi_level);
+}
+
InlineBox* InlineBoxTraversal::FindLeftBoundaryOfBidiRunIgnoringLineBreak(
const InlineBox& inline_box,
unsigned bidi_level) {
« no previous file with comments | « third_party/WebKit/Source/core/editing/InlineBoxTraversal.h ('k') | third_party/WebKit/Source/core/editing/VisibleUnits.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698