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