| 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 | 7 Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights |
| 8 reserved. | 8 reserved. |
| 9 | 9 |
| 10 This library is free software; you can redistribute it and/or | 10 This library is free software; you can redistribute it and/or |
| (...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 192 void adjustViewSize(); | 192 void adjustViewSize(); |
| 193 void adjustViewSizeAndLayout(); | 193 void adjustViewSizeAndLayout(); |
| 194 | 194 |
| 195 // Scale used to convert incoming input events. | 195 // Scale used to convert incoming input events. |
| 196 float inputEventsScaleFactor() const; | 196 float inputEventsScaleFactor() const; |
| 197 | 197 |
| 198 // Offset used to convert incoming input events while emulating device metics. | 198 // Offset used to convert incoming input events while emulating device metics. |
| 199 IntSize inputEventsOffsetForEmulation() const; | 199 IntSize inputEventsOffsetForEmulation() const; |
| 200 void setInputEventsTransformForEmulation(const IntSize&, float); | 200 void setInputEventsTransformForEmulation(const IntSize&, float); |
| 201 | 201 |
| 202 void setScrollPosition(const DoublePoint&, | |
| 203 ScrollType, | |
| 204 ScrollBehavior = ScrollBehaviorInstant) override; | |
| 205 void didChangeScrollOffset(); | 202 void didChangeScrollOffset(); |
| 206 | |
| 207 void didUpdateElasticOverscroll(); | 203 void didUpdateElasticOverscroll(); |
| 208 | 204 |
| 209 void viewportSizeChanged(bool widthChanged, bool heightChanged); | 205 void viewportSizeChanged(bool widthChanged, bool heightChanged); |
| 210 | 206 |
| 211 AtomicString mediaType() const; | 207 AtomicString mediaType() const; |
| 212 void setMediaType(const AtomicString&); | 208 void setMediaType(const AtomicString&); |
| 213 void adjustMediaTypeForPrinting(bool printing); | 209 void adjustMediaTypeForPrinting(bool printing); |
| 214 | 210 |
| 215 WebDisplayMode displayMode() { return m_displayMode; } | 211 WebDisplayMode displayMode() { return m_displayMode; } |
| 216 void setDisplayMode(WebDisplayMode); | 212 void setDisplayMode(WebDisplayMode); |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 295 void disableAutoSizeMode(); | 291 void disableAutoSizeMode(); |
| 296 | 292 |
| 297 void forceLayoutForPagination(const FloatSize& pageSize, | 293 void forceLayoutForPagination(const FloatSize& pageSize, |
| 298 const FloatSize& originalPageSize, | 294 const FloatSize& originalPageSize, |
| 299 float maximumShrinkFactor); | 295 float maximumShrinkFactor); |
| 300 | 296 |
| 301 enum UrlFragmentBehavior { UrlFragmentScroll, UrlFragmentDontScroll }; | 297 enum UrlFragmentBehavior { UrlFragmentScroll, UrlFragmentDontScroll }; |
| 302 // Updates the fragment anchor element based on URL's fragment identifier. | 298 // Updates the fragment anchor element based on URL's fragment identifier. |
| 303 // Updates corresponding ':target' CSS pseudo class on the anchor element. | 299 // Updates corresponding ':target' CSS pseudo class on the anchor element. |
| 304 // If |UrlFragmentScroll| is passed in then makes the anchor element | 300 // If |UrlFragmentScroll| is passed in then makes the anchor element |
| 305 // focused and also visible by scrolling to it. The scroll position is | 301 // focused and also visible by scrolling to it. The scroll offset is |
| 306 // maintained during the frame loading process. | 302 // maintained during the frame loading process. |
| 307 void processUrlFragment(const KURL&, UrlFragmentBehavior = UrlFragmentScroll); | 303 void processUrlFragment(const KURL&, UrlFragmentBehavior = UrlFragmentScroll); |
| 308 void clearFragmentAnchor(); | 304 void clearFragmentAnchor(); |
| 309 | 305 |
| 310 // Methods to convert points and rects between the coordinate space of the | 306 // Methods to convert points and rects between the coordinate space of the |
| 311 // layoutObject, and this view. | 307 // layoutObject, and this view. |
| 312 IntRect convertFromLayoutObject(const LayoutObject&, const IntRect&) const; | 308 IntRect convertFromLayoutObject(const LayoutObject&, const IntRect&) const; |
| 313 IntRect convertToLayoutObject(const LayoutObject&, const IntRect&) const; | 309 IntRect convertToLayoutObject(const LayoutObject&, const IntRect&) const; |
| 314 IntPoint convertFromLayoutObject(const LayoutObject&, const IntPoint&) const; | 310 IntPoint convertFromLayoutObject(const LayoutObject&, const IntPoint&) const; |
| 315 IntPoint convertToLayoutObject(const LayoutObject&, const IntPoint&) const; | 311 IntPoint convertToLayoutObject(const LayoutObject&, const IntPoint&) const; |
| (...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 406 void invalidatePaintForTickmarks(); | 402 void invalidatePaintForTickmarks(); |
| 407 | 403 |
| 408 // Since the compositor can resize the viewport due to top controls and | 404 // Since the compositor can resize the viewport due to top controls and |
| 409 // commit scroll offsets before a WebView::resize occurs, we need to adjust | 405 // commit scroll offsets before a WebView::resize occurs, we need to adjust |
| 410 // our scroll extents to prevent clamping the scroll offsets. | 406 // our scroll extents to prevent clamping the scroll offsets. |
| 411 void setTopControlsViewportAdjustment(float); | 407 void setTopControlsViewportAdjustment(float); |
| 412 IntSize topControlsSize() const { | 408 IntSize topControlsSize() const { |
| 413 return IntSize(0, ceilf(m_topControlsViewportAdjustment)); | 409 return IntSize(0, ceilf(m_topControlsViewportAdjustment)); |
| 414 } | 410 } |
| 415 | 411 |
| 416 IntPoint maximumScrollPosition() const override; | 412 IntSize maximumScrollOffsetInt() const override; |
| 417 | 413 |
| 418 // ScrollableArea interface | 414 // ScrollableArea interface |
| 419 void getTickmarks(Vector<IntRect>&) const override; | 415 void getTickmarks(Vector<IntRect>&) const override; |
| 420 IntRect scrollableAreaBoundingBox() const override; | 416 IntRect scrollableAreaBoundingBox() const override; |
| 421 bool scrollAnimatorEnabled() const override; | 417 bool scrollAnimatorEnabled() const override; |
| 422 bool usesCompositedScrolling() const override; | 418 bool usesCompositedScrolling() const override; |
| 423 bool shouldScrollOnMainThread() const override; | 419 bool shouldScrollOnMainThread() const override; |
| 424 GraphicsLayer* layerForScrolling() const override; | 420 GraphicsLayer* layerForScrolling() const override; |
| 425 GraphicsLayer* layerForHorizontalScrollbar() const override; | 421 GraphicsLayer* layerForHorizontalScrollbar() const override; |
| 426 GraphicsLayer* layerForVerticalScrollbar() const override; | 422 GraphicsLayer* layerForVerticalScrollbar() const override; |
| (...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 520 // (e.g. DevTool's viewport override). | 516 // (e.g. DevTool's viewport override). |
| 521 void clipPaintRect(FloatRect*) const; | 517 void clipPaintRect(FloatRect*) const; |
| 522 | 518 |
| 523 // Functions for getting/setting the size of the document contained inside the | 519 // Functions for getting/setting the size of the document contained inside the |
| 524 // FrameView (as an IntSize or as individual width and height values). | 520 // FrameView (as an IntSize or as individual width and height values). |
| 525 // Always at least as big as the visibleWidth()/visibleHeight(). | 521 // Always at least as big as the visibleWidth()/visibleHeight(). |
| 526 IntSize contentsSize() const override; | 522 IntSize contentsSize() const override; |
| 527 int contentsWidth() const { return contentsSize().width(); } | 523 int contentsWidth() const { return contentsSize().width(); } |
| 528 int contentsHeight() const { return contentsSize().height(); } | 524 int contentsHeight() const { return contentsSize().height(); } |
| 529 | 525 |
| 530 // Functions for querying the current scrolled position (both as a point, a | 526 // Functions for querying the current scrolled offset (both as a point, a |
| 531 // size, or as individual X and Y values). Be careful in using the Double | 527 // size, or as individual X and Y values). Be careful in using the Float |
| 532 // version scrollPositionDouble() and scrollOffsetDouble(). They are meant to | 528 // version scrollOffset() and scrollOffset(). They are meant to be used to |
| 533 // be used to communicate the fractional scroll position/offset with chromium | 529 // communicate the fractional scroll offset with chromium compositor which can |
| 534 // compositor which can do sub-pixel positioning. Do not call these if the | 530 // do sub-pixel positioning. Do not call these if the scroll offset is used |
| 535 // scroll position/offset is used in Blink for positioning. Use the Int | 531 // in Blink for positioning. Use the Int version instead. |
| 536 // version instead. | 532 IntSize scrollOffsetInt() const override { |
| 537 IntPoint scrollPosition() const override { | |
| 538 return visibleContentRect().location(); | |
| 539 } | |
| 540 DoublePoint scrollPositionDouble() const override { return m_scrollPosition; } | |
| 541 // Gets the scrolled position as an IntSize. Convenient for adding to other | |
| 542 // sizes. | |
| 543 IntSize scrollOffset() const { | |
| 544 return toIntSize(visibleContentRect().location()); | 533 return toIntSize(visibleContentRect().location()); |
| 545 } | 534 } |
| 546 DoubleSize scrollOffsetDouble() const { | 535 ScrollOffset scrollOffset() const override { return m_scrollOffset; } |
| 547 return DoubleSize(m_scrollPosition.x(), m_scrollPosition.y()); | 536 ScrollOffset pendingScrollDelta() const { return m_pendingScrollDelta; } |
| 548 } | 537 IntSize minimumScrollOffsetInt() |
| 549 DoubleSize pendingScrollDelta() const { return m_pendingScrollDelta; } | 538 const override; // The minimum offset we can be scrolled to. |
| 550 // The minimum position we can be scrolled to. | 539 int scrollX() const { return scrollOffsetInt().width(); } |
| 551 IntPoint minimumScrollPosition() const override; | 540 int scrollY() const { return scrollOffsetInt().height(); } |
| 552 int scrollX() const { return scrollPosition().x(); } | |
| 553 int scrollY() const { return scrollPosition().y(); } | |
| 554 | 541 |
| 555 // Scroll the actual contents of the view (either blitting or invalidating as | 542 // Scroll the actual contents of the view (either blitting or invalidating as |
| 556 // needed). | 543 // needed). |
| 557 void scrollContents(const IntSize& scrollDelta); | 544 void scrollContents(const IntSize& scrollDelta); |
| 558 | 545 |
| 559 // This gives us a means of blocking updating our scrollbars until the first | 546 // This gives us a means of blocking updating our scrollbars until the first |
| 560 // layout has occurred. | 547 // layout has occurred. |
| 561 void setScrollbarsSuppressed(bool suppressed) { | 548 void setScrollbarsSuppressed(bool suppressed) { |
| 562 m_scrollbarsSuppressed = suppressed; | 549 m_scrollbarsSuppressed = suppressed; |
| 563 } | 550 } |
| (...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 789 private: | 776 private: |
| 790 AutoReset<bool> m_scope; | 777 AutoReset<bool> m_scope; |
| 791 }; | 778 }; |
| 792 | 779 |
| 793 // Only for LayoutPart to traverse into sub frames during paint invalidation. | 780 // Only for LayoutPart to traverse into sub frames during paint invalidation. |
| 794 void invalidateTreeIfNeeded(const PaintInvalidationState&); | 781 void invalidateTreeIfNeeded(const PaintInvalidationState&); |
| 795 | 782 |
| 796 private: | 783 private: |
| 797 explicit FrameView(LocalFrame*); | 784 explicit FrameView(LocalFrame*); |
| 798 | 785 |
| 799 void setScrollOffset(const DoublePoint&, ScrollType) override; | 786 void updateScrollOffset(const ScrollOffset&, ScrollType) override; |
| 800 | 787 |
| 801 void updateLifecyclePhasesInternal( | 788 void updateLifecyclePhasesInternal( |
| 802 DocumentLifecycle::LifecycleState targetState); | 789 DocumentLifecycle::LifecycleState targetState); |
| 803 | 790 |
| 804 void invalidateTreeIfNeededRecursive(); | 791 void invalidateTreeIfNeededRecursive(); |
| 805 void scrollContentsIfNeededRecursive(); | 792 void scrollContentsIfNeededRecursive(); |
| 806 void updateStyleAndLayoutIfNeededRecursive(); | 793 void updateStyleAndLayoutIfNeededRecursive(); |
| 807 void updatePaintProperties(); | 794 void updatePaintProperties(); |
| 808 void synchronizedPaint(); | 795 void synchronizedPaint(); |
| 809 void synchronizedPaintRecursively(GraphicsLayer*); | 796 void synchronizedPaintRecursively(GraphicsLayer*); |
| 810 | 797 |
| 811 void updateStyleAndLayoutIfNeededRecursiveInternal(); | 798 void updateStyleAndLayoutIfNeededRecursiveInternal(); |
| 812 void invalidateTreeIfNeededRecursiveInternal(); | 799 void invalidateTreeIfNeededRecursiveInternal(); |
| 813 | 800 |
| 814 void pushPaintArtifactToCompositor(); | 801 void pushPaintArtifactToCompositor(); |
| 815 | 802 |
| 816 void reset(); | 803 void reset(); |
| 817 void init(); | 804 void init(); |
| 818 | 805 |
| 819 void clearLayoutSubtreeRootsAndMarkContainingBlocks(); | 806 void clearLayoutSubtreeRootsAndMarkContainingBlocks(); |
| 820 | 807 |
| 821 // Called when our frame rect changes (or the rect/scroll position of an | 808 // Called when our frame rect changes (or the rect/scroll offset of an |
| 822 // ancestor changes). | 809 // ancestor changes). |
| 823 void frameRectsChanged() override; | 810 void frameRectsChanged() override; |
| 824 | 811 |
| 825 bool contentsInCompositedLayer() const; | 812 bool contentsInCompositedLayer() const; |
| 826 | 813 |
| 827 void calculateScrollbarModesFromOverflowStyle(const ComputedStyle*, | 814 void calculateScrollbarModesFromOverflowStyle(const ComputedStyle*, |
| 828 ScrollbarMode& hMode, | 815 ScrollbarMode& hMode, |
| 829 ScrollbarMode& vMode); | 816 ScrollbarMode& vMode); |
| 830 | 817 |
| 831 void updateCounters(); | 818 void updateCounters(); |
| (...skipping 25 matching lines...) Expand all Loading... |
| 857 void scheduleUpdateWidgetsIfNecessary(); | 844 void scheduleUpdateWidgetsIfNecessary(); |
| 858 void updateWidgetsTimerFired(TimerBase*); | 845 void updateWidgetsTimerFired(TimerBase*); |
| 859 bool updateWidgets(); | 846 bool updateWidgets(); |
| 860 | 847 |
| 861 bool processUrlFragmentHelper(const String&, UrlFragmentBehavior); | 848 bool processUrlFragmentHelper(const String&, UrlFragmentBehavior); |
| 862 void setFragmentAnchor(Node*); | 849 void setFragmentAnchor(Node*); |
| 863 void scrollToFragmentAnchor(); | 850 void scrollToFragmentAnchor(); |
| 864 void didScrollTimerFired(TimerBase*); | 851 void didScrollTimerFired(TimerBase*); |
| 865 | 852 |
| 866 void updateLayersAndCompositingAfterScrollIfNeeded( | 853 void updateLayersAndCompositingAfterScrollIfNeeded( |
| 867 const DoubleSize& scrollDelta); | 854 const ScrollOffset& scrollDelta); |
| 868 | 855 |
| 869 static bool computeCompositedSelection(LocalFrame&, CompositedSelection&); | 856 static bool computeCompositedSelection(LocalFrame&, CompositedSelection&); |
| 870 void updateCompositedSelectionIfNeeded(); | 857 void updateCompositedSelectionIfNeeded(); |
| 871 | 858 |
| 872 // Returns true if the FrameView's own scrollbars overlay its content when | 859 // Returns true if the FrameView's own scrollbars overlay its content when |
| 873 // visible. | 860 // visible. |
| 874 bool hasOverlayScrollbars() const; | 861 bool hasOverlayScrollbars() const; |
| 875 | 862 |
| 876 // Returns true if the frame should use custom scrollbars. If true, one of | 863 // Returns true if the frame should use custom scrollbars. If true, one of |
| 877 // either |customScrollbarElement| or |customScrollbarFrame| will be set to | 864 // either |customScrollbarElement| or |customScrollbarFrame| will be set to |
| 878 // the element or frame which owns the scrollbar with the other set to null. | 865 // the element or frame which owns the scrollbar with the other set to null. |
| 879 bool shouldUseCustomScrollbars(Element*& customScrollbarElement, | 866 bool shouldUseCustomScrollbars(Element*& customScrollbarElement, |
| 880 LocalFrame*& customScrollbarFrame) const; | 867 LocalFrame*& customScrollbarFrame) const; |
| 881 | 868 |
| 882 // Returns true if a scrollbar needs to go from native -> custom or vice | 869 // Returns true if a scrollbar needs to go from native -> custom or vice |
| 883 // versa. | 870 // versa. |
| 884 bool needsScrollbarReconstruction() const; | 871 bool needsScrollbarReconstruction() const; |
| 885 | 872 |
| 886 bool shouldIgnoreOverflowHidden() const; | 873 bool shouldIgnoreOverflowHidden() const; |
| 887 | 874 |
| 888 void updateScrollCorner(); | 875 void updateScrollCorner(); |
| 889 | 876 |
| 890 AXObjectCache* axObjectCache() const; | 877 AXObjectCache* axObjectCache() const; |
| 891 | 878 |
| 892 void setLayoutSizeInternal(const IntSize&); | 879 void setLayoutSizeInternal(const IntSize&); |
| 893 | 880 |
| 894 bool adjustScrollbarExistence(ComputeScrollbarExistenceOption = FirstPass); | 881 bool adjustScrollbarExistence(ComputeScrollbarExistenceOption = FirstPass); |
| 895 void adjustScrollbarOpacity(); | 882 void adjustScrollbarOpacity(); |
| 896 void adjustScrollPositionFromUpdateScrollbars(); | 883 void adjustScrollOffsetFromUpdateScrollbars(); |
| 897 bool visualViewportSuppliesScrollbars() const; | 884 bool visualViewportSuppliesScrollbars() const; |
| 898 | 885 |
| 899 bool isFrameViewScrollbar(const Widget* child) const { | 886 bool isFrameViewScrollbar(const Widget* child) const { |
| 900 return horizontalScrollbar() == child || verticalScrollbar() == child; | 887 return horizontalScrollbar() == child || verticalScrollbar() == child; |
| 901 } | 888 } |
| 902 | 889 |
| 903 ScrollingCoordinator* scrollingCoordinator() const; | 890 ScrollingCoordinator* scrollingCoordinator() const; |
| 904 | 891 |
| 905 void prepareLayoutAnalyzer(); | 892 void prepareLayoutAnalyzer(); |
| 906 std::unique_ptr<TracedValue> analyzerCounters(); | 893 std::unique_ptr<TracedValue> analyzerCounters(); |
| (...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1018 Member<Scrollbar> m_horizontalScrollbar; | 1005 Member<Scrollbar> m_horizontalScrollbar; |
| 1019 Member<Scrollbar> m_verticalScrollbar; | 1006 Member<Scrollbar> m_verticalScrollbar; |
| 1020 ScrollbarMode m_horizontalScrollbarMode; | 1007 ScrollbarMode m_horizontalScrollbarMode; |
| 1021 ScrollbarMode m_verticalScrollbarMode; | 1008 ScrollbarMode m_verticalScrollbarMode; |
| 1022 | 1009 |
| 1023 bool m_horizontalScrollbarLock; | 1010 bool m_horizontalScrollbarLock; |
| 1024 bool m_verticalScrollbarLock; | 1011 bool m_verticalScrollbarLock; |
| 1025 | 1012 |
| 1026 ChildrenWidgetSet m_children; | 1013 ChildrenWidgetSet m_children; |
| 1027 | 1014 |
| 1028 DoubleSize m_pendingScrollDelta; | 1015 ScrollOffset m_pendingScrollDelta; |
| 1029 DoublePoint m_scrollPosition; | 1016 ScrollOffset m_scrollOffset; |
| 1030 IntSize m_contentsSize; | 1017 IntSize m_contentsSize; |
| 1031 | 1018 |
| 1032 int m_scrollbarsAvoidingResizer; | 1019 int m_scrollbarsAvoidingResizer; |
| 1033 bool m_scrollbarsSuppressed; | 1020 bool m_scrollbarsSuppressed; |
| 1034 | 1021 |
| 1035 bool m_inUpdateScrollbars; | 1022 bool m_inUpdateScrollbars; |
| 1036 | 1023 |
| 1037 std::unique_ptr<LayoutAnalyzer> m_analyzer; | 1024 std::unique_ptr<LayoutAnalyzer> m_analyzer; |
| 1038 | 1025 |
| 1039 // Mark if something has changed in the mapping from Frame to GraphicsLayer | 1026 // Mark if something has changed in the mapping from Frame to GraphicsLayer |
| (...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1129 widget.isFrameView()); | 1116 widget.isFrameView()); |
| 1130 DEFINE_TYPE_CASTS(FrameView, | 1117 DEFINE_TYPE_CASTS(FrameView, |
| 1131 ScrollableArea, | 1118 ScrollableArea, |
| 1132 scrollableArea, | 1119 scrollableArea, |
| 1133 scrollableArea->isFrameView(), | 1120 scrollableArea->isFrameView(), |
| 1134 scrollableArea.isFrameView()); | 1121 scrollableArea.isFrameView()); |
| 1135 | 1122 |
| 1136 } // namespace blink | 1123 } // namespace blink |
| 1137 | 1124 |
| 1138 #endif // FrameView_h | 1125 #endif // FrameView_h |
| OLD | NEW |