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