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

Side by Side Diff: sky/engine/core/editing/Caret.h

Issue 845093002: Delete an assortment of unneeded paint invalidation code. (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 5 years, 11 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 | sky/engine/core/editing/Caret.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 28 matching lines...) Expand all
39 class RenderBlock; 39 class RenderBlock;
40 class RenderView; 40 class RenderView;
41 41
42 class CaretBase { 42 class CaretBase {
43 WTF_MAKE_NONCOPYABLE(CaretBase); 43 WTF_MAKE_NONCOPYABLE(CaretBase);
44 WTF_MAKE_FAST_ALLOCATED; 44 WTF_MAKE_FAST_ALLOCATED;
45 protected: 45 protected:
46 enum CaretVisibility { Visible, Hidden }; 46 enum CaretVisibility { Visible, Hidden };
47 explicit CaretBase(CaretVisibility = Hidden); 47 explicit CaretBase(CaretVisibility = Hidden);
48 48
49 void invalidateCaretRect(Node*, bool caretRectChanged = false);
50 void clearCaretRect(); 49 void clearCaretRect();
51 // Creating VisiblePosition causes synchronous layout so we should use the 50 // Creating VisiblePosition causes synchronous layout so we should use the
52 // PositionWithAffinity version if possible. 51 // PositionWithAffinity version if possible.
53 // A position in HTMLTextFromControlElement is a typical example. 52 // A position in HTMLTextFromControlElement is a typical example.
54 bool updateCaretRect(Document*, const PositionWithAffinity& caretPosition); 53 bool updateCaretRect(Document*, const PositionWithAffinity& caretPosition);
55 bool updateCaretRect(Document*, const VisiblePosition& caretPosition); 54 bool updateCaretRect(Document*, const VisiblePosition& caretPosition);
56 IntRect absoluteBoundsForLocalRect(Node*, const LayoutRect&) const; 55 IntRect absoluteBoundsForLocalRect(Node*, const LayoutRect&) const;
57 void paintCaret(Node*, GraphicsContext*, const LayoutPoint&, const LayoutRec t& clipRect) const; 56 void paintCaret(Node*, GraphicsContext*, const LayoutPoint&, const LayoutRec t& clipRect) const;
58 57
59 const LayoutRect& localCaretRectWithoutUpdate() const { return m_caretLocalR ect; } 58 const LayoutRect& localCaretRectWithoutUpdate() const { return m_caretLocalR ect; }
60 59
61 bool shouldUpdateCaretRect() const { return m_caretRectNeedsUpdate; } 60 bool shouldUpdateCaretRect() const { return m_caretRectNeedsUpdate; }
62 void setCaretRectNeedsUpdate() { m_caretRectNeedsUpdate = true; } 61 void setCaretRectNeedsUpdate() { m_caretRectNeedsUpdate = true; }
63 62
64 void setCaretVisibility(CaretVisibility visibility) { m_caretVisibility = vi sibility; } 63 void setCaretVisibility(CaretVisibility visibility) { m_caretVisibility = vi sibility; }
65 bool caretIsVisible() const { return m_caretVisibility == Visible; } 64 bool caretIsVisible() const { return m_caretVisibility == Visible; }
66 CaretVisibility caretVisibility() const { return m_caretVisibility; } 65 CaretVisibility caretVisibility() const { return m_caretVisibility; }
67 66
68 protected: 67 protected:
69 static RenderBlock* caretRenderer(Node*); 68 static RenderBlock* caretRenderer(Node*);
70 static void invalidateLocalCaretRect(Node*, const LayoutRect&);
71 69
72 private: 70 private:
73 LayoutRect m_caretLocalRect; // caret rect in coords local to the renderer r esponsible for painting the caret 71 LayoutRect m_caretLocalRect; // caret rect in coords local to the renderer r esponsible for painting the caret
74 bool m_caretRectNeedsUpdate; // true if m_caretRect (and m_absCaretBounds in FrameSelection) need to be calculated 72 bool m_caretRectNeedsUpdate; // true if m_caretRect (and m_absCaretBounds in FrameSelection) need to be calculated
75 CaretVisibility m_caretVisibility; 73 CaretVisibility m_caretVisibility;
76 }; 74 };
77 75
78 class DragCaretController final : private CaretBase { 76 class DragCaretController final : private CaretBase {
79 WTF_MAKE_NONCOPYABLE(DragCaretController); 77 WTF_MAKE_NONCOPYABLE(DragCaretController);
80 WTF_MAKE_FAST_ALLOCATED; 78 WTF_MAKE_FAST_ALLOCATED;
(...skipping 16 matching lines...) Expand all
97 private: 95 private:
98 DragCaretController(); 96 DragCaretController();
99 97
100 VisiblePosition m_position; 98 VisiblePosition m_position;
101 }; 99 };
102 100
103 } // namespace blink 101 } // namespace blink
104 102
105 103
106 #endif // SKY_ENGINE_CORE_EDITING_CARET_H_ 104 #endif // SKY_ENGINE_CORE_EDITING_CARET_H_
OLDNEW
« no previous file with comments | « no previous file | sky/engine/core/editing/Caret.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698