Changeset 269923 in webkit
- Timestamp:
- Nov 17, 2020 2:14:20 PM (3 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r269921 r269923 1 2020-11-17 Andres Gonzalez <andresg_22@apple.com> 2 3 Implementation of AXCoreObject::innerHTML and outerHTML. 4 https://bugs.webkit.org/show_bug.cgi?id=219037 5 6 Reviewed by Chris Fleizach. 7 8 No change in functionality, debugging code. 9 10 - Added innerHTML and outerHTmL methods to AXCoreObject for debugging 11 purposes. 12 - The AXIsolatedObject implementation of these methods forwards the call 13 to the associated AXObject and does a lazy caching of the Inner/OuterHTML 14 properties. 15 - The AXLogger class is now declared and defined only #if !LOG_DISABLED. 16 17 * accessibility/AXLogger.cpp: 18 (WebCore::AXLogger::log): 19 (WebCore::operator<<): 20 * accessibility/AccessibilityObject.cpp: 21 (WebCore::AccessibilityObject::innerHTML const): 22 (WebCore::AccessibilityObject::outerHTML const): 23 * accessibility/AccessibilityObject.h: 24 * accessibility/AccessibilityObjectInterface.h: 25 * accessibility/isolatedtree/AXIsolatedObject.cpp: 26 (WebCore::AXIsolatedObject::innerHTML const): 27 (WebCore::AXIsolatedObject::outerHTML const): 28 * accessibility/isolatedtree/AXIsolatedObject.h: 29 * accessibility/isolatedtree/AXIsolatedTree.h: 30 * accessibility/mac/WebAccessibilityObjectWrapperBase.mm: 31 (-[WebAccessibilityObjectWrapperBase innerHTML]): 32 (-[WebAccessibilityObjectWrapperBase outerHTML]): 33 1 34 2020-11-17 Zalan Bujtas <zalan@apple.com> 2 35 -
trunk/Source/WebCore/accessibility/AXLogger.cpp
r269859 r269923 28 28 29 29 #include "config.h" 30 31 #if !LOG_DISABLED 30 32 #include "AXLogger.h" 31 33 … … 58 60 void AXLogger::log(const String& message) 59 61 { 60 #if !LOG_DISABLED61 62 LOG(Accessibility, "%s", message.utf8().data()); 62 #else63 UNUSED_PARAM(message);64 #endif65 63 } 66 64 … … 273 271 if (role == AccessibilityRole::StaticText && parent) 274 272 objectWithInterestingHTML = parent; 275 if (objectWithInterestingHTML) { 276 if (auto* element = objectWithInterestingHTML->element()) 277 stream.dumpProperty("outerHTML", element->outerHTML()); 278 } 273 if (objectWithInterestingHTML) 274 stream.dumpProperty("outerHTML", objectWithInterestingHTML->outerHTML()); 279 275 280 276 stream.dumpProperty("address", &object); … … 315 311 316 312 } // namespace WebCore 313 314 #endif // !LOG_DISABLED -
trunk/Source/WebCore/accessibility/AXLogger.h
r262224 r269923 26 26 #pragma once 27 27 28 #if !LOG_DISABLED 29 28 30 #include "AXObjectCache.h" 29 31 #include "AccessibilityObjectInterface.h" … … 49 51 }; 50 52 51 #if LOG_DISABLED 53 #define AXTRACE(methodName) AXLogger axLogger(methodName) 54 #define AXLOG(x) AXLogger::log(x) 55 56 } // namespace WebCore 57 58 #else 59 52 60 #define AXTRACE(methodName) (void)0 53 61 #define AXLOG(x) (void)0 54 #else55 #define AXTRACE(methodName) AXLogger axLogger(methodName)56 #define AXLOG(x) AXLogger::log(x)57 #endif // LOG_DISABLED58 62 59 } // namespace WebCore 63 #endif // !LOG_DISABLED -
trunk/Source/WebCore/accessibility/AccessibilityObject.cpp
r269568 r269923 3581 3581 } 3582 3582 3583 String AccessibilityObject::innerHTML() const 3584 { 3585 auto* element = this->element(); 3586 return element ? element->innerHTML() : String(); 3587 } 3588 3589 String AccessibilityObject::outerHTML() const 3590 { 3591 auto* element = this->element(); 3592 return element ? element->outerHTML() : String(); 3593 } 3594 3583 3595 namespace Accessibility { 3584 3596 -
trunk/Source/WebCore/accessibility/AccessibilityObject.h
r268610 r269923 784 784 unsigned getLengthForTextRange() const; 785 785 786 String innerHTML() const override; 787 String outerHTML() const override; 788 786 789 private: 787 790 Optional<SimpleRange> rangeOfStringClosestToRangeInDirection(const SimpleRange&, AccessibilitySearchDirection, const Vector<String>&) const; -
trunk/Source/WebCore/accessibility/AccessibilityObjectInterface.h
r268610 r269923 1490 1490 virtual AccessibilityChildrenVector documentLinks() = 0; 1491 1491 1492 virtual String innerHTML() const = 0; 1493 virtual String outerHTML() const = 0; 1494 1492 1495 private: 1493 1496 // Detaches this object from the objects it references and it is referenced by. -
trunk/Source/WebCore/accessibility/isolatedtree/AXIsolatedObject.cpp
r269692 r269923 2092 2092 } 2093 2093 2094 String AXIsolatedObject::innerHTML() const 2095 { 2096 if (m_propertyMap.contains(AXPropertyName::InnerHTML)) 2097 return stringAttributeValue(AXPropertyName::InnerHTML); 2098 2099 return Accessibility::retrieveValueFromMainThread<String>([this] () -> String { 2100 auto* axObject = associatedAXObject(); 2101 String value = axObject ? axObject->innerHTML().isolatedCopy() : String(); 2102 2103 // Cache value so that there is no need to access the main thread in subsequent calls. 2104 const_cast<AXIsolatedObject*>(this)->setProperty(AXPropertyName::InnerHTML, value); 2105 2106 return value; 2107 }); 2108 } 2109 2110 String AXIsolatedObject::outerHTML() const 2111 { 2112 if (m_propertyMap.contains(AXPropertyName::OuterHTML)) 2113 return stringAttributeValue(AXPropertyName::OuterHTML); 2114 2115 return Accessibility::retrieveValueFromMainThread<String>([this] () -> String { 2116 auto* axObject = associatedAXObject(); 2117 String value = axObject ? axObject->outerHTML().isolatedCopy() : String(); 2118 2119 // Cache value so that there is no need to access the main thread in subsequent calls. 2120 const_cast<AXIsolatedObject*>(this)->setProperty(AXPropertyName::OuterHTML, value); 2121 2122 return value; 2123 }); 2124 } 2125 2094 2126 } // namespace WebCore 2095 2127 -
trunk/Source/WebCore/accessibility/isolatedtree/AXIsolatedObject.h
r269692 r269923 648 648 void updateBackingStore() override; 649 649 650 String innerHTML() const override; 651 String outerHTML() const override; 652 650 653 AXIsolatedTreeID m_treeID; 651 654 RefPtr<AXIsolatedTree> m_cachedTree; -
trunk/Source/WebCore/accessibility/isolatedtree/AXIsolatedTree.h
r268454 r269923 127 127 HorizontalScrollBar, 128 128 IdentifierAttribute, 129 IncrementButton, 130 InnerHTML, 129 131 InvalidStatus, 130 IncrementButton,131 132 IsAccessibilityIgnored, 132 133 IsActiveDescendantOfFocusedContainer, … … 250 251 NextSibling, 251 252 Orientation, 253 OuterHTML, 252 254 Path, 253 255 PlaceholderValue, -
trunk/Source/WebCore/accessibility/mac/WebAccessibilityObjectWrapperBase.mm
r268585 r269923 602 602 } 603 603 604 #ifndef NDEBUG605 604 - (NSString *)innerHTML 606 605 { 607 if (auto* element = self.axBackingObject->element())608 return element->innerHTML();606 if (auto* backingObject = self.axBackingObject) 607 return backingObject->innerHTML(); 609 608 return nil; 610 609 } … … 612 611 - (NSString *)outerHTML 613 612 { 614 if (auto* element = self.axBackingObject->element())615 return element->outerHTML();613 if (auto* backingObject = self.axBackingObject) 614 return backingObject->outerHTML(); 616 615 return nil; 617 616 } 618 #endif619 617 620 618 #pragma mark Search helpers
Note: See TracChangeset
for help on using the changeset viewer.