macCatalyst: Cursor should send mouse events, not touch events
[WebKit-https.git] / Source / WebCore / ChangeLog
1 2019-10-18  Tim Horton  <timothy_horton@apple.com>
2
3         macCatalyst: Cursor should send mouse events, not touch events
4         https://bugs.webkit.org/show_bug.cgi?id=203175
5         <rdar://problem/56321134>
6
7         Reviewed by Simon Fraser.
8
9         * dom/Element.cpp:
10         (WebCore::shouldIgnoreMouseEvent):
11         (WebCore::Element::dispatchMouseEvent):
12         * page/PointerCaptureController.cpp:
13         (WebCore::PointerCaptureController::reset):
14         Share more code between platforms that support touch events and platforms that don't;
15         we want to be able to dispatch pointer events that originate from mouse events
16         in macCatalyst despite touch events being enabled (by virtue of being iOS WebKit),
17         so un-ifdef that code.
18
19 2019-10-18  Simon Fraser  <simon.fraser@apple.com>
20
21         Make it possible to query scrollbar pseudo-style without having a scrollbar
22         https://bugs.webkit.org/show_bug.cgi?id=203174
23
24         Reviewed by Tim Horton.
25
26         A future patch needs the ability to query scrollbar pseudo-style without having
27         a scrollbar, and it was ugly to pass a live RenderScrollbar into CSS style resolution
28         functions. Instead, pass in a pure-data object that has information about the scrollbar.
29
30         * css/ElementRuleCollector.cpp:
31         (WebCore::ElementRuleCollector::ruleMatches):
32         * css/SelectorChecker.h:
33         * css/SelectorCheckerTestFunctions.h:
34         (WebCore::scrollbarMatchesEnabledPseudoClass):
35         (WebCore::scrollbarMatchesDisabledPseudoClass):
36         (WebCore::scrollbarMatchesHoverPseudoClass):
37         (WebCore::scrollbarMatchesActivePseudoClass):
38         (WebCore::scrollbarMatchesHorizontalPseudoClass):
39         (WebCore::scrollbarMatchesVerticalPseudoClass):
40         (WebCore::scrollbarMatchesDecrementPseudoClass):
41         (WebCore::scrollbarMatchesIncrementPseudoClass):
42         (WebCore::scrollbarMatchesStartPseudoClass):
43         (WebCore::scrollbarMatchesEndPseudoClass):
44         (WebCore::scrollbarMatchesDoubleButtonPseudoClass):
45         (WebCore::scrollbarMatchesSingleButtonPseudoClass):
46         (WebCore::scrollbarMatchesNoButtonPseudoClass):
47         (WebCore::scrollbarMatchesCornerPresentPseudoClass):
48         * css/StyleResolver.h:
49         (WebCore::PseudoStyleRequest::PseudoStyleRequest):
50         * rendering/RenderScrollbar.cpp:
51         (WebCore::RenderScrollbar::getScrollbarPseudoStyle):
52
53 2019-10-18  Said Abou-Hallawa  <sabouhallawa@apple.com>
54
55         [SVG2]: Remove the SVGExternalResourcesRequired interface
56         https://bugs.webkit.org/show_bug.cgi?id=191293
57
58         Reviewed by Simon Fraser.
59
60         The spec page is: https://www.w3.org/TR/SVG/changes.html.
61
62         r251290 made externalResourcesRequired have no effect on firing the load
63         event. All the control was moved to SVGURIReference. This patch will remove
64         this interface entirely to conform with SVG2 specs and other browsers.
65
66         * CMakeLists.txt:
67         * DerivedSources-input.xcfilelist:
68         * DerivedSources-output.xcfilelist:
69         * DerivedSources.make:
70         * Sources.txt:
71         * WebCore.xcodeproj/project.pbxproj:
72         * svg/SVGAElement.cpp:
73         (WebCore::SVGAElement::SVGAElement):
74         (WebCore::SVGAElement::parseAttribute):
75         (WebCore::SVGAElement::svgAttributeChanged):
76         * svg/SVGAElement.h:
77         * svg/SVGAElement.idl:
78         * svg/SVGAnimationElement.cpp:
79         (WebCore::SVGAnimationElement::SVGAnimationElement):
80         (WebCore::SVGAnimationElement::isSupportedAttribute):
81         (WebCore::SVGAnimationElement::parseAttribute):
82         * svg/SVGAnimationElement.h:
83         * svg/SVGAnimationElement.idl:
84         * svg/SVGCircleElement.cpp:
85         (WebCore::SVGCircleElement::SVGCircleElement):
86         (WebCore::SVGCircleElement::parseAttribute):
87         (WebCore::SVGCircleElement::svgAttributeChanged):
88         * svg/SVGCircleElement.h:
89         * svg/SVGCircleElement.idl:
90         * svg/SVGClipPathElement.cpp:
91         (WebCore::SVGClipPathElement::SVGClipPathElement):
92         (WebCore::SVGClipPathElement::parseAttribute):
93         (WebCore::SVGClipPathElement::svgAttributeChanged):
94         * svg/SVGClipPathElement.h:
95         * svg/SVGClipPathElement.idl:
96         * svg/SVGCursorElement.cpp:
97         (WebCore::SVGCursorElement::SVGCursorElement):
98         (WebCore::SVGCursorElement::parseAttribute):
99         * svg/SVGCursorElement.h:
100         * svg/SVGCursorElement.idl:
101         * svg/SVGDefsElement.cpp:
102         (WebCore::SVGDefsElement::SVGDefsElement):
103         * svg/SVGDefsElement.h:
104         * svg/SVGDefsElement.idl:
105         * svg/SVGEllipseElement.cpp:
106         (WebCore::SVGEllipseElement::SVGEllipseElement):
107         (WebCore::SVGEllipseElement::parseAttribute):
108         (WebCore::SVGEllipseElement::svgAttributeChanged):
109         * svg/SVGEllipseElement.h:
110         * svg/SVGEllipseElement.idl:
111         * svg/SVGExternalResourcesRequired.cpp: Removed.
112         * svg/SVGExternalResourcesRequired.h: Removed.
113         * svg/SVGExternalResourcesRequired.idl: Removed.
114         * svg/SVGFEImageElement.cpp:
115         (WebCore::SVGFEImageElement::SVGFEImageElement):
116         (WebCore::SVGFEImageElement::parseAttribute):
117         * svg/SVGFEImageElement.h:
118         * svg/SVGFEImageElement.idl:
119         * svg/SVGFilterElement.cpp:
120         (WebCore::SVGFilterElement::SVGFilterElement):
121         (WebCore::SVGFilterElement::parseAttribute):
122         (WebCore::SVGFilterElement::svgAttributeChanged):
123         * svg/SVGFilterElement.h:
124         * svg/SVGFilterElement.idl:
125         * svg/SVGFontElement.cpp:
126         (WebCore::SVGFontElement::SVGFontElement):
127         * svg/SVGFontElement.h:
128         * svg/SVGForeignObjectElement.cpp:
129         (WebCore::SVGForeignObjectElement::SVGForeignObjectElement):
130         (WebCore::SVGForeignObjectElement::parseAttribute):
131         (WebCore::SVGForeignObjectElement::svgAttributeChanged):
132         * svg/SVGForeignObjectElement.h:
133         * svg/SVGForeignObjectElement.idl:
134         * svg/SVGGElement.cpp:
135         (WebCore::SVGGElement::SVGGElement):
136         (WebCore::SVGGElement::parseAttribute): Deleted.
137         (WebCore::SVGGElement::svgAttributeChanged): Deleted.
138         * svg/SVGGElement.h:
139         * svg/SVGGElement.idl:
140         * svg/SVGGradientElement.cpp:
141         (WebCore::SVGGradientElement::SVGGradientElement):
142         (WebCore::SVGGradientElement::parseAttribute):
143         * svg/SVGGradientElement.h:
144         * svg/SVGGradientElement.idl:
145         * svg/SVGImageElement.cpp:
146         (WebCore::SVGImageElement::SVGImageElement):
147         (WebCore::SVGImageElement::parseAttribute):
148         (WebCore::SVGImageElement::svgAttributeChanged):
149         * svg/SVGImageElement.h:
150         * svg/SVGImageElement.idl:
151         * svg/SVGLineElement.cpp:
152         (WebCore::SVGLineElement::SVGLineElement):
153         (WebCore::SVGLineElement::parseAttribute):
154         (WebCore::SVGLineElement::svgAttributeChanged):
155         * svg/SVGLineElement.h:
156         * svg/SVGLineElement.idl:
157         * svg/SVGMPathElement.cpp:
158         (WebCore::SVGMPathElement::SVGMPathElement):
159         (WebCore::SVGMPathElement::parseAttribute):
160         (WebCore::SVGMPathElement::svgAttributeChanged):
161         * svg/SVGMPathElement.h:
162         * svg/SVGMPathElement.idl:
163         * svg/SVGMarkerElement.cpp:
164         (WebCore::SVGMarkerElement::SVGMarkerElement):
165         (WebCore::SVGMarkerElement::parseAttribute):
166         (WebCore::SVGMarkerElement::svgAttributeChanged):
167         * svg/SVGMarkerElement.h:
168         * svg/SVGMarkerElement.idl:
169         * svg/SVGMaskElement.cpp:
170         (WebCore::SVGMaskElement::SVGMaskElement):
171         (WebCore::SVGMaskElement::parseAttribute):
172         (WebCore::SVGMaskElement::svgAttributeChanged):
173         * svg/SVGMaskElement.h:
174         * svg/SVGMaskElement.idl:
175         * svg/SVGPathElement.cpp:
176         (WebCore::SVGPathElement::SVGPathElement):
177         (WebCore::SVGPathElement::parseAttribute):
178         (WebCore::SVGPathElement::svgAttributeChanged):
179         * svg/SVGPathElement.h:
180         * svg/SVGPathElement.idl:
181         * svg/SVGPatternElement.cpp:
182         (WebCore::SVGPatternElement::SVGPatternElement):
183         (WebCore::SVGPatternElement::parseAttribute):
184         (WebCore::SVGPatternElement::svgAttributeChanged):
185         * svg/SVGPatternElement.h:
186         * svg/SVGPatternElement.idl:
187         * svg/SVGPolyElement.cpp:
188         (WebCore::SVGPolyElement::SVGPolyElement):
189         (WebCore::SVGPolyElement::parseAttribute):
190         (WebCore::SVGPolyElement::svgAttributeChanged):
191         * svg/SVGPolyElement.h:
192         * svg/SVGPolygonElement.idl:
193         * svg/SVGPolylineElement.idl:
194         * svg/SVGRectElement.cpp:
195         (WebCore::SVGRectElement::SVGRectElement):
196         (WebCore::SVGRectElement::parseAttribute):
197         (WebCore::SVGRectElement::svgAttributeChanged):
198         * svg/SVGRectElement.h:
199         * svg/SVGRectElement.idl:
200         * svg/SVGSVGElement.cpp:
201         (WebCore::SVGSVGElement::SVGSVGElement):
202         (WebCore::SVGSVGElement::parseAttribute):
203         (WebCore::SVGSVGElement::svgAttributeChanged):
204         * svg/SVGSVGElement.h:
205         * svg/SVGSVGElement.idl:
206         * svg/SVGScriptElement.cpp:
207         (WebCore::SVGScriptElement::SVGScriptElement):
208         (WebCore::SVGScriptElement::parseAttribute):
209         (WebCore::SVGScriptElement::svgAttributeChanged):
210         * svg/SVGScriptElement.h:
211         * svg/SVGScriptElement.idl:
212         * svg/SVGSwitchElement.cpp:
213         (WebCore::SVGSwitchElement::SVGSwitchElement):
214         * svg/SVGSwitchElement.h:
215         * svg/SVGSwitchElement.idl:
216         * svg/SVGSymbolElement.cpp:
217         (WebCore::SVGSymbolElement::SVGSymbolElement):
218         (WebCore::SVGSymbolElement::parseAttribute):
219         (WebCore::SVGSymbolElement::svgAttributeChanged): Deleted.
220         * svg/SVGSymbolElement.h:
221         * svg/SVGSymbolElement.idl:
222         * svg/SVGTextContentElement.cpp:
223         (WebCore::SVGTextContentElement::SVGTextContentElement):
224         (WebCore::SVGTextContentElement::parseAttribute):
225         (WebCore::SVGTextContentElement::svgAttributeChanged):
226         * svg/SVGTextContentElement.h:
227         * svg/SVGTextContentElement.idl:
228         * svg/SVGUseElement.cpp:
229         (WebCore::SVGUseElement::SVGUseElement):
230         (WebCore::SVGUseElement::parseAttribute):
231         (WebCore::SVGUseElement::svgAttributeChanged):
232         * svg/SVGUseElement.h:
233         * svg/SVGUseElement.idl:
234         * svg/SVGViewElement.cpp:
235         (WebCore::SVGViewElement::SVGViewElement):
236         (WebCore::SVGViewElement::parseAttribute):
237         (WebCore::SVGViewElement::svgAttributeChanged):
238         * svg/SVGViewElement.h:
239         * svg/SVGViewElement.idl:
240
241 2019-10-18  Wenson Hsieh  <wenson_hsieh@apple.com>
242
243         [Clipboard API] Refactor Pasteboard::read() to take an optional item index
244         https://bugs.webkit.org/show_bug.cgi?id=203161
245
246         Reviewed by Tim Horton.
247
248         Adds an optional `itemIndex` argument to Pasteboard::read(PasteboardPlainText&) and
249         Pasteboard::read(PasteboardWebContentReader&, WebContentReadingPolicy). See below for more details.
250
251         Tests:  CopyHTML.ItemTypesWhenCopyingWebContent
252                 PasteWebArchive.WebArchiveTypeIdentifier
253
254         * editing/mac/EditorMac.mm:
255         (WebCore::Editor::dataSelectionForPasteboard):
256
257         Recognize "com.apple.webarchive" alongside "Apple Web Archive pasteboard type" when writing and reading from the
258         platform pasteboard on macOS. We add support for this here because the existing private type cannot be written
259         to an NSPasteboardItem, since it does not conform to a valid UTI format. Luckily, there already exists a UTI
260         that represents a web archive, so we can use it instead.
261
262         We need to write and read web archive data from NSPasteboardItem in order to support the case where there are
263         multiple items in the pasteboard that contain different web archive data.
264
265         * platform/Pasteboard.h:
266         * platform/StaticPasteboard.h:
267         * platform/gtk/PasteboardGtk.cpp:
268         (WebCore::Pasteboard::read):
269         * platform/ios/PasteboardIOS.mm:
270         (WebCore::Pasteboard::read):
271
272         Read the string from `itemIndex` if specified; otherwise, fall back to index 0. This could actually be fixed in
273         the future to scan all pasteboard items for a suitable string instead of falling back on the first item, but for
274         now, we maintain the existing behavior.
275
276         (WebCore::Pasteboard::readRespectingUTIFidelities):
277
278         If an `itemIndex` is specified, ignore all other item indices when looking for suitable content.
279
280         * platform/libwpe/PasteboardLibWPE.cpp:
281         (WebCore::Pasteboard::read):
282         * platform/mac/DragDataMac.mm:
283         (WebCore::DragData::containsCompatibleContent const):
284         * platform/mac/PasteboardMac.mm:
285         (WebCore::Pasteboard::write):
286         (WebCore::readStringAtPreferredItemIndex):
287         (WebCore::readBufferAtPreferredItemIndex):
288
289         Add helper methods to read strings and buffers from the pasteboard, at an optional `itemIndex` if specified.
290
291         (WebCore::Pasteboard::read):
292
293         Adopt the helper functions when reading plain text and web content, and respect the given `itemIndex`. To do
294         this, we need to read both legacy and modern types from the pasteboard, instead of just legacy types. This is
295         because NSPasteboardItem on macOS only accepts and provides data in the form of modern pasteboard types.
296
297         * platform/mac/PlatformPasteboardMac.mm:
298         (WebCore::safeTypeForDOMToReadAndWriteForPlatformType):
299         (WebCore::PlatformPasteboard::readBuffer const):
300         (WebCore::PlatformPasteboard::readString const):
301
302         Fix these methods to accept platform pasteboard types instead of MIME types, to match the behavior of existing
303         readBuffer and readString methods in PlatformPasteboardIOS.
304
305         * platform/win/PasteboardWin.cpp:
306         (WebCore::Pasteboard::read):
307
308 2019-10-18  Devin Rousso  <drousso@apple.com>
309
310         [ASAN] Fix WebGPU tests after r250258
311         https://bugs.webkit.org/show_bug.cgi?id=203133
312         <rdar://problem/56379008>
313
314         Reviewed by Joseph Pecoraro.
315
316         * platform/graphics/gpu/GPUObjectBase.h:
317         (WebCore::GPUObjectBase::~GPUObjectBase): Added.
318         Add a default virtual destructor since this class class is the one that is `RefCounted` and
319         the `WebGPUPipeline` subclass is virtual.
320
321         * Modules/webgpu/WebGPUPipeline.h:
322         (WebCore::WebGPUPipeline::scriptExecutionContext const): Deleted.
323         * Modules/webgpu/WebGPUPipeline.cpp:
324         (WebCore::WebGPUPipeline::WebGPUPipeline):
325         (WebCore::WebGPUPipeline::contextDestroyed): Added.
326         Make `WebGPUPipeline` a subclass of `ContextDestructionObserver` so that the raw pointer to
327         the associated `ScriptExecutionContext` is properly cleared and isn't UAFd.
328
329         * Modules/webgpu/WebGPUComputePipeline.h:
330         * Modules/webgpu/WebGPUComputePipeline.cpp:
331         (WebCore::WebGPUComputePipeline::create):
332         (WebCore::WebGPUComputePipeline::WebGPUComputePipeline):
333         (WebCore::WebGPUComputePipeline::cloneShaderModules):
334         (WebCore::WebGPUComputePipeline::recompile):
335         * Modules/webgpu/WebGPURenderPipeline.h:
336         * Modules/webgpu/WebGPURenderPipeline.cpp:
337         (WebCore::WebGPURenderPipeline::create):
338         (WebCore::WebGPURenderPipeline::WebGPURenderPipeline):
339         (WebCore::WebGPURenderPipeline::cloneShaderModules):
340         (WebCore::WebGPURenderPipeline::recompile):
341         * Modules/webgpu/WebGPUDevice.cpp:
342         (WebCore::WebGPUDevice::createRenderPipeline):
343         (WebCore::WebGPUDevice::createComputePipeline):
344         Rework how Web Inspector preserves related shader modules so that there isn't as much wasted
345         space in the class layout, as we can use the `RefPtr` itself instead of an `Optional`.
346
347         * Modules/webgpu/WebGPUBuffer.idl:
348         Now that `GPUObjectBase` has a virtual destructor, it has a vtable, which means that this
349         object also does and therefore cannot be marked with `ImplementationLacksVTable`.
350
351         * inspector/InspectorShaderProgram.cpp:
352         (WebCore::shaderForType):
353         (WebCore::InspectorShaderProgram::requestShaderSource):
354         (WebCore::InspectorShaderProgram::updateShader):
355         (WebCore::InspectorShaderProgram::buildObjectForShaderProgram):
356
357 2019-10-18  Ryosuke Niwa  <rniwa@webkit.org>
358
359         Refactor AbstractEventLoop out of WindowEventLoop
360         https://bugs.webkit.org/show_bug.cgi?id=203136
361         <rdar://problem/56396749>
362
363         Reviewed by Antti Koivisto.
364
365         Extract AbstractEventLoop out of WindowEventLoop as a preparation for adding WorkerEventLoop.
366
367         Also replaced m_activeTaskCount with a boolean m_isScheduledToRun since it doesn't need to count.
368
369         * WebCore.xcodeproj/project.pbxproj:
370         * dom/AbstractEventLoop.cpp: Added.
371         * dom/AbstractEventLoop.h: Added.
372         (WebCore::AbstractEventLoop): Added.
373         * dom/WindowEventLoop.cpp:
374         (WebCore::WindowEventLoop::WindowEventLoop): Deleted. Use the default constructor in the header instead.
375         (WebCore::WindowEventLoop::queueTask):
376         (WebCore::WindowEventLoop::suspend):
377         (WebCore::WindowEventLoop::resume):
378         (WebCore::WindowEventLoop::scheduleToRunIfNeeded): Extracted out of queueTask.
379         (WebCore::WindowEventLoop::run):
380         * dom/WindowEventLoop.h:
381
382 2019-10-18  Devin Rousso  <drousso@apple.com>
383
384         Web Inspector: Elements: allow WebKit engineers to edit UserAgent shadow trees
385         https://bugs.webkit.org/show_bug.cgi?id=203159
386
387         Reviewed by Brian Burg.
388
389         Test: inspector/dom/setAllowEditingUserAgentShadowTrees.html
390
391         * inspector/agents/InspectorDOMAgent.h:
392         * inspector/agents/InspectorDOMAgent.cpp:
393         (WebCore::InspectorDOMAgent::assertEditableNode):
394         (WebCore::InspectorDOMAgent::setInspectedNode):
395         (WebCore::InspectorDOMAgent::setAllowEditingUserAgentShadowTrees): Added.
396
397 2019-10-17  Ryosuke Niwa  <rniwa@webkit.org>
398
399         Document::m_closeAfterStyleRecalc is unnecessary
400         https://bugs.webkit.org/show_bug.cgi?id=203143
401
402         Reviewed by Antti Koivisto.
403
404         Removed the code to defer implicit close until the style recalc is done
405         since we call FrameLoader::checkCompleted asynchronously via a timer these days.
406
407         * dom/Document.cpp:
408         (WebCore::Document::resolveStyle):
409         (WebCore::Document::implicitClose):
410         * dom/Document.h:
411
412 2019-10-17  Dean Jackson  <dino@apple.com>
413
414         texImage2D for a half-float texture only accepts null
415         https://bugs.webkit.org/show_bug.cgi?id=169999
416         <rdar://problem/31713571>
417
418         Reviewed by Simon Fraser.
419
420         After we initially implemented this, the extension was
421         modified such that texImage2D could upload to half-float
422         from a Uint16 array.
423
424         Test: fast/canvas/webgl/oes-texture-half-float-uint16.html
425
426         * html/canvas/WebGLRenderingContextBase.cpp:
427         (WebCore::WebGLRenderingContextBase::validateArrayBufferType): Accept
428         Uint16.
429
430 2019-10-18  Daniel Bates  <dabates@apple.com>
431
432         REGRESSION (r241747): [iOS] Adjust default SVG focus ring width to match width for HTML documents
433         https://bugs.webkit.org/show_bug.cgi?id=203011
434
435         Reviewed by Wenson Hsieh.
436
437         Update default user agent stylesheet for SVG documents (i.e. .svg resources) to use the same 3px
438         outline width for focused elements as we do for HTML documents.
439
440         This makes the test imported/blink/svg/custom/focus-ring-2.svg pass on iOS.
441
442         * css/svg.css:
443
444 2019-10-18  Jer Noble  <jer.noble@apple.com>
445
446         Add experimental HDR MediaCapabilities support.
447         https://bugs.webkit.org/show_bug.cgi?id=203113
448
449         Reviewed by Eric Carlson.
450
451         Tests: media/mediacapabilities/mock-decodingInfo-hdr.html
452                platform/mac/media/mediacapabilities/hevc-decodingInfo-hdr.html
453
454         Add support for MediaCapabilities.decodeInfo() HDR support detection.
455
456         Add new enum IDL types to MediaCapabilities and remove old unused ones. Add
457         mock implementation for HDR detection. Add Cocoa platform implementation.
458
459         * CMakeLists.txt:
460         * DerivedSources-input.xcfilelist:
461         * DerivedSources-output.xcfilelist:
462         * DerivedSources.make:
463         * Modules/mediacapabilities/ColorGamut.idl: 
464         * Modules/mediacapabilities/HdrMetadataType.idl: 
465         * Modules/mediacapabilities/ScreenLuminance.h: 
466         * Modules/mediacapabilities/TransferFunction.idl: 
467         * Modules/mediacapabilities/VideoConfiguration.idl:
468         * Scripts/GenerateSettings.rb:
469         * Sources.txt:
470         * WebCore.xcodeproj/project.pbxproj:
471         * bindings/scripts/CodeGenerator.pm:
472         (WK_ucfirst):
473         * bindings/scripts/CodeGeneratorJS.pm:
474         (ToMethodName):
475         * page/Settings.yaml:
476         * platform/graphics/cocoa/MediaEngineConfigurationFactoryCocoa.cpp:
477         (WebCore::createMediaPlayerDecodingConfigurationCocoa):
478         * platform/mediacapabilities/ColorGamut.h: 
479         * platform/mediacapabilities/HdrMetadataType.h: 
480         * platform/mediacapabilities/TransferFunction.h: 
481         * platform/mediacapabilities/VideoConfiguration.h:
482         * platform/mock/MediaEngineConfigurationFactoryMock.cpp:
483         (WebCore::canDecodeMedia):
484         (WebCore::canEncodeMedia):
485
486 2019-10-18  Jiewen Tan  <jiewen_tan@apple.com>
487
488         [WebAuthn] Implement AuthenticatorCancel
489         https://bugs.webkit.org/show_bug.cgi?id=191523
490         <rdar://problem/55920204>
491
492         Reviewed by Brent Fulgham.
493
494         Covered by new tests in existing test files.
495
496         * Modules/credentialmanagement/CredentialsContainer.cpp:
497         (WebCore::CredentialsContainer::get):
498         (WebCore::CredentialsContainer::isCreate):
499         * Modules/webauthn/AuthenticatorCoordinator.cpp:
500         (WebCore::AuthenticatorCoordinator::create const):
501         (WebCore::AuthenticatorCoordinator::discoverFromExternalSource const):
502         * Modules/webauthn/AuthenticatorCoordinator.h:
503         * Modules/webauthn/AuthenticatorCoordinatorClient.cpp: Removed.
504         * Modules/webauthn/AuthenticatorCoordinatorClient.h:
505         * Modules/webauthn/PublicKeyCredential.cpp:
506         (WebCore::PublicKeyCredential::tryCreate):
507         * Modules/webauthn/PublicKeyCredential.h:
508         * Modules/webauthn/PublicKeyCredentialData.h:
509         * Modules/webauthn/fido/DeviceRequestConverter.h:
510         * Modules/webauthn/fido/FidoHidMessage.cpp:
511         (fido::FidoHidMessage::FidoHidMessage):
512         * Modules/webauthn/fido/FidoHidPacket.cpp:
513         (fido::FidoHidInitPacket::getSerializedData const):
514         (fido::FidoHidContinuationPacket::getSerializedData const):
515         * Sources.txt:
516         * WebCore.xcodeproj/project.pbxproj:
517         * testing/MockWebAuthenticationConfiguration.h:
518         (WebCore::MockWebAuthenticationConfiguration::HidConfiguration::encode const):
519         (WebCore::MockWebAuthenticationConfiguration::HidConfiguration::decode):
520         * testing/MockWebAuthenticationConfiguration.idl:
521         Adds a new option to test AuthenticatorCancel.
522
523 2019-10-18  Simon Fraser  <simon.fraser@apple.com>
524
525         Add TextStream dumping for BasicShape types
526         https://bugs.webkit.org/show_bug.cgi?id=203150
527
528         Reviewed by Zalan Bujtas.
529
530         Add dumping for the classes, and make the BasicShape enum an enum class.
531
532         * css/BasicShapeFunctions.cpp:
533         (WebCore::valueForBasicShape):
534         * rendering/shapes/Shape.cpp:
535         (WebCore::Shape::createShape):
536         * rendering/style/BasicShapes.cpp:
537         (WebCore::BasicShapeCircle::dump const):
538         (WebCore::BasicShapeEllipse::dump const):
539         (WebCore::BasicShapePolygon::dump const):
540         (WebCore::BasicShapePath::dump const):
541         (WebCore::BasicShapeInset::dump const):
542         (WebCore::operator<<):
543         * rendering/style/BasicShapes.h:
544         (WebCore::BasicShapeCenterCoordinate::BasicShapeCenterCoordinate):
545
546 2019-10-18  Antti Koivisto  <antti@apple.com>
547
548         ElementRuleCollector function signature cleanups
549         https://bugs.webkit.org/show_bug.cgi?id=203153
550         <rdar://problem/56412684>
551
552         Unreviewed followup.
553
554         * css/ElementRuleCollector.cpp:
555         (WebCore::ElementRuleCollector::transferMatchedRules):
556
557         Try to appease MSVC.
558
559 2019-10-18  Said Abou-Hallawa  <sabouhallawa@apple.com>
560
561         Load event must be fired only for the SVG structurally external elements and the outermost SVG element
562         https://bugs.webkit.org/show_bug.cgi?id=203044
563
564         Reviewed by Simon Fraser.
565
566         The SVG1.1 spec for SVGLoad event is:
567             https://www.w3.org/TR/SVG11/interact.html
568
569         The SVG2 spec for the load event is:
570             https://www.w3.org/TR/SVG/changes.html#interact
571             https://www.w3.org/TR/SVG/interact.html
572
573         SVG2 removes the SVGExternalResourcesRequired interface. It also simplifies
574         the rules for firing the load event and made them consistent with the HTML
575         specs. The plan is to remove SVGExternalResourcesRequired in a following
576         patch. This patch makes SVGExternalResourcesRequired have no effect on the
577         load event firing rules. It moves all the functionalities to SVGURIReference
578         as a step towards removing the SVGExternalResourcesRequired interface.
579
580         Test: svg/custom/image-load-event.html
581
582         * dom/Document.cpp:
583         (WebCore::Document::implicitClose):
584         Do not use the SVGLoad term. It has been removed from the specs.
585
586         * dom/ScriptElement.cpp:
587         (WebCore::ScriptElement::ScriptElement):
588         * dom/ScriptElement.h:
589         (WebCore::ScriptElement::errorOccurred const):
590         (WebCore::ScriptElement::setErrorOccurred):
591         Add a method to track the occurrence  of loading error. errorOccurred()
592         || haveFiredLoadEvent() means no pending loading activity.
593
594         * svg/SVGDocumentExtensions.cpp:
595         (WebCore::SVGDocumentExtensions::dispatchLoadEventToOutermostSVGElements):
596         (WebCore::SVGDocumentExtensions::dispatchSVGLoadEventToOutermostSVGElements): Deleted.
597         * svg/SVGDocumentExtensions.h:
598         Do not use the SVGLoad term. 
599
600         * svg/SVGElement.cpp:
601         (WebCore::SVGElement::sendLoadEventIfPossible):
602         (WebCore::SVGElement::loadEventTimerFired):
603         (WebCore::SVGElement::loadEventTimer):
604         (WebCore::SVGElement::finishParsingChildren):
605         (WebCore::SVGElement::sendSVGLoadEventIfPossible): Deleted.
606         (WebCore::SVGElement::sendSVGLoadEventIfPossibleAsynchronously): Deleted.
607         (WebCore::SVGElement::svgLoadEventTimerFired): Deleted.
608         (WebCore::SVGElement::svgLoadEventTimer): Deleted.
609         * svg/SVGElement.h:
610         finishParsingChildren() won't fire 'load' event anymore. The 'load' event 
611         will be fired explicitly for the outermost SVG element from Document::implicitClose().
612
613         * svg/SVGExternalResourcesRequired.cpp:
614         (WebCore::SVGExternalResourcesRequired::svgAttributeChanged):
615         (WebCore::SVGExternalResourcesRequired::dispatchLoadEvent): Deleted.
616         (WebCore::SVGExternalResourcesRequired::insertedIntoDocument): Deleted.
617         (WebCore::SVGExternalResourcesRequired::finishParsingChildren): Deleted.
618         (WebCore::SVGExternalResourcesRequired::haveLoadedRequiredResources const): Deleted.
619         * svg/SVGExternalResourcesRequired.h:
620         (WebCore::SVGExternalResourcesRequired::setHaveFiredLoadEvent): Deleted.
621         (WebCore::SVGExternalResourcesRequired::isParserInserted const): Deleted.
622         (WebCore::SVGExternalResourcesRequired::haveFiredLoadEvent const): Deleted.
623         * svg/SVGImageElement.cpp:
624         (WebCore::SVGImageElement::haveLoadedRequiredResources):
625         * svg/SVGImageLoader.cpp:
626         (WebCore::SVGImageLoader::dispatchLoadEvent):
627         The value of externalResourcesRequired() no longer controls firing the
628         'load' event.
629
630         * svg/SVGScriptElement.cpp:
631         (WebCore::SVGScriptElement::SVGScriptElement):
632         (WebCore::SVGScriptElement::insertedIntoAncestor):
633         (WebCore::SVGScriptElement::dispatchErrorEvent):
634         (WebCore::SVGScriptElement::finishParsingChildren): Deleted.
635         * svg/SVGScriptElement.h:
636         dispatchErrorEvent() is now a virtual function. Let SVGScriptElement
637         overrides it so it can track when the loader finishes its activity.
638
639         * svg/SVGStyleElement.cpp:
640         (WebCore::SVGStyleElement::SVGStyleElement):
641         * svg/SVGStyleElement.h:
642
643         * svg/SVGURIReference.cpp:
644         (WebCore::SVGURIReference::contextElement const):
645         (WebCore::SVGURIReference::parseAttribute):
646         (WebCore::SVGURIReference::haveLoadedRequiredResources const):
647         (WebCore::SVGURIReference::dispatchLoadEvent):
648         * svg/SVGURIReference.h:
649         (WebCore::SVGURIReference::haveFiredLoadEvent const):
650         (WebCore::SVGURIReference::setHaveFiredLoadEvent):
651         (WebCore::SVGURIReference::errorOccurred const):
652         (WebCore::SVGURIReference::setErrorOccurred):
653         SVGURIReference will decide whether the 'load' event can be fired or not.
654
655         * svg/SVGUseElement.cpp:
656         (WebCore::SVGUseElement::SVGUseElement):
657         (WebCore::SVGUseElement::insertedIntoAncestor):
658         (WebCore::SVGUseElement::notifyFinished):
659         (WebCore::SVGUseElement::finishParsingChildren): Deleted.
660         (WebCore::SVGUseElement::isValid const): Deleted.
661         (WebCore::SVGUseElement::haveLoadedRequiredResources): Deleted.
662         (WebCore::SVGUseElement::setHaveFiredLoadEvent): Deleted.
663         (WebCore::SVGUseElement::haveFiredLoadEvent const): Deleted.
664         (WebCore::SVGUseElement::svgLoadEventTimer): Deleted.
665         * svg/SVGUseElement.h:
666         SVGUseElement needs to track firing the load event or error occurrence 
667         the same way SVGImageElement and SVGScriptElement do.
668
669 2019-10-18  Antti Koivisto  <antti@apple.com>
670
671         ElementRuleCollector function signature cleanups
672         https://bugs.webkit.org/show_bug.cgi?id=203153
673
674         Reviewed by Zalan Bujtas.
675
676         Many functions in ElementRuleCollector take repetitive arguments that can be removed:
677
678         - Make includeEmptyRules argument a class member
679         - Remove RuleRange argument, update the ranges in rule transfer step.
680
681         * css/ElementRuleCollector.cpp:
682         (WebCore::MatchRequest::MatchRequest):
683         (WebCore::ElementRuleCollector::addMatchedRule):
684         (WebCore::ElementRuleCollector::collectMatchingRules):
685         (WebCore::ElementRuleCollector::sortAndTransferMatchedRules):
686         (WebCore::ElementRuleCollector::transferMatchedRules):
687         (WebCore::ElementRuleCollector::matchAuthorRules):
688         (WebCore::ElementRuleCollector::matchesAnyAuthorRules):
689         (WebCore::ElementRuleCollector::collectMatchingAuthorRules):
690         (WebCore::ElementRuleCollector::matchAuthorShadowPseudoElementRules):
691         (WebCore::ElementRuleCollector::matchHostPseudoClassRules):
692         (WebCore::ElementRuleCollector::matchSlottedPseudoElementRules):
693         (WebCore::ElementRuleCollector::matchPartPseudoElementRules):
694         (WebCore::ElementRuleCollector::matchPartPseudoElementRulesForScope):
695         (WebCore::ElementRuleCollector::collectMatchingShadowPseudoElementRules):
696         (WebCore::ElementRuleCollector::collectSlottedPseudoElementRulesForSlot):
697         (WebCore::ElementRuleCollector::matchUserRules):
698         (WebCore::ElementRuleCollector::matchUARules):
699         (WebCore::ElementRuleCollector::collectMatchingRulesForList):
700         (WebCore::ElementRuleCollector::matchAllRules):
701         (WebCore::ElementRuleCollector::hasAnyMatchingRules):
702         * css/ElementRuleCollector.h:
703         (WebCore::ElementRuleCollector::setIncludeEmptyRules):
704         (WebCore::ElementRuleCollector::transferMatchedRules):
705
706         Range update happens now here based on the supplied argument.
707
708         * css/StyleResolver.cpp:
709         (WebCore::StyleResolver::pseudoStyleForElement):
710         (WebCore::StyleResolver::pseudoStyleRulesForElement):
711 x
712 2019-10-18  Antti Koivisto  <antti@apple.com>
713
714         [CSS Shadow Parts] :part rules should be able to override style attribute
715         https://bugs.webkit.org/show_bug.cgi?id=202919
716
717         Reviewed by Zalan Bujtas.
718
719         Element inline style was simply appended to the matching declaration list and not sorted with the rest of the author style.
720         This used to work because before CSS Shadow Parts feature inline style would always win.
721
722         Fixing this involves refactoring the rule collection code to remove this assumption.
723
724         * css/ElementRuleCollector.cpp:
725         (WebCore::ElementRuleCollector::addMatchedRule):
726
727         Both initialize and update ranges here.
728
729         (WebCore::ElementRuleCollector::clearMatchedRules):
730         (WebCore::ElementRuleCollector::addElementStyleProperties):
731
732         Both initialize and update ranges here.
733
734         (WebCore::ElementRuleCollector::sortAndTransferMatchedRules):
735
736         Split out transfering to a separate function.
737
738         (WebCore::ElementRuleCollector::transferMatchedRules):
739
740         Add a parameter to limit transfer to rules from a scope.
741
742         (WebCore::ElementRuleCollector::matchAuthorRules):
743         (WebCore::ElementRuleCollector::matchesAnyAuthorRules):
744
745         Replace hasMatchedRules() with a more specific function. This can use collectMatchingAuthorRules and avoids unnecessary sorting step.
746
747         (WebCore::ElementRuleCollector::collectMatchingAuthorRules):
748
749         Split out collecting the rules from matchAuthorRules. Like other collect functions, this doesn't do any sorting.
750
751         (WebCore::ElementRuleCollector::matchAllRules):
752
753         Add element inline style before transfering rules from the containing host scope.
754
755         (WebCore::ElementRuleCollector::addElementInlineStyleProperties):
756
757         Factor adding inline style into a function.
758
759 ]        * css/ElementRuleCollector.h:
760         (WebCore::ElementRuleCollector::hasMatchedRules const): Deleted.
761         * css/StyleProperties.h:
762         (WebCore::StylePropertiesBase::deref const):
763         (WebCore::StylePropertiesBase::deref): Deleted.
764
765         Make const to allow RefPtr<const StyleProperties>
766
767         * css/StyleResolver.cpp:
768         (WebCore::StyleResolver::CascadedProperties::addImportantMatches):
769
770         Sort !important properties taking into account that the host scope has lower priority.
771
772         * style/StyleInvalidator.cpp:
773         (WebCore::Style::Invalidator::invalidateIfNeeded):
774
775 2019-10-18  Zalan Bujtas  <zalan@apple.com>
776
777         [LFC][TFC] Include horizontal spacing when checking for the extra horizontal space
778         https://bugs.webkit.org/show_bug.cgi?id=203154
779         <rdar://problem/56408032>
780
781         Reviewed by Antti Koivisto.
782
783         * layout/tableformatting/TableFormattingContext.cpp:
784         (WebCore::Layout::TableFormattingContext::computeAndDistributeExtraHorizontalSpace):
785
786 2019-10-18  Zalan Bujtas  <zalan@apple.com>
787
788         [LFC][TFC] Fix table's total horizontal spacing computation
789         https://bugs.webkit.org/show_bug.cgi?id=203151
790         <rdar://problem/56406930>
791
792         Reviewed by Antti Koivisto.
793
794         The horizontal spacing value sets the gaps between
795         1. first column and the left edge of the table's content box
796         2. between 2 columns
797         3. last column and the right edge of the table's content box
798         In case of 'n' columns, the number of gaps is 'n + 1'.
799
800         * layout/tableformatting/TableGrid.h:
801         (WebCore::Layout::TableGrid::totalHorizontalSpacing const):
802
803 2019-10-18  Zalan Bujtas  <zalan@apple.com>
804
805         [LFC][TFC] Cache table's width constraint values.
806         https://bugs.webkit.org/show_bug.cgi?id=203135
807         <rdar://problem/56396352>
808
809         Reviewed by Antti Koivisto.
810
811         This patch ensures that when computedIntrinsicWidthConstraints is called from both the preferred width and the actual layout codepaths during a layout frame, we don't
812         end up building up the grid twice.
813
814         * layout/tableformatting/TableFormattingContext.cpp:
815         (WebCore::Layout::TableFormattingContext::computedIntrinsicWidthConstraints):
816         (WebCore::Layout::TableFormattingContext::computePreferredWidthForColumns):
817         (WebCore::Layout::TableFormattingContext::computeAndDistributeExtraHorizontalSpace):
818         * layout/tableformatting/TableGrid.cpp:
819         (WebCore::Layout::TableGrid::widthConstraints):
820         (WebCore::Layout::TableGrid::widthConstraints const): Deleted.
821         * layout/tableformatting/TableGrid.h:
822         (WebCore::Layout::TableGrid::hasComputedWidthConstraints const):
823
824 2019-10-18  Zalan Bujtas  <zalan@apple.com>
825
826         [LFC][BFC] TableFormattingContext::computedIntrinsicWidthConstraints should not expect a valid containing block's width
827         https://bugs.webkit.org/show_bug.cgi?id=203131
828         <rdar://problem/56394676>
829
830         Reviewed by Antti Koivisto.
831
832         When TableFormattingContext::computedIntrinsicWidthConstraints is called by the preferred width computation (<div style="float: left"><table>)
833         the containing block's width is not yet set (it gets computed based on the preferred width) so computedIntrinsicWidthConstraints should not be relying
834         on it. Let's move that logic out to TableFormattingContext::layoutInFlowContent() where it belongs. 
835
836         * layout/blockformatting/BlockFormattingContextGeometry.cpp:
837         (WebCore::Layout::BlockFormattingContext::Geometry::inFlowWidthAndMargin):
838         * layout/tableformatting/TableFormattingContext.cpp:
839         (WebCore::Layout::TableFormattingContext::layoutInFlowContent):
840         (WebCore::Layout::TableFormattingContext::computedIntrinsicWidthConstraints):
841         (WebCore::Layout::TableFormattingContext::ensureTableGrid):
842         (WebCore::Layout::TableFormattingContext::computeAndDistributeExtraHorizontalSpace):
843         (WebCore::Layout::TableFormattingContext::computedTableWidth): Deleted.
844         (WebCore::Layout::TableFormattingContext::distributeExtraHorizontalSpace): Deleted.
845         * layout/tableformatting/TableFormattingContext.h:
846
847 2019-10-18  Zalan Bujtas  <zalan@apple.com>
848
849         [LFC][BFC] Fix block level formatting root inflow box height computation
850         https://bugs.webkit.org/show_bug.cgi?id=203085
851         <rdar://problem/56372306>
852
853         Reviewed by Antti Koivisto.
854
855         Section 10.6.7 (https://www.w3.org/TR/CSS22/visudet.html#root-height) defines the height computation for block level formatting context roots.
856         We already use it for floats, out-of-flow and block level boxes when overflow computes to not "visible".
857         This patch makes generic in-flow non-replaced BFC roots (e.g. principal block container box for <table>) compute their heights according to 10.6.7.
858
859         * layout/blockformatting/BlockFormattingContextGeometry.cpp:
860         (WebCore::Layout::BlockFormattingContext::Geometry::inFlowNonReplacedHeightAndMargin):
861
862 2019-10-17  Wenson Hsieh  <wenson_hsieh@apple.com>
863
864         [Clipboard API] Support navigator.clipboard.read()
865         https://bugs.webkit.org/show_bug.cgi?id=203021
866
867         Reviewed by Ryosuke Niwa.
868
869         Add support for navigator.clipboard.read(), which returns a promise that resolves to a list of ClipboardItems.
870         See below for more details.
871
872         Tests: editing/async-clipboard/clipboard-change-data-while-reading.html
873                editing/async-clipboard/clipboard-read-basic.html
874
875         * Modules/async-clipboard/Clipboard.cpp:
876         (WebCore::Clipboard::read):
877
878         Implement read(). This makes two calls to the platform pasteboard: the first to get the current change count,
879         and if the change count is different from the changeCount used for the last read() call (or there are no
880         existing clipboard items being tracked), then we request pasteboard item information for all items on the
881         pasteboard, and use this information to create new clipboard items. Otherwise, if the changeCount is still valid
882         for the current list of clipboard items, simply return these clipboard items.
883
884         If the changeCount ends up being different in between the initial changeCount request and when the pasteboard
885         item information is received, we immediately bail with a NotAllowedError. The new layout test
886         clipboard-change-data-while-reading.html exercises this scenario.
887
888         (WebCore::Clipboard::getType):
889         (WebCore::Clipboard::frame const):
890         * Modules/async-clipboard/Clipboard.h:
891         * Modules/async-clipboard/ClipboardItem.cpp:
892         (WebCore::ClipboardItem::blobFromString):
893         (WebCore::ClipboardItem::ClipboardItem):
894         (WebCore::ClipboardItem::create):
895         (WebCore::ClipboardItem::navigator):
896
897         Refactor this so that each clipboard item itself has a WeakPtr to its Navigator. This avoids having to follow
898         the weak pointer to the Clipboard to get to the Clipboard's navigator during garbage collection when computing
899         reachability from opaque roots, since this may happen on a background (GC) thread.
900
901         (WebCore::ClipboardItem::clipboard):
902         * Modules/async-clipboard/ClipboardItem.h:
903         * Modules/async-clipboard/ClipboardItemBindingsDataSource.cpp:
904         (WebCore::ClipboardItemBindingsDataSource::getType):
905         (WebCore::blobFromString): Deleted.
906
907         Move this to ClipboardItem, and make it a static method.
908
909         * Modules/async-clipboard/ClipboardItemPasteboardDataSource.cpp:
910         (WebCore::ClipboardItemPasteboardDataSource::ClipboardItemPasteboardDataSource):
911         (WebCore::ClipboardItemPasteboardDataSource::getType):
912         * Modules/async-clipboard/ClipboardItemPasteboardDataSource.h:
913
914         Move a couple of member variables (index and changeCount) out of ClipboardItem. Instead of having each
915         ClipboardItem keep track of this information, have the Clipboard that owns the ClipboardItem keep this
916         information. This means that reading data from ClipboardItem will (in a future patch) work by having the item
917         ask its Clipboard object to read data on its behalf.
918
919         * platform/Pasteboard.cpp:
920         (WebCore::Pasteboard::allPasteboardItemInfo const):
921         (WebCore::Pasteboard::pasteboardItemInfo const):
922         (WebCore::Pasteboard::readString):
923         (WebCore::Pasteboard::readBuffer):
924         (WebCore::Pasteboard::readURL):
925
926         Add some null checks to handle the case where there is no pasteboard strategy.
927
928 2019-10-17  Chris Dumez  <cdumez@apple.com>
929
930         Don't put pages that have not reached the non-visually empty layout milestone in the back/forward cache
931         https://bugs.webkit.org/show_bug.cgi?id=203108
932         <rdar://problem/56375671>
933
934         Reviewed by Geoff Garen.
935
936         We don't want to go back to a visually empty page on back/forward navigation.
937
938         * history/BackForwardCache.cpp:
939         (WebCore::canCacheFrame):
940         * page/DiagnosticLoggingKeys.cpp:
941         (WebCore::DiagnosticLoggingKeys::visuallyEmptyKey):
942         * page/DiagnosticLoggingKeys.h:
943
944 2019-10-17  Simon Fraser  <simon.fraser@apple.com>
945
946         Only include "deep color" in layer tree dumps if a tests requests it
947         https://bugs.webkit.org/show_bug.cgi?id=203125
948
949         Reviewed by Tim Horton.
950         
951         Layer tree dumping tests can fail when run on different devices because the "deep color"
952         property on layers is device-dependent. Stop dumping this by default, and have one test
953         that sets the bit. iphone-7 is the only device we test that has deep color support.
954
955         Tests: compositing/contents-format/deep-color-backing-store.html
956                compositing/contents-format/ipad/deep-color-backing-store.html
957                compositing/contents-format/iphone-7/deep-color-backing-store.html
958
959         * page/Frame.h:
960         * platform/graphics/GraphicsLayerClient.h:
961         * platform/graphics/ca/GraphicsLayerCA.cpp:
962         (WebCore::GraphicsLayerCA::createTransformAnimationsFromKeyframes):
963         * rendering/RenderLayerCompositor.cpp:
964         (WebCore::RenderLayerCompositor::layerTreeAsText):
965         * testing/Internals.cpp:
966         (WebCore::toLayerTreeFlags):
967         * testing/Internals.h:
968         * testing/Internals.idl:
969
970 2019-10-17  Dean Jackson  <dino@apple.com>
971
972         ctx.font = "" asserts in CSS parser
973         https://bugs.webkit.org/show_bug.cgi?id=203127
974         <rdar://problem/56391016>
975
976         Reviewed by Devin Rousso.
977
978         The HTML specification says:
979         "values that cannot be parsed as CSS font values are ignored", so
980         return early if we get an empty string, otherwise the CSS parser
981         will assert. This was the only case I could find where we sidestepped
982         most of the parsing infrastructure and injected a raw string.
983
984         Test: http/wpt/2dcontext/text-styles/2d.text.font.parse.invalid.html
985
986         * html/canvas/CanvasRenderingContext2D.cpp:
987         (WebCore::CanvasRenderingContext2D::setFont):
988
989 2019-10-17  Ryosuke Niwa  <rniwa@webkit.org>
990
991         Integrate resize event with HTML5 event loop
992         https://bugs.webkit.org/show_bug.cgi?id=202964
993
994         Reviewed by Geoffrey Garen.
995
996         Dispatch resize events in "run the resize steps" during the "update the rendering":
997         https://html.spec.whatwg.org/multipage/webappapis.html#update-the-rendering
998
999         Exisitng code in WebCore which was dispatching or scheduling dispatching of resize events now simply sets
1000         a flag on document and schedules a rendering update. In Page::updateRendering, we fire resize events on
1001         any documents with this flag set.
1002
1003         Test: fast/events/resize-subframe-in-rendering-update.html
1004
1005         * dom/Document.cpp:
1006         (WebCore::Document::setNeedsDOMWindowResizeEvent): Added.
1007         (WebCore::Document::setNeedsVisualViewportResize): Added.
1008         (WebCore::Document::runResizeSteps): Added. https://drafts.csswg.org/cssom-view/#run-the-resize-steps
1009         * dom/Document.h:
1010         * page/DOMWindow.cpp:
1011         (WebCore::DOMWindow::resizeTo const):
1012         * page/FrameView.cpp:
1013         (WebCore::FrameView::sendResizeEventIfNeeded): Now sets m_needsDOMWindowResizeEvent on Document instead of
1014         enqueuing a resize event.
1015         * page/Page.cpp:
1016         (WebCore::Page::updateRendering): Call runResizeSteps on each document.
1017         (WebCore::Page::collectDocuments): Added.
1018         * page/Page.h:
1019         * page/VisualViewport.cpp:
1020         (WebCore::VisualViewport::enqueueResizeEvent):
1021
1022 2019-10-17  Chris Dumez  <cdumez@apple.com>
1023
1024         Unreviewed, rolling out r251255.
1025
1026         This is causing the existing back/forward tests to be flaky
1027
1028         Reverted changeset:
1029
1030         "Don't put pages that have not reached the non-visually empty
1031         layout milestone in the back/forward cache"
1032         https://bugs.webkit.org/show_bug.cgi?id=203108
1033         https://trac.webkit.org/changeset/251255
1034
1035 2019-10-17  Mark Lam  <mark.lam@apple.com>
1036
1037         Use constexpr in more places and remove some unnecessary external linkage.
1038         https://bugs.webkit.org/show_bug.cgi?id=203115
1039
1040         Reviewed by Yusuke Suzuki.
1041
1042         No new tests because this patch adds no new functionality.
1043
1044         * html/track/TextTrackCueGeneric.cpp:
1045         * html/track/VTTCue.cpp:
1046         * page/EventHandler.cpp:
1047         (WebCore::SyntheticTouchPoint::SyntheticTouchPoint):
1048         * page/FrameTree.h:
1049         * page/scrolling/ScrollingMomentumCalculator.cpp:
1050         (WebCore::projectedInertialScrollDistance):
1051         * platform/graphics/FontTaggedSettings.h:
1052         * platform/graphics/Region.cpp:
1053         * platform/graphics/filters/FELighting.cpp:
1054         * rendering/TableLayout.h:
1055         * rendering/svg/SVGRenderingContext.h:
1056
1057 2019-10-17  Simon Fraser  <simon.fraser@apple.com>
1058
1059         [ Mojave+ ] Layout Test compositing/fixed-with-main-thread-scrolling.html is a flaky timeout
1060         https://bugs.webkit.org/show_bug.cgi?id=198757
1061
1062         Reviewed by Tim Horton.
1063         
1064         WheelEventTestMonitor depends on "deferral reasons" getting added and removed, such that there is always
1065         at least one reason active until scrolling quiesces.
1066
1067         WheelEventTestMonitor made the incorrect assumption that every call into ScrollingTreeScrollingNodeDelegateMac::handleWheelEvent()
1068         would result in a scroll change making it to the main thread, so it would defer "ScrollingThreadSyncNeeded" there,
1069         and rely on AsyncScrollingCoordinator::updateScrollPositionAfterAsyncScroll() to remove that deferral reason.
1070         That assumption is wrong, because wheel events may coalesce, or have no impact on scroll position if already scrolled
1071         to the max/min extent (e.g. when rubber banding).
1072         
1073         Fix by adding a new "HandlingWheelEvent" deferral reason for the duration that the scrolling thread is processing an wheel event,
1074         and then having ScrollingThreadSyncNeeded just represent the phase where any resulting scroll is being sent to the UI process.
1075         These phases should always overlap.
1076         
1077         This required moving isMonitoringWheelEvents() from the root scrolling node to the ScrollingTree.
1078
1079         * page/WheelEventTestMonitor.cpp:
1080         (WebCore::operator<<):
1081         * page/WheelEventTestMonitor.h:
1082         * page/scrolling/AsyncScrollingCoordinator.cpp:
1083         (WebCore::AsyncScrollingCoordinator::updateScrollPositionAfterAsyncScroll):
1084         * page/scrolling/ScrollingTree.cpp:
1085         (WebCore::ScrollingTree::commitTreeState):
1086         * page/scrolling/ScrollingTree.h:
1087         (WebCore::ScrollingTree::isMonitoringWheelEvents const):
1088         * page/scrolling/ScrollingTreeScrollingNode.cpp:
1089         (WebCore::ScrollingTreeScrollingNode::commitStateBeforeChildren):
1090         * page/scrolling/ScrollingTreeScrollingNode.h:
1091         * page/scrolling/ThreadedScrollingTree.cpp:
1092         (WebCore::ThreadedScrollingTree::scrollingTreeNodeDidScroll):
1093         * page/scrolling/mac/ScrollingTreeScrollingNodeDelegateMac.mm:
1094         (WebCore::ScrollingTreeScrollingNodeDelegateMac::handleWheelEvent):
1095         (WebCore::ScrollingTreeScrollingNodeDelegateMac::deferWheelEventTestCompletionForReason const):
1096         (WebCore::ScrollingTreeScrollingNodeDelegateMac::removeWheelEventTestCompletionDeferralForReason const):
1097
1098 2019-10-17  Ryosuke Niwa  <rniwa@webkit.org>
1099
1100         Make requestIdleCallback suspendable
1101         https://bugs.webkit.org/show_bug.cgi?id=203023
1102
1103         Reviewed by Chris Dumez.
1104
1105         Make requestIdleCallback suspendable by making WindowEventLoop itself suspendable.
1106         Because WindowEventLoop can be shared across documents, we don't want to make it an ActiveDOMObject.
1107
1108         Instead, we would make CachedFrameBase::restore and CachedFrame manually invoke suspend & resume.
1109
1110         Test: requestidlecallback/requestidlecallback-in-page-cache.html
1111
1112         * dom/Document.h:
1113         (WebCore::Document::eventLoopIfExists): Added. This should probably go away once most of the event loop
1114         is implemented since we're almost always going to have this object then.
1115         * dom/WindowEventLoop.cpp:
1116         (WebCore::WindowEventLoop::queueTask): Because m_tasks may contain tasks of suspended documents,
1117         we check m_activeTaskCount, which is only positive when there is a task for non-suspended documents,
1118         to decide whether we schedule a callback or not.
1119         (WebCore::WindowEventLoop::suspend): Added. No-op for now.
1120         (WebCore::WindowEventLoop::resume): Added. Schedule a callback if there is a task associated with
1121         this document.
1122         (WebCore::WindowEventLoop::run): Skip a task for a suspended document, and add it back to m_tasks along
1123         with other tasks that got scheduled by running the current working set of tasks.
1124         * dom/WindowEventLoop.h:
1125         * history/CachedFrame.cpp:
1126         (WebCore::CachedFrameBase::restore):
1127         (WebCore::CachedFrame::CachedFrame):
1128
1129 2019-10-17  Chris Dumez  <cdumez@apple.com>
1130
1131         Don't put pages that have not reached the non-visually empty layout milestone in the back/forward cache
1132         https://bugs.webkit.org/show_bug.cgi?id=203108
1133
1134         Reviewed by Geoffrey Garen.
1135
1136         We don't want to go back to a visually empty page on back/forward navigation.
1137
1138         * history/BackForwardCache.cpp:
1139         (WebCore::canCacheFrame):
1140         * page/DiagnosticLoggingKeys.cpp:
1141         (WebCore::DiagnosticLoggingKeys::visuallyEmptyKey):
1142         * page/DiagnosticLoggingKeys.h:
1143
1144 2019-10-17  Dirk Schulze  <krit@webkit.org>
1145
1146         transform-box: content-box, stroke-box missing
1147         https://bugs.webkit.org/show_bug.cgi?id=201892
1148
1149         Reviewed by Simon Fraser.
1150
1151         Added the keywords content-box and stroke-box to the
1152         transform-box CSS property.
1153         Those keywords were added to the spec after the implementation
1154         in WebKit.
1155
1156         Test: transforms/transform-box.html
1157
1158         * css/CSSPrimitiveValueMappings.h:
1159         (WebCore::CSSPrimitiveValue::CSSPrimitiveValue):
1160         (WebCore::CSSPrimitiveValue::operator TransformBox const):
1161         * css/CSSProperties.json:
1162         * css/CSSValueKeywords.in:
1163         * css/parser/CSSPropertyParser.cpp:
1164         (WebCore::CSSPropertyParser::parseSingleValue):
1165         * rendering/RenderLayer.cpp:
1166         (WebCore::computeReferenceBox):
1167         (WebCore::transformBoxToCSSBoxType):
1168         (WebCore::RenderLayer::currentTransform const):
1169         * rendering/style/RenderStyleConstants.h:
1170         * svg/SVGGraphicsElement.cpp:
1171         (WebCore::SVGGraphicsElement::animatedLocalTransform const):
1172
1173 2019-10-17  Youenn Fablet  <youenn@apple.com>
1174
1175         SincResampler does not need to create a new AudioBus for each consumeSource call
1176         https://bugs.webkit.org/show_bug.cgi?id=202983
1177
1178         Reviewed by Eric Carlson.
1179
1180         Allocate an internal AudioBus once and for all.
1181         No observable change of behavior.
1182
1183         * platform/audio/SincResampler.cpp:
1184         (WebCore::SincResampler::consumeSource):
1185         * platform/audio/SincResampler.h:
1186
1187 2019-10-17  Chris Dumez  <cdumez@apple.com>
1188
1189         Deprecate ActiveDOMObject::canSuspendForDocumentSuspension()
1190         https://bugs.webkit.org/show_bug.cgi?id=203086
1191
1192         Reviewed by Geoffrey Garen.
1193
1194         Rename ActiveDOMObject::canSuspendForDocumentSuspension() to shouldPreventEnteringBackForwardCache_DEPRECATED()
1195         to make it clear that no new overrides should be added and that it is no longer OK to prevent the page from
1196         entering the back/forward cache. Also provide a default implementation that returns false so that well-behaved
1197         classes no longer need to override this.
1198
1199         * Modules/applepay/ApplePaySession.cpp:
1200         (WebCore::ApplePaySession::shouldPreventEnteringBackForwardCache_DEPRECATED const):
1201         (WebCore::ApplePaySession::canSuspendForDocumentSuspension const): Deleted.
1202         * Modules/applepay/ApplePaySession.h:
1203         * Modules/cache/DOMCache.cpp:
1204         (WebCore::DOMCache::canSuspendForDocumentSuspension const): Deleted.
1205         * Modules/cache/DOMCache.h:
1206         * Modules/cache/DOMCacheStorage.cpp:
1207         (WebCore::DOMCacheStorage::canSuspendForDocumentSuspension const): Deleted.
1208         * Modules/cache/DOMCacheStorage.h:
1209         * Modules/encryptedmedia/MediaKeySession.cpp:
1210         (WebCore::MediaKeySession::shouldPreventEnteringBackForwardCache_DEPRECATED const):
1211         (WebCore::MediaKeySession::canSuspendForDocumentSuspension const): Deleted.
1212         * Modules/encryptedmedia/MediaKeySession.h:
1213         * Modules/encryptedmedia/legacy/WebKitMediaKeySession.cpp:
1214         (WebCore::WebKitMediaKeySession::shouldPreventEnteringBackForwardCache_DEPRECATED const):
1215         (WebCore::WebKitMediaKeySession::canSuspendForDocumentSuspension const): Deleted.
1216         * Modules/encryptedmedia/legacy/WebKitMediaKeySession.h:
1217         * Modules/entriesapi/FileSystemDirectoryReader.cpp:
1218         (WebCore::FileSystemDirectoryReader::shouldPreventEnteringBackForwardCache_DEPRECATED const):
1219         (WebCore::FileSystemDirectoryReader::canSuspendForDocumentSuspension const): Deleted.
1220         * Modules/entriesapi/FileSystemDirectoryReader.h:
1221         * Modules/entriesapi/FileSystemEntry.cpp:
1222         (WebCore::FileSystemEntry::shouldPreventEnteringBackForwardCache_DEPRECATED const):
1223         (WebCore::FileSystemEntry::canSuspendForDocumentSuspension const): Deleted.
1224         * Modules/entriesapi/FileSystemEntry.h:
1225         * Modules/fetch/FetchRequest.cpp:
1226         (WebCore::FetchRequest::shouldPreventEnteringBackForwardCache_DEPRECATED const):
1227         (WebCore::FetchRequest::canSuspendForDocumentSuspension const): Deleted.
1228         * Modules/fetch/FetchRequest.h:
1229         * Modules/fetch/FetchResponse.cpp:
1230         (WebCore::FetchResponse::shouldPreventEnteringBackForwardCache_DEPRECATED const):
1231         (WebCore::FetchResponse::canSuspendForDocumentSuspension const): Deleted.
1232         * Modules/fetch/FetchResponse.h:
1233         * Modules/geolocation/Geolocation.cpp:
1234         (WebCore::Geolocation::page const):
1235         (WebCore::Geolocation::canSuspendForDocumentSuspension const): Deleted.
1236         * Modules/geolocation/Geolocation.h:
1237         * Modules/indexeddb/IDBDatabase.cpp:
1238         (WebCore::IDBDatabase::canSuspendForDocumentSuspension const): Deleted.
1239         * Modules/indexeddb/IDBDatabase.h:
1240         * Modules/indexeddb/IDBIndex.cpp:
1241         (WebCore::IDBIndex::canSuspendForDocumentSuspension const): Deleted.
1242         * Modules/indexeddb/IDBIndex.h:
1243         * Modules/indexeddb/IDBObjectStore.cpp:
1244         (WebCore::IDBObjectStore::canSuspendForDocumentSuspension const): Deleted.
1245         * Modules/indexeddb/IDBObjectStore.h:
1246         * Modules/indexeddb/IDBRequest.cpp:
1247         (WebCore::IDBRequest::canSuspendForDocumentSuspension const): Deleted.
1248         * Modules/indexeddb/IDBRequest.h:
1249         * Modules/indexeddb/IDBTransaction.cpp:
1250         (WebCore::IDBTransaction::canSuspendForDocumentSuspension const): Deleted.
1251         * Modules/indexeddb/IDBTransaction.h:
1252         * Modules/mediarecorder/MediaRecorder.cpp:
1253         (WebCore::MediaRecorder::shouldPreventEnteringBackForwardCache_DEPRECATED const):
1254         (WebCore::MediaRecorder::canSuspendForDocumentSuspension const): Deleted.
1255         * Modules/mediarecorder/MediaRecorder.h:
1256         * Modules/mediasource/MediaSource.cpp:
1257         (WebCore::MediaSource::canSuspendForDocumentSuspension const): Deleted.
1258         * Modules/mediasource/MediaSource.h:
1259         * Modules/mediasource/SourceBuffer.cpp:
1260         (WebCore::SourceBuffer::canSuspendForDocumentSuspension const): Deleted.
1261         * Modules/mediasource/SourceBuffer.h:
1262         * Modules/mediasource/SourceBufferList.cpp:
1263         (WebCore::SourceBufferList::canSuspendForDocumentSuspension const): Deleted.
1264         * Modules/mediasource/SourceBufferList.h:
1265         * Modules/mediastream/MediaDevices.cpp:
1266         (WebCore::MediaDevices::canSuspendForDocumentSuspension const): Deleted.
1267         * Modules/mediastream/MediaDevices.h:
1268         * Modules/mediastream/MediaStream.cpp:
1269         (WebCore::MediaStream::shouldPreventEnteringBackForwardCache_DEPRECATED const):
1270         (WebCore::MediaStream::canSuspendForDocumentSuspension const): Deleted.
1271         * Modules/mediastream/MediaStream.h:
1272         * Modules/mediastream/MediaStreamTrack.cpp:
1273         (WebCore::MediaStreamTrack::shouldPreventEnteringBackForwardCache_DEPRECATED const):
1274         (WebCore::MediaStreamTrack::canSuspendForDocumentSuspension const): Deleted.
1275         * Modules/mediastream/MediaStreamTrack.h:
1276         * Modules/mediastream/RTCDTMFSender.cpp:
1277         (WebCore::RTCDTMFSender::shouldPreventEnteringBackForwardCache_DEPRECATED const):
1278         (WebCore::RTCDTMFSender::canSuspendForDocumentSuspension const): Deleted.
1279         * Modules/mediastream/RTCDTMFSender.h:
1280         * Modules/mediastream/RTCDataChannel.h:
1281         * Modules/mediastream/RTCPeerConnection.cpp:
1282         (WebCore::RTCPeerConnection::shouldPreventEnteringBackForwardCache_DEPRECATED const):
1283         (WebCore::RTCPeerConnection::canSuspendForDocumentSuspension const): Deleted.
1284         * Modules/mediastream/RTCPeerConnection.h:
1285         * Modules/mediastream/UserMediaRequest.cpp:
1286         (WebCore::UserMediaRequest::shouldPreventEnteringBackForwardCache_DEPRECATED const):
1287         (WebCore::UserMediaRequest::canSuspendForDocumentSuspension const): Deleted.
1288         * Modules/mediastream/UserMediaRequest.h:
1289         * Modules/notifications/Notification.cpp:
1290         (WebCore::Notification::shouldPreventEnteringBackForwardCache_DEPRECATED const):
1291         (WebCore::Notification::canSuspendForDocumentSuspension const): Deleted.
1292         * Modules/notifications/Notification.h:
1293         * Modules/paymentrequest/PaymentRequest.cpp:
1294         (WebCore::PaymentRequest::shouldPreventEnteringBackForwardCache_DEPRECATED const):
1295         (WebCore::PaymentRequest::canSuspendForDocumentSuspension const): Deleted.
1296         * Modules/paymentrequest/PaymentRequest.h:
1297         * Modules/paymentrequest/PaymentResponse.cpp:
1298         (WebCore::PaymentResponse::shouldPreventEnteringBackForwardCache_DEPRECATED const):
1299         (WebCore::PaymentResponse::canSuspendForDocumentSuspension const): Deleted.
1300         * Modules/paymentrequest/PaymentResponse.h:
1301         * Modules/pictureinpicture/PictureInPictureWindow.cpp:
1302         (WebCore::PictureInPictureWindow::canSuspendForDocumentSuspension const): Deleted.
1303         * Modules/pictureinpicture/PictureInPictureWindow.h:
1304         * Modules/webaudio/AudioContext.cpp:
1305         (WebCore::AudioContext::shouldPreventEnteringBackForwardCache_DEPRECATED const):
1306         (WebCore::AudioContext::canSuspendForDocumentSuspension const): Deleted.
1307         * Modules/webaudio/AudioContext.h:
1308         * Modules/webdatabase/DatabaseContext.cpp:
1309         (WebCore::DatabaseContext::shouldPreventEnteringBackForwardCache_DEPRECATED const):
1310         (WebCore::DatabaseContext::canSuspendForDocumentSuspension const): Deleted.
1311         * Modules/webdatabase/DatabaseContext.h:
1312         * Modules/webgpu/GPUCanvasContext.h:
1313         * Modules/websockets/WebSocket.cpp:
1314         (WebCore::WebSocket::canSuspendForDocumentSuspension const): Deleted.
1315         * Modules/websockets/WebSocket.h:
1316         * Modules/webvr/VRDisplay.cpp:
1317         (WebCore::VRDisplay::shouldPreventEnteringBackForwardCache_DEPRECATED const):
1318         (WebCore::VRDisplay::canSuspendForDocumentSuspension const): Deleted.
1319         * Modules/webvr/VRDisplay.h:
1320         * animation/WebAnimation.cpp:
1321         (WebCore::WebAnimation::shouldPreventEnteringBackForwardCache_DEPRECATED const):
1322         (WebCore::WebAnimation::canSuspendForDocumentSuspension const): Deleted.
1323         * animation/WebAnimation.h:
1324         * css/FontFaceSet.cpp:
1325         (WebCore::FontFaceSet::canSuspendForDocumentSuspension const): Deleted.
1326         * css/FontFaceSet.h:
1327         * dom/ActiveDOMObject.h:
1328         * dom/GenericEventQueue.cpp:
1329         (WebCore::GenericEventQueueBase<T>::canSuspendForDocumentSuspension const): Deleted.
1330         * dom/GenericEventQueue.h:
1331         * dom/MessagePort.cpp:
1332         (WebCore::MessagePort::canSuspendForDocumentSuspension const): Deleted.
1333         * dom/MessagePort.h:
1334         * dom/ScriptExecutionContext.cpp:
1335         (WebCore::ScriptExecutionContext::canSuspendActiveDOMObjectsForDocumentSuspension):
1336         * fileapi/FileReader.cpp:
1337         (WebCore::FileReader::shouldPreventEnteringBackForwardCache_DEPRECATED const):
1338         (WebCore::FileReader::canSuspendForDocumentSuspension const): Deleted.
1339         * fileapi/FileReader.h:
1340         * html/HTMLMarqueeElement.cpp:
1341         (WebCore::HTMLMarqueeElement::canSuspendForDocumentSuspension const): Deleted.
1342         * html/HTMLMarqueeElement.h:
1343         * html/HTMLMediaElement.cpp:
1344         (WebCore::HTMLMediaElement::canSuspendForDocumentSuspension const): Deleted.
1345         * html/HTMLMediaElement.h:
1346         * html/HTMLSourceElement.cpp:
1347         (WebCore::HTMLSourceElement::canSuspendForDocumentSuspension const): Deleted.
1348         * html/HTMLSourceElement.h:
1349         * html/ImageBitmap.cpp:
1350         * html/PublicURLManager.cpp:
1351         (WebCore::PublicURLManager::canSuspendForDocumentSuspension const): Deleted.
1352         * html/PublicURLManager.h:
1353         * html/canvas/WebGLRenderingContextBase.cpp:
1354         (WebCore::WebGLRenderingContextBase::canSuspendForDocumentSuspension const): Deleted.
1355         * html/canvas/WebGLRenderingContextBase.h:
1356         * html/track/TrackListBase.cpp:
1357         (WebCore::TrackListBase::canSuspendForDocumentSuspension const): Deleted.
1358         * html/track/TrackListBase.h:
1359         * page/EventSource.cpp:
1360         (WebCore::EventSource::canSuspendForDocumentSuspension const): Deleted.
1361         * page/EventSource.h:
1362         * page/IntersectionObserver.cpp:
1363         (WebCore::IntersectionObserver::canSuspendForDocumentSuspension const): Deleted.
1364         * page/IntersectionObserver.h:
1365         * page/ResizeObserver.cpp:
1366         (WebCore::ResizeObserver::canSuspendForDocumentSuspension const): Deleted.
1367         * page/ResizeObserver.h:
1368         * page/SuspendableTimer.cpp:
1369         (WebCore::SuspendableTimerBase::canSuspendForDocumentSuspension const): Deleted.
1370         * page/SuspendableTimer.h:
1371         * platform/SuspendableTaskQueue.cpp:
1372         (WebCore::SuspendableTaskQueue::canSuspendForDocumentSuspension const): Deleted.
1373         * platform/SuspendableTaskQueue.h:
1374         * testing/Internals.cpp:
1375         * workers/Worker.cpp:
1376         (WebCore::Worker::canSuspendForDocumentSuspension const): Deleted.
1377         * workers/Worker.h:
1378         * workers/service/ServiceWorker.cpp:
1379         (WebCore::ServiceWorker::canSuspendForDocumentSuspension const): Deleted.
1380         * workers/service/ServiceWorker.h:
1381         * workers/service/ServiceWorkerContainer.cpp:
1382         (WebCore::ServiceWorkerContainer::canSuspendForDocumentSuspension const): Deleted.
1383         * workers/service/ServiceWorkerContainer.h:
1384         * workers/service/ServiceWorkerRegistration.cpp:
1385         (WebCore::ServiceWorkerRegistration::canSuspendForDocumentSuspension const): Deleted.
1386         * workers/service/ServiceWorkerRegistration.h:
1387         * xml/XMLHttpRequest.cpp:
1388         (WebCore::XMLHttpRequest::shouldPreventEnteringBackForwardCache_DEPRECATED const):
1389         (WebCore::XMLHttpRequest::canSuspendForDocumentSuspension const): Deleted.
1390         * xml/XMLHttpRequest.h:
1391
1392 2019-10-17  Zalan Bujtas  <zalan@apple.com>
1393
1394         [LFC][TFC] Table formatting context accesses geometry information from parent BFC
1395         https://bugs.webkit.org/show_bug.cgi?id=203082
1396         <rdar://problem/56370827>
1397
1398         Reviewed by Antti Koivisto.
1399
1400         Tables are wrapped in a 2 level formatting context structure. A <table> element initiates a block formatting context for its principal table box
1401         where the caption and the table content live. It also initiates a table wrapper box which establishes the table formatting context.
1402         In many cases the TFC needs access to the parent (generated) BFC.
1403
1404         * layout/FormattingContext.cpp:
1405         (WebCore::Layout::FormattingContext::geometryForBox const):
1406         * layout/FormattingContext.h:
1407         * layout/tableformatting/TableFormattingContext.cpp:
1408         (WebCore::Layout::TableFormattingContext::computedTableWidth):
1409
1410 2019-10-17  Zalan Bujtas  <zalan@apple.com>
1411
1412         [LFC][Painting] Add support for image/background image painting
1413         https://bugs.webkit.org/show_bug.cgi?id=203054
1414         <rdar://problem/56347733>
1415
1416         Reviewed by Antti Koivisto.
1417
1418         In addition to image rendering, this patch also addresses various run/decoration painting issues.
1419
1420         * layout/displaytree/DisplayPainter.cpp:
1421         (WebCore::Display::paintBoxDecoration):
1422         (WebCore::Display::paintInlineContent):
1423         (WebCore::Display::absoluteDisplayBox):
1424         (WebCore::Display::paintBoxDecorationAndChildren):
1425         (WebCore::Display::Painter::paint):
1426         * layout/displaytree/DisplayRun.h:
1427         (WebCore::Display::Run::setImage):
1428         (WebCore::Display::Run::image const):
1429         * layout/inlineformatting/InlineLine.cpp:
1430         (WebCore::Layout::Line::appendNonReplacedInlineBox):
1431         (WebCore::Layout::Line::appendReplacedInlineBox):
1432         * layout/layouttree/LayoutReplaced.h:
1433         (WebCore::Layout::Replaced::setCachedImage):
1434         (WebCore::Layout::Replaced::cachedImage const):
1435         * layout/layouttree/LayoutTreeBuilder.cpp:
1436         (WebCore::Layout::TreeBuilder::createLayoutBox):
1437
1438 2019-10-17  Zalan Bujtas  <zalan@apple.com>
1439
1440         [LFC][IFC] Add Display::Run/LineBox mapping
1441         https://bugs.webkit.org/show_bug.cgi?id=203051
1442         <rdar://problem/56342487>
1443
1444         Reviewed by Antti Koivisto.
1445
1446         Mapping enables us to paint baseline aligned runs on the current line. This is temporary until after we figure out the final run/line structure.
1447
1448         * layout/FormattingContextGeometry.cpp:
1449         (WebCore::Layout::FormattingContext::Geometry::contentHeightForFormattingContextRoot const):
1450         * layout/Verification.cpp:
1451         (WebCore::Layout::outputMismatchingSimpleLineInformationIfNeeded):
1452         (WebCore::Layout::outputMismatchingComplexLineInformationIfNeeded):
1453         * layout/blockformatting/BlockFormattingContextGeometry.cpp:
1454         (WebCore::Layout::BlockFormattingContext::Geometry::inFlowNonReplacedHeightAndMargin):
1455         * layout/displaytree/DisplayPainter.cpp:
1456         (WebCore::Display::paintInlineContent):
1457         * layout/inlineformatting/InlineFormattingContext.cpp:
1458         (WebCore::Layout::InlineFormattingContext::setDisplayBoxesForLine):
1459         * layout/inlineformatting/InlineFormattingContextQuirks.cpp:
1460         (WebCore::Layout::InlineFormattingContext::Quirks::lineDescentNeedsCollapsing const):
1461         * layout/inlineformatting/InlineFormattingState.h:
1462         (WebCore::Layout::InlineFormattingState::addLineBox):
1463         (WebCore::Layout::InlineFormattingState::lineBoxForRun const):
1464         (WebCore::Layout::InlineFormattingState::addInlineRun):
1465         * layout/inlineformatting/InlineLine.cpp:
1466         (WebCore::Layout::Line::Run::Run):
1467         (WebCore::Layout::Line::alignContentVertically):
1468         (WebCore::Layout::Line::adjustBaselineAndLineHeight):
1469         * layout/inlineformatting/InlineLine.h:
1470         (WebCore::Layout::Line::Run::displayRun const):
1471         (WebCore::Layout::Line::Run::logicalRect const):
1472         (WebCore::Layout::Line::Run::adjustLogicalTop):
1473         (WebCore::Layout::Line::Run::moveVertically):
1474         (WebCore::Layout::Line::Run::moveHorizontally):
1475         (WebCore::Layout::Line::Run::expand):
1476         * layout/inlineformatting/InlineLineBox.h:
1477         * layout/inlineformatting/InlineLineLayout.h:
1478         * layout/layouttree/LayoutTreeBuilder.cpp:
1479         (WebCore::Layout::outputInlineRuns):
1480
1481 2019-10-17  Antoine Quint  <graouts@apple.com>
1482
1483         [Web Animations] Enable the Web Animations JavaScript API by default
1484         https://bugs.webkit.org/show_bug.cgi?id=203075
1485
1486         Reviewed by Antti Koivisto.
1487
1488         * page/RuntimeEnabledFeatures.h:
1489
1490 2019-10-17  Wenson Hsieh  <wenson_hsieh@apple.com>
1491
1492         Unreviewed, fix watchOS and tvOS builds after r251224
1493
1494         * platform/ios/PlatformPasteboardIOS.mm:
1495         (WebCore::shouldTreatAtLeastOneTypeAsFile):
1496
1497         Move the `shouldTreatAtLeastOneTypeAsFile` helper function out of the `PASTEBOARD_SUPPORTS_ITEM_PROVIDERS`
1498         section, and into generic iOS-family code so that it can be used in `pasteboardMayContainFilePaths`.
1499
1500 2019-10-17  Youenn Fablet  <youenn@apple.com>
1501
1502         MultiChannelResampler does not need to recreate a ChannelProvider for every process call
1503         https://bugs.webkit.org/show_bug.cgi?id=202982
1504
1505         Reviewed by Eric Carlson.
1506
1507         We no longer allocate a new ChannelProvider for every process call.
1508         No observable change of behavior.
1509
1510         * platform/audio/MultiChannelResampler.cpp:
1511         (WebCore::MultiChannelResampler::ChannelProvider::ChannelProvider):
1512         (WebCore::MultiChannelResampler::ChannelProvider::setProvider):
1513         (WebCore::MultiChannelResampler::MultiChannelResampler):
1514         (WebCore::MultiChannelResampler::process):
1515         * platform/audio/MultiChannelResampler.h:
1516
1517 2019-10-17  Devin Rousso  <drousso@apple.com>
1518
1519         Web Inspector: rework frontend agent construction to allow commands/events to be controlled by the related target's type
1520         https://bugs.webkit.org/show_bug.cgi?id=200384
1521         <rdar://problem/53850352>
1522
1523         Reviewed by Joseph Pecoraro.
1524
1525         * inspector/InspectorFrontendClient.h:
1526         (WebCore::InspectorFrontendClient::backendCommandsURL): Deleted.
1527         (WebCore::InspectorFrontendClient::debuggableType): Deleted.
1528         * inspector/InspectorFrontendClientLocal.h:
1529         * page/PageDebuggable.h:
1530         (WebCore::PageDebuggable::type const):
1531         * testing/Internals.cpp:
1532         (WebCore::InspectorStubFrontend::debuggableType const): Added.
1533         Split the `Web` debuggable type into `Page` (WebCore::Page) and `WebPage` (WebKit::WebPageProxy).
1534
1535 2019-10-16  Wenson Hsieh  <wenson_hsieh@apple.com>
1536
1537         [Clipboard API] [iOS] Refactor logic for suppressing URL data when the pasteboard may contain files
1538         https://bugs.webkit.org/show_bug.cgi?id=203065
1539
1540         Reviewed by Tim Horton.
1541
1542         Platform-specific pasteboard refactoring before tackling webkit.org/b/203021. See below for details. No new
1543         tests, as there is no change in behavior.
1544
1545         * platform/Pasteboard.h:
1546         (WebCore::Pasteboard::changeCount const):
1547
1548         Add a stub for Pasteboard::changeCount() on non-Cocoa platforms.
1549
1550         * platform/ios/PlatformPasteboardIOS.mm:
1551         (WebCore::safeTypeForDOMToReadAndWriteForPlatformType):
1552
1553         Move this helper function farther up the file, so it can be used in more places.
1554
1555         (WebCore::webSafeTypes):
1556
1557         Add a separate helper to compute the list of web-safe MIME types (for instance, "text/plain") given a list of
1558         platform types, and a function to determine whether to avoid exposing a given URL to the DOM.
1559
1560         (WebCore::shouldTreatAtLeastOneTypeAsFile):
1561
1562         Split this out into a separate helper function, so that it can be invoked when determining whether a given
1563         NSItemProvider is suspected to contain file paths. In the case where we're getting the full list of types that
1564         are safe for the DOM to read, we want to pass in the entire pasteboard object and iterate through all of the
1565         available types in search for something that could feasibly accompany a file URL.
1566
1567         In the case of computing the web-safe types per item, we only have an item provider, in which case we only
1568         iterate through the types in that NSItemProvider. See call sites below for examples.
1569
1570         (WebCore::PlatformPasteboard::informationForItemAtIndex):
1571
1572         Invoke the new `webSafeTypes` helper method.
1573
1574         (WebCore::pasteboardMayContainFilePaths):
1575         (WebCore::PlatformPasteboard::typesSafeForDOMToReadAndWrite const):
1576
1577         Invoke the new `webSafeTypes` helper method.
1578
1579 2019-10-16  Brent Fulgham  <bfulgham@apple.com>
1580
1581         [FTW] Correct radial gradient handling of various radius orderings
1582         https://bugs.webkit.org/show_bug.cgi?id=202815
1583
1584         Reviewed by Per Arne Vollan.
1585
1586         Revise the 'generateGradient' implementation to recognize that the
1587         radius arguments might not be in increasing order. Direct2D's
1588         implementation does expect this, so we need to swap order and
1589         revise the gradient range to match.
1590
1591         Drive-by fix: Stop building unused image decoders if building with
1592         the Apple stack.
1593
1594         * PlatformFTW.cmake: Stop building unused image decoders.
1595         * platform/graphics/win/GradientDirect2D.cpp:
1596         (WebCore::Gradient::generateGradient):
1597
1598 2019-10-16  Chris Dumez  <cdumez@apple.com>
1599
1600         Rename PageCache to BackForwardCache
1601         https://bugs.webkit.org/show_bug.cgi?id=203048
1602
1603         Reviewed by Alex Christensen.
1604
1605         Rename PageCache to BackForwardCache for clarity and consistency with the UIProcess's WebBackForwardCache.
1606
1607         * Modules/geolocation/Geolocation.cpp:
1608         (WebCore::Geolocation::suspend):
1609         * Modules/mediarecorder/MediaRecorder.cpp:
1610         (WebCore::MediaRecorder::canSuspendForDocumentSuspension const):
1611         * Modules/mediastream/RTCPeerConnection.cpp:
1612         (WebCore::RTCPeerConnection::suspend):
1613         * Modules/websockets/WebSocket.cpp:
1614         (WebCore::WebSocket::suspend):
1615         * Sources.txt:
1616         * WebCore.xcodeproj/project.pbxproj:
1617         * animation/WebAnimation.cpp:
1618         (WebCore::WebAnimation::canSuspendForDocumentSuspension const):
1619         * bindings/js/WindowProxy.cpp:
1620         (WebCore::WindowProxy::clearJSWindowProxiesNotMatchingDOMWindow):
1621         * bindings/js/WindowProxy.h:
1622         * dom/ActiveDOMObject.h:
1623         * dom/Document.cpp:
1624         (WebCore::Document::~Document):
1625         (WebCore::Document::scheduleStyleRecalc):
1626         (WebCore::Document::needsStyleRecalc const):
1627         (WebCore::Document::invalidateMatchedPropertiesCacheAndForceStyleRecalc):
1628         (WebCore::Document::createRenderTree):
1629         (WebCore::Document::didBecomeCurrentDocumentInFrame):
1630         (WebCore::Document::attachToCachedFrame):
1631         (WebCore::Document::detachFromCachedFrame):
1632         (WebCore::Document::prepareForDestruction):
1633         (WebCore::Document::adjustFocusedNodeOnNodeRemoval):
1634         (WebCore::Document::setFocusedElement):
1635         (WebCore::Document::takeDOMWindowFrom):
1636         (WebCore::Document::setBackForwardCacheState):
1637         (WebCore::Document::suspend):
1638         (WebCore::Document::resume):
1639         (WebCore::Document::topDocument const):
1640         * dom/Document.h:
1641         (WebCore::Document::backForwardCacheState const):
1642         * dom/FullscreenManager.cpp:
1643         (WebCore::FullscreenManager::willEnterFullscreen):
1644         (WebCore::FullscreenManager::didEnterFullscreen):
1645         (WebCore::FullscreenManager::willExitFullscreen):
1646         (WebCore::FullscreenManager::didExitFullscreen):
1647         * dom/FullscreenManager.h:
1648         * dom/ScriptExecutionContext.cpp:
1649         (WebCore::ScriptExecutionContext::suspendActiveDOMObjects):
1650         (WebCore::ScriptExecutionContext::resumeActiveDOMObjects):
1651         * history/BackForwardCache.cpp: Renamed from Source/WebCore/history/PageCache.cpp.
1652         (WebCore::logBackForwardCacheFailureDiagnosticMessage):
1653         (WebCore::canCacheFrame):
1654         (WebCore::canCachePage):
1655         (WebCore::BackForwardCache::singleton):
1656         (WebCore::BackForwardCache::BackForwardCache):
1657         (WebCore::BackForwardCache::dump const):
1658         (WebCore::BackForwardCache::canCache const):
1659         (WebCore::BackForwardCache::pruneToSizeNow):
1660         (WebCore::BackForwardCache::setMaxSize):
1661         (WebCore::BackForwardCache::frameCount const):
1662         (WebCore::BackForwardCache::markPagesForDeviceOrPageScaleChanged):
1663         (WebCore::BackForwardCache::markPagesForContentsSizeChanged):
1664         (WebCore::BackForwardCache::markPagesForCaptionPreferencesChanged):
1665         (WebCore::setBackForwardCacheState):
1666         (WebCore::BackForwardCache::addIfCacheable):
1667         (WebCore::BackForwardCache::take):
1668         (WebCore::BackForwardCache::removeAllItemsForPage):
1669         (WebCore::BackForwardCache::get):
1670         (WebCore::BackForwardCache::remove):
1671         (WebCore::BackForwardCache::prune):
1672         * history/BackForwardCache.h: Renamed from Source/WebCore/history/PageCache.h.
1673         * history/CachedFrame.cpp:
1674         (WebCore::CachedFrameBase::restore):
1675         (WebCore::CachedFrame::CachedFrame):
1676         (WebCore::CachedFrame::clear):
1677         (WebCore::CachedFrame::destroy):
1678         * history/CachedFramePlatformData.h:
1679         * history/HistoryItem.cpp:
1680         (WebCore::HistoryItem::setCachedPage):
1681         (WebCore::HistoryItem::setURL):
1682         * history/HistoryItem.h:
1683         (WebCore::HistoryItem::isInBackForwardCache const):
1684         * html/HTMLMediaElement.cpp:
1685         (WebCore::HTMLMediaElement::suspend):
1686         (WebCore::HTMLMediaElement::resume):
1687         * html/HTMLPlugInImageElement.cpp:
1688         (WebCore::HTMLPlugInImageElement::createElementRenderer):
1689         * html/HTMLSourceElement.cpp:
1690         (WebCore::HTMLSourceElement::suspend):
1691         * html/MediaElementSession.cpp:
1692         (WebCore::MediaElementSession::autoplayPermitted const):
1693         * loader/DocumentLoader.cpp:
1694         (WebCore::DocumentLoader::addSubresourceLoader):
1695         * loader/DocumentLoader.h:
1696         * loader/EmptyFrameLoaderClient.h:
1697         * loader/FrameLoader.cpp:
1698         (WebCore::FrameLoader::closeURL):
1699         (WebCore::FrameLoader::clear):
1700         (WebCore::FrameLoader::stopAllLoaders):
1701         (WebCore::FrameLoader::stopForBackForwardCache):
1702         (WebCore::FrameLoader::commitProvisionalLoad):
1703         (WebCore::FrameLoader::open):
1704         (WebCore::FrameLoader::frameDetached):
1705         (WebCore::FrameLoader::detachFromParent):
1706         (WebCore::FrameLoader::receivedMainResourceError):
1707         (WebCore::FrameLoader::shouldPerformFragmentNavigation):
1708         (WebCore::FrameLoader::dispatchUnloadEvents):
1709         (WebCore::FrameLoader::continueLoadAfterNavigationPolicy):
1710         (WebCore::FrameLoader::loadProvisionalItemFromCachedPage):
1711         (WebCore::FrameLoader::loadDifferentDocumentItem):
1712         * loader/FrameLoader.h:
1713         * loader/FrameLoaderClient.h:
1714         * loader/HistoryController.cpp:
1715         (WebCore::HistoryController::saveScrollPositionAndViewStateToItem):
1716         (WebCore::HistoryController::restoreScrollPositionAndViewState):
1717         (WebCore::HistoryController::invalidateCurrentItemCachedPage):
1718         (WebCore::HistoryController::updateForReload):
1719         * loader/appcache/ApplicationCacheHost.cpp:
1720         (WebCore::ApplicationCacheHost::canCacheInBackForwardCache):
1721         * loader/appcache/ApplicationCacheHost.h:
1722         * loader/cache/CachedResource.cpp:
1723         (WebCore::CachedResource::load):
1724         * page/DOMWindow.cpp:
1725         (WebCore::DOMWindow::suspendForBackForwardCache):
1726         (WebCore::DOMWindow::resumeFromBackForwardCache):
1727         (WebCore::DOMWindow::decrementScrollEventListenersCount):
1728         * page/DOMWindow.h:
1729         * page/DOMWindowExtension.cpp:
1730         (WebCore::DOMWindowExtension::suspendForBackForwardCache):
1731         (WebCore::DOMWindowExtension::resumeFromBackForwardCache):
1732         * page/DOMWindowExtension.h:
1733         * page/DiagnosticLoggingKeys.cpp:
1734         (WebCore::DiagnosticLoggingKeys::backForwardCacheKey):
1735         (WebCore::DiagnosticLoggingKeys::backForwardCacheFailureKey):
1736         * page/DiagnosticLoggingKeys.h:
1737         * page/EventSource.cpp:
1738         (WebCore::EventSource::scheduleReconnect):
1739         (WebCore::EventSource::didReceiveResponse):
1740         (WebCore::EventSource::didReceiveData):
1741         (WebCore::EventSource::didFinishLoading):
1742         (WebCore::EventSource::didFail):
1743         (WebCore::EventSource::abortConnectionAttempt):
1744         (WebCore::EventSource::suspend):
1745         (WebCore::EventSource::resume):
1746         (WebCore::EventSource::dispatchMessageEvent):
1747         * page/EventSource.h:
1748         * page/Frame.cpp:
1749         (WebCore::Frame::setView):
1750         (WebCore::Frame::setDocument):
1751         (WebCore::Frame::willDetachPage):
1752         * page/FrameView.cpp:
1753         (WebCore::FrameView::didRestoreFromBackForwardCache):
1754         (WebCore::FrameView::setContentsSize):
1755         * page/FrameView.h:
1756         * page/FrameViewLayoutContext.cpp:
1757         (WebCore::FrameViewLayoutContext::layout):
1758         (WebCore::FrameViewLayoutContext::scheduleLayout):
1759         * page/MemoryRelease.cpp:
1760         (WebCore::releaseCriticalMemory):
1761         (WebCore::releaseMemory):
1762         * page/MemoryRelease.h:
1763         * page/Page.cpp:
1764         (WebCore::Page::~Page):
1765         (WebCore::Page::setViewScaleFactor):
1766         (WebCore::Page::setDeviceScaleFactor):
1767         * page/Page.h:
1768         * page/PageGroup.cpp:
1769         (WebCore::PageGroup::captionPreferencesChanged):
1770         * page/PerformanceLogging.cpp:
1771         (WebCore::PerformanceLogging::memoryUsageStatistics):
1772         * page/Settings.yaml:
1773         * page/SettingsBase.cpp:
1774         (WebCore::SettingsBase::usesBackForwardCacheChanged):
1775         * page/SettingsBase.h:
1776         * page/animation/AnimationBase.cpp:
1777         (WebCore::AnimationBase::setNeedsStyleRecalc):
1778         * page/animation/CSSAnimationController.cpp:
1779         (WebCore::CSSAnimationControllerPrivate::updateAnimations):
1780         (WebCore::CSSAnimationControllerPrivate::addElementChangeToDispatch):
1781         (WebCore::CSSAnimationController::cancelAnimations):
1782         (WebCore::CSSAnimationController::updateAnimations):
1783         * page/animation/ImplicitAnimation.cpp:
1784         (WebCore::ImplicitAnimation::sendTransitionEvent):
1785         * page/animation/KeyframeAnimation.cpp:
1786         (WebCore::KeyframeAnimation::sendAnimationEvent):
1787         * page/scrolling/AsyncScrollingCoordinator.cpp:
1788         (WebCore::AsyncScrollingCoordinator::requestScrollPositionUpdate):
1789         * platform/mac/ScrollAnimatorMac.mm:
1790         (WebCore::ScrollAnimatorMac::notifyContentAreaScrolled):
1791         (WebCore::ScrollAnimatorMac::updateScrollerStyle):
1792         * rendering/RenderLayerBacking.cpp:
1793         (WebCore::RenderLayerBacking::paintIntoLayer):
1794         * rendering/RenderLayerCompositor.cpp:
1795         (WebCore::RenderLayerCompositor::updateCompositingLayers):
1796         (WebCore::RenderLayerCompositor::willRemoveScrollingLayerWithBacking):
1797         (WebCore::RenderLayerCompositor::didAddScrollingLayer):
1798         * rendering/RenderLayerCompositor.h:
1799         * rendering/RenderObject.h:
1800         * rendering/SimpleLineLayoutCoverage.cpp:
1801         (WebCore::SimpleLineLayout::collectNonEmptyLeafRenderBlockFlowsForCurrentPage):
1802         * style/StyleTreeResolver.cpp:
1803         (WebCore::Style::TreeResolver::createAnimatedElementUpdate):
1804         * testing/Internals.cpp:
1805         (WebCore::Internals::clearBackForwardCache):
1806         (WebCore::Internals::backForwardCacheSize const):
1807         (WebCore::Internals::preventDocumentForEnteringBackForwardCache):
1808         * testing/Internals.h:
1809         * testing/Internals.idl:
1810         * xml/XMLHttpRequest.cpp:
1811         (WebCore::XMLHttpRequest::suspend):
1812
1813 2019-10-16  John Wilander  <wilander@apple.com>
1814
1815         Resource Load Statistics (experimental): Block all third-party cookies on websites without prior user interaction
1816         https://bugs.webkit.org/show_bug.cgi?id=203017
1817         <rdar://problem/56262708>
1818
1819         Reviewed by Alex Christensen.
1820
1821         NetworkStorageSession::shouldBlockCookies() now checks if the first-party website has
1822         received user interaction and if not, blocks all third-party cookies, regardless of the
1823         status of those third-party domains (prevalent or not).
1824
1825         Bundled cleanup task: Remove the two month old feature flag for NSURLSession switching.
1826
1827         Tests: http/tests/resourceLoadStatistics/third-party-cookie-blocking-on-sites-without-user-interaction-database.html
1828                http/tests/resourceLoadStatistics/third-party-cookie-blocking-on-sites-without-user-interaction.html
1829
1830         * page/RuntimeEnabledFeatures.h:
1831         (WebCore::RuntimeEnabledFeatures::setIsITPSessionSwitchingEnabled): Deleted.
1832         (WebCore::RuntimeEnabledFeatures::isITPSessionSwitchingEnabled const): Deleted.
1833         * page/Settings.yaml:
1834         * platform/network/NetworkStorageSession.cpp:
1835         (WebCore::NetworkStorageSession::hasHadUserInteractionAsFirstParty const):
1836         (WebCore::NetworkStorageSession::shouldBlockCookies const):
1837         (WebCore::NetworkStorageSession::setDomainsWithUserInteractionAsFirstParty):
1838         * platform/network/NetworkStorageSession.h:
1839         (WebCore::NetworkStorageSession::setIsThirdPartyCookieBlockingOnSitesWithoutUserInteractionEnabled):
1840
1841 2019-10-16  Zalan Bujtas  <zalan@apple.com>
1842
1843         [LFC][IFC] Add style and text content to Display::Run
1844         https://bugs.webkit.org/show_bug.cgi?id=203045
1845         <rdar://problem/56340105>
1846
1847         Reviewed by Antti Koivisto.
1848
1849         Painting Display::Runs requires style and text content. Currently there's no mapping structure to connect Display::Runs to Display::Boxes to access style and content.
1850
1851         * layout/displaytree/DisplayRun.h:
1852         (WebCore::Display::Run::TextContext::content const):
1853         (WebCore::Display::Run::style const):
1854         (WebCore::Display::Run::Run):
1855         (WebCore::Display::Run::TextContext::TextContext):
1856         (WebCore::Display::Run::TextContext::expand):
1857         * layout/inlineformatting/InlineLine.cpp:
1858         (WebCore::Layout::Line::appendNonBreakableSpace):
1859         (WebCore::Layout::Line::appendTextContent):
1860         (WebCore::Layout::Line::appendNonReplacedInlineBox):
1861         (WebCore::Layout::Line::appendHardLineBreak):
1862         * layout/inlineformatting/InlineLine.h:
1863         (WebCore::Layout::Line::Run::expand):
1864
1865 2019-10-16  Simon Fraser  <simon.fraser@apple.com>
1866
1867         Add dumping for BorderData and StyleBackgroundData
1868         https://bugs.webkit.org/show_bug.cgi?id=203038
1869
1870         Reviewed by Zalan Bujtas.
1871
1872         As part of adding dumping for all RenderStyle data, add dumping support for 
1873         BorderData and StyleBackgroundData.
1874         
1875         For large classes it's beneficial to avoid dumping default values; those classes
1876         get a dump() function that can take an argument to say whether values which are default
1877         should be printed.
1878
1879         * Sources.txt:
1880         * WebCore.xcodeproj/project.pbxproj:
1881         * platform/LengthSize.h:
1882         (WebCore::LengthSize::isZero const):
1883         * rendering/style/BorderData.cpp: Added.
1884         (WebCore::operator<<):
1885         (WebCore::BorderData::dump const):
1886         * rendering/style/BorderData.h:
1887         * rendering/style/RenderStyleConstants.h:
1888         * rendering/style/StyleBackgroundData.cpp:
1889         (WebCore::StyleBackgroundData::dump const):
1890         (WebCore::operator<<):
1891         * rendering/style/StyleBackgroundData.h:
1892
1893 2019-10-16  Chris Dumez  <cdumez@apple.com>
1894
1895         [WK2] Handle back/forward cache entry expiration in the UIProcess instead of the WebProcess
1896         https://bugs.webkit.org/show_bug.cgi?id=203034
1897         <rdar://problem/56332453>
1898
1899         Reviewed by Antti Koivisto.
1900
1901         Use Seconds type for backForwardCacheExpirationInterval setting instead of
1902         double, for clarity.
1903
1904         * history/CachedPage.cpp:
1905         (WebCore::CachedPage::CachedPage):
1906         (WebCore::CachedPage::hasExpired const):
1907         * page/Settings.yaml:
1908
1909 2019-10-16  Zalan Bujtas  <zalan@apple.com>
1910
1911         [LFC][IFC] Fix various vertical alignment issues.
1912         https://bugs.webkit.org/show_bug.cgi?id=203041
1913
1914         Reviewed by Antti Koivisto.
1915
1916         This patch fixes both regular inline box and inline-block baseline aligment. It also addresses a few related vertical positioning issues. 
1917
1918         * layout/inlineformatting/InlineLine.cpp:
1919         (WebCore::Layout::Line::alignContentVertically):
1920         (WebCore::Layout::Line::appendInlineContainerStart):
1921         (WebCore::Layout::Line::appendInlineContainerEnd):
1922         (WebCore::Layout::Line::appendTextContent):
1923         (WebCore::Layout::Line::appendNonReplacedInlineBox):
1924         (WebCore::Layout::Line::appendHardLineBreak):
1925         (WebCore::Layout::Line::adjustBaselineAndLineHeight):
1926         (WebCore::Layout::Line::inlineItemContentHeight const):
1927         * layout/inlineformatting/InlineLine.h:
1928         * layout/inlineformatting/InlineLineBox.h:
1929         (WebCore::Layout::LineBox::resetDescent):
1930         (WebCore::Layout::LineBox::setLogicalHeightIfGreater):
1931         (WebCore::Layout::LineBox::setBaselineOffsetIfGreater):
1932         (WebCore::Layout::LineBox::setAscentIfGreater):
1933         (WebCore::Layout::LineBox::setDescentIfGreater):
1934         (WebCore::Layout::LineBox::resetBaseline):
1935         (WebCore::
1936         Layout::LineBox::setBaseline): Deleted.
1937         (WebCore::Layout::LineBox::baseline): Deleted.
1938         (WebCore::Layout::LineBox::setBaselineOffset): Deleted.
1939         (WebCore::Layout::LineBox::Baseline::setAscentIfGreater): Deleted.
1940         (WebCore::Layout::LineBox::Baseline::setDescentIfGreater): Deleted.
1941
1942 2019-10-16  Chris Dumez  <cdumez@apple.com>
1943
1944         Drop unused WKPageSetResourceCachingDisabled() SPI
1945         https://bugs.webkit.org/show_bug.cgi?id=203035
1946
1947         Reviewed by Alex Christensen.
1948
1949         * history/PageCache.cpp:
1950         (WebCore::canCachePage):
1951         (WebCore::PageCache::take):
1952         (WebCore::PageCache::get):
1953         * html/HTMLMediaElement.cpp:
1954         (WebCore::HTMLMediaElement::mediaPlayerShouldUsePersistentCache const):
1955         * inspector/agents/page/PageNetworkAgent.cpp:
1956         (WebCore::PageNetworkAgent::setResourceCachingDisabled):
1957         * inspector/agents/worker/WorkerNetworkAgent.cpp:
1958         (WebCore::WorkerNetworkAgent::setResourceCachingDisabled):
1959         * loader/FrameLoader.cpp:
1960         (WebCore::FrameLoader::subresourceCachePolicy const):
1961         (WebCore::FrameLoader::addExtraFieldsToRequest):
1962         * loader/cache/CachedResourceLoader.cpp:
1963         (WebCore::CachedResourceLoader::cachePolicy const):
1964         * page/Page.h:
1965         (WebCore::Page::isResourceCachingDisabledByWebInspector const):
1966         (WebCore::Page::setResourceCachingDisabledByWebInspector):
1967         (WebCore::Page::isResourceCachingDisabled const): Deleted.
1968         (WebCore::Page::setResourceCachingDisabled): Deleted.
1969         (WebCore::Page::setResourceCachingDisabledOverride): Deleted.
1970         * workers/WorkerDebuggerProxy.h:
1971         * workers/WorkerMessagingProxy.cpp:
1972         (WebCore::WorkerMessagingProxy::setResourceCachingDisabledByWebInspector):
1973         (WebCore::WorkerMessagingProxy::setResourceCachingDisabled): Deleted.
1974         * workers/WorkerMessagingProxy.h:
1975         * workers/service/context/ServiceWorkerThreadProxy.cpp:
1976         (WebCore::ServiceWorkerThreadProxy::setResourceCachingDisabledByWebInspector):
1977         (WebCore::ServiceWorkerThreadProxy::setResourceCachingDisabled): Deleted.
1978         * workers/service/context/ServiceWorkerThreadProxy.h:
1979
1980 2019-10-16  Fujii Hironori  <Hironori.Fujii@sony.com>
1981
1982         DumpRenderTree should clear WTFLogChannelState::OnWithAccumulation state set by testRunner.accummulateLogsForChannel
1983         https://bugs.webkit.org/show_bug.cgi?id=203024
1984
1985         Reviewed by Alex Christensen.
1986
1987         * platform/LogInitialization.h:
1988         * platform/Logging.cpp:
1989         (WebCore::clearAllLogChannelsToAccumulate): Added.
1990         * platform/Logging.h:
1991         * testing/js/WebCoreTestSupport.cpp:
1992         (WebCoreTestSupport::clearAllLogChannelsToAccumulate): Added.
1993         * testing/js/WebCoreTestSupport.h:
1994
1995 2019-10-16  Youenn Fablet  <youenn@apple.com>
1996
1997         WebAudioSourceProviderAVFObjC::provideInput should set its WebAudioBufferList parameters correctly
1998         https://bugs.webkit.org/show_bug.cgi?id=202930
1999         <rdar://problem/56006776>
2000
2001         Reviewed by Eric Carlson.
2002
2003         There is a time where the bus channel number and audio source channel numbers may be different.
2004         In case the bus channel number is less than the audio source channel number, initialization of
2005         the WebAudioBufferList might not be fully done.
2006         In that case, output silence and return early.
2007         Reduce the number of frames to process based on the number of frames the output audio bus plans to process.
2008
2009         Partially covered by new API test (this a race so we cannot reproduce the crash easily).
2010
2011         * Modules/webaudio/MediaStreamAudioSourceNode.cpp:
2012         (WebCore::MediaStreamAudioSourceNode::process):
2013         Make sure to process the number of frames the output bus expect.
2014         * platform/mediastream/mac/WebAudioSourceProviderAVFObjC.mm:
2015         (WebCore::WebAudioSourceProviderAVFObjC::provideInput):
2016
2017 2019-10-16  Zalan Bujtas  <zalan@apple.com>
2018
2019         [LFC][TFC] TableFormattingContext::distributeExtraHorizontalSpace should not ignore fixed width columns
2020         https://bugs.webkit.org/show_bug.cgi?id=203010
2021
2022         Reviewed by Antti Koivisto.
2023
2024         Fixed width columns (e.g. <col width=100px>) don't participate in the extra horizontal space distribution.
2025
2026         * layout/tableformatting/TableFormattingContext.cpp:
2027         (WebCore::Layout::TableFormattingContext::computedTableWidth):
2028         (WebCore::Layout::TableFormattingContext::distributeExtraHorizontalSpace):
2029         (WebCore::Layout::TableFormattingContext::distributeAvailableWidth): Deleted.
2030         * layout/tableformatting/TableFormattingContext.h:
2031         * layout/tableformatting/TableGrid.cpp:
2032         (WebCore::Layout::TableGrid::Column::hasFixedWidth const):
2033         (WebCore::Layout::TableGrid::widthConstraints const):
2034         * layout/tableformatting/TableGrid.h:
2035         (WebCore::Layout::TableGrid::totalHorizontalSpacing const):
2036         (WebCore::Layout::TableGrid::columnsContext const):
2037
2038 2019-10-16  Carlos Garcia Campos  <cgarcia@igalia.com>
2039
2040         [GTK][WPE] ASSERTION FAILED: blob in SQLiteStatement.cpp(163) : int WebCore::SQLiteStatement::bindBlob()
2041         https://bugs.webkit.org/show_bug.cgi?id=202976
2042
2043         Reviewed by Adrian Perez de Castro.
2044
2045         This is because IconDatabases passes a nullptr blob to store emtpty icons. sqlite3_bind_blob() allows nullptr as
2046         blob, so we shouldn't assert.
2047
2048         * platform/sql/SQLiteStatement.cpp:
2049         (WebCore::SQLiteStatement::bindBlob): Update the assert to only fail when blob is nullptr and size > 0.
2050
2051 2019-10-16  Fujii Hironori  <Hironori.Fujii@sony.com>
2052
2053         Unreviewed build fix for Windows ports
2054         https://bugs.webkit.org/show_bug.cgi?id=203016
2055         <rdar://problem/56317774>
2056
2057         * page/DOMTimer.h: Added WEBCORE_EXPORT to ~DOMTimer().
2058
2059 2019-10-15  Carlos Alberto Lopez Perez  <clopez@igalia.com>
2060
2061         image/apng not recognized in source tag
2062         https://bugs.webkit.org/show_bug.cgi?id=202785
2063
2064         Reviewed by Dean Jackson.
2065
2066         Add image/apng as supported mime type for images on Mac/iOS and
2067         on all the other platforms that enable apng support.
2068
2069         This fixes the test imported/w3c/web-platform-tests/apng/supported-in-source-type.html
2070
2071         * platform/MIMETypeRegistry.cpp:
2072         (WebCore::MIMETypeRegistry::supportedImageMIMETypes):
2073
2074 2019-10-15  Ryosuke Niwa  <rniwa@webkit.org>
2075
2076         adoptRef DOMTimer in install instead of its constructor
2077         https://bugs.webkit.org/show_bug.cgi?id=203016
2078
2079         Reviewed by Simon Fraser.
2080
2081         Moved the code to add DOMTimer to ScriptExecutionContext's map to DOMTimer::install
2082         instead of its constructor so that we can adoptRef there instead for clarity & simplicity.
2083
2084         * dom/ScriptExecutionContext.h:
2085         (WebCore::ScriptExecutionContext::addTimeout):
2086         * page/DOMTimer.cpp:
2087         (WebCore::DOMTimer::DOMTimer):
2088         (WebCore::DOMTimer::install):
2089         (WebCore::DOMTimer::fired):
2090
2091 2019-10-15  Simon Fraser  <simon.fraser@apple.com>
2092
2093         ScrollingTreeScrollingNodeDelegateMac::stretchAmount() should not have side effects
2094         https://bugs.webkit.org/show_bug.cgi?id=203009
2095
2096         Reviewed by Dean Jackson.
2097
2098         Calling ScrollingTreeScrollingNodeDelegateMac::stretchAmount() had the side effect of calling
2099         setMainFrameIsRubberBanding() on the scrolling tree.
2100         
2101         Remove this badness and replace it by modifying updateMainFramePinState() (which is called every time
2102         the scroll position changes) to also compute if we're rubber-banding.
2103         
2104         Also make a bunch of methods on ScrollControllerClient const, which makes it clear that
2105         they don't have side effects.
2106
2107         * page/scrolling/mac/ScrollingTreeFrameScrollingNodeMac.h:
2108         * page/scrolling/mac/ScrollingTreeFrameScrollingNodeMac.mm:
2109         (WebCore::ScrollingTreeFrameScrollingNodeMac::commitStateAfterChildren):
2110         (WebCore::ScrollingTreeFrameScrollingNodeMac::currentScrollPositionChanged):
2111         (WebCore::ScrollingTreeFrameScrollingNodeMac::updateMainFramePinAndRubberbandState):
2112         (WebCore::ScrollingTreeFrameScrollingNodeMac::updateMainFramePinState): Deleted.
2113         * page/scrolling/mac/ScrollingTreeScrollingNodeDelegateMac.h:
2114         * page/scrolling/mac/ScrollingTreeScrollingNodeDelegateMac.mm:
2115         (WebCore::ScrollingTreeScrollingNodeDelegateMac::isAlreadyPinnedInDirectionOfGesture const):
2116         (WebCore::ScrollingTreeScrollingNodeDelegateMac::allowsHorizontalStretching const):
2117         (WebCore::ScrollingTreeScrollingNodeDelegateMac::allowsVerticalStretching const):
2118         (WebCore::ScrollingTreeScrollingNodeDelegateMac::stretchAmount const):
2119         (WebCore::ScrollingTreeScrollingNodeDelegateMac::pinnedInDirection const):
2120         (WebCore::ScrollingTreeScrollingNodeDelegateMac::canScrollHorizontally const):
2121         (WebCore::ScrollingTreeScrollingNodeDelegateMac::canScrollVertically const):
2122         (WebCore::ScrollingTreeScrollingNodeDelegateMac::shouldRubberBandInDirection const):
2123         (WebCore::ScrollingTreeScrollingNodeDelegateMac::isAlreadyPinnedInDirectionOfGesture): Deleted.
2124         (WebCore::ScrollingTreeScrollingNodeDelegateMac::allowsHorizontalStretching): Deleted.
2125         (WebCore::ScrollingTreeScrollingNodeDelegateMac::allowsVerticalStretching): Deleted.
2126         (WebCore::ScrollingTreeScrollingNodeDelegateMac::stretchAmount): Deleted.
2127         (WebCore::ScrollingTreeScrollingNodeDelegateMac::pinnedInDirection): Deleted.
2128         (WebCore::ScrollingTreeScrollingNodeDelegateMac::canScrollHorizontally): Deleted.
2129         (WebCore::ScrollingTreeScrollingNodeDelegateMac::canScrollVertically): Deleted.
2130         (WebCore::ScrollingTreeScrollingNodeDelegateMac::shouldRubberBandInDirection): Deleted.
2131         * platform/cocoa/ScrollController.h:
2132         * platform/mac/ScrollAnimatorMac.h:
2133         * platform/mac/ScrollAnimatorMac.mm:
2134         (WebCore::ScrollAnimatorMac::shouldForwardWheelEventsToParent const):
2135         (WebCore::ScrollAnimatorMac::pinnedInDirection const):
2136         (WebCore::ScrollAnimatorMac::isAlreadyPinnedInDirectionOfGesture const):
2137         (WebCore::ScrollAnimatorMac::allowsVerticalStretching const):
2138         (WebCore::ScrollAnimatorMac::allowsHorizontalStretching const):
2139         (WebCore::ScrollAnimatorMac::stretchAmount const):
2140         (WebCore::ScrollAnimatorMac::canScrollHorizontally const):
2141         (WebCore::ScrollAnimatorMac::canScrollVertically const):
2142         (WebCore::ScrollAnimatorMac::shouldRubberBandInDirection const):
2143         (WebCore::ScrollAnimatorMac::shouldForwardWheelEventsToParent): Deleted.
2144         (WebCore::ScrollAnimatorMac::pinnedInDirection): Deleted.
2145         (WebCore::ScrollAnimatorMac::isAlreadyPinnedInDirectionOfGesture): Deleted.
2146         (WebCore::ScrollAnimatorMac::allowsVerticalStretching): Deleted.
2147         (WebCore::ScrollAnimatorMac::allowsHorizontalStretching): Deleted.
2148         (WebCore::ScrollAnimatorMac::stretchAmount): Deleted.
2149         (WebCore::ScrollAnimatorMac::canScrollHorizontally): Deleted.
2150         (WebCore::ScrollAnimatorMac::canScrollVertically): Deleted.
2151         (WebCore::ScrollAnimatorMac::shouldRubberBandInDirection): Deleted.
2152         * platform/mock/ScrollAnimatorMock.h:
2153
2154 2019-10-15  Simon Fraser  <simon.fraser@apple.com>
2155
2156         WheelEventTestMonitor doesn't need to be threadsafe
2157         https://bugs.webkit.org/show_bug.cgi?id=203012
2158
2159         Reviewed by Dean Jackson.
2160
2161         WheelEventTestMonitor is only called on the main thread, so doesn't need a lock to protect
2162         m_deferCompletionReasons, and add main thread assertions.
2163
2164         * page/WheelEventTestMonitor.cpp:
2165         (WebCore::WheelEventTestMonitor::clearAllTestDeferrals):
2166         (WebCore::WheelEventTestMonitor::setTestCallbackAndStartNotificationTimer):
2167         (WebCore::WheelEventTestMonitor::deferForReason):
2168         (WebCore::WheelEventTestMonitor::removeDeferralForReason):
2169         (WebCore::WheelEventTestMonitor::triggerTestTimerFired):
2170         * page/WheelEventTestMonitor.h:
2171
2172 2019-10-15  Andres Gonzalez  <andresg_22@apple.com>
2173
2174         AX: Make AXIsolatedTree compile again
2175         https://bugs.webkit.org/show_bug.cgi?id=202702
2176         <rdar://problem/56084968>
2177
2178         Reviewed by Joanmarie Diggs.
2179
2180         Re-submitting r251045 with a fix for internal builds.
2181
2182         * accessibility/AXObjectCache.cpp:
2183         (WebCore::AXObjectCache::remove):
2184         (WebCore::AXObjectCache::createIsolatedAccessibilityTreeHierarchy):
2185         * accessibility/isolatedtree/AXIsolatedTree.cpp:
2186         (WebCore::AXIsolatedTree::treePageCache):
2187         (WebCore::AXIsolatedTree::nodeForID const):
2188         (WebCore::AXIsolatedTree::applyPendingChanges):
2189         (WebCore::AXIsolatedTree::initializePageTreeForID): Deleted.
2190         (WebCore::AXIsolatedTree::setInitialRequestInProgress): Deleted.
2191         * accessibility/isolatedtree/AXIsolatedTree.h:
2192         * accessibility/isolatedtree/AXIsolatedTreeNode.cpp:
2193         (WebCore::AXIsolatedTreeNode::setTreeIdentifier):
2194         (WebCore::AXIsolatedTreeNode::rectAttributeValue const):
2195         * accessibility/isolatedtree/AXIsolatedTreeNode.h:
2196         * accessibility/mac/WebAccessibilityObjectWrapperBase.mm:
2197         (convertToNSArray):
2198         * accessibility/mac/WebAccessibilityObjectWrapperMac.mm:
2199         (-[WebAccessibilityObjectWrapper childrenVectorArray]):
2200
2201 2019-10-15  Ryosuke Niwa  <rniwa@webkit.org>
2202
2203         [iOS] Crash in WebCore::DOMWindow::incrementScrollEventListenersCount
2204         https://bugs.webkit.org/show_bug.cgi?id=202878
2205
2206         Unreviewed. Addressed Darin's post-commit review comment.
2207
2208         * dom/Node.cpp:
2209         (WebCore::tryAddEventListener):
2210
2211 2019-10-15  Chris Dumez  <cdumez@apple.com>
2212
2213         [macOS] Simplify main thread initialization
2214         https://bugs.webkit.org/show_bug.cgi?id=203001
2215
2216         Reviewed by Geoff Garen.
2217
2218         * bridge/objc/WebScriptObject.mm:
2219         (+[WebScriptObject initialize]):
2220         * platform/cocoa/SharedBufferCocoa.mm:
2221         (+[WebCoreSharedBufferData initialize]):
2222
2223 2019-10-15  Peng Liu  <peng.liu6@apple.com>
2224
2225         [Picture-in-Picture Web API] Implement HTMLVideoElement.requestPictureInPicture() / Document.exitPictureInPicture()
2226         https://bugs.webkit.org/show_bug.cgi?id=201024
2227
2228         Reviewed by Eric Carlson.
2229
2230         Implement the support to enter and exit PiP mode with the Picture-in-Picture API.
2231         Majority work of this patch was done by Carlos Eduardo Ramalho <cadubentzen@gmail.com>.
2232
2233         Also, fix a build error of Modules/webaudio/OfflineAudioContext.cpp because of this patch (due to unified build).
2234
2235         Tests: imported/w3c/web-platform-tests/picture-in-picture/css-selector.html
2236                imported/w3c/web-platform-tests/picture-in-picture/disable-picture-in-picture.html
2237                imported/w3c/web-platform-tests/picture-in-picture/enter-picture-in-picture.html
2238                imported/w3c/web-platform-tests/picture-in-picture/exit-picture-in-picture.html
2239                imported/w3c/web-platform-tests/picture-in-picture/idlharness.window.html
2240                imported/w3c/web-platform-tests/picture-in-picture/leave-picture-in-picture.html
2241                imported/w3c/web-platform-tests/picture-in-picture/mediastream.html
2242                imported/w3c/web-platform-tests/picture-in-picture/picture-in-picture-element.html
2243                imported/w3c/web-platform-tests/picture-in-picture/picture-in-picture-window.html
2244                imported/w3c/web-platform-tests/picture-in-picture/request-picture-in-picture-twice.html
2245                imported/w3c/web-platform-tests/picture-in-picture/request-picture-in-picture.html
2246                imported/w3c/web-platform-tests/picture-in-picture/shadow-dom.html
2247
2248         * CMakeLists.txt:
2249         * Configurations/FeatureDefines.xcconfig:
2250         * DerivedSources-input.xcfilelist:
2251         * DerivedSources-output.xcfilelist:
2252         * DerivedSources.make:
2253         * Modules/pictureinpicture/DocumentPictureInPicture.cpp: Added.
2254         (WebCore::DocumentPictureInPicture::exitPictureInPicture):
2255         (WebCore::DocumentPictureInPicture::from):
2256         * Modules/pictureinpicture/DocumentPictureInPicture.h: Added.
2257         (WebCore::DocumentPictureInPicture::pictureInPictureEnabled):
2258         (WebCore::DocumentPictureInPicture::supplementName):
2259         * Modules/pictureinpicture/DocumentPictureInPicture.idl: Added.
2260         * Modules/pictureinpicture/EnterPictureInPictureEvent.cpp: Added.
2261         (WebCore::EnterPictureInPictureEvent::create):
2262         (WebCore::EnterPictureInPictureEvent::EnterPictureInPictureEvent):
2263         * Modules/pictureinpicture/EnterPictureInPictureEvent.h: Added.
2264         * Modules/pictureinpicture/EnterPictureInPictureEvent.idl: Added.
2265         * Modules/pictureinpicture/HTMLVideoElementPictureInPicture.cpp: Added.
2266         (WebCore::HTMLVideoElementPictureInPicture::HTMLVideoElementPictureInPicture):
2267         (WebCore::HTMLVideoElementPictureInPicture::~HTMLVideoElementPictureInPicture):
2268         (WebCore::HTMLVideoElementPictureInPicture::from):
2269         (WebCore::HTMLVideoElementPictureInPicture::requestPictureInPicture):
2270         (WebCore::HTMLVideoElementPictureInPicture::autoPictureInPicture):
2271         (WebCore::HTMLVideoElementPictureInPicture::setAutoPictureInPicture):
2272         (WebCore::HTMLVideoElementPictureInPicture::disablePictureInPicture):
2273         (WebCore::HTMLVideoElementPictureInPicture::setDisablePictureInPicture):
2274         (WebCore::HTMLVideoElementPictureInPicture::exitPictureInPicture):
2275         (WebCore::HTMLVideoElementPictureInPicture::didEnterPictureInPicture):
2276         (WebCore::HTMLVideoElementPictureInPicture::didExitPictureInPicture):
2277         * Modules/pictureinpicture/HTMLVideoElementPictureInPicture.h: Added.
2278         (WebCore::HTMLVideoElementPictureInPicture::supplementName):
2279         * Modules/pictureinpicture/HTMLVideoElementPictureInPicture.idl: Added.
2280         * Modules/pictureinpicture/PictureInPictureWindow.cpp: Added.
2281         (WebCore::PictureInPictureWindow::create):
2282         (WebCore::PictureInPictureWindow::PictureInPictureWindow):
2283         (WebCore::PictureInPictureWindow::activeDOMObjectName const):
2284         (WebCore::PictureInPictureWindow::canSuspendForDocumentSuspension const):
2285         (WebCore::PictureInPictureWindow::eventTargetInterface const):
2286         (WebCore::PictureInPictureWindow::scriptExecutionContext const):
2287         * Modules/pictureinpicture/PictureInPictureWindow.h: Added.
2288         * Modules/pictureinpicture/PictureInPictureWindow.idl: Added.
2289         * Modules/webaudio/OfflineAudioContext.cpp:
2290         * Sources.txt:
2291         * WebCore.xcodeproj/project.pbxproj:
2292         * bindings/js/WebCoreBuiltinNames.h:
2293         * dom/Document.cpp:
2294         (WebCore::Document::pictureInPictureElement const):
2295         (WebCore::Document::setPictureInPictureElement):
2296         * dom/Document.h:
2297         * dom/DocumentOrShadowRoot.idl:
2298         * dom/EventNames.h:
2299         * dom/EventNames.in:
2300         * dom/EventTargetFactory.in:
2301         * dom/ShadowRoot.cpp:
2302         (WebCore::ShadowRoot::pictureInPictureElement const):
2303         * dom/ShadowRoot.h:
2304         * html/HTMLVideoElement.cpp:
2305         (WebCore::HTMLVideoElement::fullscreenModeChanged):
2306         (WebCore::HTMLVideoElement::setPictureInPictureObserver):
2307         * html/HTMLVideoElement.h:
2308         * page/Settings.yaml:
2309         * platform/PictureInPictureObserver.h: Added.
2310         (WebCore::PictureInPictureObserver::~PictureInPictureObserver):
2311         * testing/InternalSettings.h:
2312
2313 2019-10-15  Simon Fraser  <simon.fraser@apple.com>
2314
2315         Add TextStream dumping for ThemeTypes enums
2316         https://bugs.webkit.org/show_bug.cgi?id=202972
2317
2318         Reviewed by Dean Jackson.
2319
2320         Make ControlPart, SelectionPart, ThemeFont and ThemeColor dumpable.
2321
2322         * Sources.txt:
2323         * WebCore.xcodeproj/project.pbxproj:
2324         * platform/ThemeTypes.cpp: Added.
2325         (WebCore::operator<<):
2326         * platform/ThemeTypes.h:
2327
2328 2019-10-15  Simon Fraser  <simon.fraser@apple.com>
2329
2330         Add dumping for Animation and AnimationList
2331         https://bugs.webkit.org/show_bug.cgi?id=202973
2332
2333         Reviewed by Dean Jackson.
2334
2335         Make Animation, AnimationList and related enums dumpable.
2336
2337         * platform/animation/Animation.cpp:
2338         (WebCore::operator<<):
2339         * platform/animation/Animation.h:
2340         * platform/animation/AnimationList.cpp:
2341         (WebCore::operator<<):
2342         * platform/animation/AnimationList.h:
2343
2344 2019-10-15  Simon Fraser  <simon.fraser@apple.com>
2345
2346         Don't mutate a NinePieceImage to create a mask default image
2347         https://bugs.webkit.org/show_bug.cgi?id=202967
2348
2349         Reviewed by Dean Jackson.
2350
2351         For every StyleRareNonInheritedData, the maskBoxImage undergoes copy-on-write
2352         via maskBoxImage.setMaskDefaults(). Fix by giving NinePieceImage a constructor
2353         argument that cna make the mask flavor of image.
2354
2355         * css/StyleBuilderConverter.h:
2356         (WebCore::StyleBuilderConverter::convertBorderMask):
2357         (WebCore::StyleBuilderConverter::convertReflection):
2358         * rendering/style/NinePieceImage.cpp:
2359         (WebCore::NinePieceImage::defaultMaskData):
2360         (WebCore::NinePieceImage::NinePieceImage):
2361         * rendering/style/NinePieceImage.h:
2362         (WebCore::NinePieceImage::setMaskDefaults): Deleted.
2363         * rendering/style/StyleRareNonInheritedData.cpp:
2364         (WebCore::StyleRareNonInheritedData::StyleRareNonInheritedData):
2365         * rendering/style/StyleReflection.h:
2366         (WebCore::StyleReflection::StyleReflection):
2367
2368 2019-10-15  youenn fablet  <youenn@apple.com>
2369
2370         Move headers to keep from a HTTPHeaderNameSet to an OptionSet
2371         https://bugs.webkit.org/show_bug.cgi?id=202977
2372
2373         Reviewed by Anders Carlsson.
2374
2375         Covered by existing tests.
2376         New representation is smaller and more efficient to process.
2377
2378         * loader/CrossOriginAccessControl.cpp:
2379         (WebCore::httpHeadersToKeepFromCleaning):
2380         (WebCore::cleanHTTPRequestHeadersForAccessControl):
2381         * loader/CrossOriginAccessControl.h:
2382         (WebCore::cleanHTTPRequestHeadersForAccessControl): Deleted.
2383         * loader/ResourceLoaderOptions.h:
2384
2385 2019-10-15  Zalan Bujtas  <zalan@apple.com>
2386
2387         [LFC][TFC] Use <col> to adjust the preferred column width.
2388         https://bugs.webkit.org/show_bug.cgi?id=202997
2389         <rdar://problem/56300345>
2390
2391         Reviewed by Antti Koivisto.
2392
2393         The <col> elment can set the preferred width on the table column. Let's take these values into account while computing the preferred width for columns.
2394
2395         * layout/tableformatting/TableFormattingContext.cpp:
2396         (WebCore::Layout::TableFormattingContext::computePreferredWidthForColumns):
2397         * layout/tableformatting/TableFormattingContext.h:
2398         * layout/tableformatting/TableFormattingContextGeometry.cpp:
2399         (WebCore::Layout::TableFormattingContext::Geometry::computedColumnWidth const):
2400         * layout/tableformatting/TableGrid.h:
2401         (WebCore::Layout::TableGrid::Column::columnBox const):
2402
2403 2019-10-15  Zalan Bujtas  <zalan@apple.com>
2404
2405         [LFC][TFC] Add support for colgroup/col
2406         https://bugs.webkit.org/show_bug.cgi?id=202991
2407         <rdar://problem/56294715>
2408
2409         Reviewed by Antti Koivisto.
2410
2411         This patch sets up the column context when <colgroup> is present. This is in preparation for using <col>'s width to adjust the preferred width on table columns.
2412
2413         * layout/layouttree/LayoutTreeBuilder.cpp:
2414         (WebCore::Layout::TreeBuilder::createLayoutBox):
2415         * layout/tableformatting/TableFormattingContext.cpp:
2416         (WebCore::Layout::TableFormattingContext::ensureTableGrid):
2417         * layout/tableformatting/TableGrid.cpp:
2418         (WebCore::Layout::TableGrid::Column::Column):
2419         (WebCore::Layout::TableGrid::ColumnsContext::addColumn):
2420         * layout/tableformatting/TableGrid.h:
2421
2422 2019-10-15  Alex Christensen  <achristensen@webkit.org>
2423
2424         Unreviewed, rolling out r251138.
2425
2426         Broke API tests
2427
2428         Reverted changeset:
2429
2430         "Pass CORS-enabled schemes through WebProcess instead of
2431         having them NetworkProcess-global"
2432         https://bugs.webkit.org/show_bug.cgi?id=202891
2433         https://trac.webkit.org/changeset/251138
2434
2435 2019-10-15  Chris Dumez  <cdumez@apple.com>
2436
2437         Stop using inheritance for WebBackForwardCacheEntry
2438         https://bugs.webkit.org/show_bug.cgi?id=202989
2439
2440         Reviewed by Alex Christensen.
2441
2442         * history/BackForwardItemIdentifier.h:
2443         (WebCore::BackForwardItemIdentifier::operator bool const):
2444
2445 2019-10-15  Alex Christensen  <achristensen@webkit.org>
2446
2447         Pass CORS-enabled schemes through WebProcess instead of having them NetworkProcess-global
2448         https://bugs.webkit.org/show_bug.cgi?id=202891
2449
2450         Reviewed by Youenn Fablet.
2451
2452         * platform/LegacySchemeRegistry.cpp:
2453         (WebCore::LegacySchemeRegistry::registerURLSchemeAsCORSEnabled):
2454         (WebCore::LegacySchemeRegistry::shouldTreatURLSchemeAsCORSEnabled):
2455         (WebCore::LegacySchemeRegistry::allURLSchemesRegisteredAsCORSEnabled):
2456         * platform/LegacySchemeRegistry.h:
2457
2458 2019-10-15  Zalan Bujtas  <zalan@apple.com>
2459
2460         [LFC] Adjust computed width value when box sizing is border-box
2461         https://bugs.webkit.org/show_bug.cgi?id=202966
2462         <rdar://problem/56277954>
2463
2464         Reviewed by Antti Koivisto.
2465
2466         box-sizing: border-box; means the width value sets the size of the border box (and not the content box).
2467
2468         * layout/FormattingContext.cpp:
2469         (WebCore::Layout::FormattingContext::computeOutOfFlowHorizontalGeometry):
2470         * layout/FormattingContext.h:
2471         * layout/FormattingContextGeometry.cpp:
2472         (WebCore::Layout::FormattingContext::Geometry::computedContentWidth const):
2473         (WebCore::Layout::FormattingContext::Geometry::computedMinWidth const):
2474         (WebCore::Layout::FormattingContext::Geometry::computedMaxWidth const):
2475         (WebCore::Layout::FormattingContext::Geometry::outOfFlowNonReplacedHorizontalGeometry):
2476         (WebCore::Layout::FormattingContext::Geometry::floatingNonReplacedWidthAndMargin):
2477         (WebCore::Layout::FormattingContext::Geometry::inlineReplacedWidthAndMargin const):
2478         * layout/blockformatting/BlockFormattingContext.cpp:
2479         (WebCore::Layout::BlockFormattingContext::computeWidthAndMargin):
2480         * layout/blockformatting/BlockFormattingContextGeometry.cpp:
2481         (WebCore::Layout::BlockFormattingContext::Geometry::inFlowNonReplacedWidthAndMargin const):
2482
2483 2019-10-15  Zalan Bujtas  <zalan@apple.com>
2484
2485         [LFC][TFC] Add <col> element's width attribute value to Layout::Box rare data
2486         https://bugs.webkit.org/show_bug.cgi?id=202988
2487         <rdar://problem/56291048>
2488
2489         Reviewed by Antti Koivisto.
2490
2491         Sadly RenderStyle does not have this value.
2492
2493         * layout/layouttree/LayoutBox.cpp:
2494         (WebCore::Layout::Box::setColumnWidth):
2495         (WebCore::Layout::Box::columnWidth const):
2496         * layout/layouttree/LayoutBox.h:
2497         * layout/layouttree/LayoutTreeBuilder.cpp:
2498         (WebCore::Layout::TreeBuilder::createLayoutBox):
2499         (WebCore::Layout::outputLayoutBox):
2500
2501 2019-10-15  Zalan Bujtas  <zalan@apple.com>
2502
2503         [LFC] Adjust computed height value when box sizing is border-box
2504         https://bugs.webkit.org/show_bug.cgi?id=202965
2505         <rdar://problem/56276771>
2506
2507         Reviewed by Antti Koivisto.
2508
2509         box-sizing: border-box; means the height value sets the size of the border box (and not the content box).  
2510
2511         * layout/FormattingContext.cpp:
2512         (WebCore::Layout::FormattingContext::computeOutOfFlowHorizontalGeometry):
2513         (WebCore::Layout::FormattingContext::computeOutOfFlowVerticalGeometry):
2514         * layout/FormattingContext.h:
2515         * layout/FormattingContextGeometry.cpp:
2516         (WebCore::Layout::FormattingContext::Geometry::computedContentHeight const):
2517         (WebCore::Layout::FormattingContext::Geometry::outOfFlowNonReplacedVerticalGeometry const):
2518         (WebCore::Layout::FormattingContext::Geometry::outOfFlowReplacedVerticalGeometry const):
2519         (WebCore::Layout::FormattingContext::Geometry::outOfFlowReplacedHorizontalGeometry const):
2520         (WebCore::Layout::FormattingContext::Geometry::complicatedCases const):
2521         (WebCore::Layout::FormattingContext::Geometry::floatingNonReplacedWidthAndMargin):
2522         (WebCore::Layout::FormattingContext::Geometry::floatingReplacedHeightAndMargin const):
2523         (WebCore::Layout::FormattingContext::Geometry::floatingReplacedWidthAndMargin const):
2524         (WebCore::Layout::FormattingContext::Geometry::floatingHeightAndMargin const):
2525         (WebCore::Layout::FormattingContext::Geometry::floatingWidthAndMargin):
2526         (WebCore::Layout::FormattingContext::Geometry::inlineReplacedHeightAndMargin const):
2527         (WebCore::Layout::FormattingContext::Geometry::inlineReplacedWidthAndMargin const):
2528         * layout/LayoutState.cpp:
2529         (WebCore::Layout::LayoutState::displayBoxForLayoutBox):
2530         * layout/LayoutUnits.h:
2531         * layout/blockformatting/BlockFormattingContext.cpp:
2532         (WebCore::Layout::BlockFormattingContext::computeWidthAndMargin):
2533         (WebCore::Layout::BlockFormattingContext::computeHeightAndMargin):
2534         * layout/blockformatting/BlockFormattingContext.h:
2535         * layout/blockformatting/BlockFormattingContextGeometry.cpp:
2536         (WebCore::Layout::BlockFormattingContext::Geometry::inFlowNonReplacedHeightAndMargin):
2537         (WebCore::Layout::BlockFormattingContext::Geometry::inFlowNonReplacedWidthAndMargin const):
2538         (WebCore::Layout::BlockFormattingContext::Geometry::inFlowReplacedWidthAndMargin const):
2539         (WebCore::Layout::BlockFormattingContext::Geometry::inFlowHeightAndMargin):
2540         (WebCore::Layout::BlockFormattingContext::Geometry::inFlowWidthAndMargin):
2541         * layout/blockformatting/BlockFormattingContextQuirks.cpp:
2542         (WebCore::Layout::BlockFormattingContext::Quirks::stretchedInFlowHeight):
2543         * layout/displaytree/DisplayBox.cpp:
2544         (WebCore::Display::Box::Box):
2545         (WebCore::Display::Box::Style::Style): Deleted.
2546         * layout/displaytree/DisplayBox.h:
2547         * layout/inlineformatting/InlineFormattingContext.cpp:
2548         (WebCore::Layout::InlineFormattingContext::computeWidthAndMargin):
2549         (WebCore::Layout::InlineFormattingContext::computeHeightAndMargin):
2550         * layout/inlineformatting/InlineFormattingContext.h:
2551         * layout/inlineformatting/InlineFormattingContextGeometry.cpp:
2552         (WebCore::Layout::InlineFormattingContext::Geometry::inlineBlockWidthAndMargin):
2553         (WebCore::Layout::InlineFormattingContext::Geometry::inlineBlockHeightAndMargin const):
2554         * layout/tableformatting/TableFormattingContext.cpp:
2555         (WebCore::Layout::TableFormattingContext::layoutTableCellBox):
2556         * layout/tableformatting/TableFormattingContext.h:
2557         * layout/tableformatting/TableFormattingContextGeometry.cpp:
2558         (WebCore::Layout::TableFormattingContext::Geometry::tableCellHeightAndMargin const):
2559
2560 2019-10-15  Wenson Hsieh  <wenson_hsieh@apple.com>
2561
2562         [Clipboard API] Implement getType() for ClipboardItems created from bindings
2563         https://bugs.webkit.org/show_bug.cgi?id=202943
2564
2565         Reviewed by Tim Horton.
2566
2567         Adds basic support for ClipboardItem.getType(), in the case where the ClipboardItems are created by the page. To
2568         achieve this, we introduce ClipboardItemDataSource, which represents the data source backing a given clipboard
2569         item. This backing may either consist of a list of types and their corresponding DOMPromises (for ClipboardItems
2570         that come from the page), or may consist of a list of items that will ask the platformr pasteboard for their
2571         data (to be supported in a future patch).
2572
2573         See below for more details.
2574
2575         Test: editing/async-clipboard/clipboard-item-basic.html
2576
2577         * Modules/async-clipboard/Clipboard.h:
2578         * Modules/async-clipboard/ClipboardItem.cpp:
2579         (WebCore::clipboardItemPresentationStyle):
2580         (WebCore::ClipboardItem::ClipboardItem):
2581
2582         Pass in the parent Clipboard object for ClipboardItems that are backed by the platform pasteboard (which are
2583         returned by Clipboard.read()). (Note that this doesn't make any difference until this codepath is actually
2584         exercised when we add support for Clipboard.read()).
2585
2586         (WebCore::ClipboardItem::create):
2587         (WebCore::ClipboardItem::types const):
2588         (WebCore::ClipboardItem::getType):
2589
2590         Plumb types() and getType() to the clipboard item's datasource.
2591
2592         (WebCore::ClipboardItem::navigator):
2593
2594         Make navigator() return the parent Clipboard object's navigator.
2595
2596         * Modules/async-clipboard/ClipboardItem.h:
2597         * Modules/async-clipboard/ClipboardItemBindingsDataSource.cpp: Added.
2598         (WebCore::blobFromString):
2599         (WebCore::ClipboardItemBindingsDataSource::ClipboardItemBindingsDataSource):
2600
2601         Store the given list of types and DOM promises.
2602
2603         (WebCore::ClipboardItemBindingsDataSource::types const):
2604         (WebCore::ClipboardItemBindingsDataSource::getType):
2605
2606         Implement getType() by finding the matching promised type in the item's array of types, and waiting for the
2607         promise to either resolve or reject. If the promise resolves to either a string or blob, we deliver the result
2608         back to the page by resolving the promise returned by getType(). Otherwise, we reject it.
2609
2610         * Modules/async-clipboard/ClipboardItemBindingsDataSource.h:
2611         * Modules/async-clipboard/ClipboardItemDataSource.h:
2612         (WebCore::ClipboardItemDataSource::ClipboardItemDataSource):
2613         * Modules/async-clipboard/ClipboardItemPasteboardDataSource.cpp:
2614
2615         Add a stub implementation of a clipboard item data source that is backed by data in the platform pasteboard. In
2616         a future patch, this will implement getType() by calling out to the platform pasteboard.
2617
2618         (WebCore::ClipboardItemPasteboardDataSource::ClipboardItemPasteboardDataSource):
2619         (WebCore::ClipboardItemPasteboardDataSource::types const):
2620         (WebCore::ClipboardItemPasteboardDataSource::getType):
2621         * Modules/async-clipboard/ClipboardItemPasteboardDataSource.h:
2622         * Modules/mediastream/RTCRtpReceiver.cpp:
2623         * Modules/mediastream/libwebrtc/LibWebRTCCertificateGenerator.cpp:
2624
2625         Unrelated build fixes, due to changes in unified source groupings.
2626
2627         * Sources.txt:
2628         * WebCore.xcodeproj/project.pbxproj:
2629         * platform/network/mac/UTIUtilities.mm:
2630
2631         More build fixes, due to changes in unified source groupings.
2632
2633 2019-10-15  Zalan Bujtas  <zalan@apple.com>
2634
2635         [LFC][IFC] Add support for text-transform: uppercase/lowercase
2636         https://bugs.webkit.org/show_bug.cgi?id=202968
2637         <rdar://problem/56278141>
2638
2639         Reviewed by Antti Koivisto.
2640
2641         The text content on the layout box should be in its final state (This might change if we actually need the original content for some reason though).
2642
2643         * layout/layouttree/LayoutTreeBuilder.cpp:
2644         (WebCore::Layout::applyTextTransform):
2645         (WebCore::Layout::TreeBuilder::createLayoutBox):
2646
2647 2019-10-14  Youenn Fablet  <youenn@apple.com>
2648
2649         Handle service worker loads through NetworkResourceLoader
2650         https://bugs.webkit.org/show_bug.cgi?id=202309
2651
2652         Reviewed by Alex Christensen.
2653
2654         Allow to serialize HTTP header names as enumeration.
2655         Updated SWServer ability to handle schemes by adding built-in support for HTTP and HTTPS as done in LegacySchemeRegistry.
2656
2657         Covered by existing tests.
2658
2659         * loader/ResourceLoaderOptions.h:
2660         * platform/network/create-http-header-name-table:
2661         * workers/service/server/SWServer.cpp:
2662         (WebCore::SWServer::canHandleScheme const):
2663         * workers/service/server/SWServer.h:
2664         * workers/service/server/SWServerJobQueue.cpp:
2665         (WebCore::SWServerJobQueue::runRegisterJob):
2666
2667 2019-10-14  Tim Horton  <timothy_horton@apple.com>
2668
2669         Unify sources for bindings more densely
2670         https://bugs.webkit.org/show_bug.cgi?id=202918
2671
2672         Reviewed by Simon Fraser.
2673
2674         No new tests, just a build time speedup.
2675         For me, this is a reliable 17% boost on the WebCore Build Time Benchmark.
2676
2677         * Scripts/generate-unified-sources.sh:
2678         Use dense bundles for JS* and bindings/js/*.
2679         This seems acceptable for a few reasons:
2680
2681         - most of the time building these files is spent parsing the exact
2682         same set of JSC headers, because the generated bindings code ends
2683         up including the same set of things
2684
2685         - the incremental build cost of bundling more bindings sources together
2686         is small, because the JSC headers dominate the time
2687
2688         - folks will frequently have to rebuild all of the bindings (on every
2689         pull, for example, because they indirectly include most JSC headers),
2690         but rarely end up rebuilding only a single one (in my experience)
2691
2692         * bindings/js/ReadableStreamDefaultController.cpp:
2693         (WebCore::readableStreamCallFunction):
2694         (WebCore::ReadableStreamDefaultController::invoke):
2695         (WebCore::callFunction): Deleted.
2696         Deduplicate static functions that now get bundled together.
2697
2698         * platform/graphics/ca/PlatformCALayer.cpp:
2699         (WebCore::PlatformCALayer::currentTimeToMediaTime):
2700         * platform/graphics/ca/PlatformCALayer.h:
2701         In older macOS SDKs, CABase.h included ApplicationServices.h, which
2702         causes lots of trouble.
2703
2704 2019-10-14  Carlos Garcia Campos  <cgarcia@igalia.com>
2705
2706         [GTK] White pages in AC mode: Cannot get default EGL display: EGL_BAD_PARAMETER
2707         https://bugs.webkit.org/show_bug.cgi?id=202362
2708
2709         Reviewed by Carlos Alberto Lopez Perez.
2710
2711         The problem is that PlatformDisplayLibWPE::initialize() is failing to initialize the EGL display for some
2712         reason. We need to understand why, but we should also handle the case of failing to initialize the EGL display
2713         and simply disable accelerated compositing mode to avoid white pages and crashes in websites using WebGL. This
2714         patch doesn't actually fix the bug, it just handles the EGL display initialization failure.
2715
2716         * platform/graphics/PlatformDisplay.cpp:
2717         (WebCore::PlatformDisplay::~PlatformDisplay): Set s_sharedDisplayForCompositing to nullptr when the shared
2718         display for compositing is destroyed.
2719         * platform/graphics/libwpe/PlatformDisplayLibWPE.cpp:
2720         (WebCore::PlatformDisplayLibWPE::initialize): Return false when EGL display initialization fails.
2721         * platform/graphics/libwpe/PlatformDisplayLibWPE.h:
2722
2723 2019-10-14  Chris Dumez  <cdumez@apple.com>
2724
2725         [WK2] Have WebBackForwardCache class coordinate page caching in all WebProcesses
2726         https://bugs.webkit.org/show_bug.cgi?id=202929
2727         <rdar://problem/56250421>
2728
2729         Reviewed by Alex Christensen.
2730
2731         Drop FrameLoaderClient::didSaveToPageCache() function as it is no longer needed.
2732         Instead, we now call HistoryItem::notifyChanged() whenever HistoryItem::m_cachedPage
2733         changes. This communicates to the UIProcess whether or not a HistoryItem has an
2734         associated CachedPage.
2735
2736         I also added more release logging to the PageCache and renamed its logging channel
2737         from PageCache to WebBackForwardCache to match the UIProcess's channel.
2738
2739         * history/BackForwardItemIdentifier.h:
2740         (WebCore::BackForwardItemIdentifier::string const):
2741         * history/CachedFrame.cpp:
2742         (WebCore::CachedFrame::CachedFrame):
2743         * history/HistoryItem.cpp:
2744         (WebCore::HistoryItem::setCachedPage):
2745         (WebCore::HistoryItem::takeCachedPage):
2746         * history/HistoryItem.h:
2747         * history/PageCache.cpp:
2748         (WebCore::PageCache::addIfCacheable):
2749         (WebCore::PageCache::take):
2750         (WebCore::PageCache::removeAllItemsForPage):
2751         (WebCore::PageCache::get):
2752         (WebCore::PageCache::remove):
2753         (WebCore::PageCache::prune):
2754         * loader/EmptyFrameLoaderClient.h:
2755         * loader/FrameLoader.cpp:
2756         (WebCore::FrameLoader::commitProvisionalLoad):
2757         (WebCore::FrameLoader::loadProvisionalItemFromCachedPage):
2758         * loader/FrameLoaderClient.h:
2759         * platform/Logging.h:
2760
2761 2019-10-14  Said Abou-Hallawa  <sabouhallawa@apple.com>
2762
2763         Outsets for referenced SVG filters are always zero
2764         https://bugs.webkit.org/show_bug.cgi?id=202826
2765
2766         Reviewed by Simon Fraser.
2767
2768         Sometimes the filter is applied only to a part of the image, so we need
2769         to enlarge the source rectangle such that the border of the result image
2770         looks like as if the filter were applied to the whole image.
2771
2772         The filter outsets should only be calculated for the blur and the drop
2773         shadow filters. The problem is FilterOperations::outsets() was returning
2774         empty outsets always for the referenced filters.
2775
2776         Since the referenced filters must be software filters, the fix is to rely
2777         on CSSFilter in calculating the filter outsets for software filters.
2778
2779         By adding a virtual function called outset() to the FilterEffect class, 
2780         we can loop through the CSSFilter::m_effects asking every FilterEffect
2781         to return its outset(). This function is only overridden by FEDropShadow
2782         and FEGaussianBlur.
2783
2784         This should work because RenderLayer builds the CSSFilter when the styleChanged()
2785         happens through its updateFilterPaintingStrategy(). This will guarantee 
2786         that m_filters->filter()->outsets() will return the correct outsets for
2787         the referenced and the non-referenced software filters.
2788
2789         We should keep FilterOperations::outsets() because it has be used for
2790         the hardware non-referenced filters. In that case, RenderLayer does not
2791         build the the filter effects. Therefore m_filters can't be used because
2792         it is null in this case.
2793
2794         For accuracy, hasOutsets() implementation is deleted. Having a blur or
2795         drop shadow filter effect is not enough to say hasOutsets() is true. We
2796         need to calculate the outsets first and then ask if it isZero() or not.
2797
2798         Test: css3/filters/svg-blur-filter-clipped.html
2799
2800         * platform/graphics/IntRectExtent.h:
2801         (WebCore::operator==):
2802         (WebCore::operator+=):
2803         (WebCore::IntRectExtent::expandRect const): Deleted.
2804         IntRectExtent is only used as a filter outsets. So add the definition of
2805         IntOutsets in IntRectExtent.h.
2806
2807         * platform/graphics/filters/FEDropShadow.cpp:
2808         (WebCore::FEDropShadow::outsets const):
2809         * platform/graphics/filters/FEDropShadow.h:
2810         * platform/graphics/filters/FEGaussianBlur.cpp:
2811         (WebCore::FEGaussianBlur::calculateOutsetSize):
2812         (WebCore::FEGaussianBlur::outsets const):
2813         * platform/graphics/filters/FEGaussianBlur.h:
2814         * platform/graphics/filters/FilterEffect.h:
2815         (WebCore::FilterEffect::outsets const):
2816         * platform/graphics/filters/FilterOperations.cpp:
2817         (WebCore::FilterOperations::outsets const):
2818         (WebCore::outsetSizeForBlur): Deleted.
2819         (WebCore::FilterOperations::hasOutsets const): Deleted.
2820         * platform/graphics/filters/FilterOperations.h:
2821         (WebCore::FilterOperations::hasOutsets const):
2822         * platform/graphics/texmap/TextureMapperLayer.cpp:
2823         (WebCore::TextureMapperLayer::computeOverlapRegions):
2824
2825         * rendering/CSSFilter.cpp:
2826         (WebCore::CSSFilter::build):
2827         (WebCore::CSSFilter::computeSourceImageRectForDirtyRect):
2828         (WebCore::CSSFilter::outsets const):
2829         Calculate m_outsets once and cache its value for later uses.
2830
2831         * rendering/CSSFilter.h:
2832         * rendering/RenderLayer.cpp:
2833         (WebCore::RenderLayer::setFilterBackendNeedsRepaintingInRect):
2834         (WebCore::RenderLayer::hasAncestorWithFilterOutsets const):
2835         (WebCore::transparencyClipBox):
2836         (WebCore::RenderLayer::calculateClipRects const):
2837         * rendering/RenderLayer.h:
2838         * rendering/style/RenderStyle.h:
2839         (WebCore::RenderStyle::filterOutsets const):
2840         (WebCore::RenderStyle::hasFilterOutsets const): Deleted.
2841
2842 2019-10-14  Wenson Hsieh  <wenson_hsieh@apple.com>
2843
2844         [Clipboard API] Refactor custom pasteboard writing codepaths to handle multiple items
2845         https://bugs.webkit.org/show_bug.cgi?id=202916
2846
2847         Reviewed by Tim Horton.
2848
2849         Adjusts the `Pasteboard::write` codepath for writing PasteboardCustomData to the platform pasteboard, such that
2850         it accepts multiple PasteboardCustomDatas. No new tests, since there is no behavior change.
2851
2852         * dom/DataTransfer.cpp:
2853         (WebCore::DataTransfer::commitToPasteboard):
2854
2855         Pass in the PasteboardCustomData as a single-item vector.
2856
2857         * platform/Pasteboard.h:
2858         * platform/PasteboardStrategy.h:
2859         * platform/PlatformPasteboard.h:
2860         * platform/StaticPasteboard.h:
2861         * platform/cocoa/PasteboardCocoa.mm:
2862         (WebCore::Pasteboard::writeCustomData):
2863         * platform/gtk/PasteboardGtk.cpp:
2864         (WebCore::Pasteboard::writeCustomData):
2865         * platform/gtk/PlatformPasteboardGtk.cpp:
2866         (WebCore::PlatformPasteboard::write):
2867         * platform/ios/PlatformPasteboardIOS.mm:
2868         (WebCore::PlatformPasteboard::write):
2869
2870         Adjust this method to return the updated change count.
2871
2872         * platform/libwpe/PasteboardLibWPE.cpp:
2873         (WebCore::Pasteboard::writeCustomData):
2874         * platform/libwpe/PlatformPasteboardLibWPE.cpp:
2875         (WebCore::PlatformPasteboard::write):
2876         * platform/mac/PlatformPasteboardMac.mm:
2877         (WebCore::PlatformPasteboard::write):
2878
2879         Add logic to fall back to writing legacy pasteboard types in the case where there is only one item.
2880
2881         * platform/win/PasteboardWin.cpp:
2882         (WebCore::Pasteboard::writeCustomData):
2883
2884 2019-10-14  Ryosuke Niwa  <rniwa@webkit.org>
2885
2886         Deploy smart pointers in RadioButtonGroups and RadioButtonGroup
2887         https://bugs.webkit.org/show_bug.cgi?id=202942
2888
2889         Reviewed by Zalan Bujtas.
2890
2891         Use Ref & WeakPtr instead of raw pointers in RadioButtonGroups and RadioButtonGroup.
2892
2893         Also made RadioButtonGroups::m_nameToGroupMap a HashMap instead of a unique_ptr of HashMap
2894         since RadioButtonGroups is lazily created in TreeScope as of r250708.
2895
2896         No new tests since there should be no observable behavioral change.
2897
2898         * accessibility/AccessibilityRenderObject.cpp:
2899         (WebCore::AccessibilityRenderObject::addRadioButtonGroupMembers const):
2900         * dom/RadioButtonGroups.cpp:
2901         (WebCore::RadioButtonGroup): Use WeakHashSet and WeakPtr instead of raw pointers.
2902         (WebCore::RadioButtonGroup::isEmpty const):
2903         (WebCore::RadioButtonGroup::checkedButton const):
2904         (WebCore::RadioButtonGroup::members const):
2905         (WebCore::RadioButtonGroup::setCheckedButton):
2906         (WebCore::RadioButtonGroup::updateCheckedState):
2907         (WebCore::RadioButtonGroup::requiredStateChanged):
2908         (WebCore::RadioButtonGroup::remove):
2909         (WebCore::RadioButtonGroup::setNeedsStyleRecalcForAllButtons):
2910         (WebCore::RadioButtonGroup::updateValidityForAllButtons):
2911         (WebCore::RadioButtonGroup::contains const):
2912         (WebCore::RadioButtonGroups::addButton):
2913         (WebCore::RadioButtonGroups::groupMembers const):
2914         (WebCore::RadioButtonGroups::updateCheckedState):
2915         (WebCore::RadioButtonGroups::requiredStateChanged):
2916         (WebCore::RadioButtonGroups::checkedButtonForGroup const):
2917         (WebCore::RadioButtonGroups::hasCheckedButton const):
2918         (WebCore::RadioButtonGroups::isInRequiredGroup const):
2919         (WebCore::RadioButtonGroups::removeButton):
2920         * dom/RadioButtonGroups.h:
2921         (WebCore::RadioButtonGroups):
2922         * html/HTMLInputElement.cpp:
2923         (WebCore::HTMLInputElement::radioButtonGroup const):
2924         (WebCore::HTMLInputElement::checkedRadioButtonForGroup const):
2925         * html/HTMLInputElement.h:
2926
2927 2019-10-14  David Quesada  <david_quesada@apple.com>
2928
2929         Remove WebCore::IOSApplication::isWebApp()
2930         https://bugs.webkit.org/show_bug.cgi?id=181259
2931
2932         Reviewed by Alex Christensen.
2933
2934         As of iOS 11, the Web.app process no longer uses WebKit directly, so IOSApplication::isWebApp()
2935         is never true. Since it's no longer needed, remove it.
2936
2937         * platform/RuntimeApplicationChecks.h:
2938         * platform/cocoa/RuntimeApplicationChecksCocoa.mm:
2939         (WebCore::IOSApplication::isWebApp): Deleted.
2940
2941 2019-10-14  Andy Estes  <aestes@apple.com>
2942
2943         REGRESSION (r243682): Quick Look previews loaded from the memory cache render with the wrong content type
2944         https://bugs.webkit.org/show_bug.cgi?id=202935
2945         <rdar://problem/54318133>
2946
2947         Reviewed by Tim Horton.
2948
2949         When loading a Quick Look preview after deciding content policy, PreviewLoader would update
2950         DocumentLoader with the preview response (the response that contains the preview's
2951         Content-Type). It would not update the CachedResource representing the preview main
2952         resource, however, which caches the underlying ResourceResponse in m_response.
2953
2954         When loading from the memory cache, it's the CachedResource's response that's used to
2955         synthesize DocumentLoader::responseReceived. When loading Quick Look previews *before*
2956         deciding content policy, this response would be the preview response, but as described
2957         above, when loading after deciding content policy it's the underlying response.
2958
2959         This patch updates a Quick Look preview's CachedResource with the preview response along
2960         with updating DocumentLoader so that there is not a mismatch between the resource's content
2961         type and its underlying data.
2962
2963         Added a new API test.
2964
2965         * loader/DocumentLoader.cpp:
2966         (WebCore::DocumentLoader::previewResponseReceived):
2967         * loader/DocumentLoader.h:
2968         * loader/ResourceLoader.h:
2969         (WebCore::ResourceLoader::didReceivePreviewResponse):
2970         * loader/SubresourceLoader.cpp:
2971         (WebCore::SubresourceLoader::didReceivePreviewResponse):
2972         * loader/SubresourceLoader.h:
2973         * loader/cache/CachedRawResource.cpp:
2974         (WebCore::CachedRawResource::previewResponseReceived):
2975         * loader/cache/CachedRawResource.h:
2976         * loader/cache/CachedRawResourceClient.h:
2977         (WebCore::CachedRawResourceClient::previewResponseReceived):
2978         * loader/cache/CachedResource.cpp:
2979         (WebCore::CachedResource::previewResponseReceived):
2980         * loader/cache/CachedResource.h:
2981         * loader/ios/PreviewLoader.mm:
2982         (-[WebPreviewLoader _loadPreviewIfNeeded]):
2983
2984 2019-10-14  Youenn Fablet  <youenn@apple.com>
2985
2986         A response body promise should be rejected in case of a failure happening after the HTTP response
2987         https://bugs.webkit.org/show_bug.cgi?id=202792
2988
2989         Reviewed by Chris Dumez.
2990
2991         Test: imported/w3c/web-platform-tests/service-workers/service-worker/fetch-error.https.html
2992
2993         * Modules/fetch/FetchResponse.cpp:
2994         (WebCore::FetchResponse::BodyLoader::didFail):
2995         Propagate error to fetch body consumer if any.
2996
2997 2019-10-14  Wenson Hsieh  <wenson_hsieh@apple.com>
2998
2999         [Clipboard API] Support writing multiple PasteboardCustomData with SharedBuffers to the pasteboard
3000         https://bugs.webkit.org/show_bug.cgi?id=202851
3001
3002         Reviewed by Darin Adler.
3003
3004         This patch refactors some logic around WebCore::PasteboardCustomData, in preparation for implementing the async
3005         clipboard API. There are two main goals of this refactoring:
3006
3007         1. Enable writing multiple items (each backed by PasteboardCustomData) to the platform pasteboard.
3008         2. Enable writing platform data in the form of SharedBuffers to the platform pasteboard.
3009
3010         See below for more details; no tests, as there is no change in behavior yet.
3011
3012         * Headers.cmake:
3013         * Sources.txt:
3014         * SourcesCocoa.txt:
3015         * WebCore.xcodeproj/project.pbxproj:
3016
3017         Move PasteboardCustomData out of Pasteboard.h and into its own file.
3018
3019         * dom/DataTransfer.cpp:
3020         (WebCore::DataTransfer::commitToPasteboard):
3021         * editing/cocoa/EditorCocoa.mm:
3022         (WebCore::Editor::getPasteboardTypesAndDataForAttachment):
3023         * platform/Pasteboard.cpp:
3024         (WebCore::PasteboardCustomData::createSharedBuffer const): Deleted.
3025         (WebCore::PasteboardCustomData::fromSharedBuffer): Deleted.
3026
3027         Moved these method implementations to PasteboardCustomData.cpp.
3028
3029         * platform/Pasteboard.h:
3030
3031         Refactor PasteboardCustomData so that its member variables are now private, and encapsulated behind methods
3032         Additionally, make it so that the only way to set data on PasteboardCustomData is to use the writeString,
3033         writeData, and writeStringInCustomData methods, which ensure that the PasteboardCustomData is always in a
3034         consistent state.
3035
3036         * platform/PasteboardCustomData.cpp: Added.
3037         (WebCore::copyPlatformData):
3038         (WebCore::PasteboardCustomData::Entry::Entry):
3039         (WebCore::PasteboardCustomData::Entry::operator=):
3040
3041         Refactor the implementation of PasteboardCustomData, so that it contains a list of PasteboardCustomData entries
3042         instead of individual Vectors and HashMaps.
3043
3044         (WebCore::PasteboardCustomData::PasteboardCustomData):
3045         (WebCore::PasteboardCustomData::createSharedBuffer const):
3046         (WebCore::PasteboardCustomData::fromSharedBuffer):
3047         (WebCore::PasteboardCustomData::writeString):
3048         (WebCore::PasteboardCustomData::writeData):
3049         (WebCore::PasteboardCustomData::writeStringInCustomData):
3050         (WebCore::PasteboardCustomData::addOrMoveEntryToEnd):
3051
3052         Move logic from StaticPasteboard into PasteboardCustomData, and refactor these methods to handle
3053         Vector<PasteboardCustomData::Entry>.
3054
3055         (WebCore::PasteboardCustomData::clear):
3056         (WebCore::PasteboardCustomData::operator=):
3057         (WebCore::PasteboardCustomData::orderedTypes const):
3058         (WebCore::PasteboardCustomData::hasData const):
3059         (WebCore::PasteboardCustomData::hasSameOriginCustomData const):
3060         (WebCore::PasteboardCustomData::sameOriginCustomStringData const):
3061         (WebCore::PasteboardCustomData::readBuffer const):
3062         (WebCore::PasteboardCustomData::readString const):
3063         (WebCore::PasteboardCustomData::readStringInCustomData const):
3064         (WebCore::PasteboardCustomData::forEachType const):
3065         (WebCore::PasteboardCustomData::forEachPlatformString const):
3066         (WebCore::PasteboardCustomData::forEachCustomString const):
3067         (WebCore::PasteboardCustomData::forEachPlatformStringOrBuffer const):
3068
3069         Moved these method implementations from StaticPasteboard to PasteboardCustomData, and also introduced some new
3070         methods to help iterate through types and data.
3071
3072         * platform/PasteboardCustomData.h: Added.
3073         (WebCore::PasteboardCustomData::origin const):
3074         (WebCore::PasteboardCustomData::setOrigin):
3075         (WebCore::PasteboardCustomData::data const):
3076         * platform/PasteboardStrategy.h:
3077         * platform/PlatformPasteboard.h:
3078         * platform/SharedBuffer.cpp:
3079         (WebCore::SharedBuffer::decoder const):
3080         * platform/SharedBuffer.h:
3081         * platform/StaticPasteboard.cpp:
3082         (WebCore::StaticPasteboard::hasData):
3083         (WebCore::StaticPasteboard::typesSafeForBindings):
3084         (WebCore::StaticPasteboard::typesForLegacyUnsafeBindings):
3085         (WebCore::StaticPasteboard::readString):
3086         (WebCore::StaticPasteboard::readStringInCustomData):
3087         (WebCore::StaticPasteboard::writeString):
3088         (WebCore::StaticPasteboard::writeData):
3089         (WebCore::StaticPasteboard::writeStringInCustomData):
3090         (WebCore::StaticPasteboard::clear):
3091         (WebCore::StaticPasteboard::takeCustomData):
3092         (WebCore::StaticPasteboard::StaticPasteboard): Deleted.
3093
3094         Refactor StaticPasteboard to now contain a PasteboardCustomData; additionally, adjust several methods in
3095         StaticPasteboard to simply call into PasteboardCustomData to write, read, or clear data.
3096
3097         (WebCore::updateTypes): Deleted.
3098         * platform/StaticPasteboard.h:
3099         * platform/cocoa/PasteboardCocoa.mm:
3100         (WebCore::Pasteboard::readStringInCustomData):
3101         (WebCore::Pasteboard::readOrigin):
3102         (WebCore::PasteboardCustomData::cocoaType): Deleted.
3103
3104         Moved the implementation of PasteboardCustomData::cocoaType from PasteboardCocoa.mm to
3105         PasteboardCustomDataCocoa.mm.
3106
3107         * platform/cocoa/PasteboardCustomDataCocoa.mm: Added.
3108         (WebCore::PasteboardCustomData::cocoaType):
3109         * platform/ios/AbstractPasteboard.h:
3110         * platform/ios/PlatformPasteboardIOS.mm:
3111         (WebCore::PlatformPasteboard::changeCount const):
3112         (WebCore::registerItemsToPasteboard):
3113         (WebCore::registerItemToPasteboard):
3114         (WebCore::PlatformPasteboard::write):
3115
3116         Support writing multiple PasteboardCustomData objects to the platform pasteboard on iOS, by generating
3117         NSItemProviders for each one. This refactors the existing `registerItemToPasteboard` helper to handle multiple
3118         registration lists, renames it to `registerItemsToPasteboard` (plural), and then reimplements
3119         `registerItemToPasteboard` in terms of `registerItemsToPasteboard`.
3120
3121         (WebCore::PlatformPasteboard::typesSafeForDOMToReadAndWrite const):
3122         (WebCore::createItemProviderRegistrationList):
3123
3124         Adjust these to use getters on PasteboardCustomData instead of accessing the member variables directly.
3125
3126         * platform/ios/WebItemProviderPasteboard.mm:
3127         (-[WebItemProviderPasteboard init]):
3128         (-[WebItemProviderPasteboard stageRegistrationLists:]):
3129         (-[WebItemProviderPasteboard clearRegistrationLists]):
3130         (-[WebItemProviderPasteboard takeRegistrationLists]):
3131
3132         Refactor registration list staging on WebItemProviderPasteboard to support multiple registration lists, each
3133         representing a single item provider.
3134
3135         (-[WebItemProviderPasteboard stageRegistrationList:]): Deleted.
3136         (-[WebItemProviderPasteboard takeRegistrationList]): Deleted.
3137         * platform/mac/PasteboardMac.mm:
3138         (WebCore::Pasteboard::write):
3139         * platform/mac/PasteboardWriter.mm:
3140         (WebCore::createPasteboardWriter):
3141         * platform/mac/PlatformPasteboardMac.mm:
3142         (WebCore::PlatformPasteboard::typesSafeForDOMToReadAndWrite const):
3143         (WebCore::PlatformPasteboard::write):
3144
3145         Support writing multiple PasteboardCustomData objects to the platform pasteboard on macOS, by creating and
3146         setting NSPasteboardItems for each custom data. This means that instead of using legacy macOS pasteboard types,
3147         we need to use the "modern" NSPasteboardTypes when writing each item. This is because NSPasteboardItem quietly
3148         fails when attempting to set data for a legacy pasteboard type.
3149
3150         (WebCore::createPasteboardItem):
3151
3152 2019-10-14  Truitt Savell  <tsavell@apple.com>
3153
3154         Unreviewed, rolling out r251081.
3155
3156         Broke macOS and iOS builds
3157
3158         Reverted changeset:
3159
3160         "transform-box: content-box, stroke-box missing"
3161         https://bugs.webkit.org/show_bug.cgi?id=201892
3162         https://trac.webkit.org/changeset/251081
3163
3164 2019-10-14  Dean Jackson  <dino@apple.com>
3165
3166         Reset maxCanvasPixelMemory between tests
3167         https://bugs.webkit.org/show_bug.cgi?id=202941
3168         <rdar://problem/56260865>
3169
3170         Reviewed by Wenson Hsieh.
3171
3172         Reset the maximum canvas memory between tests.
3173
3174         * testing/Internals.cpp:
3175         (WebCore::Internals::resetToConsistentState):
3176
3177 2019-10-14  Myles C. Maxfield  <mmaxfield@apple.com>
3178
3179         [Cocoa] font-family:system-ui on Chinese systems don't get Chinese quote marks
3180         https://bugs.webkit.org/show_bug.cgi?id=202778
3181
3182         Unreviewed.
3183
3184         Addressing post-review comment.
3185
3186         * platform/graphics/cocoa/SystemFontDatabaseCoreText.cpp:
3187         (WebCore::SystemFontDatabaseCoreText::createSystemUIFont):
3188
3189 2019-10-14  Alex Christensen  <achristensen@webkit.org>
3190
3191         REGRESSION: [iOS 13?] TestWebKitAPI.SharedBufferTest.tryCreateArrayBufferLargeSegments is failing
3192         https://bugs.webkit.org/show_bug.cgi?id=201902
3193
3194         Reviewed by Ryosuke Niwa.
3195
3196         * Modules/webauthn/fido/U2fResponseConverter.cpp:
3197         (fido::WebCore::createAttestedCredentialDataFromU2fRegisterResponse):
3198
3199 2019-10-14  Russell Epstein  <russell_e@apple.com>
3200
3201         Unreviewed, rolling out r251081.
3202
3203         Broke macOS and iOS builds.
3204
3205         Reverted changeset:
3206
3207         "transform-box: content-box, stroke-box missing"
3208         https://bugs.webkit.org/show_bug.cgi?id=201892
3209         https://trac.webkit.org/changeset/251081
3210
3211 2019-10-14  Dirk Schulze  <krit@webkit.org>
3212
3213         transform-box: content-box, stroke-box missing
3214         https://bugs.webkit.org/show_bug.cgi?id=201892
3215
3216         Reviewed by Simon Fraser.
3217
3218         Added the keywords content-box and stroke-box to the
3219         transform-box CSS property.
3220         Those keywords were added to the spec after the implementation
3221         in WebKit.
3222
3223         Test: transforms/transform-box.html
3224
3225         * css/CSSPrimitiveValueMappings.h:
3226         (WebCore::CSSPrimitiveValue::CSSPrimitiveValue):
3227         (WebCore::CSSPrimitiveValue::operator TransformBox const):
3228         * css/CSSProperties.json:
3229         * css/CSSValueKeywords.in:
3230         * css/parser/CSSPropertyParser.cpp:
3231         (WebCore::CSSPropertyParser::parseSingleValue):
3232         * rendering/RenderLayer.cpp:
3233         (WebCore::computeReferenceBox):
3234         (WebCore::transformBoxToCSSBoxType):
3235         (WebCore::RenderLayer::currentTransform const):
3236         * rendering/style/RenderStyleConstants.h:
3237         * svg/SVGGraphicsElement.cpp:
3238         (WebCore::SVGGraphicsElement::animatedLocalTransform const):
3239
3240 2019-10-14  Truitt Savell  <tsavell@apple.com>
3241
3242         Unreviewed, rolling out r251045.
3243
3244         Broke internal builds
3245
3246         Reverted changeset:
3247
3248         "AX: Make AXIsolatedTree compile again"
3249         https://bugs.webkit.org/show_bug.cgi?id=202702
3250         https://trac.webkit.org/changeset/251045
3251
3252 2019-10-14  youenn fablet  <youenn@apple.com>
3253
3254         Reuse existing web processes for running service workers
3255         https://bugs.webkit.org/show_bug.cgi?id=202195
3256
3257         Reviewed by Chris Dumez.
3258
3259         Update implementation to be able to run service workers jointly with page.
3260         Add internals API to get the process ID.
3261         This allows writing tests to check whether a service worker is in the same process as its client or not.
3262
3263         Test: http/wpt/service-workers/service-worker-different-process.https.html
3264
3265         * testing/Internals.cpp:
3266         (WebCore::Internals::processIdentifier const):
3267         * testing/Internals.h:
3268         * testing/Internals.idl:
3269         * testing/ServiceWorkerInternals.cpp:
3270         (WebCore::ServiceWorkerInternals::processIdentifier const):
3271         * testing/ServiceWorkerInternals.h:
3272         * testing/ServiceWorkerInternals.idl:
3273         * workers/service/ServiceWorkerProvider.cpp:
3274         (WebCore::ServiceWorkerProvider::registerServiceWorkerClients):
3275         Do not register dummy documents whose sole purpose is to do loading for service workers.
3276         * workers/service/context/SWContextManager.cpp:
3277         (WebCore::SWContextManager::setConnection):
3278         Now that connections might be created more than once on a given process,
3279         Make sure that the replaced connection is stopped or there is no replaced connection.
3280         (WebCore::SWContextManager::stopAllServiceWorkers):
3281         Add routine to stop all service workers running in a given web process.
3282         * workers/service/context/SWContextManager.h:
3283         (WebCore::SWContextManager::Connection::isClosed const):
3284         (WebCore::SWContextManager::Connection::setAsClosed):
3285
3286 2019-10-13  Tim Horton  <timothy_horton@apple.com>
3287
3288         Stop 'using namespace *Names' in files generated by make_names.pl
3289         https://bugs.webkit.org/show_bug.cgi?id=202907
3290
3291         Reviewed by Geoffrey Garen.
3292
3293         * dom/make_names.pl:
3294         (printFunctionTable):
3295         (printFactoryCppFile):
3296         (printWrapperFactoryCppFile):
3297         Stop 'using namespace SVGNames' and 'using namepace HTMLNames' in
3298         files generated by make_names.pl. Just use fully-qualified names.
3299
3300         There is some overlap between the two namespaces, so this is a
3301         prerequsite for doing more aggressive unified source bundling in bindings.
3302
3303 2019-10-13  Tim Horton  <timothy_horton@apple.com>
3304
3305         Don't include ApplicationServices in npapi.h
3306         https://bugs.webkit.org/show_bug.cgi?id=202911
3307
3308         Reviewed by Sam Weinig.
3309
3310         * plugins/npapi.h:
3311         Just include CoreGraphics.h, not ApplicationServices.h.
3312         ApplicationServices.h pulls in all sorts of crazy things like
3313         QuickDraw headers that have symbol conflicts with JSC (like Handle).
3314
3315 2019-10-13  Stephan Szabo  <stephan.szabo@sony.com>
3316
3317         Wincairo build broken: EventLoop.h: No such file or directory
3318         https://bugs.webkit.org/show_bug.cgi?id=202893
3319
3320         Reviewed by Fujii Hironori.
3321
3322         Remove include of EventLoop.h.
3323
3324         * platform/network/curl/SynchronousLoaderClientCurl.cpp:
3325
3326 2019-10-13  Konstantin Tokarev  <annulen@yandex.ru>
3327
3328         Fix compilation of Crypto.cpp on macOS with !WEB_CRYPTO
3329         https://bugs.webkit.org/show_bug.cgi?id=202895
3330
3331         Reviewed by Alexey Proskuryakov.
3332
3333         Crypto.cpp does not use getCommonCryptoDigestAlgorithm(), defined in
3334         CommonCryptoUtilities.h, but requires CommonCrypto includes which are
3335         coming with it. However, when WEB_CRYPTO is disabled necessary
3336         transitive includes are missing.
3337
3338         * page/Crypto.cpp:
3339
3340 2019-10-13  Simon Fraser  <simon.fraser@apple.com>
3341
3342         Convert ENinePieceImageRule into an enum class and rename
3343         https://bugs.webkit.org/show_bug.cgi?id=202889
3344
3345         Reviewed by Alex Christensen.
3346
3347         Enum classify ENinePieceImageRule.
3348         
3349         The bitfield in NinePieceImage isn't saving anything so don't use one there.
3350
3351         * css/CSSComputedStyleDeclaration.cpp:
3352         (WebCore::valueForRepeatRule):
3353         * css/CSSToStyleMap.cpp:
3354         (WebCore::CSSToStyleMap::mapNinePieceImageRepeat):
3355         * css/StyleBuilderCustom.h:
3356         (WebCore::ApplyPropertyBorderImageModifier::applyInitialValue):
3357         * rendering/style/NinePieceImage.cpp:
3358         (WebCore::NinePieceImage::NinePieceImage):
3359         (WebCore::NinePieceImage::computeMiddleTileScale):
3360         (WebCore::NinePieceImage::computeTileScales):
3361         (WebCore::NinePieceImage::Data::Data):
3362         (WebCore::NinePieceImage::Data::create):
3363         * rendering/style/NinePieceImage.h:
3364         (WebCore::NinePieceImage::horizontalRule const):
3365         (WebCore::NinePieceImage::setHorizontalRule):
3366         (WebCore::NinePieceImage::verticalRule const):
3367         (WebCore::NinePieceImage::setVerticalRule):
3368
3369 2019-10-13  Simon Fraser  <simon.fraser@apple.com>
3370
3371         Clarify the naming of the radius-related functions on BorderData
3372         https://bugs.webkit.org/show_bug.cgi?id=202888
3373
3374         Reviewed by Alex Christensen.
3375
3376         BorderData had some confusingly named data members and functions ("topLeft"'"). Renamed
3377         to include the term "radius".
3378
3379         * platform/graphics/PathUtilities.cpp:
3380         (WebCore::PathUtilities::pathWithShrinkWrappedRectsForOutline):
3381         * rendering/style/BorderData.h:
3382         (WebCore::BorderData::BorderData):
3383         (WebCore::BorderData::hasBorderRadius const):
3384         (WebCore::BorderData::operator== const):
3385         (WebCore::BorderData::topLeftRadius const):
3386         (WebCore::BorderData::topRightRadius const):
3387         (WebCore::BorderData::bottomLeftRadius const):
3388         (WebCore::BorderData::bottomRightRadius const):
3389         (WebCore::BorderData::topLeft const): Deleted.
3390         (WebCore::BorderData::topRight const): Deleted.
3391         (WebCore::BorderData::bottomLeft const): Deleted.
3392         (WebCore::BorderData::bottomRight const): Deleted.
3393         * rendering/style/RenderStyle.cpp:
3394         (WebCore::calcRadiiFor):
3395         * rendering/style/RenderStyle.h:
3396         (WebCore::RenderStyle::borderTopLeftRadius const):
3397         (WebCore::RenderStyle::borderTopRightRadius const):
3398         (WebCore::RenderStyle::borderBottomLeftRadius const):
3399         (WebCore::RenderStyle::borderBottomRightRadius const):
3400         (WebCore::RenderStyle::resetBorderTopLeftRadius):
3401         (WebCore::RenderStyle::resetBorderTopRightRadius):
3402         (WebCore::RenderStyle::resetBorderBottomLeftRadius):
3403         (WebCore::RenderStyle::resetBorderBottomRightRadius):
3404         (WebCore::RenderStyle::setBorderTopLeftRadius):
3405         (WebCore::RenderStyle::setBorderTopRightRadius):
3406         (WebCore::RenderStyle::setBorderBottomLeftRadius):
3407         (WebCore::RenderStyle::setBorderBottomRightRadius):
3408
3409 2019-10-13  Simon Fraser  <simon.fraser@apple.com>
3410
3411         Convert LineBoxContain to use an OptionSet<>
3412         https://bugs.webkit.org/show_bug.cgi?id=202890
3413
3414         Reviewed by Alex Christensen.
3415
3416         Use OptionSet<LineBoxContain>.
3417
3418         * css/CSSComputedStyleDeclaration.cpp:
3419         (WebCore::createLineBoxContainValue):
3420         * css/CSSLineBoxContainValue.cpp:
3421         (WebCore::CSSLineBoxContainValue::CSSLineBoxContainValue):
3422         (WebCore::CSSLineBoxContainValue::customCSSText const):
3423         * css/CSSLineBoxContainValue.h:
3424         * css/StyleBuilderConverter.h:
3425         (WebCore::StyleBuilderConverter::convertLineBoxContain):
3426         * css/parser/CSSPropertyParser.cpp:
3427         (WebCore::consumeLineBoxContain):
3428         * rendering/RenderBlock.cpp:
3429         (WebCore::RenderBlock::minLineHeightForReplacedRenderer const):
3430         * rendering/RootInlineBox.cpp:
3431         (WebCore::RootInlineBox::ascentAndDescentForBox const):
3432         (WebCore::RootInlineBox::includeLeadingForBox const):
3433         (WebCore::RootInlineBox::includeFontForBox const):
3434         (WebCore::RootInlineBox::includeGlyphsForBox const):
3435         (WebCore::RootInlineBox::includeInitialLetterForBox const):
3436         (WebCore::RootInlineBox::includeMarginForBox const):
3437         (WebCore::RootInlineBox::fitsToGlyphs const):
3438         (WebCore::RootInlineBox::includesRootLineBoxFontOrLeading const):
3439         * rendering/SimpleLineLayout.cpp:
3440         (WebCore::SimpleLineLayout::canUseForFontAndText):
3441         (WebCore::SimpleLineLayout::canUseForStyle):
3442         * rendering/style/RenderStyle.h:
3443         (WebCore::RenderStyle::lineBoxContain const):
3444         (WebCore::RenderStyle::setLineBoxContain):
3445         (WebCore::RenderStyle::initialLineBoxContain):
3446         * rendering/style/StyleRareInheritedData.cpp:
3447         (WebCore::StyleRareInheritedData::StyleRareInheritedData):
3448         * rendering/style/StyleRareInheritedData.h:
3449         * rendering/updating/RenderTreeBuilderFirstLetter.cpp:
3450         (WebCore::styleForFirstLetter):
3451
3452 2019-10-12  Ryosuke Niwa  <rniwa@webkit.org>
3453
3454         [iOS] Crash in WebCore::DOMWindow::incrementScrollEventListenersCount
3455         https://bugs.webkit.org/show_bug.cgi?id=202878
3456
3457         Reviewed by Alex Christensen.
3458
3459         Added the missing null check in tryAddEventListener and tryRemoveEventListener for scroll event.
3460
3461         Test: fast/events/scroll-event-on-document-without-window.html
3462
3463         * dom/Node.cpp:
3464         (WebCore::tryAddEventListener):
3465         (WebCore::tryRemoveEventListener):
3466
3467 2019-10-12  Simon Fraser  <simon.fraser@apple.com>
3468
3469         Move CSSReflectionDirection into RenderStyleConstants as ReflectionDirection
3470         https://bugs.webkit.org/show_bug.cgi?id=202886
3471
3472         Reviewed by Sam Weinig.
3473
3474         Make CSSReflectionDirection an enum class ReflectionDirection, and fix the usage sites.
3475
3476         * Headers.cmake:
3477         * WebCore.xcodeproj/project.pbxproj:
3478         * css/CSSComputedStyleDeclaration.cpp:
3479         (WebCore::valueForReflection):
3480         * css/CSSPrimitiveValueMappings.h:
3481         (WebCore::CSSPrimitiveValue::CSSPrimitiveValue):
3482         (WebCore::CSSPrimitiveValue::operator ReflectionDirection const):
3483         (WebCore::CSSPrimitiveValue::operator CSSReflectionDirection const): Deleted.
3484         * css/CSSReflectionDirection.h: Removed.
3485         * rendering/RenderBox.cpp:
3486         (WebCore::RenderBox::reflectionOffset const):
3487         (WebCore::RenderBox::reflectedRect const):
3488         * rendering/RenderLayer.cpp:
3489         (WebCore::RenderLayer::calculateClipRects const):
3490         * rendering/style/RenderStyleConstants.cpp:
3491         (WebCore::operator<<):
3492         * rendering/style/RenderStyleConstants.h:
3493         * rendering/style/StyleReflection.h:
3494         (WebCore::StyleReflection::direction const):
3495         (WebCore::StyleReflection::setDirection):
3496         (WebCore::StyleReflection::StyleReflection):
3497
3498 2019-10-12  Simon Fraser  <simon.fraser@apple.com>
3499
3500         Fix the spelling of ThreeDDarkDhasowColor and unwrap the ThemeType enums
3501         https://bugs.webkit.org/show_bug.cgi?id=202887
3502
3503         Reviewed by Wenson Hsieh.
3504
3505         ThreeDDarkDhasowColor was misspelled, and one enum value per line please.
3506
3507         * platform/ThemeTypes.h:
3508
3509 2019-10-12  Chris Dumez  <cdumez@apple.com>
3510
3511         Add [ActiveDOMObject] to IDLs of ActiveDOMObjects
3512         https://bugs.webkit.org/show_bug.cgi?id=202869
3513
3514         Reviewed by Ryosuke Niwa.
3515
3516         Add [ActiveDOMObject] to IDLs of ActiveDOMObjects, this is necessary so that the wrapper
3517         stays alive as long as ActiveDOMObject::hasPendingActivity() returns true. We may have
3518         subtle lifetime bugs otherwise.
3519
3520         * Modules/encryptedmedia/MediaKeySession.h:
3521         * Modules/encryptedmedia/MediaKeySession.idl:
3522         * Modules/entriesapi/FileSystemDirectoryReader.idl:
3523         * Modules/entriesapi/FileSystemEntry.idl:
3524         * Modules/geolocation/Geolocation.idl:
3525         * Modules/indexeddb/IDBObjectStore.h:
3526         * Modules/indexeddb/IDBObjectStore.idl:
3527         * Modules/paymentrequest/PaymentResponse.idl:
3528         * Modules/webvr/VRDisplay.h:
3529         * Modules/webvr/VRDisplay.idl:
3530         * workers/service/ServiceWorkerContainer.idl:
3531
3532 2019-10-12  Simon Fraser  <simon.fraser@apple.com>
3533
3534         Implement TextStream-based dumping for all the RenderStyle and SVGRenderStyle enum classes
3535         https://bugs.webkit.org/show_bug.cgi?id=202877
3536
3537         Reviewed by Dean Jackson.
3538
3539         Make style-related enum classes dumpable with TextStream,  and make some SVG style-related
3540         classes dumpable.
3541
3542         * rendering/style/RenderStyleConstants.cpp:
3543         (WebCore::operator<<):
3544         * rendering/style/RenderStyleConstants.h:
3545         * rendering/style/SVGRenderStyleDefs.cpp:
3546         (WebCore::operator<<):
3547         * rendering/style/SVGRenderStyleDefs.h:
3548         * rendering/style/ShadowData.cpp:
3549         (WebCore::operator<<):
3550         * rendering/style/ShadowData.h:
3551
3552 2019-10-12  Chris Dumez  <cdumez@apple.com>
3553
3554         Unreviewed, rolling out r251040.
3555
3556         Broke IDB tests in Debug
3557
3558         Reverted changeset:
3559
3560         "Add [ActiveDOMObject] to IDLs of ActiveDOMObjects"
3561         https://bugs.webkit.org/show_bug.cgi?id=202869
3562         https://trac.webkit.org/changeset/251040
3563
3564 2019-10-12  Ryosuke Niwa  <rniwa@webkit.org>
3565
3566         Invoke callbacks registered by requestIdleCallback
3567         https://bugs.webkit.org/show_bug.cgi?id=202824
3568
3569         Reviewed by Antti Koivisto.
3570
3571         Invoke callbacks registered by requestIdleCallback unless it's canceled.
3572
3573         To do this, this patch introduces WindowEventLoop class, which represents the HTML5 event loop:
3574         https://html.spec.whatwg.org/multipage/webappapis.html#window-event-loop
3575
3576         Because each and only each agent cluster is meant to have its own window event loop, this class will be shared
3577         across multiple documents of the same registrable domain:
3578         https://html.spec.whatwg.org/multipage/webappapis.html#integration-with-the-javascript-agent-cluster-formalism
3579
3580         Tests: requestidlecallback/requestidlecallback-is-called.html
3581                requestidlecallback/requestidlecallback-is-not-called-when-canceled.html
3582
3583         * Sources.txt:
3584         * WebCore.xcodeproj/project.pbxproj:
3585         * dom/Document.cpp:
3586         (WebCore::Document::eventLoop): Added.
3587         (WebCore::Document::requestIdleCallback): Associate IdleCallbackController with this document.
3588         * dom/Document.h:
3589         (WebCore::Document::idleCallbackController): Added. Used for release assertions.
3590         * dom/IdleCallbackController.cpp:
3591         (WebCore::IdleCallbackController::IdleCallbackController): Keeps a weak pointer to Document.
3592         (WebCore::IdleCallbackController::queueIdleCallback):
3593         (WebCore::IdleCallbackController::removeIdleCallback):
3594         (WebCore::IdleCallbackController::queueTaskToStartIdlePeriod): Added.
3595         (WebCore::IdleCallbackController::startIdlePeriod): Added. Implements the start an idle period algorithm:
3596         https://w3c.github.io/requestidlecallback/#start-an-idle-period-algorithm
3597         (WebCore::IdleCallbackController::queueTaskToInvokeIdleCallbacks): Added.
3598         (WebCore::IdleCallbackController::invokeIdleCallbacks): Added. The invoke idle callback timeout algorithm:
3599         https://w3c.github.io/requestidlecallback/#invoke-idle-callback-timeout-algorithm
3600         * dom/IdleCallbackController.h:
3601         * dom/IdleDeadline.h:
3602         * dom/WindowEventLoop.cpp: Added.
3603         (WebCore::WindowEventLoop::create): Added.
3604         (WebCore::WindowEventLoop::WindowEventLoop): Added.
3605         (WebCore::WindowEventLoop::queueTask): Added.
3606         (WebCore::WindowEventLoop::run): Added.
3607         * dom/WindowEventLoop.h: Added.
3608         * page/Page.cpp:
3609         (WebCore::Page::updateRendering): Added comments for the missing pieces.
3610
3611 2019-10-12  Chris Dumez  <cdumez@apple.com>
3612
3613         Back/Forward cache does not work after doing a favorite navigation
3614         https://bugs.webkit.org/show_bug.cgi?id=202762
3615         <rdar://problem/56126911>
3616
3617         Reviewed by Antti Koivisto.
3618
3619         When a subframe goes into the page cache, make sure we null out the opener
3620         link of any windows that were opened by this frame. This matches what would
3621         happened if this frame were closed.
3622
3623         Covered by the following API tests:
3624         ProcessSwap.PageCacheAfterProcessSwapByClient
3625         ProcessSwap.OpenerLinkAfterAPIControlledProcessSwappingOfOpener
3626
3627         * history/CachedFrame.cpp:
3628         (WebCore::CachedFrame::CachedFrame):
3629         * loader/FrameLoader.cpp:
3630         (WebCore::FrameLoader::~FrameLoader):
3631         (WebCore::FrameLoader::detachFromAllOpenedFrames):
3632         * loader/FrameLoader.h:
3633
3634 2019-10-12  Chris Fleizach  <cfleizach@apple.com>
3635
3636         AX: Make AXIsolatedTree compile again
3637         https://bugs.webkit.org/show_bug.cgi?id=202702
3638         <rdar://problem/56084968>
3639
3640         Reviewed by Joanmarie Diggs.
3641
3642         Fix compilation and runtime issues when building with ACCESSIBILITY_ISOLATED_TREE.
3643
3644         * accessibility/AccessibilityRenderObject.cpp:
3645         (WebCore::AccessibilityRenderObject::computeAccessibilityIsIgnored const):
3646         * accessibility/isolatedtree/AXIsolatedTree.cpp:
3647         (WebCore::AXIsolatedTree::treePageCache):
3648         (WebCore::AXIsolatedTree::nodeForID const):
3649             - Remove release assert here because the initial request that comes through happens on the main thread.
3650               We need to handle that case specific case.
3651         (WebCore::AXIsolatedTree::applyPendingChanges):
3652         (WebCore::AXIsolatedTree::initializePageTreeForID): Deleted.
3653         (WebCore::AXIsolatedTree::setInitialRequestInProgress): Deleted.
3654         * accessibility/isolatedtree/AXIsolatedTree.h:
3655         * accessibility/isolatedtree/AXIsolatedTreeNode.cpp:
3656         (WebCore::AXIsolatedTreeNode::rectAttributeValue const):
3657         * accessibility/mac/WebAccessibilityObjectWrapperBase.mm:
3658         (convertToNSArray):
3659         * accessibility/mac/WebAccessibilityObjectWrapperMac.mm:
3660         (-[WebAccessibilityObjectWrapper childrenVectorArray]):
3661
3662 2019-10-11  Ryosuke Niwa  <rniwa@webkit.org>
3663
3664         Windows build fix attempt after r251043.
3665
3666         * dom/ShadowRoot.cpp:
3667
3668 2019-10-11  Ryosuke Niwa  <rniwa@webkit.org>
3669
3670         Add the support for ShadowRoot.delegateFocus
3671         https://bugs.webkit.org/show_bug.cgi?id=166484
3672         <rdar://problem/29816058>
3673
3674         Reviewed by Antti Koivisto.
3675
3676         Implement delegatesFocus as specified in https://github.com/whatwg/html/pull/4796
3677
3678         When the shadow root of an element has delegates focus flag set, focusing on the shadow host would automatically
3679         "delegates" focus to the first focusable element in the shadow tree instead.
3680
3681         The first focusable element is determined as the first element that is programatically focusable or mouse focusable
3682         in the flat tree (composed tree in WebKit's terminology) in the case of the element getting focused via DOM API,
3683         Element.prototype.focus, by via mouse down. In the case of sequential focus navigation (via tab key), it's the
3684         first keyboard focusable element in the tabIndex order.
3685
3686         Tests: imported/w3c/web-platform-tests/shadow-dom/focus/click-focus-delegatesFocus-click-method.html
3687                imported/w3c/web-platform-tests/shadow-dom/focus/click-focus-delegatesFocus-tabindex-varies.html
3688                imported/w3c/web-platform-tests/shadow-dom/focus/click-focus-delegatesFocus-tabindex-zero.html
3689                imported/w3c/web-platform-tests/shadow-dom/focus/focus-method-delegatesFocus.html
3690                imported/w3c/web-platform-tests/shadow-dom/focus/focus-tabindex-order-shadow-negative-delegatesFocus.html
3691                imported/w3c/web-platform-tests/shadow-dom/focus/focus-tabindex-order-shadow-varying-delegatesFocus.html
3692                imported/w3c/web-platform-tests/shadow-dom/focus/focus-tabindex-order-shadow-zero-delegatesFocus.html
3693
3694         * dom/Element.cpp:
3695         (WebCore::Element::isKeyboardFocusable const): A shadow host with the delegates focus flag is not considered as
3696         keyboard focusable. The rest is taken care of by the existing logic in FocusController.
3697         (WebCore::isProgramaticallyFocusable): Extracted from Element::focus.
3698         (WebCore::findFirstProgramaticallyFocusableElementInComposedTree): Added.
3699         (WebCore::Element::focus): Added the support for delegatesFocus.
3700         * dom/Element.h:
3701         (WebCore::ShadowRootInit::delegatesFocus): Added.
3702         * dom/Element.idl: Ditto.
3703         * dom/ShadowRoot.cpp:
3704         (WebCore::ShadowRoot::ShadowRoot): Added delegatesFocus to the constructor.
3705         * dom/ShadowRoot.h:
3706         * page/EventHandler.cpp:
3707         (WebCore::findFirstMouseFocusableElementInComposedTree): Added.
3708         (WebCore::EventHandler::dispatchMouseEvent): Added the support for delegatesFocus. Uses the first mouse focusable
3709         element in the flat tree (composed tree) order.
3710         * page/FocusController.cpp:
3711         (WebCore::FocusController::findFirstFocusableElementInShadowRoot):
3712         * page/FocusController.h:
3713
3714 2019-10-11  Rob Buis  <rbuis@igalia.com>
3715
3716         Cleanup RuntimeEnabledFeatures includes
3717         https://bugs.webkit.org/show_bug.cgi?id=202857
3718
3719         Reviewed by Eric Carlson.
3720
3721         These classes must have had made use of runtime flags before
3722         but are not using them anymore.
3723
3724         * Modules/mediastream/MediaDevices.cpp:
3725         * Modules/mediastream/RTCRtpSender.cpp:
3726         * Modules/mediastream/libwebrtc/LibWebRTCPeerConnectionBackend.cpp:
3727         * Modules/mediastream/libwebrtc/LibWebRTCRtpSenderBackend.cpp:
3728         * accessibility/AccessibilityObject.cpp:
3729         * css/CSSComputedStyleDeclaration.cpp:
3730         * css/MediaQueryEvaluator.cpp:
3731         * css/MediaQueryExpression.cpp:
3732         * css/parser/CSSParser.cpp:
3733         * dom/ContainerNode.cpp:
3734         * dom/EventTarget.cpp:
3735         * dom/Position.cpp:
3736         * dom/PseudoElement.cpp:
3737         * dom/TreeScope.cpp:
3738         * dom/ViewportArguments.cpp:
3739         * history/CachedFrame.cpp:
3740         * html/HTMLPlugInElement.cpp:
3741         * html/HTMLStyleElement.cpp:
3742         * html/HTMLTrackElement.cpp:
3743         * inspector/agents/InspectorNetworkAgent.cpp:
3744         * loader/ResourceLoadNotifier.cpp:
3745         * page/DOMWindow.cpp:
3746         * page/EventHandler.cpp:
3747         * page/PointerLockController.cpp:
3748         * page/csp/ContentSecurityPolicy.cpp:
3749         * page/scrolling/ScrollingCoordinator.cpp:
3750         * platform/mediastream/mac/RealtimeMediaSourceCenterMac.cpp:
3751         * rendering/RenderFlexibleBox.cpp:
3752         * rendering/style/RenderStyle.cpp:
3753         * rendering/updating/RenderTreeUpdater.cpp:
3754
3755 2019-10-11  Chris Dumez  <cdumez@apple.com>
3756
3757         Add [ActiveDOMObject] to IDLs of ActiveDOMObjects
3758         https://bugs.webkit.org/show_bug.cgi?id=202869
3759
3760         Reviewed by Ryosuke Niwa.
3761
3762         Add [ActiveDOMObject] to IDLs of ActiveDOMObjects, this is necessary so that the wrapper
3763         stays alive as long as ActiveDOMObject::hasPendingActivity() returns true. We may have
3764         subtle lifetime bugs otherwise.
3765
3766         * Modules/encryptedmedia/MediaKeySession.h:
3767         * Modules/encryptedmedia/MediaKeySession.idl:
3768         * Modules/entriesapi/FileSystemDirectoryReader.idl:
3769         * Modules/entriesapi/FileSystemEntry.idl:
3770         * Modules/geolocation/Geolocation.idl:
3771         * Modules/indexeddb/IDBObjectStore.h:
3772         * Modules/indexeddb/IDBObjectStore.idl:
3773         * Modules/paymentrequest/PaymentResponse.idl:
3774         * Modules/webvr/VRDisplay.h:
3775         * Modules/webvr/VRDisplay.idl:
3776         * workers/service/ServiceWorkerContainer.idl:
3777
3778 2019-10-11  Devin Rousso  <drousso@apple.com>
3779
3780         Web Inspector: Elements: Computed: show shorthand properties in addition to longhand ones
3781         https://bugs.webkit.org/show_bug.cgi?id=200554
3782
3783         Reviewed by Matt Baker.
3784
3785         Test: inspector/css/getComputedStyleForNode.html
3786
3787         Include additional `CSS.CSSComputedStyleProperty` items for shorthand CSS properties when
3788         calling `CSS.getComputedStyleForNode`.
3789
3790         * inspector/InspectorStyleSheet.h:
3791         * inspector/InspectorStyleSheet.cpp:
3792         (WebCore::InspectorStyle::buildArrayForComputedStyle const):
3793         (WebCore::InspectorStyle::collectProperties const): Added.
3794         (WebCore::InspectorStyle::styleWithProperties const):
3795         (WebCore::InspectorStyle::populateAllProperties const): Deleted.
3796
3797 2019-10-08  Ryosuke Niwa  <rniwa@webkit.org>
3798
3799         Make WebInspector's remote debug EventLoop code into RunLoop
3800         https://bugs.webkit.org/show_bug.cgi?id=202716
3801
3802         Reviewed by Joseph Pecoraro.
3803
3804         Use RunLoop::cycle.
3805
3806         * PlatformFTW.cmake:
3807         * PlatformPlayStation.cmake:
3808         * PlatformWin.cmake:
3809         * SourcesCocoa.txt:
3810         * WebCore.xcodeproj/project.pbxproj:
3811         * inspector/PageScriptDebugServer.cpp:
3812         (WebCore::PageScriptDebugServer::runEventLoopWhilePausedInternal):
3813         * platform/SourcesGLib.txt:
3814         * platform/glib/EventLoopGlib.cpp: Removed.
3815         * platform/playstation/EventLoopPlayStation.cpp: Removed.
3816         * platform/win/EventLoopWin.cpp: Removed.
3817
3818 2019-10-11  Dean Jackson  <dino@apple.com>
3819
3820         REGRESSION (r244239) Layout Test fast/canvas/canvas-too-large-to-draw.html is failing
3821         https://bugs.webkit.org/show_bug.cgi?id=202870
3822
3823         Reviewed by Simon Fraser.
3824
3825         Add an internal method to specify a fake limit of canvas pixel memory
3826         so our tests produce reproducible results.
3827
3828         * html/HTMLCanvasElement.cpp:
3829         (WebCore::maxActivePixelMemory):
3830         (WebCore::HTMLCanvasElement::setMaxPixelMemoryForTesting):
3831         * html/HTMLCanvasElement.h:
3832         * testing/Internals.cpp:
3833         (WebCore::Internals::setMaxCanvasPixelMemory):
3834         * testing/Internals.h:
3835         * testing/Internals.idl:
3836
3837 2019-10-11  Chris Dumez  <cdumez@apple.com>
3838
3839         API Test TestWebKitAPI.WebKit.DefaultQuota is very flaky on High Sierra
3840         https://bugs.webkit.org/show_bug.cgi?id=202850
3841
3842         Reviewed by Alex Christensen.
3843
3844         Make sure the DOMCache / DOMCacheStorage objects stay alive while they have pending
3845         promises to be resolved.
3846
3847         * Modules/cache/DOMCache.cpp:
3848         (WebCore::DOMCache::hasPendingActivity const):
3849         * Modules/cache/DOMCache.h:
3850         * Modules/cache/DOMCache.idl:
3851         * Modules/cache/DOMCacheStorage.cpp:
3852         (WebCore::DOMCacheStorage::hasPendingActivity const):
3853         * Modules/cache/DOMCacheStorage.h:
3854         * Modules/cache/DOMCacheStorage.idl:
3855
3856 2019-10-11  Chris Dumez  <cdumez@apple.com>
3857
3858         Unreviewed, address post-landing feedback from Darin for r251019.
3859
3860         Added a new comment for clarity.
3861
3862         * loader/FrameLoader.cpp:
3863         (WebCore::FrameLoader::stopForPageCache):
3864
3865 2019-10-11  Alex Christensen  <achristensen@webkit.org>
3866
3867         Only use CFNetwork SPI for metrics where needed
3868         https://bugs.webkit.org/show_bug.cgi?id=202825
3869
3870         Reviewed by Joseph Pecoraro.
3871
3872         * platform/network/NetworkLoadMetrics.h:
3873
3874 2019-10-11  Chris Dumez  <cdumez@apple.com>
3875
3876         Pages frequently fail to enter the back/forward cache due to frames with a quick redirect coming
3877         https://bugs.webkit.org/show_bug.cgi?id=202768
3878         <rdar://problem/56132022>
3879
3880         Reviewed by Alex Christensen.
3881
3882         When a quick redirect is scheduled with the navigation scheduler, we set the m_quickRedirectComing flag.
3883         This flag is supposed to get unset if the navigation gets cancelled and when the navigation actually
3884         happens. However, for a navigation to a javascript: URL, we would return early after executing the JS
3885         and fail to reset the m_quickRedirectComing flag. Later on, we would fail to enter the page cache because
3886         we would think that the iframe still has a quick redirect scheduled.
3887
3888         Test: fast/history/page-cache-iframe-js-url.html
3889
3890         * loader/FrameLoader.cpp:
3891         (WebCore::FrameLoader::urlSelected):
3892         Reset the m_quickRedirectComing flag if we return early after executing
3893         the javascript URL.
3894
3895         (WebCore::FrameLoader::stopForPageCache):
3896         Stop policy checks & cancel scheduled navigations after stopping loads. Stopping loads may
3897         run script which may in theory schedule new navigations. This is hardening.
3898
3899 2019-10-11  Antti Koivisto  <antti@apple.com>
3900
3901         Position::upstream/downstream should not need to call ensureLineBoxes
3902         https://bugs.webkit.org/show_bug.cgi?id=202203
3903
3904         Reviewed by Zalan Bujtas.
3905
3906         This avoids forced switch to complex text layout path by Position constructor and will allow future cleanups.
3907
3908         Currently simple line path strips end of line whitespace when white-space:pre-wrap is set.
3909         These are don't affect rendering but they are needed for editing positions.
3910         This patch makes simple line path match the complex path by generating runs for these whitespaces.
3911
3912         * dom/Position.cpp:
3913         (WebCore::Position::upstream const):
3914         (WebCore::Position::downstream const):
3915         (WebCore::ensureLineBoxesIfNeeded): Deleted.
3916         * rendering/SimpleLineLayout.cpp:
3917         (WebCore::SimpleLineLayout::LineState::appendFragmentAndCreateRunIfNeeded):
3918
3919         Create a new run if isLineBreak bit is set.
3920
3921         (WebCore::SimpleLineLayout::LineState::removeTrailingWhitespace):
3922         (WebCore::SimpleLineLayout::LineState::trailingWhitespaceWidth const):
3923         (WebCore::SimpleLineLayout::computeLineLeft):
3924
3925         Also compute width of the hanging whitespace when aligning the line. This matches the code
3926         in updateLogicalWidthForLeft/Right/CenterAlignedBlock in the complex path.
3927
3928         (WebCore::SimpleLineLayout::preWrap):
3929
3930         breakSpaces implies preWrap is off.
3931
3932         (WebCore::SimpleLineLayout::firstFragment):
3933         (WebCore::SimpleLineLayout::createLineRuns):
3934
3935         Crete runs also for soft linebreaks in pre-wrap.
3936         Add whitespace runs to the end of the line in pre-wrap.
3937
3938         (WebCore::SimpleLineLayout::closeLineEndingAndAdjustRuns):
3939
3940         Hang the whitespace run when wrapping.
3941
3942         (WebCore::SimpleLineLayout::removeTrailingWhitespace): Deleted.
3943
3944         Remainging logic moved to the callsite.
3945
3946 2019-10-11  Jonathan Bedard  <jbedard@apple.com>
3947
3948         Unreviewed, rolling out r250945.
3949
3950         Broke 18 Debug API tests
3951
3952         Reverted changeset:
3953
3954         "Add support for CompactPointerTuple<..., OptionSet<...>>"
3955         https://bugs.webkit.org/show_bug.cgi?id=201316
3956         https://trac.webkit.org/changeset/250945
3957
3958 2019-10-11  Bjorn Melinder  <bjornm@spotify.com>
3959
3960         OfflineAudioContext does not validate allocation of destination buffer
3961         https://bugs.webkit.org/show_bug.cgi?id=177259
3962
3963         Reviewed by Eric Carlson.
3964
3965         Moved the allocation of the destination buffer to the static
3966         OfflineAudioContext::create method where we are able to handle a failed
3967         allocation properly and return an Exception. This change handles both
3968         negative lengths as well as too large lengths where the memory cannot
3969         be allocated.
3970
3971         * Modules/webaudio/AudioContext.cpp:
3972         (WebCore::AudioContext::AudioContext):
3973         * Modules/webaudio/AudioContext.h:
3974         * Modules/webaudio/OfflineAudioContext.cpp:
3975         (WebCore::OfflineAudioContext::OfflineAudioContext):
3976         (WebCore::OfflineAudioContext::create):
3977         * Modules/webaudio/OfflineAudioContext.h:
3978
3979 2019-10-10  Konstantin Tokarev  <annulen@yandex.ru>
3980
3981         Guard GCrypt-specific code with USE(GCRYPT) instead of PLATFORM macros
3982         https://bugs.webkit.org/show_bug.cgi?id=202829
3983
3984         Reviewed by Jiewen Tan.
3985
3986         * crypto/keys/CryptoKeyEC.h:
3987         * crypto/keys/CryptoKeyRSA.h:
3988
3989 2019-10-10  Yury Semikhatsky  <yurys@chromium.org>
3990
3991         Web Inspector: use more C++ keywords for defining agents
3992         https://bugs.webkit.org/show_bug.cgi?id=200959
3993         <rdar://problem/54735374>
3994
3995         Reviewed by Joseph Pecoraro.
3996
3997         Add override annotation to overrided virtual methods in inspector code. This
3998         change is automatically generated by the following command:
3999         clang-tidy -checks='-*,modernize-use-override' -header-filter='.*inspector.*' -fix -p WebKitBuild/Release/
4000         &