https://bugs.webkit.org/show_bug.cgi?id=122933
Reviewed by Anders Carlsson.
Add remote layer tree support for maskLayer, contentsRect, contentsScale,
minificationFilter, magnificationFilter, speed, and timeOffset.
No new tests, not yet testable.
* Shared/mac/RemoteLayerTreeTransaction.h:
* Shared/mac/RemoteLayerTreeTransaction.mm:
(WebKit::RemoteLayerTreeTransaction::LayerProperties::encode):
(WebKit::RemoteLayerTreeTransaction::LayerProperties::decode):
(WebKit::dumpProperty):
(WebKit::dumpChangedLayers):
Add the new properties.
* UIProcess/mac/RemoteLayerTreeHost.mm:
(WebKit::toCAFilterType):
(WebKit::RemoteLayerTreeHost::commit):
Apply the new properties.
* WebProcess/WebPage/mac/PlatformCALayerRemote.cpp:
(PlatformCALayerRemote::setSublayers):
(PlatformCALayerRemote::appendSublayer):
(PlatformCALayerRemote::insertSublayer):
Ensure that passed-in sublayers are always also PlatformCALayerRemote instances.
These are ASSERT_WITH_SECURITY_IMPLICATION as we will later unconditionally static_cast
them to PlatformCALayerRemote.
(PlatformCALayerRemote::setMask):
(PlatformCALayerRemote::setContentsRect):
(PlatformCALayerRemote::setMinificationFilter):
(PlatformCALayerRemote::setMagnificationFilter):
(PlatformCALayerRemote::setSpeed):
(PlatformCALayerRemote::setTimeOffset):
(PlatformCALayerRemote::contentsScale):
(PlatformCALayerRemote::setContentsScale):
Remove setFrame, store the new properties.
* WebProcess/WebPage/mac/PlatformCALayerRemote.h:
Remove setFrame, add isRemote, fix pointer side on playerLayer.
* platform/graphics/ca/GraphicsLayerCA.cpp:
(WebCore::GraphicsLayerCA::setName):
Don't dump the CALayer pointer if we own a PlatformCALayerRemote.
(WebCore::GraphicsLayerCA::recursiveCommitChanges):
Fix the visible tile wash (my fault!), and make it use setPosition and
setBounds instead of setFrame; while more convenient, it is the only
caller of setFrame, so we'll remove it.
* platform/graphics/ca/PlatformCALayer.h:
(WebCore::PlatformCALayer::isRemote): Added.
* platform/graphics/ca/mac/PlatformCALayerMac.h:
* platform/graphics/ca/mac/PlatformCALayerMac.mm:
(nullActionsDictionary):
(toCAFilterType):
(PlatformCALayerMac::synchronouslyDisplayTilesInRect):
(PlatformCALayerMac::playerLayer):
Remove setFrame, fix some pointer sides.
* platform/graphics/ca/win/PlatformCALayerWin.cpp:
* platform/graphics/ca/win/PlatformCALayerWin.h:
Remove setFrame.
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@157547
268f45cc-cd09-0410-ab3c-
d52691b4dbfc
+2013-10-16 Tim Horton <timothy_horton@apple.com>
+
+ Remote Layer Tree: Complete support for simple layer properties
+ https://bugs.webkit.org/show_bug.cgi?id=122933
+
+ Reviewed by Anders Carlsson.
+
+ No new tests, not yet testable.
+
+ * platform/graphics/ca/GraphicsLayerCA.cpp:
+ (WebCore::GraphicsLayerCA::setName):
+ Don't dump the CALayer pointer if we own a PlatformCALayerRemote.
+
+ (WebCore::GraphicsLayerCA::recursiveCommitChanges):
+ Fix the visible tile wash (my fault!), and make it use setPosition and
+ setBounds instead of setFrame; while more convenient, it is the only
+ caller of setFrame, so we'll remove it.
+
+ * platform/graphics/ca/PlatformCALayer.h:
+ (WebCore::PlatformCALayer::isRemote): Added.
+
+ * platform/graphics/ca/mac/PlatformCALayerMac.h:
+ * platform/graphics/ca/mac/PlatformCALayerMac.mm:
+ (nullActionsDictionary):
+ (toCAFilterType):
+ (PlatformCALayerMac::synchronouslyDisplayTilesInRect):
+ (PlatformCALayerMac::playerLayer):
+ Remove setFrame, fix some pointer sides.
+
+ * platform/graphics/ca/win/PlatformCALayerWin.cpp:
+ * platform/graphics/ca/win/PlatformCALayerWin.h:
+ Remove setFrame.
+
2013-10-16 Andreas Kling <akling@apple.com>
Take RenderObjects out of the arena.
void GraphicsLayerCA::setName(const String& name)
{
- String longName = String::format("CALayer(%p) GraphicsLayer(%p) ", m_layer->platformLayer(), this) + name;
+ String caLayerDescription;
+
+ if (!m_layer->isRemote())
+ caLayerDescription = String::format("CALayer(%p) ", m_layer->platformLayer());
+
+ String longName = caLayerDescription + String::format("GraphicsLayer(%p) ", this) + name;
GraphicsLayer::setName(longName);
noteLayerPropertyChanged(NameChanged);
}
static Color washFillColor(255, 0, 0, 50);
static Color washBorderColor(255, 0, 0, 100);
- m_visibleTileWashLayer = createPlatformCALayer(createPlatformCALayer, this);
+ m_visibleTileWashLayer = createPlatformCALayer(PlatformCALayer::LayerTypeLayer, this);
String name = String::format("Visible Tile Wash Layer %p", m_visibleTileWashLayer->platformLayer());
m_visibleTileWashLayer->setName(name);
m_visibleTileWashLayer->setAnchorPoint(FloatPoint3D(0, 0, 0));
noteSublayersChanged(DontScheduleFlush);
}
- if (m_visibleTileWashLayer)
- m_visibleTileWashLayer->setFrame(m_visibleRect);
+ if (m_visibleTileWashLayer) {
+ m_visibleTileWashLayer->setPosition(m_visibleRect.location());
+ m_visibleTileWashLayer->setBounds(FloatRect(FloatPoint(), m_visibleRect.size()));
+ }
#endif
bool hadChanges = m_uncommittedChanges;
virtual void setContentsChanged() = 0;
LayerType layerType() const { return m_layerType; }
+ virtual bool isRemote() const { return false; }
virtual PlatformCALayer* superlayer() const = 0;
virtual void removeFromSuperlayer() = 0;
virtual void setName(const String&) = 0;
- virtual void setFrame(const FloatRect&) = 0;
-
virtual void setSpeed(float) = 0;
virtual void setTimeOffset(CFTimeInterval) = 0;
virtual void setName(const String&) OVERRIDE;
- virtual void setFrame(const FloatRect&) OVERRIDE;
-
virtual void setSpeed(float) OVERRIDE;
virtual void setTimeOffset(CFTimeInterval) OVERRIDE;
private:
PlatformCALayerMac(LayerType, PlatformLayer*, PlatformCALayerClient* owner);
- virtual AVPlayerLayer* playerLayer() const OVERRIDE;
+ virtual AVPlayerLayer *playerLayer() const OVERRIDE;
RetainPtr<NSObject> m_delegate;
OwnPtr<PlatformCALayerList> m_customSublayers;
[static_cast<WebAnimationDelegate*>(m_delegate.get()) setOwner:this];
}
-static NSDictionary* nullActionsDictionary()
+static NSDictionary *nullActionsDictionary()
{
- NSNull* nullValue = [NSNull null];
- NSDictionary* actions = [NSDictionary dictionaryWithObjectsAndKeys:
+ NSNull *nullValue = [NSNull null];
+ NSDictionary *actions = [NSDictionary dictionaryWithObjectsAndKeys:
nullValue, @"anchorPoint",
nullValue, @"anchorPointZ",
nullValue, @"bounds",
return actions;
}
-static NSString* toCAFilterType(PlatformCALayer::FilterType type)
+static NSString *toCAFilterType(PlatformCALayer::FilterType type)
{
switch (type) {
case PlatformCALayer::Linear: return kCAFilterLinear;
END_BLOCK_OBJC_EXCEPTIONS
}
-void PlatformCALayerMac::setFrame(const FloatRect& value)
-{
- BEGIN_BLOCK_OBJC_EXCEPTIONS
- [m_layer.get() setFrame:value];
- END_BLOCK_OBJC_EXCEPTIONS
-}
-
void PlatformCALayerMac::setSpeed(float value)
{
BEGIN_BLOCK_OBJC_EXCEPTIONS
if (m_layerType != LayerTypeWebTiledLayer)
return;
- WebTiledLayer *tiledLayer = static_cast<WebTiledLayer*>(m_layer.get());
+ WebTiledLayer *tiledLayer = static_cast<WebTiledLayer *>(m_layer.get());
BEGIN_BLOCK_OBJC_EXCEPTIONS
BOOL oldCanDrawConcurrently = [tiledLayer canDrawConcurrently];
END_BLOCK_OBJC_EXCEPTIONS
}
-AVPlayerLayer* PlatformCALayerMac::playerLayer() const
+AVPlayerLayer *PlatformCALayerMac::playerLayer() const
{
ASSERT([m_layer.get() isKindOfClass:getAVPlayerLayerClass()]);
- return (AVPlayerLayer*)m_layer.get();
+ return (AVPlayerLayer *)m_layer.get();
}
#endif // USE(ACCELERATED_COMPOSITING)
setNeedsCommit();
}
-void PlatformCALayerWin::setFrame(const FloatRect& value)
-{
- intern(this)->setFrame(value);
- setNeedsLayout();
-}
-
void PlatformCALayerWin::setSpeed(float value)
{
CACFLayerSetSpeed(m_layer.get(), value);
virtual void setName(const String&) OVERRIDE;
- virtual void setFrame(const FloatRect&) OVERRIDE;
-
virtual void setSpeed(float) OVERRIDE;
virtual void setTimeOffset(CFTimeInterval) OVERRIDE;
+2013-10-16 Tim Horton <timothy_horton@apple.com>
+
+ Remote Layer Tree: Complete support for simple layer properties
+ https://bugs.webkit.org/show_bug.cgi?id=122933
+
+ Reviewed by Anders Carlsson.
+
+ Add remote layer tree support for maskLayer, contentsRect, contentsScale,
+ minificationFilter, magnificationFilter, speed, and timeOffset.
+
+ * Shared/mac/RemoteLayerTreeTransaction.h:
+ * Shared/mac/RemoteLayerTreeTransaction.mm:
+ (WebKit::RemoteLayerTreeTransaction::LayerProperties::encode):
+ (WebKit::RemoteLayerTreeTransaction::LayerProperties::decode):
+ (WebKit::dumpProperty):
+ (WebKit::dumpChangedLayers):
+ Add the new properties.
+
+ * UIProcess/mac/RemoteLayerTreeHost.mm:
+ (WebKit::toCAFilterType):
+ (WebKit::RemoteLayerTreeHost::commit):
+ Apply the new properties.
+
+ * WebProcess/WebPage/mac/PlatformCALayerRemote.cpp:
+ (PlatformCALayerRemote::setSublayers):
+ (PlatformCALayerRemote::appendSublayer):
+ (PlatformCALayerRemote::insertSublayer):
+ Ensure that passed-in sublayers are always also PlatformCALayerRemote instances.
+ These are ASSERT_WITH_SECURITY_IMPLICATION as we will later unconditionally static_cast
+ them to PlatformCALayerRemote.
+
+ (PlatformCALayerRemote::setMask):
+ (PlatformCALayerRemote::setContentsRect):
+ (PlatformCALayerRemote::setMinificationFilter):
+ (PlatformCALayerRemote::setMagnificationFilter):
+ (PlatformCALayerRemote::setSpeed):
+ (PlatformCALayerRemote::setTimeOffset):
+ (PlatformCALayerRemote::contentsScale):
+ (PlatformCALayerRemote::setContentsScale):
+ Remove setFrame, store the new properties.
+
+ * WebProcess/WebPage/mac/PlatformCALayerRemote.h:
+ Remove setFrame, add isRemote, fix pointer side on playerLayer.
+
2013-10-16 Ryuan Choi <ryuan.choi@samsung.com>
Unreviewed build fix attempt on EFL port after r157520 and r157523
GeometryFlippedChanged = 1 << 13,
DoubleSidedChanged = 1 << 14,
MasksToBoundsChanged = 1 << 15,
- OpaqueChanged = 1 << 16
+ OpaqueChanged = 1 << 16,
+ MaskLayerChanged = 1 << 17,
+ ContentsRectChanged = 1 << 18,
+ ContentsScaleChanged = 1 << 19,
+ MinificationFilterChanged = 1 << 20,
+ MagnificationFilterChanged = 1 << 21,
+ SpeedChanged = 1 << 22,
+ TimeOffsetChanged = 1 << 23
};
struct LayerCreationProperties {
bool doubleSided;
bool masksToBounds;
bool opaque;
+ LayerID maskLayer;
+ WebCore::FloatRect contentsRect;
+ float contentsScale;
+ WebCore::PlatformCALayer::FilterType minificationFilter;
+ WebCore::PlatformCALayer::FilterType magnificationFilter;
+ float speed;
+ double timeOffset;
};
explicit RemoteLayerTreeTransaction();
if (changedProperties & OpaqueChanged)
encoder << opaque;
+
+ if (changedProperties & MaskLayerChanged)
+ encoder << maskLayer;
+
+ if (changedProperties & ContentsRectChanged)
+ encoder << contentsRect;
+
+ if (changedProperties & ContentsScaleChanged)
+ encoder << contentsScale;
+
+ if (changedProperties & MinificationFilterChanged)
+ encoder.encodeEnum(minificationFilter);
+
+ if (changedProperties & MagnificationFilterChanged)
+ encoder.encodeEnum(magnificationFilter);
+
+ if (changedProperties & SpeedChanged)
+ encoder << speed;
+
+ if (changedProperties & TimeOffsetChanged)
+ encoder << timeOffset;
}
bool RemoteLayerTreeTransaction::LayerProperties::decode(CoreIPC::ArgumentDecoder& decoder, LayerProperties& result)
return false;
}
+ if (result.changedProperties & MaskLayerChanged) {
+ if (!decoder.decode(result.maskLayer))
+ return false;
+ }
+
+ if (result.changedProperties & ContentsRectChanged) {
+ if (!decoder.decode(result.contentsRect))
+ return false;
+ }
+
+ if (result.changedProperties & ContentsScaleChanged) {
+ if (!decoder.decode(result.contentsScale))
+ return false;
+ }
+
+ if (result.changedProperties & MinificationFilterChanged) {
+ if (!decoder.decodeEnum(result.minificationFilter))
+ return false;
+ }
+
+ if (result.changedProperties & MagnificationFilterChanged) {
+ if (!decoder.decodeEnum(result.magnificationFilter))
+ return false;
+ }
+
+ if (result.changedProperties & SpeedChanged) {
+ if (!decoder.decode(result.speed))
+ return false;
+ }
+
+ if (result.changedProperties & TimeOffsetChanged) {
+ if (!decoder.decode(result.timeOffset))
+ return false;
+ }
+
return true;
}
builder.append(ts.release());
}
+static void dumpProperty(StringBuilder& builder, String name, const PlatformCALayer::FilterType filterType)
+{
+ builder.append('\n');
+ writeIndent(builder, 3);
+ builder.append('(');
+ builder.append(name);
+ builder.append(' ');
+
+ switch (filterType) {
+ case PlatformCALayer::Linear:
+ builder.append("linear");
+ break;
+ case PlatformCALayer::Nearest:
+ builder.append("nearest");
+ break;
+ case PlatformCALayer::Trilinear:
+ builder.append("trilinear");
+ break;
+ default:
+ ASSERT_NOT_REACHED();
+ break;
+ }
+
+ builder.append(")");
+}
+
static void dumpChangedLayers(StringBuilder& builder, const HashMap<RemoteLayerTreeTransaction::LayerID, RemoteLayerTreeTransaction::LayerProperties>& changedLayerProperties)
{
if (changedLayerProperties.isEmpty())
builder.append(')');
}
+ if (layerProperties.changedProperties & RemoteLayerTreeTransaction::MaskLayerChanged) {
+ builder.append('\n');
+ writeIndent(builder, 3);
+ builder.append("(maskLayer ");
+ builder.appendNumber(layerProperties.maskLayer);
+ builder.append(')');
+ }
+
+ if (layerProperties.changedProperties & RemoteLayerTreeTransaction::ContentsRectChanged) {
+ builder.append('\n');
+ writeIndent(builder, 3);
+ builder.append("(contentsRect ");
+ builder.appendNumber(layerProperties.contentsRect.x());
+ builder.append(' ');
+ builder.appendNumber(layerProperties.contentsRect.y());
+ builder.append(' ');
+ builder.appendNumber(layerProperties.contentsRect.width());
+ builder.append(' ');
+ builder.appendNumber(layerProperties.contentsRect.height());
+ builder.append(')');
+ }
+
+ if (layerProperties.changedProperties & RemoteLayerTreeTransaction::ContentsScaleChanged) {
+ builder.append('\n');
+ writeIndent(builder, 3);
+ builder.append("(contentsScale ");
+ builder.appendNumber(layerProperties.contentsScale);
+ builder.append(')');
+ }
+
+ if (layerProperties.changedProperties & RemoteLayerTreeTransaction::MinificationFilterChanged)
+ dumpProperty(builder, "minificationFilter", layerProperties.minificationFilter);
+
+ if (layerProperties.changedProperties & RemoteLayerTreeTransaction::MagnificationFilterChanged)
+ dumpProperty(builder, "magnificationFilter", layerProperties.magnificationFilter);
+
+ if (layerProperties.changedProperties & RemoteLayerTreeTransaction::SpeedChanged) {
+ builder.append('\n');
+ writeIndent(builder, 3);
+ builder.append("(speed ");
+ builder.appendNumber(layerProperties.speed);
+ builder.append(')');
+ }
+
+ if (layerProperties.changedProperties & RemoteLayerTreeTransaction::TimeOffsetChanged) {
+ builder.append('\n');
+ writeIndent(builder, 3);
+ builder.append("(timeOffset ");
+ builder.appendNumber(layerProperties.timeOffset);
+ builder.append(')');
+ }
+
builder.append(")\n");
}
}
return cgColor;
}
+static NSString *toCAFilterType(PlatformCALayer::FilterType type)
+{
+ switch (type) {
+ case PlatformCALayer::Linear:
+ return kCAFilterLinear;
+ case PlatformCALayer::Nearest:
+ return kCAFilterNearest;
+ case PlatformCALayer::Trilinear:
+ return kCAFilterTrilinear;
+ };
+
+ ASSERT_NOT_REACHED();
+ return 0;
+}
+
+
void RemoteLayerTreeHost::commit(const RemoteLayerTreeTransaction& transaction)
{
#ifndef NDEBUG
if (properties.changedProperties & RemoteLayerTreeTransaction::OpaqueChanged)
layer.opaque = properties.opaque;
+
+ if (properties.changedProperties & RemoteLayerTreeTransaction::MaskLayerChanged) {
+ CALayer *maskLayer = getLayer(properties.maskLayer);
+ ASSERT(!maskLayer.superlayer);
+ if (!maskLayer.superlayer)
+ layer.mask = maskLayer;
+ }
+
+ if (properties.changedProperties & RemoteLayerTreeTransaction::ContentsRectChanged)
+ layer.contentsRect = properties.contentsRect;
+
+ if (properties.changedProperties & RemoteLayerTreeTransaction::ContentsScaleChanged)
+ layer.contentsRect = properties.contentsRect;
+
+ if (properties.changedProperties & RemoteLayerTreeTransaction::MinificationFilterChanged)
+ layer.minificationFilter = toCAFilterType(properties.minificationFilter);
+
+ if (properties.changedProperties & RemoteLayerTreeTransaction::MagnificationFilterChanged)
+ layer.magnificationFilter = toCAFilterType(properties.magnificationFilter);
+
+ if (properties.changedProperties & RemoteLayerTreeTransaction::SpeedChanged)
+ layer.speed = properties.speed;
+
+ if (properties.changedProperties & RemoteLayerTreeTransaction::TimeOffsetChanged)
+ layer.timeOffset = properties.timeOffset;
}
for (auto destroyedLayer : transaction.destroyedLayers())
void PlatformCALayerRemote::setSublayers(const PlatformCALayerList& list)
{
+#ifndef ASSERT_DISABLED
+ for (const auto& layer : list) {
+ ASSERT_WITH_SECURITY_IMPLICATION(layer->isRemote());
+ }
+#endif
+
m_children = list;
m_properties.notePropertiesChanged(RemoteLayerTreeTransaction::ChildrenChanged);
}
void PlatformCALayerRemote::appendSublayer(PlatformCALayer* layer)
{
+ ASSERT_WITH_SECURITY_IMPLICATION(layer->isRemote());
+
m_children.append(layer);
m_properties.notePropertiesChanged(RemoteLayerTreeTransaction::ChildrenChanged);
}
void PlatformCALayerRemote::insertSublayer(PlatformCALayer* layer, size_t index)
{
+ ASSERT_WITH_SECURITY_IMPLICATION(layer->isRemote());
+
m_children.insert(index, layer);
m_properties.notePropertiesChanged(RemoteLayerTreeTransaction::ChildrenChanged);
}
void PlatformCALayerRemote::setMask(PlatformCALayer* layer)
{
+ ASSERT_WITH_SECURITY_IMPLICATION(layer->isRemote());
+
+ m_properties.maskLayer = static_cast<PlatformCALayerRemote*>(layer)->layerID();
+ m_properties.notePropertiesChanged(RemoteLayerTreeTransaction::MaskLayerChanged);
}
bool PlatformCALayerRemote::isOpaque() const
void PlatformCALayerRemote::setContentsRect(const FloatRect& value)
{
+ m_properties.contentsRect = value;
+ m_properties.notePropertiesChanged(RemoteLayerTreeTransaction::ContentsRectChanged);
}
void PlatformCALayerRemote::setMinificationFilter(FilterType value)
{
+ m_properties.minificationFilter = value;
+ m_properties.notePropertiesChanged(RemoteLayerTreeTransaction::MinificationFilterChanged);
}
void PlatformCALayerRemote::setMagnificationFilter(FilterType value)
{
+ m_properties.magnificationFilter = value;
+ m_properties.notePropertiesChanged(RemoteLayerTreeTransaction::MagnificationFilterChanged);
}
Color PlatformCALayerRemote::backgroundColor() const
m_properties.notePropertiesChanged(RemoteLayerTreeTransaction::NameChanged);
}
-void PlatformCALayerRemote::setFrame(const FloatRect& value)
-{
-}
-
void PlatformCALayerRemote::setSpeed(float value)
{
+ m_properties.speed = value;
+ m_properties.notePropertiesChanged(RemoteLayerTreeTransaction::SpeedChanged);
}
void PlatformCALayerRemote::setTimeOffset(CFTimeInterval value)
{
+ m_properties.timeOffset = value;
+ m_properties.notePropertiesChanged(RemoteLayerTreeTransaction::TimeOffsetChanged);
}
float PlatformCALayerRemote::contentsScale() const
{
- return 0;
+ return m_properties.contentsScale;
}
void PlatformCALayerRemote::setContentsScale(float value)
{
+ m_properties.contentsScale = value;
+ m_properties.notePropertiesChanged(RemoteLayerTreeTransaction::ContentsScaleChanged);
}
TiledBacking* PlatformCALayerRemote::tiledBacking()
RemoteLayerTreeTransaction::LayerID layerID() { return m_layerID; }
+ virtual bool isRemote() const OVERRIDE { return true; }
+
virtual bool usesTiledBackingLayer() const OVERRIDE { return false; }
virtual PlatformLayer* platformLayer() const OVERRIDE { return nullptr; }
virtual void setName(const String&) OVERRIDE;
- virtual void setFrame(const WebCore::FloatRect&) OVERRIDE;
-
virtual void setSpeed(float) OVERRIDE;
virtual void setTimeOffset(CFTimeInterval) OVERRIDE;
private:
PlatformCALayerRemote(WebCore::PlatformCALayer::LayerType, WebCore::PlatformCALayerClient* owner, RemoteLayerTreeContext* context);
- virtual AVPlayerLayer* playerLayer() const OVERRIDE;
+ virtual AVPlayerLayer *playerLayer() const OVERRIDE;
RemoteLayerTreeTransaction::LayerID m_layerID;
RemoteLayerTreeTransaction::LayerProperties m_properties;