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