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

Unified Diff: third_party/WebKit/Source/core/html/TextControlElement.cpp

Issue 2533213003: [Editing] Use VisiblePosition stardOfWord for textarea in spell checker. (Closed)
Patch Set: Created 4 years, 1 month 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/html/TextControlElement.cpp
diff --git a/third_party/WebKit/Source/core/html/TextControlElement.cpp b/third_party/WebKit/Source/core/html/TextControlElement.cpp
index 309427990f1212e56ab1413748eca60b3f9a0132..f901aec61b6deaf68ccdb13351fcd86b7218aa54 100644
--- a/third_party/WebKit/Source/core/html/TextControlElement.cpp
+++ b/third_party/WebKit/Source/core/html/TextControlElement.cpp
@@ -870,11 +870,20 @@ TextControlElement* enclosingTextControl(Node* container) {
if (!container)
return nullptr;
Element* ancestor = container->ownerShadowHost();
- return ancestor && isTextControlElement(*ancestor) &&
- container->containingShadowRoot()->type() ==
- ShadowRootType::UserAgent
- ? toTextControlElement(ancestor)
- : 0;
+
+ if (!ancestor || !isTextControlElement(*ancestor))
+ return nullptr;
+
+ // textarea.shadowRoot is considered not enclosed.
+ if (container->isShadowRoot() &&
+ toShadowRoot(container)->type() == ShadowRootType::UserAgent &&
+ &toShadowRoot(container)->host() == ancestor)
+ return nullptr;
+
+ if (container->containingShadowRoot()->type() != ShadowRootType::UserAgent)
+ return nullptr;
+
+ return toTextControlElement(ancestor);
}
String TextControlElement::directionForFormData() const {

Powered by Google App Engine
This is Rietveld 408576698