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