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

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: Switch LocalFrame::m_pluginElements rep to HashSet<HTMLPlugInElement*> 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();
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 20 matching lines...) Expand all
120 if (position == m_currentPos) 136 if (position == m_currentPos)
121 return; 137 return;
122 138
123 int oldThumbPosition = theme()->thumbPosition(this); 139 int oldThumbPosition = theme()->thumbPosition(this);
124 m_currentPos = position; 140 m_currentPos = position;
125 updateThumbPosition(); 141 updateThumbPosition();
126 if (m_pressedPart == ThumbPart) 142 if (m_pressedPart == ThumbPart)
127 setPressedPos(m_pressedPos + theme()->thumbPosition(this) - oldThumbPosi tion); 143 setPressedPos(m_pressedPos + theme()->thumbPosition(this) - oldThumbPosi tion);
128 } 144 }
129 145
146 void Scrollbar::disconnectFromScrollableArea()
147 {
148 m_scrollableArea = nullptr;
149 #if ENABLE(OILPAN)
150 m_animator = nullptr;
151 #endif
152 }
153
130 void Scrollbar::setProportion(int visibleSize, int totalSize) 154 void Scrollbar::setProportion(int visibleSize, int totalSize)
131 { 155 {
132 if (visibleSize == m_visibleSize && totalSize == m_totalSize) 156 if (visibleSize == m_visibleSize && totalSize == m_totalSize)
133 return; 157 return;
134 158
135 m_visibleSize = visibleSize; 159 m_visibleSize = visibleSize;
136 m_totalSize = totalSize; 160 m_totalSize = totalSize;
137 161
138 updateThumbProportion(); 162 updateThumbProportion();
139 } 163 }
(...skipping 387 matching lines...) Expand 10 before | Expand all | Expand 10 after
527 if (!m_scrollableArea) 551 if (!m_scrollableArea)
528 return 0; 552 return 0;
529 553
530 if (m_orientation == HorizontalScrollbar) 554 if (m_orientation == HorizontalScrollbar)
531 return m_scrollableArea->scrollPosition().x() - m_scrollableArea->minimu mScrollPosition().x(); 555 return m_scrollableArea->scrollPosition().x() - m_scrollableArea->minimu mScrollPosition().x();
532 556
533 return m_scrollableArea->scrollPosition().y() - m_scrollableArea->minimumScr ollPosition().y(); 557 return m_scrollableArea->scrollPosition().y() - m_scrollableArea->minimumScr ollPosition().y();
534 } 558 }
535 559
536 } // namespace blink 560 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698