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