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 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
74 void ScrollView::setHasHorizontalScrollbar(bool hasBar) | 74 void ScrollView::setHasHorizontalScrollbar(bool hasBar) |
75 { | 75 { |
76 if (hasBar && !m_horizontalScrollbar) { | 76 if (hasBar && !m_horizontalScrollbar) { |
77 m_horizontalScrollbar = createScrollbar(HorizontalScrollbar); | 77 m_horizontalScrollbar = createScrollbar(HorizontalScrollbar); |
78 addChild(m_horizontalScrollbar.get()); | 78 addChild(m_horizontalScrollbar.get()); |
79 didAddScrollbar(m_horizontalScrollbar.get(), HorizontalScrollbar); | 79 didAddScrollbar(m_horizontalScrollbar.get(), HorizontalScrollbar); |
80 m_horizontalScrollbar->styleChanged(); | 80 m_horizontalScrollbar->styleChanged(); |
81 } else if (!hasBar && m_horizontalScrollbar) { | 81 } else if (!hasBar && m_horizontalScrollbar) { |
82 willRemoveScrollbar(m_horizontalScrollbar.get(), HorizontalScrollbar); | 82 willRemoveScrollbar(m_horizontalScrollbar.get(), HorizontalScrollbar); |
83 removeChild(m_horizontalScrollbar.get()); | 83 removeChild(m_horizontalScrollbar.get()); |
84 m_horizontalScrollbar = 0; | 84 m_horizontalScrollbar = nullptr; |
85 } | 85 } |
86 } | 86 } |
87 | 87 |
88 void ScrollView::setHasVerticalScrollbar(bool hasBar) | 88 void ScrollView::setHasVerticalScrollbar(bool hasBar) |
89 { | 89 { |
90 if (hasBar && !m_verticalScrollbar) { | 90 if (hasBar && !m_verticalScrollbar) { |
91 m_verticalScrollbar = createScrollbar(VerticalScrollbar); | 91 m_verticalScrollbar = createScrollbar(VerticalScrollbar); |
92 addChild(m_verticalScrollbar.get()); | 92 addChild(m_verticalScrollbar.get()); |
93 didAddScrollbar(m_verticalScrollbar.get(), VerticalScrollbar); | 93 didAddScrollbar(m_verticalScrollbar.get(), VerticalScrollbar); |
94 m_verticalScrollbar->styleChanged(); | 94 m_verticalScrollbar->styleChanged(); |
95 } else if (!hasBar && m_verticalScrollbar) { | 95 } else if (!hasBar && m_verticalScrollbar) { |
96 willRemoveScrollbar(m_verticalScrollbar.get(), VerticalScrollbar); | 96 willRemoveScrollbar(m_verticalScrollbar.get(), VerticalScrollbar); |
97 removeChild(m_verticalScrollbar.get()); | 97 removeChild(m_verticalScrollbar.get()); |
98 m_verticalScrollbar = 0; | 98 m_verticalScrollbar = nullptr; |
99 } | 99 } |
100 } | 100 } |
101 | 101 |
102 PassRefPtr<Scrollbar> ScrollView::createScrollbar(ScrollbarOrientation orientati
on) | 102 PassRefPtr<Scrollbar> ScrollView::createScrollbar(ScrollbarOrientation orientati
on) |
103 { | 103 { |
104 return Scrollbar::create(this, orientation, RegularScrollbar); | 104 return Scrollbar::create(this, orientation, RegularScrollbar); |
105 } | 105 } |
106 | 106 |
107 void ScrollView::setScrollbarModes(ScrollbarMode horizontalMode, ScrollbarMode v
erticalMode, | 107 void ScrollView::setScrollbarModes(ScrollbarMode horizontalMode, ScrollbarMode v
erticalMode, |
108 bool horizontalLock, bool verticalLock) | 108 bool horizontalLock, bool verticalLock) |
(...skipping 1019 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1128 int ScrollView::pageStep(ScrollbarOrientation orientation) const | 1128 int ScrollView::pageStep(ScrollbarOrientation orientation) const |
1129 { | 1129 { |
1130 int length = (orientation == HorizontalScrollbar) ? visibleWidth() : visible
Height(); | 1130 int length = (orientation == HorizontalScrollbar) ? visibleWidth() : visible
Height(); |
1131 int minPageStep = static_cast<float>(length) * minFractionToStepWhenPaging()
; | 1131 int minPageStep = static_cast<float>(length) * minFractionToStepWhenPaging()
; |
1132 int pageStep = std::max(minPageStep, length - maxOverlapBetweenPages()); | 1132 int pageStep = std::max(minPageStep, length - maxOverlapBetweenPages()); |
1133 | 1133 |
1134 return std::max(pageStep, 1); | 1134 return std::max(pageStep, 1); |
1135 } | 1135 } |
1136 | 1136 |
1137 } // namespace WebCore | 1137 } // namespace WebCore |
OLD | NEW |