RemoteLayerTreeTransaction should use OptionSet for change flags
authorantti@apple.com <antti@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 14 Aug 2018 16:48:45 +0000 (16:48 +0000)
committerantti@apple.com <antti@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 14 Aug 2018 16:48:45 +0000 (16:48 +0000)
https://bugs.webkit.org/show_bug.cgi?id=188547

Reviewed by Simon Fraser.

* Shared/RemoteLayerTree/RemoteLayerTreePropertyApplier.mm:
(WebKit::RemoteLayerTreePropertyApplier::applyProperties):
* Shared/RemoteLayerTree/RemoteLayerTreeTransaction.h:
(WebKit::RemoteLayerTreeTransaction::LayerProperties::notePropertiesChanged):
(WebKit::RemoteLayerTreeTransaction::LayerProperties::resetChangedProperties):

Also remove unused everChangedProperties.

* Shared/RemoteLayerTree/RemoteLayerTreeTransaction.mm:
(WebKit::RemoteLayerTreeTransaction::LayerProperties::LayerProperties):
(WebKit::RemoteLayerTreeTransaction::LayerProperties::encode const):
(WebKit::RemoteLayerTreeTransaction::LayerProperties::decode):
* WebProcess/WebPage/RemoteLayerTree/PlatformCALayerRemote.cpp:
(WebKit::PlatformCALayerRemote::recursiveBuildTransaction):
* WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeDrawingArea.mm:
(WebKit::RemoteLayerTreeDrawingArea::flushLayers):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@234849 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/WebKit/ChangeLog
Source/WebKit/Shared/RemoteLayerTree/RemoteLayerTreePropertyApplier.mm
Source/WebKit/Shared/RemoteLayerTree/RemoteLayerTreeTransaction.h
Source/WebKit/Shared/RemoteLayerTree/RemoteLayerTreeTransaction.mm
Source/WebKit/WebProcess/WebPage/RemoteLayerTree/PlatformCALayerRemote.cpp
Source/WebKit/WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeDrawingArea.mm

index 91b71f7..33b11eb 100644 (file)
@@ -1,3 +1,27 @@
+2018-08-14  Antti Koivisto  <antti@apple.com>
+
+        RemoteLayerTreeTransaction should use OptionSet for change flags
+        https://bugs.webkit.org/show_bug.cgi?id=188547
+
+        Reviewed by Simon Fraser.
+
+        * Shared/RemoteLayerTree/RemoteLayerTreePropertyApplier.mm:
+        (WebKit::RemoteLayerTreePropertyApplier::applyProperties):
+        * Shared/RemoteLayerTree/RemoteLayerTreeTransaction.h:
+        (WebKit::RemoteLayerTreeTransaction::LayerProperties::notePropertiesChanged):
+        (WebKit::RemoteLayerTreeTransaction::LayerProperties::resetChangedProperties):
+
+        Also remove unused everChangedProperties.
+
+        * Shared/RemoteLayerTree/RemoteLayerTreeTransaction.mm:
+        (WebKit::RemoteLayerTreeTransaction::LayerProperties::LayerProperties):
+        (WebKit::RemoteLayerTreeTransaction::LayerProperties::encode const):
+        (WebKit::RemoteLayerTreeTransaction::LayerProperties::decode):
+        * WebProcess/WebPage/RemoteLayerTree/PlatformCALayerRemote.cpp:
+        (WebKit::PlatformCALayerRemote::recursiveBuildTransaction):
+        * WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeDrawingArea.mm:
+        (WebKit::RemoteLayerTreeDrawingArea::flushLayers):
+
 2018-08-13  Wenson Hsieh  <wenson_hsieh@apple.com>
 
         [WK2] [macOS] Implement a mechanism to test drag and drop
index 87ad10e..726a5b7 100644 (file)
@@ -332,7 +332,7 @@ void RemoteLayerTreePropertyApplier::applyProperties(UIView *view, RemoteLayerTr
         }
     }
 
-    if (properties.changedProperties & (RemoteLayerTreeTransaction::ContentsHiddenChanged | RemoteLayerTreeTransaction::UserInteractionEnabledChanged))
+    if (properties.changedProperties.containsAny({ RemoteLayerTreeTransaction::ContentsHiddenChanged, RemoteLayerTreeTransaction::UserInteractionEnabledChanged }))
         view.userInteractionEnabled = !properties.contentsHidden && properties.userInteractionEnabled;
 
     END_BLOCK_OBJC_EXCEPTIONS;
