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 10 matching lines...) Expand all Loading... | |
21 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 21 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
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 "core/platform/Scrollbar.h" | 27 #include "core/platform/Scrollbar.h" |
28 | 28 |
29 #include <algorithm> | 29 #include <algorithm> |
30 #include "core/platform/ScrollAnimator.h" | 30 #include "core/platform/ScrollAnimator.h" |
31 #include "core/platform/ScrollView.h" | |
31 #include "core/platform/ScrollableArea.h" | 32 #include "core/platform/ScrollableArea.h" |
32 #include "core/platform/ScrollbarTheme.h" | 33 #include "core/platform/ScrollbarTheme.h" |
33 #include "core/platform/graphics/GraphicsContext.h" | 34 #include "core/platform/graphics/GraphicsContext.h" |
34 | 35 |
35 // FIXME: The following #includes are a layering violation and should be removed . | |
36 #include "core/accessibility/AXObjectCache.h" | |
37 #include "core/page/EventHandler.h" | |
38 #include "core/frame/Frame.h" | |
39 #include "core/frame/FrameView.h" | |
40 | |
41 #include "platform/PlatformGestureEvent.h" | 36 #include "platform/PlatformGestureEvent.h" |
42 #include "platform/PlatformMouseEvent.h" | 37 #include "platform/PlatformMouseEvent.h" |
43 | 38 |
44 using namespace std; | 39 using namespace std; |
45 | 40 |
46 #if OS(POSIX) && !OS(MACOSX) | 41 #if OS(POSIX) && !OS(MACOSX) |
47 // The position of the scrollbar thumb affects the appearance of the steppers, s o | 42 // The position of the scrollbar thumb affects the appearance of the steppers, s o |
48 // when the thumb moves, we have to invalidate them for painting. | 43 // when the thumb moves, we have to invalidate them for painting. |
49 #define THUMB_POSITION_AFFECTS_BUTTONS | 44 #define THUMB_POSITION_AFFECTS_BUTTONS |
50 #endif | 45 #endif |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
128 m_scrollableArea->getTickmarks(tickmarks); | 123 m_scrollableArea->getTickmarks(tickmarks); |
129 } | 124 } |
130 | 125 |
131 bool Scrollbar::isScrollableAreaActive() const | 126 bool Scrollbar::isScrollableAreaActive() const |
132 { | 127 { |
133 return m_scrollableArea && m_scrollableArea->isActive(); | 128 return m_scrollableArea && m_scrollableArea->isActive(); |
134 } | 129 } |
135 | 130 |
136 bool Scrollbar::isScrollViewScrollbar() const | 131 bool Scrollbar::isScrollViewScrollbar() const |
137 { | 132 { |
138 return parent() && parent()->isFrameView() && toFrameView(parent())->isScrol lViewScrollbar(this); | 133 return parent() && parent()->isFrameView() && toScrollView(parent())->isScro llViewScrollbar(this); |
139 } | 134 } |
140 | 135 |
141 bool Scrollbar::isLeftSideVerticalScrollbar() const | 136 bool Scrollbar::isLeftSideVerticalScrollbar() const |
142 { | 137 { |
143 if (m_orientation == VerticalScrollbar && m_scrollableArea) | 138 if (m_orientation == VerticalScrollbar && m_scrollableArea) |
144 return m_scrollableArea->shouldPlaceVerticalScrollbarOnLeft(); | 139 return m_scrollableArea->shouldPlaceVerticalScrollbarOnLeft(); |
145 return false; | 140 return false; |
146 } | 141 } |
147 | 142 |
148 void Scrollbar::offsetDidChange() | 143 void Scrollbar::offsetDidChange() |
(...skipping 301 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
450 m_draggingDocument = false; | 445 m_draggingDocument = false; |
451 stopTimerIfNeeded(); | 446 stopTimerIfNeeded(); |
452 | 447 |
453 if (m_scrollableArea) { | 448 if (m_scrollableArea) { |
454 // m_hoveredPart won't be updated until the next mouseMoved or mouseDown , so we have to hit test | 449 // m_hoveredPart won't be updated until the next mouseMoved or mouseDown , so we have to hit test |
455 // to really know if the mouse has exited the scrollbar on a mouseUp. | 450 // to really know if the mouse has exited the scrollbar on a mouseUp. |
456 ScrollbarPart part = theme()->hitTest(this, mouseEvent.position()); | 451 ScrollbarPart part = theme()->hitTest(this, mouseEvent.position()); |
457 if (part == NoPart) | 452 if (part == NoPart) |
458 m_scrollableArea->mouseExitedScrollbar(this); | 453 m_scrollableArea->mouseExitedScrollbar(this); |
459 } | 454 } |
460 | |
461 if (parent() && parent()->isFrameView()) | |
462 toFrameView(parent())->frame().eventHandler().setMousePressed(false); | |
eseidel
2013/11/08 10:28:31
Why is it OK to remove this?
| |
463 } | 455 } |
464 | 456 |
465 void Scrollbar::mouseDown(const PlatformMouseEvent& evt) | 457 void Scrollbar::mouseDown(const PlatformMouseEvent& evt) |
466 { | 458 { |
467 // Early exit for right click | 459 // Early exit for right click |
468 if (evt.button() == RightButton) | 460 if (evt.button() == RightButton) |
469 return; | 461 return; |
470 | 462 |
471 setPressedPart(theme()->hitTest(this, evt.position())); | 463 setPressedPart(theme()->hitTest(this, evt.position())); |
472 int pressedPos = (orientation() == HorizontalScrollbar ? convertFromContaini ngWindow(evt.position()).x() : convertFromContainingWindow(evt.position()).y()); | 464 int pressedPos = (orientation() == HorizontalScrollbar ? convertFromContaini ngWindow(evt.position()).x() : convertFromContainingWindow(evt.position()).y()); |
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
612 if (!m_scrollableArea) | 604 if (!m_scrollableArea) |
613 return 0; | 605 return 0; |
614 | 606 |
615 if (m_orientation == HorizontalScrollbar) | 607 if (m_orientation == HorizontalScrollbar) |
616 return m_scrollableArea->scrollPosition().x() - m_scrollableArea->minimu mScrollPosition().x(); | 608 return m_scrollableArea->scrollPosition().x() - m_scrollableArea->minimu mScrollPosition().x(); |
617 | 609 |
618 return m_scrollableArea->scrollPosition().y() - m_scrollableArea->minimumScr ollPosition().y(); | 610 return m_scrollableArea->scrollPosition().y() - m_scrollableArea->minimumScr ollPosition().y(); |
619 } | 611 } |
620 | 612 |
621 } // namespace WebCore | 613 } // namespace WebCore |
OLD | NEW |