Title: [266171] trunk/Source/WebCore
Revision
266171
Author
[email protected]
Date
2020-08-26 10:24:39 -0700 (Wed, 26 Aug 2020)

Log Message

Code cleanup and consistent naming in AXIsolatedTree classes, no change in behavior.
https://bugs.webkit.org/show_bug.cgi?id=215850

Reviewed by Chris Fleizach.

- Renamed AXIsolatedObject::m_attributeMap to m_propertyMap for naming
conssistency.
- typedef -> using
- Removed AXPropertyName::None, not used.
- Replaced AccessibilityIsolatedTreeMathMultiscriptPair alias with its
definition, shorter, clearer, and can be used for other property of the
same type.

* accessibility/isolatedtree/AXIsolatedObject.cpp:
(WebCore::AXIsolatedObject::setMathscripts):
(WebCore::AXIsolatedObject::setProperty):
(WebCore::AXIsolatedObject::insertMathPairs):
(WebCore::AXIsolatedObject::mathPrescripts):
(WebCore::AXIsolatedObject::mathPostscripts):
(WebCore::AXIsolatedObject::intPointAttributeValue const):
(WebCore::AXIsolatedObject::objectAttributeValue const):
(WebCore::AXIsolatedObject::rectAttributeValue const):
(WebCore::AXIsolatedObject::vectorAttributeValue const):
(WebCore::AXIsolatedObject::optionSetAttributeValue const):
(WebCore::AXIsolatedObject::pairAttributeValue const):
(WebCore::AXIsolatedObject::uint64AttributeValue const):
(WebCore::AXIsolatedObject::urlAttributeValue const):
(WebCore::AXIsolatedObject::pathAttributeValue const):
(WebCore::AXIsolatedObject::colorAttributeValue const):
(WebCore::AXIsolatedObject::floatAttributeValue const):
(WebCore::AXIsolatedObject::doubleAttributeValue const):
(WebCore::AXIsolatedObject::unsignedAttributeValue const):
(WebCore::AXIsolatedObject::boolAttributeValue const):
(WebCore::AXIsolatedObject::stringAttributeValue const):
(WebCore::AXIsolatedObject::intAttributeValue const):
* accessibility/isolatedtree/AXIsolatedObject.h:
* accessibility/isolatedtree/AXIsolatedTree.h:

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (266170 => 266171)


--- trunk/Source/WebCore/ChangeLog	2020-08-26 16:48:33 UTC (rev 266170)
+++ trunk/Source/WebCore/ChangeLog	2020-08-26 17:24:39 UTC (rev 266171)
@@ -1,3 +1,43 @@
+2020-08-26  Andres Gonzalez  <[email protected]>
+
+        Code cleanup and consistent naming in AXIsolatedTree classes, no change in behavior.
+        https://bugs.webkit.org/show_bug.cgi?id=215850
+
+        Reviewed by Chris Fleizach.
+
+        - Renamed AXIsolatedObject::m_attributeMap to m_propertyMap for naming
+        conssistency.
+        - typedef -> using
+        - Removed AXPropertyName::None, not used.
+        - Replaced AccessibilityIsolatedTreeMathMultiscriptPair alias with its
+        definition, shorter, clearer, and can be used for other property of the
+        same type.
+
+        * accessibility/isolatedtree/AXIsolatedObject.cpp:
+        (WebCore::AXIsolatedObject::setMathscripts):
+        (WebCore::AXIsolatedObject::setProperty):
+        (WebCore::AXIsolatedObject::insertMathPairs):
+        (WebCore::AXIsolatedObject::mathPrescripts):
+        (WebCore::AXIsolatedObject::mathPostscripts):
+        (WebCore::AXIsolatedObject::intPointAttributeValue const):
+        (WebCore::AXIsolatedObject::objectAttributeValue const):
+        (WebCore::AXIsolatedObject::rectAttributeValue const):
+        (WebCore::AXIsolatedObject::vectorAttributeValue const):
+        (WebCore::AXIsolatedObject::optionSetAttributeValue const):
+        (WebCore::AXIsolatedObject::pairAttributeValue const):
+        (WebCore::AXIsolatedObject::uint64AttributeValue const):
+        (WebCore::AXIsolatedObject::urlAttributeValue const):
+        (WebCore::AXIsolatedObject::pathAttributeValue const):
+        (WebCore::AXIsolatedObject::colorAttributeValue const):
+        (WebCore::AXIsolatedObject::floatAttributeValue const):
+        (WebCore::AXIsolatedObject::doubleAttributeValue const):
+        (WebCore::AXIsolatedObject::unsignedAttributeValue const):
+        (WebCore::AXIsolatedObject::boolAttributeValue const):
+        (WebCore::AXIsolatedObject::stringAttributeValue const):
+        (WebCore::AXIsolatedObject::intAttributeValue const):
+        * accessibility/isolatedtree/AXIsolatedObject.h:
+        * accessibility/isolatedtree/AXIsolatedTree.h:
+
 2020-08-26  Zalan Bujtas  <[email protected]>
 
         [LFC][IFC] Move inline run alignment logic to a dedicated class

