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

Side by Side Diff: Source/core/editing/Caret.cpp

Issue 506553004: Make the compositing assert disabler for paint invalidation more targeted. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Fix. Created 6 years, 3 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | Source/core/frame/FrameView.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "config.h" 26 #include "config.h"
27 #include "core/editing/Caret.h" 27 #include "core/editing/Caret.h"
28 28
29 #include "core/dom/Document.h" 29 #include "core/dom/Document.h"
30 #include "core/editing/VisibleUnits.h" 30 #include "core/editing/VisibleUnits.h"
31 #include "core/editing/htmlediting.h" 31 #include "core/editing/htmlediting.h"
32 #include "core/frame/LocalFrame.h" 32 #include "core/frame/LocalFrame.h"
33 #include "core/frame/Settings.h" 33 #include "core/frame/Settings.h"
34 #include "core/html/HTMLTextFormControlElement.h" 34 #include "core/html/HTMLTextFormControlElement.h"
35 #include "core/rendering/RenderBlock.h" 35 #include "core/rendering/RenderBlock.h"
36 #include "core/rendering/RenderLayer.h"
36 #include "core/rendering/RenderView.h" 37 #include "core/rendering/RenderView.h"
37 #include "platform/graphics/GraphicsContext.h" 38 #include "platform/graphics/GraphicsContext.h"
38 39
39 namespace blink { 40 namespace blink {
40 41
41 CaretBase::CaretBase(CaretVisibility visibility) 42 CaretBase::CaretBase(CaretVisibility visibility)
42 : m_caretRectNeedsUpdate(true) 43 : m_caretRectNeedsUpdate(true)
43 , m_caretVisibility(visibility) 44 , m_caretVisibility(visibility)
44 { 45 {
45 } 46 }
46 47
47 DragCaretController::DragCaretController() 48 DragCaretController::DragCaretController()
48 : CaretBase(Visible) 49 : CaretBase(Visible)
49 { 50 {
50 } 51 }
51 52
52 PassOwnPtrWillBeRawPtr<DragCaretController> DragCaretController::create() 53 PassOwnPtrWillBeRawPtr<DragCaretController> DragCaretController::create()
53 { 54 {
54 return adoptPtrWillBeNoop(new DragCaretController); 55 return adoptPtrWillBeNoop(new DragCaretController);
55 } 56 }
56 57
57 bool DragCaretController::isContentRichlyEditable() const 58 bool DragCaretController::isContentRichlyEditable() const
58 { 59 {
59 return isRichlyEditablePosition(m_position.deepEquivalent()); 60 return isRichlyEditablePosition(m_position.deepEquivalent());
60 } 61 }
61 62
62 void DragCaretController::setCaretPosition(const VisiblePosition& position) 63 void DragCaretController::setCaretPosition(const VisiblePosition& position)
63 { 64 {
65 // for querying RenderLayer::compositingState()
66 // This code is probably correct, since it doesn't occur in a stack that inv olves updating compositing state.
67 DisableCompositingQueryAsserts disabler;
68
64 if (Node* node = m_position.deepEquivalent().deprecatedNode()) 69 if (Node* node = m_position.deepEquivalent().deprecatedNode())
65 invalidateCaretRect(node); 70 invalidateCaretRect(node);
66 m_position = position; 71 m_position = position;
67 setCaretRectNeedsUpdate(); 72 setCaretRectNeedsUpdate();
68 Document* document = 0; 73 Document* document = 0;
69 if (Node* node = m_position.deepEquivalent().deprecatedNode()) { 74 if (Node* node = m_position.deepEquivalent().deprecatedNode()) {
70 invalidateCaretRect(node); 75 invalidateCaretRect(node);
71 document = &node->document(); 76 document = &node->document();
72 } 77 }
73 if (m_position.isNull() || m_position.isOrphan()) { 78 if (m_position.isNull() || m_position.isOrphan()) {
(...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after
268 context->fillRect(caret, caretColor); 273 context->fillRect(caret, caretColor);
269 } 274 }
270 275
271 void DragCaretController::paintDragCaret(LocalFrame* frame, GraphicsContext* p, const LayoutPoint& paintOffset, const LayoutRect& clipRect) const 276 void DragCaretController::paintDragCaret(LocalFrame* frame, GraphicsContext* p, const LayoutPoint& paintOffset, const LayoutRect& clipRect) const
272 { 277 {
273 if (m_position.deepEquivalent().deprecatedNode()->document().frame() == fram e) 278 if (m_position.deepEquivalent().deprecatedNode()->document().frame() == fram e)
274 paintCaret(m_position.deepEquivalent().deprecatedNode(), p, paintOffset, clipRect); 279 paintCaret(m_position.deepEquivalent().deprecatedNode(), p, paintOffset, clipRect);
275 } 280 }
276 281
277 } 282 }
OLDNEW
« no previous file with comments | « no previous file | Source/core/frame/FrameView.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698