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