Changeset 269437 in webkit
- Timestamp:
- Nov 5, 2020 8:58:46 AM (21 months ago)
- Location:
- trunk
- Files:
-
- 2 added
- 9 edited
-
LayoutTests/ChangeLog (modified) (1 diff)
-
LayoutTests/fast/scrolling/mac/overflow-scrollbars-toggle-dark-mode-expected.html (added)
-
LayoutTests/fast/scrolling/mac/overflow-scrollbars-toggle-dark-mode.html (added)
-
Source/WebCore/ChangeLog (modified) (1 diff)
-
Source/WebCore/dom/Document.cpp (modified) (1 diff)
-
Source/WebCore/dom/Document.h (modified) (1 diff)
-
Source/WebCore/page/FrameView.cpp (modified) (1 diff)
-
Source/WebCore/page/FrameView.h (modified) (1 diff)
-
Source/WebCore/page/Page.cpp (modified) (1 diff)
-
Source/WebCore/platform/ScrollableArea.cpp (modified) (1 diff)
-
Source/WebCore/platform/ScrollableArea.h (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r269436 r269437 1 2020-11-05 Aditya Keerthi <akeerthi@apple.com> 2 3 [macOS] Toggling dark mode does not update the scrollbar appearance in overflow: scroll elements 4 https://bugs.webkit.org/show_bug.cgi?id=218538 5 <rdar://problem/68953006> 6 7 Reviewed by Simon Fraser. 8 9 Added a layout test which draws a scrollbar in the dark appearance, 10 switches to the light appearance, and draws the scrollbar again. The 11 final image should have a light appearance scrollbar. 12 13 * fast/scrolling/mac/overflow-scrollbars-toggle-dark-mode-expected.html: Added. 14 * fast/scrolling/mac/overflow-scrollbars-toggle-dark-mode.html: Added. 15 1 16 2020-11-05 Youenn Fablet <youenn@apple.com> 2 17 -
trunk/Source/WebCore/ChangeLog
r269435 r269437 1 2020-11-05 Aditya Keerthi <akeerthi@apple.com> 2 3 [macOS] Toggling dark mode does not update the scrollbar appearance in overflow: scroll elements 4 https://bugs.webkit.org/show_bug.cgi?id=218538 5 <rdar://problem/68953006> 6 7 Reviewed by Simon Fraser. 8 9 This functionality regressed in r260276 with the introduction of async 10 overflow scrolling on macOS. The appearance of the scrollbar is determined 11 by [WebScrollerImpDelegate effectiveAppearanceForScrollerImp:]. Prior to 12 r260276, ScrollbarThemeMac::paint was responsible for painting the scrollbar, 13 using [NSScrollerImp drawKnob]. Calling this method results in a call to 14 effectiveAppearanceForScrollerImp:, ensuring the scrollbar has the correct 15 appearance. 16 17 However, async overflow scrolling no longer paints the scrollbar using 18 drawKnob, and a call to effectiveAppearanceForScrollImp: is no longer made 19 when switching between light/dark appearances. Since we no longer draw the 20 knob ourselves, and the NSScrollerImp does not belong to an NSView, the 21 scrollbar does not automatically get repainted on an appearance change. 22 To fix, we need to ensure the scrollbar is repainted by making a call to 23 [NSScrollerImp setNeedsDisplay:] when the page's appearance changes. This 24 should be done for all scrollbars to ensure their appearance is up to date. 25 26 Note that hovering over the scrollbar still results in an update to its 27 appearance, since AppKit always repaints the scrollbar on hover. 28 29 Test: fast/scrolling/mac/overflow-scrollbars-toggle-dark-mode.html 30 31 * dom/Document.cpp: 32 (WebCore::Document::invalidateScrollbars): Tell the FrameView to invalidate scrollbars in all its ScrollableAreas. 33 * dom/Document.h: 34 * page/FrameView.cpp: 35 (WebCore::FrameView::invalidateScrollbarsForAllScrollableAreas): 36 * page/FrameView.h: 37 * page/Page.cpp: 38 (WebCore::Page::appearanceDidChange): Tell each document to invalidate its scrollbars. 39 * platform/ScrollableArea.cpp: 40 (WebCore::ScrollableArea::setScrollbarOverlayStyle): 41 (WebCore::ScrollableArea::invalidateScrollbars): 42 43 Moved scrollbar invalidation out of setScrollbarOverlayStyle and into 44 its own method, so that it can be called for all ScrollableAreas in a 45 FrameView. 46 47 * platform/ScrollableArea.h: 48 1 49 2020-11-05 Alex Christensen <achristensen@webkit.org> 2 50 -
trunk/Source/WebCore/dom/Document.cpp
r269435 r269437 4157 4157 } 4158 4158 4159 void Document::invalidateScrollbars() 4160 { 4161 if (auto* frameView = view()) 4162 frameView->invalidateScrollbarsForAllScrollableAreas(); 4163 } 4164 4159 4165 void Document::addAudioProducer(MediaProducer& audioProducer) 4160 4166 { -
trunk/Source/WebCore/dom/Document.h
r269435 r269437 1370 1370 void runScrollSteps(); 1371 1371 1372 void invalidateScrollbars(); 1373 1372 1374 WEBCORE_EXPORT void addAudioProducer(MediaProducer&); 1373 1375 WEBCORE_EXPORT void removeAudioProducer(MediaProducer&); -
trunk/Source/WebCore/page/FrameView.cpp
r269160 r269437 817 817 } 818 818 819 void FrameView::invalidateScrollbarsForAllScrollableAreas() 820 { 821 if (!m_scrollableAreas) 822 return; 823 824 for (auto* scrollableArea : *m_scrollableAreas) 825 scrollableArea->invalidateScrollbars(); 826 } 827 819 828 GraphicsLayer* FrameView::layerForHorizontalScrollbar() const 820 829 { -
trunk/Source/WebCore/page/FrameView.h
r268031 r269437 669 669 void invalidateImagesWithAsyncDecodes() { traverseForPaintInvalidation(GraphicsContext::PaintInvalidationReasons::InvalidatingImagesWithAsyncDecodes); } 670 670 671 void invalidateScrollbarsForAllScrollableAreas(); 672 671 673 GraphicsLayer* layerForHorizontalScrollbar() const final; 672 674 GraphicsLayer* layerForVerticalScrollbar() const final; -
trunk/Source/WebCore/page/Page.cpp
r269348 r269437 3012 3012 document.updateElementsAffectedByMediaQueries(); 3013 3013 document.scheduleRenderingUpdate(RenderingUpdateStep::MediaQueryEvaluation); 3014 document.invalidateScrollbars(); 3014 3015 }); 3015 3016 } -
trunk/Source/WebCore/platform/ScrollableArea.cpp
r269373 r269437 369 369 m_scrollbarOverlayStyle = overlayStyle; 370 370 371 if (horizontalScrollbar()) { 372 ScrollbarTheme::theme().updateScrollbarOverlayStyle(*horizontalScrollbar()); 373 horizontalScrollbar()->invalidate(); 374 if (ScrollAnimator* scrollAnimator = existingScrollAnimator()) 375 scrollAnimator->invalidateScrollbarPartLayers(horizontalScrollbar()); 376 } 377 378 if (verticalScrollbar()) { 379 ScrollbarTheme::theme().updateScrollbarOverlayStyle(*verticalScrollbar()); 380 verticalScrollbar()->invalidate(); 381 if (ScrollAnimator* scrollAnimator = existingScrollAnimator()) 382 scrollAnimator->invalidateScrollbarPartLayers(verticalScrollbar()); 371 if (auto* scrollbar = horizontalScrollbar()) 372 ScrollbarTheme::theme().updateScrollbarOverlayStyle(*scrollbar); 373 374 if (auto* scrollbar = verticalScrollbar()) 375 ScrollbarTheme::theme().updateScrollbarOverlayStyle(*scrollbar); 376 377 invalidateScrollbars(); 378 } 379 380 void ScrollableArea::invalidateScrollbars() 381 { 382 if (auto* scrollbar = horizontalScrollbar()) { 383 scrollbar->invalidate(); 384 if (auto* scrollAnimator = existingScrollAnimator()) 385 scrollAnimator->invalidateScrollbarPartLayers(scrollbar); 386 } 387 388 if (auto* scrollbar = verticalScrollbar()) { 389 scrollbar->invalidate(); 390 if (auto* scrollAnimator = existingScrollAnimator()) 391 scrollAnimator->invalidateScrollbarPartLayers(scrollbar); 383 392 } 384 393 } -
trunk/Source/WebCore/platform/ScrollableArea.h
r269373 r269437 172 172 WEBCORE_EXPORT virtual void setScrollbarOverlayStyle(ScrollbarOverlayStyle); 173 173 ScrollbarOverlayStyle scrollbarOverlayStyle() const { return static_cast<ScrollbarOverlayStyle>(m_scrollbarOverlayStyle); } 174 void invalidateScrollbars(); 174 175 bool useDarkAppearanceForScrollbars() const; 175 176
Note: See TracChangeset
for help on using the changeset viewer.