Changeset 202725 in webkit


Ignore:
Timestamp:
Jun 30, 2016 11:58:29 PM (8 years ago)
Author:
akling@apple.com
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):

Location:
trunk/Source
Files:
10 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r202719 r202725  
     12016-07-01  Andreas Kling  <akling@apple.com>
     2
     3        [Mac] Get rid of the old timey rubber-banding linen pattern.
     4        <https://webkit.org/b/159329>
     5
     6        Reviewed by Benjamin Poulain.
     7
     8        Remove the "ScrollingOverhang" custom GraphicsLayer appearance since that was only used to
     9        install the old timey linen pattern behind the web content.
     10
     11        We now always just set the overhang area's background color to the document background color.
     12
     13        This fixes an issue where we could end up loading the linen pattern and keeping it in memory
     14        despite never actually showing it on screen.
     15
     16        * platform/ScrollbarTheme.h:
     17        (WebCore::ScrollbarTheme::setUpOverhangAreasLayerContents): Deleted.
     18        * platform/graphics/GraphicsLayer.cpp:
     19        * platform/graphics/GraphicsLayer.h:
     20        * platform/graphics/ca/cocoa/PlatformCALayerCocoa.mm:
     21        (PlatformCALayerCocoa::updateCustomAppearance):
     22        * platform/mac/ScrollbarThemeMac.h:
     23        * platform/mac/ScrollbarThemeMac.mm:
     24        (WebCore::linenBackgroundColor): Deleted.
     25        (WebCore::ScrollbarThemeMac::setUpOverhangAreaBackground): Deleted.
     26        (WebCore::ScrollbarThemeMac::removeOverhangAreaBackground): Deleted.
     27        (WebCore::ScrollbarThemeMac::setUpOverhangAreasLayerContents): Deleted.
     28        * rendering/RenderLayerCompositor.cpp:
     29        (WebCore::RenderLayerCompositor::updateOverflowControlsLayers):
     30        (WebCore::RenderLayerCompositor::setRootExtendedBackgroundColor):
     31
    1322016-06-30  Jiewen Tan  <jiewen_tan@apple.com>
    233
  • trunk/Source/WebCore/platform/ScrollbarTheme.h

    r196632 r202725  
    9292
    9393#if ENABLE(RUBBER_BANDING)
    94     virtual void setUpOverhangAreasLayerContents(GraphicsLayer*, const Color&) { }
    9594    virtual void setUpContentShadowLayer(GraphicsLayer*) { }
    9695#endif
  • trunk/Source/WebCore/platform/graphics/GraphicsLayer.cpp

    r201901 r202725  
    895895    switch (customAppearance) {
    896896    case GraphicsLayer::CustomAppearance::NoCustomAppearance: ts << "none"; break;
    897     case GraphicsLayer::CustomAppearance::ScrollingOverhang: ts << "scrolling-overhang"; break;
    898897    case GraphicsLayer::CustomAppearance::ScrollingShadow: ts << "scrolling-shadow"; break;
    899898    case GraphicsLayer::CustomAppearance::LightBackdropAppearance: ts << "light-backdrop"; break;
  • trunk/Source/WebCore/platform/graphics/GraphicsLayer.h

    r201901 r202725  
    482482    virtual void setDebugBorder(const Color&, float /*borderWidth*/) { }
    483483
    484     enum CustomAppearance { NoCustomAppearance, ScrollingOverhang, ScrollingShadow, LightBackdropAppearance, DarkBackdropAppearance };
     484    enum CustomAppearance { NoCustomAppearance, ScrollingShadow, LightBackdropAppearance, DarkBackdropAppearance };
    485485    virtual void setCustomAppearance(CustomAppearance customAppearance) { m_customAppearance = customAppearance; }
    486486    CustomAppearance customAppearance() const { return m_customAppearance; }
  • trunk/Source/WebCore/platform/graphics/ca/cocoa/PlatformCALayerCocoa.mm

    r201901 r202725  
    952952    case GraphicsLayer::LightBackdropAppearance:
    953953    case GraphicsLayer::DarkBackdropAppearance:
    954         ScrollbarThemeMac::removeOverhangAreaBackground(platformLayer());
    955954        ScrollbarThemeMac::removeOverhangAreaShadow(platformLayer());
    956         break;
    957     case GraphicsLayer::ScrollingOverhang:
    958         ScrollbarThemeMac::setUpOverhangAreaBackground(platformLayer());
    959955        break;
    960956    case GraphicsLayer::ScrollingShadow:
  • trunk/Source/WebCore/platform/mac/ScrollbarThemeMac.h

    r198859 r202725  
    6969
    7070#if ENABLE(RUBBER_BANDING)
    71     WEBCORE_EXPORT static void setUpOverhangAreaBackground(CALayer *, const Color& customBackgroundColor = Color());
    72     WEBCORE_EXPORT static void removeOverhangAreaBackground(CALayer *);
    73 
    7471    WEBCORE_EXPORT static void setUpOverhangAreaShadow(CALayer *);
    7572    WEBCORE_EXPORT static void removeOverhangAreaShadow(CALayer *);
     
    9390
    9491#if ENABLE(RUBBER_BANDING)
    95     void setUpOverhangAreasLayerContents(GraphicsLayer*, const Color&) override;
    9692    void setUpContentShadowLayer(GraphicsLayer*) override;
    9793#endif
  • trunk/Source/WebCore/platform/mac/ScrollbarThemeMac.mm

    r201038 r202725  
    4848using namespace WebCore;
    4949
    50 @interface NSColor (WebNSColorDetails)
    51 + (NSImage *)_linenPatternImage;
    52 @end
    53 
    5450namespace WebCore {
    5551
     
    565561
    566562#if ENABLE(RUBBER_BANDING)
    567 static RetainPtr<CGColorRef> linenBackgroundColor()
    568 {
    569     NSImage *image = nil;
    570     CGImageRef cgImage = nullptr;
    571     BEGIN_BLOCK_OBJC_EXCEPTIONS;
    572     image = [NSColor _linenPatternImage];
    573     cgImage = [image CGImageForProposedRect:NULL context:NULL hints:nil];
    574     END_BLOCK_OBJC_EXCEPTIONS;
    575    
    576     if (!cgImage)
    577         return nullptr;
    578 
    579     RetainPtr<CGPatternRef> pattern = adoptCF(wkCGPatternCreateWithImageAndTransform(cgImage, CGAffineTransformIdentity, wkPatternTilingNoDistortion));
    580     RetainPtr<CGColorSpaceRef> colorSpace = adoptCF(CGColorSpaceCreatePattern(0));
    581 
    582     const CGFloat alpha = 1.0;
    583     return adoptCF(CGColorCreateWithPattern(colorSpace.get(), pattern.get(), &alpha));
    584 }
    585 
    586 void ScrollbarThemeMac::setUpOverhangAreaBackground(CALayer *layer, const Color& customBackgroundColor)
    587 {
    588     static CGColorRef cachedLinenBackgroundColor = linenBackgroundColor().leakRef();
    589     // We operate on the CALayer directly here, since GraphicsLayer doesn't have the concept
    590     // of pattern images, and we know that WebCore won't touch this layer.
    591     layer.backgroundColor = customBackgroundColor.isValid() ? cachedCGColor(customBackgroundColor) : cachedLinenBackgroundColor;
    592 }
    593 
    594 void ScrollbarThemeMac::removeOverhangAreaBackground(CALayer *layer)
    595 {
    596     layer.backgroundColor = nil;
    597 }
    598 
    599563void ScrollbarThemeMac::setUpOverhangAreaShadow(CALayer *layer)
    600564{
     
    620584}
    621585
    622 void ScrollbarThemeMac::setUpOverhangAreasLayerContents(GraphicsLayer* graphicsLayer, const Color& customBackgroundColor)
    623 {
    624     ScrollbarThemeMac::setUpOverhangAreaBackground(graphicsLayer->platformLayer(), customBackgroundColor);
    625 }
    626 
    627586void ScrollbarThemeMac::setUpContentShadowLayer(GraphicsLayer* graphicsLayer)
    628587{
  • trunk/Source/WebCore/rendering/RenderLayerCompositor.cpp

    r200116 r202725  
    32713271
    32723272    m_layerForOverhangAreas->setBackgroundColor(m_rootExtendedBackgroundColor);
    3273 
    3274     if (!m_rootExtendedBackgroundColor.isValid())
    3275         m_layerForOverhangAreas->setCustomAppearance(GraphicsLayer::ScrollingOverhang);
    32763273#endif
    32773274}
     
    32943291            m_layerForOverhangAreas->setPosition(FloatPoint(0, topContentInset));
    32953292            m_layerForOverhangAreas->setAnchorPoint(FloatPoint3D());
    3296 
    3297             if (m_renderView.frameView().frame().settings().backgroundShouldExtendBeyondPage())
    3298                 m_layerForOverhangAreas->setBackgroundColor(m_renderView.frameView().documentBackgroundColor());
    3299             else
    3300                 m_layerForOverhangAreas->setCustomAppearance(GraphicsLayer::ScrollingOverhang);
     3293            m_layerForOverhangAreas->setBackgroundColor(m_renderView.frameView().documentBackgroundColor());
    33013294
    33023295            // We want the overhang areas layer to be positioned below the frame contents,
  • trunk/Source/WebKit2/ChangeLog

    r202724 r202725  
     12016-07-01  Andreas Kling  <akling@apple.com>
     2
     3        [Mac] Get rid of the old timey rubber-banding linen pattern.
     4        <https://webkit.org/b/159329>
     5
     6        Reviewed by Benjamin Poulain.
     7
     8        * Shared/mac/RemoteLayerTreePropertyApplier.mm:
     9        (WebKit::updateCustomAppearance):
     10
    1112016-06-30  Tina Liu  <iting_liu@apple.com>
    212
  • trunk/Source/WebKit2/Shared/mac/RemoteLayerTreePropertyApplier.mm

    r201901 r202725  
    112112    case GraphicsLayer::DarkBackdropAppearance:
    113113    case GraphicsLayer::LightBackdropAppearance:
    114         ScrollbarThemeMac::removeOverhangAreaBackground(layer);
    115114        ScrollbarThemeMac::removeOverhangAreaShadow(layer);
    116         break;
    117     case GraphicsLayer::ScrollingOverhang:
    118         ScrollbarThemeMac::setUpOverhangAreaBackground(layer);
    119115        break;
    120116    case GraphicsLayer::ScrollingShadow:
Note: See TracChangeset for help on using the changeset viewer.