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 604 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
712 | 722 |
713 Widget::setFrameRect(newRect); | 723 Widget::setFrameRect(newRect); |
714 | 724 |
715 updateScrollbars(scrollOffset()); | 725 updateScrollbars(scrollOffset()); |
716 | 726 |
717 frameRectsChanged(); | 727 frameRectsChanged(); |
718 } | 728 } |
719 | 729 |
720 void ScrollView::frameRectsChanged() | 730 void ScrollView::frameRectsChanged() |
721 { | 731 { |
722 HashSet<RefPtr<Widget> >::const_iterator end = m_children.end(); | 732 ChildrenWidgetSet::const_iterator end = m_children.end(); |
723 for (HashSet<RefPtr<Widget> >::const_iterator current = m_children.begin();
current != end; ++current) | 733 for (ChildrenWidgetSet::const_iterator current = m_children.begin(); current
!= end; ++current) |
724 (*current)->frameRectsChanged(); | 734 (*current)->frameRectsChanged(); |
725 } | 735 } |
726 | 736 |
727 static void positionScrollbarLayer(GraphicsLayer* graphicsLayer, Scrollbar* scro
llbar) | 737 static void positionScrollbarLayer(GraphicsLayer* graphicsLayer, Scrollbar* scro
llbar) |
728 { | 738 { |
729 if (!graphicsLayer || !scrollbar) | 739 if (!graphicsLayer || !scrollbar) |
730 return; | 740 return; |
731 | 741 |
732 IntRect scrollbarRect = scrollbar->frameRect(); | 742 IntRect scrollbarRect = scrollbar->frameRect(); |
733 graphicsLayer->setPosition(scrollbarRect.location()); | 743 graphicsLayer->setPosition(scrollbarRect.location()); |
(...skipping 316 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1050 void ScrollView::setParentVisible(bool visible) | 1060 void ScrollView::setParentVisible(bool visible) |
1051 { | 1061 { |
1052 if (isParentVisible() == visible) | 1062 if (isParentVisible() == visible) |
1053 return; | 1063 return; |
1054 | 1064 |
1055 Widget::setParentVisible(visible); | 1065 Widget::setParentVisible(visible); |
1056 | 1066 |
1057 if (!isSelfVisible()) | 1067 if (!isSelfVisible()) |
1058 return; | 1068 return; |
1059 | 1069 |
1060 HashSet<RefPtr<Widget> >::iterator end = m_children.end(); | 1070 ChildrenWidgetSet::const_iterator end = m_children.end(); |
1061 for (HashSet<RefPtr<Widget> >::iterator it = m_children.begin(); it != end;
++it) | 1071 for (ChildrenWidgetSet::const_iterator it = m_children.begin(); it != end; +
+it) |
1062 (*it)->setParentVisible(visible); | 1072 (*it)->setParentVisible(visible); |
1063 } | 1073 } |
1064 | 1074 |
1065 void ScrollView::show() | 1075 void ScrollView::show() |
1066 { | 1076 { |
1067 if (!isSelfVisible()) { | 1077 if (!isSelfVisible()) { |
1068 setSelfVisible(true); | 1078 setSelfVisible(true); |
1069 if (isParentVisible()) { | 1079 if (isParentVisible()) { |
1070 HashSet<RefPtr<Widget> >::iterator end = m_children.end(); | 1080 ChildrenWidgetSet::const_iterator end = m_children.end(); |
1071 for (HashSet<RefPtr<Widget> >::iterator it = m_children.begin(); it
!= end; ++it) | 1081 for (ChildrenWidgetSet::const_iterator it = m_children.begin(); it !
= end; ++it) |
1072 (*it)->setParentVisible(true); | 1082 (*it)->setParentVisible(true); |
1073 } | 1083 } |
1074 } | 1084 } |
1075 | 1085 |
1076 Widget::show(); | 1086 Widget::show(); |
1077 } | 1087 } |
1078 | 1088 |
1079 void ScrollView::hide() | 1089 void ScrollView::hide() |
1080 { | 1090 { |
1081 if (isSelfVisible()) { | 1091 if (isSelfVisible()) { |
1082 if (isParentVisible()) { | 1092 if (isParentVisible()) { |
1083 HashSet<RefPtr<Widget> >::iterator end = m_children.end(); | 1093 ChildrenWidgetSet::const_iterator end = m_children.end(); |
1084 for (HashSet<RefPtr<Widget> >::iterator it = m_children.begin(); it
!= end; ++it) | 1094 for (ChildrenWidgetSet::const_iterator it = m_children.begin(); it !
= end; ++it) |
1085 (*it)->setParentVisible(false); | 1095 (*it)->setParentVisible(false); |
1086 } | 1096 } |
1087 setSelfVisible(false); | 1097 setSelfVisible(false); |
1088 } | 1098 } |
1089 | 1099 |
1090 Widget::hide(); | 1100 Widget::hide(); |
1091 } | 1101 } |
1092 | 1102 |
1093 void ScrollView::addPanScrollIcon(const IntPoint& iconPosition) | 1103 void ScrollView::addPanScrollIcon(const IntPoint& iconPosition) |
1094 { | 1104 { |
(...skipping 20 matching lines...) Expand all Loading... |
1115 return; | 1125 return; |
1116 | 1126 |
1117 ScrollableArea::setScrollOrigin(origin); | 1127 ScrollableArea::setScrollOrigin(origin); |
1118 | 1128 |
1119 // Update if the scroll origin changes, since our position will be different
if the content size did not change. | 1129 // Update if the scroll origin changes, since our position will be different
if the content size did not change. |
1120 if (updatePositionAtAll && updatePositionSynchronously) | 1130 if (updatePositionAtAll && updatePositionSynchronously) |
1121 updateScrollbars(scrollOffset()); | 1131 updateScrollbars(scrollOffset()); |
1122 } | 1132 } |
1123 | 1133 |
1124 } // namespace blink | 1134 } // namespace blink |
OLD | NEW |