Modified: trunk/Source/WebCore/accessibility/isolatedtree/AXIsolatedObject.cpp (266170 => 266171)


--- trunk/Source/WebCore/accessibility/isolatedtree/AXIsolatedObject.cpp	2020-08-26 16:48:33 UTC (rev 266170)
+++ trunk/Source/WebCore/accessibility/isolatedtree/AXIsolatedObject.cpp	2020-08-26 17:24:39 UTC (rev 266171)
@@ -412,11 +412,11 @@
     size_t mathSize = pairs.size();
     if (!mathSize)
         return;
-    
-    Vector<AccessibilityIsolatedTreeMathMultiscriptPair> idPairs;
+
+    Vector<std::pair<AXID, AXID>> idPairs;
     idPairs.reserveCapacity(mathSize);
     for (auto mathPair : pairs) {
-        AccessibilityIsolatedTreeMathMultiscriptPair idPair;
+        std::pair<AXID, AXID> idPair;
         if (mathPair.first)
             idPair.first = mathPair.first->objectID();
         if (mathPair.second)
@@ -451,9 +451,9 @@
 void AXIsolatedObject::setProperty(AXPropertyName propertyName, AXPropertyValueVariant&& value, bool shouldRemove)
 {
     if (shouldRemove)
-        m_attributeMap.remove(propertyName);
+        m_propertyMap.remove(propertyName);
     else
-        m_attributeMap.set(propertyName, value);
+        m_propertyMap.set(propertyName, value);
 }
 
 void AXIsolatedObject::setParent(AXID parent)
@@ -559,7 +559,7 @@
     return String();
 }
 
