Bug 1909142 part 1: Add Selection and nsFrameSelection getters to enable the accessibility engine to query custom highlight information. r=jjaschke
Differential Revision: https://phabricator.services.mozilla.com/D233805
This commit is contained in:
@@ -4445,7 +4445,7 @@ void Selection::SetColors(const nsAString& aForegroundColor,
|
||||
void Selection::ResetColors() { mCustomColors = nullptr; }
|
||||
|
||||
void Selection::SetHighlightSelectionData(
|
||||
HighlightSelectionData aHighlightSelectionData) {
|
||||
struct HighlightSelectionData aHighlightSelectionData) {
|
||||
MOZ_ASSERT(mSelectionType == SelectionType::eHighlight);
|
||||
mHighlightData = std::move(aHighlightSelectionData);
|
||||
}
|
||||
|
||||
@@ -604,6 +604,10 @@ class Selection final : public nsSupportsWeakReference,
|
||||
void SetHighlightSelectionData(
|
||||
HighlightSelectionData aHighlightSelectionData);
|
||||
|
||||
const HighlightSelectionData& HighlightSelectionData() const {
|
||||
return mHighlightData;
|
||||
}
|
||||
|
||||
/**
|
||||
* See documentation of `GetRangesForInterval` in Selection.webidl.
|
||||
*
|
||||
@@ -1123,7 +1127,7 @@ class Selection final : public nsSupportsWeakReference,
|
||||
CachedOffsetForFrame* mCachedOffsetForFrame;
|
||||
nsDirection mDirection;
|
||||
const SelectionType mSelectionType;
|
||||
HighlightSelectionData mHighlightData;
|
||||
struct HighlightSelectionData mHighlightData;
|
||||
UniquePtr<SelectionCustomColors> mCustomColors;
|
||||
|
||||
// Non-zero if we don't want any changes we make to the selection to be
|
||||
|
||||
@@ -466,6 +466,20 @@ class nsFrameSelection final {
|
||||
return *GetSelection(mozilla::SelectionType::eNormal);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the number of highlight selections.
|
||||
*/
|
||||
size_t HighlightSelectionCount() const {
|
||||
return mHighlightSelections.Length();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a highlight selection by index. The index must be valid.
|
||||
*/
|
||||
RefPtr<mozilla::dom::Selection> HighlightSelection(size_t aIndex) const {
|
||||
return mHighlightSelections[aIndex].second();
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Adds a highlight selection for `aHighlight`.
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user