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