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

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

Issue 2836813002: Move ScrollbarManager from core to platform and use as Scrollbar parent (Closed)
Patch Set: 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 | « no previous file | third_party/WebKit/Source/core/frame/FrameView.cpp » ('j') | 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) 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 21 matching lines...) Expand all
32 #include "core/frame/FrameOrPlugin.h" 32 #include "core/frame/FrameOrPlugin.h"
33 #include "core/frame/FrameViewAutoSizeInfo.h" 33 #include "core/frame/FrameViewAutoSizeInfo.h"
34 #include "core/frame/LayoutSubtreeRootList.h" 34 #include "core/frame/LayoutSubtreeRootList.h"
35 #include "core/frame/RootFrameViewport.h" 35 #include "core/frame/RootFrameViewport.h"
36 #include "core/layout/MapCoordinatesFlags.h" 36 #include "core/layout/MapCoordinatesFlags.h"
37 #include "core/layout/ScrollAnchor.h" 37 #include "core/layout/ScrollAnchor.h"
38 #include "core/paint/FirstMeaningfulPaintDetector.h" 38 #include "core/paint/FirstMeaningfulPaintDetector.h"
39 #include "core/paint/ObjectPaintProperties.h" 39 #include "core/paint/ObjectPaintProperties.h"
40 #include "core/paint/PaintInvalidationCapableScrollableArea.h" 40 #include "core/paint/PaintInvalidationCapableScrollableArea.h"
41 #include "core/paint/PaintPhase.h" 41 #include "core/paint/PaintPhase.h"
42 #include "core/paint/ScrollbarManager.h"
43 #include "core/plugins/PluginView.h" 42 #include "core/plugins/PluginView.h"
44 #include "platform/FrameViewBase.h" 43 #include "platform/FrameViewBase.h"
45 #include "platform/RuntimeEnabledFeatures.h" 44 #include "platform/RuntimeEnabledFeatures.h"
46 #include "platform/animation/CompositorAnimationHost.h" 45 #include "platform/animation/CompositorAnimationHost.h"
47 #include "platform/animation/CompositorAnimationTimeline.h" 46 #include "platform/animation/CompositorAnimationTimeline.h"
48 #include "platform/geometry/IntRect.h" 47 #include "platform/geometry/IntRect.h"
49 #include "platform/geometry/LayoutRect.h" 48 #include "platform/geometry/LayoutRect.h"
50 #include "platform/graphics/Color.h" 49 #include "platform/graphics/Color.h"
51 #include "platform/graphics/CompositorElementId.h" 50 #include "platform/graphics/CompositorElementId.h"
52 #include "platform/graphics/GraphicsLayerClient.h" 51 #include "platform/graphics/GraphicsLayerClient.h"
53 #include "platform/scroll/ScrollTypes.h" 52 #include "platform/scroll/ScrollTypes.h"
54 #include "platform/scroll/Scrollbar.h" 53 #include "platform/scroll/Scrollbar.h"
54 #include "platform/scroll/ScrollbarManager.h"
55 #include "platform/wtf/Allocator.h" 55 #include "platform/wtf/Allocator.h"
56 #include "platform/wtf/AutoReset.h" 56 #include "platform/wtf/AutoReset.h"
57 #include "platform/wtf/Forward.h" 57 #include "platform/wtf/Forward.h"
58 #include "platform/wtf/HashSet.h" 58 #include "platform/wtf/HashSet.h"
59 #include "platform/wtf/ListHashSet.h" 59 #include "platform/wtf/ListHashSet.h"
60 #include "platform/wtf/text/WTFString.h" 60 #include "platform/wtf/text/WTFString.h"
61 #include "public/platform/ShapeProperties.h" 61 #include "public/platform/ShapeProperties.h"
62 #include "public/platform/WebDisplayMode.h" 62 #include "public/platform/WebDisplayMode.h"
63 #include "public/platform/WebRect.h" 63 #include "public/platform/WebRect.h"
64 64
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
96 class ScrollingCoordinator; 96 class ScrollingCoordinator;
97 class TracedValue; 97 class TracedValue;
98 class TransformState; 98 class TransformState;
99 struct AnnotatedRegionValue; 99 struct AnnotatedRegionValue;
100 struct CompositedSelection; 100 struct CompositedSelection;
101 101
102 typedef unsigned long long DOMTimeStamp; 102 typedef unsigned long long DOMTimeStamp;
103 103
104 class CORE_EXPORT FrameView final 104 class CORE_EXPORT FrameView final
105 : public FrameViewBase, 105 : public FrameViewBase,
106 public ScrollbarManager,
106 public FrameOrPlugin, 107 public FrameOrPlugin,
107 public PaintInvalidationCapableScrollableArea { 108 public PaintInvalidationCapableScrollableArea {
108 USING_GARBAGE_COLLECTED_MIXIN(FrameView); 109 USING_GARBAGE_COLLECTED_MIXIN(FrameView);
109 110
110 friend class PaintControllerPaintTestBase; 111 friend class PaintControllerPaintTestBase;
111 friend class Internals; 112 friend class Internals;
112 friend class LayoutPart; // for invalidateTreeIfNeeded 113 friend class LayoutPart; // for invalidateTreeIfNeeded
113 114
114 public: 115 public:
115 static FrameView* Create(LocalFrame&); 116 static FrameView* Create(LocalFrame&);
(...skipping 362 matching lines...) Expand 10 before | Expand all | Expand 10 after
478 void RemoveChild(FrameViewBase*); 479 void RemoveChild(FrameViewBase*);
479 void AddChild(FrameViewBase*); 480 void AddChild(FrameViewBase*);
480 const ChildrenSet* Children() const { return &children_; } 481 const ChildrenSet* Children() const { return &children_; }
481 void RemovePlugin(PluginView*); 482 void RemovePlugin(PluginView*);
482 void AddPlugin(PluginView*); 483 void AddPlugin(PluginView*);
483 const PluginsSet* Plugins() const { return &plugins_; } 484 const PluginsSet* Plugins() const { return &plugins_; }
484 void RemoveScrollbar(Scrollbar*); 485 void RemoveScrollbar(Scrollbar*);
485 void AddScrollbar(Scrollbar*); 486 void AddScrollbar(Scrollbar*);
486 const ScrollbarsSet* Scrollbars() const { return &scrollbars_; } 487 const ScrollbarsSet* Scrollbars() const { return &scrollbars_; }
487 488
488 // If the scroll view does not use a native widget, then it will have
489 // cross-platform Scrollbars. These functions can be used to obtain those
490 // scrollbars.
491 Scrollbar* HorizontalScrollbar() const override {
492 return scrollbar_manager_.HorizontalScrollbar();
493 }
494 Scrollbar* VerticalScrollbar() const override {
495 return scrollbar_manager_.VerticalScrollbar();
496 }
497 LayoutScrollbarPart* ScrollCorner() const override { return scroll_corner_; } 489 LayoutScrollbarPart* ScrollCorner() const override { return scroll_corner_; }
498 490
499 void PositionScrollbarLayers(); 491 void PositionScrollbarLayers();
500 492
501 // Functions for setting and retrieving the scrolling mode in each axis 493 // Functions for setting and retrieving the scrolling mode in each axis
502 // (horizontal/vertical). The mode has values of AlwaysOff, AlwaysOn, and 494 // (horizontal/vertical). The mode has values of AlwaysOff, AlwaysOn, and
503 // Auto. AlwaysOff means never show a scrollbar, AlwaysOn means always show a 495 // Auto. AlwaysOff means never show a scrollbar, AlwaysOn means always show a
504 // scrollbar. Auto means show a scrollbar only when one is needed. 496 // scrollbar. Auto means show a scrollbar only when one is needed.
505 // Note that for platforms with native widgets, these modes are considered 497 // Note that for platforms with native widgets, these modes are considered
506 // advisory. In other words the underlying native widget may choose not to 498 // advisory. In other words the underlying native widget may choose not to
(...skipping 28 matching lines...) Expand all
535 527
536 void SetScrollingModesLock(bool lock = true) { 528 void SetScrollingModesLock(bool lock = true) {
537 horizontal_scrollbar_lock_ = vertical_scrollbar_lock_ = lock; 529 horizontal_scrollbar_lock_ = vertical_scrollbar_lock_ = lock;
538 } 530 }
539 531
540 bool CanHaveScrollbars() const { 532 bool CanHaveScrollbars() const {
541 return HorizontalScrollbarMode() != kScrollbarAlwaysOff || 533 return HorizontalScrollbarMode() != kScrollbarAlwaysOff ||
542 VerticalScrollbarMode() != kScrollbarAlwaysOff; 534 VerticalScrollbarMode() != kScrollbarAlwaysOff;
543 } 535 }
544 536
537 void SetHasHorizontalScrollbar(bool) override;
538 void SetHasVerticalScrollbar(bool) override;
539 void DestroyScrollbar(ScrollbarOrientation) override;
540
545 // The visible content rect has a location that is the scrolled offset of 541 // The visible content rect has a location that is the scrolled offset of
546 // the document. The width and height are the layout viewport width and 542 // the document. The width and height are the layout viewport width and
547 // height. By default the scrollbars themselves are excluded from this 543 // height. By default the scrollbars themselves are excluded from this
548 // rectangle, but an optional boolean argument allows them to be included. 544 // rectangle, but an optional boolean argument allows them to be included.
549 IntRect VisibleContentRect( 545 IntRect VisibleContentRect(
550 IncludeScrollbarsInRect = kExcludeScrollbars) const override; 546 IncludeScrollbarsInRect = kExcludeScrollbars) const override;
551 IntSize VisibleContentSize( 547 IntSize VisibleContentSize(
552 IncludeScrollbarsInRect = kExcludeScrollbars) const; 548 IncludeScrollbarsInRect = kExcludeScrollbars) const;
553 549
554 // Clips the provided rect to the visible content area. For this purpose, we 550 // Clips the provided rect to the visible content area. For this purpose, we
(...skipping 313 matching lines...) Expand 10 before | Expand all | Expand 10 after
868 : scope_(&view->in_update_scrollbars_, true) {} 864 : scope_(&view->in_update_scrollbars_, true) {}
869 865
870 private: 866 private:
871 AutoReset<bool> scope_; 867 AutoReset<bool> scope_;
872 }; 868 };
873 869
874 // Only for LayoutPart to traverse into sub frames during paint invalidation. 870 // Only for LayoutPart to traverse into sub frames during paint invalidation.
875 void InvalidateTreeIfNeeded(const PaintInvalidationState&); 871 void InvalidateTreeIfNeeded(const PaintInvalidationState&);
876 872
877 private: 873 private:
878 explicit FrameView(LocalFrame&);
879 class ScrollbarManager : public blink::ScrollbarManager {
880 DISALLOW_NEW();
881
882 // Helper class to manage the life cycle of Scrollbar objects.
883 public:
884 ScrollbarManager(FrameView& scroller) : blink::ScrollbarManager(scroller) {}
885
886 void SetHasHorizontalScrollbar(bool has_scrollbar) override;
887 void SetHasVerticalScrollbar(bool has_scrollbar) override;
888
889 // TODO(ymalik): This should be hidden and all calls should go through
890 // setHas*Scrollbar functions above.
891 Scrollbar* CreateScrollbar(ScrollbarOrientation) override;
892
893 protected:
894 void DestroyScrollbar(ScrollbarOrientation) override;
895 };
896
897 void UpdateScrollOffset(const ScrollOffset&, ScrollType) override; 874 void UpdateScrollOffset(const ScrollOffset&, ScrollType) override;
898 875
899 void UpdateScrollbarEnabledState(); 876 void UpdateScrollbarEnabledState();
900 877
901 void DispatchEventsForPrintingOnAllFrames(); 878 void DispatchEventsForPrintingOnAllFrames();
902 879
903 void SetupPrintContext(); 880 void SetupPrintContext();
904 void ClearPrintContext(); 881 void ClearPrintContext();
905 882
906 void UpdateLifecyclePhasesInternal( 883 void UpdateLifecyclePhasesInternal(
(...skipping 269 matching lines...) Expand 10 before | Expand all | Expand 10 after
1176 1153
1177 // This is set on the local root frame view only. 1154 // This is set on the local root frame view only.
1178 DocumentLifecycle::LifecycleState 1155 DocumentLifecycle::LifecycleState
1179 current_update_lifecycle_phases_target_state_; 1156 current_update_lifecycle_phases_target_state_;
1180 1157
1181 ScrollAnchor scroll_anchor_; 1158 ScrollAnchor scroll_anchor_;
1182 using AnchoringAdjustmentQueue = 1159 using AnchoringAdjustmentQueue =
1183 HeapLinkedHashSet<WeakMember<ScrollableArea>>; 1160 HeapLinkedHashSet<WeakMember<ScrollableArea>>;
1184 AnchoringAdjustmentQueue anchoring_adjustment_queue_; 1161 AnchoringAdjustmentQueue anchoring_adjustment_queue_;
1185 1162
1186 // ScrollbarManager holds the Scrollbar instances.
1187 ScrollbarManager scrollbar_manager_;
1188
1189 bool needs_scrollbars_update_; 1163 bool needs_scrollbars_update_;
1190 bool suppress_adjust_view_size_; 1164 bool suppress_adjust_view_size_;
1191 bool allows_layout_invalidation_after_layout_clean_; 1165 bool allows_layout_invalidation_after_layout_clean_;
1192 1166
1193 Member<ElementVisibilityObserver> visibility_observer_; 1167 Member<ElementVisibilityObserver> visibility_observer_;
1194 1168
1195 IntRect remote_viewport_intersection_; 1169 IntRect remote_viewport_intersection_;
1196 1170
1197 // For testing. 1171 // For testing.
1198 struct ObjectPaintInvalidation { 1172 struct ObjectPaintInvalidation {
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
1249 frameViewBase.IsFrameView()); 1223 frameViewBase.IsFrameView());
1250 DEFINE_TYPE_CASTS(FrameView, 1224 DEFINE_TYPE_CASTS(FrameView,
1251 ScrollableArea, 1225 ScrollableArea,
1252 scrollableArea, 1226 scrollableArea,
1253 scrollableArea->IsFrameView(), 1227 scrollableArea->IsFrameView(),
1254 scrollableArea.IsFrameView()); 1228 scrollableArea.IsFrameView());
1255 1229
1256 } // namespace blink 1230 } // namespace blink
1257 1231
1258 #endif // FrameView_h 1232 #endif // FrameView_h
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/frame/FrameView.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698