OLD | NEW |
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 Loading... |
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 22 matching lines...) Expand all Loading... |
87 addChild(m_verticalScrollbar.get()); | 97 addChild(m_verticalScrollbar.get()); |
88 didAddScrollbar(m_verticalScrollbar.get(), VerticalScrollbar); | 98 didAddScrollbar(m_verticalScrollbar.get(), VerticalScrollbar); |
89 m_verticalScrollbar->styleChanged(); | 99 m_verticalScrollbar->styleChanged(); |
90 } else if (!hasBar && m_verticalScrollbar) { | 100 } else if (!hasBar && m_verticalScrollbar) { |
91 willRemoveScrollbar(m_verticalScrollbar.get(), VerticalScrollbar); | 101 willRemoveScrollbar(m_verticalScrollbar.get(), VerticalScrollbar); |
92 removeChild(m_verticalScrollbar.get()); | 102 removeChild(m_verticalScrollbar.get()); |
93 m_verticalScrollbar = nullptr; | 103 m_verticalScrollbar = nullptr; |
94 } | 104 } |
95 } | 105 } |
96 | 106 |
97 PassRefPtr<Scrollbar> ScrollView::createScrollbar(ScrollbarOrientation orientati
on) | 107 PassRefPtrWillBeRawPtr<Scrollbar> ScrollView::createScrollbar(ScrollbarOrientati
on orientation) |
98 { | 108 { |
99 return Scrollbar::create(this, orientation, RegularScrollbar); | 109 return Scrollbar::create(this, orientation, RegularScrollbar); |
100 } | 110 } |
101 | 111 |
102 void ScrollView::setScrollbarModes(ScrollbarMode horizontalMode, ScrollbarMode v
erticalMode, | 112 void ScrollView::setScrollbarModes(ScrollbarMode horizontalMode, ScrollbarMode v
erticalMode, |
103 bool horizontalLock, bool verticalLock) | 113 bool horizontalLock, bool verticalLock) |
104 { | 114 { |
105 bool needsUpdate = false; | 115 bool needsUpdate = false; |
106 | 116 |
107 if (horizontalMode != horizontalScrollbarMode() && !m_horizontalScrollbarLoc
k) { | 117 if (horizontalMode != horizontalScrollbarMode() && !m_horizontalScrollbarLoc
k) { |
(...skipping 622 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
730 | 740 |
731 Widget::setFrameRect(newRect); | 741 Widget::setFrameRect(newRect); |
732 | 742 |
733 updateScrollbars(scrollOffset()); | 743 updateScrollbars(scrollOffset()); |
734 | 744 |
735 frameRectsChanged(); | 745 frameRectsChanged(); |
736 } | 746 } |
737 | 747 |
738 void ScrollView::frameRectsChanged() | 748 void ScrollView::frameRectsChanged() |
739 { | 749 { |
740 HashSet<RefPtr<Widget> >::const_iterator end = m_children.end(); | 750 ChildrenWidgetSet::const_iterator end = m_children.end(); |
741 for (HashSet<RefPtr<Widget> >::const_iterator current = m_children.begin();
current != end; ++current) | 751 for (ChildrenWidgetSet::const_iterator current = m_children.begin(); current
!= end; ++current) |
742 (*current)->frameRectsChanged(); | 752 (*current)->frameRectsChanged(); |
743 } | 753 } |
744 | 754 |
745 static void positionScrollbarLayer(GraphicsLayer* graphicsLayer, Scrollbar* scro
llbar) | 755 static void positionScrollbarLayer(GraphicsLayer* graphicsLayer, Scrollbar* scro
llbar) |
746 { | 756 { |
747 if (!graphicsLayer || !scrollbar) | 757 if (!graphicsLayer || !scrollbar) |
748 return; | 758 return; |
749 | 759 |
750 IntRect scrollbarRect = scrollbar->frameRect(); | 760 IntRect scrollbarRect = scrollbar->frameRect(); |
751 graphicsLayer->setPosition(scrollbarRect.location()); | 761 graphicsLayer->setPosition(scrollbarRect.location()); |
(...skipping 316 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1068 void ScrollView::setParentVisible(bool visible) | 1078 void ScrollView::setParentVisible(bool visible) |
1069 { | 1079 { |
1070 if (isParentVisible() == visible) | 1080 if (isParentVisible() == visible) |
1071 return; | 1081 return; |
1072 | 1082 |
1073 Widget::setParentVisible(visible); | 1083 Widget::setParentVisible(visible); |
1074 | 1084 |
1075 if (!isSelfVisible()) | 1085 if (!isSelfVisible()) |
1076 return; | 1086 return; |
1077 | 1087 |
1078 HashSet<RefPtr<Widget> >::iterator end = m_children.end(); | 1088 ChildrenWidgetSet::const_iterator end = m_children.end(); |
1079 for (HashSet<RefPtr<Widget> >::iterator it = m_children.begin(); it != end;
++it) | 1089 for (ChildrenWidgetSet::const_iterator it = m_children.begin(); it != end; +
+it) |
1080 (*it)->setParentVisible(visible); | 1090 (*it)->setParentVisible(visible); |
1081 } | 1091 } |
1082 | 1092 |
1083 void ScrollView::show() | 1093 void ScrollView::show() |
1084 { | 1094 { |
1085 if (!isSelfVisible()) { | 1095 if (!isSelfVisible()) { |
1086 setSelfVisible(true); | 1096 setSelfVisible(true); |
1087 if (isParentVisible()) { | 1097 if (isParentVisible()) { |
1088 HashSet<RefPtr<Widget> >::iterator end = m_children.end(); | 1098 ChildrenWidgetSet::const_iterator end = m_children.end(); |
1089 for (HashSet<RefPtr<Widget> >::iterator it = m_children.begin(); it
!= end; ++it) | 1099 for (ChildrenWidgetSet::const_iterator it = m_children.begin(); it !
= end; ++it) |
1090 (*it)->setParentVisible(true); | 1100 (*it)->setParentVisible(true); |
1091 } | 1101 } |
1092 } | 1102 } |
1093 | 1103 |
1094 Widget::show(); | 1104 Widget::show(); |
1095 } | 1105 } |
1096 | 1106 |
1097 void ScrollView::hide() | 1107 void ScrollView::hide() |
1098 { | 1108 { |
1099 if (isSelfVisible()) { | 1109 if (isSelfVisible()) { |
1100 if (isParentVisible()) { | 1110 if (isParentVisible()) { |
1101 HashSet<RefPtr<Widget> >::iterator end = m_children.end(); | 1111 ChildrenWidgetSet::const_iterator end = m_children.end(); |
1102 for (HashSet<RefPtr<Widget> >::iterator it = m_children.begin(); it
!= end; ++it) | 1112 for (ChildrenWidgetSet::const_iterator it = m_children.begin(); it !
= end; ++it) |
1103 (*it)->setParentVisible(false); | 1113 (*it)->setParentVisible(false); |
1104 } | 1114 } |
1105 setSelfVisible(false); | 1115 setSelfVisible(false); |
1106 } | 1116 } |
1107 | 1117 |
1108 Widget::hide(); | 1118 Widget::hide(); |
1109 } | 1119 } |
1110 | 1120 |
1111 void ScrollView::addPanScrollIcon(const IntPoint& iconPosition) | 1121 void ScrollView::addPanScrollIcon(const IntPoint& iconPosition) |
1112 { | 1122 { |
(...skipping 20 matching lines...) Expand all Loading... |
1133 return; | 1143 return; |
1134 | 1144 |
1135 ScrollableArea::setScrollOrigin(origin); | 1145 ScrollableArea::setScrollOrigin(origin); |
1136 | 1146 |
1137 // Update if the scroll origin changes, since our position will be different
if the content size did not change. | 1147 // Update if the scroll origin changes, since our position will be different
if the content size did not change. |
1138 if (updatePositionAtAll && updatePositionSynchronously) | 1148 if (updatePositionAtAll && updatePositionSynchronously) |
1139 updateScrollbars(scrollOffset()); | 1149 updateScrollbars(scrollOffset()); |
1140 } | 1150 } |
1141 | 1151 |
1142 } // namespace blink | 1152 } // namespace blink |
OLD | NEW |