Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(30)

Side by Side Diff: third_party/WebKit/Source/core/frame/FrameView.h

Issue 1647793002: Use ScrollAnchor in FrameView and PaintLayerScrollableArea. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@anchor-skeleton
Patch Set: address review comment Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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 539 matching lines...) Expand 10 before | Expand all | Expand 10 after
583 584
584 void setContentClip(PassRefPtr<ClipPaintPropertyNode> contentClip) { m_conte ntClip = contentClip; } 585 void setContentClip(PassRefPtr<ClipPaintPropertyNode> contentClip) { m_conte ntClip = contentClip; }
585 ClipPaintPropertyNode* contentClip() const { return m_contentClip.get(); } 586 ClipPaintPropertyNode* contentClip() const { return m_contentClip.get(); }
586 587
587 // TODO(ojan): Merge this with IntersectionObserver once it lands. 588 // TODO(ojan): Merge this with IntersectionObserver once it lands.
588 IntRect computeVisibleArea(); 589 IntRect computeVisibleArea();
589 590
590 // Viewport size that should be used for viewport units (i.e. 'vh'/'vw'). 591 // Viewport size that should be used for viewport units (i.e. 'vh'/'vw').
591 FloatSize viewportSizeForViewportUnits() const; 592 FloatSize viewportSizeForViewportUnits() const;
592 593
594 ScrollAnchor& scrollAnchor() { return m_scrollAnchor; }
595
593 protected: 596 protected:
594 // Scroll the content via the compositor. 597 // Scroll the content via the compositor.
595 bool scrollContentsFastPath(const IntSize& scrollDelta); 598 bool scrollContentsFastPath(const IntSize& scrollDelta);
596 599
597 // Scroll the content by invalidating everything. 600 // Scroll the content by invalidating everything.
598 void scrollContentsSlowPath(const IntRect& updateRect); 601 void scrollContentsSlowPath(const IntRect& updateRect);
599 602
600 // These functions are used to create/destroy scrollbars. 603 // These functions are used to create/destroy scrollbars.
601 void setHasHorizontalScrollbar(bool); 604 void setHasHorizontalScrollbar(bool);
602 void setHasVerticalScrollbar(bool); 605 void setHasVerticalScrollbar(bool);
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after
754 757
755 void setNeedsUpdateViewportIntersection(); 758 void setNeedsUpdateViewportIntersection();
756 void updateViewportIntersectionsForSubtree(LifeCycleUpdateOption); 759 void updateViewportIntersectionsForSubtree(LifeCycleUpdateOption);
757 void updateViewportIntersectionIfNeeded(); 760 void updateViewportIntersectionIfNeeded();
758 void notifyRenderThrottlingObservers(); 761 void notifyRenderThrottlingObservers();
759 762
760 // PaintInvalidationCapableScrollableArea 763 // PaintInvalidationCapableScrollableArea
761 LayoutBox& boxForScrollControlPaintInvalidation() const override; 764 LayoutBox& boxForScrollControlPaintInvalidation() const override;
762 LayoutScrollbarPart* resizer() const override { return nullptr; } 765 LayoutScrollbarPart* resizer() const override { return nullptr; }
763 766
767 bool scrollAnchoringEnabled() const;
768
764 LayoutSize m_size; 769 LayoutSize m_size;
765 770
766 typedef HashSet<RefPtr<LayoutEmbeddedObject>> EmbeddedObjectSet; 771 typedef HashSet<RefPtr<LayoutEmbeddedObject>> EmbeddedObjectSet;
767 EmbeddedObjectSet m_partUpdateSet; 772 EmbeddedObjectSet m_partUpdateSet;
768 773
769 // FIXME: These are just "children" of the FrameView and should be RefPtrWil lBeMember<Widget> instead. 774 // FIXME: These are just "children" of the FrameView and should be RefPtrWil lBeMember<Widget> instead.
770 HashSet<RefPtr<LayoutPart>> m_parts; 775 HashSet<RefPtr<LayoutPart>> m_parts;
771 776
772 // The RefPtr cycle between LocalFrame and FrameView is broken 777 // The RefPtr cycle between LocalFrame and FrameView is broken
773 // when a LocalFrame is detached by LocalFrame::detach(). 778 // when a LocalFrame is detached by LocalFrame::detach().
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after
894 // [ preTranslation ] The offset from Widget::frameRect. Estab lishes viewport. 899 // [ preTranslation ] The offset from Widget::frameRect. Estab lishes viewport.
895 // +---[ scrollTranslation ] Frame scrolling. 900 // +---[ scrollTranslation ] Frame scrolling.
896 // TODO(trchen): These will not be needed once settings->rootLayerScrolls() is enabled. 901 // TODO(trchen): These will not be needed once settings->rootLayerScrolls() is enabled.
897 RefPtr<TransformPaintPropertyNode> m_preTranslation; 902 RefPtr<TransformPaintPropertyNode> m_preTranslation;
898 RefPtr<TransformPaintPropertyNode> m_scrollTranslation; 903 RefPtr<TransformPaintPropertyNode> m_scrollTranslation;
899 // The content clip clips the document (= LayoutView) but not the scrollbars . 904 // The content clip clips the document (= LayoutView) but not the scrollbars .
900 // TODO(trchen): This will not be needed once settings->rootLayerScrolls() i s enabled. 905 // TODO(trchen): This will not be needed once settings->rootLayerScrolls() i s enabled.
901 RefPtr<ClipPaintPropertyNode> m_contentClip; 906 RefPtr<ClipPaintPropertyNode> m_contentClip;
902 907
903 bool m_isUpdatingAllLifecyclePhases; 908 bool m_isUpdatingAllLifecyclePhases;
909 ScrollAnchor m_scrollAnchor;
904 }; 910 };
905 911
906 inline void FrameView::incrementVisuallyNonEmptyCharacterCount(unsigned count) 912 inline void FrameView::incrementVisuallyNonEmptyCharacterCount(unsigned count)
907 { 913 {
908 if (m_isVisuallyNonEmpty) 914 if (m_isVisuallyNonEmpty)
909 return; 915 return;
910 m_visuallyNonEmptyCharacterCount += count; 916 m_visuallyNonEmptyCharacterCount += count;
911 // Use a threshold value to prevent very small amounts of visible content fr om triggering didMeaningfulLayout. 917 // Use a threshold value to prevent very small amounts of visible content fr om triggering didMeaningfulLayout.
912 // The first few hundred characters rarely contain the interesting content o f the page. 918 // The first few hundred characters rarely contain the interesting content o f the page.
913 static const unsigned visualCharacterThreshold = 200; 919 static const unsigned visualCharacterThreshold = 200;
(...skipping 11 matching lines...) Expand all
925 if (m_visuallyNonEmptyPixelCount > visualPixelThreshold) 931 if (m_visuallyNonEmptyPixelCount > visualPixelThreshold)
926 setIsVisuallyNonEmpty(); 932 setIsVisuallyNonEmpty();
927 } 933 }
928 934
929 DEFINE_TYPE_CASTS(FrameView, Widget, widget, widget->isFrameView(), widget.isFra meView()); 935 DEFINE_TYPE_CASTS(FrameView, Widget, widget, widget->isFrameView(), widget.isFra meView());
930 DEFINE_TYPE_CASTS(FrameView, ScrollableArea, scrollableArea, scrollableArea->isF rameView(), scrollableArea.isFrameView()); 936 DEFINE_TYPE_CASTS(FrameView, ScrollableArea, scrollableArea, scrollableArea->isF rameView(), scrollableArea.isFrameView());
931 937
932 } // namespace blink 938 } // namespace blink
933 939
934 #endif // FrameView_h 940 #endif // FrameView_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698