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

Unified Diff: third_party/WebKit/Source/modules/exported/WebAXObject.cpp

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
« no previous file with comments | « third_party/WebKit/Source/modules/accessibility/BUILD.gn ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/modules/exported/WebAXObject.cpp
diff --git a/third_party/WebKit/Source/modules/exported/WebAXObject.cpp b/third_party/WebKit/Source/modules/exported/WebAXObject.cpp
index 088e3a3a4554338ab3d76c4250dc28e78d95f4a4..b8962a0c4ab6aa1b4db64944e0bc1494e0535500 100644
--- a/third_party/WebKit/Source/modules/exported/WebAXObject.cpp
+++ b/third_party/WebKit/Source/modules/exported/WebAXObject.cpp
@@ -48,6 +48,7 @@
#include "core/style/ComputedStyle.h"
#include "modules/accessibility/AXObjectCacheImpl.h"
#include "modules/accessibility/AXObjectImpl.h"
+#include "modules/accessibility/AXRange.h"
#include "modules/accessibility/AXTable.h"
#include "modules/accessibility/AXTableCell.h"
#include "modules/accessibility/AXTableColumn.h"
@@ -807,6 +808,7 @@ void WebAXObject::Selection(WebAXObject& anchor_object,
return;
}
+<<<<<<< HEAD:third_party/WebKit/Source/modules/exported/WebAXObject.cpp
AXObjectImpl::AXRange ax_selection = private_->Selection();
anchor_object = WebAXObject(ax_selection.anchor_object);
anchor_offset = ax_selection.anchor_offset;
@@ -816,6 +818,17 @@ void WebAXObject::Selection(WebAXObject& anchor_object,
focus_offset = ax_selection.focus_offset;
focus_affinity = static_cast<WebAXTextAffinity>(ax_selection.focus_affinity);
return;
+=======
+ AXRange ax_selection = private_->Selection();
+ // If selection is invalid, it will set object and offset endpoints to nullptr
+ // and -1 respectively.
+ anchor_object = WebAXObject(ax_selection.AnchorObject());
+ anchor_offset = ax_selection.AnchorOffset();
+ anchor_affinity = static_cast<WebAXTextAffinity>(ax_selection.Affinity());
+ focus_object = WebAXObject(ax_selection.FocusObject());
+ focus_offset = ax_selection.FocusOffset();
+ focus_affinity = static_cast<WebAXTextAffinity>(ax_selection.Affinity());
+>>>>>>> Simplified and cleaned up selection code in Blink > Accessibility.:third_party/WebKit/Source/web/WebAXObject.cpp
}
void WebAXObject::SetSelection(const WebAXObject& anchor_object,
@@ -825,10 +838,16 @@ void WebAXObject::SetSelection(const WebAXObject& anchor_object,
if (IsDetached())
return;
+<<<<<<< HEAD:third_party/WebKit/Source/modules/exported/WebAXObject.cpp
AXObjectImpl::AXRange ax_selection(anchor_object, anchor_offset,
TextAffinity::kUpstream, focus_object,
focus_offset, TextAffinity::kDownstream);
private_->SetSelection(ax_selection);
+=======
+ AXRange ax_selection(anchor_object, anchor_offset, focus_object, focus_offset,
+ TextAffinity::kDownstream);
+ ax_selection.Select();
+>>>>>>> Simplified and cleaned up selection code in Blink > Accessibility.:third_party/WebKit/Source/web/WebAXObject.cpp
return;
}
@@ -836,22 +855,32 @@ unsigned WebAXObject::SelectionEnd() const {
if (IsDetached())
return 0;
+<<<<<<< HEAD:third_party/WebKit/Source/modules/exported/WebAXObject.cpp
AXObjectImpl::AXRange ax_selection = private_->SelectionUnderObject();
if (ax_selection.focus_offset < 0)
+=======
+ AXRange ax_selection = private_->Selection();
+ if (ax_selection.FocusOffset() < 0)
+>>>>>>> Simplified and cleaned up selection code in Blink > Accessibility.:third_party/WebKit/Source/web/WebAXObject.cpp
return 0;
- return ax_selection.focus_offset;
+ return ax_selection.FocusOffset();
}
unsigned WebAXObject::SelectionStart() const {
if (IsDetached())
return 0;
+<<<<<<< HEAD:third_party/WebKit/Source/modules/exported/WebAXObject.cpp
AXObjectImpl::AXRange ax_selection = private_->SelectionUnderObject();
if (ax_selection.anchor_offset < 0)
+=======
+ AXRange ax_selection = private_->Selection();
+ if (ax_selection.AnchorOffset() < 0)
+>>>>>>> Simplified and cleaned up selection code in Blink > Accessibility.:third_party/WebKit/Source/web/WebAXObject.cpp
return 0;
- return ax_selection.anchor_offset;
+ return ax_selection.AnchorOffset();
}
unsigned WebAXObject::SelectionEndLineNumber() const {
@@ -889,7 +918,14 @@ void WebAXObject::SetSelectedTextRange(int selection_start,
if (IsDetached())
return;
+<<<<<<< HEAD:third_party/WebKit/Source/modules/exported/WebAXObject.cpp
private_->SetSelection(AXObjectImpl::AXRange(selection_start, selection_end));
+=======
+ AXRange ax_selection(private_.Get(), selection_start, private_.Get(),
+ selection_end);
+ if (ax_selection.IsValid())
+ ax_selection.Select();
+>>>>>>> Simplified and cleaned up selection code in Blink > Accessibility.:third_party/WebKit/Source/web/WebAXObject.cpp
}
void WebAXObject::SetSequentialFocusNavigationStartingPoint() const {
@@ -1418,7 +1454,11 @@ void WebAXObject::Markers(WebVector<WebAXMarkerType>& types,
return;
Vector<DocumentMarker::MarkerType> marker_types;
+<<<<<<< HEAD:third_party/WebKit/Source/modules/exported/WebAXObject.cpp
Vector<AXObjectImpl::AXRange> marker_ranges;
+=======
+ Vector<AXRange> marker_ranges;
+>>>>>>> Simplified and cleaned up selection code in Blink > Accessibility.:third_party/WebKit/Source/web/WebAXObject.cpp
private_->Markers(marker_types, marker_ranges);
DCHECK_EQ(marker_types.size(), marker_ranges.size());
@@ -1428,8 +1468,8 @@ void WebAXObject::Markers(WebVector<WebAXMarkerType>& types,
for (size_t i = 0; i < marker_types.size(); ++i) {
web_marker_types[i] = static_cast<WebAXMarkerType>(marker_types[i]);
DCHECK(marker_ranges[i].IsSimple());
- start_offsets[i] = marker_ranges[i].anchor_offset;
- end_offsets[i] = marker_ranges[i].focus_offset;
+ start_offsets[i] = marker_ranges[i].AnchorOffset();
+ end_offsets[i] = marker_ranges[i].FocusOffset();
}
types.Swap(web_marker_types);
@@ -1456,15 +1496,19 @@ void WebAXObject::GetWordBoundaries(WebVector<int>& starts,
if (IsDetached())
return;
+<<<<<<< HEAD:third_party/WebKit/Source/modules/exported/WebAXObject.cpp
Vector<AXObjectImpl::AXRange> word_boundaries;
+=======
+ Vector<AXRange> word_boundaries;
+>>>>>>> Simplified and cleaned up selection code in Blink > Accessibility.:third_party/WebKit/Source/web/WebAXObject.cpp
private_->GetWordBoundaries(word_boundaries);
WebVector<int> word_start_offsets(word_boundaries.size());
WebVector<int> word_end_offsets(word_boundaries.size());
for (size_t i = 0; i < word_boundaries.size(); ++i) {
DCHECK(word_boundaries[i].IsSimple());
- word_start_offsets[i] = word_boundaries[i].anchor_offset;
- word_end_offsets[i] = word_boundaries[i].focus_offset;
+ word_start_offsets[i] = word_boundaries[i].AnchorOffset();
+ word_end_offsets[i] = word_boundaries[i].FocusOffset();
}
starts.Swap(word_start_offsets);
« no previous file with comments | « third_party/WebKit/Source/modules/accessibility/BUILD.gn ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698