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