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