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

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

Issue 2454913003: MainFrame scrollbars should work with RFV instead of FV (Closed)
Patch Set: add test + rebase Created 4 years, 1 month 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
OLDNEW
1 /* 1 /*
2 Copyright (C) 1997 Martin Jones (mjones@kde.org) 2 Copyright (C) 1997 Martin Jones (mjones@kde.org)
3 (C) 1998 Waldo Bastian (bastian@kde.org) 3 (C) 1998 Waldo Bastian (bastian@kde.org)
4 (C) 1998, 1999 Torben Weis (weis@kde.org) 4 (C) 1998, 1999 Torben Weis (weis@kde.org)
5 (C) 1999 Lars Knoll (knoll@kde.org) 5 (C) 1999 Lars Knoll (knoll@kde.org)
6 (C) 1999 Antti Koivisto (koivisto@kde.org) 6 (C) 1999 Antti Koivisto (koivisto@kde.org)
7 Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights 7 Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights
8 reserved. 8 reserved.
9 9
10 This library is free software; you can redistribute it and/or 10 This library is free software; you can redistribute it and/or
(...skipping 382 matching lines...) Expand 10 before | Expand all | Expand 10 after
393 void didAddScrollbar(Scrollbar&, ScrollbarOrientation) override; 393 void didAddScrollbar(Scrollbar&, ScrollbarOrientation) override;
394 394
395 // FIXME: This should probably be renamed as the 'inSubtreeLayout' parameter 395 // FIXME: This should probably be renamed as the 'inSubtreeLayout' parameter
396 // passed around the FrameView layout methods can be true while this returns 396 // passed around the FrameView layout methods can be true while this returns
397 // false. 397 // false.
398 bool isSubtreeLayout() const { return !m_layoutSubtreeRootList.isEmpty(); } 398 bool isSubtreeLayout() const { return !m_layoutSubtreeRootList.isEmpty(); }
399 399
400 // Sets the tickmarks for the FrameView, overriding the default behavior 400 // Sets the tickmarks for the FrameView, overriding the default behavior
401 // which is to display the tickmarks corresponding to find results. 401 // which is to display the tickmarks corresponding to find results.
402 // If |m_tickmarks| is empty, the default behavior is restored. 402 // If |m_tickmarks| is empty, the default behavior is restored.
403 void setTickmarks(const Vector<IntRect>& tickmarks) { 403 void setTickmarks(const Vector<IntRect>&);
404 m_tickmarks = tickmarks;
405 invalidatePaintForTickmarks();
406 }
407 404
408 void invalidatePaintForTickmarks(); 405 void invalidatePaintForTickmarks();
409 406
410 // Since the compositor can resize the viewport due to browser controls and 407 // Since the compositor can resize the viewport due to browser controls and
411 // commit scroll offsets before a WebView::resize occurs, we need to adjust 408 // commit scroll offsets before a WebView::resize occurs, we need to adjust
412 // our scroll extents to prevent clamping the scroll offsets. 409 // our scroll extents to prevent clamping the scroll offsets.
413 void setBrowserControlsViewportAdjustment(float); 410 void setBrowserControlsViewportAdjustment(float);
414 IntSize browserControlsSize() const { 411 IntSize browserControlsSize() const {
415 return IntSize(0, ceilf(m_browserControlsViewportAdjustment)); 412 return IntSize(0, ceilf(m_browserControlsViewportAdjustment));
416 } 413 }
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
455 // If the scroll view does not use a native widget, then it will have 452 // If the scroll view does not use a native widget, then it will have
456 // cross-platform Scrollbars. These functions can be used to obtain those 453 // cross-platform Scrollbars. These functions can be used to obtain those
457 // scrollbars. 454 // scrollbars.
458 Scrollbar* horizontalScrollbar() const override { 455 Scrollbar* horizontalScrollbar() const override {
459 return m_scrollbarManager.horizontalScrollbar(); 456 return m_scrollbarManager.horizontalScrollbar();
460 } 457 }
461 Scrollbar* verticalScrollbar() const override { 458 Scrollbar* verticalScrollbar() const override {
462 return m_scrollbarManager.verticalScrollbar(); 459 return m_scrollbarManager.verticalScrollbar();
463 } 460 }
464 LayoutScrollbarPart* scrollCorner() const override { return m_scrollCorner; } 461 LayoutScrollbarPart* scrollCorner() const override { return m_scrollCorner; }
462 // Called to update the scrollbars to accurately reflect the state of the
463 // view.
464 void updateScrollbars();
465 465
466 void positionScrollbarLayers(); 466 void positionScrollbarLayers();
467 467
468 // Functions for setting and retrieving the scrolling mode in each axis 468 // Functions for setting and retrieving the scrolling mode in each axis
469 // (horizontal/vertical). The mode has values of AlwaysOff, AlwaysOn, and 469 // (horizontal/vertical). The mode has values of AlwaysOff, AlwaysOn, and
470 // Auto. AlwaysOff means never show a scrollbar, AlwaysOn means always show a 470 // Auto. AlwaysOff means never show a scrollbar, AlwaysOn means always show a
471 // scrollbar. Auto means show a scrollbar only when one is needed. 471 // scrollbar. Auto means show a scrollbar only when one is needed.
472 // Note that for platforms with native widgets, these modes are considered 472 // Note that for platforms with native widgets, these modes are considered
473 // advisory. In other words the underlying native widget may choose not to 473 // advisory. In other words the underlying native widget may choose not to
474 // honor the requested modes. 474 // honor the requested modes.
(...skipping 273 matching lines...) Expand 10 before | Expand all | Expand 10 after
748 ScrollBehavior scrollBehaviorStyle() const override; 748 ScrollBehavior scrollBehaviorStyle() const override;
749 749
750 void scrollContentsIfNeeded(); 750 void scrollContentsIfNeeded();
751 751
752 enum ComputeScrollbarExistenceOption { FirstPass, Incremental }; 752 enum ComputeScrollbarExistenceOption { FirstPass, Incremental };
753 void computeScrollbarExistence( 753 void computeScrollbarExistence(
754 bool& newHasHorizontalScrollbar, 754 bool& newHasHorizontalScrollbar,
755 bool& newHasVerticalScrollbar, 755 bool& newHasVerticalScrollbar,
756 const IntSize& docSize, 756 const IntSize& docSize,
757 ComputeScrollbarExistenceOption = FirstPass) const; 757 ComputeScrollbarExistenceOption = FirstPass) const;
758 void updateScrollbarGeometry();
759 758
760 // Called to update the scrollbars to accurately reflect the state of the
761 // view.
762 void updateScrollbars();
763 void updateScrollbarsIfNeeded(); 759 void updateScrollbarsIfNeeded();
764 760
765 class InUpdateScrollbarsScope { 761 class InUpdateScrollbarsScope {
766 STACK_ALLOCATED(); 762 STACK_ALLOCATED();
767 763
768 public: 764 public:
769 explicit InUpdateScrollbarsScope(FrameView* view) 765 explicit InUpdateScrollbarsScope(FrameView* view)
770 : m_scope(&view->m_inUpdateScrollbars, true) {} 766 : m_scope(&view->m_inUpdateScrollbars, true) {}
771 767
772 private: 768 private:
(...skipping 12 matching lines...) Expand all
785 public: 781 public:
786 ScrollbarManager(FrameView& scroller) : blink::ScrollbarManager(scroller) {} 782 ScrollbarManager(FrameView& scroller) : blink::ScrollbarManager(scroller) {}
787 783
788 void setHasHorizontalScrollbar(bool hasScrollbar) override; 784 void setHasHorizontalScrollbar(bool hasScrollbar) override;
789 void setHasVerticalScrollbar(bool hasScrollbar) override; 785 void setHasVerticalScrollbar(bool hasScrollbar) override;
790 786
791 // TODO(ymalik): This should be hidden and all calls should go through 787 // TODO(ymalik): This should be hidden and all calls should go through
792 // setHas*Scrollbar functions above. 788 // setHas*Scrollbar functions above.
793 Scrollbar* createScrollbar(ScrollbarOrientation) override; 789 Scrollbar* createScrollbar(ScrollbarOrientation) override;
794 790
791 // TODO(ymalik): There is probably scope for refactoring common code
792 // between this and PaintLayerScrollableArea.
793 bool needScrollbar(ScrollbarOrientation,
794 const IntSize& docSize,
795 ComputeScrollbarExistenceOption) const;
796 // Updates the scrollbar geometry given the size of the frame view rect.
797 void updateScrollbarGeometry(IntSize viewSize);
798
795 protected: 799 protected:
796 void destroyScrollbar(ScrollbarOrientation) override; 800 void destroyScrollbar(ScrollbarOrientation) override;
797 }; 801 };
798 802
799 void updateScrollOffset(const ScrollOffset&, ScrollType) override; 803 void updateScrollOffset(const ScrollOffset&, ScrollType) override;
800 804
801 void updateLifecyclePhasesInternal( 805 void updateLifecyclePhasesInternal(
802 DocumentLifecycle::LifecycleState targetState); 806 DocumentLifecycle::LifecycleState targetState);
803 807
804 void invalidateTreeIfNeededRecursive(); 808 void invalidateTreeIfNeededRecursive();
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
862 void setFragmentAnchor(Node*); 866 void setFragmentAnchor(Node*);
863 void scrollToFragmentAnchor(); 867 void scrollToFragmentAnchor();
864 void didScrollTimerFired(TimerBase*); 868 void didScrollTimerFired(TimerBase*);
865 869
866 void updateLayersAndCompositingAfterScrollIfNeeded( 870 void updateLayersAndCompositingAfterScrollIfNeeded(
867 const ScrollOffset& scrollDelta); 871 const ScrollOffset& scrollDelta);
868 872
869 static bool computeCompositedSelection(LocalFrame&, CompositedSelection&); 873 static bool computeCompositedSelection(LocalFrame&, CompositedSelection&);
870 void updateCompositedSelectionIfNeeded(); 874 void updateCompositedSelectionIfNeeded();
871 875
872 // Returns true if the FrameView's own scrollbars overlay its content when
873 // visible.
874 bool hasOverlayScrollbars() const;
875
876 // Returns true if the frame should use custom scrollbars. If true, one of 876 // Returns true if the frame should use custom scrollbars. If true, one of
877 // either |customScrollbarElement| or |customScrollbarFrame| will be set to 877 // either |customScrollbarElement| or |customScrollbarFrame| will be set to
878 // the element or frame which owns the scrollbar with the other set to null. 878 // the element or frame which owns the scrollbar with the other set to null.
879 bool shouldUseCustomScrollbars(Element*& customScrollbarElement, 879 bool shouldUseCustomScrollbars(Element*& customScrollbarElement,
880 LocalFrame*& customScrollbarFrame) const; 880 LocalFrame*& customScrollbarFrame) const;
881 881
882 // Returns true if a scrollbar needs to go from native -> custom or vice 882 // Returns true if a scrollbar needs to go from native -> custom or vice
883 // versa. 883 // versa.
884 bool needsScrollbarReconstruction() const; 884 bool needsScrollbarReconstruction() const;
885 885
(...skipping 247 matching lines...) Expand 10 before | Expand all | Expand 10 after
1133 widget.isFrameView()); 1133 widget.isFrameView());
1134 DEFINE_TYPE_CASTS(FrameView, 1134 DEFINE_TYPE_CASTS(FrameView,
1135 ScrollableArea, 1135 ScrollableArea,
1136 scrollableArea, 1136 scrollableArea,
1137 scrollableArea->isFrameView(), 1137 scrollableArea->isFrameView(),
1138 scrollableArea.isFrameView()); 1138 scrollableArea.isFrameView());
1139 1139
1140 } // namespace blink 1140 } // namespace blink
1141 1141
1142 #endif // FrameView_h 1142 #endif // FrameView_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698