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