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

Unified Diff: Source/core/dom/Position.cpp

Issue 302433015: Use correct offset when attribute auto is present (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Updated to latest master Created 6 years, 7 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: Source/core/dom/Position.cpp
diff --git a/Source/core/dom/Position.cpp b/Source/core/dom/Position.cpp
index 64f8730cc6f540937921deecae0cba42dc7c9d30..be00622ba2c966e90fc7cc11fcc75474b262f90c 100644
--- a/Source/core/dom/Position.cpp
+++ b/Source/core/dom/Position.cpp
@@ -1260,7 +1260,14 @@ void Position::getInlineBoxAndOffset(EAffinity affinity, TextDirection primaryDi
break;
inlineBox = prevBox;
}
- caretOffset = inlineBox->caretLeftmostOffset();
+ // A special scenario when attribute auto is set. if the direction is changed use right offset
leviw_travelin_and_unemployed 2014/05/28 17:42:31 It's not just "attribute auto," but dirAuto. Inst
Habib Virji 2014/05/29 07:58:26 Ok thanks will update accordingly.
Habib Virji 2014/05/29 11:31:51 Done.
+ bool isAuto = false;
+ if (deprecatedNode()->document().focusedElement())
leviw_travelin_and_unemployed 2014/05/28 17:42:31 Why the check for a focused element?
Habib Virji 2014/05/29 07:58:26 I need a way to access directionality function and
+ toHTMLElement(deprecatedNode()->document().focusedElement())->directionalityIfhasDirAutoAttribute(isAuto);
leviw_travelin_and_unemployed 2014/05/28 17:42:31 directionalityIfhasDirAutoAttributre returns the d
Habib Virji 2014/05/29 07:58:26 directionalityIfhasDirAutoAttribute takes bool arg
Habib Virji 2014/05/29 11:31:51 Done.
+ if (isAuto)
+ caretOffset = (inlineBox->bidiLevel() < level) ? inlineBox->caretLeftmostOffset() : inlineBox->caretRightmostOffset();
+ else
+ caretOffset = inlineBox->caretLeftmostOffset();
} else if (nextBox->bidiLevel() > level) {
// Left edge of a "tertiary" run. Set to the right edge of that run.
while (InlineBox* tertiaryBox = inlineBox->nextLeafChildIgnoringLineBreak()) {

Powered by Google App Engine
This is Rietveld 408576698