e29cd8b563f3c06abc532123c336c6913435553d
[WebKit-https.git] / Source / WebKit2 / WebProcess / WebPage / mac / PlatformCALayerRemote.cpp
1 /*
2  * Copyright (C) 2013 Apple Inc. All rights reserved.
3  *
4  * Redistribution and use in source and binary forms, with or without
5  * modification, are permitted provided that the following conditions
6  * are met:
7  * 1. Redistributions of source code must retain the above copyright
8  *    notice, this list of conditions and the following disclaimer.
9  * 2. Redistributions in binary form must reproduce the above copyright
10  *    notice, this list of conditions and the following disclaimer in the
11  *    documentation and/or other materials provided with the distribution.
12  *
13  * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
14  * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
15  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
16  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE INC. OR
17  * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
18  * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
19  * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
20  * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
21  * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
23  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24  */
25
26 #include "config.h"
27 #import "PlatformCALayerRemote.h"
28
29 #import "PlatformCALayerRemoteCustom.h"
30 #import "PlatformCALayerRemoteTiledBacking.h"
31 #import "RemoteLayerBackingStore.h"
32 #import "RemoteLayerTreeContext.h"
33 #import "RemoteLayerTreePropertyApplier.h"
34 #import <WebCore/AnimationUtilities.h>
35 #import <WebCore/GraphicsContext.h>
36 #import <WebCore/GraphicsLayerCA.h>
37 #import <WebCore/LengthFunctions.h>
38 #import <WebCore/PlatformCAFilters.h>
39 #import <WebCore/PlatformCALayerMac.h>
40 #import <WebCore/TiledBacking.h>
41 #import <wtf/CurrentTime.h>
42 #import <wtf/RetainPtr.h>
43
44 using namespace WebCore;
45
46 namespace WebKit {
47
48 PassRefPtr<PlatformCALayerRemote> PlatformCALayerRemote::create(LayerType layerType, PlatformCALayerClient* owner, RemoteLayerTreeContext& context)
49 {
50     RefPtr<PlatformCALayerRemote> layer;
51
52     if (layerType == LayerTypeTiledBackingLayer ||  layerType == LayerTypePageTiledBackingLayer)
53         layer = adoptRef(new PlatformCALayerRemoteTiledBacking(layerType, owner, context));
54     else
55         layer = adoptRef(new PlatformCALayerRemote(layerType, owner, context));
56
57     context.layerWasCreated(*layer, layerType);
58
59     return layer.release();
60 }
61
62 PassRefPtr<PlatformCALayerRemote> PlatformCALayerRemote::create(PlatformLayer *platformLayer, PlatformCALayerClient* owner, RemoteLayerTreeContext& context)
63 {
64     return PlatformCALayerRemoteCustom::create(platformLayer, owner, context);
65 }
66
67 PassRefPtr<PlatformCALayerRemote> PlatformCALayerRemote::create(const PlatformCALayerRemote& other, WebCore::PlatformCALayerClient* owner, RemoteLayerTreeContext& context)
68 {
69     RefPtr<PlatformCALayerRemote> layer = adoptRef(new PlatformCALayerRemote(other, owner, context));
70
71     context.layerWasCreated(*layer, other.layerType());
72
73     return layer.release();
74 }
75
76 PlatformCALayerRemote::PlatformCALayerRemote(LayerType layerType, PlatformCALayerClient* owner, RemoteLayerTreeContext& context)
77     : PlatformCALayer(layerType, owner)
78     , m_superlayer(nullptr)
79     , m_maskLayer(nullptr)
80     , m_acceleratesDrawing(false)
81     , m_context(&context)
82 {
83     if (owner)
84         m_properties.contentsScale = owner->platformCALayerDeviceScaleFactor();
85 }
86
87 PlatformCALayerRemote::PlatformCALayerRemote(const PlatformCALayerRemote& other, PlatformCALayerClient* owner, RemoteLayerTreeContext& context)
88     : PlatformCALayer(other.layerType(), owner)
89     , m_superlayer(nullptr)
90     , m_maskLayer(nullptr)
91     , m_acceleratesDrawing(other.acceleratesDrawing())
92     , m_context(&context)
93 {
94 }
95
96 PassRefPtr<PlatformCALayer> PlatformCALayerRemote::clone(PlatformCALayerClient* owner) const
97 {
98     RefPtr<PlatformCALayerRemote> clone = PlatformCALayerRemote::create(*this, owner, *m_context);
99
100     updateClonedLayerProperties(*clone);
101
102     clone->setClonedLayer(this);
103     return clone.release();
104 }
105
106 PlatformCALayerRemote::~PlatformCALayerRemote()
107 {
108     for (const auto& layer : m_children)
109         toPlatformCALayerRemote(layer.get())->m_superlayer = nullptr;
110
111     if (m_context)
112         m_context->layerWillBeDestroyed(*this);
113 }
114
115 void PlatformCALayerRemote::updateClonedLayerProperties(PlatformCALayerRemote& clone, bool copyContents) const
116 {
117     clone.setPosition(position());
118     clone.setBounds(bounds());
119     clone.setAnchorPoint(anchorPoint());
120
121     if (m_properties.transform)
122         clone.setTransform(*m_properties.transform);
123
124     if (m_properties.sublayerTransform)
125         clone.setSublayerTransform(*m_properties.sublayerTransform);
126
127     if (copyContents)
128         clone.setContents(contents());
129
130     clone.setMasksToBounds(masksToBounds());
131     clone.setDoubleSided(isDoubleSided());
132     clone.setOpaque(isOpaque());
133     clone.setBackgroundColor(backgroundColor());
134     clone.setContentsScale(contentsScale());
135 #if ENABLE(CSS_FILTERS)
136     if (m_properties.filters)
137         clone.copyFiltersFrom(this);
138 #endif
139     clone.updateCustomAppearance(customAppearance());
140 }
141
142 void PlatformCALayerRemote::recursiveBuildTransaction(RemoteLayerTreeContext& context, RemoteLayerTreeTransaction& transaction)
143 {
144     ASSERT(!m_properties.backingStore || owner());
145     ASSERT_WITH_SECURITY_IMPLICATION(&context == m_context);
146     
147     if (m_properties.backingStore && (!owner() || !owner()->platformCALayerDrawsContent())) {
148         m_properties.backingStore = nullptr;
149         m_properties.notePropertiesChanged(RemoteLayerTreeTransaction::BackingStoreChanged);
150     }
151
152     if (m_properties.backingStore && m_properties.backingStore->display())
153         m_properties.notePropertiesChanged(RemoteLayerTreeTransaction::BackingStoreChanged);
154
155     if (m_properties.changedProperties != RemoteLayerTreeTransaction::NoChange) {
156         if (m_properties.changedProperties & RemoteLayerTreeTransaction::ChildrenChanged) {
157             m_properties.children.clear();
158             for (const auto& layer : m_children)
159                 m_properties.children.append(layer->layerID());
160         }
161
162         if (isPlatformCALayerRemoteCustom()) {
163             RemoteLayerTreePropertyApplier::applyProperties(platformLayer(), nullptr, m_properties, RemoteLayerTreePropertyApplier::RelatedLayerMap());
164             didCommit();
165             return;
166         }
167
168         transaction.layerPropertiesChanged(*this);
169     }
170
171     for (size_t i = 0; i < m_children.size(); ++i) {
172         PlatformCALayerRemote* child = toPlatformCALayerRemote(m_children[i].get());
173         ASSERT(child->superlayer() == this);
174         child->recursiveBuildTransaction(context, transaction);
175     }
176
177     if (m_maskLayer)
178         m_maskLayer->recursiveBuildTransaction(context, transaction);
179 }
180
181 void PlatformCALayerRemote::didCommit()
182 {
183     m_properties.addedAnimations.clear();
184     m_properties.keyPathsOfAnimationsToRemove.clear();
185     m_properties.resetChangedProperties();
186 }
187
188 void PlatformCALayerRemote::ensureBackingStore()
189 {
190     ASSERT(owner());
191     
192     if (!m_properties.backingStore)
193         m_properties.backingStore = std::make_unique<RemoteLayerBackingStore>(this);
194
195     updateBackingStore();
196 }
197
198 void PlatformCALayerRemote::updateBackingStore()
199 {
200     if (!m_properties.backingStore)
201         return;
202
203     m_properties.backingStore->ensureBackingStore(m_properties.bounds.size(), m_properties.contentsScale, m_acceleratesDrawing, m_properties.opaque);
204 }
205
206 void PlatformCALayerRemote::setNeedsDisplayInRect(const FloatRect& rect)
207 {
208     ensureBackingStore();
209
210     // FIXME: Need to map this through contentsRect/etc.
211     m_properties.backingStore->setNeedsDisplay(enclosingIntRect(rect));
212 }
213
214 void PlatformCALayerRemote::setNeedsDisplay()
215 {
216     ensureBackingStore();
217
218     m_properties.backingStore->setNeedsDisplay();
219 }
220
221 void PlatformCALayerRemote::copyContentsFromLayer(PlatformCALayer* layer)
222 {
223     ASSERT(m_properties.clonedLayerID == layer->layerID());
224     
225     if (!m_properties.changedProperties)
226         m_context->layerPropertyChangedWhileBuildingTransaction(*this);
227
228     m_properties.notePropertiesChanged(RemoteLayerTreeTransaction::ClonedContentsChanged);
229 }
230
231 PlatformCALayer* PlatformCALayerRemote::superlayer() const
232 {
233     return m_superlayer;
234 }
235
236 void PlatformCALayerRemote::removeFromSuperlayer()
237 {
238     if (!m_superlayer)
239         return;
240
241     m_superlayer->removeSublayer(this);
242 }
243
244 void PlatformCALayerRemote::removeSublayer(PlatformCALayerRemote* layer)
245 {
246     size_t childIndex = m_children.find(layer);
247     if (childIndex != notFound)
248         m_children.remove(childIndex);
249     layer->m_superlayer = nullptr;
250     m_properties.notePropertiesChanged(RemoteLayerTreeTransaction::ChildrenChanged);
251 }
252
253 void PlatformCALayerRemote::setSublayers(const PlatformCALayerList& list)
254 {
255     removeAllSublayers();
256     m_children = list;
257
258     for (const auto& layer : list) {
259         layer->removeFromSuperlayer();
260         toPlatformCALayerRemote(layer.get())->m_superlayer = this;
261     }
262
263     m_properties.notePropertiesChanged(RemoteLayerTreeTransaction::ChildrenChanged);
264 }
265
266 void PlatformCALayerRemote::removeAllSublayers()
267 {
268     PlatformCALayerList layersToRemove = m_children;
269     for (const auto& layer : layersToRemove)
270         layer->removeFromSuperlayer();
271     ASSERT(m_children.isEmpty());
272     m_properties.notePropertiesChanged(RemoteLayerTreeTransaction::ChildrenChanged);
273 }
274
275 void PlatformCALayerRemote::appendSublayer(PlatformCALayer* layer)
276 {
277     RefPtr<PlatformCALayer> layerProtector(layer);
278
279     layer->removeFromSuperlayer();
280     m_children.append(layer);
281     toPlatformCALayerRemote(layer)->m_superlayer = this;
282     m_properties.notePropertiesChanged(RemoteLayerTreeTransaction::ChildrenChanged);
283 }
284
285 void PlatformCALayerRemote::insertSublayer(PlatformCALayer* layer, size_t index)
286 {
287     RefPtr<PlatformCALayer> layerProtector(layer);
288
289     layer->removeFromSuperlayer();
290     m_children.insert(index, layer);
291     toPlatformCALayerRemote(layer)->m_superlayer = this;
292     m_properties.notePropertiesChanged(RemoteLayerTreeTransaction::ChildrenChanged);
293 }
294
295 void PlatformCALayerRemote::replaceSublayer(PlatformCALayer* reference, PlatformCALayer* layer)
296 {
297     ASSERT(reference->superlayer() == this);
298     RefPtr<PlatformCALayer> layerProtector(layer);
299
300     layer->removeFromSuperlayer();
301     size_t referenceIndex = m_children.find(reference);
302     if (referenceIndex != notFound) {
303         m_children[referenceIndex]->removeFromSuperlayer();
304         m_children.insert(referenceIndex, layer);
305         toPlatformCALayerRemote(layer)->m_superlayer = this;
306     }
307
308     m_properties.notePropertiesChanged(RemoteLayerTreeTransaction::ChildrenChanged);
309 }
310
311 void PlatformCALayerRemote::adoptSublayers(PlatformCALayer* source)
312 {
313     PlatformCALayerList layersToMove = toPlatformCALayerRemote(source)->m_children;
314
315     if (const PlatformCALayerList* customLayers = source->customSublayers()) {
316         for (const auto& layer : *customLayers) {
317             size_t layerIndex = layersToMove.find(layer);
318             if (layerIndex != notFound)
319                 layersToMove.remove(layerIndex);
320         }
321     }
322
323     setSublayers(layersToMove);
324 }
325
326 void PlatformCALayerRemote::addAnimationForKey(const String& key, PlatformCAAnimation* animation)
327 {
328     auto addResult = m_animations.set(key, animation);
329     if (addResult.isNewEntry)
330         m_properties.addedAnimations.append(std::pair<String, PlatformCAAnimationRemote::Properties>(key, toPlatformCAAnimationRemote(animation)->properties()));
331     else {
332         for (auto& keyAnimationPair : m_properties.addedAnimations) {
333             if (keyAnimationPair.first == key) {
334                 keyAnimationPair.second = toPlatformCAAnimationRemote(animation)->properties();
335                 break;
336             }
337         }
338     }
339     
340     m_properties.notePropertiesChanged(RemoteLayerTreeTransaction::AnimationsChanged);
341
342     if (m_context)
343         m_context->willStartAnimationOnLayer(*this);
344 }
345
346 void PlatformCALayerRemote::removeAnimationForKey(const String& key)
347 {
348     if (m_animations.remove(key)) {
349         for (size_t i = 0; i < m_properties.addedAnimations.size(); ++i) {
350             if (m_properties.addedAnimations[i].first == key) {
351                 m_properties.addedAnimations.remove(i);
352                 break;
353             }
354         }
355     }
356     m_properties.keyPathsOfAnimationsToRemove.add(key);
357     m_properties.notePropertiesChanged(RemoteLayerTreeTransaction::AnimationsChanged);
358 }
359
360 PassRefPtr<PlatformCAAnimation> PlatformCALayerRemote::animationForKey(const String& key)
361 {
362     return m_animations.get(key);
363 }
364
365 void PlatformCALayerRemote::animationStarted(const String& key, CFTimeInterval beginTime)
366 {
367     auto it = m_animations.find(key);
368     if (it != m_animations.end())
369         toPlatformCAAnimationRemote(it->value.get())->didStart(beginTime);
370     
371     if (m_owner)
372         m_owner->platformCALayerAnimationStarted(beginTime);
373 }
374
375 void PlatformCALayerRemote::setMask(PlatformCALayer* layer)
376 {
377     if (layer) {
378         m_maskLayer = toPlatformCALayerRemote(layer);
379         m_properties.maskLayerID = m_maskLayer->layerID();
380     } else {
381         m_maskLayer = nullptr;
382         m_properties.maskLayerID = 0;
383     }
384
385     m_properties.notePropertiesChanged(RemoteLayerTreeTransaction::MaskLayerChanged);
386 }
387
388 void PlatformCALayerRemote::setClonedLayer(const PlatformCALayer* layer)
389 {
390     if (layer)
391         m_properties.clonedLayerID = layer->layerID();
392     else
393         m_properties.clonedLayerID = 0;
394
395     m_properties.notePropertiesChanged(RemoteLayerTreeTransaction::ClonedContentsChanged);
396 }
397
398 bool PlatformCALayerRemote::isOpaque() const
399 {
400     return m_properties.opaque;
401 }
402
403 void PlatformCALayerRemote::setOpaque(bool value)
404 {
405     m_properties.opaque = value;
406     m_properties.notePropertiesChanged(RemoteLayerTreeTransaction::OpaqueChanged);
407
408     updateBackingStore();
409 }
410
411 FloatRect PlatformCALayerRemote::bounds() const
412 {
413     return m_properties.bounds;
414 }
415
416 void PlatformCALayerRemote::setBounds(const FloatRect& value)
417 {
418     if (value == m_properties.bounds)
419         return;
420
421     m_properties.bounds = value;
422     m_properties.notePropertiesChanged(RemoteLayerTreeTransaction::BoundsChanged);
423     
424     if (requiresCustomAppearanceUpdateOnBoundsChange())
425         m_properties.notePropertiesChanged(RemoteLayerTreeTransaction::CustomAppearanceChanged);
426
427     updateBackingStore();
428 }
429
430 FloatPoint3D PlatformCALayerRemote::position() const
431 {
432     return m_properties.position;
433 }
434
435 void PlatformCALayerRemote::setPosition(const FloatPoint3D& value)
436 {
437     if (value == m_properties.position)
438         return;
439
440     m_properties.position = value;
441     m_properties.notePropertiesChanged(RemoteLayerTreeTransaction::PositionChanged);
442 }
443
444 FloatPoint3D PlatformCALayerRemote::anchorPoint() const
445 {
446     return m_properties.anchorPoint;
447 }
448
449 void PlatformCALayerRemote::setAnchorPoint(const FloatPoint3D& value)
450 {
451     if (value == m_properties.anchorPoint)
452         return;
453
454     m_properties.anchorPoint = value;
455     m_properties.notePropertiesChanged(RemoteLayerTreeTransaction::AnchorPointChanged);
456 }
457
458 TransformationMatrix PlatformCALayerRemote::transform() const
459 {
460     return m_properties.transform ? *m_properties.transform : TransformationMatrix();
461 }
462
463 void PlatformCALayerRemote::setTransform(const TransformationMatrix& value)
464 {
465     m_properties.transform = std::make_unique<TransformationMatrix>(value);
466     m_properties.notePropertiesChanged(RemoteLayerTreeTransaction::TransformChanged);
467 }
468
469 TransformationMatrix PlatformCALayerRemote::sublayerTransform() const
470 {
471     return m_properties.sublayerTransform ? *m_properties.sublayerTransform : TransformationMatrix();
472 }
473
474 void PlatformCALayerRemote::setSublayerTransform(const TransformationMatrix& value)
475 {
476     m_properties.sublayerTransform = std::make_unique<TransformationMatrix>(value);
477     m_properties.notePropertiesChanged(RemoteLayerTreeTransaction::SublayerTransformChanged);
478 }
479
480 void PlatformCALayerRemote::setHidden(bool value)
481 {
482     m_properties.hidden = value;
483     m_properties.notePropertiesChanged(RemoteLayerTreeTransaction::HiddenChanged);
484 }
485
486 void PlatformCALayerRemote::setGeometryFlipped(bool value)
487 {
488     m_properties.geometryFlipped = value;
489     m_properties.notePropertiesChanged(RemoteLayerTreeTransaction::GeometryFlippedChanged);
490 }
491
492 bool PlatformCALayerRemote::isDoubleSided() const
493 {
494     return m_properties.doubleSided;
495 }
496
497 void PlatformCALayerRemote::setDoubleSided(bool value)
498 {
499     m_properties.doubleSided = value;
500     m_properties.notePropertiesChanged(RemoteLayerTreeTransaction::DoubleSidedChanged);
501 }
502
503 bool PlatformCALayerRemote::masksToBounds() const
504 {
505     return m_properties.masksToBounds;
506 }
507
508 void PlatformCALayerRemote::setMasksToBounds(bool value)
509 {
510     if (value == m_properties.masksToBounds)
511         return;
512
513     m_properties.masksToBounds = value;
514     m_properties.notePropertiesChanged(RemoteLayerTreeTransaction::MasksToBoundsChanged);
515 }
516
517 bool PlatformCALayerRemote::acceleratesDrawing() const
518 {
519     return m_acceleratesDrawing;
520 }
521
522 void PlatformCALayerRemote::setAcceleratesDrawing(bool acceleratesDrawing)
523 {
524     m_acceleratesDrawing = acceleratesDrawing;
525     updateBackingStore();
526 }
527
528 CFTypeRef PlatformCALayerRemote::contents() const
529 {
530     return nullptr;
531 }
532
533 void PlatformCALayerRemote::setContents(CFTypeRef value)
534 {
535 }
536
537 void PlatformCALayerRemote::setContentsRect(const FloatRect& value)
538 {
539     m_properties.contentsRect = value;
540     m_properties.notePropertiesChanged(RemoteLayerTreeTransaction::ContentsRectChanged);
541 }
542
543 void PlatformCALayerRemote::setMinificationFilter(FilterType value)
544 {
545     m_properties.minificationFilter = value;
546     m_properties.notePropertiesChanged(RemoteLayerTreeTransaction::MinificationFilterChanged);
547 }
548
549 void PlatformCALayerRemote::setMagnificationFilter(FilterType value)
550 {
551     m_properties.magnificationFilter = value;
552     m_properties.notePropertiesChanged(RemoteLayerTreeTransaction::MagnificationFilterChanged);
553 }
554
555 Color PlatformCALayerRemote::backgroundColor() const
556 {
557     return m_properties.backgroundColor;
558 }
559
560 void PlatformCALayerRemote::setBackgroundColor(const Color& value)
561 {
562     m_properties.backgroundColor = value;
563     m_properties.notePropertiesChanged(RemoteLayerTreeTransaction::BackgroundColorChanged);
564 }
565
566 void PlatformCALayerRemote::setBorderWidth(float value)
567 {
568     if (value == m_properties.borderWidth)
569         return;
570
571     m_properties.borderWidth = value;
572     m_properties.notePropertiesChanged(RemoteLayerTreeTransaction::BorderWidthChanged);
573 }
574
575 void PlatformCALayerRemote::setBorderColor(const Color& value)
576 {
577     if (value == m_properties.borderColor)
578         return;
579
580     m_properties.borderColor = value;
581     m_properties.notePropertiesChanged(RemoteLayerTreeTransaction::BorderColorChanged);
582 }
583
584 float PlatformCALayerRemote::opacity() const
585 {
586     return m_properties.opacity;
587 }
588
589 void PlatformCALayerRemote::setOpacity(float value)
590 {
591     m_properties.opacity = value;
592     m_properties.notePropertiesChanged(RemoteLayerTreeTransaction::OpacityChanged);
593 }
594
595 #if ENABLE(CSS_FILTERS)
596 void PlatformCALayerRemote::setFilters(const FilterOperations& filters)
597 {
598     m_properties.filters = std::make_unique<FilterOperations>(filters);
599     m_properties.notePropertiesChanged(RemoteLayerTreeTransaction::FiltersChanged);
600 }
601
602 void PlatformCALayerRemote::copyFiltersFrom(const PlatformCALayer* sourceLayer)
603 {
604     if (const FilterOperations* filters = toPlatformCALayerRemote(sourceLayer)->m_properties.filters.get())
605         setFilters(*filters);
606     else if (m_properties.filters)
607         m_properties.filters = nullptr;
608
609     m_properties.notePropertiesChanged(RemoteLayerTreeTransaction::FiltersChanged);
610 }
611
612 #if ENABLE(CSS_COMPOSITING)
613 void PlatformCALayerRemote::setBlendMode(BlendMode blendMode)
614 {
615     m_properties.blendMode = blendMode;
616     m_properties.notePropertiesChanged(RemoteLayerTreeTransaction::BlendModeChanged);
617 }
618 #endif
619
620 bool PlatformCALayerRemote::filtersCanBeComposited(const FilterOperations& filters)
621 {
622     return PlatformCALayerMac::filtersCanBeComposited(filters);
623 }
624 #endif
625
626 void PlatformCALayerRemote::setName(const String& value)
627 {
628     m_properties.name = value;
629     m_properties.notePropertiesChanged(RemoteLayerTreeTransaction::NameChanged);
630 }
631
632 void PlatformCALayerRemote::setSpeed(float value)
633 {
634     m_properties.speed = value;
635     m_properties.notePropertiesChanged(RemoteLayerTreeTransaction::SpeedChanged);
636 }
637
638 void PlatformCALayerRemote::setTimeOffset(CFTimeInterval value)
639 {
640     m_properties.timeOffset = value;
641     m_properties.notePropertiesChanged(RemoteLayerTreeTransaction::TimeOffsetChanged);
642 }
643
644 float PlatformCALayerRemote::contentsScale() const
645 {
646     return m_properties.contentsScale;
647 }
648
649 void PlatformCALayerRemote::setContentsScale(float value)
650 {
651     m_properties.contentsScale = value;
652     m_properties.notePropertiesChanged(RemoteLayerTreeTransaction::ContentsScaleChanged);
653
654     updateBackingStore();
655 }
656
657 void PlatformCALayerRemote::setEdgeAntialiasingMask(unsigned value)
658 {
659     m_properties.edgeAntialiasingMask = value;
660     m_properties.notePropertiesChanged(RemoteLayerTreeTransaction::EdgeAntialiasingMaskChanged);
661 }
662
663 bool PlatformCALayerRemote::requiresCustomAppearanceUpdateOnBoundsChange() const
664 {
665     return m_properties.customAppearance == GraphicsLayer::ScrollingShadow;
666 }
667
668 GraphicsLayer::CustomAppearance PlatformCALayerRemote::customAppearance() const
669 {
670     return m_properties.customAppearance;
671 }
672
673 void PlatformCALayerRemote::updateCustomAppearance(GraphicsLayer::CustomAppearance customAppearance)
674 {
675     m_properties.customAppearance = customAppearance;
676     m_properties.notePropertiesChanged(RemoteLayerTreeTransaction::CustomAppearanceChanged);
677 }
678
679 GraphicsLayer::CustomBehavior PlatformCALayerRemote::customBehavior() const
680 {
681     return m_properties.customBehavior;
682 }
683
684 void PlatformCALayerRemote::updateCustomBehavior(GraphicsLayer::CustomBehavior customBehavior)
685 {
686     m_properties.customBehavior = customBehavior;
687     m_properties.notePropertiesChanged(RemoteLayerTreeTransaction::CustomBehaviorChanged);
688 }
689
690 PassRefPtr<PlatformCALayer> PlatformCALayerRemote::createCompatibleLayer(PlatformCALayer::LayerType layerType, PlatformCALayerClient* client) const
691 {
692     return PlatformCALayerRemote::create(layerType, client, *m_context);
693 }
694
695 void PlatformCALayerRemote::enumerateRectsBeingDrawn(CGContextRef context, void (^block)(CGRect))
696 {
697     m_properties.backingStore->enumerateRectsBeingDrawn(context, block);
698 }
699
700 uint32_t PlatformCALayerRemote::hostingContextID()
701 {
702     ASSERT_NOT_REACHED();
703     return 0;
704 }
705
706 LayerPool& PlatformCALayerRemote::layerPool()
707 {
708     return m_context->layerPool();
709 }
710
711 } // namespace WebKit