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

Side by Side Diff: Source/core/rendering/RenderSelectionInfo.h

Issue 426083005: Oilpan: Prepare to move RenderSelectionInfoBase to Oilpan heap. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Trace m_repaintContainer too Created 6 years, 4 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | Source/core/rendering/RenderView.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) 2000 Lars Knoll (knoll@kde.org) 2 * Copyright (C) 2000 Lars Knoll (knoll@kde.org)
3 * (C) 2000 Antti Koivisto (koivisto@kde.org) 3 * (C) 2000 Antti Koivisto (koivisto@kde.org)
4 * (C) 2000 Dirk Mueller (mueller@kde.org) 4 * (C) 2000 Dirk Mueller (mueller@kde.org)
5 * (C) 2004 Allan Sandfeld Jensen (kde@carewolf.com) 5 * (C) 2004 Allan Sandfeld Jensen (kde@carewolf.com)
6 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved. 6 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved.
7 * 7 *
8 * This library is free software; you can redistribute it and/or 8 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Library General Public 9 * modify it under the terms of the GNU Library General Public
10 * License as published by the Free Software Foundation; either 10 * License as published by the Free Software Foundation; either
(...skipping 12 matching lines...) Expand all
23 */ 23 */
24 24
25 #ifndef RenderSelectionInfo_h 25 #ifndef RenderSelectionInfo_h
26 #define RenderSelectionInfo_h 26 #define RenderSelectionInfo_h
27 27
28 #include "core/rendering/RenderBox.h" 28 #include "core/rendering/RenderBox.h"
29 #include "platform/geometry/IntRect.h" 29 #include "platform/geometry/IntRect.h"
30 30
31 namespace blink { 31 namespace blink {
32 32
33 class RenderSelectionInfoBase { 33 class RenderSelectionInfoBase : public NoBaseWillBeGarbageCollected<RenderSelect ionInfoBase> {
34 WTF_MAKE_NONCOPYABLE(RenderSelectionInfoBase); WTF_MAKE_FAST_ALLOCATED; 34 WTF_MAKE_NONCOPYABLE(RenderSelectionInfoBase); WTF_MAKE_FAST_ALLOCATED_WILL_ BE_REMOVED;
35 public: 35 public:
36 RenderSelectionInfoBase() 36 RenderSelectionInfoBase()
37 : m_object(0) 37 : m_object(nullptr)
38 , m_repaintContainer(0) 38 , m_repaintContainer(nullptr)
39 , m_state(RenderObject::SelectionNone) 39 , m_state(RenderObject::SelectionNone)
40 { 40 {
41 } 41 }
42 42
43 RenderSelectionInfoBase(RenderObject* o) 43 RenderSelectionInfoBase(RenderObject* o)
44 : m_object(o) 44 : m_object(o)
45 , m_repaintContainer(o->containerForPaintInvalidation()) 45 , m_repaintContainer(o->containerForPaintInvalidation())
46 , m_state(o->selectionState()) 46 , m_state(o->selectionState())
47 { 47 {
48 } 48 }
49 49
50 void trace(Visitor* visitor)
51 {
52 visitor->trace(m_object);
53 visitor->trace(m_repaintContainer);
54 }
55
50 RenderObject* object() const { return m_object; } 56 RenderObject* object() const { return m_object; }
51 const RenderLayerModelObject* repaintContainer() const { return m_repaintCon tainer; } 57 const RenderLayerModelObject* repaintContainer() const { return m_repaintCon tainer; }
52 RenderObject::SelectionState state() const { return m_state; } 58 RenderObject::SelectionState state() const { return m_state; }
53 59
54 protected: 60 protected:
55 RenderObject* m_object; 61 RawPtrWillBeMember<RenderObject> m_object;
56 const RenderLayerModelObject* m_repaintContainer; 62 RawPtrWillBeMember<const RenderLayerModelObject> m_repaintContainer;
57 RenderObject::SelectionState m_state; 63 RenderObject::SelectionState m_state;
58 }; 64 };
59 65
60 // This struct is used when the selection changes to cache the old and new state of the selection for each RenderObject. 66 // This struct is used when the selection changes to cache the old and new state of the selection for each RenderObject.
61 class RenderSelectionInfo : public RenderSelectionInfoBase { 67 class RenderSelectionInfo FINAL : public RenderSelectionInfoBase {
62 public: 68 public:
63 RenderSelectionInfo(RenderObject* o, bool clipToVisibleContent) 69 RenderSelectionInfo(RenderObject* o, bool clipToVisibleContent)
64 : RenderSelectionInfoBase(o) 70 : RenderSelectionInfoBase(o)
65 { 71 {
66 if (o->canUpdateSelectionOnRootLineBoxes()) { 72 if (o->canUpdateSelectionOnRootLineBoxes()) {
67 m_rect = o->selectionRectForPaintInvalidation(m_repaintContainer, cl ipToVisibleContent); 73 m_rect = o->selectionRectForPaintInvalidation(m_repaintContainer, cl ipToVisibleContent);
68 // FIXME: groupedMapping() leaks the squashing abstraction. See Rend erBlockSelectionInfo for more details. 74 // FIXME: groupedMapping() leaks the squashing abstraction. See Rend erBlockSelectionInfo for more details.
69 if (m_repaintContainer && m_repaintContainer->layer()->groupedMappin g()) 75 if (m_repaintContainer && m_repaintContainer->layer()->groupedMappin g())
70 RenderLayer::mapRectToPaintInvalidationBacking(m_repaintContaine r, m_repaintContainer, m_rect); 76 RenderLayer::mapRectToPaintInvalidationBacking(m_repaintContaine r, m_repaintContainer, m_rect);
71 } else { 77 } else {
72 m_rect = LayoutRect(); 78 m_rect = LayoutRect();
73 } 79 }
74 } 80 }
75 81
76 void repaint() 82 void repaint()
77 { 83 {
78 m_object->invalidatePaintUsingContainer(m_repaintContainer, m_rect, Inva lidationSelection); 84 m_object->invalidatePaintUsingContainer(m_repaintContainer, m_rect, Inva lidationSelection);
79 } 85 }
80 86
81 LayoutRect rect() const { return m_rect; } 87 LayoutRect rect() const { return m_rect; }
82 88
83 private: 89 private:
84 LayoutRect m_rect; // relative to repaint container 90 LayoutRect m_rect; // relative to repaint container
85 }; 91 };
86 92
87 93
88 // This struct is used when the selection changes to cache the old and new state of the selection for each RenderBlock. 94 // This struct is used when the selection changes to cache the old and new state of the selection for each RenderBlock.
89 class RenderBlockSelectionInfo : public RenderSelectionInfoBase { 95 class RenderBlockSelectionInfo FINAL : public RenderSelectionInfoBase {
90 public: 96 public:
91 RenderBlockSelectionInfo(RenderBlock* b) 97 RenderBlockSelectionInfo(RenderBlock* b)
92 : RenderSelectionInfoBase(b) 98 : RenderSelectionInfoBase(b)
93 { 99 {
94 if (b->canUpdateSelectionOnRootLineBoxes()) 100 if (b->canUpdateSelectionOnRootLineBoxes())
95 m_rects = block()->selectionGapRectsForRepaint(m_repaintContainer); 101 m_rects = block()->selectionGapRectsForRepaint(m_repaintContainer);
96 else 102 else
97 m_rects = GapRects(); 103 m_rects = GapRects();
98 } 104 }
99 105
(...skipping 12 matching lines...) Expand all
112 GapRects rects() const { return m_rects; } 118 GapRects rects() const { return m_rects; }
113 119
114 private: 120 private:
115 GapRects m_rects; // relative to repaint container 121 GapRects m_rects; // relative to repaint container
116 }; 122 };
117 123
118 } // namespace blink 124 } // namespace blink
119 125
120 126
121 #endif // RenderSelectionInfo_h 127 #endif // RenderSelectionInfo_h
OLDNEW
« no previous file with comments | « no previous file | Source/core/rendering/RenderView.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698