LEFT | RIGHT |
1 /* | 1 /* |
2 * Copyright (C) 2016 Apple Inc. All rights reserved. | 2 * Copyright (C) 2016 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 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
(...skipping 29 matching lines...) Expand all Loading... |
40 namespace WebCore { | 40 namespace WebCore { |
41 | 41 |
42 class Element; | 42 class Element; |
43 | 43 |
44 class IntersectionObserverEntry : public RefCounted<IntersectionObserverEntry> { | 44 class IntersectionObserverEntry : public RefCounted<IntersectionObserverEntry> { |
45 WTF_MAKE_FAST_ALLOCATED; | 45 WTF_MAKE_FAST_ALLOCATED; |
46 public: | 46 public: |
47 | 47 |
48 struct Init { | 48 struct Init { |
49 double time; | 49 double time; |
50 DOMRectInit rootBounds; | 50 std::optional<DOMRectInit> rootBounds; |
51 DOMRectInit boundingClientRect; | 51 DOMRectInit boundingClientRect; |
52 DOMRectInit intersectionRect; | 52 DOMRectInit intersectionRect; |
53 bool isIntersecting; | |
54 double intersectionRatio; | 53 double intersectionRatio; |
55 RefPtr<Element> target; | 54 RefPtr<Element> target; |
| 55 bool isIntersecting; |
56 }; | 56 }; |
57 | 57 |
58 static Ref<IntersectionObserverEntry> create(const Init& init) | 58 static Ref<IntersectionObserverEntry> create(const Init& init) |
59 { | 59 { |
60 return WTF::adoptRef(*new IntersectionObserverEntry(init)); | 60 return WTF::adoptRef(*new IntersectionObserverEntry(init)); |
61 } | 61 } |
62 ···· | 62 ···· |
63 double time() const { return m_time; } | 63 double time() const { return m_time; } |
64 RefPtr<DOMRectReadOnly> rootBounds() const { return m_rootBounds; } | 64 RefPtr<DOMRectReadOnly> rootBounds() const { return m_rootBounds; } |
65 RefPtr<DOMRectReadOnly> boundingClientRect() const { return m_boundingClient
Rect; } | 65 RefPtr<DOMRectReadOnly> boundingClientRect() const { return m_boundingClient
Rect; } |
66 RefPtr<DOMRectReadOnly> intersectionRect() const { return m_intersectionRect
; } | 66 RefPtr<DOMRectReadOnly> intersectionRect() const { return m_intersectionRect
; } |
67 RefPtr<Element> target() const { return m_target; } | 67 RefPtr<Element> target() const { return m_target; } |
68 | 68 |
69 bool isIntersecting() const { return m_isIntersecting; } | 69 bool isIntersecting() const { return m_isIntersecting; } |
70 double intersectionRatio() const { return m_intersectionRatio; } | 70 double intersectionRatio() const { return m_intersectionRatio; } |
71 | 71 |
72 private: | 72 private: |
73 IntersectionObserverEntry(const Init&); | 73 IntersectionObserverEntry(const Init&); |
74 | 74 |
75 double m_time { 0 }; | 75 double m_time { 0 }; |
76 RefPtr<DOMRectReadOnly> m_rootBounds; | 76 RefPtr<DOMRectReadOnly> m_rootBounds; |
77 RefPtr<DOMRectReadOnly> m_boundingClientRect; | 77 RefPtr<DOMRectReadOnly> m_boundingClientRect; |
78 RefPtr<DOMRectReadOnly> m_intersectionRect; | 78 RefPtr<DOMRectReadOnly> m_intersectionRect; |
79 bool m_isIntersecting { false }; | |
80 double m_intersectionRatio { 0 }; | 79 double m_intersectionRatio { 0 }; |
81 RefPtr<Element> m_target; | 80 RefPtr<Element> m_target; |
| 81 bool m_isIntersecting { false }; |
82 }; | 82 }; |
83 | 83 |
84 WTF::TextStream& operator<<(WTF::TextStream&, const DOMRectInit&); | 84 WTF::TextStream& operator<<(WTF::TextStream&, const DOMRectInit&); |
85 WTF::TextStream& operator<<(WTF::TextStream&, const DOMRectReadOnly&); | 85 WTF::TextStream& operator<<(WTF::TextStream&, const DOMRectReadOnly&); |
86 WTF::TextStream& operator<<(WTF::TextStream&, const IntersectionObserverEntry&); | 86 WTF::TextStream& operator<<(WTF::TextStream&, const IntersectionObserverEntry&); |
87 | 87 |
88 } // namespace WebCore | 88 } // namespace WebCore |
89 | 89 |
90 #endif // ENABLE(INTERSECTION_OBSERVER) | 90 #endif // ENABLE(INTERSECTION_OBSERVER) |
LEFT | RIGHT |