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