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