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/RuntimeEnabledFeatures.h" | 43 #include "platform/RuntimeEnabledFeatures.h" |
45 #include "platform/animation/CompositorAnimationHost.h" | 44 #include "platform/animation/CompositorAnimationHost.h" |
46 #include "platform/animation/CompositorAnimationTimeline.h" | 45 #include "platform/animation/CompositorAnimationTimeline.h" |
47 #include "platform/geometry/IntRect.h" | 46 #include "platform/geometry/IntRect.h" |
48 #include "platform/geometry/LayoutRect.h" | 47 #include "platform/geometry/LayoutRect.h" |
49 #include "platform/graphics/Color.h" | 48 #include "platform/graphics/Color.h" |
50 #include "platform/graphics/CompositorElementId.h" | 49 #include "platform/graphics/CompositorElementId.h" |
51 #include "platform/graphics/GraphicsLayerClient.h" | 50 #include "platform/graphics/GraphicsLayerClient.h" |
52 #include "platform/scroll/ScrollTypes.h" | 51 #include "platform/scroll/ScrollTypes.h" |
53 #include "platform/scroll/Scrollbar.h" | 52 #include "platform/scroll/Scrollbar.h" |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
95 class ScrollingCoordinator; | 94 class ScrollingCoordinator; |
96 class TracedValue; | 95 class TracedValue; |
97 class TransformState; | 96 class TransformState; |
98 struct AnnotatedRegionValue; | 97 struct AnnotatedRegionValue; |
99 struct CompositedSelection; | 98 struct CompositedSelection; |
100 | 99 |
101 typedef unsigned long long DOMTimeStamp; | 100 typedef unsigned long long DOMTimeStamp; |
102 | 101 |
103 class CORE_EXPORT FrameView final | 102 class CORE_EXPORT FrameView final |
104 : public GarbageCollectedFinalized<FrameView>, | 103 : public GarbageCollectedFinalized<FrameView>, |
105 public FrameViewBase, | |
106 public FrameOrPlugin, | 104 public FrameOrPlugin, |
107 public PaintInvalidationCapableScrollableArea { | 105 public PaintInvalidationCapableScrollableArea { |
108 USING_GARBAGE_COLLECTED_MIXIN(FrameView); | 106 USING_GARBAGE_COLLECTED_MIXIN(FrameView); |
109 | 107 |
110 friend class PaintControllerPaintTestBase; | 108 friend class PaintControllerPaintTestBase; |
111 friend class Internals; | 109 friend class Internals; |
112 friend class LayoutPart; // for invalidateTreeIfNeeded | 110 friend class LayoutPart; // for invalidateTreeIfNeeded |
113 | 111 |
114 public: | 112 public: |
115 static FrameView* Create(LocalFrame&); | 113 static FrameView* Create(LocalFrame&); |
116 static FrameView* Create(LocalFrame&, const IntSize& initial_size); | 114 static FrameView* Create(LocalFrame&, const IntSize& initial_size); |
117 | 115 |
118 ~FrameView() override; | 116 ~FrameView() override; |
119 | 117 |
120 void Invalidate() { InvalidateRect(IntRect(0, 0, Width(), Height())); } | 118 void Invalidate() { InvalidateRect(IntRect(0, 0, Width(), Height())); } |
121 void InvalidateRect(const IntRect&); | 119 void InvalidateRect(const IntRect&); |
122 void SetFrameRect(const IntRect&) override; | 120 void SetFrameRect(const IntRect&) override; |
123 const IntRect& FrameRect() const override { return frame_rect_; } | 121 const IntRect& FrameRect() const override { return frame_rect_; } |
124 int X() const { return frame_rect_.X(); } | 122 int X() const { return frame_rect_.X(); } |
125 int Y() const { return frame_rect_.Y(); } | 123 int Y() const { return frame_rect_.Y(); } |
126 int Width() const { return frame_rect_.Width(); } | 124 int Width() const { return frame_rect_.Width(); } |
127 int Height() const { return frame_rect_.Height(); } | 125 int Height() const { return frame_rect_.Height(); } |
128 IntSize Size() const { return frame_rect_.Size(); } | 126 IntSize Size() const { return frame_rect_.Size(); } |
129 IntPoint Location() const override { return frame_rect_.Location(); } | 127 IntPoint Location() const { return frame_rect_.Location(); } |
130 void Resize(int width, int height) { | 128 void Resize(int width, int height) { |
131 SetFrameRect(IntRect(frame_rect_.X(), frame_rect_.Y(), width, height)); | 129 SetFrameRect(IntRect(frame_rect_.X(), frame_rect_.Y(), width, height)); |
132 } | 130 } |
133 void Resize(const IntSize& size) { SetFrameRect(IntRect(Location(), size)); } | 131 void Resize(const IntSize& size) { SetFrameRect(IntRect(Location(), size)); } |
134 | 132 |
135 LocalFrame& GetFrame() const { | 133 LocalFrame& GetFrame() const { |
136 ASSERT(frame_); | 134 ASSERT(frame_); |
137 return *frame_; | 135 return *frame_; |
138 } | 136 } |
139 | 137 |
(...skipping 332 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
472 | 470 |
473 LayoutRect ScrollIntoView(const LayoutRect& rect_in_content, | 471 LayoutRect ScrollIntoView(const LayoutRect& rect_in_content, |
474 const ScrollAlignment& align_x, | 472 const ScrollAlignment& align_x, |
475 const ScrollAlignment& align_y, | 473 const ScrollAlignment& align_y, |
476 ScrollType = kProgrammaticScroll) override; | 474 ScrollType = kProgrammaticScroll) override; |
477 | 475 |
478 // The window that hosts the FrameView. The FrameView will communicate scrolls | 476 // The window that hosts the FrameView. The FrameView will communicate scrolls |
479 // and repaints to the host window in the window's coordinate space. | 477 // and repaints to the host window in the window's coordinate space. |
480 PlatformChromeClient* GetChromeClient() const; | 478 PlatformChromeClient* GetChromeClient() const; |
481 | 479 |
482 typedef HeapHashSet<Member<FrameOrPlugin>> ChildrenSet; | |
483 typedef HeapHashSet<Member<Scrollbar>> ScrollbarsSet; | |
484 | |
485 // Functions for child manipulation and inspection. | 480 // Functions for child manipulation and inspection. |
486 bool IsSelfVisible() const { | 481 bool IsSelfVisible() const { |
487 return self_visible_; | 482 return self_visible_; |
488 } // Whether or not we have been explicitly marked as visible or not. | 483 } // Whether or not we have been explicitly marked as visible or not. |
489 bool IsParentVisible() const { | 484 bool IsParentVisible() const { |
490 return parent_visible_; | 485 return parent_visible_; |
491 } // Whether or not our parent is visible. | 486 } // Whether or not our parent is visible. |
492 bool IsVisible() const { | 487 bool IsVisible() const { |
493 return self_visible_ && parent_visible_; | 488 return self_visible_ && parent_visible_; |
494 } // Whether or not we are actually visible. | 489 } // Whether or not we are actually visible. |
495 void SetParentVisible(bool) override; | 490 void SetParentVisible(bool) override; |
496 void SetSelfVisible(bool v) { self_visible_ = v; } | 491 void SetSelfVisible(bool v) { self_visible_ = v; } |
497 void SetParent(FrameView*) override; | 492 void SetParent(FrameView*) override; |
498 FrameView* Parent() const override { return parent_; } | 493 FrameView* Parent() const override { return parent_; } |
499 FrameView* Root() const; | 494 FrameView* Root() const; |
500 void RemoveChild(FrameOrPlugin*); | 495 void RemoveChild(FrameOrPlugin*); |
501 void AddChild(FrameOrPlugin*); | 496 void AddChild(FrameOrPlugin*); |
497 typedef HeapHashSet<Member<FrameOrPlugin>> ChildrenSet; | |
502 const ChildrenSet& Children() const { return children_; } | 498 const ChildrenSet& Children() const { return children_; } |
503 void RemoveScrollbar(Scrollbar*); | 499 // Custom PaintLayer scrollbars need to be called with StyleChanged |
504 void AddScrollbar(Scrollbar*); | 500 // whenever window focus is changed. |
505 const ScrollbarsSet& Scrollbars() const { return scrollbars_; } | 501 void RemovePaintScrollbar(Scrollbar*); |
dcheng
2017/05/09 08:05:55
Is the term "PaintScrollbar" used elsewhere in Chr
joelhockey
2017/05/10 04:17:13
No, I don't believe PaintScrollbar is used elsewhe
dcheng
2017/05/10 07:27:00
Unless I'm missing something, I think the original
| |
502 void AddPaintScrollbar(Scrollbar*); | |
506 | 503 |
507 // If the scroll view does not use a native widget, then it will have | 504 // If the scroll view does not use a native widget, then it will have |
508 // cross-platform Scrollbars. These functions can be used to obtain those | 505 // cross-platform Scrollbars. These functions can be used to obtain those |
509 // scrollbars. | 506 // scrollbars. |
510 Scrollbar* HorizontalScrollbar() const override { | 507 Scrollbar* HorizontalScrollbar() const override { |
511 return scrollbar_manager_.HorizontalScrollbar(); | 508 return scrollbar_manager_.HorizontalScrollbar(); |
512 } | 509 } |
513 Scrollbar* VerticalScrollbar() const override { | 510 Scrollbar* VerticalScrollbar() const override { |
514 return scrollbar_manager_.VerticalScrollbar(); | 511 return scrollbar_manager_.VerticalScrollbar(); |
515 } | 512 } |
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
642 | 639 |
643 // Functions for converting to screen coordinates. | 640 // Functions for converting to screen coordinates. |
644 IntRect ContentsToScreen(const IntRect&) const; | 641 IntRect ContentsToScreen(const IntRect&) const; |
645 | 642 |
646 // For platforms that need to hit test scrollbars from within the engine's | 643 // For platforms that need to hit test scrollbars from within the engine's |
647 // event handlers (like Win32). | 644 // event handlers (like Win32). |
648 Scrollbar* ScrollbarAtFramePoint(const IntPoint&); | 645 Scrollbar* ScrollbarAtFramePoint(const IntPoint&); |
649 | 646 |
650 IntRect ConvertToRootFrame(const IntRect&) const; | 647 IntRect ConvertToRootFrame(const IntRect&) const; |
651 IntPoint ConvertToRootFrame(const IntPoint&) const; | 648 IntPoint ConvertToRootFrame(const IntPoint&) const; |
649 IntRect ConvertFromRootFrame(const IntRect&) const; | |
650 IntPoint ConvertFromRootFrame(const IntPoint&) const override; | |
651 FloatPoint ConvertFromRootFrame(const FloatPoint&) const; | |
652 IntPoint ConvertSelfToChild(const IntPoint&, const IntPoint&) const; | 652 IntPoint ConvertSelfToChild(const IntPoint&, const IntPoint&) const; |
653 | 653 |
654 // Handles painting of the contents of the view as well as the scrollbars. | 654 // Handles painting of the contents of the view as well as the scrollbars. |
655 void Paint(GraphicsContext&, const CullRect&) const override; | 655 void Paint(GraphicsContext&, const CullRect&) const override; |
656 void Paint(GraphicsContext&, const GlobalPaintFlags, const CullRect&) const; | 656 void Paint(GraphicsContext&, const GlobalPaintFlags, const CullRect&) const; |
657 void PaintContents(GraphicsContext&, | 657 void PaintContents(GraphicsContext&, |
658 const GlobalPaintFlags, | 658 const GlobalPaintFlags, |
659 const IntRect& damage_rect) const; | 659 const IntRect& damage_rect) const; |
660 | 660 |
661 void Show() override; | 661 void Show() override; |
(...skipping 475 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1137 bool has_been_disposed_ = false; | 1137 bool has_been_disposed_ = false; |
1138 #endif | 1138 #endif |
1139 | 1139 |
1140 ScrollbarMode horizontal_scrollbar_mode_; | 1140 ScrollbarMode horizontal_scrollbar_mode_; |
1141 ScrollbarMode vertical_scrollbar_mode_; | 1141 ScrollbarMode vertical_scrollbar_mode_; |
1142 | 1142 |
1143 bool horizontal_scrollbar_lock_; | 1143 bool horizontal_scrollbar_lock_; |
1144 bool vertical_scrollbar_lock_; | 1144 bool vertical_scrollbar_lock_; |
1145 | 1145 |
1146 ChildrenSet children_; | 1146 ChildrenSet children_; |
1147 ScrollbarsSet scrollbars_; | 1147 HeapHashSet<Member<Scrollbar>> paint_scrollbars_; |
1148 | 1148 |
1149 ScrollOffset pending_scroll_delta_; | 1149 ScrollOffset pending_scroll_delta_; |
1150 ScrollOffset scroll_offset_; | 1150 ScrollOffset scroll_offset_; |
1151 IntSize contents_size_; | 1151 IntSize contents_size_; |
1152 | 1152 |
1153 bool scrollbars_suppressed_; | 1153 bool scrollbars_suppressed_; |
1154 | 1154 |
1155 bool in_update_scrollbars_; | 1155 bool in_update_scrollbars_; |
1156 | 1156 |
1157 std::unique_ptr<LayoutAnalyzer> analyzer_; | 1157 std::unique_ptr<LayoutAnalyzer> analyzer_; |
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1255 return; | 1255 return; |
1256 visually_non_empty_pixel_count_ += size.Area(); | 1256 visually_non_empty_pixel_count_ += size.Area(); |
1257 // Use a threshold value to prevent very small amounts of visible content from | 1257 // Use a threshold value to prevent very small amounts of visible content from |
1258 // triggering didMeaningfulLayout. | 1258 // triggering didMeaningfulLayout. |
1259 static const unsigned kVisualPixelThreshold = 32 * 32; | 1259 static const unsigned kVisualPixelThreshold = 32 * 32; |
1260 if (visually_non_empty_pixel_count_ > kVisualPixelThreshold) | 1260 if (visually_non_empty_pixel_count_ > kVisualPixelThreshold) |
1261 SetIsVisuallyNonEmpty(); | 1261 SetIsVisuallyNonEmpty(); |
1262 } | 1262 } |
1263 | 1263 |
1264 DEFINE_TYPE_CASTS(FrameView, | 1264 DEFINE_TYPE_CASTS(FrameView, |
1265 FrameViewBase, | |
1266 frameViewBase, | |
1267 frameViewBase->IsFrameView(), | |
1268 frameViewBase.IsFrameView()); | |
1269 DEFINE_TYPE_CASTS(FrameView, | |
1270 FrameOrPlugin, | 1265 FrameOrPlugin, |
1271 frame_or_plugin, | 1266 frame_or_plugin, |
1272 frame_or_plugin->IsFrameView(), | 1267 frame_or_plugin->IsFrameView(), |
1273 frame_or_plugin.IsFrameView()); | 1268 frame_or_plugin.IsFrameView()); |
1274 DEFINE_TYPE_CASTS(FrameView, | 1269 DEFINE_TYPE_CASTS(FrameView, |
1275 ScrollableArea, | 1270 ScrollableArea, |
1276 scrollable_area, | 1271 scrollable_area, |
1277 scrollable_area->IsFrameView(), | 1272 scrollable_area->IsFrameView(), |
1278 scrollable_area.IsFrameView()); | 1273 scrollable_area.IsFrameView()); |
1279 | 1274 |
1280 } // namespace blink | 1275 } // namespace blink |
1281 | 1276 |
1282 #endif // FrameView_h | 1277 #endif // FrameView_h |
OLD | NEW |