Title: [202725] trunk/Source
Revision
202725
Author
akl...@apple.com
Date
2016-06-30 23:58:29 -0700 (Thu, 30 Jun 2016)

Log Message

[Mac] Get rid of the old timey rubber-banding linen pattern.
<https://webkit.org/b/159329>

Reviewed by Benjamin Poulain.

Source/WebCore:

Remove the "ScrollingOverhang" custom GraphicsLayer appearance since that was only used to
install the old timey linen pattern behind the web content.

We now always just set the overhang area's background color to the document background color.

This fixes an issue where we could end up loading the linen pattern and keeping it in memory
despite never actually showing it on screen.

* platform/ScrollbarTheme.h:
(WebCore::ScrollbarTheme::setUpOverhangAreasLayerContents): Deleted.
* platform/graphics/GraphicsLayer.cpp:
* platform/graphics/GraphicsLayer.h:
* platform/graphics/ca/cocoa/PlatformCALayerCocoa.mm:
(PlatformCALayerCocoa::updateCustomAppearance):
* platform/mac/ScrollbarThemeMac.h:
* platform/mac/ScrollbarThemeMac.mm:
(WebCore::linenBackgroundColor): Deleted.
(WebCore::ScrollbarThemeMac::setUpOverhangAreaBackground): Deleted.
(WebCore::ScrollbarThemeMac::removeOverhangAreaBackground): Deleted.
(WebCore::ScrollbarThemeMac::setUpOverhangAreasLayerContents): Deleted.
* rendering/RenderLayerCompositor.cpp:
(WebCore::RenderLayerCompositor::updateOverflowControlsLayers):
(WebCore::RenderLayerCompositor::setRootExtendedBackgroundColor):

Source/WebKit2:

* Shared/mac/RemoteLayerTreePropertyApplier.mm:
(WebKit::updateCustomAppearance):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (202724 => 202725)


--- trunk/Source/WebCore/ChangeLog	2016-07-01 05:23:02 UTC (rev 202724)
+++ trunk/Source/WebCore/ChangeLog	2016-07-01 06:58:29 UTC (rev 202725)
@@ -1,3 +1,34 @@
+2016-07-01  Andreas Kling  <akl...@apple.com>
+
+        [Mac] Get rid of the old timey rubber-banding linen pattern.
+        <https://webkit.org/b/159329>
+
+        Reviewed by Benjamin Poulain.
+
+        Remove the "ScrollingOverhang" custom GraphicsLayer appearance since that was only used to
+        install the old timey linen pattern behind the web content.
+
+        We now always just set the overhang area's background color to the document background color.
+
+        This fixes an issue where we could end up loading the linen pattern and keeping it in memory
+        despite never actually showing it on screen.
+
+        * platform/ScrollbarTheme.h:
+        (WebCore::ScrollbarTheme::setUpOverhangAreasLayerContents): Deleted.
+        * platform/graphics/GraphicsLayer.cpp:
+        * platform/graphics/GraphicsLayer.h:
+        * platform/graphics/ca/cocoa/PlatformCALayerCocoa.mm:
+        (PlatformCALayerCocoa::updateCustomAppearance):
+        * platform/mac/ScrollbarThemeMac.h:
+        * platform/mac/ScrollbarThemeMac.mm:
+        (WebCore::linenBackgroundColor): Deleted.
+        (WebCore::ScrollbarThemeMac::setUpOverhangAreaBackground): Deleted.
+        (WebCore::ScrollbarThemeMac::removeOverhangAreaBackground): Deleted.
+        (WebCore::ScrollbarThemeMac::setUpOverhangAreasLayerContents): Deleted.
+        * rendering/RenderLayerCompositor.cpp:
+        (WebCore::RenderLayerCompositor::updateOverflowControlsLayers):
+        (WebCore::RenderLayerCompositor::setRootExtendedBackgroundColor):
+
 2016-06-30  Jiewen Tan  <jiewen_...@apple.com>
 
         Create a generic "linked-on-or-after" check for new CSP Rules

Modified: trunk/Source/WebCore/platform/ScrollbarTheme.h (202724 => 202725)


