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