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