| OLD | NEW |
| 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 12 matching lines...) Expand all Loading... |
| 23 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 23 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 24 */ | 24 */ |
| 25 | 25 |
| 26 #include "config.h" | 26 #include "config.h" |
| 27 #include "platform/scroll/Scrollbar.h" | 27 #include "platform/scroll/Scrollbar.h" |
| 28 | 28 |
| 29 #include <algorithm> | 29 #include <algorithm> |
| 30 #include "platform/graphics/GraphicsContext.h" | 30 #include "platform/graphics/GraphicsContext.h" |
| 31 #include "platform/PlatformGestureEvent.h" | 31 #include "platform/PlatformGestureEvent.h" |
| 32 #include "platform/PlatformMouseEvent.h" | 32 #include "platform/PlatformMouseEvent.h" |
| 33 #include "platform/FrameWidget.h" |
| 33 #include "platform/scroll/ScrollableArea.h" | 34 #include "platform/scroll/ScrollableArea.h" |
| 34 #include "platform/scroll/ScrollAnimator.h" | 35 #include "platform/scroll/ScrollAnimator.h" |
| 35 #include "platform/scroll/Scrollbar.h" | 36 #include "platform/scroll/Scrollbar.h" |
| 36 #include "platform/scroll/ScrollView.h" | |
| 37 #include "public/platform/Platform.h" | 37 #include "public/platform/Platform.h" |
| 38 #include "public/platform/WebPoint.h" | 38 #include "public/platform/WebPoint.h" |
| 39 #include "public/platform/WebRect.h" | 39 #include "public/platform/WebRect.h" |
| 40 #include "public/platform/WebScrollbarBehavior.h" | 40 #include "public/platform/WebScrollbarBehavior.h" |
| 41 #include "public/platform/WebThemeEngine.h" | 41 #include "public/platform/WebThemeEngine.h" |
| 42 | 42 |
| 43 #if ((OS(POSIX) && !OS(MACOSX)) || OS(WIN)) | 43 #if ((OS(POSIX) && !OS(MACOSX)) || OS(WIN)) |
| 44 // The position of the scrollbar thumb affects the appearance of the steppers, s
o | 44 // The position of the scrollbar thumb affects the appearance of the steppers, s
o |
| 45 // when the thumb moves, we have to invalidate them for painting. | 45 // when the thumb moves, we have to invalidate them for painting. |
| 46 #define THUMB_POSITION_AFFECTS_BUTTONS | 46 #define THUMB_POSITION_AFFECTS_BUTTONS |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 84 } | 84 } |
| 85 | 85 |
| 86 Scrollbar::~Scrollbar() | 86 Scrollbar::~Scrollbar() |
| 87 { | 87 { |
| 88 stopTimerIfNeeded(); | 88 stopTimerIfNeeded(); |
| 89 } | 89 } |
| 90 | 90 |
| 91 void Scrollbar::removeFromParent() | 91 void Scrollbar::removeFromParent() |
| 92 { | 92 { |
| 93 if (parent()) | 93 if (parent()) |
| 94 toScrollView(parent())->removeChild(this); | 94 toFrameWidget(parent())->removeChild(this); |
| 95 } | |
| 96 | |
| 97 ScrollView* Scrollbar::parentScrollView() const | |
| 98 { | |
| 99 return toScrollView(parent()); | |
| 100 } | |
| 101 | |
| 102 ScrollView* Scrollbar::rootScrollView() const | |
| 103 { | |
| 104 return toScrollView(root()); | |
| 105 } | 95 } |
| 106 | 96 |
| 107 ScrollbarOverlayStyle Scrollbar::scrollbarOverlayStyle() const | 97 ScrollbarOverlayStyle Scrollbar::scrollbarOverlayStyle() const |
| 108 { | 98 { |
| 109 return m_scrollableArea ? m_scrollableArea->scrollbarOverlayStyle() : Scroll
barOverlayStyleDefault; | 99 return m_scrollableArea ? m_scrollableArea->scrollbarOverlayStyle() : Scroll
barOverlayStyleDefault; |
| 110 } | 100 } |
| 111 | 101 |
| 112 void Scrollbar::getTickmarks(Vector<IntRect>& tickmarks) const | 102 void Scrollbar::getTickmarks(Vector<IntRect>& tickmarks) const |
| 113 { | 103 { |
| 114 if (m_scrollableArea) | 104 if (m_scrollableArea) |
| 115 m_scrollableArea->getTickmarks(tickmarks); | 105 m_scrollableArea->getTickmarks(tickmarks); |
| 116 } | 106 } |
| 117 | 107 |
| 118 bool Scrollbar::isScrollableAreaActive() const | 108 bool Scrollbar::isScrollableAreaActive() const |
| 119 { | 109 { |
| 120 return m_scrollableArea && m_scrollableArea->isActive(); | 110 return m_scrollableArea && m_scrollableArea->isActive(); |
| 121 } | 111 } |
| 122 | 112 |
| 123 bool Scrollbar::isScrollViewScrollbar() const | 113 bool Scrollbar::isScrollViewScrollbar() const |
| 124 { | 114 { |
| 125 return parent() && parent()->isFrameView() && toScrollView(parent())->isScro
llViewScrollbar(this); | 115 // FIXME(sky): Remove |
| 116 return false; |
| 126 } | 117 } |
| 127 | 118 |
| 128 bool Scrollbar::isLeftSideVerticalScrollbar() const | 119 bool Scrollbar::isLeftSideVerticalScrollbar() const |
| 129 { | 120 { |
| 130 if (m_orientation == VerticalScrollbar && m_scrollableArea) | 121 if (m_orientation == VerticalScrollbar && m_scrollableArea) |
| 131 return m_scrollableArea->shouldPlaceVerticalScrollbarOnLeft(); | 122 return m_scrollableArea->shouldPlaceVerticalScrollbarOnLeft(); |
| 132 return false; | 123 return false; |
| 133 } | 124 } |
| 134 | 125 |
| 135 void Scrollbar::offsetDidChange() | 126 void Scrollbar::offsetDidChange() |
| (...skipping 546 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 682 thumbRect.setWidth(thumbRect.width() - kScrollbarMargin); | 673 thumbRect.setWidth(thumbRect.width() - kScrollbarMargin); |
| 683 if (isLeftSideVerticalScrollbar()) | 674 if (isLeftSideVerticalScrollbar()) |
| 684 thumbRect.setX(thumbRect.x() + kScrollbarMargin); | 675 thumbRect.setX(thumbRect.x() + kScrollbarMargin); |
| 685 } | 676 } |
| 686 | 677 |
| 687 DEFINE_STATIC_LOCAL(Color, color, (128, 128, 128, 128)); | 678 DEFINE_STATIC_LOCAL(Color, color, (128, 128, 128, 128)); |
| 688 context->fillRect(thumbRect, color); | 679 context->fillRect(thumbRect, color); |
| 689 } | 680 } |
| 690 | 681 |
| 691 } // namespace blink | 682 } // namespace blink |
| OLD | NEW |