Changeset 274395 in webkit


Ignore:
Timestamp:
Mar 13, 2021, 7:32:31 PM (5 years ago)
Author:
Wenson Hsieh
Message:

Add support for accessibility image overlays in layout tests
https://bugs.webkit.org/show_bug.cgi?id=223146

Reviewed by Tim Horton.

Source/WebCore:

Introduce an internal testing hook to install image overlay content, for layout and API tests.

Test: fast/images/image-extraction/basic-image-overlay.html

  • dom/DOMPointReadOnly.h:
  • dom/DOMPointReadOnly.idl:

Additionally add WebCore export macros to DOMPointReadOnly, so that Internals code can this class.

  • testing/Internals.cpp:

(WebCore::Internals::installImageOverlay):

  • testing/Internals.h:
  • testing/Internals.idl:

LayoutTests:

Add a very basic test to ensure that image overlay content can be installed.

  • TestExpectations:
  • fast/images/image-extraction/basic-image-overlay-expected-mismatch.html: Added.
  • fast/images/image-extraction/basic-image-overlay.html: Added.
Location:
trunk
Files:
3 added
8 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r274393 r274395  
     12021-03-13  Wenson Hsieh  <wenson_hsieh@apple.com>
     2
     3        Add support for accessibility image overlays in layout tests
     4        https://bugs.webkit.org/show_bug.cgi?id=223146
     5
     6        Reviewed by Tim Horton.
     7
     8        Add a very basic test to ensure that image overlay content can be installed.
     9
     10        * TestExpectations:
     11        * fast/images/image-extraction/basic-image-overlay-expected-mismatch.html: Added.
     12        * fast/images/image-extraction/basic-image-overlay.html: Added.
     13
    1142021-03-13  Commit Queue  <commit-queue@webkit.org>
    215
  • trunk/LayoutTests/TestExpectations

    r274389 r274395  
    3939fast/forms/textarea/ios [ Skip ]
    4040fast/forms/watchos [ Skip ]
     41fast/images/image-extraction [ Skip ]
    4142fast/sandbox/ios [ Skip ]
    4243fast/sandbox/mac [ Skip ]
  • trunk/Source/WebCore/ChangeLog

    r274393 r274395  
     12021-03-13  Wenson Hsieh  <wenson_hsieh@apple.com>
     2
     3        Add support for accessibility image overlays in layout tests
     4        https://bugs.webkit.org/show_bug.cgi?id=223146
     5
     6        Reviewed by Tim Horton.
     7
     8        Introduce an internal testing hook to install image overlay content, for layout and API tests.
     9
     10        Test: fast/images/image-extraction/basic-image-overlay.html
     11
     12        * dom/DOMPointReadOnly.h:
     13        * dom/DOMPointReadOnly.idl:
     14
     15        Additionally add WebCore export macros to `DOMPointReadOnly`, so that Internals code can this class.
     16
     17        * testing/Internals.cpp:
     18        (WebCore::Internals::installImageOverlay):
     19        * testing/Internals.h:
     20        * testing/Internals.idl:
     21
    1222021-03-13  Commit Queue  <commit-queue@webkit.org>
    223
  • trunk/Source/WebCore/dom/DOMPointReadOnly.h

    r243887 r274395  
    3434#include "ExceptionOr.h"
    3535#include "ScriptWrappable.h"
     36#include <wtf/IsoMalloc.h>
    3637#include <wtf/RefCounted.h>
    3738
     
    4243
    4344class DOMPointReadOnly : public ScriptWrappable, public RefCounted<DOMPointReadOnly> {
    44     WTF_MAKE_ISO_ALLOCATED(DOMPointReadOnly);
     45    WTF_MAKE_ISO_ALLOCATED_EXPORT(DOMPointReadOnly, WEBCORE_EXPORT);
    4546public:
    4647    static Ref<DOMPointReadOnly> create(double x, double y, double z, double w) { return adoptRef(*new DOMPointReadOnly(x, y, z, w)); }
  • trunk/Source/WebCore/dom/DOMPointReadOnly.idl

    r267020 r274395  
    3131// The DOMPointInit constructor exists in https://www.w3.org/TR/geometry-1/ but is removed in https://drafts.fxtf.org/geometry/
    3232[
     33    ExportMacro=WEBCORE_EXPORT,
    3334    Exposed=(Window,Worker),
    3435    ImplementationLacksVTable
  • trunk/Source/WebCore/testing/Internals.cpp

    r274066 r274395  
    5656#include "CookieJar.h"
    5757#include "Cursor.h"
     58#include "DOMPointReadOnly.h"
    5859#include "DOMRect.h"
    5960#include "DOMRectList.h"
     
    7980#include "FetchResponse.h"
    8081#include "File.h"
     82#include "FloatQuad.h"
    8183#include "FontCache.h"
    8284#include "FormController.h"
     
    335337#endif
    336338
     339#if ENABLE(IMAGE_EXTRACTION)
     340#include "ImageExtractionResult.h"
     341#endif
     342
    337343using JSC::CallData;
    338344using JSC::CodeBlock;
     
    55145520#endif
    55155521
     5522Internals::ImageOverlayText::~ImageOverlayText() = default;
     5523
     5524void Internals::installImageOverlay(Element& element, Vector<ImageOverlayText>&& allTextInfo)
     5525{
     5526    if (!is<HTMLElement>(element))
     5527        return;
     5528
     5529#if ENABLE(IMAGE_EXTRACTION)
     5530    downcast<HTMLElement>(element).updateWithImageExtractionResult(ImageExtractionResult {
     5531        allTextInfo.map([] (auto& textInfo) -> ImageExtractionTextData {
     5532            return { textInfo.text, {
     5533                FloatPoint(textInfo.topLeft->x(), textInfo.topLeft->y()),
     5534                FloatPoint(textInfo.topRight->x(), textInfo.topRight->y()),
     5535                FloatPoint(textInfo.bottomRight->x(), textInfo.bottomRight->y()),
     5536                FloatPoint(textInfo.bottomLeft->x(), textInfo.bottomLeft->y()),
     5537            }};
     5538        })
     5539    });
     5540#else
     5541    UNUSED_PARAM(allTextInfo);
     5542#endif
     5543}
     5544
    55165545bool Internals::isSystemPreviewLink(Element& element) const
    55175546{
  • trunk/Source/WebCore/testing/Internals.h

    r274066 r274395  
    5353class AudioTrack;
    5454class CacheStorageConnection;
     55class DOMPointReadOnly;
    5556class DOMRect;
    5657class DOMRectList;
     
    841842#endif
    842843
     844    struct ImageOverlayText {
     845        String text;
     846        RefPtr<DOMPointReadOnly> topLeft;
     847        RefPtr<DOMPointReadOnly> topRight;
     848        RefPtr<DOMPointReadOnly> bottomRight;
     849        RefPtr<DOMPointReadOnly> bottomLeft;
     850
     851        ~ImageOverlayText();
     852    };
     853    void installImageOverlay(Element&, Vector<ImageOverlayText>&&);
     854
    843855    bool isSystemPreviewLink(Element&) const;
    844856    bool isSystemPreviewImage(Element&) const;
  • trunk/Source/WebCore/testing/Internals.idl

    r274066 r274395  
    256256[
    257257    ExportMacro=WEBCORE_TESTSUPPORT_EXPORT,
     258    JSGenerateToJSObject,
     259] dictionary ImageOverlayText {
     260    required DOMString text;
     261    required DOMPointReadOnly topLeft;
     262    required DOMPointReadOnly topRight;
     263    required DOMPointReadOnly bottomRight;
     264    required DOMPointReadOnly bottomLeft;
     265};
     266
     267[
     268    ExportMacro=WEBCORE_TESTSUPPORT_EXPORT,
    258269    LegacyNoInterfaceObject,
    259270] interface Internals {
     
    871882    boolean isSystemPreviewImage(Element element);
    872883
     884    undefined installImageOverlay(Element element, sequence<ImageOverlayText> allTextInfo);
     885
    873886    boolean usingAppleInternalSDK();
    874887    boolean usingGStreamer();
Note: See TracChangeset for help on using the changeset viewer.