Chromium Code Reviews| 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 reserv ed. | 7 Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserv ed. |
| 8 | 8 |
| 9 This library is free software; you can redistribute it and/or | 9 This library is free software; you can redistribute it and/or |
| 10 modify it under the terms of the GNU Library General Public | 10 modify it under the terms of the GNU Library General Public |
| 11 License as published by the Free Software Foundation; either | 11 License as published by the Free Software Foundation; either |
| 12 version 2 of the License, or (at your option) any later version. | 12 version 2 of the License, or (at your option) any later version. |
| 13 | 13 |
| 14 This library is distributed in the hope that it will be useful, | 14 This library is distributed in the hope that it will be useful, |
| 15 but WITHOUT ANY WARRANTY; without even the implied warranty of | 15 but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 17 Library General Public License for more details. | 17 Library General Public License for more details. |
| 18 | 18 |
| 19 You should have received a copy of the GNU Library General Public License | 19 You should have received a copy of the GNU Library General Public License |
| 20 along with this library; see the file COPYING.LIB. If not, write to | 20 along with this library; see the file COPYING.LIB. If not, write to |
| 21 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | 21 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
| 22 Boston, MA 02110-1301, USA. | 22 Boston, MA 02110-1301, USA. |
| 23 */ | 23 */ |
| 24 | 24 |
| 25 #ifndef FrameView_h | 25 #ifndef FrameView_h |
| 26 #define FrameView_h | 26 #define FrameView_h |
| 27 | 27 |
| 28 #include "core/CoreExport.h" | 28 #include "core/CoreExport.h" |
| 29 #include "core/dom/DocumentLifecycle.h" | 29 #include "core/dom/DocumentLifecycle.h" |
| 30 #include "core/dom/IntersectionObserverCallback.h" | |
| 30 #include "core/frame/FrameViewAutoSizeInfo.h" | 31 #include "core/frame/FrameViewAutoSizeInfo.h" |
| 31 #include "core/frame/LayoutSubtreeRootList.h" | 32 #include "core/frame/LayoutSubtreeRootList.h" |
| 32 #include "core/frame/RootFrameViewport.h" | 33 #include "core/frame/RootFrameViewport.h" |
| 33 #include "core/layout/ScrollAnchor.h" | 34 #include "core/layout/ScrollAnchor.h" |
| 34 #include "core/layout/api/LayoutViewItem.h" | 35 #include "core/layout/api/LayoutViewItem.h" |
| 35 #include "core/paint/FirstMeaningfulPaintDetector.h" | 36 #include "core/paint/FirstMeaningfulPaintDetector.h" |
| 36 #include "core/paint/PaintInvalidationCapableScrollableArea.h" | 37 #include "core/paint/PaintInvalidationCapableScrollableArea.h" |
| 37 #include "core/paint/PaintPhase.h" | 38 #include "core/paint/PaintPhase.h" |
| 38 #include "platform/RuntimeEnabledFeatures.h" | 39 #include "platform/RuntimeEnabledFeatures.h" |
| 39 #include "platform/Widget.h" | 40 #include "platform/Widget.h" |
| (...skipping 544 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 584 | 585 |
| 585 LayoutAnalyzer* layoutAnalyzer() { return m_analyzer.get(); } | 586 LayoutAnalyzer* layoutAnalyzer() { return m_analyzer.get(); } |
| 586 | 587 |
| 587 // Returns true if this frame should not render or schedule visual updates. | 588 // Returns true if this frame should not render or schedule visual updates. |
| 588 bool shouldThrottleRendering() const; | 589 bool shouldThrottleRendering() const; |
| 589 | 590 |
| 590 // Returns true if this frame could potentially skip rendering and avoid | 591 // Returns true if this frame could potentially skip rendering and avoid |
| 591 // scheduling visual updates. | 592 // scheduling visual updates. |
| 592 bool canThrottleRendering() const; | 593 bool canThrottleRendering() const; |
| 593 bool isHiddenForThrottling() const { return m_hiddenForThrottling; } | 594 bool isHiddenForThrottling() const { return m_hiddenForThrottling; } |
| 595 void setupRenderThrottling(); | |
| 594 | 596 |
| 595 // For testing, run pending intersection observer notifications for this fra me. | 597 // For testing, run pending intersection observer notifications for this fra me. |
| 596 void notifyRenderThrottlingObserversForTesting(); | 598 void updateRenderThrottlingStatusForTesting(); |
| 597 | 599 |
| 598 // Paint properties for SPv2 Only. | 600 // Paint properties for SPv2 Only. |
| 599 void setPreTranslation(PassRefPtr<TransformPaintPropertyNode> preTranslation ) { m_preTranslation = preTranslation; } | 601 void setPreTranslation(PassRefPtr<TransformPaintPropertyNode> preTranslation ) { m_preTranslation = preTranslation; } |
| 600 TransformPaintPropertyNode* preTranslation() const { return m_preTranslation .get(); } | 602 TransformPaintPropertyNode* preTranslation() const { return m_preTranslation .get(); } |
| 601 | 603 |
| 602 void setScrollTranslation(PassRefPtr<TransformPaintPropertyNode> scrollTrans lation) { m_scrollTranslation = scrollTranslation; } | 604 void setScrollTranslation(PassRefPtr<TransformPaintPropertyNode> scrollTrans lation) { m_scrollTranslation = scrollTranslation; } |
| 603 TransformPaintPropertyNode* scrollTranslation() const { return m_scrollTrans lation.get(); } | 605 TransformPaintPropertyNode* scrollTranslation() const { return m_scrollTrans lation.get(); } |
| 604 | 606 |
| 605 void setContentClip(PassRefPtr<ClipPaintPropertyNode> contentClip) { m_conte ntClip = contentClip; } | 607 void setContentClip(PassRefPtr<ClipPaintPropertyNode> contentClip) { m_conte ntClip = contentClip; } |
| 606 ClipPaintPropertyNode* contentClip() const { return m_contentClip.get(); } | 608 ClipPaintPropertyNode* contentClip() const { return m_contentClip.get(); } |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 661 : m_scope(&view->m_inUpdateScrollbars, true) | 663 : m_scope(&view->m_inUpdateScrollbars, true) |
| 662 { } | 664 { } |
| 663 private: | 665 private: |
| 664 AutoReset<bool> m_scope; | 666 AutoReset<bool> m_scope; |
| 665 }; | 667 }; |
| 666 | 668 |
| 667 // Only for LayoutPart to traverse into sub frames during paint invalidation . | 669 // Only for LayoutPart to traverse into sub frames during paint invalidation . |
| 668 void invalidateTreeIfNeeded(const PaintInvalidationState&); | 670 void invalidateTreeIfNeeded(const PaintInvalidationState&); |
| 669 | 671 |
| 670 private: | 672 private: |
| 673 class IntersectionObserverCallback : public blink::IntersectionObserverCallb ack { | |
| 674 public: | |
| 675 IntersectionObserverCallback(FrameView*); | |
| 676 | |
| 677 // IntersectionObserverCallback implementation: | |
| 678 void handleEvent(const HeapVector<Member<IntersectionObserverEntry>>&, I ntersectionObserver&) override; | |
| 679 ExecutionContext* getExecutionContext() const override; | |
| 680 | |
| 681 DECLARE_TRACE(); | |
| 682 | |
| 683 private: | |
| 684 Member<FrameView> m_frameView; | |
|
szager1
2016/08/30 23:57:12
I think this should be WeakMember, to avoid a refe
Sami
2016/08/31 11:08:56
I guess I was thinking that with Oilpan in-heap re
| |
| 685 }; | |
| 686 | |
| 671 explicit FrameView(LocalFrame*); | 687 explicit FrameView(LocalFrame*); |
| 672 | 688 |
| 673 void setScrollOffset(const DoublePoint&, ScrollType) override; | 689 void setScrollOffset(const DoublePoint&, ScrollType) override; |
| 674 | 690 |
| 675 void updateLifecyclePhasesInternal(DocumentLifecycle::LifecycleState targetS tate); | 691 void updateLifecyclePhasesInternal(DocumentLifecycle::LifecycleState targetS tate); |
| 676 | 692 |
| 677 void invalidateTreeIfNeededRecursive(); | 693 void invalidateTreeIfNeededRecursive(); |
| 678 void scrollContentsIfNeededRecursive(); | 694 void scrollContentsIfNeededRecursive(); |
| 679 void updateStyleAndLayoutIfNeededRecursive(); | 695 void updateStyleAndLayoutIfNeededRecursive(); |
| 680 void updatePaintProperties(); | 696 void updatePaintProperties(); |
| (...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 771 | 787 |
| 772 // LayoutObject for the viewport-defining element (see Document::viewportDef iningElement). | 788 // LayoutObject for the viewport-defining element (see Document::viewportDef iningElement). |
| 773 LayoutObject* viewportLayoutObject() const; | 789 LayoutObject* viewportLayoutObject() const; |
| 774 | 790 |
| 775 void collectAnnotatedRegions(LayoutObject&, Vector<AnnotatedRegionValue>&) c onst; | 791 void collectAnnotatedRegions(LayoutObject&, Vector<AnnotatedRegionValue>&) c onst; |
| 776 | 792 |
| 777 template <typename Function> void forAllNonThrottledFrameViews(const Functio n&); | 793 template <typename Function> void forAllNonThrottledFrameViews(const Functio n&); |
| 778 | 794 |
| 779 void setNeedsUpdateViewportIntersection(); | 795 void setNeedsUpdateViewportIntersection(); |
| 780 void updateViewportIntersectionsForSubtree(DocumentLifecycle::LifecycleState targetState); | 796 void updateViewportIntersectionsForSubtree(DocumentLifecycle::LifecycleState targetState); |
| 781 void updateViewportIntersectionIfNeeded(); | 797 void updateRenderThrottlingStatus(bool hidden, bool subtreeThrottled); |
| 782 void notifyRenderThrottlingObservers(); | |
| 783 void updateThrottlingStatus(); | |
| 784 void notifyResizeObservers(); | 798 void notifyResizeObservers(); |
| 785 | 799 |
| 786 // PaintInvalidationCapableScrollableArea | 800 // PaintInvalidationCapableScrollableArea |
| 787 LayoutScrollbarPart* resizer() const override { return nullptr; } | 801 LayoutScrollbarPart* resizer() const override { return nullptr; } |
| 788 | 802 |
| 789 bool checkLayoutInvalidationIsAllowed() const; | 803 bool checkLayoutInvalidationIsAllowed() const; |
| 790 | 804 |
| 791 LayoutSize m_size; | 805 LayoutSize m_size; |
| 792 | 806 |
| 793 typedef HashSet<RefPtr<LayoutEmbeddedObject>> EmbeddedObjectSet; | 807 typedef HashSet<RefPtr<LayoutEmbeddedObject>> EmbeddedObjectSet; |
| (...skipping 18 matching lines...) Expand all Loading... | |
| 812 bool m_hasPendingLayout; | 826 bool m_hasPendingLayout; |
| 813 LayoutSubtreeRootList m_layoutSubtreeRootList; | 827 LayoutSubtreeRootList m_layoutSubtreeRootList; |
| 814 DepthOrderedLayoutObjectList m_orthogonalWritingModeRootList; | 828 DepthOrderedLayoutObjectList m_orthogonalWritingModeRootList; |
| 815 | 829 |
| 816 bool m_layoutSchedulingEnabled; | 830 bool m_layoutSchedulingEnabled; |
| 817 bool m_inSynchronousPostLayout; | 831 bool m_inSynchronousPostLayout; |
| 818 int m_layoutCount; | 832 int m_layoutCount; |
| 819 unsigned m_nestedLayoutCount; | 833 unsigned m_nestedLayoutCount; |
| 820 Timer<FrameView> m_postLayoutTasksTimer; | 834 Timer<FrameView> m_postLayoutTasksTimer; |
| 821 Timer<FrameView> m_updateWidgetsTimer; | 835 Timer<FrameView> m_updateWidgetsTimer; |
| 822 std::unique_ptr<CancellableTaskFactory> m_renderThrottlingObserverNotificati onFactory; | |
| 823 | 836 |
| 824 bool m_firstLayout; | 837 bool m_firstLayout; |
| 825 bool m_isTransparent; | 838 bool m_isTransparent; |
| 826 Color m_baseBackgroundColor; | 839 Color m_baseBackgroundColor; |
| 827 IntSize m_lastViewportSize; | 840 IntSize m_lastViewportSize; |
| 828 float m_lastZoomFactor; | 841 float m_lastZoomFactor; |
| 829 | 842 |
| 830 AtomicString m_mediaType; | 843 AtomicString m_mediaType; |
| 831 AtomicString m_mediaTypeWhenNotPrinting; | 844 AtomicString m_mediaTypeWhenNotPrinting; |
| 832 | 845 |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 894 | 907 |
| 895 // Mark if something has changed in the mapping from Frame to GraphicsLayer | 908 // Mark if something has changed in the mapping from Frame to GraphicsLayer |
| 896 // and the Frame Timing regions should be recalculated. | 909 // and the Frame Timing regions should be recalculated. |
| 897 bool m_frameTimingRequestsDirty; | 910 bool m_frameTimingRequestsDirty; |
| 898 | 911 |
| 899 // Exists only on root frame. | 912 // Exists only on root frame. |
| 900 // TODO(bokan): crbug.com/484188. We should specialize FrameView for the | 913 // TODO(bokan): crbug.com/484188. We should specialize FrameView for the |
| 901 // main frame. | 914 // main frame. |
| 902 Member<RootFrameViewport> m_viewportScrollableArea; | 915 Member<RootFrameViewport> m_viewportScrollableArea; |
| 903 | 916 |
| 904 // This frame's bounds in the root frame's content coordinates, clipped | |
| 905 // recursively through every ancestor view. | |
| 906 IntRect m_viewportIntersection; | |
| 907 bool m_viewportIntersectionValid; | |
| 908 | |
| 909 // The following members control rendering pipeline throttling for this | 917 // The following members control rendering pipeline throttling for this |
| 910 // frame. They are only updated in response to intersection observer | 918 // frame. They are only updated in response to intersection observer |
| 911 // notifications, i.e., not in the middle of the lifecycle. | 919 // notifications, i.e., not in the middle of the lifecycle. |
| 912 bool m_hiddenForThrottling; | 920 bool m_hiddenForThrottling; |
| 913 bool m_crossOriginForThrottling; | |
| 914 bool m_subtreeThrottled; | 921 bool m_subtreeThrottled; |
| 915 | 922 |
| 916 // Paint properties for SPv2 Only. | 923 // Paint properties for SPv2 Only. |
| 917 // The hierarchy of transform subtree created by a FrameView. | 924 // The hierarchy of transform subtree created by a FrameView. |
| 918 // [ preTranslation ] The offset from Widget::frameRect. Estab lishes viewport. | 925 // [ preTranslation ] The offset from Widget::frameRect. Estab lishes viewport. |
| 919 // +---[ scrollTranslation ] Frame scrolling. | 926 // +---[ scrollTranslation ] Frame scrolling. |
| 920 // TODO(trchen): These will not be needed once settings->rootLayerScrolls() is enabled. | 927 // TODO(trchen): These will not be needed once settings->rootLayerScrolls() is enabled. |
| 921 RefPtr<TransformPaintPropertyNode> m_preTranslation; | 928 RefPtr<TransformPaintPropertyNode> m_preTranslation; |
| 922 RefPtr<TransformPaintPropertyNode> m_scrollTranslation; | 929 RefPtr<TransformPaintPropertyNode> m_scrollTranslation; |
| 923 // The content clip clips the document (= LayoutView) but not the scrollbars . | 930 // The content clip clips the document (= LayoutView) but not the scrollbars . |
| 924 // TODO(trchen): This will not be needed once settings->rootLayerScrolls() i s enabled. | 931 // TODO(trchen): This will not be needed once settings->rootLayerScrolls() i s enabled. |
| 925 RefPtr<ClipPaintPropertyNode> m_contentClip; | 932 RefPtr<ClipPaintPropertyNode> m_contentClip; |
| 926 | 933 |
| 927 // These nodes represent the root nodes of each property tree. | 934 // These nodes represent the root nodes of each property tree. |
| 928 // Only the root frame should create them and they will be no-op. | 935 // Only the root frame should create them and they will be no-op. |
| 929 RefPtr<TransformPaintPropertyNode> m_rootTransform; | 936 RefPtr<TransformPaintPropertyNode> m_rootTransform; |
| 930 RefPtr<ClipPaintPropertyNode> m_rootClip; | 937 RefPtr<ClipPaintPropertyNode> m_rootClip; |
| 931 RefPtr<EffectPaintPropertyNode> m_rootEffect; | 938 RefPtr<EffectPaintPropertyNode> m_rootEffect; |
| 932 | 939 |
| 933 // This is set on the local root frame view only. | 940 // This is set on the local root frame view only. |
| 934 DocumentLifecycle::LifecycleState m_currentUpdateLifecyclePhasesTargetState; | 941 DocumentLifecycle::LifecycleState m_currentUpdateLifecyclePhasesTargetState; |
| 935 | 942 |
| 936 ScrollAnchor m_scrollAnchor; | 943 ScrollAnchor m_scrollAnchor; |
| 937 | 944 |
| 938 bool m_needsScrollbarsUpdate; | 945 bool m_needsScrollbarsUpdate; |
| 939 bool m_suppressAdjustViewSize; | 946 bool m_suppressAdjustViewSize; |
| 940 bool m_allowsLayoutInvalidationAfterLayoutClean; | 947 bool m_allowsLayoutInvalidationAfterLayoutClean; |
| 941 | 948 |
| 949 Member<IntersectionObserver> m_intersectionObserver; | |
| 950 | |
| 942 // For testing. | 951 // For testing. |
| 943 struct ObjectPaintInvalidation { | 952 struct ObjectPaintInvalidation { |
| 944 String name; | 953 String name; |
| 945 PaintInvalidationReason reason; | 954 PaintInvalidationReason reason; |
| 946 }; | 955 }; |
| 947 std::unique_ptr<Vector<ObjectPaintInvalidation>> m_trackedObjectPaintInvalid ations; | 956 std::unique_ptr<Vector<ObjectPaintInvalidation>> m_trackedObjectPaintInvalid ations; |
| 948 }; | 957 }; |
| 949 | 958 |
| 950 inline void FrameView::incrementVisuallyNonEmptyCharacterCount(unsigned count) | 959 inline void FrameView::incrementVisuallyNonEmptyCharacterCount(unsigned count) |
| 951 { | 960 { |
| (...skipping 17 matching lines...) Expand all Loading... | |
| 969 if (m_visuallyNonEmptyPixelCount > visualPixelThreshold) | 978 if (m_visuallyNonEmptyPixelCount > visualPixelThreshold) |
| 970 setIsVisuallyNonEmpty(); | 979 setIsVisuallyNonEmpty(); |
| 971 } | 980 } |
| 972 | 981 |
| 973 DEFINE_TYPE_CASTS(FrameView, Widget, widget, widget->isFrameView(), widget.isFra meView()); | 982 DEFINE_TYPE_CASTS(FrameView, Widget, widget, widget->isFrameView(), widget.isFra meView()); |
| 974 DEFINE_TYPE_CASTS(FrameView, ScrollableArea, scrollableArea, scrollableArea->isF rameView(), scrollableArea.isFrameView()); | 983 DEFINE_TYPE_CASTS(FrameView, ScrollableArea, scrollableArea, scrollableArea->isF rameView(), scrollableArea.isFrameView()); |
| 975 | 984 |
| 976 } // namespace blink | 985 } // namespace blink |
| 977 | 986 |
| 978 #endif // FrameView_h | 987 #endif // FrameView_h |
| OLD | NEW |