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