-void AXIsolatedObject::insertMathPairs(Vector<AccessibilityIsolatedTreeMathMultiscriptPair>& isolatedPairs, AccessibilityMathMultiscriptPairs& pairs)
+void AXIsolatedObject::insertMathPairs(Vector<std::pair<AXID, AXID>>& isolatedPairs, AccessibilityMathMultiscriptPairs& pairs)
 {
     for (const auto& pair : isolatedPairs) {
         AccessibilityMathMultiscriptPair prescriptPair;
@@ -573,13 +573,13 @@
 
 void AXIsolatedObject::mathPrescripts(AccessibilityMathMultiscriptPairs& pairs)
 {
-    auto isolatedPairs = vectorAttributeValue<AccessibilityIsolatedTreeMathMultiscriptPair>(AXPropertyName::MathPrescripts);
+    auto isolatedPairs = vectorAttributeValue<std::pair<AXID, AXID>>(AXPropertyName::MathPrescripts);
     insertMathPairs(isolatedPairs, pairs);
 }
 
 void AXIsolatedObject::mathPostscripts(AccessibilityMathMultiscriptPairs& pairs)
 {
-    auto isolatedPairs = vectorAttributeValue<AccessibilityIsolatedTreeMathMultiscriptPair>(AXPropertyName::MathPostscripts);
+    auto isolatedPairs = vectorAttributeValue<std::pair<AXID, AXID>>(AXPropertyName::MathPostscripts);
     insertMathPairs(isolatedPairs, pairs);
 }
 
@@ -721,7 +721,7 @@
 
 IntPoint AXIsolatedObject::intPointAttributeValue(AXPropertyName propertyName) const
 {
-    auto value = m_attributeMap.get(propertyName);
+    auto value = m_propertyMap.get(propertyName);
     return WTF::switchOn(value,
         [] (IntPoint& typedValue) { return typedValue; },
         [] (auto&) { return IntPoint(); }
@@ -730,7 +730,7 @@
 
 AXCoreObject* AXIsolatedObject::objectAttributeValue(AXPropertyName propertyName) const
 {
-    auto value = m_attributeMap.get(propertyName);
+    auto value = m_propertyMap.get(propertyName);
     AXID nodeID = WTF::switchOn(value,
         [] (AXID& typedValue) { return typedValue; },
         [] (auto&) { return InvalidAXID; }
@@ -742,7 +742,7 @@
 template<typename T>
 T AXIsolatedObject::rectAttributeValue(AXPropertyName propertyName) const
 {
-    auto value = m_attributeMap.get(propertyName);
+    auto value = m_propertyMap.get(propertyName);
     return WTF::switchOn(value,
         [] (T& typedValue) { return typedValue; },
         [] (auto&) { return T { }; }
@@ -752,7 +752,7 @@
 template<typename T>
 Vector<T> AXIsolatedObject::vectorAttributeValue(AXPropertyName propertyName) const
 {
-    auto value = m_attributeMap.get(propertyName);
+    auto value = m_propertyMap.get(propertyName);
     return WTF::switchOn(value,
         [] (Vector<T>& typedValue) { return typedValue; },
         [] (auto&) { return Vector<T>(); }
@@ -762,7 +762,7 @@
 template<typename T>
 OptionSet<T> AXIsolatedObject::optionSetAttributeValue(AXPropertyName propertyName) const
 {
-    auto value = m_attributeMap.get(propertyName);
+    auto value = m_propertyMap.get(propertyName);
     return WTF::switchOn(value,
         [] (T& typedValue) { return typedValue; },
         [] (auto&) { return OptionSet<T>(); }
@@ -772,7 +772,7 @@
 template<typename T>
 std::pair<T, T> AXIsolatedObject::pairAttributeValue(AXPropertyName propertyName) const
 {
-    auto value = m_attributeMap.get(propertyName);
+    auto value = m_propertyMap.get(propertyName);
     return WTF::switchOn(value,
         [] (std::pair<T, T>& typedValue) { return typedValue; },
         [] (auto&) { return std::pair<T, T>(0, 1); }
@@ -781,7 +781,7 @@
 
 uint64_t AXIsolatedObject::uint64AttributeValue(AXPropertyName propertyName) const
 {
-    auto value = m_attributeMap.get(propertyName);
+    auto value = m_propertyMap.get(propertyName);
     return WTF::switchOn(value,
         [] (uint64_t& typedValue) { return typedValue; },
         [] (auto&) { return 0; }
@@ -790,7 +790,7 @@
 
 URL AXIsolatedObject::urlAttributeValue(AXPropertyName propertyName) const
 {
-    auto value = m_attributeMap.get(propertyName);
+    auto value = m_propertyMap.get(propertyName);
     return WTF::switchOn(value,
         [] (URL& typedValue) { return typedValue; },
         [] (auto&) { return URL(); }
@@ -799,7 +799,7 @@
 
 Path AXIsolatedObject::pathAttributeValue(AXPropertyName propertyName) const
 {
-    auto value = m_attributeMap.get(propertyName);
+    auto value = m_propertyMap.get(propertyName);
     return WTF::switchOn(value,
         [] (Path& typedValue) { return typedValue; },
         [] (auto&) { return Path(); }
@@ -808,7 +808,7 @@
 
 Color AXIsolatedObject::colorAttributeValue(AXPropertyName propertyName) const
 {
-    auto value = m_attributeMap.get(propertyName);
+    auto value = m_propertyMap.get(propertyName);
     return WTF::switchOn(value,
         [] (Color& typedValue) { return typedValue; },
         [] (auto&) { return Color(); }
@@ -817,7 +817,7 @@
 
 float AXIsolatedObject::floatAttributeValue(AXPropertyName propertyName) const
 {
-    auto value = m_attributeMap.get(propertyName);
+    auto value = m_propertyMap.get(propertyName);
     return WTF::switchOn(value,
         [] (float& typedValue) { return typedValue; },
         [] (auto&) { return 0; }
@@ -826,7 +826,7 @@
 
 double AXIsolatedObject::doubleAttributeValue(AXPropertyName propertyName) const
 {
-    auto value = m_attributeMap.get(propertyName);
+    auto value = m_propertyMap.get(propertyName);
     return WTF::switchOn(value,
         [] (double& typedValue) { return typedValue; },
         [] (auto&) { return 0; }
@@ -835,7 +835,7 @@
 
 unsigned AXIsolatedObject::unsignedAttributeValue(AXPropertyName propertyName) const
 {
-    auto value = m_attributeMap.get(propertyName);
+    auto value = m_propertyMap.get(propertyName);
     return WTF::switchOn(value,
         [] (unsigned& typedValue) { return typedValue; },
         [] (auto&) { return 0; }
@@ -844,7 +844,7 @@
 
 bool AXIsolatedObject::boolAttributeValue(AXPropertyName propertyName) const
 {
-    auto value = m_attributeMap.get(propertyName);
+    auto value = m_propertyMap.get(propertyName);
     return WTF::switchOn(value,
         [] (bool& typedValue) { return typedValue; },
         [] (auto&) { return false; }
@@ -853,7 +853,7 @@
 
 String AXIsolatedObject::stringAttributeValue(AXPropertyName propertyName) const
 {
-    auto value = m_attributeMap.get(propertyName);
+    auto value = m_propertyMap.get(propertyName);
     return WTF::switchOn(value,
         [] (String& typedValue) { return typedValue; },
         [] (auto&) { return emptyString(); }
@@ -862,7 +862,7 @@
 
 int AXIsolatedObject::intAttributeValue(AXPropertyName propertyName) const
 {
-    auto value = m_attributeMap.get(propertyName);
+    auto value = m_propertyMap.get(propertyName);
     return WTF::switchOn(value,
         [] (int& typedValue) { return typedValue; },
         [] (auto&) { return 0; }

Modified: trunk/Source/WebCore/accessibility/isolatedtree/AXIsolatedObject.h (266170 => 266171)


--- trunk/Source/WebCore/accessibility/isolatedtree/AXIsolatedObject.h	2020-08-26 16:48:33 UTC (rev 266170)
+++ trunk/Source/WebCore/accessibility/isolatedtree/AXIsolatedObject.h	2020-08-26 17:24:39 UTC (rev 266171)
@@ -112,7 +112,7 @@
 
     void fillChildrenVectorForProperty(AXPropertyName, AccessibilityChildrenVector&) const;
     void setMathscripts(AXPropertyName, AXCoreObject&);
-    void insertMathPairs(Vector<AccessibilityIsolatedTreeMathMultiscriptPair>&, AccessibilityMathMultiscriptPairs&);
+    void insertMathPairs(Vector<std::pair<AXID, AXID>>&, AccessibilityMathMultiscriptPairs&);
     template<typename U> void performFunctionOnMainThread(U&&);
 
     // Attribute retrieval overrides.
@@ -650,7 +650,7 @@
     AXID m_id { InvalidAXID };
     Vector<AXID> m_childrenIDs;
     Vector<RefPtr<AXCoreObject>> m_children;
-    AXPropertyMap m_attributeMap;
+    AXPropertyMap m_propertyMap;
 
 #if PLATFORM(COCOA)
     RetainPtr<NSView> m_platformWidget;

Modified: trunk/Source/WebCore/accessibility/isolatedtree/AXIsolatedTree.h (266170 => 266171)


--- trunk/Source/WebCore/accessibility/isolatedtree/AXIsolatedTree.h	2020-08-26 16:48:33 UTC (rev 266170)
+++ trunk/Source/WebCore/accessibility/isolatedtree/AXIsolatedTree.h	2020-08-26 17:24:39 UTC (rev 266171)
@@ -43,10 +43,9 @@
 class AXObjectCache;
 class Page;
 
-typedef unsigned AXIsolatedTreeID;
+using AXIsolatedTreeID = unsigned;
 
 enum class AXPropertyName : uint16_t {
-    None = 0,
     ARIAControlsElements,
     ARIADetailsElements,
     DropEffects,
@@ -79,7 +78,7 @@
     CanSetTextRangeAttributes,
     CanSetValueAttribute,
     CanvasHasFallbackContent,
-#if PLATFORM(COCOA) && !PLATFORM(IOS_FAMILY)
+#if PLATFORM(MAC)
     CaretBrowsingEnabled,
 #endif
     Cells,
@@ -307,10 +306,8 @@
     WebArea,
 };
 
-typedef std::pair<AXID, AXID> AccessibilityIsolatedTreeMathMultiscriptPair;
-
 using AXPropertyValueVariant = Variant<std::nullptr_t, String, bool, int, unsigned, double, float, uint64_t, Color, URL, LayoutRect, FloatRect, AXID, IntPoint, OptionSet<SpeakAs>, std::pair<unsigned, unsigned>, Vector<AccessibilityText>, Vector<AXID>, Vector<std::pair<AXID, AXID>>, Vector<String>, Path>;
-typedef HashMap<AXPropertyName, AXPropertyValueVariant, WTF::IntHash<AXPropertyName>, WTF::StrongEnumHashTraits<AXPropertyName>> AXPropertyMap;
+using AXPropertyMap = HashMap<AXPropertyName, AXPropertyValueVariant, WTF::IntHash<AXPropertyName>, WTF::StrongEnumHashTraits<AXPropertyName>>;
 
 struct AXPropertyChange {
     AXID axID { InvalidAXID }; // ID of the object whose properties changed.
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to