Changeset 268206 in webkit


Ignore:
Timestamp:
Oct 8, 2020 1:20:09 PM (4 years ago)
Author:
Andres Gonzalez
Message:

Presidential Executive Order pages not accessible with Safari.
https://bugs.webkit.org/show_bug.cgi?id=217415
<rdar://problem/69922416>

Reviewed by Chris Fleizach and Simon Fraser.

Follow up to the previous change for this bug per Simon Fraser's comment.
Check not only the visibility and opacity of the object in question but
also of its ancestors.
Expanded the test accessibility/aria-modal.html to include the case
where the visibility of the modal dialog is determined by the opacity of
its parent object.

  • accessibility/AXObjectCache.cpp:

(WebCore::AXObjectCache::isNodeVisible const):

Location:
trunk
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/accessibility/aria-modal-expected.txt

    r268117 r268206  
    2323Dialog is displaying with opacity 1
    2424PASS backgroundAccessible() is false
     25Dialog is not displaying with parent opacity 0
     26PASS backgroundAccessible() is true
     27Dialog is displaying with parent opacity .5
     28PASS backgroundAccessible() is false
    2529Dialog is removed from DOM
    2630PASS backgroundAccessible() is true
     
    3135
    3236Display a dialog
     37
     38
  • trunk/LayoutTests/accessibility/aria-modal.html

    r268117 r268206  
    1313</div>
    1414
    15 <div role="dialog" aria-modal="true" aria-labelledby="myDialog" id="box" class="box-hidden" tabindex="-1">
    16     <h3 id="myDialog">Just an example.</h3>
    17     <button id="ok" onclick="toggleDialog('hide');" class="close-button">OK</button>
    18     <button onclick="toggleDialog('hide');" class="close-button">Cancel</button>
     15<div id="dialogParent" role="group">
     16    <div role="dialog" aria-modal="true" aria-labelledby="myDialog" id="box" class="box-hidden" tabindex="-1">
     17        <h3 id="myDialog">Just an example.</h3>
     18        <button id="ok" onclick="toggleDialog('hide');" class="close-button">OK</button>
     19        <button onclick="toggleDialog('hide');" class="close-button">Cancel</button>
     20    </div>
    1921</div>
    2022
     
    98100            shouldBeFalse("backgroundAccessible()");
    99101
     102            // Set opacity of the dialog parent to 0 which should make the dialog invisible since opacity multiply.
     103            document.getElementById("dialogParent").style.opacity = 0;
     104            await waitFor(() => {
     105                return backgroundAccessible();
     106            });
     107            debug("Dialog is not displaying with parent opacity 0");
     108            shouldBeTrue("backgroundAccessible()");
     109
     110            // Set opacity of the dialog parent to .5 which should make the dialog visible again.
     111            document.getElementById("dialogParent").style.opacity = .5;
     112            await waitFor(() => {
     113                return !backgroundAccessible();
     114            });
     115            debug("Dialog is displaying with parent opacity .5");
     116            shouldBeFalse("backgroundAccessible()");
     117
    100118            // Test modal dialog is removed from DOM tree.
    101119            var dialog = document.getElementById("box");
     
    129147        } else {
    130148            dialog.style.display = 'none';
    131             //dialog.style.opacity = 0;
    132149            dialog.setAttribute("aria-modal", "false");
    133150        }
  • trunk/Source/WebCore/ChangeLog

    r268202 r268206  
     12020-10-08  Andres Gonzalez  <andresg_22@apple.com>
     2
     3        Presidential Executive Order pages not accessible with Safari.
     4        https://bugs.webkit.org/show_bug.cgi?id=217415
     5        <rdar://problem/69922416>
     6
     7        Reviewed by Chris Fleizach and Simon Fraser.
     8
     9        Follow up to the previous change for this bug per Simon Fraser's comment.
     10        Check not only the visibility and opacity of the object in question but
     11        also of its ancestors.
     12        Expanded the test accessibility/aria-modal.html to include the case
     13        where the visibility of the modal dialog is determined by the opacity of
     14        its parent object.
     15
     16        * accessibility/AXObjectCache.cpp:
     17        (WebCore::AXObjectCache::isNodeVisible const):
     18
    1192020-10-08  Zalan Bujtas  <zalan@apple.com>
    220
  • trunk/Source/WebCore/accessibility/AXObjectCache.cpp

    r268117 r268206  
    8989#include "Range.h"
    9090#include "RenderAttachment.h"
     91#include "RenderLayer.h"
    9192#include "RenderLineBreak.h"
    9293#include "RenderListBox.h"
     
    301302        return false;
    302303
    303     const RenderStyle& style = renderer->style();
    304     if (style.display() == DisplayType::None
    305         || style.visibility() != Visibility::Visible
    306         || !style.opacity())
     304    const auto& style = renderer->style();
     305    if (style.display() == DisplayType::None)
    307306        return false;
     307
     308    auto* renderLayer = renderer->enclosingLayer();
     309    if (style.visibility() != Visibility::Visible && renderLayer && !renderLayer->hasVisibleContent())
     310        return false;
     311
     312    // Check whether this object or any of its ancestors has opacity 0.
     313    // The resulting opacity of a RenderObject is computed as the multiplication
     314    // of its opacity times the opacities of its ancestors.
     315    for (auto* renderObject = renderer; renderObject; renderObject = renderObject->parent()) {
     316        if (!renderObject->style().opacity())
     317            return false;
     318    }
    308319
    309320    // We also need to consider aria hidden status.
Note: See TracChangeset for help on using the changeset viewer.