Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(149)

Unified Diff: third_party/WebKit/Source/core/dom/AXObject.h

Issue 2907133002: Move WebAXObject.cpp to core/ (WIP) (Closed)
Patch Set: Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | third_party/WebKit/Source/modules/accessibility/AXARIAGridRow.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/core/dom/AXObject.h
diff --git a/third_party/WebKit/Source/core/dom/AXObject.h b/third_party/WebKit/Source/core/dom/AXObject.h
index ae518553788b2422fd184d33aef0db4cc3586f29..985a6479666cde0c4a4a0459d1263ca0c226d13b 100644
--- a/third_party/WebKit/Source/core/dom/AXObject.h
+++ b/third_party/WebKit/Source/core/dom/AXObject.h
@@ -288,8 +288,269 @@ enum AXDescriptionFrom {
// on AXObjectImpl from outside of modules/.
class CORE_EXPORT AXObject {
public:
+ typedef HeapVector<Member<AXObject>> AXObjectVector;
+
+ struct AXRange {
+ DISALLOW_NEW_EXCEPT_PLACEMENT_NEW();
+ // The deepest descendant in which the range starts.
+ // (nullptr means the current object.)
+ Persistent<AXObject> anchor_object;
+ // The number of characters and child objects in the anchor object
+ // before the range starts.
+ int anchor_offset;
+ // When the same character offset could correspond to two possible
+ // cursor positions, upstream means it's on the previous line rather
+ // than the next line.
+ TextAffinity anchor_affinity;
+
+ // The deepest descendant in which the range ends.
+ // (nullptr means the current object.)
+ Persistent<AXObject> focus_object;
+ // The number of characters and child objects in the focus object
+ // before the range ends.
+ int focus_offset;
+ // When the same character offset could correspond to two possible
+ // cursor positions, upstream means it's on the previous line rather
+ // than the next line.
+ TextAffinity focus_affinity;
+
+ AXRange()
+ : anchor_object(nullptr),
+ anchor_offset(-1),
+ anchor_affinity(TextAffinity::kUpstream),
+ focus_object(nullptr),
+ focus_offset(-1),
+ focus_affinity(TextAffinity::kDownstream) {}
+
+ AXRange(int start_offset, int end_offset)
+ : anchor_object(nullptr),
+ anchor_offset(start_offset),
+ anchor_affinity(TextAffinity::kUpstream),
+ focus_object(nullptr),
+ focus_offset(end_offset),
+ focus_affinity(TextAffinity::kDownstream) {}
+
+ AXRange(AXObjectImpl* anchor_object,
+ int anchor_offset,
+ TextAffinity anchor_affinity,
+ AXObject* focus_object,
+ int focus_offset,
+ TextAffinity focus_affinity)
+ : anchor_object(anchor_object),
+ anchor_offset(anchor_offset),
+ anchor_affinity(anchor_affinity),
+ focus_object(focus_object),
+ focus_offset(focus_offset),
+ focus_affinity(focus_affinity) {}
+
+ bool IsValid() const {
+ return ((anchor_object && focus_object) ||
+ (!anchor_object && !focus_object)) &&
+ anchor_offset >= 0 && focus_offset >= 0;
+ }
+
+ // Determines if the range only refers to text offsets under the current
+ // object.
+ bool IsSimple() const {
+ return anchor_object == focus_object || !anchor_object || !focus_object;
+ }
+ };
+
// Static helper functions.
static bool IsInsideFocusableElementOrARIAWidget(const Node&);
+
+ // Properties of static elements.
+ virtual const AtomicString& AccessKey() const = 0;
+ virtual bool CanvasHasFallbackContent() const = 0;
+ virtual String FontFamily() const = 0;
+ // Font size is in pixels.
+ virtual float FontSize() const = 0;
+
+ // Value should be 1-based. 0 means not supported.
+ virtual int HeadingLevel() const { return 0; }
+ // Value should be 1-based. 0 means not supported.
+ virtual unsigned HierarchicalLevel() const { return 0; }
+ // Return the content of an image or canvas as an image data url in
+ // PNG format. If |maxSize| is not empty and if the image is larger than
+ // those dimensions, the image will be resized proportionally first to fit.
+ virtual String ImageDataUrl(const IntSize& max_size) const = 0;
+ virtual AXObject* InPageLinkTarget() const = 0;
+ virtual AccessibilityOrientation Orientation() const = 0;
+ virtual AccessibilityTextDirection GetTextDirection() const = 0;
+ virtual TextStyle GetTextStyle() const = 0;
+ virtual AXObjectVector RadioButtonsInGroup() const = 0;
+ virtual KURL Url() const = 0;
+
+ // Load inline text boxes for just this node, even if
+ // settings->inlineTextBoxAccessibilityEnabled() is false.
+ virtual void LoadInlineTextBoxes() = 0;
+
+ // Walk the AXObjects on the same line. This is supported on any
+ // object type but primarily intended to be used for inline text boxes.
+ virtual AXObject* NextOnLine() const = 0;
+ virtual AXObject* PreviousOnLine() const = 0;
+
+ // For all node objects. The start and end character offset of each
+ // marker, such as spelling or grammar error.
+ virtual void Markers(Vector<DocumentMarker::MarkerType>&,
+ Vector<AXRange>&) const = 0;
+ // For an inline text box.
+ // The integer horizontal pixel offset of each character in the string;
+ // negative values for RTL.
+ virtual void TextCharacterOffsets(Vector<int>&) const = 0;
+ // The start and end character offset of each word in the object's text.
+ virtual void GetWordBoundaries(Vector<AXRange>&) const = 0;
+
+ // Properties of interactive elements.
+ virtual InvalidState GetInvalidState() const = 0;
+ // Only used when invalidState() returns InvalidStateOther.
+ virtual String AriaInvalidValue() const = 0;
+ virtual String ValueDescription() const = 0;
+ virtual float ValueForRange() const = 0;
+ virtual float MaxValueForRange() const = 0;
+ virtual float MinValueForRange() const = 0;
+ virtual String StringValue() const = 0;
+
+ // ARIA attributes.
+ virtual bool SupportsRangeValue() const = 0;
+
+ // Properties of the object's owning document or page.
+ virtual double EstimatedLoadingProgress() const = 0;
+
+ // ARIA live-region features.
+ virtual AXObject* LiveRegionRoot() const = 0;
+
+ // DOM and layout tree access.
+ virtual Node* GetNode() const = 0;
+ virtual LocalFrameView* DocumentFrameView() const = 0;
+
+ // Get the bounds in frame-relative coordinates as a LayoutRect.
+ virtual LayoutRect GetBoundsInFrameCoordinates() const = 0;
+
+ // Every object's bounding box is returned relative to a
+ // container object (which is guaranteed to be an ancestor) and
+ // optionally a transformation matrix that needs to be applied too.
+ // To compute the absolute bounding box of an element, start with its
+ // boundsInContainer and apply the transform. Then as long as its container is
+ // not null, walk up to its container and offset by the container's offset
+ // from origin, the container's scroll position if any, and apply the
+ // container's transform. Do this until you reach the root of the tree.
+ virtual void GetRelativeBounds(AXObject** out_container,
+ FloatRect& out_bounds_in_container,
+ SkMatrix44& out_container_transform) const;
+
+ // Hit testing.
+ // Called on the root AX object to return the deepest available element.
+ virtual AXObject* AccessibilityHitTest(const IntPoint&) const = 0;
+
+ virtual const AtomicString& ContainerLiveRegionStatus() const = 0;
+ virtual const AtomicString& ContainerLiveRegionRelevant() const = 0;
+ virtual bool ContainerLiveRegionAtomic() const = 0;
+ virtual bool ContainerLiveRegionBusy() const = 0;
+
+ // DOM and layout tree access.
+ virtual Node* GetNode() const = 0;
+ virtual Document* GetDocument() const = 0;
+ virtual String Language() const = 0;
+
+ // Scrollable containers.
+ virtual bool IsScrollableContainer() const = 0;
+ virtual IntPoint GetScrollOffset() const = 0;
+ virtual IntPoint MinimumScrollOffset() const = 0;
+ virtual IntPoint MaximumScrollOffset() const = 0;
+ virtual void SetScrollOffset(const IntPoint&) const = 0;
+
+ // Modify or take an action on an object.
+ virtual void Increment() = 0;
+ virtual void Decrement() = 0;
+ virtual bool PerformDefaultAction() = 0;
+ virtual bool Press() = 0;
+ // Make this object visible by scrolling as many nested scrollable views as
+ // needed.
+ virtual void ScrollToMakeVisible() const = 0;
+ // Same, but if the whole object can't be made visible, try for this subrect,
+ // in local coordinates.
+ virtual void ScrollToMakeVisibleWithSubFocus(const IntRect&) const = 0;
+ // Scroll this object to a given point in global coordinates of the top-level
+ // window.
+ virtual void ScrollToGlobalPoint(const IntPoint&) const = 0;
+ virtual void SetFocused(bool) = 0;
+ virtual void SetSequentialFocusNavigationStartingPoint() = 0;
+ virtual void SetValue(const String&) = 0;
+
+ // Check object role or purpose.
+ virtual AccessibilityRole RoleValue() const = 0;
+
+ // Methods that retrieve or manipulate the current selection.
+
+ // Get the current selection from anywhere in the accessibility tree.
+ virtual AXRange Selection() const { return AXRange(); }
+ // Gets only the start and end offsets of the selection computed using the
+ // current object as the starting point. Returns a null selection if there is
+ // no selection in the subtree rooted at this object.
+ virtual AXRange SelectionUnderObject() const { return AXRange(); }
+ virtual void SetSelection(const AXRange&) {}
+
+ // Text metrics. Most of these should be deprecated, needs major cleanup.
+ virtual VisiblePosition VisiblePositionForIndex(int) const = 0;
+ virtual int LineForPosition(const VisiblePosition&) const = 0;
+ virtual void LineBreaks(Vector<int>&) const = 0;
+
+ // Whether objects are ignored, i.e. not included in the tree.
+ virtual bool AccessibilityIsIgnored() = 0;
+ ;
+
+ // Accessible name calculation
+
+ // Retrieves the accessible name of the object, an enum indicating where the
+ // name was derived from, and a list of objects that were used to derive the
+ // name, if any.
+ virtual String GetName(AXNameFrom&, AXObjectVector* name_objects) const = 0;
+
+ typedef HeapVector<DescriptionSource> DescriptionSources;
+ // Takes the result of nameFrom from calling |name|, above, and retrieves the
+ // accessible description of the object, which is secondary to |name|, an enum
+ // indicating where the description was derived from, and a list of objects
+ // that were used to derive the description, if any.
+ virtual String Description(AXNameFrom,
+ AXDescriptionFrom&,
+ AXObjectVector* description_objects) const = 0;
+
+ // Takes the result of nameFrom and descriptionFrom from calling |name| and
+ // |description|, above, and retrieves the placeholder of the object, if
+ // present and if it wasn't already exposed by one of the two functions above.
+ virtual String Placeholder(AXNameFrom) const = 0;
+
+ // Methods from WebAXObject.
+ // For a table
+ virtual int AriaColumnCount() const = 0;
+ virtual unsigned AriaColumnIndex() const = 0;
+ virtual int AriaRowCount() const = 0;
+ virtual unsigned AriaRowIndex() const = 0;
+ virtual unsigned ColumnCount() const = 0;
+ virtual unsigned RowCount() const = 0;
+ virtual WebAXObject CellForColumnAndRow(unsigned column,
+ unsigned row) const = 0;
+ virtual WebAXObject HeaderContainerObject() const = 0;
+ virtual WebAXObject RowAtIndex(unsigned row_index) const = 0;
+ virtual WebAXObject ColumnAtIndex(unsigned column_index) const = 0;
+ virtual void RowHeaders(WebVector<WebAXObject>&) const = 0;
+ virtual void ColumnHeaders(WebVector<WebAXObject>&) const = 0;
+
+ // For a table row
+ virtual unsigned RowIndex() const = 0;
+ virtual WebAXObject RowHeader() const = 0;
+
+ // For a table column
+ virtual unsigned ColumnIndex() const = 0;
+ virtual WebAXObject ColumnHeader() const = 0;
+
+ // For a table cell
+ virtual unsigned CellColumnIndex() const = 0;
+ virtual unsigned CellColumnSpan() const = 0;
+ virtual unsigned CellRowIndex() const = 0;
+ virtual unsigned CellRowSpan() const = 0;
+ virtual WebAXSortDirection SortDirection() const = 0;
};
} // namespace blink
« no previous file with comments | « no previous file | third_party/WebKit/Source/modules/accessibility/AXARIAGridRow.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698