OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2008, 2009, 2011 Apple Inc. All rights reserved. | 2 * Copyright (C) 2008, 2009, 2011 Apple Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
6 * are met: | 6 * are met: |
7 * | 7 * |
8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
(...skipping 706 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
717 | 717 |
718 if (getLayoutObject()) | 718 if (getLayoutObject()) |
719 return getLayoutObject()->style()->visibility() != EVisibility::kVisible; | 719 return getLayoutObject()->style()->visibility() != EVisibility::kVisible; |
720 | 720 |
721 // This is an obscure corner case: if a node has no LayoutObject, that means | 721 // This is an obscure corner case: if a node has no LayoutObject, that means |
722 // it's not rendered, but we still may be exploring it as part of a text | 722 // it's not rendered, but we still may be exploring it as part of a text |
723 // alternative calculation, for example if it was explicitly referenced by | 723 // alternative calculation, for example if it was explicitly referenced by |
724 // aria-labelledby. So we need to explicitly call the style resolver to check | 724 // aria-labelledby. So we need to explicitly call the style resolver to check |
725 // whether it's invisible or display:none, rather than relying on the style | 725 // whether it's invisible or display:none, rather than relying on the style |
726 // cached in the LayoutObject. | 726 // cached in the LayoutObject. |
727 Document* doc = getDocument(); | 727 Document* document = getDocument(); |
728 if (doc && doc->frame() && getNode() && getNode()->isElementNode()) { | 728 if (!document || !document->frame()) |
729 RefPtr<ComputedStyle> style = | 729 return false; |
730 doc->ensureStyleResolver().styleForElement(toElement(getNode())); | 730 if (Node* node = getNode()) { |
731 return style->display() == EDisplay::None || | 731 if (node->isConnected() && node->isElementNode()) { |
732 style->visibility() != EVisibility::kVisible; | 732 RefPtr<ComputedStyle> style = |
| 733 document->ensureStyleResolver().styleForElement(toElement(node)); |
| 734 return style->display() == EDisplay::None || |
| 735 style->visibility() != EVisibility::kVisible; |
| 736 } |
733 } | 737 } |
734 | |
735 return false; | 738 return false; |
736 } | 739 } |
737 | 740 |
738 String AXObject::ariaTextAlternative(bool recursive, | 741 String AXObject::ariaTextAlternative(bool recursive, |
739 bool inAriaLabelledByTraversal, | 742 bool inAriaLabelledByTraversal, |
740 AXObjectSet& visited, | 743 AXObjectSet& visited, |
741 AXNameFrom& nameFrom, | 744 AXNameFrom& nameFrom, |
742 AXRelatedObjectVector* relatedObjects, | 745 AXRelatedObjectVector* relatedObjects, |
743 NameSources* nameSources, | 746 NameSources* nameSources, |
744 bool* foundTextAlternative) const { | 747 bool* foundTextAlternative) const { |
(...skipping 1014 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1759 } | 1762 } |
1760 | 1763 |
1761 DEFINE_TRACE(AXObject) { | 1764 DEFINE_TRACE(AXObject) { |
1762 visitor->trace(m_children); | 1765 visitor->trace(m_children); |
1763 visitor->trace(m_parent); | 1766 visitor->trace(m_parent); |
1764 visitor->trace(m_cachedLiveRegionRoot); | 1767 visitor->trace(m_cachedLiveRegionRoot); |
1765 visitor->trace(m_axObjectCache); | 1768 visitor->trace(m_axObjectCache); |
1766 } | 1769 } |
1767 | 1770 |
1768 } // namespace blink | 1771 } // namespace blink |
OLD | NEW |