Changeset 180615 in webkit
- Timestamp:
- Feb 24, 2015, 9:35:38 PM (10 years ago)
- Location:
- trunk/Source
- Files:
-
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
TabularUnified trunk/Source/WebCore/ChangeLog ¶
r180614 r180615 1 2015-02-24 Simon Fraser <simon.fraser@apple.com> 2 3 Clarify some resizing terminology in ScrollView/FrameView 4 https://bugs.webkit.org/show_bug.cgi?id=141996 5 6 Reviewed by Zalan Bujtas. 7 8 ScrollableArea/ScrollView/FrameView had some confusing terminology around 9 contentsResized/visibleContentsResized/fixedLayoutSizeChanged. 10 11 Clarify this by distinguishing between: 12 1. Available size changes because of 13 i) non-overlay scrollbar presence 14 ii) ScrollableArea frame change 15 2. Removing fixedLayoutSizeChanged() and just treating it like an 16 available size change. 17 18 contentsResized() is relegated to simply being a hook that allows Mac to 19 flash overlay scrollbars. 20 21 The confusingly named visibleContentsResized() is now updateContentsSize(), 22 and is the way that a ScrollableArea tells its subclasss that it should recompute 23 the size of the contents (i.e. do a layout). 24 25 * page/FrameView.cpp: 26 (WebCore::FrameView::setContentsSize): No longer mysteriously skip the 27 FrameView implementation of contentsResized(), which used to do a setNeedsLayout() 28 which we didn't want to do from setContentsSize(), which itself happens as a result of layout. 29 (WebCore::FrameView::adjustViewSize): Whitespace. 30 (WebCore::FrameView::layout): Ditto. 31 (WebCore::FrameView::availableContentSizeChanged): Called on frame size change, or scrollbar 32 change. 33 (WebCore::FrameView::updateContentsSize): This actually does the layout. 34 (WebCore::FrameView::scrollbarStyleChanged): Always call the base class; ScrollView::scrollbarStyleChanged 35 will bail if not a forced update. 36 (WebCore::FrameView::setCustomFixedPositionLayoutRect): Forces a layout via updateContentsSize() now. 37 (WebCore::FrameView::contentsResized): Deleted. 38 (WebCore::FrameView::fixedLayoutSizeChanged): Deleted. 39 (WebCore::FrameView::visibleContentsResized): Deleted. 40 * page/FrameView.h: 41 * platform/ScrollView.cpp: 42 (WebCore::ScrollView::setFixedLayoutSize): Calls availableContentSizeChanged() now. 43 (WebCore::ScrollView::setUseFixedLayout): Ditto. 44 (WebCore::ScrollView::availableContentSizeChanged): Update scrollbars if that's not 45 the reason we are being called. 46 (WebCore::ScrollView::updateScrollbars): contentsResized() was the thing that caused setNeedsLayout(); 47 replace it with availableContentSizeChanged(). visibleContentsResized() did the layout, and 48 replace with updateContentsSize(). 49 (WebCore::ScrollView::setFrameRect): Call availableContentSizeChanged() now. This takes care of 50 updating scrollbars, so no need to explicitly do that. 51 (WebCore::ScrollView::scrollbarStyleChanged): Call the base class. 52 (WebCore::ScrollView::fixedLayoutSizeChanged): Deleted. 53 * platform/ScrollView.h: 54 * platform/ScrollableArea.cpp: 55 (WebCore::ScrollableArea::availableContentSizeChanged): Call scrollAnimator->contentsResized() 56 to flash the scrollbars. 57 (WebCore::ScrollableArea::scrolledToRight): 58 (WebCore::ScrollableArea::scrollbarStyleChanged): Call availableContentSizeChanged() since 59 scrollbar style affects available space. 60 * platform/ScrollableArea.h: 61 (WebCore::ScrollableArea::updateContentsSize): 62 (WebCore::ScrollableArea::scrollbarStyleChanged): Deleted. 63 1 64 2015-02-24 Ryosuke Niwa <rniwa@webkit.org> 2 65 -
TabularUnified trunk/Source/WebCore/page/FrameView.cpp ¶
r180607 r180615 567 567 568 568 ScrollView::setContentsSize(size); 569 ScrollView::contentsResized();569 contentsResized(); 570 570 571 571 Page* page = frame().page(); … … 598 598 const IntSize& size = rect.size(); 599 599 ScrollView::setScrollOrigin(IntPoint(-rect.x(), -rect.y()), !frame().document()->printing(), size == contentsSize()); 600 600 601 601 setContentsSize(size); 602 602 } … … 1277 1277 1278 1278 LayoutSize oldSize = m_size; 1279 1280 1279 m_size = layoutSize(); 1281 1280 … … 2291 2290 } 2292 2291 2293 void FrameView::contentsResized() 2294 { 2295 ScrollView::contentsResized(); 2292 void FrameView::availableContentSizeChanged(AvailableSizeChangeReason reason) 2293 { 2296 2294 setNeedsLayout(); 2297 } 2298 2299 void FrameView::fixedLayoutSizeChanged() 2300 { 2301 // Can be triggered before the view is set, see comment in FrameView::visibleContentsResized(). 2302 // An ASSERT is triggered when a view schedules a layout before being attached to a frame. 2303 if (!frame().view()) 2304 return; 2305 ScrollView::fixedLayoutSizeChanged(); 2295 ScrollView::availableContentSizeChanged(reason); 2306 2296 } 2307 2297 … … 2311 2301 } 2312 2302 2313 void FrameView:: visibleContentsResized()2303 void FrameView::updateContentsSize() 2314 2304 { 2315 2305 // We check to make sure the view is attached to a frame() as this method can … … 3494 3484 frame().page()->chrome().client().recommendedScrollbarStyleDidChange(newStyle); 3495 3485 3496 if (forceUpdate) 3497 ScrollView::scrollbarStyleChanged(newStyle, forceUpdate); 3486 ScrollView::scrollbarStyleChanged(newStyle, forceUpdate); 3498 3487 } 3499 3488 … … 4467 4456 m_useCustomFixedPositionLayoutRect = true; 4468 4457 m_customFixedPositionLayoutRect = rect; 4469 visibleContentsResized();4458 updateContentsSize(); 4470 4459 } 4471 4460 -
TabularUnified trunk/Source/WebCore/page/FrameView.h ¶
r180607 r180615 581 581 582 582 virtual void repaintContentRectangle(const IntRect&) override; 583 virtual void contentsResized() override;584 virtual void visibleContentsResized() override;583 virtual void updateContentsSize() override; 584 virtual void availableContentSizeChanged(AvailableSizeChangeReason) override; 585 585 virtual void addedOrRemovedScrollbar() override; 586 virtual void fixedLayoutSizeChanged() override;587 586 588 587 virtual void delegatesScrollingDidChange() override; -
TabularUnified trunk/Source/WebCore/platform/ScrollView.cpp ¶
r180607 r180615 347 347 m_fixedLayoutSize = newSize; 348 348 if (m_useFixedLayout) 349 fixedLayoutSizeChanged();349 availableContentSizeChanged(AvailableSizeChangeReason::AreaSizeChanged); 350 350 } 351 351 … … 361 361 m_useFixedLayout = enable; 362 362 if (!m_fixedLayoutSize.isEmpty()) 363 fixedLayoutSizeChanged(); 364 } 365 366 void ScrollView::fixedLayoutSizeChanged() 367 { 368 updateScrollbars(scrollOffset()); 369 contentsResized(); 363 availableContentSizeChanged(AvailableSizeChangeReason::AreaSizeChanged); 364 } 365 366 void ScrollView::availableContentSizeChanged(AvailableSizeChangeReason reason) 367 { 368 ScrollableArea::availableContentSizeChanged(reason); 369 if (reason != AvailableSizeChangeReason::ScrollbarsChanged) 370 updateScrollbars(scrollOffset()); 370 371 } 371 372 … … 601 602 602 603 // If we came in here with the view already needing a layout, then go ahead and do that 603 // first. 604 // first. (This will be the common case, e.g., when the page changes due to window resizing for example). 604 605 // This layout will not re-enter updateScrollbars and does not count towards our max layout pass total. 605 606 if (!m_scrollbarsSuppressed && !hasOverlayScrollbars) { 606 607 m_inUpdateScrollbars = true; 607 visibleContentsResized();608 updateContentsSize(); 608 609 m_inUpdateScrollbars = false; 609 610 } … … 697 698 if ((sendContentResizedNotification || needAnotherPass) && m_updateScrollbarsPass < cMaxUpdateScrollbarsPass) { 698 699 m_updateScrollbarsPass++; 699 contentsResized();700 visibleContentsResized();700 availableContentSizeChanged(AvailableSizeChangeReason::ScrollbarsChanged); 701 updateContentsSize(); 701 702 IntSize newDocSize = totalContentsSize(); 702 703 if (newDocSize == docSize) { … … 1048 1049 1049 1050 Widget::setFrameRect(newRect); 1050 1051 1051 frameRectsChanged(); 1052 1053 updateScrollbars(scrollOffset()); 1054 1052 1055 1053 if (!m_useFixedLayout && oldRect.size() != newRect.size()) 1056 contentsResized();1054 availableContentSizeChanged(AvailableSizeChangeReason::AreaSizeChanged); 1057 1055 } 1058 1056 … … 1163 1161 } 1164 1162 1165 void ScrollView::scrollbarStyleChanged(ScrollbarStyle, bool forceUpdate) 1166 { 1163 void ScrollView::scrollbarStyleChanged(ScrollbarStyle newStyle, bool forceUpdate) 1164 { 1165 ScrollableArea::scrollbarStyleChanged(newStyle, forceUpdate); 1167 1166 if (!forceUpdate) 1168 1167 return; 1169 1168 1170 contentsResized();1171 1169 updateScrollbars(scrollOffset()); 1172 1170 positionScrollbarLayers(); -
TabularUnified trunk/Source/WebCore/platform/ScrollView.h ¶
r180607 r180615 390 390 virtual void paintOverhangAreas(GraphicsContext*, const IntRect& horizontalOverhangArea, const IntRect& verticalOverhangArea, const IntRect& dirtyRect); 391 391 392 virtual void visibleContentsResized() = 0;392 virtual void availableContentSizeChanged(AvailableSizeChangeReason) override; 393 393 virtual void addedOrRemovedScrollbar() = 0; 394 394 virtual void delegatesScrollingDidChange() { } 395 virtual void fixedLayoutSizeChanged();396 395 397 396 // These functions are used to create/destroy scrollbars. -
TabularUnified trunk/Source/WebCore/platform/ScrollableArea.cpp ¶
r180474 r180615 315 315 } 316 316 317 void ScrollableArea::availableContentSizeChanged(AvailableSizeChangeReason) 318 { 319 if (ScrollAnimator* scrollAnimator = existingScrollAnimator()) 320 scrollAnimator->contentsResized(); // This flashes overlay scrollbars. 321 } 322 317 323 bool ScrollableArea::hasOverlayScrollbars() const 318 324 { … … 478 484 { 479 485 return scrollPosition().x() >= maximumScrollPosition().x(); 486 } 487 488 void ScrollableArea::scrollbarStyleChanged(ScrollbarStyle, bool) 489 { 490 availableContentSizeChanged(AvailableSizeChangeReason::ScrollbarsChanged); 480 491 } 481 492 -
TabularUnified trunk/Source/WebCore/platform/ScrollableArea.h ¶
r180607 r180615 113 113 WEBCORE_EXPORT virtual void contentsResized(); 114 114 115 // Force the contents to recompute their size (i.e. do layout). 116 virtual void updateContentsSize() { } 117 118 enum class AvailableSizeChangeReason { 119 ScrollbarsChanged, 120 AreaSizeChanged 121 }; 122 WEBCORE_EXPORT virtual void availableContentSizeChanged(AvailableSizeChangeReason); 123 115 124 bool hasOverlayScrollbars() const; 116 125 WEBCORE_EXPORT virtual void setScrollbarOverlayStyle(ScrollbarOverlayStyle); … … 202 211 203 212 virtual bool shouldSuspendScrollAnimations() const { return true; } 204 virtual void scrollbarStyleChanged(ScrollbarStyle, bool /*forceUpdate*/) { }213 WEBCORE_EXPORT virtual void scrollbarStyleChanged(ScrollbarStyle /*newStyle*/, bool /*forceUpdate*/); 205 214 virtual void setVisibleScrollerThumbRect(const IntRect&) { } 206 215 -
TabularUnified trunk/Source/WebKit2/ChangeLog ¶
r180607 r180615 1 2015-02-24 Simon Fraser <simon.fraser@apple.com> 2 3 Clarify some resizing terminology in ScrollView/FrameView 4 https://bugs.webkit.org/show_bug.cgi?id=141996 5 6 Reviewed by Zalan Bujtas. 7 8 ScrollableArea/ScrollView/FrameView had some confusing terminology around 9 contentsResized/visibleContentsResized/fixedLayoutSizeChanged. 10 11 Clarify this by distinguishing between: 12 1. Available size changes because of 13 i) non-overlay scrollbar presence 14 ii) ScrollableArea frame change 15 2. Removing fixedLayoutSizeChanged() and just treating it like an 16 available size change. 17 18 contentsResized() is relegated to simply being a hook that allows Mac to 19 flash overlay scrollbars. 20 21 The confusingly named visibleContentsResized() is now updateContentsSize(), 22 and is the way that a ScrollableArea tells its subclasss that it should recompute 23 the size of the contents (i.e. do a layout). 24 25 * WebProcess/Plugins/PDF/PDFPlugin.mm: 26 (WebKit::PDFPlugin::scrollbarStyleChanged): Call the base class method, 27 which takes care of 28 1 29 2015-02-24 Simon Fraser <simon.fraser@apple.com> 2 30 -
TabularUnified trunk/Source/WebKit2/WebProcess/Plugins/PDF/PDFPlugin.mm ¶
r180607 r180615 725 725 { 726 726 // FIXME: Walk up the frame tree and look for a scrollable parent frame or RenderLayer. 727 return 0;727 return nullptr; 728 728 } 729 729 … … 798 798 setScrollOffset(newScrollOffset); 799 799 800 ScrollableArea::scrollbarStyleChanged(style, forceUpdate); 800 801 // As size of the content area changes, scrollbars may need to appear or to disappear. 801 802 updateScrollbars(); 802 803 ScrollableArea::contentsResized();804 803 } 805 804
Note:
See TracChangeset
for help on using the changeset viewer.