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

Unified Diff: third_party/WebKit/Source/modules/accessibility/AXObjectImpl.h

Issue 2745713002: WIP: Modified AXPosition to work with objects with both embedded object characters and text. (Closed)
Patch Set: Simplified and cleaned up selection code in Blink > Accessibility. Created 3 years, 6 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
Index: third_party/WebKit/Source/modules/accessibility/AXObjectImpl.h
diff --git a/third_party/WebKit/Source/modules/accessibility/AXObjectImpl.h b/third_party/WebKit/Source/modules/accessibility/AXObjectImpl.h
index a2a9acc8f1a44aa42c5ea5882fe5d079a1dbfdc0..053496ad28337acbdbed590eeb5d6afe3ee5da58 100644
--- a/third_party/WebKit/Source/modules/accessibility/AXObjectImpl.h
+++ b/third_party/WebKit/Source/modules/accessibility/AXObjectImpl.h
@@ -36,6 +36,7 @@
#include "core/editing/markers/DocumentMarker.h"
#include "core/inspector/protocol/Accessibility.h"
#include "modules/ModulesExport.h"
+#include "modules/accessibility/AXRange.h"
#include "platform/geometry/FloatQuad.h"
#include "platform/geometry/LayoutRect.h"
#include "platform/graphics/Color.h"
@@ -253,72 +254,6 @@ class MODULES_EXPORT AXObjectImpl
public:
typedef HeapVector<Member<AXObjectImpl>> AXObjectVector;
- struct AXRange {
- DISALLOW_NEW_EXCEPT_PLACEMENT_NEW();
- // The deepest descendant in which the range starts.
- // (nullptr means the current object.)
- Persistent<AXObjectImpl> 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<AXObjectImpl> 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,
- AXObjectImpl* 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;
- }
- };
-
protected:
AXObjectImpl(AXObjectCacheImpl&);
@@ -747,15 +682,8 @@ class MODULES_EXPORT AXObjectImpl
bool HasAttribute(const QualifiedName&) const;
const AtomicString& GetAttribute(const QualifiedName&) const;
- // 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&) {}
+ // Selection.
+ virtual AXRange Selection() const;
// Scrollable containers.
bool IsScrollableContainer() const;
@@ -886,6 +814,9 @@ class MODULES_EXPORT AXObjectImpl
private:
bool IsCheckable() const;
static bool IsNativeInputInMixedState(const Node*);
+ void ComputeAXObjectAndOffset(const VisiblePositionInFlatTree& position,
+ AXObject** ax_object,
+ int* offset) const;
static bool IncludesARIAWidgetRole(const String&);
static bool HasInteractiveARIAAttribute(const Element&);

Powered by Google App Engine
This is Rietveld 408576698