[MediaStream] Add Mac screen capture source
[WebKit-https.git] / Source / WebCore / ChangeLog
1 2018-01-05  Eric Carlson  <eric.carlson@apple.com>
2
3         [MediaStream] Add Mac screen capture source
4         https://bugs.webkit.org/show_bug.cgi?id=181333
5         <rdar://problem/36323219>
6
7         Reviewed by Dean Jackson.
8
9         * SourcesCocoa.txt: Add ScreenDisplayCaptureSourceMac.mm.
10
11         * WebCore.xcodeproj/project.pbxproj: Ditto.
12
13         * platform/cocoa/CoreVideoSoftLink.cpp: Declare new constants used.
14         * platform/cocoa/CoreVideoSoftLink.h:
15
16         * platform/mediastream/mac/DisplayCaptureManagerCocoa.cpp:
17         (WebCore::displayReconfigurationCallBack): Call refreshCaptureDevices.
18         (WebCore::DisplayCaptureManagerCocoa::~DisplayCaptureManagerCocoa): Unregister for display
19         reconfiguration callbacks.
20         (WebCore::DisplayCaptureManagerCocoa::captureDevices): Register for display reconfigrations.
21         (WebCore::DisplayCaptureManagerCocoa::refreshCaptureDevices): Use CGActiveDisplayList to
22         get list of active screens.
23         (WebCore::DisplayCaptureManagerCocoa::screenCaptureDeviceWithPersistentID): Validate screen
24         ID, return CaptureDevice.
25         * platform/mediastream/mac/DisplayCaptureManagerCocoa.h:
26
27         * platform/mediastream/mac/RealtimeMediaSourceCenterMac.cpp:
28         (WebCore::VideoCaptureSourceFactoryMac::createVideoCaptureSource): Deal with screen capture
29         on macOS.
30
31         Implement Mac screen capture with CGDisplayStream.
32         * platform/mediastream/mac/ScreenDisplayCaptureSourceMac.h: Added.
33         (WebCore::ScreenDisplayCaptureSourceMac::DisplaySurface::~DisplaySurface):
34         (WebCore::ScreenDisplayCaptureSourceMac::DisplaySurface::operator=):
35         (WebCore::ScreenDisplayCaptureSourceMac::DisplaySurface::ioSurface const):
36         * platform/mediastream/mac/ScreenDisplayCaptureSourceMac.mm: Added.
37         (WebCore::roundUpToMacroblockMultiple):
38         (WebCore::ScreenDisplayCaptureSourceMac::updateDisplayID):
39         (WebCore::ScreenDisplayCaptureSourceMac::create):
40         (WebCore::ScreenDisplayCaptureSourceMac::ScreenDisplayCaptureSourceMac):
41         (WebCore::ScreenDisplayCaptureSourceMac::~ScreenDisplayCaptureSourceMac):
42         (WebCore::ScreenDisplayCaptureSourceMac::createDisplayStream):
43         (WebCore::ScreenDisplayCaptureSourceMac::startProducingData):
44         (WebCore::ScreenDisplayCaptureSourceMac::stopProducingData):
45         (WebCore::ScreenDisplayCaptureSourceMac::sampleBufferFromPixelBuffer):
46         (WebCore::ScreenDisplayCaptureSourceMac::pixelBufferFromIOSurface):
47         (WebCore::ScreenDisplayCaptureSourceMac::generateFrame):
48         (WebCore::ScreenDisplayCaptureSourceMac::startDisplayStream):
49         (WebCore::ScreenDisplayCaptureSourceMac::applySize):
50         (WebCore::ScreenDisplayCaptureSourceMac::applyFrameRate):
51         (WebCore::ScreenDisplayCaptureSourceMac::commitConfiguration):
52         (WebCore::ScreenDisplayCaptureSourceMac::displayWasReconfigured):
53         (WebCore::ScreenDisplayCaptureSourceMac::displayReconfigurationCallBack):
54         (WebCore::ScreenDisplayCaptureSourceMac::frameAvailable):
55
56 2018-01-05  Don Olmstead  <don.olmstead@sony.com>
57
58         [curl] Can't load file:// URL with a URL fragment identifier
59         https://bugs.webkit.org/show_bug.cgi?id=181170
60
61         Reviewed by Alex Christensen.
62
63         No new tests. No change in behavior.
64
65         * platform/network/curl/CurlRequest.cpp:
66         (WebCore::CurlRequest::invokeDidReceiveResponseForFile):
67
68 2018-01-05  Don Olmstead  <don.olmstead@sony.com>
69
70         TextCodec uses std::array but does not include it
71         https://bugs.webkit.org/show_bug.cgi?id=181340
72
73         Reviewed by Alex Christensen.
74
75         No new tests. No change in behavior.
76
77         * platform/text/TextCodec.h:
78
79 2018-01-05  Said Abou-Hallawa  <sabouhallawa@apple.com>
80
81         SVGAnimatedListPropertyTearOff::synchronizeWrappersIfNeeded() should do nothing if the property is not animating
82         https://bugs.webkit.org/show_bug.cgi?id=181316
83         <rdar://problem/36147545>
84
85         Reviewed by Simon Fraser.
86
87         This is a speculative change to fix a crash which appeared after r226065.
88         The crash is very intermittent and sometimes very hard to reproduce. The
89         basic code analysis did not show how this crash can even happen.
90
91         * svg/SVGAnimatedTypeAnimator.h:
92         (WebCore::SVGAnimatedTypeAnimator::resetFromBaseValues): For SVG property
93         with two values, e.g. <SVGAngleValue, SVGMarkerOrientType>,  we need to
94         detach the wrappers of the animated property if the animated values are
95         going to change. This is similar to what we did in resetFromBaseValue().
96
97         * svg/properties/SVGAnimatedListPropertyTearOff.h:
98         (WebCore::SVGAnimatedListPropertyTearOff::synchronizeWrappersIfNeeded):
99
100 2018-01-05  Matt Lewis  <jlewis3@apple.com>
101
102         Unreviewed, rolling out r226401.
103
104         This caused timeouts on multiple platforms.
105
106         Reverted changeset:
107
108         "Implement Cache API partitioning based on ClientOrigin"
109         https://bugs.webkit.org/show_bug.cgi?id=181240
110         https://trac.webkit.org/changeset/226401
111
112 2018-01-05  Dan Bernstein  <mitz@apple.com>
113
114         Fixed the build following AppKit API deprecations in a recent SDKs
115
116         * platform/mac/PasteboardMac.mm:
117         (WebCore::setDragImageImpl): Suppressed deprecation warnings.
118         * platform/mac/WidgetMac.mm:
119         (WebCore::Widget::paint): Ditto.
120
121 2018-01-05  Joseph Pecoraro  <pecoraro@apple.com>
122
123         ServiceWorkers: Enable UserTiming / ResourceTiming
124         https://bugs.webkit.org/show_bug.cgi?id=181297
125         <rdar://problem/36307306>
126
127         Reviewed by Youenn Fablet.
128
129         Tests: http/tests/workers/service/service-worker-resource-timing.https.html
130                http/tests/workers/service/service-worker-user-timing.https.html
131
132         * loader/ResourceTiming.cpp:
133         (WebCore::ResourceTiming::ResourceTiming):
134         We used to clear extra NetworkLoadMetrics data early on. However,
135         for Workers we want to pass the complete NetworkLoadMetrics to
136         the Worker so that a Worker inspector has access to it.
137
138         * page/PerformanceResourceTiming.cpp:
139         (WebCore::PerformanceResourceTiming::PerformanceResourceTiming):
140         Instead move the clearing of extra data to here, when the NetworkLoadMetrics
141         have finally settled into being used only for a performance entry.
142
143 2018-01-04  Philippe Normand  <pnormand@igalia.com>
144
145         [EME][GStreamer] Fix wrong ifdef
146         https://bugs.webkit.org/show_bug.cgi?id=181289
147
148         Reviewed by Alex Christensen.
149
150         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:
151         (WebCore::MediaPlayerPrivateGStreamer::handleMessage): Remove the
152         ENCRYPTED_MEDIA ifdef from the VIDEO_TRACK ifdef block. Both have
153         nothing to do together.
154
155 2018-01-05  Fujii Hironori  <Hironori.Fujii@sony.com>
156
157         [Cairo] Canvas: Path::clear should clear its transform
158         https://bugs.webkit.org/show_bug.cgi?id=181320
159
160         Reviewed by Carlos Garcia Campos.
161
162         Path of Cairo port has its cairo context. Path::clear() didn't
163         clear the transform matrix of the context.
164
165         Test: fast/canvas/reset-scaling-by-height-change.html
166
167         * platform/graphics/cairo/PathCairo.cpp:
168         (WebCore::Path::clear): Reset the transform matrix of Path.
169
170 2018-01-04  Devin Rousso  <webkit@devinrousso.com>
171
172         Web Inspector: replace HTMLCanvasElement with CanvasRenderingContext for instrumentation logic
173         https://bugs.webkit.org/show_bug.cgi?id=180770
174
175         Reviewed by Joseph Pecoraro.
176
177         No change in functionality.
178
179         * html/HTMLCanvasElement.h:
180         * html/HTMLCanvasElement.cpp:
181         (WebCore::HTMLCanvasElement::createContext2d):
182         (WebCore::HTMLCanvasElement::createContextWebGL):
183         (WebCore::HTMLCanvasElement::createContextWebGPU):
184         (WebCore::HTMLCanvasElement::createContextBitmapRenderer):
185         (WebCore::HTMLCanvasElement::reset):
186         (WebCore::HTMLCanvasElement::paint):
187         (WebCore::HTMLCanvasElement::setImageBuffer const):
188         (WebCore::HTMLCanvasElement::addObserver): Deleted.
189         (WebCore::HTMLCanvasElement::removeObserver): Deleted.
190         (WebCore::HTMLCanvasElement::cssCanvasClients): Deleted.
191         (WebCore::HTMLCanvasElement::notifyObserversCanvasChanged): Deleted.
192         * html/OffscreenCanvas.h:
193         * html/canvas/CanvasRenderingContext.h:
194         * html/canvas/CanvasRenderingContext.cpp:
195         * html/canvas/CanvasRenderingContext2D.h:
196         * html/canvas/CanvasRenderingContext2D.cpp:
197         (WebCore::CanvasRenderingContext2D::create):
198         * html/canvas/CanvasRenderingContext2DBase.h:
199         * html/canvas/ImageBitmapRenderingContext.h:
200         * html/canvas/ImageBitmapRenderingContext.cpp:
201         (WebCore::ImageBitmapRenderingContext::create):
202         * html/canvas/WebGL2RenderingContext.h:
203         * html/canvas/WebGL2RenderingContext.cpp:
204         (WebCore::WebGL2RenderingContext::create):
205         * html/canvas/WebGLRenderingContext.h:
206         * html/canvas/WebGLRenderingContext.cpp:
207         (WebCore::WebGLRenderingContext::create):
208         * html/canvas/WebGLRenderingContextBase.h:
209         * html/canvas/WebGLRenderingContextBase.cpp:
210         (WebCore::WebGLRenderingContextBase::create):
211         * html/canvas/WebGPURenderingContext.cpp:
212         (WebCore::WebGPURenderingContext::create):
213         Instead of adding didCreateCanvasRenderingContext calls at the construction sites of each
214         context, we can make the constructors private and force the usage of static `create` functions.
215         This way, we have access to the fully constructed object and have a guaranteed path for creation.
216
217         * html/CanvasBase.h:
218         * html/CanvasBase.cpp:
219         (WebCore::CanvasBase::~CanvasBase):
220         (WebCore::CanvasBase::renderingContext const):
221         (WebCore::CanvasBase::addObserver):
222         (WebCore::CanvasBase::removeObserver):
223         (WebCore::CanvasBase::notifyObserversCanvasChanged):
224         (WebCore::CanvasBase::notifyObserversCanvasResized):
225         (WebCore::CanvasBase::notifyObserversCanvasDestroyed):
226         (WebCore::CanvasBase::cssCanvasClients const):
227         * Modules/mediastream/CanvasCaptureMediaStreamTrack.h:
228         * Modules/mediastream/CanvasCaptureMediaStreamTrack.cpp:
229         (WebCore::CanvasCaptureMediaStreamTrack::Source::canvasDestroyed):
230         (WebCore::CanvasCaptureMediaStreamTrack::Source::canvasResized):
231         (WebCore::CanvasCaptureMediaStreamTrack::Source::canvasChanged):
232         * css/CSSCanvasValue.h:
233         Move the CanvasObserver class to CanvasBase so that it can also be used for OffscreenCanvas.
234
235         * inspector/InspectorInstrumentation.h:
236         (WebCore::InspectorInstrumentation::didChangeCSSCanvasClientNodes):
237         (WebCore::InspectorInstrumentation::didCreateCanvasRenderingContext):
238         (WebCore::InspectorInstrumentation::didChangeCanvasMemory):
239         (WebCore::InspectorInstrumentation::recordCanvasAction):
240         (WebCore::InspectorInstrumentation::didFinishRecordingCanvasFrame):
241         (WebCore::InspectorInstrumentation::didEnableExtension):
242         (WebCore::InspectorInstrumentation::didCreateProgram):
243         (WebCore::InspectorInstrumentation::willDeleteProgram):
244         (WebCore::InspectorInstrumentation::isShaderProgramDisabled):
245         (WebCore::InspectorInstrumentation::consoleStartRecordingCanvas):
246         (WebCore::InspectorInstrumentation::didCreateCSSCanvas): Deleted.
247         * inspector/InspectorInstrumentation.cpp:
248         (WebCore::InspectorInstrumentation::consoleStartRecordingCanvasImpl):
249         (WebCore::InspectorInstrumentation::didChangeCSSCanvasClientNodesImpl):
250         (WebCore::InspectorInstrumentation::didCreateCanvasRenderingContextImpl):
251         (WebCore::InspectorInstrumentation::didChangeCanvasMemoryImpl):
252         (WebCore::InspectorInstrumentation::didFinishRecordingCanvasFrameImpl):
253         (WebCore::InspectorInstrumentation::didEnableExtensionImpl):
254         (WebCore::InspectorInstrumentation::didCreateProgramImpl):
255         (WebCore::InspectorInstrumentation::didCreateCSSCanvasImpl): Deleted.
256
257         * inspector/agents/InspectorCanvasAgent.h:
258         * inspector/agents/InspectorCanvasAgent.cpp:
259         (WebCore::InspectorCanvasAgent::enable):
260         (WebCore::InspectorCanvasAgent::requestNode):
261         (WebCore::InspectorCanvasAgent::requestContent):
262         (WebCore::InspectorCanvasAgent::requestCSSCanvasClientNodes):
263         (WebCore::contextAsScriptValue):
264         (WebCore::InspectorCanvasAgent::resolveCanvasContext):
265         (WebCore::InspectorCanvasAgent::startRecording):
266         (WebCore::InspectorCanvasAgent::stopRecording):
267         (WebCore::InspectorCanvasAgent::updateShader):
268         (WebCore::InspectorCanvasAgent::frameNavigated):
269         (WebCore::InspectorCanvasAgent::didChangeCSSCanvasClientNodes):
270         (WebCore::InspectorCanvasAgent::didCreateCanvasRenderingContext):
271         (WebCore::InspectorCanvasAgent::didChangeCanvasMemory):
272         (WebCore::InspectorCanvasAgent::recordCanvasAction):
273         (WebCore::InspectorCanvasAgent::canvasDestroyed):
274         (WebCore::InspectorCanvasAgent::didFinishRecordingCanvasFrame):
275         (WebCore::InspectorCanvasAgent::consoleStartRecordingCanvas):
276         (WebCore::InspectorCanvasAgent::didEnableExtension):
277         (WebCore::InspectorCanvasAgent::didCreateProgram):
278         (WebCore::InspectorCanvasAgent::canvasRecordingTimerFired):
279         (WebCore::InspectorCanvasAgent::clearCanvasData):
280         (WebCore::InspectorCanvasAgent::unbindCanvas):
281         (WebCore::InspectorCanvasAgent::findInspectorCanvas):
282         (WebCore::InspectorCanvasAgent::unbindProgram):
283         (WebCore::InspectorCanvasAgent::didCreateCSSCanvas): Deleted.
284
285         * inspector/InspectorCanvas.h:
286         * inspector/InspectorCanvas.cpp:
287         (WebCore::InspectorCanvas::create):
288         (WebCore::InspectorCanvas::InspectorCanvas):
289         (WebCore::InspectorCanvas::canvasElement):
290         (WebCore::InspectorCanvas::resetRecordingData):
291         (WebCore::InspectorCanvas::recordAction):
292         (WebCore::InspectorCanvas::buildObjectForCanvas):
293         (WebCore::InspectorCanvas::getCanvasContentAsDataURL):
294         (WebCore::InspectorCanvas::buildInitialState):
295         (WebCore::InspectorCanvas::~InspectorCanvas): Deleted.
296
297         * inspector/InspectorShaderProgram.h:
298         * inspector/InspectorShaderProgram.cpp:
299         (WebCore::InspectorShaderProgram::context const):
300
301         * page/PageConsoleClient.cpp:
302         (WebCore::PageConsoleClient::record):
303         (WebCore::PageConsoleClient::recordEnd):
304
305         * dom/Document.h:
306         * dom/Document.cpp:
307         (WebCore::Document::getCSSCanvasElement):
308         (WebCore::Document::nameForCSSCanvasElement const):
309         We have no reason to save the CSS canvas name for each InspectorCanvas object, so instead we
310         can just query for the name based on the CanvasRenderingContext's HTMLCanvasElement (assuming
311         it is not an OffscreenCanvas) when we need it.
312
313 2018-01-04  Chris Fleizach  <cfleizach@apple.com>
314
315         AX: Implement updated CSS3 Speech for 'speak' and 'speak-as' properties
316         https://bugs.webkit.org/show_bug.cgi?id=180361
317
318         Reviewed by Zalan Bujtas.
319
320         Change speak -> speakAs, and allow a combination of properties.
321
322         Tests: Updated accessibility/mac/css-speech-speak.html
323
324         * accessibility/AccessibilityObject.h:
325         (WebCore::AccessibilityObject::speakAsProperty const):
326         (WebCore::AccessibilityObject::speakProperty const): Deleted.
327         * accessibility/AccessibilityRenderObject.cpp:
328         (WebCore::AccessibilityRenderObject::speakAsProperty const):
329         (WebCore::AccessibilityRenderObject::speakProperty const): Deleted.
330         * accessibility/AccessibilityRenderObject.h:
331         * accessibility/ios/WebAccessibilityObjectWrapperIOS.mm:
332         (-[WebAccessibilityObjectWrapper accessibilitySpeechHint]):
333         * accessibility/mac/WebAccessibilityObjectWrapperBase.h:
334         * accessibility/mac/WebAccessibilityObjectWrapperBase.mm:
335         (-[WebAccessibilityObjectWrapperBase baseAccessibilitySpeechHint]):
336         * accessibility/mac/WebAccessibilityObjectWrapperMac.mm:
337         (-[WebAccessibilityObjectWrapper accessibilityAttributeValue:]):
338         * css/CSSComputedStyleDeclaration.cpp:
339         (WebCore::speakAsToCSSValue):
340         (WebCore::ComputedStyleExtractor::propertyValue):
341         * css/CSSPrimitiveValueMappings.h:
342         (WebCore::CSSPrimitiveValue::CSSPrimitiveValue):
343         (WebCore::CSSPrimitiveValue::operator ESpeakAs const):
344         (WebCore::CSSPrimitiveValue::operator ESpeak const): Deleted.
345         * css/CSSProperties.json:
346         * css/StyleBuilderConverter.h:
347         (WebCore::StyleBuilderConverter::convertSpeakAs):
348         * css/parser/CSSParserFastPaths.cpp:
349         (WebCore::CSSParserFastPaths::isValidKeywordPropertyAndValue):
350         (WebCore::CSSParserFastPaths::isKeywordPropertyID):
351         * css/parser/CSSPropertyParser.cpp:
352         (WebCore::consumeSpeakAs):
353         (WebCore::CSSPropertyParser::parseSingleValue):
354         * rendering/style/RenderStyle.h:
355         (WebCore::RenderStyle::speakAs const):
356         (WebCore::RenderStyle::setSpeakAs):
357         (WebCore::RenderStyle::initialSpeakAs):
358         (WebCore::RenderStyle::speak const): Deleted.
359         (WebCore::RenderStyle::setSpeak): Deleted.
360         (WebCore::RenderStyle::initialSpeak): Deleted.
361         * rendering/style/RenderStyleConstants.h:
362         (WebCore::operator| ):
363         (WebCore::operator|= ):
364         * rendering/style/StyleRareInheritedData.cpp:
365         (WebCore::StyleRareInheritedData::StyleRareInheritedData):
366         (WebCore::StyleRareInheritedData::operator== const):
367         * rendering/style/StyleRareInheritedData.h:
368
369 2018-01-04  Brian Burg  <bburg@apple.com>
370
371         Web Inspector: Capture Element Screenshot looks fuzzy
372         https://bugs.webkit.org/show_bug.cgi?id=175734
373         <rdar://problem/33803377>
374
375         Reviewed by Joseph Pecoraro and Simon Fraser.
376
377         Screenshots taken by Web Inspector were being downscaled from the
378         internal size to the logical size, causing them to be blurry when
379         later upscaled to the internal size.
380
381         Replace ScaleBehavior { Scaled, Unscaled } with PreserveResolution { No, Yes }.
382         This is a lot less confusing to read both inside ImageBuffer and at its use sites.
383
384         Remove unused CoordinateSystem argument for ImageBuffer::toDataURL,
385         and replace it with PreserveResolution. Plumb PreserveResolution into toCFData
386         so that PreserveResolution::Yes will preserve the internal size of
387         the image buffer, just as it does in other methods that take PreserveResolution.
388
389         At the use site in InspectorPageAgent, always request PreserveResolution::Yes snapshots
390         when taking an element screenshot. For now, keep using downscaled (smaller)
391         snapshots when capturing canvas previews, as the previews are not full-size.
392
393         Test: inspector/page/hidpi-snapshot-size.html
394
395         * html/HTMLCanvasElement.cpp:
396         (WebCore::HTMLCanvasElement::makePresentationCopy):
397         (WebCore::HTMLCanvasElement::copiedImage const):
398         * html/canvas/CanvasRenderingContext2DBase.cpp:
399         (WebCore::CanvasRenderingContext2DBase::createPattern):
400         * inspector/agents/InspectorPageAgent.cpp:
401         (WebCore::InspectorPageAgent::snapshotNode):
402         (WebCore::InspectorPageAgent::snapshotRect):
403         * page/TextIndicator.cpp:
404         (WebCore::takeSnapshot):
405         * platform/DragImage.cpp:
406         (WebCore::createDragImageFromSnapshot):
407         * platform/graphics/BitmapImage.cpp:
408         (WebCore::BitmapImage::drawPattern):
409         * platform/graphics/ImageBuffer.h:
410         * platform/graphics/cairo/ImageBufferCairo.cpp:
411         (WebCore::ImageBuffer::sinkIntoImage):
412         (WebCore::ImageBuffer::copyImage const):
413         (WebCore::ImageBuffer::toDataURL const):
414         * platform/graphics/cg/ImageBufferCG.cpp:
415         (WebCore::createBitmapImageAfterScalingIfNeeded):
416         (WebCore::ImageBuffer::copyImage const):
417         (WebCore::ImageBuffer::sinkIntoImage):
418         (WebCore::ImageBuffer::toDataURL const):
419         (WebCore::ImageBuffer::toData const):
420         (WebCore::ImageBuffer::toCFData const):
421         * platform/graphics/gtk/ImageBufferGtk.cpp:
422         (WebCore::ImageBuffer::toDataURL const):
423         * platform/graphics/win/ImageBufferDirect2D.cpp:
424         (WebCore::ImageBuffer::copyImage const):
425         (WebCore::ImageBuffer::sinkIntoImage):
426         (WebCore::ImageBuffer::toDataURL const):
427         * svg/graphics/SVGImage.cpp:
428         (WebCore::SVGImage::drawPatternForContainer):
429
430 2018-01-04  John Wilander  <wilander@apple.com>
431
432         Storage Access API: Turn feature on by default in Settings.yaml
433         https://bugs.webkit.org/show_bug.cgi?id=181298
434         <rdar://problem/36302506>
435
436         Reviewed by Brent Fulgham.
437
438         No new tests. This is just a feature settings change.
439
440         * page/Settings.yaml:
441
442 2018-01-04  Zalan Bujtas  <zalan@apple.com>
443
444         WebContent process crashes while loading https://www.classicspecs.com
445         https://bugs.webkit.org/show_bug.cgi?id=181290
446         <rdar://problem/36225906>
447
448         Reviewed by Simon Fraser.
449
450         Floats can overhang multiple blocks (they are called intruding floats).
451         Each block keeps track of such intruding floats. When an overhanging float box is destroyed,
452         we need to deregister it from all those blocks. We do it by walking up the ancestor block chain
453         and check if the parent (grandparent etc) block still contains this float. Once we find the topmost block, 
454         we start deregistering it by traversing back on the descendant blocks.
455         Normally we do it in RenderElement::takeChildInternal right before the box is getting detached.
456         However in certain cases (like when the float's parent happens to be an anonymous wrapper)
457         by the time we get to ::takeChildInternal the subtree is already detached and we can't access all the
458         ancestors.
459         This patch ensure that the floating box is still attached during de-registration. 
460
461         Test: fast/block/float/crash-when-intruding-float-has-anonymous-parent-and-detach.html
462
463         * rendering/RenderObject.cpp:
464         (WebCore::RenderObject::removeFromParentAndDestroyCleaningUpAnonymousWrappers):
465
466 2018-01-04  Eric Carlson  <eric.carlson@apple.com>
467
468         [MediaStream] Add Mock screen capture source
469         https://bugs.webkit.org/show_bug.cgi?id=181291
470         <rdar://problem/36298164>
471
472         Reviewed by Dean Jackson.
473
474         Tests:  http/tests/media/media-stream/get-display-media-prompt.html
475                 GetDisplayMediaTest.BasicPrompt
476                 GetDisplayMediaTest.Constraints
477
478         * Modules/mediastream/MediaDevices.cpp:
479         (WebCore::MediaDevices::MediaDevices): Add static_assert to ensure MediaDevices::DisplayCaptureSurfaceType
480         and RealtimeMediaSourceSettings::DisplaySurfaceType values are equivalent.
481         (WebCore::MediaDevices::getSupportedConstraints): Remove bogus code.
482         * Modules/mediastream/MediaDevices.h: Add DisplayCaptureSurfaceType.
483         * Modules/mediastream/MediaDevices.idl: Ditto.
484
485         * Modules/mediastream/MediaStreamTrack.cpp:
486         (WebCore::MediaStreamTrack::getSettings const): Add a FIXME.
487         * Modules/mediastream/MediaStreamTrack.h: Add displaySurface and logicalSurface.
488
489         * Modules/mediastream/MediaTrackSupportedConstraints.h: Remove displaySurface and logicalSurface.
490         * Modules/mediastream/MediaTrackSupportedConstraints.idl:
491
492         * SourcesCocoa.txt: Add DisplayCaptureManagerCocoa.cpp and DisplayCaptureSourceCocoa.cpp.
493
494         * WebCore.xcodeproj/project.pbxproj: Ditto.
495
496         * platform/mediastream/CaptureDevice.h:
497         (WebCore::CaptureDevice::encode const): Add.
498         (WebCore::CaptureDevice::decode):
499
500         * platform/mediastream/RealtimeMediaSourceCenter.cpp:
501         (WebCore::RealtimeMediaSourceCenter::getMediaStreamDevices): Include display capture "devices".
502         (WebCore::RealtimeMediaSourceCenter::validateRequestConstraints): Deal with display capture devices.
503         (WebCore::RealtimeMediaSourceCenter::captureDeviceWithPersistentID): Ditto.
504         * platform/mediastream/RealtimeMediaSourceCenter.h:
505
506         * platform/mediastream/RealtimeMediaSourceSettings.h:
507         (WebCore::RealtimeMediaSourceSettings::displaySurface const): Return a DisplaySurfaceType.
508         (WebCore::RealtimeMediaSourceSettings::setDisplaySurface): Take a DisplaySurfaceType.
509
510         * platform/mediastream/mac/DisplayCaptureManagerCocoa.cpp:
511         (WebCore::DisplayCaptureManagerCocoa::singleton):
512         (WebCore::DisplayCaptureManagerCocoa::~DisplayCaptureManagerCocoa):
513         (WebCore::DisplayCaptureManagerCocoa::captureDevices):
514         (WebCore::DisplayCaptureManagerCocoa::screenCaptureDeviceWithPersistentID):
515         (WebCore::DisplayCaptureManagerCocoa::captureDeviceWithPersistentID):
516         * platform/mediastream/mac/DisplayCaptureManagerCocoa.h:
517
518         * platform/mediastream/mac/DisplayCaptureSourceCocoa.cpp: Added.
519         (WebCore::DisplayCaptureSourceCocoa::DisplayCaptureSourceCocoa):
520         (WebCore::DisplayCaptureSourceCocoa::~DisplayCaptureSourceCocoa):
521         (WebCore::DisplayCaptureSourceCocoa::capabilities const):
522         (WebCore::DisplayCaptureSourceCocoa::settings const):
523         (WebCore::DisplayCaptureSourceCocoa::settingsDidChange):
524         (WebCore::DisplayCaptureSourceCocoa::startProducingData):
525         (WebCore::DisplayCaptureSourceCocoa::stopProducingData):
526         (WebCore::DisplayCaptureSourceCocoa::elapsedTime):
527         (WebCore::DisplayCaptureSourceCocoa::applyFrameRate):
528         (WebCore::DisplayCaptureSourceCocoa::emitFrame):
529         * platform/mediastream/mac/DisplayCaptureSourceCocoa.h:
530
531         * platform/mediastream/mac/RealtimeMediaSourceCenterMac.cpp:
532         (WebCore::RealtimeMediaSourceCenterMac::displayCaptureDeviceManager): New.
533         * platform/mediastream/mac/RealtimeMediaSourceCenterMac.h:
534
535         * platform/mock/MockRealtimeMediaSource.cpp:
536         (WebCore::deviceMap): Add screen capture "devices".
537         (WebCore::MockRealtimeMediaSource::displayDevices): New.
538         * platform/mock/MockRealtimeMediaSource.h:
539
540         * platform/mock/MockRealtimeMediaSourceCenter.cpp: Clean up includes.
541         * platform/mock/MockRealtimeMediaSourceCenter.h:
542
543         * platform/mock/MockRealtimeVideoSource.cpp:
544         (WebCore::MockRealtimeVideoSource::MockRealtimeVideoSource): Mock two screen devices.
545         (WebCore::MockRealtimeVideoSource::updateSettings): Deal with mock screens.
546         (WebCore::MockRealtimeVideoSource::initializeCapabilities): Ditto.
547         (WebCore::MockRealtimeVideoSource::initializeSupportedConstraints): Ditto.
548         (WebCore::MockRealtimeVideoSource::drawText): Ditto.
549         (WebCore::MockRealtimeVideoSource::generateFrame): Ditto.
550         * platform/mock/MockRealtimeVideoSource.h:
551         (WebCore::MockRealtimeVideoSource::mockCamera const):
552         (WebCore::MockRealtimeVideoSource::mockScreen const):
553
554 2018-01-04  Youenn Fablet  <youenn@apple.com>
555
556         FetchResponse should set its internal response text encoding name
557         https://bugs.webkit.org/show_bug.cgi?id=181284
558
559         Reviewed by Alex Christensen.
560
561         Covered by rebased test.
562
563         * Modules/fetch/FetchResponse.cpp:
564         (WebCore::FetchResponse::create): Set response text encoding based on content type charset.
565
566 2018-01-04  John Wilander  <wilander@apple.com>
567
568         Storage Access API: Remove JavaScript confirm() prompt from Document::requestStorageAccess()
569         https://bugs.webkit.org/show_bug.cgi?id=181276
570         <rdar://problem/36290463>
571
572         Reviewed by Alex Christensen.
573
574         No new tests. Existing test expectations updated.
575
576         * dom/Document.cpp:
577         (WebCore::Document::requestStorageAccess):
578
579 2018-01-04  Carlos Garcia Campos  <cgarcia@igalia.com>
580
581         [GTK] Issues with Ahem's ex / x-height
582         https://bugs.webkit.org/show_bug.cgi?id=180581
583
584         Reviewed by Michael Catanzaro.
585
586         Get the x-height value from the TT_OS2 table if available.
587
588         Fixes: fast/text/break-word-pre-wrap.html
589                imported/w3c/web-platform-tests/css/css-shapes-1/shape-outside/values/shape-outside-shape-arguments-000.html
590
591         * platform/graphics/freetype/SimpleFontDataFreeType.cpp:
592         (WebCore::Font::platformInit):
593
594 2018-01-04  Philippe Normand  <pnormand@igalia.com>
595
596         Unreviewed, GTK build fix attempt after r226357
597
598         * platform/graphics/gstreamer/GStreamerUtilities.h: The
599         GST_BUFFER_DTS_OR_PTS macro was added in GStreamer 1.8 but old
600         versions of Debian might not have this release yet.
601
602 2018-01-04  Youenn Fablet  <youenn@apple.com>
603
604         Implement Cache API partitioning based on ClientOrigin
605         https://bugs.webkit.org/show_bug.cgi?id=181240
606
607         Reviewed by Alex Christensen.
608
609         Covered by updated tests.
610
611         Previously, cache storage was partitioned according the origin of the client, represented as a String.
612         We now partition according both client and top origins, represented as a ClientOrigin
613
614         Minor refactoring to use more makePendingActivity.
615         Added support for IPC serialization of ClientOrigin.
616         Added SecurityOriginData::toString which is used by WebKit2 Cache Storage implementation.
617
618         * Modules/cache/CacheStorageConnection.cpp:
619         (WebCore::CacheStorageConnection::open):
620         (WebCore::CacheStorageConnection::retrieveCaches):
621         * Modules/cache/CacheStorageConnection.h:
622         (WebCore::CacheStorageConnection::clearMemoryRepresentation):
623         (WebCore::CacheStorageConnection::doOpen):
624         (WebCore::CacheStorageConnection::doRetrieveCaches):
625         * Modules/cache/DOMCacheStorage.cpp:
626         (WebCore::DOMCacheStorage::origin const):
627         (WebCore::DOMCacheStorage::retrieveCaches):
628         (WebCore::DOMCacheStorage::open):
629         (WebCore::DOMCacheStorage::remove):
630         * Modules/cache/DOMCacheStorage.h:
631         * Modules/cache/WorkerCacheStorageConnection.cpp:
632         (WebCore::WorkerCacheStorageConnection::doOpen):
633         (WebCore::WorkerCacheStorageConnection::doRetrieveCaches):
634         * Modules/cache/WorkerCacheStorageConnection.h:
635         * page/ClientOrigin.h:
636         (WebCore::ClientOrigin::isolatedCopy const):
637         (WebCore::ClientOrigin::encode const):
638         (WebCore::ClientOrigin::decode):
639         * page/SecurityOriginData.cpp:
640         (WebCore::SecurityOriginData::toString const):
641         (WebCore::SecurityOriginData::debugString const): Deleted.
642         * page/SecurityOriginData.h:
643         (WebCore::SecurityOriginData::debugString const):
644         * testing/Internals.cpp:
645         (WebCore::Internals::clearCacheStorageMemoryRepresentation):
646
647 2018-01-04  Youenn Fablet  <youenn@apple.com>
648
649         Service Worker should expose redirect mode for navigation loads as manual
650         https://bugs.webkit.org/show_bug.cgi?id=181067
651
652         Reviewed by Alex Christensen.
653
654         Covered by rebased tests.
655
656         * loader/CrossOriginAccessControl.cpp: Removing ContentType header only if affecting CORS checks.
657         This allows extending header filtering in service worker to all modes, including Navigate.
658         * workers/service/context/ServiceWorkerFetch.cpp:
659         (WebCore::ServiceWorkerFetch::dispatchFetchEvent): Ideally, document loading code should set redirect to manual.
660         Since it is not the case yet and that would require changes to various places, manual is set before exposing the corresponding fetch event.
661
662 2018-01-04  Youenn Fablet  <youenn@apple.com>
663
664         ServiceWorkerThreadProxy::postTaskForModeToWorkerGlobalScope should be a no-op if worker is being terminated
665         https://bugs.webkit.org/show_bug.cgi?id=181245
666
667         Reviewed by Alex Christensen.
668
669         Stop appending tasks to a terminating worker and returning false in that case.
670         This mirrors what is done for regular workers.
671
672         * workers/service/context/SWContextManager.cpp:
673         (WebCore::SWContextManager::terminateWorker):
674         * workers/service/context/ServiceWorkerThreadProxy.cpp:
675         (WebCore::ServiceWorkerThreadProxy::postTaskForModeToWorkerGlobalScope):
676         * workers/service/context/ServiceWorkerThreadProxy.h:
677
678 2018-01-04  Youenn Fablet  <youenn@apple.com>
679
680         Cancel pending script loads when service worker is being terminated
681         https://bugs.webkit.org/show_bug.cgi?id=181250
682
683         Reviewed by Alex Christensen.
684
685         Covered by service worker tests no longer crashing in ASAN builds.
686
687         * workers/WorkerScriptLoader.cpp:
688         (WebCore::WorkerScriptLoader::notifyFinished): Clearing loader when finished.
689         (WebCore::WorkerScriptLoader::cancel): Implementing cancel of a script loader by cancelling the underlying threadable loader.
690         * workers/WorkerScriptLoader.h:
691         * workers/service/ServiceWorkerContainer.cpp: Canceling loads of all pending jobs.
692         (WebCore::ServiceWorkerContainer::stop):
693         * workers/service/ServiceWorkerJob.cpp:
694         (WebCore::ServiceWorkerJob::cancelPendingLoad):
695         * workers/service/ServiceWorkerJob.h:
696
697 2018-01-04  Youenn Fablet  <youenn@apple.com>
698
699         Implement  https://fetch.spec.whatwg.org/#main-fetch default referrer policy setting
700         https://bugs.webkit.org/show_bug.cgi?id=181239
701
702         Reviewed by Alex Christensen.
703
704         Covered by updated and rebased test.
705
706         Setting the request referrer policy to the Document referrer policy if no one is set.
707         If Document has no referrer policy, use no-referrer-when-downgrade as per the spec.
708
709         * loader/cache/CachedResourceLoader.cpp:
710         (WebCore::CachedResourceLoader::updateHTTPRequestHeaders):
711         (WebCore::CachedResourceLoader::requestResource):
712         * loader/cache/CachedResourceLoader.h:
713         * loader/cache/CachedResourceRequest.cpp:
714         (WebCore::CachedResourceRequest::updateReferrerPolicy):
715         (WebCore::CachedResourceRequest::updateReferrerOriginAndUserAgentHeaders):
716         * loader/cache/CachedResourceRequest.h:
717
718 2018-01-03  Wenson Hsieh  <wenson_hsieh@apple.com>
719
720         [Attachment Support] Create attachment elements when dropping files on iOS
721         https://bugs.webkit.org/show_bug.cgi?id=181192
722         <rdar://problem/36280945>
723
724         Reviewed by Tim Horton.
725
726         Implements support for dropping data as attachment elements on iOS. See comments below for more detail.
727
728         Tests:  WKAttachmentTests.InsertDroppedRichAndPlainTextFilesAsAttachments
729                 WKAttachmentTests.InsertDroppedZipArchiveAsAttachment
730                 WKAttachmentTests.InsertDroppedItemProvidersInOrder
731
732         * WebCore.xcodeproj/project.pbxproj:
733         * editing/WebContentReader.cpp:
734         (WebCore::WebContentReader::ensureFragment):
735
736         Add a new helper to create the WebContentReader's fragment, if it hasn't already been created.
737
738         * editing/WebContentReader.h:
739         * editing/cocoa/WebContentReaderCocoa.mm:
740         (WebCore::WebContentReader::readFilePaths):
741
742         Rename readFilenames to readFilePaths (which better reflects its parameters, which are file paths). Also, move
743         the implementation of readFilePaths to shared iOS/macOS code in WebContentReaderCocoa, and remove the stub
744         implementation on iOS.
745
746         There's a bit of code here that I kept macOS-only which deals with inserting file paths as plain text in
747         editable areas, but it's unclear to me why and if WebKit clients currently find this useful, so I left a FIXME
748         to investigate removing this altogether. Code for handling this plain text insertion of file paths on Mac was
749         introduced in r67403.
750
751         * editing/ios/WebContentReaderIOS.mm:
752         (WebCore::WebContentReader::readFilenames): Deleted.
753         * editing/mac/WebContentReaderMac.mm:
754         (WebCore::WebContentReader::readFilenames): Deleted.
755         * page/mac/DragControllerMac.mm:
756         (WebCore::DragController::updateSupportedTypeIdentifiersForDragHandlingMethod const):
757
758         Teach DragController to accept all types conforming to "public.item" and "public.content" on iOS, only when
759         attachment elements are enabled. This allows us to load content from item providers that we otherwise would not
760         have loaded, since we now have the ability to fall back to attachment element insertion if the type is not have
761         a default representation using standard web content.
762
763         * platform/Pasteboard.h:
764         * platform/PasteboardItemInfo.h: Added.
765         (WebCore::PasteboardItemInfo::encode const):
766         (WebCore::PasteboardItemInfo::decode):
767
768         Add PasteboardItemInfo, a struct that describes an item on the pasteboard. Also, implement encoding and decoding
769         support for PasteboardItemInfo. So far, the item info only describes file information about the pasteboard item,
770         and flags indicating whether the item prefers attachment or inline presentation.
771
772         * platform/PasteboardStrategy.h:
773
774         Replace getFilenamesForDataInteraction with informationForItemAtIndex. Instead of returning all of the file
775         paths associated with any item on the pasteboard, fetch a PasteboardItemInfo at a given item index, which
776         includes information about the file path as well as some other metadata we'll need when deciding how to read
777         pasteboard contents as a document fragment.
778
779         * platform/PlatformPasteboard.h:
780         * platform/cocoa/PasteboardCocoa.mm:
781         (WebCore::Pasteboard::read):
782         * platform/ios/AbstractPasteboard.h:
783         * platform/ios/PasteboardIOS.mm:
784         (WebCore::Pasteboard::read):
785         (WebCore::Pasteboard::readRespectingUTIFidelities):
786
787         Teach the iOS Pasteboard to read web content using attachment elements, if enabled. There are two scenarios in
788         which we would want to insert an attachment element:
789         (1) The item provider uses a preferred presentation style of attachment, in which case we bail out of trying to
790             handle the drop using the default mechanisms, and simply insert it as an attachment. We need this to deal
791             with the case where we drop text or HTML files from the Files app, so that we don't try and insert the
792             contents of the text or HTML as inline web content.
793         (2) The item provider doesn't have a preferred attachment presentation style, but there's nothing WebKit would
794             otherwise do with the dropped content, so insert an attachment element as a fallback. Examples where this is
795             relevant are dropping a PDF or ZIP archive without attachment presentation style explicitly set.
796         We first check if we fall into case (1). If so, we can bail early by inserting an attachment; otherwise, we
797         proceed normally and see if we can read the contents of the drop as web content. If, at the end of default drop
798         handling, we don't still have a way to represent the dropped content, enter case (2).
799
800         (WebCore::Pasteboard::readFilePaths):
801         (WebCore::Pasteboard::readFilenames): Deleted.
802
803         Rename readFilenames to readFilePaths, and reimplement it using informationForItemAtIndex.
804
805         * platform/ios/PlatformPasteboardIOS.mm:
806         (WebCore::pasteboardItemPresentationStyle):
807         (WebCore::PlatformPasteboard::informationForItemAtIndex):
808         (WebCore::PlatformPasteboard::filenamesForDataInteraction): Deleted.
809
810         Implement informationForItemAtIndex and remove filenamesForDataInteraction. As before, we ask the pasteboard
811         (i.e. WebItemProviderPasteboard) for information about dropped file URLs. This time, we limit this to a single
812         file, so we don't end up creating multiple attachment elements for each representation of a single item
813         provider. See below for -preferredFileUploadURLAtIndex:fileType: for more detail.
814
815         * platform/ios/WebItemProviderPasteboard.h:
816         * platform/ios/WebItemProviderPasteboard.mm:
817         (-[WebItemProviderLoadResult initWithItemProvider:typesToLoad:]):
818         (-[WebItemProviderLoadResult canBeRepresentedAsFileUpload]):
819
820         Remove this synthesized instance variable and instead just check the item provider's preferredPresentationStyle.
821
822         (-[WebItemProviderLoadResult description]):
823
824         Add a verbose -description to the load result object. Useful for debugging what was content was loaded from an
825         item provider on drop.
826
827         (-[WebItemProviderPasteboard preferredFileUploadURLAtIndex:fileType:]):
828
829         Return the highest fidelity loaded type identifier for a given item.
830
831         (-[WebItemProviderPasteboard allDroppedFileURLs]):
832         (-[WebItemProviderPasteboard typeIdentifiersToLoadForRegisteredTypeIdentfiers:]):
833
834         Prefer flat RTFD to RTFD. In the case where attachments are enabled and we're accepting all types of content
835         using attachment elements as a fallback representation, if the source writes attributed strings to the
836         pasteboard with com.apple.rtfd at a higher fidelity than com.apple.flat-rtfd, we'll end up loading only
837         com.apple.rtfd and dropping the text as an attachment element because we cannot convert the dropped content to
838         markup. Instead, if flat RTFD is present in the item provider, always prefer that over RTFD so that dropping as
839         regular web content isn't overridden when attachment elements are enabled.
840
841         (-[WebItemProviderPasteboard doAfterLoadingProvidedContentIntoFileURLs:synchronousTimeout:]):
842         (-[WebItemProviderPasteboard droppedFileURLs]): Deleted.
843         * platform/mac/DragDataMac.mm:
844         (WebCore::DragData::containsCompatibleContent const):
845
846         DragData::containsCompatibleContent should be true when attachment elements are enabled, and there are files we
847         can drop as attachment elements.
848
849         * platform/mac/PasteboardMac.mm:
850         (WebCore::Pasteboard::read):
851         (WebCore::Pasteboard::readFilePaths):
852         (WebCore::Pasteboard::readFilenames): Deleted.
853
854 2018-01-03  Ting-Wei Lan  <lantw44@gmail.com>
855
856         Replace hard-coded paths in shebangs with #!/usr/bin/env
857         https://bugs.webkit.org/show_bug.cgi?id=181040
858
859         Reviewed by Alex Christensen.
860
861         * bindings/scripts/InFilesCompiler.pm:
862         * bindings/scripts/InFilesParser.pm:
863         * bindings/scripts/generate-bindings-all.pl:
864         * bindings/scripts/generate-bindings.pl:
865         * bindings/scripts/preprocess-idls.pl:
866         * css/make-css-file-arrays.pl:
867         * css/makeprop.pl:
868         * css/makevalues.pl:
869         * dom/make_event_factory.pl:
870         * dom/make_names.pl:
871         * extract-localizable-strings.pl:
872         * make-hash-tools.pl:
873
874 2018-01-03  Wenson Hsieh  <wenson_hsieh@apple.com>
875
876         [Attachment Support] Add plumbing for starting a drag with promised blob data
877         https://bugs.webkit.org/show_bug.cgi?id=181201
878
879         Reviewed by Tim Horton.
880
881         Adds logic to allow dragging an attachment element as a file by sending promised blob information to the UI
882         process. See comments below for more detail.
883
884         The only change in behavior is that dragging an attachment element will no longer write web content and injected
885         bundle data to the pasteboard if the attachment element's file attribute is nonnull. This will cause one
886         existing WK1 layout test to fail, but will otherwise not affect any attachment editing clients. On iOS,
887         attachment elements in the Mail viewer can be dragged, but each attachment's file is null, so we fall back to
888         current behavior; on macOS, Mail currently overrides the drag completely, beginning at -mouseDown:, so this
889         doesn't make a difference to macOS Mail either.
890
891         * editing/Editor.h:
892         * editing/cocoa/EditorCocoa.mm:
893         (WebCore::Editor::getPasteboardTypesAndDataForAttachment):
894
895         Add a helper method to retrieve an attachment element as web archive data, for moving attachments within the
896         same document. Also gives the injected editor bundle a chance to supply custom pasteboard types.
897
898         * loader/EmptyClients.cpp:
899         * page/DragClient.h:
900         (WebCore::DragClient::prepareToDragPromisedBlob):
901
902         Add new DragClient methods to send information about a promised blob to the UI process.
903
904         * page/DragController.cpp:
905         (WebCore::DragController::startDrag):
906
907         Call dragAttachmentElement when starting a drag on an attachment element.
908
909         (WebCore::DragController::dragAttachmentElement):
910
911         Try to begin dragging a given attachment element, propagating promised blob information to the client layers.
912         Returns true iff the attachment is backed by blob data (i.e. the file is nonnull).
913
914         * platform/PromisedBlobInfo.h:
915
916         Add a list of additional types and data to PromisedBlobInfo. In addition to the promised blob info, this would
917         allow injected bundle data and other private types alongside the main attachment data on the pasteboard.
918
919 2018-01-03  Simon Fraser  <simon.fraser@apple.com>
920
921         Remove the 'resolutionScale' parameter from ImageBufferDataCG get/putBytes
922         https://bugs.webkit.org/show_bug.cgi?id=181268
923
924         Reviewed by Alex Christensen.
925
926         These functions were always called with resolutionScale=1.
927
928         * platform/graphics/cg/ImageBufferCG.cpp:
929         (WebCore::ImageBuffer::getUnmultipliedImageData const):
930         (WebCore::ImageBuffer::getPremultipliedImageData const):
931         (WebCore::ImageBuffer::putByteArray):
932         * platform/graphics/cg/ImageBufferDataCG.cpp:
933         (WebCore::ImageBufferData::getData const):
934         (WebCore::ImageBufferData::putData):
935         (WebCore::affineWarpBufferData): Deleted.
936         * platform/graphics/cg/ImageBufferDataCG.h:
937
938 2018-01-03  John Wilander  <wilander@apple.com>
939
940         Storage Access API: Refactor XPC for access removal to go straight from the web process to the network process
941         https://bugs.webkit.org/show_bug.cgi?id=181270
942         <rdar://problem/36289544>
943
944         Reviewed by Alex Christensen.
945
946         No new tests. Existing test re-enabled.
947
948         This change refactors how the web process tells the network process
949         to remove storage access. Previously, this was done over the UI process
950         just like requests for storage access. But since no further reasoning
951         is needed, the message should go straight from the web process to the
952         network process for performance reasons and to minimize the risk of a
953         race.
954
955         As a consequence, the XPC code for storage access removal in the UI
956         process is deleted.
957
958         * platform/network/cf/NetworkStorageSessionCFNet.cpp:
959         (WebCore::NetworkStorageSession::cookieStoragePartition const):
960             Removes the storageAccessAPIEnabled check since the flag
961             doesn't get propagated when the network process is created.
962             Figuring this out will take some work which is unnecessary
963             when we already gate access to the feature in Document.idl.
964
965 2018-01-03  James Craig  <jcraig@apple.com>
966
967         AX: when invert colors is on, double-invert certain media elements in UserAgentStyleSheet
968         https://bugs.webkit.org/show_bug.cgi?id=168447
969         <rdar://problem/30559874>
970
971         Reviewed by Simon Fraser.
972
973         Double-invert video when platform 'invert colors' setting is enabled. Behavior matches 
974         current 'Smart Invert' feature of Safari Reader on macOS/iOS and other iOS native apps.
975
976         Tests: accessibility/smart-invert-reference.html
977                accessibility/smart-invert.html
978
979         * Modules/modern-media-controls/controls/media-controls.css:
980         (@media (inverted-colors)):
981         (:host):
982         (picture):
983         * css/html.css:
984         (@media (inverted-colors)):
985         (video):
986
987 2018-01-03  Youenn Fablet  <youenn@apple.com>
988
989         LayoutTest http/tests/media/media-stream/disconnected-frame.html to consistently fail an assertion: !m_adoptionIsRequired
990         https://bugs.webkit.org/show_bug.cgi?id=181264
991
992         Reviewed by Eric Carlson.
993
994         Covered by http/tests/media/media-stream/disconnected-frame.html not crashing anymore in Debug builds.
995         Calling suspendIfNeeded in create method instead of constructor.
996
997         * Modules/mediastream/UserMediaRequest.cpp:
998         (WebCore::UserMediaRequest::create):
999         (WebCore::UserMediaRequest::UserMediaRequest):
1000
1001 2018-01-03  Antti Koivisto  <antti@apple.com>
1002
1003         Remove DeprecatedCSSOMValue::equals
1004         https://bugs.webkit.org/show_bug.cgi?id=181241
1005
1006         Reviewed by Zalan Bujtas.
1007
1008         This is dead code.
1009
1010         * css/DeprecatedCSSOMValue.cpp:
1011         (WebCore::compareCSSOMValues): Deleted.
1012         (WebCore::DeprecatedCSSOMValue::equals const): Deleted.
1013         * css/DeprecatedCSSOMValue.h:
1014         (WebCore::DeprecatedCSSOMValue::operator== const): Deleted.
1015         (WebCore::DeprecatedCSSOMComplexValue::equals const): Deleted.
1016         * css/DeprecatedCSSOMValueList.cpp:
1017         (WebCore::DeprecatedCSSOMValueList::equals const): Deleted.
1018         * css/DeprecatedCSSOMValueList.h:
1019
1020 2018-01-03  Simon Fraser  <simon.fraser@apple.com>
1021
1022         feLighting is broken with primitiveUnits="objectBoundingBox"
1023         https://bugs.webkit.org/show_bug.cgi?id=181197
1024
1025         Reviewed by Tim Horton.
1026
1027         With <filter primitiveUnits="objectBoundingBox"> we need to convert the coordinates
1028         of fePointLights and feSpotLights into user space coordinates. Following
1029         https://www.w3.org/TR/SVG/filters.html#FilterElementPrimitiveUnitsAttribute
1030         this is done by treating them as fractions of the bounding box on the referencing
1031         element, with treatment for z following https://www.w3.org/TR/SVG/coords.html#Units_viewport_percentage
1032         
1033         To do this, store the bounds of the referencing elemenet on SVGFilterBuilder as
1034         targetBoundingBox, and store the primitiveUnits type. Then do the conversion of lighting
1035         coordinates in SVGFESpecularLightingElement::build() and SVGFEDiffuseLightingElement::build().
1036
1037         Remove SVGFELightElement::findLightSource(), since we need to be able to pass the SVGFilterBuilder
1038         to the lightSource() function so hoist the code up.
1039
1040         Tests: svg/filters/feDiffuseLighting-fePointLight-primitiveUnits-objectBoundingBox-expected.svg
1041                svg/filters/feDiffuseLighting-fePointLight-primitiveUnits-objectBoundingBox.svg
1042                svg/filters/feDiffuseLighting-feSpotLight-primitiveUnits-objectBoundingBox-expected.svg
1043                svg/filters/feDiffuseLighting-feSpotLight-primitiveUnits-objectBoundingBox.svg
1044                svg/filters/feSpecularLighting-fePointLight-primitiveUnits-objectBoundingBox-expected.svg
1045                svg/filters/feSpecularLighting-fePointLight-primitiveUnits-objectBoundingBox.svg
1046
1047         * rendering/svg/RenderSVGResourceFilter.cpp:
1048         (WebCore::RenderSVGResourceFilter::buildPrimitives const):
1049         * svg/SVGFEDiffuseLightingElement.cpp:
1050         (WebCore::SVGFEDiffuseLightingElement::build):
1051         * svg/SVGFEDistantLightElement.cpp:
1052         (WebCore::SVGFEDistantLightElement::lightSource const):
1053         * svg/SVGFEDistantLightElement.h:
1054         * svg/SVGFELightElement.cpp:
1055         (WebCore::SVGFELightElement::findLightSource): Deleted.
1056         * svg/SVGFELightElement.h:
1057         * svg/SVGFEPointLightElement.cpp:
1058         (WebCore::SVGFEPointLightElement::lightSource const):
1059         * svg/SVGFEPointLightElement.h:
1060         * svg/SVGFESpecularLightingElement.cpp:
1061         (WebCore::SVGFESpecularLightingElement::build):
1062         * svg/SVGFESpotLightElement.cpp:
1063         (WebCore::SVGFESpotLightElement::lightSource const):
1064         * svg/SVGFESpotLightElement.h:
1065         * svg/graphics/filters/SVGFilterBuilder.h:
1066         (WebCore::SVGFilterBuilder::setTargetBoundingBox):
1067         (WebCore::SVGFilterBuilder::targetBoundingBox const):
1068         (WebCore::SVGFilterBuilder::primitiveUnits const):
1069         (WebCore::SVGFilterBuilder::setPrimitiveUnits):
1070
1071 2018-01-03  Antti Koivisto  <antti@apple.com>
1072
1073         Crash beneath CSSValue::equals @ csas.cz
1074         https://bugs.webkit.org/show_bug.cgi?id=181243
1075         <rdar://problem/35990826>
1076
1077         Reviewed by Alex Christensen.
1078
1079         Test: fast/text/oblique-degree-equals-crash.html
1080
1081         * css/CSSFontStyleValue.cpp:
1082         (WebCore::CSSFontStyleValue::equals const):
1083
1084         Null check both oblique pointers.
1085
1086 2018-01-03  Joseph Pecoraro  <pecoraro@apple.com>
1087
1088         Web Inspector: Slow open time enumerating system fonts (FontCache::systemFontFamilies)
1089         https://bugs.webkit.org/show_bug.cgi?id=180979
1090         <rdar://problem/36146670>
1091
1092         Reviewed by Matt Baker.
1093
1094         * platform/graphics/cocoa/FontCacheCoreText.cpp:
1095         (fontNameIsSystemFont):
1096         (WebCore::FontCache::systemFontFamilies):
1097         Switch to the original Mac algorithm before r180979 that uses
1098         CTFontManagerCopyAvailableFontFamilyNames. Previously this wasn't
1099         available on iOS but now it is. This is a performance improvement on
1100         both platforms, but significantly so on macOS. It also finds more,
1101         valid, family names.
1102
1103 2018-01-03  Michael Catanzaro  <mcatanzaro@igalia.com>
1104
1105         ASSERTION FAILED: !source || is<Target>(*source) in CoordinatedGraphicsLayer::removeFromParent
1106         https://bugs.webkit.org/show_bug.cgi?id=166568
1107
1108         Reviewed by Simon Fraser.
1109
1110         When a GraphicsLayer has a mask layer, it fails to properly unparent the mask layer before
1111         it is destroyed. This leaves the mask layer with a dangling parent pointer. Fix it, while
1112         taking care not to introduce yet another virtual function call during the execution of the
1113         destructor.
1114
1115         * platform/graphics/GraphicsLayer.cpp:
1116         (WebCore::GraphicsLayer::willBeDestroyed):
1117
1118 2018-01-03  Simon Fraser  <simon.fraser@apple.com>
1119
1120         SVG lighting filter lights are in the wrong coordinate system
1121         https://bugs.webkit.org/show_bug.cgi?id=181147
1122
1123         Reviewed by Zalan Bujtas.
1124
1125         Point and spot light coordinates weren't being converted into buffer-relative
1126         coordinates before being fed into the lighting math, resulting in incorrect light
1127         rendering on Retina devices, and when the filter primitive region was clipped.
1128
1129         Fix by storing absoluteUnclippedSubregion on FilterEffect, which allows us to map
1130         lighting points from user space coordinates into the coordinates of the buffer being
1131         used for rendering. Also scale the light z coordinate by doing a dummy point mapping in x.
1132
1133         Rename members of PointLightSource and SpotLightSource to make it clear which coordinate
1134         system they are in.
1135
1136         Tests include HiDPI tests.
1137
1138         Tests: svg/filters/fePointLight-coordinates-expected.svg
1139                svg/filters/fePointLight-coordinates.svg
1140                svg/filters/feSpotLight-coordinates-expected.svg
1141                svg/filters/feSpotLight-coordinates.svg
1142                svg/filters/hidpi/fePointLight-coordinates-expected.svg
1143                svg/filters/hidpi/fePointLight-coordinates.svg
1144                svg/filters/hidpi/feSpotLight-coordinates-expected.svg
1145                svg/filters/hidpi/feSpotLight-coordinates.svg
1146
1147         * platform/graphics/FloatPoint3D.h: Make it easy to get and set the X and Y coords as a FloatPoint.
1148         (WebCore::FloatPoint3D::xy const):
1149         (WebCore::FloatPoint3D::setXY):
1150         * platform/graphics/GeometryUtilities.cpp:
1151         (WebCore::mapPoint):
1152         (WebCore::mapRect):
1153         * platform/graphics/GeometryUtilities.h: Helper to make a point between rects.
1154         * platform/graphics/filters/DistantLightSource.cpp:
1155         (WebCore::DistantLightSource::initPaintingData):
1156         * platform/graphics/filters/DistantLightSource.h:
1157         * platform/graphics/filters/FELighting.cpp:
1158         (WebCore::FELighting::drawLighting):
1159         * platform/graphics/filters/FilterEffect.cpp:
1160         (WebCore::FilterEffect::mapPointFromUserSpaceToBuffer const):
1161         * platform/graphics/filters/FilterEffect.h:
1162         (WebCore::FilterEffect::setUnclippedAbsoluteSubregion):
1163         * platform/graphics/filters/LightSource.h:
1164         * platform/graphics/filters/PointLightSource.cpp:
1165         (WebCore::PointLightSource::initPaintingData):
1166         (WebCore::PointLightSource::computePixelLightingData const):
1167         (WebCore::PointLightSource::setX):
1168         (WebCore::PointLightSource::setY):
1169         (WebCore::PointLightSource::setZ):
1170         * platform/graphics/filters/PointLightSource.h:
1171         (WebCore::PointLightSource::position const):
1172         (WebCore::PointLightSource::PointLightSource):
1173         * platform/graphics/filters/SpotLightSource.cpp:
1174         (WebCore::SpotLightSource::initPaintingData):
1175         (WebCore::SpotLightSource::computePixelLightingData const):
1176         (WebCore::SpotLightSource::setX):
1177         (WebCore::SpotLightSource::setY):
1178         (WebCore::SpotLightSource::setZ):
1179         (WebCore::SpotLightSource::setPointsAtX):
1180         (WebCore::SpotLightSource::setPointsAtY):
1181         (WebCore::SpotLightSource::setPointsAtZ):
1182         * platform/graphics/filters/SpotLightSource.h:
1183         (WebCore::SpotLightSource::position const):
1184         (WebCore::SpotLightSource::direction const):
1185         (WebCore::SpotLightSource::SpotLightSource):
1186         * rendering/svg/RenderSVGResourceFilter.cpp:
1187         (WebCore::RenderSVGResourceFilter::buildPrimitives const):
1188         * rendering/svg/RenderSVGResourceFilterPrimitive.cpp:
1189         (WebCore::RenderSVGResourceFilterPrimitive::determineFilterPrimitiveSubregion):
1190
1191 2018-01-03  Youenn Fablet  <youenn@apple.com>
1192
1193         Select service worker for documents with data/blob URLS
1194         https://bugs.webkit.org/show_bug.cgi?id=181213
1195
1196         Reviewed by Alex Christensen.
1197
1198         Covered by updated test.
1199
1200         Reusing the service worker of the parent for blob/data URL documents.
1201
1202         * loader/DocumentLoader.cpp:
1203         (WebCore::isLocalURL):
1204         (WebCore::DocumentLoader::commitData):
1205
1206 2018-01-03  Ryan Haddad  <ryanhaddad@apple.com>
1207
1208         Unreviewed, rolling out r226352.
1209
1210         Breaks Sierra and El Capitan builds.
1211
1212         Reverted changeset:
1213
1214         "Web Inspector: Slow open time enumerating system fonts
1215         (FontCache::systemFontFamilies)"
1216         https://bugs.webkit.org/show_bug.cgi?id=180979
1217         https://trac.webkit.org/changeset/226352
1218
1219 2018-01-03  Philippe Normand  <pnormand@igalia.com>
1220
1221         [GStreamer] The bus synchronous handler should be in the base player class
1222         https://bugs.webkit.org/show_bug.cgi?id=181237
1223
1224         Reviewed by Carlos Garcia Campos.
1225
1226         Because this is where video rendering is handled.
1227
1228         No new tests, this is only a refactoring.
1229
1230         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:
1231         (WebCore::MediaPlayerPrivateGStreamer::createGSTPlayBin):
1232         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp:
1233         (WebCore::MediaPlayerPrivateGStreamerBase::setPipeline):
1234
1235 2018-01-03  Philippe Normand  <pnormand@igalia.com>
1236
1237         [GStreamer] move MediaSample implementation out of mse/
1238         https://bugs.webkit.org/show_bug.cgi?id=179165
1239
1240         Reviewed by Carlos Garcia Campos.
1241
1242         This module isn't specific to MSE and can potentially be reused
1243         elsewhere, for WebRTC for instance. Additionally the
1244         ::platformSample() method was implemented and the code was cleaned up.
1245
1246         * platform/GStreamer.cmake:
1247         * platform/MediaSample.h:
1248         * platform/graphics/gstreamer/GStreamerMediaSample.cpp: Renamed from Source/WebCore/platform/graphics/gstreamer/mse/GStreamerMediaSample.cpp.
1249         (WebCore::GStreamerMediaSample::platformSample):
1250         * platform/graphics/gstreamer/GStreamerMediaSample.h: Renamed from Source/WebCore/platform/graphics/gstreamer/mse/GStreamerMediaSample.h.
1251         * platform/graphics/gstreamer/mse/PlaybackPipeline.cpp:
1252         (WebCore::PlaybackPipeline::enqueueSample):
1253
1254 2018-01-03  Carlos Garcia Campos  <cgarcia@igalia.com>
1255
1256         Unreviewed. Fix resource load stats tests on GLib based ports after r226355.
1257
1258         The monitor can be created in the work queue thread too.
1259
1260         * platform/glib/FileMonitorGLib.cpp:
1261         (WebCore::FileMonitor::FileMonitor):
1262
1263 2018-01-03  Carlos Garcia Campos  <cgarcia@igalia.com>
1264
1265         [GTK] Crash destroying WebCore::FileMonitor
1266         https://bugs.webkit.org/show_bug.cgi?id=181138
1267
1268         Reviewed by Michael Catanzaro.
1269
1270         Ensure that platform file monitor is always created and destroyed in the work queue thread synchronously.
1271
1272         * platform/FileMonitor.h:
1273         * platform/glib/FileMonitorGLib.cpp:
1274         (WebCore::FileMonitor::FileMonitor):
1275         (WebCore::FileMonitor::~FileMonitor):
1276         (WebCore::FileMonitor::didChange):
1277
1278 2018-01-02  Joseph Pecoraro  <pecoraro@apple.com>
1279
1280         Web Inspector: Slow open time enumerating system fonts (FontCache::systemFontFamilies)
1281         https://bugs.webkit.org/show_bug.cgi?id=180979
1282         <rdar://problem/36146670>
1283
1284         Reviewed by Matt Baker.
1285
1286         * platform/graphics/cocoa/FontCacheCoreText.cpp:
1287         (WebCore::FontCache::systemFontFamilies):
1288         Switch to the original Mac algorithm before r180979 that uses
1289         CTFontManagerCopyAvailableFontFamilyNames. Previously this wasn't
1290         available on iOS but now it is. This is a performance improvement on
1291         both platforms, but significantly so on macOS. It also finds more,
1292         valid, family names.
1293
1294 2018-01-02  Yusuke Suzuki  <utatane.tea@gmail.com>
1295
1296         Unreviewed, fix GCC warning by using #include
1297         https://bugs.webkit.org/show_bug.cgi?id=181189
1298
1299         This file is included in C++ files. Use #include instead of #import to suppress warning in GCC.
1300
1301         * platform/PromisedBlobInfo.h:
1302
1303 2017-12-28  Yusuke Suzuki  <utatane.tea@gmail.com>
1304
1305         Remove std::chrono completely
1306         https://bugs.webkit.org/show_bug.cgi?id=181186
1307
1308         Reviewed by Alex Christensen.
1309
1310         Use MonotonicTime, WallTime, and Seconds instead.
1311         Changes are mechanical ones. But persistent network cache data is changed.
1312         So we bump the version number of the cache storage.
1313
1314         * Modules/indexeddb/server/IDBServer.cpp:
1315         (WebCore::IDBServer::IDBServer::closeAndDeleteDatabasesModifiedSince):
1316         (WebCore::IDBServer::removeAllDatabasesForOriginPath):
1317         (WebCore::IDBServer::IDBServer::performCloseAndDeleteDatabasesModifiedSince):
1318         (WebCore::IDBServer::IDBServer::performCloseAndDeleteDatabasesForOrigins):
1319         * Modules/indexeddb/server/IDBServer.h:
1320         * Modules/webdatabase/DatabaseTracker.cpp:
1321         (WebCore::DatabaseTracker::deleteDatabasesModifiedSince):
1322         * Modules/webdatabase/DatabaseTracker.h:
1323         * dom/Document.cpp:
1324         (WebCore::Document::lastModified):
1325         * html/HTMLMediaElement.cpp:
1326         (WebCore::HTMLMediaElement::clearMediaCache):
1327         * html/HTMLMediaElement.h:
1328         (WebCore::HTMLMediaElement::clearMediaCache):
1329         * loader/CrossOriginPreflightResultCache.cpp:
1330         (WebCore::parseAccessControlMaxAge):
1331         (WebCore::CrossOriginPreflightResultCacheItem::parse):
1332         (WebCore::CrossOriginPreflightResultCacheItem::allowsRequest const):
1333         * loader/CrossOriginPreflightResultCache.h:
1334         * loader/cache/CachedResource.cpp:
1335         (WebCore::CachedResource::CachedResource):
1336         (WebCore::CachedResource::freshnessLifetime const):
1337         (WebCore::CachedResource::responseReceived):
1338         (WebCore::CachedResource::updateResponseAfterRevalidation):
1339         * loader/cache/CachedResource.h:
1340         * platform/FileSystem.cpp:
1341         (WebCore::FileSystem::getFileModificationTime):
1342         * platform/FileSystem.h:
1343         * platform/SearchPopupMenu.h:
1344         * platform/cocoa/SearchPopupMenuCocoa.h:
1345         * platform/cocoa/SearchPopupMenuCocoa.mm:
1346         (WebCore::toSystemClockTime):
1347         (WebCore::toNSDateFromSystemClock):
1348         (WebCore::removeRecentlyModifiedRecentSearches):
1349         * platform/graphics/MediaPlayer.cpp:
1350         (WebCore::MediaPlayer::clearMediaCache):
1351         * platform/graphics/MediaPlayer.h:
1352         * platform/graphics/MediaPlayerPrivate.h:
1353         (WebCore::MediaPlayerPrivateInterface::clearMediaCache):
1354         * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.h:
1355         * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
1356         (WebCore::toSystemClockTime):
1357         (WebCore::MediaPlayerPrivateAVFoundationObjC::clearMediaCache):
1358         * platform/graphics/mac/MediaPlayerPrivateQTKit.h:
1359         * platform/graphics/mac/MediaPlayerPrivateQTKit.mm:
1360         (WebCore::MediaPlayerPrivateQTKit::clearMediaCache):
1361         * platform/network/CacheValidation.cpp:
1362         (WebCore::computeCurrentAge):
1363         (WebCore::computeFreshnessLifetimeForHTTPFamily):
1364         (WebCore::updateRedirectChainStatus):
1365         (WebCore::redirectChainAllowsReuse):
1366         (WebCore::parseCacheControlDirectives):
1367         * platform/network/CacheValidation.h:
1368         (WebCore::RedirectChainCacheStatus::RedirectChainCacheStatus):
1369         * platform/network/HTTPParsers.cpp:
1370         (WebCore::parseHTTPDate):
1371         * platform/network/HTTPParsers.h:
1372         * platform/network/PlatformCookieJar.h:
1373         * platform/network/ResourceResponseBase.cpp:
1374         (WebCore::ResourceResponseBase::cacheControlMaxAge const):
1375         (WebCore::parseDateValueInHeader):
1376         (WebCore::ResourceResponseBase::date const):
1377         (WebCore::ResourceResponseBase::age const):
1378         (WebCore::ResourceResponseBase::expires const):
1379         (WebCore::ResourceResponseBase::lastModified const):
1380         * platform/network/ResourceResponseBase.h:
1381         * platform/network/cf/CookieJarCFNet.cpp:
1382         (WebCore::deleteAllCookiesModifiedSince):
1383         * platform/network/curl/CookieJarCurl.cpp:
1384         (WebCore::CookieJarCurlFileSystem::deleteAllCookiesModifiedSince):
1385         (WebCore::deleteAllCookiesModifiedSince):
1386         * platform/network/curl/CookieJarCurl.h:
1387         * platform/network/curl/CurlCacheEntry.cpp:
1388         (WebCore::CurlCacheEntry::CurlCacheEntry):
1389         (WebCore::CurlCacheEntry::isCached):
1390         (WebCore::CurlCacheEntry::parseResponseHeaders):
1391         * platform/network/curl/CurlCacheEntry.h:
1392         * platform/network/mac/CookieJarMac.mm:
1393         (WebCore::deleteAllCookiesModifiedSince):
1394         * platform/network/soup/CookieJarSoup.cpp:
1395         (WebCore::deleteAllCookiesModifiedSince):
1396         * platform/win/SearchPopupMenuWin.cpp:
1397         (WebCore::SearchPopupMenuWin::loadRecentSearches):
1398         * rendering/RenderSearchField.cpp:
1399         (WebCore::RenderSearchField::addSearchResult):
1400
1401 2018-01-02  Wenson Hsieh  <wenson_hsieh@apple.com>
1402
1403         [Attachment Support] Introduce data structures and IPC support for writing promised blobs
1404         https://bugs.webkit.org/show_bug.cgi?id=181189
1405
1406         Reviewed by Tim Horton.
1407
1408         Introduces a new header containing structs to be used for writing blob data when dragging. PromisedBlobInfo
1409         represents information needed to declare data on the pasteboard that will eventually be provided via a Blob.
1410         This includes the type and filename of the Blob-backed content. PromisedBlobData represents information needed
1411         to actually deliver the Blob's content to the platform, and is sent some time after its corresponding
1412         PromisedBlobInfo. The content may either be in the form of a file path (as is the case using the previous
1413         declareAndWriteAttachment codepath) or a data buffer (which we would use if the Blob is not already backed by a
1414         file on disk).
1415
1416         No new tests, since there is no observable change in functionality yet.
1417
1418         * WebCore.xcodeproj/project.pbxproj:
1419         * platform/PromisedBlobInfo.h: Added.
1420         (WebCore::PromisedBlobInfo::operator bool const):
1421         (WebCore::PromisedBlobData::hasData const):
1422         (WebCore::PromisedBlobData::hasFile const):
1423         (WebCore::PromisedBlobData::operator bool const):
1424         (WebCore::PromisedBlobData::fulfills const):
1425
1426 2018-01-02  Brady Eidson  <beidson@apple.com>
1427
1428         Make MessagePortChannel::takeAllMessagesFromRemote asynchronous.
1429         https://bugs.webkit.org/show_bug.cgi?id=181205
1430
1431         Reviewed by Alex Christensen.
1432
1433         No new tests (No behavior change)
1434
1435         This is needed for the ongoing WK2 MessagePort work.
1436
1437         For WK1 in-process MessagePorts it is still synchronous; no behavior change.
1438
1439         * dom/InProcessMessagePortChannel.cpp:
1440         (WebCore::InProcessMessagePortChannel::takeAllMessagesFromRemote):
1441         * dom/InProcessMessagePortChannel.h:
1442
1443         * dom/MessagePort.cpp:
1444         (WebCore::MessagePort::dispatchMessages):
1445         * dom/MessagePortChannel.h:
1446
1447 2018-01-02  Jiewen Tan  <jiewen_tan@apple.com>
1448
1449         Add a WebAuthentication runtime feature flag
1450         https://bugs.webkit.org/show_bug.cgi?id=181220
1451         <rdar://problem/36055305>
1452
1453         Reviewed by Brent Fulgham.
1454
1455         This patch basically renames the CredentialManagement runtime feature flag into
1456         WebAuthentication runtime feature flag.
1457
1458         No tests.
1459
1460         * Modules/credentialmanagement/BasicCredential.idl:
1461         * Modules/credentialmanagement/CredentialsContainer.idl:
1462         * Modules/credentialmanagement/NavigatorCredentials.idl:
1463         * Modules/webauthn/PublicKeyCredential.idl:
1464         * page/RuntimeEnabledFeatures.h:
1465         (WebCore::RuntimeEnabledFeatures::setWebAuthenticationEnabled):
1466         (WebCore::RuntimeEnabledFeatures::webAuthenticationEnabled const):
1467         (WebCore::RuntimeEnabledFeatures::setCredentialManagementEnabled): Deleted.
1468         (WebCore::RuntimeEnabledFeatures::credentialManagementEnabled const): Deleted.
1469
1470 2018-01-02  Wenson Hsieh  <wenson_hsieh@apple.com>
1471
1472         [Attachment Support] Don't Blob-convert images and attachments with https:, http: or data: urls
1473         https://bugs.webkit.org/show_bug.cgi?id=181143
1474         <rdar://problem/36200381>
1475
1476         Reviewed by Tim Horton.
1477
1478         Clients such as Mail would expect pasting or dropping an image with src="https://..." to result in the source
1479         URL being preserved (i.e. staying as remote images) instead of creating image attachments out of them. This
1480         patch hooks into the shouldConvertToBlob() check added in r226272 so that it applies to attachment element
1481         replacement as well.
1482
1483         Test: WKAttachmentTests.DoNotInsertDataURLImagesAsAttachments
1484
1485         * editing/cocoa/WebContentReaderCocoa.mm:
1486         (WebCore::shouldConvertToBlob):
1487         (WebCore::replaceRichContentWithAttachments):
1488
1489 2018-01-02  Brady Eidson  <beidson@apple.com>
1490
1491         Identify MessagePorts by a globally unique MessagePortIdentifier.
1492         https://bugs.webkit.org/show_bug.cgi?id=181172
1493
1494         Reviewed by Alex Christensen.
1495
1496         No new tests (Behavior change covered by all existing tests).
1497
1498         This cleans up the abstract MessagePortChannel interface to be in terms of identifiers
1499         instead of actual MessagePort objects.
1500         
1501         The identifiers are compounded with the current ProcessIdentifier meaning they are global
1502         across all processes for the running UI process, enabling easy cross-process communication.
1503         
1504         (Actual cross-process communication comes in a followup)
1505         
1506         * WebCore.xcodeproj/project.pbxproj:
1507         
1508         * dom/InProcessMessagePortChannel.cpp:
1509         (WebCore::InProcessMessagePortChannel::createChannelBetweenPorts):
1510         (WebCore::InProcessMessagePortChannel::isConnectedTo):
1511         (WebCore::InProcessMessagePortChannel::entangleWithRemoteIfOpen):
1512         (WebCore::InProcessMessagePortChannel::entangleIfOpen): Deleted.
1513         * dom/InProcessMessagePortChannel.h:
1514         
1515         * dom/MessageChannel.cpp:
1516         (WebCore::MessageChannel::MessageChannel):
1517         (WebCore::m_port2):
1518         
1519         * dom/MessagePort.cpp:
1520         (WebCore::allMessagePortsLock):
1521         (WebCore::MessagePort::ref const):
1522         (WebCore::MessagePort::deref const):
1523         (WebCore::MessagePort::existingMessagePortForIdentifier):
1524         (WebCore::MessagePort::MessagePort):
1525         (WebCore::MessagePort::~MessagePort):
1526         (WebCore::MessagePort::postMessage):
1527         (WebCore::MessagePort::entangleWithRemote):
1528         (WebCore::MessagePort::entanglePorts):
1529         (WebCore::MessagePort::entangle): Deleted.
1530         * dom/MessagePort.h:
1531         
1532         * dom/MessagePortChannel.h:
1533         
1534         * dom/MessagePortIdentifier.h: Added.
1535         (WebCore::operator==):
1536         (WebCore::MessagePortIdentifier::encode const):
1537         (WebCore::MessagePortIdentifier::decode):
1538         (WebCore::MessagePortIdentifier::hash const):
1539         (WTF::MessagePortIdentifierHash::hash):
1540         (WTF::MessagePortIdentifierHash::equal):
1541         (WTF::HashTraits<WebCore::MessagePortIdentifier>::emptyValue):
1542         (WTF::HashTraits<WebCore::MessagePortIdentifier>::constructDeletedValue):
1543         (WTF::HashTraits<WebCore::MessagePortIdentifier>::isDeletedValue):
1544
1545 2018-01-02  Youenn Fablet  <youenn@apple.com>
1546
1547         Memory cache should not reuse resources with different credential fetch option
1548         https://bugs.webkit.org/show_bug.cgi?id=181212
1549
1550         Reviewed by Alex Christensen.
1551
1552         Covered by rebased test.
1553
1554         * loader/cache/CachedResourceLoader.cpp:
1555         (WebCore::CachedResourceLoader::determineRevalidationPolicy const):
1556
1557 2018-01-02  Jiewen Tan  <jiewen_tan@apple.com>
1558
1559         Update Credential Management API for WebAuthentication
1560         https://bugs.webkit.org/show_bug.cgi?id=181082
1561         <rdar://problem/36055239>
1562
1563         Reviewed by Brent Fulgham.
1564
1565         Part 2/2
1566
1567         This patch implements Core API from Credential Management API: https://www.w3.org/TR/credential-management-1/#core.
1568         which is required by WebAuthN. It also sets the CredentialManagement runtime flag to enable testing. Note that it
1569         introduces a dummy PublicKeyCredential interface for testing functionalities of the Credential interface, which
1570         cannot be instantiated.
1571
1572         Tests: http/wpt/credential-management/credentialscontainer-create-basics.https.html
1573                http/wpt/credential-management/credentialscontainer-get-basics.https.html
1574                http/wpt/credential-management/credentialscontainer-preventSilentAccess-basics.https.html
1575                http/wpt/credential-management/idl.https.html
1576
1577         * CMakeLists.txt:
1578         * DerivedSources.make:
1579         * Modules/credentialmanagement/BasicCredential.cpp:
1580         (WebCore::BasicCredential::BasicCredential):
1581         (WebCore::BasicCredential::type const):
1582         * Modules/credentialmanagement/BasicCredential.h:
1583         (WebCore::BasicCredential::discovery const):
1584         * Modules/credentialmanagement/BasicCredential.idl:
1585         * Modules/credentialmanagement/CredentialCreationOptions.h:
1586         * Modules/credentialmanagement/CredentialCreationOptions.idl:
1587         * Modules/credentialmanagement/CredentialRequestOptions.h:
1588         * Modules/credentialmanagement/CredentialRequestOptions.idl:
1589         * Modules/credentialmanagement/CredentialsContainer.cpp:
1590         (WebCore::CredentialsContainer::CredentialsContainer):
1591         (WebCore::CredentialsContainer::isSameOriginWithItsAncestors):
1592         (WebCore::CredentialsContainer::dispatchTask):
1593         (WebCore::CredentialsContainer::get):
1594         (WebCore::CredentialsContainer::store):
1595         (WebCore::CredentialsContainer::isCreate):
1596         (WebCore::CredentialsContainer::preventSilentAccess):
1597         * Modules/credentialmanagement/CredentialsContainer.h:
1598         (WebCore::CredentialsContainer::create):
1599         (WebCore::CredentialsContainer::CredentialsContainer): Deleted.
1600         * Modules/credentialmanagement/CredentialsContainer.idl:
1601         * Modules/credentialmanagement/NavigatorCredentials.cpp:
1602         (WebCore::NavigatorCredentials::credentials):
1603         * Modules/credentialmanagement/NavigatorCredentials.h:
1604         * Modules/credentialmanagement/NavigatorCredentials.idl:
1605         * Modules/webauthn/PublicKeyCredential.cpp: Copied from Source/WebCore/Modules/credentialmanagement/BasicCredential.cpp.
1606         (WebCore::PublicKeyCredential::PublicKeyCredential):
1607         (WebCore::PublicKeyCredential::collectFromCredentialStore):
1608         (WebCore::PublicKeyCredential::discoverFromExternalSource):
1609         (WebCore::PublicKeyCredential::store):
1610         (WebCore::PublicKeyCredential::create):
1611         * Modules/webauthn/PublicKeyCredential.h: Copied from Source/WebCore/Modules/credentialmanagement/BasicCredential.cpp.
1612         * Modules/webauthn/PublicKeyCredential.idl: Copied from Source/WebCore/Modules/credentialmanagement/BasicCredential.idl.
1613         * Sources.txt:
1614         * WebCore.xcodeproj/project.pbxproj:
1615         * bindings/js/WebCoreBuiltinNames.h:
1616         * page/RuntimeEnabledFeatures.h:
1617
1618 2018-01-02  Oleksandr Skachkov  <gskachkov@gmail.com>
1619
1620         WebAssembly: sending module to iframe fails
1621         https://bugs.webkit.org/show_bug.cgi?id=179263
1622
1623         Reviewed by JF Bastien.
1624
1625         Allow use WebAssembly.Module as input parameters for postMessage 
1626         in window and iframe object. To prevent sending message to iframe
1627         that is not ready, in iframe-* test we are waiting message from
1628         iframe only after that we send message to it.   
1629
1630         Tests: wasm/iframe-parent-postmessage.html
1631                wasm/iframe-postmessage.html
1632                wasm/window-postmessage.html
1633
1634         * bindings/js/SerializedScriptValue.cpp:
1635         (WebCore::CloneSerializer::dumpIfTerminal):
1636         * bindings/js/SerializedScriptValue.h:
1637         * page/DOMWindow.cpp:
1638         (WebCore::DOMWindow::postMessage):
1639
1640 == Rolled over to ChangeLog-2018-01-01 ==