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