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