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 |
(...skipping 13 matching lines...) Expand all Loading... |
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/frame/FrameViewAutoSizeInfo.h" | 30 #include "core/frame/FrameViewAutoSizeInfo.h" |
31 #include "core/frame/LayoutSubtreeRootList.h" | 31 #include "core/frame/LayoutSubtreeRootList.h" |
32 #include "core/frame/RootFrameViewport.h" | 32 #include "core/frame/RootFrameViewport.h" |
33 #include "core/layout/LayoutAnalyzer.h" | 33 #include "core/layout/LayoutAnalyzer.h" |
| 34 #include "core/layout/ScrollAnchor.h" |
34 #include "core/paint/PaintInvalidationCapableScrollableArea.h" | 35 #include "core/paint/PaintInvalidationCapableScrollableArea.h" |
35 #include "core/paint/PaintPhase.h" | 36 #include "core/paint/PaintPhase.h" |
36 #include "platform/RuntimeEnabledFeatures.h" | 37 #include "platform/RuntimeEnabledFeatures.h" |
37 #include "platform/Widget.h" | 38 #include "platform/Widget.h" |
38 #include "platform/geometry/IntRect.h" | 39 #include "platform/geometry/IntRect.h" |
39 #include "platform/geometry/LayoutRect.h" | 40 #include "platform/geometry/LayoutRect.h" |
40 #include "platform/graphics/Color.h" | 41 #include "platform/graphics/Color.h" |
41 #include "platform/graphics/paint/ClipPaintPropertyNode.h" | 42 #include "platform/graphics/paint/ClipPaintPropertyNode.h" |
42 #include "platform/graphics/paint/TransformPaintPropertyNode.h" | 43 #include "platform/graphics/paint/TransformPaintPropertyNode.h" |
43 #include "platform/scroll/ScrollTypes.h" | 44 #include "platform/scroll/ScrollTypes.h" |
(...skipping 534 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
578 | 579 |
579 void setContentClip(PassRefPtr<ClipPaintPropertyNode> contentClip) { m_conte
ntClip = contentClip; } | 580 void setContentClip(PassRefPtr<ClipPaintPropertyNode> contentClip) { m_conte
ntClip = contentClip; } |
580 ClipPaintPropertyNode* contentClip() const { return m_contentClip.get(); } | 581 ClipPaintPropertyNode* contentClip() const { return m_contentClip.get(); } |
581 | 582 |
582 // TODO(ojan): Merge this with IntersectionObserver once it lands. | 583 // TODO(ojan): Merge this with IntersectionObserver once it lands. |
583 IntRect computeVisibleArea(); | 584 IntRect computeVisibleArea(); |
584 | 585 |
585 // Viewport size that should be used for viewport units (i.e. 'vh'/'vw'). | 586 // Viewport size that should be used for viewport units (i.e. 'vh'/'vw'). |
586 FloatSize viewportSizeForViewportUnits() const; | 587 FloatSize viewportSizeForViewportUnits() const; |
587 | 588 |
| 589 ScrollAnchor& scrollAnchor() { return m_scrollAnchor; } |
| 590 |
588 protected: | 591 protected: |
589 // Scroll the content via the compositor. | 592 // Scroll the content via the compositor. |
590 bool scrollContentsFastPath(const IntSize& scrollDelta); | 593 bool scrollContentsFastPath(const IntSize& scrollDelta); |
591 | 594 |
592 // Scroll the content by invalidating everything. | 595 // Scroll the content by invalidating everything. |
593 void scrollContentsSlowPath(const IntRect& updateRect); | 596 void scrollContentsSlowPath(const IntRect& updateRect); |
594 | 597 |
595 // These functions are used to create/destroy scrollbars. | 598 // These functions are used to create/destroy scrollbars. |
596 void setHasHorizontalScrollbar(bool); | 599 void setHasHorizontalScrollbar(bool); |
597 void setHasVerticalScrollbar(bool); | 600 void setHasVerticalScrollbar(bool); |
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
749 | 752 |
750 void setNeedsUpdateViewportIntersection(); | 753 void setNeedsUpdateViewportIntersection(); |
751 void updateViewportIntersectionsForSubtree(LifeCycleUpdateOption); | 754 void updateViewportIntersectionsForSubtree(LifeCycleUpdateOption); |
752 void updateViewportIntersectionIfNeeded(); | 755 void updateViewportIntersectionIfNeeded(); |
753 void notifyRenderThrottlingObservers(); | 756 void notifyRenderThrottlingObservers(); |
754 | 757 |
755 // PaintInvalidationCapableScrollableArea | 758 // PaintInvalidationCapableScrollableArea |
756 LayoutBox& boxForScrollControlPaintInvalidation() const override; | 759 LayoutBox& boxForScrollControlPaintInvalidation() const override; |
757 LayoutScrollbarPart* resizer() const override { return nullptr; } | 760 LayoutScrollbarPart* resizer() const override { return nullptr; } |
758 | 761 |
| 762 bool scrollAnchoringEnabled() const; |
| 763 |
759 LayoutSize m_size; | 764 LayoutSize m_size; |
760 | 765 |
761 typedef HashSet<RefPtr<LayoutEmbeddedObject>> EmbeddedObjectSet; | 766 typedef HashSet<RefPtr<LayoutEmbeddedObject>> EmbeddedObjectSet; |
762 EmbeddedObjectSet m_partUpdateSet; | 767 EmbeddedObjectSet m_partUpdateSet; |
763 | 768 |
764 // FIXME: These are just "children" of the FrameView and should be RefPtrWil
lBeMember<Widget> instead. | 769 // FIXME: These are just "children" of the FrameView and should be RefPtrWil
lBeMember<Widget> instead. |
765 HashSet<RefPtr<LayoutPart>> m_parts; | 770 HashSet<RefPtr<LayoutPart>> m_parts; |
766 | 771 |
767 // The RefPtr cycle between LocalFrame and FrameView is broken | 772 // The RefPtr cycle between LocalFrame and FrameView is broken |
768 // when a LocalFrame is detached by LocalFrame::detach(). | 773 // when a LocalFrame is detached by LocalFrame::detach(). |
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
889 // [ preTranslation ] The offset from Widget::frameRect. Estab
lishes viewport. | 894 // [ preTranslation ] The offset from Widget::frameRect. Estab
lishes viewport. |
890 // +---[ scrollTranslation ] Frame scrolling. | 895 // +---[ scrollTranslation ] Frame scrolling. |
891 // TODO(trchen): These will not be needed once settings->rootLayerScrolls()
is enabled. | 896 // TODO(trchen): These will not be needed once settings->rootLayerScrolls()
is enabled. |
892 RefPtr<TransformPaintPropertyNode> m_preTranslation; | 897 RefPtr<TransformPaintPropertyNode> m_preTranslation; |
893 RefPtr<TransformPaintPropertyNode> m_scrollTranslation; | 898 RefPtr<TransformPaintPropertyNode> m_scrollTranslation; |
894 // The content clip clips the document (= LayoutView) but not the scrollbars
. | 899 // The content clip clips the document (= LayoutView) but not the scrollbars
. |
895 // TODO(trchen): This will not be needed once settings->rootLayerScrolls() i
s enabled. | 900 // TODO(trchen): This will not be needed once settings->rootLayerScrolls() i
s enabled. |
896 RefPtr<ClipPaintPropertyNode> m_contentClip; | 901 RefPtr<ClipPaintPropertyNode> m_contentClip; |
897 | 902 |
898 bool m_isUpdatingAllLifecyclePhases; | 903 bool m_isUpdatingAllLifecyclePhases; |
| 904 ScrollAnchor m_scrollAnchor; |
899 }; | 905 }; |
900 | 906 |
901 inline void FrameView::incrementVisuallyNonEmptyCharacterCount(unsigned count) | 907 inline void FrameView::incrementVisuallyNonEmptyCharacterCount(unsigned count) |
902 { | 908 { |
903 if (m_isVisuallyNonEmpty) | 909 if (m_isVisuallyNonEmpty) |
904 return; | 910 return; |
905 m_visuallyNonEmptyCharacterCount += count; | 911 m_visuallyNonEmptyCharacterCount += count; |
906 // Use a threshold value to prevent very small amounts of visible content fr
om triggering didMeaningfulLayout. | 912 // Use a threshold value to prevent very small amounts of visible content fr
om triggering didMeaningfulLayout. |
907 // The first few hundred characters rarely contain the interesting content o
f the page. | 913 // The first few hundred characters rarely contain the interesting content o
f the page. |
908 static const unsigned visualCharacterThreshold = 200; | 914 static const unsigned visualCharacterThreshold = 200; |
(...skipping 11 matching lines...) Expand all Loading... |
920 if (m_visuallyNonEmptyPixelCount > visualPixelThreshold) | 926 if (m_visuallyNonEmptyPixelCount > visualPixelThreshold) |
921 setIsVisuallyNonEmpty(); | 927 setIsVisuallyNonEmpty(); |
922 } | 928 } |
923 | 929 |
924 DEFINE_TYPE_CASTS(FrameView, Widget, widget, widget->isFrameView(), widget.isFra
meView()); | 930 DEFINE_TYPE_CASTS(FrameView, Widget, widget, widget->isFrameView(), widget.isFra
meView()); |
925 DEFINE_TYPE_CASTS(FrameView, ScrollableArea, scrollableArea, scrollableArea->isF
rameView(), scrollableArea.isFrameView()); | 931 DEFINE_TYPE_CASTS(FrameView, ScrollableArea, scrollableArea, scrollableArea->isF
rameView(), scrollableArea.isFrameView()); |
926 | 932 |
927 } // namespace blink | 933 } // namespace blink |
928 | 934 |
929 #endif // FrameView_h | 935 #endif // FrameView_h |
OLD | NEW |