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 |
11 * documentation and/or other materials provided with the distribution. | 11 * documentation and/or other materials provided with the distribution. |
12 * | 12 * |
13 * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY | 13 * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY |
14 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | 14 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
15 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | 15 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR |
16 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR | 16 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR |
17 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, | 17 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, |
18 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, | 18 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, |
19 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR | 19 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR |
20 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY | 20 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY |
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 "platform/scroll/Scrollbar.h" | 26 #include "platform/scroll/Scrollbar.h" |
27 | 27 |
28 #include <algorithm> | 28 #include <algorithm> |
| 29 #include "platform/FrameViewBase.h" |
29 #include "platform/PlatformChromeClient.h" | 30 #include "platform/PlatformChromeClient.h" |
30 #include "platform/geometry/FloatRect.h" | 31 #include "platform/geometry/FloatRect.h" |
31 #include "platform/graphics/paint/CullRect.h" | 32 #include "platform/graphics/paint/CullRect.h" |
32 #include "platform/scroll/ScrollAnimatorBase.h" | 33 #include "platform/scroll/ScrollAnimatorBase.h" |
33 #include "platform/scroll/ScrollableArea.h" | 34 #include "platform/scroll/ScrollableArea.h" |
34 #include "platform/scroll/ScrollbarTheme.h" | 35 #include "platform/scroll/ScrollbarTheme.h" |
35 #include "public/platform/WebGestureEvent.h" | 36 #include "public/platform/WebGestureEvent.h" |
36 #include "public/platform/WebMouseEvent.h" | 37 #include "public/platform/WebMouseEvent.h" |
37 | 38 |
38 namespace blink { | 39 namespace blink { |
(...skipping 532 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
571 | 572 |
572 bool Scrollbar::IsWindowActive() const { | 573 bool Scrollbar::IsWindowActive() const { |
573 return scrollable_area_ && scrollable_area_->IsActive(); | 574 return scrollable_area_ && scrollable_area_->IsActive(); |
574 } | 575 } |
575 | 576 |
576 IntPoint Scrollbar::ConvertFromRootFrame( | 577 IntPoint Scrollbar::ConvertFromRootFrame( |
577 const IntPoint& point_in_root_frame) const { | 578 const IntPoint& point_in_root_frame) const { |
578 if (const FrameViewBase* parent = Parent()) { | 579 if (const FrameViewBase* parent = Parent()) { |
579 IntPoint parent_point = parent->ConvertFromRootFrame(point_in_root_frame); | 580 IntPoint parent_point = parent->ConvertFromRootFrame(point_in_root_frame); |
580 if (scrollable_area_) { | 581 if (scrollable_area_) { |
581 return scrollable_area_->ConvertFromContainingFrameViewBaseToScrollbar( | 582 return scrollable_area_->ConvertFromContainingFrameViewToScrollbar( |
582 *this, parent_point); | 583 *this, parent_point); |
583 } | 584 } |
584 } | 585 } |
585 | 586 |
586 return point_in_root_frame; | 587 return point_in_root_frame; |
587 } | 588 } |
588 | 589 |
589 IntRect Scrollbar::ConvertToContainingFrameViewBase( | 590 IntRect Scrollbar::ConvertToContainingFrameView( |
590 const IntRect& local_rect) const { | 591 const IntRect& local_rect) const { |
591 if (scrollable_area_) { | 592 if (scrollable_area_) { |
592 return scrollable_area_->ConvertFromScrollbarToContainingFrameViewBase( | 593 return scrollable_area_->ConvertFromScrollbarToContainingFrameView( |
593 *this, local_rect); | 594 *this, local_rect); |
594 } | 595 } |
595 | 596 |
596 return local_rect; | 597 return local_rect; |
597 } | 598 } |
598 | 599 |
599 IntPoint Scrollbar::ConvertFromContainingFrameViewBase( | 600 IntPoint Scrollbar::ConvertFromContainingFrameView( |
600 const IntPoint& parent_point) const { | 601 const IntPoint& parent_point) const { |
601 if (scrollable_area_) { | 602 if (scrollable_area_) { |
602 return scrollable_area_->ConvertFromContainingFrameViewBaseToScrollbar( | 603 return scrollable_area_->ConvertFromContainingFrameViewToScrollbar( |
603 *this, parent_point); | 604 *this, parent_point); |
604 } | 605 } |
605 | 606 |
606 return parent_point; | 607 return parent_point; |
607 } | 608 } |
608 | 609 |
609 float Scrollbar::ScrollableAreaCurrentPos() const { | 610 float Scrollbar::ScrollableAreaCurrentPos() const { |
610 if (!scrollable_area_) | 611 if (!scrollable_area_) |
611 return 0; | 612 return 0; |
612 | 613 |
(...skipping 24 matching lines...) Expand all Loading... |
637 invalid_parts = kAllParts; | 638 invalid_parts = kAllParts; |
638 if (invalid_parts & ~kThumbPart) | 639 if (invalid_parts & ~kThumbPart) |
639 track_needs_repaint_ = true; | 640 track_needs_repaint_ = true; |
640 if (invalid_parts & kThumbPart) | 641 if (invalid_parts & kThumbPart) |
641 thumb_needs_repaint_ = true; | 642 thumb_needs_repaint_ = true; |
642 if (scrollable_area_) | 643 if (scrollable_area_) |
643 scrollable_area_->SetScrollbarNeedsPaintInvalidation(Orientation()); | 644 scrollable_area_->SetScrollbarNeedsPaintInvalidation(Orientation()); |
644 } | 645 } |
645 | 646 |
646 } // namespace blink | 647 } // namespace blink |
OLD | NEW |