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 22 matching lines...) Expand all Loading... |
33 | 33 |
34 namespace blink { | 34 namespace blink { |
35 | 35 |
36 class LocalFrame; | 36 class LocalFrame; |
37 class Node; | 37 class Node; |
38 class RenderBox; | 38 class RenderBox; |
39 class RenderScrollbarPart; | 39 class RenderScrollbarPart; |
40 class RenderStyle; | 40 class RenderStyle; |
41 | 41 |
42 class RenderScrollbar final : public Scrollbar { | 42 class RenderScrollbar final : public Scrollbar { |
43 WILL_BE_USING_PRE_FINALIZER(RenderScrollbar, destroyParts); | |
44 public: | 43 public: |
45 static PassRefPtrWillBeRawPtr<Scrollbar> createCustomScrollbar(ScrollableAre
a*, ScrollbarOrientation, Node*, LocalFrame* owningFrame = 0); | 44 static PassRefPtrWillBeRawPtr<Scrollbar> createCustomScrollbar(ScrollableAre
a*, ScrollbarOrientation, Node*, LocalFrame* owningFrame = 0); |
46 virtual ~RenderScrollbar(); | 45 virtual ~RenderScrollbar(); |
47 | 46 |
48 RenderBox* owningRenderer() const; | 47 RenderBox* owningRenderer() const; |
49 | 48 |
50 IntRect buttonRect(ScrollbarPart); | 49 IntRect buttonRect(ScrollbarPart); |
51 IntRect trackRect(int startLength, int endLength); | 50 IntRect trackRect(int startLength, int endLength); |
52 IntRect trackPieceRectWithMargins(ScrollbarPart, const IntRect&); | 51 IntRect trackPieceRectWithMargins(ScrollbarPart, const IntRect&); |
53 | 52 |
(...skipping 19 matching lines...) Expand all Loading... |
73 | 72 |
74 virtual void styleChanged() override; | 73 virtual void styleChanged() override; |
75 | 74 |
76 virtual bool isCustomScrollbar() const override { return true; } | 75 virtual bool isCustomScrollbar() const override { return true; } |
77 | 76 |
78 void updateScrollbarParts(bool destroy = false); | 77 void updateScrollbarParts(bool destroy = false); |
79 | 78 |
80 PassRefPtr<RenderStyle> getScrollbarPseudoStyle(ScrollbarPart, PseudoId); | 79 PassRefPtr<RenderStyle> getScrollbarPseudoStyle(ScrollbarPart, PseudoId); |
81 void updateScrollbarPart(ScrollbarPart, bool destroy = false); | 80 void updateScrollbarPart(ScrollbarPart, bool destroy = false); |
82 | 81 |
83 void destroyParts(); | |
84 | |
85 // This Scrollbar(Widget) may outlive the DOM which created it (during tear
down), | 82 // This Scrollbar(Widget) may outlive the DOM which created it (during tear
down), |
86 // so we keep a reference to the Node which caused this custom scrollbar cre
ation. | 83 // so we keep a reference to the Node which caused this custom scrollbar cre
ation. |
87 // This will not create a reference cycle as the Widget tree is owned by our
containing | 84 // This will not create a reference cycle as the Widget tree is owned by our
containing |
88 // FrameView which this Node pointer can in no way keep alive. See webkit bu
g 80610. | 85 // FrameView which this Node pointer can in no way keep alive. See webkit bu
g 80610. |
89 RefPtrWillBeMember<Node> m_owner; | 86 RefPtrWillBeMember<Node> m_owner; |
90 | 87 |
91 RawPtrWillBeMember<LocalFrame> m_owningFrame; | 88 RawPtrWillBeMember<LocalFrame> m_owningFrame; |
92 | 89 |
93 WillBeHeapHashMap<unsigned, RawPtrWillBeMember<RenderScrollbarPart> > m_part
s; | 90 HashMap<unsigned, RenderScrollbarPart*> m_parts; |
94 }; | 91 }; |
95 | 92 |
96 DEFINE_TYPE_CASTS(RenderScrollbar, ScrollbarThemeClient, scrollbar, scrollbar->i
sCustomScrollbar(), scrollbar.isCustomScrollbar()); | 93 DEFINE_TYPE_CASTS(RenderScrollbar, ScrollbarThemeClient, scrollbar, scrollbar->i
sCustomScrollbar(), scrollbar.isCustomScrollbar()); |
97 | 94 |
98 } // namespace blink | 95 } // namespace blink |
99 | 96 |
100 #endif // RenderScrollbar_h | 97 #endif // RenderScrollbar_h |
OLD | NEW |