| 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/frame/FrameViewAutoSizeInfo.h" | 30 #include "core/frame/FrameViewAutoSizeInfo.h" |
| 30 #include "core/frame/LayoutSubtreeRootList.h" | 31 #include "core/frame/LayoutSubtreeRootList.h" |
| 31 #include "core/frame/RootFrameViewport.h" | 32 #include "core/frame/RootFrameViewport.h" |
| 32 #include "core/layout/LayoutAnalyzer.h" | 33 #include "core/layout/LayoutAnalyzer.h" |
| 33 #include "core/paint/PaintPhase.h" | 34 #include "core/paint/PaintPhase.h" |
| 34 #include "platform/RuntimeEnabledFeatures.h" | 35 #include "platform/RuntimeEnabledFeatures.h" |
| 35 #include "platform/Widget.h" | 36 #include "platform/Widget.h" |
| 36 #include "platform/geometry/IntRect.h" | 37 #include "platform/geometry/IntRect.h" |
| 37 #include "platform/geometry/LayoutRect.h" | 38 #include "platform/geometry/LayoutRect.h" |
| 38 #include "platform/graphics/Color.h" | 39 #include "platform/graphics/Color.h" |
| 39 #include "platform/scroll/ScrollTypes.h" | 40 #include "platform/scroll/ScrollTypes.h" |
| 40 #include "platform/scroll/ScrollableArea.h" | 41 #include "platform/scroll/ScrollableArea.h" |
| 41 #include "platform/scroll/Scrollbar.h" | 42 #include "platform/scroll/Scrollbar.h" |
| 42 #include "public/platform/WebDisplayMode.h" | 43 #include "public/platform/WebDisplayMode.h" |
| 43 #include "public/platform/WebRect.h" | 44 #include "public/platform/WebRect.h" |
| 44 #include "wtf/Allocator.h" | 45 #include "wtf/Allocator.h" |
| 45 #include "wtf/Forward.h" | 46 #include "wtf/Forward.h" |
| 46 #include "wtf/HashSet.h" | 47 #include "wtf/HashSet.h" |
| 47 #include "wtf/ListHashSet.h" | 48 #include "wtf/ListHashSet.h" |
| 48 #include "wtf/OwnPtr.h" | 49 #include "wtf/OwnPtr.h" |
| 49 #include "wtf/TemporaryChange.h" | 50 #include "wtf/TemporaryChange.h" |
| 50 #include "wtf/text/WTFString.h" | 51 #include "wtf/text/WTFString.h" |
| 51 | 52 |
| 52 namespace blink { | 53 namespace blink { |
| 53 | 54 |
| 54 class AXObjectCache; | 55 class AXObjectCache; |
| 55 class DocumentLifecycle; | |
| 56 class Cursor; | 56 class Cursor; |
| 57 class Element; | 57 class Element; |
| 58 class FloatSize; | 58 class FloatSize; |
| 59 class HTMLFrameOwnerElement; | 59 class HTMLFrameOwnerElement; |
| 60 class LayoutPart; | 60 class LayoutPart; |
| 61 class LocalFrame; | 61 class LocalFrame; |
| 62 class KURL; | 62 class KURL; |
| 63 class Node; | 63 class Node; |
| 64 class LayoutBox; | 64 class LayoutBox; |
| 65 class LayoutEmbeddedObject; | 65 class LayoutEmbeddedObject; |
| (...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 219 void setIsPainting(bool val) { m_isPainting = val; } | 219 void setIsPainting(bool val) { m_isPainting = val; } |
| 220 bool isPainting() const; | 220 bool isPainting() const; |
| 221 void setLastPaintTime(double val) { m_lastPaintTime = val; } | 221 void setLastPaintTime(double val) { m_lastPaintTime = val; } |
| 222 bool hasEverPainted() const { return m_lastPaintTime; } | 222 bool hasEverPainted() const { return m_lastPaintTime; } |
| 223 void setNodeToDraw(Node*); | 223 void setNodeToDraw(Node*); |
| 224 Node* nodeToDraw() { return m_nodeToDraw.get(); } | 224 Node* nodeToDraw() { return m_nodeToDraw.get(); } |
| 225 | 225 |
| 226 Color documentBackgroundColor() const; | 226 Color documentBackgroundColor() const; |
| 227 | 227 |
| 228 // Run all needed lifecycle stages. After calling this method, all frames wi
ll be in the lifecycle state PaintInvalidationClean. | 228 // Run all needed lifecycle stages. After calling this method, all frames wi
ll be in the lifecycle state PaintInvalidationClean. |
| 229 void updateAllLifecyclePhases(); | 229 // If lifecycle throttling is allowed, some frames may skip the lifecycle up
date (e.g., based on visibility) and will not end |
| 230 // up being PaintInvalidationClean. |
| 231 void updateAllLifecyclePhases(DocumentLifecycle::ThrottlingMode = DocumentLi
fecycle::ThrottlingMode::Disallow); |
| 230 | 232 |
| 231 // Computes the style, layout and compositing lifecycle stages if needed. Af
ter calling this method, all frames wil lbe in a lifecycle | 233 // Computes the style, layout and compositing lifecycle stages if needed. Af
ter calling this method, all frames wil lbe in a lifecycle |
| 232 // state >= CompositingClean, and scrolling has been updated. | 234 // state >= CompositingClean, and scrolling has been updated. |
| 233 void updateLifecycleToCompositingCleanPlusScrolling(); | 235 void updateLifecycleToCompositingCleanPlusScrolling(DocumentLifecycle::Throt
tlingMode = DocumentLifecycle::ThrottlingMode::Disallow); |
| 234 | 236 |
| 235 bool invalidateViewportConstrainedObjects(); | 237 bool invalidateViewportConstrainedObjects(); |
| 236 | 238 |
| 237 void incrementVisuallyNonEmptyCharacterCount(unsigned); | 239 void incrementVisuallyNonEmptyCharacterCount(unsigned); |
| 238 void incrementVisuallyNonEmptyPixelCount(const IntSize&); | 240 void incrementVisuallyNonEmptyPixelCount(const IntSize&); |
| 239 bool isVisuallyNonEmpty() const { return m_isVisuallyNonEmpty; } | 241 bool isVisuallyNonEmpty() const { return m_isVisuallyNonEmpty; } |
| 240 void setIsVisuallyNonEmpty() { m_isVisuallyNonEmpty = true; } | 242 void setIsVisuallyNonEmpty() { m_isVisuallyNonEmpty = true; } |
| 241 void enableAutoSizeMode(const IntSize& minSize, const IntSize& maxSize); | 243 void enableAutoSizeMode(const IntSize& minSize, const IntSize& maxSize); |
| 242 void disableAutoSizeMode(); | 244 void disableAutoSizeMode(); |
| 243 | 245 |
| (...skipping 308 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 552 // Returns true if the default scrolling direction is vertical. i.e. writing
mode | 554 // Returns true if the default scrolling direction is vertical. i.e. writing
mode |
| 553 // is horiziontal. In a vertical document, a spacebar scrolls down. | 555 // is horiziontal. In a vertical document, a spacebar scrolls down. |
| 554 bool isVerticalDocument() const; | 556 bool isVerticalDocument() const; |
| 555 | 557 |
| 556 // Returns true if the document's writing mode is right-to-left or bottom-to
-top. | 558 // Returns true if the document's writing mode is right-to-left or bottom-to
-top. |
| 557 bool isFlippedDocument() const; | 559 bool isFlippedDocument() const; |
| 558 | 560 |
| 559 void setFrameTimingRequestsDirty(bool isDirty) { m_frameTimingRequestsDirty
= isDirty; } | 561 void setFrameTimingRequestsDirty(bool isDirty) { m_frameTimingRequestsDirty
= isDirty; } |
| 560 bool frameTimingRequestsDirty() { return m_frameTimingRequestsDirty; } | 562 bool frameTimingRequestsDirty() { return m_frameTimingRequestsDirty; } |
| 561 | 563 |
| 564 // Returns true if this frame should skip rendering pipeline processing duri
ng the |
| 565 // current BeginMainFrame. |
| 566 bool shouldThrottleRenderingPipeline() const; |
| 567 |
| 568 // Returns true if this frame should skip style computation, layout and |
| 569 // compositing updates for the current BeginMainFrame. |
| 570 bool shouldThrottleStyleLayoutAndCompositingUpdates() const; |
| 571 |
| 572 // Updates the throttling status of all frames in the hierarchy and |
| 573 // schedules new animations or lifecycle updates as necessary. Must be |
| 574 // called after the layer update phase of the current BeginMainFrame. |
| 575 void updateThrottling(); |
| 576 |
| 562 protected: | 577 protected: |
| 563 // Scroll the content via the compositor. | 578 // Scroll the content via the compositor. |
| 564 bool scrollContentsFastPath(const IntSize& scrollDelta); | 579 bool scrollContentsFastPath(const IntSize& scrollDelta); |
| 565 | 580 |
| 566 // Scroll the content by invalidating everything. | 581 // Scroll the content by invalidating everything. |
| 567 void scrollContentsSlowPath(const IntRect& updateRect); | 582 void scrollContentsSlowPath(const IntRect& updateRect); |
| 568 | 583 |
| 569 // These functions are used to create/destroy scrollbars. | 584 // These functions are used to create/destroy scrollbars. |
| 570 void setHasHorizontalScrollbar(bool); | 585 void setHasHorizontalScrollbar(bool); |
| 571 void setHasVerticalScrollbar(bool); | 586 void setHasVerticalScrollbar(bool); |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 605 explicit FrameView(LocalFrame*); | 620 explicit FrameView(LocalFrame*); |
| 606 | 621 |
| 607 void setScrollOffset(const IntPoint&, ScrollType) override; | 622 void setScrollOffset(const IntPoint&, ScrollType) override; |
| 608 void setScrollOffset(const DoublePoint&, ScrollType) override; | 623 void setScrollOffset(const DoublePoint&, ScrollType) override; |
| 609 | 624 |
| 610 enum LifeCycleUpdateOption { | 625 enum LifeCycleUpdateOption { |
| 611 AllPhases, | 626 AllPhases, |
| 612 OnlyUpToCompositingCleanPlusScrolling, | 627 OnlyUpToCompositingCleanPlusScrolling, |
| 613 }; | 628 }; |
| 614 | 629 |
| 615 void updateLifecyclePhasesInternal(LifeCycleUpdateOption); | 630 void updateLifecyclePhasesInternal(LifeCycleUpdateOption, DocumentLifecycle:
:ThrottlingMode); |
| 616 void invalidateTreeIfNeededRecursive(); | 631 void invalidateTreeIfNeededRecursive(); |
| 617 void scrollContentsIfNeededRecursive(); | 632 void scrollContentsIfNeededRecursive(); |
| 618 void updateStyleAndLayoutIfNeededRecursive(); | 633 void updateStyleAndLayoutIfNeededRecursive(); |
| 619 void paintForSlimmingPaintV2(); | 634 void paintForSlimmingPaintV2(); |
| 620 void compositeForSlimmingPaintV2(); | 635 void compositeForSlimmingPaintV2(); |
| 621 | 636 |
| 622 void reset(); | 637 void reset(); |
| 623 void init(); | 638 void init(); |
| 624 | 639 |
| 625 void clearLayoutSubtreeRootsAndMarkContainingBlocks(); | 640 void clearLayoutSubtreeRootsAndMarkContainingBlocks(); |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 710 // LayoutObject for the viewport-defining element (see Document::viewportDef
iningElement). | 725 // LayoutObject for the viewport-defining element (see Document::viewportDef
iningElement). |
| 711 LayoutObject* viewportLayoutObject(); | 726 LayoutObject* viewportLayoutObject(); |
| 712 | 727 |
| 713 void collectAnnotatedRegions(LayoutObject&, Vector<AnnotatedRegionValue>&); | 728 void collectAnnotatedRegions(LayoutObject&, Vector<AnnotatedRegionValue>&); |
| 714 | 729 |
| 715 typedef WTF::HashMap <const GraphicsLayer*, Vector<std::pair<int64_t, WebRec
t>>> GraphicsLayerFrameTimingRequests; | 730 typedef WTF::HashMap <const GraphicsLayer*, Vector<std::pair<int64_t, WebRec
t>>> GraphicsLayerFrameTimingRequests; |
| 716 void updateFrameTimingRequestsIfNeeded(); | 731 void updateFrameTimingRequestsIfNeeded(); |
| 717 void collectFrameTimingRequests(GraphicsLayerFrameTimingRequests&); | 732 void collectFrameTimingRequests(GraphicsLayerFrameTimingRequests&); |
| 718 void collectFrameTimingRequestsRecursive(GraphicsLayerFrameTimingRequests&); | 733 void collectFrameTimingRequestsRecursive(GraphicsLayerFrameTimingRequests&); |
| 719 | 734 |
| 735 void updateViewportVisibilityIfNeeded(); |
| 736 void setLifecycleThrottlingModeForSubtree(DocumentLifecycle::ThrottlingMode)
; |
| 737 |
| 738 enum class SecurityOriginStatus { IsSameOrigin, IsCrossOrigin }; |
| 739 void updateThrottlingRecursive(SecurityOriginStatus); |
| 740 |
| 720 LayoutSize m_size; | 741 LayoutSize m_size; |
| 721 | 742 |
| 722 typedef HashSet<RefPtr<LayoutEmbeddedObject>> EmbeddedObjectSet; | 743 typedef HashSet<RefPtr<LayoutEmbeddedObject>> EmbeddedObjectSet; |
| 723 EmbeddedObjectSet m_partUpdateSet; | 744 EmbeddedObjectSet m_partUpdateSet; |
| 724 | 745 |
| 725 // FIXME: These are just "children" of the FrameView and should be RefPtrWil
lBeMember<Widget> instead. | 746 // FIXME: These are just "children" of the FrameView and should be RefPtrWil
lBeMember<Widget> instead. |
| 726 HashSet<RefPtr<LayoutPart>> m_parts; | 747 HashSet<RefPtr<LayoutPart>> m_parts; |
| 727 | 748 |
| 728 // The RefPtr cycle between LocalFrame and FrameView is broken | 749 // The RefPtr cycle between LocalFrame and FrameView is broken |
| 729 // when a LocalFrame is detached by LocalFrame::detach(). | 750 // when a LocalFrame is detached by LocalFrame::detach(). |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 794 IntSize m_layoutSize; | 815 IntSize m_layoutSize; |
| 795 bool m_layoutSizeFixedToFrameSize; | 816 bool m_layoutSizeFixedToFrameSize; |
| 796 | 817 |
| 797 Timer<FrameView> m_didScrollTimer; | 818 Timer<FrameView> m_didScrollTimer; |
| 798 | 819 |
| 799 Vector<IntRect> m_tickmarks; | 820 Vector<IntRect> m_tickmarks; |
| 800 | 821 |
| 801 float m_topControlsViewportAdjustment; | 822 float m_topControlsViewportAdjustment; |
| 802 | 823 |
| 803 bool m_needsUpdateWidgetPositions; | 824 bool m_needsUpdateWidgetPositions; |
| 825 bool m_needsUpdateViewportVisibility; |
| 804 | 826 |
| 805 #if ENABLE(ASSERT) | 827 #if ENABLE(ASSERT) |
| 806 // Verified when finalizing. | 828 // Verified when finalizing. |
| 807 bool m_hasBeenDisposed; | 829 bool m_hasBeenDisposed; |
| 808 #endif | 830 #endif |
| 809 | 831 |
| 810 RefPtrWillBeMember<Scrollbar> m_horizontalScrollbar; | 832 RefPtrWillBeMember<Scrollbar> m_horizontalScrollbar; |
| 811 RefPtrWillBeMember<Scrollbar> m_verticalScrollbar; | 833 RefPtrWillBeMember<Scrollbar> m_verticalScrollbar; |
| 812 ScrollbarMode m_horizontalScrollbarMode; | 834 ScrollbarMode m_horizontalScrollbarMode; |
| 813 ScrollbarMode m_verticalScrollbarMode; | 835 ScrollbarMode m_verticalScrollbarMode; |
| (...skipping 18 matching lines...) Expand all Loading... |
| 832 OwnPtr<LayoutAnalyzer> m_analyzer; | 854 OwnPtr<LayoutAnalyzer> m_analyzer; |
| 833 | 855 |
| 834 // Mark if something has changed in the mapping from Frame to GraphicsLayer | 856 // Mark if something has changed in the mapping from Frame to GraphicsLayer |
| 835 // and the Frame Timing regions should be recalculated. | 857 // and the Frame Timing regions should be recalculated. |
| 836 bool m_frameTimingRequestsDirty; | 858 bool m_frameTimingRequestsDirty; |
| 837 | 859 |
| 838 // Exists only on root frame. | 860 // Exists only on root frame. |
| 839 // TODO(bokan): crbug.com/484188. We should specialize FrameView for the | 861 // TODO(bokan): crbug.com/484188. We should specialize FrameView for the |
| 840 // main frame. | 862 // main frame. |
| 841 OwnPtrWillBeMember<ScrollableArea> m_viewportScrollableArea; | 863 OwnPtrWillBeMember<ScrollableArea> m_viewportScrollableArea; |
| 864 |
| 865 // This frame's bounds in the root frame's content coordinates, clipped |
| 866 // recursively through every ancestor view. |
| 867 IntRect m_clippedBounds; |
| 868 |
| 869 enum class ViewportVisibility { Hidden, Visible }; |
| 870 |
| 871 // The following members control rendering pipeline throttling for this |
| 872 // frame. They are only updated at the end of the pipeline (after painting) |
| 873 // to avoid running further pipeline stages for a frame without having gone |
| 874 // through the previous ones. |
| 875 ViewportVisibility m_viewportVisibility; |
| 876 SecurityOriginStatus m_securityOriginStatusForThrottling; |
| 842 }; | 877 }; |
| 843 | 878 |
| 844 inline void FrameView::incrementVisuallyNonEmptyCharacterCount(unsigned count) | 879 inline void FrameView::incrementVisuallyNonEmptyCharacterCount(unsigned count) |
| 845 { | 880 { |
| 846 if (m_isVisuallyNonEmpty) | 881 if (m_isVisuallyNonEmpty) |
| 847 return; | 882 return; |
| 848 m_visuallyNonEmptyCharacterCount += count; | 883 m_visuallyNonEmptyCharacterCount += count; |
| 849 // Use a threshold value to prevent very small amounts of visible content fr
om triggering didFirstVisuallyNonEmptyLayout. | 884 // Use a threshold value to prevent very small amounts of visible content fr
om triggering didFirstVisuallyNonEmptyLayout. |
| 850 // The first few hundred characters rarely contain the interesting content o
f the page. | 885 // The first few hundred characters rarely contain the interesting content o
f the page. |
| 851 static const unsigned visualCharacterThreshold = 200; | 886 static const unsigned visualCharacterThreshold = 200; |
| (...skipping 10 matching lines...) Expand all Loading... |
| 862 static const unsigned visualPixelThreshold = 32 * 32; | 897 static const unsigned visualPixelThreshold = 32 * 32; |
| 863 if (m_visuallyNonEmptyPixelCount > visualPixelThreshold) | 898 if (m_visuallyNonEmptyPixelCount > visualPixelThreshold) |
| 864 setIsVisuallyNonEmpty(); | 899 setIsVisuallyNonEmpty(); |
| 865 } | 900 } |
| 866 | 901 |
| 867 DEFINE_TYPE_CASTS(FrameView, Widget, widget, widget->isFrameView(), widget.isFra
meView()); | 902 DEFINE_TYPE_CASTS(FrameView, Widget, widget, widget->isFrameView(), widget.isFra
meView()); |
| 868 | 903 |
| 869 } // namespace blink | 904 } // namespace blink |
| 870 | 905 |
| 871 #endif // FrameView_h | 906 #endif // FrameView_h |
| OLD | NEW |