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