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