Diff
Modified: trunk/Source/WebCore/ChangeLog (160671 => 160672)
--- trunk/Source/WebCore/ChangeLog 2013-12-17 00:06:20 UTC (rev 160671)
+++ trunk/Source/WebCore/ChangeLog 2013-12-17 00:13:38 UTC (rev 160672)
@@ -1,3 +1,55 @@
+2013-12-16 Simon Fraser <[email protected]>
+
+ Apply overhang shadow and linen to UI-side layers
+ https://bugs.webkit.org/show_bug.cgi?id=125807
+
+ Reviewed by Tim Horton.
+
+ With UI-side compositing, we need to apply the overhang shadow and linen
+ background to layers in the UI process. Achieve this by setting a "custom
+ appearance" flag on layers that need a shadow or linen background, and
+ migrating this flag to the UI process. Static functions on ScrollbarThemeMac
+ are exposed to do the actual setting.
+
+ * WebCore.exp.in: Export ScrollbarThemeMac and GraphicsLayerCA functions.
+ * WebCore.xcodeproj/project.pbxproj: ScrollbarThemeMac.h and ScrollbarThemeComposite.h
+ need to be Private.
+ * platform/graphics/GraphicsLayer.cpp: Initialize m_customAppearance.
+ (WebCore::GraphicsLayer::GraphicsLayer):
+ * platform/graphics/GraphicsLayer.h: Getter/setter for CustomAppearance.
+ (WebCore::GraphicsLayer::setCustomAppearance):
+ (WebCore::GraphicsLayer::customAppearance):
+ * platform/graphics/ca/GraphicsLayerCA.cpp: Update CustomAppearanceChanged as
+ we do other properties.
+ (WebCore::GraphicsLayerCA::commitLayerChangesBeforeSublayers):
+ (WebCore::GraphicsLayerCA::updateCustomAppearance):
+ (WebCore::GraphicsLayerCA::setCustomAppearance):
+ * platform/graphics/ca/GraphicsLayerCA.h:
+ * platform/graphics/ca/PlatformCALayer.h:
+ * platform/graphics/ca/mac/PlatformCALayerMac.h:
+ * platform/graphics/ca/mac/PlatformCALayerMac.mm: When we have a custom
+ appearance, use ScrollbarThemeMac functions to update the layer. Ensure
+ that if the bounds change, we update the shadow (whose path depends on the bounds).
+ (PlatformCALayerMac::PlatformCALayerMac):
+ (PlatformCALayerMac::clone):
+ (PlatformCALayerMac::setBounds):
+ (PlatformCALayerMac::requiresCustomAppearanceUpdateOnBoundsChange):
+ (PlatformCALayerMac::updateCustomAppearance):
+ * platform/mac/ScrollbarThemeMac.h: Export some static functions.
+ * platform/mac/ScrollbarThemeMac.mm: Change code to use static functions.
+ (WebCore::ScrollbarThemeMac::setUpOverhangAreaBackground):
+ (WebCore::ScrollbarThemeMac::removeOverhangAreaBackground):
+ (WebCore::ScrollbarThemeMac::setUpOverhangAreaShadow):
+ (WebCore::ScrollbarThemeMac::removeOverhangAreaShadow):
+ (WebCore::ScrollbarThemeMac::setUpOverhangAreasLayerContents):
+ (WebCore::ScrollbarThemeMac::setUpContentShadowLayer):
+ * rendering/RenderLayerCompositor.cpp:
+ (WebCore::RenderLayerCompositor::updateRootLayerPosition): No need to call
+ setUpContentShadowLayer() now when size changes; PlatformCALayer takes
+ care of that.
+ (WebCore::RenderLayerCompositor::updateOverflowControlsLayers): Now set
+ custom appearance via GraphicsLayer.
+
2013-12-16 Brent Fulgham <[email protected]>
[Win] Remove dead code after converstion to VS2013
Modified: trunk/Source/WebCore/WebCore.exp.in (160671 => 160672)
--- trunk/Source/WebCore/WebCore.exp.in 2013-12-17 00:06:20 UTC (rev 160671)
+++ trunk/Source/WebCore/WebCore.exp.in 2013-12-17 00:13:38 UTC (rev 160672)
@@ -403,6 +403,10 @@
__ZN7WebCore14ScrollableAreaC2Ev
__ZN7WebCore14ScrollableAreaD2Ev
__ZN7WebCore14ScrollbarTheme5themeEv
+__ZN7WebCore17ScrollbarThemeMac28removeOverhangAreaBackgroundEP7CALayer
+__ZN7WebCore17ScrollbarThemeMac24removeOverhangAreaShadowEP7CALayer
+__ZN7WebCore17ScrollbarThemeMac27setUpOverhangAreaBackgroundEP7CALayerRKNS_5ColorE
+__ZN7WebCore17ScrollbarThemeMac23setUpOverhangAreaShadowEP7CALayer
__ZN7WebCore14SecurityOrigin16createFromStringERKN3WTF6StringE
__ZN7WebCore14SecurityOrigin28createFromDatabaseIdentifierERKN3WTF6StringE
__ZN7WebCore14SecurityOrigin6createERKN3WTF6StringES4_i
@@ -566,6 +570,7 @@
__ZN7WebCore15GraphicsLayerCA8addChildEPNS_13GraphicsLayerE
__ZN7WebCore15GraphicsLayerCAC2EPNS_19GraphicsLayerClientE
__ZN7WebCore15GraphicsLayerCAD2Ev
+__ZN7WebCore15GraphicsLayerCA19setCustomAppearanceENS_13GraphicsLayer16CustomAppearanceE
__ZN7WebCore15HitTestLocation12rectForPointERKNS_11LayoutPointEjjjj
__ZN7WebCore15JSDOMWindowBase8commonVMEv
__ZN7WebCore15PasteboardImageC1Ev
Modified: trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj (160671 => 160672)
--- trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj 2013-12-17 00:06:20 UTC (rev 160671)
+++ trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj 2013-12-17 00:13:38 UTC (rev 160672)
@@ -4754,7 +4754,7 @@
BC128A73137C867C00CAC845 /* RenderGrid.h in Headers */ = {isa = PBXBuildFile; fileRef = BC128A72137C867C00CAC845 /* RenderGrid.h */; };
BC128B01137C8D4600CAC845 /* RenderGrid.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BC128B00137C8D4600CAC845 /* RenderGrid.cpp */; };
BC14028A0E83680800319717 /* ScrollbarThemeComposite.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BC1402880E83680800319717 /* ScrollbarThemeComposite.cpp */; };
- BC14028B0E83680800319717 /* ScrollbarThemeComposite.h in Headers */ = {isa = PBXBuildFile; fileRef = BC1402890E83680800319717 /* ScrollbarThemeComposite.h */; };
+ BC14028B0E83680800319717 /* ScrollbarThemeComposite.h in Headers */ = {isa = PBXBuildFile; fileRef = BC1402890E83680800319717 /* ScrollbarThemeComposite.h */; settings = {ATTRIBUTES = (Private, ); }; };
BC17F9660B64EBB8004A65CB /* JSHTMLSelectElementCustom.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BC17F9650B64EBB8004A65CB /* JSHTMLSelectElementCustom.cpp */; };
BC1A37AD097C715F0019F3D8 /* DOM.h in Headers */ = {isa = PBXBuildFile; fileRef = BC1A3797097C715F0019F3D8 /* DOM.h */; settings = {ATTRIBUTES = (Private, ); }; };
BC1A37AE097C715F0019F3D8 /* DOM.mm in Sources */ = {isa = PBXBuildFile; fileRef = BC1A3798097C715F0019F3D8 /* DOM.mm */; };
@@ -4976,7 +4976,7 @@
BC85F23D151915E000BC17BE /* RenderNamedFlowThread.h in Headers */ = {isa = PBXBuildFile; fileRef = BC85F23C151915E000BC17BE /* RenderNamedFlowThread.h */; };
BC8AE34E12EA096A00EB3AE6 /* ScrollableArea.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BC8AE34C12EA096A00EB3AE6 /* ScrollableArea.cpp */; };
BC8AE34F12EA096A00EB3AE6 /* ScrollableArea.h in Headers */ = {isa = PBXBuildFile; fileRef = BC8AE34D12EA096A00EB3AE6 /* ScrollableArea.h */; settings = {ATTRIBUTES = (Private, ); }; };
- BC8B853E0E7C7F1100AB6984 /* ScrollbarThemeMac.h in Headers */ = {isa = PBXBuildFile; fileRef = BC8B853C0E7C7F1100AB6984 /* ScrollbarThemeMac.h */; };
+ BC8B853E0E7C7F1100AB6984 /* ScrollbarThemeMac.h in Headers */ = {isa = PBXBuildFile; fileRef = BC8B853C0E7C7F1100AB6984 /* ScrollbarThemeMac.h */; settings = {ATTRIBUTES = (Private, ); }; };
BC8B854B0E7C7F5600AB6984 /* ScrollbarTheme.h in Headers */ = {isa = PBXBuildFile; fileRef = BC8B854A0E7C7F5600AB6984 /* ScrollbarTheme.h */; settings = {ATTRIBUTES = (Private, ); }; };
BC8BF151105813BF00A40A07 /* UserStyleSheet.h in Headers */ = {isa = PBXBuildFile; fileRef = BC8BF150105813BF00A40A07 /* UserStyleSheet.h */; settings = {ATTRIBUTES = (Private, ); }; };
BC8BF15A1058141800A40A07 /* UserStyleSheetTypes.h in Headers */ = {isa = PBXBuildFile; fileRef = BC8BF1591058141800A40A07 /* UserStyleSheetTypes.h */; settings = {ATTRIBUTES = (Private, ); }; };
Modified: trunk/Source/WebCore/platform/graphics/GraphicsLayer.cpp (160671 => 160672)
--- trunk/Source/WebCore/platform/graphics/GraphicsLayer.cpp 2013-12-17 00:06:20 UTC (rev 160671)
+++ trunk/Source/WebCore/platform/graphics/GraphicsLayer.cpp 2013-12-17 00:13:38 UTC (rev 160672)
@@ -97,6 +97,7 @@
, m_replicaLayer(0)
, m_replicatedLayer(0)
, m_repaintCount(0)
+ , m_customAppearance(NoCustomAppearance)
{
#ifndef NDEBUG
if (m_client)
Modified: trunk/Source/WebCore/platform/graphics/GraphicsLayer.h (160671 => 160672)
--- trunk/Source/WebCore/platform/graphics/GraphicsLayer.h 2013-12-17 00:06:20 UTC (rev 160671)
+++ trunk/Source/WebCore/platform/graphics/GraphicsLayer.h 2013-12-17 00:13:38 UTC (rev 160672)
@@ -421,6 +421,10 @@
virtual void setDebugBackgroundColor(const Color&) { }
virtual void setDebugBorder(const Color&, float /*borderWidth*/) { }
+ enum CustomAppearance { NoCustomAppearance, ScrollingOverhang, ScrollingShadow };
+ virtual void setCustomAppearance(CustomAppearance customAppearance) { m_customAppearance = customAppearance; }
+ CustomAppearance customAppearance() const { return m_customAppearance; }
+
// z-position is the z-equivalent of position(). It's only used for debugging purposes.
virtual float zPosition() const { return m_zPosition; }
virtual void setZPosition(float);
@@ -577,6 +581,7 @@
IntSize m_contentsTileSize;
int m_repaintCount;
+ CustomAppearance m_customAppearance;
};
Modified: trunk/Source/WebCore/platform/graphics/ca/GraphicsLayerCA.cpp (160671 => 160672)
--- trunk/Source/WebCore/platform/graphics/ca/GraphicsLayerCA.cpp 2013-12-17 00:06:20 UTC (rev 160671)
+++ trunk/Source/WebCore/platform/graphics/ca/GraphicsLayerCA.cpp 2013-12-17 00:13:38 UTC (rev 160672)
@@ -1365,6 +1365,9 @@
if (m_uncommittedChanges & DebugIndicatorsChanged)
updateDebugBorder();
+ if (m_uncommittedChanges & CustomAppearanceChanged)
+ updateCustomAppearance();
+
if (m_uncommittedChanges & ChildrenChanged) {
updateSublayerList();
// Sublayers may set this flag again, so clear it to avoid always updating sublayers in commitLayerChangesAfterSublayers().
@@ -2843,6 +2846,11 @@
m_layer->setNeedsDisplay();
}
+void GraphicsLayerCA::updateCustomAppearance()
+{
+ m_layer->updateCustomAppearance(m_customAppearance);
+}
+
void GraphicsLayerCA::setShowDebugBorder(bool showBorder)
{
if (showBorder == m_showDebugBorder)
@@ -2935,6 +2943,15 @@
}
}
+void GraphicsLayerCA::setCustomAppearance(CustomAppearance customAppearance)
+{
+ if (customAppearance == m_customAppearance)
+ return;
+
+ GraphicsLayer::setCustomAppearance(customAppearance);
+ noteLayerPropertyChanged(CustomAppearanceChanged);
+}
+
bool GraphicsLayerCA::requiresTiledLayer(float pageScaleFactor) const
{
if (!m_drawsContent || !m_allowTiledLayer || m_isPageTiledBackingLayer)
Modified: trunk/Source/WebCore/platform/graphics/ca/GraphicsLayerCA.h (160671 => 160672)
--- trunk/Source/WebCore/platform/graphics/ca/GraphicsLayerCA.h 2013-12-17 00:06:20 UTC (rev 160671)
+++ trunk/Source/WebCore/platform/graphics/ca/GraphicsLayerCA.h 2013-12-17 00:13:38 UTC (rev 160672)
@@ -130,6 +130,8 @@
virtual void setDebugBackgroundColor(const Color&);
virtual void setDebugBorder(const Color&, float borderWidth);
+ virtual void setCustomAppearance(CustomAppearance);
+
virtual void layerDidDisplay(PlatformLayer*);
virtual void setMaintainsPixelAlignment(bool);
@@ -366,6 +368,7 @@
void updateVisibleRect(const FloatRect& oldVisibleRect);
void updateTiles();
void updateContentsScale(float pageScaleFactor);
+ void updateCustomAppearance();
enum StructuralLayerPurpose {
NoStructuralLayer = 0,
@@ -422,7 +425,8 @@
FiltersChanged = 1 << 27,
TilingAreaChanged = 1 << 28,
TilesAdded = 1 < 29,
- DebugIndicatorsChanged = 1 << 30
+ DebugIndicatorsChanged = 1 << 30,
+ CustomAppearanceChanged = 1 << 31
};
typedef unsigned LayerChangeFlags;
enum ScheduleFlushOrNot { ScheduleFlush, DontScheduleFlush };
Modified: trunk/Source/WebCore/platform/graphics/ca/PlatformCALayer.h (160671 => 160672)
--- trunk/Source/WebCore/platform/graphics/ca/PlatformCALayer.h 2013-12-17 00:06:20 UTC (rev 160671)
+++ trunk/Source/WebCore/platform/graphics/ca/PlatformCALayer.h 2013-12-17 00:13:38 UTC (rev 160672)
@@ -186,6 +186,9 @@
virtual void setContentsScale(float) = 0;
virtual void setEdgeAntialiasingMask(unsigned) = 0;
+
+ virtual GraphicsLayer::CustomAppearance customAppearance() const = 0;
+ virtual void updateCustomAppearance(GraphicsLayer::CustomAppearance) = 0;
virtual TiledBacking* tiledBacking() = 0;
Modified: trunk/Source/WebCore/platform/graphics/ca/mac/PlatformCALayerMac.h (160671 => 160672)
--- trunk/Source/WebCore/platform/graphics/ca/mac/PlatformCALayerMac.h 2013-12-17 00:06:20 UTC (rev 160671)
+++ trunk/Source/WebCore/platform/graphics/ca/mac/PlatformCALayerMac.h 2013-12-17 00:13:38 UTC (rev 160672)
@@ -135,6 +135,9 @@
virtual void setEdgeAntialiasingMask(unsigned) OVERRIDE;
+ virtual GraphicsLayer::CustomAppearance customAppearance() const OVERRIDE { return m_customAppearance; }
+ virtual void updateCustomAppearance(GraphicsLayer::CustomAppearance) OVERRIDE;
+
virtual TiledBacking* tiledBacking() OVERRIDE;
virtual PassRefPtr<PlatformCALayer> clone(PlatformCALayerClient* owner) const OVERRIDE;
@@ -146,8 +149,11 @@
private:
PlatformCALayerMac(LayerType, PlatformLayer*, PlatformCALayerClient* owner);
+ bool requiresCustomAppearanceUpdateOnBoundsChange() const;
+
RetainPtr<NSObject> m_delegate;
OwnPtr<PlatformCALayerList> m_customSublayers;
+ GraphicsLayer::CustomAppearance m_customAppearance;
};
} // namespace WebCore
Modified: trunk/Source/WebCore/platform/graphics/ca/mac/PlatformCALayerMac.mm (160671 => 160672)
--- trunk/Source/WebCore/platform/graphics/ca/mac/PlatformCALayerMac.mm 2013-12-17 00:06:20 UTC (rev 160671)
+++ trunk/Source/WebCore/platform/graphics/ca/mac/PlatformCALayerMac.mm 2013-12-17 00:13:38 UTC (rev 160672)
@@ -35,6 +35,7 @@
#import "GraphicsLayerCA.h"
#import "LengthFunctions.h"
#import "PlatformCAFilters.h"
+#import "ScrollbarThemeMac.h"
#import "SoftLinking.h"
#import "TiledBacking.h"
#import "TileController.h"
@@ -178,6 +179,7 @@
PlatformCALayerMac::PlatformCALayerMac(LayerType layerType, PlatformLayer* layer, PlatformCALayerClient* owner)
: PlatformCALayer(layer ? LayerTypeCustom : layerType, owner)
+ , m_customAppearance(GraphicsLayer::NoCustomAppearance)
{
BEGIN_BLOCK_OBJC_EXCEPTIONS
if (layer) {
@@ -272,6 +274,7 @@
#if ENABLE(CSS_FILTERS)
newLayer->copyFiltersFrom(this);
#endif
+ newLayer->updateCustomAppearance(customAppearance());
if (type == LayerTypeAVPlayerLayer) {
ASSERT([newLayer->platformLayer() isKindOfClass:getAVPlayerLayerClass()]);
@@ -450,6 +453,10 @@
{
BEGIN_BLOCK_OBJC_EXCEPTIONS
[m_layer.get() setBounds:value];
+
+ if (requiresCustomAppearanceUpdateOnBoundsChange())
+ updateCustomAppearance(m_customAppearance);
+
END_BLOCK_OBJC_EXCEPTIONS
}
@@ -722,6 +729,29 @@
END_BLOCK_OBJC_EXCEPTIONS
}
+bool PlatformCALayerMac::requiresCustomAppearanceUpdateOnBoundsChange() const
+{
+ return m_customAppearance == GraphicsLayer::ScrollingShadow;
+}
+
+void PlatformCALayerMac::updateCustomAppearance(GraphicsLayer::CustomAppearance appearance)
+{
+ m_customAppearance = appearance;
+
+ switch (appearance) {
+ case GraphicsLayer::NoCustomAppearance:
+ ScrollbarThemeMac::removeOverhangAreaBackground(platformLayer());
+ ScrollbarThemeMac::removeOverhangAreaShadow(platformLayer());
+ break;
+ case GraphicsLayer::ScrollingOverhang:
+ ScrollbarThemeMac::setUpOverhangAreaBackground(platformLayer());
+ break;
+ case GraphicsLayer::ScrollingShadow:
+ ScrollbarThemeMac::setUpOverhangAreaShadow(platformLayer());
+ break;
+ }
+}
+
TiledBacking* PlatformCALayerMac::tiledBacking()
{
if (!usesTiledBackingLayer())
Modified: trunk/Source/WebCore/platform/mac/ScrollbarThemeMac.h (160671 => 160672)
--- trunk/Source/WebCore/platform/mac/ScrollbarThemeMac.h 2013-12-17 00:06:20 UTC (rev 160671)
+++ trunk/Source/WebCore/platform/mac/ScrollbarThemeMac.h 2013-12-17 00:13:38 UTC (rev 160672)
@@ -64,6 +64,14 @@
static bool isCurrentlyDrawingIntoLayer();
static void setIsCurrentlyDrawingIntoLayer(bool);
+#if USE(ACCELERATED_COMPOSITING) && ENABLE(RUBBER_BANDING)
+ static void setUpOverhangAreaBackground(CALayer *, const Color& customBackgroundColor = Color());
+ static void removeOverhangAreaBackground(CALayer *);
+
+ static void setUpOverhangAreaShadow(CALayer *);
+ static void removeOverhangAreaShadow(CALayer *);
+#endif
+
protected:
virtual bool hasButtons(ScrollbarThemeClient*);
virtual bool hasThumb(ScrollbarThemeClient*);
Modified: trunk/Source/WebCore/platform/mac/ScrollbarThemeMac.mm (160671 => 160672)
--- trunk/Source/WebCore/platform/mac/ScrollbarThemeMac.mm 2013-12-17 00:06:20 UTC (rev 160671)
+++ trunk/Source/WebCore/platform/mac/ScrollbarThemeMac.mm 2013-12-17 00:13:38 UTC (rev 160672)
@@ -530,35 +530,54 @@
return adoptCF(CGColorCreateWithPattern(colorSpace.get(), pattern.get(), &alpha));
}
-void ScrollbarThemeMac::setUpOverhangAreasLayerContents(GraphicsLayer* graphicsLayer, const Color& backgroundColor)
+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.
- graphicsLayer->platformLayer().backgroundColor = backgroundColor.isValid() ? cachedCGColor(backgroundColor, ColorSpaceDeviceRGB) : cachedLinenBackgroundColor;
+ layer.backgroundColor = customBackgroundColor.isValid() ? cachedCGColor(customBackgroundColor, ColorSpaceDeviceRGB) : cachedLinenBackgroundColor;
}
-void ScrollbarThemeMac::setUpContentShadowLayer(GraphicsLayer* graphicsLayer)
+void ScrollbarThemeMac::removeOverhangAreaBackground(CALayer *layer)
{
- // We operate on the CALayer directly here, since GraphicsLayer doesn't have the concept
- // of shadows, and we know that WebCore won't touch this layer.
- CALayer *contentShadowLayer = graphicsLayer->platformLayer();
+ layer.backgroundColor = nil;
+}
+void ScrollbarThemeMac::setUpOverhangAreaShadow(CALayer *layer)
+{
static const CGFloat shadowOpacity = 0.66;
static const CGFloat shadowRadius = 3;
// We only need to set these shadow properties once.
- if (!contentShadowLayer.shadowOpacity) {
- contentShadowLayer.shadowColor = CGColorGetConstantColor(kCGColorBlack);
- contentShadowLayer.shadowOffset = CGSizeZero;
- contentShadowLayer.shadowOpacity = shadowOpacity;
- contentShadowLayer.shadowRadius = shadowRadius;
+ if (!layer.shadowOpacity) {
+ layer.shadowColor = CGColorGetConstantColor(kCGColorBlack);
+ layer.shadowOffset = CGSizeZero;
+ layer.shadowOpacity = shadowOpacity;
+ layer.shadowRadius = shadowRadius;
}
- RetainPtr<CGPathRef> shadowPath = adoptCF(CGPathCreateWithRect(CGRectMake(0, 0, graphicsLayer->size().width(), graphicsLayer->size().height()), NULL));
- contentShadowLayer.shadowPath = shadowPath.get();
+ RetainPtr<CGPathRef> shadowPath = adoptCF(CGPathCreateWithRect(layer.bounds, NULL));
+ layer.shadowPath = shadowPath.get();
}
+void ScrollbarThemeMac::removeOverhangAreaShadow(CALayer *layer)
+{
+ layer.shadowPath = nil;
+ 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
+ // of shadows, and we know that WebCore won't touch this layer.
+ setUpOverhangAreaShadow(graphicsLayer->platformLayer());
+}
+
#endif
} // namespace WebCore
Modified: trunk/Source/WebCore/rendering/RenderLayerCompositor.cpp (160671 => 160672)
--- trunk/Source/WebCore/rendering/RenderLayerCompositor.cpp 2013-12-17 00:06:20 UTC (rev 160671)
+++ trunk/Source/WebCore/rendering/RenderLayerCompositor.cpp 2013-12-17 00:13:38 UTC (rev 160672)
@@ -55,7 +55,6 @@
#include "RenderReplica.h"
#include "RenderVideo.h"
#include "RenderView.h"
-#include "ScrollbarTheme.h"
#include "ScrollingConstraints.h"
#include "ScrollingCoordinator.h"
#include "Settings.h"
@@ -1842,12 +1841,7 @@
#if ENABLE(RUBBER_BANDING)
if (m_contentShadowLayer) {
m_contentShadowLayer->setPosition(m_rootContentLayer->position());
-
- FloatSize rootContentLayerSize = m_rootContentLayer->size();
- if (m_contentShadowLayer->size() != rootContentLayerSize) {
- m_contentShadowLayer->setSize(rootContentLayerSize);
- ScrollbarTheme::theme()->setUpContentShadowLayer(m_contentShadowLayer.get());
- }
+ m_contentShadowLayer->setSize(m_rootContentLayer->size());
}
updateLayerForTopOverhangArea(m_layerForTopOverhangArea != nullptr);
@@ -2933,9 +2927,8 @@
#endif
m_layerForOverhangAreas->setDrawsContent(false);
m_layerForOverhangAreas->setSize(m_renderView.frameView().frameRect().size());
+ m_layerForOverhangAreas->setCustomAppearance(GraphicsLayer::ScrollingOverhang);
- ScrollbarTheme::theme()->setUpOverhangAreasLayerContents(m_layerForOverhangAreas.get(), this->page()->chrome().client().underlayColor());
-
// 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());
@@ -2953,7 +2946,7 @@
#endif
m_contentShadowLayer->setSize(m_rootContentLayer->size());
m_contentShadowLayer->setPosition(m_rootContentLayer->position());
- ScrollbarTheme::theme()->setUpContentShadowLayer(m_contentShadowLayer.get());
+ m_contentShadowLayer->setCustomAppearance(GraphicsLayer::ScrollingShadow);
m_scrollLayer->addChildBelow(m_contentShadowLayer.get(), m_rootContentLayer.get());
}
Modified: trunk/Source/WebKit2/ChangeLog (160671 => 160672)
--- trunk/Source/WebKit2/ChangeLog 2013-12-17 00:06:20 UTC (rev 160671)
+++ trunk/Source/WebKit2/ChangeLog 2013-12-17 00:13:38 UTC (rev 160672)
@@ -1,3 +1,34 @@
+2013-12-16 Simon Fraser <[email protected]>
+
+ Apply overhang shadow and linen to UI-side layers
+ https://bugs.webkit.org/show_bug.cgi?id=125807
+
+ Reviewed by Tim Horton.
+
+ With UI-side compositing, we need to apply the overhang shadow and linen
+ background to layers in the UI process. Achieve this by setting a "custom
+ appearance" flag on layers that need a shadow or linen background, and
+ migrating this flag to the UI process. Static functions on ScrollbarThemeMac
+ are exposed to do the actual setting.
+
+ * Shared/mac/RemoteLayerTreePropertyApplier.mm:
+ (WebKit::updateCustomAppearance): Use ScrollbarThemeMac to update the
+ appearance.
+ (WebKit::RemoteLayerTreePropertyApplier::applyPropertiesToLayer):
+ * Shared/mac/RemoteLayerTreeTransaction.h:
+ * Shared/mac/RemoteLayerTreeTransaction.mm:
+ (WebKit::RemoteLayerTreeTransaction::LayerProperties::encode):
+ (WebKit::RemoteLayerTreeTransaction::LayerProperties::decode):
+ (WebKit::dumpChangedLayers):
+ * WebProcess/WebPage/mac/PlatformCALayerRemote.cpp:
+ (PlatformCALayerRemote::setBounds): If the bounds change, also set the
+ CustomAppearanceChanged bit so that the UI side updates the shadow bounds
+ (done here because the UI side is not stateful).
+ (PlatformCALayerRemote::requiresCustomAppearanceUpdateOnBoundsChange):
+ (PlatformCALayerRemote::customAppearance):
+ (PlatformCALayerRemote::updateCustomAppearance):
+ * WebProcess/WebPage/mac/PlatformCALayerRemote.h:
+
2013-12-16 Brady Eidson <[email protected]>
DatabaseProcess: Implement openTransaction()
Modified: trunk/Source/WebKit2/Shared/mac/RemoteLayerTreePropertyApplier.mm (160671 => 160672)
--- trunk/Source/WebKit2/Shared/mac/RemoteLayerTreePropertyApplier.mm 2013-12-17 00:06:20 UTC (rev 160671)
+++ trunk/Source/WebKit2/Shared/mac/RemoteLayerTreePropertyApplier.mm 2013-12-17 00:13:38 UTC (rev 160672)
@@ -29,6 +29,7 @@
#import "PlatformCALayerRemote.h"
#import <QuartzCore/CALayer.h>
#import <WebCore/PlatformCAFilters.h>
+#import <WebCore/ScrollbarThemeMac.h>
using namespace WebCore;
@@ -58,6 +59,22 @@
return 0;
}
+static void updateCustomAppearance(CALayer *layer, GraphicsLayer::CustomAppearance customAppearance)
+{
+ switch (customAppearance) {
+ case GraphicsLayer::NoCustomAppearance:
+ ScrollbarThemeMac::removeOverhangAreaBackground(layer);
+ ScrollbarThemeMac::removeOverhangAreaShadow(layer);
+ break;
+ case GraphicsLayer::ScrollingOverhang:
+ ScrollbarThemeMac::setUpOverhangAreaBackground(layer);
+ break;
+ case GraphicsLayer::ScrollingShadow:
+ ScrollbarThemeMac::setUpOverhangAreaShadow(layer);
+ break;
+ }
+}
+
void RemoteLayerTreePropertyApplier::applyPropertiesToLayer(CALayer *layer, RemoteLayerTreeTransaction::LayerProperties properties, RelatedLayerMap relatedLayers)
{
if (properties.changedProperties & RemoteLayerTreeTransaction::NameChanged)
@@ -161,6 +178,9 @@
if (properties.changedProperties & RemoteLayerTreeTransaction::EdgeAntialiasingMaskChanged)
layer.edgeAntialiasingMask = properties.edgeAntialiasingMask;
+
+ if (properties.changedProperties & RemoteLayerTreeTransaction::CustomAppearanceChanged)
+ updateCustomAppearance(layer, properties.customAppearance);
}
void RemoteLayerTreePropertyApplier::disableActionsForLayer(CALayer *layer)
Modified: trunk/Source/WebKit2/Shared/mac/RemoteLayerTreeTransaction.h (160671 => 160672)
--- trunk/Source/WebKit2/Shared/mac/RemoteLayerTreeTransaction.h 2013-12-17 00:06:20 UTC (rev 160671)
+++ trunk/Source/WebKit2/Shared/mac/RemoteLayerTreeTransaction.h 2013-12-17 00:13:38 UTC (rev 160672)
@@ -76,7 +76,8 @@
TimeOffsetChanged = 1 << 23,
BackingStoreChanged = 1 << 24,
FiltersChanged = 1 << 25,
- EdgeAntialiasingMaskChanged = 1 << 26
+ EdgeAntialiasingMaskChanged = 1 << 26,
+ CustomAppearanceChanged = 1 << 27
};
struct LayerCreationProperties {
@@ -132,6 +133,7 @@
RemoteLayerBackingStore backingStore;
WebCore::FilterOperations filters;
unsigned edgeAntialiasingMask;
+ WebCore::GraphicsLayer::CustomAppearance customAppearance;
};
explicit RemoteLayerTreeTransaction();
Modified: trunk/Source/WebKit2/Shared/mac/RemoteLayerTreeTransaction.mm (160671 => 160672)
--- trunk/Source/WebKit2/Shared/mac/RemoteLayerTreeTransaction.mm 2013-12-17 00:06:20 UTC (rev 160671)
+++ trunk/Source/WebKit2/Shared/mac/RemoteLayerTreeTransaction.mm 2013-12-17 00:13:38 UTC (rev 160672)
@@ -155,6 +155,9 @@
if (changedProperties & EdgeAntialiasingMaskChanged)
encoder << edgeAntialiasingMask;
+
+ if (changedProperties & CustomAppearanceChanged)
+ encoder.encodeEnum(customAppearance);
}
bool RemoteLayerTreeTransaction::LayerProperties::decode(CoreIPC::ArgumentDecoder& decoder, LayerProperties& result)
@@ -297,6 +300,11 @@
return false;
}
+ if (result.changedProperties & CustomAppearanceChanged) {
+ if (!decoder.decodeEnum(result.customAppearance))
+ return false;
+ }
+
return true;
}
@@ -639,6 +647,9 @@
if (layerProperties.changedProperties & RemoteLayerTreeTransaction::EdgeAntialiasingMaskChanged)
dumpProperty<unsigned>(ts, "edgeAntialiasingMask", layerProperties.edgeAntialiasingMask);
+ if (layerProperties.changedProperties & RemoteLayerTreeTransaction::CustomAppearanceChanged)
+ dumpProperty<GraphicsLayer::CustomAppearance>(ts, "customAppearance", layerProperties.customAppearance);
+
ts << ")";
ts.decreaseIndent();
Modified: trunk/Source/WebKit2/WebProcess/WebPage/mac/PlatformCALayerRemote.cpp (160671 => 160672)
--- trunk/Source/WebKit2/WebProcess/WebPage/mac/PlatformCALayerRemote.cpp 2013-12-17 00:06:20 UTC (rev 160671)
+++ trunk/Source/WebKit2/WebProcess/WebPage/mac/PlatformCALayerRemote.cpp 2013-12-17 00:13:38 UTC (rev 160672)
@@ -304,6 +304,9 @@
{
m_properties.size = value.size();
m_properties.notePropertiesChanged(RemoteLayerTreeTransaction::SizeChanged);
+
+ if (requiresCustomAppearanceUpdateOnBoundsChange())
+ m_properties.notePropertiesChanged(RemoteLayerTreeTransaction::CustomAppearanceChanged);
ensureBackingStore();
}
@@ -513,6 +516,22 @@
m_properties.notePropertiesChanged(RemoteLayerTreeTransaction::EdgeAntialiasingMaskChanged);
}
+bool PlatformCALayerRemote::requiresCustomAppearanceUpdateOnBoundsChange() const
+{
+ return m_properties.customAppearance == GraphicsLayer::ScrollingShadow;
+}
+
+GraphicsLayer::CustomAppearance PlatformCALayerRemote::customAppearance() const
+{
+ return m_properties.customAppearance;
+}
+
+void PlatformCALayerRemote::updateCustomAppearance(GraphicsLayer::CustomAppearance customAppearance)
+{
+ m_properties.customAppearance = customAppearance;
+ m_properties.notePropertiesChanged(RemoteLayerTreeTransaction::CustomAppearanceChanged);
+}
+
PassRefPtr<PlatformCALayer> PlatformCALayerRemote::createCompatibleLayer(PlatformCALayer::LayerType layerType, PlatformCALayerClient* client) const
{
return PlatformCALayerRemote::create(layerType, client, m_context);
Modified: trunk/Source/WebKit2/WebProcess/WebPage/mac/PlatformCALayerRemote.h (160671 => 160672)
--- trunk/Source/WebKit2/WebProcess/WebPage/mac/PlatformCALayerRemote.h 2013-12-17 00:06:20 UTC (rev 160671)
+++ trunk/Source/WebKit2/WebProcess/WebPage/mac/PlatformCALayerRemote.h 2013-12-17 00:13:38 UTC (rev 160672)
@@ -140,6 +140,9 @@
virtual void setEdgeAntialiasingMask(unsigned) OVERRIDE;
+ virtual WebCore::GraphicsLayer::CustomAppearance customAppearance() const OVERRIDE;
+ virtual void updateCustomAppearance(WebCore::GraphicsLayer::CustomAppearance) OVERRIDE;
+
virtual WebCore::TiledBacking* tiledBacking() OVERRIDE { return nullptr; }
virtual PassRefPtr<WebCore::PlatformCALayer> clone(WebCore::PlatformCALayerClient* owner) const OVERRIDE;
@@ -157,6 +160,8 @@
void ensureBackingStore();
void removeSublayer(PlatformCALayerRemote*);
+ bool requiresCustomAppearanceUpdateOnBoundsChange() const;
+
RemoteLayerTreeTransaction::LayerID m_layerID;
RemoteLayerTreeTransaction::LayerProperties m_properties;
WebCore::PlatformCALayerList m_children;