Bug 686400 - Add function to nsCoreUtils for display: contents. r=Jamie

Differential Revision: https://phabricator.services.mozilla.com/D40131

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Eitan Isaacson 2019-08-01 16:19:06 +00:00
parent fb55d9f3fa
commit aeb736599d
4 changed files with 10 additions and 3 deletions

View File

@ -919,7 +919,7 @@ Accessible* nsAccessibilityService::CreateAccessible(nsINode* aNode,
if (!frame || !frame->StyleVisibility()->IsVisible()) {
// display:contents element doesn't have a frame, but retains the semantics.
// All its children are unaffected.
if (content->IsElement() && content->AsElement()->IsDisplayContents()) {
if (nsCoreUtils::IsDisplayContents(content)) {
const HTMLMarkupMapInfo* markupMap =
mHTMLMarkupMap.Get(content->NodeInfo()->NameAtom());
if (markupMap && markupMap->new_func) {

View File

@ -545,3 +545,8 @@ void nsCoreUtils::DispatchAccEvent(RefPtr<nsIAccessibleEvent> event) {
obsService->NotifyObservers(event, NS_ACCESSIBLE_EVENT_TOPIC, nullptr);
}
bool nsCoreUtils::IsDisplayContents(nsIContent* aContent) {
return aContent && aContent->IsElement() &&
aContent->AsElement()->IsDisplayContents();
}

View File

@ -323,6 +323,8 @@ class nsCoreUtils {
* Notify accessible event observers of an event.
*/
static void DispatchAccEvent(RefPtr<nsIAccessibleEvent> aEvent);
static bool IsDisplayContents(nsIContent* aContent);
};
#endif

View File

@ -310,7 +310,7 @@ uint64_t Accessible::VisibilityState() const {
if (!frame) {
// Element having display:contents is considered visible semantically,
// despite it doesn't have a visually visible box.
if (mContent->IsElement() && mContent->AsElement()->IsDisplayContents()) {
if (nsCoreUtils::IsDisplayContents(mContent)) {
return states::OFFSCREEN;
}
return states::INVISIBLE;
@ -1918,7 +1918,7 @@ void Accessible::AppendTextTo(nsAString& aText, uint32_t aStartOffset,
nsIFrame* frame = GetFrame();
if (!frame) {
if (mContent->IsElement() && mContent->AsElement()->IsDisplayContents()) {
if (nsCoreUtils::IsDisplayContents(mContent)) {
aText += kEmbeddedObjectChar;
}
return;