Stop using dispatch_set_target_queue()
[WebKit-https.git] / Source / WebCore / ChangeLog
1 2018-03-23  David Kilzer  <ddkilzer@apple.com>
2
3         Stop using dispatch_set_target_queue()
4         <https://webkit.org/b/183908>
5         <rdar://problem/33553533>
6
7         Reviewed by Daniel Bates.
8
9         No new tests since no change in behavior.
10
11         * platform/mediastream/mac/AVMediaCaptureSource.mm:
12         (WebCore::globaVideoCaptureSerialQueue): Remove use of
13         dispatch_set_target_queue() by changing dispatch_queue_create()
14         to dispatch_queue_create_with_target().
15
16 2018-03-23  Youenn Fablet  <youenn@apple.com>
17
18         Use libwebrtc ObjectiveC H264 encoder and decoder
19         https://bugs.webkit.org/show_bug.cgi?id=183912
20
21         Reviewed by Eric Carlson.
22
23         No observable change of behavior.
24         Made use of libwebrtc WebKit utilities.
25         Updated RealtimeINcomingVideoSourceCocoa as it now receives ObjcVideoFrame.
26
27         * Configurations/WebCore.xcconfig:
28         * SourcesCocoa.txt:
29         * WebCore.xcodeproj/project.pbxproj:
30         * platform/mediastream/libwebrtc/LibWebRTCProviderCocoa.cpp:
31         (WebCore::LibWebRTCProviderCocoa::~LibWebRTCProviderCocoa):
32         (WebCore::LibWebRTCProviderCocoa::setH264HardwareEncoderAllowed):
33         (WebCore::LibWebRTCProviderCocoa::createDecoderFactory):
34         (WebCore::LibWebRTCProviderCocoa::createEncoderFactory):
35         (WebCore::LibWebRTCProviderCocoa::setActive):
36         * platform/mediastream/libwebrtc/LibWebRTCProviderCocoa.h:
37         * platform/mediastream/mac/RealtimeIncomingVideoSourceCocoa.mm: Renamed from Source/WebCore/platform/mediastream/mac/RealtimeIncomingVideoSourceCocoa.cpp.
38         (WebCore::RealtimeIncomingVideoSourceCocoa::pixelBufferFromVideoFrame):
39         (WebCore::RealtimeIncomingVideoSourceCocoa::OnFrame):
40         * testing/Internals.cpp: Removed commented out include.
41
42 2018-03-23  Youenn Fablet  <youenn@apple.com>
43
44         DocumentThreadableLoader should send credentials after redirections and preflight if fetch option credentials is include
45         https://bugs.webkit.org/show_bug.cgi?id=183928
46
47         Reviewed by Chris Dumez.
48
49         Tests: imported/w3c/web-platform-tests/fetch/api/cors/cors-cookies-redirect.any.html
50                imported/w3c/web-platform-tests/fetch/api/cors/cors-cookies-redirect.any.worker.html
51
52         In case mode is include, keep sending credentials even after redirection with preflight.
53
54         * loader/DocumentThreadableLoader.cpp:
55         (WebCore::DocumentThreadableLoader::redirectReceived):
56
57 2018-03-23  Tim Horton  <timothy_horton@apple.com>
58
59         Fix the build after r229858
60
61         * platform/graphics/cocoa/GraphicsContext3DCocoa.mm:
62
63 2018-03-23  Youenn Fablet  <youenn@apple.com>
64
65         Allow fully whitelisted plug-ins to match non HTTP URLs
66         https://bugs.webkit.org/show_bug.cgi?id=183938
67         rdar://problem/38534312
68
69         Reviewed by Chris Dumez.
70
71         Covered by manual testing and unit testing.
72
73         * platform/URL.cpp:
74         (WebCore::URL::isMatchingDomain const):
75
76 2018-03-23  Youenn Fablet  <youenn@apple.com>
77
78         ActiveDOMObject should assert that they are destroyed in the thread they are created
79         https://bugs.webkit.org/show_bug.cgi?id=183671
80
81         Reviewed by Chris Dumez.
82
83         No change of behavior.
84         Moved MessagePort assertion to ActiveDOMObject.
85
86         * dom/ActiveDOMObject.cpp:
87         (WebCore::ActiveDOMObject::~ActiveDOMObject):
88         * dom/ActiveDOMObject.h:
89         * dom/MessagePort.cpp:
90         (WebCore::MessagePort::~MessagePort):
91         * dom/MessagePort.h:
92
93 2018-03-23  Youenn Fablet  <youenn@apple.com>
94
95         Safari WebKitWebRTCAudioModule crash during <video> tag update when audio track present in MediaStream
96         https://bugs.webkit.org/show_bug.cgi?id=181180
97         <rdar://problem/36302375>
98
99         Reviewed by Eric Carlson.
100
101         Test: webrtc/video-update-often.html
102
103         AudioTrackPrivateMediaStreamCocoa needs to be destroyed in the main thread since it owns a Ref to its MediaStreamTrackPrivate.
104         We can still ref it on a background thread but we always deref it on the main thread.
105
106         * platform/mediastream/mac/AudioTrackPrivateMediaStreamCocoa.cpp:
107         (WebCore::AudioTrackPrivateMediaStreamCocoa::audioSamplesAvailable):
108         (WebCore::AudioTrackPrivateMediaStreamCocoa::render):
109
110 2018-03-23  Sergio Villar Senin  <svillar@igalia.com>
111
112         [css-grid] Fix auto repeat tracks computation with definite min sizes
113         https://bugs.webkit.org/show_bug.cgi?id=183933
114
115         Reviewed by Javier Fernandez.
116
117         Indefinitely sized containers use the specified definite min-size (if any) as available
118         space in order to compute the number of auto repeat tracks to create. A bug in that code was
119         causing the grid to be one track larger than expected. That was only happening in the case
120         of the free space being a multiple of the total size of the autorepeat tracks.
121
122         Test: imported/w3c/web-platform-tests/css/css-grid/grid-definition/grid-inline-auto-repeat-001.html
123
124         * rendering/RenderGrid.cpp:
125         (WebCore::RenderGrid::computeAutoRepeatTracksCount const):
126
127 2018-03-23  Miguel Gomez  <magomez@igalia.com>
128
129         [GTK][WPE] Avoid software color conversion inside BitmapTextureGL
130         https://bugs.webkit.org/show_bug.cgi?id=183892
131
132         Reviewed by Žan Doberšek.
133
134         Always use RGBA format on BitmapTextureGL (when no other format is specifically requested). When
135         the texture is updated from BGRA content, use a flag to indicate the shader to perform a color
136         conversion during the painting. This way we don't need to swap the R and B components on the CPU.
137         Also, remove one of the lists in BitmapTexturePool as now all of them have the same format, and
138         remove the UpdateContentsFlag as we never need to modify the original image data.
139
140         Covered by existent tests.
141
142         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp:
143         (WebCore::MediaPlayerPrivateGStreamerBase::updateTexture):
144         * platform/graphics/texmap/BitmapTexture.cpp:
145         (WebCore::BitmapTexture::updateContents):
146         * platform/graphics/texmap/BitmapTexture.h:
147         * platform/graphics/texmap/BitmapTextureGL.cpp:
148         (WebCore::BitmapTextureGL::BitmapTextureGL):
149         (WebCore::BitmapTextureGL::didReset):
150         (WebCore::BitmapTextureGL::updateContents):
151         (WebCore::BitmapTextureGL::applyFilters):
152         (WebCore::swizzleBGRAToRGBA): Deleted.
153         (WebCore::BitmapTextureGL::updateContentsNoSwizzle): Deleted.
154         * platform/graphics/texmap/BitmapTextureGL.h:
155         (WebCore::BitmapTextureGL::colorConvertFlags const):
156         * platform/graphics/texmap/BitmapTexturePool.cpp:
157         (WebCore::BitmapTexturePool::acquireTexture):
158         (WebCore::BitmapTexturePool::releaseUnusedTexturesTimerFired):
159         * platform/graphics/texmap/BitmapTexturePool.h:
160         * platform/graphics/texmap/GraphicsLayerTextureMapper.cpp:
161         (WebCore::GraphicsLayerTextureMapper::updateBackingStoreIfNeeded):
162         * platform/graphics/texmap/TextureMapperContextAttributes.cpp:
163         (WebCore::TextureMapperContextAttributes::get):
164         * platform/graphics/texmap/TextureMapperContextAttributes.h:
165         * platform/graphics/texmap/TextureMapperGL.cpp:
166         (WebCore::TextureMapperGL::drawNumber):
167         (WebCore::TextureMapperGL::drawTexture):
168         * platform/graphics/texmap/TextureMapperGL.h:
169         * platform/graphics/texmap/TextureMapperLayer.cpp:
170         (WebCore::TextureMapperLayer::paintIntoSurface):
171         * platform/graphics/texmap/TextureMapperPlatformLayerBuffer.cpp:
172         (WebCore::TextureMapperPlatformLayerBuffer::paintToTextureMapper):
173         * platform/graphics/texmap/TextureMapperTile.cpp:
174         (WebCore::TextureMapperTile::updateContents):
175         * platform/graphics/texmap/TextureMapperTile.h:
176         * platform/graphics/texmap/TextureMapperTiledBackingStore.cpp:
177         (WebCore::TextureMapperTiledBackingStore::updateContentsFromImageIfNeeded):
178         (WebCore::TextureMapperTiledBackingStore::updateContents):
179         * platform/graphics/texmap/TextureMapperTiledBackingStore.h:
180
181 2018-03-23  Yusuke Suzuki  <utatane.tea@gmail.com>
182
183         [WTF] Add standard containers with FastAllocator specialization
184         https://bugs.webkit.org/show_bug.cgi?id=183789
185
186         Reviewed by Darin Adler.
187
188         * Modules/indexeddb/IDBKeyData.h:
189         * Modules/mediasource/SampleMap.h:
190         * Modules/mediasource/SourceBuffer.cpp:
191         * Modules/webauthn/cbor/CBORValue.h:
192         It did not use FastAllocator for its container.
193
194         * page/WheelEventTestTrigger.h:
195         * platform/audio/PlatformMediaSessionManager.h:
196         * platform/graphics/avfoundation/objc/ImageDecoderAVFObjC.h:
197         * platform/graphics/avfoundation/objc/ImageDecoderAVFObjC.mm:
198         * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
199         * platform/graphics/avfoundation/objc/SourceBufferPrivateAVFObjC.mm:
200         * platform/graphics/cv/VideoTextureCopierCV.cpp:
201         (WebCore::YCbCrToRGBMatrixForRangeAndTransferFunction):
202         * platform/mock/mediasource/MockSourceBufferPrivate.cpp:
203         * platform/wpe/PlatformPasteboardWPE.cpp:
204         * rendering/OrderIterator.h:
205
206 2018-03-23  Antoine Quint  <graouts@apple.com>
207
208         [Web Animations] infinite repeat counts aren't reflected for CSS Animations
209         https://bugs.webkit.org/show_bug.cgi?id=183932
210
211         Reviewed by Dean Jackson.
212
213         The "infinite" value for animation-repeat-count is reflected as a special value which resolves to -1. We need to check
214         for this special value before setting the iterations count on the AnimationEffectTimingReadOnly object.
215
216         * animation/CSSAnimation.cpp:
217         (WebCore::CSSAnimation::syncPropertiesWithBackingAnimation):
218
219 2018-03-22  Antoine Quint  <graouts@apple.com>
220
221         [Web Animations] Correctly cancel animations when a parent gets a "display: none" style or when an element is removed
222         https://bugs.webkit.org/show_bug.cgi?id=183919
223
224         Reviewed by Dean Jackson.
225
226         The old CSSAnimationController provided a cancelAnimations(Element&) method that allowed for animations for a given element
227         to be canceled when a parent element in the hierarchy gets a "display: none" style or if an element with animations is removed.
228         We add a similar cancelAnimationsForElement(Element&) method on AnimationTimeline and update CSSAnimationController::cancelAnimations()
229         call sites to use AnimationTimeline::cancelAnimationsForElement() when the flag to use Web Animations is on.
230
231         * animation/AnimationTimeline.cpp:
232         (WebCore::AnimationTimeline::cancelAnimationsForElement): Iterate over all animations for the provided element and call cancel() on them.
233         * animation/AnimationTimeline.h:
234         * animation/DocumentTimeline.cpp:
235         (WebCore::DocumentTimeline::animatedStyleForRenderer): Drive-by fix while I was reviewed call sites to animationsForElement() to make
236         sure we don't create extra RefPtr<> objects.
237         * dom/Element.cpp:
238         (WebCore::Element::removedFromAncestor): Call AnimationTimeline::cancelAnimationsForElement() if the Web Animations flag is on when an
239         element is removed.
240         * dom/PseudoElement.cpp:
241         (WebCore::PseudoElement::clearHostElement): Call AnimationTimeline::cancelAnimationsForElement() if the Web Animations flag is on when
242         a pseudo-element is removed.
243         * rendering/updating/RenderTreeUpdater.cpp:
244         (WebCore::RenderTreeUpdater::tearDownRenderers): Call AnimationTimeline::cancelAnimationsForElement() if the Web Animations flag is on
245         for all children elements when an element gets a "display: none" style.
246
247 2018-03-23  Antoine Quint  <graouts@apple.com>
248
249         [Web Animations] Animated transform styles are ignored when calling getComputedStyle()
250         https://bugs.webkit.org/show_bug.cgi?id=183918
251
252         Reviewed by Dean Jackson.
253
254         Strictly looking at whether the renderer has a transform is a bad idea when determining whether a
255         transform is applied for an element. Looking at the RenderStyle is preferable because in the case
256         of animations running on the compositor, such as a transform-only animation or transition, the
257         renderer doesn't necessarily have a transform style on it, since we don't blend properties in
258         software as the animation progresses. Instead, all of the blending is performed by the compositor,
259         and only the computed style object has the software-blended transform style on it.
260
261         We do need to account for inline renderers though as these do not support transforms.
262
263         * css/CSSComputedStyleDeclaration.cpp:
264         (WebCore::computedTransform):
265
266 2018-03-22  Antoine Quint  <graouts@apple.com>
267
268         [Web Animations] Support "transition: all" for CSS Transitions as Web Animations
269         https://bugs.webkit.org/show_bug.cgi?id=183917
270
271         Reviewed by Dean Jackson.
272
273         We now support "transition: all" CSS Transitions by iterating over all known CSS properties should the mode
274         of the backing animation be AnimateAll. Any property that we find to have a different value in the previous
275         and current style will have a backing CSSTransition object created for it. To support this, we now explicitly
276         provide a CSSPropertyID when creating a CSSTransition since we can no longer infer the transition property
277         from the backing animation, as Animation objects with mode AnimateAll report CSSPropertyInvalid as their
278         property.
279
280         * animation/AnimationTimeline.cpp:
281         (WebCore::shouldBackingAnimationBeConsideredForCSSTransition): New method that checks whether a given backing
282         Animation object is suitable for consideration as a CSSTransition, where the mode must not be either AnimateNone
283         or AnimateUnknownProperty, and should the mode be AnimateSingleProperty, the property must not be CSSPropertyInvalid.
284         (WebCore::AnimationTimeline::updateCSSTransitionsForElement): We now assemble the list of previously animated
285         properties by looking at the m_elementToCSSTransitionByCSSPropertyID map and getting its keys. Then we compile
286         all backing Animation objects found in the old style that match the conditions enforced by the new method
287         shouldBackingAnimationBeConsideredForCSSTransition(). Then as we iterate over backing Animation objects found
288         in the new style, we iterate over all known CSS properties if the mode is AnimateAll, indicating that we're dealing
289         with a "transition: all" style. If we're dealing with a single property, we only process that single property.
290         * animation/CSSTransition.cpp:
291         (WebCore::CSSTransition::create): Expect a new CSSPropertyID parameter when creating a new CSSTransition since
292         we can no longer infer it from the backing Animation object.
293         (WebCore::CSSTransition::CSSTransition): Expect a new CSSPropertyID parameter when creating a new CSSTransition
294         since we can no longer infer it from the backing Animation object.
295         (WebCore::CSSTransition::matchesBackingAnimationAndStyles const): We can no longer use the == overloaded operator
296         for backing Animation objects to determine whether their respective properties match since this would compare the
297         "property" member of both Animation objects and when going from a "transition: all" style to one targeting a single
298         property, we would falsely identify mis-matching Animation objects. Instead, we pass a false flag to animationsMatch()
299         which indicates that we don't care about matching the transition property itself.
300         * animation/CSSTransition.h: Expose a new property() accessor which returns the CSSPropertyID passed at construction.
301         * animation/KeyframeEffectReadOnly.cpp:
302         (WebCore::KeyframeEffectReadOnly::computeCSSTransitionBlendingKeyframes): Use the new property() accessor on
303         CSSTransition to get at the transition property.
304         * platform/animation/Animation.cpp:
305         (WebCore::Animation::animationsMatch const): Replace the boolean parameter, which was not in use in WebCore, to indicate
306         whether we should match the property-related fields. We need this in CSSTransition::matchesBackingAnimationAndStyles().
307         * platform/animation/Animation.h:
308
309 2018-03-22  Tim Horton  <timothy_horton@apple.com>
310
311         Adopt WK_ALTERNATE_FRAMEWORKS_DIR in WebCore
312         https://bugs.webkit.org/show_bug.cgi?id=183930
313         <rdar://problem/38782249>
314
315         Reviewed by Dan Bernstein.
316
317         * Configurations/Base.xcconfig:
318         * Configurations/WebCore.xcconfig:
319         * Configurations/WebCoreTestSupport.xcconfig:
320
321 2018-03-22  Commit Queue  <commit-queue@webkit.org>
322
323         Unreviewed, rolling out r229876.
324         https://bugs.webkit.org/show_bug.cgi?id=183929
325
326         Some webrtc tests are timing out on iOS simulator (Requested
327         by youenn on #webkit).
328
329         Reverted changeset:
330
331         "Use libwebrtc ObjectiveC H264 encoder and decoder"
332         https://bugs.webkit.org/show_bug.cgi?id=183912
333         https://trac.webkit.org/changeset/229876
334
335 2018-03-22  Megan Gardner  <megan_gardner@apple.com>
336
337         Expose more system colors via CSS
338         https://bugs.webkit.org/show_bug.cgi?id=183764
339         <rdar://problem/36975898>
340
341         Reviewed by Tim Horton.
342
343         Test: fast/css/apple-system-control-colors.html
344
345         Expose Apple specific system colors via CSS.
346
347         * rendering/RenderThemeMac.mm:
348         (WebCore::RenderThemeMac::systemColor const):
349
350 2018-03-22  Nan Wang  <n_wang@apple.com>
351
352         AX: Web table row count is incorrect when role row is added to <tr> in DOM
353         https://bugs.webkit.org/show_bug.cgi?id=183922
354
355         Reviewed by Chris Fleizach.
356
357         Although the parent table for an ARIA grid row should be an ARIA table, we
358         should return the native table if the row is native <tr>.
359
360         Test: accessibility/row-with-aria-role-in-native-table.html
361
362         * accessibility/AccessibilityARIAGridRow.cpp:
363         (WebCore::AccessibilityARIAGridRow::parentTable const):
364
365 2018-03-22  Chris Dumez  <cdumez@apple.com>
366
367         Include security origin in the service worker process name
368         https://bugs.webkit.org/show_bug.cgi?id=183913
369
370         Reviewed by Youenn Fablet.
371
372         Updated localizable strings.
373
374         * English.lproj/Localizable.strings:
375
376 2018-03-22  Youenn Fablet  <youenn@apple.com>
377
378         Use libwebrtc ObjectiveC H264 encoder and decoder
379         https://bugs.webkit.org/show_bug.cgi?id=183912
380
381         Reviewed by Eric Carlson.
382
383         No observable change of behavior.
384         Made use of libwebrtc WebKit utilities.
385         Updated RealtimeINcomingVideoSourceCocoa as it now receives ObjcVideoFrame.
386
387         * Configurations/WebCore.xcconfig:
388         * SourcesCocoa.txt:
389         * WebCore.xcodeproj/project.pbxproj:
390         * platform/mediastream/libwebrtc/LibWebRTCProviderCocoa.cpp:
391         (WebCore::LibWebRTCProviderCocoa::~LibWebRTCProviderCocoa):
392         (WebCore::LibWebRTCProviderCocoa::setH264HardwareEncoderAllowed):
393         (WebCore::LibWebRTCProviderCocoa::createDecoderFactory):
394         (WebCore::LibWebRTCProviderCocoa::createEncoderFactory):
395         (WebCore::LibWebRTCProviderCocoa::setActive):
396         * platform/mediastream/libwebrtc/LibWebRTCProviderCocoa.h:
397         * platform/mediastream/mac/RealtimeIncomingVideoSourceCocoa.mm: Renamed from Source/WebCore/platform/mediastream/mac/RealtimeIncomingVideoSourceCocoa.cpp.
398         (WebCore::RealtimeIncomingVideoSourceCocoa::pixelBufferFromVideoFrame):
399         (WebCore::RealtimeIncomingVideoSourceCocoa::OnFrame):
400         * testing/Internals.cpp: Removed commented out include.
401
402 2018-03-22  Michael Catanzaro  <mcatanzaro@gnome.org>
403
404         Unreviewed, fix format string warnings in service worker code
405
406         On Linux x86_64, uint64_t is unsigned long, not unsigned long long.
407
408         * workers/service/ServiceWorkerContainer.cpp:
409         (WebCore::ServiceWorkerContainer::addRegistration):
410         (WebCore::ServiceWorkerContainer::removeRegistration):
411         (WebCore::ServiceWorkerContainer::updateRegistration):
412         (WebCore::ServiceWorkerContainer::jobFailedWithException):
413         (WebCore::ServiceWorkerContainer::jobResolvedWithRegistration):
414         (WebCore::ServiceWorkerContainer::jobResolvedWithUnregistrationResult):
415         (WebCore::ServiceWorkerContainer::startScriptFetchForJob):
416         (WebCore::ServiceWorkerContainer::jobFinishedLoadingScript):
417         (WebCore::ServiceWorkerContainer::jobFailedLoadingScript):
418
419 2018-03-22  Daniel Bates  <dabates@apple.com>
420
421         Expose SchemeRegistry::registerAsCanDisplayOnlyIfCanRequest() as WebKit SPI
422         https://bugs.webkit.org/show_bug.cgi?id=183907
423         <rdar://problem/38759127>
424
425         Reviewed by Alex Christensen.
426
427         Exports SchemeRegistry::registerAsCanDisplayOnlyIfCanRequest() so that we can use it from WebKit.
428
429         * platform/SchemeRegistry.h:
430
431 2018-03-22  Daniel Bates  <dabates@apple.com>
432
433         CSS mask images should be retrieved using potentially CORS-enabled fetch
434         https://bugs.webkit.org/show_bug.cgi?id=179983
435         <rdar://problem/35678149>
436
437         Reviewed by Brent Fulgham.
438
439         As per <https://drafts.fxtf.org/css-masking-1/#priv-sec> (Editor's Draft, 23 December 2017)
440         we should fetch CSS mask images using a potentially CORS-enabled fetch.
441
442         Both cross-origin CSS shape-outside images and CSS mask images may be sensitive to timing
443         attacks that can be used to reveal their pixel data when retrieved without regard to CORS.
444         For the same reason that we fetch CSS shape-outside images using a potentially CORS-enabled
445         fetch we should fetch CSS mask the same way. This also makes the behavior of WebKit more
446         closely align with the behavior in the spec.
447
448         Test: http/tests/security/css-mask-image.html
449
450         * style/StylePendingResources.cpp: Substitute LoadPolicy::NoCORS and LoadPolicy::Anonymous for
451         LoadPolicy::Normal and LoadPolicy::ShapeOutside, respectively, to match the terminology used
452         in the HTML, CSS Shapes Module Level 1, and CSS Masking Module Level 1 specs.
453         (WebCore::Style::loadPendingImage): Ditto.
454         (WebCore::Style::loadPendingResources): Use load policy LoadPolicy::Anonymous when fetching
455         a mask image or shape-outside image.
456
457 2018-03-22  Zalan Bujtas  <zalan@apple.com>
458
459         [Simple line layout] Text with letter spacing is not positioned properly.
460         https://bugs.webkit.org/show_bug.cgi?id=183079
461         <rdar://problem/38762569>
462
463         Reviewed by Antti Koivisto.
464
465         We need to recompute RenderText::m_canUseSimplifiedTextMeasuring when the font cascade changes
466         since we might not be able to use the fast path anymore.
467
468         Test: fast/text/simple-line-layout-dynamic-letter-word-spacing.html
469
470         * rendering/RenderText.cpp:
471         (WebCore::RenderText::styleDidChange):
472
473 2018-03-21  Antoine Quint  <graouts@apple.com>
474
475         [Web Animations] Make imported/mozilla/css-animations/test_event-dispatch.html pass reliably
476         https://bugs.webkit.org/show_bug.cgi?id=183845
477
478         Reviewed by Dean Jackson.
479
480         Finish the work to get DOM events for CSS Animations and CSS Transitions dispatching as specified.
481
482         * animation/AnimationEffectReadOnly.cpp: Move timeEpsilon to be shared as part of WebAnimationUtilities.h since we now need it in
483         WebAnimation::timeToNextRequiredTick().
484         * animation/AnimationTimeline.cpp:
485         (WebCore::AnimationTimeline::updateCSSAnimationsForElement): We add a pre-emptive return clause when we know that the AnimationList
486         for previous and current styles are a match.
487         * animation/CSSTransition.cpp:
488         (WebCore::CSSTransition::matchesBackingAnimationAndStyles const): Ensure we have a valid effect before downcasting it.
489         * animation/DeclarativeAnimation.cpp:
490         (WebCore::DeclarativeAnimation::initialize): We need to call pause() for declarative animations that aren't playing so that the animation's
491         playState is set correctly and the animation is not idle.
492         * animation/DocumentTimeline.cpp:
493         (WebCore::DocumentTimeline::updateAnimationSchedule): We no longer need to pass the current time to timeToNextRequiredTick() since the method has
494         been reworked to use the animation's current time, which is based on the timeline's current time.
495         (WebCore::DocumentTimeline::updateAnimations): Avoid creating a copy when iterating over pending hardware animations.
496         * animation/KeyframeEffectReadOnly.cpp:
497         (WebCore::KeyframeEffectReadOnly::stylesWouldYieldNewCSSTransitionsBlendingKeyframes const): We should never generate new blending keyframes if the
498         old and new styles contain the same value, since there would be no transition between two equal values, and we should only look at whether the new
499         style value and the recorded target value differ to determine if new blending keyframes are necessary.
500         * animation/WebAnimation.cpp:
501         (WebCore::WebAnimation::timeToNextRequiredTick const): We correct our scheduling code which was shown to be broken in several of the newly-imported
502         Mozilla tests. Any running animation is now scheduled to invalidate again on the next tick, and we use timeEpsilon from WebAnimationUtilities.h to
503         correctly check if we're right at the active threshold, when we also invalidate on the next tick. If our current time is negative, in other words
504         when the animation has not yet started, we schedule this animation's next tick to be the negative of that value. In all other cases, no invalidation
505         needs to be scheduled.
506         * animation/WebAnimation.h: We move updateFinishedState() to private since this method is not actually used outside of WebAnimation.cpp.
507         * animation/WebAnimationUtilities.h: Move timeEpsilon to be shared as part of WebAnimationUtilities.h.
508
509 2018-03-22  Tim Horton  <timothy_horton@apple.com>
510
511         Improve readability of WebCore's OTHER_LDFLAGS
512         https://bugs.webkit.org/show_bug.cgi?id=183909
513         <rdar://problem/38760992>
514
515         Reviewed by Dan Bernstein.
516
517         * Configurations/Base.xcconfig:
518         * Configurations/FeatureDefines.xcconfig:
519         * Configurations/WebCore.xcconfig:
520
521 2018-03-22  Tim Horton  <timothy_horton@apple.com>
522
523         Adopt USE(OPENGL[_ES]) in more places
524         https://bugs.webkit.org/show_bug.cgi?id=183882
525         <rdar://problem/37912195>
526
527         Reviewed by Dan Bernstein.
528
529         * platform/graphics/GraphicsContext3D.h:
530         * platform/graphics/cocoa/GraphicsContext3DCocoa.mm:
531         (WebCore::hasMuxableGPU):
532         (WebCore::GraphicsContext3DManager::updateHighPerformanceState):
533         (WebCore::GraphicsContext3D::GraphicsContext3D):
534         (WebCore::GraphicsContext3D::~GraphicsContext3D):
535         (WebCore::GraphicsContext3D::makeContextCurrent):
536         (WebCore::GraphicsContext3D::checkGPUStatus):
537         (WebCore::GraphicsContext3D::texImageIOSurface2D):
538         * platform/graphics/cocoa/WebGLLayer.h:
539         * platform/graphics/cocoa/WebGLLayer.mm:
540         (-[WebGLLayer initWithGraphicsContext3D:]):
541         (-[WebGLLayer copyImageSnapshotWithColorSpace:]):
542         (-[WebGLLayer display]):
543         * platform/graphics/ios/GraphicsContext3DIOS.h:
544         * platform/graphics/opengl/Extensions3DOpenGL.cpp:
545         (WebCore::Extensions3DOpenGL::blitFramebuffer):
546         (WebCore::Extensions3DOpenGL::createVertexArrayOES):
547         (WebCore::Extensions3DOpenGL::deleteVertexArrayOES):
548         (WebCore::Extensions3DOpenGL::isVertexArrayOES):
549         (WebCore::Extensions3DOpenGL::bindVertexArrayOES):
550         * platform/graphics/opengl/Extensions3DOpenGL.h:
551         * platform/graphics/opengl/GraphicsContext3DOpenGL.cpp:
552         (WebCore::GraphicsContext3D::reshapeFBOs):
553         (WebCore::GraphicsContext3D::resolveMultisamplingIfNecessary):
554         (WebCore::GraphicsContext3D::renderbufferStorage):
555         (WebCore::GraphicsContext3D::getIntegerv):
556         (WebCore::GraphicsContext3D::texImage2D):
557         (WebCore::GraphicsContext3D::depthRange):
558         (WebCore::GraphicsContext3D::clearDepth):
559         * platform/graphics/opengl/GraphicsContext3DOpenGLCommon.cpp:
560         (WebCore::GraphicsContext3D::paintRenderingResultsToCanvas):
561         Make it a bit more clear which code is platform-dependent and which code is GL/GLES-dependent.
562
563 2018-03-22  Zan Dobersek  <zdobersek@igalia.com>
564
565         [TexMap] Make TextureMapperContextAttributes thread-specific
566         https://bugs.webkit.org/show_bug.cgi?id=183895
567
568         Reviewed by Carlos Garcia Campos.
569
570         Store the TextureMapperContextAttributes in a thread-specific manner.
571         The TextureMapperContextAttributes::get() method is now used to retrieve
572         a reference to that thread-specific object. If it's not been initialized
573         yet, then the current GL context is used for the initialization, as it
574         used to be done in the now-removed initialize() method.
575
576         TextureMapperPlatformLayerBuffer::clone() method now doesn't need to
577         be passed a TextureMapperGL object, since the texture can be created
578         directly by calling BitmapTextureGL::create(), passing the
579         TextureMapperContextAttributes object that's retrieved from the
580         thread-specific storage. This further simplifies the
581         TextureMapperPlatformLayerProxy::Compositor interface, removing the
582         texmapGL() getter from it.
583
584         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp:
585         (WebCore::MediaPlayerPrivateGStreamerBase::pushTextureToCompositor):
586         * platform/graphics/texmap/TextureMapperContextAttributes.cpp:
587         (WebCore::threadSpecificAttributes):
588         (WebCore::TextureMapperContextAttributes::get):
589         (WebCore::TextureMapperContextAttributes::initialize): Deleted.
590         * platform/graphics/texmap/TextureMapperContextAttributes.h:
591         * platform/graphics/texmap/TextureMapperGL.cpp:
592         (WebCore::TextureMapperGL::TextureMapperGL):
593         * platform/graphics/texmap/TextureMapperPlatformLayerBuffer.cpp:
594         (WebCore::TextureMapperPlatformLayerBuffer::clone):
595         * platform/graphics/texmap/TextureMapperPlatformLayerBuffer.h:
596         * platform/graphics/texmap/TextureMapperPlatformLayerProxy.cpp:
597         (WebCore::TextureMapperPlatformLayerProxy::dropCurrentBufferWhilePreservingTexture):
598         * platform/graphics/texmap/TextureMapperPlatformLayerProxy.h:
599
600 2018-03-22  Zalan Bujtas  <zalan@apple.com>
601
602         SVG root is skipped while marking percentage height descendants dirty.
603         https://bugs.webkit.org/show_bug.cgi?id=183877
604
605         Reviewed by Antti Koivisto.
606
607         Calling continingBlock() to get to the correct container works as long as the ancestor inline element
608         renderers are wrapped in anonymous blocks (continuation for example).
609
610         While the SVG root renderer is an inline renderer, it is not wrapped or normalized in any way,
611         so containingBlock() will elegantly skip it and return an SVG root ancestor.
612         dirtyForLayoutFromPercentageHeightDescendants calls containingBlock() to walk up
613         on the ancestor chain to mark elements dirty. This fails when there's an SVG subtree in the block chain.
614         This patch marks the SVG subtree chain dirty to ensure that layout will get to all the dirty leaf renderers 
615         (note that the SVG subtree is supposed to have only statically positioned elements so parent == containing block).
616
617         Covered by existing tests.
618
619         * rendering/RenderBlock.cpp:
620         (WebCore::RenderBlock::dirtyForLayoutFromPercentageHeightDescendants):
621
622 2018-03-22  Adrian Perez de Castro  <aperez@igalia.com>
623
624         [WPE][GTK] Build failure when ENABLE_VIDEO, ENABLE_WEB_AUDIO and ENABLE_XSLT are disabled
625         https://bugs.webkit.org/show_bug.cgi?id=183896
626
627         Reviewed by Yusuke Suzuki.
628
629         No new tests needed.
630
631         * bindings/js/JSWebAnimationCustom.cpp: Add missing #include of Document.h
632
633 2018-03-21  Chris Dumez  <cdumez@apple.com>
634
635         Regression(r229828): WebKit.NoHistoryItemScrollToFragment API test is failing on iOS
636         https://bugs.webkit.org/show_bug.cgi?id=183886
637
638         Reviewed by Wenson Hsieh.
639
640         Since r229828, the FrameLoader needs to call FrameLoaderClient::didDecidePolicyForNavigationAction()
641         whenever a navigation policy decision is made. I added such a call r229828 to
642         FrameLoader::continueLoadAfterNavigationPolicy() but forgot to add one to
643         FrameLoader::continueFragmentScrollAfterNavigationPolicy(), which is the equivalent
644         for fragment navigations.
645
646         * loader/FrameLoader.cpp:
647         (WebCore::FrameLoader::continueFragmentScrollAfterNavigationPolicy):
648
649 2018-03-21  Said Abou-Hallawa  <sabouhallawa@apple.com>
650
651         Disconnect the SVGPathSegList items from their SVGPathElement before rebuilding a new list
652         https://bugs.webkit.org/show_bug.cgi?id=183723
653         <rdar://problem/38517871>
654
655         Reviewed by Daniel Bates.
656
657         When setting the "d" attribute directly on a path, we rebuild the list
658         of path segments held for creating the property tear off. The old path
659         segments need to get disconnected from the path element. We already do 
660         that when a path segment is replaced or removed.
661
662         Test: svg/dom/reuse-pathseg-after-changing-d.html
663
664         * svg/SVGPathElement.cpp:
665         (WebCore::SVGPathElement::svgAttributeChanged):
666         * svg/SVGPathSegList.cpp:
667         (WebCore::SVGPathSegList::clear): SVGPathSegListValues::clearContextAndRoles()
668         will now be called from SVGPathSegListValues::clear() via SVGListProperty::clearValues().
669         (WebCore::SVGPathSegList::replaceItem):
670         (WebCore::SVGPathSegList::removeItem):
671         (WebCore::SVGPathSegList::clearContextAndRoles): Deleted.
672         * svg/SVGPathSegList.h: SVGPathSegListValues::clearContextAndRoles() will
673         now be called from SVGPathSegListValues::clear() via SVGListProperty::initializeValues().
674         * svg/SVGPathSegListValues.cpp:
675         (WebCore::SVGPathSegListValues::clearItemContextAndRole):
676         (WebCore::SVGPathSegListValues::clearContextAndRoles):
677         * svg/SVGPathSegListValues.h:
678         (WebCore::SVGPathSegListValues::operator=):
679         (WebCore::SVGPathSegListValues::clear):
680
681 2018-03-21  Antoine Quint  <graouts@apple.com>
682
683         [Web Animations] Ensure animationcancel and transitioncancel events are dispatched
684         https://bugs.webkit.org/show_bug.cgi?id=183864
685
686         Reviewed by Dean Jackson.
687
688         In order to correctly dispatch animationcancel and transitioncancel events, we must call cancel() on CSSAnimation and CSSTransitions
689         objects that are removed while in a play or pause phase. Additionally, we cancel declarative animations that are moving from a valid
690         to a null timeline. Finally, when cancel() is called on a declarative animation, we record the timestamp and manually call
691         invalidateDOMEvents() passing that timestamp in to ensure that the right phase change is recorded and results in the queuing of
692         animationcancel and transitioncancel events.
693
694         * animation/AnimationTimeline.cpp:
695         (WebCore::AnimationTimeline::updateCSSAnimationsForElement): Make sure we cancel all recorded CSS Animations when we newly get a
696         "display: none" style. We also call the new cancelOrRemoveDeclarativeAnimation() method, instead of removing animations outright,
697         for all animations that previously existed but are no longer listed in the current style.
698         (WebCore::AnimationTimeline::updateCSSTransitionsForElement): Like in updateCSSAnimationsForElement(), we cancel all recorded CSS
699         Transitions when we newly get a "display: none" style. We now use the refactored removeDeclarativeAnimation() method to remove an
700         a transition for a property that was already transitioned in the previous style but has a new backing Animation object. Finally,
701         like in updateCSSAnimationsForElement(), we call the new cancelOrRemoveDeclarativeAnimation() method, instead of removing transitions
702         outright, for all transitions that previously existed but are no longer listed in the current style.
703         (WebCore::AnimationTimeline::removeDeclarativeAnimation): Refactor code into this new method to remove a declarative animation.
704         (WebCore::AnimationTimeline::cancelOrRemoveDeclarativeAnimation): Cancels a DeclarativeAnimation if it's active or removes it right away.
705         * animation/AnimationTimeline.h:
706         * animation/DeclarativeAnimation.cpp:
707         (WebCore::DeclarativeAnimation::setTimeline): If we're moving from a valid timeline to a null timeline, call cancel() on this animation
708         such that an animationcancel or transitioncancel event can be dispatched.
709         (WebCore::DeclarativeAnimation::cancel): Cancelations require the computation of the time at which a declarative animation was canceled,
710         so we record the animation's active time as it's canceled and manually call invalidateDOMEvents() with that time after the general cancel()
711         code has run.
712         (WebCore::DeclarativeAnimation::invalidateDOMEvents): Accept an explicit timestamp for cancel events.
713         * animation/DeclarativeAnimation.h:
714         * animation/WebAnimation.h:
715
716 2018-03-21  Chris Dumez  <cdumez@apple.com>
717
718         ScrollViewInsetTests.RestoreInitialContentOffsetAfterCrash API test is failing with async delegates
719         https://bugs.webkit.org/show_bug.cgi?id=183787
720
721         Reviewed by Wenson Hsieh.
722
723         * loader/FrameLoader.cpp:
724         (WebCore::FrameLoader::continueLoadAfterNavigationPolicy):
725         * loader/FrameLoaderClient.h:
726
727 2018-03-21  Eric Carlson  <eric.carlson@apple.com>
728
729         Clean up platform VideoFullscreenLayerManager
730         https://bugs.webkit.org/show_bug.cgi?id=183859
731         <rdar://problem/38715419>
732
733         Reviewed by Jer Noble.
734
735         No new tests, no functional change.
736
737         * WebCore.xcodeproj/project.pbxproj:
738         * platform/graphics/VideoFullscreenLayerManager.h: Copied from Source/WebCore/platform/graphics/avfoundation/objc/VideoFullscreenLayerManager.h.
739         (WebCore::VideoFullscreenLayerManager::~VideoFullscreenLayerManager):
740         * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.h:
741         * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
742         (WebCore::MediaPlayerPrivateAVFoundationObjC::MediaPlayerPrivateAVFoundationObjC):
743         (WebCore::MediaPlayerPrivateAVFoundationObjC::createAVPlayerLayer):
744         (WebCore::MediaPlayerPrivateAVFoundationObjC::destroyVideoLayer):
745         (WebCore::MediaPlayerPrivateAVFoundationObjC::platformLayer const):
746         (WebCore::MediaPlayerPrivateAVFoundationObjC::setVideoFullscreenLayer):
747         (WebCore::MediaPlayerPrivateAVFoundationObjC::setVideoFullscreenFrame):
748         (WebCore::MediaPlayerPrivateAVFoundationObjC::updateVideoLayerGravity):
749         (WebCore::MediaPlayerPrivateAVFoundationObjC::requiresTextTrackRepresentation const):
750         (WebCore::MediaPlayerPrivateAVFoundationObjC::syncTextTrackBounds):
751         (WebCore::MediaPlayerPrivateAVFoundationObjC::setTextTrackRepresentation):
752         * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.h:
753         * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.mm:
754         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::MediaPlayerPrivateMediaSourceAVFObjC):
755         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::platformLayer const):
756         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::ensureLayer):
757         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::destroyLayer):
758         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::setVideoFullscreenLayer):
759         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::setVideoFullscreenFrame):
760         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::requiresTextTrackRepresentation const):
761         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::syncTextTrackBounds):
762         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::setTextTrackRepresentation):
763         * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.h:
764         * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.mm:
765         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::MediaPlayerPrivateMediaStreamAVFObjC):
766         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::ensureLayers):
767         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::destroyLayers):
768         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::platformLayer const):
769         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::setVideoFullscreenLayer):
770         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::setVideoFullscreenFrame):
771         * platform/graphics/avfoundation/objc/VideoFullscreenLayerManagerObjC.h: Renamed from Source/WebCore/platform/graphics/avfoundation/objc/VideoFullscreenLayerManager.h.
772         * platform/graphics/avfoundation/objc/VideoFullscreenLayerManagerObjC.mm: Renamed from Source/WebCore/platform/graphics/avfoundation/objc/VideoFullscreenLayerManager.mm.
773         (-[WebVideoContainerLayer setBounds:]):
774         (-[WebVideoContainerLayer setPosition:]):
775         (WebCore::VideoFullscreenLayerManagerObjC::VideoFullscreenLayerManagerObjC):
776         (WebCore::VideoFullscreenLayerManagerObjC::setVideoLayer):
777         (WebCore::VideoFullscreenLayerManagerObjC::setVideoFullscreenLayer):
778         (WebCore::VideoFullscreenLayerManagerObjC::setVideoFullscreenFrame):
779         (WebCore::VideoFullscreenLayerManagerObjC::didDestroyVideoLayer):
780         (WebCore::VideoFullscreenLayerManagerObjC::requiresTextTrackRepresentation const):
781         (WebCore::VideoFullscreenLayerManagerObjC::syncTextTrackBounds):
782         (WebCore::VideoFullscreenLayerManagerObjC::setTextTrackRepresentation):
783
784 2018-03-21  Antoine Quint  <graouts@apple.com>
785
786         [Web Animations] Dispatch DOM events for CSS Transitions and CSS Animations implemented as Web Animations
787         https://bugs.webkit.org/show_bug.cgi?id=183781
788
789         Reviewed by Dean Jackson.
790
791         Now that we've implemented CSS Animations and CSS Transitions as Web Animations (webkit.org/b/183504) we can dispatch DOM events
792         for targets of DeclarativeAnimation objects. To do that, we add a new invalidateDOMEvents() method on DeclarativeAnimations which
793         is called when the timer scheduled after the timing model has been invalidated fires in DocumentTimeline::performInvalidationTask().
794         When we check for DOM events to dispatch, we look at the last recorded phase and iteration and determine whether the state of the
795         animation has changed. We use a GenericEventQueue to enqueue the events such that they are dispatched asynchronously at a moment
796         when it is safe to evaluate script.
797
798         * animation/AnimationEffectReadOnly.h: Make currentIteration() public since we now need it in DeclarativeAnimation::invalidateDOMEvents().
799         * animation/CSSAnimation.cpp:
800         (WebCore::CSSAnimation::create): Pass the animation target to the constructor instead of its document.
801         (WebCore::CSSAnimation::CSSAnimation): Pass the animation target to the superclass instead of its document.
802         * animation/CSSAnimation.h:
803         * animation/CSSTransition.cpp:
804         (WebCore::CSSTransition::create): Pass the animation target to the constructor instead of its document.
805         (WebCore::CSSTransition::CSSTransition): Pass the animation target to the superclass instead of its document.
806         * animation/CSSTransition.h:
807         * animation/DeclarativeAnimation.cpp:
808         (WebCore::DeclarativeAnimation::DeclarativeAnimation): Expect an Element instead of a Document and use that element as the target of the
809         GenericEventQueue that we initialize. We also register this element as our m_target.
810         (WebCore::DeclarativeAnimation::~DeclarativeAnimation): Close the GenericEventQueue member upon destruction.
811         (WebCore::DeclarativeAnimation::initialize): We need to call pause() for declarative animations that aren't playing so that the animation's
812         playState is set correctly and the animation is not idle.
813         (WebCore::DeclarativeAnimation::phaseWithoutEffect const): Because we may need to get an animation's current phase in invalidateDOMEvents()
814         after an animation's effect has been removed, we provide an alternate way to compute the phase just by looking at the animation's current time.
815         (WebCore::DeclarativeAnimation::invalidateDOMEvents): Based on the previous and current pending state, iteration and phase, we enqueue animation
816         and transition DOM events as specified by the CSS Animations Level 2 and CSS Transitions Level 2 specifications.
817         (WebCore::DeclarativeAnimation::enqueueDOMEvent): Enqueue an event on the GenericEventQueue based on the animation type.
818         * animation/DeclarativeAnimation.h:
819         * animation/DocumentTimeline.cpp:
820         (WebCore::DocumentTimeline::performInvalidationTask): We call invalidateDOMEvents() on all declarative animations registered with this timeline
821         now that the timing model has been invalidated.
822         * dom/EventNames.h: Add the names of newly-implemented events (animationcancel, transitioncancel, transitionrun and transitionstart).
823         * dom/GlobalEventHandlers.idl: Add new attribute-based event handlers for the newly-implemented events.
824         * html/HTMLAttributeNames.in: Add new attribute-based event handlers for the newly-implemented events.
825         * html/HTMLElement.cpp:
826         (WebCore::HTMLElement::createEventHandlerNameMap): Add new attribute-based event handlers for the newly-implemented events.
827
828 2018-03-21  Per Arne Vollan  <pvollan@apple.com>
829
830         Compile error when not using IOSurface canvas backing store.
831         https://bugs.webkit.org/show_bug.cgi?id=183855
832
833         Reviewed by Brent Fulgham.
834
835         The method IOSurface::createFromImageBuffer is only referenced when IOSurface
836         is used as canvas backing store.
837
838         * platform/graphics/cocoa/IOSurface.h:
839         * platform/graphics/cocoa/IOSurface.mm:
840
841 2018-03-21  Zan Dobersek  <zdobersek@igalia.com>
842
843         [CoordGraphics] Track dirty rects that need update in CoordinatedGraphicsLayer
844         https://bugs.webkit.org/show_bug.cgi?id=175376
845
846         Reviewed by Carlos Garcia Campos.
847
848         Follow the GraphicsLayerCA class and track rectangles in need of display
849         in a Vector object. In case the whole layer needs updating, it's marked
850         separately, and further rects are ignored.
851
852         During layer flush, all the rects are used to invalidate the backing
853         store, or a single layer-sized rect is used in case the whole layer has
854         to be updated. We can also bail early from updateContentBuffers() if
855         there are no dirty rects recorded and there's no pending visible rect
856         adjustment.
857
858         At the end of updateContentBuffers() we now test for an existing
859         previous backing store before inquiring the backing store if the visible
860         area is already covered, enabling deletion of this backing store.
861
862         * platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.cpp:
863         (WebCore::CoordinatedGraphicsLayer::setNeedsDisplay):
864         (WebCore::CoordinatedGraphicsLayer::setNeedsDisplayInRect):
865         (WebCore::CoordinatedGraphicsLayer::updateContentBuffers):
866         * platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.h:
867
868 2018-03-21  Carlos Alberto Lopez Perez  <clopez@igalia.com>
869
870         [WPE] Build failure with ENABLE_VIDEO=OFF when GStreamer is not available
871         https://bugs.webkit.org/show_bug.cgi?id=183811
872
873         Reviewed by Philippe Normand.
874
875         Add build guards for USE_GSTREAMER.
876
877         No new tests, it is a build fix.
878
879         * platform/graphics/gstreamer/GStreamerUtilities.h:
880
881 2018-03-21  Zan Dobersek  <zdobersek@igalia.com>
882
883         [Cairo] Draw Cairo patterns with cairo_paint_with_alpha()
884         https://bugs.webkit.org/show_bug.cgi?id=183774
885
886         Reviewed by Carlos Garcia Campos.
887
888         In the drawPatternToCairoContext() helper in CairoOperations.cpp source
889         file, always clip the painting region to the specified rectangle and
890         then use cairo_paint_with_alpha() to paint the passed-in pattern object,
891         not relaying rasterization to cairo_fill() when using opaque alpha. We
892         still clamp the alpha value to the 0.0 - 1.0 range.
893
894         No new tests -- no change in behavior.
895
896         * platform/graphics/cairo/CairoOperations.cpp:
897         (WebCore::Cairo::drawPatternToCairoContext):
898
899 2018-03-21  Zan Dobersek  <zdobersek@igalia.com>
900
901         [TexMap] Have TextureMapperLayer::applyAnimationsRecursively() return running animation status
902         https://bugs.webkit.org/show_bug.cgi?id=183771
903
904         Reviewed by Carlos Garcia Campos.
905
906         TextureMapperLayer::applyAnimationsRecursively() should return true when
907         the TextureMapperLayer tree has currently-running animations that
908         require continuous scene update.
909
910         TextureMapperAnimation::ApplicationResult gains the hasRunningAnimation
911         member that's set to true if any of the applied animations are still in
912         playing state. That information is then returned in syncAnimations(),
913         and the result is accumulated in the top applyAnimationsRecursively()
914         call and returned there to the caller.
915
916         No new tests -- no change in behavior.
917
918         * platform/graphics/texmap/TextureMapperAnimation.cpp:
919         (WebCore::TextureMapperAnimation::apply):
920         * platform/graphics/texmap/TextureMapperAnimation.h:
921         * platform/graphics/texmap/TextureMapperLayer.cpp:
922         (WebCore::TextureMapperLayer::applyAnimationsRecursively):
923         (WebCore::TextureMapperLayer::syncAnimations):
924         * platform/graphics/texmap/TextureMapperLayer.h:
925
926 2018-03-21  Zan Dobersek  <zdobersek@igalia.com>
927
928         Use-after-move in SWContextManager::terminateWorker() with Linux x86_64 calling convention
929         https://bugs.webkit.org/show_bug.cgi?id=183783
930
931         Reviewed by Chris Dumez.
932
933         In SWContextManager::terminateWorker(), some calling conventions can
934         end up moving the ServiceWorkerThreadProxy RefPtr into the lambda struct
935         before that proxy's thread (on which the lambda is bound to execute) is
936         retrieved.
937
938         Avoid this by taking a reference to the thread in a separate earlier
939         expression, before the RefPtr is moved into the lambda in the following
940         one.
941
942         * workers/service/context/SWContextManager.cpp:
943         (WebCore::SWContextManager::terminateWorker):
944
945 2018-03-21  Timothy Horton  <timothy_horton@apple.com>
946
947         Fix the build
948
949         * platform/network/cf/FormDataStreamCFNet.cpp:
950
951 2018-03-20  Tim Horton  <timothy_horton@apple.com>
952
953         Introduce HAVE_MEDIA_PLAYER and HAVE_CORE_VIDEO
954         https://bugs.webkit.org/show_bug.cgi?id=183803
955         <rdar://problem/38690487>
956
957         Reviewed by Sam Weinig.
958
959         * platform/audio/ios/MediaSessionManagerIOS.mm:
960         (WebCore::MediaSessionManageriOS::configureWireLessTargetMonitoring):
961         (WebCore::MediaSessionManageriOS::updateNowPlayingInfo):
962         (-[WebMediaSessionHelper initWithCallback:]):
963         (-[WebMediaSessionHelper dealloc]):
964         (-[WebMediaSessionHelper hasWirelessTargetsAvailable]):
965         * platform/cocoa/CoreVideoSoftLink.cpp:
966         * platform/cocoa/CoreVideoSoftLink.h:
967         * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.h:
968         * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
969         (WebCore::MediaPlayerPrivateAVFoundationObjC::createVideoLayer):
970         (WebCore::MediaPlayerPrivateAVFoundationObjC::hasAvailableVideoFrame const):
971         (WebCore::MediaPlayerPrivateAVFoundationObjC::updateLastImage):
972         * platform/graphics/avfoundation/objc/MediaSampleAVFObjC.mm:
973         (WebCore::MediaSampleAVFObjC::getRGBAImageData const):
974         * platform/graphics/cv/PixelBufferConformerCV.cpp:
975         * platform/graphics/cv/PixelBufferConformerCV.h:
976         * platform/graphics/cv/TextureCacheCV.h:
977         * platform/graphics/cv/TextureCacheCV.mm:
978         * platform/graphics/cv/VideoTextureCopierCV.cpp:
979         * platform/graphics/cv/VideoTextureCopierCV.h:
980         Make it possible to disable our dependency on MediaPlayer and CoreVideo.
981
982 2018-03-20  Tim Horton  <timothy_horton@apple.com>
983
984         Enable the minimal simulator feature flag when appropriate
985         https://bugs.webkit.org/show_bug.cgi?id=183807
986
987         Reviewed by Dan Bernstein.
988
989         * Configurations/FeatureDefines.xcconfig:
990
991 2018-03-19  Ryosuke Niwa  <rniwa@webkit.org>
992
993         Expose content attributes on _WKLinkIconParameters
994         https://bugs.webkit.org/show_bug.cgi?id=183768
995
996         Reviewed by Alex Christensen.
997
998         Collect a vector of content attributes upon finding touch and fav-icons in order to expose it in a WebKit API.
999
1000         Tests: IconLoading.DefaultFavicon
1001
1002         * html/LinkIconCollector.cpp:
1003         (WebCore::LinkIconCollector::iconsOfTypes): Collect attributes.
1004         * loader/DocumentLoader.cpp:
1005         (WebCore::DocumentLoader::startIconLoading): Use an empty vector for /favicon.ico.
1006         * platform/LinkIcon.h:
1007         (WebCore::LinkIcon::encode const): Encode the vector of content attributes.
1008         (WebCore::LinkIcon::decode): Ditto for decoding.
1009
1010 2018-03-20  Zalan Bujtas  <zalan@apple.com>
1011
1012         RenderTreeNeedsLayoutChecker fails with absolutely positioned svg and <use>
1013         https://bugs.webkit.org/show_bug.cgi?id=183718
1014
1015         Reviewed by Antti Koivisto.
1016
1017         This patch ensures after resolving the style for an SVG element with a corresponding element (<use>),
1018         we adjust this style for the cloned SVG element too.
1019
1020         Test: svg/in-html/path-with-absolute-positioned-svg-and-use-crash.html
1021
1022         * css/StyleResolver.cpp:
1023         (WebCore::StyleResolver::adjustSVGElementStyle):
1024         (WebCore::StyleResolver::adjustRenderStyle):
1025         * css/StyleResolver.h:
1026         * svg/SVGElement.cpp:
1027         (WebCore::SVGElement::resolveCustomStyle):
1028
1029 2018-03-20  Brady Eidson  <beidson@apple.com>
1030
1031         First piece of process swapping on navigation.
1032         https://bugs.webkit.org/show_bug.cgi?id=183665
1033
1034         Reviewed by Andy Estes.
1035
1036         Covered by API test(s)
1037
1038         This patch:
1039         - A new PolicyAction::Suspend for future use in this feature
1040         - Makes sure that loads triggered as part of a process swap do *not* re-consult the policy delegate
1041
1042         * loader/DocumentLoader.cpp:
1043         (WebCore::DocumentLoader::continueAfterContentPolicy):
1044
1045         * loader/FrameLoadRequest.h:
1046         (WebCore::FrameLoadRequest::setShouldCheckNavigationPolicy):
1047         (WebCore::FrameLoadRequest::shouldCheckNavigationPolicy const):
1048
1049         * loader/FrameLoader.cpp:
1050         (WebCore::FrameLoader::load):
1051         (WebCore::FrameLoader::loadWithDocumentLoader):
1052         * loader/FrameLoader.h:
1053
1054         * loader/FrameLoaderTypes.h: Add a new Policy type "Suspend" to be used in the future
1055           by the process-swap-on-navigation mechanism.
1056
1057         * loader/PolicyChecker.cpp:
1058         (WebCore::PolicyChecker::checkNavigationPolicy):
1059         (WebCore::PolicyChecker::checkNewWindowPolicy):
1060
1061 2018-03-20  Chris Dumez  <cdumez@apple.com>
1062
1063         QuickLook.NavigationDelegate API test is failing on iOS with async policy delegates
1064         https://bugs.webkit.org/show_bug.cgi?id=183791
1065
1066         Reviewed by Alex Christensen.
1067
1068         Update PreviewLoader to not send data (or call finishFinishLoading) until
1069         the resource response has been processed.
1070
1071         * loader/ios/PreviewLoader.mm:
1072         (-[WebPreviewLoader _sendDidReceiveResponseIfNecessary]):
1073         (-[WebPreviewLoader connection:didReceiveData:lengthReceived:]):
1074         (-[WebPreviewLoader connectionDidFinishLoading:]):
1075
1076 2018-03-20  Antoine Quint  <graouts@apple.com>
1077
1078         [Web Animations] Update the timing model when pending tasks schedule changes
1079         https://bugs.webkit.org/show_bug.cgi?id=183785
1080
1081         Reviewed by Dean Jackson.
1082
1083         Changing the time at which a pending play or pause task is scheduled changes the pending
1084         state of the animation and thus should notify that the timing model has changed and invalidate
1085         the effect.
1086
1087         * animation/WebAnimation.cpp:
1088         (WebCore::WebAnimation::setTimeToRunPendingPlayTask):
1089         (WebCore::WebAnimation::setTimeToRunPendingPauseTask):
1090         (WebCore::WebAnimation::updatePendingTasks):
1091
1092 2018-03-20  Tim Horton  <timothy_horton@apple.com>
1093
1094         Add and adopt WK_PLATFORM_NAME and adjust default feature defines
1095         https://bugs.webkit.org/show_bug.cgi?id=183758
1096         <rdar://problem/38017644>
1097
1098         Reviewed by Dan Bernstein.
1099
1100         * Configurations/Base.xcconfig:
1101         * Configurations/FeatureDefines.xcconfig:
1102         * WebCore.xcodeproj/project.pbxproj:
1103
1104 2018-03-19  Tim Horton  <timothy_horton@apple.com>
1105
1106         Apply some SDK checks in LocalDefaultSystemAppearance
1107         https://bugs.webkit.org/show_bug.cgi?id=183767
1108         <rdar://problem/38649611>
1109
1110         Reviewed by Zalan Bujtas.
1111
1112         * platform/mac/LocalDefaultSystemAppearance.h:
1113         * platform/mac/LocalDefaultSystemAppearance.mm:
1114         (WebCore::LocalDefaultSystemAppearance::LocalDefaultSystemAppearance):
1115         (WebCore::LocalDefaultSystemAppearance::~LocalDefaultSystemAppearance):
1116
1117 2018-03-19  Chris Dumez  <cdumez@apple.com>
1118
1119         Have one service worker process per security origin
1120         https://bugs.webkit.org/show_bug.cgi?id=183600
1121         <rdar://problem/35280128>
1122
1123         Reviewed by Brady Eidson.
1124
1125         Split service workers from different origins into their own processes
1126         for security reasons.
1127
1128         * workers/service/server/SWServer.cpp:
1129         (WebCore::SWServer::addRegistrationFromStore):
1130         (WebCore::SWServer::clear):
1131         (WebCore::SWServer::tryInstallContextData):
1132         (WebCore::SWServer::serverToContextConnectionCreated):
1133         (WebCore::SWServer::installContextData):
1134         (WebCore::SWServer::runServiceWorkerIfNecessary):
1135         (WebCore::SWServer::markAllWorkersAsTerminated):
1136         * workers/service/server/SWServer.h:
1137         * workers/service/server/SWServerToContextConnection.cpp:
1138         (WebCore::SWServerToContextConnection::SWServerToContextConnection):
1139         (WebCore::SWServerToContextConnection::~SWServerToContextConnection):
1140         (WebCore::SWServerToContextConnection::connectionForOrigin):
1141         * workers/service/server/SWServerToContextConnection.h:
1142         (WebCore::SWServerToContextConnection::origin):
1143         * workers/service/server/SWServerWorker.cpp:
1144         (WebCore::SWServerWorker::SWServerWorker):
1145         (WebCore::SWServerWorker::securityOrigin const):
1146         (WebCore::SWServerWorker::contextConnection):
1147         * workers/service/server/SWServerWorker.h:
1148
1149 2018-03-19  Megan Gardner  <megan_gardner@apple.com>
1150
1151         Have select element respect current appearance
1152         https://bugs.webkit.org/show_bug.cgi?id=183753
1153
1154         Reviewed by Tim Horton.
1155
1156         Not currently testable, will add tests in a later patch.
1157
1158         Have the menu lists/select elements follow the system colors.
1159
1160         * rendering/RenderThemeMac.mm:
1161         (WebCore::RenderThemeMac::adjustMenuListStyle const):
1162
1163 2018-03-19  Nan Wang  <n_wang@apple.com>
1164
1165         AX: embedded attachments do not work correctly with text marker APIs on macOS
1166         https://bugs.webkit.org/show_bug.cgi?id=183751
1167
1168         Reviewed by Chris Fleizach.
1169
1170         In WebKit1, embedded attachments are not working well with text marker APIs.
1171         We should use the corresponding attachment view in the following cases:
1172         1. Hit testing on an attachment object.
1173         2. Getting the attachment object at a text marker position.
1174         3. Asking for the associated element with NSAccessibilityAttachmentTextAttribute. 
1175
1176         Not able to construct a layout test because it relies on embedded attachments.
1177
1178         * accessibility/mac/WebAccessibilityObjectWrapperMac.mm:
1179         (AXAttributeStringSetElement):
1180         (-[WebAccessibilityObjectWrapper accessibilityHitTest:]):
1181         (-[WebAccessibilityObjectWrapper accessibilityAttributeValue:forParameter:]):
1182
1183 2018-03-19  Jiewen Tan  <jiewen_tan@apple.com>
1184
1185         Unreviewed, another quick fix for r229699
1186
1187         Restricts ENABLE_WEB_AUTHN to only macOS and iOS.
1188
1189         * Configurations/FeatureDefines.xcconfig:
1190
1191 2018-03-19  Daniel Bates  <dabates@apple.com>
1192
1193         Fix case of Strong Password localized string
1194
1195         * English.lproj/Localizable.strings:
1196         * platform/LocalizedStrings.cpp:
1197         (WebCore::autoFillStrongPasswordLabel):
1198
1199 2018-03-19  Chris Dumez  <cdumez@apple.com>
1200
1201         WebKit.WebsitePoliciesAutoplayQuirks API test times out with async policy delegates
1202         https://bugs.webkit.org/show_bug.cgi?id=183702
1203         <rdar://problem/38566060>
1204
1205         Reviewed by Alex Christensen.
1206
1207         The issue is that the test calls loadHTMLString then loadRequest right after, without
1208         waiting for the first load to complete first. loadHTMLString is special as it relies
1209         on substitute data and which schedules a timer to commit the data. When doing the
1210         navigation policy check for the following loadRequest(), the substitute data timer
1211         would fire and commit its data and load. This would in turn cancel the pending
1212         navigation policy check for the loadRequest().
1213
1214         With sync policy delegates, this is not an issue because we take care of stopping
1215         all loaders when receiving the policy decision, which happens synchronously. However,
1216         when the policy decision happens asynchronously, the pending substitute data load
1217         does not get cancelled in time and it gets committed.
1218
1219         To address the issue, we now cancel any pending provisional load before doing the
1220         navigation policy check.
1221
1222         Test: fast/loader/inner-iframe-loads-data-url-into-parent-on-unload-crash-async-delegate.html
1223
1224         * loader/FrameLoader.cpp:
1225         (WebCore::FrameLoader::clearProvisionalLoadForPolicyCheck):
1226         * loader/FrameLoader.h:
1227         * loader/PolicyChecker.cpp:
1228         (WebCore::PolicyChecker::checkNavigationPolicy):
1229         Cancel any pending provisional load before starting the navigation policy check. This call
1230         needs to be here rather than in the call site of policyChecker().checkNavigationPolicy()
1231         because there is code in PolicyChecker::checkNavigationPolicy() which relies on
1232         FrameLoader::activeDocumentLoader().
1233         Also, we only cancel the provisional load if there is a policy document loader. In some
1234         rare cases (when we receive a redirect after navigation policy has been decided for the
1235         initial request), the provisional document loader needs to receive navigation policy
1236         decisions so we cannot clear the provisional document loader in such case.
1237
1238 2018-03-19  Eric Carlson  <eric.carlson@apple.com>
1239
1240         [Extra zoom mode] Require fullscreen for video playback
1241         https://bugs.webkit.org/show_bug.cgi?id=183742
1242         <rdar://problem/38235862>
1243
1244         Reviewed by Jer Noble.
1245
1246         * Modules/modern-media-controls/media/playback-support.js:
1247         (PlaybackSupport.prototype.syncControl): Always show the play button.
1248         * html/HTMLMediaElement.cpp:
1249         (WebCore::HTMLMediaElement::updatePlayState): Return immediately if playback requires fullscreen
1250         (WebCore::HTMLMediaElement::didBecomeFullscreenElement): Call updatePlayState in case 
1251         playback is pending.
1252         * html/HTMLMediaElement.h:
1253         * platform/cocoa/VideoFullscreenModel.h:
1254         (WebCore::VideoFullscreenModel::presentingViewController): New.
1255         (WebCore::VideoFullscreenModel::createVideoFullscreenViewController): New.
1256         * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
1257         (WebCore::MediaPlayerPrivateAVFoundationObjC::createAVPlayerLayer):
1258         (WebCore::MediaPlayerPrivateAVFoundationObjC::setVideoFullscreenMode):
1259         * platform/ios/PlaybackSessionInterfaceAVKit.mm:
1260         (WebCore::PlaybackSessionInterfaceAVKit::seekableRangesChanged):
1261
1262         * platform/ios/VideoFullscreenInterfaceAVKit.h:
1263         * platform/ios/VideoFullscreenInterfaceAVKit.mm: Wrap AVPlayerLayerView so we can change its
1264         behavior.
1265         (WebAVPlayerLayerView_playerLayer):
1266         (WebAVPlayerLayerView_videoView):
1267         (allocWebAVPlayerLayerViewInstance):
1268         (-[WebAVPlayerViewController initWithFullscreenInterface:]):
1269         (-[WebAVPlayerViewController playerViewControllerShouldHandleDoneButtonTap:]):
1270         (-[WebAVPlayerViewController enterFullScreenAnimated:completionHandler:]):
1271         (-[WebAVPlayerViewController exitFullScreenAnimated:completionHandler:]):
1272         (-[WebAVPlayerViewController NO_RETURN_DUE_TO_ASSERT]):
1273         (-[WebAVPlayerViewController isPictureInPicturePossible]):
1274         (-[WebAVPlayerViewController isPictureInPictureActive]):
1275         (-[WebAVPlayerViewController isPictureInPictureSuspended]):
1276         (-[WebAVPlayerViewController pictureInPictureActive]):
1277         (-[WebAVPlayerViewController pictureInPictureWasStartedWhenEnteringBackground]):
1278         (-[WebAVPlayerViewController view]):
1279         (-[WebAVPlayerViewController showsPlaybackControls]):
1280         (-[WebAVPlayerViewController setShowsPlaybackControls:]):
1281         (-[WebAVPlayerViewController setAllowsPictureInPicturePlayback:]):
1282         (-[WebAVPlayerViewController setDelegate:]):
1283         (-[WebAVPlayerViewController setPlayerController:]):
1284         (-[WebAVPlayerViewController avPlayerViewController]):
1285         (-[WebAVPlayerViewController removeFromParentViewController]):
1286         (VideoFullscreenInterfaceAVKit::setupFullscreen):
1287         (fallbackViewController):
1288         (VideoFullscreenInterfaceAVKit::presentingViewController):
1289         (VideoFullscreenInterfaceAVKit::shouldExitFullscreenWithReason):
1290         (VideoFullscreenInterfaceAVKit::doSetup):
1291         (WebCore::supportsPictureInPicture):
1292
1293 2018-03-19  Per Arne Vollan  <pvollan@apple.com>
1294
1295         When the WebContent process is blocked from accessing the WindowServer, the call CVDisplayLinkCreateWithCGDisplay will fail.
1296         https://bugs.webkit.org/show_bug.cgi?id=183604
1297         <rdar://problem/38305109>
1298
1299         Reviewed by Brent Fulgham.
1300
1301         The call to CVDisplayLinkCreateWithCGDisplay can instead be made in the UIProcess. Notify the WebContent process
1302         about display updates by sending a message from the UIProcess on each screen update. This patch adds an extra
1303         IPC step when notifying the WebContent process about display updates. However, the MotionMark benchmark shows no
1304         performance regression when running it with this patch. A possible explanation for this is that the high priority
1305         display link thread is now running in the UIProcess instead of the WebContent process, which means there will be
1306         more available CPU resources for the WebContent process. A run loop observer is added to make sure that only one
1307         display callback (for each display observer) is executed in a single iteration of the run loop. This will make
1308         sure we are not filling the IPC message queue with unhandled display link messages.
1309
1310         No new tests, covered by existing tests. 
1311
1312         * platform/graphics/DisplayRefreshMonitor.h:
1313         (WebCore::DisplayRefreshMonitor::displayLinkFired):
1314         * platform/graphics/DisplayRefreshMonitorManager.cpp:
1315         (WebCore::DisplayRefreshMonitorManager::displayWasUpdated):
1316         * platform/graphics/DisplayRefreshMonitorManager.h:
1317         * platform/graphics/mac/DisplayRefreshMonitorMac.h:
1318
1319 2018-03-19  Megan Gardner  <megan_gardner@apple.com>
1320
1321         Ensure local appearance actually mirrors the app's appearance
1322         https://bugs.webkit.org/show_bug.cgi?id=183743
1323
1324         Reviewed by Tim Horton.
1325
1326         Not currently testable, will add tests in a later patch.
1327
1328         Current appearance isn't always accurate by default and needs to be set manually.
1329
1330         * platform/mac/LocalDefaultSystemAppearance.mm:
1331         (WebCore::LocalDefaultSystemAppearance::LocalDefaultSystemAppearance):
1332
1333 2018-03-19  Zan Dobersek  <zdobersek@igalia.com>
1334
1335         Unreviewed GCC 4.9 build-fix after r229672.
1336
1337         * platform/graphics/nicosia/cairo/NicosiaCairoOperationRecorder.cpp:
1338         (Nicosia::createCommand): Don't depend on implicit conversion of the
1339         returning std::unique_ptr<> object, and instead only wrap the
1340         heap-allocated PaintingOperation-derived in a std::unique_ptr<> at the
1341         point of return.
1342
1343 2018-03-18  Commit Queue  <commit-queue@webkit.org>
1344
1345         Unreviewed, rolling out r229689.
1346         https://bugs.webkit.org/show_bug.cgi?id=183735
1347
1348         Causes fast/loader/inner-iframe-loads-data-url-into-parent-on-
1349         unload-crash.html to fail with async delegates (Requested by
1350         cdumez_ on #webkit).
1351
1352         Reverted changeset:
1353
1354         "WebKit.WebsitePoliciesAutoplayQuirks API test times out with
1355         async policy delegates"
1356         https://bugs.webkit.org/show_bug.cgi?id=183702
1357         https://trac.webkit.org/changeset/229689
1358
1359 2018-03-17  Tim Horton  <timothy_horton@apple.com>
1360
1361         Correct redefined fnfErr type
1362         https://bugs.webkit.org/show_bug.cgi?id=183728
1363         <rdar://problem/38590063>
1364
1365         Reviewed by Dan Bernstein.
1366
1367         * platform/network/cf/FormDataStreamCFNet.cpp:
1368         CFStreamError's error parameter takes a SInt32, not an int.
1369         Make sure our redefinition has a compatible type.
1370
1371 2018-03-17  Jiewen Tan  <jiewen_tan@apple.com>
1372
1373         [WebAuthN] Implement authenticatorMakeCredential
1374         https://bugs.webkit.org/show_bug.cgi?id=183527
1375         <rdar://problem/35275886>
1376
1377         Reviewed by Brent Fulgham.
1378
1379         This patch does the following few things:
1380         1) It implements the authenticatorMakeCredential logic from the spec: https://www.w3.org/TR/webauthn/#op-make-cred.
1381         2) It tweaks enocding and deocding of PublicKeyCredentialCreationOptions between UIProccess and WebProcess.
1382         3) It soft links LocalAuthentication.Framework to WebCore, which was linked to WebKit.
1383         4) It creates SPI header for DeviceIdentity.Framework, and provides stubs to link it to WebCore.
1384
1385         Here is a detailed explanantion of 1):
1386         1. A helper class called LocalAuthenticator is crafted to represent Apple platform attached authenticator, i.e.
1387         the devices themselves. All operations are currently restricted to iOS at this moment as macOS lacks attestation
1388         support.
1389         2. To do testing, this helper class is then moved from WebKit to WebCore even though all operations can only happens
1390         in the UIProcess. We currently lack the ability to pretend a https environment in TestWebKitAPI which is required by
1391         the WebAuthN API, and thus it is moved to WebCore to perform unit tesing flavor API tests. This is not enough as it
1392         can't test message exchange between the UI and Web processes. We will address this in a subsequent patch.
1393         3. More on testing: The attestation process is abstracted into a protected method such that the testing enviroment can
1394         override it with self attestation as network access is restricted in the WebKit testing enviroment. Also, swizzlers of
1395         LocalAuthentication API are provided to override the behavoir of LAContext.
1396         4. More on testing: The actual Apple attestation can only happen in real device and with network access, therefore
1397         it can only be covered by manual tests at this moment.
1398         5. Back to LocalAuthenticator, it currently has two public methods:
1399                 5.1. makeCredential(): This method is the one does all the magic.
1400                 + It first checks some parameters.
1401                 + It then invokes LAContext to get user consent.
1402                 + It then talks to Apple Attestation Privacy CA to do attestations.
1403                 + It then stores necessary information into the Keychain.
1404                 + Finally it generates the attestation object.
1405                 5.2 isAvailable():
1406                 To check if a LocalAuthenticator is available or not.
1407         6. Even though files are of .mm format, they are written in a way that mixes NS, CF and C++ types. Here is the rule:
1408                 6.1 Use CF type only if it is requested by APIs.
1409                 6.2 Use NS type to manipulate all Objc objects.
1410                 6.3 Use C++ otherwise.
1411
1412         Covered by API tests.
1413
1414         * Configurations/WebCore.xcconfig:
1415         * Modules/credentialmanagement/CredentialsMessenger.cpp:
1416         (WebCore::getIdFromAttestationObject): Deleted.
1417         Decoding attestation object is tedious. UIProcess will instead return credential ID and attestation object
1418         at the same time. Therefore, this method is removed.
1419         * Modules/credentialmanagement/CredentialsMessenger.h:
1420         (WebCore::CreationReturnBundle::CreationReturnBundle): Deleted.
1421         (WebCore::AssertionReturnBundle::AssertionReturnBundle): Deleted.
1422         * Modules/webauthn/COSEConstants.h: Copied from Source/WebCore/Modules/webauthn/PublicKeyCredentialType.h.
1423         * Modules/webauthn/PublicKeyCredentialCreationOptions.h:
1424         (WebCore::PublicKeyCredentialCreationOptions::isolatedPartialCopyPtr const):
1425         (WebCore::PublicKeyCredentialCreationOptions::Parameters::encode const):
1426         (WebCore::PublicKeyCredentialCreationOptions::Parameters::decode):
1427         (WebCore::PublicKeyCredentialCreationOptions::encode const):
1428         (WebCore::PublicKeyCredentialCreationOptions::decode):
1429         * Modules/webauthn/PublicKeyCredentialDescriptor.h:
1430         (WebCore::PublicKeyCredentialDescriptor::encode const):
1431         (WebCore::PublicKeyCredentialDescriptor::decode):
1432         * Modules/webauthn/PublicKeyCredentialType.h:
1433         * Modules/webauthn/cocoa/LocalAuthenticator.h: Copied from Source/WebCore/Modules/webauthn/PublicKeyCredentialCreationOptions.h.
1434         * Modules/webauthn/cocoa/LocalAuthenticator.mm: Added.
1435         (WebCore::LocalAuthenticatorInternal::freePtrs):
1436         (WebCore::LocalAuthenticator::makeCredential const):
1437         (WebCore::LocalAuthenticator::isAvailable const):
1438         (WebCore::LocalAuthenticator::issueClientCertificate const):
1439         * SourcesCocoa.txt:
1440         * WebCore.xcodeproj/project.pbxproj:
1441         * platform/cocoa/LocalAuthenticationSoftLink.h: Copied from Source/WebCore/Modules/webauthn/PublicKeyCredentialType.h.
1442         * platform/cocoa/LocalAuthenticationSoftLink.mm: Added.
1443         * testing/MockCredentialsMessenger.cpp:
1444         (WebCore::MockCredentialsMessenger::setCreationReturnBundle):
1445         (WebCore::MockCredentialsMessenger::makeCredential):
1446         (WebCore::MockCredentialsMessenger::makeCredentialReply):
1447         (WebCore::MockCredentialsMessenger::setAttestationObject): Deleted.
1448         * testing/MockCredentialsMessenger.h:
1449         * testing/MockCredentialsMessenger.idl:
1450
1451 2018-03-16  Brent Fulgham  <bfulgham@apple.com>
1452
1453         Correct debug assertion in Range::borderAndTextRects
1454         https://bugs.webkit.org/show_bug.cgi?id=183710
1455         <rdar://problem/38466976>
1456
1457         Reviewed by Ryosuke Niwa.
1458
1459         A debug assertion will fire if Range::borderAndTextRects is asked to evaluate a set of selected elements, where one of the elements does not have a parent.
1460
1461         We should consider a nullptr parent as satisfying the condition of a parent not being present in the selection set.
1462
1463         Tests: fast/dom/range/range-selection-empty-body.html
1464
1465         * dom/Range.cpp:
1466         (WebCore::Range::borderAndTextRects const):
1467
1468 2018-03-15  Filip Pizlo  <fpizlo@apple.com>
1469
1470         Put the DOM in IsoHeaps
1471         https://bugs.webkit.org/show_bug.cgi?id=183546
1472
1473         Reviewed by Daniel Bates.
1474
1475         No new tests because no change in behavior.
1476         
1477         This puts all descendants of WebCore::Node in isoheaps, so that UAFs on the DOM cannot be
1478         used for RCE attacks. This probably also makes it harder to use UAFs for UXSS, since it means
1479         that DOM UAFs cannot be used for universal read gadgets.
1480         
1481         This looks neutral on Speedometer and membuster, though I did have one round of testing
1482         that led me to believe that membuster was regressed - I just wasn't able to reproduce that
1483         result on subsequent testing.
1484
1485         * Sources.txt:
1486         * WebCore.xcodeproj/project.pbxproj:
1487         * dom/Attr.cpp:
1488         * dom/Attr.h:
1489         * dom/CDATASection.cpp:
1490         * dom/CDATASection.h:
1491         * dom/CharacterData.cpp:
1492         * dom/CharacterData.h:
1493         * dom/Comment.cpp:
1494         * dom/Comment.h:
1495         * dom/ContainerNode.cpp:
1496         * dom/ContainerNode.h:
1497         * dom/Document.cpp:
1498         * dom/Document.h:
1499         * dom/DocumentFragment.cpp:
1500         * dom/DocumentFragment.h:
1501         * dom/DocumentType.cpp:
1502         * dom/DocumentType.h:
1503         * dom/Node.cpp:
1504         * dom/Node.h:
1505         * dom/ProcessingInstruction.cpp:
1506         * dom/ProcessingInstruction.h:
1507         * dom/PseudoElement.cpp:
1508         * dom/PseudoElement.h:
1509         * dom/ShadowRoot.cpp:
1510         * dom/ShadowRoot.h:
1511         * dom/StyledElement.cpp:
1512         * dom/StyledElement.h:
1513         * dom/TemplateContentDocumentFragment.cpp: Added.
1514         * dom/TemplateContentDocumentFragment.h:
1515         * dom/Text.cpp:
1516         * dom/Text.h:
1517         * dom/XMLDocument.cpp: Added.
1518         * dom/XMLDocument.h:
1519         * html/FTPDirectoryDocument.cpp:
1520         * html/FTPDirectoryDocument.h:
1521         * html/FileInputType.cpp:
1522         * html/HTMLAnchorElement.cpp:
1523         * html/HTMLAnchorElement.h:
1524         * html/HTMLAppletElement.cpp:
1525         * html/HTMLAppletElement.h:
1526         * html/HTMLAreaElement.cpp:
1527         * html/HTMLAreaElement.h:
1528         * html/HTMLAttachmentElement.cpp:
1529         * html/HTMLAttachmentElement.h:
1530         * html/HTMLBDIElement.cpp: Added.
1531         * html/HTMLBDIElement.h:
1532         * html/HTMLBRElement.cpp:
1533         * html/HTMLBRElement.h:
1534         * html/HTMLBaseElement.cpp:
1535         * html/HTMLBaseElement.h:
1536         * html/HTMLBodyElement.cpp:
1537         * html/HTMLBodyElement.h:
1538         * html/HTMLButtonElement.cpp:
1539         * html/HTMLButtonElement.h:
1540         * html/HTMLCanvasElement.cpp:
1541         * html/HTMLCanvasElement.h:
1542         * html/HTMLDListElement.cpp:
1543         * html/HTMLDListElement.h:
1544         * html/HTMLDataElement.cpp:
1545         * html/HTMLDataElement.h:
1546         * html/HTMLDataListElement.cpp:
1547         * html/HTMLDataListElement.h:
1548         * html/HTMLDetailsElement.cpp:
1549         * html/HTMLDetailsElement.h:
1550         * html/HTMLDirectoryElement.cpp:
1551         * html/HTMLDirectoryElement.h:
1552         * html/HTMLDivElement.cpp:
1553         * html/HTMLDivElement.h:
1554         * html/HTMLDocument.cpp:
1555         * html/HTMLDocument.h:
1556         * html/HTMLElement.cpp:
1557         * html/HTMLElement.h:
1558         * html/HTMLEmbedElement.cpp:
1559         * html/HTMLEmbedElement.h:
1560         * html/HTMLFieldSetElement.cpp:
1561         * html/HTMLFieldSetElement.h:
1562         * html/HTMLFontElement.cpp:
1563         * html/HTMLFontElement.h:
1564         * html/HTMLFormControlElement.cpp:
1565         * html/HTMLFormControlElement.h:
1566         * html/HTMLFormControlElementWithState.cpp:
1567         * html/HTMLFormControlElementWithState.h:
1568         * html/HTMLFormElement.cpp:
1569         * html/HTMLFormElement.h:
1570         * html/HTMLFrameElement.cpp:
1571         * html/HTMLFrameElement.h:
1572         * html/HTMLFrameElementBase.cpp:
1573         * html/HTMLFrameElementBase.h:
1574         * html/HTMLFrameOwnerElement.cpp:
1575         * html/HTMLFrameOwnerElement.h:
1576         * html/HTMLFrameSetElement.cpp:
1577         * html/HTMLFrameSetElement.h:
1578         * html/HTMLHRElement.cpp:
1579         * html/HTMLHRElement.h:
1580         * html/HTMLHeadElement.cpp:
1581         * html/HTMLHeadElement.h:
1582         * html/HTMLHeadingElement.cpp:
1583         * html/HTMLHeadingElement.h:
1584         * html/HTMLHtmlElement.cpp:
1585         * html/HTMLHtmlElement.h:
1586         * html/HTMLIFrameElement.cpp:
1587         * html/HTMLIFrameElement.h:
1588         * html/HTMLImageElement.cpp:
1589         * html/HTMLImageElement.h:
1590         * html/HTMLInputElement.cpp:
1591         * html/HTMLInputElement.h:
1592         * html/HTMLKeygenElement.cpp:
1593         * html/HTMLKeygenElement.h:
1594         * html/HTMLLIElement.cpp:
1595         * html/HTMLLIElement.h:
1596         * html/HTMLLabelElement.cpp:
1597         * html/HTMLLabelElement.h:
1598         * html/HTMLLegendElement.cpp:
1599         * html/HTMLLegendElement.h:
1600         * html/HTMLLinkElement.cpp:
1601         * html/HTMLLinkElement.h:
1602         * html/HTMLMapElement.cpp:
1603         * html/HTMLMapElement.h:
1604         * html/HTMLMarqueeElement.cpp:
1605         * html/HTMLMarqueeElement.h:
1606         * html/HTMLMenuElement.cpp:
1607         * html/HTMLMenuElement.h:
1608         * html/HTMLMenuItemElement.cpp:
1609         * html/HTMLMenuItemElement.h:
1610         * html/HTMLMetaElement.cpp:
1611         * html/HTMLMetaElement.h:
1612         * html/HTMLMeterElement.cpp:
1613         * html/HTMLMeterElement.h:
1614         * html/HTMLModElement.cpp:
1615         * html/HTMLModElement.h:
1616         * html/HTMLOListElement.cpp:
1617         * html/HTMLOListElement.h:
1618         * html/HTMLObjectElement.cpp:
1619         * html/HTMLObjectElement.h:
1620         * html/HTMLOptGroupElement.cpp:
1621         * html/HTMLOptGroupElement.h:
1622         * html/HTMLOptionElement.cpp:
1623         * html/HTMLOptionElement.h:
1624         * html/HTMLOutputElement.cpp:
1625         * html/HTMLOutputElement.h:
1626         * html/HTMLParagraphElement.cpp:
1627         * html/HTMLParagraphElement.h:
1628         * html/HTMLParamElement.cpp:
1629         * html/HTMLParamElement.h:
1630         * html/HTMLPictureElement.cpp:
1631         * html/HTMLPictureElement.h:
1632         * html/HTMLPlugInElement.cpp:
1633         * html/HTMLPlugInElement.h:
1634         * html/HTMLPlugInImageElement.cpp:
1635         * html/HTMLPlugInImageElement.h:
1636         * html/HTMLPreElement.cpp:
1637         * html/HTMLPreElement.h:
1638         * html/HTMLProgressElement.cpp:
1639         * html/HTMLProgressElement.h:
1640         * html/HTMLQuoteElement.cpp:
1641         * html/HTMLQuoteElement.h:
1642         * html/HTMLScriptElement.cpp:
1643         * html/HTMLScriptElement.h:
1644         * html/HTMLSelectElement.cpp:
1645         * html/HTMLSelectElement.h:
1646         * html/HTMLSlotElement.cpp:
1647         * html/HTMLSlotElement.h:
1648         * html/HTMLSourceElement.cpp:
1649         * html/HTMLSourceElement.h:
1650         * html/HTMLSpanElement.cpp:
1651         * html/HTMLSpanElement.h:
1652         * html/HTMLStyleElement.cpp:
1653         * html/HTMLStyleElement.h:
1654         * html/HTMLSummaryElement.cpp:
1655         * html/HTMLSummaryElement.h:
1656         * html/HTMLTableCaptionElement.cpp:
1657         * html/HTMLTableCaptionElement.h:
1658         * html/HTMLTableCellElement.cpp:
1659         * html/HTMLTableCellElement.h:
1660         * html/HTMLTableColElement.cpp:
1661         * html/HTMLTableColElement.h:
1662         * html/HTMLTableElement.cpp:
1663         * html/HTMLTableElement.h:
1664         * html/HTMLTablePartElement.cpp:
1665         * html/HTMLTablePartElement.h:
1666         * html/HTMLTableRowElement.cpp:
1667         * html/HTMLTableRowElement.h:
1668         * html/HTMLTableSectionElement.cpp:
1669         * html/HTMLTableSectionElement.h:
1670         * html/HTMLTemplateElement.cpp:
1671         * html/HTMLTemplateElement.h:
1672         * html/HTMLTextAreaElement.cpp:
1673         * html/HTMLTextAreaElement.h:
1674         * html/HTMLTextFormControlElement.cpp:
1675         * html/HTMLTextFormControlElement.h:
1676         * html/HTMLTimeElement.cpp:
1677         * html/HTMLTimeElement.h:
1678         * html/HTMLTitleElement.cpp:
1679         * html/HTMLTitleElement.h:
1680         * html/HTMLTrackElement.cpp:
1681         * html/HTMLTrackElement.h:
1682         * html/HTMLUListElement.cpp:
1683         * html/HTMLUListElement.h:
1684         * html/HTMLUnknownElement.cpp: Added.
1685         * html/HTMLUnknownElement.h:
1686         * html/HTMLWBRElement.cpp:
1687         * html/HTMLWBRElement.h:
1688         * html/ImageDocument.cpp:
1689         * html/ImageDocument.h:
1690         * html/LabelableElement.cpp:
1691         * html/LabelableElement.h:
1692         * html/MediaController.cpp:
1693         (MediaController::create): Deleted.
1694         (MediaController::MediaController): Deleted.
1695         (MediaController::addMediaElement): Deleted.
1696         (MediaController::removeMediaElement): Deleted.
1697         (MediaController::containsMediaElement const): Deleted.
1698         (MediaController::buffered const): Deleted.
1699         (MediaController::seekable const): Deleted.
1700         (MediaController::played): Deleted.
1701         (MediaController::duration const): Deleted.
1702         (MediaController::currentTime const): Deleted.
1703         (MediaController::setCurrentTime): Deleted.
1704         (MediaController::unpause): Deleted.
1705         (MediaController::play): Deleted.
1706         (MediaController::pause): Deleted.
1707         (MediaController::setDefaultPlaybackRate): Deleted.
1708         (MediaController::playbackRate const): Deleted.
1709         (MediaController::setPlaybackRate): Deleted.
1710         (MediaController::setVolume): Deleted.
1711         (MediaController::setMuted): Deleted.
1712         (playbackStateWaiting): Deleted.
1713         (playbackStatePlaying): Deleted.
1714         (playbackStateEnded): Deleted.
1715         (MediaController::playbackState const): Deleted.
1716         (MediaController::reportControllerState): Deleted.
1717         (eventNameForReadyState): Deleted.
1718         (MediaController::updateReadyState): Deleted.
1719         (MediaController::updatePlaybackState): Deleted.
1720         (MediaController::updateMediaElements): Deleted.
1721         (MediaController::bringElementUpToSpeed): Deleted.
1722         (MediaController::isBlocked const): Deleted.
1723         (MediaController::hasEnded const): Deleted.
1724         (MediaController::scheduleEvent): Deleted.
1725         (MediaController::asyncEventTimerFired): Deleted.
1726         (MediaController::clearPositionTimerFired): Deleted.
1727         (MediaController::hasAudio const): Deleted.
1728         (MediaController::hasVideo const): Deleted.
1729         (MediaController::hasClosedCaptions const): Deleted.
1730         (MediaController::setClosedCaptionsVisible): Deleted.
1731         (MediaController::supportsScanning const): Deleted.
1732         (MediaController::beginScrubbing): Deleted.
1733         (MediaController::endScrubbing): Deleted.
1734         (MediaController::beginScanning): Deleted.
1735         (MediaController::endScanning): Deleted.
1736         (MediaController::canPlay const): Deleted.
1737         (MediaController::isLiveStream const): Deleted.
1738         (MediaController::hasCurrentSrc const): Deleted.
1739         (MediaController::returnToRealtime): Deleted.
1740         (MediaController::startTimeupdateTimer): Deleted.
1741         (MediaController::scheduleTimeupdateEvent): Deleted.
1742         * html/MediaDocument.cpp:
1743         * html/MediaDocument.h:
1744         * html/PluginDocument.cpp:
1745         * html/PluginDocument.h:
1746         * html/RubyElement.cpp:
1747         * html/RubyElement.h:
1748         * html/RubyTextElement.cpp:
1749         * html/RubyTextElement.h:
1750         * html/TextDocument.cpp:
1751         * html/TextDocument.h:
1752         * html/shadow/AutoFillButtonElement.cpp:
1753         * html/shadow/AutoFillButtonElement.h:
1754         * html/shadow/DetailsMarkerControl.cpp:
1755         * html/shadow/DetailsMarkerControl.h:
1756         * html/shadow/ImageControlsRootElement.cpp:
1757         * html/shadow/ImageControlsRootElement.h:
1758         * html/shadow/MediaControlElementTypes.cpp:
1759         * html/shadow/MediaControlElementTypes.h:
1760         * html/shadow/MediaControlElements.cpp:
1761         * html/shadow/MediaControlElements.h:
1762         * html/shadow/MediaControls.cpp:
1763         * html/shadow/MediaControls.h:
1764         * html/shadow/ProgressShadowElement.cpp:
1765         * html/shadow/ProgressShadowElement.h:
1766         * html/shadow/SliderThumbElement.cpp:
1767         * html/shadow/SliderThumbElement.h:
1768         * html/shadow/SpinButtonElement.cpp:
1769         * html/shadow/SpinButtonElement.h:
1770         * html/shadow/TextControlInnerElements.cpp:
1771         * html/shadow/TextControlInnerElements.h:
1772         * html/shadow/YouTubeEmbedShadowElement.cpp:
1773         * html/shadow/YouTubeEmbedShadowElement.h:
1774         * html/shadow/mac/ImageControlsButtonElementMac.cpp:
1775         * html/shadow/mac/ImageControlsButtonElementMac.h:
1776         * html/shadow/mac/ImageControlsRootElementMac.cpp:
1777         * html/shadow/mac/ImageControlsRootElementMac.h:
1778         * html/track/TextTrackCueGeneric.cpp:
1779         * html/track/VTTCue.cpp:
1780         * html/track/VTTCue.h:
1781         * html/track/WebVTTElement.cpp:
1782         * html/track/WebVTTElement.h:
1783         * loader/SinkDocument.cpp:
1784         * loader/SinkDocument.h:
1785         * mathml/MathMLAnnotationElement.cpp:
1786         * mathml/MathMLAnnotationElement.h:
1787         * mathml/MathMLElement.cpp:
1788         * mathml/MathMLElement.h:
1789         * mathml/MathMLFractionElement.cpp:
1790         * mathml/MathMLFractionElement.h:
1791         * mathml/MathMLMathElement.cpp:
1792         * mathml/MathMLMathElement.h:
1793         * mathml/MathMLMencloseElement.cpp:
1794         * mathml/MathMLMencloseElement.h:
1795         * mathml/MathMLOperatorElement.cpp:
1796         * mathml/MathMLOperatorElement.h:
1797         * mathml/MathMLPaddedElement.cpp:
1798         * mathml/MathMLPaddedElement.h:
1799         * mathml/MathMLPresentationElement.cpp:
1800         * mathml/MathMLPresentationElement.h:
1801         * mathml/MathMLRootElement.cpp:
1802         * mathml/MathMLRootElement.h:
1803         * mathml/MathMLRowElement.cpp:
1804         * mathml/MathMLRowElement.h:
1805         * mathml/MathMLScriptsElement.cpp:
1806         * mathml/MathMLScriptsElement.h:
1807         * mathml/MathMLSelectElement.cpp:
1808         * mathml/MathMLSelectElement.h:
1809         * mathml/MathMLSpaceElement.cpp:
1810         * mathml/MathMLSpaceElement.h:
1811         * mathml/MathMLTokenElement.cpp:
1812         * mathml/MathMLTokenElement.h:
1813         * mathml/MathMLUnderOverElement.cpp:
1814         * mathml/MathMLUnderOverElement.h:
1815         * mathml/MathMLUnknownElement.cpp: Added.
1816         * mathml/MathMLUnknownElement.h:
1817         * svg/SVGAElement.cpp:
1818         * svg/SVGAElement.h:
1819         * svg/SVGAltGlyphDefElement.cpp:
1820         * svg/SVGAltGlyphDefElement.h:
1821         * svg/SVGAltGlyphElement.cpp:
1822         * svg/SVGAltGlyphElement.h:
1823         * svg/SVGAltGlyphItemElement.cpp:
1824         * svg/SVGAltGlyphItemElement.h:
1825         * svg/SVGAnimateColorElement.cpp:
1826         * svg/SVGAnimateColorElement.h:
1827         * svg/SVGAnimateElement.cpp:
1828         * svg/SVGAnimateElement.h:
1829         * svg/SVGAnimateElementBase.cpp:
1830         * svg/SVGAnimateElementBase.h:
1831         * svg/SVGAnimateMotionElement.cpp:
1832         * svg/SVGAnimateMotionElement.h:
1833         * svg/SVGAnimateTransformElement.cpp:
1834         * svg/SVGAnimateTransformElement.h:
1835         * svg/SVGAnimationElement.cpp:
1836         * svg/SVGAnimationElement.h:
1837         * svg/SVGCircleElement.cpp:
1838         * svg/SVGCircleElement.h:
1839         * svg/SVGClipPathElement.cpp:
1840         * svg/SVGClipPathElement.h:
1841         * svg/SVGComponentTransferFunctionElement.cpp:
1842         * svg/SVGComponentTransferFunctionElement.h:
1843         * svg/SVGCursorElement.cpp:
1844         * svg/SVGCursorElement.h:
1845         * svg/SVGDefsElement.cpp:
1846         * svg/SVGDefsElement.h:
1847         * svg/SVGDescElement.cpp:
1848         * svg/SVGDescElement.h:
1849         * svg/SVGDocument.cpp:
1850         * svg/SVGDocument.h:
1851         * svg/SVGElement.cpp:
1852         * svg/SVGElement.h:
1853         * svg/SVGEllipseElement.cpp:
1854         * svg/SVGEllipseElement.h:
1855         * svg/SVGFEBlendElement.cpp:
1856         * svg/SVGFEBlendElement.h:
1857         * svg/SVGFEColorMatrixElement.cpp:
1858         * svg/SVGFEColorMatrixElement.h:
1859         * svg/SVGFEComponentTransferElement.cpp:
1860         * svg/SVGFEComponentTransferElement.h:
1861         * svg/SVGFECompositeElement.cpp:
1862         * svg/SVGFECompositeElement.h:
1863         * svg/SVGFEConvolveMatrixElement.cpp:
1864         * svg/SVGFEConvolveMatrixElement.h:
1865         * svg/SVGFEDiffuseLightingElement.cpp:
1866         * svg/SVGFEDiffuseLightingElement.h:
1867         * svg/SVGFEDisplacementMapElement.cpp:
1868         * svg/SVGFEDisplacementMapElement.h:
1869         * svg/SVGFEDropShadowElement.cpp:
1870         * svg/SVGFEDropShadowElement.h:
1871         * svg/SVGFEFloodElement.cpp:
1872         * svg/SVGFEFloodElement.h:
1873         * svg/SVGFEGaussianBlurElement.cpp:
1874         * svg/SVGFEGaussianBlurElement.h:
1875         * svg/SVGFEImageElement.cpp:
1876         * svg/SVGFEImageElement.h:
1877         * svg/SVGFELightElement.cpp:
1878         * svg/SVGFELightElement.h:
1879         * svg/SVGFEMergeElement.cpp:
1880         * svg/SVGFEMergeElement.h:
1881         * svg/SVGFEMergeNodeElement.cpp:
1882         * svg/SVGFEMergeNodeElement.h:
1883         * svg/SVGFEMorphologyElement.cpp:
1884         * svg/SVGFEMorphologyElement.h:
1885         * svg/SVGFEOffsetElement.cpp:
1886         * svg/SVGFEOffsetElement.h:
1887         * svg/SVGFESpecularLightingElement.cpp:
1888         * svg/SVGFESpecularLightingElement.h:
1889         * svg/SVGFETileElement.cpp:
1890         * svg/SVGFETileElement.h:
1891         * svg/SVGFETurbulenceElement.cpp:
1892         * svg/SVGFETurbulenceElement.h:
1893         * svg/SVGFilterElement.cpp:
1894         * svg/SVGFilterElement.h:
1895         * svg/SVGFilterPrimitiveStandardAttributes.cpp:
1896         * svg/SVGFilterPrimitiveStandardAttributes.h:
1897         * svg/SVGFontFaceElement.cpp:
1898         * svg/SVGFontFaceElement.h:
1899         * svg/SVGFontFaceFormatElement.cpp:
1900         * svg/SVGFontFaceFormatElement.h:
1901         * svg/SVGFontFaceNameElement.cpp:
1902         * svg/SVGFontFaceNameElement.h:
1903         * svg/SVGFontFaceSrcElement.cpp:
1904         * svg/SVGFontFaceSrcElement.h:
1905         * svg/SVGFontFaceUriElement.cpp:
1906         * svg/SVGFontFaceUriElement.h:
1907         * svg/SVGForeignObjectElement.cpp:
1908         * svg/SVGForeignObjectElement.h:
1909         * svg/SVGGElement.cpp:
1910         * svg/SVGGElement.h:
1911         * svg/SVGGlyphElement.cpp:
1912         * svg/SVGGlyphElement.h:
1913         * svg/SVGGlyphRefElement.cpp:
1914         * svg/SVGGlyphRefElement.h:
1915         * svg/SVGGradientElement.cpp:
1916         * svg/SVGGradientElement.h:
1917         * svg/SVGGraphicsElement.cpp:
1918         * svg/SVGGraphicsElement.h:
1919         * svg/SVGHKernElement.cpp:
1920         * svg/SVGHKernElement.h:
1921         * svg/SVGImageElement.cpp:
1922         * svg/SVGImageElement.h:
1923         * svg/SVGLineElement.cpp:
1924         * svg/SVGLineElement.h:
1925         * svg/SVGLinearGradientElement.cpp:
1926         * svg/SVGLinearGradientElement.h:
1927         * svg/SVGMPathElement.cpp:
1928         * svg/SVGMPathElement.h:
1929         * svg/SVGMarkerElement.cpp:
1930         * svg/SVGMarkerElement.h:
1931         * svg/SVGMaskElement.cpp:
1932         * svg/SVGMaskElement.h:
1933         * svg/SVGMetadataElement.cpp:
1934         * svg/SVGMetadataElement.h:
1935         * svg/SVGMissingGlyphElement.cpp:
1936         * svg/SVGMissingGlyphElement.h:
1937         * svg/SVGPathElement.cpp:
1938         * svg/SVGPathElement.h:
1939         * svg/SVGPatternElement.cpp:
1940         * svg/SVGPatternElement.h:
1941         * svg/SVGPolyElement.cpp:
1942         * svg/SVGPolyElement.h:
1943         * svg/SVGPolygonElement.cpp:
1944         * svg/SVGPolygonElement.h:
1945         * svg/SVGPolylineElement.cpp:
1946         * svg/SVGPolylineElement.h:
1947         * svg/SVGRadialGradientElement.cpp:
1948         * svg/SVGRadialGradientElement.h:
1949         * svg/SVGRectElement.cpp:
1950         * svg/SVGRectElement.h:
1951         * svg/SVGSVGElement.cpp:
1952         * svg/SVGSVGElement.h:
1953         * svg/SVGScriptElement.cpp:
1954         * svg/SVGScriptElement.h:
1955         * svg/SVGSetElement.cpp:
1956         * svg/SVGSetElement.h:
1957         * svg/SVGStopElement.cpp:
1958         * svg/SVGStopElement.h:
1959         * svg/SVGStyleElement.cpp:
1960         * svg/SVGStyleElement.h:
1961         * svg/SVGSwitchElement.cpp:
1962         * svg/SVGSwitchElement.h:
1963         * svg/SVGSymbolElement.cpp:
1964         * svg/SVGSymbolElement.h:
1965         * svg/SVGTRefElement.cpp:
1966         * svg/SVGTRefElement.h:
1967         * svg/SVGTSpanElement.cpp:
1968         * svg/SVGTSpanElement.h:
1969         * svg/SVGTextContentElement.cpp:
1970         * svg/SVGTextContentElement.h:
1971         * svg/SVGTextElement.cpp:
1972         * svg/SVGTextElement.h:
1973         * svg/SVGTextPathElement.cpp:
1974         * svg/SVGTextPathElement.h:
1975         * svg/SVGTextPositioningElement.cpp:
1976         * svg/SVGTextPositioningElement.h:
1977         * svg/SVGTitleElement.cpp:
1978         * svg/SVGTitleElement.h:
1979         * svg/SVGUnknownElement.cpp: Added.
1980         * svg/SVGUnknownElement.h:
1981         * svg/SVGUseElement.cpp:
1982         * svg/SVGUseElement.h:
1983         * svg/SVGVKernElement.cpp:
1984         * svg/SVGVKernElement.h:
1985         * svg/SVGViewElement.cpp:
1986         * svg/SVGViewElement.h:
1987         * svg/animation/SVGSMILElement.cpp:
1988         * svg/animation/SVGSMILElement.h:
1989
1990 2018-03-16  Youenn Fablet  <youenn@apple.com>
1991
1992         Ensure Document::responseReceived and clearResource are called on the main thread
1993         https://bugs.webkit.org/show_bug.cgi?id=183709
1994
1995         Reviewed by Chris Dumez.
1996
1997         No change of behavior.
1998
1999         * loader/DocumentLoader.cpp:
2000         (WebCore::DocumentLoader::responseReceived):
2001         (WebCore::DocumentLoader::clearMainResource):
2002
2003 2018-03-16  Chris Dumez  <cdumez@apple.com>
2004
2005         WebKit.WebsitePoliciesAutoplayQuirks API test times out with async policy delegates
2006         https://bugs.webkit.org/show_bug.cgi?id=183702
2007
2008         Reviewed by Alex Christensen.
2009
2010         The issue is that the test calls loadHTMLString then loadRequest right after, without
2011         waiting for the first load to complete first. loadHTMLString is special as it relies
2012         on substitute data and which schedules a timer to commit the data. When doing the
2013         navigation policy check for the following loadRequest(), the substitute data timer
2014         would fire and commit its data and load. This would in turn cancel the pending
2015         navigation policy check for the loadRequest().
2016
2017         With sync policy delegates, this is not an issue because we take care of stopping
2018         all loaders when receiving the policy decision, which happens synchronously. However,
2019         when the policy decision happens asynchronously, the pending substitute data load
2020         does not get cancelled in time and it gets committed.
2021
2022         To address the issue, this patch updates loadWithDocumentLoader() to cancel any
2023         provisional load when there is an asynchronous navigation policy decision pending.
2024
2025         Change covered by new API test.
2026
2027         * loader/FrameLoader.cpp:
2028         (WebCore::FrameLoader::loadWithDocumentLoader):
2029
2030 2018-03-16  Brent Fulgham  <bfulgham@apple.com>
2031
2032         Set a trap to catch an infrequent form-related nullptr crash
2033         https://bugs.webkit.org/show_bug.cgi?id=183704
2034         <rdar://problem/37579354>
2035
2036         Reviewed by Ryosuke Niwa.
2037
2038         Make FormState a FrameDestructionObserver. We expect all relevant FormState objects to have been
2039         cleaned up prior to the frame being destroyed. If we find such a case, we'd like to see the
2040         stack trace to see what's going on.
2041
2042         * loader/FormState.cpp:
2043         (WebCore::FormState::FormState):
2044         (WebCore::FormState::willDetachPage): RELEASE_ASSERT_NOT_REACHED if we ever get here.
2045         * loader/FormState.h:
2046
2047 2018-03-16  Joanmarie Diggs  <jdiggs@igalia.com>
2048
2049         AX: AccessibilityNodeObject::textForLabelElement() doesn't follow AccName calculation rules
2050         https://bugs.webkit.org/show_bug.cgi?id=183661
2051
2052         Reviewed by Chris Fleizach.
2053
2054         Have AccessibilityNodeObject::textForLabelElement() return the value from
2055         accessibleNameForNode() instead of innerText(). The former falls back on
2056         the latter if there is no author-provided accessible name.
2057
2058         Tests: accessibility/aria-label-on-label-element.html
2059                accessibility/label-with-pseudo-elements.html
2060
2061         * accessibility/AccessibilityNodeObject.cpp:
2062         (WebCore::AccessibilityNodeObject::textForLabelElement const):
2063         (WebCore::AccessibilityNodeObject::titleElementText const):
2064
2065 2018-03-16  Basuke Suzuki  <Basuke.Suzuki@sony.com>
2066
2067         [Curl] Fix crash on websocket with bad handshake message.
2068         https://bugs.webkit.org/show_bug.cgi?id=183686
2069
2070         Reviewed by Youenn Fablet.
2071
2072         The closing cleanup was called multiple times. Add flag to detect
2073         it is already closed or not.
2074
2075         No new tests because it is covered by existing test:
2076         - LayoutTests/http/tests/websocket/tests/hybi/bad-handshake-crash.html
2077
2078         * platform/network/curl/SocketStreamHandleImpl.h:
2079         * platform/network/curl/SocketStreamHandleImplCurl.cpp:
2080         (WebCore::SocketStreamHandleImpl::platformClose):
2081         (WebCore::SocketStreamHandleImpl::didReceiveData):
2082
2083 2018-03-16  Jer Noble  <jer.noble@apple.com>
2084
2085         Make Fullscreen API an Experimental Feature
2086         https://bugs.webkit.org/show_bug.cgi?id=183662
2087
2088         Reviewed by Jon Lee.
2089
2090         The Fullscreen APIs should be guarded by a Setting, so they are not present in the DOM when the
2091         Experimental Feature is disabled.
2092
2093         * dom/Document.idl:
2094         * dom/Element.idl:
2095
2096 2018-03-16  Megan Gardner  <megan_gardner@apple.com>
2097
2098         Ensure that style is updated when the effective appearance changes
2099         https://bugs.webkit.org/show_bug.cgi?id=183690
2100         <rdar://problem/38385900>
2101
2102         Reviewed by Tim Horton and Wenson Hsieh.
2103
2104         Only exposing a function to outside WebCore, no tests needed.
2105
2106         * page/Page.h:
2107
2108 2018-03-16  Chris Dumez  <cdumez@apple.com>
2109
2110         WebKit.RestoreSessionStateContainingScrollRestorationDefault API test is failing with async policy delegates
2111         https://bugs.webkit.org/show_bug.cgi?id=183679
2112
2113         Reviewed by Alex Christensen.
2114
2115         Update CachedRawResource::didAddClient() to not send data until we've received
2116         the policy decision for the response.
2117
2118         No new tests, covered by new API test.
2119
2120         * loader/DocumentLoader.cpp:
2121         (WebCore::DocumentLoader::handleSubstituteDataLoadNow):
2122         (WebCore::DocumentLoader::responseReceived):
2123         * loader/DocumentLoader.h:
2124         * loader/DocumentThreadableLoader.cpp:
2125         (WebCore::DocumentThreadableLoader::responseReceived):
2126         * loader/DocumentThreadableLoader.h:
2127         * loader/MediaResourceLoader.cpp:
2128         (WebCore::MediaResource::responseReceived):
2129         * loader/MediaResourceLoader.h:
2130         * loader/appcache/ApplicationCacheResourceLoader.cpp:
2131         (WebCore::ApplicationCacheResourceLoader::responseReceived):
2132         * loader/appcache/ApplicationCacheResourceLoader.h:
2133         * loader/cache/CachedRawResource.cpp:
2134         (WebCore::CachedRawResource::didAddClient):
2135         (WebCore::CachedRawResource::responseReceived):
2136         * loader/cache/CachedRawResourceClient.h:
2137         (WebCore::CachedRawResourceClient::responseReceived):
2138         * loader/cache/KeepaliveRequestTracker.cpp:
2139         (WebCore::KeepaliveRequestTracker::responseReceived):
2140         * loader/cache/KeepaliveRequestTracker.h:
2141         * platform/graphics/avfoundation/objc/WebCoreAVFResourceLoader.h:
2142         * platform/graphics/avfoundation/objc/WebCoreAVFResourceLoader.mm:
2143         (WebCore::WebCoreAVFResourceLoader::responseReceived):
2144
2145 2018-03-16  Youenn Fablet  <youenn@apple.com>
2146
2147         Name Service Worker threads differently from regular Worker threads
2148         https://bugs.webkit.org/show_bug.cgi?id=183698
2149
2150         Reviewed by Chris Dumez.
2151
2152         No observable change of behavior.
2153         For debugging purposes, knowing that a thread is a service worker thread might help give context.
2154         It might also identify on a crash log whether the process is a service worker process or a regular web process.
2155
2156         * workers/WorkerThread.cpp:
2157         (WebCore::WorkerThread::start):
2158         * workers/WorkerThread.h:
2159         (WebCore::WorkerThread::isServiceWorkerThread const):
2160         * workers/service/context/ServiceWorkerThread.h:
2161
2162 2018-03-16  Youenn Fablet  <youenn@apple.com>
2163
2164         IceCandidates leak on webrtc/datachannel/basic.html and other tests
2165         https://bugs.webkit.org/show_bug.cgi?id=183676
2166         <rdar://problem/36116228>
2167
2168         Reviewed by Eric Carlson.
2169
2170         Covered by manual testing using --leaks option on WK1.
2171         WebKit should not release the candidates since libwebrtc is not taking ownership.
2172
2173         * Modules/mediastream/libwebrtc/LibWebRTCPeerConnectionBackend.cpp:
2174         (WebCore::LibWebRTCPeerConnectionBackend::doSetLocalDescription):
2175         (WebCore::LibWebRTCPeerConnectionBackend::doSetRemoteDescription):
2176
2177 2018-03-16  Zan Dobersek  <zdobersek@igalia.com>
2178
2179         [Nicosia] Add Cairo-specific GraphicsContext operation recorder
2180         https://bugs.webkit.org/show_bug.cgi?id=183593
2181
2182         Reviewed by Carlos Garcia Campos.
2183
2184         Add Nicosia::CairoOperationRecorder, GraphicsContextImpl implementation
2185         that records all GraphicsContext operations for deferred replay on a
2186         different thread. Recording here mostly consists of storing all the
2187         Cairo resources in a thread-safe manner, which is eased by the atomic
2188         reference counting used in Cairo.
2189
2190         Nicosia::PaintingOperation derivatives are used for operations or state
2191         updates that require recording. Instances of these classes are appended
2192         to a Vector<> object that is then pushed into a thread pool in
2193         Nicosia::PaintingEngineThreaded , replaying all the operations against
2194         the Cairo context established from an associated target Nicosia::Buffer.
2195
2196         This GraphicsContextImpl implementation is now used in the
2197         PaintingContextCairo::ForRecording constructor to construct the
2198         GraphicsContext implementation that will be used for recording.
2199
2200         * platform/TextureMapper.cmake:
2201         * platform/graphics/nicosia/cairo/NicosiaCairoOperationRecorder.cpp: Added.
2202         (Nicosia::getContext):
2203         (Nicosia::OperationData::arg const const):
2204         (Nicosia::createCommand):
2205         (Nicosia::CairoOperationRecorder::CairoOperationRecorder):
2206         (Nicosia::m_commandList):
2207         (Nicosia::CairoOperationRecorder::updateState):
2208         (Nicosia::CairoOperationRecorder::clearShadow):
2209         (Nicosia::CairoOperationRecorder::setLineCap):
2210         (Nicosia::CairoOperationRecorder::setLineDash):
2211         (Nicosia::CairoOperationRecorder::setLineJoin):
2212         (Nicosia::CairoOperationRecorder::setMiterLimit):
2213         (Nicosia::CairoOperationRecorder::fillRect):
2214         (Nicosia::CairoOperationRecorder::fillRoundedRect):
2215         (Nicosia::CairoOperationRecorder::fillRectWithRoundedHole):
2216         (Nicosia::CairoOperationRecorder::fillPath):
2217         (Nicosia::CairoOperationRecorder::fillEllipse):
2218         (Nicosia::CairoOperationRecorder::strokeRect):
2219         (Nicosia::CairoOperationRecorder::strokePath):
2220         (Nicosia::CairoOperationRecorder::strokeEllipse):
2221         (Nicosia::CairoOperationRecorder::clearRect):
2222         (Nicosia::CairoOperationRecorder::drawGlyphs):
2223         (Nicosia::CairoOperationRecorder::drawImage):
2224         (Nicosia::CairoOperationRecorder::drawTiledImage):
2225         (Nicosia::CairoOperationRecorder::drawNativeImage):
2226         (Nicosia::CairoOperationRecorder::drawPattern):
2227         (Nicosia::CairoOperationRecorder::drawRect):
2228         (Nicosia::CairoOperationRecorder::drawLine):
2229         (Nicosia::CairoOperationRecorder::drawLinesForText):
2230         (Nicosia::CairoOperationRecorder::drawLineForDocumentMarker):
2231         (Nicosia::CairoOperationRecorder::drawEllipse):
2232         (Nicosia::CairoOperationRecorder::drawPath):
2233         (Nicosia::CairoOperationRecorder::drawFocusRing):
2234         (Nicosia::CairoOperationRecorder::save):
2235         (Nicosia::CairoOperationRecorder::restore):
2236         (Nicosia::CairoOperationRecorder::translate):
2237         (Nicosia::CairoOperationRecorder::rotate):
2238         (Nicosia::CairoOperationRecorder::scale):
2239         (Nicosia::CairoOperationRecorder::concatCTM):
2240         (Nicosia::CairoOperationRecorder::setCTM):
2241         (Nicosia::CairoOperationRecorder::getCTM):
2242         (Nicosia::CairoOperationRecorder::beginTransparencyLayer):
2243         (Nicosia::CairoOperationRecorder::endTransparencyLayer):
2244         (Nicosia::CairoOperationRecorder::clip):
2245         (Nicosia::CairoOperationRecorder::clipOut):
2246         (Nicosia::CairoOperationRecorder::clipPath):
2247         (Nicosia::CairoOperationRecorder::clipBounds):
2248         (Nicosia::CairoOperationRecorder::applyDeviceScaleFactor):
2249         (Nicosia::CairoOperationRecorder::roundToDevicePixels):
2250         (Nicosia::CairoOperationRecorder::append):
2251         * platform/graphics/nicosia/cairo/NicosiaCairoOperationRecorder.h: Added.
2252         * platform/graphics/nicosia/cairo/NicosiaPaintingContextCairo.cpp:
2253         (Nicosia::PaintingContextCairo::ForRecording::ForRecording):
2254
2255 2018-03-16  Zan Dobersek  <zdobersek@igalia.com>
2256
2257         [TexMap] Clean up TextureMapperLayer constructor
2258         https://bugs.webkit.org/show_bug.cgi?id=183634
2259
2260         Reviewed by Michael Catanzaro.
2261
2262         In the TextureMapperLayer header, only declare the constructor, and move
2263         all the previous member initialization to the point of declaration of
2264         these member variables.
2265
2266         In the TextureMapperLayer implementation file, the constructor and
2267         destructor are moved into proper order at the top of the file. The
2268         former is defaulted, and the latter remains unchanged.
2269
2270         No change in behavior.
2271
2272         * platform/graphics/texmap/TextureMapperLayer.cpp:
2273         (WebCore::TextureMapperLayer::~TextureMapperLayer):
2274         * platform/graphics/texmap/TextureMapperLayer.h:
2275
2276 2018-03-16  Miguel Gomez  <magomez@igalia.com>
2277
2278         [GTK] When using EGL, request an OpenGL core profile when possible
2279         https://bugs.webkit.org/show_bug.cgi?id=178719
2280
2281         Reviewed by Carlos Garcia Campos.
2282
2283         When using EGL and OpenGL, try to request a context with version >= 3.2 with a core profile
2284         whenever possible. In order to to this, we require EGL version 1.5 or version 1.4 with the
2285         extension EGL_KHR_create_context. If EGL requirements are not met, or we cannot get a
2286         context with version >= 3.2 then use whatever EGL gives us.
2287
2288         Covered by existent tests.
2289
2290         * platform/graphics/egl/GLContextEGL.cpp:
2291         (WebCore::GLContextEGL::createWindowContext):
2292         (WebCore::GLContextEGL::createPbufferContext):
2293         (WebCore::GLContextEGL::createSurfacelessContext):
2294         (WebCore::GLContextEGL::createContextForEGLVersion):
2295         * platform/graphics/egl/GLContextEGL.h:
2296         * platform/graphics/egl/GLContextEGLWPE.cpp:
2297         (WebCore::GLContextEGL::createWPEContext):
2298         * platform/graphics/egl/GLContextEGLWayland.cpp:
2299         (WebCore::GLContextEGL::createWaylandContext):
2300         * platform/graphics/egl/GLContextEGLX11.cpp:
2301         (WebCore::GLContextEGL::createPixmapContext):
2302
2303 2018-03-16  Zan Dobersek  <zdobersek@igalia.com>
2304
2305         [TexMap] Don't use the TextureMapperAnimation::Client interface to apply animation
2306         https://bugs.webkit.org/show_bug.cgi?id=183656
2307
2308         Reviewed by Carlos Garcia Campos.
2309
2310         Don't have the TextureMapperLayer class inherit from the
2311         TextureMapperAnimation::Client interface just for the purposes of
2312         synchronization of animation-affected attributes in syncAnimations().
2313         For that purpose it's enough to provide a struct that is passed to that
2314         method, and with the TextureMapperAnimation class filling out any of the
2315         animated attributes that need to be updated.
2316
2317         TextureMapperAnimation::ApplicationResult struct is introducted for that
2318         purpose. std::optional<> members in it are assigned values during the
2319         application process, if an appropriate animation affects them. The
2320         relevant member values in TextureMapperLayer are then updated, or value
2321         from the default state is used.
2322
2323         TextureMapperAnimation::Client is removed.
2324
2325         No new tests -- no change in behavior.
2326
2327         * platform/graphics/texmap/TextureMapperAnimation.cpp:
2328         (WebCore::TextureMapperAnimation::apply):
2329         (WebCore::TextureMapperAnimation::applyInternal):
2330         (WebCore::TextureMapperAnimations::apply):
2331         * platform/graphics/texmap/TextureMapperAnimation.h:
2332         * platform/graphics/texmap/TextureMapperLayer.cpp:
2333         (WebCore::TextureMapperLayer::syncAnimations):
2334         (WebCore::TextureMapperLayer::setAnimatedTransform): Deleted.
2335         (WebCore::TextureMapperLayer::setAnimatedOpacity): Deleted.
2336         (WebCore::TextureMapperLayer::setAnimatedFilters): Deleted.
2337         * platform/graphics/texmap/TextureMapperLayer.h:
2338
2339 2018-03-16  Devin Rousso  <webkit@devinrousso.com>
2340
2341         Web Inspector: Canvas Tab: main WebGL canvas on acko.net has no reported size
2342         https://bugs.webkit.org/show_bug.cgi?id=178798
2343         <rdar://problem/35175740>
2344
2345         Reviewed by Brian Burg.
2346
2347         When the main frame navigates, the DOMAgent would recieve two InspectorInstrumentation calls,
2348         one when the frame begins its navigation and the other when the document for that frame has
2349         loaded. Both of these would discard the DOMAgent's bindings, which included the map of
2350         `nodeId`s. This was an issue for canvases, as the frontend would be notified whenever any
2351         canvas is created, which would usually occur before the `DOMContentLoaded` event is fired.
2352         As a result, the canvases would attempt to retrieve their associated node, only to have the
2353         DOMAgent discard those bindings quickly thereafter.
2354
2355         This patch removes DOMAgent's and DOMDebuggerAgent's (parity) instrumentation hooks for the
2356         latter event, ensuring that the bindings are only discarded once.
2357
2358         * inspector/agents/InspectorDOMAgent.h:
2359         * inspector/agents/InspectorDOMAgent.cpp:
2360         (WebCore::InspectorDOMAgent::mainFrameDOMContentLoaded): Deleted.
2361
2362         * inspector/agents/InspectorDOMDebuggerAgent.h:
2363         * inspector/agents/InspectorDOMDebuggerAgent.cpp:
2364         (WebCore::InspectorDOMDebuggerAgent::frameDocumentUpdated): Added.
2365         (WebCore::InspectorDOMDebuggerAgent::mainFrameDOMContentLoaded): Deleted.
2366
2367         * inspector/InspectorInstrumentation.cpp:
2368         (WebCore::InspectorInstrumentation::domContentLoadedEventFiredImpl):
2369         (WebCore::InspectorInstrumentation::frameDocumentUpdatedImpl):
2370
2371 2018-03-15  Tim Horton  <timothy_horton@apple.com>
2372
2373         Include CADisplayLink explicitly where needed, instead of all of CA
2374         https://bugs.webkit.org/show_bug.cgi?id=183689
2375         <rdar://problem/38528719>
2376
2377         Reviewed by Wenson Hsieh.
2378
2379         * platform/graphics/ios/DisplayRefreshMonitorIOS.mm:
2380
2381 2018-03-15  Tim Horton  <timothy_horton@apple.com>
2382
2383         Include MobileCoreServices in the WebCore prefix header
2384         https://bugs.webkit.org/show_bug.cgi?id=183688
2385         <rdar://problem/38527621>
2386
2387         Reviewed by Dan Bernstein.
2388
2389         * WebCorePrefix.h:
2390
2391 2018-03-15  Megan Gardner  <megan_gardner@apple.com>
2392
2393         Create MediaQueryParserContext to provide additional context for the evaluation of media queries
2394         https://bugs.webkit.org/show_bug.cgi?id=183677
2395
2396         Reviewed by Tim Horton.
2397
2398         We need additional context for parsing media queries to make sure they are parsed correctly and valid.
2399
2400         Not currently testable, will add tests in a later patch.
2401
2402         * WebCore.xcodeproj/project.pbxproj:
2403         * css/MediaList.cpp:
2404         (WebCore::MediaQuerySet::create):
2405         (WebCore::MediaQuerySet::set):
2406         (WebCore::MediaQuerySet::add):
2407         (WebCore::MediaQuerySet::remove):
2408         * css/MediaList.h:
2409         * css/MediaQueryEvaluator.cpp:
2410         (WebCore::MediaQueryEvaluator::mediaAttributeMatches):
2411         * css/MediaQueryExpression.cpp:
2412         (WebCore::featureWithValidIdent):
2413         (WebCore::featureWithValidDensity):
2414         (WebCore::featureWithValidPositiveLength):
2415         (WebCore::featureWithPositiveInteger):
2416         (WebCore::featureWithPositiveNumber):
2417         (WebCore::featureWithZeroOrOne):
2418         (WebCore::isFeatureValidWithoutValue):
2419         (WebCore::MediaQueryExpression::MediaQueryExpression):
2420         * css/MediaQueryExpression.h:
2421         * css/MediaQueryMatcher.cpp:
2422         (WebCore::MediaQueryMatcher::matchMedia):
2423         * css/MediaQueryParserContext.cpp: Added.
2424         (WebCore::MediaQueryParserContext::MediaQueryParserContext):
2425         * css/MediaQueryParserContext.h: Added.
2426         (WebCore::MediaQueryParserContext::MediaQueryParserContext):
2427         * css/StyleMedia.cpp:
2428         (WebCore::StyleMedia::matchMedium const):
2429         * css/StyleRuleImport.cpp:
2430         (WebCore::StyleRuleImport::StyleRuleImport):
2431         (WebCore::StyleRuleImport::setCSSStyleSheet):
2432         * css/parser/CSSParser.cpp:
2433         (WebCore::CSSParserContext::CSSParserContext):
2434         (WebCore::operator==):
2435         * css/parser/CSSParserImpl.cpp:
2436         (WebCore::CSSParserImpl::consumeImportRule):
2437         (WebCore::CSSParserImpl::consumeMediaRule):
2438         * css/parser/MediaQueryParser.cpp:
2439         (WebCore::MediaQueryParser::parseMediaQuerySet):
2440         (WebCore::MediaQueryParser::parseMediaCondition):
2441         (WebCore::MediaQueryParser::MediaQueryParser):
2442         (WebCore::MediaQueryData::addExpression):
2443         * css/parser/MediaQueryParser.h:
2444         (WebCore::MediaQueryData::setMediaQueryParserContext):
2445         * css/parser/SizesAttributeParser.cpp:
2446         (WebCore::SizesAttributeParser::parse):
2447         * dom/DOMImplementation.cpp:
2448         (WebCore::DOMImplementation::createCSSStyleSheet):
2449         * dom/InlineStyleSheetOwner.cpp:
2450         (WebCore::InlineStyleSheetOwner::createSheet):
2451         * dom/ProcessingInstruction.cpp:
2452         (WebCore::ProcessingInstruction::setCSSStyleSheet):
2453         * html/HTMLImageElement.cpp:
2454         (WebCore::HTMLImageElement::bestFitSourceFromPictureElement):
2455         * html/HTMLLinkElement.cpp:
2456         (WebCore::HTMLLinkElement::process):
2457         (WebCore::HTMLLinkElement::initializeStyleSheet):
2458         (WebCore::HTMLLinkElement::setCSSStyleSheet):
2459         * html/HTMLLinkElement.h:
2460         * html/HTMLMediaElement.cpp:
2461         (WebCore::HTMLMediaElement::selectNextSourceChild):
2462         * html/HTMLSourceElement.cpp:
2463         (WebCore::HTMLSourceElement::parsedMediaAttribute const):
2464         * html/HTMLSourceElement.h:
2465         * html/HTMLStyleElement.cpp:
2466         (WebCore::HTMLStyleElement::parseAttribute):
2467         * html/parser/HTMLPreloadScanner.cpp:
2468         (WebCore::TokenPreloadScanner::StartTagScanner::processAttribute):
2469
2470 2018-03-15  Commit Queue  <commit-queue@webkit.org>
2471
2472         Unreviewed, rolling out r229639.
2473         https://bugs.webkit.org/show_bug.cgi?id=183683
2474
2475         it is causing a crash in API tests (Requested by youenn on
2476         #webkit).
2477
2478         Reverted changeset:
2479
2480         "ActiveDOMObject should assert that they are destroyed in the
2481         thread they are created"
2482         https://bugs.webkit.org/show_bug.cgi?id=183671
2483         https://trac.webkit.org/changeset/229639
2484
2485 2018-03-15  Youenn Fablet  <youenn@apple.com>
2486
2487         Bad configuration parameters should make RTCPeerConnection constructor throw
2488         https://bugs.webkit.org/show_bug.cgi?id=183615
2489
2490         Reviewed by Eric Carlson.
2491
2492         Implement more of https://w3c.github.io/webrtc-pc/#set-pc-configuration.
2493         Throw an error whenever underlying libwebrtc set configuration fails.
2494
2495         Covered by rebased test.
2496
2497         * Modules/mediastream/PeerConnectionBackend.h:
2498         * Modules/mediastream/RTCPeerConnection.cpp:
2499         (WebCore::iceServersFromConfiguration):
2500         (WebCore::RTCPeerConnection::initializeConfiguration):
2501         (WebCore::RTCPeerConnection::setConfiguration):
2502         * Modules/mediastream/RTCPeerConnection.js:
2503         (initializeRTCPeerConnection):
2504         * Modules/mediastream/libwebrtc/LibWebRTCPeerConnectionBackend.h:
2505
2506 2018-03-15  Youenn Fablet  <youenn@apple.com>
2507
2508         replaceTrack triggers negotiationneeded
2509         https://bugs.webkit.org/show_bug.cgi?id=180342
2510         <rdar://problem/35822426>
2511
2512         Reviewed by Eric Carlson.
2513
2514         Covered by updated test.
2515         Fix the case of replacing a track for which data is already flowing.
2516         We should probably do the same for null tracks when fully implementing transceivers.
2517
2518         * Modules/mediastream/RTCPeerConnection.cpp:
2519         (WebCore::RTCPeerConnection::enqueueReplaceTrackTask):
2520
2521 2018-03-15  Keith Rollin  <krollin@apple.com>
2522
2523         Telemetry for stalled webpage loads
2524         https://bugs.webkit.org/show_bug.cgi?id=183221
2525         <rdar://problem/36549013>
2526
2527         Reviewed by Chris Dumez.
2528
2529         Add telemetry for page loads, tracking the pages that succeed, fail,
2530         or are canceled. This information will be used to track the overall
2531         health of our page loading as time goes on.
2532
2533         No new tests -- no new/changed user-level functionality.
2534
2535         * page/DiagnosticLoggingKeys.cpp:
2536         (WebCore::DiagnosticLoggingKeys::telemetryPageLoadKey):
2537         (WebCore::DiagnosticLoggingKeys::timedOutKey):
2538         (WebCore::DiagnosticLoggingKeys::canceledLessThan2SecondsKey):
2539         (WebCore::DiagnosticLoggingKeys::canceledLessThan5SecondsKey):
2540         (WebCore::DiagnosticLoggingKeys::canceledLessThan20SecondsKey):
2541         (WebCore::DiagnosticLoggingKeys::canceledMoreThan20SecondsKey):
2542         (WebCore::DiagnosticLoggingKeys::failedLessThan2SecondsKey):
2543         (WebCore::DiagnosticLoggingKeys::failedLessThan5SecondsKey):
2544         (WebCore::DiagnosticLoggingKeys::failedLessThan20SecondsKey):
2545         (WebCore::DiagnosticLoggingKeys::failedMoreThan20SecondsKey):
2546         (WebCore::DiagnosticLoggingKeys::occurredKey):
2547         (WebCore::DiagnosticLoggingKeys::succeededLessThan2SecondsKey):
2548         (WebCore::DiagnosticLoggingKeys::succeededLessThan5SecondsKey):
2549         (WebCore::DiagnosticLoggingKeys::succeededLessThan20SecondsKey):
2550         (WebCore::DiagnosticLoggingKeys::succeededMoreThan20SecondsKey):
2551         * page/DiagnosticLoggingKeys.h:
2552         * platform/network/cf/ResourceError.h:
2553         (WebCore::ResourceError::ResourceError):
2554         * platform/network/mac/ResourceErrorMac.mm:
2555         (WebCore::ResourceError::ResourceError):
2556         (WebCore::ResourceError::getNSURLErrorDomain const):
2557         (WebCore::ResourceError::getCFErrorDomainCFNetwork const):
2558         (WebCore::ResourceError::mapPlatformError):
2559
2560 2018-03-15  Youenn Fablet  <youenn@apple.com>
2561
2562         ActiveDOMObject should assert that they are destroyed in the thread they are created
2563         https://bugs.webkit.org/show_bug.cgi?id=183671
2564
2565         Reviewed by Chris Dumez.
2566
2567         No change of behavior.
2568         Moved MessagePort assertion to ActiveDOMObject.
2569
2570         * dom/ActiveDOMObject.cpp:
2571         (WebCore::ActiveDOMObject::~ActiveDOMObject):
2572         * dom/ActiveDOMObject.h:
2573         * dom/MessagePort.cpp:
2574         (WebCore::MessagePort::~MessagePort):
2575         * dom/MessagePort.h:
2576
2577 2018-03-15  Youenn Fablet  <youenn@apple.com>
2578
2579         MessagePort is not always destroyed on the right thread
2580         https://bugs.webkit.org/show_bug.cgi?id=183619
2581         <rdar://problem/38204711>
2582
2583         Reviewed by Chris Dumez.
2584
2585         Add assertion to ensure MessagePort is destroyed in the right thread.
2586         Modify methods taking a ref in a lambda to rely on weak pointers and refing the WorkerThread if in a worker context.
2587         It is safe to ref the WorkerThread since it is thread safe ref counted and we are passing the ref to the main thread
2588         where the WorkerThread is expected to be destroyed.
2589
2590         Test: http/tests/workers/worker-messageport-2.html
2591
2592         * dom/MessagePort.cpp:
2593         (WebCore::MessagePort::~MessagePort):
2594         (WebCore::MessagePort::dispatchMessages):
2595         (WebCore::MessagePort::updateActivity):
2596         (WebCore::MessagePort::hasPendingActivity const):
2597         * dom/MessagePort.h:
2598
2599 2018-03-15  Jer Noble  <jer.noble@apple.com>
2600
2601         Adopt new AVURLAssetUseClientURLLoadingExclusively AVURLAsset creation option.
2602         https://bugs.webkit.org/show_bug.cgi?id=183660
2603
2604         Reviewed by Jon Lee.
2605
2606         * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
2607         (WebCore::MediaPlayerPrivateAVFoundationObjC::createAVAssetForURL):
2608
2609 2018-03-15  Chris Dumez  <cdumez@apple.com>
2610
2611         Unreviewed, fix tiny mistake in r229615 that caused API tests failures.
2612
2613         * workers/service/server/SWServer.cpp:
2614         (WebCore::SWServer::addRegistrationFromStore):
2615
2616 2018-03-15  Zan Dobersek  <zdobersek@igalia.com>
2617
2618         [TexMap] Remove TextureMapperLayer::texture()
2619         https://bugs.webkit.org/show_bug.cgi?id=183635
2620
2621         Reviewed by Michael Catanzaro.
2622
2623         Remove the unused TextureMapperLayer::texture() method. This enables
2624         removing the virtual TextureMapperBackingStore::texture() method, as
2625         well as the implementations of it in TextureMapperTiledBackingStore and
2626         CoordinatedBackingStore classes.
2627
2628         No change in behavior.
2629
2630         * platform/graphics/texmap/TextureMapperBackingStore.h:
2631         * platform/graphics/texmap/TextureMapperLayer.h:
2632         * platform/graphics/texmap/TextureMapperTiledBackingStore.cpp:
2633         (WebCore::TextureMapperTiledBackingStore::texture const): Deleted.
2634         * platform/graphics/texmap/TextureMapperTiledBackingStore.h:
2635
2636 2018-03-15  Zan Dobersek  <zdobersek@igalia.com>
2637
2638         [TexMap] Don't bother caching pattern transform matrix
2639         https://bugs.webkit.org/show_bug.cgi?id=183633
2640
2641         Reviewed by Michael Catanzaro.
2642
2643         Remove the m_patternTransform and m_patternTransformDirty member
2644         variables from the TextureMapperLayer class. These unnecessarily
2645         complicate the state update methods that need to compare the given
2646         attribute against the current state, and only update it if it has
2647         changed.
2648
2649         Instead, compute the pattern TransformationMatrix value on-the-fly in
2650         the paintSelf() method, if at all necessary.
2651
2652         No change in functionality.
2653
2654         * platform/graphics/texmap/TextureMapperLayer.cpp:
2655         (WebCore::TextureMapperLayer::paintSelf):
2656         (WebCore::TextureMapperLayer::setContentsRect):
2657         (WebCore::TextureMapperLayer::setContentsTileSize):
2658         (WebCore::TextureMapperLayer::setContentsTilePhase):
2659         (WebCore::TextureMapperLayer::computePatternTransformIfNeeded): Deleted.
2660         * platform/graphics/texmap/TextureMapperLayer.h:
2661
2662 2018-03-14  John Wilander  <wilander@apple.com>
2663
2664         Resource Load Statistics: Add clearing of storage access to WebResourceLoadStatisticsStore::clearInMemory()
2665         https://bugs.webkit.org/show_bug.cgi?id=183641
2666         <rdar://problem/38469497>
2667
2668         Reviewed by Brent Fulgham and Chris Dumez.
2669
2670         No new tests. This change is to stabilize existing layout tests.
2671         See Ryan Haddad's comment in https://bugs.webkit.org/show_bug.cgi?id=183620.
2672
2673         * platform/network/NetworkStorageSession.h:
2674         * platform/network/cf/NetworkStorageSessionCFNet.cpp:
2675         (WebCore::NetworkStorageSession::removeAllStorageAccess):
2676             New function to clear out all storage access entries.
2677
2678 2018-03-14  Youenn Fablet  <youenn@apple.com>
2679
2680         imported/w3c/web-platform-tests/WebCryptoAPI/wrapKey_unwrapKey/wrapKey_unwrapKey.worker.html is crashing
2681         https://bugs.webkit.org/show_bug.cgi?id=183602
2682
2683         Reviewed by Chris Dumez.
2684
2685         Introduce a map of ScriptExecutionContext that is read/write protected using a Lock.
2686         This allows introducing postTaskTo taking a ScriptExecutionContext identifier and callable from any thread.
2687         Use that method in Crypto instead of refing/unrefing  the context.
2688         Lock only happens if context does some postTask activity. This is governed by calling or not the new contextIdentifier() getter.
2689
2690         Covered by crypto tests no longer failing m_workerGlobalScope->hasOneRef() assertion.
2691
2692         * crypto/CryptoAlgorithm.cpp:
2693         (WebCore::dispatchAlgorithmOperation):
2694         * crypto/algorithms/CryptoAlgorithmECDH.cpp:
2695         (WebCore::CryptoAlgorithmECDH::deriveBits):
2696         * crypto/algorithms/CryptoAlgorithmSHA1.cpp:
2697         (WebCore::CryptoAlgorithmSHA1::digest):
2698         * crypto/algorithms/CryptoAlgorithmSHA224.cpp:
2699         (WebCore::CryptoAlgorithmSHA224::digest):
2700         * crypto/algorithms/CryptoAlgorithmSHA256.cpp:
2701         (WebCore::CryptoAlgorithmSHA256::digest):
2702         * crypto/algorithms/CryptoAlgorithmSHA384.cpp:
2703         (WebCore::CryptoAlgorithmSHA384::digest):
2704         * crypto/algorithms/CryptoAlgorithmSHA512.cpp:
2705         (WebCore::CryptoAlgorithmSHA512::digest):
2706         * crypto/gcrypt/CryptoKeyRSAGCrypt.cpp:
2707         (WebCore::CryptoKeyRSA::generatePair):
2708         * crypto/mac/CryptoKeyRSAMac.cpp:
2709         (WebCore::CryptoKeyRSA::generatePair):
2710         * dom/Document.cpp:
2711         (WebCore::Document::~Document):
2712         * dom/ScriptExecutionContext.cpp:
2713         (WebCore::allScriptExecutionContextsMapLock):
2714         (WebCore::ScriptExecutionContext::ScriptExecutionContext):
2715         (WebCore::ScriptExecutionContext::removeFromContextsMap):
2716         (WebCore::ScriptExecutionContext::checkConsistency const):
2717         (WebCore::ScriptExecutionContext::postTaskTo):
2718         * dom/ScriptExecutionContext.h:
2719         (WebCore::ScriptExecutionContext::contextIdentifier const):
2720         * workers/WorkerGlobalScope.cpp:
2721         (WebCore::WorkerGlobalScope::~WorkerGlobalScope):
2722
2723 2018-03-14  Chris Dumez  <cdumez@apple.com>
2724
2725         Reduce use of SWServerToContextConnection::globalServerToContextConnection()
2726         https://bugs.webkit.org/show_bug.cgi?id=183626
2727
2728         Reviewed by Youenn Fablet.
2729
2730         Reduce use of SWServerToContextConnection::globalServerToContextConnection() as we are moving towards
2731         having multiple context connections.
2732
2733         No new tests, no expected behavior change.
2734
2735         * workers/service/server/SWServer.cpp:
2736         (WebCore::SWServer::matchAll):
2737         (WebCore::SWServer::serverToContextConnectionCreated):
2738         (WebCore::SWServer::runServiceWorkerIfNecessary):
2739         (WebCore::SWServer::runServiceWorker):
2740         (WebCore::SWServer::terminateWorkerInternal):
2741         (WebCore::SWServer::markAllWorkersAsTerminated):
2742         (WebCore::SWServer::workerContextTerminated):
2743         (WebCore::SWServer::fireInstallEvent):
2744         (WebCore::SWServer::fireActivateEvent):
2745         * workers/service/server/SWServer.h:
2746         * workers/service/server/SWServerToContextConnection.cpp:
2747         (WebCore::SWServerToContextConnection::findClientByIdentifier):
2748         (WebCore::SWServerToContextConnection::matchAll):
2749         (WebCore::SWServerToContextConnection::claim):
2750         * workers/service/server/SWServerWorker.cpp:
2751         (WebCore::SWServerWorker::contextConnection):
2752         (WebCore::SWServerWorker::matchAll):
2753         * workers/service/server/SWServerWorker.h:
2754
2755 2018-03-14  Youenn Fablet  <youenn@apple.com>
2756
2757         MessagePort should remove its listeners when being closed
2758         https://bugs.webkit.org/show_bug.cgi?id=183644
2759
2760         Reviewed by Chris Dumez.
2761
2762         Test: http/tests/workers/worker-messageport.html
2763
2764         * dom/MessagePort.cpp:
2765         (WebCore::MessagePort::close):
2766         (WebCore::MessagePort::contextDestroyed):
2767
2768 2018-03-14  Chris Dumez  <cdumez@apple.com>
2769
2770         Drop unnecessary StorageToWebProcessConnection::workerContextProcessConnectionCreated()
2771         https://bugs.webkit.org/show_bug.cgi?id=183624
2772
2773         Reviewed by Youenn Fablet.
2774
2775         Pass in context connection to SWServer::serverToContextConnectionCreated() to avoid
2776         relying on the deprecated globalServerToContextConnection().
2777
2778         No new tests, no expected behavior change.
2779
2780         * workers/service/server/SWServer.cpp:
2781         (WebCore::SWServer::serverToContextConnectionCreated):
2782         * workers/service/server/SWServer.h:
2783
2784 2018-03-14  Mark Lam  <mark.lam@apple.com>
2785
2786         Enhance the MacroAssembler and LinkBuffer to support pointer profiling.
2787         https://bugs.webkit.org/show_bug.cgi?id=183623
2788         <rdar://problem/38443314>
2789
2790         Reviewed by Michael Saboff.
2791
2792         No new tests.  Just adding PtrTags required by new MacroAssembler API.
2793
2794         * cssjit/FunctionCall.h:
2795         (WebCore::FunctionCall::prepareAndCall):
2796         * cssjit/SelectorCompiler.cpp:
2797         (WebCore::SelectorCompiler::SelectorCodeGenerator::compile):
2798
2799 2018-03-14  Chris Fleizach  <cfleizach@apple.com>
2800
2801         AX: Implement accessible dismiss action on iOS
2802         https://bugs.webkit.org/show_bug.cgi?id=183352
2803         <rdar://problem/38161500>
2804
2805         Reviewed by Zalan Bujtas.
2806
2807         Test: accessibility/ios-simulator/AOM-dismiss-event.html
2808
2809         * accessibility/ios/WebAccessibilityObjectWrapperIOS.mm:
2810         (-[WebAccessibilityObjectWrapper accessibilityPerformEscape]):
2811
2812 2018-03-14  Youenn Fablet  <youenn@apple.com>
2813
2814         Update libwebrtc up to 36af4e9614f707f733eb2340fae66d6325aaac5b
2815         https://bugs.webkit.org/show_bug.cgi?id=183481
2816
2817         Reviewed by Eric Carlson.
2818
2819         Covered by existing tests.
2820         Updated libwebrtc binding code.
2821
2822         * Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.cpp:
2823         (WebCore::fillEncodingParameters):
2824         * platform/mediastream/libwebrtc/LibWebRTCAudioModule.h:
2825
2826 2018-03-14  Tim Horton  <timothy_horton@apple.com>
2827
2828         Fix the build after r229567
2829
2830         * Configurations/FeatureDefines.xcconfig:
2831
2832 2018-03-13  John Wilander  <wilander@apple.com>
2833
2834         Resource Load Statistics: Immediately forward cookie access for domains with previous user interaction when there's an opener document
2835         https://bugs.webkit.org/show_bug.cgi?id=183620
2836         <rdar://problem/38431469>
2837
2838         Reviewed by Brent Fulgham.
2839
2840         Tests: http/tests/storageAccess/deny-storage-access-under-opener.html
2841                http/tests/storageAccess/grant-storage-access-under-opener.html
2842
2843         It turns out the fix in https://bugs.webkit.org/show_bug.cgi?id=183577
2844         wasn't enough to address the compatibility issues with popups. Some of
2845         them just detect their unpartitioned cookies, auto-dismiss themselves,
2846         and expect their unpartitioned cookies to be available under the opener
2847         afterwards. We should grant them access if the popup's domain has had
2848         user interaction _previously_.
2849
2850         Note that we still need https://bugs.webkit.org/show_bug.cgi?id=183577
2851         because if the popup's domain has not received user interaction
2852         previously, we will not grant it storage access on just the window open.
2853
2854         * dom/Document.cpp:
2855         (WebCore::Document::hasRequestedPageSpecificStorageAccessWithUserInteraction):
2856         (WebCore::Document::setHasRequestedPageSpecificStorageAccessWithUserInteraction):
2857         (WebCore::Document::hasGrantedPageSpecificStorageAccess): Deleted.
2858         (WebCore::Document::setHasGrantedPageSpecificStorageAccess): Deleted.
2859             Renamed from *Granted* to *Requested* since there is now a case
2860             where access will not be granted, i.e. when the popup domain has
2861             not had user interaction previously.
2862         * dom/Document.h:
2863         * loader/ResourceLoadObserver.cpp:
2864         (WebCore::ResourceLoadObserver::setRequestStorageAccessUnderOpenerCallback):
2865             Renamed *Grant* to *Request*.
2866         (WebCore::ResourceLoadObserver::logUserInteractionWithReducedTimeResolution):
2867         (WebCore::ResourceLoadObserver::logWindowCreation):
2868             New function called from DOMWindow::createWindow().
2869         (WebCore::ResourceLoadObserver::requestStorageAccessUnderOpener):
2870             New convenience function.
2871         (WebCore::ResourceLoadObserver::setGrantStorageAccessUnderOpenerCallback): Deleted.
2872             Renamed *Grant* to *Request*.
2873         * loader/ResourceLoadObserver.h:
2874         * page/DOMWindow.cpp:
2875         (WebCore::DOMWindow::createWindow):
2876             Now calls ResourceLoadObserver::logWindowCreation() if a window
2877             was created and the opener has a document and a page ID.
2878
2879 2018-03-13  Chris Dumez  <cdumez@apple.com>
2880
2881         fast/loader/javascript-url-iframe-remove-on-navigate.html is a flaky crash on iOS with async delegates
2882         https://bugs.webkit.org/show_bug.cgi?id=183610
2883
2884         Reviewed by Youenn Fablet.
2885
2886         The issue was that in DocumentLoader::loadMainResource(), the call to requestMainResource() which
2887         return null due to the load getting cancelled synchronously. If this load is the parent frame's last
2888         pending load, then the 'load' event gets fired in the parent frame. In the test, the parent frame's
2889         load event handler does a document.write() call which blows away the iframe. As a result, when
2890         we return from the requestMainResource(), m_frame is null and we crash later on dereferencing it.
2891
2892         No new tests, covered by fast/loader/javascript-url-iframe-remove-on-navigate-async-delegate.html
2893         which was crashing flakily.
2894
2895         * loader/DocumentLoader.cpp:
2896         (WebCore::DocumentLoader::loadMainResource):
2897
2898 2018-03-13  Jer Noble  <jer.noble@apple.com>
2899
2900         [iOS] Muted media playback can interrupt out-of-process audio
2901         https://bugs.webkit.org/show_bug.cgi?id=183606
2902         <rdar://problem/37466253>
2903
2904         Reviewed by Eric Carlson.
2905
2906         Test: Updated TestWebKitAPI test to verify the correct AVAudioSession category is set.
2907
2908         A non-playing, non-muted media element will cause the AVAudioSession category to be set to
2909         "playing" when a muted media element begins playback. Ignore these non-playing elements for
2910         the purposes of determining the AVAudioSession category.
2911
2912         * platform/audio/cocoa/MediaSessionManagerCocoa.cpp:
2913         (PlatformMediaSessionManager::updateSessionState):
2914
2915 2018-03-13  Youenn Fablet  <youenn@apple.com>
2916
2917         Calling removeTrack with RTCRtpSender does not set SenderTrack to null
2918         https://bugs.webkit.org/show_bug.cgi?id=183308
2919
2920         Reviewed by Eric Carlson.
2921
2922         Covered by updated test.
2923
2924         * Modules/mediastream/RTCRtpSender.cpp:
2925         (WebCore::RTCRtpSender::stop): Set track to null when being stopped i.e. removed.
2926         * Modules/mediastream/RTCRtpSender.h:
2927
2928 2018-03-13  Youenn Fablet  <youenn@apple.com>
2929
2930         Changing link element rel attribute from preload to stylesheet should succeed loading the stylesheet
2931         https://bugs.webkit.org/show_bug.cgi?id=183601
2932         <rdar://problem/38309441>
2933
2934         Reviewed by Antti Koivisto.
2935
2936         Test: http/wpt/preload/change-link-rel-attribute.html
2937
2938         * loader/LinkPreloadResourceClients.h:
2939         (WebCore::LinkPreloadResourceClient::clearResource): Remove the call to CachedResource::cancelLoad.
2940         This call is expected to be called by ResourceLoader when cancelling the load from below CachedResource.
2941         * loader/cache/CachedResource.cpp:
2942         (WebCore::CachedResource::allClientsRemoved): In case of preload,
2943         cancel the load if not finished when there is no more client attached to it.
2944         * loader/cache/CachedResource.h:
2945
2946 2018-03-12  John Wilander  <wilander@apple.com>
2947
2948         Resource Load Statistics: Immediately forward cookie access at user interaction when there's an opener document
2949         https://bugs.webkit.org/show_bug.cgi?id=183577
2950         <rdar://problem/38266987>
2951
2952         Reviewed by Brent Fulgham.
2953
2954         Tested manually on live websites.
2955         No new automated tests because of a bug in WebKitTestRunner:
2956         https://bugs.webkit.org/show_bug.cgi?id=183578
2957         The event sender triggers gestures in the opener rather than
2958         in the popup.
2959
2960         * dom/Document.cpp:
2961         (WebCore::Document::removedLastRef):
2962             Clears the new m_primaryDomainsGrantedPageSpecificStorageAccess.
2963         (WebCore::Document::hasGrantedPageSpecificStorageAccess):
2964         (WebCore::Document::setHasGrantedPageSpecificStorageAccess):
2965         * dom/Document.h:
2966             Added member m_primaryDomainsGrantedPageSpecificStorageAccess
2967             where we store domains that have been granted access.
2968         * loader/ResourceLoadObserver.cpp:
2969         (WebCore::ResourceLoadObserver::setGrantStorageAccessUnderOpenerCallback):
2970         (WebCore::ResourceLoadObserver::logUserInteractionWithReducedTimeResolution):
2971             Now checks if there is a cross-origin opener and if so, immediately
2972             grants cookie access to the popup's domain if it is partitioned or
2973             blocked. 
2974         * loader/ResourceLoadObserver.h:
2975         * platform/network/NetworkStorageSession.h:
2976             Added member m_pagesGrantedStorageAccess.
2977         * platform/network/cf/NetworkStorageSessionCFNet.cpp:
2978         (WebCore::NetworkStorageSession::cookieStoragePartition const):
2979         (WebCore::NetworkStorageSession::hasStorageAccess const):
2980             Renamed from hasStorageAccessForFrame since the frameID now is optional.
2981         (WebCore::NetworkStorageSession::grantStorageAccess):
2982             Renamed from grantStorageAccessForFrame since the frameID now is optional.
2983         (WebCore::NetworkStorageSession::removeStorageAccessForAllFramesOnPage):
2984             Now removes the pageID entry in m_pagesGrantedStorageAccess.
2985         (WebCore::NetworkStorageSession::hasStorageAccessForFrame const): Deleted.
2986             Renamed since the frameID now is optional.
2987         (WebCore::NetworkStorageSession::grantStorageAccessForFrame): Deleted.
2988             Renamed since the frameID now is optional.
2989
2990 2018-03-12  Tim Horton  <timothy_horton@apple.com>
2991
2992         Stop using SDK conditionals to control feature definitions
2993         https://bugs.webkit.org/show_bug.cgi?id=183430
2994         <rdar://problem/38251619>
2995
2996         Reviewed by Dan Bernstein.
2997
2998         * Configurations/FeatureDefines.xcconfig:
2999         * Configurations/WebKitTargetConditionals.xcconfig: Renamed.
3000
3001 2018-03-12  Chris Dumez  <cdumez@apple.com>
3002
3003         Return boolean from DOMTokenList's replace() method
3004         https://bugs.webkit.org/show_bug.cgi?id=183567
3005
3006         Reviewed by Youenn Fablet.
3007
3008         Have DOMTokenList's replace() method return a boolean indicating if the
3009         token was replaced, as per:
3010         - https://dom.spec.whatwg.org/#dom-domtokenlist-replace
3011
3012         This is a recent addition to the DOM specification:
3013         - https://github.com/whatwg/dom/pull/582
3014
3015         No new tests, rebaselined existing test.
3016
3017         * html/DOMTokenList.cpp:
3018         (WebCore::replaceInOrderedSet):
3019         (WebCore::DOMTokenList::replace):
3020         * html/DOMTokenList.h:
3021         * html/DOMTokenList.idl:
3022
3023 2018-03-12  Brian Burg  <bburg@apple.com>
3024
3025         Ignore some deprecation warnings encountered when compiling with newer versions of ICU
3026         https://bugs.webkit.org/show_bug.cgi?id=183584
3027         <rdar://problem/38395317>
3028
3029         Reviewed by Daniel Bates.
3030
3031         Ignore new deprecation warnings. Where a function has more than one
3032         deprecation warning, mark out the entire function so it remains readable.
3033
3034         * editing/TextIterator.cpp:
3035         * platform/graphics/SurrogatePairAwareTextIterator.cpp:
3036         (WebCore::SurrogatePairAwareTextIterator::normalizeVoicingMarks):
3037         * platform/text/TextEncoding.cpp:
3038
3039 2018-03-12  Yoav Weiss  <yoav@yoav.ws>
3040
3041         Runtime flag for link prefetch and remove link subresource.
3042         https://bugs.webkit.org/show_bug.cgi?id=183540
3043
3044         Reviewed by Chris Dumez.
3045
3046         This patch removes the LINK_PREFETCH build time flag, removes
3047         link subresource, adds an off-by-default runtime flag for link
3048         prefetch and makes sure link prefetch only works when this flag is on.
3049
3050         Subresource is removed as it's not a part of any spec, nor supported by any
3051         other browser. It was replaced by link preload.
3052
3053         No new tests as this is not adding any new functionality.
3054
3055         * Configurations/FeatureDefines.xcconfig: Remove the LINK_PREFETCH flag.
3056         * html/LinkRelAttribute.cpp:
3057         (WebCore::LinkRelAttribute::LinkRelAttribute): Put prefetch support behind the runtime flag.
3058         (WebCore::LinkRelAttribute::isSupported): Add prefetch.
3059         * html/LinkRelAttribute.h: Remove the LINK_PREFETCH flag.
3060         * loader/LinkLoader.cpp:
3061         (WebCore::createLinkPreloadResourceClient): Remove the LINK_PREFETCH flag.
3062         (WebCore::LinkLoader::prefetchIfNeeded): Move the prefetch code to `prefetchIfNeeded()`. Remove subresource bits.
3063         (WebCore::LinkLoader::loadLink): Call `prefetchIfNeeded()`.
3064         * loader/LinkLoader.h:
3065         * loader/ResourceLoadInfo.cpp:
3066         (WebCore::toResourceType): Remove the LINK_PREFETCH flag as well as subresource.
3067         * loader/SubresourceLoader.cpp:
3068         (WebCore::logResourceLoaded): Remove the LINK_PREFETCH flag as well as subresource.
3069         * loader/cache/CachedResource.cpp:
3070         (WebCore::CachedResource::defaultPriorityForResourceType): Remove the LINK_PREFETCH flag as well as subresource.
3071         (WebCore::CachedResource::load): Remove the LINK_PREFETCH flag.
3072         * loader/cache/CachedResource.h:
3073         (WebCore::CachedResource::ignoreForRequestCount const): Remove the LINK_PREFETCH flag as well as subresource.
3074         * loader/cache/CachedResourceLoader.cpp:
3075         (WebCore::createResource): Remove the LINK_PREFETCH flag as well as subresource.
3076         (WebCore::CachedResourceLoader::requestLinkResource): Remove subresource.
3077         (WebCore::contentTypeFromResourceType): Remove the LINK_PREFETCH flag as well as subresource.
3078         (WebCore::CachedResourceLoader::checkInsecureContent const): Remove the LINK_PREFETCH flag as well as subresource.
3079         (WebCore::CachedResourceLoader::shouldUpdateCachedResourceWithCurrentRequest): Remove the LINK_PREFETCH flag as well as subresource.
3080         * loader/cache/CachedResourceLoader.h:
3081         * page/RuntimeEnabledFeatures.h:
3082         (WebCore::RuntimeEnabledFeatures::setLinkPrefetchEnabled): Set the prefetch flag.
3083         (WebCore::RuntimeEnabledFeatures::linkPrefetchEnabled const): Get the prefetch flag.
3084
3085 2018-03-12  Youenn Fablet  <youenn@apple.com>
3086
3087         RTCPeerConnection's close method should update signalingState
3088         https://bugs.webkit.org/show_bug.cgi?id=174314
3089         <rdar://problem/33267977>
3090
3091         Reviewed by Eric Carlson.
3092
3093         Covered by rebased test.
3094         Add closed as signalingState enum value.
3095         Set peer connection signaling state to closed once close is called.
3096
3097         * Modules/mediastream/RTCPeerConnection.cpp:
3098         (WebCore::RTCPeerConnection::doClose):
3099         * Modules/mediastream/RTCSignalingState.idl:
3100         * platform/mediastream/RTCSignalingState.h:
3101
3102 2018-03-12  Mark Lam  <mark.lam@apple.com>
3103
3104         Make a NativeFunction into a class to support pointer profiling.
3105         https://bugs.webkit.org/show_bug.cgi?id=183573
3106         <rdar://problem/38384697>
3107
3108         Reviewed by Filip Pizlo.
3109
3110         No new tests because there's no new behavior.  Only updating bindings.
3111
3112         * bindings/scripts/CodeGeneratorJS.pm:
3113         (GenerateHashTableValueArray):
3114         * bindings/scripts/test/JS/JSMapLike.cpp:
3115         * bindings/scripts/test/JS/JSReadOnlyMapLike.cpp:
3116         * bindings/scripts/test/JS/JSTestActiveDOMObject.cpp:
3117         * bindings/scripts/test/JS/JSTestCEReactions.cpp:
3118         * bindings/scripts/test/JS/JSTestCEReactionsStringifier.cpp:
3119         * bindings/scripts/test/JS/JSTestCallTracer.cpp:
3120         * bindings/scripts/test/JS/JSTestDOMJIT.cpp:
3121         * bindings/scripts/test/JS/JSTestEnabledBySetting.cpp:
3122         * bindings/scripts/test/JS/JSTestEventTarget.cpp:
3123         * bindings/scripts/test/JS/JSTestGlobalObject.cpp:
3124         * bindings/scripts/test/JS/JSTestIndexedSetterWithIdentifier.cpp:
3125         * bindings/scripts/test/JS/JSTestInterface.cpp:
3126         * bindings/scripts/test/JS/JSTestIterable.cpp:
3127         * bindings/scripts/test/JS/JSTestJSBuiltinConstructor.cpp:
3128         * bindings/scripts/test/JS/JSTestMediaQueryListListener.cpp:
3129         * bindings/scripts/test/JS/JSTestNamedAndIndexedSetterWithIdentifier.cpp:
3130         * bindings/scripts/test/JS/JSTestNamedDeleterWithIdentifier.cpp:
3131         * bindings/scripts/test/JS/JSTestNamedGetterWithIdentifier.cpp:
3132         * bindings/scripts/test/JS/JSTestNamedSetterWithIdentifier.cpp:
3133         * bindings/scripts/test/JS/JSTestNamedSetterWithIndexedGetter.cpp:
3134         * bindings/scripts/test/JS/JSTestNamedSetterWithIndexedGetterAndSetter.cpp:
3135         * bindings/scripts/test/JS/JSTestNamedSetterWithUnforgableProperties.cpp:
3136         * bindings/scripts/test/JS/JSTestNamedSetterWithUnforgablePropertiesAndOverrideBuiltins.cpp:
3137         * bindings/scripts/test/JS/JSTestNode.cpp:
3138         * bindings/scripts/test/JS/JSTestObj.cpp:
3139         * bindings/scripts/test/JS/JSTestOverrideBuiltins.cpp:
3140         * bindings/scripts/test/JS/JSTestSerialization.cpp:
3141         * bindings/scripts/test/JS/JSTestSerializationInherit.cpp:
3142         * bindings/scripts/test/JS/JSTestSerializationInheritFinal.cpp:
3143         * bindings/scripts/test/JS/JSTestSerializedScriptValueInterface.cpp:
3144         * bindings/scripts/test/JS/JSTestStringifier.cpp:
3145         * bindings/scripts/test/JS/JSTestStringifierAnonymousOperation.cpp:
3146         * bindings/scripts/test/JS/JSTestStringifierNamedOperation.cpp:
3147         * bindings/scripts/test/JS/JSTestStringifierOperationImplementedAs.cpp:
3148         * bindings/scripts/test/JS/JSTestStringifierOperationNamedToString.cpp:
3149         * bindings/scripts/test/JS/JSTestStringifierReadOnlyAttribute.cpp:
3150         * bindings/scripts/test/JS/JSTestStringifierReadWriteAttribute.cpp:
3151         * bindings/scripts/test/JS/JSTestTypedefs.cpp:
3152
3153 2018-03-12  Tim Horton  <timothy_horton@apple.com>
3154
3155         Use a different SPI header for some AudioToolbox enums
3156         https://bugs.webkit.org/show_bug.cgi?id=183574
3157         <rdar://problem/38385889>
3158
3159         Reviewed by Anders Carlsson.
3160
3161         * platform/audio/ios/AudioDestinationIOS.cpp:
3162         * platform/mediastream/mac/AudioTrackPrivateMediaStreamCocoa.cpp:
3163         Adjust SPI imports.
3164
3165 2018-03-12  Danyao Wang  <danyao@chromium.org>
3166
3167         Add a query and fragment exception to history API's unique origin restriction.
3168         https://bugs.webkit.org/show_bug.cgi?id=183028
3169
3170         Reviewed by Brent Fulgham.
3171
3172         Tests: http/tests/navigation/pushstate-at-unique-origin-denied.php
3173                Tools/TestWebKitAPI/Tests/WebCore/URL.cpp
3174
3175         * page/History.cpp:
3176         (WebCore::History::stateObjectAdded):
3177
3178 2018-03-12  Antti Koivisto  <antti@apple.com>
3179
3180         Don't invalidate descendants for nth pseudo classes unless needed
3181         https://bugs.webkit.org/show_bug.cgi?id=183566
3182
3183         Reviewed by Zalan Bujtas.
3184
3185         We currently invalidate the whole subtrees that may match :nth-child and similar. In many common
3186         cases we know that only the direct siblings may be affected.
3187
3188         * css/SelectorChecker.cpp:
3189         (WebCore::localContextForParent):
3190         (WebCore::SelectorChecker::matchRecursively const):
3191
3192             Track if the context matches the subject element if the selector or its siblings only.
3193
3194         (WebCore::SelectorChecker::checkOne const):
3195
3196             Use different bits of descendant and child invalidation cases.
3197
3198         * cssjit/SelectorCompiler.cpp:
3199         (WebCore::SelectorCompiler::fragmentMatchesRightmostOrAdjacentElement):
3200         (WebCore::SelectorCompiler::constructFragmentsInternal):
3201
3202             Track if the context matches the subject element if the selector or its siblings only.
3203
3204         (WebCore::SelectorCompiler::SelectorCodeGenerator::generateElementIsNthChild):
3205         (WebCore::SelectorCompiler::SelectorCodeGenerator::generateElementIsNthChildOf):
3206         (WebCore::SelectorCompiler::SelectorCodeGenerator::generateElementIsNthLastChild):
3207
3208             Use different bits of descendant and child invalidation cases.
3209
3210         * dom/Element.cpp:
3211         (WebCore::invalidateForForwardPositionalRules):
3212         (WebCore::invalidateForBackwardPositionalRules):
3213
3214             Invalidate more precisely based on the new bits.
3215
3216         (WebCore::checkForSiblingStyleChanges):
3217         (WebCore::Element::setDescendantsAffectedByForwardPositionalRules):
3218         (WebCore::Element::setDescendantsAffectedByBackwardPositionalRules):
3219         (WebCore::Element::hasFlagsSetDuringStylingOfChildren const):
3220         (WebCore::Element::rareDataDescendantsAffectedByForwardPositionalRules const):
3221         (WebCore::Element::rareDataDescendantsAffectedByBackwardPositionalRules const):
3222
3223             New bits.
3224
3225         * dom/Element.h:
3226         (WebCore::Element::descendantsAffectedByForwardPositionalRules const):
3227         (WebCore::Element::descendantsAffectedByBackwardPositionalRules const):
3228         * dom/ElementRareData.h:
3229         (WebCore::ElementRareData::descendantsAffectedByForwardPositionalRules const):
3230         (WebCore::ElementRareData::setDescendantsAffectedByForwardPositionalRules):
3231         (WebCore::ElementRareData::descendantsAffectedByBackwardPositionalRules const):
3232         (WebCore::ElementRareData::setDescendantsAffectedByBackwardPositionalRules):
3233         (WebCore::ElementRareData::ElementRareData):
3234         (WebCore::ElementRareData::resetStyleRelations):
3235         * style/StyleRelations.cpp:
3236         (WebCore::Style::commitRelationsToRenderStyle):
3237         (WebCore::Style::commitRelations):
3238         * style/StyleRelations.h:
3239
3240 2018-03-12  Javier Fernandez  <jfernandez@igalia.com>
3241
3242         Remove GridLayout runtime flag
3243         https://bugs.webkit.org/show_bug.cgi?id=183484
3244
3245         Reviewed by Myles C. Maxfield.
3246
3247         The Grid Layout feature has been enabled by default for almost a
3248         year, so I think it's time to remove the runtime flag and the
3249         codepath run when the feature is disabled.
3250
3251         No new tests, because there are no changes in functionality.
3252
3253         * css/CSSComputedStyleDeclaration.cpp:
3254         (WebCore::valueForContentPositionAndDistributionWithOverflowAlignment):
3255         (WebCore::ComputedStyleExtractor::valueForPropertyinStyle):
3256         * css/StyleBuilderConverter.h:
3257         (WebCore::StyleBuilderConverter::convertContentAlignmentData):
3258         * css/parser/CSSParser.cpp:
3259         (WebCore::CSSParserContext::CSSParserContext):
3260         (WebCore::operator==):
3261         * css/parser/CSSParserFastPaths.cpp:
3262         (WebCore::CSSParserFastPaths::isValidKeywordPropertyAndValue):
3263         (WebCore::CSSParserFastPaths::isKeywordPropertyID):
3264         * css/parser/CSSParserMode.h:
3265         (WebCore::CSSParserContextHash::hash):
3266         * css/parser/CSSPropertyParser.cpp:
3267         (WebCore::CSSPropertyParser::parseSingleValue):
3268         * dom/Document.cpp:
3269         * dom/Document.h:
3270         * page/RuntimeEnabledFeatures.h:
3271         * rendering/RenderFlexibleBox.cpp:
3272         (WebCore::alignmentOffset):
3273         * rendering/style/RenderStyle.cpp:
3274         * rendering/style/RenderStyle.h:
3275         (WebCore::RenderStyle::initialDefaultAlignment):
3276         * testing/InternalSettings.cpp:
3277         (WebCore::InternalSettings::Backup::Backup):
3278         (WebCore::InternalSettings::Backup::restoreTo):
3279         * testing/InternalSettings.h:
3280         * testing/InternalSettings.idl:
3281
3282 2018-03-12  Antoine Quint  <graouts@apple.com>
3283
3284         [Web Animations] Implement CSS Animations and CSS Transitions as Web Animations
3285         https://bugs.webkit.org/show_bug.cgi?id=183504
3286         <rdar://problem/38372965>
3287
3288         Reviewed by Dean Jackson and Jon Lee.
3289
3290         Tests: webanimations/css-animations.html
3291                webanimations/css-transitions.html
3292
3293         This patch implements CSS Animations and CSS Transitions as Web Animations. The main changes are:
3294
3295         * StyleTreeResolver: StyleTreeResolver now has a code path to add CSSAnimation and CSSTransition objects onto the DocumentTimeline
3296         to be picked up by the Web Animations engine. The previous CSSAnimationController code path is preserved if the runtime flag is disabled.
3297
3298         * AnimationTimeline: we add two new methods, updateCSSAnimationsForElement() and updateCSSTransitionsForElement() which are called from
3299         TreeResolver::createAnimatedElementUpdate(). These look at the AnimationList for the old and new RenderStyle objects and create, update
3300         and remove matching CSSAnimation and CSSTransition instances.
3301
3302         * DeclarativeAnimation: a new superclass to both CSSAnimation and CSSTransition which introduces the concept of a backingAnimation(),
3303         which is an Animation held by the RenderStyle objects, and two virtual methods with base implementations, initialize() which is called
3304         upon creating by create() methods in subclasses, and syncPropertiesWithBackingAnimation() which ensures that properties on the
3305         DeclarativeAnimation objects (Web Animations side) match the backing animation (CSS side).
3306
3307         * KeyframeEffectReadOnly: two new important methods to create blending keyframes (KeyframeList) based on backing Animation objects,
3308         computeCSSAnimationBlendingKeyframes() and computeCSSTransitionBlendingKeyframes().
3309
3310         * Sources.txt:
3311         * WebCore.xcodeproj/project.pbxproj:
3312         * animation/AnimationEffectReadOnly.h:
3313         (WebCore::AnimationEffectReadOnly::isKeyframeEffectReadOnly const): We fix this method such that calling it on a KeyframeEffect, which
3314         is a subclass of KeyframeEffectReadOnly, returns true.
3315         * animation/AnimationEffectTimingReadOnly.cpp: In order for DeclarativeAnimation::syncPropertiesWithBackingAnimation() to set the timing
3316         function for a declarative animation's effect, we need a public method to set an effect's timing function outside of just the "easing"
3317         property setter exposed via the JS API. So we introduce a setTimingFunction() method and call it from setEasing().
3318         (WebCore::AnimationEffectTimingReadOnly::setEasing):
3319         (WebCore::AnimationEffectTimingReadOnly::setTimingFunction):
3320         * animation/AnimationEffectTimingReadOnly.h:
3321         * animation/AnimationTimeline.cpp:
3322         (WebCore::AnimationTimeline::~AnimationTimeline): Clear all maps and sets containing WebAnimation references to ensure these get destructed
3323         when the AnimationTimeline is being destructed and should no longer hold a reference to them.
3324         (WebCore::AnimationTimeline::relevantMapForAnimation): We store various subclasses of WebAnimation in dedicated maps so we can composite
3325         animations in the correct order when animating. This function returns the correct map for a given animation such that animationWasAddedToElement()
3326         and animationWasRemovedFromElement() mutate the right map.
3327         (WebCore::AnimationTimeline::animationWasAddedToElement):
3328         (WebCore::AnimationTimeline::animationWasRemovedFromElement):
3329         (WebCore::AnimationTimeline::animationsForElement): Make sure to look for animations in the lists of CSS Animations and CSS Transitions as well
3330         as Web Animations.
3331         (WebCore::AnimationTimeline::updateCSSAnimationsForElement): This method is called by TreeResolver::createAnimatedElementUpdate() during style
3332         resolution. It compares the AnimationList of the previous style and the new style for a given element, checks that animations with a given name
3333         that were not present in the old AnimationList have a new matching CSSAnimation object for them added to the AnimationTimeline, that animations
3334         with a given name that are no longer present in the new AnimationList have their matching CSSAnimation object removed from the AnimationTimeline,
3335         and that animations with a given name that are present in both the old and new AnimationList have their matching CSSAnimation updated to match
3336         the current state of the animation in the AnimationList.
3337         (WebCore::AnimationTimeline::updateCSSTransitionsForElement): Similarly to updateCSSAnimationsForElement(), this method is called during style
3338         resolution by TreeResolver::createAnimatedElementUpdate(). Its role is to create or remove CSSTransition objects based on the AnimationList found
3339         in the old and new styles for a given element. It follows a slightly different logic than updateCSSAnimationsForElement() since for CSS Transitions,
3340         there is no need to update CSSTransition objects for a CSS property existing in both the old and new AnimationList, since when a CSS transitions
3341         property is changed, a whole new transition is initiated. However, it's important to check that different Animation objects and styles would actually
3342         result in different timing properties and blending keyframes, so check for this as well before creating new CSSTransition objects.
3343         * animation/AnimationTimeline.h:
3344         (WebCore::AnimationTimeline::animations const): Change the m_animations type from HashSet to ListHashSet to guarantee we preserve the insertion order which is
3345         required by getAnimations().
3346         (WebCore::AnimationTimeline::hasElementAnimations const): Indicates to DocumentTimeline::updateAnimations() that there are animations targeting the provided element.
3347         (WebCore::AnimationTimeline::elementToAnimationsMap):
3348         (WebCore::AnimationTimeline::elementToCSSAnimationsMap):
3349         (WebCore::AnimationTimeline::elementToCSSTransitionsMap):
3350         * animation/CSSAnimation.cpp: CSSAnimation is now a subclass of DeclarativeAnimation and subclasses initialize() and syncPropertiesWithBackingAnimation()
3351         to perform work specific to CSS Animations.
3352         (WebCore::CSSAnimation::create): Set the animationName property based on the provided backing animation.
3353         (WebCore::CSSAnimation::CSSAnimation):
3354         (WebCore::CSSAnimation::initialize): Create the blending keyframes for this CSSAnimation.
3355         (WebCore::CSSAnimation::syncPropertiesWithBackingAnimation): Reflect the animation-fill-mode, animation-direction, animation-iteration-count and
3356         animation-play-state CSS properties on the AnimationEffectTimingReadOnly object associated with this CSSAnimation.
3357         * animation/CSSAnimation.h:
3358         * animation/CSSTransition.cpp: CSSTransition is now a subclass of DeclarativeAnimation.
3359         (WebCore::CSSTransition::create): Set the transitionProperty property based on the provided backing animation.
3360         (WebCore::CSSTransition::CSSTransition):
3361         (WebCore::CSSTransition::matchesBackingAnimationAndStyles const):
3362         (WebCore::CSSTransition::canBeListed const): Subclass this method such that we also check that we have blending keyframes for a CSSTransition to be
3363         listed by calls to getAnimations().
3364         * animation/CSSTransition.h:
3365         * animation/DeclarativeAnimation.cpp: Added. This new WebAnimation subclass now is the common base class for both CSSAnimation and CSSTransition.
3366         It establishes a relationship with a "backing animation", which is an Animation obtained from a style's AnimationList while resolving styles.
3367         These backing animations contain all of the parsed CSS styles related to CSS Animations and CSS Transitions and we use those to set matching properties
3368         of the Web Animations timing model in the new syncPropertiesWithBackingAnimation() virtual method, which subclasses can override to perform further
3369         work that is specific to a given declarative animation type. The initialize() method is called during create() methods to perform common animation
3370         setup work. Note that while both initialize() and syncPropertiesWithBackingAnimation() are called, we suspend invalidation to that animation's effect
3371         since these methods are meant to be called during style invalidation and we would hit an assertion if we followed the usual route of calling
3372         updateStyleIfNeeded() on the target's document during invalidation.
3373         (WebCore::DeclarativeAnimation::DeclarativeAnimation):
3374         (WebCore::DeclarativeAnimation::setBackingAnimation):
3375         (WebCore::DeclarativeAnimation::initialize): Create a KeyframeEffectReadOnly for this animation a