Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(66)

Side by Side Diff: third_party/WebKit/Source/platform/scroll/Scrollbar.cpp

Issue 2832883003: Remove unneeded Convert* methods and move many from FrameViewBase to FrameView (Closed)
Patch Set: fix ScrollableArea::ConvertFromScrollbarToContainingFrameViewBase and remove dchecks Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « third_party/WebKit/Source/platform/scroll/Scrollbar.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 551 matching lines...) Expand 10 before | Expand all | Expand 10 after
562 // Non-overlay scrollbars should always participate in hit testing. 562 // Non-overlay scrollbars should always participate in hit testing.
563 if (!IsOverlayScrollbar()) 563 if (!IsOverlayScrollbar())
564 return true; 564 return true;
565 return !scrollable_area_->ScrollbarsHidden(); 565 return !scrollable_area_->ScrollbarsHidden();
566 } 566 }
567 567
568 bool Scrollbar::IsWindowActive() const { 568 bool Scrollbar::IsWindowActive() const {
569 return scrollable_area_ && scrollable_area_->IsActive(); 569 return scrollable_area_ && scrollable_area_->IsActive();
570 } 570 }
571 571
572 IntPoint Scrollbar::ConvertFromRootFrame(
573 const IntPoint& point_in_root_frame) const {
574 if (const FrameViewBase* parent = Parent()) {
575 IntPoint parent_point = parent->ConvertFromRootFrame(point_in_root_frame);
576 if (scrollable_area_) {
577 return scrollable_area_->ConvertFromContainingFrameViewBaseToScrollbar(
578 *this, parent_point);
579 }
580 }
581
582 return point_in_root_frame;
583 }
584
572 IntRect Scrollbar::ConvertToContainingFrameViewBase( 585 IntRect Scrollbar::ConvertToContainingFrameViewBase(
573 const IntRect& local_rect) const { 586 const IntRect& local_rect) const {
574 if (scrollable_area_) { 587 if (scrollable_area_) {
575 return scrollable_area_->ConvertFromScrollbarToContainingFrameViewBase( 588 return scrollable_area_->ConvertFromScrollbarToContainingFrameViewBase(
576 *this, local_rect); 589 *this, local_rect);
577 } 590 }
578 591
579 return FrameViewBase::ConvertToContainingFrameViewBase(local_rect); 592 return local_rect;
580 }
581
582 IntRect Scrollbar::ConvertFromContainingFrameViewBase(
583 const IntRect& parent_rect) const {
584 if (scrollable_area_) {
585 return scrollable_area_->ConvertFromContainingFrameViewBaseToScrollbar(
586 *this, parent_rect);
587 }
588
589 return FrameViewBase::ConvertFromContainingFrameViewBase(parent_rect);
590 }
591
592 IntPoint Scrollbar::ConvertToContainingFrameViewBase(
593 const IntPoint& local_point) const {
594 if (scrollable_area_) {
595 return scrollable_area_->ConvertFromScrollbarToContainingFrameViewBase(
596 *this, local_point);
597 }
598
599 return FrameViewBase::ConvertToContainingFrameViewBase(local_point);
600 } 593 }
601 594
602 IntPoint Scrollbar::ConvertFromContainingFrameViewBase( 595 IntPoint Scrollbar::ConvertFromContainingFrameViewBase(
603 const IntPoint& parent_point) const { 596 const IntPoint& parent_point) const {
604 if (scrollable_area_) { 597 if (scrollable_area_) {
605 return scrollable_area_->ConvertFromContainingFrameViewBaseToScrollbar( 598 return scrollable_area_->ConvertFromContainingFrameViewBaseToScrollbar(
606 *this, parent_point); 599 *this, parent_point);
607 } 600 }
608 601
609 return FrameViewBase::ConvertFromContainingFrameViewBase(parent_point); 602 return parent_point;
610 } 603 }
611 604
612 float Scrollbar::ScrollableAreaCurrentPos() const { 605 float Scrollbar::ScrollableAreaCurrentPos() const {
613 if (!scrollable_area_) 606 if (!scrollable_area_)
614 return 0; 607 return 0;
615 608
616 if (orientation_ == kHorizontalScrollbar) { 609 if (orientation_ == kHorizontalScrollbar) {
617 return scrollable_area_->GetScrollOffset().Width() - 610 return scrollable_area_->GetScrollOffset().Width() -
618 scrollable_area_->MinimumScrollOffset().Width(); 611 scrollable_area_->MinimumScrollOffset().Width();
619 } 612 }
(...skipping 20 matching lines...) Expand all
640 invalid_parts = kAllParts; 633 invalid_parts = kAllParts;
641 if (invalid_parts & ~kThumbPart) 634 if (invalid_parts & ~kThumbPart)
642 track_needs_repaint_ = true; 635 track_needs_repaint_ = true;
643 if (invalid_parts & kThumbPart) 636 if (invalid_parts & kThumbPart)
644 thumb_needs_repaint_ = true; 637 thumb_needs_repaint_ = true;
645 if (scrollable_area_) 638 if (scrollable_area_)
646 scrollable_area_->SetScrollbarNeedsPaintInvalidation(Orientation()); 639 scrollable_area_->SetScrollbarNeedsPaintInvalidation(Orientation());
647 } 640 }
648 641
649 } // namespace blink 642 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/platform/scroll/Scrollbar.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698