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

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

Issue 2325933002: Move m_caretVisibility from CaretBase to FrameCaret (Closed)
Patch Set: 2016-09-09T14:05:22 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 24 matching lines...) Expand all
35 35
36 namespace blink { 36 namespace blink {
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 };
46
47 class CORE_EXPORT CaretBase : public GarbageCollectedFinalized<CaretBase>, publi c DisplayItemClient { 45 class CORE_EXPORT CaretBase : public GarbageCollectedFinalized<CaretBase>, publi c DisplayItemClient {
48 WTF_MAKE_NONCOPYABLE(CaretBase); 46 WTF_MAKE_NONCOPYABLE(CaretBase);
49 public: 47 public:
50 explicit CaretBase(CaretVisibility = CaretVisibility::Hidden); 48 CaretBase();
51 virtual ~CaretBase(); 49 virtual ~CaretBase();
52 50
53 void invalidateCaretRect(Node*); 51 void invalidateCaretRect(Node*);
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&, DisplayItem::Ty pe) 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);
68 bool caretIsVisible() const { return m_caretVisibility == CaretVisibility::V isible; }
69 CaretVisibility getCaretVisibility() const { return m_caretVisibility; }
70
71 static LayoutBlock* caretLayoutObject(Node*); 65 static LayoutBlock* caretLayoutObject(Node*);
72 void invalidateLocalCaretRect(Node*, const LayoutRect&); 66 void invalidateLocalCaretRect(Node*, const LayoutRect&);
73 67
74 // DisplayItemClient methods. 68 // DisplayItemClient methods.
75 LayoutRect visualRect() const override; 69 LayoutRect visualRect() const override;
76 String debugName() const final; 70 String debugName() const final;
77 71
78 DECLARE_VIRTUAL_TRACE(); 72 DECLARE_VIRTUAL_TRACE();
79 73
80 private: 74 private:
81 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
82 CaretVisibility m_caretVisibility;
83 LayoutRect m_visualRect; 76 LayoutRect m_visualRect;
84 }; 77 };
85 78
86 } // namespace blink 79 } // namespace blink
87 80
88 #endif // CaretBase_h 81 #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