Diff
Modified: trunk/Source/WebCore/ChangeLog (167552 => 167553)
--- trunk/Source/WebCore/ChangeLog 2014-04-19 22:16:26 UTC (rev 167552)
+++ trunk/Source/WebCore/ChangeLog 2014-04-19 22:26:59 UTC (rev 167553)
@@ -1,3 +1,35 @@
+2014-04-19 Simon Fraser <simon.fra...@apple.com>
+
+ [UI-side compositing] Implement blend modes
+ https://bugs.webkit.org/show_bug.cgi?id=131891
+ <rdar://problem/16490085>
+
+ Reviewed by Tim Horton.
+
+ Implement blend modes with UI-side compositing.
+
+ PlatformCALayer::setBlendMode() becomes pure virtual, and overridden in
+ PlatformCALayerMac and PlatformCALayerRemote.
+ PlatformCAFilters::setBlendingFiltersOnLayer() now takes a raw platform
+ layer, so it can be called from the UI process on a CALayer*.
+
+ Fix an issue with GraphicsLayerCA::LayerChange flags. 1 << 31 shifts
+ a signed integer, so it ended up setting all the high bits in m_uncommittedChanges,
+ causing us to push blend modes to the UI process for every layer. Fix by shifting
+ an unsigned long long (1LLU << 31). This should also fix a build warning on Windows.
+
+ * WebCore.exp.in:
+ * platform/graphics/ca/GraphicsLayerCA.h:
+ * platform/graphics/ca/PlatformCAFilters.h:
+ * platform/graphics/ca/PlatformCALayer.h:
+ * platform/graphics/ca/mac/PlatformCAFiltersMac.mm:
+ (PlatformCAFilters::setBlendingFiltersOnLayer):
+ * platform/graphics/ca/mac/PlatformCALayerMac.h:
+ * platform/graphics/ca/mac/PlatformCALayerMac.mm:
+ (PlatformCALayerMac::setFilters):
+ (PlatformCALayerMac::setBlendMode):
+ (PlatformCALayer::setBlendMode): Deleted.
+
2014-04-19 Joseph Pecoraro <pecor...@apple.com>
Fix AVPlayerController leak on pages with video
Modified: trunk/Source/WebCore/WebCore.exp.in (167552 => 167553)
--- trunk/Source/WebCore/WebCore.exp.in 2014-04-19 22:16:26 UTC (rev 167552)
+++ trunk/Source/WebCore/WebCore.exp.in 2014-04-19 22:26:59 UTC (rev 167553)
@@ -736,6 +736,7 @@
__ZN7WebCore17MouseRelatedEvent7offsetYEv
__ZN7WebCore17PlatformCAFilters17setFiltersOnLayerEP7CALayerRKNS_16FilterOperationsE
__ZN7WebCore17PlatformCAFilters23filterValueForOperationEPKNS_15FilterOperationEi
+__ZN7WebCore17PlatformCAFilters25setBlendingFiltersOnLayerEP7CALayerNS_9BlendModeE
__ZN7WebCore17SQLiteTransaction5beginEv
__ZN7WebCore17SQLiteTransaction6commitEv
__ZN7WebCore17SQLiteTransaction8rollbackEv
Modified: trunk/Source/WebCore/platform/graphics/ca/GraphicsLayerCA.h (167552 => 167553)
--- trunk/Source/WebCore/platform/graphics/ca/GraphicsLayerCA.h 2014-04-19 22:16:26 UTC (rev 167552)
+++ trunk/Source/WebCore/platform/graphics/ca/GraphicsLayerCA.h 2014-04-19 22:26:59 UTC (rev 167553)
@@ -424,39 +424,39 @@
enum LayerChange {
NoChange = 0,
- NameChanged = 1 << 1,
- ChildrenChanged = 1 << 2, // also used for content layer, and preserves-3d, and size if tiling changes?
- GeometryChanged = 1 << 3,
- TransformChanged = 1 << 4,
- ChildrenTransformChanged = 1 << 5,
- Preserves3DChanged = 1 << 6,
- MasksToBoundsChanged = 1 << 7,
- DrawsContentChanged = 1 << 8,
- BackgroundColorChanged = 1 << 9,
- ContentsOpaqueChanged = 1 << 10,
- BackfaceVisibilityChanged = 1 << 11,
- OpacityChanged = 1 << 12,
- AnimationChanged = 1 << 13,
- DirtyRectsChanged = 1 << 14,
- ContentsImageChanged = 1 << 15,
- ContentsMediaLayerChanged = 1 << 16,
- ContentsCanvasLayerChanged = 1 << 17,
- ContentsColorLayerChanged = 1 << 18,
- ContentsRectsChanged = 1 << 19,
- MaskLayerChanged = 1 << 20,
- ReplicatedLayerChanged = 1 << 21,
- ContentsNeedsDisplay = 1 << 22,
- AcceleratesDrawingChanged = 1 << 23,
- ContentsScaleChanged = 1 << 24,
- ContentsVisibilityChanged = 1 << 25,
- VisibleRectChanged = 1 << 26,
- FiltersChanged = 1 << 27,
- TilingAreaChanged = 1 << 28,
- TilesAdded = 1 < 29,
- DebugIndicatorsChanged = 1 << 30,
- CustomAppearanceChanged = 1 << 31,
- CustomBehaviorChanged = 1 << 32,
- BlendModeChanged = 1 << 33
+ NameChanged = 1LLU << 1,
+ ChildrenChanged = 1LLU << 2, // also used for content layer, and preserves-3d, and size if tiling changes?
+ GeometryChanged = 1LLU << 3,
+ TransformChanged = 1LLU << 4,
+ ChildrenTransformChanged = 1LLU << 5,
+ Preserves3DChanged = 1LLU << 6,
+ MasksToBoundsChanged = 1LLU << 7,
+ DrawsContentChanged = 1LLU << 8,
+ BackgroundColorChanged = 1LLU << 9,
+ ContentsOpaqueChanged = 1LLU << 10,
+ BackfaceVisibilityChanged = 1LLU << 11,
+ OpacityChanged = 1LLU << 12,
+ AnimationChanged = 1LLU << 13,
+ DirtyRectsChanged = 1LLU << 14,
+ ContentsImageChanged = 1LLU << 15,
+ ContentsMediaLayerChanged = 1LLU << 16,
+ ContentsCanvasLayerChanged = 1LLU << 17,
+ ContentsColorLayerChanged = 1LLU << 18,
+ ContentsRectsChanged = 1LLU << 19,
+ MaskLayerChanged = 1LLU << 20,
+ ReplicatedLayerChanged = 1LLU << 21,
+ ContentsNeedsDisplay = 1LLU << 22,
+ AcceleratesDrawingChanged = 1LLU << 23,
+ ContentsScaleChanged = 1LLU << 24,
+ ContentsVisibilityChanged = 1LLU << 25,
+ VisibleRectChanged = 1LLU << 26,
+ FiltersChanged = 1LLU << 27,
+ TilingAreaChanged = 1LLU << 28,
+ TilesAdded = 1LLU < 29,
+ DebugIndicatorsChanged = 1LLU << 30,
+ CustomAppearanceChanged = 1LLU << 31,
+ CustomBehaviorChanged = 1LLU << 32,
+ BlendModeChanged = 1LLU << 33
};
typedef uint64_t LayerChangeFlags;
enum ScheduleFlushOrNot { ScheduleFlush, DontScheduleFlush };
Modified: trunk/Source/WebCore/platform/graphics/ca/PlatformCAFilters.h (167552 => 167553)
--- trunk/Source/WebCore/platform/graphics/ca/PlatformCAFilters.h 2014-04-19 22:16:26 UTC (rev 167552)
+++ trunk/Source/WebCore/platform/graphics/ca/PlatformCAFilters.h 2014-04-19 22:26:59 UTC (rev 167553)
@@ -48,7 +48,7 @@
class PlatformCAFilters {
public:
static void setFiltersOnLayer(PlatformLayer*, const FilterOperations&);
- static void setBlendingFiltersOnLayer(PlatformCALayer*, const BlendMode);
+ static void setBlendingFiltersOnLayer(PlatformLayer*, const BlendMode);
static int numAnimatedFilterProperties(FilterOperation::OperationType);
static const char* animatedFilterPropertyName(FilterOperation::OperationType, int internalFilterPropertyIndex);
Modified: trunk/Source/WebCore/platform/graphics/ca/PlatformCALayer.h (167552 => 167553)
--- trunk/Source/WebCore/platform/graphics/ca/PlatformCALayer.h 2014-04-19 22:16:26 UTC (rev 167552)
+++ trunk/Source/WebCore/platform/graphics/ca/PlatformCALayer.h 2014-04-19 22:26:59 UTC (rev 167553)
@@ -183,7 +183,7 @@
#endif
#if ENABLE(CSS_COMPOSITING)
- void setBlendMode(BlendMode);
+ virtual void setBlendMode(BlendMode) = 0;
#endif
virtual void setName(const String&) = 0;
Modified: trunk/Source/WebCore/platform/graphics/ca/mac/PlatformCAFiltersMac.mm (167552 => 167553)
--- trunk/Source/WebCore/platform/graphics/ca/mac/PlatformCAFiltersMac.mm 2014-04-19 22:16:26 UTC (rev 167552)
+++ trunk/Source/WebCore/platform/graphics/ca/mac/PlatformCAFiltersMac.mm 2014-04-19 22:26:59 UTC (rev 167553)
@@ -28,7 +28,6 @@
#if ENABLE(CSS_FILTERS)
#import "PlatformCAFilters.h"
-
#import "BlockExceptions.h"
#import "FloatConversion.h"
#import "LengthFunctions.h" // This is a layering violation.
@@ -39,13 +38,13 @@
using namespace WebCore;
// FIXME: Should share these values with FilterEffectRenderer::build() (https://bugs.webkit.org/show_bug.cgi?id=76008).
-static double sepiaFullConstants[3][3] = {
+static const double sepiaFullConstants[3][3] = {
{ 0.393, 0.769, 0.189 },
{ 0.349, 0.686, 0.168 },
{ 0.272, 0.534, 0.131 }
};
-static double sepiaNoneConstants[3][3] = {
+static const double sepiaNoneConstants[3][3] = {
{ 1, 0, 0 },
{ 0, 1, 0 },
{ 0, 0, 1 }
@@ -538,11 +537,9 @@
}
#endif
-void PlatformCAFilters::setBlendingFiltersOnLayer(PlatformCALayer* platformCALayer, const BlendMode blendMode)
+void PlatformCAFilters::setBlendingFiltersOnLayer(PlatformLayer* layer, const BlendMode blendMode)
{
#if USE_CA_FILTERS
- CALayer* layer = platformCALayer->platformLayer();
-
BEGIN_BLOCK_OBJC_EXCEPTIONS
CAFilter* filter = nil;
@@ -595,9 +592,8 @@
[layer setCompositingFilter:filter];
END_BLOCK_OBJC_EXCEPTIONS
-
#else
- UNUSED_PARAM(platformCALayer);
+ UNUSED_PARAM(layer);
UNUSED_PARAM(blendMode);
#endif
}
Modified: trunk/Source/WebCore/platform/graphics/ca/mac/PlatformCALayerMac.h (167552 => 167553)
--- trunk/Source/WebCore/platform/graphics/ca/mac/PlatformCALayerMac.h 2014-04-19 22:16:26 UTC (rev 167552)
+++ trunk/Source/WebCore/platform/graphics/ca/mac/PlatformCALayerMac.h 2014-04-19 22:26:59 UTC (rev 167553)
@@ -122,6 +122,10 @@
virtual void copyFiltersFrom(const PlatformCALayer*) override;
#endif
+#if ENABLE(CSS_COMPOSITING)
+ virtual void setBlendMode(BlendMode) override;
+#endif
+
virtual void setName(const String&) override;
virtual void setSpeed(float) override;
Modified: trunk/Source/WebCore/platform/graphics/ca/mac/PlatformCALayerMac.mm (167552 => 167553)
--- trunk/Source/WebCore/platform/graphics/ca/mac/PlatformCALayerMac.mm 2014-04-19 22:16:26 UTC (rev 167552)
+++ trunk/Source/WebCore/platform/graphics/ca/mac/PlatformCALayerMac.mm 2014-04-19 22:26:59 UTC (rev 167553)
@@ -643,7 +643,7 @@
#if ENABLE(CSS_FILTERS)
void PlatformCALayerMac::setFilters(const FilterOperations& filters)
{
- PlatformCAFilters::setFiltersOnLayer(this->platformLayer(), filters);
+ PlatformCAFilters::setFiltersOnLayer(platformLayer(), filters);
}
void PlatformCALayerMac::copyFiltersFrom(const PlatformCALayer* sourceLayer)
@@ -679,9 +679,9 @@
#endif
#if ENABLE(CSS_COMPOSITING)
-void PlatformCALayer::setBlendMode(BlendMode blendMode)
+void PlatformCALayerMac::setBlendMode(BlendMode blendMode)
{
- PlatformCAFilters::setBlendingFiltersOnLayer(this, blendMode);
+ PlatformCAFilters::setBlendingFiltersOnLayer(platformLayer(), blendMode);
}
#endif
Modified: trunk/Source/WebKit2/ChangeLog (167552 => 167553)
--- trunk/Source/WebKit2/ChangeLog 2014-04-19 22:16:26 UTC (rev 167552)
+++ trunk/Source/WebKit2/ChangeLog 2014-04-19 22:26:59 UTC (rev 167553)
@@ -1,3 +1,34 @@
+2014-04-19 Simon Fraser <simon.fra...@apple.com>
+
+ [UI-side compositing] Implement blend modes
+ https://bugs.webkit.org/show_bug.cgi?id=131891
+ <rdar://problem/16490085>
+
+ Reviewed by Tim Horton.
+
+ Implement blend modes with UI-side compositing.
+
+ PlatformCALayer::setBlendMode() becomes pure virtual, and overridden in
+ PlatformCALayerMac and PlatformCALayerRemote.
+ PlatformCAFilters::setBlendingFiltersOnLayer() now takes a raw platform
+ layer, so it can be called from the UI process on a CALayer*.
+
+ Add BlendMode to LayerProperties, and initialize, encode and decode it,
+ as well as adding dumping support for blend modes.
+
+ * Shared/mac/RemoteLayerTreePropertyApplier.mm:
+ (WebKit::applyPropertiesToLayer):
+ * Shared/mac/RemoteLayerTreeTransaction.h:
+ * Shared/mac/RemoteLayerTreeTransaction.mm:
+ (WebKit::RemoteLayerTreeTransaction::LayerProperties::LayerProperties):
+ (WebKit::RemoteLayerTreeTransaction::LayerProperties::encode):
+ (WebKit::RemoteLayerTreeTransaction::LayerProperties::decode):
+ (WebKit::RemoteLayerTreeTextStream::operator<<):
+ (WebKit::dumpChangedLayers):
+ * WebProcess/WebPage/mac/PlatformCALayerRemote.cpp:
+ (WebKit::PlatformCALayerRemote::setBlendMode):
+ * WebProcess/WebPage/mac/PlatformCALayerRemote.h:
+
2014-04-19 Joseph Pecoraro <pecor...@apple.com>
Fix leak of UIScreenEdgePanGestureRecognizer in WKSwipeTransitionController
Modified: trunk/Source/WebKit2/Shared/mac/RemoteLayerTreePropertyApplier.mm (167552 => 167553)
--- trunk/Source/WebKit2/Shared/mac/RemoteLayerTreePropertyApplier.mm 2014-04-19 22:16:26 UTC (rev 167552)
+++ trunk/Source/WebKit2/Shared/mac/RemoteLayerTreePropertyApplier.mm 2014-04-19 22:26:59 UTC (rev 167553)
@@ -178,6 +178,9 @@
if (properties.changedProperties & RemoteLayerTreeTransaction::MagnificationFilterChanged)
layer.magnificationFilter = toCAFilterType(properties.magnificationFilter);
+ if (properties.changedProperties & RemoteLayerTreeTransaction::BlendModeChanged)
+ PlatformCAFilters::setBlendingFiltersOnLayer(layer, properties.blendMode);
+
if (properties.changedProperties & RemoteLayerTreeTransaction::SpeedChanged)
layer.speed = properties.speed;
Modified: trunk/Source/WebKit2/Shared/mac/RemoteLayerTreeTransaction.h (167552 => 167553)
--- trunk/Source/WebKit2/Shared/mac/RemoteLayerTreeTransaction.h 2014-04-19 22:16:26 UTC (rev 167552)
+++ trunk/Source/WebKit2/Shared/mac/RemoteLayerTreeTransaction.h 2014-04-19 22:26:59 UTC (rev 167553)
@@ -72,14 +72,15 @@
ContentsScaleChanged = 1 << 19,
MinificationFilterChanged = 1 << 20,
MagnificationFilterChanged = 1 << 21,
- SpeedChanged = 1 << 22,
- TimeOffsetChanged = 1 << 23,
- BackingStoreChanged = 1 << 24,
- FiltersChanged = 1 << 25,
- AnimationsChanged = 1 << 26,
- EdgeAntialiasingMaskChanged = 1 << 27,
- CustomAppearanceChanged = 1 << 28,
- CustomBehaviorChanged = 1 << 29
+ BlendModeChanged = 1 << 22,
+ SpeedChanged = 1 << 23,
+ TimeOffsetChanged = 1 << 24,
+ BackingStoreChanged = 1 << 25,
+ FiltersChanged = 1 << 26,
+ AnimationsChanged = 1 << 27,
+ EdgeAntialiasingMaskChanged = 1 << 28,
+ CustomAppearanceChanged = 1 << 29,
+ CustomBehaviorChanged = 1 << 30
};
typedef unsigned LayerChange;
@@ -143,6 +144,7 @@
WebCore::GraphicsLayer::CustomBehavior customBehavior;
WebCore::PlatformCALayer::FilterType minificationFilter;
WebCore::PlatformCALayer::FilterType magnificationFilter;
+ WebCore::BlendMode blendMode;
bool hidden;
bool geometryFlipped;
bool doubleSided;
Modified: trunk/Source/WebKit2/Shared/mac/RemoteLayerTreeTransaction.mm (167552 => 167553)
--- trunk/Source/WebKit2/Shared/mac/RemoteLayerTreeTransaction.mm 2014-04-19 22:16:26 UTC (rev 167552)
+++ trunk/Source/WebKit2/Shared/mac/RemoteLayerTreeTransaction.mm 2014-04-19 22:26:59 UTC (rev 167553)
@@ -93,6 +93,7 @@
, customBehavior(GraphicsLayer::NoCustomBehavior)
, minificationFilter(PlatformCALayer::FilterType::Linear)
, magnificationFilter(PlatformCALayer::FilterType::Linear)
+ , blendMode(BlendModeNormal)
, hidden(false)
, geometryFlipped(false)
, doubleSided(true)
@@ -125,6 +126,7 @@
, customBehavior(other.customBehavior)
, minificationFilter(other.minificationFilter)
, magnificationFilter(other.magnificationFilter)
+ , blendMode(other.blendMode)
, hidden(other.hidden)
, geometryFlipped(other.geometryFlipped)
, doubleSided(other.doubleSided)
@@ -216,6 +218,9 @@
if (changedProperties & MagnificationFilterChanged)
encoder.encodeEnum(magnificationFilter);
+ if (changedProperties & BlendModeChanged)
+ encoder.encodeEnum(blendMode);
+
if (changedProperties & SpeedChanged)
encoder << speed;
@@ -371,6 +376,11 @@
return false;
}
+ if (result.changedProperties & BlendModeChanged) {
+ if (!decoder.decodeEnum(result.blendMode))
+ return false;
+ }
+
if (result.changedProperties & SpeedChanged) {
if (!decoder.decode(result.speed))
return false;
@@ -567,6 +577,7 @@
RemoteLayerTreeTextStream& operator<<(const FilterOperations&);
RemoteLayerTreeTextStream& operator<<(const PlatformCAAnimationRemote::Properties&);
RemoteLayerTreeTextStream& operator<<(const RemoteLayerBackingStore&);
+ RemoteLayerTreeTextStream& operator<<(BlendMode);
RemoteLayerTreeTextStream& operator<<(PlatformCAAnimation::AnimationType);
RemoteLayerTreeTextStream& operator<<(PlatformCAAnimation::FillModeType);
RemoteLayerTreeTextStream& operator<<(PlatformCAAnimation::ValueFunctionType);
@@ -714,7 +725,31 @@
}
return ts;
}
-
+
+RemoteLayerTreeTextStream& RemoteLayerTreeTextStream::operator<<(BlendMode blendMode)
+{
+ RemoteLayerTreeTextStream& ts = *this;
+ switch (blendMode) {
+ case BlendModeNormal: ts << "normal"; break;
+ case BlendModeMultiply: ts << "multiply"; break;
+ case BlendModeScreen: ts << "screen"; break;
+ case BlendModeOverlay: ts << "overlay"; break;
+ case BlendModeDarken: ts << "darken"; break;
+ case BlendModeLighten: ts << "lighten"; break;
+ case BlendModeColorDodge: ts << "color-dodge"; break;
+ case BlendModeColorBurn: ts << "color-burn"; break;
+ case BlendModeHardLight: ts << "hard-light"; break;
+ case BlendModeSoftLight: ts << "soft-light"; break;
+ case BlendModeDifference: ts << "difference"; break;
+ case BlendModeExclusion: ts << "exclusion"; break;
+ case BlendModeHue: ts << "hue"; break;
+ case BlendModeSaturation: ts << "saturation"; break;
+ case BlendModeColor: ts << "color"; break;
+ case BlendModeLuminosity: ts << "luminosity"; break;
+ }
+ return ts;
+}
+
RemoteLayerTreeTextStream& RemoteLayerTreeTextStream::operator<<(PlatformCAAnimation::AnimationType type)
{
RemoteLayerTreeTextStream& ts = *this;
@@ -1018,6 +1053,9 @@
if (layerProperties.changedProperties & RemoteLayerTreeTransaction::MagnificationFilterChanged)
dumpProperty(ts, "magnificationFilter", layerProperties.magnificationFilter);
+ if (layerProperties.changedProperties & RemoteLayerTreeTransaction::BlendModeChanged)
+ dumpProperty(ts, "blendMode", layerProperties.blendMode);
+
if (layerProperties.changedProperties & RemoteLayerTreeTransaction::SpeedChanged)
dumpProperty(ts, "speed", layerProperties.speed);
Modified: trunk/Source/WebKit2/WebProcess/WebPage/mac/PlatformCALayerRemote.cpp (167552 => 167553)
--- trunk/Source/WebKit2/WebProcess/WebPage/mac/PlatformCALayerRemote.cpp 2014-04-19 22:16:26 UTC (rev 167552)
+++ trunk/Source/WebKit2/WebProcess/WebPage/mac/PlatformCALayerRemote.cpp 2014-04-19 22:26:59 UTC (rev 167553)
@@ -528,6 +528,14 @@
ASSERT_NOT_REACHED();
}
+#if ENABLE(CSS_COMPOSITING)
+void PlatformCALayerRemote::setBlendMode(BlendMode blendMode)
+{
+ m_properties.blendMode = blendMode;
+ m_properties.notePropertiesChanged(RemoteLayerTreeTransaction::BlendModeChanged);
+}
+#endif
+
bool PlatformCALayerRemote::filtersCanBeComposited(const FilterOperations& filters)
{
return PlatformCALayerMac::filtersCanBeComposited(filters);
Modified: trunk/Source/WebKit2/WebProcess/WebPage/mac/PlatformCALayerRemote.h (167552 => 167553)
--- trunk/Source/WebKit2/WebProcess/WebPage/mac/PlatformCALayerRemote.h 2014-04-19 22:16:26 UTC (rev 167552)
+++ trunk/Source/WebKit2/WebProcess/WebPage/mac/PlatformCALayerRemote.h 2014-04-19 22:26:59 UTC (rev 167553)
@@ -124,6 +124,10 @@
virtual void copyFiltersFrom(const WebCore::PlatformCALayer*) override;
#endif
+#if ENABLE(CSS_COMPOSITING)
+ virtual void setBlendMode(WebCore::BlendMode) override;
+#endif
+
virtual void setName(const String&) override;
virtual void setSpeed(float) override;