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

Side by Side Diff: Source/platform/scroll/ScrollView.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) 2006, 2007, 2008 Apple Inc. All rights reserved. 2 * Copyright (C) 2006, 2007, 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 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
44 , m_inUpdateScrollbars(false) 44 , m_inUpdateScrollbars(false)
45 , m_drawPanScrollIcon(false) 45 , m_drawPanScrollIcon(false)
46 , m_clipsRepaints(true) 46 , m_clipsRepaints(true)
47 { 47 {
48 } 48 }
49 49
50 ScrollView::~ScrollView() 50 ScrollView::~ScrollView()
51 { 51 {
52 } 52 }
53 53
54 void ScrollView::addChild(PassRefPtr<Widget> prpChild) 54 void ScrollView::trace(Visitor* visitor)
55 {
56 #if ENABLE(OILPAN)
57 visitor->trace(m_horizontalScrollbar);
58 visitor->trace(m_verticalScrollbar);
59 visitor->trace(m_children);
60 #endif
61 Widget::trace(visitor);
62 }
63
64 void ScrollView::addChild(PassRefPtrWillBeRawPtr<Widget> prpChild)
55 { 65 {
56 Widget* child = prpChild.get(); 66 Widget* child = prpChild.get();
57 ASSERT(child != this && !child->parent()); 67 ASSERT(child != this && !child->parent());
58 child->setParent(this); 68 child->setParent(this);
59 m_children.add(prpChild); 69 m_children.add(prpChild);
60 } 70 }
61 71
62 void ScrollView::removeChild(Widget* child) 72 void ScrollView::removeChild(Widget* child)
63 { 73 {
64 ASSERT(child->parent() == this); 74 ASSERT(child->parent() == this);
(...skipping 30 matching lines...) Expand all
95 willRemoveScrollbar(m_verticalScrollbar.get(), VerticalScrollbar); 105 willRemoveScrollbar(m_verticalScrollbar.get(), VerticalScrollbar);
96 // If the scrollbar has been marked as overlapping the window resizer, 106 // If the scrollbar has been marked as overlapping the window resizer,
97 // then its removal should reduce the count. 107 // then its removal should reduce the count.
98 if (m_verticalScrollbar->overlapsResizer()) 108 if (m_verticalScrollbar->overlapsResizer())
99 adjustScrollbarsAvoidingResizerCount(-1); 109 adjustScrollbarsAvoidingResizerCount(-1);
100 removeChild(m_verticalScrollbar.get()); 110 removeChild(m_verticalScrollbar.get());
101 m_verticalScrollbar = nullptr; 111 m_verticalScrollbar = nullptr;
102 } 112 }
103 } 113 }
104 114
105 PassRefPtr<Scrollbar> ScrollView::createScrollbar(ScrollbarOrientation orientati on) 115 PassRefPtrWillBeRawPtr<Scrollbar> ScrollView::createScrollbar(ScrollbarOrientati on orientation)
106 { 116 {
107 return Scrollbar::create(this, orientation, RegularScrollbar); 117 return Scrollbar::create(this, orientation, RegularScrollbar);
108 } 118 }
109 119
110 void ScrollView::setScrollbarModes(ScrollbarMode horizontalMode, ScrollbarMode v erticalMode, 120 void ScrollView::setScrollbarModes(ScrollbarMode horizontalMode, ScrollbarMode v erticalMode,
111 bool horizontalLock, bool verticalLock) 121 bool horizontalLock, bool verticalLock)
112 { 122 {
113 bool needsUpdate = false; 123 bool needsUpdate = false;
114 124
115 if (horizontalMode != horizontalScrollbarMode() && !m_horizontalScrollbarLoc k) { 125 if (horizontalMode != horizontalScrollbarMode() && !m_horizontalScrollbarLoc k) {
(...skipping 653 matching lines...) Expand 10 before | Expand all | Expand 10 after
769 779
770 Widget::setFrameRect(newRect); 780 Widget::setFrameRect(newRect);
771 781
772 updateScrollbars(scrollOffset()); 782 updateScrollbars(scrollOffset());
773 783
774 frameRectsChanged(); 784 frameRectsChanged();
775 } 785 }
776 786
777 void ScrollView::frameRectsChanged() 787 void ScrollView::frameRectsChanged()
778 { 788 {
779 HashSet<RefPtr<Widget> >::const_iterator end = m_children.end(); 789 ChildrenWidgetSet::const_iterator end = m_children.end();
780 for (HashSet<RefPtr<Widget> >::const_iterator current = m_children.begin(); current != end; ++current) 790 for (ChildrenWidgetSet::const_iterator current = m_children.begin(); current != end; ++current)
781 (*current)->frameRectsChanged(); 791 (*current)->frameRectsChanged();
782 } 792 }
783 793
784 static void positionScrollbarLayer(GraphicsLayer* graphicsLayer, Scrollbar* scro llbar) 794 static void positionScrollbarLayer(GraphicsLayer* graphicsLayer, Scrollbar* scro llbar)
785 { 795 {
786 if (!graphicsLayer || !scrollbar) 796 if (!graphicsLayer || !scrollbar)
787 return; 797 return;
788 798
789 IntRect scrollbarRect = scrollbar->frameRect(); 799 IntRect scrollbarRect = scrollbar->frameRect();
790 graphicsLayer->setPosition(scrollbarRect.location()); 800 graphicsLayer->setPosition(scrollbarRect.location());
(...skipping 316 matching lines...) Expand 10 before | Expand all | Expand 10 after
1107 void ScrollView::setParentVisible(bool visible) 1117 void ScrollView::setParentVisible(bool visible)
1108 { 1118 {
1109 if (isParentVisible() == visible) 1119 if (isParentVisible() == visible)
1110 return; 1120 return;
1111 1121
1112 Widget::setParentVisible(visible); 1122 Widget::setParentVisible(visible);
1113 1123
1114 if (!isSelfVisible()) 1124 if (!isSelfVisible())
1115 return; 1125 return;
1116 1126
1117 HashSet<RefPtr<Widget> >::iterator end = m_children.end(); 1127 ChildrenWidgetSet::const_iterator end = m_children.end();
1118 for (HashSet<RefPtr<Widget> >::iterator it = m_children.begin(); it != end; ++it) 1128 for (ChildrenWidgetSet::const_iterator it = m_children.begin(); it != end; + +it)
1119 (*it)->setParentVisible(visible); 1129 (*it)->setParentVisible(visible);
1120 } 1130 }
1121 1131
1122 void ScrollView::show() 1132 void ScrollView::show()
1123 { 1133 {
1124 if (!isSelfVisible()) { 1134 if (!isSelfVisible()) {
1125 setSelfVisible(true); 1135 setSelfVisible(true);
1126 if (isParentVisible()) { 1136 if (isParentVisible()) {
1127 HashSet<RefPtr<Widget> >::iterator end = m_children.end(); 1137 ChildrenWidgetSet::const_iterator end = m_children.end();
1128 for (HashSet<RefPtr<Widget> >::iterator it = m_children.begin(); it != end; ++it) 1138 for (ChildrenWidgetSet::const_iterator it = m_children.begin(); it ! = end; ++it)
1129 (*it)->setParentVisible(true); 1139 (*it)->setParentVisible(true);
1130 } 1140 }
1131 } 1141 }
1132 1142
1133 Widget::show(); 1143 Widget::show();
1134 } 1144 }
1135 1145
1136 void ScrollView::hide() 1146 void ScrollView::hide()
1137 { 1147 {
1138 if (isSelfVisible()) { 1148 if (isSelfVisible()) {
1139 if (isParentVisible()) { 1149 if (isParentVisible()) {
1140 HashSet<RefPtr<Widget> >::iterator end = m_children.end(); 1150 ChildrenWidgetSet::const_iterator end = m_children.end();
1141 for (HashSet<RefPtr<Widget> >::iterator it = m_children.begin(); it != end; ++it) 1151 for (ChildrenWidgetSet::const_iterator it = m_children.begin(); it ! = end; ++it)
1142 (*it)->setParentVisible(false); 1152 (*it)->setParentVisible(false);
1143 } 1153 }
1144 setSelfVisible(false); 1154 setSelfVisible(false);
1145 } 1155 }
1146 1156
1147 Widget::hide(); 1157 Widget::hide();
1148 } 1158 }
1149 1159
1150 void ScrollView::addPanScrollIcon(const IntPoint& iconPosition) 1160 void ScrollView::addPanScrollIcon(const IntPoint& iconPosition)
1151 { 1161 {
(...skipping 20 matching lines...) Expand all
1172 return; 1182 return;
1173 1183
1174 ScrollableArea::setScrollOrigin(origin); 1184 ScrollableArea::setScrollOrigin(origin);
1175 1185
1176 // Update if the scroll origin changes, since our position will be different if the content size did not change. 1186 // Update if the scroll origin changes, since our position will be different if the content size did not change.
1177 if (updatePositionAtAll && updatePositionSynchronously) 1187 if (updatePositionAtAll && updatePositionSynchronously)
1178 updateScrollbars(scrollOffset()); 1188 updateScrollbars(scrollOffset());
1179 } 1189 }
1180 1190
1181 } // namespace blink 1191 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698