зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1667262 - Add AXStyleTextMarkerRangeForTextMarker. r=morgan
Depends on D91357 Differential Revision: https://phabricator.services.mozilla.com/D91850
This commit is contained in:
Родитель
df6fb4e5a5
Коммит
474e7874b9
|
@ -79,7 +79,7 @@ template <>
|
|||
struct ParamTraits<mozilla::a11y::EWhichRange>
|
||||
: public ContiguousEnumSerializerInclusive<
|
||||
mozilla::a11y::EWhichRange, mozilla::a11y::EWhichRange::eLeftWord,
|
||||
mozilla::a11y::EWhichRange::eParagraph> {};
|
||||
mozilla::a11y::EWhichRange::eStyle> {};
|
||||
|
||||
} // namespace IPC
|
||||
|
||||
|
|
|
@ -77,6 +77,10 @@ class HyperTextAccessibleWrap : public HyperTextAccessible {
|
|||
void ParagraphAt(int32_t aOffset, HyperTextAccessible** aStartContainer,
|
||||
int32_t* aStartOffset, HyperTextAccessible** aEndContainer,
|
||||
int32_t* aEndOffset);
|
||||
|
||||
void StyleAt(int32_t aOffset, HyperTextAccessible** aStartContainer,
|
||||
int32_t* aStartOffset, HyperTextAccessible** aEndContainer,
|
||||
int32_t* aEndOffset);
|
||||
};
|
||||
|
||||
} // namespace a11y
|
||||
|
|
|
@ -274,6 +274,10 @@ void HyperTextAccessibleWrap::RangeAt(int32_t aOffset, EWhichRange aRangeType,
|
|||
ParagraphAt(aOffset, aStartContainer, aStartOffset, aEndContainer,
|
||||
aEndOffset);
|
||||
break;
|
||||
case EWhichRange::eStyle:
|
||||
StyleAt(aOffset, aStartContainer, aStartOffset, aEndContainer,
|
||||
aEndOffset);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
@ -425,6 +429,29 @@ void HyperTextAccessibleWrap::ParagraphAt(int32_t aOffset,
|
|||
*aEndOffset = end.mOffset;
|
||||
}
|
||||
|
||||
void HyperTextAccessibleWrap::StyleAt(int32_t aOffset,
|
||||
HyperTextAccessible** aStartContainer,
|
||||
int32_t* aStartOffset,
|
||||
HyperTextAccessible** aEndContainer,
|
||||
int32_t* aEndOffset) {
|
||||
// Get the range of the text leaf at this offset.
|
||||
// A text leaf represents a stretch of like-styled text.
|
||||
auto leaf = LeafAtOffset(aOffset);
|
||||
if (!leaf) {
|
||||
return;
|
||||
}
|
||||
|
||||
MOZ_ASSERT(leaf->Parent()->IsHyperText());
|
||||
HyperTextAccessibleWrap* container =
|
||||
static_cast<HyperTextAccessibleWrap*>(leaf->Parent()->AsHyperText());
|
||||
if (!container) {
|
||||
return;
|
||||
}
|
||||
|
||||
*aStartContainer = *aEndContainer = container;
|
||||
container->RangeOfChild(leaf, aStartOffset, aEndOffset);
|
||||
}
|
||||
|
||||
void HyperTextAccessibleWrap::NextClusterAt(
|
||||
int32_t aOffset, HyperTextAccessible** aNextContainer,
|
||||
int32_t* aNextOffset) {
|
||||
|
|
|
@ -424,6 +424,9 @@
|
|||
- (id _Nullable)moxParagraphTextMarkerRangeForTextMarker:
|
||||
(id _Nonnull)textMarker;
|
||||
|
||||
// AXStyleTextMarkerRangeForTextMarker
|
||||
- (id _Nullable)moxStyleTextMarkerRangeForTextMarker:(id _Nonnull)textMarker;
|
||||
|
||||
#pragma mark - TextAttributeSetters
|
||||
|
||||
// AXSelectedTextMarkerRange
|
||||
|
|
|
@ -73,6 +73,9 @@
|
|||
// override
|
||||
- (id)moxParagraphTextMarkerRangeForTextMarker:(id)textMarker;
|
||||
|
||||
// override
|
||||
- (id)moxStyleTextMarkerRangeForTextMarker:(id)textMarker;
|
||||
|
||||
// override
|
||||
- (id)moxNextTextMarkerForTextMarker:(id)textMarker;
|
||||
|
||||
|
|
|
@ -219,6 +219,16 @@ static nsDataHashtable<nsUint64HashKey, MOXTextMarkerDelegate*> sDelegates;
|
|||
.CreateAXTextMarkerRange();
|
||||
}
|
||||
|
||||
// override
|
||||
- (id)moxStyleTextMarkerRangeForTextMarker:(id)textMarker {
|
||||
GeckoTextMarker geckoTextMarker(mGeckoDocAccessible, textMarker);
|
||||
if (!geckoTextMarker.IsValid()) {
|
||||
return nil;
|
||||
}
|
||||
|
||||
return geckoTextMarker.Range(EWhichRange::eStyle).CreateAXTextMarkerRange();
|
||||
}
|
||||
|
||||
- (id)moxNextTextMarkerForTextMarker:(id)textMarker {
|
||||
GeckoTextMarker geckoTextMarker(mGeckoDocAccessible, textMarker);
|
||||
if (!geckoTextMarker.IsValid()) {
|
||||
|
|
|
@ -15,7 +15,8 @@ enum class EWhichRange {
|
|||
eLine,
|
||||
eLeftLine,
|
||||
eRightLine,
|
||||
eParagraph
|
||||
eParagraph,
|
||||
eStyle
|
||||
};
|
||||
|
||||
} // namespace a11y
|
||||
|
|
|
@ -31,6 +31,16 @@ function testUIElement(macDoc, marker, msg, expectedRole, expectedValue) {
|
|||
);
|
||||
}
|
||||
|
||||
function testStyleRun(macDoc, marker, msg, expectedStyleRun) {
|
||||
testRangeAtMarker(
|
||||
macDoc,
|
||||
marker,
|
||||
"AXStyleTextMarkerRangeForTextMarker",
|
||||
expectedStyleRun,
|
||||
`${msg}: style run matches`
|
||||
);
|
||||
}
|
||||
|
||||
function testParagraph(macDoc, marker, msg, expectedParagraph) {
|
||||
testRangeAtMarker(
|
||||
macDoc,
|
||||
|
@ -141,6 +151,12 @@ function testMarkerIntegrity(accDoc, expectedMarkerValues) {
|
|||
`At index ${count}`,
|
||||
expectedMarkerValues[count].paragraph
|
||||
);
|
||||
testStyleRun(
|
||||
macDoc,
|
||||
marker,
|
||||
`At index ${count}`,
|
||||
expectedMarkerValues[count].style
|
||||
);
|
||||
|
||||
marker = macDoc.getParameterizedAttributeValue(
|
||||
"AXNextTextMarkerForTextMarker",
|
||||
|
|
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
Загрузка…
Ссылка в новой задаче