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

Side by Side Diff: third_party/WebKit/Source/core/editing/CaretBase.h

Issue 2271883002: Fix paint invalidation and painting for composited-scrolling input elements. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: none Created 4 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
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010 Apple Inc. All rights reserved. 2 * Copyright (C) 2004, 2005, 2006, 2007, 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 12 matching lines...) Expand all
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 #ifndef CaretBase_h 26 #ifndef CaretBase_h
27 #define CaretBase_h 27 #define CaretBase_h
28 28
29 #include "core/CoreExport.h" 29 #include "core/CoreExport.h"
30 #include "core/editing/VisiblePosition.h" 30 #include "core/editing/VisiblePosition.h"
31 #include "platform/geometry/IntRect.h" 31 #include "platform/geometry/IntRect.h"
32 #include "platform/geometry/LayoutRect.h" 32 #include "platform/geometry/LayoutRect.h"
33 #include "platform/graphics/paint/DisplayItem.h"
33 #include "wtf/Noncopyable.h" 34 #include "wtf/Noncopyable.h"
34 35
35 namespace blink { 36 namespace blink {
36 37
37 class CullRect; 38 class CullRect;
39 class DisplayItemClient;
38 class LocalFrame; 40 class LocalFrame;
39 class GraphicsContext; 41 class GraphicsContext;
40 class LayoutBlock; 42 class LayoutBlock;
41 class LayoutViewItem; 43 class LayoutViewItem;
42 44
43 enum class CaretVisibility { Visible, Hidden }; 45 enum class CaretVisibility { Visible, Hidden };
44 46
45 class CORE_EXPORT CaretBase : public GarbageCollectedFinalized<CaretBase> { 47 class CORE_EXPORT CaretBase : public GarbageCollectedFinalized<CaretBase> {
46 WTF_MAKE_NONCOPYABLE(CaretBase); 48 WTF_MAKE_NONCOPYABLE(CaretBase);
47 public: 49 public:
48 explicit CaretBase(CaretVisibility = CaretVisibility::Hidden); 50 explicit CaretBase(CaretVisibility = CaretVisibility::Hidden);
49 virtual ~CaretBase(); 51 virtual ~CaretBase();
50 52
51 void invalidateCaretRect(Node*, bool caretRectChanged = false); 53 void invalidateCaretRect(Node*, bool caretRectChanged = false);
52 void clearCaretRect(); 54 void clearCaretRect();
53 // Creating VisiblePosition causes synchronous layout so we should use the 55 // Creating VisiblePosition causes synchronous layout so we should use the
54 // PositionWithAffinity version if possible. 56 // PositionWithAffinity version if possible.
55 // A position in HTMLTextFromControlElement is a typical example. 57 // A position in HTMLTextFromControlElement is a typical example.
56 bool updateCaretRect(const PositionWithAffinity& caretPosition); 58 bool updateCaretRect(const PositionWithAffinity& caretPosition);
57 bool updateCaretRect(const VisiblePosition& caretPosition); 59 bool updateCaretRect(const VisiblePosition& caretPosition);
58 IntRect absoluteBoundsForLocalRect(Node*, const LayoutRect&) const; 60 IntRect absoluteBoundsForLocalRect(Node*, const LayoutRect&) const;
59 bool shouldRepaintCaret(Node&) const; 61 bool shouldRepaintCaret(Node&) const;
60 bool shouldRepaintCaret(const LayoutViewItem) const; 62 bool shouldRepaintCaret(const LayoutViewItem) const;
61 void paintCaret(Node*, GraphicsContext&, const LayoutPoint&) const; 63 void paintCaret(Node*, GraphicsContext&, const LayoutPoint&, DisplayItem::Ty pe) const;
62 64
63 const LayoutRect& localCaretRectWithoutUpdate() const { return m_caretLocalR ect; } 65 const LayoutRect& localCaretRectWithoutUpdate() const { return m_caretLocalR ect; }
64 66
65 virtual void setCaretVisibility(CaretVisibility); 67 virtual void setCaretVisibility(CaretVisibility);
66 bool caretIsVisible() const { return m_caretVisibility == CaretVisibility::V isible; } 68 bool caretIsVisible() const { return m_caretVisibility == CaretVisibility::V isible; }
67 CaretVisibility getCaretVisibility() const { return m_caretVisibility; } 69 CaretVisibility getCaretVisibility() const { return m_caretVisibility; }
68 70
69 static LayoutBlock* caretLayoutObject(Node*); 71 static LayoutBlock* caretLayoutObject(Node*);
70 static void invalidateLocalCaretRect(Node*, const LayoutRect&); 72 static void invalidateLocalCaretRect(Node*, const LayoutRect&);
71 73
72 DECLARE_VIRTUAL_TRACE(); 74 DECLARE_VIRTUAL_TRACE();
73 75
74 private: 76 private:
77 static DisplayItemClient* displayItemClientForCaret(Node*);
78
75 LayoutRect m_caretLocalRect; // caret rect in coords local to the layoutObje ct responsible for painting the caret 79 LayoutRect m_caretLocalRect; // caret rect in coords local to the layoutObje ct responsible for painting the caret
76 CaretVisibility m_caretVisibility; 80 CaretVisibility m_caretVisibility;
77 }; 81 };
78 82
79 } // namespace blink 83 } // namespace blink
80 84
81 #endif // CaretBase_h 85 #endif // CaretBase_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698