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
44using namespace WebCore;
45
46namespace WebKit {
47
48PassRefPtr<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
62PassRefPtr<PlatformCALayerRemote> PlatformCALayerRemote::create(PlatformLayer *platformLayer, PlatformCALayerClient* owner, RemoteLayerTreeContext& context)
63{
64    return PlatformCALayerRemoteCustom::create(platformLayer, owner, context);
65}
66
67PassRefPtr<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
76PlatformCALayerRemote::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
87PlatformCALayerRemote::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
96PassRefPtr<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
106PlatformCALayerRemote::~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
115void 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
142void 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
181void PlatformCALayerRemote::didCommit()
182{
183    m_properties.addedAnimations.clear();
184    m_properties.keyPathsOfAnimationsToRemove.clear();
185    m_properties.resetChangedProperties();
186}
187
188void 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
198void 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
206void PlatformCALayerRemote::setNeedsDisplay(const FloatRect* rect)
207{
208    ensureBackingStore();
209
210    if (!rect) {
211        m_properties.backingStore->setNeedsDisplay();
212        return;
213    }
214
215    // FIXME: Need to map this through contentsRect/etc.
216    m_properties.backingStore->setNeedsDisplay(enclosingIntRect(*rect));
217}
218
219void PlatformCALayerRemote::copyContentsFromLayer(PlatformCALayer* layer)
220{
221    ASSERT(m_properties.clonedLayerID == layer->layerID());
222
223    if (!m_properties.changedProperties)
224        m_context->layerPropertyChangedWhileBuildingTransaction(*this);
225
226    m_properties.notePropertiesChanged(RemoteLayerTreeTransaction::ClonedContentsChanged);
227}
228
229PlatformCALayer* PlatformCALayerRemote::superlayer() const
230{
231    return m_superlayer;
232}
233
234void PlatformCALayerRemote::removeFromSuperlayer()
235{
236    if (!m_superlayer)
237        return;
238
239    m_superlayer->removeSublayer(this);
240}
241
242void PlatformCALayerRemote::removeSublayer(PlatformCALayerRemote* layer)
243{
244    size_t childIndex = m_children.find(layer);
245    if (childIndex != notFound)
246        m_children.remove(childIndex);
247    layer->m_superlayer = nullptr;
248    m_properties.notePropertiesChanged(RemoteLayerTreeTransaction::ChildrenChanged);
249}
250
251void PlatformCALayerRemote::setSublayers(const PlatformCALayerList& list)
252{
253    removeAllSublayers();
254    m_children = list;
255
256    for (const auto& layer : list) {
257        layer->removeFromSuperlayer();
258        toPlatformCALayerRemote(layer.get())->m_superlayer = this;
259    }
260
261    m_properties.notePropertiesChanged(RemoteLayerTreeTransaction::ChildrenChanged);
262}
263
264void PlatformCALayerRemote::removeAllSublayers()
265{
266    PlatformCALayerList layersToRemove = m_children;
267    for (const auto& layer : layersToRemove)
268        layer->removeFromSuperlayer();
269    ASSERT(m_children.isEmpty());
270    m_properties.notePropertiesChanged(RemoteLayerTreeTransaction::ChildrenChanged);
271}
272
273void PlatformCALayerRemote::appendSublayer(PlatformCALayer* layer)
274{
275    RefPtr<PlatformCALayer> layerProtector(layer);
276
277    layer->removeFromSuperlayer();
278    m_children.append(layer);
279    toPlatformCALayerRemote(layer)->m_superlayer = this;
280    m_properties.notePropertiesChanged(RemoteLayerTreeTransaction::ChildrenChanged);
281}
282
283void PlatformCALayerRemote::insertSublayer(PlatformCALayer* layer, size_t index)
284{
285    RefPtr<PlatformCALayer> layerProtector(layer);
286
287    layer->removeFromSuperlayer();
288    m_children.insert(index, layer);
289    toPlatformCALayerRemote(layer)->m_superlayer = this;
290    m_properties.notePropertiesChanged(RemoteLayerTreeTransaction::ChildrenChanged);
291}
292
293void PlatformCALayerRemote::replaceSublayer(PlatformCALayer* reference, PlatformCALayer* layer)
294{
295    ASSERT(reference->superlayer() == this);
296    RefPtr<PlatformCALayer> layerProtector(layer);
297
298    layer->removeFromSuperlayer();
299    size_t referenceIndex = m_children.find(reference);
300    if (referenceIndex != notFound) {
301        m_children[referenceIndex]->removeFromSuperlayer();
302        m_children.insert(referenceIndex, layer);
303        toPlatformCALayerRemote(layer)->m_superlayer = this;
304    }
305
306    m_properties.notePropertiesChanged(RemoteLayerTreeTransaction::ChildrenChanged);
307}
308
309void PlatformCALayerRemote::adoptSublayers(PlatformCALayer* source)
310{
311    PlatformCALayerList layersToMove = toPlatformCALayerRemote(source)->m_children;
312
313    if (const PlatformCALayerList* customLayers = source->customSublayers()) {
314        for (const auto& layer : *customLayers) {
315            size_t layerIndex = layersToMove.find(layer);
316            if (layerIndex != notFound)
317                layersToMove.remove(layerIndex);
318        }
319    }
320
321    setSublayers(layersToMove);
322}
323
324void PlatformCALayerRemote::addAnimationForKey(const String& key, PlatformCAAnimation* animation)
325{
326    auto addResult = m_animations.set(key, animation);
327    if (addResult.isNewEntry)
328        m_properties.addedAnimations.append(std::pair<String, PlatformCAAnimationRemote::Properties>(key, toPlatformCAAnimationRemote(animation)->properties()));
329    else {
330        for (auto& keyAnimationPair : m_properties.addedAnimations) {
331            if (keyAnimationPair.first == key) {
332                keyAnimationPair.second = toPlatformCAAnimationRemote(animation)->properties();
333                break;
334            }
335        }
336    }
337
338    m_properties.notePropertiesChanged(RemoteLayerTreeTransaction::AnimationsChanged);
339
340    if (m_context)
341        m_context->willStartAnimationOnLayer(*this);
342}
343
344void PlatformCALayerRemote::removeAnimationForKey(const String& key)
345{
346    if (m_animations.remove(key)) {
347        for (size_t i = 0; i < m_properties.addedAnimations.size(); ++i) {
348            if (m_properties.addedAnimations[i].first == key) {
349                m_properties.addedAnimations.remove(i);
350                break;
351            }
352        }
353    }
354    m_properties.keyPathsOfAnimationsToRemove.add(key);
355    m_properties.notePropertiesChanged(RemoteLayerTreeTransaction::AnimationsChanged);
356}
357
358PassRefPtr<PlatformCAAnimation> PlatformCALayerRemote::animationForKey(const String& key)
359{
360    return m_animations.get(key);
361}
362
363void PlatformCALayerRemote::animationStarted(const String& key, CFTimeInterval beginTime)
364{
365    auto it = m_animations.find(key);
366    if (it != m_animations.end())
367        toPlatformCAAnimationRemote(it->value.get())->didStart(beginTime);
368
369    if (m_owner)
370        m_owner->platformCALayerAnimationStarted(beginTime);
371}
372
373void PlatformCALayerRemote::setMask(PlatformCALayer* layer)
374{
375    if (layer) {
376        m_maskLayer = toPlatformCALayerRemote(layer);
377        m_properties.maskLayerID = m_maskLayer->layerID();
378    } else {
379        m_maskLayer = nullptr;
380        m_properties.maskLayerID = 0;
381    }
382
383    m_properties.notePropertiesChanged(RemoteLayerTreeTransaction::MaskLayerChanged);
384}
385
386void PlatformCALayerRemote::setClonedLayer(const PlatformCALayer* layer)
387{
388    if (layer)
389        m_properties.clonedLayerID = layer->layerID();
390    else
391        m_properties.clonedLayerID = 0;
392
393    m_properties.notePropertiesChanged(RemoteLayerTreeTransaction::ClonedContentsChanged);
394}
395
396bool PlatformCALayerRemote::isOpaque() const
397{
398    return m_properties.opaque;
399}
400
401void PlatformCALayerRemote::setOpaque(bool value)
402{
403    m_properties.opaque = value;
404    m_properties.notePropertiesChanged(RemoteLayerTreeTransaction::OpaqueChanged);
405
406    updateBackingStore();
407}
408
409FloatRect PlatformCALayerRemote::bounds() const
410{
411    return m_properties.bounds;
412}
413
414void PlatformCALayerRemote::setBounds(const FloatRect& value)
415{
416    if (value == m_properties.bounds)
417        return;
418
419    m_properties.bounds = value;
420    m_properties.notePropertiesChanged(RemoteLayerTreeTransaction::BoundsChanged);
421
422    if (requiresCustomAppearanceUpdateOnBoundsChange())
423        m_properties.notePropertiesChanged(RemoteLayerTreeTransaction::CustomAppearanceChanged);
424
425    updateBackingStore();
426}
427
428FloatPoint3D PlatformCALayerRemote::position() const
429{
430    return m_properties.position;
431}
432
433void PlatformCALayerRemote::setPosition(const FloatPoint3D& value)
434{
435    if (value == m_properties.position)
436        return;
437
438    m_properties.position = value;
439    m_properties.notePropertiesChanged(RemoteLayerTreeTransaction::PositionChanged);
440}
441
442FloatPoint3D PlatformCALayerRemote::anchorPoint() const
443{
444    return m_properties.anchorPoint;
445}
446
447void PlatformCALayerRemote::setAnchorPoint(const FloatPoint3D& value)
448{
449    if (value == m_properties.anchorPoint)
450        return;
451
452    m_properties.anchorPoint = value;
453    m_properties.notePropertiesChanged(RemoteLayerTreeTransaction::AnchorPointChanged);
454}
455
456TransformationMatrix PlatformCALayerRemote::transform() const
457{
458    return m_properties.transform ? *m_properties.transform : TransformationMatrix();
459}
460
461void PlatformCALayerRemote::setTransform(const TransformationMatrix& value)
462{
463    m_properties.transform = std::make_unique<TransformationMatrix>(value);
464    m_properties.notePropertiesChanged(RemoteLayerTreeTransaction::TransformChanged);
465}
466
467TransformationMatrix PlatformCALayerRemote::sublayerTransform() const
468{
469    return m_properties.sublayerTransform ? *m_properties.sublayerTransform : TransformationMatrix();
470}
471
472void PlatformCALayerRemote::setSublayerTransform(const TransformationMatrix& value)
473{
474    m_properties.sublayerTransform = std::make_unique<TransformationMatrix>(value);
475    m_properties.notePropertiesChanged(RemoteLayerTreeTransaction::SublayerTransformChanged);
476}
477
478void PlatformCALayerRemote::setHidden(bool value)
479{
480    m_properties.hidden = value;
481    m_properties.notePropertiesChanged(RemoteLayerTreeTransaction::HiddenChanged);
482}
483
484void PlatformCALayerRemote::setGeometryFlipped(bool value)
485{
486    m_properties.geometryFlipped = value;
487    m_properties.notePropertiesChanged(RemoteLayerTreeTransaction::GeometryFlippedChanged);
488}
489
490bool PlatformCALayerRemote::isDoubleSided() const
491{
492    return m_properties.doubleSided;
493}
494
495void PlatformCALayerRemote::setDoubleSided(bool value)
496{
497    m_properties.doubleSided = value;
498    m_properties.notePropertiesChanged(RemoteLayerTreeTransaction::DoubleSidedChanged);
499}
500
501bool PlatformCALayerRemote::masksToBounds() const
502{
503    return m_properties.masksToBounds;
504}
505
506void PlatformCALayerRemote::setMasksToBounds(bool value)
507{
508    if (value == m_properties.masksToBounds)
509        return;
510
511    m_properties.masksToBounds = value;
512    m_properties.notePropertiesChanged(RemoteLayerTreeTransaction::MasksToBoundsChanged);
513}
514
515bool PlatformCALayerRemote::acceleratesDrawing() const
516{
517    return m_acceleratesDrawing;
518}
519
520void PlatformCALayerRemote::setAcceleratesDrawing(bool acceleratesDrawing)
521{
522    m_acceleratesDrawing = acceleratesDrawing;
523    updateBackingStore();
524}
525
526CFTypeRef PlatformCALayerRemote::contents() const
527{
528    return nullptr;
529}
530
531void PlatformCALayerRemote::setContents(CFTypeRef value)
532{
533}
534
535void PlatformCALayerRemote::setContentsRect(const FloatRect& value)
536{
537    m_properties.contentsRect = value;
538    m_properties.notePropertiesChanged(RemoteLayerTreeTransaction::ContentsRectChanged);
539}
540
541void PlatformCALayerRemote::setMinificationFilter(FilterType value)
542{
543    m_properties.minificationFilter = value;
544    m_properties.notePropertiesChanged(RemoteLayerTreeTransaction::MinificationFilterChanged);
545}
546
547void PlatformCALayerRemote::setMagnificationFilter(FilterType value)
548{
549    m_properties.magnificationFilter = value;
550    m_properties.notePropertiesChanged(RemoteLayerTreeTransaction::MagnificationFilterChanged);
551}
552
553Color PlatformCALayerRemote::backgroundColor() const
554{
555    return m_properties.backgroundColor;
556}
557
558void PlatformCALayerRemote::setBackgroundColor(const Color& value)
559{
560    m_properties.backgroundColor = value;
561    m_properties.notePropertiesChanged(RemoteLayerTreeTransaction::BackgroundColorChanged);
562}
563
564void PlatformCALayerRemote::setBorderWidth(float value)
565{
566    if (value == m_properties.borderWidth)
567        return;
568
569    m_properties.borderWidth = value;
570    m_properties.notePropertiesChanged(RemoteLayerTreeTransaction::BorderWidthChanged);
571}
572
573void PlatformCALayerRemote::setBorderColor(const Color& value)
574{
575    if (value == m_properties.borderColor)
576        return;
577
578    m_properties.borderColor = value;
579    m_properties.notePropertiesChanged(RemoteLayerTreeTransaction::BorderColorChanged);
580}
581
582float PlatformCALayerRemote::opacity() const
583{
584    return m_properties.opacity;
585}
586
587void PlatformCALayerRemote::setOpacity(float value)
588{
589    m_properties.opacity = value;
590    m_properties.notePropertiesChanged(RemoteLayerTreeTransaction::OpacityChanged);
591}
592
593#if ENABLE(CSS_FILTERS)
594void PlatformCALayerRemote::setFilters(const FilterOperations& filters)
595{
596    m_properties.filters = std::make_unique<FilterOperations>(filters);
597    m_properties.notePropertiesChanged(RemoteLayerTreeTransaction::FiltersChanged);
598}
599
600void PlatformCALayerRemote::copyFiltersFrom(const PlatformCALayer* sourceLayer)
601{
602    if (const FilterOperations* filters = toPlatformCALayerRemote(sourceLayer)->m_properties.filters.get())
603        setFilters(*filters);
604    else if (m_properties.filters)
605        m_properties.filters = nullptr;
606
607    m_properties.notePropertiesChanged(RemoteLayerTreeTransaction::FiltersChanged);
608}
609
610#if ENABLE(CSS_COMPOSITING)
611void PlatformCALayerRemote::setBlendMode(BlendMode blendMode)
612{
613    m_properties.blendMode = blendMode;
614    m_properties.notePropertiesChanged(RemoteLayerTreeTransaction::BlendModeChanged);
615}
616#endif
617
618bool PlatformCALayerRemote::filtersCanBeComposited(const FilterOperations& filters)
619{
620    return PlatformCALayerMac::filtersCanBeComposited(filters);
621}
622#endif
623
624void PlatformCALayerRemote::setName(const String& value)
625{
626    m_properties.name = value;
627    m_properties.notePropertiesChanged(RemoteLayerTreeTransaction::NameChanged);
628}
629
630void PlatformCALayerRemote::setSpeed(float value)
631{
632    m_properties.speed = value;
633    m_properties.notePropertiesChanged(RemoteLayerTreeTransaction::SpeedChanged);
634}
635
636void PlatformCALayerRemote::setTimeOffset(CFTimeInterval value)
637{
638    m_properties.timeOffset = value;
639    m_properties.notePropertiesChanged(RemoteLayerTreeTransaction::TimeOffsetChanged);
640}
641
642float PlatformCALayerRemote::contentsScale() const
643{
644    return m_properties.contentsScale;
645}
646
647void PlatformCALayerRemote::setContentsScale(float value)
648{
649    m_properties.contentsScale = value;
650    m_properties.notePropertiesChanged(RemoteLayerTreeTransaction::ContentsScaleChanged);
651
652    updateBackingStore();
653}
654
655void PlatformCALayerRemote::setEdgeAntialiasingMask(unsigned value)
656{
657    m_properties.edgeAntialiasingMask = value;
658    m_properties.notePropertiesChanged(RemoteLayerTreeTransaction::EdgeAntialiasingMaskChanged);
659}
660
661bool PlatformCALayerRemote::requiresCustomAppearanceUpdateOnBoundsChange() const
662{
663    return m_properties.customAppearance == GraphicsLayer::ScrollingShadow;
664}
665
666GraphicsLayer::CustomAppearance PlatformCALayerRemote::customAppearance() const
667{
668    return m_properties.customAppearance;
669}
670
671void PlatformCALayerRemote::updateCustomAppearance(GraphicsLayer::CustomAppearance customAppearance)
672{
673    m_properties.customAppearance = customAppearance;
674    m_properties.notePropertiesChanged(RemoteLayerTreeTransaction::CustomAppearanceChanged);
675}
676
677GraphicsLayer::CustomBehavior PlatformCALayerRemote::customBehavior() const
678{
679    return m_properties.customBehavior;
680}
681
682void PlatformCALayerRemote::updateCustomBehavior(GraphicsLayer::CustomBehavior customBehavior)
683{
684    m_properties.customBehavior = customBehavior;
685    m_properties.notePropertiesChanged(RemoteLayerTreeTransaction::CustomBehaviorChanged);
686}
687
688PassRefPtr<PlatformCALayer> PlatformCALayerRemote::createCompatibleLayer(PlatformCALayer::LayerType layerType, PlatformCALayerClient* client) const
689{
690    return PlatformCALayerRemote::create(layerType, client, *m_context);
691}
692
693void PlatformCALayerRemote::enumerateRectsBeingDrawn(CGContextRef context, void (^block)(CGRect))
694{
695    m_properties.backingStore->enumerateRectsBeingDrawn(context, block);
696}
697
698uint32_t PlatformCALayerRemote::hostingContextID()
699{
700    ASSERT_NOT_REACHED();
701    return 0;
702}
703
704LayerPool& PlatformCALayerRemote::layerPool()
705{
706    return m_context->layerPool();
707}
708
709} // namespace WebKit
710