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