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

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

Issue 2612713002: Move core/editing timer to frame-specific task runners. (Closed)
Patch Set: Created 3 years, 11 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
11 * documentation and/or other materials provided with the distribution. 11 * documentation and/or other materials provided with the distribution.
12 * 12 *
13 * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY 13 * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
14 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 14 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
15 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 15 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
16 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR 16 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
17 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 17 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
18 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 18 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
19 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 19 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
20 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY 20 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
21 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 21 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
23 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 23 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24 */ 24 */
25 25
26 #include "core/editing/FrameCaret.h" 26 #include "core/editing/FrameCaret.h"
27 27
28 #include "core/dom/TaskRunnerHelper.h"
28 #include "core/editing/EditingUtilities.h" 29 #include "core/editing/EditingUtilities.h"
29 #include "core/editing/Editor.h" 30 #include "core/editing/Editor.h"
30 #include "core/editing/SelectionEditor.h" 31 #include "core/editing/SelectionEditor.h"
31 #include "core/editing/commands/CompositeEditCommand.h" 32 #include "core/editing/commands/CompositeEditCommand.h"
32 #include "core/frame/FrameView.h" 33 #include "core/frame/FrameView.h"
33 #include "core/frame/LocalFrame.h" 34 #include "core/frame/LocalFrame.h"
34 #include "core/frame/Settings.h" 35 #include "core/frame/Settings.h"
35 #include "core/html/TextControlElement.h" 36 #include "core/html/TextControlElement.h"
36 #include "core/layout/LayoutTheme.h" 37 #include "core/layout/LayoutTheme.h"
37 #include "core/layout/api/LayoutPartItem.h" 38 #include "core/layout/api/LayoutPartItem.h"
38 #include "core/page/Page.h" 39 #include "core/page/Page.h"
39 #include "core/paint/PaintLayer.h" 40 #include "core/paint/PaintLayer.h"
40 #include "public/platform/WebTraceLocation.h" 41 #include "public/platform/WebTraceLocation.h"
41 42
42 namespace blink { 43 namespace blink {
43 44
44 FrameCaret::FrameCaret(LocalFrame* frame, 45 FrameCaret::FrameCaret(LocalFrame& frame,
45 const SelectionEditor& selectionEditor) 46 const SelectionEditor& selectionEditor)
46 : m_selectionEditor(&selectionEditor), 47 : m_selectionEditor(&selectionEditor),
47 m_frame(frame), 48 m_frame(frame),
48 m_caretVisibility(CaretVisibility::Hidden), 49 m_caretVisibility(CaretVisibility::Hidden),
49 m_previousCaretVisibility(CaretVisibility::Hidden), 50 m_previousCaretVisibility(CaretVisibility::Hidden),
50 m_caretBlinkTimer(this, &FrameCaret::caretBlinkTimerFired), 51 m_caretBlinkTimer(TaskRunnerHelper::get(TaskType::UnspecedTimer, &frame),
52 this,
53 &FrameCaret::caretBlinkTimerFired),
51 m_caretRectDirty(true), 54 m_caretRectDirty(true),
52 m_shouldPaintCaret(true), 55 m_shouldPaintCaret(true),
53 m_isCaretBlinkingSuspended(false), 56 m_isCaretBlinkingSuspended(false),
54 m_shouldShowBlockCursor(false) { 57 m_shouldShowBlockCursor(false) {}
55 DCHECK(frame);
56 }
57 58
58 FrameCaret::~FrameCaret() = default; 59 FrameCaret::~FrameCaret() = default;
59 60
60 DEFINE_TRACE(FrameCaret) { 61 DEFINE_TRACE(FrameCaret) {
61 visitor->trace(m_selectionEditor); 62 visitor->trace(m_selectionEditor);
62 visitor->trace(m_frame); 63 visitor->trace(m_frame);
63 visitor->trace(m_previousCaretNode); 64 visitor->trace(m_previousCaretNode);
64 visitor->trace(m_previousCaretAnchorNode); 65 visitor->trace(m_previousCaretAnchorNode);
65 CaretBase::trace(visitor); 66 CaretBase::trace(visitor);
66 } 67 }
(...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after
298 299
299 void FrameCaret::caretBlinkTimerFired(TimerBase*) { 300 void FrameCaret::caretBlinkTimerFired(TimerBase*) {
300 DCHECK_EQ(m_caretVisibility, CaretVisibility::Visible); 301 DCHECK_EQ(m_caretVisibility, CaretVisibility::Visible);
301 if (isCaretBlinkingSuspended() && m_shouldPaintCaret) 302 if (isCaretBlinkingSuspended() && m_shouldPaintCaret)
302 return; 303 return;
303 m_shouldPaintCaret = !m_shouldPaintCaret; 304 m_shouldPaintCaret = !m_shouldPaintCaret;
304 setCaretRectNeedsUpdate(); 305 setCaretRectNeedsUpdate();
305 } 306 }
306 307
307 } // namespace blink 308 } // namespace blink
OLDNEW
« 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