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