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

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

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

Powered by Google App Engine
This is Rietveld 408576698