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 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
187 void adjustViewSize(); | 187 void adjustViewSize(); |
188 void adjustViewSizeAndLayout(); | 188 void adjustViewSizeAndLayout(); |
189 | 189 |
190 // Scale used to convert incoming input events. | 190 // Scale used to convert incoming input events. |
191 float inputEventsScaleFactor() const; | 191 float inputEventsScaleFactor() const; |
192 | 192 |
193 // Offset used to convert incoming input events while emulating device metics. | 193 // Offset used to convert incoming input events while emulating device metics. |
194 IntSize inputEventsOffsetForEmulation() const; | 194 IntSize inputEventsOffsetForEmulation() const; |
195 void setInputEventsTransformForEmulation(const IntSize&, float); | 195 void setInputEventsTransformForEmulation(const IntSize&, float); |
196 | 196 |
197 void setScrollPosition(const DoublePoint&, | |
198 ScrollType, | |
199 ScrollBehavior = ScrollBehaviorInstant) override; | |
200 void didChangeScrollOffset(); | 197 void didChangeScrollOffset(); |
201 | |
202 void didUpdateElasticOverscroll(); | 198 void didUpdateElasticOverscroll(); |
203 | 199 |
204 void viewportSizeChanged(bool widthChanged, bool heightChanged); | 200 void viewportSizeChanged(bool widthChanged, bool heightChanged); |
205 | 201 |
206 AtomicString mediaType() const; | 202 AtomicString mediaType() const; |
207 void setMediaType(const AtomicString&); | 203 void setMediaType(const AtomicString&); |
208 void adjustMediaTypeForPrinting(bool printing); | 204 void adjustMediaTypeForPrinting(bool printing); |
209 | 205 |
210 WebDisplayMode displayMode() { return m_displayMode; } | 206 WebDisplayMode displayMode() { return m_displayMode; } |
211 void setDisplayMode(WebDisplayMode); | 207 void setDisplayMode(WebDisplayMode); |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
285 void disableAutoSizeMode(); | 281 void disableAutoSizeMode(); |
286 | 282 |
287 void forceLayoutForPagination(const FloatSize& pageSize, | 283 void forceLayoutForPagination(const FloatSize& pageSize, |
288 const FloatSize& originalPageSize, | 284 const FloatSize& originalPageSize, |
289 float maximumShrinkFactor); | 285 float maximumShrinkFactor); |
290 | 286 |
291 enum UrlFragmentBehavior { UrlFragmentScroll, UrlFragmentDontScroll }; | 287 enum UrlFragmentBehavior { UrlFragmentScroll, UrlFragmentDontScroll }; |
292 // Updates the fragment anchor element based on URL's fragment identifier. | 288 // Updates the fragment anchor element based on URL's fragment identifier. |
293 // Updates corresponding ':target' CSS pseudo class on the anchor element. | 289 // Updates corresponding ':target' CSS pseudo class on the anchor element. |
294 // If |UrlFragmentScroll| is passed in then makes the anchor element | 290 // If |UrlFragmentScroll| is passed in then makes the anchor element |
295 // focused and also visible by scrolling to it. The scroll position is | 291 // focused and also visible by scrolling to it. The scroll offset is |
296 // maintained during the frame loading process. | 292 // maintained during the frame loading process. |
297 void processUrlFragment(const KURL&, UrlFragmentBehavior = UrlFragmentScroll); | 293 void processUrlFragment(const KURL&, UrlFragmentBehavior = UrlFragmentScroll); |
298 void clearFragmentAnchor(); | 294 void clearFragmentAnchor(); |
299 | 295 |
300 // Methods to convert points and rects between the coordinate space of the lay
outObject, and this view. | 296 // Methods to convert points and rects between the coordinate space of the lay
outObject, and this view. |
301 IntRect convertFromLayoutObject(const LayoutObject&, const IntRect&) const; | 297 IntRect convertFromLayoutObject(const LayoutObject&, const IntRect&) const; |
302 IntRect convertToLayoutObject(const LayoutObject&, const IntRect&) const; | 298 IntRect convertToLayoutObject(const LayoutObject&, const IntRect&) const; |
303 IntPoint convertFromLayoutObject(const LayoutObject&, const IntPoint&) const; | 299 IntPoint convertFromLayoutObject(const LayoutObject&, const IntPoint&) const; |
304 IntPoint convertToLayoutObject(const LayoutObject&, const IntPoint&) const; | 300 IntPoint convertToLayoutObject(const LayoutObject&, const IntPoint&) const; |
305 | 301 |
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
394 void invalidatePaintForTickmarks(); | 390 void invalidatePaintForTickmarks(); |
395 | 391 |
396 // Since the compositor can resize the viewport due to top controls and | 392 // Since the compositor can resize the viewport due to top controls and |
397 // commit scroll offsets before a WebView::resize occurs, we need to adjust | 393 // commit scroll offsets before a WebView::resize occurs, we need to adjust |
398 // our scroll extents to prevent clamping the scroll offsets. | 394 // our scroll extents to prevent clamping the scroll offsets. |
399 void setTopControlsViewportAdjustment(float); | 395 void setTopControlsViewportAdjustment(float); |
400 IntSize topControlsSize() const { | 396 IntSize topControlsSize() const { |
401 return IntSize(0, ceilf(m_topControlsViewportAdjustment)); | 397 return IntSize(0, ceilf(m_topControlsViewportAdjustment)); |
402 } | 398 } |
403 | 399 |
404 IntPoint maximumScrollPosition() const override; | 400 IntSize maximumScrollOffsetInt() const override; |
405 | 401 |
406 // ScrollableArea interface | 402 // ScrollableArea interface |
407 void getTickmarks(Vector<IntRect>&) const override; | 403 void getTickmarks(Vector<IntRect>&) const override; |
408 IntRect scrollableAreaBoundingBox() const override; | 404 IntRect scrollableAreaBoundingBox() const override; |
409 bool scrollAnimatorEnabled() const override; | 405 bool scrollAnimatorEnabled() const override; |
410 bool usesCompositedScrolling() const override; | 406 bool usesCompositedScrolling() const override; |
411 bool shouldScrollOnMainThread() const override; | 407 bool shouldScrollOnMainThread() const override; |
412 GraphicsLayer* layerForScrolling() const override; | 408 GraphicsLayer* layerForScrolling() const override; |
413 GraphicsLayer* layerForHorizontalScrollbar() const override; | 409 GraphicsLayer* layerForHorizontalScrollbar() const override; |
414 GraphicsLayer* layerForVerticalScrollbar() const override; | 410 GraphicsLayer* layerForVerticalScrollbar() const override; |
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
505 // (e.g. DevTool's viewport override). | 501 // (e.g. DevTool's viewport override). |
506 void clipPaintRect(FloatRect*) const; | 502 void clipPaintRect(FloatRect*) const; |
507 | 503 |
508 // Functions for getting/setting the size of the document contained inside the
FrameView (as an IntSize or as individual width and height | 504 // Functions for getting/setting the size of the document contained inside the
FrameView (as an IntSize or as individual width and height |
509 // values). | 505 // values). |
510 IntSize contentsSize() const | 506 IntSize contentsSize() const |
511 override; // Always at least as big as the visibleWidth()/visibleHeight()
. | 507 override; // Always at least as big as the visibleWidth()/visibleHeight()
. |
512 int contentsWidth() const { return contentsSize().width(); } | 508 int contentsWidth() const { return contentsSize().width(); } |
513 int contentsHeight() const { return contentsSize().height(); } | 509 int contentsHeight() const { return contentsSize().height(); } |
514 | 510 |
515 // Functions for querying the current scrolled position (both as a point, a si
ze, or as individual X and Y values). | 511 // Functions for querying the current scrolled offset (both as a point, a size
, or as individual X and Y values). |
516 // Be careful in using the Double version scrollPositionDouble() and scrollOff
setDouble(). They are meant to be | 512 // Be careful in using the Float version scrollOffset() and scrollOffset(). Th
ey are meant to be |
517 // used to communicate the fractional scroll position/offset with chromium com
positor which can do sub-pixel positioning. | 513 // used to communicate the fractional scroll offset with chromium compositor w
hich can do sub-pixel positioning. |
518 // Do not call these if the scroll position/offset is used in Blink for positi
oning. Use the Int version instead. | 514 // Do not call these if the scroll offset is used in Blink for positioning. Us
e the Int version instead. |
519 IntPoint scrollPosition() const override { | 515 IntSize scrollOffsetInt() const override { |
520 return visibleContentRect().location(); | 516 return toIntSize(visibleContentRect().location()); |
521 } | 517 } |
522 DoublePoint scrollPositionDouble() const override { return m_scrollPosition; } | 518 ScrollOffset scrollOffset() const override { return m_scrollOffset; } |
523 IntSize scrollOffset() const { | 519 ScrollOffset pendingScrollDelta() const { return m_pendingScrollDelta; } |
524 return toIntSize(visibleContentRect().location()); | 520 IntSize minimumScrollOffsetInt() |
525 } // Gets the scrolled position as an IntSize. Convenient for adding to other
sizes. | 521 const override; // The minimum offset we can be scrolled to. |
526 DoubleSize scrollOffsetDouble() const { | 522 int scrollX() const { return scrollOffsetInt().width(); } |
527 return DoubleSize(m_scrollPosition.x(), m_scrollPosition.y()); | 523 int scrollY() const { return scrollOffsetInt().height(); } |
528 } | |
529 DoubleSize pendingScrollDelta() const { return m_pendingScrollDelta; } | |
530 IntPoint minimumScrollPosition() | |
531 const override; // The minimum position we can be scrolled to. | |
532 int scrollX() const { return scrollPosition().x(); } | |
533 int scrollY() const { return scrollPosition().y(); } | |
534 | 524 |
535 // Scroll the actual contents of the view (either blitting or invalidating as
needed). | 525 // Scroll the actual contents of the view (either blitting or invalidating as
needed). |
536 void scrollContents(const IntSize& scrollDelta); | 526 void scrollContents(const IntSize& scrollDelta); |
537 | 527 |
538 // This gives us a means of blocking updating our scrollbars until the first l
ayout has occurred. | 528 // This gives us a means of blocking updating our scrollbars until the first l
ayout has occurred. |
539 void setScrollbarsSuppressed(bool suppressed) { | 529 void setScrollbarsSuppressed(bool suppressed) { |
540 m_scrollbarsSuppressed = suppressed; | 530 m_scrollbarsSuppressed = suppressed; |
541 } | 531 } |
542 bool scrollbarsSuppressed() const { return m_scrollbarsSuppressed; } | 532 bool scrollbarsSuppressed() const { return m_scrollbarsSuppressed; } |
543 | 533 |
(...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
757 private: | 747 private: |
758 AutoReset<bool> m_scope; | 748 AutoReset<bool> m_scope; |
759 }; | 749 }; |
760 | 750 |
761 // Only for LayoutPart to traverse into sub frames during paint invalidation. | 751 // Only for LayoutPart to traverse into sub frames during paint invalidation. |
762 void invalidateTreeIfNeeded(const PaintInvalidationState&); | 752 void invalidateTreeIfNeeded(const PaintInvalidationState&); |
763 | 753 |
764 private: | 754 private: |
765 explicit FrameView(LocalFrame*); | 755 explicit FrameView(LocalFrame*); |
766 | 756 |
767 void updateScrollPosition(const DoublePoint&, ScrollType) override; | 757 void updateScrollOffset(const ScrollOffset&, ScrollType) override; |
768 | 758 |
769 void updateLifecyclePhasesInternal( | 759 void updateLifecyclePhasesInternal( |
770 DocumentLifecycle::LifecycleState targetState); | 760 DocumentLifecycle::LifecycleState targetState); |
771 | 761 |
772 void invalidateTreeIfNeededRecursive(); | 762 void invalidateTreeIfNeededRecursive(); |
773 void scrollContentsIfNeededRecursive(); | 763 void scrollContentsIfNeededRecursive(); |
774 void updateStyleAndLayoutIfNeededRecursive(); | 764 void updateStyleAndLayoutIfNeededRecursive(); |
775 void updatePaintProperties(); | 765 void updatePaintProperties(); |
776 void synchronizedPaint(); | 766 void synchronizedPaint(); |
777 void synchronizedPaintRecursively(GraphicsLayer*); | 767 void synchronizedPaintRecursively(GraphicsLayer*); |
778 | 768 |
779 void updateStyleAndLayoutIfNeededRecursiveInternal(); | 769 void updateStyleAndLayoutIfNeededRecursiveInternal(); |
780 void invalidateTreeIfNeededRecursiveInternal(); | 770 void invalidateTreeIfNeededRecursiveInternal(); |
781 | 771 |
782 void pushPaintArtifactToCompositor(); | 772 void pushPaintArtifactToCompositor(); |
783 | 773 |
784 void reset(); | 774 void reset(); |
785 void init(); | 775 void init(); |
786 | 776 |
787 void clearLayoutSubtreeRootsAndMarkContainingBlocks(); | 777 void clearLayoutSubtreeRootsAndMarkContainingBlocks(); |
788 | 778 |
789 // Called when our frame rect changes (or the rect/scroll position of an ances
tor changes). | 779 // Called when our frame rect changes (or the rect/scroll offset of an ancesto
r changes). |
790 void frameRectsChanged() override; | 780 void frameRectsChanged() override; |
791 | 781 |
792 bool contentsInCompositedLayer() const; | 782 bool contentsInCompositedLayer() const; |
793 | 783 |
794 void calculateScrollbarModesFromOverflowStyle(const ComputedStyle*, | 784 void calculateScrollbarModesFromOverflowStyle(const ComputedStyle*, |
795 ScrollbarMode& hMode, | 785 ScrollbarMode& hMode, |
796 ScrollbarMode& vMode); | 786 ScrollbarMode& vMode); |
797 | 787 |
798 void updateCounters(); | 788 void updateCounters(); |
799 void forceLayoutParentViewIfNeeded(); | 789 void forceLayoutParentViewIfNeeded(); |
(...skipping 24 matching lines...) Expand all Loading... |
824 void scheduleUpdateWidgetsIfNecessary(); | 814 void scheduleUpdateWidgetsIfNecessary(); |
825 void updateWidgetsTimerFired(TimerBase*); | 815 void updateWidgetsTimerFired(TimerBase*); |
826 bool updateWidgets(); | 816 bool updateWidgets(); |
827 | 817 |
828 bool processUrlFragmentHelper(const String&, UrlFragmentBehavior); | 818 bool processUrlFragmentHelper(const String&, UrlFragmentBehavior); |
829 void setFragmentAnchor(Node*); | 819 void setFragmentAnchor(Node*); |
830 void scrollToFragmentAnchor(); | 820 void scrollToFragmentAnchor(); |
831 void didScrollTimerFired(TimerBase*); | 821 void didScrollTimerFired(TimerBase*); |
832 | 822 |
833 void updateLayersAndCompositingAfterScrollIfNeeded( | 823 void updateLayersAndCompositingAfterScrollIfNeeded( |
834 const DoubleSize& scrollDelta); | 824 const ScrollOffset& scrollDelta); |
835 | 825 |
836 static bool computeCompositedSelection(LocalFrame&, CompositedSelection&); | 826 static bool computeCompositedSelection(LocalFrame&, CompositedSelection&); |
837 void updateCompositedSelectionIfNeeded(); | 827 void updateCompositedSelectionIfNeeded(); |
838 | 828 |
839 // Returns true if the FrameView's own scrollbars overlay its content when vis
ible. | 829 // Returns true if the FrameView's own scrollbars overlay its content when vis
ible. |
840 bool hasOverlayScrollbars() const; | 830 bool hasOverlayScrollbars() const; |
841 | 831 |
842 // Returns true if the frame should use custom scrollbars. If true, one of | 832 // Returns true if the frame should use custom scrollbars. If true, one of |
843 // either |customScrollbarElement| or |customScrollbarFrame| will be set to | 833 // either |customScrollbarElement| or |customScrollbarFrame| will be set to |
844 // the element or frame which owns the scrollbar with the other set to null. | 834 // the element or frame which owns the scrollbar with the other set to null. |
845 bool shouldUseCustomScrollbars(Element*& customScrollbarElement, | 835 bool shouldUseCustomScrollbars(Element*& customScrollbarElement, |
846 LocalFrame*& customScrollbarFrame) const; | 836 LocalFrame*& customScrollbarFrame) const; |
847 | 837 |
848 // Returns true if a scrollbar needs to go from native -> custom or vice versa
. | 838 // Returns true if a scrollbar needs to go from native -> custom or vice versa
. |
849 bool needsScrollbarReconstruction() const; | 839 bool needsScrollbarReconstruction() const; |
850 | 840 |
851 bool shouldIgnoreOverflowHidden() const; | 841 bool shouldIgnoreOverflowHidden() const; |
852 | 842 |
853 void updateScrollCorner(); | 843 void updateScrollCorner(); |
854 | 844 |
855 AXObjectCache* axObjectCache() const; | 845 AXObjectCache* axObjectCache() const; |
856 | 846 |
857 void setLayoutSizeInternal(const IntSize&); | 847 void setLayoutSizeInternal(const IntSize&); |
858 | 848 |
859 bool adjustScrollbarExistence(ComputeScrollbarExistenceOption = FirstPass); | 849 bool adjustScrollbarExistence(ComputeScrollbarExistenceOption = FirstPass); |
860 void adjustScrollbarOpacity(); | 850 void adjustScrollbarOpacity(); |
861 void adjustScrollPositionFromUpdateScrollbars(); | 851 void adjustScrollOffsetFromUpdateScrollbars(); |
862 bool visualViewportSuppliesScrollbars() const; | 852 bool visualViewportSuppliesScrollbars() const; |
863 | 853 |
864 bool isFrameViewScrollbar(const Widget* child) const { | 854 bool isFrameViewScrollbar(const Widget* child) const { |
865 return horizontalScrollbar() == child || verticalScrollbar() == child; | 855 return horizontalScrollbar() == child || verticalScrollbar() == child; |
866 } | 856 } |
867 | 857 |
868 ScrollingCoordinator* scrollingCoordinator() const; | 858 ScrollingCoordinator* scrollingCoordinator() const; |
869 | 859 |
870 void prepareLayoutAnalyzer(); | 860 void prepareLayoutAnalyzer(); |
871 std::unique_ptr<TracedValue> analyzerCounters(); | 861 std::unique_ptr<TracedValue> analyzerCounters(); |
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
981 Member<Scrollbar> m_horizontalScrollbar; | 971 Member<Scrollbar> m_horizontalScrollbar; |
982 Member<Scrollbar> m_verticalScrollbar; | 972 Member<Scrollbar> m_verticalScrollbar; |
983 ScrollbarMode m_horizontalScrollbarMode; | 973 ScrollbarMode m_horizontalScrollbarMode; |
984 ScrollbarMode m_verticalScrollbarMode; | 974 ScrollbarMode m_verticalScrollbarMode; |
985 | 975 |
986 bool m_horizontalScrollbarLock; | 976 bool m_horizontalScrollbarLock; |
987 bool m_verticalScrollbarLock; | 977 bool m_verticalScrollbarLock; |
988 | 978 |
989 ChildrenWidgetSet m_children; | 979 ChildrenWidgetSet m_children; |
990 | 980 |
991 DoubleSize m_pendingScrollDelta; | 981 ScrollOffset m_pendingScrollDelta; |
992 DoublePoint m_scrollPosition; | 982 ScrollOffset m_scrollOffset; |
993 IntSize m_contentsSize; | 983 IntSize m_contentsSize; |
994 | 984 |
995 int m_scrollbarsAvoidingResizer; | 985 int m_scrollbarsAvoidingResizer; |
996 bool m_scrollbarsSuppressed; | 986 bool m_scrollbarsSuppressed; |
997 | 987 |
998 bool m_inUpdateScrollbars; | 988 bool m_inUpdateScrollbars; |
999 | 989 |
1000 std::unique_ptr<LayoutAnalyzer> m_analyzer; | 990 std::unique_ptr<LayoutAnalyzer> m_analyzer; |
1001 | 991 |
1002 // Mark if something has changed in the mapping from Frame to GraphicsLayer | 992 // Mark if something has changed in the mapping from Frame to GraphicsLayer |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1087 widget.isFrameView()); | 1077 widget.isFrameView()); |
1088 DEFINE_TYPE_CASTS(FrameView, | 1078 DEFINE_TYPE_CASTS(FrameView, |
1089 ScrollableArea, | 1079 ScrollableArea, |
1090 scrollableArea, | 1080 scrollableArea, |
1091 scrollableArea->isFrameView(), | 1081 scrollableArea->isFrameView(), |
1092 scrollableArea.isFrameView()); | 1082 scrollableArea.isFrameView()); |
1093 | 1083 |
1094 } // namespace blink | 1084 } // namespace blink |
1095 | 1085 |
1096 #endif // FrameView_h | 1086 #endif // FrameView_h |
OLD | NEW |