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

Side by Side Diff: third_party/WebKit/Source/core/editing/FrameCaret.cpp

Issue 2737043002: Fix caret paint invalidation issue on partial lifecycle updates (Closed)
Patch Set: Created 3 years, 9 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 unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2004, 2008, 2009, 2010 Apple Inc. All rights reserved. 2 * Copyright (C) 2004, 2008, 2009, 2010 Apple Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after
126 } 126 }
127 127
128 void FrameCaret::clearPreviousVisualRect(const LayoutBlock& block) { 128 void FrameCaret::clearPreviousVisualRect(const LayoutBlock& block) {
129 m_displayItemClient->clearPreviousVisualRect(block); 129 m_displayItemClient->clearPreviousVisualRect(block);
130 } 130 }
131 131
132 void FrameCaret::layoutBlockWillBeDestroyed(const LayoutBlock& block) { 132 void FrameCaret::layoutBlockWillBeDestroyed(const LayoutBlock& block) {
133 m_displayItemClient->layoutBlockWillBeDestroyed(block); 133 m_displayItemClient->layoutBlockWillBeDestroyed(block);
134 } 134 }
135 135
136 void FrameCaret::updateStyleAndLayoutIfNeeded() { 136 void FrameCaret::updateForPaintInvalidation() {
137 DCHECK_GE(m_frame->document()->lifecycle().state(), 137 DCHECK_GE(m_frame->document()->lifecycle().state(),
138 DocumentLifecycle::LayoutClean); 138 DocumentLifecycle::LayoutClean);
139 updateAppearance(); 139 updateAppearance();
140 bool shouldPaintCaret = 140 bool shouldPaintCaret =
141 m_shouldPaintCaret && isActive() && 141 m_shouldPaintCaret && isActive() &&
142 m_caretVisibility == CaretVisibility::Visible && 142 m_caretVisibility == CaretVisibility::Visible &&
143 m_selectionEditor->computeVisibleSelectionInDOMTree().hasEditableStyle(); 143 m_selectionEditor->computeVisibleSelectionInDOMTree().hasEditableStyle();
144 144
145 m_displayItemClient->updateStyleAndLayoutIfNeeded( 145 m_displayItemClient->updateForPaintInvalidation(
146 shouldPaintCaret ? caretPosition() : PositionWithAffinity()); 146 shouldPaintCaret ? caretPosition() : PositionWithAffinity());
147 } 147 }
148 148
149 void FrameCaret::invalidatePaintIfNeeded(const LayoutBlock& block, 149 void FrameCaret::invalidatePaintIfNeeded(const LayoutBlock& block,
150 const PaintInvalidatorContext& context, 150 const PaintInvalidatorContext& context,
151 PaintInvalidationReason reason) { 151 PaintInvalidationReason reason) {
152 m_displayItemClient->invalidatePaintIfNeeded(block, context, reason); 152 m_displayItemClient->invalidatePaintIfNeeded(block, context, reason);
153 } 153 }
154 154
155 bool FrameCaret::caretPositionIsValidForDocument( 155 bool FrameCaret::caretPositionIsValidForDocument(
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
229 frameView->scheduleVisualUpdateForPaintInvalidationIfNeeded(); 229 frameView->scheduleVisualUpdateForPaintInvalidationIfNeeded();
230 } 230 }
231 231
232 void FrameCaret::recreateCaretBlinkTimerForTesting( 232 void FrameCaret::recreateCaretBlinkTimerForTesting(
233 RefPtr<WebTaskRunner> taskRunner) { 233 RefPtr<WebTaskRunner> taskRunner) {
234 m_caretBlinkTimer.reset(new TaskRunnerTimer<FrameCaret>( 234 m_caretBlinkTimer.reset(new TaskRunnerTimer<FrameCaret>(
235 std::move(taskRunner), this, &FrameCaret::caretBlinkTimerFired)); 235 std::move(taskRunner), this, &FrameCaret::caretBlinkTimerFired));
236 } 236 }
237 237
238 } // namespace blink 238 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698