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