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