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

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

Issue 1406133005: Calculate paint invalidation rect for scrollbars (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 1 month 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/paint/PaintInvalidationCapableScrollableArea.h"
34 #include "core/paint/PaintPhase.h" 35 #include "core/paint/PaintPhase.h"
35 #include "platform/RuntimeEnabledFeatures.h" 36 #include "platform/RuntimeEnabledFeatures.h"
36 #include "platform/Widget.h" 37 #include "platform/Widget.h"
37 #include "platform/geometry/IntRect.h" 38 #include "platform/geometry/IntRect.h"
38 #include "platform/geometry/LayoutRect.h" 39 #include "platform/geometry/LayoutRect.h"
39 #include "platform/graphics/Color.h" 40 #include "platform/graphics/Color.h"
40 #include "platform/graphics/paint/TransformPaintPropertyNode.h" 41 #include "platform/graphics/paint/TransformPaintPropertyNode.h"
41 #include "platform/scroll/ScrollTypes.h" 42 #include "platform/scroll/ScrollTypes.h"
42 #include "platform/scroll/ScrollableArea.h"
43 #include "platform/scroll/Scrollbar.h" 43 #include "platform/scroll/Scrollbar.h"
44 #include "public/platform/WebDisplayMode.h" 44 #include "public/platform/WebDisplayMode.h"
45 #include "public/platform/WebRect.h" 45 #include "public/platform/WebRect.h"
46 #include "wtf/Allocator.h" 46 #include "wtf/Allocator.h"
47 #include "wtf/Forward.h" 47 #include "wtf/Forward.h"
48 #include "wtf/HashSet.h" 48 #include "wtf/HashSet.h"
49 #include "wtf/ListHashSet.h" 49 #include "wtf/ListHashSet.h"
50 #include "wtf/OwnPtr.h" 50 #include "wtf/OwnPtr.h"
51 #include "wtf/TemporaryChange.h" 51 #include "wtf/TemporaryChange.h"
52 #include "wtf/text/WTFString.h" 52 #include "wtf/text/WTFString.h"
(...skipping 19 matching lines...) Expand all
72 class LayoutView; 72 class LayoutView;
73 class PaintInvalidationState; 73 class PaintInvalidationState;
74 class Page; 74 class Page;
75 class ScrollingCoordinator; 75 class ScrollingCoordinator;
76 class TracedValue; 76 class TracedValue;
77 struct AnnotatedRegionValue; 77 struct AnnotatedRegionValue;
78 struct CompositedSelection; 78 struct CompositedSelection;
79 79
80 typedef unsigned long long DOMTimeStamp; 80 typedef unsigned long long DOMTimeStamp;
81 81
82 class CORE_EXPORT FrameView final : public Widget, public ScrollableArea { 82 class CORE_EXPORT FrameView final : public Widget, public PaintInvalidationCapab leScrollableArea {
83 WILL_BE_USING_GARBAGE_COLLECTED_MIXIN(FrameView); 83 WILL_BE_USING_GARBAGE_COLLECTED_MIXIN(FrameView);
84 84
85 friend class PaintControllerPaintTestBase; 85 friend class PaintControllerPaintTestBase;
86 friend class Internals; 86 friend class Internals;
87 friend class LayoutPart; // for invalidateTreeIfNeeded 87 friend class LayoutPart; // for invalidateTreeIfNeeded
88 88
89 public: 89 public:
90 static PassRefPtrWillBeRawPtr<FrameView> create(LocalFrame*); 90 static PassRefPtrWillBeRawPtr<FrameView> create(LocalFrame*);
91 static PassRefPtrWillBeRawPtr<FrameView> create(LocalFrame*, const IntSize& initialSize); 91 static PassRefPtrWillBeRawPtr<FrameView> create(LocalFrame*, const IntSize& initialSize);
92 92
(...skipping 239 matching lines...) Expand 10 before | Expand all | Expand 10 after
332 332
333 // Sets the tickmarks for the FrameView, overriding the default behavior 333 // Sets the tickmarks for the FrameView, overriding the default behavior
334 // which is to display the tickmarks corresponding to find results. 334 // which is to display the tickmarks corresponding to find results.
335 // If |m_tickmarks| is empty, the default behavior is restored. 335 // If |m_tickmarks| is empty, the default behavior is restored.
336 void setTickmarks(const Vector<IntRect>& tickmarks) 336 void setTickmarks(const Vector<IntRect>& tickmarks)
337 { 337 {
338 m_tickmarks = tickmarks; 338 m_tickmarks = tickmarks;
339 invalidatePaintForTickmarks(); 339 invalidatePaintForTickmarks();
340 } 340 }
341 341
342 void invalidatePaintForTickmarks() const; 342 void invalidatePaintForTickmarks();
343 343
344 // Since the compositor can resize the viewport due to top controls and 344 // Since the compositor can resize the viewport due to top controls and
345 // commit scroll offsets before a WebView::resize occurs, we need to adjust 345 // commit scroll offsets before a WebView::resize occurs, we need to adjust
346 // our scroll extents to prevent clamping the scroll offsets. 346 // our scroll extents to prevent clamping the scroll offsets.
347 void setTopControlsViewportAdjustment(float); 347 void setTopControlsViewportAdjustment(float);
348 IntSize topControlsSize() const { return IntSize(0, roundf(m_topControlsView portAdjustment)); } 348 IntSize topControlsSize() const { return IntSize(0, roundf(m_topControlsView portAdjustment)); }
349 349
350 IntPoint maximumScrollPosition() const override; 350 IntPoint maximumScrollPosition() const override;
351 351
352 // ScrollableArea interface 352 // ScrollableArea interface
353 void invalidateScrollbarRect(Scrollbar*, const IntRect&) override; 353 void scrollControlWasSetNeedsPaintInvalidation() override { }
354 void getTickmarks(Vector<IntRect>&) const override; 354 void getTickmarks(Vector<IntRect>&) const override;
355 void scrollTo(const DoublePoint&); 355 void scrollTo(const DoublePoint&);
356 IntRect scrollableAreaBoundingBox() const override; 356 IntRect scrollableAreaBoundingBox() const override;
357 bool scrollAnimatorEnabled() const override; 357 bool scrollAnimatorEnabled() const override;
358 bool usesCompositedScrolling() const override; 358 bool usesCompositedScrolling() const override;
359 GraphicsLayer* layerForScrolling() const override; 359 GraphicsLayer* layerForScrolling() const override;
360 GraphicsLayer* layerForHorizontalScrollbar() const override; 360 GraphicsLayer* layerForHorizontalScrollbar() const override;
361 GraphicsLayer* layerForVerticalScrollbar() const override; 361 GraphicsLayer* layerForVerticalScrollbar() const override;
362 GraphicsLayer* layerForScrollCorner() const override; 362 GraphicsLayer* layerForScrollCorner() const override;
363 int scrollSize(ScrollbarOrientation) const override; 363 int scrollSize(ScrollbarOrientation) const override;
(...skipping 19 matching lines...) Expand all
383 // Functions for child manipulation and inspection. 383 // Functions for child manipulation and inspection.
384 void setParent(Widget*) override; 384 void setParent(Widget*) override;
385 void removeChild(Widget*); 385 void removeChild(Widget*);
386 void addChild(PassRefPtrWillBeRawPtr<Widget>); 386 void addChild(PassRefPtrWillBeRawPtr<Widget>);
387 const ChildrenWidgetSet* children() const { return &m_children; } 387 const ChildrenWidgetSet* children() const { return &m_children; }
388 388
389 // If the scroll view does not use a native widget, then it will have cross- platform Scrollbars. These functions 389 // If the scroll view does not use a native widget, then it will have cross- platform Scrollbars. These functions
390 // can be used to obtain those scrollbars. 390 // can be used to obtain those scrollbars.
391 Scrollbar* horizontalScrollbar() const override { return m_horizontalScrollb ar.get(); } 391 Scrollbar* horizontalScrollbar() const override { return m_horizontalScrollb ar.get(); }
392 Scrollbar* verticalScrollbar() const override { return m_verticalScrollbar.g et(); } 392 Scrollbar* verticalScrollbar() const override { return m_verticalScrollbar.g et(); }
393 LayoutScrollbarPart* scrollCorner() const { return m_scrollCorner; } 393 LayoutScrollbarPart* scrollCorner() const override { return m_scrollCorner; }
394 394
395 void positionScrollbarLayers(); 395 void positionScrollbarLayers();
396 396
397 // Functions for setting and retrieving the scrolling mode in each axis (hor izontal/vertical). The mode has values of 397 // Functions for setting and retrieving the scrolling mode in each axis (hor izontal/vertical). The mode has values of
398 // AlwaysOff, AlwaysOn, and Auto. AlwaysOff means never show a scrollbar, Al waysOn means always show a scrollbar. 398 // AlwaysOff, AlwaysOn, and Auto. AlwaysOff means never show a scrollbar, Al waysOn means always show a scrollbar.
399 // Auto means show a scrollbar only when one is needed. 399 // Auto means show a scrollbar only when one is needed.
400 // Note that for platforms with native widgets, these modes are considered a dvisory. In other words the underlying native 400 // Note that for platforms with native widgets, these modes are considered a dvisory. In other words the underlying native
401 // widget may choose not to honor the requested modes. 401 // widget may choose not to honor the requested modes.
402 void setScrollbarModes(ScrollbarMode horizontalMode, ScrollbarMode verticalM ode, bool horizontalLock = false, bool verticalLock = false); 402 void setScrollbarModes(ScrollbarMode horizontalMode, ScrollbarMode verticalM ode, bool horizontalLock = false, bool verticalLock = false);
403 void setHorizontalScrollbarMode(ScrollbarMode mode, bool lock = false) { set ScrollbarModes(mode, verticalScrollbarMode(), lock, verticalScrollbarLock()); } 403 void setHorizontalScrollbarMode(ScrollbarMode mode, bool lock = false) { set ScrollbarModes(mode, verticalScrollbarMode(), lock, verticalScrollbarLock()); }
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
436 IntSize scrollOffset() const { return toIntSize(visibleContentRect().locatio n()); } // Gets the scrolled position as an IntSize. Convenient for adding to ot her sizes. 436 IntSize scrollOffset() const { return toIntSize(visibleContentRect().locatio n()); } // Gets the scrolled position as an IntSize. Convenient for adding to ot her sizes.
437 DoubleSize scrollOffsetDouble() const { return DoubleSize(m_scrollPosition.x (), m_scrollPosition.y()); } 437 DoubleSize scrollOffsetDouble() const { return DoubleSize(m_scrollPosition.x (), m_scrollPosition.y()); }
438 DoubleSize pendingScrollDelta() const { return m_pendingScrollDelta; } 438 DoubleSize pendingScrollDelta() const { return m_pendingScrollDelta; }
439 IntPoint minimumScrollPosition() const override; // The minimum position we can be scrolled to. 439 IntPoint minimumScrollPosition() const override; // The minimum position we can be scrolled to.
440 int scrollX() const { return scrollPosition().x(); } 440 int scrollX() const { return scrollPosition().x(); }
441 int scrollY() const { return scrollPosition().y(); } 441 int scrollY() const { return scrollPosition().y(); }
442 442
443 // Scroll the actual contents of the view (either blitting or invalidating a s needed). 443 // Scroll the actual contents of the view (either blitting or invalidating a s needed).
444 void scrollContents(const IntSize& scrollDelta); 444 void scrollContents(const IntSize& scrollDelta);
445 445
446 // This gives us a means of blocking painting on our scrollbars until the fi rst layout has occurred. 446 // This gives us a means of blocking updating our scrollbars until the first layout has occurred.
447 void setScrollbarsSuppressed(bool suppressed, bool repaintOnUnsuppress = fal se); 447 void setScrollbarsSuppressed(bool suppressed) { m_scrollbarsSuppressed = sup pressed; }
448 bool scrollbarsSuppressed() const { return m_scrollbarsSuppressed; } 448 bool scrollbarsSuppressed() const { return m_scrollbarsSuppressed; }
449 449
450 // Methods for converting between this frame and other coordinate spaces. 450 // Methods for converting between this frame and other coordinate spaces.
451 // For definitions and an explanation of the varous spaces, please see: 451 // For definitions and an explanation of the varous spaces, please see:
452 // http://www.chromium.org/developers/design-documents/blink-coordinate-spac es 452 // http://www.chromium.org/developers/design-documents/blink-coordinate-spac es
453 IntPoint rootFrameToContents(const IntPoint&) const; 453 IntPoint rootFrameToContents(const IntPoint&) const;
454 FloatPoint rootFrameToContents(const FloatPoint&) const; 454 FloatPoint rootFrameToContents(const FloatPoint&) const;
455 IntRect rootFrameToContents(const IntRect&) const; 455 IntRect rootFrameToContents(const IntRect&) const;
456 IntPoint contentsToRootFrame(const IntPoint&) const; 456 IntPoint contentsToRootFrame(const IntPoint&) const;
457 IntRect contentsToRootFrame(const IntRect&) const; 457 IntRect contentsToRootFrame(const IntRect&) const;
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after
582 // Scroll the content via the compositor. 582 // Scroll the content via the compositor.
583 bool scrollContentsFastPath(const IntSize& scrollDelta); 583 bool scrollContentsFastPath(const IntSize& scrollDelta);
584 584
585 // Scroll the content by invalidating everything. 585 // Scroll the content by invalidating everything.
586 void scrollContentsSlowPath(const IntRect& updateRect); 586 void scrollContentsSlowPath(const IntRect& updateRect);
587 587
588 // These functions are used to create/destroy scrollbars. 588 // These functions are used to create/destroy scrollbars.
589 void setHasHorizontalScrollbar(bool); 589 void setHasHorizontalScrollbar(bool);
590 void setHasVerticalScrollbar(bool); 590 void setHasVerticalScrollbar(bool);
591 591
592 void invalidateScrollCornerRect(const IntRect&) override;
593 ScrollBehavior scrollBehaviorStyle() const override; 592 ScrollBehavior scrollBehaviorStyle() const override;
594 593
595 void scrollContentsIfNeeded(); 594 void scrollContentsIfNeeded();
596 595
597 void setScrollOrigin(const IntPoint&, bool updatePositionAtAll, bool updateP ositionSynchronously); 596 void setScrollOrigin(const IntPoint&, bool updatePositionAtAll, bool updateP ositionSynchronously);
598 597
599 enum ComputeScrollbarExistenceOption { 598 enum ComputeScrollbarExistenceOption {
600 FirstPass, 599 FirstPass,
601 Incremental 600 Incremental
602 }; 601 };
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after
737 void collectFrameTimingRequests(GraphicsLayerFrameTimingRequests&); 736 void collectFrameTimingRequests(GraphicsLayerFrameTimingRequests&);
738 void collectFrameTimingRequestsRecursive(GraphicsLayerFrameTimingRequests&); 737 void collectFrameTimingRequestsRecursive(GraphicsLayerFrameTimingRequests&);
739 738
740 template <typename Function> void forAllNonThrottledFrameViews(Function); 739 template <typename Function> void forAllNonThrottledFrameViews(Function);
741 740
742 void setNeedsUpdateViewportIntersection(); 741 void setNeedsUpdateViewportIntersection();
743 void updateViewportIntersectionsForSubtree(); 742 void updateViewportIntersectionsForSubtree();
744 void updateViewportIntersectionIfNeeded(); 743 void updateViewportIntersectionIfNeeded();
745 void notifyIntersectionObservers(); 744 void notifyIntersectionObservers();
746 745
746 // PaintInvalidationCapableScrollableArea
747 LayoutBox& boxForScrollControlPaintInvalidation() const override;
748 LayoutScrollbarPart* resizer() const override { return nullptr; }
749
747 LayoutSize m_size; 750 LayoutSize m_size;
748 751
749 typedef HashSet<RefPtr<LayoutEmbeddedObject>> EmbeddedObjectSet; 752 typedef HashSet<RefPtr<LayoutEmbeddedObject>> EmbeddedObjectSet;
750 EmbeddedObjectSet m_partUpdateSet; 753 EmbeddedObjectSet m_partUpdateSet;
751 754
752 // FIXME: These are just "children" of the FrameView and should be RefPtrWil lBeMember<Widget> instead. 755 // FIXME: These are just "children" of the FrameView and should be RefPtrWil lBeMember<Widget> instead.
753 HashSet<RefPtr<LayoutPart>> m_parts; 756 HashSet<RefPtr<LayoutPart>> m_parts;
754 757
755 // The RefPtr cycle between LocalFrame and FrameView is broken 758 // The RefPtr cycle between LocalFrame and FrameView is broken
756 // when a LocalFrame is detached by LocalFrame::detach(). 759 // when a LocalFrame is detached by LocalFrame::detach().
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after
904 static const unsigned visualPixelThreshold = 32 * 32; 907 static const unsigned visualPixelThreshold = 32 * 32;
905 if (m_visuallyNonEmptyPixelCount > visualPixelThreshold) 908 if (m_visuallyNonEmptyPixelCount > visualPixelThreshold)
906 setIsVisuallyNonEmpty(); 909 setIsVisuallyNonEmpty();
907 } 910 }
908 911
909 DEFINE_TYPE_CASTS(FrameView, Widget, widget, widget->isFrameView(), widget.isFra meView()); 912 DEFINE_TYPE_CASTS(FrameView, Widget, widget, widget->isFrameView(), widget.isFra meView());
910 913
911 } // namespace blink 914 } // namespace blink
912 915
913 #endif // FrameView_h 916 #endif // FrameView_h
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/fetch/ImageResourceTest.cpp ('k') | third_party/WebKit/Source/core/frame/FrameView.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698