Update Credit Card AutoFill button icon
[WebKit-https.git] / Source / WebCore / ChangeLog
1 2018-12-13  Zach Li  <zachli@apple.com>
2
3         Update Credit Card AutoFill button icon
4         https://bugs.webkit.org/show_bug.cgi?id=192637
5         rdar://problem/46545006
6
7         Reviewed by Chris Dumez.
8
9         * css/html.css:
10         (input::-webkit-credit-card-auto-fill-button):
11
12 2018-12-13  Eric Carlson  <eric.carlson@apple.com>
13
14         [MediaStream] Calculate width or height when constraints contain only the other
15         https://bugs.webkit.org/show_bug.cgi?id=192632
16         <rdar://problem/46665734>
17
18         Reviewed by Youenn Fablet.
19
20         Test: fast/mediastream/constraint-intrinsic-size.html
21
22         * platform/graphics/RemoteVideoSample.cpp:
23         (WebCore::RemoteVideoSample::create): Log errors with RELEASE_LOG_ERROR.
24
25         * platform/graphics/cv/ImageTransferSessionVT.h:
26         (WebCore::ImageTransferSessionVT::pixelFormat const): New.
27
28         * platform/mediastream/RealtimeMediaSource.cpp:
29         (WebCore::RealtimeMediaSource::setSizeAndFrameRate): Replace current size with new size.
30         (WebCore::RealtimeMediaSource::setSize): Don't notify about width and height.
31         (WebCore::RealtimeMediaSource::size const): Use intrinsic size when necessary.
32         (WebCore::RealtimeMediaSource::setIntrinsicSize): New.
33         (WebCore::RealtimeMediaSource::remoteVideoSampleAvailable): Deleted.
34         * platform/mediastream/RealtimeMediaSource.h:
35
36         * platform/mediastream/RealtimeVideoSource.cpp:
37         (WebCore::RealtimeVideoSource::dispatchMediaSampleToObservers): No more remoteVideoSampleAvailable.
38
39         * platform/mediastream/mac/DisplayCaptureSourceCocoa.cpp:
40         (WebCore::DisplayCaptureSourceCocoa::settings): Report size correctly.
41         (WebCore::DisplayCaptureSourceCocoa::frameSize const): Use intrinsicSize().
42         (WebCore::DisplayCaptureSourceCocoa::emitFrame): No more remoteVideoSampleAvailable.
43         (WebCore::DisplayCaptureSourceCocoa::setIntrinsicSize): Deleted.
44         * platform/mediastream/mac/DisplayCaptureSourceCocoa.h:
45         (WebCore::DisplayCaptureSourceCocoa::intrinsicSize const): Deleted.
46
47         * platform/mock/MockRealtimeVideoSource.cpp:
48         (WebCore::MockRealtimeVideoSource::MockRealtimeVideoSource): Report intrinsic size.
49         (WebCore::MockRealtimeVideoSource::setSizeAndFrameRate): Minor cleanup.
50         (WebCore::MockRealtimeVideoSource::setSizeAndFrameRateWithPreset):  Report intrinsic size.
51         (WebCore::MockRealtimeVideoSource::drawText): Don't render preset info for display source.
52         * platform/mock/MockRealtimeVideoSource.h:
53
54 2018-12-13  David Kilzer  <ddkilzer@apple.com>
55
56         clang-tidy: loop variable is copied but only used as const reference in Document.cpp, Element.cpp
57         <https://webkit.org/b/192661>
58         <rdar://problem/46694035>
59
60         Reviewed by Daniel Bates.
61
62         * dom/Document.cpp:
63         (WebCore::Document::updateIntersectionObservations):
64         (WebCore::Document::notifyIntersectionObserversTimerFired):
65         * dom/Element.cpp:
66         (WebCore::Element::didMoveToNewDocument):
67         (WebCore::Element::disconnectFromIntersectionObservers):
68         - Change loop variables from `auto` to `const auto&` to prevent
69           unnecessary copies of WeakPtr<IntersectionObserver> or
70           struct IntersectionObserverRegistration objects.
71
72 2018-12-13  Carlos Garcia Campos  <cgarcia@igalia.com>
73
74         [FreeType] Remove HarfBuzzFace
75         https://bugs.webkit.org/show_bug.cgi?id=192589
76
77         Reviewed by Michael Catanzaro.
78
79         This was used to share the common implementation with the chromium port, but now that only freetype based ports
80         use it, it can be removed and use hb_ft_face_create_cached() instead. We don't need the glyph cache either,
81         since we are already caching glyphs in Font.
82
83         * platform/FreeType.cmake: Remove HarfBuzzFaceCairo.cpp and HarfBuzzFace.cpp.
84         * platform/graphics/FontPlatformData.h: Remove HarfBuzzFace member.
85         * platform/graphics/freetype/FontCustomPlatformDataFreeType.cpp: Add missing include.
86         * platform/graphics/freetype/FontPlatformDataFreeType.cpp:
87         (WebCore::FontPlatformData::operator=): Remove m_harfBuzzFace handling.
88         (WebCore::FontPlatformData::createOpenTypeMathHarfBuzzFont const): New funtction to create a hb_font_t for
89         OpenType math.
90         * platform/graphics/harfbuzz/ComplexTextControllerHarfBuzz.cpp:
91         (WebCore::floatToHarfBuzzPosition): Moved from HarfBuzzFaceCairo.cpp.
92         (WebCore::doubleToHarfBuzzPosition): Ditto.
93         (WebCore::harfBuzzFontFunctions): Also moved from HarfBuzzFaceCairo.cpp, but implement get_nominal/variation
94         functions when using HarfBuzz >= 1.2.3 and use Font::glyphForCharacter() to make it simpler.
95         (WebCore::fontFeatures): Moved from HarfBuzzFaceCairo.cpp.
96         (WebCore::findScriptForVerticalGlyphSubstitution): Moved from HarfBuzzFace.cpp.
97         (WebCore::ComplexTextController::collectComplexTextRunsForCharacters): Create the HarfBuzz face and font here.
98         * platform/graphics/harfbuzz/HarfBuzzFace.cpp: Removed.
99         * platform/graphics/harfbuzz/HarfBuzzFace.h: Removed.
100         * platform/graphics/harfbuzz/HarfBuzzFaceCairo.cpp: Removed.
101         * platform/graphics/harfbuzz/HbUniquePtr.h:
102         (WebCore::HbPtrDeleter<hb_face_t>::operator() const): Add deleter for hb_face_t.
103         * platform/graphics/opentype/OpenTypeMathData.cpp:
104         (WebCore::OpenTypeMathData::OpenTypeMathData): Use FontPlatformData::createOpenTypeMathHarfBuzzFont().
105
106 2018-12-12  Carlos Garcia Campos  <cgarcia@igalia.com>
107
108         [FreeType] Add initial implementation of variation fonts
109         https://bugs.webkit.org/show_bug.cgi?id=192151
110
111         Reviewed by Michael Catanzaro.
112
113         * css/CSSFontFaceSource.cpp:
114         (WebCore::CSSFontFaceSource::font): Remove platform ifdefs.
115         * loader/cache/CachedFont.cpp:
116         (WebCore::CachedFont::platformDataFromCustomData): Ditto.
117         * platform/graphics/FontPlatformData.h:
118         (WebCore::FontPlatformData::isFixedWidth const):
119         * platform/graphics/cairo/FontCustomPlatformData.h: Use RefPtr for cairo_font_face_t.
120         * platform/graphics/freetype/FontCacheFreeType.cpp:
121         (WebCore::getFontPropertiesFromPattern): Helper function to get several font properties from the fontconfig
122         pattern.
123         (WebCore::FontCache::systemFallbackForCharacters): Use getFontPropertiesFromPattern().
124         (WebCore::FontCache::createFontPlatformData): Pass FC_VARIABLE to the pattern and call buildVariationSettings()
125         before creating the FontPlatformData to set FC_FONT_VARIATIONS on the pattern.
126         (WebCore::defaultVariationValues): Parse font variations table.
127         (WebCore::buildVariationSettings): Build a font variations string from the settings that can be passed to cairo.
128         * platform/graphics/freetype/FontCacheFreeType.h: Added.
129         * platform/graphics/freetype/FontCustomPlatformDataFreeType.cpp:
130         (WebCore::FontCustomPlatformData::FontCustomPlatformData): Use RefPtr and make freeTypeFaceKey global.
131         (WebCore::FontCustomPlatformData::~FontCustomPlatformData): Remove explicit destroy.
132         (WebCore::defaultFontconfigOptions): Moved here from FontCacheFreeType.
133         (WebCore::FontCustomPlatformData::fontPlatformData): Call buildVariationSettings() before creating the
134         FontPlatformData to set FC_FONT_VARIATIONS on the pattern.
135         (WebCore::FontCustomPlatformData::supportsFormat): Add variation formats.
136         * platform/graphics/freetype/FontPlatformDataFreeType.cpp:
137         (WebCore::setCairoFontOptionsFromFontConfigPattern): Call cairo_font_options_set_variations() with the
138         FC_FONT_VARIATIONS value from the pattern.
139         (WebCore::FontPlatformData::FontPlatformData): Use a single constructor that always receives a valid fontconfig
140         pattern.
141         (WebCore::FontPlatformData::fcPattern const): Return the fontconfig pattern.
142         (WebCore::FontPlatformData::platformIsEqual const): Update the condition now that m_pattern can't be nullptr.
143         (WebCore::FontPlatformData::buildScaledFont): Use m_pattern unconditionally.
144         * platform/graphics/freetype/SimpleFontDataFreeType.cpp:
145         (WebCore::Font::platformCreateScaledFont const): Update it to use the new FontPlatformData constructor.
146         * platform/graphics/harfbuzz/HarfBuzzFaceCairo.cpp:
147         (WebCore::HarfBuzzFace::createFont): Pass variations to HarfBuzz.
148         * platform/graphics/win/FontCustomPlatformData.cpp:
149         (WebCore::FontCustomPlatformData::fontPlatformData):
150         * platform/graphics/win/FontCustomPlatformData.h:
151
152 2018-12-12  Fujii Hironori  <Hironori.Fujii@sony.com>
153
154         [Win][Clang][WebKitLegacy] WebFrame.cpp: warning: delete called on non-final 'WebFrame' that has virtual functions but non-virtual destructor [-Wdelete-non-virtual-dtor]
155         https://bugs.webkit.org/show_bug.cgi?id=192618
156
157         Reviewed by Alex Christensen.
158
159         No new tests, no behavior changes.
160
161         * platform/win/PopupMenuWin.h:
162         * platform/win/WCDataObject.cpp:
163         * platform/win/WCDataObject.h:
164
165 2018-12-12  Simon Fraser  <simon.fraser@apple.com>
166
167         REGRESSION (r238090): CAPCHA UI jumps to the wrong location
168         https://bugs.webkit.org/show_bug.cgi?id=192651
169         rdar://problem/46531919
170
171         Reviewed by Zalan Bujtas.
172         
173         When a RenderLayer becomes non-composited because of a style change, we need to set a dirty
174         bit to say that descendants need their geometry updated (because they now have to
175         compute their positions relative to a different ancestor). This wasn't happening
176         in the layerStyleChanged() code path.
177         
178         In the code path that did do this correctly (in the computeCompositingRequirements() tree walk),
179         we can address a FIXME and only dirty direct children, not all descendants (that code was
180         written before the child-only dirty bit existed).
181
182         Test: compositing/geometry/update-child-geometry-on-compositing-change.html
183
184         * rendering/RenderLayerCompositor.cpp:
185         (WebCore::RenderLayerCompositor::computeCompositingRequirements):
186         (WebCore::RenderLayerCompositor::layerStyleChanged):
187
188 2018-12-13  Ryosuke Niwa  <rniwa@webkit.org>
189
190         Make TextInputController.legacyAttributedString take DOM nodes and offsets
191         https://bugs.webkit.org/show_bug.cgi?id=192653
192
193         Reviewed by Wenson Hsieh.
194
195         No new tests since there should be no observable behavioral change other than
196         TextInputController API in DumpRenderTree.
197
198         * editing/cocoa/HTMLConverter.h:
199         * editing/cocoa/HTMLConverter.mm:
200         (WebCore::attributedStringFromSelection):
201         (WebCore::attributedStringBetweenStartAndEnd): Added.
202
203 2018-12-12  Ryosuke Niwa  <rniwa@webkit.org>
204
205         Fix macOS builds after r239145.
206
207         * platform/mediastream/mac/MockRealtimeVideoSourceMac.mm:
208
209 2018-12-12  Simon Fraser  <simon.fraser@apple.com>
210
211         REGRESSION (r238357): Pins on Yelp map disappear
212         https://bugs.webkit.org/show_bug.cgi?id=192597
213         rdar://problem/46578285
214
215         Reviewed by Zalan Bujtas.
216
217         RenderLayerCompositor::updateBackingAndHierarchy() had a bug where if a RenderLayer gained
218         a negative z-order child (triggering creation of a foreground layer), we'd fail to 
219         call the "setChildren()" with the vector containing that foreground layer.
220         
221         When updateBackingAndHierarchy() stops visiting descendants because none are composited,
222         it may still have to update the child list with the foreground layer, so make sure
223         the code handles this case.
224
225         Tests: compositing/z-order/add-negative-z-child.html
226                compositing/z-order/rebuild-sibling-of-layer-with-foreground-layer.html
227
228         * rendering/RenderLayer.cpp:
229         (WebCore::outputPaintOrderTreeRecursive):
230         * rendering/RenderLayerCompositor.cpp:
231         (WebCore::RenderLayerCompositor::updateBackingAndHierarchy):
232
233 2018-12-12  YUHAN WU  <yuhan_wu@apple.com>
234
235         Implement non-timeslice mode encoding for MediaRecorder
236         https://bugs.webkit.org/show_bug.cgi?id=192069
237         <rdar://problem/46443290>
238
239         Reviewed by Eric Carlson.
240
241         Implement the encoding for non-timeslice mode of MediaRecorder.
242         It only supports to record MP4 file through H264 and AAC encoding, we will need to support more MIME types and encoding methods.
243         Add a API in internals to allow testings to turn on the mock source.
244
245         Test: http/wpt/mediarecorder/MediaRecorder-AV-audio-video-dataavailable.html
246
247         * Modules/mediarecorder/MediaRecorder.cpp:
248         (WebCore::MediaRecorder::create):
249         (WebCore::MediaRecorder::setCustomPrivateRecorderCreator):
250         (WebCore::MediaRecorder::getPrivateImpl):
251         (WebCore::MediaRecorder::MediaRecorder):
252         (WebCore::MediaRecorder::stopRecording):
253         (WebCore::MediaRecorder::stopRecordingInternal):
254         (WebCore::MediaRecorder::createRecordingDataBlob):
255         (WebCore::MediaRecorder::scheduleDeferredTask):
256         * Modules/mediarecorder/MediaRecorder.h:
257         * Modules/mediarecorder/MediaRecorder.idl:
258         * SourcesCocoa.txt:
259         * WebCore.xcodeproj/project.pbxproj:
260         * platform/mediarecorder/MediaRecorderPrivate.h:
261         (WebCore::MediaRecorderPrivate::stopRecording):
262         * platform/mediarecorder/MediaRecorderPrivateAVFImpl.cpp: Added.
263         (WebCore::MediaRecorderPrivateAVFImpl::create):
264         (WebCore::MediaRecorderPrivateAVFImpl::MediaRecorderPrivateAVFImpl):
265         (WebCore::MediaRecorderPrivateAVFImpl::sampleBufferUpdated):
266         (WebCore::MediaRecorderPrivateAVFImpl::audioSamplesAvailable):
267         (WebCore::MediaRecorderPrivateAVFImpl::stopRecording):
268         (WebCore::MediaRecorderPrivateAVFImpl::fetchData):
269         (WebCore::MediaRecorderPrivateAVFImpl::mimeType):
270         * platform/mediarecorder/MediaRecorderPrivateAVFImpl.h: Added.
271         * platform/mediarecorder/MediaRecorderPrivateMock.cpp:
272         (WebCore::MediaRecorderPrivateMock::fetchData):
273         (WebCore::MediaRecorderPrivateMock::mimeType):
274         * platform/mediarecorder/MediaRecorderPrivateMock.h:
275         * platform/mediarecorder/cocoa/MediaRecorderPrivateWriterCocoa.h: added.
276         * platform/mediarecorder/cocoa/MediaRecorderPrivateWriterCocoa.mm: Added.
277         (WebCore::MediaRecorderPrivateWriter::clear):
278         (WebCore::MediaRecorderPrivateWriter::setupWriter):
279         (WebCore::MediaRecorderPrivateWriter::setVideoInput):
280         (WebCore::MediaRecorderPrivateWriter::setAudioInput):
281         (WebCore::copySampleBufferWithCurrentTimeStamp):
282         (WebCore::MediaRecorderPrivateWriter::appendVideoSampleBuffer):
283         (WebCore::MediaRecorderPrivateWriter::appendAudioSampleBuffer):
284         (WebCore::MediaRecorderPrivateWriter::stopRecording):
285         * testing/Internals.cpp:
286         (WebCore::createRecorderMockSource):
287         (WebCore::Internals::setCustomPrivateRecorderCreator):
288         * testing/Internals.h:
289         * testing/Internals.idl:
290
291 2018-12-12  Justin Fan  <justin_fan@apple.com>
292
293         [WebGPU] Vertex buffers and WebGPUInputState
294         https://bugs.webkit.org/show_bug.cgi?id=192611
295
296         Reviewed by Dean Jackson.
297
298         Test: webgpu/vertex-buffer-triangle-strip.html
299
300         Basic implementation of vertex buffers with Metal shading language in WebGPU. In 
301         WebGPURenderPipelineDescriptor, refactor to match updated shader stage structure and add 
302         WebGPUInputStateDescriptor. Also implement WebGPURenderPassEncoder::setVertexBuffers.
303
304         Add symbols and files for WebGPUIndexFormat, WebGPUInputStateDescriptor, WebGPUInputStepMode, 
305         WebGPUVertexAttributeDescriptor, WebGPUVertexFormat, WebGPUVertexInputDescriptor:
306         * CMakeLists.txt:
307         * DerivedSources.make:
308         * Sources.txt:
309         * WebCore.xcodeproj/project.pbxproj:
310         * bindings/js/WebCoreBuiltinNames.h:
311
312         Add and implement interfaces and dictionaries for WebGPUInputState:
313         * Modules/webgpu/WebGPUBuffer.cpp:
314         (WebCore::WebGPUBuffer::WebGPUBuffer):
315         * Modules/webgpu/WebGPUBuffer.h:
316         (WebCore::WebGPUBuffer::buffer const): Added getter for backing GPUBuffer.
317         * Modules/webgpu/WebGPUBufferDescriptor.h:
318         * Modules/webgpu/WebGPUBufferDescriptor.idl: Moving WebGPUBufferUsage out into its own IDL.
319         * Modules/webgpu/WebGPUDevice.h:
320         * Modules/webgpu/WebGPUIndexFormat.h: Added.
321         * Modules/webgpu/WebGPUIndexFormat.idl: Added. 
322         * Modules/webgpu/WebGPUInputStateDescriptor.h: Added.
323         * Modules/webgpu/WebGPUInputStateDescriptor.idl: Added.
324         * Modules/webgpu/WebGPUInputStepMode.h: Added.
325         * Modules/webgpu/WebGPUInputStepMode.idl: Added.
326         * Modules/webgpu/WebGPUVertexAttributeDescriptor.h: Added.
327         * Modules/webgpu/WebGPUVertexAttributeDescriptor.idl: Added.
328         * Modules/webgpu/WebGPUVertexFormat.h: Added.
329         * Modules/webgpu/WebGPUVertexFormat.idl: Added.
330         * Modules/webgpu/WebGPUVertexInputDescriptor.h: Added.
331         * Modules/webgpu/WebGPUVertexInputDescriptor.idl: Added.
332         * platform/graphics/gpu/GPUInputStateDescriptor.h: Added.
333         * platform/graphics/gpu/GPURenderPassEncoder.h: Added.
334         * platform/graphics/gpu/GPURenderPipelineDescriptor.h: Added.
335         * platform/graphics/gpu/GPUVertexAttributeDescriptor.h: Added.
336         * platform/graphics/gpu/GPUVertexInputDescriptor.h: Added.
337
338         Refactor to support updated structure of pipeline descriptor in sketch IDL:
339         * Modules/webgpu/WebGPUDevice.cpp:
340         (WebCore::validateAndConvertPipelineStage):
341         (WebCore::WebGPUDevice::createRenderPipeline const):
342         * Modules/webgpu/WebGPUPipelineDescriptorBase.h:
343         * Modules/webgpu/WebGPUPipelineDescriptorBase.idl:
344         * Modules/webgpu/WebGPUPipelineStageDescriptor.h:
345         * Modules/webgpu/WebGPUPipelineStageDescriptor.idl:
346         * Modules/webgpu/WebGPURenderPipelineDescriptor.h:
347         * Modules/webgpu/WebGPURenderPipelineDescriptor.idl:
348         * Modules/webgpu/WebGPUShaderStage.*: Removed.
349
350         Add and implement setVertexBuffers:
351         * Modules/webgpu/WebGPURenderPassEncoder.cpp:
352         (WebCore::WebGPURenderPassEncoder::setVertexBuffers): Added. 
353         * Modules/webgpu/WebGPURenderPassEncoder.h:
354         * Modules/webgpu/WebGPURenderPassEncoder.idl: 
355         * platform/graphics/gpu/cocoa/GPURenderPassEncoderMetal.mm:
356         (WebCore::GPURenderPassEncoder::setVertexBuffers):
357         * platform/graphics/gpu/cocoa/GPURenderPipelineMetal.mm:
358         (WebCore::setInputStateForPipelineDescriptor):
359         (WebCore::GPURenderPipeline::create):
360
361 2018-12-12  Tim Horton  <timothy_horton@apple.com>
362
363         REGRESSION (r237565): >20 Find in Page highlights in one tile results in a single giant highlight
364         https://bugs.webkit.org/show_bug.cgi?id=192642
365         <rdar://problem/46498246>
366
367         Reviewed by Geoffrey Garen.
368
369         No new tests; adjusted an existing test instead.
370
371         * platform/graphics/PathUtilities.cpp:
372         (WebCore::PathUtilities::pathsWithShrinkWrappedRects):
373         Instead of uniting when we fail to shrink-wrap, just return the original rects.
374         This seems like a more reasonable default in most cases.
375
376 2018-12-12  Vivek Seth  <v_seth@apple.com>
377
378         HTTPS Upgrade: Figure out if/how to tell clients that the HTTPS upgrade happened
379         https://bugs.webkit.org/show_bug.cgi?id=192375
380         <rdar://problem/45851159>
381
382         Reviewed by Chris Dumez.
383
384         Use simulated redirect to tell clients that HTTPS Upgrade happened.
385
386         * platform/network/ResourceResponseBase.cpp:
387         (WebCore::ResourceResponseBase::syntheticRedirectResponse):
388         * platform/network/ResourceResponseBase.h:
389         * platform/network/mac/WebCoreURLResponse.mm:
390         (WebCore::synthesizeRedirectResponseIfNecessary):
391
392 2018-12-12  Chris Dumez  <cdumez@apple.com>
393
394         Add a preference to enable / disable devicemotion and deviceorientation events
395         https://bugs.webkit.org/show_bug.cgi?id=192631
396         <rdar://problem/46646244>
397
398         Reviewed by Geoffrey Garen.
399
400         Add setting to toggle support for the deviceorientation / devicemotion events:
401         - https://w3c.github.io/deviceorientation/
402
403         * page/DOMWindow.cpp:
404         (WebCore::DOMWindow::addEventListener):
405         * page/Settings.yaml:
406
407 2018-12-11  Ryosuke Niwa  <rniwa@webkit.org>
408
409         Make HTMLConverter take two Positions in preparation to make it work with shadow DOM
410         https://bugs.webkit.org/show_bug.cgi?id=192613
411
412         Reviewed by Darin Adler.
413
414         This patch makes HTMLConverter store two Position's instead of a Range so that HTMLConverter can work with
415         a selection which spans across shadow boundaries in the future.
416
417         No new tests since there should be no observable behavioral change.
418
419         * editing/cocoa/EditorCocoa.mm:
420         (WebCore::Editor::writeSelectionToPasteboard): Uses the newly introduced writeSelectionToPasteboard.
421         (WebCore::Editor::writeSelection): Ditto.
422         * editing/cocoa/HTMLConverter.h:
423         * editing/cocoa/HTMLConverter.mm:
424         (HTMLConverter::HTMLConverter): Now takes two Position's.
425         (HTMLConverter::convert): Updated to work with Position's.
426         (HTMLConverter::_processText): Ditto.
427         (HTMLConverter::_traverseNode): Ditto.
428         (HTMLConverter::_traverseFooterNode): Ditto.
429         (HTMLConverterCaches::cacheAncestorsOfStartToBeConverted): Ditto.
430         (WebCore::attributedStringFromRange): Ditto.
431         (WebCore::attributedStringFromSelection): Added. For now, we first create a Range via toNormalizedRange
432         in order to preserve the exact behavior.
433
434 2018-12-12  Michael Catanzaro  <mcatanzaro@igalia.com>
435
436         Unreviewed manual rollout of r239100-r239102 and r239116
437         https://bugs.webkit.org/show_bug.cgi?id=192151
438         <rdar://problem/46655586>
439
440         * css/CSSFontFaceSource.cpp:
441         (WebCore::CSSFontFaceSource::font):
442         * loader/cache/CachedFont.cpp:
443         (WebCore::CachedFont::platformDataFromCustomData):
444         * platform/FreeType.cmake:
445         * platform/graphics/FontPlatformData.h:
446         (WebCore::FontPlatformData::isFixedWidth const): Deleted.
447         * platform/graphics/cairo/FontCustomPlatformData.h:
448         * platform/graphics/freetype/FontCacheFreeType.cpp:
449         (WebCore::FontCache::systemFallbackForCharacters):
450         (WebCore::FontCache::createFontPlatformData):
451         (WebCore::getFontPropertiesFromPattern): Deleted.
452         (WebCore::defaultVariationValues): Deleted.
453         (WebCore::buildVariationSettings): Deleted.
454         * platform/graphics/freetype/FontCacheFreeType.h: Removed.
455         * platform/graphics/freetype/FontCustomPlatformDataFreeType.cpp:
456         (WebCore::FontCustomPlatformData::FontCustomPlatformData):
457         (WebCore::FontCustomPlatformData::~FontCustomPlatformData):
458         (WebCore::FontCustomPlatformData::fontPlatformData):
459         (WebCore::FontCustomPlatformData::supportsFormat):
460         (WebCore::defaultFontconfigOptions): Deleted.
461         * platform/graphics/freetype/FontPlatformDataFreeType.cpp:
462         (WebCore::setCairoFontOptionsFromFontConfigPattern):
463         (WebCore::getDefaultFontconfigOptions):
464         (WebCore::FontPlatformData::FontPlatformData):
465         (WebCore::FontPlatformData::operator=):
466         (WebCore::FontPlatformData::harfBuzzFace const):
467         (WebCore::FontPlatformData::platformIsEqual const):
468         (WebCore::FontPlatformData::buildScaledFont):
469         (WebCore::FontPlatformData::fcPattern const): Deleted.
470         (WebCore::FontPlatformData::createOpenTypeMathHarfBuzzFont const): Deleted.
471         * platform/graphics/freetype/SimpleFontDataFreeType.cpp:
472         (WebCore::Font::platformCreateScaledFont const):
473         * platform/graphics/harfbuzz/ComplexTextControllerHarfBuzz.cpp:
474         (WebCore::fontFeatures):
475         (WebCore::ComplexTextController::collectComplexTextRunsForCharacters):
476         (WebCore::floatToHarfBuzzPosition): Deleted.
477         (WebCore::doubleToHarfBuzzPosition): Deleted.
478         (WebCore::harfBuzzFontFunctions): Deleted.
479         (WebCore::findScriptForVerticalGlyphSubstitution): Deleted.
480         * platform/graphics/harfbuzz/HarfBuzzFace.cpp: Added.
481         (WebCore::HarfBuzzFace::CacheEntry::CacheEntry):
482         (WebCore::HarfBuzzFace::CacheEntry::~CacheEntry):
483         (WebCore::HarfBuzzFace::cache):
484         (WebCore::HarfBuzzFace::HarfBuzzFace):
485         (WebCore::HarfBuzzFace::~HarfBuzzFace):
486         (WebCore::findScriptForVerticalGlyphSubstitution):
487         (WebCore::HarfBuzzFace::setScriptForVerticalGlyphSubstitution):
488         * platform/graphics/harfbuzz/HarfBuzzFace.h: Added.
489         (WebCore::HarfBuzzFace::CacheEntry::create):
490         (WebCore::HarfBuzzFace::CacheEntry::face):
491         (WebCore::HarfBuzzFace::CacheEntry::glyphCache):
492         * platform/graphics/harfbuzz/HarfBuzzFaceCairo.cpp: Added.
493         (WebCore::floatToHarfBuzzPosition):
494         (WebCore::doubleToHarfBuzzPosition):
495         (WebCore::CairoGetGlyphWidthAndExtents):
496         (WebCore::harfBuzzGetGlyph):
497         (WebCore::harfBuzzGetGlyphHorizontalAdvance):
498         (WebCore::harfBuzzGetGlyphHorizontalOrigin):
499         (WebCore::harfBuzzGetGlyphExtents):
500         (WebCore::harfBuzzCairoTextGetFontFuncs):
501         (WebCore::harfBuzzCairoGetTable):
502         (WebCore::HarfBuzzFace::createFace):
503         (WebCore::HarfBuzzFace::createFont):
504         * platform/graphics/harfbuzz/HbUniquePtr.h:
505         (WebCore::HbPtrDeleter<hb_face_t>::operator() const): Deleted.
506         * platform/graphics/opentype/OpenTypeMathData.cpp:
507         (WebCore::OpenTypeMathData::OpenTypeMathData):
508         * platform/graphics/win/FontCustomPlatformData.cpp:
509         (WebCore::FontCustomPlatformData::fontPlatformData):
510         * platform/graphics/win/FontCustomPlatformData.h:
511         * platform/graphics/win/FontCustomPlatformDataCairo.cpp:
512         (WebCore::FontCustomPlatformData::fontPlatformData):
513
514 2018-12-12  Chris Dumez  <cdumez@apple.com>
515
516         Unreviewed attempt to fix Windows Cairo build after r239100.
517
518         * platform/graphics/win/FontCustomPlatformDataCairo.cpp:
519         (WebCore::FontCustomPlatformData::fontPlatformData):
520
521 2018-12-12  Wenson Hsieh  <wenson_hsieh@apple.com>
522
523         [iOS] A few API tests are failing after r239086
524         https://bugs.webkit.org/show_bug.cgi?id=192608
525
526         Reviewed by Zalan Bujtas.
527
528         These test failures were caused by a missing Vector size check in `Pasteboard::readFilePaths` before accessing
529         the first item. Fix this by adding a helper method on PasteboardItemInfo to grab the file path for the highest
530         fidelity pasteboard item (returning the null string if there are none), and use this in a few places that grab
531         the highest fidelity path using Vector::first().
532
533         While `Pasteboard::readRespectingUTIFidelities` does have a bounds check before accessing the list of paths,
534         this patch still replaces it with a call to `pathForHighestFidelityItem()`, so that the intent is more clear.
535
536         * platform/PasteboardItemInfo.h:
537         (WebCore::PasteboardItemInfo::pathForHighestFidelityItem const):
538         * platform/ios/PasteboardIOS.mm:
539         (WebCore::Pasteboard::readRespectingUTIFidelities):
540         (WebCore::Pasteboard::readFilePaths):
541
542 2018-12-12  Carlos Garcia Campos  <cgarcia@igalia.com>
543
544         Unreviewed. Fix WPE build after r239101.
545
546         * platform/graphics/harfbuzz/ComplexTextControllerHarfBuzz.cpp: Include <hb-ot.h>
547
548 2018-12-12  Carlos Garcia Campos  <cgarcia@igalia.com>
549
550         [FreeType] Remove HarfBuzzFace
551         https://bugs.webkit.org/show_bug.cgi?id=192589
552
553         Reviewed by Michael Catanzaro.
554
555         This was used to share the common implementation with the chromium port, but now that only freetype based ports
556         use it, it can be removed and use hb_ft_face_create_cached() instead. We don't need the glyph cache either,
557         since we are already caching glyphs in Font.
558
559         * platform/FreeType.cmake: Remove HarfBuzzFaceCairo.cpp and HarfBuzzFace.cpp.
560         * platform/graphics/FontPlatformData.h: Remove HarfBuzzFace member.
561         * platform/graphics/freetype/FontCustomPlatformDataFreeType.cpp: Add missing include.
562         * platform/graphics/freetype/FontPlatformDataFreeType.cpp:
563         (WebCore::FontPlatformData::operator=): Remove m_harfBuzzFace handling.
564         (WebCore::FontPlatformData::createOpenTypeMathHarfBuzzFont const): New funtction to create a hb_font_t for
565         OpenType math.
566         * platform/graphics/harfbuzz/ComplexTextControllerHarfBuzz.cpp:
567         (WebCore::floatToHarfBuzzPosition): Moved from HarfBuzzFaceCairo.cpp.
568         (WebCore::doubleToHarfBuzzPosition): Ditto.
569         (WebCore::harfBuzzFontFunctions): Also moved from HarfBuzzFaceCairo.cpp, but implement get_nominal/variation
570         functions when using HarfBuzz >= 1.2.3 and use Font::glyphForCharacter() to make it simpler.
571         (WebCore::fontFeatures): Moved from HarfBuzzFaceCairo.cpp.
572         (WebCore::findScriptForVerticalGlyphSubstitution): Moved from HarfBuzzFace.cpp.
573         (WebCore::ComplexTextController::collectComplexTextRunsForCharacters): Create the HarfBuzz face and font here.
574         * platform/graphics/harfbuzz/HarfBuzzFace.cpp: Removed.
575         * platform/graphics/harfbuzz/HarfBuzzFace.h: Removed.
576         * platform/graphics/harfbuzz/HarfBuzzFaceCairo.cpp: Removed.
577         * platform/graphics/harfbuzz/HbUniquePtr.h:
578         (WebCore::HbPtrDeleter<hb_face_t>::operator() const): Add deleter for hb_face_t.
579         * platform/graphics/opentype/OpenTypeMathData.cpp:
580         (WebCore::OpenTypeMathData::OpenTypeMathData): Use FontPlatformData::createOpenTypeMathHarfBuzzFont().
581
582 2018-12-12  Carlos Garcia Campos  <cgarcia@igalia.com>
583
584         [FreeType] Add initial implementation of variation fonts
585         https://bugs.webkit.org/show_bug.cgi?id=192151
586
587         Reviewed by Michael Catanzaro.
588
589         * css/CSSFontFaceSource.cpp:
590         (WebCore::CSSFontFaceSource::font): Remove platform ifdefs.
591         * loader/cache/CachedFont.cpp:
592         (WebCore::CachedFont::platformDataFromCustomData): Ditto.
593         * platform/graphics/FontPlatformData.h:
594         (WebCore::FontPlatformData::isFixedWidth const):
595         * platform/graphics/cairo/FontCustomPlatformData.h: Use RefPtr for cairo_font_face_t.
596         * platform/graphics/freetype/FontCacheFreeType.cpp:
597         (WebCore::getFontPropertiesFromPattern): Helper function to get several font properties from the fontconfig
598         pattern.
599         (WebCore::FontCache::systemFallbackForCharacters): Use getFontPropertiesFromPattern().
600         (WebCore::FontCache::createFontPlatformData): Pass FC_VARIABLE to the pattern and call buildVariationSettings()
601         before creating the FontPlatformData to set FC_FONT_VARIATIONS on the pattern.
602         (WebCore::defaultVariationValues): Parse font variations table.
603         (WebCore::buildVariationSettings): Build a font variations string from the settings that can be passed to cairo.
604         * platform/graphics/freetype/FontCacheFreeType.h: Added.
605         * platform/graphics/freetype/FontCustomPlatformDataFreeType.cpp:
606         (WebCore::FontCustomPlatformData::FontCustomPlatformData): Use RefPtr and make freeTypeFaceKey global.
607         (WebCore::FontCustomPlatformData::~FontCustomPlatformData): Remove explicit destroy.
608         (WebCore::defaultFontconfigOptions): Moved here from FontCacheFreeType.
609         (WebCore::FontCustomPlatformData::fontPlatformData): Call buildVariationSettings() before creating the
610         FontPlatformData to set FC_FONT_VARIATIONS on the pattern.
611         (WebCore::FontCustomPlatformData::supportsFormat): Add variation formats.
612         * platform/graphics/freetype/FontPlatformDataFreeType.cpp:
613         (WebCore::setCairoFontOptionsFromFontConfigPattern): Call cairo_font_options_set_variations() with the
614         FC_FONT_VARIATIONS value from the pattern.
615         (WebCore::FontPlatformData::FontPlatformData): Use a single constructor that always receives a valid fontconfig
616         pattern.
617         (WebCore::FontPlatformData::fcPattern const): Return the fontconfig pattern.
618         (WebCore::FontPlatformData::platformIsEqual const): Update the condition now that m_pattern can't be nullptr.
619         (WebCore::FontPlatformData::buildScaledFont): Use m_pattern unconditionally.
620         * platform/graphics/freetype/SimpleFontDataFreeType.cpp:
621         (WebCore::Font::platformCreateScaledFont const): Update it to use the new FontPlatformData constructor.
622         * platform/graphics/harfbuzz/HarfBuzzFaceCairo.cpp:
623         (WebCore::HarfBuzzFace::createFont): Pass variations to HarfBuzz.
624         * platform/graphics/win/FontCustomPlatformData.cpp:
625         (WebCore::FontCustomPlatformData::fontPlatformData):
626         * platform/graphics/win/FontCustomPlatformData.h:
627
628 2018-12-11  Justin Michaud  <justin_michaud@apple.com>
629
630         Implement feature flag for CSS Typed OM
631         https://bugs.webkit.org/show_bug.cgi?id=192610
632
633         Reviewed by Ryosuke Niwa.
634
635         * Configurations/FeatureDefines.xcconfig:
636         * bindings/js/JSTypedOMCSSStyleValueCustom.cpp:
637         * css/typedom/StylePropertyMapReadOnly.h:
638         * css/typedom/StylePropertyMapReadOnly.idl:
639         * css/typedom/TypedOMCSSImageValue.h:
640         * css/typedom/TypedOMCSSImageValue.idl:
641         * css/typedom/TypedOMCSSNumericValue.h:
642         * css/typedom/TypedOMCSSNumericValue.idl:
643         * css/typedom/TypedOMCSSStyleValue.h:
644         * css/typedom/TypedOMCSSStyleValue.idl:
645         * css/typedom/TypedOMCSSUnitValue.h:
646         * css/typedom/TypedOMCSSUnitValue.idl:
647         * css/typedom/TypedOMCSSUnparsedValue.h:
648         * css/typedom/TypedOMCSSUnparsedValue.idl:
649         * features.json:
650         * html/ImageBitmap.cpp:
651         * html/ImageBitmap.h:
652         * html/canvas/CanvasDrawImage.idl:
653         * html/canvas/CanvasFillStrokeStyles.idl:
654         * html/canvas/CanvasRenderingContext2DBase.cpp:
655         * html/canvas/CanvasRenderingContext2DBase.h:
656         * inspector/InspectorCanvas.cpp:
657         (WebCore::InspectorCanvas::buildAction):
658         * page/RuntimeEnabledFeatures.h:
659         (WebCore::RuntimeEnabledFeatures::setCSSTypedOMEnabled):
660         (WebCore::RuntimeEnabledFeatures::cssTypedOMEnabled const):
661         * page/WindowOrWorkerGlobalScope.idl:
662
663 2018-12-10  Ryosuke Niwa  <rniwa@webkit.org>
664
665         connectedCallback is invoked during the removal of the element inside another element's connectedCallback
666         https://bugs.webkit.org/show_bug.cgi?id=183586
667         <rdar://problem/38403504>
668
669         Reviewed by Frédéric Wang.
670
671         Align WebKit's behavior with Chrome/Firefox with regards to https://github.com/w3c/webcomponents/issues/760
672
673         After much discussion, it's unclear that there is a clear path forward to fixing the oddness that
674         the presence of a custom element reaction changes the timing at which another reaction callback gets invoked.
675         So matching Chrome/Firefox behaviors in this case seems the path of the least resistance to interoperability.
676
677         Namely, this patch makes WebKit not insert a custom element to the appropriate element queue when the element
678         does not have a matching reaction callback. Put it another way, steps 3-5 in would be done before step 6 in:
679         https://html.spec.whatwg.org/multipage/custom-elements.html#enqueue-a-custom-element-callback-reaction
680             1. Let definition be element's custom element definition.
681             2. Let callback be the value of the entry in definition's lifecycle callbacks with key callbackName.
682             3. If callback is null, then return
683             4. If callbackName is "attributeChangedCallback", then:
684                 1. Let attributeName be the first element of args.
685                 2. If definition's observed attributes does not contain attributeName, then return.
686             5. Add a new callback reaction to element's custom element reaction queue, with callback function callback
687                and arguments args.
688             6. Enqueue an element on the appropriate element queue given element.
689
690         Test: fast/custom-elements/enqueue-custom-element-callback-reactions-inside-another-callback.html
691
692         * dom/CustomElementReactionQueue.cpp:
693         (WebCore::CustomElementReactionQueue::enqueueElementUpgrade):
694         (WebCore::CustomElementReactionQueue::enqueueConnectedCallbackIfNeeded):
695         (WebCore::CustomElementReactionQueue::enqueueDisconnectedCallbackIfNeeded):
696         (WebCore::CustomElementReactionQueue::enqueueAdoptedCallbackIfNeeded):
697         (WebCore::CustomElementReactionQueue::enqueueAttributeChangedCallbackIfNeeded):
698         (WebCore::CustomElementReactionQueue::enqueuePostUpgradeReactions):
699         (WebCore::CustomElementReactionQueue::enqueueElementOnAppropriateElementQueue): Renamed from ensureCurrentQueue.
700         * dom/CustomElementReactionQueue.h:
701
702 2018-12-11  Justin Fan  <justin_fan@apple.com>
703
704         [WebGPU] Implement WebGPUBuffer, and some nullibility consistency in WebGPU
705         https://bugs.webkit.org/show_bug.cgi?id=192516
706
707         Reviewed by Dean Jackson.
708
709         Test: webgpu/buffers.html
710
711         Enable basic creation of WebGPUBuffers, and fix nullability inconsitencies in WebGPU implementation.
712
713         Add necessary symbols and files for Web/GPUBuffer, Web/GPUBufferUsage, and Web/GPUBufferDescriptor:
714         * CMakeLists.txt:
715         * DerivedSources.make:
716         * Sources.txt:
717         * SourcesCocoa.txt:
718         * WebCore.xcodeproj/project.pbxproj:
719         * bindings/js/WebCoreBuiltinNames.h:
720
721         * Modules/webgpu/WebGPUBuffer.cpp: Added.
722         (WebCore::WebGPUBuffer::create):
723         (WebCore::WebGPUBuffer::WebGPUBuffer):
724         * Modules/webgpu/WebGPUBuffer.h: Added.
725         (WebCore::WebGPUBuffer::mapping const):
726         (WebCore::WebGPUBuffer::unmap): Unimplemented stub, for now, as Metal equivalent is unclear.
727         (WebCore::WebGPUBuffer::destroy): Unimplemented stub.
728         * Modules/webgpu/WebGPUBuffer.idl: Added.
729         * Modules/webgpu/WebGPUBufferDescriptor.h: Added.
730         * Modules/webgpu/WebGPUBufferDescriptor.idl: Added.
731         * Modules/webgpu/WebGPUDevice.cpp:
732         (WebCore::WebGPUDevice::createBuffer const): Added.
733         * platform/graphics/gpu/GPUBuffer.h:
734         (WebCore::GPUBuffer::platformBuffer const):
735         (WebCore::GPUBuffer::mapping const):
736         * platform/graphics/gpu/GPUBufferDescriptor.h: Added.
737         * platform/graphics/gpu/GPUDevice.cpp:
738         (WebCore::GPUDevice::createBuffer const): Added.
739         * platform/graphics/gpu/GPUDevice.h:
740         * platform/graphics/gpu/cocoa/GPUBufferMetal.mm: Added.
741         (WebCore::GPUBuffer::create): Attempt to create a page-aligned Gigacage to back the GPUBuffer's ArrayBuffer. 
742         (WebCore::GPUBuffer::GPUBuffer):
743         (WebCore::GPUBuffer::~GPUBuffer): Dereference mapped ArrayBuffer first.
744
745         Small benign edits, most to make nullability more consistent in WebGPU classes:
746         * Modules/webgpu/WebGPUCommandBuffer.cpp:
747         (WebCore::WebGPUCommandBuffer::create):
748         (WebCore::WebGPUCommandBuffer::beginRenderPass):
749         * Modules/webgpu/WebGPUCommandBuffer.h:
750         * Modules/webgpu/WebGPUDevice.cpp:
751         (WebCore::WebGPUDevice::create):
752         (WebCore::WebGPUDevice::WebGPUDevice):
753         (WebCore::WebGPUDevice::createShaderModule const):
754         (WebCore::WebGPUDevice::createRenderPipeline const):
755         (WebCore::WebGPUDevice::createCommandBuffer const):
756         * Modules/webgpu/WebGPUDevice.h:
757         (WebCore::WebGPUDevice::device const):
758         * Modules/webgpu/WebGPUDevice.idl:
759         * Modules/webgpu/WebGPUQueue.cpp:
760         (WebCore::WebGPUQueue::create):
761         * Modules/webgpu/WebGPURenderPassEncoder.cpp:
762         (WebCore::WebGPURenderPassEncoder::create):
763         * Modules/webgpu/WebGPURenderPassEncoder.h:
764         * Modules/webgpu/WebGPUShaderModule.cpp:
765         (WebCore::WebGPUShaderModule::create):
766         (WebCore::WebGPUShaderModule::WebGPUShaderModule):
767         * Modules/webgpu/WebGPUShaderModule.h:
768         (WebCore::WebGPUShaderModule::module const):
769         * Modules/webgpu/WebGPUSwapChain.idl: Sync with IDL changes.
770         * Modules/webgpu/WebGPUTexture.cpp:
771         (WebCore::WebGPUTexture::create):
772         (WebCore::WebGPUTexture::createDefaultTextureView):
773         * Modules/webgpu/WebGPUTextureView.cpp:
774         (WebCore::WebGPUTextureView::create):
775         * Modules/webgpu/WebGPUTextureView.h:
776         * platform/graphics/gpu/cocoa/GPUQueueMetal.mm:
777         (WebCore::GPUQueue::create):
778         * platform/graphics/gpu/cocoa/GPURenderPipelineMetal.mm:
779         (WebCore::GPURenderPipeline::create):
780         * platform/graphics/gpu/cocoa/GPUShaderModuleMetal.mm:
781         (WebCore::GPUShaderModule::create):
782         * platform/graphics/gpu/cocoa/GPUSwapChainMetal.mm:
783         (WebCore::GPUSwapChain::setDevice):
784         * platform/graphics/gpu/cocoa/GPUTextureMetal.mm:
785         (WebCore::GPUTexture::GPUTexture):
786
787 2018-12-11  Fujii Hironori  <Hironori.Fujii@sony.com>
788
789         [Win][Clang] Fix warning -Wmissing-field-initializers
790         https://bugs.webkit.org/show_bug.cgi?id=192584
791
792         Reviewed by Yusuke Suzuki.
793
794         Initialize a struct with '{ }' instead of '= {0}'.
795
796         No new tests, no behavior changes.
797
798         * platform/graphics/win/FontCacheWin.cpp:
799         (WebCore::FontCache::lastResortFallbackFont):
800         * platform/graphics/win/MediaPlayerPrivateFullscreenWindow.cpp:
801         (WebCore::MediaPlayerPrivateFullscreenWindow::createWindow):
802         * platform/win/ClipboardUtilitiesWin.cpp:
803         (WebCore::setFileDescriptorData):
804         (WebCore::setFileContentData):
805         (WebCore::setUCharData):
806         (WebCore::setUtf8Data):
807         (WebCore::setCFData):
808         * platform/win/CursorWin.cpp:
809         (WebCore::createSharedCursor):
810         * platform/win/DefWndProcWindowClass.cpp:
811         (WebCore::registerClass):
812         * platform/win/DragImageWin.cpp:
813         (WebCore::createDragImageIconForCachedImageFilename):
814         * platform/win/PasteboardWin.cpp:
815         (WebCore::writeURL):
816         (WebCore::Pasteboard::writeString):
817         (WebCore::Pasteboard::writeRangeToDataObject):
818         (WebCore::Pasteboard::writePlainTextToDataObject):
819         (WebCore::writeFileToDataObject):
820         (WebCore::Pasteboard::writeMarkup):
821         * platform/win/PopupMenuWin.cpp:
822         (WebCore::PopupMenuWin::show):
823         * platform/win/SSLKeyGeneratorWin.cpp:
824         (WebCore::WebCore::signedPublicKeyAndChallengeString):
825
826 2018-12-11  Jer Noble  <jer.noble@apple.com>
827
828         Globally namespaced objects shouldn't use framework-prefixed names
829         https://bugs.webkit.org/show_bug.cgi?id=192600
830
831         Reviewed by Eric Carlson.
832
833         Rename CMSampleBufferIs... -> isCMSampleBuffer...
834
835         * platform/graphics/avfoundation/objc/MediaSampleAVFObjC.mm:
836         (WebCore::isCMSampleBufferRandomAccess):
837         (WebCore::isCMSampleBufferNonDisplaying):
838         (WebCore::MediaSampleAVFObjC::flags const):
839         (WebCore::CMSampleBufferIsRandomAccess): Deleted.
840         (WebCore::CMSampleBufferIsNonDisplaying): Deleted.
841
842 2018-12-11  Brent Fulgham  <bfulgham@apple.com>
843
844         Don't attempt to compute animated values when there is no relevant animation
845         https://bugs.webkit.org/show_bug.cgi?id=192591
846         <rdar://problem/34336946>
847
848         Reviewed by Dean Jackson.
849
850         Check if the property is supposed to be animated, or has animatable features, before
851         attempting to calculate the current animated value.
852
853         Test: svg/animations/avoid-calculating-for-non-animating-elements.html
854
855         * svg/SVGAnimateElementBase.cpp:
856         (WebCore::SVGAnimateElementBase::calculateAnimatedValue):
857
858 2018-12-11  Chris Dumez  <cdumez@apple.com>
859
860         Unreviewed, fix typos in console log from r239087.
861
862         * page/DOMWindow.cpp:
863         (WebCore::DOMWindow::addEventListener):
864
865 2018-12-11  Tim Horton  <timothy_horton@apple.com>
866
867         WebCore shouldn't have a Objective-C class named NSCursor
868         https://bugs.webkit.org/show_bug.cgi?id=192602
869         <rdar://problem/46615532>
870
871         Reviewed by Wenson Hsieh.
872
873         * platform/ios/wak/WAKAppKitStubs.h:
874         * platform/ios/wak/WAKAppKitStubs.m:
875         (+[NSCursor setHiddenUntilMouseMoves:]): Deleted.
876         Get rid of the class.
877         Also remove a comment that seems to have detached from wherever it's supposed to be.
878
879 2018-12-11  Chris Dumez  <cdumez@apple.com>
880
881         Restrict DeviceMotion / DeviceOrientation APIs to secure contexts
882         https://bugs.webkit.org/show_bug.cgi?id=192595
883         <rdar://problem/46382603>
884
885         Reviewed by Dean Jackson.
886
887         Tests: http/tests/events/device-orientation-motion-non-secure-context.html
888                http/tests/events/device-orientation-motion-secure-context.html
889
890         * page/DOMWindow.cpp:
891         (WebCore::DOMWindow::addEventListener):
892         * page/SecurityOrigin.h:
893         (WebCore::SecurityOrigin::setIsPotentiallyTrustworthy):
894         * testing/Internals.cpp:
895         (WebCore::Internals::markContextAsInsecure):
896         (WebCore::Internals::postTask):
897         * testing/Internals.h:
898         * testing/Internals.idl:
899
900 2018-12-11  Wenson Hsieh  <wenson_hsieh@apple.com>
901
902         [iOS] Send the full list of file upload URLs and types in PasteboardItemInfo
903         https://bugs.webkit.org/show_bug.cgi?id=192598
904         Work towards <rdar://problem/35626913>
905
906         Reviewed by Tim Horton.
907
908         Refactors PasteboardItemInfo to contain lists of file URLs and corresponding pasteboard types, instead of just
909         a "preferred" file upload URL and type. See below for more details.
910
911         * platform/PasteboardItemInfo.h:
912         (WebCore::PasteboardItemInfo::pathForContentType const):
913
914         Add a helper method to find a file upload URL corresponding to a given type.
915
916         (WebCore::PasteboardItemInfo::encode const):
917         (WebCore::PasteboardItemInfo::decode):
918
919         Change `pathForFileUpload` to `pathsForFileUpload`, and `contentTypeForFileUpload` to `contentTypesForFileUpload`.
920
921         * platform/ios/AbstractPasteboard.h:
922         * platform/ios/PasteboardIOS.mm:
923         (WebCore::Pasteboard::readRespectingUTIFidelities):
924
925         Adjust this to take the file path for the highest fidelity representation in `pathsForContentType`.
926
927         (WebCore::Pasteboard::readFilePaths):
928         * platform/ios/PlatformPasteboardIOS.mm:
929         (WebCore::PlatformPasteboard::informationForItemAtIndex):
930         * platform/ios/WebItemProviderPasteboard.h:
931         * platform/ios/WebItemProviderPasteboard.mm:
932         (-[NSItemProvider web_containsFileURLAndFileUploadContent]):
933         (-[NSItemProvider web_fileUploadContentTypes]):
934
935         Replace `web_containsFileUploadContent` with `web_fileUploadContentTypes`, which returns the full list of file
936         upload content types (rather than just a `BOOL` indicating whether one or more of these types exist).
937
938         (-[WebItemProviderPasteboard fileUploadURLsAtIndex:fileTypes:]):
939         (-[WebItemProviderPasteboard numberOfFiles]):
940         (-[NSItemProvider web_containsFileUploadContent]): Deleted.
941         (-[WebItemProviderPasteboard preferredFileUploadURLAtIndex:fileType:]): Deleted.
942
943         Replaced with `-fileUploadURLsAtIndex:fileTypes:`. This implementation currently just returns the highest
944         fidelity loaded type identifier, but this is wrong because it doesn't take into account inline data types that
945         shouldn't be represented as data for file uploads (for instance, it never makes sense to upload the internal
946         data serialization for an `NSURL` as a file on the web).
947
948         Instead, use existing logic in `web_fileUploadContentTypes` to determine which file types can be treated as file
949         uploads, and return all of these file types that we've loaded.
950
951 2018-12-11  Don Olmstead  <don.olmstead@sony.com>
952
953         Resource Load Statistics: Use common implementation within NetworkStorageSession
954         https://bugs.webkit.org/show_bug.cgi?id=192592
955
956         Reviewed by Alex Christensen.
957
958         There's nothing within the resource load statistics implementation contained
959         in NetworkStorageSessionCFNet that was CF specific. All of the resource load
960         statistics methods are moved from that file to the root NetworkStorageSession
961         implementation.
962
963         * platform/network/NetworkStorageSession.cpp:
964         (WebCore::getPartitioningDomain):
965         (WebCore::NetworkStorageSession::shouldBlockThirdPartyCookies const):
966         (WebCore::NetworkStorageSession::shouldBlockCookies const):
967         (WebCore::NetworkStorageSession::maxAgeCacheCap):
968         (WebCore::NetworkStorageSession::setAgeCapForClientSideCookies):
969         (WebCore::NetworkStorageSession::setPrevalentDomainsToBlockCookiesFor):
970         (WebCore::NetworkStorageSession::removePrevalentDomains):
971         (WebCore::NetworkStorageSession::hasStorageAccess const):
972         (WebCore::NetworkStorageSession::getAllStorageAccessEntries const):
973         (WebCore::NetworkStorageSession::grantStorageAccess):
974         (WebCore::NetworkStorageSession::removeStorageAccessForFrame):
975         (WebCore::NetworkStorageSession::removeStorageAccessForAllFramesOnPage):
976         (WebCore::NetworkStorageSession::removeAllStorageAccess):
977         (WebCore::NetworkStorageSession::setCacheMaxAgeCapForPrevalentResources):
978         (WebCore::NetworkStorageSession::resetCacheMaxAgeCapForPrevalentResources):
979         * platform/network/NetworkStorageSession.h:
980         * platform/network/cf/NetworkStorageSessionCFNet.cpp:
981         (WebCore::getPartitioningDomain): Deleted.
982         (WebCore::NetworkStorageSession::shouldBlockThirdPartyCookies const): Deleted.
983         (WebCore::NetworkStorageSession::shouldBlockCookies const): Deleted.
984         (WebCore::NetworkStorageSession::maxAgeCacheCap): Deleted.
985         (WebCore::NetworkStorageSession::setAgeCapForClientSideCookies): Deleted.
986         (WebCore::NetworkStorageSession::setPrevalentDomainsToBlockCookiesFor): Deleted.
987         (WebCore::NetworkStorageSession::removePrevalentDomains): Deleted.
988         (WebCore::NetworkStorageSession::hasStorageAccess const): Deleted.
989         (WebCore::NetworkStorageSession::getAllStorageAccessEntries const): Deleted.
990         (WebCore::NetworkStorageSession::grantStorageAccess): Deleted.
991         (WebCore::NetworkStorageSession::removeStorageAccessForFrame): Deleted.
992         (WebCore::NetworkStorageSession::removeStorageAccessForAllFramesOnPage): Deleted.
993         (WebCore::NetworkStorageSession::removeAllStorageAccess): Deleted.
994         (WebCore::NetworkStorageSession::setCacheMaxAgeCapForPrevalentResources): Deleted.
995         (WebCore::NetworkStorageSession::resetCacheMaxAgeCapForPrevalentResources): Deleted.
996
997 2018-12-11  Devin Rousso  <drousso@apple.com>
998
999         Web Inspector: overlay bounds rulers don't match element when page is scrolled
1000         https://bugs.webkit.org/show_bug.cgi?id=192577
1001
1002         Reviewed by Joseph Pecoraro.
1003
1004         When drawing the highlight for a node, the canvas is translated based on the scroll position
1005         of the node. This translation was not applied to the bounds calculations, which meant that
1006         the bounds always drew where the node would have been if it wasn't scrolled.
1007
1008         * inspector/InspectorOverlayPage.js:
1009         (Bounds.prototype.get minX):
1010         (Bounds.prototype.get minY):
1011         (Bounds.prototype.get maxX):
1012         (Bounds.prototype.get maxY):
1013         (Bounds.prototype.offset): Added.
1014         (drawNodeHighlight):
1015         Drive-by: draw bounds for every node being highlighted instead of just the first one.
1016         Drive-by: switch the bounds color to be a semi-transparent red for more visibility/contrast.
1017
1018 2018-12-11  Andy Estes  <aestes@apple.com>
1019
1020         Introduce makeBlockPtr for lambdas
1021         https://bugs.webkit.org/show_bug.cgi?id=192594
1022
1023         Reviewed by Alex Christensen.
1024
1025         Adopted makeBlockPtr.
1026
1027         * platform/cocoa/FileMonitorCocoa.mm:
1028         (WebCore::FileMonitor::FileMonitor):
1029         * platform/graphics/avfoundation/objc/VideoFullscreenLayerManagerObjC.mm:
1030         (WebCore::VideoFullscreenLayerManagerObjC::setVideoFullscreenLayer):
1031         * platform/graphics/gpu/legacy/cocoa/GPULegacyCommandBufferMetal.mm:
1032         (WebCore::GPULegacyCommandBuffer::GPULegacyCommandBuffer):
1033         * platform/network/cocoa/WebCoreNSURLSession.mm:
1034         (-[WebCoreNSURLSession addDelegateOperation:]):
1035         (-[WebCoreNSURLSessionDataTask resource:receivedRedirect:request:completionHandler:]):
1036         * platform/network/mac/WebCoreResourceHandleAsOperationQueueDelegate.mm:
1037         (-[WebCoreResourceHandleAsOperationQueueDelegate callFunctionOnMainThread:]):
1038
1039 2018-12-10  Brent Fulgham  <bfulgham@apple.com>
1040
1041         SVGViewSpec objects should mark relevant SVG elements
1042         https://bugs.webkit.org/show_bug.cgi?id=192567
1043         <rdar://problem/46491325>
1044
1045         Reviewed by Ryosuke Niwa.
1046
1047         SVGViewSpec elements reflect the state of an underlying SVGElement. Teach the mark algorithm to
1048         recognize the relevant SVGElement as active as long as the SVGViewSpec is active.
1049
1050         Update SVGElement so that it can vend WeakPtrs. I also noticed that SVGAttributeOwner used a bare
1051         pointer to the SVGElement, so switched to a WeakPtr.
1052
1053         Test: svg/animations/view-dependency-crash.html
1054
1055         * Sources.txt: Add new files.
1056         * WebCore.xcodeproj/project.pbxproj: Ditto.
1057         * bindings/js/JSSVGViewSpecCustom.cpp: Added.
1058         (WebCore::JSSVGViewSpec::visitAdditionalChildren):
1059         * svg/SVGElement.h:
1060         * svg/SVGPathElement.h:
1061         * svg/SVGViewSpec.cpp:
1062         (WebCore::SVGViewSpec::SVGViewSpec): Hold a weak pointer (rather than a bare pointer) to the underlying element.
1063         * svg/SVGViewSpec.h:
1064         * svg/SVGViewSpec.idl:
1065         * svg/properties/SVGAttributeOwnerProxy.cpp: Added.
1066         (WebCore::SVGAttributeOwnerProxy::SVGAttributeOwnerProxy): Hold a weak pointer (rather than a bare pointer) to
1067         the underling SVGElement.
1068         (WebCore::SVGAttributeOwnerProxy::element const): Ditto.
1069         * svg/properties/SVGAttributeOwnerProxy.h:
1070         (WebCore::SVGAttributeOwnerProxy::SVGAttributeOwnerProxy): Move implementation to cpp file.
1071         (WebCore::SVGAttributeOwnerProxy::element const): Ditto.
1072         * svg/properties/SVGAttributeOwnerProxyImpl.h: Update for WeakPtr use.
1073
1074 2018-12-10  Benjamin Poulain  <benjamin@webkit.org>
1075
1076         <rdar://problem/45296285> Content blocker rule "raw" blocks media elements from loading
1077         https://bugs.webkit.org/show_bug.cgi?id=192439
1078
1079         Reviewed by Dean Jackson.
1080
1081         This broken when WebKit switched to NSURLSession.
1082         In CachedResourceLoader::requestResource(), toResourceType() was turning media load into RAW.
1083
1084         Test: http/tests/contentextensions/video-element-resource-type.html
1085
1086         * loader/ResourceLoadInfo.cpp:
1087         (WebCore::toResourceType):
1088
1089 2018-12-10  Don Olmstead  <don.olmstead@sony.com>
1090
1091         Move ENABLE_RESOURCE_LOAD_STATISTICS to FeatureDefines.xcconfig
1092         https://bugs.webkit.org/show_bug.cgi?id=192573
1093
1094         Reviewed by Simon Fraser.
1095
1096         * Configurations/FeatureDefines.xcconfig:
1097
1098 2018-12-10  Justin Michaud  <justin_michaud@apple.com>
1099
1100         CS Painting API should support multiple worklets.
1101         https://bugs.webkit.org/show_bug.cgi?id=192335
1102
1103         Reviewed by Dean Jackson.
1104
1105         Adds a new map to support separate paint worklet global scopes (one for each worklet). Also
1106         adds some tests and a fix for a repaint bug that this oncovered, where changing a custom property required
1107         for paint would not trigger a repaint if there had not been a valid value set before.
1108
1109         Test: fast/css-custom-paint/multiple-worklets.html
1110
1111         * css/CSSPaintImageValue.cpp:
1112         (WebCore::CSSPaintImageValue::image):
1113         * css/StyleResolver.cpp:
1114         (WebCore::StyleResolver::applyProperty):
1115         * dom/Document.cpp:
1116         (WebCore::Document::prepareForDestruction):
1117         (WebCore::Document::paintWorkletGlobalScope):
1118         (WebCore::Document::setPaintWorkletGlobalScope):
1119         * dom/Document.h:
1120         (WebCore::Document::paintWorkletGlobalScope): Deleted.
1121         * rendering/style/RenderStyle.cpp:
1122         (WebCore::changedCustomPaintWatchedProperty):
1123         * worklets/Worklet.cpp:
1124         (WebCore::Worklet::addModule):
1125         * worklets/WorkletGlobalScope.cpp:
1126         (WebCore::WorkletGlobalScope::prepareForDestruction):
1127
1128 2018-12-10  Youenn Fablet  <youenn@apple.com>
1129
1130         Remove derived classes of RealtimeMediaSourceCenter
1131         https://bugs.webkit.org/show_bug.cgi?id=192546
1132
1133         Reviewed by Eric Carlson.
1134
1135         Remove virtual methods of RealtimeMediaSourceCenter and remove derived classes of it.
1136         Instead port specific implementation directly implement the needed default factory methods.
1137
1138         Renamed some methods for improved consistency.
1139         Moved some static variables as RealtimeMediaSourceCenter members.
1140
1141         No change of behavior.
1142
1143         * WebCore.xcodeproj/project.pbxproj:
1144         * page/DeprecatedGlobalSettings.cpp:
1145         * platform/mediastream/RealtimeMediaSourceCenter.cpp:
1146         (WebCore::RealtimeMediaSourceCenter::createMediaStream):
1147         (WebCore::RealtimeMediaSourceCenter::getMediaStreamDevices):
1148         (WebCore::RealtimeMediaSourceCenter::getUserMediaDevices):
1149         (WebCore::RealtimeMediaSourceCenter::setVideoCapturePageState):
1150         (WebCore::RealtimeMediaSourceCenter::setAudioFactory):
1151         (WebCore::RealtimeMediaSourceCenter::unsetAudioFactory):
1152         (WebCore::RealtimeMediaSourceCenter::audioCaptureFactory):
1153         (WebCore::RealtimeMediaSourceCenter::setVideoFactory):
1154         (WebCore::RealtimeMediaSourceCenter::unsetVideoFactory):
1155         (WebCore::RealtimeMediaSourceCenter::videoCaptureFactory):
1156         (WebCore::RealtimeMediaSourceCenter::setDisplayCaptureFactory):
1157         (WebCore::RealtimeMediaSourceCenter::unsetDisplayCaptureFactory):
1158         (WebCore::RealtimeMediaSourceCenter::displayCaptureFactory):
1159         * platform/mediastream/RealtimeMediaSourceCenter.h:
1160         * platform/mediastream/RealtimeVideoSource.cpp:
1161         (WebCore::RealtimeVideoSource::~RealtimeVideoSource):
1162         (WebCore::RealtimeVideoSource::prepareToProduceData):
1163         * platform/mediastream/gstreamer/RealtimeMediaSourceCenterLibWebRTC.cpp:
1164         (WebCore::RealtimeMediaSourceCenter::singleton):
1165         (WebCore::RealtimeMediaSourceCenter::defaultAudioCaptureFactory):
1166         (WebCore::RealtimeMediaSourceCenter::defaultVideoCaptureFactory):
1167         (WebCore::RealtimeMediaSourceCenter::defaultDisplayCaptureFactory):
1168         * platform/mediastream/gstreamer/RealtimeMediaSourceCenterLibWebRTC.h: Removed.
1169         * platform/mediastream/mac/AVVideoCaptureSource.mm:
1170         (WebCore::AVVideoCaptureSource::~AVVideoCaptureSource):
1171         (WebCore::AVVideoCaptureSource::setupCaptureSession):
1172         * platform/mediastream/mac/DisplayCaptureSourceCocoa.cpp:
1173         (WebCore::DisplayCaptureSourceCocoa::~DisplayCaptureSourceCocoa):
1174         (WebCore::DisplayCaptureSourceCocoa::startProducingData):
1175         * platform/mediastream/mac/RealtimeMediaSourceCenterMac.cpp:
1176         (WebCore::RealtimeMediaSourceCenter::singleton):
1177         (WebCore::RealtimeMediaSourceCenter::defaultAudioCaptureFactory):
1178         (WebCore::RealtimeMediaSourceCenter::defaultVideoCaptureFactory):
1179         (WebCore::RealtimeMediaSourceCenter::defaultDisplayCaptureFactory):
1180         * platform/mediastream/mac/RealtimeMediaSourceCenterMac.h: Removed.
1181         * platform/mock/MockRealtimeAudioSource.cpp:
1182         (WebCore::MockRealtimeAudioSource::~MockRealtimeAudioSource):
1183         (WebCore::MockRealtimeAudioSource::startProducingData):
1184         * platform/mock/MockRealtimeMediaSourceCenter.cpp:
1185         (WebCore::MockRealtimeMediaSourceCenter::setMockRealtimeMediaSourceCenterEnabled):
1186         (WebCore::MockRealtimeMediaSourceCenter::audioCaptureFactory):
1187         (WebCore::MockRealtimeMediaSourceCenter::videoCaptureFactory):
1188         * platform/mock/MockRealtimeMediaSourceCenter.h:
1189
1190 2018-12-10  Youenn Fablet  <youenn@apple.com>
1191
1192         DataChannels created asynchronously never open and are unusable
1193         https://bugs.webkit.org/show_bug.cgi?id=192566
1194
1195         Reviewed by Eric Carlson.
1196
1197         For every new data channel (remote or local), we should check the underlying backend state.
1198         This allows firing events if needed.
1199         We were not always doing that which was prohibiting sending some open
1200         events for data channels created after the SCTP connection is set up.
1201
1202         Covered by updated test.
1203
1204         * Modules/mediastream/libwebrtc/LibWebRTCDataChannelHandler.cpp:
1205         (WebCore::LibWebRTCDataChannelHandler::channelEvent):
1206         (WebCore::LibWebRTCDataChannelHandler::setClient):
1207         (WebCore::LibWebRTCDataChannelHandler::OnStateChange):
1208         (WebCore::LibWebRTCDataChannelHandler::checkState):
1209         * Modules/mediastream/libwebrtc/LibWebRTCDataChannelHandler.h:
1210
1211 2018-12-10  Ryosuke Niwa  <rniwa@webkit.org>
1212
1213         Use WeakPtr to refer to VTTCue in VTTCueBox
1214         https://bugs.webkit.org/show_bug.cgi?id=192575
1215
1216         Reviewed by Eric Carlson.
1217
1218         Address the FIXME in VTTCue::~VTTCue by clearing VTTCueBox::m_cue when VTTCue goes away.
1219         This is implemented by simply using WeakPtr.
1220
1221         No new tests since there shoul be no behaivoral change.
1222
1223         * html/track/TextTrackCueGeneric.cpp:
1224         (WebCore::TextTrackCueGenericBoxElement::applyCSSProperties):
1225         * html/track/VTTCue.cpp:
1226         (WebCore::VTTCueBox::VTTCueBox):
1227         (WebCore::VTTCueBox::getCue const):
1228         (WebCore::VTTCueBox::applyCSSProperties):
1229         (WebCore::VTTCue::~VTTCue):
1230         * html/track/VTTCue.h:
1231         (WebCore::VTTCueBox::fontSizeFromCaptionUserPrefs const):
1232
1233 2018-12-10  Mark Lam  <mark.lam@apple.com>
1234
1235         PropertyAttribute needs a CustomValue bit.
1236         https://bugs.webkit.org/show_bug.cgi?id=191993
1237         <rdar://problem/46264467>
1238
1239         Reviewed by Saam Barati.
1240
1241         This patch revealed a bug in the CodeGenerator where a constructor property is
1242         set with a ReadOnly attribute.  This conflicts with the WebIDL link (see clause
1243         12 in https://heycam.github.io/webidl/#interface-prototype-object) which states
1244         that it should be [Writable].  The ReadOnly attribute is now removed.
1245
1246         On the WebCore side, this change is covered by existing tests.
1247
1248         * bindings/scripts/CodeGeneratorJS.pm:
1249         (GenerateImplementation):
1250         * bindings/scripts/test/JS/JSTestCustomConstructorWithNoInterfaceObject.cpp:
1251         (WebCore::jsTestCustomConstructorWithNoInterfaceObjectConstructor):
1252
1253 2018-12-10  Antti Koivisto  <antti@apple.com>
1254
1255         Rename "forced style recalc" to "full style rebuild"
1256         https://bugs.webkit.org/show_bug.cgi?id=192572
1257
1258         Reviewed by Zalan Bujtas.
1259
1260         The old name is confusing.
1261
1262         * css/CSSComputedStyleDeclaration.cpp:
1263         (WebCore::hasValidStyleForProperty):
1264         * dom/Document.cpp:
1265         (WebCore::Document::scheduleStyleRebuild):
1266         (WebCore::Document::scheduleStyleRecalc):
1267         (WebCore::Document::unscheduleStyleRecalc):
1268         (WebCore::Document::hasPendingStyleRebuild const):
1269         (WebCore::Document::resolveStyle):
1270         (WebCore::Document::needsStyleRecalc const):
1271         (WebCore::Document::updateLayoutIgnorePendingStylesheets):
1272         (WebCore::Document::invalidateMatchedPropertiesCacheAndForceStyleRecalc):
1273         (WebCore::Document::setDesignMode):
1274         (WebCore::Document::webkitDidExitFullScreenForElement):
1275         (WebCore::Document::setAnimatingFullScreen):
1276         (WebCore::Document::setFullscreenControlsHidden):
1277         (WebCore::Document::scheduleForcedStyleRecalc): Deleted.
1278         (WebCore::Document::hasPendingForcedStyleRecalc const): Deleted.
1279         * dom/Document.h:
1280         * dom/Element.cpp:
1281         (WebCore::Element::needsStyleInvalidation const):
1282         * page/Page.cpp:
1283         (WebCore::Page::updateStyleAfterChangeInEnvironment):
1284         * style/StyleScope.cpp:
1285         (WebCore::Style::Scope::updateActiveStyleSheets):
1286
1287 2018-12-10  Alexey Proskuryakov  <ap@apple.com>
1288
1289         Include CoreGraphics.h from WebCorePrefix.h
1290         https://bugs.webkit.org/show_bug.cgi?id=192557
1291
1292         Reviewed by Tim Horton.
1293
1294         The theory is that this will improve build time. Let's try and see what bots say.
1295
1296         * WebCorePrefix.h:
1297
1298 2018-12-10  Wenson Hsieh  <wenson_hsieh@apple.com>
1299
1300         [iOS] Unable to upload data that conforms to "public.item" but not "public.content"
1301         https://bugs.webkit.org/show_bug.cgi?id=192555
1302         <rdar://problem/35204990>
1303
1304         Reviewed by Tim Horton.
1305
1306         Add support for uploading content that conforms to "public.item" via drag and drop. Currently, iOS WebKit only
1307         supports data that conforms to "public.content", but there exist several types of files that conform to
1308         "public.item" but not "public.content". See below for more detail.
1309
1310         Test: DragAndDropTests.ExternalSourcePKCS12ToSingleFileInput
1311
1312         * platform/ios/PasteboardIOS.mm:
1313         (WebCore::Pasteboard::supportedFileUploadPasteboardTypes):
1314
1315         Update this to include "public.item", and remove "public.folder", which is now redundant because "public.folder"
1316         conforms to "public.item".
1317
1318         * platform/ios/WebItemProviderPasteboard.mm:
1319         (-[NSItemProvider web_containsFileURLAndFileUploadContent]):
1320
1321         Pull out the "contains content that is supported for file uploads" part of this helper method into a separate
1322         method, and use it within `-web_containsFileURLAndFileUploadContent`. Note that this prevents "public.url"-
1323         conformant data from being uploaded as files (i.e., we never want to upload a URL string *itself* as a file).
1324         Drawing this distinction ensures that we don't confuse item providers that contain just a URL as files when
1325         dropping into a file upload area or file input (see API test: ExternalSourceZIPArchiveAndURLToSingleFileInput
1326         for an example of this corner case).
1327
1328         (-[NSItemProvider web_containsFileUploadContent]):
1329         (-[WebItemProviderPasteboard numberOfFiles]):
1330
1331         Refactor this to use `-web_containsFileUploadContent`.
1332
1333 2018-12-10  Chris Dumez  <cdumez@apple.com>
1334
1335         Add SPI to allow the client to set the user-agent at main frame level, from the UIProcess
1336         https://bugs.webkit.org/show_bug.cgi?id=192509
1337         <rdar://problem/46500832>
1338
1339         Reviewed by Alex Christensen.
1340
1341         * loader/DocumentLoader.h:
1342         (WebCore::DocumentLoader::setCustomUserAgent):
1343         (WebCore::DocumentLoader::customUserAgent const):
1344         * loader/FrameLoader.cpp:
1345         (WebCore::FrameLoader::userAgent const):
1346
1347 2018-12-10  Adrian Perez de Castro  <aperez@igalia.com>
1348
1349         [GLib] FileSystem::moveFile() should fall back to copying
1350         https://bugs.webkit.org/show_bug.cgi?id=192562
1351
1352         Reviewed by Michael Catanzaro.
1353
1354         No new tests needed.
1355
1356         * platform/glib/FileSystemGlib.cpp:
1357         (WebCore::FileSystem::moveFile): Use g_file_move() instead of a plain g_rename(), which
1358         provides a fall-back which does copy+delete when a direct move or rename cannot be done.
1359
1360 2018-12-10  Simon Fraser  <simon.fraser@apple.com>
1361
1362         Allow control over child order when adding nodes to the scrolling tree
1363         https://bugs.webkit.org/show_bug.cgi?id=176914
1364         <rdar://problem/46542237>
1365         
1366         Re-land r239010 after over-zealous rollout.
1367
1368         * page/scrolling/AsyncScrollingCoordinator.cpp:
1369         (WebCore::AsyncScrollingCoordinator::attachToStateTree):
1370         (WebCore::AsyncScrollingCoordinator::ensureRootStateNodeForFrameView):
1371         * page/scrolling/AsyncScrollingCoordinator.h:
1372         * page/scrolling/ScrollingCoordinator.h:
1373         (WebCore::ScrollingCoordinator::attachToStateTree):
1374         * page/scrolling/ScrollingStateNode.cpp:
1375         (WebCore::ScrollingStateNode::insertChild):
1376         (WebCore::ScrollingStateNode::indexOfChild const):
1377         * page/scrolling/ScrollingStateNode.h:
1378         * page/scrolling/ScrollingStateTree.cpp:
1379         (WebCore::ScrollingStateTree::nodeTypeAndParentMatch const):
1380         (WebCore::ScrollingStateTree::attachNode):
1381         * page/scrolling/ScrollingStateTree.h:
1382
1383 2018-12-10  Antti Koivisto  <antti@apple.com>
1384
1385         Document should throttle style recalc even when m_pendingStyleRecalcShouldForce is true.
1386         https://bugs.webkit.org/show_bug.cgi?id=191695
1387
1388         Reviewed by Zalan Bujtas.
1389
1390         * dom/Document.cpp:
1391         (WebCore::Document::scheduleStyleRecalc):
1392
1393         Don't test for m_pendingStyleRecalcShouldForce.
1394
1395         (WebCore::Document::hasPendingStyleRecalc const):
1396         (WebCore::Document::hasPendingForcedStyleRecalc const):
1397
1398         Don't base the pending status of these function on whether the timer is running.
1399         Instead check if the style is invalid.
1400
1401 2018-12-10  Rob Buis  <rbuis@igalia.com>
1402
1403         XMLHttpRequest removes spaces from content-types before processing
1404         https://bugs.webkit.org/show_bug.cgi?id=8644
1405
1406         Reviewed by Chris Dumez.
1407
1408         Stop trimming white space characters from the middle of
1409         type/subtype value. Also make sure whitespace being parsed
1410         adheres to OWS definition from RFC 7230 Section 3.2.3
1411         (referenced by RFC 7231), i.e. space or HT.
1412
1413         Based on http://crrev.com/416586.
1414
1415         Behavior matches Firefox and Chrome.
1416
1417         Tests: http/tests/xmlhttprequest/supported-xml-content-types.html
1418                web-platform-tests/mimesniff/mime-types/parsing.any.html
1419                web-platform-tests/mimesniff/mime-types/parsing.any.worker.html
1420
1421         * platform/network/HTTPParsers.cpp:
1422         (WebCore::extractMIMETypeFromMediaType):
1423
1424 2018-12-10  Wenson Hsieh  <wenson_hsieh@apple.com>
1425
1426         [iOS] Caret is obscured by finger when dragging over an editable element
1427         https://bugs.webkit.org/show_bug.cgi?id=192499
1428         <rdar://problem/46570101>
1429
1430         Reviewed by Tim Horton.
1431
1432         * page/DragActions.h:
1433
1434         Move DragHandlingMethod to DragActions.h, and drive-by fix some minor issues (i.e. make a couple of enum classes
1435         use 8 bits, fix the indentation levels, and update the copyright year). Also add `EnumTraits` for
1436         DragHandlingMethod so that it may be encoded over IPC.
1437
1438         * page/DragController.cpp:
1439         (WebCore::dragIsHandledByDocument):
1440
1441         Simplify this helper function.
1442
1443         (WebCore::DragController::tryDocumentDrag):
1444         * page/DragController.h:
1445
1446         Expose the current DragHandlingMethod via a const getter method.
1447
1448         (WebCore::DragController::dragHandlingMethod const):
1449
1450 2018-12-10  Youenn Fablet  <youenn@apple.com>
1451
1452         Make mock capture happen in the process used for real capture
1453         https://bugs.webkit.org/show_bug.cgi?id=192544
1454
1455         Reviewed by Eric Carlson.
1456
1457         MockRealtimeMediaSourceCenter previously was setting its factories whenever mock capture is on.
1458         Add booleans to choose which source (audio, video, display) will actually be toggled on.
1459
1460         Covered by existing tests.
1461
1462         * platform/mock/MockRealtimeMediaSourceCenter.cpp:
1463         (WebCore::MockRealtimeMediaSourceCenter::setMockRealtimeMediaSourceCenterEnabled):
1464         * platform/mock/MockRealtimeMediaSourceCenter.h:
1465         (WebCore::MockRealtimeMediaSourceCenter::setMockAudioCaptureEnabled):
1466         (WebCore::MockRealtimeMediaSourceCenter::setMockVideoCaptureEnabled):
1467         (WebCore::MockRealtimeMediaSourceCenter::setMockDisplayCaptureEnabled):
1468
1469 2018-12-10  Dean Jackson  <dino@apple.com>
1470
1471         Use text/javascript as recommended by the HTML specification
1472         https://bugs.webkit.org/show_bug.cgi?id=192525
1473         <rdar://problem/46569636>
1474
1475         Reviewed by Jon Lee.
1476
1477         The HTML specification says we should use text/javascript for
1478         JavaScript files:
1479         https://html.spec.whatwg.org/multipage/scripting.html#scriptingLanguages:javascript-mime-type
1480
1481         * loader/cache/CachedScript.cpp: Replace application/javascript with text/javascript.
1482         (WebCore::CachedScript::CachedScript):
1483         * platform/network/ios/WebCoreURLResponseIOS.mm: Ditto.
1484         (WebCore::createExtensionToMIMETypeMap):
1485         * platform/network/mac/WebCoreURLResponse.mm: Ditto.
1486         (WebCore::createExtensionToMIMETypeMap):
1487
1488 2018-12-10  Dean Jackson  <dino@apple.com>
1489
1490         [iOS] Make WebGPU work with remote layer hosting
1491         https://bugs.webkit.org/show_bug.cgi?id=192508
1492         <rdar://problem/46560649>
1493
1494         Reviewed by Tim Horton.
1495
1496         WebGPU wasn't working on iOS because we were not correctly
1497         identifying the CALayers for remote hosting. Fix this by
1498         adding a new CALayer type, WebGPULayer. This will also
1499         eventually hold the code to render WebGPU into a canvas.
1500
1501         Covered by the existing reference tests (on device).
1502
1503         * SourcesCocoa.txt: Add new files.
1504         * WebCore.xcodeproj/project.pbxproj: Ditto.
1505
1506         * platform/graphics/ca/cocoa/PlatformCALayerCocoa.mm: Recognise the WebGPULayer
1507         class for remote hosting.
1508         (WebCore::PlatformCALayerCocoa::layerTypeForPlatformLayer):
1509         (WebCore::PlatformCALayerCocoa::PlatformCALayerCocoa):
1510
1511         * platform/graphics/cocoa/WebGPULayer.h: Added. Very simple inheritance
1512         from CAMetalLayer.
1513         * platform/graphics/cocoa/WebGPULayer.mm: Added.
1514         (-[WebGPULayer init]):
1515         (-[WebGPULayer copyImageSnapshotWithColorSpace:]):
1516
1517         * platform/graphics/gpu/GPUSwapChain.h: Reference WebGPULayer rather
1518         than CALayer.
1519
1520         * platform/graphics/gpu/cocoa/GPUSwapChainMetal.mm: Ensure that
1521         the WebGPULayer has a reference back to this object, which it
1522         will use in the future.
1523         (WebCore::GPUSwapChain::create):
1524         (WebCore::GPUSwapChain::GPUSwapChain):
1525
1526 2018-12-10  Truitt Savell  <tsavell@apple.com>
1527
1528         Unreviewed, rolling out r238965.
1529
1530         Caused internal iOS build failures
1531
1532         Reverted changeset:
1533
1534         "[iOS] Make WebGPU work with remote layer hosting"
1535         https://bugs.webkit.org/show_bug.cgi?id=192508
1536         https://trac.webkit.org/changeset/238965
1537
1538 2018-12-10  Youenn Fablet  <youenn@apple.com>
1539
1540         MockLibWebRTCPeerConnectionFactory should isolate copy its test case
1541         https://bugs.webkit.org/show_bug.cgi?id=192545
1542
1543         Reviewed by Eric Carlson.
1544
1545         Isolate copy the test case member so that it can be destroyed on another thread.
1546         Covered by existing test that should no longer crash.
1547
1548         * testing/MockLibWebRTCPeerConnection.cpp:
1549         (WebCore::useMockRTCPeerConnectionFactory):
1550         (WebCore::MockLibWebRTCPeerConnectionFactory::MockLibWebRTCPeerConnectionFactory):
1551         * testing/MockLibWebRTCPeerConnection.h:
1552         (WebCore::MockLibWebRTCPeerConnectionFactory::create):
1553
1554 2018-12-09  Youenn Fablet  <youenn@apple.com>
1555
1556         Move capture manager from RealtimeMediaSourceCenter to capture factory
1557         https://bugs.webkit.org/show_bug.cgi?id=192542
1558
1559         Reviewed by Eric Carlson.
1560
1561         We should be able to run mock captures in wither UIProcess or WebProcess.
1562         Currently, mock capture is only done in WebProcess.
1563         This patch is a first step towards that goal.
1564
1565         It also simplifies RealtimeMediaSourceCenter implementation by starting to remove virtual methods.
1566         Further refactoring will remove the need to subclass RealtimeMediaSourceCenter.
1567         Instead, remaining virtual methods will become non virtual and their
1568         implementation will become port specific.
1569
1570         Removed a JS internal method that is not longer used to further simplify RealtimeMediaSourceCenter.
1571
1572         No visible change of behavior.
1573         Covered by existing tests.
1574
1575         * platform/mediastream/CaptureDeviceManager.h:
1576         * platform/mediastream/RealtimeMediaSourceCenter.cpp:
1577         (WebCore::RealtimeMediaSourceCenter::singleton):
1578         (WebCore::RealtimeMediaSourceCenter::getMediaStreamDevices):
1579         (WebCore::RealtimeMediaSourceCenter::getDisplayMediaDevices):
1580         (WebCore::RealtimeMediaSourceCenter::getUserMediaDevices):
1581         (WebCore::RealtimeMediaSourceCenter::captureDeviceWithPersistentID):
1582         (WebCore::RealtimeMediaSourceCenter::unsetAudioFactory):
1583         (WebCore::RealtimeMediaSourceCenter::unsetVideoFactory):
1584         (WebCore::RealtimeMediaSourceCenter::unsetDisplayCaptureFactory):
1585         * platform/mediastream/RealtimeMediaSourceCenter.h:
1586         * platform/mediastream/RealtimeMediaSourceFactory.h:
1587         * platform/mediastream/gstreamer/GStreamerAudioCaptureSource.cpp:
1588         * platform/mediastream/gstreamer/GStreamerVideoCaptureSource.cpp:
1589         * platform/mediastream/gstreamer/RealtimeMediaSourceCenterLibWebRTC.cpp:
1590         * platform/mediastream/gstreamer/RealtimeMediaSourceCenterLibWebRTC.h:
1591         * platform/mediastream/mac/CoreAudioCaptureSource.cpp:
1592         (WebCore::CoreAudioCaptureSourceFactory::audioCaptureDeviceManager):
1593         * platform/mediastream/mac/CoreAudioCaptureSource.h:
1594         * platform/mediastream/mac/RealtimeMediaSourceCenterMac.cpp:
1595         * platform/mediastream/mac/RealtimeMediaSourceCenterMac.h:
1596         * platform/mock/MockRealtimeMediaSourceCenter.cpp:
1597         (WebCore::MockRealtimeMediaSourceCenter::setMockRealtimeMediaSourceCenterEnabled):
1598         (WebCore::MockRealtimeMediaSourceCenter::audioFactory):
1599         (WebCore::MockRealtimeMediaSourceCenter::videoFactory):
1600         (WebCore::MockRealtimeMediaSourceCenter::displayCaptureFactory):
1601         * platform/mock/MockRealtimeMediaSourceCenter.h:
1602         (WebCore::MockRealtimeMediaSourceCenter::audioCaptureDeviceManager):
1603         (WebCore::MockRealtimeMediaSourceCenter::videoCaptureDeviceManager):
1604         (WebCore::MockRealtimeMediaSourceCenter::displayCaptureDeviceManager):
1605         * testing/Internals.cpp:
1606         * testing/Internals.h:
1607         * testing/Internals.idl:
1608
1609 2018-12-09  Commit Queue  <commit-queue@webkit.org>
1610
1611         Unreviewed, rolling out r239010.
1612         https://bugs.webkit.org/show_bug.cgi?id=192537
1613
1614         Breaks fast/visual-viewport/tiled-drawing/zoomed-fixed-
1615         scrolling-layers-state.html again (Requested by ap on
1616         #webkit).
1617
1618         Reverted changeset:
1619
1620         "Allow control over child order when adding nodes to the
1621         scrolling tree"
1622         https://bugs.webkit.org/show_bug.cgi?id=176914
1623         https://trac.webkit.org/changeset/239010
1624
1625 2018-12-08  Eric Carlson  <eric.carlson@apple.com>
1626
1627         [MediaStream] Scaled video frames should be resized in letterbox mode
1628         https://bugs.webkit.org/show_bug.cgi?id=192528
1629         <rdar://problem/46576638>
1630
1631         Reviewed by Darin Adler.
1632
1633         Test: fast/mediastream/resize-letterbox.html
1634
1635         * platform/graphics/cv/ImageTransferSessionVT.mm:
1636         (WebCore::ImageTransferSessionVT::ImageTransferSessionVT): Use letterbox resize mode, not trim.
1637
1638         * platform/mock/MockRealtimeVideoSource.cpp:
1639         (WebCore::MockRealtimeVideoSource::captureSize const): "Capture" at the preset size, not 
1640         necessarily at the requested size to be more like a physical camera.
1641         (WebCore::MockRealtimeVideoSource::settingsDidChange):
1642         (WebCore::MockRealtimeVideoSource::drawAnimation):
1643         (WebCore::MockRealtimeVideoSource::drawBoxes):
1644         (WebCore::MockRealtimeVideoSource::drawText):
1645         (WebCore::MockRealtimeVideoSource::generateFrame):
1646         (WebCore::MockRealtimeVideoSource::imageBuffer const):
1647         * platform/mock/MockRealtimeVideoSource.h:
1648
1649 2018-12-08  Alex Christensen  <achristensen@webkit.org>
1650
1651         Don't programmatically capitalize safe browsing warning buttons
1652         https://bugs.webkit.org/show_bug.cgi?id=192531
1653         <rdar://problem/46417791>
1654
1655         Reviewed by Darin Adler.
1656
1657         This doesn't work so well in other languages.
1658         Capitalize the source strings in English instead.
1659
1660         * en.lproj/Localizable.strings:
1661
1662 2018-12-08  Frederic Wang  <fwang@igalia.com>
1663
1664         Allow control over child order when adding nodes to the scrolling tree
1665         https://bugs.webkit.org/show_bug.cgi?id=176914
1666         <rdar://problem/46542237>
1667
1668         Reviewed by Simon Fraser.
1669
1670         Based on an earlier patch by Simon Fraser.
1671
1672         Previously ScrollingCoordinator just allowed nodes to be "attached" with a given parent,
1673         but with no control over sibling order. To allow for correct hit-testing overflow and
1674         frame scrolling nodes, we have to build the scrolling tree in z-order.
1675
1676         This patch adds a 'childIndex' parameter to attachNode() which gives control over
1677         sibling order. For now, RenderLayerCompositor always uses the default 'notFound' value
1678         for childIndex so the current behavior (appending new nodes at the end of child list) is
1679         preserved.
1680
1681         One test marked as flakey, since scrolling tree order is currently dependent on HashSet
1682         traversal order.
1683
1684         * page/scrolling/AsyncScrollingCoordinator.cpp:
1685         (WebCore::AsyncScrollingCoordinator::attachToStateTree):
1686         (WebCore::AsyncScrollingCoordinator::ensureRootStateNodeForFrameView):
1687         * page/scrolling/AsyncScrollingCoordinator.h:
1688         * page/scrolling/ScrollingCoordinator.h:
1689         (WebCore::ScrollingCoordinator::attachToStateTree):
1690         * page/scrolling/ScrollingStateNode.cpp:
1691         (WebCore::ScrollingStateNode::insertChild):
1692         (WebCore::ScrollingStateNode::indexOfChild const):
1693         * page/scrolling/ScrollingStateNode.h:
1694         * page/scrolling/ScrollingStateTree.cpp:
1695         (WebCore::ScrollingStateTree::nodeTypeAndParentMatch const):
1696         (WebCore::ScrollingStateTree::attachNode):
1697         * page/scrolling/ScrollingStateTree.h:
1698
1699 2018-12-07  Eric Carlson  <eric.carlson@apple.com>
1700
1701         [MediaStream] 'devicechange' event should not fire in frames that can't access capture devices
1702         https://bugs.webkit.org/show_bug.cgi?id=192511
1703         <rdar://problem/46562063>
1704
1705         Reviewed by Youenn Fablet.
1706
1707         Test: http/tests/media/media-stream/device-change-event-in-iframe.html
1708
1709         * Modules/mediastream/MediaDevices.cpp:
1710         (WebCore::MediaDevices::addEventListener): Don't fire the event unless the document can
1711         access a camera or microphone.
1712
1713 2018-12-07  Eric Carlson  <eric.carlson@apple.com>
1714
1715         [MediaStream] Address post-review comments after r238904
1716         https://bugs.webkit.org/show_bug.cgi?id=192514
1717         <rdar://problem/46564302>
1718
1719         Reviewed by Youenn Fablet.
1720
1721         No new tests, no functional change.
1722
1723         * platform/graphics/cv/ImageTransferSessionVT.mm:
1724         (WebCore::ImageTransferSessionVT::setSize):
1725         * platform/mediastream/mac/ScreenDisplayCaptureSourceMac.mm:
1726         (WebCore::ScreenDisplayCaptureSourceMac::createDisplayStream):
1727
1728 2018-12-07  Antti Koivisto  <antti@apple.com>
1729
1730         [LFC] Rename LayoutFormattingState files to LayoutState
1731         https://bugs.webkit.org/show_bug.cgi?id=192520
1732
1733         Reviewed by Zalan Bujtas.
1734
1735         Match the class name.
1736
1737         * layout/FormattingContext.cpp:
1738         * layout/FormattingContextQuirks.cpp:
1739         * layout/FormattingState.h:
1740         * layout/LayoutFormattingState.cpp: Removed.
1741         * layout/LayoutFormattingState.h: Removed.
1742         * layout/LayoutState.cpp: Copied from Source/WebCore/layout/LayoutFormattingState.cpp.
1743         * layout/LayoutState.h: Copied from Source/WebCore/layout/LayoutFormattingState.h.
1744         * layout/Verification.cpp:
1745         * layout/blockformatting/BlockFormattingContext.cpp:
1746         * layout/blockformatting/BlockFormattingContextQuirks.cpp:
1747         * layout/blockformatting/BlockInvalidation.cpp:
1748         * layout/floats/FloatAvoider.cpp:
1749         * layout/floats/FloatingContext.cpp:
1750         * layout/floats/FloatingState.cpp:
1751         * layout/inlineformatting/InlineFormattingContext.cpp:
1752         * layout/inlineformatting/InlineFormattingContextGeometry.cpp:
1753         * layout/inlineformatting/InlineInvalidation.cpp:
1754         * layout/layouttree/LayoutTreeBuilder.cpp:
1755         * page/FrameViewLayoutContext.cpp:
1756
1757 2018-12-07  Justin Michaud  <justin_michaud@apple.com>
1758
1759         CSS Painting API code cleanup
1760         https://bugs.webkit.org/show_bug.cgi?id=192480
1761
1762         Reviewed by Dean Jackson.
1763
1764         No new tests, since the existing tests should cover it.
1765
1766         * bindings/js/JSDOMWrapper.cpp:
1767         (WebCore::outputConstraintSubspaceFor):
1768         (WebCore::globalObjectOutputConstraintSubspaceFor):
1769         * bindings/js/JSWorkletGlobalScopeBase.cpp:
1770         (WebCore::toJS):
1771         * css/CSSPaintCallback.h:
1772         * platform/graphics/CustomPaintImage.cpp:
1773         (WebCore::CustomPaintImage::doCustomPaint):
1774         * platform/graphics/CustomPaintImage.h:
1775         * rendering/style/RenderStyle.cpp:
1776         (WebCore::RenderStyle::addCustomPaintWatchProperty):
1777         (WebCore::changedCustomPaintWatchedProperty):
1778         (WebCore::RenderStyle::changeRequiresRepaint const):
1779         * worklets/PaintWorkletGlobalScope.cpp:
1780         (WebCore::PaintWorkletGlobalScope::registerPaint):
1781         * worklets/PaintWorkletGlobalScope.h:
1782
1783 2018-12-07  Youenn Fablet  <youenn@apple.com>
1784
1785         Update libwebrtc up to 0d007d7c4f
1786         https://bugs.webkit.org/show_bug.cgi?id=192316
1787
1788         Reviewed by Eric Carlson.
1789
1790         Update include according new libwebrtc.
1791
1792         * platform/mediastream/libwebrtc/LibWebRTCProvider.cpp:
1793
1794 2018-12-07  Dean Jackson  <dino@apple.com>
1795
1796         [iOS] Make WebGPU work with remote layer hosting
1797         https://bugs.webkit.org/show_bug.cgi?id=192508
1798         <rdar://problem/46560649>
1799
1800         Reviewed by Tim Horton.
1801
1802         WebGPU wasn't working on iOS because we were not correctly
1803         identifying the CALayers for remote hosting. Fix this by
1804         adding a new CALayer type, WebGPULayer. This will also
1805         eventually hold the code to render WebGPU into a canvas.
1806
1807         Covered by the existing reference tests (on device).
1808
1809         * SourcesCocoa.txt: Add new files.
1810         * WebCore.xcodeproj/project.pbxproj: Ditto.
1811
1812         * platform/graphics/ca/cocoa/PlatformCALayerCocoa.mm: Recognise the WebGPULayer
1813         class for remote hosting.
1814         (WebCore::PlatformCALayerCocoa::layerTypeForPlatformLayer):
1815         (WebCore::PlatformCALayerCocoa::PlatformCALayerCocoa):
1816
1817         * platform/graphics/cocoa/WebGPULayer.h: Added. Very simple inheritance
1818         from CAMetalLayer.
1819         * platform/graphics/cocoa/WebGPULayer.mm: Added.
1820         (-[WebGPULayer init]):
1821         (-[WebGPULayer copyImageSnapshotWithColorSpace:]):
1822
1823         * platform/graphics/gpu/GPUSwapChain.h: Reference WebGPULayer rather
1824         than CALayer.
1825
1826         * platform/graphics/gpu/cocoa/GPUSwapChainMetal.mm: Ensure that
1827         the WebGPULayer has a reference back to this object, which it
1828         will use in the future.
1829         (WebCore::GPUSwapChain::create):
1830         (WebCore::GPUSwapChain::GPUSwapChain):
1831
1832 2018-12-07  Antti Koivisto  <antti@apple.com>
1833
1834         Rename LayoutState to RenderLayoutState
1835         https://bugs.webkit.org/show_bug.cgi?id=192504
1836
1837         Reviewed by Zalan Bujtas.
1838
1839         The name is better used in LFC.
1840
1841         * Sources.txt:
1842         * WebCore.xcodeproj/project.pbxproj:
1843         * page/FrameViewLayoutContext.cpp:
1844         (WebCore::FrameViewLayoutContext::layoutState const):
1845         (WebCore::FrameViewLayoutContext::pushLayoutState):
1846         (WebCore::FrameViewLayoutContext::pushLayoutStateForPaginationIfNeeded):
1847         * page/FrameViewLayoutContext.h:
1848         * rendering/LayoutState.cpp: Removed.
1849         * rendering/LayoutState.h: Removed.
1850         * rendering/RenderBlock.cpp:
1851         * rendering/RenderBlock.h:
1852         * rendering/RenderBlockFlow.cpp:
1853         (WebCore::RenderBlockFlow::checkForPaginationLogicalHeightChange):
1854         * rendering/RenderBlockLineLayout.cpp:
1855         * rendering/RenderBox.cpp:
1856         * rendering/RenderEmbeddedObject.cpp:
1857         * rendering/RenderFragmentedFlow.cpp:
1858         * rendering/RenderGrid.cpp:
1859         * rendering/RenderImage.cpp:
1860         * rendering/RenderInline.cpp:
1861         * rendering/RenderLayoutState.cpp: Copied from Source/WebCore/rendering/LayoutState.cpp.
1862         (WebCore::RenderLayoutState::RenderLayoutState):
1863         (WebCore::RenderLayoutState::computeOffsets):
1864         (WebCore::RenderLayoutState::computeClipRect):
1865         (WebCore::RenderLayoutState::computePaginationInformation):
1866         (WebCore::RenderLayoutState::pageLogicalOffset const):
1867         (WebCore::RenderLayoutState::computeLineGridPaginationOrigin):
1868         (WebCore::RenderLayoutState::propagateLineGridInfo):
1869         (WebCore::RenderLayoutState::establishLineGrid):
1870         (WebCore::RenderLayoutState::addLayoutDelta):
1871         (WebCore::RenderLayoutState::layoutDeltaMatches const):
1872         (WebCore::LayoutState::LayoutState): Deleted.
1873         (WebCore::LayoutState::computeOffsets): Deleted.
1874         (WebCore::LayoutState::computeClipRect): Deleted.
1875         (WebCore::LayoutState::computePaginationInformation): Deleted.
1876         (WebCore::LayoutState::pageLogicalOffset const): Deleted.
1877         (WebCore::LayoutState::computeLineGridPaginationOrigin): Deleted.
1878         (WebCore::LayoutState::propagateLineGridInfo): Deleted.
1879         (WebCore::LayoutState::establishLineGrid): Deleted.
1880         (WebCore::LayoutState::addLayoutDelta): Deleted.
1881         (WebCore::LayoutState::layoutDeltaMatches const): Deleted.
1882         * rendering/RenderLayoutState.h: Copied from Source/WebCore/rendering/LayoutState.h.
1883         (WebCore::RenderLayoutState::RenderLayoutState):
1884         (WebCore::LayoutState::LayoutState): Deleted.
1885         (WebCore::LayoutState::isPaginated const): Deleted.
1886         (WebCore::LayoutState::pageLogicalHeight const): Deleted.
1887         (WebCore::LayoutState::pageLogicalHeightChanged const): Deleted.
1888         (WebCore::LayoutState::lineGrid const): Deleted.
1889         (WebCore::LayoutState::lineGridOffset const): Deleted.
1890         (WebCore::LayoutState::lineGridPaginationOrigin const): Deleted.
1891         (WebCore::LayoutState::paintOffset const): Deleted.
1892         (WebCore::LayoutState::layoutOffset const): Deleted.
1893         (WebCore::LayoutState::pageOffset const): Deleted.
1894         (WebCore::LayoutState::needsBlockDirectionLocationSetBeforeLayout const): Deleted.
1895         (WebCore::LayoutState::renderer const): Deleted.
1896         (WebCore::LayoutState::clipRect const): Deleted.
1897         (WebCore::LayoutState::isClipped const): Deleted.
1898         (WebCore::LayoutState::layoutDelta const): Deleted.
1899         * rendering/RenderListBox.cpp:
1900         * rendering/RenderMediaControlElements.cpp:
1901         * rendering/RenderMultiColumnFlow.cpp:
1902         * rendering/RenderTable.cpp:
1903         * rendering/RenderTableRow.cpp:
1904         * rendering/RenderTableSection.cpp:
1905         * rendering/RenderVTTCue.cpp:
1906         * rendering/RenderView.cpp:
1907         * rendering/RenderView.h:
1908         * rendering/RootInlineBox.cpp:
1909         * rendering/svg/RenderSVGRoot.cpp:
1910         (WebCore::RenderSVGRoot::layout):
1911
1912 2018-12-07  Antti Koivisto  <antti@apple.com>
1913
1914         [LFC] Rename formattingContext() to createFormattingContext()
1915         https://bugs.webkit.org/show_bug.cgi?id=192500
1916
1917         Reviewed by Zalan Bujtas.
1918
1919         * layout/FormattingContext.cpp:
1920         (WebCore::Layout::FormattingContext::layoutOutOfFlowDescendants const):
1921         * layout/FormattingState.h:
1922         * layout/LayoutFormattingState.cpp:
1923         (WebCore::Layout::LayoutState::layoutFormattingContextSubtree):
1924         * layout/blockformatting/BlockFormattingState.cpp:
1925         (WebCore::Layout::BlockFormattingState::createFormattingContext):
1926         (WebCore::Layout::BlockFormattingState::formattingContext): Deleted.
1927         * layout/blockformatting/BlockFormattingState.h:
1928         * layout/inlineformatting/InlineFormattingContext.cpp:
1929         (WebCore::Layout::InlineFormattingContext::layoutFormattingContextRoot const):
1930         * layout/inlineformatting/InlineFormattingState.h:
1931
1932 2018-12-07  Truitt Savell  <tsavell@apple.com>
1933
1934         Unreviewed, rolling out r238947.
1935
1936         Revision caused fast/visual-viewport/tiled-drawing/zoomed-
1937         fixed-scrolling-layers-state.html to constantly fail
1938
1939         Reverted changeset:
1940
1941         "Allow control over child order when adding nodes to the
1942         scrolling tree"
1943         https://bugs.webkit.org/show_bug.cgi?id=176914
1944         https://trac.webkit.org/changeset/238947
1945
1946 2018-12-07  Wenson Hsieh  <wenson_hsieh@apple.com>
1947
1948         [Attachment Support] Cloned attachment elements lose their unique identifiers
1949         https://bugs.webkit.org/show_bug.cgi?id=192483
1950
1951         Reviewed by Tim Horton.
1952
1953         This patch adds logic to ensure that the unique identifier of a cloned attachment element is the same as the
1954         unique identifier of the original attachment element. If the cloned attachment is inserted into the same
1955         document as the original attachment, then we will exercise the same codepath for copied-and-pasted attachments,
1956         and assign a new unique identifier to the attachment element, while creating a new `_WKAttachment` in the client
1957         that's backed by the same `NSFileWrapper`.
1958
1959         Test: WKAttachmentTests.AttachmentIdentifierOfClonedAttachment
1960
1961         * html/HTMLAttachmentElement.cpp:
1962         (WebCore::HTMLAttachmentElement::copyNonAttributePropertiesFromElement):
1963         * html/HTMLAttachmentElement.h:
1964
1965 2018-12-07  Rob Buis  <rbuis@igalia.com>
1966
1967         Merge parseAccessControlExposeHeadersAllowList into parseAccessControlAllowList
1968         https://bugs.webkit.org/show_bug.cgi?id=192288
1969
1970         Reviewed by Frédéric Wang.
1971
1972         Merge parseAccessControlExposeHeadersAllowList into parseAccessControlAllowList
1973         as they do the same thing. Also remove std::optional from parseAccessControlAllowList
1974         since the function can't fail.
1975
1976         * WebCore.order:
1977         * loader/CrossOriginAccessControl.cpp:
1978         (WebCore::validatePreflightResponse):
1979         * loader/CrossOriginPreflightResultCache.cpp:
1980         (WebCore::CrossOriginPreflightResultCacheItem::parse):
1981         * loader/CrossOriginPreflightResultCache.h:
1982         * platform/network/HTTPParsers.cpp:
1983         (WebCore::parseAccessControlExposeHeadersAllowList): Deleted.
1984         * platform/network/HTTPParsers.h:
1985         (WebCore::parseAccessControlAllowList):
1986         * platform/network/ResourceResponseBase.cpp:
1987         (WebCore::ResourceResponseBase::filter):
1988         (WebCore::ResourceResponseBase::sanitizeHTTPHeaderFieldsAccordingToTainting):
1989
1990 2018-12-07  Eric Carlson  <eric.carlson@apple.com>
1991
1992         [iOS] Don't update AVPlayerViewController currentTime while scrubbing
1993         https://bugs.webkit.org/show_bug.cgi?id=192438
1994         <rdar://problem/42977046>
1995
1996         Reviewed by Jer Noble.
1997
1998         No new tests, tested manually.
1999
2000         * platform/ios/PlaybackSessionInterfaceAVKit.mm:
2001         (WebCore::PlaybackSessionInterfaceAVKit::currentTimeChanged): Don't report change during scrubbing.
2002
2003         * platform/ios/WebAVPlayerController.h:
2004         * platform/ios/WebAVPlayerController.mm:
2005         (-[WebAVPlayerController beginScrubbing:]): Set _isScrubbing.
2006         (-[WebAVPlayerController endScrubbing:]): Ditto.
2007         (-[WebAVPlayerController isScrubbing]): Return _isScrubbing.
2008
2009 2018-12-07  Thibault Saunier  <tsaunier@igalia.com>
2010
2011         [WPE][GTK] Implement WebAudioSourceProviderGStreamer to allow bridging MediaStream and the WebAudio APIs
2012         https://bugs.webkit.org/show_bug.cgi?id=186933
2013
2014         Reusing the AudioSourceProviderGStreamer itself as it was doing almost everything we needed,
2015         just added a constructor to be able to create it from a MediaStreamTrackPrivate and made it a
2016         WebAudioSourceProvider which only means it is now a ThreadSafeRefCounted.
2017
2018         Sensibily refactored GStreamerMediaStreamSource so that we could reuse it to track a single
2019         MediaStreamTrack.
2020
2021         Reviewed by Philippe Normand.
2022
2023         Enabled all tests depending on that feature.
2024
2025         * platform/audio/gstreamer/AudioSourceProviderGStreamer.cpp:
2026         (WebCore::AudioSourceProviderGStreamer::AudioSourceProviderGStreamer):
2027         (WebCore::AudioSourceProviderGStreamer::~AudioSourceProviderGStreamer):
2028         (WebCore::AudioSourceProviderGStreamer::setClient):
2029         * platform/audio/gstreamer/AudioSourceProviderGStreamer.h:
2030         * platform/mediastream/MediaStreamTrackPrivate.cpp:
2031         (WebCore::MediaStreamTrackPrivate::audioSourceProvider):
2032         * platform/mediastream/gstreamer/GStreamerAudioCapturer.cpp:
2033         (WebCore::GStreamerAudioCapturer::GStreamerAudioCapturer):
2034         * platform/mediastream/gstreamer/GStreamerAudioStreamDescription.h:
2035         * platform/mediastream/gstreamer/GStreamerMediaStreamSource.cpp:
2036         (WebCore::webkitMediaStreamSrcSetupSrc):
2037         (WebCore::webkitMediaStreamSrcSetupAppSrc):
2038         (WebCore::webkitMediaStreamSrcAddTrack):
2039         (WebCore::webkitMediaStreamSrcSetStream):
2040         (WebCore::webkitMediaStreamSrcNew):
2041         * platform/mediastream/gstreamer/GStreamerMediaStreamSource.h:
2042         * platform/mediastream/gstreamer/MockGStreamerAudioCaptureSource.cpp:
2043         (WebCore::WrappedMockRealtimeAudioSource::WrappedMockRealtimeAudioSource):
2044         (WebCore::WrappedMockRealtimeAudioSource::start):
2045         (WebCore::WrappedMockRealtimeAudioSource::addHum):
2046         (WebCore::WrappedMockRealtimeAudioSource::render):
2047         (WebCore::WrappedMockRealtimeAudioSource::settingsDidChange):
2048         (WebCore::MockGStreamerAudioCaptureSource::startProducingData):
2049         * platform/mediastream/gstreamer/RealtimeOutgoingAudioSourceLibWebRTC.cpp:
2050         (WebCore::RealtimeOutgoingAudioSourceLibWebRTC::pullAudioData): Handle the case where input buffers
2051           are "big" and process all the data we can for each runs of the method.
2052
2053 2018-12-06  Alexey Proskuryakov  <ap@apple.com>
2054
2055         Move USE_NEW_THEME out of WebCore's config.h
2056         https://bugs.webkit.org/show_bug.cgi?id=192426
2057
2058         Reviewed by Tim Horton.
2059
2060         * config.h:
2061
2062 2018-12-06  Frederic Wang  <fwang@igalia.com>
2063
2064         Allow control over child order when adding nodes to the scrolling tree
2065         https://bugs.webkit.org/show_bug.cgi?id=176914
2066
2067         Reviewed by Simon Fraser.
2068
2069         Based on an earlier patch by Simon Fraser.
2070
2071         Previously ScrollingCoordinator just allowed nodes to be "attached" with a given parent,
2072         but with no control over sibling order. To allow for correct hit-testing overflow and
2073         frame scrolling nodes, we have to build the scrolling tree in z-order.
2074
2075         This patch adds a 'childIndex' parameter to attachNode() which gives control over
2076         sibling order. For now, RenderLayerCompositor always uses the default 'notFound' value
2077         for childIndex so the current behavior (appending new nodes at the end of child list) is
2078         preserved.
2079
2080         No new tests, behavior unchanged and already covered by existing tests.
2081
2082         * page/scrolling/AsyncScrollingCoordinator.cpp:
2083         (WebCore::AsyncScrollingCoordinator::attachToStateTree):
2084         (WebCore::AsyncScrollingCoordinator::ensureRootStateNodeForFrameView):
2085         * page/scrolling/AsyncScrollingCoordinator.h:
2086         * page/scrolling/ScrollingCoordinator.h:
2087         (WebCore::ScrollingCoordinator::attachToStateTree):
2088         * page/scrolling/ScrollingStateNode.cpp:
2089         (WebCore::ScrollingStateNode::insertChild):
2090         (WebCore::ScrollingStateNode::indexOfChild const):
2091         * page/scrolling/ScrollingStateNode.h:
2092         * page/scrolling/ScrollingStateTree.cpp:
2093         (WebCore::ScrollingStateTree::nodeTypeAndParentMatch const):
2094         (WebCore::ScrollingStateTree::attachNode):
2095         * page/scrolling/ScrollingStateTree.h:
2096
2097 2018-12-06  Yongjun Zhang  <yongjun_zhang@apple.com>
2098
2099         We should ignore minimumEffectiveDeviceWidth if the page specifies device-width in viewport meta-tag.
2100         https://bugs.webkit.org/show_bug.cgi?id=192377
2101         <rdar://problem/46364206>
2102
2103         Reviewed by Tim Horton.
2104
2105         If the page specifies width=device-width or initial-scale=1 in the viewport meta tag, we should use the
2106         native device width and ignore the minimum effective device width in ViewportConfiguration. The patch
2107         also introduces scalableNativeWebpageParameters() which uses the device width as default and also allows the page
2108         to shrink-to-fit. If a page doesn't have viewport meta tag, or if the width argument isn't device-width
2109         and the initial scale isn't 1, we will use scalableNativeWebpageParameters() as the default configuration.
2110
2111         Tests: fast/viewport/ios/ignore-minimum-device-width-for-page-with-viewport-device-width.html
2112                fast/viewport/ios/use-minimum-device-width-for-page-without-viewport-meta.html
2113
2114         * page/ViewportConfiguration.cpp:
2115         (WebCore::ViewportConfiguration::updateDefaultConfiguration): pick the default configuration based on
2116             the page's viewport arguments. Also, we will always fall back to scalableNativeWebpageParameters() if we
2117             can ignore scaling constraints.
2118         (WebCore::ViewportConfiguration::setViewportArguments): When page sends us new ViewportArguments, pick
2119             up the correponsding default configuration before updating the configuration.
2120         (WebCore::ViewportConfiguration::setCanIgnoreScalingConstraints): When m_canIgnoreScalingConstraints is
2121             changed, try to pick up the correponsding default configuration.
2122         (WebCore::ViewportConfiguration::scalableNativeWebpageParameters): Add a new default set of viewport Parameters
2123             this is very close to nativeWebpageParameters() excpet that it allows shrink to fit and its minimum scale
2124             is 0.25. We will use this Parameters for pages that doesn't have viewport meta tag; or the width is
2125             not device-width and initial scale is not 1.
2126         (WebCore::ViewportConfiguration::updateConfiguration): If the page's viewport argument doesn't override
2127             the default width, use the m_minimumLayoutSize.width().
2128         * page/ViewportConfiguration.h:
2129         (WebCore::ViewportConfiguration::shouldIgnoreMinimumEffectiveDeviceWidth const): A helper method to tell
2130             if we should avoid using minimum effective device width.
2131         (WebCore::ViewportConfiguration::canOverrideConfigurationParameters const): If we are using a default
2132             configuration that is neither nativeWebpageParameters() nor scalableNativeWebpageParameters(), don't override
2133             it.
2134         (WebCore::ViewportConfiguration::minimumEffectiveDeviceWidth const): Add a helper method to return minimum
2135             effective device width based on shouldIgnoreMinimumEffectiveDeviceWidth().
2136         (WebCore::ViewportConfiguration::effectiveLayoutSizeScaleFactor const): Use minimumEffectiveDeviceWidth().
2137
2138 2018-12-06  Adrian Perez de Castro  <aperez@igalia.com>
2139
2140         Content Extensions: Misc fixes to debugging / perf testing code
2141         https://bugs.webkit.org/show_bug.cgi?id=192474
2142
2143         Reviewed by Mark Lam.
2144
2145         This make it possible to build the content extensions support with the
2146         debugging features enabled. In particular, building with
2147         CONTENT_EXTENSIONS_PERFORMANCE_REPORTING enabled was broken.
2148
2149         No new tests needed.
2150
2151         * contentextensions/ContentExtensionCompiler.cpp:
2152         (WebCore::ContentExtensions::compileRuleList): Remove usage of removed
2153         variables machinesWihthoutConditionsCount,
2154         totalBytecodeSizeForMachinesWithoutConditions,
2155         machinesWithConditionsCount, and
2156         totalBytecodeSizeForMachinesWithConditions.
2157         * contentextensions/DFA.cpp:
2158         (WebCore::ContentExtensions::DFA::debugPrintDot const):
2159         Use "%" PRIu64 instead of "%llu" to format uint64_t values.
2160         * contentextensions/NFA.cpp:
2161         (WebCore::ContentExtensions::NFA::debugPrintDot const):
2162         Use "%" PRIu64 instead of "%llu" to format uint64_t values.
2163
2164 2018-12-06  Alex Christensen  <achristensen@webkit.org>
2165
2166         Remove unused LoaderStrategy::storeDerivedDataToCache and associated dead code
2167         https://bugs.webkit.org/show_bug.cgi?id=192452
2168
2169         Reviewed by Anders Carlsson.
2170
2171         * loader/LoaderStrategy.h:
2172         * loader/ResourceLoader.cpp:
2173         (WebCore::ResourceLoader::didRetrieveDerivedDataFromCache): Deleted.
2174         * loader/ResourceLoader.h:
2175         * loader/ResourceLoaderOptions.h:
2176         * loader/SubresourceLoader.cpp:
2177         (WebCore::SubresourceLoader::didRetrieveDerivedDataFromCache): Deleted.
2178         * loader/SubresourceLoader.h:
2179         * loader/ThreadableLoader.cpp:
2180         (WebCore::ThreadableLoaderOptions::isolatedCopy const):
2181         * loader/cache/CachedResource.h:
2182         (WebCore::CachedResource::didRetrieveDerivedDataFromCache): Deleted.
2183
2184 2018-12-06  Zalan Bujtas  <zalan@apple.com>
2185
2186         [LFC][BFC][MarginCollapsing] HeightAndMargin::margin is always the non-collapsed margin value.
2187         https://bugs.webkit.org/show_bug.cgi?id=192345
2188
2189         Reviewed by Antti Koivisto.
2190
2191         Rename HeightAndMargin::margin to HeightAndMargin::nonCollapsedMargin.
2192
2193         * layout/FormattingContext.cpp:
2194         (WebCore::Layout::FormattingContext::computeOutOfFlowVerticalGeometry const):
2195         * layout/LayoutUnits.h:
2196         (WebCore::Layout::HeightAndMargin::usedMarginValues const):
2197         * layout/blockformatting/BlockFormattingContext.cpp:
2198         (WebCore::Layout::BlockFormattingContext::computeHeightAndMargin const):
2199         * layout/blockformatting/BlockFormattingContextGeometry.cpp:
2200         (WebCore::Layout::BlockFormattingContext::Geometry::inFlowNonReplacedHeightAndMargin):
2201         (WebCore::Layout::BlockFormattingContext::Geometry::inFlowHeightAndMargin):
2202         * layout/blockformatting/BlockFormattingContextQuirks.cpp:
2203         (WebCore::Layout::BlockFormattingContext::Quirks::stretchedHeight):
2204         * layout/inlineformatting/InlineFormattingContext.cpp:
2205         (WebCore::Layout::InlineFormattingContext::computeHeightAndMargin const):
2206
2207 2018-12-06  Zalan Bujtas  <zalan@apple.com>
2208
2209         [LFC][BFC][MarginCollapsing] Add MarginCollapse::establishesBlockFormattingContext
2210         https://bugs.webkit.org/show_bug.cgi?id=192297
2211
2212         Reviewed by Antti Koivisto.
2213
2214         WebKit treats the document element renderer as a block formatting context root.
2215
2216         * layout/blockformatting/BlockMarginCollapse.cpp:
2217         (WebCore::Layout::establishesBlockFormattingContext):
2218         (WebCore::Layout::BlockFormattingContext::Geometry::MarginCollapse::isMarginTopCollapsedWithParent):
2219         (WebCore::Layout::BlockFormattingContext::Geometry::MarginCollapse::isMarginBottomCollapsedWithParent):
2220
2221 2018-12-06  Carlos Eduardo Ramalho  <cadubentzen@gmail.com>
2222
2223         [GStreamer] -DENABLE_VIDEO=ON -DENABLE_OPENGL=OFF still tries to build GstreamerGL
2224         https://bugs.webkit.org/show_bug.cgi?id=191998
2225
2226         Reviewed by Philippe Normand.
2227
2228         Fix compilation with -DENABLE_VIDEO=ON and -DENABLE_OPENGL=OFF due to GStreamerGL.
2229
2230         No new tests required. Only fixing the build with certain flags.
2231
2232         * Modules/mediastream/CanvasCaptureMediaStreamTrack.cpp:
2233         (WebCore::CanvasCaptureMediaStreamTrack::Source::canvasChanged): add required #if ENABLE(WEBGL).
2234
2235 2018-12-06  Carlos Eduardo Ramalho  <cadubentzen@gmail.com>
2236
2237         REGRESSION(r231043): [GTK] Undefined references to WebCore::LayerRepresentation::* with -DENABLE_OPENGL=OFF builds
2238         https://bugs.webkit.org/show_bug.cgi?id=191997
2239
2240         Reviewed by Philippe Normand.
2241
2242         Fix build with -DENABLE_OPENGL=OFF and -DENABLE_VIDEO=OFF.
2243
2244         No new tests required. Only fixing build.
2245
2246         * platform/gtk/PlatformWheelEventGtk.cpp:
2247         (WebCore::PlatformWheelEvent::PlatformWheelEvent): add required #if ENABLE(ASYNC_SCROLLING)
2248
2249 2018-12-05  Don Olmstead  <don.olmstead@sony.com>
2250
2251         [PlayStation] Enable WebCore
2252         https://bugs.webkit.org/show_bug.cgi?id=192384
2253
2254         Reviewed by Brent Fulgham.
2255
2256         Implements WebCore for the PlayStation platform.
2257
2258         * PlatformPlayStation.cmake: Added.
2259         * loader/cache/CachedResourceLoader.cpp:
2260         * platform/generic/KeyedDecoderGeneric.cpp: Added.
2261         (WebCore::KeyedDecoder::decoder):
2262         (WebCore::KeyedDecoderGeneric::KeyedDecoderGeneric):
2263         (WebCore::KeyedDecoderGeneric::~KeyedDecoderGeneric):
2264         (WebCore::KeyedDecoderGeneric::decodeBytes):
2265         (WebCore::KeyedDecoderGeneric::decodeBool):
2266         (WebCore::KeyedDecoderGeneric::decodeUInt32):
2267         (WebCore::KeyedDecoderGeneric::decodeUInt64):
2268         (WebCore::KeyedDecoderGeneric::decodeInt32):
2269         (WebCore::KeyedDecoderGeneric::decodeInt64):
2270         (WebCore::KeyedDecoderGeneric::decodeFloat):
2271         (WebCore::KeyedDecoderGeneric::decodeDouble):
2272         (WebCore::KeyedDecoderGeneric::decodeString):
2273         (WebCore::KeyedDecoderGeneric::beginObject):
2274         (WebCore::KeyedDecoderGeneric::endObject):
2275         (WebCore::KeyedDecoderGeneric::beginArray):
2276         (WebCore::KeyedDecoderGeneric::beginArrayElement):
2277         (WebCore::KeyedDecoderGeneric::endArrayElement):
2278         (WebCore::KeyedDecoderGeneric::endArray):
2279         * platform/generic/KeyedDecoderGeneric.h: Added.
2280         * platform/generic/KeyedEncoderGeneric.cpp: Added.
2281         (WebCore::KeyedEncoder::encoder):
2282         (WebCore::KeyedEncoderGeneric::KeyedEncoderGeneric):
2283         (WebCore::KeyedEncoderGeneric::~KeyedEncoderGeneric):
2284         (WebCore::KeyedEncoderGeneric::encodeBytes):
2285         (WebCore::KeyedEncoderGeneric::encodeBool):
2286         (WebCore::KeyedEncoderGeneric::encodeUInt32):
2287         (WebCore::KeyedEncoderGeneric::encodeUInt64):
2288         (WebCore::KeyedEncoderGeneric::encodeInt32):
2289         (WebCore::KeyedEncoderGeneric::encodeInt64):
2290         (WebCore::KeyedEncoderGeneric::encodeFloat):
2291         (WebCore::KeyedEncoderGeneric::encodeDouble):
2292         (WebCore::KeyedEncoderGeneric::encodeString):
2293         (WebCore::KeyedEncoderGeneric::beginObject):
2294         (WebCore::KeyedEncoderGeneric::endObject):
2295         (WebCore::KeyedEncoderGeneric::beginArray):
2296         (WebCore::KeyedEncoderGeneric::beginArrayElement):
2297         (WebCore::KeyedEncoderGeneric::endArrayElement):
2298         (WebCore::KeyedEncoderGeneric::endArray):
2299         (WebCore::KeyedEncoderGeneric::finishEncoding):
2300         * platform/generic/KeyedEncoderGeneric.h: Added.
2301         * platform/network/curl/NetworkStorageSessionCurl.cpp:
2302         (WebCore::defaultCookieJarPath):
2303         * platform/network/playstation/CurlSSLHandlePlayStation.cpp: Added.
2304         (WebCore::getCACertPathEnv):
2305         (WebCore::CurlSSLHandle::platformInitialize):
2306         * platform/network/playstation/NetworkStateNotifierPlayStation.cpp: Added.
2307         (WebCore::NetworkStateNotifier::updateStateWithoutNotifying):
2308         (WebCore::NetworkStateNotifier::startObserving):
2309         * platform/playstation/EventLoopPlayStation.cpp: Added.
2310         (WebCore::EventLoop::cycle):
2311         * platform/playstation/MIMETypeRegistryPlayStation.cpp: Added.
2312         (WebCore::MIMETypeRegistry::getMIMETypeForExtension):
2313         (WebCore::MIMETypeRegistry::isApplicationPluginMIMEType):
2314         (WebCore::MIMETypeRegistry::getPreferredExtensionForMIMEType):
2315         * platform/playstation/PlatformScreenPlayStation.cpp: Added.
2316         (WebCore::screenDepth):
2317         (WebCore::screenDepthPerComponent):
2318         (WebCore::screenIsMonochrome):
2319         (WebCore::screenHasInvertedColors):
2320         (WebCore::screenRect):
2321         (WebCore::screenAvailableRect):
2322         (WebCore::screenSupportsExtendedColor):
2323         * platform/playstation/ScrollbarThemePlayStation.cpp: Added.
2324         (WebCore::ScrollbarTheme::nativeTheme):
2325         (WebCore::ScrollbarThemePlayStation::scrollbarThickness):
2326         (WebCore::ScrollbarThemePlayStation::hasButtons):
2327         (WebCore::ScrollbarThemePlayStation::hasThumb):
2328         (WebCore::ScrollbarThemePlayStation::backButtonRect):
2329         (WebCore::ScrollbarThemePlayStation::forwardButtonRect):
2330         (WebCore::ScrollbarThemePlayStation::trackRect):
2331         (WebCore::ScrollbarThemePlayStation::paintTrackBackground):
2332         (WebCore::ScrollbarThemePlayStation::paintThumb):
2333         * platform/playstation/ScrollbarThemePlayStation.h: Added.
2334         * platform/playstation/UserAgentPlayStation.cpp: Added.
2335         (WebCore::standardUserAgent):
2336         (WebCore::standardUserAgentForURL):
2337         * rendering/RenderThemePlayStation.cpp: Added.
2338         (WebCore::RenderTheme::singleton):
2339         (WebCore::RenderThemePlayStation::updateCachedSystemFontDescription const):
2340         * rendering/RenderThemePlayStation.h: Added.
2341
2342 2018-12-05  Ryosuke Niwa  <rniwa@webkit.org>
2343
2344         Null pointer crash in DocumentOrderedMap::getElementById via FormAssociatedElement::findAssociatedForm
2345         https://bugs.webkit.org/show_bug.cgi?id=192392
2346
2347         Reviewed by Dean Jackson.
2348
2349         The crash was caused by FormAssociatedElement::findAssociatedForm invoking DocumentOrderedMap::getElementById
2350         and de-referencing nullptr Attribute* via IdTargetObserver before Element::attributeChanged had updated
2351         ElementData::m_idForStyleResolution.
2352
2353         Fixed it by updating m_idForStyleResolution before invoking IdTargetObservers.
2354
2355         Test: fast/dom/remove-id-form-associated-elemet-id-observer-crash.html
2356
2357         * dom/Element.cpp:
2358         (WebCore::Element::attributeChanged): Fixed the bug.
2359
2360 2018-12-05  Youenn Fablet  <youenn@apple.com>
2361
2362         Enable the possibility to do video capture in UIProcess
2363         https://bugs.webkit.org/show_bug.cgi?id=192394
2364
2365         Reviewed by Eric Carlson.
2366
2367         Create IOSurface-backed sample buffers so that we can easily send them through IPC.
2368         Manually tested.
2369
2370         * platform/mediastream/mac/AVVideoCaptureSource.mm:
2371         (WebCore::AVVideoCaptureSource::setSizeAndFrameRateWithPreset):
2372
2373 2018-12-05  Youenn Fablet  <youenn@apple.com>
2374
2375         Update ServiceWorkerContainer::getRegistration lambdas
2376         https://bugs.webkit.org/show_bug.cgi?id=192376
2377
2378         Reviewed by Chris Dumez.
2379
2380         There is no need to pass 'this' in lambdas as the last lambda
2381         takes a ScriptExecutionContext&.
2382         No change of behavior.
2383
2384         * workers/service/ServiceWorkerContainer.cpp:
2385         (WebCore::ServiceWorkerContainer::getRegistration):
2386         (WebCore::ServiceWorkerContainer::getRegistrations):
2387
2388 2018-12-05  Chris Dumez  <cdumez@apple.com>
2389
2390         Crash under WebCore::cachedDocumentWrapper()
2391         https://bugs.webkit.org/show_bug.cgi?id=192421
2392         <rdar://problem/37114163>
2393
2394         Reviewed by Alex Christensen.
2395
2396         Fix potential null defererence of the value returned by toJSDOMWindow(). For example,
2397         if the window is frameless, it would return null.
2398
2399         * bindings/js/JSDocumentCustom.cpp:
2400         (WebCore::cachedDocumentWrapper):
2401
2402 2018-12-05  Eric Carlson  <eric.carlson@apple.com>
2403
2404         [MediaStream] Cleanup up Mac screen capture class
2405         https://bugs.webkit.org/show_bug.cgi?id=192379
2406         <rdar://problem/46465458>
2407
2408         Reviewed by Youenn Fablet.
2409
2410         No new tests, tested manually.
2411
2412         * platform/mediastream/mac/DisplayCaptureManagerCocoa.cpp:
2413         (WebCore::DisplayCaptureManagerCocoa::captureDevices): Initialize Screen devices first so
2414         they are first in the list of devices.
2415
2416         * platform/mediastream/mac/ScreenDisplayCaptureSourceMac.h:
2417         * platform/mediastream/mac/ScreenDisplayCaptureSourceMac.mm:
2418         (WebCore::ScreenDisplayCaptureSourceMac::createDisplayStream): Cleanup. Always capture at the
2419         native screen size to work around a bug.
2420         (WebCore::ScreenDisplayCaptureSourceMac::settingsDidChange): Deleted.
2421
2422 2018-12-05  Commit Queue  <commit-queue@webkit.org>
2423
2424         Unreviewed, rolling out r238844, r238846, and r238874.
2425         https://bugs.webkit.org/show_bug.cgi?id=192414
2426
2427         The layout tests added with this change are flaky. (Requested
2428         by ryanhaddad on #webkit).
2429
2430         Reverted changesets:
2431
2432         "Implement non-timeslice mode encoding for MediaRecorder"
2433         https://bugs.webkit.org/show_bug.cgi?id=192069
2434         https://trac.webkit.org/changeset/238844
2435
2436         "Fix the build"
2437         https://trac.webkit.org/changeset/238846
2438
2439         "Fix MediaRecorder flaky tests"
2440         https://bugs.webkit.org/show_bug.cgi?id=192371
2441         https://trac.webkit.org/changeset/238874
2442
2443 2018-12-05  Frederic Wang  <fwang@igalia.com>
2444
2445         Minor refactoring of the scrolling code
2446         https://bugs.webkit.org/show_bug.cgi?id=192398
2447
2448         Reviewed by Simon Fraser.
2449
2450         Based on an earlier patch by Simon Fraser.
2451
2452         This patch performs some minor refactoring of the scrolling code:
2453         - Rename ScrollingCoordinator::uniqueScrollLayerID() to uniqueScrollingNodeID() since it
2454           is really a node id.
2455         - Inline ScrollingStateTree::setRootStateNode() so we only need to forward declare
2456           ScrollingStateFrameScrollingNode in headers.
2457         - Pass argument to ScrollingStateTree::addNode() as a reference rather than a pointer.
2458         - Initialize ScrollingStateTree::m_changedProperties and ScrollingStateTree::m_parent in
2459           the header file.
2460         - Remove obsolete comment about ScrollingCoordinatorMac.
2461
2462         No new tests, behavior unchanged.
2463
2464         * page/scrolling/ScrollingCoordinator.cpp:
2465         (WebCore::ScrollingCoordinator::uniqueScrollingNodeID):
2466         (WebCore::ScrollingCoordinator::uniqueScrollLayerID): Deleted.
2467         * page/scrolling/ScrollingCoordinator.h:
2468         * page/scrolling/ScrollingStateNode.cpp:
2469         (WebCore::ScrollingStateNode::ScrollingStateNode):
2470         * page/scrolling/ScrollingStateNode.h:
2471         * page/scrolling/ScrollingStateTree.cpp:
2472         (WebCore::ScrollingStateTree::attachNode):
2473         (WebCore::ScrollingStateTree::setRootStateNode):
2474         (WebCore::ScrollingStateTree::addNode):
2475         * page/scrolling/ScrollingStateTree.h:
2476         (WebCore::ScrollingStateTree::setRootStateNode): Deleted.
2477         * page/scrolling/ScrollingTree.cpp:
2478         * page/scrolling/mac/ScrollingTreeFrameScrollingNodeMac.h:
2479         * rendering/RenderLayerCompositor.cpp:
2480         (WebCore::RenderLayerCompositor::attachScrollingNode):
2481
2482 2018-12-05  Wenson Hsieh  <wenson_hsieh@apple.com>
2483
2484         Turn WritingDirection into an enum class
2485         https://bugs.webkit.org/show_bug.cgi?id=192401
2486         Work towards <rdar://problem/42075638>
2487
2488         Reviewed by Dan Bernstein.
2489
2490         Change WritingDirection from an enum to an enum class. No change in behavior.
2491
2492         * editing/ApplyStyleCommand.cpp:
2493         (WebCore::ApplyStyleCommand::splitAncestorsWithUnicodeBidi):
2494         (WebCore::ApplyStyleCommand::applyInlineStyle):
2495         * editing/EditingStyle.cpp:
2496         (WebCore::EditingStyle::textDirection const):
2497         (WebCore::EditingStyle::textDirectionForSelection):
2498         * editing/Editor.cpp:
2499         (WebCore::Editor::setBaseWritingDirection):
2500         (WebCore::Editor::baseWritingDirectionForSelectionStart const):
2501         * editing/EditorCommand.cpp:
2502         (WebCore::stateTextWritingDirectionLeftToRight):
2503         (WebCore::stateTextWritingDirectionNatural):
2504         (WebCore::stateTextWritingDirectionRightToLeft):
2505         * editing/WritingDirection.h:
2506
2507         Additionally wrap this enum in `namespace WebCore`, and update the copyright year.
2508
2509         * editing/ios/EditorIOS.mm:
2510         (WebCore::Editor::setTextAlignmentForChangedBaseWritingDirection):
2511         * page/ContextMenuController.cpp:
2512         (WebCore::ContextMenuController::contextMenuItemSelected):
2513         * testing/Internals.cpp:
2514         (WebCore::Internals::setBaseWritingDirection):
2515
2516 2018-12-05  Alicia Boya García  <aboya@igalia.com>
2517
2518         [MSE][GStreamer] Remove the AppendPipeline state machine
2519         https://bugs.webkit.org/show_bug.cgi?id=192204
2520
2521         Reviewed by Xabier Rodriguez-Calvar.
2522
2523         This patch tries to reduce the complexity of the AppendPipeline by
2524         removing the appendState state machine and cleaning all the
2525         conditional code around it that is not necessary anymore.
2526
2527         For the most part the behavior is the same, but some edge cases have
2528         been improved in the process:
2529
2530         Demuxing errors now result in the append being flagged as
2531         ParsingFailed and the error being propagated to the application. This
2532         fixes media/media-source/media-source-error-crash.html (or at least
2533         gets it up to date with cross platform expectations).
2534
2535         AbortableTaskQueue now allows the task handler to perform an abort
2536         safely. This is used in the GstBus error message sync handler, since
2537         it needs to ask the MainThread to raise a parse error, which will in
2538         turn abort. An API test has been added for this new functionality.
2539         Also, code has been added to the API tests to ensure the correct
2540         destruction of the response object, especially in this case.
2541
2542         The code handling invalid track codecs has been made clearer by also
2543         explicitly raising a parse error, but it should not expose behavior
2544         differences for the application. A test has been added for this
2545         behavior: web-platform-tests/media-source/mediasource-invalid-codec.html
2546
2547         The reporting of EOS events have been made more rigorous. EOS is only
2548         expected after a demuxing error, otherwise it's a g_critical.
2549
2550         AppendPipeline::abort() has been renamed to
2551         AppendPipeline::resetParserState() to honor the fact that it's not
2552         only called when the user calls abort() and match better the names
2553         used in the spec.
2554
2555         Test: imported/w3c/web-platform-tests/media-source/mediasource-invalid-codec.html
2556
2557         * platform/AbortableTaskQueue.h:
2558         * platform/graphics/gstreamer/mse/AppendPipeline.cpp:
2559         (WebCore::assertedElementSetState):
2560         (WebCore::AppendPipeline::AppendPipeline):
2561         (WebCore::AppendPipeline::~AppendPipeline):
2562         (WebCore::AppendPipeline::handleErrorSyncMessage):
2563         (WebCore::AppendPipeline::appsrcEndOfAppendCheckerProbe):
2564         (WebCore::AppendPipeline::handleNeedContextSyncMessage):
2565         (WebCore::AppendPipeline::appsinkCapsChanged):
2566         (WebCore::AppendPipeline::handleEndOfAppend):
2567         (WebCore::AppendPipeline::appsinkNewSample):
2568         (WebCore::AppendPipeline::didReceiveInitializationSegment):
2569         (WebCore::AppendPipeline::resetParserState):
2570         (WebCore::AppendPipeline::pushNewBuffer):
2571         (WebCore::AppendPipeline::handleAppsinkNewSampleFromStreamingThread):
2572         (WebCore::AppendPipeline::connectDemuxerSrcPadToAppsinkFromStreamingThread):
2573         (WebCore::AppendPipeline::connectDemuxerSrcPadToAppsink):
2574         (WebCore::AppendPipeline::disconnectDemuxerSrcPadFromAppsinkFromAnyThread):
2575         (WebCore::AppendPipeline::dumpAppendState): Deleted.
2576         (WebCore::AppendPipeline::demuxerNoMorePads): Deleted.
2577         (WebCore::AppendPipeline::setAppendState): Deleted.
2578         (WebCore::AppendPipeline::appsinkEOS): Deleted.
2579         (WebCore::AppendPipeline::resetPipeline): Deleted.
2580         (WebCore::AppendPipeline::abort): Deleted.
2581         * platform/graphics/gstreamer/mse/AppendPipeline.h:
2582         (WebCore::AppendPipeline::appendState): Deleted.
2583         * platform/graphics/gstreamer/mse/MediaSourceClientGStreamerMSE.cpp:
2584         (WebCore::MediaSourceClientGStreamerMSE::abort):
2585         (WebCore::MediaSourceClientGStreamerMSE::resetParserState):
2586         * platform/graphics/gstreamer/mse/SourceBufferPrivateGStreamer.cpp:
2587         (WebCore::SourceBufferPrivateGStreamer::appendParsingFailed):
2588         * platform/graphics/gstreamer/mse/SourceBufferPrivateGStreamer.h:
2589
2590 2018-12-05  Rob Buis  <rbuis@igalia.com>
2591
2592         [Mac] HEAD requests changed to GET after 301, 302, and 303 redirections (http/tests/xmlhttprequest/head-redirection.html)
2593         https://bugs.webkit.org/show_bug.cgi?id=114965
2594
2595         Reviewed by Frédéric Wang.
2596
2597         HEAD requests should not be changed to GET after 303 redirects, see [1].
2598         This was fixed earlier for GTK [2].
2599
2600         Behavior matches Firefox and Chrome.
2601
2602         [1] http://tools.ietf.org/html/draft-ietf-httpbis-p2-semantics-21#section-7.4
2603         [2] https://bugs.webkit.org/show_bug.cgi?id=110127
2604
2605         Tests: web-platform-tests/fetch/api/redirect/redirect-method.html
2606                web-platform-tests/fetch/api/redirect/redirect-method-worker.html
2607                http/tests/xmlhttprequest/head-redirection.html
2608
2609         * platform/network/mac/ResourceHandleMac.mm:
2610         (WebCore::ResourceHandle::willSendRequest):
2611
2612 2018-12-05  Rob Buis  <rbuis@igalia.com>
2613
2614         Align with Fetch on data: URLs
2615         https://bugs.webkit.org/show_bug.cgi?id=182325
2616
2617         Reviewed by Alex Christensen.
2618
2619         Do not accept data URLs that do not contain a comma
2620         character, as specified in the relevant specs [1, 2].
2621
2622         Behavior matches Firefox and Chrome.
2623
2624         Test: web-platform-tests/fetch/api/basic/scheme-data.any.html
2625
2626         [1] https://tools.ietf.org/html/rfc2397
2627         [2] https://fetch.spec.whatwg.org/#data-url-processor
2628
2629         * platform/network/DataURLDecoder.cpp:
2630         (WebCore::DataURLDecoder::parseMediaType):
2631         (WebCore::DataURLDecoder::DecodeTask::DecodeTask):
2632         (WebCore::DataURLDecoder::DecodeTask::process):
2633         (WebCore::DataURLDecoder::createDecodeTask):
2634         (WebCore::DataURLDecoder::decode):
2635
2636 2018-12-05  Frederic Wang  <fwang@igalia.com>
2637
2638         Unreviewed build fix.
2639
2640         * page/scrolling/ios/ScrollingTreeFrameScrollingNodeIOS.mm: Add missing header.
2641
2642 2018-12-05  Javier Fernandez  <jfernandez@igalia.com>
2643
2644         [css-grid] Crash on debug changing the style of a positioned element
2645         https://bugs.webkit.org/show_bug.cgi?id=191473
2646
2647         Reviewed by Dean Jackson and Zalan Bujtas.
2648
2649         When an box becomes {out-of,in}-flow, it may be re-parented and it may become a grid
2650         item. In that case, we must mark the RenderGrid as dirty, so that the grid items
2651         placement logic is executed again.
2652
2653         Test: fast/css-grid-layout/grid-crash-out-of-flow-positioned-element.html
2654
2655         * rendering/updating/RenderTreeBuilder.cpp:
2656         (WebCore::childFlowStateChangesAndAffectsParentBlock): Consider the case of a box's new parent being a grid container.
2657
2658 2018-12-04  Frederic Wang  <fwang@igalia.com>
2659
2660         Always pass scrollingGeometry to update*ScrollingNode functions
2661         https://bugs.webkit.org/show_bug.cgi?id=192358
2662
2663         Reviewed by Simon Fraser.
2664
2665         Currently, the scrollingGeometry parameter of updateOverflowScrollingNode is always used
2666         while the one of updateFrameScrollingNode is never used. Both of them are passed as possibly
2667         null pointers. This commit makes things more consistent by making the parameter a reference
2668         and explicitly setting the scrollingGeometry of updateFrameScrollingNode. This will help
2669         other efforts (such as support for macOS/iOS asynchronous scrolling of overflow nodes /
2670         subframes or for CSS overscroll-behavior) for which new data members have to be passed to the
2671         scrolling nodes.
2672
2673         No new tests, no behavior changes.
2674
2675         * page/scrolling/AsyncScrollingCoordinator.cpp:
2676         (WebCore::AsyncScrollingCoordinator::updateFrameScrollingNode):
2677         (WebCore::AsyncScrollingCoordinator::updateOverflowScrollingNode):
2678         * page/scrolling/AsyncScrollingCoordinator.h:
2679         * page/scrolling/ScrollingCoordinator.h:
2680         (WebCore::ScrollingCoordinator::updateFrameScrollingNode):
2681         (WebCore::ScrollingCoordinator::updateOverflowScrollingNode):
2682         * rendering/RenderLayerCompositor.cpp:
2683         (WebCore::RenderLayerCompositor::updateScrollCoordinationForThisFrame):
2684         (WebCore::RenderLayerCompositor::updateScrollCoordinatedLayer):
2685
2686 2018-12-04  Ryosuke Niwa  <rniwa@webkit.org>
2687
2688         Crash in HTMLCollection::updateNamedElementCache
2689         https://bugs.webkit.org/show_bug.cgi?id=192347
2690
2691         Reviewed by Darin Adler.
2692
2693         The bug was caused by CollectionIndexCache's nodeAt caching the length of 1
2694         when there are no matching elements in the subtree when the index is non-zero.
2695
2696         A related bug was fixed in r182125 but we were not considering the possibility
2697         that the index given to this function might be non-zero even when there were
2698         no matching elements.
2699
2700         Test: fast/dom/options-collection-zero-length-crash.html
2701
2702         * dom/CollectionIndexCache.h:
2703         (WebCore::CollectionIndexCache<Collection, Iterator>::nodeAt):
2704
2705 2018-11-30  Jiewen Tan  <jiewen_tan@apple.com>
2706
2707         Don't report resource timing to parent frame for history items
2708         https://bugs.webkit.org/show_bug.cgi?id=192273
2709         <rdar://problem/45163764>
2710
2711         Reviewed by Youenn Fablet.
2712
2713         We should not report history items to its parent frame as those are less
2714         interested to its parent and might not be the first navigation in the iframes.
2715
2716         This change aligns the behavior when a cached document is not available for the
2717         history item with the available case as we don't report resource timing for any
2718         cached main document.
2719
2720         Test: http/tests/misc/resource-timing-navigation-in-restored-iframe-2.html
2721
2722         * loader/FrameLoader.cpp:
2723         (WebCore::FrameLoader::loadDifferentDocumentItem):
2724
2725 2018-12-04  Simon Fraser  <simon.fraser@apple.com>
2726
2727         REGRESSION (r238090): position:fixed sidebar on https://www.w3.org/TR/SVG2/coords.html does not stay fixed
2728         https://bugs.webkit.org/show_bug.cgi?id=192320
2729         <rdar://problem/46429833>
2730
2731         Reviewed by Zalan Bujtas.
2732         
2733         Re-land r238840 with a more reliable test.
2734         
2735         When we fall into slow scrolling mode (for example, because of background-attachment: fixed),
2736         RenderLayerCompositor::updateCompositingLayers() needs to set the geometry dirty bit on layers
2737         for viewport-constrained objects so we update them.
2738         
2739         This is only necessary for page scrolling; for overflow scrolls, updateLayerPositions() already
2740         does enough dirtying that fixed layers nested inside scrollers get updated.
2741
2742         Test: compositing/fixed-with-main-thread-scrolling.html
2743
2744         * rendering/RenderLayerCompositor.cpp:
2745         (WebCore::RenderLayerCompositor::updateCompositingLayers):
2746
2747 2018-12-04  Youenn Fablet  <youenn@apple.com>
2748
2749         Fix MediaRecorder flaky tests
2750         https://bugs.webkit.org/show_bug.cgi?id=192371
2751
2752         Reviewed by Eric Carlson.
2753
2754         No change of behavior.
2755
2756         * testing/Internals.cpp:
2757         (WebCore::Internals::resetToConsistentState):
2758         Reset to use real MediaRecorder by default.
2759
2760 2018-12-04  Justin Michaud  <justin_michaud@apple.com>
2761
2762         CSS Painting API should allow image values in inputProperties
2763         https://bugs.webkit.org/show_bug.cgi?id=192200
2764
2765         Reviewed by Dean Jackson.
2766
2767         Adds new TypedOMCSSImageValue wrapper. We rename all the existing ones so that the naming is consistent (CSSImageValue is already a thing).
2768         Finally, we let CanvasRenderingContext2DBase render these.
2769
2770         Tests: fast/css-custom-paint/arguments.html
2771                fast/css-custom-paint/image.html
2772
2773         * CMakeLists.txt:
2774         * DerivedSources.make:
2775         * Sources.txt:
2776         * WebCore.xcodeproj/project.pbxproj:
2777         * bindings/js/CallTracerTypes.h:
2778         * bindings/js/JSTypedOMCSSStyleValueCustom.cpp: Renamed from Source/WebCore/bindings/js/JSCSSStyleValueCustom.cpp.
2779         (WebCore::toJSNewlyCreated):
2780         (WebCore::toJS):
2781         * bindings/js/WebCoreBuiltinNames.h:
2782         * css/CSSComputedStyleDeclaration.cpp:
2783         (WebCore::ComputedStyleExtractor::customPropertyValue):
2784         * css/CSSCustomPropertyValue.cpp:
2785         (WebCore::CSSCustomPropertyValue::equals const):
2786         (WebCore::CSSCustomPropertyValue::customCSSText const):
2787         (WebCore::CSSCustomPropertyValue::tokens const):
2788         * css/CSSCustomPropertyValue.h:
2789         * css/CSSPaintImageValue.cpp:
2790         (WebCore::CSSPaintImageValue::image):
2791         * css/typedom/StylePropertyMapReadOnly.h:
2792         (WebCore::StylePropertyMapReadOnly::create):
2793         (WebCore::StylePropertyMapReadOnly::get const):
2794         (WebCore::StylePropertyMapReadOnly::StylePropertyMapReadOnly):
2795         * css/typedom/StylePropertyMapReadOnly.idl:
2796         * css/typedom/TypedOMCSSImageValue.h: Copied from Source/WebCore/css/typedom/CSSUnitValue.h.
2797         * css/typedom/TypedOMCSSImageValue.idl: Copied from Source/WebCore/css/typedom/CSSStyleValue.idl.
2798         * css/typedom/TypedOMCSSNumericValue.h: Renamed from Source/WebCore/css/typedom/CSSNumericValue.h.
2799         * css/typedom/TypedOMCSSNumericValue.idl: Renamed from Source/WebCore/css/typedom/CSSNumericValue.idl.
2800         * css/typedom/TypedOMCSSStyleValue.h: Renamed from Source/WebCore/css/typedom/CSSStyleValue.h.
2801         (WebCore::TypedOMCSSStyleValue::isImageValue):
2802         * css/typedom/TypedOMCSSStyleValue.idl: Renamed from Source/WebCore/css/typedom/CSSStyleValue.idl.
2803         * css/typedom/TypedOMCSSUnitValue.h: Renamed from Source/WebCore/css/typedom/CSSUnitValue.h.
2804         * css/typedom/TypedOMCSSUnitValue.idl: Renamed from Source/WebCore/css/typedom/CSSUnitValue.idl.
2805         * css/typedom/TypedOMCSSUnparsedValue.h: Renamed from Source/WebCore/css/typedom/CSSUnparsedValue.h.
2806         * css/typedom/TypedOMCSSUnparsedValue.idl: Renamed from Source/WebCore/css/typedom/CSSUnparsedValue.idl.
2807         * html/ImageBitmap.cpp:
2808         (WebCore::ImageBitmap::createPromise):
2809         * html/ImageBitmap.h:
2810         * html/canvas/CanvasDrawImage.idl:
2811         * html/canvas/CanvasFillStrokeStyles.idl:
2812         * html/canvas/CanvasRenderingContext.cpp:
2813         (WebCore::CanvasRenderingContext::checkOrigin):
2814         * html/canvas/CanvasRenderingContext.h:
2815         * html/canvas/CanvasRenderingContext2DBase.cpp:
2816         (WebCore::size):
2817         (WebCore::CanvasRenderingContext2DBase::drawImage):
2818         (WebCore::CanvasRenderingContext2DBase::createPattern):
2819         * html/canvas/CanvasRenderingContext2DBase.h:
2820         * inspector/InspectorCanvas.cpp:
2821         (WebCore::InspectorCanvas::buildAction):
2822         * page/WindowOrWorkerGlobalScope.idl:
2823         * platform/graphics/CustomPaintImage.cpp:
2824         (WebCore::CustomPaintImage::doCustomPaint):
2825
2826 2018-12-04  Chris Dumez  <cdumez@apple.com>
2827
2828         Regression(r238817) PSON Page Cache API tests are failing
2829         https://bugs.webkit.org/show_bug.cgi?id=192348
2830
2831         Reviewed by Alex Christensen.
2832
2833         * page/MemoryRelease.cpp:
2834         (WebCore::releaseCriticalMemory):
2835         (WebCore::releaseMemory):
2836         * page/MemoryRelease.h:
2837
2838 2018-12-04  Ryan Haddad  <ryanhaddad@apple.com>
2839
2840         Unreviewed, rolling out r238838.
2841
2842         The layout test added with this change is failing on iOS.
2843
2844         Reverted changeset:
2845
2846         "Thick overlines and line-throughs grow in the wrong
2847         direction"
2848         https://bugs.webkit.org/show_bug.cgi?id=192264
2849         https://trac.webkit.org/changeset/238838
2850
2851 2018-12-04  Ryan Haddad  <ryanhaddad@apple.com>
2852
2853         Unreviewed, rolling out r238840.
2854
2855         The layout test added with this change is frequently failing.
2856
2857         Reverted changeset:
2858
2859         "REGRESSION (r238090): position:fixed sidebar on
2860         https://www.w3.org/TR/SVG2/coords.html does not stay fixed"
2861         https://bugs.webkit.org/show_bug.cgi?id=192320
2862         https://trac.webkit.org/changeset/238840
2863
2864 2018-12-04  Carlos Garcia Campos  <cgarcia@igalia.com>
2865
2866         [SOUP] Move URLSoup back to WebCore after r238771
2867         https://bugs.webkit.org/show_bug.cgi?id=192306
2868
2869         Reviewed by Michael Catanzaro.
2870
2871         Add soupURIToURL() and urlToSoupURI() to replace the URL contructor taking a Soup URI and
2872         URL::createSoupURI(). Fix several build failures that showed up after removing the soup includes from URL
2873         header.
2874
2875         * platform/Cookie.h:
2876         * platform/SharedBuffer.h:
2877         * platform/SourcesSoup.txt:
2878         * platform/network/soup/CookieSoup.cpp:
2879         * platform/network/soup/GUniquePtrSoup.h: Renamed from Source/WTF/wtf/glib/GUniquePtrSoup.h.
2880         * platform/network/soup/NetworkStorageSessionSoup.cpp:
2881         (WebCore::NetworkStorageSession::setCookiesFromDOM const):
2882         (WebCore::NetworkStorageSession::deleteCookie const):
2883         (WebCore::NetworkStorageSession::getCookies):
2884         (WebCore::NetworkStorageSession::getRawCookies const):
2885         (WebCore::cookiesForSession):
2886         * platform/network/soup/ResourceErrorSoup.cpp:
2887         (WebCore::failingURI):
2888         * platform/network/soup/ResourceHandleSoup.cpp:
2889         * platform/network/soup/ResourceRequest.h:
2890         (WebCore::ResourceRequest::ResourceRequest):
2891         * platform/network/soup/ResourceRequestSoup.cpp:
2892         (WebCore::ResourceRequest::updateSoupMessageMembers const):
2893         (WebCore::ResourceRequest::updateFromSoupMessage):
2894         (WebCore::ResourceRequest::createSoupURI const):
2895         * platform/network/soup/ResourceResponseSoup.cpp:
2896         (WebCore::ResourceResponse::updateFromSoupMessage):
2897         * platform/network/soup/SocketStreamHandleImpl.h:
2898         * platform/network/soup/SocketStreamHandleImplSoup.cpp:
2899         (WebCore::SocketStreamHandleImpl::create):
2900         * platform/network/soup/SoupNetworkSession.cpp:
2901         * platform/network/soup/URLSoup.cpp: Copied from Source/WTF/wtf/glib/URLSoup.cpp.
2902         (WebCore::soupURIToURL):
2903         (WebCore::urlToSoupURI):
2904         * platform/network/soup/URLSoup.h: Renamed from Source/WTF/wtf/glib/URLSoup.cpp.
2905
2906 2018-12-04  Devin Rousso  <drousso@apple.com>
2907
2908         Web Inspector: Audit: tests should support async operations
2909         https://bugs.webkit.org/show_bug.cgi?id=192171
2910         <rdar://problem/46423562>
2911
2912         Reviewed by Joseph Pecoraro.
2913
2914         * page/Settings.yaml:
2915         * dom/ScriptExecutionContext.cpp:
2916         (ScriptExecutionContext::reportUnhandledPromiseRejection):
2917         Add setting for muting the "Unhandled Promise Rejection" console message.
2918
2919 2018-12-03  Tim Horton  <timothy_horton@apple.com>
2920
2921         Fix the build
2922
2923         * platform/mediarecorder/cocoa/MediaRecorderPrivateWriterCocoa.mm:
2924         Unified sources, of course.
2925
2926 2018-12-03  Youenn Fablet  <youenn@apple.com>
2927
2928         A sender created through addTransceiver and populated using addTrack should have its source set
2929         https://bugs.webkit.org/show_bug.cgi?id=192136
2930
2931         Reviewed by Eric Carlson.
2932
2933         In case libwebrtc backend is already created, we need to make sure to
2934         set the track source to the libwebrtc sender backend that is actually
2935         tied to the sender.
2936
2937         Covered by updated test.
2938
2939         * Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.cpp:
2940         (WebCore::LibWebRTCPeerConnectionBackend::removeTrack):
2941         * Modules/mediastream/libwebrtc/LibWebRTCPeerConnectionBackend.cpp:
2942         (WebCore::LibWebRTCPeerConnectionBackend::addTrack):
2943         * Modules/mediastream/libwebrtc/LibWebRTCRtpSenderBackend.h:
2944
2945 2018-12-03  YUHAN WU  <yuhan_wu@apple.com>
2946
2947         Implement non-timeslice mode encoding for MediaRecorder
2948         https://bugs.webkit.org/show_bug.cgi?id=192069
2949
2950         Reviewed by Youenn Fablet.
2951
2952         Implement the encoding for non-timeslice mode of MediaRecorder.
2953         It only supports to record MP4 file through H264 and AAC encoding, we will need to support more MIME types and encoding methods.
2954         Add a API in internals to allow testings to turn on the mock source.
2955
2956         Tests: http/wpt/mediarecorder/MediaRecorder-AV-audio-only-dataavailable.html
2957                http/wpt/mediarecorder/MediaRecorder-AV-audio-video-dataavailable.html
2958                http/wpt/mediarecorder/MediaRecorder-AV-video-only-dataavailable.html
2959
2960         * Modules/mediarecorder/MediaRecorder.cpp:
2961         (WebCore::MediaRecorder::create):
2962         (WebCore::MediaRecorder::setCustomPrivateRecorderCreator):
2963         (WebCore::MediaRecorder::getPrivateImpl):
2964         (WebCore::MediaRecorder::MediaRecorder):
2965         (WebCore::MediaRecorder::stopRecording):
2966         (WebCore::MediaRecorder::stopRecordingInternal):
2967         (WebCore::MediaRecorder::createRecordingDataBlob):
2968         (WebCore::MediaRecorder::scheduleDeferredTask):
2969         * Modules/mediarecorder/MediaRecorder.h:
2970         * Modules/mediarecorder/MediaRecorder.idl:
2971         * SourcesCocoa.txt:
2972         * WebCore.xcodeproj/project.pbxproj:
2973         * platform/mediarecorder/MediaRecorderPrivate.h:
2974         (WebCore::MediaRecorderPrivate::stopRecording):
2975         * platform/mediarecorder/MediaRecorderPrivateAVFImpl.cpp: Added.
2976         (WebCore::MediaRecorderPrivateAVFImpl::create):
2977         (WebCore::MediaRecorderPrivateAVFImpl::MediaRecorderPrivateAVImpl):
2978         (WebCore::MediaRecorderPrivateAVFImpl::sampleBufferUpdated):
2979         (WebCore::MediaRecorderPrivateAVFImpl::audioSamplesAvailable):
2980         (WebCore::MediaRecorderPrivateAVFImpl::stopRecording):
2981         (WebCore::MediaRecorderPrivateAVFImpl::fetchData):
2982         (WebCore::MediaRecorderPrivateAVFImpl::mimeType):
2983         * platform/mediarecorder/MediaRecorderPrivateAVFImpl.h: Added.
2984         * platform/mediarecorder/MediaRecorderPrivateMock.cpp:
2985         (WebCore::MediaRecorderPrivateMock::fetchData):
2986         (WebCore::MediaRecorderPrivateMock::mimeType):
2987         * platform/mediarecorder/MediaRecorderPrivateMock.h:
2988         * platform/mediarecorder/cocoa/MediaRecorderPrivateWriterCocoa.h: Added.
2989         * platform/mediarecorder/cocoa/MediaRecorderPrivateWriterCocoa.mm: Added.
2990         (WebCore::MediaRecorderPrivateWriter::setupWriter):
2991         (WebCore::MediaRecorderPrivateWriter::setVideoInput):
2992         (WebCore::MediaRecorderPrivateWriter::setAudioInput):
2993         (WebCore::copySampleBufferWithCurrentTimeStamp):
2994         (WebCore::MediaRecorderPrivateWriter::appendVideoSampleBuffer):
2995         (WebCore::MediaRecorderPrivateWriter::appendAudioSampleBuffer):
2996         (WebCore::MediaRecorderPrivateWriter::stopRecording):
2997         (WebCore::MediaRecorderPrivateWriter::fetchData):
2998         * testing/Internals.cpp:
2999         (WebCore::createRecorderMockSource):
3000         (WebCore::Internals::setCustomPrivateRecorderCreator):
3001         * testing/Internals.h:
3002         * testing/Internals.idl:
3003
3004 2018-12-03  Simon Fraser  <simon.fraser@apple.com>
3005
3006         REGRESSION (r238090): position:fixed sidebar on https://www.w3.org/TR/SVG2/coords.html does not stay fixed
3007         https://bugs.webkit.org/show_bug.cgi?id=192320
3008         <rdar://problem/46429833>
3009
3010         Reviewed by Zalan Bujtas.
3011         
3012         When we fall into slow scrolling mode (for example, because of background-attachment: fixed),
3013         RenderLayerCompositor::updateCompositingLayers() needs to set the geometry dirty bit on layers
3014         for viewport-constrained objects so we update them.
3015         
3016         This is only necessary for page scrolling; for overflow scrolls, updateLayerPositions() already
3017         does enough dirtying that fixed layers nested inside scrollers get updated.
3018
3019         Test: compositing/fixed-with-main-thread-scrolling.html
3020
3021         * rendering/RenderLayerCompositor.cpp:
3022         (WebCore::RenderLayerCompositor::updateCompositingLayers):
3023
3024 2018-12-03  Justin Michaud  <justin_michaud@apple.com>
3025
3026         CSS Painting API should scale display list when drawing
3027         https://bugs.webkit.org/show_bug.cgi?id=192217
3028
3029         Reviewed by Simon Fraser.
3030
3031         When we replay the display list, fix the scaling. The separate buffer is needed to make sure that globalCompositeOperation functions correctly.
3032
3033         * html/CustomPaintCanvas.cpp:
3034         (WebCore::CustomPaintCanvas::replayDisplayList const):
3035         * html/CustomPaintCanvas.h:
3036         * platform/graphics/CustomPaintImage.cpp:
3037         (WebCore::CustomPaintImage::doCustomPaint):
3038
3039 2018-12-03  Myles C. Maxfield  <mmaxfield@apple.com>
3040
3041         Thick overlines and line-throughs grow in the wrong direction
3042         https://bugs.webkit.org/show_bug.cgi?id=192264
3043
3044         Reviewed by Dean Jackson.
3045
3046         Overlines should grow upward, and line-throughs should stay centered.
3047
3048         Test: fast/css3-text/css3-text-decoration/text-decoration-thicknes-overline-grow-direction.html
3049
3050         * rendering/TextDecorationPainter.cpp:
3051         (WebCore::TextDecorationPainter::paintTextDecoration):
3052         * style/InlineTextBoxStyle.cpp:
3053         (WebCore::visualOverflowForDecorations):
3054
3055 2018-12-03  Simon Fraser  <simon.fraser@apple.com>
3056
3057         Viewport-constrained renderers are always RenderLayerModelObjects
3058         https://bugs.webkit.org/show_bug.cgi?id=192342
3059
3060         Reviewed by Myles C. Maxfield.
3061
3062         addViewportConstrainedObject/removeViewportConstrainedObject can take RenderLayerModelObjects,
3063         since all viewport-constrained renderers have layers.
3064
3065         * page/FrameView.cpp:
3066         (WebCore::FrameView::addViewportConstrainedObject):
3067         (WebCore::FrameView::removeViewportConstrainedObject):
3068         * page/FrameView.h:
3069         * rendering/RenderLayerModelObject.cpp:
3070         (WebCore::RenderLayerModelObject::styleDidChange): The 0 argument is actually a nullptr RenderGeometryMap,
3071         which has a default value, and the comment was obsolete.
3072
3073 2018-12-03  Don Olmstead  <don.olmstead@sony.com>
3074
3075         Fix some unused parameter warnings
3076         https://bugs.webkit.org/show_bug.cgi?id=192336
3077
3078         Reviewed by Fujii Hironori.
3079
3080         * Modules/indexeddb/server/IDBSerialization.cpp:
3081         (WebCore::isLegacySerializedIDBKeyData):
3082         * platform/FileSystem.cpp:
3083         (WebCore::FileSystem::openAndLockFile):
3084         * platform/graphics/opengl/GraphicsContext3DOpenGLCommon.cpp:
3085         (WebCore::GraphicsContext3D::bindVertexArray):
3086         * platform/network/curl/CertificateInfo.h:
3087         (WTF::Persistence::Coder<WebCore::CertificateInfo>::encode):
3088         (WTF::Persistence::Coder<WebCore::CertificateInfo>::decode):
3089
3090 2018-12-03  Keith Rollin  <krollin@apple.com>
3091
3092         Add .xcfilelist files
3093         https://bugs.webkit.org/show_bug.cgi?id=192082
3094         <rdar://problem/46312533>
3095
3096         Reviewed by Brent Fulgham.
3097
3098         Add .xcfilelist files for Generate Derived Sources and Generate
3099         Unified Sources build phases in Xcode. These are just being staged for
3100         now; they'll be added to the Xcode projects later.
3101
3102         No new tests -- no changed functionality.
3103
3104         * DerivedSources-input.xcfilelist: Added.
3105         * DerivedSources-output.xcfilelist: Added.
3106         * UnifiedSources-input.xcfilelist: Added.
3107         * UnifiedSources-output.xcfilelist: Added.
3108
3109 2018-12-03  Alex Christensen  <achristensen@webkit.org>
3110
3111         Add WKWebProcessPlugInLoadDelegate SPI willStartProvisionalLoadForFrame with a completion handler
3112         https://bugs.webkit.org/show_bug.cgi?id=192272
3113
3114         Reviewed by Brady Eidson.
3115
3116         This is needed for rdar://problem/45910057
3117         Covered by an API test.
3118
3119         * loader/EmptyFrameLoaderClient.h:
3120         * loader/FrameLoader.cpp:
3121         (WebCore::FrameLoader::prepareForLoadStart):
3122         (WebCore::FrameLoader::continueLoadAfterNavigationPolicy):
3123         (WebCore::FrameLoader::loadProvisionalItemFromCachedPage):
3124         * loader/FrameLoader.h:
3125         * loader/FrameLoaderClient.h:
3126
3127 2018-12-03  Zalan Bujtas  <zalan@apple.com>
3128
3129         [iOS] Unreviewed build fix.
3130
3131         * page/DOMTimer.cpp:
3132         (WebCore::DOMTimer::fired):
3133
3134 2018-12-03  Jer Noble  <jer.noble@apple.com>
3135
3136         Get rid of old, dead Mac video fullscreen code.
3137         https://bugs.webkit.org/show_bug.cgi?id=192315
3138
3139         Reviewed by Eric Carlson.
3140
3141         * PlatformMac.cmake:
3142         * platform/graphics/avfoundation/MediaPlayerPrivateAVFoundation.cpp:
3143         (WebCore::MediaPlayerPrivateAVFoundation::supportsFullscreen const):
3144
3145 2018-12-03  Ryosuke Niwa  <rniwa@webkit.org>
3146
3147         title attribute on style & link elements should be ignored inside a shadow tree
3148         https://bugs.webkit.org/show_bug.cgi?id=191297
3149
3150         Reviewed by Antti Koivisto.
3151
3152         Fixed the by not setting the stylesheet's title even when the title content attribute is present
3153         or set on SVG/HTML style and link elements inside a shadow tree.
3154
3155         Test: fast/shadow-dom/stylesheet-title-in-shadow-tree.html
3156
3157         * dom/InlineStyleSheetOwner.cpp:
3158         (WebCore::InlineStyleSheetOwner::createSheet):
3159         * html/HTMLLinkElement.cpp:
3160         (WebCore::HTMLLinkElement::parseAttribute):
3161         (WebCore::HTMLLinkElement::initializeStyleSheet):
3162         * html/HTMLStyleElement.cpp:
3163         (WebCore::HTMLStyleElement::parseAttribute):
3164         * style/StyleScope.cpp:
3165         (WebCore::Style::Scope::collectActiveStyleSheets):
3166         * svg/SVGStyleElement.cpp:
3167         (WebCore::SVGStyleElement::parseAttribute):
3168
3169 2018-12-03  Zalan Bujtas  <zalan@apple.com>
3170
3171         [iOS] Add logging channel for hover related content observation
3172         https://bugs.webkit.org/show_bug.cgi?id=192312
3173
3174         Reviewed by Simon Fraser.
3175
3176         * dom/Document.cpp:
3177         (WebCore::Document::scheduleStyleRecalc):
3178         (WebCore::Document::updateStyleIfNeeded):
3179         (WebCore::Document::platformSuspendOrStopActiveDOMObjects):
3180         * page/DOMTimer.cpp:
3181         (WebCore::DOMTimer::install):
3182         (WebCore::DOMTimer::fired):
3183         * page/DOMWindow.cpp:
3184         (WebCore::DOMWindow::clearTimeout):
3185         * page/Frame.cpp:
3186         (WebCore::Frame::willDetachPage):
3187         * platform/Logging.h:
3188
3189 2018-12-03  Michael Catanzaro  <mcatanzaro@igalia.com>
3190
3191         [SOUP] Use SoupSession instead of SoupSessionAsync
3192         https://bugs.webkit.org/show_bug.cgi?id=107451
3193
3194         Reviewed by Carlos Garcia Campos.
3195
3196         With glib-networking 2.57.1, WebKit is no longer able to load TLS error pages. The problem
3197         is a network process deadlock caused by a change in how glib-networking performs certificate
3198         verification. Previously it verified certificates *after* the TLS handshake had completed,
3199         which was weirdly late, but previously not problematic. But now that TLS 1.3 exists,
3200         application data can be sent before certificate verification occurs, which is no good. So I
3201         moved verification to occur during the handshake. I needed to do this regardless because I
3202         need to add a new callback in GnuTLS for another feature. This introduced a deadlock in
3203         WebKit:
3204
3205          - glib-networking detects an unacceptable certificate, emits accept-certificate signal
3206          - NetworkDataTaskSoup::tlsConnectionAcceptCertificate calls
3207            NetworkDataTaskSoup::invalidateAndCancel calls NetworkDataTaskSoup::clearRequest
3208          - NetworkDataTaskSoup::clearRequest calls soup_session_cancel_message
3209
3210         The problem is that, in the deprecated SoupSessionAsync used by WebKit, cancellation is
3211         always *synchronous* despite the name of the class. So soup_session_cancel_message winds up
3212         doing its thing to close everything out, and that eventually ends up in a synchronous call
3213         to g_tls_connection_gnutls_close. The close operation can't proceed until the TLS handshake
3214         is finished, and the handshake is blocked waiting for WebKit to return from its
3215         accept-certificate handler. So the close operation winds up polling forever waiting for the
3216         handshake to finish. Deadlock.
3217
3218         The only changes required in WebKit to use the modern SoupSession are adjustments for the
3219         new default property values. Most of the properties we used to set explicitly are now
3220         defaults and should be removed. Additionally, SoupSession has default timeouts, which we
3221         want to override to allow NetworkDataTaskSoup to implement its own timeouts.
3222
3223         No new tests because this is covered by TestSSL (which would be failing if run with the
3224         newer glib-networking).
3225
3226         * platform/network/soup/SoupNetworkSession.cpp:
3227         (WebCore::SoupNetworkSession::SoupNetworkSession):
3228
3229 2018-12-03  Yusuke Suzuki  <yusukesuzuki@slowstart.org>
3230
3231         Use WallTime for file time
3232         https://bugs.webkit.org/show_bug.cgi?id=192287
3233
3234         Reviewed by Darin Adler.
3235
3236         This patch changes a type of file time from double to WallTime to use strongly typed file time.
3237
3238         No behavior change.
3239
3240         * Modules/webdatabase/Database.cpp:
3241         (WebCore::Database::details const):
3242         * Modules/webdatabase/DatabaseDetails.h:
3243         (WebCore::DatabaseDetails::DatabaseDetails):
3244         (WebCore::DatabaseDetails::creationTime const):
3245         (WebCore::DatabaseDetails::modificationTime const):
3246         * Modules/webdatabase/DatabaseManager.cpp:
3247         (WebCore::DatabaseManager::ProposedDatabase::ProposedDatabase):
3248         * Modules/webdatabase/DatabaseTracker.cpp:
3249         (WebCore::DatabaseTracker::detailsForNameAndOrigin):
3250         * fileapi/AsyncFileStream.cpp:
3251         (WebCore::AsyncFileStream::getSize):
3252         * fileapi/AsyncFileStream.h:
3253         * fileapi/File.cpp:
3254         (WebCore::File::lastModified const):
3255         * page/Page.cpp:
3256         (WebCore::Page::userStyleSheetLocationChanged):
3257         (WebCore::Page::userStyleSheet const):
3258         * page/Page.h:
3259         * platform/FileMetadata.h:
3260         * platform/FileStream.cpp:
3261         (WebCore::FileStream::getSize):
3262         * platform/FileStream.h:
3263         * platform/FileSystem.cpp:
3264         (WebCore::FileSystem::getFileModificationTime): Deleted.
3265         * platform/FileSystem.h:
3266         (WebCore::FileSystem::invalidFileTime): Deleted.
3267         (WebCore::FileSystem::isValidFileTime): Deleted.
3268         * platform/glib/FileSystemGlib.cpp:
3269         (WebCore::FileSystem::getFileCreationTime):
3270         (WebCore::FileSystem::getFileModificationTime):
3271         (WebCore::FileSystem::fileMetadataUsingFunction):
3272         * platform/network/BlobDataFileReference.cpp:
3273         (WebCore::BlobDataFileReference::BlobDataFileReference):
3274         (WebCore::BlobDataFileReference::expectedModificationTime):
3275         * platform/network/BlobDataFileReference.h:
3276         * platform/network/FormData.cpp:
3277         (WebCore::FormData::appendFile):
3278         (WebCore::FormData::appendFileRange):
3279         * platform/network/FormData.h:
3280         (WebCore::FormDataElement::FormDataElement):
3281         (WebCore::FormDataElement::EncodedFileData::decode):
3282         * platform/network/cf/FormDataStreamCFNet.cpp:
3283         (WebCore::advanceCurrentStream):
3284         * platform/network/soup/ResourceRequestSoup.cpp:
3285         (WebCore::appendEncodedBlobItemToSoupMessageBody):
3286         * platform/posix/FileSystemPOSIX.cpp:
3287         (WebCore::FileSystem::getFileCreationTime):
3288         (WebCore::FileSystem::getFileModificationTime):
3289         * platform/sql/SQLiteFileSystem.cpp:
3290         (WebCore::SQLiteFileSystem::databaseCreationTime):
3291         (WebCore::SQLiteFileSystem::databaseModificationTime):
3292         * platform/sql/SQLiteFileSystem.h:
3293         * platform/win/FileSystemWin.cpp:
3294         (WebCore::FileSystem::getFileModificationTime):
3295         (WebCore::FileSystem::getFileCreationTime):
3296         (WebCore::FileSystem::findDataToFileMetadata):
3297
3298 2018-12-03  Dean Jackson  <dino@apple.com>
3299
3300         Fix iOS Simulator Release test crashes.
3301
3302         * platform/network/ios/WebCoreURLResponseIOS.mm:
3303         (WebCore::adjustMIMETypeIfNecessary): Check for null before using the
3304         new MIME type.
3305
3306 2018-12-03  Eric Carlson  <eric.carlson@apple.com>
3307
3308         [MediaStream] 'devicechange' event when more capture device information are revealed.
3309         https://bugs.webkit.org/show_bug.cgi?id=192268
3310
3311         Reviewed by Youenn Fablet.
3312
3313         Test: fast/mediastream/enumerate-devices-change-event.html
3314
3315         * Modules/mediastream/MediaDevicesRequest.cpp:
3316         (WebCore::MediaDevicesRequest::start): Remove code to modify device based on access, that is
3317         now done in the UI process.
3318         (WebCore::MediaDevicesRequest::filterDeviceList): Deleted.
3319         * Modules/mediastream/MediaDevicesRequest.h:
3320         * platform/mediastream/RealtimeMediaSourceCenter.h:
3321
3322 2018-12-03  Wenson Hsieh  <wenson_hsieh@apple.com>
3323
3324         [iOSMac] Unable to upload non-image files using drag and drop in WKWebView
3325         https://bugs.webkit.org/show_bug.cgi?id=192283
3326         <rdar://problem/46399461>
3327
3328         Reviewed by Ryosuke Niwa.
3329
3330         Currently on iOS, file URLs aren't generally written to the pasteboard during drag and drop unless the
3331         application providing the data explicitly registers "public.file-url" to item providers. As such, our current
3332         logic on iOS for handling drops does not attempt to prevent "public.file-url" from being advertised as the
3333         "text/uri-list" MIME type in DataTransfer, though we do currently succeed in suppressing access to the file URL.
3334
3335         However, on iOSMac, the scenario in which file URLs are registered to item providers becomes pertinent when
3336         uploading files from other macOS apps (e.g. Finder) into a WKWebView running in iOSMac. Furthermore, the
3337         `preferredPresentationStyle` flag on `NSItemProvider` is unavailable in iOSMac; currently, this flag is our
3338         primary cue on iOS that an item should be treated as an attachment rather than inline data. In order to support
3339         file uploads in iOSMac, we make several adjustments to drop handling logic in iOS to handle the case where the
3340         "public.file-url" type is registered. See below for more details.
3341
3342         Tests:  DragAndDropTests.DataTransferExposePlainTextWithFileURLAsFile
3343                 DragAndDropTests.DataTransferGetDataWhenDroppingImageWithFileURL
3344
3345         * platform/PasteboardItemInfo.h:
3346         (WebCore::PasteboardItemInfo::encode const):
3347         (WebCore::PasteboardItemInfo::decode):
3348
3349         Add a new flag that is set if and only if the item provider contains the "public.file-url" type, and also
3350         contains some non-URL data type that conforms to one of the file types supported for file uploads (i.e.
3351         "public.content", zip archives, and folders).
3352
3353         * platform/cocoa/PasteboardCocoa.mm:
3354         (WebCore::Pasteboard::fileContentState):
3355
3356         Consider the pasteboard to contain files in the case where one or more of the items contains a file URL, along
3357         with some other pasteboard data that can be represented as a file upload.
3358
3359         * platform/ios/PlatformPasteboardIOS.mm:
3360         (WebCore::PlatformPasteboard::informationForItemAtIndex):
3361         (WebCore::PlatformPasteboard::typesSafeForDOMToReadAndWrite const):
3362
3363         If the pasteboard contains "public.file-url", don't consider "text/uri-list" to be one of the data types that's
3364         safe to expose to the page. Our current behavior in this case is that we will advertise "text/uri-list" as a
3365         pasteboard type in the DataTransfer, but if the page attempts to request this information, we simply return the
3366         empty string. Instead, we shouldn't expose "text/uri-list" as a type in the first place.
3367
3368         * platform/ios/WebItemProviderPasteboard.h:
3369         * platform/ios/WebItemProviderPasteboard.mm:
3370
3371         Add a few more `__bridge`-ing casts where appropriate.
3372
3373         (typeConformsToTypes):
3374
3375         Move this further up the file so that it can be used in `NSItemProvider (WebCoreExtras)`.
3376
3377         (-[NSItemProvider web_containsFileURLAndFileUploadContent]):
3378
3379         Add a helper method on NSItemProvider to determine whether an item provider has a file URL, as well as a content
3380         type suitable for file uploads.
3381
3382         (-[WebItemProviderLoadResult canBeRepresentedAsFileUpload]):
3383
3384         This currently always returns `NO` in iOSMac; instead, return `YES` on both iOS and iOSMac in the case where the
3385         item provider contains a file URL and content which may be uploaded.
3386
3387         (-[WebItemProviderPasteboard preferredFileUploadURLAtIndex:fileType:]):
3388         (-[WebItemProviderPasteboard typeIdentifiersToLoad:]):
3389
3390         Refactor this to take an `NSItemProvider` instead of a list of type identifiers, and bail out of loading data
3391         for "public.url" if the item provider contains a file URL.
3392
3393         (-[WebItemProviderPasteboard doAfterLoadingProvidedContentIntoFileURLs:synchronousTimeout:]):
3394         (-[WebItemProviderPasteboard typeIdentifiersToLoadForRegisteredTypeIdentifiers:]): Deleted.
3395
3396 2018-12-02  Zalan Bujtas  <zalan@apple.com>
3397
3398         Add a runtime feature flag for LayoutFormattingContext.
3399         https://bugs.webkit.org/show_bug.cgi?id=192280
3400
3401         Reviewed by Simon Fraser.
3402
3403         * Configurations/FeatureDefines.xcconfig:
3404         * page/FrameViewLayoutContext.cpp:
3405         (WebCore::layoutUsingFormattingContext):
3406         * page/RuntimeEnabledFeatures.h:
3407         (WebCore::RuntimeEnabledFeatures::setLayoutFormattingContextEnabled):
3408         (WebCore::RuntimeEnabledFeatures::layoutFormattingContextEnabled const):
3409
3410 2018-12-01  Brent Fulgham  <bfulgham@apple.com>
3411
3412         Lifetime of HTMLMediaElement is not properly handled in asynchronous actions
3413         https://bugs.webkit.org/show_bug.cgi?id=192087
3414         <rdar://problem/45975230>
3415
3416         Reviewed by Dean Jackson.
3417
3418         The HTMLMediaElement performs operations that allow arbitrary JavaScript to run. We need to make
3419         sure the active media element is protected until those calls complete.
3420
3421         * html/HTMLMediaElement.cpp:
3422         (WebCore::HTMLMediaElement::didFinishInsertingNode):
3423         (WebCore::HTMLMediaElement::exitFullscreen):
3424         (WebCore::HTMLMediaElement::markCaptionAndSubtitleTracksAsUnconfigured):
3425         (WebCore::HTMLMediaElement::scheduleConfigureTextTracks):