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