Chromium Code Reviews| Index: third_party/WebKit/Source/web/WebAXObject.cpp |
| diff --git a/third_party/WebKit/Source/web/WebAXObject.cpp b/third_party/WebKit/Source/web/WebAXObject.cpp |
| index 3cca2dea3a7b940f7e77fc3f88cdaefda8567995..c06faf9473d8984901d1eed32f175efa80721c02 100644 |
| --- a/third_party/WebKit/Source/web/WebAXObject.cpp |
| +++ b/third_party/WebKit/Source/web/WebAXObject.cpp |
| @@ -62,6 +62,42 @@ |
| namespace blink { |
| +class SparseAttributeMapAdapter : public AXSparseAttributeMap { |
|
aboxhall
2017/01/10 05:59:59
WebAX[...]Wrapper/Adapter?
dmazzoni
2017/01/12 03:36:24
This is now SparseAttributeClientAdapter
I'm not
aboxhall
2017/01/12 04:26:51
I meant because it's adapting WebAXSparseAttribute
|
| + public: |
| + SparseAttributeMapAdapter(WebAXSparseAttributeMap& attributeMap) |
| + : m_attributeMap(attributeMap) {} |
| + virtual ~SparseAttributeMapAdapter() {} |
| + |
| + private: |
| + WebAXSparseAttributeMap& m_attributeMap; |
| + |
| + void addBoolAttribute(AXBoolAttribute attribute, bool value) override { |
| + m_attributeMap.addBoolAttribute(static_cast<WebAXBoolAttribute>(attribute), |
| + value); |
| + } |
| + |
| + void addStringAttribute(AXStringAttribute attribute, |
| + const String& value) override { |
| + m_attributeMap.addStringAttribute( |
| + static_cast<WebAXStringAttribute>(attribute), value); |
| + } |
| + |
| + void addObjectAttribute(AXObjectAttribute attribute, |
| + AXObject* value) override { |
| + m_attributeMap.addObjectAttribute( |
| + static_cast<WebAXObjectAttribute>(attribute), WebAXObject(value)); |
| + } |
| + |
| + void addObjectVectorAttribute(AXObjectVectorAttribute attribute, |
| + HeapVector<Member<AXObject>>& value) override { |
| + WebVector<WebAXObject> result(value.size()); |
| + for (size_t i = 0; i < value.size(); i++) |
| + result[i] = WebAXObject(value[i]); |
| + m_attributeMap.addObjectVectorAttribute( |
| + static_cast<WebAXObjectVectorAttribute>(attribute), result); |
| + } |
| +}; |
| + |
| #if DCHECK_IS_ON() |
| // It's not safe to call some WebAXObject APIs if a layout is pending. |
| // Clients should call updateLayoutAndCheckValidity first. |
| @@ -200,6 +236,14 @@ WebAXObject WebAXObject::parentObject() const { |
| return WebAXObject(m_private->parentObject()); |
| } |
| +void WebAXObject::getSparseAXAttributes(WebAXSparseAttributeMap& sink) const { |
| + if (isDetached()) |
| + return; |
| + |
| + SparseAttributeMapAdapter adapter(sink); |
| + m_private->getSparseAXAttributes(adapter); |
| +} |
| + |
| bool WebAXObject::canSetSelectedAttribute() const { |
| if (isDetached()) |
| return false; |
| @@ -432,21 +476,6 @@ WebAXObject WebAXObject::ariaActiveDescendant() const { |
| return WebAXObject(m_private->activeDescendant()); |
| } |
| -bool WebAXObject::ariaControls(WebVector<WebAXObject>& controlsElements) const { |
| - if (isDetached()) |
| - return false; |
| - |
| - AXObject::AXObjectVector controls; |
| - m_private->ariaControlsElements(controls); |
| - |
| - WebVector<WebAXObject> result(controls.size()); |
| - for (size_t i = 0; i < controls.size(); i++) |
| - result[i] = WebAXObject(controls[i]); |
| - controlsElements.swap(result); |
| - |
| - return true; |
| -} |
| - |
| bool WebAXObject::ariaHasPopup() const { |
| if (isDetached()) |
| return false; |
| @@ -454,21 +483,6 @@ bool WebAXObject::ariaHasPopup() const { |
| return m_private->ariaHasPopup(); |
| } |
| -bool WebAXObject::ariaFlowTo(WebVector<WebAXObject>& flowToElements) const { |
| - if (isDetached()) |
| - return false; |
| - |
| - AXObject::AXObjectVector flowTo; |
| - m_private->ariaFlowToElements(flowTo); |
| - |
| - WebVector<WebAXObject> result(flowTo.size()); |
| - for (size_t i = 0; i < flowTo.size(); i++) |
| - result[i] = WebAXObject(flowTo[i]); |
| - flowToElements.swap(result); |
| - |
| - return true; |
| -} |
| - |
| bool WebAXObject::isEditable() const { |
| if (isDetached()) |
| return false; |