| Index: third_party/WebKit/Source/core/editing/FrameSelection.cpp
|
| diff --git a/third_party/WebKit/Source/core/editing/FrameSelection.cpp b/third_party/WebKit/Source/core/editing/FrameSelection.cpp
|
| index 91eca913ae3b82fd15416100e242ca674fee44bd..decdf8298f69484fdba6bd5410c017621d4af8b5 100644
|
| --- a/third_party/WebKit/Source/core/editing/FrameSelection.cpp
|
| +++ b/third_party/WebKit/Source/core/editing/FrameSelection.cpp
|
| @@ -434,15 +434,22 @@ bool FrameSelection::SelectionHasFocus() const {
|
| return false;
|
|
|
| // No focused element means document root has focus.
|
| - const Element* const focused_element = GetDocument().FocusedElement()
|
| - ? GetDocument().FocusedElement()
|
| - : GetDocument().documentElement();
|
| + Element* const focused_element = GetDocument().FocusedElement()
|
| + ? GetDocument().FocusedElement()
|
| + : GetDocument().documentElement();
|
| if (!focused_element)
|
| return false;
|
|
|
| if (focused_element->IsTextControl())
|
| return focused_element->ContainsIncludingHostElements(*current);
|
|
|
| + // Selection has focus if it contains the focused element.
|
| + const PositionInFlatTree& focused_position =
|
| + PositionInFlatTree::FirstPositionInNode(focused_element);
|
| + if (ComputeVisibleSelectionInFlatTree().Start() <= focused_position &&
|
| + ComputeVisibleSelectionInFlatTree().end() >= focused_position)
|
| + return true;
|
| +
|
| bool has_editable_style = HasEditableStyle(*current);
|
| do {
|
| // If the selection is within an editable sub tree and that sub tree
|
|
|