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