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