OLD | NEW |
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 22 matching lines...) Expand all Loading... |
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" | 42 #include "core/paint/ScrollbarManager.h" |
43 #include "platform/FrameViewBase.h" | |
44 #include "platform/PlatformFrameView.h" | 43 #include "platform/PlatformFrameView.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" |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
97 class TracedValue; | 96 class TracedValue; |
98 class TransformState; | 97 class TransformState; |
99 struct AnnotatedRegionValue; | 98 struct AnnotatedRegionValue; |
100 struct CompositedSelection; | 99 struct CompositedSelection; |
101 | 100 |
102 typedef unsigned long long DOMTimeStamp; | 101 typedef unsigned long long DOMTimeStamp; |
103 | 102 |
104 class CORE_EXPORT FrameView final | 103 class CORE_EXPORT FrameView final |
105 : public GarbageCollectedFinalized<FrameView>, | 104 : public GarbageCollectedFinalized<FrameView>, |
106 public PlatformFrameView, | 105 public PlatformFrameView, |
107 public FrameViewBase, | |
108 public FrameOrPlugin, | 106 public FrameOrPlugin, |
109 public PaintInvalidationCapableScrollableArea { | 107 public PaintInvalidationCapableScrollableArea { |
110 USING_GARBAGE_COLLECTED_MIXIN(FrameView); | 108 USING_GARBAGE_COLLECTED_MIXIN(FrameView); |
111 | 109 |
112 friend class PaintControllerPaintTestBase; | 110 friend class PaintControllerPaintTestBase; |
113 friend class Internals; | 111 friend class Internals; |
114 friend class LayoutPart; // for invalidateTreeIfNeeded | 112 friend class LayoutPart; // for invalidateTreeIfNeeded |
115 | 113 |
116 public: | 114 public: |
117 static FrameView* Create(LocalFrame&); | 115 static FrameView* Create(LocalFrame&); |
118 static FrameView* Create(LocalFrame&, const IntSize& initial_size); | 116 static FrameView* Create(LocalFrame&, const IntSize& initial_size); |
119 | 117 |
120 ~FrameView() override; | 118 ~FrameView() override; |
121 | 119 |
122 void Invalidate() { InvalidateRect(IntRect(0, 0, Width(), Height())); } | 120 void Invalidate() { InvalidateRect(IntRect(0, 0, Width(), Height())); } |
123 void InvalidateRect(const IntRect&); | 121 void InvalidateRect(const IntRect&); |
124 void SetFrameRect(const IntRect&) override; | 122 void SetFrameRect(const IntRect&) override; |
125 const IntRect& FrameRect() const override { return frame_rect_; } | 123 const IntRect& FrameRect() const override { return frame_rect_; } |
126 int X() const { return frame_rect_.X(); } | 124 int X() const { return frame_rect_.X(); } |
127 int Y() const { return frame_rect_.Y(); } | 125 int Y() const { return frame_rect_.Y(); } |
128 int Width() const { return frame_rect_.Width(); } | 126 int Width() const { return frame_rect_.Width(); } |
129 int Height() const { return frame_rect_.Height(); } | 127 int Height() const { return frame_rect_.Height(); } |
130 IntSize Size() const { return frame_rect_.Size(); } | 128 IntSize Size() const { return frame_rect_.Size(); } |
131 IntPoint Location() const override { return frame_rect_.Location(); } | 129 IntPoint Location() const { return frame_rect_.Location(); } |
132 void Resize(int width, int height) { | 130 void Resize(int width, int height) { |
133 SetFrameRect(IntRect(frame_rect_.X(), frame_rect_.Y(), width, height)); | 131 SetFrameRect(IntRect(frame_rect_.X(), frame_rect_.Y(), width, height)); |
134 } | 132 } |
135 void Resize(const IntSize& size) { SetFrameRect(IntRect(Location(), size)); } | 133 void Resize(const IntSize& size) { SetFrameRect(IntRect(Location(), size)); } |
136 | 134 |
137 LocalFrame& GetFrame() const { | 135 LocalFrame& GetFrame() const { |
138 DCHECK(frame_); | 136 DCHECK(frame_); |
139 return *frame_; | 137 return *frame_; |
140 } | 138 } |
141 | 139 |
(...skipping 332 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
474 | 472 |
475 LayoutRect ScrollIntoView(const LayoutRect& rect_in_content, | 473 LayoutRect ScrollIntoView(const LayoutRect& rect_in_content, |
476 const ScrollAlignment& align_x, | 474 const ScrollAlignment& align_x, |
477 const ScrollAlignment& align_y, | 475 const ScrollAlignment& align_y, |
478 ScrollType = kProgrammaticScroll) override; | 476 ScrollType = kProgrammaticScroll) override; |
479 | 477 |
480 // The window that hosts the FrameView. The FrameView will communicate scrolls | 478 // The window that hosts the FrameView. The FrameView will communicate scrolls |
481 // and repaints to the host window in the window's coordinate space. | 479 // and repaints to the host window in the window's coordinate space. |
482 PlatformChromeClient* GetChromeClient() const; | 480 PlatformChromeClient* GetChromeClient() const; |
483 | 481 |
484 typedef HeapHashSet<Member<FrameOrPlugin>> ChildrenSet; | |
485 typedef HeapHashSet<Member<Scrollbar>> ScrollbarsSet; | |
486 | |
487 // Functions for child manipulation and inspection. | 482 // Functions for child manipulation and inspection. |
488 bool IsSelfVisible() const { | 483 bool IsSelfVisible() const { |
489 return self_visible_; | 484 return self_visible_; |
490 } // Whether or not we have been explicitly marked as visible or not. | 485 } // Whether or not we have been explicitly marked as visible or not. |
491 bool IsParentVisible() const { | 486 bool IsParentVisible() const { |
492 return parent_visible_; | 487 return parent_visible_; |
493 } // Whether or not our parent is visible. | 488 } // Whether or not our parent is visible. |
494 bool IsVisible() const { | 489 bool IsVisible() const { |
495 return self_visible_ && parent_visible_; | 490 return self_visible_ && parent_visible_; |
496 } // Whether or not we are actually visible. | 491 } // Whether or not we are actually visible. |
497 void SetParentVisible(bool) override; | 492 void SetParentVisible(bool) override; |
498 void SetSelfVisible(bool v) { self_visible_ = v; } | 493 void SetSelfVisible(bool v) { self_visible_ = v; } |
499 void SetParent(FrameView*) override; | 494 void SetParent(FrameView*) override; |
500 FrameView* Parent() const override { return parent_; } | 495 FrameView* Parent() const override { return parent_; } |
501 void RemoveChild(FrameOrPlugin*); | 496 void RemoveChild(FrameOrPlugin*); |
502 void AddChild(FrameOrPlugin*); | 497 void AddChild(FrameOrPlugin*); |
| 498 using ChildrenSet = HeapHashSet<Member<FrameOrPlugin>>; |
503 const ChildrenSet& Children() const { return children_; } | 499 const ChildrenSet& Children() const { return children_; } |
| 500 // Custom scrollbars in PaintLayerScrollableArea need to be called with |
| 501 // StyleChanged whenever window focus is changed. |
504 void RemoveScrollbar(Scrollbar*); | 502 void RemoveScrollbar(Scrollbar*); |
505 void AddScrollbar(Scrollbar*); | 503 void AddScrollbar(Scrollbar*); |
506 const ScrollbarsSet* Scrollbars() const { return &scrollbars_; } | |
507 | 504 |
508 // If the scroll view does not use a native widget, then it will have | 505 // If the scroll view does not use a native widget, then it will have |
509 // cross-platform Scrollbars. These functions can be used to obtain those | 506 // cross-platform Scrollbars. These functions can be used to obtain those |
510 // scrollbars. | 507 // scrollbars. |
511 Scrollbar* HorizontalScrollbar() const override { | 508 Scrollbar* HorizontalScrollbar() const override { |
512 return scrollbar_manager_.HorizontalScrollbar(); | 509 return scrollbar_manager_.HorizontalScrollbar(); |
513 } | 510 } |
514 Scrollbar* VerticalScrollbar() const override { | 511 Scrollbar* VerticalScrollbar() const override { |
515 return scrollbar_manager_.VerticalScrollbar(); | 512 return scrollbar_manager_.VerticalScrollbar(); |
516 } | 513 } |
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
643 | 640 |
644 // Functions for converting to screen coordinates. | 641 // Functions for converting to screen coordinates. |
645 IntRect ContentsToScreen(const IntRect&) const; | 642 IntRect ContentsToScreen(const IntRect&) const; |
646 | 643 |
647 // For platforms that need to hit test scrollbars from within the engine's | 644 // For platforms that need to hit test scrollbars from within the engine's |
648 // event handlers (like Win32). | 645 // event handlers (like Win32). |
649 Scrollbar* ScrollbarAtFramePoint(const IntPoint&); | 646 Scrollbar* ScrollbarAtFramePoint(const IntPoint&); |
650 | 647 |
651 IntRect ConvertToRootFrame(const IntRect&) const; | 648 IntRect ConvertToRootFrame(const IntRect&) const; |
652 IntPoint ConvertToRootFrame(const IntPoint&) const; | 649 IntPoint ConvertToRootFrame(const IntPoint&) const; |
| 650 IntRect ConvertFromRootFrame(const IntRect&) const; |
| 651 IntPoint ConvertFromRootFrame(const IntPoint&) const override; |
| 652 FloatPoint ConvertFromRootFrame(const FloatPoint&) const; |
653 IntPoint ConvertSelfToChild(const FrameOrPlugin&, const IntPoint&) const; | 653 IntPoint ConvertSelfToChild(const FrameOrPlugin&, const IntPoint&) const; |
654 | 654 |
655 // Handles painting of the contents of the view as well as the scrollbars. | 655 // Handles painting of the contents of the view as well as the scrollbars. |
656 void Paint(GraphicsContext&, const CullRect&) const override; | 656 void Paint(GraphicsContext&, const CullRect&) const override; |
657 void Paint(GraphicsContext&, const GlobalPaintFlags, const CullRect&) const; | 657 void Paint(GraphicsContext&, const GlobalPaintFlags, const CullRect&) const; |
658 void PaintContents(GraphicsContext&, | 658 void PaintContents(GraphicsContext&, |
659 const GlobalPaintFlags, | 659 const GlobalPaintFlags, |
660 const IntRect& damage_rect) const; | 660 const IntRect& damage_rect) const; |
661 | 661 |
662 void Show() override; | 662 void Show() override; |
(...skipping 475 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1138 bool has_been_disposed_ = false; | 1138 bool has_been_disposed_ = false; |
1139 #endif | 1139 #endif |
1140 | 1140 |
1141 ScrollbarMode horizontal_scrollbar_mode_; | 1141 ScrollbarMode horizontal_scrollbar_mode_; |
1142 ScrollbarMode vertical_scrollbar_mode_; | 1142 ScrollbarMode vertical_scrollbar_mode_; |
1143 | 1143 |
1144 bool horizontal_scrollbar_lock_; | 1144 bool horizontal_scrollbar_lock_; |
1145 bool vertical_scrollbar_lock_; | 1145 bool vertical_scrollbar_lock_; |
1146 | 1146 |
1147 ChildrenSet children_; | 1147 ChildrenSet children_; |
1148 ScrollbarsSet scrollbars_; | 1148 HeapHashSet<Member<Scrollbar>> scrollbars_; |
1149 | 1149 |
1150 ScrollOffset pending_scroll_delta_; | 1150 ScrollOffset pending_scroll_delta_; |
1151 ScrollOffset scroll_offset_; | 1151 ScrollOffset scroll_offset_; |
1152 IntSize contents_size_; | 1152 IntSize contents_size_; |
1153 | 1153 |
1154 bool scrollbars_suppressed_; | 1154 bool scrollbars_suppressed_; |
1155 | 1155 |
1156 bool in_update_scrollbars_; | 1156 bool in_update_scrollbars_; |
1157 | 1157 |
1158 std::unique_ptr<LayoutAnalyzer> analyzer_; | 1158 std::unique_ptr<LayoutAnalyzer> analyzer_; |
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1261 if (visually_non_empty_pixel_count_ > kVisualPixelThreshold) | 1261 if (visually_non_empty_pixel_count_ > kVisualPixelThreshold) |
1262 SetIsVisuallyNonEmpty(); | 1262 SetIsVisuallyNonEmpty(); |
1263 } | 1263 } |
1264 | 1264 |
1265 DEFINE_TYPE_CASTS(FrameView, | 1265 DEFINE_TYPE_CASTS(FrameView, |
1266 PlatformFrameView, | 1266 PlatformFrameView, |
1267 platform_frame_view, | 1267 platform_frame_view, |
1268 platform_frame_view->IsFrameView(), | 1268 platform_frame_view->IsFrameView(), |
1269 platform_frame_view.IsFrameView()); | 1269 platform_frame_view.IsFrameView()); |
1270 DEFINE_TYPE_CASTS(FrameView, | 1270 DEFINE_TYPE_CASTS(FrameView, |
1271 FrameViewBase, | |
1272 frameViewBase, | |
1273 frameViewBase->IsFrameView(), | |
1274 frameViewBase.IsFrameView()); | |
1275 DEFINE_TYPE_CASTS(FrameView, | |
1276 FrameOrPlugin, | 1271 FrameOrPlugin, |
1277 frame_or_plugin, | 1272 frame_or_plugin, |
1278 frame_or_plugin->IsFrameView(), | 1273 frame_or_plugin->IsFrameView(), |
1279 frame_or_plugin.IsFrameView()); | 1274 frame_or_plugin.IsFrameView()); |
1280 DEFINE_TYPE_CASTS(FrameView, | 1275 DEFINE_TYPE_CASTS(FrameView, |
1281 ScrollableArea, | 1276 ScrollableArea, |
1282 scrollableArea, | 1277 scrollableArea, |
1283 scrollableArea->IsFrameView(), | 1278 scrollableArea->IsFrameView(), |
1284 scrollableArea.IsFrameView()); | 1279 scrollableArea.IsFrameView()); |
1285 | 1280 |
1286 } // namespace blink | 1281 } // namespace blink |
1287 | 1282 |
1288 #endif // FrameView_h | 1283 #endif // FrameView_h |
OLD | NEW |