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