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

Side by Side Diff: third_party/WebKit/Source/core/frame/FrameView.cpp

Issue 2894733002: Kill ScrollbarModesCalculationStrategy. (Closed)
Patch Set: Created 3 years, 7 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/core/frame/FrameView.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) 1998, 1999 Torben Weis <weis@kde.org> 2 * Copyright (C) 1998, 1999 Torben Weis <weis@kde.org>
3 * 1999 Lars Knoll <knoll@kde.org> 3 * 1999 Lars Knoll <knoll@kde.org>
4 * 1999 Antti Koivisto <koivisto@kde.org> 4 * 1999 Antti Koivisto <koivisto@kde.org>
5 * 2000 Dirk Mueller <mueller@kde.org> 5 * 2000 Dirk Mueller <mueller@kde.org>
6 * Copyright (C) 2004, 2005, 2006, 2007, 2008 Apple Inc. All rights reserved. 6 * Copyright (C) 2004, 2005, 2006, 2007, 2008 Apple Inc. All rights reserved.
7 * (C) 2006 Graham Dennis (graham.dennis@gmail.com) 7 * (C) 2006 Graham Dennis (graham.dennis@gmail.com)
8 * (C) 2006 Alexey Proskuryakov (ap@nypop.com) 8 * (C) 2006 Alexey Proskuryakov (ap@nypop.com)
9 * Copyright (C) 2009 Google Inc. All rights reserved. 9 * Copyright (C) 2009 Google Inc. All rights reserved.
10 * 10 *
(...skipping 743 matching lines...) Expand 10 before | Expand all | Expand 10 after
754 if (overflow_y == EOverflow::kHidden) 754 if (overflow_y == EOverflow::kHidden)
755 v_mode = kScrollbarAlwaysOff; 755 v_mode = kScrollbarAlwaysOff;
756 } 756 }
757 757
758 if (overflow_x == EOverflow::kScroll) 758 if (overflow_x == EOverflow::kScroll)
759 h_mode = kScrollbarAlwaysOn; 759 h_mode = kScrollbarAlwaysOn;
760 if (overflow_y == EOverflow::kScroll) 760 if (overflow_y == EOverflow::kScroll)
761 v_mode = kScrollbarAlwaysOn; 761 v_mode = kScrollbarAlwaysOn;
762 } 762 }
763 763
764 void FrameView::CalculateScrollbarModes( 764 void FrameView::CalculateScrollbarModes(ScrollbarMode& h_mode,
765 ScrollbarMode& h_mode, 765 ScrollbarMode& v_mode) const {
766 ScrollbarMode& v_mode,
767 ScrollbarModesCalculationStrategy strategy) const {
768 #define RETURN_SCROLLBAR_MODE(mode) \ 766 #define RETURN_SCROLLBAR_MODE(mode) \
769 { \ 767 { \
770 h_mode = v_mode = mode; \ 768 h_mode = v_mode = mode; \
771 return; \ 769 return; \
772 } 770 }
773 771
774 // Setting scrolling="no" on an iframe element disables scrolling. 772 // Setting scrolling="no" on an iframe element disables scrolling.
775 if (frame_->Owner() && 773 if (frame_->Owner() &&
776 frame_->Owner()->ScrollingMode() == kScrollbarAlwaysOff) 774 frame_->Owner()->ScrollingMode() == kScrollbarAlwaysOff)
777 RETURN_SCROLLBAR_MODE(kScrollbarAlwaysOff); 775 RETURN_SCROLLBAR_MODE(kScrollbarAlwaysOff);
778 776
779 // Framesets can't scroll. 777 // Framesets can't scroll.
780 Node* body = frame_->GetDocument()->body(); 778 Node* body = frame_->GetDocument()->body();
781 if (isHTMLFrameSetElement(body) && body->GetLayoutObject()) 779 if (isHTMLFrameSetElement(body) && body->GetLayoutObject())
782 RETURN_SCROLLBAR_MODE(kScrollbarAlwaysOff); 780 RETURN_SCROLLBAR_MODE(kScrollbarAlwaysOff);
783 781
784 // Scrollbars can be disabled by FrameView::setCanHaveScrollbars. 782 // Scrollbars can be disabled by FrameView::setCanHaveScrollbars.
785 if (!can_have_scrollbars_ && strategy != kRulesFromWebContentOnly) 783 if (!can_have_scrollbars_)
786 RETURN_SCROLLBAR_MODE(kScrollbarAlwaysOff); 784 RETURN_SCROLLBAR_MODE(kScrollbarAlwaysOff);
787 785
788 // This will be the LayoutObject for either the body element or the html 786 // This will be the LayoutObject for either the body element or the html
789 // element (see Document::viewportDefiningElement). 787 // element (see Document::viewportDefiningElement).
790 LayoutObject* viewport = ViewportLayoutObject(); 788 LayoutObject* viewport = ViewportLayoutObject();
791 if (!viewport || !viewport->Style()) 789 if (!viewport || !viewport->Style())
792 RETURN_SCROLLBAR_MODE(kScrollbarAuto); 790 RETURN_SCROLLBAR_MODE(kScrollbarAuto);
793 791
794 if (viewport->IsSVGRoot()) { 792 if (viewport->IsSVGRoot()) {
795 // Don't allow overflow to affect <img> and css backgrounds 793 // Don't allow overflow to affect <img> and css backgrounds
(...skipping 1930 matching lines...) Expand 10 before | Expand all | Expand 10 after
2726 // Covers #2. 2724 // Covers #2.
2727 // FIXME: Do we need to fix this for OOPI? 2725 // FIXME: Do we need to fix this for OOPI?
2728 HTMLFrameOwnerElement* owner = frame_->DeprecatedLocalOwner(); 2726 HTMLFrameOwnerElement* owner = frame_->DeprecatedLocalOwner();
2729 if (owner && (!owner->GetLayoutObject() || 2727 if (owner && (!owner->GetLayoutObject() ||
2730 !owner->GetLayoutObject()->VisibleToHitTesting())) 2728 !owner->GetLayoutObject()->VisibleToHitTesting()))
2731 return kNotScrollableNotVisible; 2729 return kNotScrollableNotVisible;
2732 2730
2733 // Cover #3 and #4. 2731 // Cover #3 and #4.
2734 ScrollbarMode horizontal_mode; 2732 ScrollbarMode horizontal_mode;
2735 ScrollbarMode vertical_mode; 2733 ScrollbarMode vertical_mode;
2736 CalculateScrollbarModes(horizontal_mode, vertical_mode, 2734 CalculateScrollbarModes(horizontal_mode, vertical_mode);
2737 kRulesFromWebContentOnly);
2738 if (horizontal_mode == kScrollbarAlwaysOff && 2735 if (horizontal_mode == kScrollbarAlwaysOff &&
2739 vertical_mode == kScrollbarAlwaysOff) 2736 vertical_mode == kScrollbarAlwaysOff)
2740 return kNotScrollableExplicitlyDisabled; 2737 return kNotScrollableExplicitlyDisabled;
2741 2738
2742 return kScrollable; 2739 return kScrollable;
2743 } 2740 }
2744 2741
2745 void FrameView::UpdateParentScrollableAreaSet() { 2742 void FrameView::UpdateParentScrollableAreaSet() {
2746 if (RuntimeEnabledFeatures::rootLayerScrollingEnabled()) 2743 if (RuntimeEnabledFeatures::rootLayerScrollingEnabled())
2747 return; 2744 return;
(...skipping 2641 matching lines...) Expand 10 before | Expand all | Expand 10 after
5389 void FrameView::SetAnimationHost( 5386 void FrameView::SetAnimationHost(
5390 std::unique_ptr<CompositorAnimationHost> host) { 5387 std::unique_ptr<CompositorAnimationHost> host) {
5391 animation_host_ = std::move(host); 5388 animation_host_ = std::move(host);
5392 } 5389 }
5393 5390
5394 LayoutUnit FrameView::CaretWidth() const { 5391 LayoutUnit FrameView::CaretWidth() const {
5395 return LayoutUnit(GetChromeClient()->WindowToViewportScalar(1)); 5392 return LayoutUnit(GetChromeClient()->WindowToViewportScalar(1));
5396 } 5393 }
5397 5394
5398 } // namespace blink 5395 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/frame/FrameView.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698