LEFT | RIGHT |
1 /* | 1 /* |
2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) | 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) |
3 * (C) 1999 Antti Koivisto (koivisto@kde.org) | 3 * (C) 1999 Antti Koivisto (koivisto@kde.org) |
4 * (C) 2001 Peter Kelly (pmk@post.com) | 4 * (C) 2001 Peter Kelly (pmk@post.com) |
5 * (C) 2001 Dirk Mueller (mueller@kde.org) | 5 * (C) 2001 Dirk Mueller (mueller@kde.org) |
6 * (C) 2007 David Smith (catfish.man@gmail.com) | 6 * (C) 2007 David Smith (catfish.man@gmail.com) |
7 * Copyright (C) 2004-2017 Apple Inc. All rights reserved. | 7 * Copyright (C) 2004-2017 Apple Inc. All rights reserved. |
8 * (C) 2007 Eric Seidel (eric@webkit.org) | 8 * (C) 2007 Eric Seidel (eric@webkit.org) |
9 * | 9 * |
10 * This library is free software; you can redistribute it and/or | 10 * This library is free software; you can redistribute it and/or |
(...skipping 3226 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3237 void Element::requestPointerLock() | 3237 void Element::requestPointerLock() |
3238 { | 3238 { |
3239 if (document().page()) | 3239 if (document().page()) |
3240 document().page()->pointerLockController().requestPointerLock(this); | 3240 document().page()->pointerLockController().requestPointerLock(this); |
3241 } | 3241 } |
3242 #endif | 3242 #endif |
3243 | 3243 |
3244 #if ENABLE(INTERSECTION_OBSERVER) | 3244 #if ENABLE(INTERSECTION_OBSERVER) |
3245 void Element::startObservingIntersections(IntersectionObserver& observer) | 3245 void Element::startObservingIntersections(IntersectionObserver& observer) |
3246 { | 3246 { |
3247 ASSERT(&observer.document() == &document()); | |
3248 | |
3249 auto& data = ensureElementRareData(); | 3247 auto& data = ensureElementRareData(); |
3250 | 3248 |
3251 auto* registrations = data.intersectionObserverRegistrations(); | 3249 auto* registrations = data.intersectionObserverRegistrations(); |
3252 if (!registrations) { | 3250 if (!registrations) { |
3253 data.setIntersectionObserverRegistrations(std::make_unique<Vector<Inters
ectionObserverRegistration>>()); | 3251 data.setIntersectionObserverRegistrations(std::make_unique<Vector<Inters
ectionObserverRegistration>>()); |
3254 registrations = data.intersectionObserverRegistrations(); | 3252 registrations = data.intersectionObserverRegistrations(); |
3255 } | 3253 } |
3256 | 3254 |
3257 // If target is in this's internal [[ObservationTargets]] slot, return. | 3255 // If target is in this's internal [[ObservationTargets]] slot, return. |
3258 for (auto& registration : *registrations) { | 3256 for (auto& registration : *registrations) { |
3259 if (registration.observer == &observer) | 3257 if (registration.observer == &observer) |
3260 return; | 3258 return; |
3261 } | 3259 } |
3262 | 3260 |
3263 // Let intersectionObserverRegistration be an IntersectionObserverRegistrati
on record with an observer | 3261 // Let intersectionObserverRegistration be an IntersectionObserverRegistrati
on record with an observer |
3264 // property set to this and a previousThreshold property set so that it's im
mediately differently from | 3262 // property set to this and a previousThreshold property set so that it's im
mediately differently from |
3265 // the current threshold, triggering an initial notification. | 3263 // the current threshold, triggering an initial notification. |
3266 // Append intersectionObserverRegistration to targets internal [[RegisteredI
ntersectionObservers]] slot. | 3264 // Append intersectionObserverRegistration to targets internal [[RegisteredI
ntersectionObservers]] slot. |
3267 registrations->append({ &observer, std::numeric_limits<size_t>::max() }); | 3265 registrations->append({ &observer, std::numeric_limits<size_t>::max(), false
}); |
3268 | 3266 |
3269 // Add target to this's internal [[ObservationTargets]] slot. | 3267 // Add target to this's internal [[ObservationTargets]] slot. |
3270 observer.addObservationTarget(*this); | 3268 observer.addObservationTarget(*this); |
3271 | 3269 |
3272 document().addToIntersectionObserverTargets(*this); | 3270 document().addToIntersectionObserverTargets(*this); |
3273 document().postTask([&document = document()] (ScriptExecutionContext&) mutab
le { | 3271 document().postTask([&document = document()] (ScriptExecutionContext&) mutab
le { |
3274 document.updateIntersectionObservations(); | 3272 document.updateIntersectionObservations(); |
3275 }); | 3273 }); |
3276 } | 3274 } |
3277 | 3275 |
(...skipping 671 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3949 if (auto timeline = document().existingTimeline()) { | 3947 if (auto timeline = document().existingTimeline()) { |
3950 for (auto& animation : timeline->animationsForElement(*this, AnimationTi
meline::Ordering::Sorted)) { | 3948 for (auto& animation : timeline->animationsForElement(*this, AnimationTi
meline::Ordering::Sorted)) { |
3951 if (animation->canBeListed()) | 3949 if (animation->canBeListed()) |
3952 animations.append(animation); | 3950 animations.append(animation); |
3953 } | 3951 } |
3954 } | 3952 } |
3955 return animations; | 3953 return animations; |
3956 } | 3954 } |
3957 | 3955 |
3958 } // namespace WebCore | 3956 } // namespace WebCore |
LEFT | RIGHT |