Changeset 234732 in webkit


Ignore:
Timestamp:
Aug 9, 2018 12:36:38 PM (6 years ago)
Author:
ajuma@chromium.org
Message:

Update IDL for IntersectionObserverEntry and IntersectionObserverEntryInit
https://bugs.webkit.org/show_bug.cgi?id=188445

Reviewed by Simon Fraser.

Source/WebCore:

Update IntersectionObserverEntry by making rootBounds nullable, and adding an
isIntersecting attribute. Make the same changes to IntersectionObserverEntryInit,
and also add an intersectionRatio attribute.

Tested by intersection-observer/intersection-observer-entry-interface.html

  • page/IntersectionObserverEntry.cpp:

(WebCore::IntersectionObserverEntry::IntersectionObserverEntry):

  • page/IntersectionObserverEntry.h:

(WebCore::IntersectionObserverEntry::isIntersecting const):

  • page/IntersectionObserverEntry.idl:

LayoutTests:

  • intersection-observer/intersection-observer-entry-interface-expected.txt:
  • intersection-observer/intersection-observer-entry-interface.html:
Location:
trunk
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r234728 r234732  
     12018-08-09  Ali Juma  <ajuma@chromium.org>
     2
     3        Update IDL for IntersectionObserverEntry and IntersectionObserverEntryInit
     4        https://bugs.webkit.org/show_bug.cgi?id=188445
     5
     6        Reviewed by Simon Fraser.
     7
     8        * intersection-observer/intersection-observer-entry-interface-expected.txt:
     9        * intersection-observer/intersection-observer-entry-interface.html:
     10
    1112018-08-08  Keith Miller  <keith_miller@apple.com>
    212
  • trunk/LayoutTests/intersection-observer/intersection-observer-entry-interface-expected.txt

    r208181 r234732  
    33PASS ConstructorTime
    44PASS ConstructorRootBounds
     5PASS ConstructorNullRootBounds
    56PASS ConstructorBoundingClientRect
    67PASS ConstructorIntersectionRect
    7 PASS ConstructorTime
     8PASS ConstructorIsIntersecting
     9PASS ConstructorIntersectionRatio
     10PASS ConstructorTarget
    811
  • trunk/LayoutTests/intersection-observer/intersection-observer-entry-interface.html

    r208983 r234732  
    1616        boundingClientRect: { x: 110, y: 112.7, width: 1130, height: 1140 },
    1717        intersectionRect: { x: 210, y: 212, width: 2130, height: 2140 },
     18        isIntersecting: true,
     19        intersectionRatio: 0.35,
    1820        target: document.body
    1921    };
     
    3234    },'ConstructorRootBounds');
    3335    test(function() {
     36        entryInit.rootBounds = null;
     37        var entry = new IntersectionObserverEntry(entryInit);
     38        assert_equals(entry.rootBounds, null);
     39    },'ConstructorNullRootBounds');
     40    test(function() {
    3441        var entry = new IntersectionObserverEntry(entryInit);
    3542        assert_class_string(entry.boundingClientRect, 'DOMRectReadOnly');
     
    4350    test(function() {
    4451        var entry = new IntersectionObserverEntry(entryInit);
     52        assert_true(entry.isIntersecting);
     53    },'ConstructorIsIntersecting');
     54    test(function() {
     55        var entry = new IntersectionObserverEntry(entryInit);
     56        assert_equals(entry.intersectionRatio, 0.35);
     57    },'ConstructorIntersectionRatio');
     58    test(function() {
     59        var entry = new IntersectionObserverEntry(entryInit);
    4560        assert_equals(entry.target, document.body);
    46     },'ConstructorTime');
     61    },'ConstructorTarget');
    4762
    4863</script>
  • trunk/Source/WebCore/ChangeLog

    r234721 r234732  
     12018-08-09  Ali Juma  <ajuma@chromium.org>
     2
     3        Update IDL for IntersectionObserverEntry and IntersectionObserverEntryInit
     4        https://bugs.webkit.org/show_bug.cgi?id=188445
     5
     6        Reviewed by Simon Fraser.
     7
     8        Update IntersectionObserverEntry by making rootBounds nullable, and adding an
     9        isIntersecting attribute. Make the same changes to IntersectionObserverEntryInit,
     10        and also add an intersectionRatio attribute.
     11
     12        Tested by intersection-observer/intersection-observer-entry-interface.html
     13
     14        * page/IntersectionObserverEntry.cpp:
     15        (WebCore::IntersectionObserverEntry::IntersectionObserverEntry):
     16        * page/IntersectionObserverEntry.h:
     17        (WebCore::IntersectionObserverEntry::isIntersecting const):
     18        * page/IntersectionObserverEntry.idl:
     19
    1202018-08-09  Charlie Turner  <cturner@igalia.com>
    221
  • trunk/Source/WebCore/page/IntersectionObserverEntry.cpp

    r208181 r234732  
    3535IntersectionObserverEntry::IntersectionObserverEntry(const Init& init)
    3636    : m_time(init.time)
    37     , m_rootBounds(DOMRectReadOnly::fromRect(init.rootBounds))
    3837    , m_boundingClientRect(DOMRectReadOnly::fromRect(init.boundingClientRect))
    3938    , m_intersectionRect(DOMRectReadOnly::fromRect(init.intersectionRect))
     39    , m_intersectionRatio(init.intersectionRatio)
    4040    , m_target(init.target)
     41    , m_isIntersecting(init.isIntersecting)
    4142{
     43    if (init.rootBounds)
     44        m_rootBounds = DOMRectReadOnly::fromRect(*init.rootBounds);
    4245}
    43 
    4446
    4547} // namespace WebCore
  • trunk/Source/WebCore/page/IntersectionObserverEntry.h

    r208192 r234732  
    4444    struct Init {
    4545        double time;
    46         DOMRectInit rootBounds;
     46        std::optional<DOMRectInit> rootBounds;
    4747        DOMRectInit boundingClientRect;
    4848        DOMRectInit intersectionRect;
     49        double intersectionRatio;
    4950        RefPtr<Element> target;
     51        bool isIntersecting;
    5052    };
    5153
     
    6163    RefPtr<Element> target() const { return m_target; }
    6264
     65    bool isIntersecting() const { return m_isIntersecting; }
    6366    double intersectionRatio() const { return m_intersectionRatio; }
    6467
     
    7275    double m_intersectionRatio { 0 };
    7376    RefPtr<Element> m_target;
     77    bool m_isIntersecting { false };
    7478};
    7579
  • trunk/Source/WebCore/page/IntersectionObserverEntry.idl

    r208983 r234732  
    3535] interface IntersectionObserverEntry {
    3636    readonly attribute DOMHighResTimeStamp time;
    37     readonly attribute DOMRectReadOnly rootBounds;
     37    readonly attribute DOMRectReadOnly? rootBounds;
    3838    readonly attribute DOMRectReadOnly boundingClientRect;
    3939    readonly attribute DOMRectReadOnly intersectionRect;
     40    readonly attribute boolean isIntersecting;
    4041    readonly attribute double intersectionRatio;
    4142    readonly attribute Element target;
     
    4647] dictionary IntersectionObserverEntryInit {
    4748    required DOMHighResTimeStamp time;
    48     required DOMRectInit rootBounds;
     49    required DOMRectInit? rootBounds;
    4950    required DOMRectInit boundingClientRect;
    5051    required DOMRectInit intersectionRect;
     52    required boolean isIntersecting;
     53    required double intersectionRatio;
    5154    required Element target;
    5255};
Note: See TracChangeset for help on using the changeset viewer.