--- trunk/Source/WebCore/platform/ScrollbarTheme.h	2016-07-01 05:23:02 UTC (rev 202724)
+++ trunk/Source/WebCore/platform/ScrollbarTheme.h	2016-07-01 06:58:29 UTC (rev 202725)
@@ -91,7 +91,6 @@
     virtual void paintOverhangAreas(ScrollView&, GraphicsContext&, const IntRect&, const IntRect&, const IntRect&) { }
 
 #if ENABLE(RUBBER_BANDING)
-    virtual void setUpOverhangAreasLayerContents(GraphicsLayer*, const Color&) { }
     virtual void setUpContentShadowLayer(GraphicsLayer*) { }
 #endif
 

Modified: trunk/Source/WebCore/platform/graphics/GraphicsLayer.cpp (202724 => 202725)


--- trunk/Source/WebCore/platform/graphics/GraphicsLayer.cpp	2016-07-01 05:23:02 UTC (rev 202724)
+++ trunk/Source/WebCore/platform/graphics/GraphicsLayer.cpp	2016-07-01 06:58:29 UTC (rev 202725)
@@ -894,7 +894,6 @@
 {
     switch (customAppearance) {
     case GraphicsLayer::CustomAppearance::NoCustomAppearance: ts << "none"; break;
-    case GraphicsLayer::CustomAppearance::ScrollingOverhang: ts << "scrolling-overhang"; break;
     case GraphicsLayer::CustomAppearance::ScrollingShadow: ts << "scrolling-shadow"; break;
     case GraphicsLayer::CustomAppearance::LightBackdropAppearance: ts << "light-backdrop"; break;
     case GraphicsLayer::CustomAppearance::DarkBackdropAppearance: ts << "dark-backdrop"; break;

Modified: trunk/Source/WebCore/platform/graphics/GraphicsLayer.h (202724 => 202725)


--- trunk/Source/WebCore/platform/graphics/GraphicsLayer.h	2016-07-01 05:23:02 UTC (rev 202724)
+++ trunk/Source/WebCore/platform/graphics/GraphicsLayer.h	2016-07-01 06:58:29 UTC (rev 202725)
@@ -481,7 +481,7 @@
     virtual void setDebugBackgroundColor(const Color&) { }
     virtual void setDebugBorder(const Color&, float /*borderWidth*/) { }
 
-    enum CustomAppearance { NoCustomAppearance, ScrollingOverhang, ScrollingShadow, LightBackdropAppearance, DarkBackdropAppearance };
+    enum CustomAppearance { NoCustomAppearance, ScrollingShadow, LightBackdropAppearance, DarkBackdropAppearance };
     virtual void setCustomAppearance(CustomAppearance customAppearance) { m_customAppearance = customAppearance; }
     CustomAppearance customAppearance() const { return m_customAppearance; }
 

Modified: trunk/Source/WebCore/platform/graphics/ca/cocoa/PlatformCALayerCocoa.mm (202724 => 202725)


--- trunk/Source/WebCore/platform/graphics/ca/cocoa/PlatformCALayerCocoa.mm	2016-07-01 05:23:02 UTC (rev 202724)
+++ trunk/Source/WebCore/platform/graphics/ca/cocoa/PlatformCALayerCocoa.mm	2016-07-01 06:58:29 UTC (rev 202725)
@@ -951,12 +951,8 @@
     case GraphicsLayer::NoCustomAppearance:
     case GraphicsLayer::LightBackdropAppearance:
     case GraphicsLayer::DarkBackdropAppearance:
-        ScrollbarThemeMac::removeOverhangAreaBackground(platformLayer());
         ScrollbarThemeMac::removeOverhangAreaShadow(platformLayer());
         break;
-    case GraphicsLayer::ScrollingOverhang:
-        ScrollbarThemeMac::setUpOverhangAreaBackground(platformLayer());
-        break;
     case GraphicsLayer::ScrollingShadow:
         ScrollbarThemeMac::setUpOverhangAreaShadow(platformLayer());
         break;

Modified: trunk/Source/WebCore/platform/mac/ScrollbarThemeMac.h (202724 => 202725)


--- trunk/Source/WebCore/platform/mac/ScrollbarThemeMac.h	2016-07-01 05:23:02 UTC (rev 202724)
+++ trunk/Source/WebCore/platform/mac/ScrollbarThemeMac.h	2016-07-01 06:58:29 UTC (rev 202725)
@@ -68,9 +68,6 @@
     bool isLayoutDirectionRTL(Scrollbar&);
 
 #if ENABLE(RUBBER_BANDING)
-    WEBCORE_EXPORT static void setUpOverhangAreaBackground(CALayer *, const Color& customBackgroundColor = Color());
-    WEBCORE_EXPORT static void removeOverhangAreaBackground(CALayer *);
-
     WEBCORE_EXPORT static void setUpOverhangAreaShadow(CALayer *);
     WEBCORE_EXPORT static void removeOverhangAreaShadow(CALayer *);
 #endif
@@ -92,7 +89,6 @@
     int scrollbarPartToHIPressedState(ScrollbarPart);
 
 #if ENABLE(RUBBER_BANDING)
-    void setUpOverhangAreasLayerContents(GraphicsLayer*, const Color&) override;
     void setUpContentShadowLayer(GraphicsLayer*) override;
 #endif
 };

Modified: trunk/Source/WebCore/platform/mac/ScrollbarThemeMac.mm (202724 => 202725)


--- trunk/Source/WebCore/platform/mac/ScrollbarThemeMac.mm	2016-07-01 05:23:02 UTC (rev 202724)
+++ trunk/Source/WebCore/platform/mac/ScrollbarThemeMac.mm	2016-07-01 06:58:29 UTC (rev 202725)
@@ -47,10 +47,6 @@
 
 using namespace WebCore;
 
-@interface NSColor (WebNSColorDetails)
-+ (NSImage *)_linenPatternImage;
-@end
-
 namespace WebCore {
 
 typedef HashMap<Scrollbar*, RetainPtr<NSScrollerImp>> ScrollerImpMap;
@@ -564,38 +560,6 @@
 }
 
 #if ENABLE(RUBBER_BANDING)
-static RetainPtr<CGColorRef> linenBackgroundColor()
-{
-    NSImage *image = nil;
-    CGImageRef cgImage = nullptr;
-    BEGIN_BLOCK_OBJC_EXCEPTIONS;
-    image = [NSColor _linenPatternImage];
-    cgImage = [image CGImageForProposedRect:NULL context:NULL hints:nil];
-    END_BLOCK_OBJC_EXCEPTIONS;
-    
-    if (!cgImage)
-        return nullptr;
-
-    RetainPtr<CGPatternRef> pattern = adoptCF(wkCGPatternCreateWithImageAndTransform(cgImage, CGAffineTransformIdentity, wkPatternTilingNoDistortion));
-    RetainPtr<CGColorSpaceRef> colorSpace = adoptCF(CGColorSpaceCreatePattern(0));
-
-    const CGFloat alpha = 1.0;
-    return adoptCF(CGColorCreateWithPattern(colorSpace.get(), pattern.get(), &alpha));
-}
-
-void ScrollbarThemeMac::setUpOverhangAreaBackground(CALayer *layer, const Color& customBackgroundColor)
-{
-    static CGColorRef cachedLinenBackgroundColor = linenBackgroundColor().leakRef();
-    // We operate on the CALayer directly here, since GraphicsLayer doesn't have the concept
-    // of pattern images, and we know that WebCore won't touch this layer.
-    layer.backgroundColor = customBackgroundColor.isValid() ? cachedCGColor(customBackgroundColor) : cachedLinenBackgroundColor;
-}
-
-void ScrollbarThemeMac::removeOverhangAreaBackground(CALayer *layer)
-{
-    layer.backgroundColor = nil;
-}
-
 void ScrollbarThemeMac::setUpOverhangAreaShadow(CALayer *layer)
 {
     static const CGFloat shadowOpacity = 0.66;
@@ -619,11 +583,6 @@
     layer.shadowOpacity = 0;
 }
 
-void ScrollbarThemeMac::setUpOverhangAreasLayerContents(GraphicsLayer* graphicsLayer, const Color& customBackgroundColor)
-{
-    ScrollbarThemeMac::setUpOverhangAreaBackground(graphicsLayer->platformLayer(), customBackgroundColor);
-}
-
 void ScrollbarThemeMac::setUpContentShadowLayer(GraphicsLayer* graphicsLayer)
 {
     // We operate on the CALayer directly here, since GraphicsLayer doesn't have the concept

Modified: trunk/Source/WebCore/rendering/RenderLayerCompositor.cpp (202724 => 202725)


--- trunk/Source/WebCore/rendering/RenderLayerCompositor.cpp	2016-07-01 05:23:02 UTC (rev 202724)
+++ trunk/Source/WebCore/rendering/RenderLayerCompositor.cpp	2016-07-01 06:58:29 UTC (rev 202725)
@@ -3270,9 +3270,6 @@
         return;
 
     m_layerForOverhangAreas->setBackgroundColor(m_rootExtendedBackgroundColor);
-
-    if (!m_rootExtendedBackgroundColor.isValid())
-        m_layerForOverhangAreas->setCustomAppearance(GraphicsLayer::ScrollingOverhang);
 #endif
 }
 
@@ -3293,12 +3290,8 @@
             m_layerForOverhangAreas->setSize(overhangAreaSize);
             m_layerForOverhangAreas->setPosition(FloatPoint(0, topContentInset));
             m_layerForOverhangAreas->setAnchorPoint(FloatPoint3D());
+            m_layerForOverhangAreas->setBackgroundColor(m_renderView.frameView().documentBackgroundColor());
 
-            if (m_renderView.frameView().frame().settings().backgroundShouldExtendBeyondPage())
-                m_layerForOverhangAreas->setBackgroundColor(m_renderView.frameView().documentBackgroundColor());
-            else
-                m_layerForOverhangAreas->setCustomAppearance(GraphicsLayer::ScrollingOverhang);
-
             // We want the overhang areas layer to be positioned below the frame contents,
             // so insert it below the clip layer.
             m_overflowControlsHostLayer->addChildBelow(m_layerForOverhangAreas.get(), m_clipLayer.get());

Modified: trunk/Source/WebKit2/ChangeLog (202724 => 202725)


--- trunk/Source/WebKit2/ChangeLog	2016-07-01 05:23:02 UTC (rev 202724)
+++ trunk/Source/WebKit2/ChangeLog	2016-07-01 06:58:29 UTC (rev 202725)
@@ -1,3 +1,13 @@
+2016-07-01  Andreas Kling  <akl...@apple.com>
+
+        [Mac] Get rid of the old timey rubber-banding linen pattern.
+        <https://webkit.org/b/159329>
+
+        Reviewed by Benjamin Poulain.
+
+        * Shared/mac/RemoteLayerTreePropertyApplier.mm:
+        (WebKit::updateCustomAppearance):
+
 2016-06-30  Tina Liu  <iting_...@apple.com>
 
         Add SPI to allow restoring session state without navigation in WKPage

Modified: trunk/Source/WebKit2/Shared/mac/RemoteLayerTreePropertyApplier.mm (202724 => 202725)


--- trunk/Source/WebKit2/Shared/mac/RemoteLayerTreePropertyApplier.mm	2016-07-01 05:23:02 UTC (rev 202724)
+++ trunk/Source/WebKit2/Shared/mac/RemoteLayerTreePropertyApplier.mm	2016-07-01 06:58:29 UTC (rev 202725)
@@ -111,12 +111,8 @@
     case GraphicsLayer::NoCustomAppearance:
     case GraphicsLayer::DarkBackdropAppearance:
     case GraphicsLayer::LightBackdropAppearance:
-        ScrollbarThemeMac::removeOverhangAreaBackground(layer);
         ScrollbarThemeMac::removeOverhangAreaShadow(layer);
         break;
-    case GraphicsLayer::ScrollingOverhang:
-        ScrollbarThemeMac::setUpOverhangAreaBackground(layer);
-        break;
     case GraphicsLayer::ScrollingShadow:
         ScrollbarThemeMac::setUpOverhangAreaShadow(layer);
         break;
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to