- Revision
- 170546
- Author
- bda...@apple.com
- Date
- 2014-06-27 12:22:44 -0700 (Fri, 27 Jun 2014)
Log Message
Custom scrollbars should not create ScrollbarPainters on Mac
https://bugs.webkit.org/show_bug.cgi?id=134406
-and corresponding-
<rdar://problem/16178301>
Reviewed by Tim Horton.
The solution here is to return early in ScrollbarThemeMac::registerScrollbar() if
the scrollbar is custom. However, since this function is called during the
RenderScrollbar and Scrollbar constructor, we need to re-implement
Scrollbar::isCustomScrollbar() to return a member variable that is passed into the
constructor. Otherwise, we will get Scrollbar’s implementation is
isCustomScrollbar() wrongfully returning false since instead of the derived
class’s implementation.
Scrollbar constructor now has an option parameter isCustomScrollbar that defaults
to false. That value is returned by isCustomScrollbar()
* platform/Scrollbar.cpp:
(WebCore::Scrollbar::Scrollbar):
* platform/Scrollbar.h:
Return early if this is a custom scrollbar since the rest of the function deals
with creating a native scrollbar and getting it in the right state.
* platform/mac/ScrollbarThemeMac.mm:
(WebCore::ScrollbarThemeMac::registerScrollbar):
Send true to the Scrollbar constructor to indicate that this is a custom
scrollbar.
* rendering/RenderScrollbar.cpp:
(WebCore::RenderScrollbar::RenderScrollbar):
* rendering/RenderScrollbar.h:
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (170545 => 170546)
--- trunk/Source/WebCore/ChangeLog 2014-06-27 19:17:44 UTC (rev 170545)
+++ trunk/Source/WebCore/ChangeLog 2014-06-27 19:22:44 UTC (rev 170546)
@@ -1,3 +1,37 @@
+2014-06-27 Beth Dakin <bda...@apple.com>
+
+ Custom scrollbars should not create ScrollbarPainters on Mac
+ https://bugs.webkit.org/show_bug.cgi?id=134406
+ -and corresponding-
+ <rdar://problem/16178301>
+
+ Reviewed by Tim Horton.
+
+ The solution here is to return early in ScrollbarThemeMac::registerScrollbar() if
+ the scrollbar is custom. However, since this function is called during the
+ RenderScrollbar and Scrollbar constructor, we need to re-implement
+ Scrollbar::isCustomScrollbar() to return a member variable that is passed into the
+ constructor. Otherwise, we will get Scrollbar’s implementation is
+ isCustomScrollbar() wrongfully returning false since instead of the derived
+ class’s implementation.
+
+ Scrollbar constructor now has an option parameter isCustomScrollbar that defaults
+ to false. That value is returned by isCustomScrollbar()
+ * platform/Scrollbar.cpp:
+ (WebCore::Scrollbar::Scrollbar):
+ * platform/Scrollbar.h:
+
+ Return early if this is a custom scrollbar since the rest of the function deals
+ with creating a native scrollbar and getting it in the right state.
+ * platform/mac/ScrollbarThemeMac.mm:
+ (WebCore::ScrollbarThemeMac::registerScrollbar):
+
+ Send true to the Scrollbar constructor to indicate that this is a custom
+ scrollbar.
+ * rendering/RenderScrollbar.cpp:
+ (WebCore::RenderScrollbar::RenderScrollbar):
+ * rendering/RenderScrollbar.h:
+
2014-06-27 Eric Carlson <eric.carl...@apple.com>
[Mac] AVMetadataKeySpaceISOUserData not defined on 10.8
Modified: trunk/Source/WebCore/platform/Scrollbar.cpp (170545 => 170546)
--- trunk/Source/WebCore/platform/Scrollbar.cpp 2014-06-27 19:17:44 UTC (rev 170545)
+++ trunk/Source/WebCore/platform/Scrollbar.cpp 2014-06-27 19:22:44 UTC (rev 170546)
@@ -56,7 +56,7 @@
}
Scrollbar::Scrollbar(ScrollableArea* scrollableArea, ScrollbarOrientation orientation, ScrollbarControlSize controlSize,
- ScrollbarTheme* theme)
+ ScrollbarTheme* theme, bool isCustomScrollbar)
: m_scrollableArea(scrollableArea)
, m_orientation(orientation)
, m_controlSize(controlSize)
@@ -79,6 +79,7 @@
, m_overlapsResizer(false)
, m_suppressInvalidation(false)
, m_isAlphaLocked(false)
+ , m_isCustomScrollbar(isCustomScrollbar)
{
if (!m_theme)
m_theme = ScrollbarTheme::theme();
Modified: trunk/Source/WebCore/platform/Scrollbar.h (170545 => 170546)
--- trunk/Source/WebCore/platform/Scrollbar.h 2014-06-27 19:17:44 UTC (rev 170545)
+++ trunk/Source/WebCore/platform/Scrollbar.h 2014-06-27 19:22:44 UTC (rev 170546)
@@ -72,7 +72,7 @@
virtual IntPoint convertFromContainingWindow(const IntPoint& windowPoint) override { return Widget::convertFromContainingWindow(windowPoint); }
- virtual bool isCustomScrollbar() const override { return false; }
+ virtual bool isCustomScrollbar() const override final { return m_isCustomScrollbar; }
virtual ScrollbarOrientation orientation() const override { return m_orientation; }
virtual int value() const override { return lroundf(m_currentPos); }
@@ -156,7 +156,7 @@
virtual bool supportsUpdateOnSecondaryThread() const;
protected:
- Scrollbar(ScrollableArea*, ScrollbarOrientation, ScrollbarControlSize, ScrollbarTheme* = 0);
+ Scrollbar(ScrollableArea*, ScrollbarOrientation, ScrollbarControlSize, ScrollbarTheme* = 0, bool isCustomScrollbar = false);
void updateThumb();
virtual void updateThumbPosition();
@@ -198,6 +198,8 @@
bool m_isAlphaLocked;
+ bool m_isCustomScrollbar;
+
private:
virtual bool isScrollbar() const override { return true; }
};
Modified: trunk/Source/WebCore/platform/mac/ScrollbarThemeMac.mm (170545 => 170546)
--- trunk/Source/WebCore/platform/mac/ScrollbarThemeMac.mm 2014-06-27 19:17:44 UTC (rev 170545)
+++ trunk/Source/WebCore/platform/mac/ScrollbarThemeMac.mm 2014-06-27 19:22:44 UTC (rev 170546)
@@ -156,6 +156,9 @@
void ScrollbarThemeMac::registerScrollbar(ScrollbarThemeClient* scrollbar)
{
+ if (scrollbar->isCustomScrollbar())
+ return;
+
bool isHorizontal = scrollbar->orientation() == HorizontalScrollbar;
ScrollbarPainter scrollbarPainter = [NSClassFromString(@"NSScrollerImp") scrollerImpWithStyle:recommendedScrollerStyle() controlSize:scrollbarControlSizeToNSControlSize(scrollbar->controlSize()) horizontal:isHorizontal replacingScrollerImp:nil];
scrollbarMap()->add(scrollbar, scrollbarPainter);
Modified: trunk/Source/WebCore/rendering/RenderScrollbar.cpp (170545 => 170546)
--- trunk/Source/WebCore/rendering/RenderScrollbar.cpp 2014-06-27 19:17:44 UTC (rev 170545)
+++ trunk/Source/WebCore/rendering/RenderScrollbar.cpp 2014-06-27 19:22:44 UTC (rev 170546)
@@ -42,7 +42,7 @@
}
RenderScrollbar::RenderScrollbar(ScrollableArea* scrollableArea, ScrollbarOrientation orientation, Element* ownerElement, Frame* owningFrame)
- : Scrollbar(scrollableArea, orientation, RegularScrollbar, RenderScrollbarTheme::renderScrollbarTheme())
+ : Scrollbar(scrollableArea, orientation, RegularScrollbar, RenderScrollbarTheme::renderScrollbarTheme(), true)
, m_ownerElement(ownerElement)
, m_owningFrame(owningFrame)
{
Modified: trunk/Source/WebCore/rendering/RenderScrollbar.h (170545 => 170546)
--- trunk/Source/WebCore/rendering/RenderScrollbar.h 2014-06-27 19:17:44 UTC (rev 170545)
+++ trunk/Source/WebCore/rendering/RenderScrollbar.h 2014-06-27 19:22:44 UTC (rev 170546)
@@ -74,8 +74,6 @@
virtual void styleChanged() override;
- virtual bool isCustomScrollbar() const override { return true; }
-
void updateScrollbarParts();
void updateScrollbarPart(ScrollbarPart);