Changeset 155660 in webkit
- Timestamp:
- Sep 12, 2013 4:28:32 PM (11 years ago)
- Location:
- trunk/Source
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r155655 r155660 1 2013-09-12 Simon Fraser <simon.fraser@apple.com> 2 3 Avoid extra scrollbar-related layouts for overlay scrollbars 4 https://bugs.webkit.org/show_bug.cgi?id=121267 5 6 Reviewed by Beth Dakin. 7 8 If ScrollView::updateScrollbars() detected that scrollbars were added 9 and removed, it would call contentsResized(), which calls setNeedsLayout(), 10 followed by visibleContentsResized() which would trigger layout. There is no 11 point doing this with overlay scrollbars, so avoid it by having 12 setHas*Scrollbar() return true if the addition/removal of a scrollbar changed 13 the available width. 14 15 No tests: we can't test overlay scrollbars in tests. 16 17 * page/FrameView.cpp: 18 (WebCore::FrameView::setContentsSize): Drive-by assertion that 19 checks that the unsigned m_deferSetNeedsLayouts doesn't wrap when 20 decremented. 21 * platform/ScrollView.cpp: 22 (WebCore::ScrollView::setHasHorizontalScrollbar): Return true if the addition/removal 23 changed available space. 24 (WebCore::ScrollView::setHasVerticalScrollbar): Ditto. 25 (WebCore::ScrollView::updateScrollbars): Only set sendContentResizedNotification 26 if available space was changed by addition/removal of scrollbars. 27 * platform/ScrollView.h: 28 1 29 2013-09-12 Zoltan Horvath <zoltan@webkit.org> 2 30 -
trunk/Source/WebCore/page/FrameView.cpp
r155598 r155660 582 582 page->chrome().contentsSizeChanged(&frame(), size); // Notify only. 583 583 584 ASSERT(m_deferSetNeedsLayouts); 584 585 m_deferSetNeedsLayouts--; 585 586 -
trunk/Source/WebCore/platform/ScrollView.cpp
r154045 r155660 85 85 } 86 86 87 voidScrollView::setHasHorizontalScrollbar(bool hasBar)87 bool ScrollView::setHasHorizontalScrollbar(bool hasBar) 88 88 { 89 89 ASSERT(!hasBar || !avoidScrollbarCreation()); … … 93 93 didAddScrollbar(m_horizontalScrollbar.get(), HorizontalScrollbar); 94 94 m_horizontalScrollbar->styleChanged(); 95 } else if (!hasBar && m_horizontalScrollbar) { 95 return !m_horizontalScrollbar->isOverlayScrollbar(); 96 } 97 98 if (!hasBar && m_horizontalScrollbar) { 99 bool wasOverlayScrollbar = m_horizontalScrollbar->isOverlayScrollbar(); 96 100 willRemoveScrollbar(m_horizontalScrollbar.get(), HorizontalScrollbar); 97 101 removeChild(m_horizontalScrollbar.get()); 98 102 m_horizontalScrollbar = 0; 99 } 100 } 101 102 void ScrollView::setHasVerticalScrollbar(bool hasBar) 103 return !wasOverlayScrollbar; 104 } 105 106 return false; 107 } 108 109 bool ScrollView::setHasVerticalScrollbar(bool hasBar) 103 110 { 104 111 ASSERT(!hasBar || !avoidScrollbarCreation()); … … 108 115 didAddScrollbar(m_verticalScrollbar.get(), VerticalScrollbar); 109 116 m_verticalScrollbar->styleChanged(); 110 } else if (!hasBar && m_verticalScrollbar) { 117 return !m_verticalScrollbar->isOverlayScrollbar(); 118 } 119 120 if (!hasBar && m_verticalScrollbar) { 121 bool wasOverlayScrollbar = m_verticalScrollbar->isOverlayScrollbar(); 111 122 willRemoveScrollbar(m_verticalScrollbar.get(), VerticalScrollbar); 112 123 removeChild(m_verticalScrollbar.get()); 113 124 m_verticalScrollbar = 0; 114 } 125 return !wasOverlayScrollbar; 126 } 127 128 return false; 115 129 } 116 130 … … 543 557 if (m_horizontalScrollbar) 544 558 m_horizontalScrollbar->invalidate(); 545 setHasHorizontalScrollbar(newHasHorizontalScrollbar); 546 sendContentResizedNotification = true;559 560 sendContentResizedNotification = setHasHorizontalScrollbar(newHasHorizontalScrollbar); 547 561 } 548 562 … … 552 566 if (m_verticalScrollbar) 553 567 m_verticalScrollbar->invalidate(); 554 setHasVerticalScrollbar(newHasVerticalScrollbar); 555 sendContentResizedNotification = true;568 569 sendContentResizedNotification = setHasVerticalScrollbar(newHasVerticalScrollbar); 556 570 } 557 571 -
trunk/Source/WebCore/platform/ScrollView.h
r155164 r155660 316 316 317 317 // These functions are used to create/destroy scrollbars. 318 void setHasHorizontalScrollbar(bool); 319 void setHasVerticalScrollbar(bool); 318 // They return true if the space taken up by the scrollbar changed. 319 bool setHasHorizontalScrollbar(bool); 320 bool setHasVerticalScrollbar(bool); 320 321 321 322 virtual void updateScrollCorner(); -
trunk/Source/WebKit2/ChangeLog
r155642 r155660 1 2013-09-12 Simon Fraser <simon.fraser@apple.com> 2 3 Avoid extra scrollbar-related layouts for overlay scrollbars 4 https://bugs.webkit.org/show_bug.cgi?id=121267 5 6 Reviewed by Beth Dakin. 7 8 view->resize() will call setNeedsLayout() if necessary, and may already have 9 done layout, so the extra setNeedsLayout() here was bad. 10 11 * WebProcess/WebPage/WebPage.cpp: 12 (WebKit::WebPage::setSize): 13 1 14 2013-09-12 Andre Moreira Magalhaes <andre.magalhaes@collabora.co.uk> 2 15 -
trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp
r155582 r155660 1069 1069 FrameView* view = m_page->mainFrame().view(); 1070 1070 view->resize(viewSize); 1071 view->setNeedsLayout();1072 1071 m_drawingArea->setNeedsDisplay(); 1073 1072
Note: See TracChangeset
for help on using the changeset viewer.