Index: third_party/WebKit/Source/core/editing/FrameCaretTest.cpp |
diff --git a/third_party/WebKit/Source/core/editing/FrameCaretTest.cpp b/third_party/WebKit/Source/core/editing/FrameCaretTest.cpp |
index e6c9b9c142893e0a4b08467ef76e0e7d7e169c07..aa1a1991f8c2491294d73384fd1fa0e5dff4056e 100644 |
--- a/third_party/WebKit/Source/core/editing/FrameCaretTest.cpp |
+++ b/third_party/WebKit/Source/core/editing/FrameCaretTest.cpp |
@@ -27,6 +27,10 @@ class FrameCaretTest : public EditingTestBase { |
LayoutTestSupport::SetIsRunningLayoutTest(was_running_layout_test_); |
} |
+ static bool ShouldBlinkCaret(const FrameCaret& caret) { |
+ return caret.ShouldBlinkCaret(); |
+ } |
+ |
private: |
const bool was_running_layout_test_; |
}; |
@@ -71,4 +75,23 @@ TEST_F(FrameCaretTest, BlinkAfterTyping) { |
<< "The caret should blink after the typing command."; |
} |
+TEST_F(FrameCaretTest, ShouldNotBlinkWhenSelectionLooseFocus) { |
+ FrameCaret& caret = Selection().FrameCaretForTesting(); |
+ GetDocument().GetPage()->GetFocusController().SetActive(true); |
+ GetDocument().GetPage()->GetFocusController().SetFocused(true); |
+ GetDocument().body()->setInnerHTML( |
+ "<div id='outer' tabindex='-1'>" |
+ "<div id='input' contenteditable>foo</div>" |
+ "</div>"); |
+ Element* input = GetDocument().QuerySelector("#input"); |
+ input->focus(); |
+ Element* outer = GetDocument().QuerySelector("#outer"); |
+ outer->focus(); |
+ GetDocument().View()->UpdateAllLifecyclePhases(); |
+ const SelectionInDOMTree& selection = Selection().GetSelectionInDOMTree(); |
+ EXPECT_EQ(selection.Base(), |
+ Position(input, PositionAnchorType::kBeforeChildren)); |
+ EXPECT_FALSE(ShouldBlinkCaret(caret)); |
+} |
+ |
} // namespace blink |