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

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

Issue 648913002: Clean up vestiges of ScrollView. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 2 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 | Annotate | Revision Log
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 316 matching lines...) Expand 10 before | Expand all | Expand 10 after
327 virtual void invalidateScrollbarRect(Scrollbar*, const IntRect&) override; 327 virtual void invalidateScrollbarRect(Scrollbar*, const IntRect&) override;
328 virtual void getTickmarks(Vector<IntRect>&) const override; 328 virtual void getTickmarks(Vector<IntRect>&) const override;
329 void scrollTo(const DoublePoint&); 329 void scrollTo(const DoublePoint&);
330 virtual IntRect scrollableAreaBoundingBox() const override; 330 virtual IntRect scrollableAreaBoundingBox() const override;
331 virtual bool scrollAnimatorEnabled() const override; 331 virtual bool scrollAnimatorEnabled() const override;
332 virtual bool usesCompositedScrolling() const override; 332 virtual bool usesCompositedScrolling() const override;
333 virtual GraphicsLayer* layerForScrolling() const override; 333 virtual GraphicsLayer* layerForScrolling() const override;
334 virtual GraphicsLayer* layerForHorizontalScrollbar() const override; 334 virtual GraphicsLayer* layerForHorizontalScrollbar() const override;
335 virtual GraphicsLayer* layerForVerticalScrollbar() const override; 335 virtual GraphicsLayer* layerForVerticalScrollbar() const override;
336 virtual GraphicsLayer* layerForScrollCorner() const override; 336 virtual GraphicsLayer* layerForScrollCorner() const override;
337
338 // --- ScrollView ---
339 virtual int scrollSize(ScrollbarOrientation) const override; 337 virtual int scrollSize(ScrollbarOrientation) const override;
340 virtual void setScrollOffset(const IntPoint&) override; 338 virtual void setScrollOffset(const IntPoint&) override;
341 virtual void setScrollOffset(const DoublePoint&) override; 339 virtual void setScrollOffset(const DoublePoint&) override;
342 virtual bool isScrollCornerVisible() const override; 340 virtual bool isScrollCornerVisible() const override;
343 void scrollbarStyleChangedInternal();
344 virtual bool userInputScrollable(ScrollbarOrientation) const override; 341 virtual bool userInputScrollable(ScrollbarOrientation) const override;
345 virtual bool shouldPlaceVerticalScrollbarOnLeft() const override; 342 virtual bool shouldPlaceVerticalScrollbarOnLeft() const override;
346 343
344 void scrollbarStyleChangedInternal();
347 void notifyPageThatContentAreaWillPaintInternal() const; 345 void notifyPageThatContentAreaWillPaintInternal() const;
348 346
349 // The window that hosts the ScrollView. The ScrollView will communicate scr olls and repaints to the 347 // The window that hosts the FrameView. The FrameView will communicate scrol ls and repaints to the
350 // host window in the window's coordinate space. 348 // host window in the window's coordinate space.
351 HostWindow* hostWindow() const; 349 HostWindow* hostWindow() const;
352 350
353 // Returns a clip rect in host window coordinates. Used to clip the blit on a scroll. 351 // Returns a clip rect in host window coordinates. Used to clip the blit on a scroll.
354 IntRect windowClipRect(IncludeScrollbarsInRect = ExcludeScrollbars) const; 352 IntRect windowClipRect(IncludeScrollbarsInRect = ExcludeScrollbars) const;
355 353
356 // Functions for child manipulation and inspection. 354 // Functions for child manipulation and inspection.
357 const HashSet<RefPtr<Widget> >* children() const { return &m_children; } 355 const HashSet<RefPtr<Widget> >* children() const { return &m_children; }
358 void addChild(PassRefPtr<Widget>); 356 void addChild(PassRefPtr<Widget>);
359 void removeChildInternal(Widget*); 357 void removeChildInternal(Widget*);
360 358
361 // If the scroll view does not use a native widget, then it will have cross- platform Scrollbars. These functions 359 // If the scroll view does not use a native widget, then it will have cross- platform Scrollbars. These functions
362 // can be used to obtain those scrollbars. 360 // can be used to obtain those scrollbars.
363 virtual Scrollbar* horizontalScrollbar() const override { return m_horizonta lScrollbar.get(); } 361 virtual Scrollbar* horizontalScrollbar() const override { return m_horizonta lScrollbar.get(); }
364 virtual Scrollbar* verticalScrollbar() const override { return m_verticalScr ollbar.get(); } 362 virtual Scrollbar* verticalScrollbar() const override { return m_verticalScr ollbar.get(); }
365 virtual bool isScrollViewScrollbar(const Widget* child) const override { ret urn horizontalScrollbar() == child || verticalScrollbar() == child; }
366 363
367 void positionScrollbarLayers(); 364 void positionScrollbarLayers();
368 365
369 // Functions for setting and retrieving the scrolling mode in each axis (hor izontal/vertical). The mode has values of 366 // Functions for setting and retrieving the scrolling mode in each axis (hor izontal/vertical). The mode has values of
370 // AlwaysOff, AlwaysOn, and Auto. AlwaysOff means never show a scrollbar, Al waysOn means always show a scrollbar. 367 // AlwaysOff, AlwaysOn, and Auto. AlwaysOff means never show a scrollbar, Al waysOn means always show a scrollbar.
371 // Auto means show a scrollbar only when one is needed. 368 // Auto means show a scrollbar only when one is needed.
372 // Note that for platforms with native widgets, these modes are considered a dvisory. In other words the underlying native 369 // Note that for platforms with native widgets, these modes are considered a dvisory. In other words the underlying native
373 // widget may choose not to honor the requested modes. 370 // widget may choose not to honor the requested modes.
374 void setScrollbarModes(ScrollbarMode horizontalMode, ScrollbarMode verticalM ode, bool horizontalLock = false, bool verticalLock = false); 371 void setScrollbarModes(ScrollbarMode horizontalMode, ScrollbarMode verticalM ode, bool horizontalLock = false, bool verticalLock = false);
375 void setHorizontalScrollbarMode(ScrollbarMode mode, bool lock = false) { set ScrollbarModes(mode, verticalScrollbarMode(), lock, verticalScrollbarLock()); } 372 void setHorizontalScrollbarMode(ScrollbarMode mode, bool lock = false) { set ScrollbarModes(mode, verticalScrollbarMode(), lock, verticalScrollbarLock()); }
(...skipping 30 matching lines...) Expand all
406 // For the main frame, visibleContentScaleFactor is equal to the page's page ScaleFactor; it's 1 otherwise. 403 // For the main frame, visibleContentScaleFactor is equal to the page's page ScaleFactor; it's 1 otherwise.
407 IntSize unscaledVisibleContentSize(IncludeScrollbarsInRect = ExcludeScrollba rs) const; 404 IntSize unscaledVisibleContentSize(IncludeScrollbarsInRect = ExcludeScrollba rs) const;
408 float visibleContentScaleFactorInternal() const { return 1; } 405 float visibleContentScaleFactorInternal() const { return 1; }
409 406
410 // Offset used to convert incoming input events while emulating device metic s. 407 // Offset used to convert incoming input events while emulating device metic s.
411 IntSize inputEventsOffsetForEmulationInternal() const { return IntSize(); } 408 IntSize inputEventsOffsetForEmulationInternal() const { return IntSize(); }
412 409
413 // Scale used to convert incoming input events. Usually the same as visibleC ontentScaleFactor(), unless specifically changed. 410 // Scale used to convert incoming input events. Usually the same as visibleC ontentScaleFactor(), unless specifically changed.
414 float inputEventsScaleFactorInternal() const { return visibleContentScaleFac tor(); } 411 float inputEventsScaleFactorInternal() const { return visibleContentScaleFac tor(); }
415 412
416 // Functions for getting/setting the size of the document contained inside t he ScrollView (as an IntSize or as individual width and height 413 // Functions for getting/setting the size of the document contained inside t he FrameView (as an IntSize or as individual width and height
417 // values). 414 // values).
418 virtual IntSize contentsSize() const override; // Always at least as big as the visibleWidth()/visibleHeight(). 415 virtual IntSize contentsSize() const override; // Always at least as big as the visibleWidth()/visibleHeight().
419 int contentsWidth() const { return contentsSize().width(); } 416 int contentsWidth() const { return contentsSize().width(); }
420 int contentsHeight() const { return contentsSize().height(); } 417 int contentsHeight() const { return contentsSize().height(); }
421 void setContentsSizeInternal(const IntSize&); 418 void setContentsSizeInternal(const IntSize&);
422 419
423 // Functions for querying the current scrolled position (both as a point, a size, or as individual X and Y values). 420 // Functions for querying the current scrolled position (both as a point, a size, or as individual X and Y values).
424 // FIXME: Remove the IntPoint version. crbug.com/414283. 421 // FIXME: Remove the IntPoint version. crbug.com/414283.
425 virtual IntPoint scrollPosition() const override { return visibleContentRect ().location(); } 422 virtual IntPoint scrollPosition() const override { return visibleContentRect ().location(); }
426 virtual DoublePoint scrollPositionDouble() const override { return m_scrollP osition; } 423 virtual DoublePoint scrollPositionDouble() const override { return m_scrollP osition; }
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
488 // Updates our scrollbars and notifies our contents of the resize. 485 // Updates our scrollbars and notifies our contents of the resize.
489 void setFrameRectInternal(const IntRect&); 486 void setFrameRectInternal(const IntRect&);
490 487
491 // For platforms that need to hit test scrollbars from within the engine's e vent handlers (like Win32). 488 // For platforms that need to hit test scrollbars from within the engine's e vent handlers (like Win32).
492 Scrollbar* scrollbarAtWindowPoint(const IntPoint& windowPoint); 489 Scrollbar* scrollbarAtWindowPoint(const IntPoint& windowPoint);
493 Scrollbar* scrollbarAtViewPoint(const IntPoint& viewPoint); 490 Scrollbar* scrollbarAtViewPoint(const IntPoint& viewPoint);
494 491
495 virtual IntPoint convertChildToSelf(const Widget* child, const IntPoint& poi nt) const override 492 virtual IntPoint convertChildToSelf(const Widget* child, const IntPoint& poi nt) const override
496 { 493 {
497 IntPoint newPoint = point; 494 IntPoint newPoint = point;
498 if (!isScrollViewScrollbar(child)) 495 if (!isFrameViewScrollbar(child))
499 newPoint = point - scrollOffset(); 496 newPoint = point - scrollOffset();
500 newPoint.moveBy(child->location()); 497 newPoint.moveBy(child->location());
501 return newPoint; 498 return newPoint;
502 } 499 }
503 500
504 virtual IntPoint convertSelfToChild(const Widget* child, const IntPoint& poi nt) const override 501 virtual IntPoint convertSelfToChild(const Widget* child, const IntPoint& poi nt) const override
505 { 502 {
506 IntPoint newPoint = point; 503 IntPoint newPoint = point;
507 if (!isScrollViewScrollbar(child)) 504 if (!isFrameViewScrollbar(child))
508 newPoint = point + scrollOffset(); 505 newPoint = point + scrollOffset();
509 newPoint.moveBy(-child->location()); 506 newPoint.moveBy(-child->location());
510 return newPoint; 507 return newPoint;
511 } 508 }
512 509
513 // Widget override. Handles painting of the contents of the view as well as the scrollbars. 510 // Widget override. Handles painting of the contents of the view as well as the scrollbars.
514 virtual void paint(GraphicsContext*, const IntRect&) override; 511 virtual void paint(GraphicsContext*, const IntRect&) override;
515 void paintScrollbars(GraphicsContext*, const IntRect&); 512 void paintScrollbars(GraphicsContext*, const IntRect&);
516 513
517 // Widget overrides to ensure that our children's visibility status is kept up to date when we get shown and hidden. 514 // Widget overrides to ensure that our children's visibility status is kept up to date when we get shown and hidden.
(...skipping 14 matching lines...) Expand all
532 void paintScrollbarInternal(GraphicsContext*, Scrollbar*, const IntRect&); 529 void paintScrollbarInternal(GraphicsContext*, Scrollbar*, const IntRect&);
533 530
534 virtual IntRect convertFromScrollbarToContainingView(const Scrollbar*, const IntRect&) const override; 531 virtual IntRect convertFromScrollbarToContainingView(const Scrollbar*, const IntRect&) const override;
535 virtual IntRect convertFromContainingViewToScrollbar(const Scrollbar*, const IntRect&) const override; 532 virtual IntRect convertFromContainingViewToScrollbar(const Scrollbar*, const IntRect&) const override;
536 virtual IntPoint convertFromScrollbarToContainingView(const Scrollbar*, cons t IntPoint&) const override; 533 virtual IntPoint convertFromScrollbarToContainingView(const Scrollbar*, cons t IntPoint&) const override;
537 virtual IntPoint convertFromContainingViewToScrollbar(const Scrollbar*, cons t IntPoint&) const override; 534 virtual IntPoint convertFromContainingViewToScrollbar(const Scrollbar*, cons t IntPoint&) const override;
538 535
539 void calculateAndPaintOverhangAreas(GraphicsContext*, const IntRect& dirtyRe ct); 536 void calculateAndPaintOverhangAreas(GraphicsContext*, const IntRect& dirtyRe ct);
540 void calculateAndPaintOverhangBackground(GraphicsContext*, const IntRect& di rtyRect); 537 void calculateAndPaintOverhangBackground(GraphicsContext*, const IntRect& di rtyRect);
541 538
542 virtual bool isScrollView() const override final { return true; }
543 virtual bool isFrameView() const override { return true; } 539 virtual bool isFrameView() const override { return true; }
544 540
545 protected: 541 protected:
546 bool scrollContentsFastPath(const IntSize& scrollDelta); 542 bool scrollContentsFastPath(const IntSize& scrollDelta);
547 void scrollContentsSlowPath(const IntRect& updateRect); 543 void scrollContentsSlowPath(const IntRect& updateRect);
548 544
549 bool isVerticalDocument() const; 545 bool isVerticalDocument() const;
550 bool isFlippedDocument() const; 546 bool isFlippedDocument() const;
551 547
552 // Prevents creation of scrollbars. Used to prevent drawing two sets of 548 // Prevents creation of scrollbars. Used to prevent drawing two sets of
553 // overlay scrollbars in the case of the pinch viewport. 549 // overlay scrollbars in the case of the pinch viewport.
554 bool scrollbarsDisabled() const; 550 bool scrollbarsDisabled() const;
555 551
556 // --- ScrollView --- 552 // NOTE: This should only be called by the overridden setScrollOffset from S crollableArea.
557 // NOTE: This should only be called by the overriden setScrollOffset from Sc rollableArea.
558 void scrollToInternal(const DoublePoint& newPosition); 553 void scrollToInternal(const DoublePoint& newPosition);
559 554
560 void contentRectangleForPaintInvalidationInternal(const IntRect&); 555 void contentRectangleForPaintInvalidationInternal(const IntRect&);
561 556
562 void paintOverhangAreasInternal(GraphicsContext*, const IntRect& horizontalO verhangArea, const IntRect& verticalOverhangArea, const IntRect& dirtyRect); 557 void paintOverhangAreasInternal(GraphicsContext*, const IntRect& horizontalO verhangArea, const IntRect& verticalOverhangArea, const IntRect& dirtyRect);
563 558
564 // These functions are used to create/destroy scrollbars. 559 // These functions are used to create/destroy scrollbars.
565 void setHasHorizontalScrollbar(bool); 560 void setHasHorizontalScrollbar(bool);
566 void setHasVerticalScrollbar(bool); 561 void setHasVerticalScrollbar(bool);
567 562
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
675 AXObjectCache* axObjectCache() const; 670 AXObjectCache* axObjectCache() const;
676 void removeFromAXObjectCache(); 671 void removeFromAXObjectCache();
677 672
678 void setLayoutSizeInternal(const IntSize&); 673 void setLayoutSizeInternal(const IntSize&);
679 674
680 bool paintInvalidationIsAllowed() const 675 bool paintInvalidationIsAllowed() const
681 { 676 {
682 return !isInPerformLayout() || canInvalidatePaintDuringPerformLayout(); 677 return !isInPerformLayout() || canInvalidatePaintDuringPerformLayout();
683 } 678 }
684 679
680 bool adjustScrollbarExistence(ComputeScrollbarExistenceOption = FirstPass);
681 void adjustScrollbarOpacity();
682 // FIXME(bokan): setScrollOffset, setScrollPosition, scrollTo, scrollToOffse tWithoutAnimation,
683 // notifyScrollPositionChanged...there's too many ways to scroll this class. This needs
684 // some cleanup.
685 void setScrollOffsetFromUpdateScrollbars(const DoubleSize&);
686
687 IntRect rectToCopyOnScroll() const;
688
689 void calculateOverhangAreasForPainting(IntRect& horizontalOverhangRect, IntR ect& verticalOverhangRect);
690 void updateOverhangAreas();
691
692 bool isFrameViewScrollbar(const Widget* child) const { return horizontalScro llbar() == child || verticalScrollbar() == child; }
693
685 static double s_currentFrameTimeStamp; // used for detecting decoded resourc e thrash in the cache 694 static double s_currentFrameTimeStamp; // used for detecting decoded resourc e thrash in the cache
686 static bool s_inPaintContents; 695 static bool s_inPaintContents;
687 696
688 LayoutSize m_size; 697 LayoutSize m_size;
689 698
690 typedef WillBeHeapHashSet<RefPtrWillBeMember<RenderEmbeddedObject> > Embedde dObjectSet; 699 typedef WillBeHeapHashSet<RefPtrWillBeMember<RenderEmbeddedObject> > Embedde dObjectSet;
691 WillBePersistentHeapHashSet<RefPtrWillBeMember<RenderEmbeddedObject> > m_wid getUpdateSet; 700 WillBePersistentHeapHashSet<RefPtrWillBeMember<RenderEmbeddedObject> > m_wid getUpdateSet;
692 701
693 // FIXME: These are just "children" of the FrameView and should be RefPtr<Wi dget> instead. 702 // FIXME: These are just "children" of the FrameView and should be RefPtr<Wi dget> instead.
694 WillBePersistentHeapHashSet<RefPtrWillBeMember<RenderWidget> > m_widgets; 703 WillBePersistentHeapHashSet<RefPtrWillBeMember<RenderWidget> > m_widgets;
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
768 IntSize m_layoutSize; 777 IntSize m_layoutSize;
769 bool m_layoutSizeFixedToFrameSize; 778 bool m_layoutSizeFixedToFrameSize;
770 779
771 Timer<FrameView> m_didScrollTimer; 780 Timer<FrameView> m_didScrollTimer;
772 781
773 Vector<IntRect> m_tickmarks; 782 Vector<IntRect> m_tickmarks;
774 783
775 bool m_needsUpdateWidgetPositions; 784 bool m_needsUpdateWidgetPositions;
776 float m_topControlsViewportAdjustment; 785 float m_topControlsViewportAdjustment;
777 786
778 // --- ScrollView ---
779 bool adjustScrollbarExistence(ComputeScrollbarExistenceOption = FirstPass);
780 void adjustScrollbarOpacity();
781 // FIXME(bokan): setScrollOffset, setScrollPosition, scrollTo, scrollToOffse tWithoutAnimation,
782 // notifyScrollPositionChanged...there's too many ways to scroll this class. This needs
783 // some cleanup.
784 void setScrollOffsetFromUpdateScrollbars(const DoubleSize&);
785
786 RefPtr<Scrollbar> m_horizontalScrollbar; 787 RefPtr<Scrollbar> m_horizontalScrollbar;
787 RefPtr<Scrollbar> m_verticalScrollbar; 788 RefPtr<Scrollbar> m_verticalScrollbar;
788 ScrollbarMode m_horizontalScrollbarMode; 789 ScrollbarMode m_horizontalScrollbarMode;
789 ScrollbarMode m_verticalScrollbarMode; 790 ScrollbarMode m_verticalScrollbarMode;
790 791
791 bool m_horizontalScrollbarLock; 792 bool m_horizontalScrollbarLock;
792 bool m_verticalScrollbarLock; 793 bool m_verticalScrollbarLock;
793 794
794 HashSet<RefPtr<Widget> > m_children; 795 HashSet<RefPtr<Widget> > m_children;
795 796
796 DoubleSize m_pendingScrollDelta; 797 DoubleSize m_pendingScrollDelta;
797 DoublePoint m_scrollPosition; 798 DoublePoint m_scrollPosition;
798 DoublePoint m_cachedScrollPosition; 799 DoublePoint m_cachedScrollPosition;
799 IntSize m_contentsSize; 800 IntSize m_contentsSize;
800 801
801 int m_scrollbarsAvoidingResizer; 802 int m_scrollbarsAvoidingResizer;
802 bool m_scrollbarsSuppressed; 803 bool m_scrollbarsSuppressed;
803 804
804 bool m_inUpdateScrollbars; 805 bool m_inUpdateScrollbars;
805 806
806 IntPoint m_panScrollIconPoint; 807 IntPoint m_panScrollIconPoint;
807 bool m_drawPanScrollIcon; 808 bool m_drawPanScrollIcon;
808 809
809 bool m_clipsRepaints; 810 bool m_clipsRepaints;
810
811 IntRect rectToCopyOnScroll() const;
812
813 void calculateOverhangAreasForPainting(IntRect& horizontalOverhangRect, IntR ect& verticalOverhangRect);
814 void updateOverhangAreas();
815 }; 811 };
816 812
817 inline void FrameView::incrementVisuallyNonEmptyCharacterCount(unsigned count) 813 inline void FrameView::incrementVisuallyNonEmptyCharacterCount(unsigned count)
818 { 814 {
819 if (m_isVisuallyNonEmpty) 815 if (m_isVisuallyNonEmpty)
820 return; 816 return;
821 m_visuallyNonEmptyCharacterCount += count; 817 m_visuallyNonEmptyCharacterCount += count;
822 // Use a threshold value to prevent very small amounts of visible content fr om triggering didFirstVisuallyNonEmptyLayout. 818 // Use a threshold value to prevent very small amounts of visible content fr om triggering didFirstVisuallyNonEmptyLayout.
823 // The first few hundred characters rarely contain the interesting content o f the page. 819 // The first few hundred characters rarely contain the interesting content o f the page.
824 static const unsigned visualCharacterThreshold = 200; 820 static const unsigned visualCharacterThreshold = 200;
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
859 m_view->setCanInvalidatePaintDuringPerformLayout(m_originalValue); 855 m_view->setCanInvalidatePaintDuringPerformLayout(m_originalValue);
860 } 856 }
861 private: 857 private:
862 FrameView* m_view; 858 FrameView* m_view;
863 bool m_originalValue; 859 bool m_originalValue;
864 }; 860 };
865 861
866 } // namespace blink 862 } // namespace blink
867 863
868 #endif // FrameView_h 864 #endif // FrameView_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698