index 3e56f50..aa28ce6 100644 (file)
@@ -54,8 +54,7 @@ class PlatformCALayerRemote;
 
 class RemoteLayerTreeTransaction {
 public:
-    enum LayerChanges {
-        NoChange                        = 0,
+    enum LayerChange {
         NameChanged                     = 1LLU << 1,
         ChildrenChanged                 = 1LLU << 2,
         PositionChanged                 = 1LLU << 3,
@@ -94,7 +93,6 @@ public:
         CustomAppearanceChanged         = 1LLU << 36,
         UserInteractionEnabledChanged   = 1LLU << 37,
     };
-    typedef uint64_t LayerChange;
 
     struct LayerCreationProperties {
         LayerCreationProperties();
@@ -116,19 +114,17 @@ public:
         void encode(IPC::Encoder&) const;
         static bool decode(IPC::Decoder&, LayerProperties&);
 
-        void notePropertiesChanged(LayerChange changeFlags)
+        void notePropertiesChanged(OptionSet<LayerChange> changeFlags)
         {
             changedProperties |= changeFlags;
-            everChangedProperties |= changeFlags;
         }
 
         void resetChangedProperties()
         {
-            changedProperties = RemoteLayerTreeTransaction::NoChange;
+            changedProperties = { };
         }
 
-        LayerChange changedProperties;
-        LayerChange everChangedProperties;
+        OptionSet<LayerChange> changedProperties;
 
         String name;
         std::unique_ptr<WebCore::TransformationMatrix> transform;
index 4b8d59d..182f6c5 100644 (file)
@@ -75,9 +75,7 @@ auto RemoteLayerTreeTransaction::LayerCreationProperties::decode(IPC::Decoder& d
 }
 
 RemoteLayerTreeTransaction::LayerProperties::LayerProperties()
-    : changedProperties(NoChange)
-    , everChangedProperties(NoChange)
-    , anchorPoint(0.5, 0.5, 0)
+    : anchorPoint(0.5, 0.5, 0)
     , contentsRect(FloatPoint(), FloatSize(1, 1))
     , maskLayerID(0)
     , clonedLayerID(0)
@@ -108,7 +106,6 @@ RemoteLayerTreeTransaction::LayerProperties::LayerProperties()
 
 RemoteLayerTreeTransaction::LayerProperties::LayerProperties(const LayerProperties& other)
     : changedProperties(other.changedProperties)
-    , everChangedProperties(other.everChangedProperties)
     , name(other.name)
     , children(other.children)
     , addedAnimations(other.addedAnimations)
@@ -158,7 +155,7 @@ RemoteLayerTreeTransaction::LayerProperties::LayerProperties(const LayerProperti
 
 void RemoteLayerTreeTransaction::LayerProperties::encode(IPC::Encoder& encoder) const
 {
-    encoder.encodeEnum(changedProperties);
+    encoder.encode(changedProperties);
 
     if (changedProperties & NameChanged)
         encoder << name;
@@ -280,7 +277,7 @@ void RemoteLayerTreeTransaction::LayerProperties::encode(IPC::Encoder& encoder)
 
 bool RemoteLayerTreeTransaction::LayerProperties::decode(IPC::Decoder& decoder, LayerProperties& result)
 {
-    if (!decoder.decodeEnum(result.changedProperties))
+    if (!decoder.decode(result.changedProperties))
         return false;
 
     if (result.changedProperties & NameChanged) {
index 155c054..b9bc939 100644 (file)
@@ -154,7 +154,7 @@ void PlatformCALayerRemote::recursiveBuildTransaction(RemoteLayerTreeContext& co
     if (m_properties.backingStore && m_properties.backingStoreAttached && m_properties.backingStore->display())
         m_properties.notePropertiesChanged(RemoteLayerTreeTransaction::BackingStoreChanged);
 
-    if (m_properties.changedProperties != RemoteLayerTreeTransaction::NoChange) {
+    if (m_properties.changedProperties) {
         if (m_properties.changedProperties & RemoteLayerTreeTransaction::ChildrenChanged) {
             m_properties.children.resize(m_children.size());
             for (size_t i = 0; i < m_children.size(); ++i)
index fe5826c..97382aa 100644 (file)
@@ -397,7 +397,7 @@ void RemoteLayerTreeDrawingArea::flushLayers()
     bool hadAnyChangedBackingStore = false;
     Vector<RetainPtr<CGContextRef>> contextsToFlush;
     for (auto& layer : layerTransaction.changedLayers()) {
-        if (layer->properties().changedProperties & RemoteLayerTreeTransaction::LayerChanges::BackingStoreChanged) {
+        if (layer->properties().changedProperties & RemoteLayerTreeTransaction::BackingStoreChanged) {
             hadAnyChangedBackingStore = true;
             if (layer->properties().backingStore) {
                 if (auto contextPendingFlush = layer->properties().backingStore->takeFrontContextPendingFlush())