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

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

Issue 2680943004: Make FrameSelection to hold non-canonicalized positions (Closed)
Patch Set: 2014-02-14T23:34:22 Update TestExpectation to include extend-{0,2,4}0.html and selectAllChildren.html Created 3 years, 10 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
Index: third_party/WebKit/Source/core/editing/FrameCaret.cpp
diff --git a/third_party/WebKit/Source/core/editing/FrameCaret.cpp b/third_party/WebKit/Source/core/editing/FrameCaret.cpp
index a69dbedbf67c7fc4c8ef97a7a564f5b93b9a9fa0..640f161b6e3af20a571c37df626391730399aa5c 100644
--- a/third_party/WebKit/Source/core/editing/FrameCaret.cpp
+++ b/third_party/WebKit/Source/core/editing/FrameCaret.cpp
@@ -81,20 +81,14 @@ inline static bool shouldStopBlinkingDueToTypingCommand(LocalFrame* frame) {
}
void FrameCaret::updateAppearance() {
+ DCHECK_GE(m_frame->document()->lifecycle().state(),
+ DocumentLifecycle::LayoutClean);
// Paint a block cursor instead of a caret in overtype mode unless the caret
// is at the end of a line (in this case the FrameSelection will paint a
// blinking caret as usual).
- bool paintBlockCursor = m_shouldShowBlockCursor && isActive();
- if (paintBlockCursor) {
- // TODO(editing-dev): Use of updateStyleAndLayoutIgnorePendingStylesheets
- // needs to be audited. see http://crbug.com/590369 for more details.
- // In the long term, we should defer the update of the caret's appearance
- // to prevent synchronous layout.
- m_frame->document()->updateStyleAndLayoutIgnorePendingStylesheets();
-
- if (isLogicalEndOfLine(createVisiblePosition(caretPosition())))
- paintBlockCursor = false;
- }
+ const bool paintBlockCursor =
+ m_shouldShowBlockCursor && isActive() &&
+ !isLogicalEndOfLine(createVisiblePosition(caretPosition()));
bool shouldBlink = !paintBlockCursor && shouldBlinkCaret();
@@ -135,7 +129,8 @@ void FrameCaret::setCaretVisibility(CaretVisibility visibility) {
m_caretVisibility = visibility;
- updateAppearance();
+ if (visibility == CaretVisibility::Hidden)
+ stopCaretBlinkTimer();
scheduleVisualUpdateForPaintInvalidationIfNeeded();
}
@@ -148,6 +143,9 @@ void FrameCaret::layoutBlockWillBeDestroyed(const LayoutBlock& block) {
}
void FrameCaret::updateStyleAndLayoutIfNeeded() {
+ DCHECK_GE(m_frame->document()->lifecycle().state(),
+ DocumentLifecycle::LayoutClean);
+ updateAppearance();
bool shouldPaintCaret =
m_shouldPaintCaret && isActive() &&
m_caretVisibility == CaretVisibility::Visible &&
@@ -199,10 +197,7 @@ IntRect FrameCaret::absoluteCaretBounds() const {
void FrameCaret::setShouldShowBlockCursor(bool shouldShowBlockCursor) {
m_shouldShowBlockCursor = shouldShowBlockCursor;
-
- m_frame->document()->updateStyleAndLayoutIgnorePendingStylesheets();
-
- updateAppearance();
+ scheduleVisualUpdateForPaintInvalidationIfNeeded();
}
bool FrameCaret::shouldPaintCaret(const LayoutBlock& block) const {
« no previous file with comments | « third_party/WebKit/Source/core/editing/FrameCaret.h ('k') | third_party/WebKit/Source/core/editing/FrameSelection.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698