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

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

Issue 2565103002: Fix mismatched nullptr check for caret paint invalidation. (Closed)
Patch Set: Sync to head and add test baselines. Created 4 years 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 169 matching lines...) Expand 10 before | Expand all | Expand 10 after
180 // invalidate the caret. For example, when running as a layout test the 180 // invalidate the caret. For example, when running as a layout test the
181 // caret blink interval could be zero and thus |m_caretBlinkTimer| will 181 // caret blink interval could be zero and thus |m_caretBlinkTimer| will
182 // never be started. We provide |forceInvalidation| for use by paint 182 // never be started. We provide |forceInvalidation| for use by paint
183 // invalidation internals where we need to invalidate the caret regardless 183 // invalidation internals where we need to invalidate the caret regardless
184 // of timer state. 184 // of timer state.
185 if (!forceInvalidation && !m_caretBlinkTimer.isActive() && 185 if (!forceInvalidation && !m_caretBlinkTimer.isActive() &&
186 newNode == m_previousCaretNode && newRect == m_previousCaretRect && 186 newNode == m_previousCaretNode && newRect == m_previousCaretRect &&
187 m_caretVisibility == m_previousCaretVisibility) 187 m_caretVisibility == m_previousCaretVisibility)
188 return; 188 return;
189 189
190 if (m_previousCaretNode && shouldRepaintCaret(*m_previousCaretAnchorNode)) { 190 if (m_previousCaretAnchorNode &&
191 shouldRepaintCaret(*m_previousCaretAnchorNode)) {
191 invalidateLocalCaretRect(m_previousCaretAnchorNode.get(), 192 invalidateLocalCaretRect(m_previousCaretAnchorNode.get(),
192 m_previousCaretRect); 193 m_previousCaretRect);
193 } 194 }
194 if (newNode && shouldRepaintCaret(*newAnchorNode)) 195 if (newAnchorNode && shouldRepaintCaret(*newAnchorNode))
195 invalidateLocalCaretRect(newAnchorNode, newRect); 196 invalidateLocalCaretRect(newAnchorNode, newRect);
196 m_previousCaretNode = newNode; 197 m_previousCaretNode = newNode;
197 m_previousCaretAnchorNode = newAnchorNode; 198 m_previousCaretAnchorNode = newAnchorNode;
198 m_previousCaretRect = newRect; 199 m_previousCaretRect = newRect;
199 m_previousCaretVisibility = m_caretVisibility; 200 m_previousCaretVisibility = m_caretVisibility;
200 } 201 }
201 202
202 IntRect FrameCaret::absoluteCaretBounds() { 203 IntRect FrameCaret::absoluteCaretBounds() {
203 DCHECK_NE(m_frame->document()->lifecycle().state(), 204 DCHECK_NE(m_frame->document()->lifecycle().state(),
204 DocumentLifecycle::InPaintInvalidation); 205 DocumentLifecycle::InPaintInvalidation);
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
289 290
290 void FrameCaret::caretBlinkTimerFired(TimerBase*) { 291 void FrameCaret::caretBlinkTimerFired(TimerBase*) {
291 DCHECK_EQ(m_caretVisibility, CaretVisibility::Visible); 292 DCHECK_EQ(m_caretVisibility, CaretVisibility::Visible);
292 if (isCaretBlinkingSuspended() && m_shouldPaintCaret) 293 if (isCaretBlinkingSuspended() && m_shouldPaintCaret)
293 return; 294 return;
294 m_shouldPaintCaret = !m_shouldPaintCaret; 295 m_shouldPaintCaret = !m_shouldPaintCaret;
295 setCaretRectNeedsUpdate(); 296 setCaretRectNeedsUpdate();
296 } 297 }
297 298
298 } // namespace blink 299 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/LayoutTests/platform/win/virtual/spinvalidation/paint/invalidation/caret-contenteditable-content-after-expected.txt ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698