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

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

Issue 2296203002: Make CaretBase a DisplayItemClient. (Closed)
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
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/editing/CaretBase.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, 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 26 matching lines...) Expand all
37 37
38 class CullRect; 38 class CullRect;
39 class DisplayItemClient; 39 class DisplayItemClient;
40 class LocalFrame; 40 class LocalFrame;
41 class GraphicsContext; 41 class GraphicsContext;
42 class LayoutBlock; 42 class LayoutBlock;
43 class LayoutViewItem; 43 class LayoutViewItem;
44 44
45 enum class CaretVisibility { Visible, Hidden }; 45 enum class CaretVisibility { Visible, Hidden };
46 46
47 class CORE_EXPORT CaretBase : public GarbageCollectedFinalized<CaretBase> { 47 class CORE_EXPORT CaretBase : public GarbageCollectedFinalized<CaretBase>, Disp layItemClient {
48 WTF_MAKE_NONCOPYABLE(CaretBase); 48 WTF_MAKE_NONCOPYABLE(CaretBase);
49 public: 49 public:
50 explicit CaretBase(CaretVisibility = CaretVisibility::Hidden); 50 explicit CaretBase(CaretVisibility = CaretVisibility::Hidden);
51 virtual ~CaretBase(); 51 virtual ~CaretBase();
52 52
53 void invalidateCaretRect(Node*, bool caretRectChanged = false); 53 void invalidateCaretRect(Node*, bool caretRectChanged = false);
54 void clearCaretRect(); 54 void clearCaretRect();
55 // Creating VisiblePosition causes synchronous layout so we should use the 55 // Creating VisiblePosition causes synchronous layout so we should use the
56 // PositionWithAffinity version if possible. 56 // PositionWithAffinity version if possible.
57 // A position in HTMLTextFromControlElement is a typical example. 57 // A position in HTMLTextFromControlElement is a typical example.
58 bool updateCaretRect(const PositionWithAffinity& caretPosition); 58 bool updateCaretRect(const PositionWithAffinity& caretPosition);
59 bool updateCaretRect(const VisiblePosition& caretPosition); 59 bool updateCaretRect(const VisiblePosition& caretPosition);
60 IntRect absoluteBoundsForLocalRect(Node*, const LayoutRect&) const; 60 IntRect absoluteBoundsForLocalRect(Node*, const LayoutRect&) const;
61 bool shouldRepaintCaret(Node&) const; 61 bool shouldRepaintCaret(Node&) const;
62 bool shouldRepaintCaret(const LayoutViewItem) const; 62 bool shouldRepaintCaret(const LayoutViewItem) const;
63 void paintCaret(Node*, GraphicsContext&, const LayoutPoint&, DisplayItem::Ty pe) const; 63 void paintCaret(Node*, GraphicsContext&, const LayoutPoint&, DisplayItem::Ty pe) const;
64 64
65 const LayoutRect& localCaretRectWithoutUpdate() const { return m_caretLocalR ect; } 65 const LayoutRect& localCaretRectWithoutUpdate() const { return m_caretLocalR ect; }
66 66
67 virtual void setCaretVisibility(CaretVisibility); 67 virtual void setCaretVisibility(CaretVisibility);
68 bool caretIsVisible() const { return m_caretVisibility == CaretVisibility::V isible; } 68 bool caretIsVisible() const { return m_caretVisibility == CaretVisibility::V isible; }
69 CaretVisibility getCaretVisibility() const { return m_caretVisibility; } 69 CaretVisibility getCaretVisibility() const { return m_caretVisibility; }
70 70
71 static LayoutBlock* caretLayoutObject(Node*); 71 static LayoutBlock* caretLayoutObject(Node*);
72 static void invalidateLocalCaretRect(Node*, const LayoutRect&); 72 void invalidateLocalCaretRect(Node*, const LayoutRect&);
73
74 // DisplayItemClient methods.
75 LayoutRect visualRect() const override;
76 String debugName() const final;
73 77
74 DECLARE_VIRTUAL_TRACE(); 78 DECLARE_VIRTUAL_TRACE();
75 79
76 private: 80 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 81 LayoutRect m_caretLocalRect; // caret rect in coords local to the layoutObje ct responsible for painting the caret
80 CaretVisibility m_caretVisibility; 82 CaretVisibility m_caretVisibility;
83 LayoutRect m_visualRect;
81 }; 84 };
82 85
83 } // namespace blink 86 } // namespace blink
84 87
85 #endif // CaretBase_h 88 #endif // CaretBase_h
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/editing/CaretBase.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698