Index: third_party/WebKit/Source/core/dom/Element.cpp |
diff --git a/third_party/WebKit/Source/core/dom/Element.cpp b/third_party/WebKit/Source/core/dom/Element.cpp |
index 2fde2c526802721659102806ad693fc66f3f70b6..147bb266e0eb3a1a14c019ff5615d12fa7ac44fa 100644 |
--- a/third_party/WebKit/Source/core/dom/Element.cpp |
+++ b/third_party/WebKit/Source/core/dom/Element.cpp |
@@ -2681,8 +2681,9 @@ void Element::updateFocusAppearance( |
SelectionBehaviorOnFocus selectionBehavior) { |
if (selectionBehavior == SelectionBehaviorOnFocus::None) |
return; |
+ |
+ LocalFrame* frame = document().frame(); |
yosin_UTC9
2017/02/09 13:02:17
We can early return here if |!frame|.
Let's hoist
|
if (isRootEditableElement(*this)) { |
- LocalFrame* frame = document().frame(); |
if (!frame) |
return; |
@@ -2706,8 +2707,13 @@ void Element::updateFocusAppearance( |
FrameSelection::CloseTyping | FrameSelection::ClearTypingStyle | |
FrameSelection::DoNotSetFocus); |
frame->selection().revealSelection(); |
- } else if (layoutObject() && !layoutObject()->isLayoutPart()) { |
- layoutObject()->scrollRectToVisible(boundingBox()); |
+ } else { |
+ // This element is non editable. |
+ if (frame) |
+ frame->selection().clear(); |
yosin_UTC9
2017/02/09 13:02:17
Focus and selection are individual identity. We do
hugoh_UTC2
2017/02/11 03:42:22
True, here we would clear() too often. Let's put t
|
+ |
+ if (layoutObject() && !layoutObject()->isLayoutPart()) |
+ layoutObject()->scrollRectToVisible(boundingBox()); |
} |
} |