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

Side by Side Diff: Source/platform/scroll/Scrollbar.cpp

Issue 603193005: Move the Widget hierarchy to the Oilpan heap. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Support renderer-less plugin disposal Created 6 years, 2 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
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2004, 2006, 2008 Apple Inc. All rights reserved. 2 * Copyright (C) 2004, 2006, 2008 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 #include "platform/scroll/ScrollbarTheme.h" 35 #include "platform/scroll/ScrollbarTheme.h"
36 36
37 #if ((OS(POSIX) && !OS(MACOSX)) || OS(WIN)) 37 #if ((OS(POSIX) && !OS(MACOSX)) || OS(WIN))
38 // The position of the scrollbar thumb affects the appearance of the steppers, s o 38 // The position of the scrollbar thumb affects the appearance of the steppers, s o
39 // when the thumb moves, we have to invalidate them for painting. 39 // when the thumb moves, we have to invalidate them for painting.
40 #define THUMB_POSITION_AFFECTS_BUTTONS 40 #define THUMB_POSITION_AFFECTS_BUTTONS
41 #endif 41 #endif
42 42
43 namespace blink { 43 namespace blink {
44 44
45 PassRefPtr<Scrollbar> Scrollbar::create(ScrollableArea* scrollableArea, Scrollba rOrientation orientation, ScrollbarControlSize size) 45 PassRefPtrWillBeRawPtr<Scrollbar> Scrollbar::create(ScrollableArea* scrollableAr ea, ScrollbarOrientation orientation, ScrollbarControlSize size)
46 { 46 {
47 return adoptRef(new Scrollbar(scrollableArea, orientation, size)); 47 return adoptRefWillBeNoop(new Scrollbar(scrollableArea, orientation, size));
48 } 48 }
49 49
50 Scrollbar::Scrollbar(ScrollableArea* scrollableArea, ScrollbarOrientation orient ation, ScrollbarControlSize controlSize, ScrollbarTheme* theme) 50 Scrollbar::Scrollbar(ScrollableArea* scrollableArea, ScrollbarOrientation orient ation, ScrollbarControlSize controlSize, ScrollbarTheme* theme)
51 : m_scrollableArea(scrollableArea) 51 : m_scrollableArea(scrollableArea)
52 , m_orientation(orientation) 52 , m_orientation(orientation)
53 , m_controlSize(controlSize) 53 , m_controlSize(controlSize)
54 , m_theme(theme) 54 , m_theme(theme)
55 , m_visibleSize(0) 55 , m_visibleSize(0)
56 , m_totalSize(0) 56 , m_totalSize(0)
57 , m_currentPos(0) 57 , m_currentPos(0)
(...skipping 15 matching lines...) Expand all
73 73
74 m_theme->registerScrollbar(this); 74 m_theme->registerScrollbar(this);
75 75
76 // FIXME: This is ugly and would not be necessary if we fix cross-platform c ode to actually query for 76 // FIXME: This is ugly and would not be necessary if we fix cross-platform c ode to actually query for
77 // scrollbar thickness and use it when sizing scrollbars (rather than leavin g one dimension of the scrollbar 77 // scrollbar thickness and use it when sizing scrollbars (rather than leavin g one dimension of the scrollbar
78 // alone when sizing). 78 // alone when sizing).
79 int thickness = m_theme->scrollbarThickness(controlSize); 79 int thickness = m_theme->scrollbarThickness(controlSize);
80 Widget::setFrameRect(IntRect(0, 0, thickness, thickness)); 80 Widget::setFrameRect(IntRect(0, 0, thickness, thickness));
81 81
82 m_currentPos = scrollableAreaCurrentPos(); 82 m_currentPos = scrollableAreaCurrentPos();
83
84 #if ENABLE(OILPAN)
85 if (m_scrollableArea)
86 m_animator = m_scrollableArea->scrollAnimator();
haraken 2014/10/10 02:50:32 Sorry, I got confused with this again. The scroll
sof 2014/10/10 05:22:19 It _might_ be on the heap, we don't know (i.e., a
87 #endif
83 } 88 }
84 89
85 Scrollbar::~Scrollbar() 90 Scrollbar::~Scrollbar()
86 { 91 {
87 stopTimerIfNeeded(); 92 stopTimerIfNeeded();
88 93
89 m_theme->unregisterScrollbar(this); 94 m_theme->unregisterScrollbar(this);
95
96 #if ENABLE(OILPAN)
97 if (!m_animator)
98 return;
99
100 ASSERT(m_scrollableArea);
101 if (m_orientation == VerticalScrollbar)
102 m_animator->willRemoveVerticalScrollbar(this);
103 else
104 m_animator->willRemoveHorizontalScrollbar(this);
105 #endif
90 } 106 }
91 107
92 ScrollbarOverlayStyle Scrollbar::scrollbarOverlayStyle() const 108 ScrollbarOverlayStyle Scrollbar::scrollbarOverlayStyle() const
93 { 109 {
94 return m_scrollableArea ? m_scrollableArea->scrollbarOverlayStyle() : Scroll barOverlayStyleDefault; 110 return m_scrollableArea ? m_scrollableArea->scrollbarOverlayStyle() : Scroll barOverlayStyleDefault;
95 } 111 }
96 112
97 void Scrollbar::getTickmarks(Vector<IntRect>& tickmarks) const 113 void Scrollbar::getTickmarks(Vector<IntRect>& tickmarks) const
98 { 114 {
99 if (m_scrollableArea) 115 if (m_scrollableArea)
(...skipping 25 matching lines...) Expand all
125 if (position == m_currentPos) 141 if (position == m_currentPos)
126 return; 142 return;
127 143
128 int oldThumbPosition = theme()->thumbPosition(this); 144 int oldThumbPosition = theme()->thumbPosition(this);
129 m_currentPos = position; 145 m_currentPos = position;
130 updateThumbPosition(); 146 updateThumbPosition();
131 if (m_pressedPart == ThumbPart) 147 if (m_pressedPart == ThumbPart)
132 setPressedPos(m_pressedPos + theme()->thumbPosition(this) - oldThumbPosi tion); 148 setPressedPos(m_pressedPos + theme()->thumbPosition(this) - oldThumbPosi tion);
133 } 149 }
134 150
151 void Scrollbar::disconnectFromScrollableArea()
152 {
153 m_scrollableArea = nullptr;
154 #if ENABLE(OILPAN)
155 m_animator = nullptr;
156 #endif
157 }
158
135 void Scrollbar::setProportion(int visibleSize, int totalSize) 159 void Scrollbar::setProportion(int visibleSize, int totalSize)
136 { 160 {
137 if (visibleSize == m_visibleSize && totalSize == m_totalSize) 161 if (visibleSize == m_visibleSize && totalSize == m_totalSize)
138 return; 162 return;
139 163
140 m_visibleSize = visibleSize; 164 m_visibleSize = visibleSize;
141 m_totalSize = totalSize; 165 m_totalSize = totalSize;
142 166
143 updateThumbProportion(); 167 updateThumbProportion();
144 } 168 }
(...skipping 387 matching lines...) Expand 10 before | Expand all | Expand 10 after
532 if (!m_scrollableArea) 556 if (!m_scrollableArea)
533 return 0; 557 return 0;
534 558
535 if (m_orientation == HorizontalScrollbar) 559 if (m_orientation == HorizontalScrollbar)
536 return m_scrollableArea->scrollPosition().x() - m_scrollableArea->minimu mScrollPosition().x(); 560 return m_scrollableArea->scrollPosition().x() - m_scrollableArea->minimu mScrollPosition().x();
537 561
538 return m_scrollableArea->scrollPosition().y() - m_scrollableArea->minimumScr ollPosition().y(); 562 return m_scrollableArea->scrollPosition().y() - m_scrollableArea->minimumScr ollPosition().y();
539 } 563 }
540 564
541 } // namespace blink 565 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698