OLD | NEW |
---|---|
1 /* | 1 /* |
2 * Copyright (C) 2008, 2009 Apple Inc. All Rights Reserved. | 2 * Copyright (C) 2008, 2009 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 Loading... | |
37 class RenderBox; | 37 class RenderBox; |
38 class RenderScrollbarPart; | 38 class RenderScrollbarPart; |
39 class RenderStyle; | 39 class RenderStyle; |
40 | 40 |
41 class RenderScrollbar FINAL : public Scrollbar { | 41 class RenderScrollbar FINAL : public Scrollbar { |
42 protected: | 42 protected: |
43 RenderScrollbar(ScrollableArea*, ScrollbarOrientation, Node*, LocalFrame*); | 43 RenderScrollbar(ScrollableArea*, ScrollbarOrientation, Node*, LocalFrame*); |
44 | 44 |
45 public: | 45 public: |
46 friend class Scrollbar; | 46 friend class Scrollbar; |
47 static PassRefPtr<Scrollbar> createCustomScrollbar(ScrollableArea*, Scrollba rOrientation, Node*, LocalFrame* owningFrame = 0); | 47 static PassRefPtrWillBeRawPtr<Scrollbar> createCustomScrollbar(ScrollableAre a*, ScrollbarOrientation, Node*, LocalFrame* owningFrame = 0); |
48 virtual ~RenderScrollbar(); | 48 virtual ~RenderScrollbar(); |
49 | 49 |
50 RenderBox* owningRenderer() const; | 50 RenderBox* owningRenderer() const; |
51 | 51 |
52 void paintPart(GraphicsContext*, ScrollbarPart, const IntRect&); | 52 void paintPart(GraphicsContext*, ScrollbarPart, const IntRect&); |
53 | 53 |
54 IntRect buttonRect(ScrollbarPart); | 54 IntRect buttonRect(ScrollbarPart); |
55 IntRect trackRect(int startLength, int endLength); | 55 IntRect trackRect(int startLength, int endLength); |
56 IntRect trackPieceRectWithMargins(ScrollbarPart, const IntRect&); | 56 IntRect trackPieceRectWithMargins(ScrollbarPart, const IntRect&); |
57 | 57 |
58 int minimumThumbLength(); | 58 int minimumThumbLength(); |
59 | 59 |
60 virtual bool isOverlayScrollbar() const OVERRIDE { return false; } | 60 virtual bool isOverlayScrollbar() const OVERRIDE { return false; } |
61 | 61 |
62 virtual void trace(Visitor*) OVERRIDE; | |
63 | |
62 private: | 64 private: |
63 virtual void setParent(Widget*) OVERRIDE; | 65 virtual void setParent(Widget*) OVERRIDE; |
64 virtual void setEnabled(bool) OVERRIDE; | 66 virtual void setEnabled(bool) OVERRIDE; |
65 | 67 |
66 virtual void setHoveredPart(ScrollbarPart) OVERRIDE; | 68 virtual void setHoveredPart(ScrollbarPart) OVERRIDE; |
67 virtual void setPressedPart(ScrollbarPart) OVERRIDE; | 69 virtual void setPressedPart(ScrollbarPart) OVERRIDE; |
68 | 70 |
69 virtual void styleChanged() OVERRIDE; | 71 virtual void styleChanged() OVERRIDE; |
70 | 72 |
71 virtual bool isCustomScrollbar() const OVERRIDE { return true; } | 73 virtual bool isCustomScrollbar() const OVERRIDE { return true; } |
72 | 74 |
73 void updateScrollbarParts(bool destroy = false); | 75 void updateScrollbarParts(bool destroy = false); |
74 | 76 |
75 PassRefPtr<RenderStyle> getScrollbarPseudoStyle(ScrollbarPart, PseudoId); | 77 PassRefPtr<RenderStyle> getScrollbarPseudoStyle(ScrollbarPart, PseudoId); |
76 void updateScrollbarPart(ScrollbarPart, bool destroy = false); | 78 void updateScrollbarPart(ScrollbarPart, bool destroy = false); |
77 | 79 |
78 // This Scrollbar(Widget) may outlive the DOM which created it (during tear down), | 80 // This Scrollbar(Widget) may outlive the DOM which created it (during tear down), |
79 // so we keep a reference to the Node which caused this custom scrollbar cre ation. | 81 // so we keep a reference to the Node which caused this custom scrollbar cre ation. |
80 // This will not create a reference cycle as the Widget tree is owned by our containing | 82 // This will not create a reference cycle as the Widget tree is owned by our containing |
81 // FrameView which this Node pointer can in no way keep alive. See webkit bu g 80610. | 83 // FrameView which this Node pointer can in no way keep alive. See webkit bu g 80610. |
82 RefPtrWillBePersistent<Node> m_owner; | 84 RefPtrWillBeMember<Node> m_owner; |
83 | 85 |
84 LocalFrame* m_owningFrame; | 86 RawPtrWillBeMember<LocalFrame> m_owningFrame; |
87 | |
88 // FIXME: Oilpan: post-detach creation of RenderScrollbarPart | |
89 // objects (see ~RenderScrollbar comment) makes it difficult to | |
90 // ensure that all RenderScrollbarParts have been explicitly | |
91 // destroyed prior to finalization. To reliably address, a | |
92 // Persistent reference to the hash map is kept here, so that the | |
93 // RenderScrollbar finalizer can safely notify the 'parts' of | |
94 // destruction..before they're swept out the next time around. | |
95 GC_PLUGIN_IGNORE("") | |
85 WillBePersistentHeapHashMap<unsigned, RawPtrWillBeMember<RenderScrollbarPart > > m_parts; | 96 WillBePersistentHeapHashMap<unsigned, RawPtrWillBeMember<RenderScrollbarPart > > m_parts; |
haraken
2014/09/29 14:16:36
Hmm, this looks too tricky as well. The RenderScro
| |
86 }; | 97 }; |
87 | 98 |
88 DEFINE_TYPE_CASTS(RenderScrollbar, ScrollbarThemeClient, scrollbar, scrollbar->i sCustomScrollbar(), scrollbar.isCustomScrollbar()); | 99 DEFINE_TYPE_CASTS(RenderScrollbar, ScrollbarThemeClient, scrollbar, scrollbar->i sCustomScrollbar(), scrollbar.isCustomScrollbar()); |
89 | 100 |
90 } // namespace blink | 101 } // namespace blink |
91 | 102 |
92 #endif // RenderScrollbar_h | 103 #endif // RenderScrollbar_h |
OLD | NEW |