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

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

Issue 2928083003: Introduce AdjustInlineBoxPositionForTextDirection() for ComputeInlineBoxPosition() (Closed)
Patch Set: 2017-06-09T16:24:59 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/core/editing/VisibleUnits.cpp
diff --git a/third_party/WebKit/Source/core/editing/VisibleUnits.cpp b/third_party/WebKit/Source/core/editing/VisibleUnits.cpp
index fc81732adfaf8acc405ae4f963d6ee809e21ae40..c585f1a010eacdee915f00a062040146dfee97da 100644
--- a/third_party/WebKit/Source/core/editing/VisibleUnits.cpp
+++ b/third_party/WebKit/Source/core/editing/VisibleUnits.cpp
@@ -748,6 +748,13 @@ static bool IsStartOfDifferentDirection(const InlineBox* inline_box) {
return prev_box->BidiLevel() > inline_box->BidiLevel();
}
+// TODO(yosin): We have a forward declaration here to reduce patch size. We'll
+// replice this with an implementation once review finished.
+static InlineBoxPosition AdjustInlineBoxPositionForTextDirection(InlineBox*,
+ int,
+ UnicodeBidi,
+ TextDirection);
+
template <typename Strategy>
static InlineBoxPosition ComputeInlineBoxPositionTemplate(
const PositionTemplate<Strategy>& position,
@@ -831,7 +838,16 @@ static InlineBoxPosition ComputeInlineBoxPositionTemplate(
if (!inline_box)
return InlineBoxPosition(inline_box, caret_offset);
+ return AdjustInlineBoxPositionForTextDirection(
+ inline_box, caret_offset, layout_object->Style()->GetUnicodeBidi(),
+ primary_direction);
+}
+static InlineBoxPosition AdjustInlineBoxPositionForTextDirection(
+ InlineBox* inline_box,
+ int caret_offset,
+ UnicodeBidi unicode_bidi,
+ TextDirection primary_direction) {
unsigned char level = inline_box->BidiLevel();
if (inline_box->Direction() == primary_direction) {
@@ -906,8 +922,7 @@ static InlineBoxPosition ComputeInlineBoxPositionTemplate(
return InlineBoxPosition(inline_box, caret_offset);
}
- if (layout_object &&
- layout_object->Style()->GetUnicodeBidi() == UnicodeBidi::kPlaintext) {
+ if (unicode_bidi == UnicodeBidi::kPlaintext) {
if (inline_box->BidiLevel() < level)
return InlineBoxPosition(inline_box, inline_box->CaretLeftmostOffset());
return InlineBoxPosition(inline_box, inline_box->CaretRightmostOffset());
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698