summaryrefslogtreecommitdiff
path: root/chromium/third_party/blink/renderer/modules/exported/web_ax_object.cc
diff options
context:
space:
mode:
Diffstat (limited to 'chromium/third_party/blink/renderer/modules/exported/web_ax_object.cc')
-rw-r--r--chromium/third_party/blink/renderer/modules/exported/web_ax_object.cc147
1 files changed, 75 insertions, 72 deletions
diff --git a/chromium/third_party/blink/renderer/modules/exported/web_ax_object.cc b/chromium/third_party/blink/renderer/modules/exported/web_ax_object.cc
index 8e4a75ab03b..6db5a589ad6 100644
--- a/chromium/third_party/blink/renderer/modules/exported/web_ax_object.cc
+++ b/chromium/third_party/blink/renderer/modules/exported/web_ax_object.cc
@@ -31,7 +31,6 @@
#include "third_party/blink/public/web/web_ax_object.h"
#include "third_party/blink/public/platform/web_float_rect.h"
-#include "third_party/blink/public/platform/web_point.h"
#include "third_party/blink/public/platform/web_rect.h"
#include "third_party/blink/public/platform/web_string.h"
#include "third_party/blink/public/platform/web_url.h"
@@ -65,23 +64,23 @@
namespace blink {
namespace {
-blink::ScrollAlignmentBehavior ToBlinkScrollAlignmentBehavior(
+mojom::blink::ScrollAlignment::Behavior ToBlinkScrollAlignmentBehavior(
ax::mojom::ScrollAlignment alignment) {
switch (alignment) {
case ax::mojom::ScrollAlignment::kNone:
- return blink::kScrollAlignmentNoScroll;
+ return mojom::blink::ScrollAlignment::Behavior::kNoScroll;
case ax::mojom::ScrollAlignment::kScrollAlignmentCenter:
- return blink::kScrollAlignmentCenter;
+ return mojom::blink::ScrollAlignment::Behavior::kCenter;
case ax::mojom::ScrollAlignment::kScrollAlignmentTop:
- return blink::kScrollAlignmentTop;
+ return mojom::blink::ScrollAlignment::Behavior::kTop;
case ax::mojom::ScrollAlignment::kScrollAlignmentBottom:
- return blink::kScrollAlignmentBottom;
+ return mojom::blink::ScrollAlignment::Behavior::kBottom;
case ax::mojom::ScrollAlignment::kScrollAlignmentLeft:
- return blink::kScrollAlignmentLeft;
+ return mojom::blink::ScrollAlignment::Behavior::kLeft;
case ax::mojom::ScrollAlignment::kScrollAlignmentRight:
- return blink::kScrollAlignmentRight;
+ return mojom::blink::ScrollAlignment::Behavior::kRight;
case ax::mojom::ScrollAlignment::kScrollAlignmentClosestEdge:
- return blink::kScrollAlignmentClosestEdge;
+ return mojom::blink::ScrollAlignment::Behavior::kClosestEdge;
}
NOTREACHED() << alignment;
}
@@ -195,9 +194,8 @@ bool WebAXObject::UpdateLayoutAndCheckValidity() {
Document* document = private_->GetDocument();
if (!document || !document->View())
return false;
- if (IsLayoutClean(document))
- return true;
- if (!document->View()->UpdateLifecycleToCompositingCleanPlusScrolling())
+ if (!document->View()->UpdateLifecycleToCompositingCleanPlusScrolling(
+ DocumentUpdateReason::kAccessibility))
return false;
}
@@ -255,7 +253,7 @@ WebAXObject WebAXObject::ParentObject() const {
if (IsDetached())
return WebAXObject();
- return WebAXObject(private_->ParentObject());
+ return WebAXObject(private_->ParentObjectIncludedInTree());
}
void WebAXObject::GetSparseAXAttributes(
@@ -372,13 +370,6 @@ bool WebAXObject::IsLinked() const {
return private_->IsLinked();
}
-bool WebAXObject::IsLoaded() const {
- if (IsDetached())
- return false;
-
- return private_->IsLoaded();
-}
-
bool WebAXObject::IsModal() const {
if (IsDetached())
return false;
@@ -442,6 +433,13 @@ bool WebAXObject::IsVisited() const {
return private_->IsVisited();
}
+bool WebAXObject::HasAriaAttribute() const {
+ if (IsDetached())
+ return false;
+
+ return private_->HasAriaAttribute();
+}
+
WebString WebAXObject::AccessKey() const {
if (IsDetached())
return WebString();
@@ -673,13 +671,6 @@ WebString WebAXObject::AriaInvalidValue() const {
return private_->AriaInvalidValue();
}
-double WebAXObject::EstimatedLoadingProgress() const {
- if (IsDetached())
- return 0.0;
-
- return private_->EstimatedLoadingProgress();
-}
-
int WebAXObject::HeadingLevel() const {
if (IsDetached())
return 0;
@@ -698,14 +689,14 @@ int WebAXObject::HierarchicalLevel() const {
// that (0, 0) is the top left of the visual viewport. In other words, the
// point has the VisualViewport scale applied, but not the VisualViewport
// offset. crbug.com/459591.
-WebAXObject WebAXObject::HitTest(const WebPoint& point) const {
+WebAXObject WebAXObject::HitTest(const gfx::Point& point) const {
if (IsDetached())
return WebAXObject();
ScopedActionAnnotator annotater(private_.Get());
IntPoint contents_point =
private_->DocumentFrameView()->SoonToBeRemovedUnscaledViewportToContents(
- point);
+ IntPoint(point));
AXObject* hit = private_->AccessibilityHitTest(contents_point);
if (hit)
@@ -835,6 +826,27 @@ static ax::mojom::TextAffinity ToAXAffinity(TextAffinity affinity) {
}
}
+bool WebAXObject::IsLoaded() const {
+ if (IsDetached())
+ return false;
+
+ return private_->IsLoaded();
+}
+
+double WebAXObject::EstimatedLoadingProgress() const {
+ if (IsDetached())
+ return 0.0;
+
+ return private_->EstimatedLoadingProgress();
+}
+
+WebAXObject WebAXObject::RootScroller() const {
+ if (IsDetached())
+ return WebAXObject();
+
+ return WebAXObject(private_->RootScroller());
+}
+
void WebAXObject::Selection(bool& is_selection_backward,
WebAXObject& anchor_object,
int& anchor_offset,
@@ -1206,28 +1218,11 @@ WebDocument WebAXObject::GetDocument() const {
return WebDocument(document);
}
-bool WebAXObject::HasComputedStyle() const {
- if (IsDetached())
- return false;
-
- Document* document = private_->GetDocument();
- if (document)
- document->UpdateStyleAndLayoutTree();
-
- Node* node = private_->GetNode();
- if (!node || node->IsDocumentNode())
- return false;
-
- return node->GetComputedStyle();
-}
-
WebString WebAXObject::ComputedStyleDisplay() const {
if (IsDetached())
return WebString();
- Document* document = private_->GetDocument();
- if (document)
- document->UpdateStyleAndLayoutTree();
+ DCHECK(IsLayoutClean(private_->GetDocument()));
Node* node = private_->GetNode();
if (!node || node->IsDocumentNode())
@@ -1521,32 +1516,38 @@ bool WebAXObject::IsScrollableContainer() const {
return private_->IsScrollableContainer();
}
-WebPoint WebAXObject::GetScrollOffset() const {
+bool WebAXObject::IsUserScrollable() const {
if (IsDetached())
- return WebPoint();
+ return false;
+
+ return private_->IsUserScrollable();
+}
+gfx::Point WebAXObject::GetScrollOffset() const {
+ if (IsDetached())
+ return gfx::Point();
return private_->GetScrollOffset();
}
-WebPoint WebAXObject::MinimumScrollOffset() const {
+gfx::Point WebAXObject::MinimumScrollOffset() const {
if (IsDetached())
- return WebPoint();
+ return gfx::Point();
return private_->MinimumScrollOffset();
}
-WebPoint WebAXObject::MaximumScrollOffset() const {
+gfx::Point WebAXObject::MaximumScrollOffset() const {
if (IsDetached())
- return WebPoint();
+ return gfx::Point();
return private_->MaximumScrollOffset();
}
-void WebAXObject::SetScrollOffset(const WebPoint& offset) const {
+void WebAXObject::SetScrollOffset(const gfx::Point& offset) const {
if (IsDetached())
return;
- private_->SetScrollOffset(offset);
+ private_->SetScrollOffset(IntPoint(offset));
}
void WebAXObject::Dropeffects(
@@ -1571,9 +1572,7 @@ void WebAXObject::GetRelativeBounds(WebAXObject& offset_container,
if (IsDetached())
return;
-#if DCHECK_IS_ON()
DCHECK(IsLayoutClean(private_->GetDocument()));
-#endif
AXObject* container = nullptr;
FloatRect bounds;
@@ -1605,30 +1604,30 @@ bool WebAXObject::ScrollToMakeVisibleWithSubFocus(
auto vertical_behavior =
ToBlinkScrollAlignmentBehavior(vertical_scroll_alignment);
- blink::ScrollAlignmentBehavior visible_horizontal_behavior =
+ mojom::blink::ScrollAlignment::Behavior visible_horizontal_behavior =
scroll_behavior == ax::mojom::ScrollBehavior::kScrollIfVisible
? horizontal_behavior
- : kScrollAlignmentNoScroll;
- blink::ScrollAlignmentBehavior visible_vertical_behavior =
+ : mojom::blink::ScrollAlignment::Behavior::kNoScroll;
+ mojom::blink::ScrollAlignment::Behavior visible_vertical_behavior =
scroll_behavior == ax::mojom::ScrollBehavior::kScrollIfVisible
? vertical_behavior
- : kScrollAlignmentNoScroll;
+ : mojom::blink::ScrollAlignment::Behavior::kNoScroll;
- blink::ScrollAlignment blink_horizontal_scroll_alignment = {
+ blink::mojom::blink::ScrollAlignment blink_horizontal_scroll_alignment = {
visible_horizontal_behavior, horizontal_behavior, horizontal_behavior};
- blink::ScrollAlignment blink_vertical_scroll_alignment = {
+ blink::mojom::blink::ScrollAlignment blink_vertical_scroll_alignment = {
visible_vertical_behavior, vertical_behavior, vertical_behavior};
return private_->RequestScrollToMakeVisibleWithSubFocusAction(
subfocus, blink_horizontal_scroll_alignment,
blink_vertical_scroll_alignment);
}
-bool WebAXObject::ScrollToGlobalPoint(const WebPoint& point) const {
+bool WebAXObject::ScrollToGlobalPoint(const gfx::Point& point) const {
if (IsDetached())
return false;
ScopedActionAnnotator annotater(private_.Get());
- return private_->RequestScrollToGlobalPointAction(point);
+ return private_->RequestScrollToGlobalPointAction(IntPoint(point));
}
void WebAXObject::Swap(WebAXObject& other) {
@@ -1649,6 +1648,13 @@ void WebAXObject::HandleAutofillStateChanged(
private_->HandleAutofillStateChanged(state);
}
+int WebAXObject::GetDOMNodeId() const {
+ if (IsDetached())
+ return 0;
+
+ return private_->GetDOMNodeId();
+}
+
WebString WebAXObject::ToString() const {
if (IsDetached())
return WebString();
@@ -1707,7 +1713,7 @@ WebAXObject::operator AXObject*() const {
WebAXObject WebAXObject::FromWebNode(const WebNode& web_node) {
WebDocument web_document = web_node.GetDocument();
const Document* doc = web_document.ConstUnwrap<Document>();
- AXObjectCacheImpl* cache = ToAXObjectCacheImpl(doc->ExistingAXObjectCache());
+ auto* cache = To<AXObjectCacheImpl>(doc->ExistingAXObjectCache());
const Node* node = web_node.ConstUnwrap<Node>();
return cache ? WebAXObject(cache->Get(node)) : WebAXObject();
}
@@ -1715,8 +1721,7 @@ WebAXObject WebAXObject::FromWebNode(const WebNode& web_node) {
// static
WebAXObject WebAXObject::FromWebDocument(const WebDocument& web_document) {
const Document* document = web_document.ConstUnwrap<Document>();
- AXObjectCacheImpl* cache =
- ToAXObjectCacheImpl(document->ExistingAXObjectCache());
+ auto* cache = To<AXObjectCacheImpl>(document->ExistingAXObjectCache());
return cache ? WebAXObject(cache->GetOrCreate(document->GetLayoutView()))
: WebAXObject();
}
@@ -1725,8 +1730,7 @@ WebAXObject WebAXObject::FromWebDocument(const WebDocument& web_document) {
WebAXObject WebAXObject::FromWebDocumentByID(const WebDocument& web_document,
int ax_id) {
const Document* document = web_document.ConstUnwrap<Document>();
- AXObjectCacheImpl* cache =
- ToAXObjectCacheImpl(document->ExistingAXObjectCache());
+ auto* cache = To<AXObjectCacheImpl>(document->ExistingAXObjectCache());
return cache ? WebAXObject(cache->ObjectFromAXID(ax_id)) : WebAXObject();
}
@@ -1734,8 +1738,7 @@ WebAXObject WebAXObject::FromWebDocumentByID(const WebDocument& web_document,
WebAXObject WebAXObject::FromWebDocumentFocused(
const WebDocument& web_document) {
const Document* document = web_document.ConstUnwrap<Document>();
- AXObjectCacheImpl* cache =
- ToAXObjectCacheImpl(document->ExistingAXObjectCache());
+ auto* cache = To<AXObjectCacheImpl>(document->ExistingAXObjectCache());
return cache ? WebAXObject(cache->FocusedObject()) : WebAXObject();
}