Unreviewed test fix after r226224.
[WebKit-https.git] / Source / WebCore / ChangeLog
1 2017-12-21  Brent Fulgham  <bfulgham@apple.com>
2
3         Unreviewed test fix after r226224.
4         <rdar://problem/36185975>
5
6         Pasteboard data is more than a dictionary. We have to whitelist NSString
7         and NSArray as well. Change method name to reflect that we take a whitelist
8         of classes that are allowed to be unarchived in the call.
9
10         * platform/ios/PlatformPasteboardIOS.mm:
11         (WebCore::PlatformPasteboard::write): Use revised method.
12         (WebCore::PlatformPasteboard::typesSafeForDOMToReadAndWrite const): Ditto.
13
14 2017-12-21  Zalan Bujtas  <zalan@apple.com>
15
16         [RenderTreeBuilder] Move RenderRubyAsInline::addChild mutation to a RenderTreeBuilder
17         https://bugs.webkit.org/show_bug.cgi?id=181101
18         <rdar://problem/36184788>
19
20         Reviewed by Antti Koivisto.
21
22         * rendering/RenderRuby.cpp:
23         (WebCore::isRubyBeforeBlock): Deleted.
24         (WebCore::isRubyAfterBlock): Deleted.
25         (WebCore::rubyBeforeBlock): Deleted.
26         (WebCore::rubyAfterBlock): Deleted.
27         (WebCore::createAnonymousRubyInlineBlock): Deleted.
28         (WebCore::lastRubyRun): Deleted.
29         (WebCore::RenderRubyAsInline::addChild): Deleted.
30         * rendering/RenderRuby.h:
31         * rendering/updating/RenderTreeBuilder.cpp:
32         (WebCore::RenderTreeBuilder::insertChild):
33         * rendering/updating/RenderTreeBuilderRuby.cpp:
34         (WebCore::RenderTreeBuilder::Ruby::findOrCreateParentForChild):
35         * rendering/updating/RenderTreeBuilderRuby.h:
36
37 2017-12-21  Jiewen Tan  <jiewen_tan@apple.com>
38
39         Update Credential Management API for WebAuthentication
40         https://bugs.webkit.org/show_bug.cgi?id=181082
41         <rdar://problem/36055239>
42
43         Reviewed by Daniel Bates.
44
45         Part 1/2
46
47         In this patch, it restructure a bit for existing Credential Management API codebase:
48         1. Rename the folder from credentials to credentialmanagement for better understanding.
49         2. Remove unneeded dummy codes, i.e. PasswordCredential and FederatedCredential.
50         3. Core API and layout tests are updated correspondingly as well.
51
52         Rebaseline test results.
53
54         * CMakeLists.txt:
55         * DerivedSources.make:
56         * Modules/credentialmanagement/BasicCredential.cpp: Renamed from Source/WebCore/Modules/credentials/BasicCredential.cpp.
57         (WebCore::BasicCredential::BasicCredential):
58         (WebCore::BasicCredential::type const):
59         * Modules/credentialmanagement/BasicCredential.h: Renamed from Source/WebCore/Modules/credentials/BasicCredential.h.
60         (WebCore::BasicCredential::id const):
61         * Modules/credentialmanagement/BasicCredential.idl: Renamed from Source/WebCore/Modules/credentials/BasicCredential.idl.
62         * Modules/credentialmanagement/CredentialCreationOptions.h: Renamed from Source/WebCore/Modules/credentials/CredentialData.h.
63         * Modules/credentialmanagement/CredentialCreationOptions.idl: Renamed from Source/WebCore/Modules/credentials/CredentialData.idl.
64         * Modules/credentialmanagement/CredentialRequestOptions.h: Renamed from Source/WebCore/Modules/credentials/CredentialRequestOptions.h.
65         * Modules/credentialmanagement/CredentialRequestOptions.idl: Renamed from Source/WebCore/Modules/credentials/CredentialRequestOptions.idl.
66         * Modules/credentialmanagement/CredentialsContainer.cpp: Renamed from Source/WebCore/Modules/credentials/CredentialsContainer.cpp.
67         (WebCore::CredentialsContainer::get):
68         (WebCore::CredentialsContainer::store):
69         (WebCore::CredentialsContainer::isCreate):
70         (WebCore::CredentialsContainer::preventSilentAccess):
71         * Modules/credentialmanagement/CredentialsContainer.h: Renamed from Source/WebCore/Modules/credentials/CredentialsContainer.h.
72         (WebCore::CredentialsContainer::create):
73         (WebCore::CredentialsContainer::CredentialsContainer):
74         * Modules/credentialmanagement/CredentialsContainer.idl: Renamed from Source/WebCore/Modules/credentials/CredentialsContainer.idl.
75         * Modules/credentialmanagement/NavigatorCredentials.cpp: Renamed from Source/WebCore/Modules/credentials/NavigatorCredentials.cpp.
76         (WebCore::NavigatorCredentials::supplementName):
77         (WebCore::NavigatorCredentials::credentials):
78         (WebCore::NavigatorCredentials::from):
79         * Modules/credentialmanagement/NavigatorCredentials.h: Renamed from Source/WebCore/Modules/credentials/NavigatorCredentials.h.
80         * Modules/credentialmanagement/NavigatorCredentials.idl: Renamed from Source/WebCore/Modules/credentials/NavigatorCredentials.idl.
81         * Modules/credentials/CredentialCreationOptions.h: Removed.
82         * Modules/credentials/CredentialCreationOptions.idl: Removed.
83         * Modules/credentials/CredentialUserData.h: Removed.
84         * Modules/credentials/CredentialUserData.idl: Removed.
85         * Modules/credentials/FederatedCredential.cpp: Removed.
86         * Modules/credentials/FederatedCredential.h: Removed.
87         * Modules/credentials/FederatedCredential.idl: Removed.
88         * Modules/credentials/FederatedCredentialInit.h: Removed.
89         * Modules/credentials/FederatedCredentialInit.idl: Removed.
90         * Modules/credentials/FederatedCredentialRequestOptions.h: Removed.
91         * Modules/credentials/FederatedCredentialRequestOptions.idl: Removed.
92         * Modules/credentials/PasswordCredential.cpp: Removed.
93         * Modules/credentials/PasswordCredential.h: Removed.
94         * Modules/credentials/PasswordCredential.idl: Removed.
95         * Modules/credentials/PasswordCredentialData.h: Removed.
96         * Modules/credentials/PasswordCredentialData.idl: Removed.
97         * Sources.txt:
98         * WebCore.xcodeproj/project.pbxproj:
99         * bindings/js/WebCoreBuiltinNames.h:
100
101 2017-12-21  John Wilander  <wilander@apple.com>
102
103         Storage Access API: Allow requests from non-sandboxed iframes
104         https://bugs.webkit.org/show_bug.cgi?id=181099
105         <rdar://problem/36184501>
106
107         Reviewed by Brent Fulgham.
108
109         No new tests. Changed existing tests.
110
111         * dom/Document.cpp:
112         (WebCore::Document::requestStorageAccess):
113
114 2017-12-21  Ryosuke Niwa  <rniwa@webkit.org>
115
116         Minor cleanup in WebContentReaderCocoa after r226213
117         https://bugs.webkit.org/show_bug.cgi?id=181104
118
119         Reviewed by Wenson Hsieh.
120
121         Deployed early exists in the case of attachment replacements to make the code easier to read.
122
123         * editing/cocoa/WebContentReaderCocoa.mm:
124         (WebCore::createFragmentAndAddResources):
125         (WebCore::markupForFragmentInDocument): Extracted out of sanitizeMarkupWithArchive.
126         (WebCore::sanitizeMarkupWithArchive):
127         (WebCore::WebContentReader::readImage): Simplified the return logic.
128
129 2017-12-21  Zalan Bujtas  <zalan@apple.com>
130
131         [RenderTreeBuilder] Move RenderRubyAsBlock::addChild mutation to a RenderTreeBuilder
132         https://bugs.webkit.org/show_bug.cgi?id=181090
133         <rdar://problem/36180916>
134
135         Reviewed by Antti Koivisto.
136
137         This is in preparation for moving all ruby mutation code here.
138
139         Covered by existing tests.
140
141         * rendering/RenderRuby.cpp:
142         (WebCore::RenderRubyAsBlock::addChild): Deleted.
143         * rendering/RenderRuby.h:
144         * rendering/updating/RenderTreeBuilder.cpp:
145         (WebCore::RenderTreeBuilder::insertChild):
146         * rendering/updating/RenderTreeBuilderRuby.cpp:
147         (WebCore::isAnonymousRubyInlineBlock):
148         (WebCore::isRubyBeforeBlock):
149         (WebCore::isRubyAfterBlock):
150         (WebCore::isRubyChildForNormalRemoval):
151         (WebCore::rubyBeforeBlock):
152         (WebCore::rubyAfterBlock):
153         (WebCore::createAnonymousRubyInlineBlock):
154         (WebCore::lastRubyRun):
155         (WebCore::RenderTreeBuilder::Ruby::findOrCreateParentForChild):
156         * rendering/updating/RenderTreeBuilderRuby.h:
157
158 2017-12-21  Jeremy Jones  <jeremyj@apple.com>
159
160         Update FULLSCREEN_API feature defines.
161         https://bugs.webkit.org/show_bug.cgi?id=181015
162
163         Reviewed by Tim Horton.
164
165         Change enabled iphone sdk for FULLSCREEN_API.
166
167         * Configurations/FeatureDefines.xcconfig:
168
169 2017-12-21  Chris Dumez  <cdumez@apple.com>
170
171         ononline, onoffline and navigator.onLine don't work if Parallels or VMWare is installed
172         https://bugs.webkit.org/show_bug.cgi?id=32327
173
174         Reviewed by Alexey Proskuryakov.
175
176         When determining if we are online, ignore virtual interfaces added on the host machine
177         by Parallels and VMWare. This is needed because those interfaces are always up, whether
178         or not the virtual machine is running. This was causing navigator.onLine to always return
179         true on the host machine when Parallels or VMWare was installed.
180
181         Note that it is safe to ignore these interfaces and that it does not cause issues when
182         running Safari inside the virtual machine because those virtual interfaces are only
183         exposed on the host machine. Inside, the virtual machine, we see the usual en0 interface.
184
185         * platform/network/mac/NetworkStateNotifierMac.cpp:
186         (WebCore::NetworkStateNotifier::updateStateWithoutNotifying):
187
188 2017-12-21  Zalan Bujtas  <zalan@apple.com>
189
190         [RenderTreeBuilder] Move repeating code to RenderTreeBuilder::insertInternal
191         https://bugs.webkit.org/show_bug.cgi?id=181094
192
193         Reviewed by Antti Koivisto.
194
195         * rendering/updating/RenderTreeBuilder.cpp:
196         (WebCore::RenderTreeBuilder::insertChild):
197
198 2017-12-21  Jeremy Jones  <jeremyj@apple.com>
199
200         Build fix after r226223
201         https://bugs.webkit.org/show_bug.cgi?id=181088
202
203         Unreviewed.
204
205         * platform/ios/VideoFullscreenInterfaceAVKit.mm:
206         (VideoFullscreenInterfaceAVKit::exitFullscreen):
207
208 2017-12-21  John Wilander  <wilander@apple.com>
209
210         Storage Access API: Make DocumentLoader::willSendRequest() and WebFrameLoaderClient::detachedFromParent2() tell the network process to get rid of any sub frame access entries
211         https://bugs.webkit.org/show_bug.cgi?id=180728
212         <rdar://problem/36009288>
213
214         Reviewed by Youenn Fablet.
215
216         Tests: http/tests/storageAccess/request-and-grant-access-then-detach-should-not-have-access.html
217                http/tests/storageAccess/request-and-grant-access-then-navigate-should-not-have-access.html
218
219         This change calls the network process to clear any storage access
220         entries when a subframe navigates or is detached.
221
222         * dom/Document.cpp:
223         (WebCore::Document::hasStorageAccess):
224         (WebCore::Document::requestStorageAccess):
225         (WebCore::Document::hasFrameSpecificStorageAccess):
226         (WebCore::Document::setHasFrameSpecificStorageAccess):
227         * dom/Document.h:
228         * loader/DocumentLoader.cpp:
229         (WebCore::DocumentLoader::willSendRequest):
230         * loader/EmptyFrameLoaderClient.h:
231         * loader/FrameLoaderClient.h:
232         * platform/network/NetworkStorageSession.h:
233         * platform/network/cf/NetworkStorageSessionCFNet.cpp:
234         (WebCore::NetworkStorageSession::removeStorageAccess):
235
236 2017-12-21  Antoine Quint  <graouts@apple.com>
237
238         [Web Animations] Complete support for keyframe animations
239         https://bugs.webkit.org/show_bug.cgi?id=179708
240
241         Reviewed by Dean Jackson.
242
243         We implement section 5.10.3 "Processing a keyframes argument" of the Web Animations spec to handle
244         multiple keyframes, rather than only two, provided either in iterable (ie. array) or property-index
245         (ie. dictionary) form. Although we don't currently support timing function or composite operations,
246         we parse them as well.
247
248         While there are minimal test changes, there will be a host of changes in the next patch in which
249         we turn Element.animate() on.
250
251         * animation/KeyframeEffect.cpp:
252         (WebCore::IDLAttributeNameToAnimationPropertyName): New utility to convert an IDL-parsed JS property
253         into a WebCore CSSPropertyID.
254         (WebCore::computeMissingKeyframeOffsets): Converts "null" offsets into computed offset values as specified
255         in section 4.4.2. "Calculating computed keyframes".
256         (WebCore::processIterableKeyframes): Process the iterable form of the keyframes argument.
257         (WebCore::processKeyframeLikeObject): Process a keyframe-like object found in the property-indexed form.
258         (WebCore::processPropertyIndexedKeyframes): Process the property-indexed form of the keyframes argument.
259         (WebCore::KeyframeEffect::setKeyframes): Since this method and processKeyframes() share the same signature,
260         we can just return the value from processKeyframes() directly.
261         (WebCore::KeyframeEffect::processKeyframes): Process the keyframes argument as specified.
262         (WebCore::KeyframeEffect::applyAtLocalTime): Delegate blending to the new setAnimatedPropertiesInStyle()
263         since this task is now more complex due to handling of multiple keyframes.
264         (WebCore::KeyframeEffect::getAnimatedStyle): Delegate blending to the new setAnimatedPropertiesInStyle()
265         since this task is now more complex due to handling of multiple keyframes.
266         (WebCore::KeyframeEffect::setAnimatedPropertiesInStyle): Handle multiple and implicit start and end keyframes.
267         * animation/KeyframeEffect.h: Add some new structures used for parsing purposes.
268         * animation/KeyframeEffect.idl: Expose the CompositeOperation enum and the BasePropertyIndexedKeyframe dictionary
269         used in processKeyframeLikeObject().
270         * css/CSSStyleDeclaration.cpp:
271         (WebCore::CSSStyleDeclaration::getCSSPropertyIDFromJavaScriptPropertyName):
272         * css/CSSStyleDeclaration.h:
273         * page/animation/CSSPropertyAnimation.cpp:
274         (WebCore::CSSPropertyAnimation::isPropertyAnimatable):
275         * page/animation/CSSPropertyAnimation.h:
276
277 2017-12-21  Jer Noble  <jer.noble@apple.com>
278
279         Add initial DOM support for Media Capabilities
280         https://bugs.webkit.org/show_bug.cgi?id=181064
281
282         Reviewed by Eric Carlson.
283
284         Test: media/mediacapabilities/mediacapabilities-types.html
285
286         Add basic, cross-platform, DOM facing type and API support for Media Capabilities API.
287
288         * bindings/scripts/CodeGenerator.pm:
289         (WK_ucfirst):
290         * CMakeLists.txt:
291         * DerivedSources.make:
292         * Modules/mediacapabilities/AudioConfiguration.h: Added.
293         * Modules/mediacapabilities/AudioConfiguration.idl: Added.
294         * Modules/mediacapabilities/MediaCapabilities.cpp: Added.
295         (WebCore::bucketMIMETypes):
296         (WebCore::isValidMIMEType):
297         (WebCore::isValidVideoConfiguration):
298         (WebCore::isValidAudioConfiguration):
299         (WebCore::isValidMediaConfiguration):
300         (WebCore::MediaCapabilities::decodingInfo):
301         (WebCore::MediaCapabilities::encodingInfo):
302         * Modules/mediacapabilities/MediaCapabilities.h: Added.
303         * Modules/mediacapabilities/MediaCapabilities.idl: Added.
304         * Modules/mediacapabilities/MediaCapabilitiesInfo.h: Added.
305         (WebCore::MediaCapabilitiesInfo::supported const):
306         (WebCore::MediaCapabilitiesInfo::setSupported):
307         (WebCore::MediaCapabilitiesInfo::smooth const):
308         (WebCore::MediaCapabilitiesInfo::setSmooth):
309         (WebCore::MediaCapabilitiesInfo::powerEfficient const):
310         (WebCore::MediaCapabilitiesInfo::setPowerEfficient):
311         * Modules/mediacapabilities/MediaCapabilitiesInfo.idl: Added.
312         * Modules/mediacapabilities/MediaConfiguration.h: Added.
313         * Modules/mediacapabilities/MediaConfiguration.idl: Added.
314         * Modules/mediacapabilities/MediaDecodingConfiguration.h: Added.
315         * Modules/mediacapabilities/MediaDecodingConfiguration.idl: Added.
316         * Modules/mediacapabilities/MediaDecodingType.h: Added.
317         * Modules/mediacapabilities/MediaDecodingType.idl: Added.
318         * Modules/mediacapabilities/MediaEncodingConfiguration.h: Added.
319         * Modules/mediacapabilities/MediaEncodingConfiguration.idl: Added.
320         * Modules/mediacapabilities/MediaEncodingType.h: Added.
321         * Modules/mediacapabilities/MediaEncodingType.idl: Added.
322         * Modules/mediacapabilities/NavigatorMediaCapabilities.cpp: Added.
323         (WebCore::NavigatorMediaCapabilities::NavigatorMediaCapabilities):
324         (WebCore::NavigatorMediaCapabilities::supplementName):
325         (WebCore::NavigatorMediaCapabilities::from):
326         (WebCore::NavigatorMediaCapabilities::mediaCapabilities):
327         (WebCore::NavigatorMediaCapabilities::mediaCapabilities const):
328         * Modules/mediacapabilities/NavigatorMediaCapabilities.h: Added.
329         * Modules/mediacapabilities/NavigatorMediaCapabilities.idl: Added.
330         * Modules/mediacapabilities/ScreenColorGamut.h: Added.
331         * Modules/mediacapabilities/ScreenColorGamut.idl: Added.
332         * Modules/mediacapabilities/ScreenLuminance.h: Added.
333         (WebCore::ScreenLuminance::min const):
334         (WebCore::ScreenLuminance::setMin):
335         (WebCore::ScreenLuminance::max const):
336         (WebCore::ScreenLuminance::setMax):
337         (WebCore::ScreenLuminance::maxAverage const):
338         (WebCore::ScreenLuminance::setMaxAverage):
339         * Modules/mediacapabilities/ScreenLuminance.idl: Added.
340         * Modules/mediacapabilities/VideoConfiguration.h: Added.
341         * Modules/mediacapabilities/VideoConfiguration.idl: Added.
342         * Sources.txt:
343         * WebCore.xcodeproj/project.pbxproj:
344         * bindings/js/WebCoreBuiltinNames.h:
345         * page/RuntimeEnabledFeatures.h:
346         (WebCore::RuntimeEnabledFeatures::setMediaCapabilitiesEnabled):
347         (WebCore::RuntimeEnabledFeatures::mediaCapabilitiesEnabled const):
348         * page/Settings.yaml:
349
350 2017-12-21  Keith Rollin  <krollin@apple.com>
351
352         Add optional logging of per-resource cookie information
353         https://bugs.webkit.org/show_bug.cgi?id=180883
354         <rdar://problem/35802295>
355
356         Reviewed by Brent Fulgham.
357
358         In order to support the tracking of the efficacy of Intelligent
359         Tracking Protection, add some logging of the cookie information
360         associated with each loaded resource. This logging is off by default
361         and is enabled with `defaults write -g WebKitLogCookieInformation
362         -bool true`.
363
364         No new tests -- no new user functionality added. Only new logging has
365         been added.
366
367         * platform/Cookie.h:
368         (WebCore::Cookie::Cookie):
369         (WebCore::Cookie::isNull const):
370         (WebCore::Cookie::encode const):
371         (WebCore::Cookie::decode):
372         * platform/network/cf/CookieJarCFNet.cpp:
373         (WebCore::canonicalCookieTime):
374         (WebCore::cookieCreatedTime):
375         (WebCore::cookieExpirationTime):
376         (WebCore::getRawCookies):
377         * platform/network/cocoa/CookieCocoa.mm:
378         (WebCore::cookieCreated):
379         (WebCore::Cookie::Cookie):
380         * platform/network/soup/CookieJarSoup.cpp:
381         (WebCore::getRawCookies):
382
383 2017-12-21  Brent Fulgham  <bfulgham@apple.com>
384
385         Adopt new secure coding APIs in WebCore
386         https://bugs.webkit.org/show_bug.cgi?id=178484
387         <rdar://problem/34837193>
388
389         Reviewed by Eric Carlson.
390
391         Switch to new NSKeyed[Un]Archiver methods that use NSSecureCoding by default.
392
393         Most of the new API is wrapped in a set of convenience methods so we can
394         build without the new API on older systems.
395
396         No change in behavior.
397
398         * editing/cocoa/EditorCocoa.mm:
399         (WebCore::archivedDataForAttributedString): Use new convenience method
400         to archive the string object.
401         * platform/ios/PlatformPasteboardIOS.mm:
402         (WebCore::PlatformPasteboard::write): Use new secure API.
403         (WebCore::PlatformPasteboard::typesSafeForDOMToReadAndWrite const): Ditto.
404
405 2017-12-21  Zalan Bujtas  <zalan@apple.com>
406
407         [RenderTreeBuilder] Move ruby mutation code to a dedicated class.
408         https://bugs.webkit.org/show_bug.cgi?id=181066
409         <rdar://problem/36167692>
410
411         Reviewed by Antti Koivisto.
412
413         This is in preparation for moving all ruby mutation code here.
414
415         No change in functionality.
416
417         * Sources.txt:
418         * WebCore.xcodeproj/project.pbxproj:
419         * rendering/updating/RenderTreeBuilder.cpp:
420         (WebCore::RenderTreeBuilder::insertChild):
421         (WebCore::RenderTreeBuilder::rubyRunInsertChild): Deleted.
422         * rendering/updating/RenderTreeBuilder.h:
423         (WebCore::RenderTreeBuilder::rubyBuilder):
424         * rendering/updating/RenderTreeBuilderRuby.cpp: Added.
425         (WebCore::RenderTreeBuilder::Ruby::Ruby):
426         (WebCore::RenderTreeBuilder::Ruby::insertChild):
427         * rendering/updating/RenderTreeBuilderRuby.h: Copied from Source/WebCore/rendering/updating/RenderTreeBuilder.h.
428
429 2017-12-21  Ms2ger  <Ms2ger@igalia.com>
430
431         Replace a FIXME comment in CanvasGradient::addColorStop().
432         https://bugs.webkit.org/show_bug.cgi?id=181034
433
434         Reviewed by Daniel Bates.
435
436         Tests: LayoutTests/imported/w3c/canvas/2d.gradient.object.current.html
437
438         * html/canvas/CanvasGradient.cpp:
439         (WebCore::CanvasGradient::addColorStop):
440
441 2017-12-21  Jeremy Jones  <jeremyj@apple.com>
442
443         Enable picture-in-picture from inline element on suspend.
444         https://bugs.webkit.org/show_bug.cgi?id=180942
445         rdar://problem/34745234
446
447         Reviewed by Jer Noble.
448
449         When a element goes into element fullscreen mode, a descendant video element gains the ability to automatically enter picture-in-picture on application suspend.
450
451         This adds support for video fullscreen standby mode, which creates a VideoFullscreenInterfaceAVKit so that it can
452         trigger auto-pip on application suspend while the element is not actually presenting in video fullscreen mode.
453
454         VideoFullscreenInterfaceAVKit has a new state transition system that will replace the existing one to enable the increased
455         number and complexity of state transitions. Until we are ready to completely commit to this new code path, this implementation is
456         conditionalized to keep the existing code path working.
457
458         * html/HTMLMediaElement.cpp:
459         (WebCore::HTMLMediaElement::enterFullscreen):
460         (WebCore::HTMLMediaElement::exitFullscreen):
461         (WebCore::HTMLMediaElement::setVideoFullscreenStandby):
462         (WebCore::HTMLMediaElement::shouldOverrideBackgroundPlaybackRestriction const):
463         * html/HTMLMediaElement.h:
464         * page/ChromeClient.h:
465         * platform/cocoa/VideoFullscreenChangeObserver.h:
466         * platform/ios/VideoFullscreenInterfaceAVKit.h:
467         * platform/ios/VideoFullscreenInterfaceAVKit.mm:
468         (-[WebAVPlayerViewControllerDelegate playerViewControllerShouldStartPictureInPictureFromInlineWhenEnteringBackground:]):
469         (-[WebAVPlayerLayer layoutSublayers]):
470         (allocWebAVPictureInPicturePlayerLayerViewInstance):
471         (allocWebAVPlayerLayerViewInstance):
472         (VideoFullscreenInterfaceAVKit::applicationDidBecomeActive):
473         (VideoFullscreenInterfaceAVKit::setupFullscreen):
474         (VideoFullscreenInterfaceAVKit::enterFullscreen):
475         (VideoFullscreenInterfaceAVKit::exitFullscreen):
476         (VideoFullscreenInterfaceAVKit::cleanupFullscreen):
477         (VideoFullscreenInterfaceAVKit::requestHideAndExitFullscreen):
478         (VideoFullscreenInterfaceAVKit::preparedToReturnToInline):
479         (VideoFullscreenInterfaceAVKit::mayAutomaticallyShowVideoPictureInPicture const):
480         (VideoFullscreenInterfaceAVKit::willStartPictureInPicture):
481         (VideoFullscreenInterfaceAVKit::didStartPictureInPicture):
482         (VideoFullscreenInterfaceAVKit::failedToStartPictureInPicture):
483         (VideoFullscreenInterfaceAVKit::willStopPictureInPicture):
484         (VideoFullscreenInterfaceAVKit::didStopPictureInPicture):
485         (VideoFullscreenInterfaceAVKit::prepareForPictureInPictureStopWithCompletionHandler):
486         (VideoFullscreenInterfaceAVKit::shouldExitFullscreenWithReason):
487         (VideoFullscreenInterfaceAVKit::setMode):
488         (VideoFullscreenInterfaceAVKit::clearMode):
489         (VideoFullscreenInterfaceAVKit::setHasVideoContentLayer):
490         (VideoFullscreenInterfaceAVKit::setInlineRect):
491         (VideoFullscreenInterfaceAVKit::doSetup):
492         (VideoFullscreenInterfaceAVKit::finalizeSetup):
493         (VideoFullscreenInterfaceAVKit::doEnterFullscreen):
494         (VideoFullscreenInterfaceAVKit::doExitFullscreen):
495         (VideoFullscreenInterfaceAVKit::exitFullscreenHandler):
496         (VideoFullscreenInterfaceAVKit::enterFullscreenHandler):
497         (VideoFullscreenInterfaceAVKit::returnToStandby):
498         * platform/ios/WebVideoFullscreenControllerAVKit.mm:
499         (VideoFullscreenControllerContext::requestUpdateInlineRect):
500         (VideoFullscreenControllerContext::requestVideoContentLayer):
501         (VideoFullscreenControllerContext::returnVideoContentLayer):
502         (VideoFullscreenControllerContext::didSetupFullscreen):
503         (VideoFullscreenControllerContext::didExitFullscreen):
504         (VideoFullscreenControllerContext::setUpFullscreen):
505
506 2017-12-20  Ryosuke Niwa  <rniwa@webkit.org>
507
508         DeferredLoadingScope incorrectly disabled images or enables deferred loading
509         https://bugs.webkit.org/show_bug.cgi?id=181077
510
511         Reviewed by Wenson Hsieh.
512
513         Fixed the bug that DeferredLoadingScope::~DeferredLoadingScope was checking the wrong flag
514         for restoring the disabledness of images and deferred loading.
515
516         Test: editing/pasteboard/pasting-with-images-disabled-should-not-enable-deferred-loading.html
517
518         * editing/cocoa/WebContentReaderCocoa.mm:
519         (WebCore::DeferredLoadingScope::~DeferredLoadingScope): Fixed the bug.
520         * testing/Internals.cpp:
521         (WebCore::Internals::pageDefersLoading): Added for testing.
522         * testing/Internals.h:
523         * testing/Internals.idl: Added pageDefersLoading.
524
525 2017-12-20  Ryosuke Niwa  <rniwa@webkit.org>
526
527         isSafari check should take Safari Technology Preview into account
528         https://bugs.webkit.org/show_bug.cgi?id=181076
529
530         Reviewed by Alex Christensen.
531
532         Fixed isSafari() so that it returns true for Safari Technology Preview. This bug resulted in the custom pasteboard
533         types not being enabled in Safari Technology Preview. In long term, we should eliminate these isSafari() checks.
534
535         * platform/cocoa/RuntimeApplicationChecksCocoa.mm:
536         (WebCore::MacApplication::isSafari):
537
538 2017-12-20  Wenson Hsieh  <wenson_hsieh@apple.com>
539
540         [Attachment Support] Attachment replacement logic should not depend on subresource URL attribute replacement
541         https://bugs.webkit.org/show_bug.cgi?id=181068
542         <rdar://problem/36168313>
543
544         Reviewed by Ryosuke Niwa.
545
546         Refactors attachment replacement logic, so that it doesn't require us to first replace element attributes that
547         contain subresource URLs with blob URLs before performing attachment element replacement. See below comments for
548         more detail.
549
550         Covered by existing API tests in WKAttachmentTests.
551
552         * editing/WebContentReader.h:
553         (WebCore::BlobReplacementInfo::isEmpty const): Deleted.
554
555         Remove BlobReplacementInfo. Instead, augment `replaceRichContentWithAttachments` so that it takes in the list of
556         subresources directly and generates blobs for each subresource.
557
558         * editing/cocoa/EditorCocoa.mm:
559         (WebCore::Editor::replaceSelectionWithAttributedString):
560         * editing/cocoa/WebContentReaderCocoa.mm:
561         (WebCore::shouldReplaceRichContentWithAttachments):
562         (WebCore::createFragmentForImageAttachment):
563         (WebCore::replaceRichContentWithAttachments):
564         (WebCore::createFragmentAndAddResources):
565         (WebCore::sanitizeMarkupWithArchive):
566
567         In these helper functions that currently convert subresource URLs to blob URLs, if attachment elements are not
568         defined out, and the runtime feature for attachment elements is enabled, then use an alternate codepath to
569         adjust the markup (via replaceRichContentWithAttachments).
570
571         Otherwise, fall back to default subresource URL conversion logic, which (at the moment) still converts
572         subresources to blobs, but will soon be changed to emit data URLs instead.
573
574         (WebCore::WebContentReader::readWebArchive):
575         (WebCore::WebContentMarkupReader::readWebArchive):
576         (WebCore::WebContentReader::readRTFD):
577         (WebCore::WebContentMarkupReader::readRTFD):
578         (WebCore::WebContentReader::readRTF):
579         (WebCore::WebContentMarkupReader::readRTF):
580         (WebCore::WebContentReader::readImage):
581
582         Remove the createFragmentFromAttributedString helper and revert to just calling createFragmentAndAddResources.
583
584         (WebCore::createFragmentFromAttributedString): Deleted.
585
586 2017-12-20  Eric Carlson  <eric.carlson@apple.com>
587
588         [MediaStream] Add screen capture IDL and stub functions
589         https://bugs.webkit.org/show_bug.cgi?id=181070
590         <rdar://problem/35555184>
591
592         Reviewed by Youenn Fablet.
593
594         Tests: fast/mediastream/screencapture-disabled.html
595                fast/mediastream/screencapture-enabled.html
596
597         * Modules/mediastream/MediaDevices.cpp:
598         (WebCore::MediaDevices::getDisplayMedia const):
599         (WebCore::MediaDevices::getSupportedConstraints):
600         * Modules/mediastream/MediaDevices.h:
601         * Modules/mediastream/MediaDevices.idl:
602         * Modules/mediastream/MediaTrackConstraints.cpp:
603         (WebCore::convertToInternalForm):
604         * Modules/mediastream/MediaTrackConstraints.h:
605         * Modules/mediastream/MediaTrackConstraints.idl:
606         * Modules/mediastream/MediaTrackSupportedConstraints.h:
607         * Modules/mediastream/MediaTrackSupportedConstraints.idl:
608         * Modules/mediastream/UserMediaRequest.cpp:
609         (WebCore::UserMediaRequest::start):
610         (WebCore::UserMediaRequest::allow):
611         (WebCore::UserMediaRequest::deny):
612         * Modules/mediastream/UserMediaRequest.h:
613         * page/RuntimeEnabledFeatures.h:
614         (WebCore::RuntimeEnabledFeatures::screenCaptureEnabled const):
615         (WebCore::RuntimeEnabledFeatures::setScreenCaptureEnabled):
616         * platform/mediastream/CaptureDevice.h:
617         * platform/mediastream/MediaConstraints.cpp:
618         (WebCore::MediaTrackConstraintSetMap::set):
619         * platform/mediastream/MediaConstraints.h:
620         (WebCore::MediaTrackConstraintSetMap::displaySurface const):
621         (WebCore::MediaTrackConstraintSetMap::logicalSurface const):
622         (WebCore::MediaTrackConstraintSetMap::encode const):
623         (WebCore::MediaTrackConstraintSetMap::decode):
624         * platform/mediastream/MediaStreamRequest.h:
625         * platform/mediastream/RealtimeMediaSource.cpp:
626         (WebCore::RealtimeMediaSource::fitnessDistance):
627         (WebCore::RealtimeMediaSource::applyConstraint):
628         (WebCore::RealtimeMediaSource::supportsConstraint const):
629         * platform/mediastream/RealtimeMediaSourceCenter.cpp:
630         (WebCore::RealtimeMediaSourceCenter::validateRequestConstraints):
631         (WebCore::RealtimeMediaSourceCenter::captureDeviceWithPersistentID):
632         * platform/mediastream/RealtimeMediaSourceSettings.h:
633         (WebCore::RealtimeMediaSourceSettings::supportsDisplaySurface const):
634         (WebCore::RealtimeMediaSourceSettings::displaySurface const):
635         (WebCore::RealtimeMediaSourceSettings::setDisplaySurface):
636         (WebCore::RealtimeMediaSourceSettings::supportsLogicalSurface const):
637         (WebCore::RealtimeMediaSourceSettings::logicalSurface const):
638         (WebCore::RealtimeMediaSourceSettings::setLogicalSurface):
639         * platform/mediastream/RealtimeMediaSourceSupportedConstraints.cpp:
640         (WebCore::RealtimeMediaSourceSupportedConstraints::supportsConstraint const):
641         * platform/mediastream/RealtimeMediaSourceSupportedConstraints.h:
642         (WebCore::RealtimeMediaSourceSupportedConstraints::supportsDisplaySurface const):
643         (WebCore::RealtimeMediaSourceSupportedConstraints::setSupportsDisplaySurface):
644         (WebCore::RealtimeMediaSourceSupportedConstraints::supportsLogicalSurface const):
645         (WebCore::RealtimeMediaSourceSupportedConstraints::setSupportsLogicalSurface):
646         (WebCore::RealtimeMediaSourceSupportedConstraints::encode const):
647         (WebCore::RealtimeMediaSourceSupportedConstraints::decode):
648         * platform/mediastream/mac/RealtimeMediaSourceCenterMac.cpp:
649         * platform/mock/MockRealtimeVideoSource.cpp:
650         * testing/InternalSettings.cpp:
651         (WebCore::InternalSettings::Backup::Backup):
652         (WebCore::InternalSettings::Backup::restoreTo):
653         (WebCore::InternalSettings::setScreenCaptureEnabled):
654         * testing/InternalSettings.h:
655         * testing/InternalSettings.idl:
656
657 2017-12-20  Matt Lewis  <jlewis3@apple.com>
658
659         Unreviewed, rolling out r225656.
660
661         The test has been a flaky timout since being added.
662
663         Reverted changeset:
664
665         "WebAssembly: sending module to iframe fails"
666         https://bugs.webkit.org/show_bug.cgi?id=179263
667         https://trac.webkit.org/changeset/225656
668
669 2017-12-20  Don Olmstead  <don.olmstead@sony.com>
670
671         [Win] Use WCharStringExtras functions in WebCore
672         https://bugs.webkit.org/show_bug.cgi?id=180963
673
674         Reviewed by Alex Christensen.
675
676         No new tests. No change in behavior.
677
678         * platform/graphics/win/FontCacheWin.cpp:
679         (WebCore::appendLinkedFonts):
680         (WebCore::getLinkedFonts):
681         (WebCore::FontCache::systemFallbackForCharacters):
682         (WebCore::FontCache::fontFromDescriptionAndLogFont):
683         * platform/graphics/win/FontCustomPlatformDataCairo.cpp:
684         (WebCore::FontCustomPlatformData::fontPlatformData):
685         * platform/graphics/win/IconWin.cpp:
686         (WebCore::Icon::createIconForFiles):
687         * platform/network/win/DownloadBundleWin.cpp:
688         (WebCore::DownloadBundle::appendResumeData):
689         (WebCore::DownloadBundle::extractResumeData):
690         * platform/text/win/LocaleWin.cpp:
691         (WebCore::LCIDFromLocaleInternal):
692         (WebCore::LCIDFromLocale):
693         * platform/win/ClipboardUtilitiesWin.cpp:
694         (WebCore::getWebLocData):
695         (WebCore::createGlobalData):
696         (WebCore::getFileDescriptorData):
697         (WebCore::getURL):
698         (WebCore::getCFData):
699         (WebCore::setCFData):
700         * platform/win/DragDataWin.cpp:
701         (WebCore::DragData::asFilenames const):
702         * platform/win/DragImageWin.cpp:
703         (WebCore::createDragImageIconForCachedImageFilename):
704         (WebCore::dragLabelFont):
705         * platform/win/FileSystemWin.cpp:
706         (WebCore::FileSystem::getFindData):
707         (WebCore::FileSystem::createSymbolicLink):
708         (WebCore::FileSystem::deleteFile):
709         (WebCore::FileSystem::deleteEmptyDirectory):
710         (WebCore::FileSystem::moveFile):
711         (WebCore::FileSystem::pathByAppendingComponent):
712         (WebCore::FileSystem::makeAllDirectories):
713         (WebCore::FileSystem::pathGetFileName):
714         (WebCore::FileSystem::openTemporaryFile):
715         (WebCore::FileSystem::openFile):
716         (WebCore::FileSystem::hardLinkOrCopyFile):
717         * platform/win/MIMETypeRegistryWin.cpp:
718         (WebCore::mimeTypeForExtension):
719         (WebCore::MIMETypeRegistry::getPreferredExtensionForMIMEType):
720         * platform/win/PasteboardWin.cpp:
721         (WebCore::Pasteboard::read):
722         (WebCore::createGlobalHDropContent):
723         * platform/win/PathWalker.cpp:
724         (WebCore::PathWalker::PathWalker):
725         * platform/win/SSLKeyGeneratorWin.cpp:
726         (WebCore::WebCore::signedPublicKeyAndChallengeString):
727         * platform/win/SharedBufferWin.cpp:
728         (WebCore::SharedBuffer::createFromReadingFile):
729         * rendering/RenderThemeWin.cpp:
730         (WebCore::fillFontDescription):
731
732 2017-12-20  Youenn Fablet  <youenn@apple.com>
733
734         com.apple.WebKit.WebContent.Development crashed in com.apple.WebCore: WebCore::UserMediaRequest::stop + 126
735         https://bugs.webkit.org/show_bug.cgi?id=181057
736
737         Reviewed by Eric Carlson.
738
739         Covered by fast/mediastream tests to not crash anymore.
740
741         * Modules/mediastream/UserMediaRequest.cpp:
742         (WebCore::UserMediaRequest::stop):
743
744 2017-12-20  Brady Eidson  <beidson@apple.com>
745
746         Assertion failure in MessagePort::contextDestroyed in http/tests/security/MessagePort/event-listener-context.html, usually attributed to later tests.
747         https://bugs.webkit.org/show_bug.cgi?id=94458
748
749         Reviewed by Chris Dumez.
750
751         No new tests (Changed existing test to reliably crash before this change, and work after it)
752
753         There was already a glaring FIXME that said "MessagePorts should be ActiveDOMObjects"
754         
755         It was right, and it fixes up this subtle lifetime issue.
756         
757         * dom/MessagePort.cpp:
758         (WebCore::MessagePort::MessagePort):
759         (WebCore::MessagePort::hasPendingActivity const):
760         (WebCore::MessagePort::locallyEntangledPort const):
761         (WebCore::MessagePort::activeDOMObjectName const):
762         (WebCore::MessagePort::hasPendingActivity): Deleted.
763         (WebCore::MessagePort::locallyEntangledPort): Deleted.
764         * dom/MessagePort.h:
765
766         * dom/ScriptExecutionContext.cpp:
767         (WebCore::ScriptExecutionContext::~ScriptExecutionContext):
768         (WebCore::ScriptExecutionContext::stopActiveDOMObjects):
769         (WebCore::ScriptExecutionContext::hasPendingActivity const):
770
771 2017-12-20  Youenn Fablet  <youenn@apple.com>
772
773         Do not search for service worker registration in case of non HTTP navigation loads
774         https://bugs.webkit.org/show_bug.cgi?id=180976
775         <rdar://problem/36157322>
776
777         Unreviewed.
778
779         * loader/DocumentLoader.cpp:
780         (WebCore::DocumentLoader::startLoadingMainResource): Removing unneeded spaces.
781
782 2017-12-20  Alex Christensen  <achristensen@webkit.org>
783
784         Remove some SVN files accidentally committed with r226160
785         https://bugs.webkit.org/show_bug.cgi?id=180934
786
787         * WebCore.xcodeproj/project.pbxproj.orig: Removed.
788         * WebCore.xcodeproj/project.pbxproj.rej: Removed.
789
790 2017-12-20  Zalan Bujtas  <zalan@apple.com>
791
792         [RenderTreeBuilder] Replace remaining addChild calls with RenderTreeBuilder::insert
793         https://bugs.webkit.org/show_bug.cgi?id=181044
794         <rdar://problem/36157613>
795
796         Reviewed by Antti Koivisto.
797
798         Covered by existing test cases.
799
800         * rendering/RenderBlock.cpp:
801         (WebCore::RenderBlock::addChildIgnoringContinuation):
802         * rendering/RenderElement.cpp:
803         (WebCore::RenderElement::addChildIgnoringContinuation):
804         * rendering/RenderElement.h:
805         (WebCore::RenderElement::addChildIgnoringContinuation): Deleted.
806
807 2017-12-20  Daniel Bates  <dabates@apple.com>
808
809         Cleanup: Dereference value of optional directly instead of using checked value in WebCore::subdivide()
810         https://bugs.webkit.org/show_bug.cgi?id=181050
811
812         Reviewed by Simon Fraser.
813
814         It is sufficient and more efficient to dereference a std::optional directly when we know that it has
815         a value as opposed to using the checked dereference member function std::optional<>::value().
816
817         No functionality changed. So, no new tests.
818
819         * rendering/MarkerSubrange.cpp:
820         (WebCore::subdivide):
821
822 2017-12-20  Daniel Bates  <dabates@apple.com>
823
824         MarkerSubrange.SubdivideGrammarAndSelectionOverlap{Frontmost, FrontmostWithLongestEffectiveRange} are failing
825         https://bugs.webkit.org/show_bug.cgi?id=181014
826
827         Reviewed by Simon Fraser.
828
829         Fixes an issue in the subdivision algorithm where the returned subranges may not be paint order
830         or reverse paint order when using the default overlap strategy (OverlapStrategy::None) and
831         either OverlapStrategy::Frontmost or OverlapStrategy::FrontmostWithLongestEffectiveRange, respectively.
832
833         Currently we compute the overlapping subranges up to some point p_i on the line by sweeping from the
834         start of the line through all the unclosed subranges. The unclosed subranges are sorted along the line.
835         That is, they are not sorted by paint order or reverse paint order. Therefore we must take care to
836         ensure that we return the computed overlapping subranges with respect to paint order/reverse paint order.
837
838         * rendering/MarkerSubrange.cpp:
839         (WebCore::subdivide):
840
841 2017-12-20  Youenn Fablet  <youenn@apple.com>
842
843         LayoutTest imported/w3c/web-platform-tests/service-workers/cache-storage/serviceworker/cache-match.https.html is a flaky failure
844         https://bugs.webkit.org/show_bug.cgi?id=179137
845         <rdar://problem/35337335>
846
847         Reviewed by Chris Dumez.
848
849         Covered by unflaked test.
850
851         * workers/service/context/ServiceWorkerThreadProxy.cpp:
852         (WebCore::ServiceWorkerThreadProxy::postTaskToLoader): ThreadableBlobRegistry is using callOnMainThread.
853         Use it also for postTaskToLoader so that there is no race condition between registering a blob and reading it.
854
855 2017-12-20  Youenn Fablet  <youenn@apple.com>
856
857         Support service worker interception of request with blob body
858         https://bugs.webkit.org/show_bug.cgi?id=181035
859
860         Reviewed by Chris Dumez.
861
862         Covered by updated test.
863
864         Add support for getting blob request bodies within service worker.
865         Disable interception of requests with form datas.
866
867         * Modules/fetch/FetchBody.cpp:
868         (WebCore::FetchBody::fromFormData):
869         * Modules/fetch/FetchBody.h:
870         * workers/service/context/ServiceWorkerFetch.cpp:
871         (WebCore::ServiceWorkerFetch::dispatchFetchEvent):
872         * workers/service/context/ServiceWorkerFetch.h:
873         * workers/service/context/ServiceWorkerThread.cpp:
874         (WebCore::ServiceWorkerThread::postFetchTask):
875
876 2017-12-20  Jeremy Jones  <jeremyj@apple.com>
877
878         Send fullscreenChange earlier, in webkitWillEnterFullscreen
879         https://bugs.webkit.org/show_bug.cgi?id=181016
880
881         Reviewed by Jer Noble.
882
883         Sending the event earlier, allows pages to update their interface state before the fullscreen animation.
884         
885         * dom/Document.cpp:
886         (WebCore::Document::webkitWillEnterFullScreenForElement):
887         (WebCore::Document::webkitDidEnterFullScreenForElement):
888
889 2017-12-20  Daniel Bates  <dabates@apple.com>
890
891         Remove Alternative Presentation Button
892         https://bugs.webkit.org/show_bug.cgi?id=180500
893         <rdar://problem/35891047>
894
895         Reviewed by Simon Fraser.
896
897         We no longer need the alternative presentation button.
898
899         * Configurations/FeatureDefines.xcconfig:
900         * DerivedSources.make:
901         * English.lproj/Localizable.strings:
902         * SourcesCocoa.txt:
903         * WebCore.xcodeproj/project.pbxproj:
904         * dom/Element.h:
905         * editing/Editor.cpp:
906         (WebCore::Editor::clear):
907         (WebCore::Editor::substituteWithAlternativePresentationButton): Deleted.
908         (WebCore::Editor::removeAlternativePresentationButton): Deleted.
909         (WebCore::Editor::elementsReplacedByAlternativePresentationButton): Deleted.
910         (WebCore::Editor::didInsertAlternativePresentationButtonElement): Deleted.
911         (WebCore::Editor::didRemoveAlternativePresentationButtonElement): Deleted.
912         * editing/Editor.h:
913         * editing/cocoa/AlternativePresentationButtonSubstitution.cpp: Removed.
914         * editing/cocoa/AlternativePresentationButtonSubstitution.h: Removed.
915         * html/HTMLInputElement.cpp:
916         (WebCore::HTMLInputElement::updateType):
917         (WebCore::HTMLInputElement::parseAttribute):
918         (WebCore::HTMLInputElement::willAttachRenderers):
919         (WebCore::HTMLInputElement::alternativePresentationButtonElement const): Deleted.
920         (WebCore::HTMLInputElement::setTypeWithoutUpdatingAttribute): Deleted.
921         (WebCore::HTMLInputElement::createInputType): Deleted.
922         * html/HTMLInputElement.h:
923         * html/InputType.h:
924         (WebCore::InputType::alternativePresentationButtonElement const): Deleted.
925         * html/InputTypeNames.cpp:
926         (WebCore::InputTypeNames::alternativePresentationButton): Deleted.
927         * html/InputTypeNames.h:
928         * html/shadow/cocoa/AlternativePresentationButtonElement.cpp: Removed.
929         * html/shadow/cocoa/AlternativePresentationButtonElement.h: Removed.
930         * html/shadow/cocoa/AlternativePresentationButtonInputType.cpp: Removed.
931         * html/shadow/cocoa/AlternativePresentationButtonInputType.h: Removed.
932         * page/ChromeClient.h:
933         * platform/LocalizedStrings.cpp:
934         (WebCore::AXAlternativePresentationButtonLabel): Deleted.
935         (WebCore::alternativePresentationButtonTitle): Deleted.
936         (WebCore::alternativePresentationButtonSubtitle): Deleted.
937         * platform/LocalizedStrings.h:
938         * testing/Internals.cpp:
939         (WebCore::Internals::substituteWithAlternativePresentationButton): Deleted.
940         (WebCore::Internals::removeAlternativePresentationButton): Deleted.
941         (WebCore::Internals::elementsReplacedByAlternativePresentationButton): Deleted.
942         * testing/Internals.h:
943         * testing/Internals.idl:
944
945 2017-12-20  Chris Dumez  <cdumez@apple.com>
946
947         Do not reuse resource for memory cache if selected service worker differs
948         https://bugs.webkit.org/show_bug.cgi?id=181042
949
950         Reviewed by Youenn Fablet.
951
952         No new tests, rebaselined existing test.
953
954         * loader/cache/CachedResource.h:
955         (WebCore::CachedResource::options const):
956         * loader/cache/CachedResourceLoader.cpp:
957         (WebCore::CachedResourceLoader::determineRevalidationPolicy const):
958
959 2017-12-20  Youenn Fablet  <youenn@apple.com>
960
961         Do not search for service worker registration in case of non HTTP navigation loads
962         https://bugs.webkit.org/show_bug.cgi?id=180976
963
964         Reviewed by Chris Dumez.
965
966         Covered by manual testing using perf test app uploaded in https://bugs.webkit.org/show_bug.cgi?id=180929.
967         In case we are sure there is no possiblity for getting a service worker, skip the search step.
968         Simialrly, do not report any Document as a Service Worker client if it can never be controlled.
969         A follow-up patch should handle the case of local URLs service worker selection.
970
971         * loader/DocumentLoader.cpp:
972         (WebCore::DocumentLoader::startLoadingMainResource):
973         (WebCore::DocumentLoader::commitData):
974
975 2017-12-20  Andy Estes  <aestes@apple.com>
976
977         [Apple Pay] Tell PassKit whether Apple Pay JS or Payment Request was used to start an Apple Pay session
978         https://bugs.webkit.org/show_bug.cgi?id=181001
979         <rdar://problem/35479106>
980
981         Reviewed by Tim Horton.
982
983         * Modules/applepay/ApplePaySession.cpp:
984         (WebCore::convertAndValidate):
985         * Modules/applepay/ApplePaySessionPaymentRequest.h:
986         (WebCore::ApplePaySessionPaymentRequest::requester const):
987         (WebCore::ApplePaySessionPaymentRequest::setRequester):
988         * Modules/applepay/paymentrequest/ApplePayPaymentHandler.cpp:
989         (WebCore::ApplePayPaymentHandler::show):
990
991 2017-12-20  Zalan Bujtas  <zalan@apple.com>
992
993         [RenderTreeBuilder] Move finding-the-parent/creating-wrapper logic from RenderTable::addChild to RenderTreeBuilder
994         https://bugs.webkit.org/show_bug.cgi?id=181018
995         <rdar://problem/36148601>
996
997         Reviewed by Antti Koivisto.
998
999         This is in preparation for removing all tree mutation from renderering code.
1000
1001         Covered by existing tests.
1002
1003         * rendering/RenderBlock.cpp:
1004         (WebCore::RenderBlock::addChildIgnoringContinuation):
1005         * rendering/RenderTable.cpp:
1006         (WebCore::RenderTable::addChild):
1007         * rendering/updating/RenderTreeBuilder.cpp:
1008         (WebCore::RenderTreeBuilder::insertChild):
1009         * rendering/updating/RenderTreeBuilderTable.cpp:
1010         (WebCore::RenderTreeBuilder::Table::findOrCreateParentForChild):
1011         * rendering/updating/RenderTreeBuilderTable.h:
1012
1013 2017-12-20  Frederic Wang  <fwang@igalia.com>
1014
1015         Split layout of RenderMathMLRow into smaller steps
1016         https://bugs.webkit.org/show_bug.cgi?id=180348
1017
1018         Reviewed by Manuel Rego Casasnovas.
1019
1020         Currently, RenderMathMLRow mixes too many steps in the same layout functions: layout children,
1021         calculate stretch size, stretch vertical operators, calculate final ascent/descent, handle
1022         out-of-flow positioned children, set logical height, set logical width for non-display
1023         <math> tag, center display <math> tag etc This situation is inherited from the old flexbox
1024         implementation but it makes difficult to read the code and to re-use layout & metrics
1025         calculation for follow-up work on <mrow>-like elements (<menclose>, <mapdded>, <msqrt> or
1026         <math>). See for example bug 160547 for <math> or bug 161126 for <menclose>.
1027         This patch rewrites RenderMathMLRow into smaller steps:
1028         - stretchVerticalOperatorsAndLayoutChildren() which calls layoutIfNeeded() or
1029         insertPositionedObject() on children and stretch vertical operators.
1030         - getContentBoundingBox() to determine the metrics of the mrow-like element without calling
1031         layout on children or positioning them, so that we can improve mrow-like element in the
1032         future.
1033         - layoutRowItems() which sets the position of children.
1034
1035         Setting the logical width/height or centering children is now moved into layoutBlock() since
1036         derived class overriding layoutBlock() will do their own adjustment for width, height and
1037         positions.
1038
1039         Test: mathml/mrow-preferred-width-with-out-of-flow-child.html
1040         The rest of the behavior is unchanged and already covered by existing tests.
1041
1042         * rendering/mathml/RenderMathMLMenclose.cpp:
1043         (WebCore::RenderMathMLMenclose::layoutBlock): Use the new function and get contentWidth
1044         directly from getContentBoundingBox().
1045         * rendering/mathml/RenderMathMLPadded.cpp:
1046         (WebCore::RenderMathMLPadded::layoutBlock): Ditto.
1047         * rendering/mathml/RenderMathMLRoot.cpp:
1048         (WebCore::RenderMathMLRoot::layoutBlock): Ditto, also remove useless statement
1049         baseAscent = baseDescent.
1050         * rendering/mathml/RenderMathMLRow.cpp:
1051         (WebCore::toVerticalStretchyOperator): New helper function to cast to a vertical stretchy
1052         operator.
1053         (WebCore::RenderMathMLRow::stretchVerticalOperatorsAndLayoutChildren): New helper function
1054         to ensure layoutIfNeeded()/insertPositionedObject() is called on children and that the
1055         vertical operators are stretched.
1056         (WebCore::RenderMathMLRow::getContentBoundingBox const): New helper function to determine
1057         the width/ascent/descent to use for the mrow content.
1058         (WebCore::RenderMathMLRow::computePreferredLogicalWidths): Skip out-of-flow children in the
1059         preferred width calculation. This is verified by the new test.
1060         (WebCore::RenderMathMLRow::layoutRowItems): Only keep the positioning of children with the
1061         specified width and ascent.
1062         (WebCore::RenderMathMLRow::layoutBlock): Center children for <math display="block"> tag and
1063         set the logical width in other cases. Also set the logical height here.
1064         (WebCore::RenderMathMLRow::computeLineVerticalStretch): Deleted. This work is included in
1065         stretchVerticalOperatorsAndLayoutChildren() now.
1066         * rendering/mathml/RenderMathMLRow.h: Update declaration of functions.
1067
1068 2017-12-20  Antti Koivisto  <antti@apple.com>
1069
1070         Move list and multicolumn building code from RenderTreeUpdater to RenderTreeBuilder
1071         https://bugs.webkit.org/show_bug.cgi?id=181021
1072
1073         Reviewed by Zalan Bujtas.
1074
1075         RenderTreeUpdater::ListItem -> RenderTreeBuilder::List
1076         RenderTreeUpdater::MultiColumn -> RenderTreeBuilder::MultiColumn
1077
1078         * Sources.txt:
1079         * WebCore.xcodeproj/project.pbxproj:
1080         * rendering/TextAutoSizing.cpp:
1081         (WebCore::TextAutoSizingValue::adjustTextNodeSizes):
1082         * rendering/updating/RenderTreeBuilder.cpp:
1083         (WebCore::RenderTreeBuilder::RenderTreeBuilder):
1084         (WebCore::RenderTreeBuilder::updateAfterDescendants):
1085         * rendering/updating/RenderTreeBuilder.h:
1086         (WebCore::RenderTreeBuilder::listBuilder):
1087         (WebCore::RenderTreeBuilder::multiColumnBuilder):
1088         * rendering/updating/RenderTreeBuilderList.cpp: Copied from Source/WebCore/rendering/updating/RenderTreeUpdaterListItem.cpp.
1089         (WebCore::RenderTreeBuilder::List::List):
1090         (WebCore::RenderTreeBuilder::List::updateItemMarker):
1091         (WebCore::RenderTreeUpdater::ListItem::updateMarker): Deleted.
1092         * rendering/updating/RenderTreeBuilderList.h: Copied from Source/WebCore/rendering/updating/RenderTreeUpdaterListItem.h.
1093         * rendering/updating/RenderTreeBuilderMultiColumn.cpp: Copied from Source/WebCore/rendering/updating/RenderTreeUpdaterMultiColumn.cpp.
1094         (WebCore::RenderTreeBuilder::MultiColumn::MultiColumn):
1095         (WebCore::RenderTreeBuilder::MultiColumn::updateAfterDescendants):
1096         (WebCore::RenderTreeBuilder::MultiColumn::createFragmentedFlow):
1097         (WebCore::RenderTreeBuilder::MultiColumn::destroyFragmentedFlow):
1098         (WebCore::RenderTreeUpdater::MultiColumn::update): Deleted.
1099         (WebCore::RenderTreeUpdater::MultiColumn::createFragmentedFlow): Deleted.
1100         (WebCore::RenderTreeUpdater::MultiColumn::destroyFragmentedFlow): Deleted.
1101         * rendering/updating/RenderTreeBuilderMultiColumn.h: Copied from Source/WebCore/rendering/updating/RenderTreeUpdaterMultiColumn.h.
1102         * rendering/updating/RenderTreeUpdater.cpp:
1103         (WebCore::RenderTreeUpdater::commit):
1104         (WebCore::RenderTreeUpdater::updateAfterDescendants):
1105         * rendering/updating/RenderTreeUpdater.h:
1106         * rendering/updating/RenderTreeUpdaterGeneratedContent.cpp:
1107         (WebCore::RenderTreeUpdater::GeneratedContent::updatePseudoElement):
1108         * rendering/updating/RenderTreeUpdaterListItem.cpp: Removed.
1109         * rendering/updating/RenderTreeUpdaterListItem.h: Removed.
1110         * rendering/updating/RenderTreeUpdaterMultiColumn.cpp: Removed.
1111         * rendering/updating/RenderTreeUpdaterMultiColumn.h: Removed.
1112
1113 2017-12-20  Ms2ger  <Ms2ger@igalia.com>
1114
1115         REGRESSION(r226160) Build broken when MEDIA_STREAM is disabled with MediaStreamRequest namespace confusion
1116         https://bugs.webkit.org/show_bug.cgi?id=181026
1117
1118         Unreviewed build fix.
1119
1120         * platform/mediastream/MediaStreamRequest.h: Fix namespace, unconditionally include header.
1121
1122 2017-12-20  Frederic Wang  <fwang@igalia.com>
1123
1124         Refactor RenderMathMLFraction to remove members modified during layout
1125         https://bugs.webkit.org/show_bug.cgi?id=180151
1126
1127         Reviewed by Manuel Rego Casasnovas.
1128
1129         Currently, RenderMathMLFraction has three LayoutUnit members m_defaultLineThickness,
1130         m_lineThickness and m_ascent that are set during layout. In the past such members have caused
1131         MathML rendering bugs due to update issues. This patch refactors the layout of MathML
1132         fractions so that it does not require to store and keep these LayoutUnit members up-to-date.
1133         New helper functions are introduced to perform the simple arithmetic calculations required.
1134
1135         No new tests, behavior unchanged and already covered by existing tests.
1136
1137         * rendering/mathml/RenderMathMLFraction.cpp: We add new helper functions to calculate line
1138         thickness values. This allows to remove updateLineThickness(), m_defaultLineThickness and
1139         m_lineThickness. We also introduce the ascentOverHorizontalAxis() helper function to
1140         calculate the ascent over the middle of its fraction bar or stack gap. This allows to remove
1141         the m_ascent member.
1142         (WebCore::RenderMathMLFraction::defaultLineThickness const): Helper function to calculate
1143         the default thickness of the fraction bar given in the MATH table or a fallback value.
1144         This replaces the use of m_defaultLineThickness.
1145         (WebCore::RenderMathMLFraction::lineThickness const): Helper function to resolve the
1146         actual thickness based on the @linethickness attribute and the default value. This replaces
1147         the use of m_lineThickness.
1148         (WebCore::RenderMathMLFraction::relativeLineThickness const): Rewrite this function using
1149         the new helper functions.
1150         (WebCore::RenderMathMLFraction::fractionParameters const): Make this const and replaces
1151         isStack() with !lineThickness().
1152         (WebCore::RenderMathMLFraction::stackParameters const): Ditto. Also move from layoutBlock
1153         the adjustment of parameters to ensure a minimum gap. Doing so assumes that the fraction is
1154         valid so we add an ASSERT.
1155         (WebCore::RenderMathMLFraction::horizontalOffset const): Make this a const since it does not
1156         mutate anything.
1157         (WebCore::RenderMathMLFraction::ascentOverHorizontalAxis const): Move this code from
1158         layoutBlock() to determine the middle of the stack gap or of the fraction bar. This helper
1159         function replaces m_ascent - mathAxisHeight(). Note that the adjustment of topShiftUp is now
1160         done in stackParameters().
1161         (WebCore::RenderMathMLFraction::layoutBlock): Remove the call to updateLineThickness().
1162         Rely on stackParameters() and ascentOverHorizontalAxis() to perform the necessary calculation
1163         of bottomShiftDown and ascent respectively.
1164         (WebCore::RenderMathMLFraction::paint): Use lineThickness() and ascentOverHorizontalAxis()
1165         instead of m_lineThickness, m_ascent and isStack().
1166         (WebCore::RenderMathMLFraction::firstLineBaseline const): Use ascentOverHorizontalAxis() and
1167         mathAxisHeight() instead of m_ascent.
1168         (WebCore::RenderMathMLFraction::updateLineThickness): Deleted.
1169         * rendering/mathml/RenderMathMLFraction.h: Declare new helper functions for line thickness
1170         values and ascent and remove the old LayoutUnit members. Make horizontalOffset(),
1171         fractionParameter() and stackParameters() const since they do not modify anything and the two
1172         last are used in the const function ascentOverHorizontalAxis(), itself used in
1173         firstLineBaseline().
1174
1175 2017-12-20  Carlos Alberto Lopez Perez  <clopez@igalia.com>
1176
1177         [GTK][Clang] Build fix after r226138
1178         https://bugs.webkit.org/show_bug.cgi?id=180984
1179
1180         Unreviewed build fix.
1181
1182         No new tests, its a build fix.
1183
1184         * rendering/InlineTextBox.cpp:
1185         (WebCore::InlineTextBox::collectSubrangesForDocumentMarkers):
1186
1187 2017-12-20  Ryosuke Niwa  <rniwa@webkit.org>
1188
1189         REGRESSION(r222699): Drag & drop from a web page to Gmail fails
1190         https://bugs.webkit.org/show_bug.cgi?id=181019
1191
1192         Reviewed by Wenson Hsieh.
1193
1194         The bug was caused by imageTypeToFakeFilename returning "image/png" instead of "image.png" for
1195         the filename for a PING image converted from a TIFF image. Fixed the bug by correcting this typo.
1196
1197         Tests: PasteImage.PasteLegacyTIFFImage
1198                PasteImage.PasteTIFFImage 
1199
1200         * platform/cocoa/PasteboardCocoa.mm:
1201         (WebCore::imageTypeToFakeFilename):
1202
1203 2017-12-19  Myles C. Maxfield  <mmaxfield@apple.com>
1204
1205         Refactor user-installed font setting for clarity
1206         https://bugs.webkit.org/show_bug.cgi?id=181013
1207
1208         Reviewed by Simon Fraser.
1209
1210         Pave the way for https://bugs.webkit.org/show_bug.cgi?id=180951.
1211
1212         This patch renames the Setting to not have so many grammatical negatives, and moves
1213         some CoreText-specific FontCache function signatures into a new FontCacheCoreText.h
1214         header file. It also uses the AllowUserInstalledFonts enum class in more places instead
1215         of the old boolean we were using, and puts this enum class in the common TextFlags.h
1216         header.
1217
1218         No new tests because there is no behavior change.
1219
1220         * WebCore.xcodeproj/project.pbxproj:
1221         * css/CSSFontFaceSet.cpp:
1222         (WebCore::CSSFontFaceSet::ensureLocalFontFacesForFamilyRegistered):
1223         * css/StyleResolver.cpp:
1224         (WebCore::StyleResolver::initializeFontStyle):
1225         * page/Settings.yaml:
1226         * platform/graphics/FontCache.h:
1227         (WebCore::SynthesisPair::SynthesisPair): Deleted.
1228         (WebCore::SynthesisPair::boldObliquePair const): Deleted.
1229         * platform/graphics/FontDescription.cpp:
1230         (WebCore::m_shouldAllowUserInstalledFonts):
1231         (WebCore::m_mayRepresentUserInstalledFont): Deleted.
1232         * platform/graphics/FontDescription.h:
1233         (WebCore::FontDescription::shouldAllowUserInstalledFonts const):
1234         (WebCore::FontDescription::setShouldAllowUserInstalledFonts):
1235         (WebCore::FontDescription::operator== const):
1236         (WebCore::FontDescription::mayRepresentUserInstalledFont const): Deleted.
1237         (WebCore::FontDescription::setMayRepresentUserInstalledFont): Deleted.
1238         * platform/graphics/cocoa/FontCacheCoreText.cpp:
1239         (WebCore::FontDatabase::singleton):
1240         (WebCore::FontDatabase::singletonAllowingUserInstalledFonts):
1241         (WebCore::FontDatabase::singletonDisallowingUserInstalledFonts):
1242         (WebCore::FontDatabase::FontDatabase):
1243         (WebCore::platformFontLookupWithFamily):
1244         (WebCore::fontWithFamily):
1245         * platform/graphics/cocoa/FontCacheCoreText.h: Added.
1246         (WebCore::SynthesisPair::SynthesisPair):
1247         (WebCore::SynthesisPair::boldObliquePair const):
1248         * platform/text/TextFlags.h:
1249         * style/StyleResolveForDocument.cpp:
1250         (WebCore::Style::resolveForDocument):
1251
1252 2017-12-19  Youenn Fablet  <youenn@apple.com>
1253
1254         UserMediaRequest should stop a request when Document is being stopped
1255         https://bugs.webkit.org/show_bug.cgi?id=180962
1256
1257         Reviewed by Eric Carlson.
1258
1259         Covered by fast/mediastream/destroy-document-while-enumerating-devices.html not crashing anymore under guardmalloc.
1260         Stopping to wait for the media stream to be active whenDocument goes away.
1261
1262         * Modules/mediastream/UserMediaRequest.cpp:
1263         (WebCore::UserMediaRequest::UserMediaRequest):
1264         (WebCore::UserMediaRequest::stop):
1265         (WebCore::UserMediaRequest::activeDOMObjectName const):
1266         (WebCore::UserMediaRequest::canSuspendForDocumentSuspension const):
1267         (WebCore::UserMediaRequest::contextDestroyed): Deleted.
1268         * Modules/mediastream/UserMediaRequest.h:
1269
1270 2017-12-19  Antti Koivisto  <antti@apple.com>
1271
1272         Move first-letter building code to RenderTreeBuilder
1273         https://bugs.webkit.org/show_bug.cgi?id=180992
1274
1275         Reviewed by Zalan Bujtas.
1276
1277         All special case tree building logic should go to RenderTreeBuilder.
1278
1279         - RenderTreeUpdater::FirstLetter -> RenderTreeBuilder::FirstLetter
1280         - Make the builder non-static and stop using RenderTreeBuilder::current() there.
1281
1282         * Sources.txt:
1283         * WebCore.xcodeproj/project.pbxproj:
1284         * rendering/TextAutoSizing.cpp:
1285         (WebCore::TextAutoSizingValue::adjustTextNodeSizes):
1286         * rendering/updating/RenderTreeBuilder.cpp:
1287         (WebCore::RenderTreeBuilder::RenderTreeBuilder):
1288         (WebCore::RenderTreeBuilder::insertChild):
1289         (WebCore::RenderTreeBuilder::updateAfterDescendants):
1290         * rendering/updating/RenderTreeBuilder.h:
1291         (WebCore::RenderTreeBuilder::firstLetterBuilder):
1292         (WebCore::RenderTreeBuilder::tableBuilder):
1293         * rendering/updating/RenderTreeBuilderFirstLetter.cpp: Copied from rendering/updating/RenderTreeUpdaterFirstLetter.cpp.
1294         (WebCore::supportsFirstLetter):
1295         (WebCore::RenderTreeBuilder::FirstLetter::FirstLetter):
1296         (WebCore::RenderTreeBuilder::FirstLetter::updateAfterDescendants):
1297         (WebCore::RenderTreeBuilder::FirstLetter::updateStyle):
1298         (WebCore::RenderTreeBuilder::FirstLetter::createRenderers):
1299         (WebCore::updateFirstLetterStyle): Deleted.
1300         (WebCore::createFirstLetterRenderer): Deleted.
1301         (WebCore::RenderTreeUpdater::FirstLetter::update): Deleted.
1302         * rendering/updating/RenderTreeBuilderFirstLetter.h: Copied from rendering/updating/RenderTreeUpdaterFirstLetter.h.
1303         * rendering/updating/RenderTreeUpdater.cpp:
1304         (WebCore::RenderTreeUpdater::updateAfterDescendants):
1305         * rendering/updating/RenderTreeUpdater.h:
1306         * rendering/updating/RenderTreeUpdaterFirstLetter.cpp: Removed.
1307         * rendering/updating/RenderTreeUpdaterFirstLetter.h: Removed.
1308
1309 2017-12-19  Chris Dumez  <cdumez@apple.com>
1310
1311         [Fetch] Extracting a body of type Blob should not set Content-Type to the empty string
1312         https://bugs.webkit.org/show_bug.cgi?id=180991
1313
1314         Reviewed by Youenn Fablet.
1315
1316         Extracting a body of type Blob should not set Content-Type to the empty string as per:
1317         - https://fetch.spec.whatwg.org/#concept-bodyinit-extract
1318
1319         No new tests, rebaselined existing test.
1320
1321         * Modules/fetch/FetchBody.cpp:
1322         (WebCore::FetchBody::extract):
1323
1324 2017-12-19  Commit Queue  <commit-queue@webkit.org>
1325
1326         Unreviewed, rolling out r226094.
1327         https://bugs.webkit.org/show_bug.cgi?id=181012
1328
1329         No longer needed to build without error. (Requested by xenon
1330         on #webkit).
1331
1332         Reverted changeset:
1333
1334         "[GTK][WPE] Conditionalize libTASN1 use behind
1335         ENABLE_SUBTLE_CRYPTO in the CMake files"
1336         https://bugs.webkit.org/show_bug.cgi?id=180949
1337         https://trac.webkit.org/changeset/226094
1338
1339 2017-12-19  Eric Carlson  <eric.carlson@apple.com>
1340
1341         [MediaStream] Clean up RealtimeMediaSource interfaces
1342         https://bugs.webkit.org/show_bug.cgi?id=180934
1343         <rdar://problem/36108648>
1344
1345         Reviewed by Youenn Fablet.
1346
1347         No new tests, updated http/tests/media/media-stream/disconnected-frame.html.
1348         
1349         Wrap video and audio constraints in a struct instead of passing both around as separate
1350         parameters. Cleanup up the interface to RealTimeMediaSourceCenter.
1351
1352         * Modules/mediastream/MediaDevices.cpp:
1353         (WebCore::MediaDevices::getUserMedia const):
1354         * Modules/mediastream/MediaDevicesRequest.cpp:
1355         (WebCore::MediaDevicesRequest::start):
1356         * Modules/mediastream/UserMediaRequest.cpp:
1357         (WebCore::UserMediaRequest::create):
1358         (WebCore::UserMediaRequest::UserMediaRequest):
1359         (WebCore::UserMediaRequest::start):
1360         (WebCore::UserMediaRequest::allow):
1361         (WebCore::UserMediaRequest::contextDestroyed):
1362         * Modules/mediastream/UserMediaRequest.h:
1363         (WebCore::UserMediaRequest::request const):
1364         * WebCore.xcodeproj/project.pbxproj:
1365         * platform/mediastream/CaptureDevice.h:
1366         (WebCore::CaptureDevice::persistentId const):
1367         (WebCore::CaptureDevice::label const):
1368         (WebCore::CaptureDevice::groupId const):
1369         (WebCore::CaptureDevice::type const):
1370         (WebCore::CaptureDevice::setPersistentId): Deleted.
1371         (WebCore::CaptureDevice::setLabel): Deleted.
1372         (WebCore::CaptureDevice::setGroupId): Deleted.
1373         (WebCore::CaptureDevice::setType): Deleted.
1374         * platform/mediastream/CaptureDeviceManager.cpp:
1375         (CaptureDeviceManager::getAudioSourcesInfo): Deleted.
1376         (CaptureDeviceManager::getVideoSourcesInfo): Deleted.
1377         (CaptureDeviceManager::deviceWithUID): Deleted.
1378         * platform/mediastream/CaptureDeviceManager.h:
1379         (WebCore::CaptureDeviceManager::captureDeviceWithPersistentID):
1380         (WebCore::CaptureDeviceManager::refreshCaptureDevices):
1381         * platform/mediastream/MediaStreamRequest.h: Copied from Source/WebCore/platform/mediastream/ios/AVAudioSessionCaptureDevice.mm.
1382         (WebCore::MediaStreamRequest::encode const):
1383         (WebCore::MediaStreamRequest::decode):
1384         * platform/mediastream/RealtimeMediaSourceCenter.cpp:
1385         (WebCore::RealtimeMediaSourceCenter::createMediaStream):
1386         (WebCore::RealtimeMediaSourceCenter::getMediaStreamDevices):
1387         (WebCore::RealtimeMediaSourceCenter::validateRequestConstraints):
1388         (WebCore::RealtimeMediaSourceCenter::captureDeviceWithPersistentID):
1389         * platform/mediastream/RealtimeMediaSourceCenter.h:
1390         * platform/mediastream/RealtimeMediaSourceSettings.h:
1391         * platform/mediastream/ios/AVAudioSessionCaptureDevice.mm:
1392         (WebCore::AVAudioSessionCaptureDevice::AVAudioSessionCaptureDevice):
1393         * platform/mediastream/ios/AVAudioSessionCaptureDeviceManager.h:
1394         * platform/mediastream/ios/AVAudioSessionCaptureDeviceManager.mm:
1395         (WebCore::AVAudioSessionCaptureDeviceManager::captureDevices):
1396         (WebCore::AVAudioSessionCaptureDeviceManager::captureDeviceWithPersistentID):
1397         * platform/mediastream/mac/AVCaptureDeviceManager.h:
1398         * platform/mediastream/mac/AVCaptureDeviceManager.mm:
1399         (WebCore::AVCaptureDeviceManager::captureDevicesInternal):
1400         (WebCore::AVCaptureDeviceManager::captureDevices):
1401         (WebCore::AVCaptureDeviceManager::refreshAVCaptureDevicesOfType):
1402         (WebCore::AVCaptureDeviceManager::refreshCaptureDevices):
1403         (WebCore::AVCaptureDeviceManager::deviceDisconnected):
1404         (WebCore::AVCaptureDeviceManager::getAudioSourcesInfo): Deleted.
1405         (WebCore::AVCaptureDeviceManager::getVideoSourcesInfo): Deleted.
1406         * platform/mediastream/mac/CoreAudioCaptureDevice.cpp:
1407         (WebCore::CoreAudioCaptureDevice::CoreAudioCaptureDevice):
1408         * platform/mediastream/mac/CoreAudioCaptureDeviceManager.cpp:
1409         (WebCore::CoreAudioCaptureDeviceManager::captureDevices):
1410         (WebCore::CoreAudioCaptureDeviceManager::captureDeviceWithPersistentID):
1411         (WebCore::CoreAudioCaptureDeviceManager::refreshAudioCaptureDevices):
1412         * platform/mediastream/mac/CoreAudioCaptureDeviceManager.h:
1413         * platform/mediastream/mac/RealtimeMediaSourceCenterMac.cpp:
1414         * platform/mock/MockRealtimeAudioSource.cpp:
1415         (WebCore::MockRealtimeAudioSource::startProducingData):
1416         (WebCore::MockRealtimeAudioSource::createMuted): Deleted.
1417         * platform/mock/MockRealtimeAudioSource.h:
1418         * platform/mock/MockRealtimeMediaSource.cpp:
1419         (WebCore::deviceMap):
1420         (WebCore::MockRealtimeMediaSource::captureDeviceWithPersistentID):
1421         (WebCore::MockRealtimeMediaSource::audioDevices):
1422         (WebCore::MockRealtimeMediaSource::videoDevices):
1423         (WebCore::MockRealtimeMediaSource::MockRealtimeMediaSource):
1424         * platform/mock/MockRealtimeMediaSource.h:
1425         (WebCore::MockRealtimeMediaSource::device const):
1426         (WebCore::MockRealtimeMediaSource::deviceIndex): Deleted.
1427         * platform/mock/MockRealtimeMediaSourceCenter.h:
1428         * platform/mock/MockRealtimeVideoSource.cpp:
1429         (WebCore::MockRealtimeVideoSource::MockRealtimeVideoSource):
1430         (WebCore::MockRealtimeVideoSource::initializeCapabilities):
1431         (WebCore::MockRealtimeVideoSource::generateFrame):
1432         (WebCore::MockRealtimeVideoSource::createMuted): Deleted.
1433         * platform/mock/MockRealtimeVideoSource.h:
1434
1435 2017-12-19  Ryosuke Niwa  <rniwa@webkit.org>
1436
1437         Don't convert pasted content to use blob URL in WebKit1
1438         https://bugs.webkit.org/show_bug.cgi?id=180969
1439
1440         Reviewed by Wenson Hsieh.
1441
1442         Turns out that some WebKit1 clients are relying on being able to see the original URLs of the pasted content;
1443         e.g. not storing content referenced by HTTP/HTTPS protocol as opposed to local files.
1444
1445         This patch restores the behavior prior to r223440 and r222839 for WebKit1 clients by overriding resources in
1446         DocumentLoader instead of converting URLs used in the pasted contents by blob URLs. In addition, this patch
1447         disables the pasteboard sanitization and custom data transfer types for WebKit1 clients as the feature poses
1448         a compatibility concern for WebKit1 clients.
1449
1450         Tests: WebKitLegacy.AccessingImageInPastedRTFD
1451                WebKitLegacy.AccessingImageInPastedWebArchive
1452
1453         * editing/cocoa/WebContentReaderCocoa.mm:
1454         (WebCore::createFragmentAndAddResources):
1455         (WebCore::WebContentReader::readWebArchive):
1456         * page/DeprecatedGlobalSettings.cpp:
1457         (WebCore::DeprecatedGlobalSettings::defaultCustomPasteboardDataEnabled):
1458
1459 2017-12-19  Jer Noble  <jer.noble@apple.com>
1460
1461         Playing media elements which call "pause(); play()" will have the play promise rejected.
1462         https://bugs.webkit.org/show_bug.cgi?id=180781
1463         <rdar://problem/33191377>
1464
1465         Reviewed by Eric Carlson.
1466
1467         Follow-up to address failing iOS API tests. Rather than skipping the call to
1468         prepareForLoad() in the case where media elements are not allowed to load data,
1469         unconditionally call prepareForLoad(), but conditionally call selectMediaResource() inside
1470         that function only if the media elemnet is allowed to load. This ensures that the
1471         MediaPlayer is created when play(), pause(), or load() are called during a user gesture
1472         later, and selectMediaResource() (which depends on having a non-null m_player) is called.
1473
1474         * html/HTMLMediaElement.cpp:
1475         (WebCore::HTMLMediaElement::parseAttribute):
1476         (WebCore::HTMLMediaElement::insertedIntoAncestor):
1477         (WebCore::HTMLMediaElement::load):
1478         (WebCore::HTMLMediaElement::prepareForLoad):
1479         (WebCore::HTMLMediaElement::playInternal):
1480
1481 2017-12-19  Timothy Hatcher  <timothy@hatcher.name>
1482
1483         Build failure in WebGL2 when Video feature is disabled
1484         https://bugs.webkit.org/show_bug.cgi?id=180946
1485
1486         Reviewed by Brian Burg.
1487
1488         * html/canvas/WebGL2RenderingContext.h: Make TexImageSource conditional on ENABLE(VIDEO).
1489         * html/canvas/WebGL2RenderingContext.idl: Ditto.
1490
1491 2017-12-19  Chris Dumez  <cdumez@apple.com>
1492
1493         scopeURL should start with the provided scriptURL
1494         https://bugs.webkit.org/show_bug.cgi?id=180983
1495
1496         Reviewed by Youenn Fablet.
1497
1498         scopeURL should start with the provided scriptURL, as per:
1499         - https://w3c.github.io/ServiceWorker/#update (steps 7.8 to 7.18)
1500
1501         No new tests, rebaselined existing tests.
1502
1503         * platform/network/HTTPHeaderNames.in:
1504         * workers/service/ServiceWorkerJob.cpp:
1505         (WebCore::ServiceWorkerJob::didReceiveResponse):
1506
1507 2017-12-19  Zalan Bujtas  <zalan@apple.com>
1508
1509         [RenderTreeBuilder] Move finding-the-parent/creating-wrapper logic from RenderTableSection::addChild to RenderTreeBuilder
1510         https://bugs.webkit.org/show_bug.cgi?id=180994
1511         <rdar://problem/36139222>
1512
1513         Reviewed by Antti Koivisto.
1514
1515         This is in preparation for removing all tree mutation from renderering code.
1516
1517         Covered by existing tests.
1518
1519         * rendering/RenderTableSection.cpp:
1520         (WebCore::RenderTableSection::addChild):
1521         * rendering/updating/RenderTreeBuilder.cpp:
1522         (WebCore::RenderTreeBuilder::insertChild):
1523         * rendering/updating/RenderTreeBuilderTable.cpp:
1524         (WebCore::RenderTreeBuilder::Table::findOrCreateParentForChild):
1525         * rendering/updating/RenderTreeBuilderTable.h:
1526
1527 2017-12-19  Daniel Bates  <dabates@apple.com>
1528
1529         Implement InlineTextBox painting using marker subranges
1530         https://bugs.webkit.org/show_bug.cgi?id=180984
1531         <rdar://problem/36139364>
1532
1533         Reviewed by David Hyatt.
1534
1535         As a step towards implementing CSS Pseudo-Elements Module Level 4, explicitly decompose a
1536         text line into subrange objects that may be styled (say, to give the appearance of selected
1537         text) and painted.
1538
1539         No functionality changed. So, no new tests.
1540
1541         * rendering/InlineTextBox.cpp:
1542         (WebCore::InlineTextBox::localSelectionRect const): Update comments.
1543
1544         (WebCore::InlineTextBox::MarkerSubrangeStyle::operator== const):
1545         (WebCore::InlineTextBox::MarkerSubrangeStyle::operator!= const):
1546         (WebCore::InlineTextBox::StyledMarkerSubrange::StyledMarkerSubrange):
1547         Define a subclass to represent a marker subrange that has associated style information.
1548         We will make use of the style information when painting the subrange.
1549
1550         (WebCore::createMarkerSubrangeFromSelectionInBox): Convenience function to instantiate a
1551         MarkerSubrange instance from the current selection of a specified text box.
1552
1553         (WebCore::InlineTextBox::paint): Write in terms of MarkerSubrange. We keep composition backgrounds
1554         and composition underlines as special cases for now. We represent all other subranges of the line
1555         as MarkerSubrange instances, including unmarked text (i.e. non-selected text without an associated
1556         document marker). The subranges for the gaps between document markers and selection are implicitly
1557         created by subdividing the entire line. Support for PaintBehaviorExcludeSelection is implemented
1558         by subdividing the entire line with the selection subrange and then removing the selection subrange
1559         from the resulting list of subdivisions before painting with the resulting list.
1560
1561         (WebCore::InlineTextBox::paintPlatformDocumentMarkers): Renamed; formerly named paintDocumentMarkers.
1562         (WebCore::InlineTextBox::paintPlatformDocumentMarker): Renamed; formerly named paintDocumentMarker.
1563
1564         (WebCore::InlineTextBox::computeStyleForUnmarkedMarkerSubrange const): Convenience function to
1565         compute the style for unmarked text.
1566
1567         (WebCore::InlineTextBox::resolveStyleForSubrange): Added
1568
1569         (WebCore::InlineTextBox::subdivideAndResolveStyle): Subdivides the list of marker subranges and
1570         coalesces subranges of the same type (e.g. selection) or with the same style. The latter strategy
1571         preserves the optimization of drawing the text of the entire line in one draw command when we know
1572         that the selected text looks identical to non-selected text. This optimization was performed in TextPainter::paint().
1573
1574         (WebCore::InlineTextBox::collectSubrangesForDraggedContent): Added.
1575         (WebCore::InlineTextBox::collectSubrangesForDocumentMarkers): Added.
1576         (WebCore::InlineTextBox::textOriginFromBoxRect const): Added.
1577
1578         (WebCore::InlineTextBox::paintMarkerSubranges):
1579         (WebCore::InlineTextBox::paintTextSubrangeBackground):
1580         (WebCore::InlineTextBox::paintTextSubrangeForeground):
1581         (WebCore::InlineTextBox::paintTextSubrangeDecoration):
1582         Paint the marker subrange.
1583
1584         (WebCore::InlineTextBox::paintCompositionBackground): Moved function to group it with the logic to
1585         paint composition underlines. Modified to pass clamped offsets to paintTextSubrangeBackground() as
1586         paintTextSubrangeBackground() now expects them.
1587
1588         (WebCore::mirrorRTLSegment): Moved function to be above paintCompositionUnderline() as it is the only
1589         function that makes use of it.
1590
1591         (WebCore::InlineTextBox::paintSelection): Deleted.
1592         (WebCore::InlineTextBox::paintTextMatchMarker): Deleted.
1593         (WebCore::InlineTextBox::paintDecoration): Deleted.
1594         (WebCore::InlineTextBox::paintDocumentMarker): Deleted; renamed to paintPlatformDocumentMarker.
1595         (WebCore::InlineTextBox::paintDocumentMarkers): Deleted; renamed to paintPlatformDocumentMarkers.
1596         * rendering/InlineTextBox.h:
1597         (WebCore::InlineTextBox::paintMarkerSubranges): Added.
1598         * rendering/MarkerSubrange.h:
1599         (WebCore::MarkerSubrange::isEmpty const): Added.
1600         (WebCore::MarkerSubrange::operator!= const): Added.
1601         (WebCore::MarkerSubrange::operator== const): Added.
1602         * rendering/SimpleLineLayoutFunctions.cpp:
1603         (WebCore::SimpleLineLayout::paintFlow): Updated code as we no longer need to pass the text run length
1604         to TextPainter::paint(). Also modernize the code while I am here.
1605         * rendering/TextDecorationPainter.cpp:
1606         (WebCore::TextDecorationPainter::Styles::operator== const): Added.
1607         (WebCore::TextDecorationPainter::TextDecorationPainter): Modified to take an optional TextDecorationPainter::Styles
1608         instance as an argument and removed the unused parameter for PseudoId.
1609         * rendering/TextDecorationPainter.h:
1610         (WebCore::TextDecorationPainter::Styles::operator!= const): Added.
1611         * rendering/TextPaintStyle.cpp:
1612         (WebCore::TextPaintStyle::operator== const): Added.
1613         (WebCore::computeTextSelectionPaintStyle): Removed the now unused out-arguments paintSelectedTextOnly, paintSelectedTextSeparately,
1614         and paintNonSelectedTextOnly. The values stored in these out-arguments were intended to be used by the caller to
1615         minimize the number of drawing commands. The value of paintSelectedTextSeparately indicated whether selected text
1616         would look identical to non-selected text so that a caller could use one paint command to draw the entire line
1617         instead of issuing two or more drawing commands to paint non-selected and selected text separately. We now
1618         accomplish the same optimization by coalescing subrange styles in InlineTextBox::subdivideAndResolveStyle().
1619         The value of paintNonSelectedTextOnly, as its name states, indicated whether a caller should only paint non-selected
1620         text and hence skip painting of selected text. This value was only used when painting dragged content (i.e. DocumentMarker::DraggedContent
1621         markers) and its effect is now more directly achieved by the dragged content logic in InlineTextBox::paint().
1622         * rendering/TextPaintStyle.h:
1623         (WebCore::TextPaintStyle::operator!= const): Added.
1624         * rendering/TextPainter.cpp:
1625         (WebCore::TextPainter::paint): Implemented in terms TextPainter::paintRange() now that InlineTextBox::paint() optimizes
1626         for the number of drawing calls. See remarks for WebCore::computeTextSelectionPaintStyle() for more details.
1627         * rendering/TextPainter.h: Group together related member functions.
1628         (WebCore::TextPainter::setSelectionStyle): Deleted.
1629         (WebCore::TextPainter::setSelectionShadow): Deleted.
1630
1631 2017-12-19  Daniel Bates  <dabates@apple.com>
1632
1633         Add support for computing the frontmost longest effective marker subrange
1634         https://bugs.webkit.org/show_bug.cgi?id=180985
1635
1636         Reviewed by Dave Hyatt.
1637
1638         Add a new subdivision overlap strategy to return the minimum list of maximal length non-
1639         overlapping subranges. We will make use of this strategy together with an algorithm to
1640         coalesce adjacent subranges with visually indistinct styles to minimize the total number
1641         of drawing commands needed to paint an entire line of text. We are not making use of
1642         this functionality now. We will make use of it to simplify the patch for <https://bugs.webkit.org/show_bug.cgi?id=180984>.
1643
1644         * rendering/MarkerSubrange.cpp:
1645         (WebCore::subdivide):
1646         * rendering/MarkerSubrange.h:
1647
1648 2017-12-19  Chris Dumez  <cdumez@apple.com>
1649
1650         Handle Fetch should wait for the service worker's state to become activated
1651         https://bugs.webkit.org/show_bug.cgi?id=180959
1652
1653         Reviewed by Youenn Fablet.
1654
1655         Handle Fetch should wait for the service worker's state to become activated when
1656         it is currently activating.
1657
1658         Specification:
1659         - https://w3c.github.io/ServiceWorker/#on-fetch-request-algorithm (Step 16)
1660
1661         No new tests, rebaselined existing test.
1662
1663         * workers/service/server/SWServerWorker.cpp:
1664         (WebCore::SWServerWorker::~SWServerWorker):
1665         (WebCore::SWServerWorker::whenActivated):
1666         (WebCore::SWServerWorker::setState):
1667         (WebCore::SWServerWorker::callWhenActivatedHandler):
1668         * workers/service/server/SWServerWorker.h:
1669
1670 2017-12-19  Yusuke Suzuki  <utatane.tea@gmail.com>
1671
1672         [YARR] Yarr should return ErrorCode instead of error messages (const char*)
1673         https://bugs.webkit.org/show_bug.cgi?id=180966
1674
1675         Reviewed by Mark Lam.
1676
1677         Remove unnecessary String creation.
1678
1679         No behavior change.
1680
1681         * contentextensions/URLFilterParser.cpp:
1682         (WebCore::ContentExtensions::URLFilterParser::addPattern):
1683
1684 2017-12-19  Zalan Bujtas  <zalan@apple.com>
1685
1686         [RenderTreeBuilder] Move finding-the-parent/creating-wrapper logic from RenderTableRow::addChild to RenderTreeBuilder
1687         https://bugs.webkit.org/show_bug.cgi?id=180964
1688         <rdar://problem/36123315>
1689
1690         Reviewed by Antti Koivisto.
1691
1692         This is in preparation for removing all tree mutation from renderering code.
1693
1694         Covered by existing tests.
1695
1696         * Sources.txt:
1697         * WebCore.xcodeproj/project.pbxproj:
1698         * rendering/RenderTableRow.cpp:
1699         (WebCore::RenderTableRow::addChild):
1700         * rendering/updating/RenderTreeBuilder.cpp:
1701         (WebCore::RenderTreeBuilder::insertChild):
1702         * rendering/updating/RenderTreeBuilder.h:
1703         * rendering/updating/RenderTreeBuilderTable.cpp: Added.
1704         (WebCore::RenderTreeBuilder::Table::findOrCreateParentForChild):
1705         * rendering/updating/RenderTreeBuilderTable.h: Copied from Source/WebCore/rendering/updating/RenderTreeBuilder.h.
1706
1707 2017-12-19  Youenn Fablet  <youenn@apple.com>
1708
1709         Service Worker should not clean HTTP headers added by the application or by fetch specification before service worker interception
1710         https://bugs.webkit.org/show_bug.cgi?id=180939
1711
1712         Reviewed by Chris Dumez.
1713
1714         Covered by modified WPT test.
1715
1716         Add support to clean only specific headers in cleanHTTPRequestHeadersForAccessControl,
1717         renamed from cleanRedirectedRequestForAccessControl.
1718         Compute the list of headers to keep in DocumentThreadableLoader.
1719         Add a specific rule for Accept header which is set prior service worker interception and for
1720         HTTP headers set by DocumentThreadableLoader clients.
1721
1722         * loader/CrossOriginAccessControl.cpp:
1723         (WebCore::httpHeadersToKeepFromCleaning):
1724         (WebCore::cleanRedirectedRequestForAccessControl):
1725         * loader/CrossOriginAccessControl.h:
1726         (WebCore::cleanRedirectedRequestForAccessControl):
1727         * loader/DocumentThreadableLoader.cpp:
1728         (WebCore::DocumentThreadableLoader::DocumentThreadableLoader):
1729         * loader/ResourceLoaderOptions.h:
1730         * workers/service/context/ServiceWorkerFetch.cpp:
1731         (WebCore::ServiceWorkerFetch::dispatchFetchEvent):
1732         * workers/service/context/ServiceWorkerFetch.h:
1733         * workers/service/context/ServiceWorkerThread.cpp:
1734         (WebCore::ServiceWorkerThread::postFetchTask):
1735         * workers/service/context/ServiceWorkerThread.h:
1736
1737 2017-12-19  Andy Estes  <aestes@apple.com>
1738
1739         [Apple Pay] Stop maintaining a list of payment networks
1740         https://bugs.webkit.org/show_bug.cgi?id=180965
1741         <rdar://problem/34696560>
1742
1743         Reviewed by Tim Horton.
1744
1745         Instead of maintaining the list of valid payment networks in WebCore, allow the client to
1746         provide the list when constructing a PaymentCoordinator. Then, use PaymentCoordinator's list
1747         to validate ApplePaySessionPaymentRequests.
1748
1749         Validation will now be done case-insensitively since Cocoa clients will provide a list of
1750         network names that differ in capitalization from the names formerly accepted by WebCore.
1751
1752         Added new test cases to http/tests/ssl/applepay/ApplePaySession.html.
1753
1754         * Modules/applepay/ApplePayRequestBase.cpp:
1755         (WebCore::convertAndValidate): Changed to return a Vector of validated strings.
1756         (WebCore::validate): Renamed to convertAndValidate.
1757         * Modules/applepay/ApplePayRequestBase.h:
1758         * Modules/applepay/ApplePaySession.cpp:
1759         (WebCore::convertAndValidate):
1760         (WebCore::ApplePaySession::create):
1761         * Modules/applepay/ApplePaySessionPaymentRequest.cpp:
1762         (WebCore::ApplePaySessionPaymentRequest::isValidSupportedNetwork): Deleted.
1763         * Modules/applepay/ApplePaySessionPaymentRequest.h:
1764         * Modules/applepay/PaymentCoordinator.cpp:
1765         (WebCore::toHashSet):
1766         (WebCore::PaymentCoordinator::PaymentCoordinator): Converted availablePaymentNetworks to a
1767         case-insensitive HashSet and stored in m_availablePaymentNetworks.
1768         (WebCore::PaymentCoordinator::validatedPaymentNetwork const): Added special cases for "jcb"
1769         and "carteBancaire" for API compatibility. For other networks, checked m_availablePaymentNetworks.
1770         * Modules/applepay/PaymentCoordinator.h:
1771         * Modules/applepay/paymentrequest/ApplePayPaymentHandler.cpp:
1772         (WebCore::ApplePayPaymentHandler::show):
1773         * page/MainFrame.cpp:
1774         (WebCore::MainFrame::MainFrame): Constructed m_paymentCoordinator with configuration.availablePaymentNetworks.
1775         * page/PageConfiguration.h:
1776         * testing/Internals.cpp:
1777         (WebCore::Internals::Internals):
1778         * testing/MockPaymentCoordinator.cpp:
1779         * testing/MockPaymentCoordinator.h:
1780
1781 2017-12-19  Wenson Hsieh  <wenson_hsieh@apple.com>
1782
1783         Unreviewed, try to fix the Windows build after r226097.
1784
1785         * editing/markup.cpp:
1786         (WebCore::StyledMarkupAccumulator::appendCustomAttributes):
1787
1788 2017-12-18  Andy Estes  <aestes@apple.com>
1789
1790         [Apple Pay] Only include phonetic name properties in ApplePayPaymentContact when version >= 3
1791         https://bugs.webkit.org/show_bug.cgi?id=180925
1792         <rdar://problem/35907596>
1793
1794         Reviewed by Tim Horton.
1795
1796         No tests possible. The fix involves converting PKContacts, which we can't create in our test harness.
1797
1798         * Modules/applepay/ApplePayPaymentAuthorizedEvent.cpp:
1799         (WebCore::ApplePayPaymentAuthorizedEvent::ApplePayPaymentAuthorizedEvent):
1800         * Modules/applepay/ApplePayPaymentAuthorizedEvent.h:
1801         * Modules/applepay/ApplePaySession.cpp:
1802         (WebCore::ApplePaySession::create):
1803         (WebCore::ApplePaySession::ApplePaySession):
1804         (WebCore::ApplePaySession::version const):
1805         (WebCore::ApplePaySession::didAuthorizePayment):
1806         (WebCore::ApplePaySession::didSelectShippingContact):
1807         * Modules/applepay/ApplePaySession.h:
1808         * Modules/applepay/ApplePayShippingContactSelectedEvent.cpp:
1809         (WebCore::ApplePayShippingContactSelectedEvent::ApplePayShippingContactSelectedEvent):
1810         * Modules/applepay/ApplePayShippingContactSelectedEvent.h:
1811         * Modules/applepay/Payment.h:
1812         * Modules/applepay/PaymentContact.h:
1813         * Modules/applepay/PaymentCoordinator.cpp:
1814         (WebCore::PaymentCoordinator::supportsVersion const):
1815         (WebCore::PaymentCoordinator::supportsVersion): Deleted.
1816         * Modules/applepay/PaymentCoordinator.h:
1817         * Modules/applepay/PaymentSession.h:
1818         * Modules/applepay/cocoa/PaymentCocoa.mm:
1819         (WebCore::convert):
1820         (WebCore::Payment::toApplePayPayment const):
1821         * Modules/applepay/cocoa/PaymentContactCocoa.mm:
1822         (WebCore::convert):
1823         (WebCore::PaymentContact::toApplePayPaymentContact const):
1824         * Modules/applepay/paymentrequest/ApplePayPaymentHandler.cpp:
1825         (WebCore::ApplePayPaymentHandler::document const):
1826         (WebCore::ApplePayPaymentHandler::paymentCoordinator const):
1827         (WebCore::ApplePayPaymentHandler::version const):
1828         (WebCore::ApplePayPaymentHandler::didAuthorizePayment):
1829         (WebCore::ApplePayPaymentHandler::didSelectShippingContact):
1830         (WebCore::ApplePayPaymentHandler::document): Deleted.
1831         (WebCore::ApplePayPaymentHandler::paymentCoordinator): Deleted.
1832         * Modules/applepay/paymentrequest/ApplePayPaymentHandler.h:
1833
1834 2017-12-18  Wenson Hsieh  <wenson_hsieh@apple.com>
1835
1836         [Attachment Support] The 'webkitattachmentbloburl' attribute should not persist after markup serialization
1837         https://bugs.webkit.org/show_bug.cgi?id=180924
1838         <rdar://problem/36099093>
1839
1840         Reviewed by Tim Horton.
1841
1842         Work towards dragging Blob-backed attachment elements as files on iOS and Mac. It doesn't make sense for the
1843         attachment blob URL to stick around on the element after markup serialization, so this patch removes logic that
1844         eagerly sets the blob URL upon setting an attachment's File. Instead, we just append this attribute when
1845         generating markup.
1846
1847         This patch also augments existing WKAttachmentTests to ensure that these attributes are not present.
1848
1849         * editing/markup.cpp:
1850         (WebCore::StyledMarkupAccumulator::appendCustomAttributes):
1851         (WebCore::createFragmentFromMarkup):
1852         * html/HTMLAttachmentElement.cpp:
1853         (WebCore::HTMLAttachmentElement::setFile):
1854         * rendering/HitTestResult.cpp:
1855
1856         Fixes a related issue where an attachment is backed by Blob data (and not a file path) would specify "file:///"
1857         as its attachment file path in DragController when starting a drag. Instead, if there is no file path, fall back
1858         to the blob URL.
1859
1860         This will be tested in a future patch once a WK2 dragging simulator for Mac is implemented, and support for
1861         dragging out Blob-backed attachments as (platform) files is implemented.
1862
1863         (WebCore::HitTestResult::absoluteAttachmentURL const):
1864
1865 2017-12-18  Chris Dumez  <cdumez@apple.com>
1866
1867         Default scope used when registering a service worker is wrong
1868         https://bugs.webkit.org/show_bug.cgi?id=180961
1869
1870         Reviewed by Youenn Fablet.
1871
1872         The default scope we used when registering a service worker was wrong, it did not match:
1873         - https://w3c.github.io/ServiceWorker/#start-register (Step 4)
1874
1875         This patch aligns our behavior with the specification.
1876
1877         No new tests, rebaselined existing test.
1878
1879         * workers/service/ServiceWorkerContainer.cpp:
1880         (WebCore::ServiceWorkerContainer::addRegistration):
1881
1882 2017-12-18  Ryosuke Niwa  <rniwa@webkit.org>
1883
1884         Assertion hit in DocumentOrderedMap::get while removing a form element
1885         https://bugs.webkit.org/show_bug.cgi?id=137959
1886         <rdar://problem/27702012>
1887
1888         Reviewed by Brent Fulgham.
1889
1890         The assertion failure was caused by FormAssociatedElement::findAssociatedForm calling TreeScope::getElementById
1891         for a form associated element inside FormAttributeTargetObserver::idTargetChanged during the removal of
1892         the owner form element, or the first non-form element with the matching ID. If there are other elements with
1893         the same ID in the removed tree at that moment, MapEntry's count for the ID can be higher than it needs to be
1894         since Element::removedFromAncestor has not been called on those elements yet.
1895
1896         Fixed the bug by checking this condition explicitly. This patch introduces ContainerChildRemovalScope which
1897         keeps track of the container node from which a subtree was removed as well as the root of the removed subtree.
1898         DocumentOrderedMap::get then checks whether the matching element can be found in this removed subtree, and its
1899         isConnected() still returns true (the evidence that Element::removedFromAncestor has not been called) when
1900         count > 0 and there was no matching element in the tree scope.
1901
1902         In the long term, we should refactor the way FormAssociatedElement and HTMLFormElement refers to each other
1903         and avoid calling DocumentOrderedMap::get before finish calling removedFromAncestor on the removed subtree.
1904
1905         Tests: fast/forms/update-form-owner-in-moved-subtree-assertion-failure-5.html
1906                fast/forms/update-form-owner-in-moved-subtree-assertion-failure-6.html
1907
1908         * dom/ContainerNodeAlgorithms.cpp:
1909         (WebCore::notifyChildNodeRemoved):
1910         * dom/ContainerNodeAlgorithms.h:
1911         (WebCore::ContainerChildRemovalScope): Added.
1912         (WebCore::ContainerChildRemovalScope::ContainerChildRemovalScope):
1913         (WebCore::ContainerChildRemovalScope::~ContainerChildRemovalScope):
1914         (WebCore::ContainerChildRemovalScope::parentOfRemovedTree):
1915         (WebCore::ContainerChildRemovalScope::removedChild):
1916         (WebCore::ContainerChildRemovalScope::currentScope):
1917         * dom/DocumentOrderedMap.cpp:
1918         (WebCore::DocumentOrderedMap::get const): Added a special early exit when this function is called during
1919         a node removal.
1920
1921 2017-12-18  Timothy Hatcher  <timothy@hatcher.name>
1922
1923         [GTK][WPE] Conditionalize libTASN1 use behind ENABLE_SUBTLE_CRYPTO in the CMake files
1924         https://bugs.webkit.org/show_bug.cgi?id=180949
1925
1926         Reviewed by Carlos Alberto Lopez Perez.
1927
1928         * PlatformGTK.cmake: Move the include path and library additions to conditional ENABLE_SUBTLE_CRYPTO section.
1929         * PlatformWPE.cmake: Ditto.
1930
1931 2017-12-18  Wenson Hsieh  <wenson_hsieh@apple.com>
1932
1933         [Attachment Support] Support representing pasted or dropped content using attachment elements
1934         https://bugs.webkit.org/show_bug.cgi?id=180892
1935         <rdar://problem/36064210>
1936
1937         Reviewed by Tim Horton.
1938
1939         Support dropping and pasting attributed strings that contain NSTextAttachments. Teaches
1940         replaceRichContentWithAttachmentsIfNecessary to replace object elements with attachments; see comments below for
1941         more details.
1942
1943         Test: WKAttachmentTests.InsertPastedAttributedStringContainingMultipleAttachments
1944
1945         * editing/WebContentReader.h:
1946
1947         Add BlobReplacementInfo, which contains a map of blob URLs to replacement Blobs, as well as a map of blob URLs
1948         to replaced subresource URLs.
1949
1950         (WebCore::BlobReplacementInfo::isEmpty const):
1951         * editing/cocoa/EditorCocoa.mm:
1952         (WebCore::Editor::replaceSelectionWithAttributedString):
1953         * editing/cocoa/WebArchiveResourceFromNSAttributedString.h:
1954         * editing/cocoa/WebArchiveResourceFromNSAttributedString.mm:
1955
1956         Implement -[WebArchiveResourceFromNSAttributedString MIMEType]. UIFoundation asks for -MIMEType in the process
1957         of generating markup from NSTextAttachments; this currently causes the web process to crash on an unrecognized
1958         selector.
1959
1960         Additionally, work around <rdar://problem/36074429>, a UIFoundation bug in which all but a few hard-coded file
1961         extensions actually yield MIME types that are more specific than "application/octet-stream". This can safely be
1962         removed once <rdar://problem/36074429> is addressed.
1963
1964         (-[WebArchiveResourceFromNSAttributedString MIMEType]):
1965         * editing/cocoa/WebContentReaderCocoa.mm:
1966         (WebCore::replaceRichContentWithAttachmentsIfNecessary):
1967
1968         Try to replace object elements with attachments, and also tweak the title of the attachment's File to use the
1969         replaced subresource's filename if possible. Additionally, abstracts out information for replacing object or
1970         image elements (formerly a pair of { File, Element }) into a separate struct, and add a AttachmentDisplayMode
1971         parameter to determine whether the attachment should be presented in-line (in the case of images), or as an icon.
1972
1973         (WebCore::attributesForAttributedStringConversion):
1974
1975         Only exclude object elements from being generated from NSTextAttachments if the attachment element runtime
1976         feature is disabled, or !ENABLE(ATTACHMENT_ELEMENT).
1977
1978         (WebCore::createFragmentAndAddResources):
1979
1980         Additionally keep track of a mapping from blob URL => replaced subresource URL. In all the places where we
1981         previously only plumbed a map of blob URL => Blob, use a BlobReplacementInfo struct instead, which now includes
1982         a map from blob URL => replaced URL.
1983
1984         (WebCore::sanitizeMarkupWithArchive):
1985         (WebCore::WebContentReader::readWebArchive):
1986         (WebCore::WebContentMarkupReader::readWebArchive):
1987         (WebCore::WebContentReader::readRTFD):
1988         (WebCore::WebContentMarkupReader::readRTFD):
1989         (WebCore::WebContentReader::readRTF):
1990         (WebCore::WebContentMarkupReader::readRTF):
1991         (WebCore::WebContentReader::readImage):
1992
1993 2017-12-18  Youenn Fablet  <youenn@apple.com>
1994
1995         Service worker served response tainting should keep its tainting
1996         https://bugs.webkit.org/show_bug.cgi?id=180952
1997
1998         Reviewed by Chris Dumez.
1999
2000         Covered by rebased tests.
2001
2002         * loader/cache/CachedResource.cpp:
2003         (WebCore::CachedResource::setResponse):
2004
2005 2017-12-18  Wenson Hsieh  <wenson_hsieh@apple.com>
2006
2007         Unreviewed, attempt to fix watch and TV builds after r226085
2008
2009         Explicitly include a header in WebContentReaderCocoa.mm.
2010
2011         * editing/cocoa/WebContentReaderCocoa.mm:
2012
2013 2017-12-18  Brady Eidson  <beidson@apple.com>
2014
2015         Add ability to API test Service Workers via a custom protocol.
2016         https://bugs.webkit.org/show_bug.cgi?id=180911
2017
2018         Reviewed by Chris Dumez.
2019
2020         Covered by API test ServiceWorkers.Basic
2021
2022         This adds a set of "Service Workers can handle this" schemes to the scheme registry
2023         and uses it for SW decisions instead of a handful of previous techniques.
2024
2025         * bindings/scripts/CodeGeneratorJS.pm:
2026         (NeedsRuntimeCheck):
2027         (GenerateRuntimeEnableConditionalString):
2028         * bindings/scripts/IDLAttributes.json:
2029
2030         * dom/ScriptExecutionContext.cpp:
2031         (WebCore::ScriptExecutionContext::hasServiceWorkerScheme):
2032         * dom/ScriptExecutionContext.h:
2033
2034         * page/NavigatorServiceWorker.idl:
2035
2036         * platform/SchemeRegistry.cpp:
2037         (WebCore::serviceWorkerSchemesLock):
2038         (WebCore::serviceWorkerSchemes):
2039         (WebCore::SchemeRegistry::registerURLSchemeServiceWorkersCanHandle):
2040         (WebCore::SchemeRegistry::canServiceWorkersHandleURLScheme):
2041         (WebCore::SchemeRegistry::isServiceWorkerContainerCustomScheme):
2042         * platform/SchemeRegistry.h:
2043
2044         * workers/service/ServiceWorkerContainer.cpp:
2045         (WebCore::ServiceWorkerContainer::addRegistration):
2046
2047         * workers/service/server/SWServerJobQueue.cpp:
2048         (WebCore::SWServerJobQueue::runRegisterJob):
2049
2050 2017-12-18  Chris Dumez  <cdumez@apple.com>
2051
2052         We should use "error" redirect mode for fetching service worker scripts
2053         https://bugs.webkit.org/show_bug.cgi?id=180950
2054
2055         Reviewed by Youenn Fablet.
2056
2057         We should use "error" redirect mode for fetching service worker scripts, as per:
2058         - https://w3c.github.io/ServiceWorker/#update (Step 7.5)
2059
2060         No new tests, rebaselined existing test.
2061
2062         * loader/SubresourceLoader.cpp:
2063         (WebCore::SubresourceLoader::willSendRequestInternal):
2064         * workers/Worker.cpp:
2065         (WebCore::Worker::create):
2066         * workers/WorkerScriptLoader.cpp:
2067         (WebCore::WorkerScriptLoader::loadAsynchronously):
2068         * workers/WorkerScriptLoader.h:
2069         * workers/service/ServiceWorkerJob.cpp:
2070         (WebCore::ServiceWorkerJob::fetchScriptWithContext):
2071
2072 2017-12-18  Chris Dumez  <cdumez@apple.com>
2073
2074         ExtendableMessageEvent constructor fails to initialize the 'source' attribute
2075         https://bugs.webkit.org/show_bug.cgi?id=180954
2076
2077         Reviewed by Youenn Fablet.
2078
2079         No new tests, rebaselined existing test.
2080
2081         * workers/service/ExtendableMessageEvent.cpp:
2082         (WebCore::ExtendableMessageEvent::ExtendableMessageEvent):
2083
2084 2017-12-18  Wenson Hsieh  <wenson_hsieh@apple.com>
2085
2086         [Attachment Support] Insert images as inline attachments when pasting and dropping
2087         https://bugs.webkit.org/show_bug.cgi?id=180853
2088         <rdar://problem/35756268>
2089
2090         Reviewed by Tim Horton.
2091
2092         Adds support for transforming dropped and pasted web content fragments prior to insertion, such that inline
2093         elements (so far, only images) are replaced with attachment elements that have an inline representation. See
2094         below comments for more detail.
2095
2096         Tests: WKAttachmentTests.InsertPastedImageAsAttachment
2097                WKAttachmentTests.InsertPastedAttributedStringContainingImage
2098                WKAttachmentTestsMac.InsertPastedFileURLsAsAttachments
2099                WKAttachmentTestsIOS.InsertDroppedImageAsAttachment
2100                WKAttachmentTestsIOS.InsertDroppedAttributedStringContainingAttachment
2101
2102         * editing/WebContentReader.h:
2103         * editing/cocoa/EditorCocoa.mm:
2104         (WebCore::Editor::replaceSelectionWithAttributedString):
2105
2106         Add a new helper to replace elements in a DOM fragment with inline attachment elements instead, using the given
2107         Blobs. So far, we only replace image elements with these attachments, by mapping the source of each image to a
2108         Blob, and constructing a replacement attachment backed by a File constructed from the image's corresponding
2109         Blob. However, this mechanism can be generalized in the future to handle transformations from arbitrary elements
2110         to attachment elements capable of representing the same elements using inline display mode.
2111
2112         This function is a noop if the attachment elements are disabled via runtime-enabled features.
2113
2114         * editing/cocoa/WebContentReaderCocoa.mm:
2115         (WebCore::replaceRichContentWithAttachmentsIfNecessary):
2116         (WebCore::createFragmentAndAddResources):
2117         (WebCore::sanitizeMarkupWithArchive):
2118
2119         Add out-params to both of these helper functions that capture the map of blob URLs to Blobs being used to
2120         replace subresource URLs in the pasted/dropped DOM fragment.
2121
2122         (WebCore::WebContentReader::readWebArchive):
2123         (WebCore::WebContentMarkupReader::readWebArchive):
2124         (WebCore::createFragmentFromAttributedString):
2125         (WebCore::WebContentReader::readRTFD):
2126         (WebCore::WebContentMarkupReader::readRTFD):
2127         (WebCore::WebContentReader::readRTF):
2128         (WebCore::WebContentMarkupReader::readRTF):
2129         (WebCore::WebContentReader::readImage):
2130
2131         In these places where we swap out subresource URLs for blob URLs, collect a map of blob URL => Blob, and use it
2132         to replace images in the DOM with attachments (if needed, and possible).
2133
2134         * editing/mac/WebContentReaderMac.mm:
2135         (WebCore::WebContentReader::readFilenames):
2136
2137         Augment existing logic to generate attachment elements when pasting or dropping file URLs, so that the generated
2138         attachment elements also have titles, subtitles, and content type information.
2139
2140         * html/HTMLAttachmentElement.cpp:
2141         (WebCore::HTMLAttachmentElement::setFile):
2142
2143         Add an optional second param, UpdateDisplayAttributes. If UpdateDisplayAttributes::Yes is passed in, then we set
2144         the elements's attributes that are displayed in the attachment representation (title, subtitle, and type) using
2145         the given File.
2146
2147         (WebCore::HTMLAttachmentElement::updateFileWithData):
2148         (WebCore::HTMLAttachmentElement::populateShadowRootIfNecessary):
2149
2150         Make a small tweak to correctly handle the case where an attachment with a content type that is a UTI is being
2151         displayed inline. Content type can either be a UTI or a MIME type, but the code to construct the shadow tree of
2152         an attachment element only handles MIME types.
2153
2154         * html/HTMLAttachmentElement.h:
2155
2156 2017-12-18  Youenn Fablet  <youenn@apple.com>
2157
2158         SameOrigin and CORS fetch should fail on opaque responses served from ServiceWorker
2159         https://bugs.webkit.org/show_bug.cgi?id=180941
2160
2161         Reviewed by Chris Dumez.
2162
2163         Covered by rebased tests.
2164
2165         * loader/SubresourceLoader.cpp:
2166         (WebCore::SubresourceLoader::checkResponseCrossOriginAccessControl):
2167
2168 2017-12-18  Dean Jackson  <dino@apple.com>
2169
2170         Make some functions in GraphicsContextCG use call_once for statics
2171         https://bugs.webkit.org/show_bug.cgi?id=180841
2172         <rdar://problem/36058448>
2173
2174         Reviewed by Antoine Quint.
2175
2176         In preparation for making OffscreenCanvas operate inside a Worker,
2177         make sure GraphicsContext is thread safe. Change some functions
2178         that use a static to call_once.
2179
2180         * platform/graphics/cg/GraphicsContextCG.cpp:
2181         (WebCore::sRGBColorSpaceRef):
2182         (WebCore::linearRGBColorSpaceRef):
2183         (WebCore::extendedSRGBColorSpaceRef):
2184         (WebCore::displayP3ColorSpaceRef):
2185
2186 2017-12-18  Chris Dumez  <cdumez@apple.com>
2187
2188         ExtendableMessageEvent.data should return the value it was initialized to
2189         https://bugs.webkit.org/show_bug.cgi?id=180868
2190
2191         Reviewed by Geoffrey Garen.
2192
2193         No new tests, rebaselined existing test.
2194
2195         * bindings/js/JSExtendableMessageEventCustom.cpp:
2196         (WebCore::constructJSExtendableMessageEvent):
2197         * workers/service/ExtendableMessageEvent.cpp:
2198         (WebCore::ExtendableMessageEvent::ExtendableMessageEvent):
2199         * workers/service/ExtendableMessageEvent.idl:
2200
2201 2017-12-18  Megan Gardner  <megan_gardner@apple.com>
2202
2203         Support Autoscrolling in contenteditable for WK2
2204         https://bugs.webkit.org/show_bug.cgi?id=180789
2205
2206         Reviewed by Simon Frasier and Wenson Hsieh..
2207
2208         Activate the autoscrollController to scroll to the position provided to us by the
2209         UIProcess. Allows for scrolling in contentEditable for WebKit2
2210
2211         Test: fast/events/touch/ios/drag-to-autoscroll-in-single-line-editable.html
2212
2213         * page/AutoscrollController.cpp:
2214         (WebCore::AutoscrollController::autoscrollTimerFired):
2215         * page/EventHandler.cpp:
2216         (WebCore::EventHandler::clearOrScheduleClearingLatchedStateIfNeeded):
2217         (WebCore::EventHandler::targetPositionForSelectionAutoscroll const):
2218         (WebCore::EventHandler::shouldUpdateAutoscroll):
2219         (WebCore::EventHandler::effectiveMousePositionForSelectionAutoscroll const): Deleted.
2220         * page/EventHandler.h:
2221         * page/ios/EventHandlerIOS.mm:
2222         (WebCore::EventHandler::startTextAutoscroll):
2223         (WebCore::EventHandler::cancelTextAutoscroll):
2224         (WebCore::EventHandler::targetPositionForSelectionAutoscroll const):
2225         (WebCore::EventHandler::shouldUpdateAutoscroll):
2226         * page/mac/EventHandlerMac.mm:
2227         (WebCore::EventHandler::targetPositionForSelectionAutoscroll const):
2228         (WebCore::EventHandler::effectiveMousePositionForSelectionAutoscroll const): Deleted.
2229
2230 2017-12-18  Youenn Fablet  <youenn@apple.com>
2231
2232         Add support for response blob given to fetch events
2233         https://bugs.webkit.org/show_bug.cgi?id=180894
2234
2235         Reviewed by Darin Adler.
2236
2237         Covered by updated test expectations.
2238
2239         Adding support for getting a blob URL from a FormData that only contains one blob.
2240         Adding support to create a FetcLoader from a ServiceWorkerThreadProxy
2241
2242         * Modules/fetch/FetchLoader.cpp:
2243         (WebCore::FetchLoader::start):
2244         (WebCore::FetchLoader::startLoadingBlobURL):
2245         * Modules/fetch/FetchLoader.h:
2246         * WebCore.xcodeproj/project.pbxproj:
2247         * platform/network/FormData.cpp:
2248         (WebCore::FormData::asBlobURL const):
2249         * platform/network/FormData.h:
2250         * workers/service/context/ServiceWorkerThreadProxy.cpp:
2251         (WebCore::ServiceWorkerThreadProxy::createBlobLoader):
2252         * workers/service/context/ServiceWorkerThreadProxy.h:
2253
2254 2017-12-18  Zalan Bujtas  <zalan@apple.com>
2255
2256         [SVG] Detach list wrappers before resetting the base value.
2257         https://bugs.webkit.org/show_bug.cgi?id=180912
2258         <rdar://problem/36017970>
2259
2260         Reviewed by Simon Fraser.
2261
2262         Before resetting the animation value (and destroying the assigned SVG object -SVGLengthValue in this case),
2263         we need to check if there's an associated tear off wrapper for the said SVG object and make a copy of it.
2264         This is currently done in the wrong order through animValDidChange.
2265
2266         Test: svg/animations/crash-when-animation-is-running-while-getting-value.html
2267
2268         * svg/SVGAnimatedTypeAnimator.h:
2269         (WebCore::SVGAnimatedTypeAnimator::resetFromBaseValue):
2270         * svg/properties/SVGAnimatedPropertyTearOff.h:
2271         * svg/properties/SVGAnimatedStaticPropertyTearOff.h:
2272         (WebCore::SVGAnimatedStaticPropertyTearOff::synchronizeWrappersIfNeeded):
2273
2274 2017-12-18  Brady Eidson  <beidson@apple.com>
2275
2276         REGRESSION: ASSERTION FAILED: !m_importCompleted
2277         https://bugs.webkit.org/show_bug.cgi?id=180935
2278
2279         Unreviewed bot gardening.
2280
2281         No new tests (Covered by existing tests)
2282
2283         The ASSERT was invalid for database pushes failing to open databases like this, so skip it for that scenario.
2284
2285         * workers/service/server/RegistrationStore.cpp:
2286         (WebCore::RegistrationStore::databaseFailedToOpen):
2287         * workers/service/server/SWServer.cpp:
2288         (WebCore::SWServer::registrationStoreDatabaseFailedToOpen):
2289         * workers/service/server/SWServer.h:
2290
2291 2017-12-18  Jer Noble  <jer.noble@apple.com>
2292
2293         Playing media elements which call "pause(); play()" will have the play promise rejected.
2294         https://bugs.webkit.org/show_bug.cgi?id=180781
2295
2296         Reviewed by Eric Carlson.
2297
2298         Test: media/video-pause-play-resolve.html
2299
2300         When scheduling a rejection or resolution of existing play promises, move() the existing
2301         promises into the block. This ensures that valid promises aren't added to the play promise
2302         vector between when a rejection is scheduled and when it runs.
2303
2304         Drive-by fix: Don't return false from playInternal() just so the newly created promise will
2305         get rejected. The pause() command will reject the promise, so just make sure it's added to
2306         the m_pendingPlayPromises before calling playInternal().
2307
2308         Drive-by fix #2: The spec referenced by playInternal() and pauseInternal() doesn't say to
2309         call the "Media Element Load Algorithm" (i.e., prepareForLoad()); it says to call the
2310         "Resource Selection Algorithm" (i.e., selectMediaResource()). But fixing this bug caused
2311         an assertion crash when the resource selection task was fired and m_player was null. This
2312         was because the algorithm is being run at stop() time due to stop() calling pause(). The
2313         solution to this ASSERT is to stop the m_resourceSelectionTaskQueue in stop().
2314
2315         * html/HTMLMediaElement.cpp:
2316         (WebCore::HTMLMediaElement::scheduleRejectPendingPlayPromises):
2317         (WebCore::HTMLMediaElement::rejectPendingPlayPromises):
2318         (WebCore::HTMLMediaElement::resolvePendingPlayPromises):
2319         (WebCore::HTMLMediaElement::scheduleNotifyAboutPlaying):
2320         (WebCore::HTMLMediaElement::notifyAboutPlaying):
2321         (WebCore::HTMLMediaElement::noneSupported):
2322         (WebCore::HTMLMediaElement::cancelPendingEventsAndCallbacks):
2323         (WebCore::HTMLMediaElement::play):
2324         (WebCore::HTMLMediaElement::playInternal):
2325         (WebCore::HTMLMediaElement::pauseInternal):
2326         (WebCore::HTMLMediaElement::stop):
2327         * html/HTMLMediaElement.h:
2328
2329 2017-12-18  Daniel Bates  <dabates@apple.com>
2330
2331         Add SPI to query for the current and last auto fill button type and pass user data object to _webView:focusShouldStartInputSession:
2332         https://bugs.webkit.org/show_bug.cgi?id=180774
2333         <rdar://problem/36033832>
2334
2335         Reviewed by Tim Horton.
2336
2337         Expose a way for an embedding client to query for the auto fill button type of a specific
2338         input element as it may not be feasible for a client to track such state themselves. For
2339         similar reasons track and expose SPI to query for the last auto fill button type for a
2340         specific field.
2341
2342         Test: fast/forms/auto-fill-button/last-auto-fill-button-type.html
2343
2344         * html/HTMLInputElement.cpp:
2345         (WebCore::HTMLInputElement::HTMLInputElement):
2346         (WebCore::HTMLInputElement::setShowAutoFillButton):
2347         Update the last auto fill button type.
2348
2349         * html/HTMLInputElement.h:
2350         (WebCore::HTMLInputElement::lastAutoFillButtonType const): Added.
2351
2352         * testing/Internals.cpp:
2353         (WebCore::toAutoFillButtonType):
2354         (WebCore::toInternalsAutoFillButtonType):
2355         (WebCore::Internals::autoFillButtonType):
2356         (WebCore::Internals::lastAutoFillButtonType):
2357         * testing/Internals.h:
2358         * testing/Internals.idl:
2359         Add functions for testing.
2360
2361 2017-12-17  John Wilander  <wilander@apple.com>
2362
2363         Storage Access API: Make document.hasStorageAccess() retrieve current status from the network process
2364         https://bugs.webkit.org/show_bug.cgi?id=180681
2365         <rdar://problem/35982161>
2366
2367         Reviewed by Alex Christensen.
2368
2369         Tests: http/tests/storageAccess/has-storage-access-from-prevalent-domain-with-non-recent-user-interaction.html
2370                http/tests/storageAccess/has-storage-access-from-prevalent-domain-with-recent-user-interaction.html
2371
2372         This change makes an asynchronous request to the network process
2373         to see if storage access has been granted for this frame, on this
2374         page, for this domain.
2375
2376         * dom/Document.cpp:
2377         (WebCore::Document::hasStorageAccess):
2378         * page/ChromeClient.h:
2379
2380 2017-12-17  Chris Dumez  <cdumez@apple.com>
2381
2382         Strip fragment identifier from ServiceWorker's scriptURL
2383         https://bugs.webkit.org/show_bug.cgi?id=180887
2384
2385         Reviewed by Darin Adler.
2386
2387         Strip fragment identifier from ServiceWorker's scriptURL to match Firefox and Chrome.
2388         This behavior does not appear to be specified so I filed:
2389         - https://github.com/w3c/ServiceWorker/issues/1249
2390
2391         No new tests, rebaselined existing test.
2392
2393         * workers/service/server/SWServerWorker.cpp:
2394         (WebCore::m_script):
2395
2396 2017-12-17  Antti Koivisto  <antti@apple.com>
2397
2398         Move render tree updating related files under rendering/updating/
2399         https://bugs.webkit.org/show_bug.cgi?id=180918
2400
2401         Reviewed by Darin Adler.
2402
2403         * CMakeLists.txt:
2404         * Sources.txt:
2405         * WebCore.xcodeproj/project.pbxproj:
2406         * rendering/RenderTreeBuilder.cpp: Removed.
2407         * rendering/RenderTreeBuilder.h: Removed.
2408         * rendering/updating: Added.
2409         * rendering/updating/RenderTreeBuilder.cpp: Copied from Source/WebCore/rendering/RenderTreeBuilder.cpp.
2410         * rendering/updating/RenderTreeBuilder.h: Copied from Source/WebCore/rendering/RenderTreeBuilder.h.
2411         * rendering/updating/RenderTreePosition.cpp: Copied from Source/WebCore/style/RenderTreePosition.cpp.
2412         * rendering/updating/RenderTreePosition.h: Copied from Source/WebCore/style/RenderTreePosition.h.
2413         * rendering/updating/RenderTreeUpdater.cpp: Copied from Source/WebCore/style/RenderTreeUpdater.cpp.
2414         * rendering/updating/RenderTreeUpdater.h: Copied from Source/WebCore/style/RenderTreeUpdater.h.
2415         * rendering/updating/RenderTreeUpdaterFirstLetter.cpp: Copied from Source/WebCore/style/RenderTreeUpdaterFirstLetter.cpp.
2416         * rendering/updating/RenderTreeUpdaterFirstLetter.h: Copied from Source/WebCore/style/RenderTreeUpdaterFirstLetter.h.
2417         * rendering/updating/RenderTreeUpdaterGeneratedContent.cpp: Copied from Source/WebCore/style/RenderTreeUpdaterGeneratedContent.cpp.
2418         * rendering/updating/RenderTreeUpdaterGeneratedContent.h: Copied from Source/WebCore/style/RenderTreeUpdaterGeneratedContent.h.
2419         * rendering/updating/RenderTreeUpdaterListItem.cpp: Copied from Source/WebCore/style/RenderTreeUpdaterListItem.cpp.
2420         * rendering/updating/RenderTreeUpdaterListItem.h: Copied from Source/WebCore/style/RenderTreeUpdaterListItem.h.
2421         * rendering/updating/RenderTreeUpdaterMultiColumn.cpp: Copied from Source/WebCore/style/RenderTreeUpdaterMultiColumn.cpp.
2422         * rendering/updating/RenderTreeUpdaterMultiColumn.h: Copied from Source/WebCore/style/RenderTreeUpdaterMultiColumn.h.
2423         * style/RenderTreePosition.cpp: Removed.
2424         * style/RenderTreePosition.h: Removed.
2425         * style/RenderTreeUpdater.cpp: Removed.
2426         * style/RenderTreeUpdater.h: Removed.
2427         * style/RenderTreeUpdaterFirstLetter.cpp: Removed.
2428         * style/RenderTreeUpdaterFirstLetter.h: Removed.
2429         * style/RenderTreeUpdaterGeneratedContent.cpp: Removed.
2430         * style/RenderTreeUpdaterGeneratedContent.h: Removed.
2431         * style/RenderTreeUpdaterListItem.cpp: Removed.
2432         * style/RenderTreeUpdaterListItem.h: Removed.
2433         * style/RenderTreeUpdaterMultiColumn.cpp: Removed.
2434         * style/RenderTreeUpdaterMultiColumn.h: Removed.
2435
2436 2017-12-17  Yusuke Suzuki  <utatane.tea@gmail.com>
2437
2438         [JSC][WebCore][CSSJIT] Remove VM reference in CSSJIT
2439         https://bugs.webkit.org/show_bug.cgi?id=180917
2440
2441         Reviewed by Sam Weinig.
2442
2443         Remove VM reference in CSSJIT. CSSJIT should not be
2444         bound to a specific VM.
2445
2446         No behavior change.
2447
2448         * css/ElementRuleCollector.cpp:
2449         (WebCore::ElementRuleCollector::ruleMatches):
2450         * cssjit/SelectorCompiler.cpp:
2451         (WebCore::SelectorCompiler::compileSelector):
2452         * cssjit/SelectorCompiler.h:
2453         * dom/SelectorQuery.cpp:
2454         (WebCore::SelectorDataList::compileSelector):
2455         (WebCore::SelectorDataList::execute const):
2456         * dom/SelectorQuery.h:
2457
2458 2017-12-16  Dan Bernstein  <mitz@apple.com>
2459
2460         WKWebView has no equivalent of -[WebView setAlwaysShowVerticalScroller:]
2461         https://bugs.webkit.org/show_bug.cgi?id=180613
2462         <rdar://problem/35946124>
2463
2464         Reviewed by Geoff Garen.
2465
2466         Test: TestWebKitAPI/Tests/WebKitCocoa/WKWebViewAlwaysShowsScroller.mm
2467
2468         * platform/ScrollView.h: Exported setScrollbarModes.
2469
2470 2017-12-16  Antti Koivisto  <antti@apple.com>
2471
2472         Introduce RenderTreeBuilder
2473         https://bugs.webkit.org/show_bug.cgi?id=180817
2474
2475         Reviewed by Zalan Bujtas.
2476
2477         RenderTreeBuilder is responsible of building the render tree, including construction of various anonymous
2478         renderers. Renderer subtype specific render tree construction code will eventually move there.
2479
2480         This patch adds RenderTreeBuilder class and passes it as a parameter for all addChild implementations.
2481         Future patches can then mechanically move the building code from renderers to RenderTreeBuilder.
2482
2483         It also moves one addChild implementation (RenderRuby::addChild -> RenderTreeBuilder::rubyRunInsertChild)
2484         to RenderTreeBuilder as a test.
2485
2486         * WebCore.xcodeproj/project.pbxproj:
2487         * rendering/RenderBlock.cpp:
2488         (WebCore::RenderBlock::addChildToContinuation):
2489         (WebCore::RenderBlock::addChild):
2490         (WebCore::RenderBlock::addChildIgnoringContinuation):
2491         * rendering/RenderBlock.h:
2492         * rendering/RenderBlockFlow.cpp:
2493         (WebCore::RenderBlockFlow::addChild):
2494         * rendering/RenderBlockFlow.h:
2495         * rendering/RenderBoxModelObject.cpp:
2496         (WebCore::RenderBoxModelObject::moveChildTo):
2497         * rendering/RenderButton.cpp:
2498         (WebCore::RenderButton::addChild):
2499         (WebCore::RenderButton::setText):
2500         * rendering/RenderButton.h:
2501         * rendering/RenderElement.cpp:
2502         (WebCore::RenderElement::addChild):
2503         * rendering/RenderElement.h:
2504         (WebCore::RenderElement::addChildIgnoringContinuation):
2505         * rendering/RenderFullScreen.cpp:
2506         (WebCore::RenderFullScreen::wrapNewRenderer):
2507         (WebCore::RenderFullScreen::wrapExistingRenderer):
2508         (WebCore::RenderFullScreen::unwrapRenderer):
2509         (WebCore::RenderFullScreen::createPlaceholder):
2510         * rendering/RenderGrid.cpp:
2511         (WebCore::RenderGrid::addChild):
2512         * rendering/RenderGrid.h:
2513         * rendering/RenderInline.cpp:
2514         (WebCore::RenderInline::addChild):
2515         (WebCore::RenderInline::addChildIgnoringContinuation):
2516         (WebCore::RenderInline::splitInlines):
2517         (WebCore::RenderInline::splitFlow):
2518         (WebCore::RenderInline::addChildToContinuation):
2519         (WebCore::RenderInline::childBecameNonInline):
2520         * rendering/RenderInline.h:
2521         * rendering/RenderMenuList.cpp:
2522         (WebCore::RenderMenuList::createInnerBlock):
2523         (RenderMenuList::addChild):
2524         (RenderMenuList::setText):
2525         * rendering/RenderMenuList.h:
2526         * rendering/RenderMultiColumnFlow.cpp:
2527         (WebCore::RenderMultiColumnFlow::processPossibleSpannerDescendant):
2528         * rendering/RenderQuote.cpp:
2529         (WebCore::RenderQuote::updateTextRenderer):
2530         (WebCore::RenderQuote::updateRenderer):
2531         * rendering/RenderQuote.h:
2532         * rendering/RenderRuby.cpp:
2533         (WebCore::RenderRubyAsInline::addChild):
2534         (WebCore::RenderRubyAsBlock::addChild):
2535         * rendering/RenderRuby.h:
2536         * rendering/RenderRubyBase.h:
2537         * rendering/RenderRubyRun.cpp:
2538         (WebCore::RenderRubyRun::rubyBaseSafe):
2539         (WebCore::RenderRubyRun::addChild): Deleted.
2540         * rendering/RenderRubyRun.h:
2541         * rendering/RenderTable.cpp:
2542         (WebCore::RenderTable::addChild):
2543         * rendering/RenderTable.h:
2544         * rendering/RenderTableRow.cpp:
2545         (WebCore::RenderTableRow::addChild):
2546         * rendering/RenderTableRow.h:
2547         * rendering/RenderTableSection.cpp:
2548         (WebCore::RenderTableSection::addChild):
2549         * rendering/RenderTableSection.h:
2550         * rendering/RenderTreeBuilder.cpp: Added.
2551         (WebCore::RenderTreeBuilder::RenderTreeBuilder):
2552         (WebCore::RenderTreeBuilder::~RenderTreeBuilder):
2553         (WebCore::RenderTreeBuilder::insertChild):
2554         (WebCore::RenderTreeBuilder::rubyRunInsertChild):
2555         * rendering/RenderTreeBuilder.h: Added.
2556         (WebCore::RenderTreeBuilder::current):
2557         * rendering/TextAutoSizing.cpp:
2558         (WebCore::TextAutoSizingValue::adjustTextNodeSizes):
2559         * rendering/mathml/RenderMathMLFenced.cpp:
2560         (WebCore::RenderMathMLFenced::updateFromElement):
2561         (WebCore::RenderMathMLFenced::makeFences):
2562         (WebCore::RenderMathMLFenced::addChild):
2563         * rendering/mathml/RenderMathMLFenced.h:
2564         * rendering/svg/RenderSVGContainer.cpp:
2565         (WebCore::RenderSVGContainer::addChild):
2566         * rendering/svg/RenderSVGContainer.h:
2567         * rendering/svg/RenderSVGInline.cpp:
2568         (WebCore::RenderSVGInline::addChild):
2569         * rendering/svg/RenderSVGInline.h:
2570         * rendering/svg/RenderSVGRoot.cpp:
2571         (WebCore::RenderSVGRoot::addChild):
2572         * rendering/svg/RenderSVGRoot.h:
2573         * rendering/svg/RenderSVGText.cpp:
2574         (WebCore::RenderSVGText::addChild):
2575         * rendering/svg/RenderSVGText.h:
2576         * style/RenderTreePosition.cpp:
2577         (WebCore::RenderTreePosition::insert): Deleted.
2578         * style/RenderTreePosition.h:
2579         (WebCore::RenderTreePosition::RenderTreePosition):
2580         (WebCore::RenderTreePosition::nextSibling const):
2581         (WebCore::RenderTreePosition::canInsert const): Deleted.
2582         * style/RenderTreeUpdater.cpp:
2583         (WebCore::RenderTreeUpdater::updateAfterDescendants):
2584         (WebCore::RenderTreeUpdater::createRenderer):
2585         (WebCore::RenderTreeUpdater::createTextRenderer):
2586         (WebCore::RenderTreeUpdater::updateTextRenderer):
2587         (WebCore::createTextRenderer): Deleted.
2588         * style/RenderTreeUpdater.h:
2589         * style/RenderTreeUpdaterFirstLetter.cpp:
2590         (WebCore::updateFirstLetterStyle):
2591         (WebCore::createFirstLetterRenderer):
2592         * style/RenderTreeUpdaterGeneratedContent.cpp:
2593         (WebCore::RenderTreeUpdater::GeneratedContent::updateQuotesUpTo):
2594         (WebCore::createContentRenderers):
2595         (WebCore::RenderTreeUpdater::GeneratedContent::updatePseudoElement):
2596         * style/RenderTreeUpdaterListItem.cpp:
2597         (WebCore::RenderTreeUpdater::ListItem::updateMarker):
2598         * style/RenderTreeUpdaterListItem.h:
2599         * style/RenderTreeUpdaterMultiColumn.cpp:
2600         (WebCore::RenderTreeUpdater::MultiColumn::createFragmentedFlow):
2601         (WebCore::RenderTreeUpdater::MultiColumn::destroyFragmentedFlow):
2602
2603 2017-12-16  Romain Bellessort  <romain.bellessort@crf.canon.fr>
2604
2605         [Readable Streams API] Fix filling of descriptor from queue
2606         https://bugs.webkit.org/show_bug.cgi?id=172717
2607
2608         Reviewed by Youenn Fablet.
2609
2610         Fixed the filling of descriptor from queue (step 10.d at [1]). When first implemented,
2611         spec comprised a bug and code was not reachable. Spec has now been fixed and code can
2612         now be reached.
2613
2614         [1] https://streams.spec.whatwg.org/#readable-byte-stream-controller-fill-pull-into-descriptor-from-queue
2615
2616         No new tests (covered by WPT tests, whose expectations have been updated).
2617
2618         * Modules/streams/ReadableByteStreamInternals.js:
2619         (readableByteStreamControllerFillDescriptorFromQueue): Updated.
2620
2621 2017-12-16  Brady Eidson  <beidson@apple.com>
2622
2623         Implement getting ServiceWorker registrations for the WKWebsiteDataStore API
2624         https://bugs.webkit.org/show_bug.cgi?id=180886
2625
2626         Reviewed by Chris Dumez.
2627
2628         No new tests (API test coming soon).
2629
2630         * workers/service/server/SWServer.cpp:
2631         (WebCore::SWServer::registrationStoreImportComplete):
2632         (WebCore::SWServer::SWServer):
2633         (WebCore::SWServer::getOriginsWithRegistrations):
2634         (WebCore::SWServer::performGetOriginsWithRegistrationsCallbacks):
2635         * workers/service/server/SWServer.h:
2636
2637 2017-12-16  Yusuke Suzuki  <utatane.tea@gmail.com>
2638
2639         Remove unnecessary boolean result of start() functions
2640         https://bugs.webkit.org/show_bug.cgi?id=180856
2641
2642         Reviewed by Darin Adler.
2643
2644         No behavior change.
2645
2646         * Modules/webaudio/AsyncAudioDecoder.cpp:
2647         (WebCore::AsyncAudioDecoder::~AsyncAudioDecoder):
2648         * Modules/webdatabase/DatabaseContext.cpp:
2649         (WebCore::DatabaseContext::databaseThread):
2650         * Modules/webdatabase/DatabaseThread.cpp:
2651         (WebCore::DatabaseThread::start):
2652         Now `Thread::create` always succeeds (if it fails, WebKit crashes).
2653         DatabaseThread::start() now always returns true. So, we do not need
2654         to return bool.
2655
2656         * Modules/webdatabase/DatabaseThread.h:
2657         * platform/network/curl/CurlDownload.cpp:
2658         (WebCore::CurlDownload::start):
2659         * platform/network/curl/CurlDownload.h:
2660         * platform/network/curl/ResourceHandleCurl.cpp:
2661         (WebCore::ResourceHandle::start):
2662         * platform/network/curl/ResourceHandleCurlDelegate.cpp:
2663         (WebCore::ResourceHandleCurlDelegate::start):
2664         * platform/network/curl/ResourceHandleCurlDelegate.h:
2665
2666 2017-12-16  Chris Dumez  <cdumez@apple.com>
2667
2668         Add optimization when updating a SW registration results in the exact same script
2669         https://bugs.webkit.org/show_bug.cgi?id=180891
2670
2671         Reviewed by Geoffrey Garen.
2672
2673         Add optimization when updating a SW registration results in the exact same script:
2674         - https://w3c.github.io/ServiceWorker/#update-algorithm (step 8)
2675
2676         No new tests, rebaselined existing test.
2677
2678         * workers/service/server/SWServerJobQueue.cpp:
2679         (WebCore::SWServerJobQueue::scriptFetchFinished):
2680
2681 2017-12-16  Youenn Fablet  <youenn@apple.com>
2682
2683         Service worker script fetch request should set the Service-Worker header
2684         https://bugs.webkit.org/show_bug.cgi?id=180889
2685
2686         Reviewed by Chris Dumez.
2687
2688         Test: http/wpt/service-workers/check-service-worker-header.https.html
2689
2690         Update WorkerScriptLoader to take a request instead of an URL.
2691         Updates Worker implementation and use it in ServiceWorkerJob to set the missing request header.
2692
2693         * workers/Worker.cpp:
2694         (WebCore::Worker::create):
2695         * workers/WorkerScriptLoader.cpp:
2696         (WebCore::WorkerScriptLoader::loadAsynchronously):
2697         * workers/WorkerScriptLoader.h:
2698         * workers/service/ServiceWorkerJob.cpp:
2699         (WebCore::ServiceWorkerJob::fetchScriptWithContext):
2700
2701 2017-12-15  Ryan Haddad  <ryanhaddad@apple.com>
2702
2703         Unreviewed, rolling out r225969.
2704
2705         This change introduced LayoutTest crashes.
2706
2707         Reverted changeset:
2708
2709         "Introduce RenderTreeBuilder"
2710         https://bugs.webkit.org/show_bug.cgi?id=180817
2711         https://trac.webkit.org/changeset/225969
2712
2713 2017-12-15  Chris Dumez  <cdumez@apple.com>
2714
2715         Support updating a service worker registration's updateViaCache flag
2716         https://bugs.webkit.org/show_bug.cgi?id=180888
2717
2718         Reviewed by Brady Eidson.
2719
2720         Support updating a service worker registration's updateViaCache flag to match other browsers:
2721         - https://github.com/w3c/ServiceWorker/issues/1189
2722
2723         No new tests, rebaselined existing test.
2724
2725         * workers/service/SWClientConnection.cpp:
2726         (WebCore::SWClientConnection::setRegistrationUpdateViaCache):
2727         * workers/service/SWClientConnection.h:
2728         * workers/service/ServiceWorkerRegistration.cpp:
2729         (WebCore::ServiceWorkerRegistration::setUpdateViaCache):
2730         * workers/service/ServiceWorkerRegistration.h:
2731         * workers/service/server/SWServer.h:
2732         * workers/service/server/SWServerJobQueue.cpp:
2733         (WebCore::SWServerJobQueue::runRegisterJob):
2734         * workers/service/server/SWServerRegistration.cpp:
2735         (WebCore::SWServerRegistration::setUpdateViaCache):
2736         * workers/service/server/SWServerRegistration.h:
2737
2738 2017-12-15  Ryan Haddad  <ryanhaddad@apple.com>
2739
2740         Unreviewed, rolling out r225941.
2741
2742         This change introduced LayoutTest crashes and assertion
2743         failures.
2744
2745         Reverted changeset:
2746
2747         "Web Inspector: replace HTMLCanvasElement with
2748         CanvasRenderingContext for instrumentation logic"
2749         https://bugs.webkit.org/show_bug.cgi?id=180770
2750         https://trac.webkit.org/changeset/225941
2751
2752 2017-12-15  Ryosuke Niwa  <rniwa@webkit.org>
2753
2754         Add a release assert that Timer::m_wasDeleted is false in setNextFireTime
2755         https://bugs.webkit.org/show_bug.cgi?id=180860
2756         <rdar://problem/36066500>
2757
2758         Reviewed by David Kilzer.
2759
2760         Turn an exist debug-only assertion into a release assertion to help diagnose a crash
2761         which appears to be caused by a freed timer getting scheduled back into the timer heap.
2762
2763         * platform/Timer.cpp:
2764         (WebCore::TimerBase::~TimerBase):
2765         (WebCore::TimerBase::setNextFireTime):
2766         * platform/Timer.h:
2767
2768 2017-12-15  Simon Fraser  <simon.fraser@apple.com>
2769
2770         Elements animated on-screen are missing sometimes
2771         https://bugs.webkit.org/show_bug.cgi?id=180773
2772         rdar://problem/34923438
2773
2774         Reviewed by Zalan Bujtas.
2775         
2776         After r225310 it was still possible for elements to be missing backing store when brought
2777         on-screen via an animation. This occurred if a child element was outside the bounds of the
2778         element being animated.
2779
2780         Fix by making sure that GraphicsLayer's "animatedExtent" took composited child layers into account.
2781
2782         As for r225310, no test because this is timing sensitive and hard to reliably make a test for.
2783
2784         * rendering/RenderLayer.cpp:
2785         (WebCore::RenderLayer::calculateClipRects const):
2786         * rendering/RenderLayer.h:
2787         * rendering/RenderLayerBacking.cpp:
2788         (WebCore::RenderLayerBacking::updateGeometry):
2789
2790 2017-12-15  Chris Dumez  <cdumez@apple.com>
2791
2792         imported/w3c/web-platform-tests/service-workers/service-worker/update.https.html is sometimes crashing in Debug builds
2793         https://bugs.webkit.org/show_bug.cgi?id=180867
2794
2795         Reviewed by Brady Eidson.
2796
2797         Fix assertion to make sure the worker is terminating if it is already in m_runningOrTerminatingWorkers.
2798
2799         * workers/service/server/SWServer.cpp:
2800         (WebCore::SWServer::runServiceWorker):
2801
2802 2017-12-15  Chris Dumez  <cdumez@apple.com>
2803
2804         Service Worker Registration promise is sometimes not rejected when the script load fails
2805         https://bugs.webkit.org/show_bug.cgi?id=180849
2806
2807         Reviewed by Brady Eidson.
2808
2809         Service Worker Registration promise is sometimes not rejected when the script load fails.
2810         This was caused by the ServiceWorkerJob sometimes passing a null ResourceError to the
2811         StorageProcess, even though the load failed.
2812
2813         No new tests, rebaselined exisiting tests.
2814
2815         * workers/WorkerScriptLoader.cpp:
2816         (WebCore::WorkerScriptLoader::notifyError):
2817         * workers/service/ServiceWorkerJob.cpp:
2818         (WebCore::ServiceWorkerJob::notifyFinished):
2819
2820 2017-12-15  Youenn Fablet  <youenn@apple.com>
2821
2822         WebRTC Stats should not be console logged from a background thread
2823         https://bugs.webkit.org/show_bug.cgi?id=180845
2824
2825         Reviewed by Eric Carlson.
2826
2827         Ensuring console log are done in the main thread.
2828
2829         * Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.cpp:
2830         (WebCore::LibWebRTCMediaEndpoint::OnStatsDelivered):
2831
2832 2017-12-15  Antti Koivisto  <antti@apple.com>
2833
2834         Introduce RenderTreeBuilder
2835         https://bugs.webkit.org/show_bug.cgi?id=180817
2836
2837         Reviewed by Zalan Bujtas.
2838
2839         RenderTreeBuilder is responsible of building the render tree, including construction of various anonymous
2840         renderers. Renderer subtype specific render tree construction code will eventually move there.
2841
2842         This patch adds RenderTreeBuilder class and passes it as a parameter for all addChild implementations.
2843         Future patches can then mechanically move the building code from renderers to RenderTreeBuilder.
2844
2845         It also moves one addChild implementation (RenderRuby::addChild -> RenderTreeBuilder::rubyRunInsertChild)
2846         to RenderTreeBuilder as a test.
2847
2848         * WebCore.xcodeproj/project.pbxproj:
2849         * rendering/RenderBlock.cpp:
2850         (WebCore::RenderBlock::addChildToContinuation):
2851         (WebCore::RenderBlock::addChild):
2852         (WebCore::RenderBlock::addChildIgnoringContinuation):
2853         * rendering/RenderBlock.h:
2854         * rendering/RenderBlockFlow.cpp:
2855         (WebCore::RenderBlockFlow::addChild):
2856         * rendering/RenderBlockFlow.h:
2857         * rendering/RenderBoxModelObject.cpp:
2858         (WebCore::RenderBoxModelObject::moveChildTo):
2859         * rendering/RenderButton.cpp:
2860         (WebCore::RenderButton::addChild):
2861         (WebCore::RenderButton::setText):
2862         * rendering/RenderButton.h:
2863         * rendering/RenderElement.cpp:
2864         (WebCore::RenderElement::addChild):
2865         * rendering/RenderElement.h:
2866         (WebCore::RenderElement::addChildIgnoringContinuation):
2867         * rendering/RenderFullScreen.cpp:
2868         (WebCore::RenderFullScreen::wrapNewRenderer):
2869         (WebCore::RenderFullScreen::wrapExistingRenderer):
2870         (WebCore::RenderFullScreen::unwrapRenderer):
2871         (WebCore::RenderFullScreen::createPlaceholder):
2872         * rendering/RenderGrid.cpp:
2873         (WebCore::RenderGrid::addChild):
2874         * rendering/RenderGrid.h:
2875         * rendering/RenderInline.cpp:
2876         (WebCore::RenderInline::addChild):
2877         (WebCore::RenderInline::addChildIgnoringContinuation):
2878         (WebCore::RenderInline::splitInlines):
2879         (WebCore::RenderInline::splitFlow):
2880         (WebCore::RenderInline::addChildToContinuation):
2881         (WebCore::RenderInline::childBecameNonInline):
2882         * rendering/RenderInline.h:
2883         * rendering/RenderMenuList.cpp:
2884         (WebCore::RenderMenuList::createInnerBlock):
2885         (RenderMenuList::addChild):
2886         (RenderMenuList::setText):
2887         * rendering/RenderMenuList.h:
2888         * rendering/RenderMultiColumnFlow.cpp:
2889         (WebCore::RenderMultiColumnFlow::processPossibleSpannerDescendant):
2890         * rendering/RenderQuote.cpp:
2891         (WebCore::RenderQuote::updateTextRenderer):
2892         (WebCore::RenderQuote::updateRenderer):
2893         * rendering/RenderQuote.h:
2894         * rendering/RenderRuby.cpp:
2895         (WebCore::RenderRubyAsInline::addChild):
2896         (WebCore::RenderRubyAsBlock::addChild):
2897         * rendering/RenderRuby.h:
2898         * rendering/RenderRubyBase.h:
2899         * rendering/RenderRubyRun.cpp:
2900         (WebCore::RenderRubyRun::rubyBaseSafe):
2901         (WebCore::RenderRubyRun::addChild): Deleted.
2902         * rendering/RenderRubyRun.h:
2903         * rendering/RenderTable.cpp:
2904         (WebCore::RenderTable::addChild):
2905         * rendering/RenderTable.h:
2906         * rendering/RenderTableRow.cpp:
2907         (WebCore::RenderTableRow::addChild):
2908         * rendering/RenderTableRow.h:
2909         * rendering/RenderTableSection.cpp:
2910         (WebCore::RenderTableSection::addChild):
2911         * rendering/RenderTableSection.h:
2912         * rendering/RenderTreeBuilder.cpp: Added.
2913         (WebCore::RenderTreeBuilder::RenderTreeBuilder):
2914         (WebCore::RenderTreeBuilder::~RenderTreeBuilder):
2915         (WebCore::RenderTreeBuilder::insertChild):
2916         (WebCore::RenderTreeBuilder::rubyRunInsertChild):
2917         * rendering/RenderTreeBuilder.h: Added.
2918         (WebCore::RenderTreeBuilder::current):
2919         * rendering/TextAutoSizing.cpp:
2920         (WebCore::TextAutoSizingValue::adjustTextNodeSizes):
2921         * rendering/mathml/RenderMathMLFenced.cpp:
2922         (WebCore::RenderMathMLFenced::updateFromElement):
2923         (WebCore::RenderMathMLFenced::makeFences):
2924         (WebCore::RenderMathMLFenced::addChild):
2925         * rendering/mathml/RenderMathMLFenced.h:
2926         * rendering/svg/RenderSVGContainer.cpp:
2927         (WebCore::RenderSVGContainer::addChild):
2928         * rendering/svg/RenderSVGContainer.h:
2929         * rendering/svg/RenderSVGInline.cpp:
2930         (WebCore::RenderSVGInline::addChild):
2931         * rendering/svg/RenderSVGInline.h:
2932         * rendering/svg/RenderSVGRoot.cpp:
2933         (WebCore::RenderSVGRoot::addChild):
2934         * rendering/svg/RenderSVGRoot.h:
2935         * rendering/svg/RenderSVGText.cpp:
2936         (WebCore::RenderSVGText::addChild):
2937         * rendering/svg/RenderSVGText.h:
2938         * style/RenderTreePosition.cpp:
2939         (WebCore::RenderTreePosition::insert): Deleted.
2940         * style/RenderTreePosition.h:
2941         (WebCore::RenderTreePosition::RenderTreePosition):
2942         (WebCore::RenderTreePosition::nextSibling const):
2943         (WebCore::RenderTreePosition::canInsert const): Deleted.
2944         * style/RenderTreeUpdater.cpp:
2945         (WebCore::RenderTreeUpdater::updateAfterDescendants):
2946         (WebCore::RenderTreeUpdater::createRenderer):
2947         (WebCore::RenderTreeUpdater::createTextRenderer):
2948         (WebCore::RenderTreeUpdater::updateTextRenderer):
2949         (WebCore::createTextRenderer): Deleted.
2950         * style/RenderTreeUpdater.h:
2951         * style/RenderTreeUpdaterFirstLetter.cpp:
2952         (WebCore::updateFirstLetterStyle):
2953         (WebCore::createFirstLetterRenderer):
2954         * style/RenderTreeUpdaterGeneratedContent.cpp:
2955         (WebCore::RenderTreeUpdater::GeneratedContent::updateQuotesUpTo):
2956         (WebCore::createContentRenderers):
2957         (WebCore::RenderTreeUpdater::GeneratedContent::updatePseudoElement):
2958         * style/RenderTreeUpdaterListItem.cpp:
2959         (WebCore::RenderTreeUpdater::ListItem::updateMarker):
2960         * style/RenderTreeUpdaterListItem.h:
2961         * style/RenderTreeUpdaterMultiColumn.cpp:
2962         (WebCore::RenderTreeUpdater::MultiColumn::createFragmentedFlow):
2963         (WebCore::RenderTreeUpdater::MultiColumn::destroyFragmentedFlow):
2964
2965 2017-12-14  Youenn Fablet  <youenn@apple.com>
2966
2967         Implement <iframe allow="camera; microphone">
2968         https://bugs.webkit.org/show_bug.cgi?id=167430
2969
2970         Reviewed by Eric Carlson.
2971
2972         Tests: imported/w3c/web-platform-tests/mediacapture-streams/MediaStream-default-feature-policy.https.sub.html
2973
2974         Adding allow attribute to HTMLIFrameElement as per https://wicg.github.io/feature-policy/#iframe-allow-attribute.
2975         Cross-origin iframes will get access to camera/microphone based on this attribute value.
2976         Same-origin iframes do not need any attribute.
2977         In case getUserMedia requests both camera and microphone, and allow attribute is only one of these,
2978         getUserMedia access is denied. This goes against the tests but is not very clear from the specification.
2979
2980         * Modules/mediastream/UserMediaRequest.cpp:
2981         (WebCore::isSecure):
2982         (WebCore::isAllowedToUse):
2983         (WebCore::canCallGetUserMedia):
2984         (WebCore::UserMediaRequest::start):
2985         * html/HTMLAttributeNames.in:
2986         * html/HTMLIFrameElement.cpp:
2987         (WebCore::HTMLIFrameElement::parseAttribute):
2988         * html/HTMLIFrameElement.h:
2989         * html/HTMLIFrameElement.idl:
2990
2991 2017-12-14  Zalan Bujtas  <zalan@apple.com>
2992
2993         Inconsistent section grid could lead to CrashOnOverflow
2994         https://bugs.webkit.org/show_bug.cgi?id=180850
2995         <rdar://problem/34064811>
2996
2997         Reviewed by Simon Fraser.
2998
2999         Each RenderTableSection maintains a grid of rows and columns. The number of columns in this grid equals the
3000         maximum number of columns in the entire table (taking spans and multiple sections into account).
3001         Since the maximum number of columns might change while re-computing the sections, we need to
3002         adjust them accordingly at the end (otherwise it could lead to inconsistent grids where rows have different number of columns).
3003
3004         Test: fast/table/table-row-oveflow-crash.html
3005
3006         * rendering/RenderTable.cpp:
3007         (WebCore::RenderTable::recalcSections const):
3008         * rendering/RenderTableSection.cpp:
3009         (WebCore::RenderTableSection::removeRedundantColumns):
3010         * rendering/RenderTableSection.h:
3011
3012 2017-12-14  David Kilzer  <ddkilzer@apple.com>
3013
3014         Enable -Wstrict-prototypes for WebKit
3015         <https://webkit.org/b/180757>
3016         <rdar://problem/36024132>
3017
3018         Rubber-stamped by Joseph Pecoraro.
3019
3020         * Configurations/Base.xcconfig:
3021         (CLANG_WARN_STRICT_PROTOTYPES): Add. Set to YES.
3022
3023 2017-12-14  Youenn Fablet  <youenn@apple.com>
3024
3025         srflx and relay ICE candidates lack raddr (rel-addr) and rport (rel-port) attributes if getUserMedia access has not been granted
3026         https://bugs.webkit.org/show_bug.cgi?id=180842
3027
3028         Reviewed by Jon Lee.
3029
3030         Manually tested since there is no way to gather reflexive or stun candidates in WebKit CI.
3031
3032         * Modules/mediastream/PeerConnectionBackend.cpp:
3033         (WebCore::filterICECandidate):
3034
3035 2017-12-14  Commit Queue  <commit-queue@webkit.org>
3036
3037         Unreviewed, rolling out r225878.
3038         https://bugs.webkit.org/show_bug.cgi?id=180855
3039
3040         Introduced a crash in HTMLPictureElement. We're taking a
3041         different approach for webkit.org/b/180769 (Requested by rniwa
3042         on #webkit).
3043
3044         Reverted changeset:
3045
3046         "Crash inside ImageLoader::updateFromElement()"
3047         https://bugs.webkit.org/show_bug.cgi?id=180769
3048         https://trac.webkit.org/changeset/225878
3049
3050 2017-12-14  Ryan Haddad  <ryanhaddad@apple.com>
3051
3052         Unreviewed, rolling out r225931.
3053
3054         Breaks internal builds.
3055
3056         Reverted changeset:
3057
3058         "Fix Mac CMake build"
3059         https://bugs.webkit.org/show_bug.cgi?id=180835
3060         https://trac.webkit.org/changeset/225931
3061
3062 2017-12-14  Simon Fraser  <simon.fraser@apple.com>
3063
3064         Another Windows build fix.
3065
3066         * platform/graphics/cg/GraphicsContextCG.cpp:
3067         (WebCore::extendedSRGBColorSpaceRef):
3068
3069 2017-12-14  Simon Fraser  <simon.fraser@apple.com>
3070
3071         Fix Windows build after r225915.
3072
3073         Windows doens't have dispatch_once with blocks. Switch to use lambda functions instead.
3074
3075         * platform/graphics/cg/GraphicsContextCG.cpp:
3076         (WebCore::sRGBColorSpaceRef):
3077         (WebCore::linearRGBColorSpaceRef):
3078         (WebCore::extendedSRGBColorSpaceRef):
3079         (WebCore::displayP3ColorSpaceRef):
3080
3081 2017-12-14  Devin Rousso  <webkit@devinrousso.com>
3082
3083         Web Inspector: replace HTMLCanvasElement with CanvasRenderingContext for instrumentation logic
3084         https://bugs.webkit.org/show_bug.cgi?id=180770
3085
3086         Reviewed by Joseph Pecoraro.
3087
3088         No change in functionality.
3089
3090         * html/canvas/CanvasRenderingContext.h:
3091         * html/canvas/CanvasRenderingContext.cpp:
3092         (WebCore::CanvasRenderingContext::~CanvasRenderingContext):
3093         Instead of waiting on the HTMLCanvasElement to destruct to call willDestroyCanvasRenderingContext
3094         we can call out in the destructor and know that the CanvasRenderingContext will be destroyed
3095         immediately thereafter.
3096
3097         * html/canvas/CanvasRenderingContext2D.h:
3098         * html/canvas/CanvasRenderingContext2D.cpp:
3099         (WebCore::CanvasRenderingContext2D::create):
3100         * html/canvas/ImageBitmapRenderingContext.h:
3101         * html/canvas/ImageBitmapRenderingContext.cpp:
3102         (WebCore::ImageBitmapRenderingContext::create):
3103         * html/canvas/WebGL2RenderingContext.h:
3104         * html/canvas/WebGL2RenderingContext.cpp:
3105         (WebCore::WebGL2RenderingContext::create):
3106         * html/canvas/WebGLRenderingContext.h:
3107         * html/canvas/WebGLRenderingContext.cpp:
3108         (WebCore::WebGLRenderingContext::create):
3109         * html/canvas/WebGLRenderingContextBase.cpp:
3110         (WebCore::WebGLRenderingContextBase::create):
3111         * html/canvas/WebGPURenderingContext.cpp:
3112         (WebCore::WebGPURenderingContext::create):
3113         * html/HTMLCanvasElement.cpp:
3114         (WebCore::HTMLCanvasElement::createContext2d):
3115         (WebCore::HTMLCanvasElement::createContextWebGL):
3116         (WebCore::HTMLCanvasElement::createContextWebGPU):
3117         (WebCore::HTMLCanvasElement::createContextBitmapRenderer):
3118         (WebCore::HTMLCanvasElement::paint):
3119         (WebCore::HTMLCanvasElement::setImageBuffer const):
3120         Instead of adding didCreateCanvasRenderingContext calls at the construction sites of each
3121         context, we can make the constructors private and force the usage of static `create` functions.
3122         This way, we have access to the fully constructed object and have a guaranteed path for creation.
3123
3124         * inspector/InspectorCanvas.h:
3125         * inspector/InspectorCanvas.cpp:
3126         (WebCore::InspectorCanvas::create):
3127         (WebCore::InspectorCanvas::InspectorCanvas):
3128         (WebCore::InspectorCanvas::canvasElement):
3129         (WebCore::InspectorCanvas::resetRecordingData):
3130         (WebCore::InspectorCanvas::recordAction):
3131         (WebCore::InspectorCanvas::buildObjectForCanvas):
3132         (WebCore::InspectorCanvas::getCanvasContentAsDataURL):
3133         (WebCore::InspectorCanvas::buildInitialState):
3134         
3135         * inspector/InspectorShaderProgram.h:
3136         * inspector/InspectorShaderProgram.cpp:
3137         (WebCore::InspectorShaderProgram::context const):
3138
3139         * inspector/agents/InspectorCanvasAgent.h:
3140         * inspector/agents/InspectorCanvasAgent.cpp:
3141         (WebCore::InspectorCanvasAgent::InspectorCanvasAgent):
3142         (WebCore::InspectorCanvasAgent::enable):
3143         (WebCore::InspectorCanvasAgent::disable):
3144         (WebCore::InspectorCanvasAgent::requestNode):
3145         (WebCore::InspectorCanvasAgent::requestContent):
3146         (WebCore::InspectorCanvasAgent::requestCSSCanvasClientNodes):
3147         (WebCore::contextAsScriptValue):
3148         (WebCore::InspectorCanvasAgent::resolveCanvasContext):
3149         (WebCore::InspectorCanvasAgent::startRecording):
3150         (WebCore::InspectorCanvasAgent::stopRecording):
3151         (WebCore::InspectorCanvasAgent::updateShader):
3152         (WebCore::InspectorCanvasAgent::frameNavigated):
3153         (WebCore::InspectorCanvasAgent::didChangeCSSCanvasClientNodes):
3154         (WebCore::InspectorCanvasAgent::didCreateCanvasRenderingContext):
3155         (WebCore::InspectorCanvasAgent::willDestroyCanvasRenderingContext):
3156         (WebCore::InspectorCanvasAgent::didChangeCanvasMemory):
3157         (WebCore::InspectorCanvasAgent::recordCanvasAction):
3158         (WebCore::InspectorCanvasAgent::didFinishRecordingCanvasFrame):
3159         (WebCore::InspectorCanvasAgent::consoleStartRecordingCanvas):
3160         (WebCore::InspectorCanvasAgent::didEnableExtension):
3161         (WebCore::InspectorCanvasAgent::didCreateProgram):
3162         (WebCore::InspectorCanvasAgent::canvasDestroyedTimerFired):
3163         (WebCore::InspectorCanvasAgent::canvasRecordingTimerFired):
3164         (WebCore::InspectorCanvasAgent::clearCanvasData):
3165         (WebCore::InspectorCanvasAgent::unbindCanvas):
3166         (WebCore::InspectorCanvasAgent::findInspectorCanvas):
3167         (WebCore::InspectorCanvasAgent::unbindProgram):
3168         (WebCore::InspectorCanvasAgent::didCreateCSSCanvas): Deleted.
3169         (WebCore::InspectorCanvasAgent::canvasDestroyed): Deleted.
3170
3171         * inspector/InspectorInstrumentation.h:
3172         (WebCore::InspectorInstrumentation::didCreateCanvasRenderingContext):
3173         (WebCore::InspectorInstrumentation::willDestroyCanvasRenderingContext):
3174         (WebCore::InspectorInstrumentation::didChangeCanvasMemory):
3175         (WebCore::InspectorInstrumentation::recordCanvasAction):
3176         (WebCore::InspectorInstrumentation::didFinishRecordingCanvasFrame):
3177         (WebCore::InspectorInstrumentation::didEnableExtension):
3178         (WebCore::InspectorInstrumentation::didCreateProgram):
3179         (WebCore::InspectorInstrumentation::willDeleteProgram):
3180         (WebCore::InspectorInstrumentation::isShaderProgramDisabled):
3181         (WebCore::InspectorInstrumentation::consoleStartRecordingCanvas):
3182         (WebCore::InspectorInstrumentation::didCreateCSSCanvas): Deleted.
3183         * inspector/InspectorInstrumentation.cpp:
3184         (WebCore::InspectorInstrumentation::consoleStartRecordingCanvasImpl):
3185         (WebCore::InspectorInstrumentation::didChangeCSSCanvasClientNodesImpl):
3186         (WebCore::InspectorInstrumentation::didCreateCanvasRenderingContextImpl):
3187         (WebCore::InspectorInstrumentation::willDestroyCanvasRenderingContextImpl):
3188         (WebCore::InspectorInstrumentation::didChangeCanvasMemoryImpl):
3189         (WebCore::InspectorInstrumentation::didFinishRecordingCanvasFrameImpl):
3190         (WebCore::InspectorInstrumentation::didEnableExtensionImpl):
3191         (WebCore::InspectorInstrumentation::didCreateProgramImpl):
3192         (WebCore::InspectorInstrumentation::didCreateCSSCanvasImpl): Deleted.
3193
3194         * page/PageConsoleClient.cpp:
3195         (WebCore::PageConsoleClient::record):
3196         (WebCore::PageConsoleClient::recordEnd):
3197
3198         * dom/Document.h:
3199         * dom/Document.cpp:
3200         (WebCore::Document::getCSSCanvasElement):
3201         (WebCore::Document::nameForCSSCanvasElement const):
3202         We have no reason to save the CSS canvas name for each InspectorCanvas object, so instead we
3203         can just query for the name based on the CanvasRenderingContext's HTMLCanvasElement (assuming
3204         it is not an OffscreenCanvas) when we need it.
3205
3206 2017-12-14  Chris Dumez  <cdumez@apple.com>
3207
3208         self.importScripts() should obey updateViaCache inside service workers
3209         https://bugs.webkit.org/show_bug.cgi?id=180826
3210
3211         Reviewed by Youenn Fablet.
3212
3213         self.importScripts() should obey updateViaCache inside service workers, as per:
3214         - https://html.spec.whatwg.org/multipage/workers.html#dom-workerglobalscope-importscripts
3215
3216         Tests: http/tests/workers/service/registration-updateViaCache-all-importScripts.html
3217                http/tests/workers/service/registration-updateViaCache-imports-importScripts.html
3218                http/tests/workers/service/registration-updateViaCache-none-importScripts.html
3219
3220         * workers/WorkerGlobalScope.cpp:
3221         (WebCore::WorkerGlobalScope::importScripts):
3222         * workers/WorkerScriptLoader.cpp:
3223         (WebCore::WorkerScriptLoader::loadSynchronously):
3224         * workers/WorkerScriptLoader.h:
3225         * workers/service/SWClientConnection.cpp:
3226         (WebCore::SWClientConnection::setRegistrationLastUpdateTime):
3227         * workers/service/SWClientConnection.h:
3228         * workers/service/ServiceWorkerRegistration.cpp:
3229         (WebCore::ServiceWorkerRegistration::lastUpdateTime const):
3230         (WebCore::ServiceWorkerRegistration::setLastUpdateTime):
3231         * workers/service/ServiceWorkerRegistration.h:
3232         * workers/service/server/SWServer.h:
3233         * workers/service/server/SWServerRegistration.cpp:
3234         (WebCore::SWServerRegistration::setLastUpdateTime):
3235         * workers/service/server/SWServerRegistration.h:
3236
3237 2017-12-14  Yusuke Suzuki  <utatane.tea@gmail.com>
3238
3239         Drop Thread::tryCreate
3240         https://bugs.webkit.org/show_bug.cgi?id=180808
3241
3242         Reviewed by Darin Adler.
3243
3244         This change reveals that nobody cares the WorkerThread::start's failure.
3245         We should use `Thread::create` to ensure thread is actually starting.
3246
3247         * workers/WorkerThread.cpp:
3248         (WebCore::WorkerThread::start):
3249         * workers/WorkerThread.h:
3250
3251 2017-12-14  Alicia Boya GarcĂ­a  <aboya@igalia.com>
3252
3253         [MSE] Add isValid() check before using trackBuffer.lastEnqueuedPresentationTime
3254         https://bugs.webkit.org/show_bug.cgi?id=180258
3255
3256         Reviewed by Jer Noble.
3257
3258         * Modules/mediasource/SourceBuffer.cpp:
3259         (WebCore::SourceBuffer::sourceBufferPrivateDidReceiveSample):
3260
3261 2017-12-14  John Wilander  <wilander@apple.com>
3262
3263         Storage Access API: Implement frame-specific access in the document.cookie layer
3264         https://bugs.webkit.org/show_bug.cgi?id=180682
3265         <rdar://problem/35982257>
3266
3267         Reviewed by Alex Christensen.
3268
3269         No new tests. Changed expected result from existing test.
3270
3271         CookiesStrategy::cookiesForDOM(), CookiesStrategy::setCookiesFromDOM(),
3272         CookiesStrategy::cookieRequestHeaderFieldValue(), and
3273         CookiesStrategy::getRawCookies() now take optional parameters for
3274         frameID and pageID to allow frame-specific scoping of cookies.
3275
3276         This change makes the return values of FrameLoaderClient::frameID()
3277         and FrameLoaderClient::pageID() std::optional<uint64_t> so that
3278         WebCore can call those getters and get the right return values in
3279         WebKit and std:nullopt in WebKitLegacy.
3280
3281         * dom/Document.cpp:
3282         (WebCore::Document::requestStorageAccess):
3283         * loader/CookieJar.cpp:
3284         (WebCore::cookies):
3285         (WebCore::setCookies):
3286         (WebCore::cookieRequestHeaderFieldValue):
3287         (WebCore::getRawCookies):
3288         * loader/EmptyFrameLoaderClient.h:
3289         * loader/FrameLoaderClient.h:
3290         * platform/CookiesStrategy.h:
3291         * platform/network/CacheValidation.cpp:
3292         (WebCore::headerValueForVary):
3293         * platform/network/PlatformCookieJar.h:
3294         * platform/network/cf/CookieJarCFNet.cpp:
3295         (WebCore::setCookiesFromDOM):
3296         (WebCore::cookiesForDOM):
3297         (WebCore::cookieRequestHeaderFieldValue):
3298         (WebCore::getRawCookies):
3299         * platform/network/curl/CookieJarCurl.cpp:
3300         (WebCore::CookieJarCurlFileSystem::setCookiesFromDOM):
3301         (WebCore::CookieJarCurlFileSystem::cookiesForDOM):
3302         (WebCore::CookieJarCurlFileSystem::cookieRequestHeaderFieldValue):
3303         (WebCore::CookieJarCurlFileSystem::getRawCookies):
3304         (WebCore::cookiesForDOM):
3305         (WebCore::setCookiesFromDOM):
3306         (WebCore::cookieRequestHeaderFieldValue):
3307         (WebCore::getRawCookies):
3308         * platform/network/curl/CookieJarCurl.h:
3309         * platform/network/mac/CookieJarMac.mm:
3310         (WebCore::cookiesInPartitionForURL):
3311         (WebCore::cookiesForURL):
3312         (WebCore::cookiesForSession):
3313         (WebCore::cookiesForDOM):
3314         (WebCore::cookieRequestHeaderFieldValue):
3315         (WebCore::setCookiesFromDOM):
3316         (WebCore::getRawCookies):
3317         * platform/network/soup/CookieJarSoup.cpp:
3318         (WebCore::setCookiesFromDOM):
3319         (WebCore::cookiesForDOM):
3320         (WebCore::cookieRequestHeaderFieldValue):
3321         (WebCore::getRawCookies):
3322
3323 2017-12-14  Alex Christensen  <achristensen@webkit.org>
3324
3325         Fix Mac CMake build
3326         https://bugs.webkit.org/show_bug.cgi?id=180835
3327
3328         Reviewed by Andy Estes.
3329
3330         * PlatformMac.cmake:
3331         * platform/graphics/avfoundation/objc/CDMInstanceFairPlayStreamingAVFObjC.h:
3332
3333 2017-12-14  Antoine Quint  <graouts@apple.com>
3334
3335         [Web Animations] Use is<> when possible
3336         https://bugs.webkit.org/show_bug.cgi?id=180832
3337
3338         Reviewed by Dean Jackson.
3339
3340         Adopt is<> when possible.
3341
3342         * animation/WebAnimation.cpp:
3343         (WebCore::WebAnimation::setEffect):
3344         (WebCore::WebAnimation::setTimeline):
3345         (WebCore::WebAnimation::startOrStopAccelerated):
3346
3347 2017-12-14  Antoine Quint  <graouts@apple.com>
3348
3349         [Web Animations] Bring timeline and currentTime setters closer to compliance
3350         https://bugs.webkit.org/show_bug.cgi?id=180834
3351
3352         Reviewed by Dean Jackson.
3353
3354         Now that we've added support for the concept of a hold time, pending tasks
3355         and updating the finished state, adopt those in places we had already implemented
3356         but weren't fully compliant.
3357
3358         Web Platform Tests cover these behaviors, but we're currently failing those tests
3359         due to lacking an implementation for Element.animate().
3360
3361         * animation/WebAnimation.cpp:
3362         (WebCore::WebAnimation::setTimeline): Add some spec comments to clarify the code behavior
3363         and implement step 4 of the "setting the timeline" procedure where we reset the hold time
3364         to an unresolved value if the start time is resolved, as well as step 5 where we update the
3365         finished state. Finally, we also ensure we update the pending tasks as the ready state is
3366         dependent on a timeline being set.
3367         (WebCore::WebAnimation::bindingsStartTime const): Invert the way we test for an unresolved
3368         value to match prior review comments by Dean Jackson.
3369         (WebCore::WebAnimation::setBindingsStartTime): Use a boolean check rather than checking
3370         equality with std::nullopt.
3371         (WebCore::WebAnimation::setBindingsCurrentTime): Do not raise an exception when setting
3372         an unresolved time.
3373
3374 2017-12-14  Antoine Quint  <graouts@apple.com>
3375
3376         [Web Animations] Implement the cancel() method on Animation
3377         https://bugs.webkit.org/show_bug.cgi?id=180830
3378         <rdar://problem/36055816>
3379
3380         Reviewed by Dean Jackson.
3381
3382         We implement the cancel() method on the Animation interface with full spec text defining
3383         the normative behavior of those methods and code matching those steps. Implementing the
3384         cancel() method required implementing the notion of "resetting pending tasks",
3385         which the Web Animations spec defines as well.
3386
3387         * animation/WebAnimation.cpp:
3388         (WebCore::WebAnimation::setEffect):
3389         (WebCore::WebAnimation::cancel):
3390         (WebCore::WebAnimation::resetPendingTasks):
3391         * animation/WebAnimation.h:
3392         * animation/WebAnimation.idl:
3393
3394 2017-12-14  Jer Noble  <jer.noble@apple.com>
3395
3396         "Click to exit fullscreen" text not legible on High Sierra
3397         https://bugs.webkit.org/show_bug.cgi?id=180825
3398         <rdar://problem/32839983>
3399
3400         Reviewed by Eric Carlson.
3401
3402         Explicitly set the NSVisualAffectView's .appearance property.
3403
3404         * platform/mac/WebCoreFullScreenPlaceholderView.mm:
3405         (-[WebCoreFullScreenPlaceholderView initWithFrame:]):
3406
3407 2017-12-14  Antoine Quint  <graouts@apple.com>
3408
3409         [Web Animations] Implement the finish() method on Animation
3410         https://bugs.webkit.org/show_bug.cgi?id=180822
3411         <rdar://problem/36053282>
3412
3413         Reviewed by Dean Jackson.
3414
3415         We implement the finish() method on the Animation interface with full spec text defining
3416         the normative behavior of those methods and code matching those steps. Implementing the
3417         finish() method required implementing the notion of "silently setting the current time",
3418         which the Web Animations spec defines as well.
3419
3420         * animation/WebAnimation.cpp:
3421         (WebCore::WebAnimation::silentlySetCurrentTime):
3422         (WebCore::WebAnimation::setCurrentTime):
3423         (WebCore::WebAnimation::finish):
3424         * animation/WebAnimation.h:
3425         * animation/WebAnimation.idl:
3426
3427 2017-12-14  Chris Dumez  <cdumez@apple.com>
3428
3429         Service worker script fetching currently always uses the network cache
3430         https://bugs.webkit.org/show_bug.cgi?id=180816
3431
3432         Reviewed by Alex Christensen.
3433
3434         Service worker script fetching currently always uses the network cache. This is incorrect as per:
3435         - https://w3c.github.io/ServiceWorker/#update-algorithm (step 7.2)
3436
3437         Tests: http/tests/workers/service/registration-updateViaCache-all.html
3438                http/tests/workers/service/registration-updateViaCache-none.html
3439
3440         * workers/Worker.cpp:
3441         (WebCore::Worker::create):
3442         * workers/WorkerScriptLoader.cpp:
3443         (WebCore::WorkerScriptLoader::loadAsynchronously):
3444         * workers/WorkerScriptLoader.h:
3445         * workers/service/SWClientConnection.cpp:
3446         (WebCore::SWClientConnection::startScriptFetchForServer):
3447         * workers/service/SWClientConnection.h:
3448         * workers/service/ServiceWorkerContainer.cpp:
3449         (WebCore::ServiceWorkerContainer::startScriptFetchForJob):
3450         * workers/service/ServiceWorkerContainer.h:
3451         * workers/service/ServiceWorkerJob.cpp:
3452         (WebCore::ServiceWorkerJob::startScriptFetch):
3453         (WebCore::ServiceWorkerJob::fetchScriptWithContext):
3454         * workers/service/ServiceWorkerJob.h:
3455         * workers/service/ServiceWorkerJobClient.h:
3456         * workers/service/server/SWServer.cpp:
3457         (WebCore::SWServer::startScriptFetch):
3458         * workers/service/server/SWServer.h:
3459         * workers/service/server/SWServerJobQueue.cpp:
3460         (WebCore::SWServerJobQueue::runUpdateJob):
3461         * workers/service/server/SWServerRegistration.h:
3462         (WebCore::SWServerRegistration::lastUpdateTime const):
3463
3464 2017-12-14  Simon Fraser  <simon.fraser@apple.com>
3465
3466         Remove ColorSpaceDeviceRGB and most users of the obsolete deviceRGB colorspace
3467         https://bugs.webkit.org/show_bug.cgi?id=180689
3468
3469         Reviewed by Darin Adler.
3470         
3471         Address issues noted by Darin in r225797:
3472         
3473         Existing and new code mistakenly allocated colorspaces on every call, because
3474         they didn't initialize the static variable on the first call. Avoid this mistake
3475         by using dispatch_once() in these functions.
3476
3477         Fix a case where the extendedSRGBColorSpaceRef() fallback was returning deviceRGB
3478         instead of sRGB.
3479
3480         * platform/graphics/cg/GraphicsContextCG.cpp:
3481         (WebCore::sRGBColorSpaceRef):
3482         (WebCore::linearRGBColorSpaceRef):
3483         (WebCore::extendedSRGBColorSpaceRef):
3484         (WebCore::displayP3ColorSpaceRef):
3485         * platform/graphics/cocoa/GraphicsContextCocoa.mm:
3486         (WebCore::linearRGBColorSpaceRef):
3487
3488 2017-12-13  Keith Miller  <keith_miller@apple.com>
3489
3490         JSObjects should have a mask for loading indexed properties
3491         https://bugs.webkit.org/show_bug.cgi?id=180768
3492
3493         Reviewed by Mark Lam.
3494
3495         * bindings/js/JSDOMConvertSequences.h:
3496         (WebCore::Detail::NumericSequenceConverter::convertArray):
3497         (WebCore::Detail::SequenceConverter::convertArray):
3498
3499 2017-12-13  Antoine Quint  <graouts@apple.com>
3500
3501         [Web Animations] Implement the play() and pause() methods on Animation
3502         https://bugs.webkit.org/show_bug.cgi?id=178932
3503         <rdar://problem/35271069>
3504
3505         Reviewed by Eric Carlson.
3506
3507         We implement the play() and pause() methods of the Animation interface with full spec text defining
3508         the normative behavior of those methods and code matching those steps. Playing and pausing animations
3509         incur running a play or pause task when conditions are met, specifically here when the timeline is ready.
3510         So we add the notion of pending tasks and provide a proper implementation of pending() which we had
3511         introduced in an earlier patch with a constant false return value.
3512
3513         Note that the play() method exposes an auto-rewinding flag which we always set to true, but other specs,
3514         namely CSS Animations, do not require the rewinding behavior, so we expose it for future use.
3515
3516         * animation/WebAnimation.cpp:
3517         (WebCore::WebAnimation::play):
3518         (WebCore::WebAnimation::setTimeToRunPendingPlayTask):
3519         (WebCore::WebAnimation::runPendingPlayTask):
3520         (WebCore::WebAnimation::pause):
3521         (WebCore::WebAnimation::setTimeToRunPendingPauseTask):
3522         (WebCore::WebAnimation::runPendingPauseTask):
3523         (WebCore::WebAnimation::updatePendingTasks):
3524         * animation/WebAnimation.h:
3525         * animation/WebAnimation.idl:
3526
3527 2017-12-14  Frederic Wang  <fwang@igalia.com>
3528
3529         Make GraphicsLayer::dumpProperties dump m_offsetFromRenderer
3530         https://bugs.webkit.org/show_bug.cgi?id=180473
3531
3532         Reviewed by Antonio Gomes.
3533
3534         No new tests, this is just a new debug info.
3535
3536         * platform/graphics/GraphicsLayer.cpp:
3537         (WebCore::GraphicsLayer::dumpProperties const): Dump the offset from renderer if nonzero.
3538
3539 2017-12-12  Yusuke Suzuki  <utatane.tea@gmail.com>
3540
3541         REGRESSION(r225769): Build errors with constexpr std::tie on older gcc
3542         https://bugs.webkit.org/show_bug.cgi?id=180692
3543
3544         Reviewed by Carlos Garcia Campos.
3545
3546         * platform/graphics/FontSelectionAlgorithm.h:
3547         (WebCore::FontSelectionRange::operator== const):
3548         (WebCore::FontSelectionRequest::tied const):
3549         (WebCore::FontSelectionCapabilities::tied const):
3550         (WebCore::FontSelectionSpecifiedCapabilities:: const):
3551
3552 2017-12-13  Daniel Bates  <dabates@apple.com>
3553
3554         Fix the Windows build after <https://trac.webkit.org/changeset/225879>
3555         (https://bugs.webkit.org/show_bug.cgi?id=180651)
3556
3557         * html/TextFieldInputType.cpp:
3558         (WebCore::autoFillButtonTypeToAccessibilityLabel):
3559         (WebCore::autoFillButtonTypeToAutoFillButtonText):
3560         (WebCore::autoFillButtonTypeToAutoFillButtonPseudoClassName):
3561
3562 2017-12-13  Devin Rousso  <webkit@devinrousso.com>
3563
3564         Web Inspector: add instrumentation for ImageBitmapRenderingContext
3565         https://bugs.webkit.org/show_bug.cgi?id=180736
3566
3567         Reviewed by Joseph Pecoraro.
3568
3569         Tests: inspector/canvas/create-context-bitmaprenderer.html
3570                inspector/canvas/requestContent-bitmaprenderer.html
3571                inspector/canvas/resolveCanvasContext-bitmaprenderer.html
3572
3573         * CMakeLists.txt:
3574         * Sources.txt:
3575         * WebCore.xcodeproj/project.pbxproj:
3576
3577         * html/HTMLCanvasElement.cpp:
3578         (WebCore::HTMLCanvasElement::getContext):
3579         (WebCore::HTMLCanvasElement::createContextBitmapRenderer):
3580         Support passing an optional settings dictionary when creating an ImageBitmapRenderingContext.
3581
3582         * inspector/agents/InspectorCanvasAgent.cpp:
3583         (WebCore::InspectorCanvasAgent::requestContent):
3584         (WebCore::contextAsScriptValue):
3585
3586         * bindings/js/CallTracerTypes.h:
3587
3588         * inspector/InspectorCanvas.h:
3589         * inspector/InspectorCanvas.cpp:
3590         (WebCore::InspectorCanvas::buildObjectForCanvas):
3591         (WebCore::InspectorCanvas::indexForData):
3592         (WebCore::InspectorCanvas::buildAction):
3593         (WebCore::InspectorCanvas::buildArrayForImageBitmap): Deleted.
3594
3595 2017-12-13  Daniel Bates  <dabates@apple.com>
3596
3597         Add more auto fill button types
3598         https://bugs.webkit.org/show_bug.cgi?id=180651
3599         <rdar://problem/35891125>
3600         And
3601         <rdar://problem/35977943>
3602
3603         Reviewed by Brent Fulgham.
3604
3605         Tests: fast/forms/auto-fill-button/input-autofilled-disabled-strong-password-auto-fill-button.html
3606                fast/forms/auto-fill-button/input-autofilled-readonly-strong-password-auto-fill-button.html
3607                fast/forms/auto-fill-button/input-disabled-strong-password-and-strong-confirmation-password-auto-fill-buttons.html
3608                fast/forms/auto-fill-button/input-readonly-strong-password-and-strong-confirmation-password-auto-fill-buttons.html
3609                fast/forms/auto-fill-button/input-strong-confirmation-password-auto-fill-button.html
3610                fast/forms/auto-fill-button/input-strong-password-auto-fill-button.html
3611
3612         * English.lproj/Localizable.strings:
3613         * accessibility/mac/WebAccessibilityObjectWrapperMac.mm:
3614         (-[WebAccessibilityObjectWrapper accessibilityAttributeValue:]): Add strings for new auto fill button types.
3615
3616         * css/CSSSelector.cpp:
3617         (WebCore::CSSSelector::selectorText const):
3618         * css/CSSSelector.h:
3619         * css/SelectorChecker.cpp:
3620         (WebCore::SelectorChecker::checkOne const):
3621         * css/SelectorCheckerTestFunctions.h:
3622         (WebCore::isAutofilledStrongPassword):
3623         * css/SelectorPseudoClassAndCompatibilityElementMap.in:
3624         * css/html.css:
3625         (input::-webkit-strong-password-auto-fill-button):
3626         (input:-webkit-autofill-strong-password):
3627         (input:-webkit-autofill, input:-webkit-autofill-strong-password):
3628         (input:-webkit-autofill): Deleted.
3629         * cssjit/SelectorCompiler.cpp:
3630         (WebCore::SelectorCompiler::addPseudoClassType):
3631         Add new CSS pseudo class and CSS styles.
3632
3633         * html/HTMLInputElement.cpp:
3634         (WebCore::HTMLInputElement::reset): Hide the auto fill button when the form is reset. This is also called
3635         whenever we suspend the page to put it into the page cache.
3636         (WebCore::HTMLInputElement::setShowAutoFillButton): Modified to update the editability of the inner text element
3637         and invalidate styles for the subtree as the editability may have changed depending on the auto fill button type.
3638
3639         (WebCore::autoFillStrongPasswordMaskImage):
3640         (WebCore::HTMLInputElement::createInnerTextStyle):
3641         (WebCore::HTMLInputElement::createInnerTextStyle const): Deleted.
3642         Adjust the look of the inner text field. This function is not const because we may need to resolve style to
3643         generate a mask image.
3644
3645         * html/HTMLInputElement.h:
3646         (WebCore::HTMLInputElement::autoFillButtonType const): Fix style nit; use a C++ style cast while I am in
3647         this area.
3648         (WebCore::HTMLInputElement::hasAutoFillStrongPasswordButton const): Added.
3649
3650         * html/HTMLTextAreaElement.cpp:
3651         (WebCore::HTMLTextAreaElement::createInnerTextStyle):
3652         (WebCore::HTMLTextAreaElement::createInnerTextStyle const): Deleted.
3653         Made this non-const because HTMLInputElement::createInnerTextStyle() needs to be non-const. See above.
3654
3655         * html/HTMLTextAreaElement.h:
3656         * html/HTMLTextFormControlElement.cpp:
3657         (WebCore::HTMLTextFormControlElement::isInnerTextElementEditable const):
3658         (WebCore::HTMLTextFormControlElement::updateInnerTextElementEditability):
3659         Extract out the query to determine if the inner text element is editable into a virtual function isInnerTextElementEditable()
3660         and have updateInnerTextElementEditability() make use of it. By default a field is considered editable if it is not disabled
3661         or read-only. We override updateInnerTextElementEditability() in HTMLInputElement to also consider the auto fill button type.
3662
3663         * html/HTMLTextFormControlElement.h:
3664         * html/TextFieldInputType.cpp:
3665         (WebCore::autoFillButtonTypeToAccessibilityLabel):
3666         (WebCore::autoFillButtonTypeToAutoFillButtonText):
3667         (WebCore::autoFillButtonTypeToAutoFillButtonPseudoClassName):
3668         (WebCore::isAutoFillButtonTypeChanged):
3669         (WebCore::TextFieldInputType::createAutoFillButton):
3670         (WebCore::TextFieldInputType::updateAutoFillButton):
3671         Support having text for the auto fill button.
3672
3673         * platform/LocalizedStrings.cpp:
3674         (WebCore::AXAutoFillStrongPasswordLabel):
3675         (WebCore::AXAutoFillStrongConfirmationPasswordLabel):
3676         (WebCore::autoFillStrongPasswordLabel):
3677         * platform/LocalizedStrings.h:
3678         Add localized strings.
3679
3680         * rendering/RenderTextControlSingleLine.h: Disallow scrolling depending on the auto fill button type.
3681
3682         * testing/Internals.cpp:
3683         (WebCore::toAutoFillButtonType):
3684         * testing/Internals.h:
3685         * testing/Internals.idl:
3686         Add support for testing.
3687
3688 2017-12-13  Ryosuke Niwa  <rniwa@webkit.org>
3689
3690         Crash inside ImageLoader::updateFromElement()
3691         https://bugs.webkit.org/show_bug.cgi?id=180769
3692         <rdar://problem/35278782>
3693
3694         Reviewed by Antti Koivisto.
3695
3696         Fixed the crash by moving all call sites of ImageLoader::updateFromElement() to be post insertion callbacks
3697         where it's safe to execute arbitrary scripts.
3698
3699         No new test since existing tests cover this with a newly added release assert in ImageLoader.
3700
3701         * html/HTMLImageElement.cpp:
3702         (WebCore::HTMLImageElement::insertedIntoAncestor):
3703         (WebCore::HTMLImageElement::didFinishInsertingNode): Extracted from insertedIntoAncestor to call
3704         selectImageSource or updateFromElement.
3705         * html/HTMLImageElement.h: Made many member functions final.
3706         * html/HTMLInputElement.cpp:
3707         (WebCore::HTMLInputElement::didAttachRenderers): Delay the call to ImageLoader::updateFromElement() in
3708         ImageInputType using a post style resolution callback.
3709         * html/HTMLMetaElement.h:
3710         * html/HTMLPictureElement.cpp:
3711         (WebCore::HTMLPictureElement::sourcesChanged): Store the list of child image elements into a vector before
3712         calling selectImageSource since each call may execute arbitrary scripts.
3713         * html/HTMLSourceElement.cpp:
3714         (WebCore::HTMLSourceElement::insertedIntoAncestor): Delay the call to ImageLoader::updateFromElement()
3715         using a post style resolution callback.
3716         (WebCore::HTMLSourceElement::didFinishInsertingNode): Extracted from insertedIntoAncestor.
3717         * html/HTMLSourceElement.h:
3718         * html/HTMLVideoElement.cpp:
3719         (WebCore::HTMLVideoElement::didAttachRenderers):
3720         (WebCore::HTMLVideoElement::updateAfterStyleResolution): Extracted from didAttachRenderers.
3721         * html/HTMLVideoElement.h:
3722         * html/ImageInputType.cpp:
3723         (WebCore::ImageInputType::needsPostStyleResolutionCallback): Added. Returns true so that HTMLInputElement's
3724         didAttachRenderers would register a post style resolution callback.
3725         (WebCore::ImageInputType::updateAfterStyleResolution): Extracted from attach.
3726         (WebCore::ImageInputType::attach): Deleted.
3727         * html/ImageInputType.h:
3728         * html/InputType.cpp:
3729         (WebCore::InputType::needsPostStyleResolutionCallback): Added. All but ImageInputType returns false.
3730         (WebCore::InputType::updateAfterStyleResolution): Added.
3731         (WebCore::InputType::attach): Deleted.
3732         * html/InputType.h:
3733         * loader/ImageLoader.cpp:
3734         (WebCore::ImageLoader::updateFromElement): Added a release assertion. There is no direct security implication
3735         so there is no need to use RELEASE_ASSERT_WITH_SECURITY_IMPLICATION here.
3736         * svg/SVGImageElement.cpp:
3737         (WebCore::SVGImageElement::insertedIntoAncestor):
3738         (WebCore::SVGImageElement::didFinishInsertingNode):
3739         * svg/SVGImageElement.h:
3740
3741 2017-12-13  Zalan Bujtas  <zalan@apple.com>
3742
3743         RenderImage can be destroyed even before setting the style on it.
3744         https://bugs.webkit.org/show_bug.cgi?id=180767
3745         <rdar://problem/33965995>
3746
3747         Reviewed by Simon Fraser.
3748
3749         In certain cases, when the newly constructed renderer can't be inserted into the tree (parent can only have specific type of children etc),
3750         RenderTreeUpdater destroys it right away. While destroying a RenderImage, the associated image resource assumes
3751         that the image renderer has been initialized through RenderElement::initializeStyle(). This is an incorrect
3752         assumption.
3753         This patch also makes RenderImageResource's m_renderer a weak pointer.
3754            
3755         Test: fast/images/crash-when-image-renderer-is-destroyed-before-calling-initializeStyle.html
3756
3757         * rendering/RenderImageResource.cpp:
3758         (WebCore::RenderImageResource::initialize):
3759         (WebCore::RenderImageResource::setCachedImage):
3760         (WebCore::RenderImageResource::resetAnimation):
3761         (WebCore::RenderImageResource::image const):
3762         (WebCore::RenderImageResource::setContainerContext):
3763         (WebCore::RenderImageResource::imageSize const):
3764         * rendering/RenderImageResource.h:
3765         (WebCore::RenderImageResource::renderer const):
3766         * rendering/RenderImageResourceStyleImage.cpp:
3767         (WebCore::RenderImageResourceStyleImage::shutdown):
3768
3769 2017-12-13  Ryosuke Niwa  <rniwa@webkit.org>
3770
3771         Update the SVG use element's shadow trees explicitly before the style recall
3772         https://bugs.webkit.org/show_bug.cgi?id=180729
3773         <rdar://problem/36009806>
3774
3775         Reviewed by Antti Koivisto.
3776
3777         Update the SVG use element's shadow trees before start resolving styles. Document now has a hash set of all
3778         connected SVG use elements with invalidated shadow trees. SVGUseElement adds itself to this set when its
3779         shadow tree gets invalidated, or it gets newly connected to a document with the invalidated shadow tree.
3780         SVGUseElement removes itself from this set when it updates its shadow tree or it gets disconnected from
3781         a document with the invalidated shadow tree.
3782
3783         No new tests. Covered by existing tests.
3784
3785         * dom/Document.cpp:
3786         (WebCore::Document::~Document): Assert that m_svgUseElements has been cleared.
3787         (WebCore::Document::resolveStyle): Update the shadow trees of SVG use elements with invalidated shadow trees.
3788         (WebCore::Document::addSVGUseElement): Added.
3789         (WebCore::Document::removeSVGUseElement): Added.
3790         * dom/Document.h:
3791         (WebCore::Document::svgUseElements const): Added.
3792         * dom/Element.cpp:
3793         (WebCore::Element::cloneElementWithChildren): Removed EventAllowedScope since the SVG use element's shadow
3794         tree is no longer updated when there is a NoEventDispatchAssertion in the stack.
3795         (WebCore::Element::cloneElementWithoutChildren): Ditto.
3796         * style/StyleTreeResolver.cpp:
3797         (WebCore::Style::TreeResolver::resolveComposedTree): No longer drops the assertion now that SVG use element's
3798         shadow tree is updated before calling this function.
3799         * svg/SVGUseElement.cpp:
3800         (WebCore::SVGUseElement::insertedIntoAncestor): Add the element to the document's hash set if this use element's
3801         shadow tree needs to be updated (m_shadowTreeNeedsUpdate is set), and it got newly connected.
3802         (WebCore::SVGUseElement::removedFromAncestor): Ditto for removal. We have to check m_shadowTreeNeedsUpdate before
3803         calling SVGGraphicsElement::removedFromAncestor or updateExternalDocument since either function can invoke
3804         m_shadowTreeNeedsUpdate to true.
3805         (WebCore::SVGUseElement::willRecalcStyle): Deleted. We no longer call updateShadowTree during style recalc.
3806         (WebCore::SVGUseElement::updateShadowTree): Remove this element from the document's hah set. We can't clear all
3807         the entries in the map at once in Document::resolveStyle because updating the shadow trees of a SVG use element
3808         can result in a sync IPC in ImageLoader::updateFromElement, which end up executing arbitrary author scripts.
3809         (WebCore::SVGUseElement::cloneTarget const): Removed EventAllowedScope since the SVG use element's shadow tree
3810         is no longer updated when there is a NoEventDispatchAssertion in the stack.
3811         (WebCore::SVGUseElement::expandUseElementsInShadowTree const): Ditto.
3812         (WebCore::SVGUseElement::expandSymbolElementsInShadowTree const): Ditto.
3813         (WebCore::SVGUseElement::invalidateShadowTree): Add the element to the document's hash set if it's connected.
3814         * svg/SVGUseElement.h:
3815
3816 2017-12-13  Per Arne Vollan  <pvollan@apple.com>
3817
3818         REGRESSION(225597): Can't select a text box or web view on a page when VO is on.
3819         https://bugs.webkit.org/show_bug.cgi?id=180756
3820         <rdar://problem/35996158>
3821
3822         Reviewed by Brent Fulgham.
3823
3824         No new tests.
3825
3826         * platform/mac/EventLoopMac.mm:
3827         (WebCore::EventLoop::cycle):
3828
3829 2017-12-13  Antoine Quint  <graouts@apple.com>
3830
3831         [Web Animations] Implement the "updating the finished state" procedure
3832         https://bugs.webkit.org/show_bug.cgi?id=180743
3833         <rdar://problem/36017232>
3834
3835         Reviewed by Simon Fraser.
3836
3837         The Web Animations spec defines a procedure for "updating the finished state", which should run as the timeline time
3838         changes and is responsible for ultimately triggering finish events and fulfil the "finished" promise. The procedure
3839         allows for two flags to control its behavior: didSeek and synchronouslyNotify. When synchronouslyNotify is true, the
3840         "finish notification steps" procedure is ran right away, otherwise it's queued as a microtask.
3841
3842         In this patch we introduce the notion of "hold time", which is the time held while an animation is paused. It will be
3843         set by the pause() and play() method in future patches.
3844
3845         * animation/DocumentTimeline.cpp:
3846         (WebCore::DocumentTimeline::updateAnimations): Update the finished state as the timeline time changes with both flags
3847         set to false.
3848         * animation/WebAnimation.cpp:
3849         (WebCore::WebAnimation::currentTime const): Add a private currentTime(bool) variant which allows for the hold time to
3850         be ignored in case updateFinishedState() was called with the didSeek flag set to false.
3851         (WebCore::WebAnimation::updateFinishedState): Implement the procedure as specified with all spec-mandated steps inline.
3852         (WebCore::WebAnimation::scheduleMicrotaskIfNeeded): Schedule a microtask to complete the "finish notification steps"
3853         if we haven't scheduled a microtask before.
3854         (WebCore::WebAnimation::performMicrotask): Perform the microtask if the "finish notification steps" procedure hasn't
3855         been canceled after it was originally scheduled, as tracked by the m_finishNotificationStepsMicrotaskPending flag, since
3856         microtasks are not presently cancelable.
3857         (WebCore::WebAnimation::finishNotificationSteps): Implement the procedure as specified with all spec-mandated steps inline,
3858         dispatching a "finish" events and fulfilling the "finished" promise.
3859         * animation/WebAnimation.h:
3860         * animation/WebAnimation.idl:
3861         * dom/EventNames.h:
3862
3863 2017-12-13  Simon Fraser  <simon.fraser@apple.com>
3864
3865         Fix crash under Document::visualUpdatesSuppressionTimerFired()
3866         https://bugs.webkit.org/show_bug.cgi?id=180758
3867         Document::visualUpdatesSuppressionTimerFired
3868
3869         Reviewed by Zalan Bujtas.
3870
3871         Speculative fix for crash under visualUpdatesSuppressionTimerFired() where view()
3872         can be null. Add null checks for the view() in all code called from this function.
3873
3874         * dom/Document.cpp:
3875         (WebCore::Document::setVisualUpdatesAllowed):
3876         (WebCore::Document::visualUpdatesSuppressionTimerFired):
3877
3878 2017-12-13  Zalan Bujtas  <zalan@apple.com>
3879
3880         ASSERT(LayoutDisallowedScope::isLayoutAllowed()) whenever hitting Enter in Web Inspector console
3881         https://bugs.webkit.org/show_bug.cgi?id=180690
3882
3883         Reviewed by Simon Fraser.
3884
3885         Defer text replacement notification until after layout is done to avoid unexpected forced layouts.
3886
3887         Covered by existing tests.
3888
3889         * accessibility/AXObjectCache.cpp:
3890         (WebCore::AXObjectCache::disableAccessibility):
3891         (WebCore::AXObjectCache::remove):
3892         (WebCore::filterMapForRemoval):
3893         (WebCore::filterListForRemoval):
3894         (WebCore::AXObjectCache::prepareForDocumentDestruction):
3895         (WebCore::AXObjectCache::performDeferredCacheUpdate):
3896         (WebCore::AXObjectCache::deferTextReplacementNotificationForTextControl):
3897         (WebCore::filterForRemoval): Deleted.
3898         * accessibility/AXObjectCache.h: Need to use the base (Element) class since
3899         we can't call is<HTMLTextFormControlElement> in Node d'tor.
3900         (WebCore::AXObjectCache::deferTextReplacementNotificationForTextControl):
3901         * html/HTMLTextFormControlElement.cpp:
3902         (WebCore::HTMLTextFormControlElement::setInnerTextValue):
3903
3904 2017-12-13  Ryan Haddad  <ryanhaddad@apple.com>
3905
3906         Unreviewed, rolling out r225836.
3907
3908         Broke the Windows build.
3909
3910         Reverted changeset:
3911
3912         "Unify some WebGL sources"
3913         https://bugs.webkit.org/show_bug.cgi?id=180726
3914         https://trac.webkit.org/changeset/225836
3915
3916 2017-12-13  Andy Estes  <aestes@apple.com>
3917
3918         [Payment Request] Remove ApplePayPaymentMethodUpdateEvent and use PaymentDetailsModifiers instead
3919         https://bugs.webkit.org/show_bug.cgi?id=180737
3920         <rdar://problem/36013152>
3921
3922         Reviewed by Brady Eidson.
3923
3924         Instead of firing a non-standard "applepaypaymentmethodupdate" event when the payment method
3925         changes, use the PaymentDetailsModifier mechanism to allow the merchant to specify override
3926         totals and additional display items per payment method type.
3927
3928         Test: http/tests/ssl/applepay/ApplePayPaymentDetailsModifier.https.html
3929
3930         * DerivedSources.make:
3931         * Modules/applepay/ApplePayLineItem.idl:
3932         * Modules/applepay/ApplePayPaymentMethod.h:
3933         * Modules/applepay/ApplePayPaymentMethod.idl:
3934         * Modules/applepay/ApplePayPaymentMethodType.h: Added.
3935         * Modules/applepay/ApplePayPaymentMethodType.idl: Added.
3936         * Modules/applepay/cocoa/PaymentMethodCocoa.mm:
3937         * Modules/applepay/paymentrequest/ApplePayModifier.h: Added.
3938         * Modules/applepay/paymentrequest/ApplePayModifier.idl: Added.
3939         * Modules/applepay/paymentrequest/ApplePayPaymentHandler.cpp:
3940         (WebCore::ApplePayPaymentHandler::show):
3941         (WebCore::ApplePayPaymentHandler::computeTotalAndLineItems):
3942         (WebCore::ApplePayPaymentHandler::detailsUpdated):
3943         (WebCore::ApplePayPaymentHandler::shippingAddressUpdated):
3944         (WebCore::ApplePayPaymentHandler::shippingOptionUpdated):
3945         (WebCore::ApplePayPaymentHandler::paymentMethodUpdated):
3946         (WebCore::ApplePayPaymentHandler::didSelectPaymentMethod):
3947         * Modules/applepay/paymentrequest/ApplePayPaymentHandler.h:
3948         * Modules/applepay/paymentrequest/ApplePayPaymentMethodUpdateEvent.cpp: Removed.
3949         * Modules/applepay/paymentrequest/ApplePayPaymentMethodUpdateEvent.h: Removed.
3950         * Modules/paymentrequest/PaymentRequest.h:
3951         * Modules/paymentrequest/PaymentRequest.idl:
3952         * WebCore.xcodeproj/project.pbxproj:
3953         * dom/EventNames.h:
3954         * dom/EventNames.in:
3955         * testing/MockPaymentCoordinator.cpp:
3956         (WebCore::convert):
3957         (WebCore::MockPaymentCoordinator::updateTotalAndLineItems):
3958         (WebCore::MockPaymentCoordinator::completeShippingMethodSelection):
3959         (WebCore::MockPaymentCoordinator::completeShippingContactSelection):
3960         (WebCore::MockPaymentCoordinator::completePaymentMethodSelection):
3961         * testing/MockPaymentCoordinator.h:
3962         * testing/MockPaymentCoordinator.idl:
3963
3964 2017-12-12  Zalan Bujtas  <zalan@apple.com>
3965