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

Unified Diff: third_party/WebKit/Source/core/editing/FrameCaretTest.cpp

Issue 2887303002: Blink caret only if selection has focus. (Closed)
Patch Set: update Created 3 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
« no previous file with comments | « third_party/WebKit/Source/core/editing/FrameCaret.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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
« no previous file with comments | « third_party/WebKit/Source/core/editing/FrameCaret.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698