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