Update device orientation & motion permission native SPI as per latest proposal
[WebKit-https.git] / Source / WebCore / ChangeLog
1 2019-03-11  Chris Dumez  <cdumez@apple.com>
2
3         Update device orientation & motion permission native SPI as per latest proposal
4         https://bugs.webkit.org/show_bug.cgi?id=195567
5
6         Reviewed by Youenn Fablet.
7
8         * dom/DeviceOrientationAndMotionAccessController.cpp:
9         (WebCore::DeviceOrientationAndMotionAccessController::shouldAllowAccess):
10         * page/ChromeClient.h:
11
12 2019-03-11  Wenson Hsieh  <wenson_hsieh@apple.com>
13
14         [macOS] Dispatching reentrant "contextmenu" events may cause crashes
15         https://bugs.webkit.org/show_bug.cgi?id=195571
16         <rdar://problem/48086046>
17
18         Reviewed by Andy Estes.
19
20         Make ContextMenuController::handleContextMenuEvent robust against reentrancy by guarding it with a boolean flag.
21         As demonstrated in the test case, it is currently possible to force WebKit into a bad state by dispatching a
22         synthetic "contextmenu" event from within the scope of one of the "before(copy|cut|paste)" events triggered as
23         a result of handling a context menu event.
24
25         Test: fast/events/contextmenu-reentrancy-crash.html
26
27         * page/ContextMenuController.cpp:
28         (WebCore::ContextMenuController::handleContextMenuEvent):
29         * page/ContextMenuController.h:
30
31 2019-03-11  Andy Estes  <aestes@apple.com>
32
33         [Apple Pay] Use PKPaymentAuthorizationController to present the Apple Pay UI remotely from the Networking service on iOS
34         https://bugs.webkit.org/show_bug.cgi?id=195530
35         <rdar://problem/48747164>
36
37         Reviewed by Alex Christensen.
38
39         * Modules/applepay/PaymentCoordinatorClient.h: Defined isWebPaymentCoordinator.
40         * page/Settings.yaml: Defined the applePayRemoteUIEnabled setting and reordered the other
41         Apple Pay settings.
42
43 2019-03-11  Alex Christensen  <achristensen@webkit.org>
44
45         Soft linking to Reveal framework should be optional
46         https://bugs.webkit.org/show_bug.cgi?id=195576
47         <rdar://problem/46822452>
48
49         Reviewed by Megan Gardner.
50
51         Systems exist with ENABLE(REVEAL) true and the Reveal framework does not exist.
52
53         * editing/cocoa/DictionaryLookup.mm:
54         (WebCore::showPopupOrCreateAnimationController):
55
56 2019-03-11  Yusuke Suzuki  <ysuzuki@apple.com>
57
58         [JSC] Reduce # of structures in JSGlobalObject initialization
59         https://bugs.webkit.org/show_bug.cgi?id=195498
60
61         Reviewed by Darin Adler.
62
63         * bindings/js/SerializedScriptValue.cpp:
64         (WebCore::CloneSerializer::serialize):
65
66 2019-03-11  Brent Fulgham  <bfulgham@apple.com>
67
68         Remove obsolete runtime flag for StorageAccess API Prompt
69         https://bugs.webkit.org/show_bug.cgi?id=195564
70         <rdar://problem/37279014>
71
72         Reviewed by Chris Dumez.
73
74         This bug tracks the work of removing the obsolete flag that had been used to optionally
75         prevent display of the StorageAccess API prompt. We have since shipped the final version
76         of this feature with an always-on prompt, and should have removed this runtime flag.
77
78         No test changes because this has no change in behavior. Tests already assume the prompt
79         behavior, and did not test turning the flag off.
80
81         * page/RuntimeEnabledFeatures.h:
82         (WebCore::RuntimeEnabledFeatures::setStorageAccessPromptsEnabled): Deleted.
83         (WebCore::RuntimeEnabledFeatures::storageAccessPromptsEnabled const): Deleted.
84         * testing/InternalSettings.cpp:
85         (WebCore::InternalSettings::Backup::Backup):
86         (WebCore::InternalSettings::Backup::restoreTo):
87         (WebCore::InternalSettings::setStorageAccessPromptsEnabled): Deleted.
88         * testing/InternalSettings.h:
89         (): Deleted.
90         * testing/InternalSettings.idl:
91
92 2019-03-11  Eric Carlson  <eric.carlson@apple.com>
93
94         Add web audio release logging
95         https://bugs.webkit.org/show_bug.cgi?id=195554
96         <rdar://problem/48767211>
97
98         Reviewed by Jer Noble.
99
100         No new tests, no functional change.
101
102         * Modules/webaudio/AudioBasicInspectorNode.cpp:
103         (WebCore::AudioBasicInspectorNode::AudioBasicInspectorNode):
104         * Modules/webaudio/AudioBufferSourceNode.cpp:
105         (WebCore::AudioBufferSourceNode::setBuffer):
106         (WebCore::AudioBufferSourceNode::startPlaying):
107         * Modules/webaudio/AudioContext.cpp:
108         (WebCore::nextLogIdentifier):
109         (WebCore::AudioContext::AudioContext):
110         (WebCore::AudioContext::uninitialize):
111         (WebCore::AudioContext::stop):
112         (WebCore::AudioContext::createBufferSource):
113         (WebCore::AudioContext::createMediaElementSource):
114         (WebCore::AudioContext::createMediaStreamSource):
115         (WebCore::AudioContext::createScriptProcessor):
116         (WebCore::AudioContext::createBiquadFilter):
117         (WebCore::AudioContext::createWaveShaper):
118         (WebCore::AudioContext::createPanner):
119         (WebCore::AudioContext::createConvolver):
120         (WebCore::AudioContext::createDynamicsCompressor):
121         (WebCore::AudioContext::createAnalyser):
122         (WebCore::AudioContext::createGain):
123         (WebCore::AudioContext::createDelay):
124         (WebCore::AudioContext::createChannelSplitter):
125         (WebCore::AudioContext::createChannelMerger):
126         (WebCore::AudioContext::createOscillator):
127         (WebCore::AudioContext::createPeriodicWave):
128         (WebCore::AudioContext::willBeginPlayback):
129         (WebCore::AudioContext::startRendering):
130         (WebCore::AudioContext::fireCompletionEvent):
131         (WebCore::AudioContext::logChannel const):
132         * Modules/webaudio/AudioContext.h:
133         (WebCore::AudioContext::nextAudioNodeLogIdentifier):
134         (WebCore::AudioContext::nextAudioParameterLogIdentifier):
135         * Modules/webaudio/AudioDestinationNode.cpp:
136         (WebCore::AudioDestinationNode::AudioDestinationNode):
137         * Modules/webaudio/AudioNode.cpp:
138         (WebCore::convertEnumerationToString):
139         (WebCore::AudioNode::AudioNode):
140         (WebCore::AudioNode::~AudioNode):
141         (WebCore::AudioNode::setNodeType):
142         (WebCore::AudioNode::addInput):
143         (WebCore::AudioNode::addOutput):
144         (WebCore::AudioNode::connect):
145         (WebCore::AudioNode::disconnect):
146         (WebCore::AudioNode::setChannelCount):
147         (WebCore::AudioNode::setChannelCountMode):
148         (WebCore::AudioNode::setChannelInterpretation):
149         (WebCore::AudioNode::logChannel const):
150         * Modules/webaudio/AudioNode.h:
151         (WTF::LogArgument<WebCore::AudioNode::NodeType>::toString):
152         * Modules/webaudio/AudioParam.cpp:
153         (WebCore::AudioParam::AudioParam):
154         (WebCore::AudioParam::setValue):
155         (WebCore::AudioParam::connect):
156         (WebCore::AudioParam::disconnect):
157         (WebCore::AudioParam::logChannel const):
158         * Modules/webaudio/AudioParam.h:
159         * Modules/webaudio/AudioScheduledSourceNode.cpp:
160         (WebCore::AudioScheduledSourceNode::start):
161         (WebCore::AudioScheduledSourceNode::stop):
162         * Modules/webaudio/BiquadFilterNode.cpp:
163         (WebCore::BiquadFilterNode::BiquadFilterNode):
164         * Modules/webaudio/ChannelMergerNode.cpp:
165         (WebCore::ChannelMergerNode::ChannelMergerNode):
166         * Modules/webaudio/ChannelSplitterNode.cpp:
167         (WebCore::ChannelSplitterNode::ChannelSplitterNode):
168         * Modules/webaudio/ConvolverNode.cpp:
169         (WebCore::ConvolverNode::ConvolverNode):
170         * Modules/webaudio/DefaultAudioDestinationNode.cpp:
171         (WebCore::DefaultAudioDestinationNode::initialize):
172         (WebCore::DefaultAudioDestinationNode::uninitialize):
173         (WebCore::DefaultAudioDestinationNode::enableInput):
174         (WebCore::DefaultAudioDestinationNode::setChannelCount):
175         * Modules/webaudio/DelayNode.cpp:
176         (WebCore::DelayNode::DelayNode):
177         * Modules/webaudio/DynamicsCompressorNode.cpp:
178         (WebCore::DynamicsCompressorNode::DynamicsCompressorNode):
179         * Modules/webaudio/GainNode.cpp:
180         (WebCore::GainNode::GainNode):
181         * Modules/webaudio/MediaElementAudioSourceNode.cpp:
182         (WebCore::MediaElementAudioSourceNode::MediaElementAudioSourceNode):
183         * Modules/webaudio/MediaStreamAudioSourceNode.cpp:
184         (WebCore::MediaStreamAudioSourceNode::MediaStreamAudioSourceNode):
185         * Modules/webaudio/OfflineAudioDestinationNode.cpp:
186         (WebCore::OfflineAudioDestinationNode::startRendering):
187         * Modules/webaudio/OscillatorNode.cpp:
188         (WebCore::OscillatorNode::setType):
189         (WebCore::OscillatorNode::setPeriodicWave):
190         * Modules/webaudio/OscillatorNode.h:
191         (WTF::LogArgument<WebCore::OscillatorNode::Type>::toString):
192         * Modules/webaudio/PannerNode.cpp:
193         (WebCore::PannerNode::PannerNode):
194         * Modules/webaudio/ScriptProcessorNode.cpp:
195         (WebCore::ScriptProcessorNode::ScriptProcessorNode):
196         * Modules/webaudio/WaveShaperNode.cpp:
197         (WebCore::WaveShaperNode::WaveShaperNode):
198         (WebCore::WaveShaperNode::setCurve):
199         (WebCore::WaveShaperNode::setOversample):
200         * Modules/webaudio/WaveShaperNode.h:
201         (WTF::LogArgument<WebCore::WaveShaperNode::OverSampleType>::toString):
202
203 2019-03-11  Youenn Fablet  <youenn@apple.com>
204
205         Make IDBDatabaseIdentifier take a ClientOrigin as member
206         https://bugs.webkit.org/show_bug.cgi?id=195544
207
208         Reviewed by Geoffrey Garen.
209
210         Instead of taking a top and a frame origin, make
211         make IDBDatabaseIdentifier take a ClientOrigin.
212
213         This allows reusing some ClientOrigin code
214         and will ease implementation of storage quota checking in
215         NetworkProcess, as quota managers are keyed by client origins.
216
217         No change of behavior.
218
219         * Modules/indexeddb/IDBDatabaseIdentifier.cpp:
220         (WebCore::IDBDatabaseIdentifier::IDBDatabaseIdentifier):
221         (WebCore::IDBDatabaseIdentifier::isolatedCopy const):
222         (WebCore::IDBDatabaseIdentifier::databaseDirectoryRelativeToRoot const):
223         (WebCore::IDBDatabaseIdentifier::debugString const):
224         * Modules/indexeddb/IDBDatabaseIdentifier.h:
225         (WebCore::IDBDatabaseIdentifier::hash const):
226         (WebCore::IDBDatabaseIdentifier::operator== const):
227         (WebCore::IDBDatabaseIdentifier::origin const):
228         (WebCore::IDBDatabaseIdentifier::isRelatedToOrigin const):
229         (WebCore::IDBDatabaseIdentifier::encode const):
230         (WebCore::IDBDatabaseIdentifier::decode):
231         * page/ClientOrigin.h:
232         (WebCore::ClientOrigin::isRelated const):
233
234 2019-03-11  Zan Dobersek  <zdobersek@igalia.com>
235
236         Unreviewed. Manually rolling out r242701 and r242703 since the changes
237         are causing test timeouts and crashes on GTK and WPE.
238
239         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:
240         (WebCore::MediaPlayerPrivateGStreamer::createGSTPlayBin):
241         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp:
242         (WebCore::MediaPlayerPrivateGStreamerBase::~MediaPlayerPrivateGStreamerBase):
243         (WebCore::MediaPlayerPrivateGStreamerBase::flushCurrentBuffer):
244         (WebCore::MediaPlayerPrivateGStreamerBase::createGLAppSink):
245         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.h:
246         * platform/graphics/texmap/TextureMapperPlatformLayerProxy.cpp:
247         (WebCore::TextureMapperPlatformLayerProxy::pushNextBuffer):
248         (WebCore::TextureMapperPlatformLayerProxy::dropCurrentBufferWhilePreservingTexture):
249         * platform/graphics/texmap/TextureMapperPlatformLayerProxy.h:
250         (): Deleted.
251
252 2019-03-11  Jer Noble  <jer.noble@apple.com>
253
254         Use AVContentKeySession for "com.apple.fps.2_0" CDM version when AVStreamSession is absent
255         https://bugs.webkit.org/show_bug.cgi?id=195462
256         <rdar://problem/48712306>
257
258         Reviewed by Eric Carlson.
259
260         The difference between "com.apple.fps.2_0" and "3_0" is a protocol difference more than an
261         implementation difference. In "2_0", the "EME nitialization" data comes in the form of a "content
262         identifier", while the true initialization data is retrieved through a side channel directly from
263         the attached element. In "3_0", the "EME initialization data" is the exact initialization data
264         given by the parser, with no "content identifier" at all.
265
266         In the original implementation, the "2_0" used AVStreamSession, and "3_0" used AVContentKeySession,
267         but in the absense of AVStreamSession, those protocol differences are minor and can be implemented
268         using AVContentKeySession.
269
270         Changes:
271
272         - Add a new helper struct in CDMPrivateMediaSourceAVFObjC that represents the parsed parameters
273           of the CDM string.
274         - Add an "initData()" accessor to SourceBufferPrivateAVFObjC so that the "2_0" path can implement
275           the side channel access to the necessary initialization data.
276         - Refactor some of the SPI code to not re-declare unnecessary APIs.
277         - In CDMSessionAVContentKeySession::generateKeyRequest(), this function can never be called twice
278           so it is a logical impossibility to have a certificate at this point. Remove all this if() code.
279
280         * Modules/encryptedmedia/legacy/LegacyCDM.cpp:
281         * platform/graphics/avfoundation/CDMPrivateMediaSourceAVFObjC.h:
282         * platform/graphics/avfoundation/CDMPrivateMediaSourceAVFObjC.mm:
283         (WebCore::CDMPrivateMediaSourceAVFObjC::parseKeySystem):
284         (WebCore::queryDecoderAvailability):
285         (WebCore::CDMPrivateMediaSourceAVFObjC::supportsKeySystem):
286         (WebCore::CDMPrivateMediaSourceAVFObjC::createSession):
287         (WebCore::validKeySystemRE): Deleted.
288         * platform/graphics/avfoundation/objc/CDMSessionAVContentKeySession.h:
289         * platform/graphics/avfoundation/objc/CDMSessionAVContentKeySession.mm:
290         (WebCore::CDMSessionAVContentKeySession::CDMSessionAVContentKeySession):
291         (WebCore::CDMSessionAVContentKeySession::generateKeyRequest):
292         (WebCore::CDMSessionAVContentKeySession::update):
293         (WebCore::CDMSessionAVContentKeySession::addParser):
294         (WebCore::CDMSessionAVContentKeySession::removeParser):
295         (WebCore::CDMSessionAVContentKeySession::contentKeySession):
296         * platform/graphics/avfoundation/objc/CDMSessionAVStreamSession.h:
297         * platform/graphics/avfoundation/objc/CDMSessionAVStreamSession.mm:
298         (WebCore::CDMSessionAVStreamSession::CDMSessionAVStreamSession):
299         * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.h:
300         * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.mm:
301         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::setCDMSession):
302         * platform/graphics/avfoundation/objc/SourceBufferPrivateAVFObjC.h:
303         * platform/graphics/avfoundation/objc/SourceBufferPrivateAVFObjC.mm:
304         (WebCore::SourceBufferPrivateAVFObjC::didProvideContentKeyRequestInitializationDataForTrackID):
305
306 2019-03-11  Ryan Haddad  <ryanhaddad@apple.com>
307
308         Unreviewed, rolling out r242688, r242643, r242624.
309
310         Caused multiple layout test failures and crashes on iOS and macOS.
311
312         Reverted changeset:
313
314         "requestAnimationFrame should execute before the next frame"
315         https://bugs.webkit.org/show_bug.cgi?id=177484
316         https://trac.webkit.org/changeset/242624/webkit
317
318         * Sources.txt:
319         * WebCore.xcodeproj/project.pbxproj:
320         * accessibility/mac/AXObjectCacheMac.mm:
321         (WebCore::AXObjectCache::platformHandleFocusedUIElementChanged):
322         * animation/DocumentAnimationScheduler.cpp: Added.
323         (WebCore::DocumentAnimationScheduler::create):
324         (WebCore::DocumentAnimationScheduler::DocumentAnimationScheduler):
325         (WebCore::DocumentAnimationScheduler::detachFromDocument):
326         (WebCore::DocumentAnimationScheduler::scheduleWebAnimationsResolution):
327         (WebCore::DocumentAnimationScheduler::unscheduleWebAnimationsResolution):
328         (WebCore::DocumentAnimationScheduler::scheduleScriptedAnimationResolution):
329         (WebCore::DocumentAnimationScheduler::displayRefreshFired):
330         (WebCore::DocumentAnimationScheduler::windowScreenDidChange):
331         (WebCore::DocumentAnimationScheduler::createDisplayRefreshMonitor const):
332         * animation/DocumentAnimationScheduler.h: Renamed from Source/WebCore/page/RenderingUpdateScheduler.h.
333         (WebCore::DocumentAnimationScheduler::lastTimestamp):
334         (WebCore::DocumentAnimationScheduler::isFiring const):
335         * animation/DocumentTimeline.cpp:
336         (WebCore::DocumentTimeline::DocumentTimeline):
337         (WebCore::DocumentTimeline::updateThrottlingState):
338         (WebCore::DocumentTimeline::suspendAnimations):
339         (WebCore::DocumentTimeline::resumeAnimations):
340         (WebCore::DocumentTimeline::liveCurrentTime const):
341         (WebCore::DocumentTimeline::currentTime):
342         (WebCore::DocumentTimeline::cacheCurrentTime):
343         (WebCore::DocumentTimeline::scheduleAnimationResolutionIfNeeded):
344         (WebCore::DocumentTimeline::animationTimingDidChange):
345         (WebCore::DocumentTimeline::scheduleAnimationResolution):
346         (WebCore::DocumentTimeline::unscheduleAnimationResolution):
347         (WebCore::DocumentTimeline::animationResolutionTimerFired):
348         (WebCore::DocumentTimeline::updateAnimationsAndSendEvents):
349         (WebCore::DocumentTimeline::scheduleNextTick):
350         (WebCore::DocumentTimeline::updateListOfElementsWithRunningAcceleratedAnimationsForElement):
351         (WebCore::DocumentTimeline::resolveAnimationsForElement):
352         (WebCore::DocumentTimeline::internalUpdateAnimationsAndSendEvents): Deleted.
353         * animation/DocumentTimeline.h:
354         * dom/Document.cpp:
355         (WebCore::Document::resolveStyle):
356         (WebCore::Document::prepareForDestruction):
357         (WebCore::Document::windowScreenDidChange):
358         (WebCore::Document::updateIntersectionObservations):
359         (WebCore::Document::scheduleForcedIntersectionObservationUpdate):
360         (WebCore::Document::animationScheduler):
361         (WebCore::Document::updateAnimationsAndSendEvents): Deleted.
362         (WebCore::Document::serviceRequestAnimationFrameCallbacks): Deleted.
363         * dom/Document.h:
364         * dom/ScriptedAnimationController.cpp:
365         (WebCore::ScriptedAnimationController::serviceScriptedAnimations):
366         (WebCore::ScriptedAnimationController::scheduleAnimation):
367         (WebCore::ScriptedAnimationController::animationTimerFired):
368         (WebCore::ScriptedAnimationController::documentAnimationSchedulerDidFire):
369         (WebCore::ScriptedAnimationController::serviceRequestAnimationFrameCallbacks): Deleted.
370         * dom/ScriptedAnimationController.h:
371         * page/FrameView.cpp:
372         (WebCore::FrameView::viewportContentsChanged):
373         * page/IntersectionObserver.cpp:
374         (WebCore::IntersectionObserver::observe):
375         * page/Page.cpp:
376         (WebCore::Page::Page):
377         (WebCore::Page::willDisplayPage):
378         (WebCore::Page::addDocumentNeedingIntersectionObservationUpdate):
379         (WebCore::Page::updateIntersectionObservations):
380         (WebCore::Page::scheduleForcedIntersectionObservationUpdate):
381         (WebCore::Page::layoutIfNeeded): Deleted.
382         (WebCore::Page::renderingUpdate): Deleted.
383         (WebCore::Page::renderingUpdateScheduler): Deleted.
384         * page/Page.h:
385         * page/PageOverlayController.cpp:
386         (WebCore::PageOverlayController::didChangeViewExposedRect):
387         (WebCore::PageOverlayController::notifyFlushRequired):
388         * page/RenderingUpdateScheduler.cpp: Removed.
389         * page/ios/ContentChangeObserver.h:
390         * page/mac/ServicesOverlayController.mm:
391         (WebCore::ServicesOverlayController::Highlight::notifyFlushRequired):
392         * rendering/RenderLayerCompositor.cpp:
393         (WebCore::RenderLayerCompositor::scheduleLayerFlushNow):
394
395 2019-03-11  Darin Adler  <darin@apple.com>
396
397         Specify fixed precision explicitly to prepare to change String::number and StringBuilder::appendNumber floating point behavior
398         https://bugs.webkit.org/show_bug.cgi?id=195533
399
400         Reviewed by Brent Fulgham.
401
402         * accessibility/AccessibilityNodeObject.cpp:
403         (WebCore::AccessibilityNodeObject::changeValueByStep): Use numberToStringFixedPrecision.
404         (WebCore::AccessibilityNodeObject::changeValueByPercent): Ditto.
405         * accessibility/AccessibilityScrollbar.cpp:
406         (WebCore::AccessibilityScrollbar::setValue): Ditto.
407         * css/CSSFontVariationValue.cpp:
408         (WebCore::CSSFontVariationValue::customCSSText const): Use appendFixedPrecisionNumber.
409         * css/CSSGradientValue.cpp:
410         (WebCore::CSSLinearGradientValue::customCSSText const): Ditto.
411         (WebCore::CSSRadialGradientValue::customCSSText const): Ditto.
412         * css/CSSKeyframeRule.cpp:
413         (WebCore::StyleRuleKeyframe::keyText const): Ditto.
414         * css/CSSTimingFunctionValue.cpp:
415         (WebCore::CSSCubicBezierTimingFunctionValue::customCSSText const): Ditto.
416         (WebCore::CSSSpringTimingFunctionValue::customCSSText const): Ditto.
417         * css/parser/CSSParserToken.cpp:
418         (WebCore::CSSParserToken::serialize const): Ditto.
419         * html/HTMLImageElement.cpp:
420         (WebCore::HTMLImageElement::completeURLsInAttributeValue const): Ditto.
421         * inspector/InspectorOverlay.cpp:
422         (WebCore::InspectorOverlay::drawRulers): Use numberToStringFixedPrecision.
423         * loader/ResourceLoadStatistics.cpp:
424         (WebCore::ResourceLoadStatistics::toString const): Use appendFixedPrecisionNumber.
425         * page/PrintContext.cpp:
426         (WebCore::PrintContext::pageProperty): Use numberToStringFixedPrecision.
427         * page/cocoa/ResourceUsageOverlayCocoa.mm:
428         (WebCore::gcTimerString): Use numberToStringFixedPrecision.
429         * platform/LayoutUnit.h:
430         (WTF::ValueToString<WebCore::LayoutUnit>::string): Ditto.
431         * platform/graphics/Color.cpp:
432         (WebCore::Color::cssText const): Use appendFixedPrecisionNumber.
433         * platform/graphics/ExtendedColor.cpp:
434         (WebCore::ExtendedColor::cssText const): Ditto.
435         * svg/SVGAngleValue.cpp:
436         (WebCore::SVGAngleValue::valueAsString const): Use numberToStringFixedPrecision.
437         * svg/SVGNumberListValues.cpp:
438         (WebCore::SVGNumberListValues::valueAsString const): Use appendFixedPrecisionNumber.
439         * svg/SVGPathStringBuilder.cpp:
440         (WebCore::appendNumber): Ditto.
441         (WebCore::appendPoint): Ditto.
442         * svg/SVGPointListValues.cpp:
443         (WebCore::SVGPointListValues::valueAsString const): Ditto.
444         * svg/SVGTransformValue.cpp:
445         (WebCore::SVGTransformValue::valueAsString const): Ditto.
446         * svg/properties/SVGPropertyTraits.h:
447         (WebCore::SVGPropertyTraits<float>::toString): Use numberToStringFixedPrecision.
448         (WebCore::SVGPropertyTraits<FloatPoint>::toString): Use appendFixedPrecisionNumber.
449         (WebCore::SVGPropertyTraits<FloatRect>::toString): Ditto.
450         * testing/Internals.cpp:
451         (WebCore::Internals::dumpMarkerRects): Use appendFixedPrecisionNumber.
452         (WebCore::Internals::getCurrentCursorInfo): Ditto.
453         * xml/XPathValue.cpp:
454         (WebCore::XPath::Value::toString const): Use numberToStringFixedPrecision.
455
456 2019-03-11  Philippe Normand  <pnormand@igalia.com>
457
458         Unreviewed, Non-GStreamer-GL build fix after r242701.
459
460         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp:
461         (WebCore::MediaPlayerPrivateGStreamerBase::~MediaPlayerPrivateGStreamerBase):
462
463 2019-03-11  Philippe Normand  <pnormand@igalia.com>
464
465         [GStreamer][v4l2] Synchronous video texture flushing support
466         https://bugs.webkit.org/show_bug.cgi?id=195453
467
468         Reviewed by Xabier Rodriguez-Calvar.
469
470         The v4l2 video decoder currently requires that downstream users of
471         the graphics resources complete any pending draw call and release
472         resources before returning from the DRAIN query.
473
474         To accomplish this the player monitors the pipeline and whenever a
475         v4l2 decoder is added, synchronous video texture flushing support
476         is enabled. Additionally and for all decoder configurations, a
477         flush is performed before disposing of the player.
478
479         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:
480         (WebCore::MediaPlayerPrivateGStreamer::playbinDeepElementAddedCallback):
481         Monitor elements added to the decodebin bin.
482         (WebCore::MediaPlayerPrivateGStreamer::decodebinElementAdded): Set
483         a flag if a v4l2 decoder was added in decodebin.
484         (WebCore::MediaPlayerPrivateGStreamer::createGSTPlayBin): Connect
485         to the deep-element-added signal so as to monitor pipeline
486         topology updates.
487         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.h:
488         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp:
489         (WebCore::MediaPlayerPrivateGStreamerBase::~MediaPlayerPrivateGStreamerBase):
490         Flush video texture before disposing of the player.
491         (WebCore::MediaPlayerPrivateGStreamerBase::flushCurrentBuffer):
492         Synchronously flush if the pipeline contains a v4l2 decoder.
493         (WebCore::MediaPlayerPrivateGStreamerBase::createGLAppSink): Monitor push events only.
494         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.h:
495         * platform/graphics/texmap/TextureMapperPlatformLayerProxy.cpp:
496         (WebCore::TextureMapperPlatformLayerProxy::pushNextBuffer): New
497         boolean flag used mostly to trigger synchronous flush conditions.
498         (WebCore::TextureMapperPlatformLayerProxy::dropCurrentBufferWhilePreservingTexture):
499         Optionally drop the current buffer in a synchronous manner. By
500         default the method keeps operating asynchronously.
501         * platform/graphics/texmap/TextureMapperPlatformLayerProxy.h:
502
503 2019-03-11  Antti Koivisto  <antti@apple.com>
504
505         Rename contentOffsetInCompostingLayer to contentOffsetInCompositingLayer
506         https://bugs.webkit.org/show_bug.cgi?id=195553
507
508         Reviewed by Simon Fraser.
509
510         Less composting, more compositing.
511
512         * rendering/RenderLayerBacking.cpp:
513         (WebCore::RenderLayerBacking::updateBackdropFiltersGeometry):
514         (WebCore::RenderLayerBacking::resetContentsRect):
515         (WebCore::RenderLayerBacking::updateChildClippingStrategy):
516         (WebCore::RenderLayerBacking::updateImageContents):
517         (WebCore::RenderLayerBacking::contentOffsetInCompositingLayer const):
518         (WebCore::RenderLayerBacking::contentsBox const):
519         (WebCore::RenderLayerBacking::backgroundBoxForSimpleContainerPainting const):
520         (WebCore::RenderLayerBacking::contentOffsetInCompostingLayer const): Deleted.
521         * rendering/RenderLayerBacking.h:
522
523 2019-03-10  Ross Kirsling  <ross.kirsling@sony.com>
524
525         Invalid flags in a RegExp literal should be an early SyntaxError
526         https://bugs.webkit.org/show_bug.cgi?id=195514
527
528         Reviewed by Darin Adler.
529
530         * bindings/js/SerializedScriptValue.cpp:
531         (WebCore::CloneDeserializer::readTerminal):
532         Consume YarrFlags.
533
534 2019-03-10  Tim Horton  <timothy_horton@apple.com>
535
536         Add SPI to retrieve the set of text inputs in a given rect, and later focus one
537         https://bugs.webkit.org/show_bug.cgi?id=195499
538
539         Reviewed by Darin Adler.
540
541         New API tests: WebKit.RequestTextInputContext and WebKit.FocusTextInputContext
542
543         * WebCore.xcodeproj/project.pbxproj:
544         * dom/Document.cpp:
545         (WebCore::Document::identifierForElement):
546         (WebCore::Document::elementWithIdentifier):
547         (WebCore::Document::identifiedElementWasRemovedFromDocument):
548         * dom/Document.h:
549         Add a mechanism where Document will vend an ObjectIdentifier for a given
550         element, and can (if possible) retrieve that element later.
551
552         * dom/Element.cpp:
553         (WebCore::Element::removedFromAncestor):
554         If an Element has an identifier created for it, inform Document to remove
555         it from the identifier map when the element is detached.
556
557         (WebCore::Element::createElementIdentifier):
558         * dom/Element.h:
559         * dom/ElementIdentifier.h: Added.
560         * dom/ElementRareData.cpp:
561         * dom/ElementRareData.h:
562         (WebCore::ElementRareData::hasElementIdentifier const):
563         (WebCore::ElementRareData::setHasElementIdentifier):
564         (WebCore::ElementRareData::ElementRareData):
565         Store a bit indicating if the Element has had a identifier created for it,
566         so that we can avoid a hash lookup on every Element removal.
567
568         * dom/Node.h:
569         * html/HTMLTextFormControlElement.h:
570
571 2019-03-10  Zalan Bujtas  <zalan@apple.com>
572
573         [ContentChangeObserver] Fix failing test cases
574         https://bugs.webkit.org/show_bug.cgi?id=195524
575         <rdar://problem/48745101>
576
577         Reviewed by Simon Fraser.
578
579         1. Do not start DOM timer install observation when we already detected change at touchstart.
580         2. hasPendingActivity() should only care about ContentChangeObserver flags.
581         3. Do not try to notify the client when we are in the mouseMoved dispatch call (currently it could happen
582         when a timer gets intalled and removed right away).
583
584         * page/ios/ContentChangeObserver.cpp:
585         (WebCore::ContentChangeObserver::adjustObservedState):
586         (WebCore::ContentChangeObserver::isNotifyContentChangeAllowed const): Deleted.
587         * page/ios/ContentChangeObserver.h:
588         (WebCore::ContentChangeObserver::hasPendingActivity const):
589         (WebCore::ContentChangeObserver::isObservationTimeWindowActive const):
590
591 2019-03-10  Simon Fraser  <simon.fraser@apple.com>
592
593         ScrollingTree should have the final say on where layers go
594         https://bugs.webkit.org/show_bug.cgi?id=195507
595
596         Reviewed by Antti Koivisto.
597
598         Main thread layer flushing can race with scrolling tree layer changes on macOS, causing
599         flashing as layers jump around sometimes. We go to some lengths to avoid this by trying
600         not to touch properties on layers that are being interacted with (scrollableArea->setIsUserScroll in
601         updateScrollPositionAfterAsyncScroll()), but that's fragile.
602
603         This patch adds ScrollingTree::applyScrollingTreeLayerPositions(), which enters
604         ScrollingTree::applyLayerPositions() on the main thread/UI process. This traverses
605         the tree allowing each node to run their layer positioning logic.
606
607         For macOS WK2, this is called from TiledCoreAnimationDrawingArea::flushLayers() after flushCompositingStateIncludingSubframes().
608         For macOS WK2 with UI-side compositing, RemoteLayerTreeDrawingAreaProxy::commitLayerTree()
609         calls m_webPageProxy.scrollingCoordinatorProxy()->applyScrollingTreeLayerPositions().
610         iOS WK2 is unchanged, using viewportChangedViaDelegatedScrolling() which does the same thing, allowing
611         for the dynamic viewport changes that happen when zooming on iOS.
612
613         Testing this requires infrastructure that we don't have yet.
614
615         * page/scrolling/AsyncScrollingCoordinator.cpp:
616         (WebCore::AsyncScrollingCoordinator::applyScrollingTreeLayerPositions):
617         * page/scrolling/AsyncScrollingCoordinator.h:
618         * page/scrolling/ScrollingCoordinator.h:
619         (WebCore::ScrollingCoordinator::applyScrollingTreeLayerPositions):
620         * page/scrolling/ScrollingTree.cpp:
621         (WebCore::ScrollingTree::handleWheelEvent):
622         (WebCore::ScrollingTree::commitTreeState):
623         (WebCore::ScrollingTree::applyLayerPositions):
624         (WebCore::ScrollingTree::applyLayerPositionsRecursive):
625         * page/scrolling/ScrollingTree.h:
626         * page/scrolling/ScrollingTreeFrameHostingNode.cpp:
627         (WebCore::ScrollingTreeFrameHostingNode::applyLayerPositions):
628         * page/scrolling/ScrollingTreeFrameHostingNode.h:
629         * page/scrolling/ScrollingTreeNode.h:
630         * page/scrolling/ScrollingTreeScrollingNode.cpp:
631         (WebCore::ScrollingTreeScrollingNode::applyLayerPositions):
632         * page/scrolling/ScrollingTreeScrollingNode.h:
633         * page/scrolling/cocoa/ScrollingTreeFixedNode.h:
634         * page/scrolling/cocoa/ScrollingTreeFixedNode.mm:
635         (WebCore::ScrollingTreeFixedNode::relatedNodeScrollPositionDidChange):
636         * page/scrolling/cocoa/ScrollingTreeStickyNode.h:
637         * page/scrolling/cocoa/ScrollingTreeStickyNode.mm:
638         (WebCore::ScrollingTreeStickyNode::applyLayerPositions):
639         (WebCore::ScrollingTreeStickyNode::relatedNodeScrollPositionDidChange):
640         * page/scrolling/mac/ScrollingTreeFrameScrollingNodeMac.h:
641         * page/scrolling/mac/ScrollingTreeFrameScrollingNodeMac.mm:
642         (WebCore::ScrollingTreeFrameScrollingNodeMac::applyLayerPositions):
643
644 2019-03-09  Andy Estes  <aestes@apple.com>
645
646         [Apple Pay] CanMakePaymentsWithActiveCard and OpenPaymentSetup should be async messages
647         https://bugs.webkit.org/show_bug.cgi?id=195526
648         <rdar://problem/48745636>
649
650         Reviewed by Chris Dumez.
651
652         * Modules/applepay/PaymentCoordinatorClient.h:
653         * loader/EmptyClients.cpp:
654         * testing/MockPaymentCoordinator.cpp:
655         (WebCore::MockPaymentCoordinator::canMakePaymentsWithActiveCard):
656         (WebCore::MockPaymentCoordinator::openPaymentSetup):
657         * testing/MockPaymentCoordinator.h:
658
659 2019-03-09  Zalan Bujtas  <zalan@apple.com>
660
661         [ContentChangeObserver] Click event fires immediately on hover menu at seriouseats.com
662         https://bugs.webkit.org/show_bug.cgi?id=195520
663         <rdar://problem/48740098>
664
665         Reviewed by Simon Fraser.
666
667         Unfortunately seriouseats has a 300ms hover intent delay to deal with accidental menupane pop-ups. This page also hides this
668         non-fixed width menupane using absolute positioning and negative left.  
669
670         Test: fast/events/touch/ios/content-observation/move-content-from-offscreen.html
671
672         * page/ios/ContentChangeObserver.cpp:
673         (WebCore::ContentChangeObserver::didInstallDOMTimer):
674         (WebCore::ContentChangeObserver::StyleChangeScope::~StyleChangeScope):
675         (WebCore::ContentChangeObserver::StyleChangeScope::isConsideredHidden const): Content auhtors tend to use x - 1 values (where x = 10^y)
676
677 2019-03-09  Chris Dumez  <cdumez@apple.com>
678
679         Add assertions to help debug crash under DOMWindowExtension::suspendForPageCache()
680         https://bugs.webkit.org/show_bug.cgi?id=195488
681
682         Reviewed by Ryosuke Niwa.
683
684         Try and figure out how the document can be detached from its frame while we're suspending
685         DOMWindowExtensions.
686
687         * page/DOMWindow.cpp:
688         (WebCore::DOMWindow::willDetachDocumentFromFrame):
689         (WebCore::DOMWindow::suspendForPageCache):
690         * page/DOMWindow.h:
691
692 2019-03-09  Chris Dumez  <cdumez@apple.com>
693
694         Simplify DOMWindowProperty code / handling
695         https://bugs.webkit.org/show_bug.cgi?id=195495
696
697         Reviewed by Ryosuke Niwa.
698
699         DOMWindowProperty code was unnecessarily complex because DOMWindowExtension inherited
700         from it and DOMWindowExtension needs a lot of information about the global object's
701         lifetime to communicate to the injected bbundle client. This subclassing is also
702         very confusing because a DOMWindowExtension is not a *property* on the Window object.
703
704         This patch updates DOMWindowExtension to stop subclassing DOMWindowProperty and
705         moves all the complexity from DOMWindowProperty to DOMWindowExtension.
706         DOMWindowProperty is now a very simple base class which merely has a WeakPtr to
707         the window and getters for the window and the frame.
708
709         * Modules/indexeddb/DOMWindowIndexedDatabase.cpp:
710         (WebCore::DOMWindowIndexedDatabase::DOMWindowIndexedDatabase):
711         (WebCore::DOMWindowIndexedDatabase::indexedDB):
712         * Modules/indexeddb/DOMWindowIndexedDatabase.h:
713         There is no reason for DOMWindowIndexedDatabase to move its IDBFactory to a
714         separate data member which in PageCache. Script do not run while in PageCache.
715         Also, frames are nulled out while in the PageCache so the indexedDB() getter
716         would return null anyway while in PageCache.
717
718         * css/StyleMedia.idl:
719         * loader/appcache/ApplicationCacheHost.cpp:
720         (WebCore::ApplicationCacheHost::setDOMApplicationCache):
721         Store a WeakPtr to the DOMApplicationCache for safety.
722
723         (WebCore::ApplicationCacheHost::dispatchDOMEvent):
724         Do not fire events on the DOMApplicationCache if it is frameless to maintain
725         previous behavior. Previously, the DOMApplicationCache would have been nulled
726         out when detached from its frame so we would not have fired events.
727
728         * loader/appcache/ApplicationCacheHost.h:
729         * loader/appcache/DOMApplicationCache.cpp:
730         * loader/appcache/DOMApplicationCache.h:
731         Remove some unnecessary complexity. The ApplicationCacheHost is owned by the
732         DocumentLoader, which changes on navigation. There is therefore no reason to
733         null out the DOMApplicationCache on the ApplicationCacheHost when its gets
734         detached from its frame or enters PageCache.
735
736         * page/BarProp.idl:
737         * page/DOMSelection.idl:
738         * page/DOMWindow.cpp:
739         (WebCore::DOMWindow::willDestroyCachedFrame):
740         (WebCore::DOMWindow::willDestroyDocumentInFrame):
741         (WebCore::DOMWindow::willDetachDocumentFromFrame):
742         (WebCore::DOMWindow::registerExtension):
743         (WebCore::DOMWindow::unregisterExtension):
744
745         (WebCore::DOMWindow::resetDOMWindowProperties): Removed.
746         Stop clearing some of the DOMWindow's properties when the document gets destroyed or when
747         the Window for the initial empty document gets reused on navigation. I think we used to
748         need this because DOMWindowProperty used to hold pointers to their frame. However, this
749         is no longer the case nowadays as DOMWindowProperty objects get their frame from their
750         Window.
751
752         (WebCore::DOMWindow::resetUnlessSuspendedForDocumentSuspension):
753         (WebCore::DOMWindow::suspendForPageCache):
754         (WebCore::DOMWindow::resumeFromPageCache):
755         * page/DOMWindow.h:
756         * page/DOMWindowExtension.cpp:
757         (WebCore::DOMWindowExtension::DOMWindowExtension):
758         (WebCore::DOMWindowExtension::~DOMWindowExtension):
759         (WebCore::DOMWindowExtension::frame const):
760         (WebCore::DOMWindowExtension::suspendForPageCache):
761         (WebCore::DOMWindowExtension::resumeFromPageCache):
762         (WebCore::DOMWindowExtension::willDestroyGlobalObjectInCachedFrame):
763         (WebCore::DOMWindowExtension::willDestroyGlobalObjectInFrame):
764         (WebCore::DOMWindowExtension::willDetachGlobalObjectFromFrame):
765         * page/DOMWindowExtension.h:
766         * page/DOMWindowProperty.cpp:
767         (WebCore::DOMWindowProperty::DOMWindowProperty):
768         * page/DOMWindowProperty.h:
769         (WebCore::DOMWindowProperty::window const):
770         * page/History.idl:
771         * page/Location.idl:
772         * page/Navigator.cpp:
773         (WebCore::Navigator::plugins):
774         (WebCore::Navigator::mimeTypes):
775         * page/PerformanceNavigation.idl:
776         * page/PerformanceTiming.idl:
777         * page/Screen.idl:
778         * page/VisualViewport.cpp:
779         (WebCore::VisualViewport::scriptExecutionContext const):
780         * plugins/DOMMimeTypeArray.idl:
781         * plugins/DOMPluginArray.idl:
782
783 2019-03-09  Zalan Bujtas  <zalan@apple.com>
784
785         [ContentChangeObserver] Start observing for content change between touchEnd and mouseMoved start
786         https://bugs.webkit.org/show_bug.cgi?id=195510
787         <rdar://problem/48735695>
788
789         Reviewed by Simon Fraser.
790
791         This patch covers the observation of async changes triggered by touchStart/touchEnd (animations, timers, style recalcs).
792
793         Test: fast/events/touch/ios/content-observation/visibility-change-after-touch-end.html
794
795         * page/ios/ContentChangeObserver.cpp:
796         (WebCore::ContentChangeObserver::didCancelTouchEvent):
797         (WebCore::ContentChangeObserver::adjustObservedState):
798         * page/ios/ContentChangeObserver.h:
799         (WebCore::ContentChangeObserver::setIsInBetweenTouchEndAndMouseMoved):
800         (WebCore::ContentChangeObserver::isInBetweenTouchEndAndMouseMoved const):
801         (WebCore::ContentChangeObserver::isObservingContentChanges const):
802
803 2019-03-08  Simon Fraser  <simon.fraser@apple.com>
804
805         Make it clearer which data is protected by the two locks in ScrollingTree
806         https://bugs.webkit.org/show_bug.cgi?id=195501
807
808         Reviewed by Tim Horton.
809
810         Gather ScrollingTree member variables into two structs, and name the struct
811         members and the locks to make it clear which data is protected by each lock.
812         
813         We only need to protect data read by multiple threads; these are the scrolling
814         thread, the event handling thread (which runs ThreadedScrollingTree::tryToHandleWheelEvent()),
815         and the main thread, which pokes various bits of pin/rubber-banding state.
816         Ideally the main thread would always push data to the scrolling thread via a commit,
817         but that's not what happens now.
818
819         Suspiciously, ScrollingTree::shouldHandleWheelEventSynchronously() uses the root node,
820         so should probably hold a lock shared with the scrolling thread (webkit.org/b/195502).
821         
822         * page/scrolling/ScrollingTree.cpp:
823         (WebCore::ScrollingTree::shouldHandleWheelEventSynchronously):
824         (WebCore::ScrollingTree::commitTreeState):
825         (WebCore::ScrollingTree::setAsyncFrameOrOverflowScrollingEnabled):
826         (WebCore::ScrollingTree::setMainFrameScrollPosition):
827         (WebCore::ScrollingTree::eventTrackingTypeForPoint):
828         (WebCore::ScrollingTree::isRubberBandInProgress):
829         (WebCore::ScrollingTree::setMainFrameIsRubberBanding):
830         (WebCore::ScrollingTree::isScrollSnapInProgress):
831         (WebCore::ScrollingTree::setMainFrameIsScrollSnapping):
832         (WebCore::ScrollingTree::setMainFramePinState):
833         (WebCore::ScrollingTree::setCanRubberBandState):
834         (WebCore::ScrollingTree::setScrollPinningBehavior):
835         (WebCore::ScrollingTree::scrollPinningBehavior):
836         (WebCore::ScrollingTree::willWheelEventStartSwipeGesture):
837         (WebCore::ScrollingTree::latchedNode):
838         (WebCore::ScrollingTree::setLatchedNode):
839         (WebCore::ScrollingTree::clearLatchedNode):
840         (WebCore::ScrollingTree::scrollingTreeAsText):
841         (WebCore::ScrollingTree::touchActionDataAtPoint const):
842         (WebCore::ScrollingTree::mainFrameScrollPosition): Deleted.
843         (WebCore::ScrollingTree::mainFrameLayoutViewport): Deleted.
844         (WebCore::ScrollingTree::rubberBandsAtLeft): Deleted.
845         (WebCore::ScrollingTree::rubberBandsAtRight): Deleted.
846         (WebCore::ScrollingTree::rubberBandsAtBottom): Deleted.
847         (WebCore::ScrollingTree::rubberBandsAtTop): Deleted.
848         * page/scrolling/ScrollingTree.h:
849         (WebCore::ScrollingTree::hasLatchedNode const):
850         * page/scrolling/mac/ScrollingTreeScrollingNodeDelegateMac.mm:
851         (WebCore::ScrollingTreeScrollingNodeDelegateMac::stretchAmount):
852         * platform/graphics/FloatPoint.h:
853         (WebCore::FloatPoint::isZero const):
854
855 2019-03-08  Simon Fraser  <simon.fraser@apple.com>
856
857         Share some code that sets CALayer positions
858         https://bugs.webkit.org/show_bug.cgi?id=195485
859
860         Reviewed by Zalan Bujtas.
861
862         Share some code between ScrollingTreeStickyNode and ScrollingTreeFixedNode that sets the position
863         of a CALayer given the top-left location.
864
865         * page/scrolling/cocoa/ScrollingTreeFixedNode.mm:
866         (WebCore::ScrollingTreeFixedNode::relatedNodeScrollPositionDidChange):
867         (WebCore::ScrollingTreeFixedNodeInternal::operator*): Deleted.
868         * page/scrolling/cocoa/ScrollingTreeStickyNode.mm:
869         (WebCore::ScrollingTreeStickyNode::relatedNodeScrollPositionDidChange):
870         (WebCore::ScrollingTreeStickyNodeInternal::operator*): Deleted.
871         * platform/graphics/cocoa/WebCoreCALayerExtras.h:
872         * platform/graphics/cocoa/WebCoreCALayerExtras.mm:
873         (-[CALayer _web_setLayerTopLeftPosition:]):
874
875 2019-03-08  Chris Dumez  <cdumez@apple.com>
876
877         Add support for Device Orientation / Motion permission API
878         https://bugs.webkit.org/show_bug.cgi?id=195329
879         <rdar://problem/47645367>
880
881         Reviewed by Geoffrey Garen.
882
883         Add support for Device Orientation / Motion permission API:
884         - https://github.com/w3c/deviceorientation/issues/57
885
886         Pages can add event listeners for 'deviceorientation' / 'devicemotion' events but
887         such events will not be fired until the page's JavaScript calls
888         DeviceOrientationEvent.requestPermission() / DeviceMotionEvent.requestPermission()
889         and the user grants the request.
890
891         The feature is currently behind an experimental feature flag, off by default.
892
893         Tests: fast/device-orientation/device-motion-request-permission-denied.html
894                fast/device-orientation/device-motion-request-permission-granted.html
895                fast/device-orientation/device-motion-request-permission-user-gesture.html
896                fast/device-orientation/device-orientation-request-permission-denied.html
897                fast/device-orientation/device-orientation-request-permission-granted.html
898                fast/device-orientation/device-orientation-request-permission-user-gesture.html
899
900         * CMakeLists.txt:
901         * DerivedSources-input.xcfilelist:
902         * DerivedSources-output.xcfilelist:
903         * DerivedSources.make:
904         * Sources.txt:
905         * WebCore.xcodeproj/project.pbxproj:
906         * dom/DeviceMotionEvent.h:
907         * dom/DeviceMotionEvent.idl:
908         * dom/DeviceOrientationAndMotionAccessController.cpp: Added.
909         (WebCore::DeviceOrientationAndMotionAccessController::DeviceOrientationAndMotionAccessController):
910         (WebCore::DeviceOrientationAndMotionAccessController::shouldAllowAccess):
911         (WebCore::DeviceOrientationAndMotionAccessController::setAccessState):
912         * dom/DeviceOrientationAndMotionAccessController.h: Added.
913         (WebCore::DeviceOrientationAndMotionAccessController::accessState const):
914         * dom/DeviceOrientationEvent.h:
915         * dom/DeviceOrientationEvent.idl:
916         * dom/DeviceOrientationOrMotionEvent.cpp: Added.
917         (WebCore::DeviceOrientationOrMotionEvent::requestPermission):
918         * dom/DeviceOrientationOrMotionEvent.h: Added.
919         * dom/DeviceOrientationOrMotionEvent.idl: Added.
920         * dom/DeviceOrientationOrMotionPermissionState.h: Added.
921         * dom/DeviceOrientationOrMotionPermissionState.idl: Added.
922         * dom/Document.cpp:
923         (WebCore::Document::deviceOrientationAndMotionAccessController):
924         * dom/Document.h:
925         * dom/Event.cpp:
926         * dom/MessagePort.cpp:
927         * dom/Microtasks.cpp:
928         * page/ChromeClient.h:
929         * page/DOMWindow.cpp:
930         (WebCore::DOMWindow::addEventListener):
931         (WebCore::DOMWindow::deviceOrientationController const):
932         (WebCore::DOMWindow::deviceMotionController const):
933         (WebCore::DOMWindow::isAllowedToUseDeviceMotionOrientation const):
934         (WebCore::DOMWindow::isAllowedToAddDeviceMotionOrientationListener const):
935         (WebCore::DOMWindow::startListeningForDeviceOrientationIfNecessary):
936         (WebCore::DOMWindow::stopListeningForDeviceOrientationIfNecessary):
937         (WebCore::DOMWindow::startListeningForDeviceMotionIfNecessary):
938         (WebCore::DOMWindow::stopListeningForDeviceMotionIfNecessary):
939         (WebCore::DOMWindow::removeEventListener):
940         (WebCore::DOMWindow::removeAllEventListeners):
941         * page/DOMWindow.h:
942         * page/DeviceController.cpp:
943         (WebCore::DeviceController::hasDeviceEventListener const):
944         * page/DeviceController.h:
945         * page/Settings.yaml:
946
947 2019-03-08  Zalan Bujtas  <zalan@apple.com>
948
949         [ContentChangeObserver] Expand "isConsideredClickable" to descendants
950         https://bugs.webkit.org/show_bug.cgi?id=195478
951         <rdar://problem/48724935>
952
953         Reviewed by Simon Fraser.
954
955         In StyleChangeScope we try to figure out whether newly visible content should stick (menu panes etc) by checking if it is clickable.
956         This works fine as long as all the visible elements are gaining new renderers through this style update processs.
957         However when an element becomes visible by a change other than display: (not)none, it's not sufficient to just check the element itself,
958         since it might not respond to click at all, while its descendants do.
959         A concrete example is a max-height value change on usps.com, where the max-height is on a container (menu pane).
960         This container itself is not clickable while most of its children are (menu items).    
961
962         Test: fast/events/touch/ios/content-observation/clickable-content-is-inside-a-container.html
963
964         * page/ios/ContentChangeObserver.cpp:
965         (WebCore::ContentChangeObserver::StyleChangeScope::StyleChangeScope):
966         (WebCore::ContentChangeObserver::StyleChangeScope::~StyleChangeScope):
967         (WebCore::ContentChangeObserver::StyleChangeScope::isConsideredHidden const):
968         (WebCore::ContentChangeObserver::StyleChangeScope::isConsideredClickable const):
969         (WebCore::isConsideredHidden): Deleted.
970         * page/ios/ContentChangeObserver.h:
971
972 2019-03-08  Zalan Bujtas  <zalan@apple.com>
973
974         [ContentChangeObserver] Cleanup adjustObservedState
975         https://bugs.webkit.org/show_bug.cgi?id=195470
976         <rdar://problem/48717823>
977
978         Reviewed by Simon Fraser.
979
980         This is in preparation for introducing an observation window from touchStart -> mouseMoved.
981         1. Cancel pending activities (future timers, pending stylesheet recalcs) when visible content change is detected.
982         2. The fixed time window takes care of notifying the client -timers, style recalcs during the window should not signal themselves.  
983         3. Reset m_isObservingPendingStyleRecalc at StartedStyleRecalc instead of EndedStyleRecalc. 
984
985         * page/ios/ContentChangeObserver.cpp:
986         (WebCore::ContentChangeObserver::domTimerExecuteDidFinish):
987         (WebCore::ContentChangeObserver::styleRecalcDidStart):
988         (WebCore::ContentChangeObserver::styleRecalcDidFinish):
989         (WebCore::ContentChangeObserver::adjustObservedState):
990         * page/ios/ContentChangeObserver.h:
991         (WebCore::ContentChangeObserver::hasPendingActivity const):
992         (WebCore::ContentChangeObserver::isObservationTimeWindowActive const):
993
994 2019-03-08  Zalan Bujtas  <zalan@apple.com>
995
996         [ContentChangeObserver] Add StartedDOMTimerExecution and StartedStyleRecalc
997         https://bugs.webkit.org/show_bug.cgi?id=195463
998         <rdar://problem/48714762>
999
1000         Reviewed by Simon Fraser.
1001
1002         This is in preparation for introducing m_isObservingContentChanges flag to track observing state across events (touchStart -> mouseMoved).
1003
1004         * page/ios/ContentChangeObserver.cpp:
1005         (WebCore::ContentChangeObserver::domTimerExecuteDidStart):
1006         (WebCore::ContentChangeObserver::styleRecalcDidStart):
1007         (WebCore::ContentChangeObserver::styleRecalcDidFinish):
1008         (WebCore::ContentChangeObserver::setShouldObserveNextStyleRecalc):
1009         (WebCore::ContentChangeObserver::adjustObservedState):
1010         * page/ios/ContentChangeObserver.h:
1011         (WebCore::ContentChangeObserver::isObservingPendingStyleRecalc const):
1012         (WebCore::ContentChangeObserver::isObservingStyleRecalc const): Deleted.
1013
1014 2019-03-08  Chris Fleizach  <cfleizach@apple.com>
1015
1016         AX: AOM accessibleclick does not work on iOS
1017         https://bugs.webkit.org/show_bug.cgi?id=195423
1018         <rdar://problem/48682110>
1019
1020         Reviewed by Joanmarie Diggs.
1021
1022         Return this value of this method so it can be surfaced to a higher level.
1023
1024         * accessibility/ios/WebAccessibilityObjectWrapperIOS.mm:
1025         (-[WebAccessibilityObjectWrapper _accessibilityActivate]):
1026
1027 2019-03-08  Chris Dumez  <cdumez@apple.com>
1028
1029         imported/w3c/web-platform-tests/FileAPI/reading-data-section/filereader_error.html is a flaky crash
1030         https://bugs.webkit.org/show_bug.cgi?id=195441
1031         <rdar://problem/43437394>
1032
1033         Reviewed by Alexey Proskuryakov.
1034
1035         FileReader is an ActiveDOMObject, which means that FileReader::stop() gets called when
1036         its script execution context is about to get destroyed. FileReader::stop() sets m_state
1037         to DONE. FileReader::abort() would schedule an asynchronous task and then ASSERT that
1038         m_state is not DONE, which would hit if FileReader::stop() had been called in between
1039         the task being scheduled and its execution. To address the issue, have the task abort
1040         early if isContextStopped() returns true.
1041
1042         Also replace calls to setPendingActivity() / unsetPendingActivity() with a
1043         PendingActivity data member as mismatched call to those can lead to leaks.
1044
1045         * fileapi/FileReader.cpp:
1046         (WebCore::FileReader::canSuspendForDocumentSuspension const):
1047         No reason not to suspend if there is no pending read.
1048
1049         (WebCore::FileReader::stop):
1050         (WebCore::FileReader::readInternal):
1051         (WebCore::FileReader::abort):
1052         (WebCore::FileReader::didFinishLoading):
1053         (WebCore::FileReader::didFail):
1054         * fileapi/FileReader.h:
1055
1056 2019-03-08  Zan Dobersek  <zdobersek@igalia.com>
1057
1058         GLContextEGL: desired EGL config should search for 8-bit components by default
1059         https://bugs.webkit.org/show_bug.cgi?id=195413
1060
1061         Reviewed by Carlos Garcia Campos.
1062
1063         The EGL config search in GLContextEGL should by default look for
1064         RGBA8888 configurations while allowing RGB565 as an alternative.
1065         This prevents from accidentally landing on an RGBA1010102
1066         configuration that is available with some graphics stacks, and which is
1067         not expected in e.g. window snapshotting that's done for layout test
1068         output comparison.
1069
1070         * platform/graphics/egl/GLContextEGL.cpp:
1071         (WebCore::GLContextEGL::getEGLConfig): EGL config search should by
1072         default request 8-bit color channels.
1073
1074 2019-03-08  Miguel Gomez  <magomez@igalia.com>
1075
1076         Use a thread safe refcounter for FilterOperation.
1077         https://bugs.webkit.org/show_bug.cgi?id=194149
1078
1079         Reviewed by Carlos Garcia Campos.
1080
1081         Use a thread safe refcounter for FilterOperation.
1082
1083         * platform/graphics/filters/FilterOperation.h:
1084
1085 2019-03-07  Yusuke Suzuki  <ysuzuki@apple.com>
1086
1087         [JSC] Make more fields lazy in JSGlobalObject
1088         https://bugs.webkit.org/show_bug.cgi?id=195449
1089
1090         Reviewed by Mark Lam.
1091
1092         Use arrayBufferConstructor() since getDirect does not work with lazy property.
1093
1094         * bindings/js/JSDOMGlobalObject.cpp:
1095         (WebCore::JSDOMGlobalObject::addBuiltinGlobals):
1096
1097 2019-03-07  Zalan Bujtas  <zalan@apple.com>
1098
1099         [ContentChangeObserver][REGRESSION] Check if visibility change happens while dispatching mouseMoved
1100         https://bugs.webkit.org/show_bug.cgi?id=195421
1101         <rdar://problem/48682004>
1102
1103         Reviewed by Simon Fraser.
1104
1105         Visibility change might be triggered synchronously while dispatching mouseMoved event.
1106
1107         Test: fast/events/touch/ios/content-observation/visibility-change-happens-while-in-mousemoved.html
1108
1109         * page/ios/ContentChangeObserver.cpp:
1110         (WebCore::ContentChangeObserver::mouseMovedDidStart):
1111         (WebCore::ContentChangeObserver::mouseMovedDidFinish):
1112         (WebCore::ContentChangeObserver::isNotifyContentChangeAllowed const):
1113         * page/ios/ContentChangeObserver.h:
1114         (WebCore::ContentChangeObserver::isObservingContentChanges const):
1115
1116 2019-03-07  Zalan Bujtas  <zalan@apple.com>
1117
1118         [ContentChangeObserver] Check if max-height change triggers visible content change.
1119         https://bugs.webkit.org/show_bug.cgi?id=195417
1120         <rdar://problem/48680631>
1121
1122         Reviewed by Simon Fraser.
1123
1124         A fixed max-height non-zero value could indicate visible content change. usps.com uses this technique to show menu panes.  
1125
1126         Test: fast/events/touch/ios/content-observation/visibility-change-is-max-height-change.html
1127
1128         * page/ios/ContentChangeObserver.cpp:
1129         (WebCore::isConsideredHidden):
1130         (WebCore::ContentChangeObserver::StyleChangeScope::StyleChangeScope):
1131         (WebCore::ContentChangeObserver::StyleChangeScope::~StyleChangeScope):
1132         (WebCore::elementImplicitVisibility): Deleted.
1133         * page/ios/ContentChangeObserver.h:
1134
1135 2019-03-07  Yusuke Suzuki  <ysuzuki@apple.com>
1136
1137         Unreviewed, fix failing EWS build for ios-sim
1138
1139         * page/ios/ContentChangeObserver.cpp:
1140         (WebCore::ContentChangeObserver::touchEventDidStart):
1141
1142 2019-03-07  Eric Carlson  <eric.carlson@apple.com>
1143
1144         [MSE] Adopt new AVSampleBufferDisplayLayer SPI
1145         https://bugs.webkit.org/show_bug.cgi?id=195445
1146         <rdar://problem/48480516>
1147
1148         Reviewed by Jer Noble.
1149
1150         No new tests, no functional change.
1151
1152         * platform/graphics/avfoundation/objc/SourceBufferPrivateAVFObjC.mm:
1153         (WebCore::SourceBufferPrivateAVFObjC::SourceBufferPrivateAVFObjC): Only register for 
1154         kCMSampleBufferConsumerNotification_BufferConsumed notiication when
1155         -[AVSampleBufferDisplayLayer prerollDecodeWithCompletionHandler:] isn't available.
1156         (WebCore::SourceBufferPrivateAVFObjC::~SourceBufferPrivateAVFObjC): Ditto, for unregistering.
1157         (WebCore::SourceBufferPrivateAVFObjC::enqueueSample): Use 
1158         -[AVSampleBufferDisplayLayer prerollDecodeWithCompletionHandler:] when possible.
1159
1160 2019-03-07  Zalan Bujtas  <zalan@apple.com>
1161
1162         [ContentChangeObserver] Click event fires immediately on hover menu at Ebbets.com
1163         https://bugs.webkit.org/show_bug.cgi?id=195397
1164
1165         Reviewed by Simon Fraser.
1166
1167         This patch introduces TouchEventScope to track changes triggered by touch start.
1168
1169         Test: fast/events/touch/ios/content-observation/visibility-change-on-touch-start-simple.html
1170
1171         * page/ios/ContentChangeObserver.cpp:
1172         (WebCore::ContentChangeObserver::touchEventDidStart):
1173         (WebCore::ContentChangeObserver::touchEventDidFinish):
1174         (WebCore::ContentChangeObserver::mouseMovedDidStart):
1175         (WebCore::ContentChangeObserver::mouseMovedDidFinish):
1176         (WebCore::ContentChangeObserver::adjustObservedState):
1177         (WebCore::ContentChangeObserver::TouchEventScope::TouchEventScope):
1178         (WebCore::ContentChangeObserver::TouchEventScope::~TouchEventScope):
1179         * page/ios/ContentChangeObserver.h:
1180         (WebCore::ContentChangeObserver::isObservingContentChanges const):
1181
1182 2019-03-07  Zalan Bujtas  <zalan@apple.com>
1183
1184         [ContentChangeObserver] Introduce fixed duration content observation
1185         https://bugs.webkit.org/show_bug.cgi?id=195295
1186         <rdar://problem/48579913>
1187
1188         Reviewed by Simon Fraser.
1189
1190         Some pages have a runloop-like scheduling setup where the content triggering change happens at a nested timer firing.
1191         This patch helps finding cases like that using a 32ms long fixed window. Currently nested timers get dropped on the floor and
1192         we stop observing for content changes before they even get fired.
1193
1194         Test: fast/events/touch/ios/content-observation/visibility-change-happens-on-timer-hops.html
1195
1196         * page/ios/ContentChangeObserver.cpp:
1197         (WebCore::ContentChangeObserver::ContentChangeObserver):
1198         (WebCore::ContentChangeObserver::startContentObservationForDuration):
1199         (WebCore::ContentChangeObserver::completeDurationBasedContentObservation):
1200         (WebCore::ContentChangeObserver::didInstallDOMTimer):
1201         (WebCore::ContentChangeObserver::didRemoveDOMTimer):
1202         (WebCore::ContentChangeObserver::domTimerExecuteDidStart):
1203         (WebCore::ContentChangeObserver::domTimerExecuteDidFinish):
1204         (WebCore::ContentChangeObserver::styleRecalcDidStart):
1205         (WebCore::ContentChangeObserver::styleRecalcDidFinish):
1206         (WebCore::ContentChangeObserver::cancelPendingActivities):
1207         (WebCore::ContentChangeObserver::didSuspendActiveDOMObjects):
1208         (WebCore::ContentChangeObserver::willDetachPage):
1209         (WebCore::ContentChangeObserver::contentVisibilityDidChange):
1210         (WebCore::ContentChangeObserver::setShouldObserveNextStyleRecalc):
1211         (WebCore::ContentChangeObserver::adjustObservedState):
1212         (WebCore::ContentChangeObserver::StyleChangeScope::StyleChangeScope):
1213         (WebCore::ContentChangeObserver::StyleChangeScope::~StyleChangeScope):
1214         (WebCore::ContentChangeObserver::clearTimersAndReportContentChange): Deleted.
1215         * page/ios/ContentChangeObserver.h:
1216         (WebCore::ContentChangeObserver::clearObservedDOMTimers):
1217         (WebCore::ContentChangeObserver::isObservingContentChanges const):
1218         (WebCore::ContentChangeObserver::hasPendingActivity const):
1219
1220 2019-03-07  Said Abou-Hallawa  <sabouhallawa@apple.com>
1221
1222         requestAnimationFrame should execute before the next frame
1223         https://bugs.webkit.org/show_bug.cgi?id=177484
1224
1225         Reviewed by Simon Fraser.
1226
1227         This change fixes two issues with animation timing:
1228
1229         1. Calling the requestAnimationFrame callbacks would have happened when
1230            the DisplayLink fires. This may have happened even if the frame is
1231            missed and no display is committed.
1232
1233         2. Style changes and layout triggered by script could trigger painting
1234            at more than 60fps. CoreAnimation commits could happen at more than
1235            60fps, although WindowServer will throttle those, and only some will
1236            be shown on the screen.
1237
1238         This change introduces a new paint scheduling model where painting is
1239         driven by a "RenderingUpdateScheduler", which only triggers paints once
1240         per 16.7ms frame.
1241
1242         Code that previously scheduled a compositing layer flush now schedules a
1243         "RenderingUpdate", and that update is driven by a DisplayRefreshMonitor
1244         callback. When the render happens, we service requestAnimationFrame callbacks,
1245         Web Animations and intersection observations per the "Update the rendering"
1246         step of the HTML Event Loop specification
1247         <https://html.spec.whatwg.org/multipage/webappapis.html#update-the-rendering>.
1248
1249         In the future, more rendering steps will be added to this code.
1250
1251         * Sources.txt:
1252         * WebCore.xcodeproj/project.pbxproj:
1253         * accessibility/mac/AXObjectCacheMac.mm:
1254         Fix layout tests by adding null check.
1255
1256         * animation/DocumentAnimationScheduler.cpp: Removed.
1257         * animation/DocumentAnimationScheduler.h: Removed.
1258         * animation/DocumentTimeline.cpp:
1259         (WebCore::DocumentTimeline::DocumentTimeline):
1260         (WebCore::DocumentTimeline::updateThrottlingState):
1261         (WebCore::DocumentTimeline::resumeAnimations):
1262         (WebCore::DocumentTimeline::liveCurrentTime const):
1263         (WebCore::DocumentTimeline::currentTime):
1264         (WebCore::DocumentTimeline::animationTimingDidChange):
1265         (WebCore::DocumentTimeline::scheduleAnimationResolution):
1266         (WebCore::DocumentTimeline::unscheduleAnimationResolution):
1267         (WebCore::DocumentTimeline::updateAnimationsAndSendEvents):
1268         (WebCore::DocumentTimeline::internalUpdateAnimationsAndSendEvents):
1269         (WebCore::DocumentTimeline::scheduleNextTick):
1270         (WebCore::DocumentTimeline::updateListOfElementsWithRunningAcceleratedAnimationsForElement):
1271         Simplify this function by handling the case of no-animations separately.
1272
1273         (WebCore::DocumentTimeline::resolveAnimationsForElement):
1274         Simplify the loop and delete hasPendingAcceleratedAnimations because it
1275         is initialized to true and is not changed inside the loop.
1276
1277         (WebCore::DocumentTimeline::scheduleAnimationResolutionIfNeeded): Deleted.
1278         (WebCore::DocumentTimeline::animationResolutionTimerFired): Deleted.
1279         * animation/DocumentTimeline.h:
1280         * dom/Document.cpp:
1281         (WebCore::Document::resolveStyle):
1282         There is no need to force update in resolveStyle(). notifyFlushRequired()
1283         will be called eventually which will scheduleRenderingUpdate().
1284
1285         (WebCore::Document::prepareForDestruction):
1286         (WebCore::Document::updateAnimationsAndSendEvents):
1287         (WebCore::Document::serviceRequestAnimationFrameCallbacks):
1288         (WebCore::Document::windowScreenDidChange):
1289         (WebCore::Document::updateIntersectionObservations):
1290         (WebCore::Document::scheduleForcedIntersectionObservationUpdate): Deleted.
1291         (WebCore::Document::animationScheduler): Deleted.
1292         * dom/Document.h:
1293         (WebCore::Document::numberOfIntersectionObservers const):
1294         * dom/ScriptedAnimationController.cpp:
1295         (WebCore::ScriptedAnimationController::serviceRequestAnimationFrameCallbacks):
1296         (WebCore::ScriptedAnimationController::scheduleAnimation):
1297         (WebCore::ScriptedAnimationController::animationTimerFired):
1298         (WebCore::ScriptedAnimationController::serviceScriptedAnimations): Deleted.
1299         (WebCore::ScriptedAnimationController::documentAnimationSchedulerDidFire): Deleted.
1300         * dom/ScriptedAnimationController.h:
1301         * page/FrameView.cpp:
1302         (WebCore::FrameView::viewportContentsChanged):
1303         * page/IntersectionObserver.cpp:
1304         (WebCore::IntersectionObserver::observe):
1305         * page/Page.cpp:
1306         (WebCore::Page::Page):
1307         (WebCore::Page::layoutIfNeeded):
1308         (WebCore::Page::renderingUpdate):
1309         (WebCore::Page::renderingUpdateScheduler):
1310         (WebCore::Page::willDisplayPage): Deleted.
1311         (WebCore::Page::addDocumentNeedingIntersectionObservationUpdate): Deleted.
1312         (WebCore::Page::updateIntersectionObservations): Deleted.
1313         (WebCore::Page::scheduleForcedIntersectionObservationUpdate): Deleted.
1314         * page/Page.h:
1315         * page/PageOverlayController.cpp:
1316         (WebCore::PageOverlayController::didChangeViewExposedRect):
1317         (WebCore::PageOverlayController::notifyFlushRequired):
1318         * page/ResourceUsageData.h:
1319         Include header files that become missing because of adding 
1320         RenderingUpdateScheduler.cpp.
1321
1322         * page/RenderingUpdateScheduler.cpp: Added.
1323         (WebCore::RenderingUpdateScheduler::RenderingUpdateScheduler):
1324         (WebCore::RenderingUpdateScheduler::scheduleRenderingUpdate):
1325         (WebCore::RenderingUpdateScheduler::startTimer):
1326         (WebCore::RenderingUpdateScheduler::clearTimer):
1327         (WebCore::RenderingUpdateScheduler::windowScreenDidChange):
1328         (WebCore::RenderingUpdateScheduler::createDisplayRefreshMonitor const):
1329         (WebCore::RenderingUpdateScheduler::displayRefreshFired):
1330         * page/RenderingUpdateScheduler.h: Added.
1331         (WebCore::RenderingUpdateScheduler::create):
1332         * page/ios/ContentChangeObserver.h:
1333         Include header files that become missing because of adding 
1334         RenderingUpdateScheduler.cpp.
1335
1336         * page/mac/ServicesOverlayController.mm:
1337         (WebCore::ServicesOverlayController::Highlight::notifyFlushRequired):
1338         * rendering/RenderLayerCompositor.cpp:
1339         (WebCore::RenderLayerCompositor::scheduleLayerFlushNow):
1340
1341 2019-03-07  Zalan Bujtas  <zalan@apple.com>
1342
1343         [ContentChangeObserver] Add a setting to be able to turn content change observation on/off
1344         https://bugs.webkit.org/show_bug.cgi?id=195353
1345         <rdar://problem/48626394>
1346
1347         Reviewed by Simon Fraser.
1348
1349         Move content observation tests to a dedicated directory.
1350
1351         Tests: fast/events/touch/ios/content-observation/click-instead-of-hover-simple.html
1352                fast/events/touch/ios/content-observation/hover-when-style-change-is-async.html
1353                fast/events/touch/ios/content-observation/stuck-with-hover-state.html
1354                fast/events/touch/ios/content-observation/style-recalc-schedule-and-force-relalc.html
1355                fast/events/touch/ios/content-observation/visibility-change-happens-at-the-second-timer.html
1356
1357         * page/Settings.yaml:
1358         * page/ios/ContentChangeObserver.cpp:
1359         (WebCore::ContentChangeObserver::didInstallDOMTimer):
1360         (WebCore::ContentChangeObserver::isNotifyContentChangeAllowed const):
1361         * page/ios/ContentChangeObserver.h:
1362         (WebCore::ContentChangeObserver::isNotifyContentChangeAllowed const): Deleted.
1363         * testing/InternalSettings.cpp:
1364         (WebCore::InternalSettings::resetToConsistentState):
1365
1366 2019-03-07  John Wilander  <wilander@apple.com>
1367
1368         Make sure an empty host matches the internal representation "nullOrigin" in WebCore::RegistrableDomain::matches()
1369         https://bugs.webkit.org/show_bug.cgi?id=195435
1370
1371         Reviewed by Brent Fulgham.
1372
1373         No new tests. Tests are currently failing and will pass again with
1374         this patch.
1375
1376         WebCore::RegistrableDomain::matches() is a quick way to compare a
1377         RegistrableDomain with a URL. Since RegistrableDomain represents the
1378         empty host as "nullOrigin," a URL with an empty host needs to match
1379         that representation in WebCore::RegistrableDomain::matches().
1380         Failure to do so caused debug assertions in fast/ layout tests after
1381         https://trac.webkit.org/changeset/242603/webkit.
1382
1383         * platform/RegistrableDomain.h:
1384         (WebCore::RegistrableDomain::matches const):
1385
1386 2019-03-07  Justin Fan  <justin_fan@apple.com>
1387
1388         Unreviewed build fixes since MTLClampToBorderColor is only supported on macOS.
1389
1390         * Modules/webgpu/GPUSamplerDescriptor.idl:
1391         * platform/graphics/gpu/GPUSamplerDescriptor.h:
1392         * platform/graphics/gpu/cocoa/GPUProgrammablePassEncoderMetal.mm: Forgot include.
1393         * platform/graphics/gpu/cocoa/GPUSamplerMetal.mm:
1394         (WebCore::mtlAddressModeForAddressMode):
1395         (WebCore::tryCreateMtlSamplerState):
1396         (WebCore::mtlBorderColorForBorderColor): Deleted.
1397
1398 2019-03-07  Justin Fan  <justin_fan@apple.com>
1399
1400         [Web GPU] GPUSampler implementation
1401         https://bugs.webkit.org/show_bug.cgi?id=195427
1402         <rdar://problem/48686011>
1403
1404         Reviewed by Dean Jackson.
1405
1406         Implement ability to create GPUSamplers and use them as pipeline resource bindings.
1407
1408         Test: texture-triangle-strip.html updated.
1409
1410         Add symbols to project:
1411         * CMakeLists.txt:
1412         * DerivedSources-input.xcfilelist:
1413         * DerivedSources-output.xcfilelist:
1414         * DerivedSources.make:
1415         * Sources.txt:
1416         * SourcesCocoa.txt:
1417         * WebCore.xcodeproj/project.pbxproj:
1418         * bindings/js/WebCoreBuiltinNames.h:
1419
1420         GPUSampler creation:
1421         * Modules/webgpu/GPUSamplerDescriptor.idl: Added.
1422         * Modules/webgpu/WebGPUDevice.cpp:
1423         (WebCore::WebGPUDevice::createSampler const): Added.
1424         * Modules/webgpu/WebGPUDevice.h:
1425         * Modules/webgpu/WebGPUDevice.idl:
1426         * Modules/webgpu/WebGPUSampler.cpp: Added.
1427         (WebCore::WebGPUSampler::create):
1428         (WebCore::WebGPUSampler::WebGPUSampler):
1429         * Modules/webgpu/WebGPUSampler.h: Added.
1430         (WebCore::WebGPUSampler::sampler const):
1431         * Modules/webgpu/WebGPUSampler.idl: Added.
1432         * platform/graphics/gpu/GPUDevice.cpp:
1433         (WebCore::GPUDevice::tryCreateSampler const): Added.
1434         * platform/graphics/gpu/GPUDevice.h:
1435         * platform/graphics/gpu/GPUSampler.h: Added.
1436         (WebCore::GPUSampler::platformSampler const):
1437         * platform/graphics/gpu/GPUSamplerDescriptor.h: Added.
1438         * platform/graphics/gpu/cocoa/GPUSamplerMetal.mm: Added.
1439         (WebCore::mtlAddressModeForAddressMode):
1440         (WebCore::mtlBorderColorForBorderColor):
1441         (WebCore::mtlMinMagFilterForFilterMode):
1442         (WebCore::mtlMipFilterForFilterMode):
1443         (WebCore::tryCreateMtlSamplerState):
1444         (WebCore::GPUSampler::tryCreate):
1445         (WebCore::GPUSampler::GPUSampler):
1446
1447         Move GPUCompareFunction to Utils for shared use.
1448         * platform/graphics/gpu/GPUCompareFunction.h:
1449         * platform/graphics/gpu/GPUUtils.h:
1450         * platform/graphics/gpu/cocoa/GPURenderPipelineMetal.mm:
1451         (WebCore::tryCreateMtlDepthStencilState):
1452         (WebCore::validateAndConvertDepthCompareFunctionToMtl): Deleted.
1453         * platform/graphics/gpu/cocoa/GPUUtilsMetal.mm:
1454         (WebCore::platformTextureFormatForGPUTextureFormat):
1455         (WebCore::platformCompareFunctionForGPUCompareFunction):
1456
1457         Expand bind groups to accept GPUSamplers:
1458         * Modules/webgpu/WebGPUBindGroupBinding.h:
1459         * Modules/webgpu/WebGPUBindGroupBinding.idl:
1460         * Modules/webgpu/WebGPUBindGroupDescriptor.cpp:
1461         (WebCore::WebGPUBindGroupDescriptor::asGPUBindGroupDescriptor const):
1462         * platform/graphics/gpu/GPUBindGroupBinding.h:
1463         * platform/graphics/gpu/GPUProgrammablePassEncoder.h:
1464         * platform/graphics/gpu/cocoa/GPUProgrammablePassEncoderMetal.mm:
1465         (WebCore::GPUProgrammablePassEncoder::setBindGroup):
1466         (WebCore::GPUProgrammablePassEncoder::setResourceAsBufferOnEncoder):
1467         (WebCore::GPUProgrammablePassEncoder::setResourceAsSamplerOnEncoder): Added.
1468         (WebCore::GPUProgrammablePassEncoder::setResourceAsTextureOnEncoder):
1469
1470         Misc:
1471         * Modules/webgpu/WebGPUTexture.cpp: Missing includes.
1472         * Modules/webgpu/WebGPUTexture.h:
1473         * Modules/webgpu/WebGPUSwapChain.cpp: Removed extra include.
1474
1475 2019-03-07  Commit Queue  <commit-queue@webkit.org>
1476
1477         Unreviewed, rolling out r242297.
1478         https://bugs.webkit.org/show_bug.cgi?id=195430
1479
1480         Broke Microsoft Visio. (Requested by dydz on #webkit).
1481
1482         Reverted changeset:
1483
1484         "[iOS] Turn mouse event simulation on by default"
1485         https://bugs.webkit.org/show_bug.cgi?id=195218
1486         https://trac.webkit.org/changeset/242297
1487
1488 2019-03-07  Sihui Liu  <sihui_liu@apple.com>
1489
1490         Crash in com.apple.WebCore: WebCore::IDBTransaction::pendingOperationTimerFired + 72
1491         https://bugs.webkit.org/show_bug.cgi?id=195214
1492         <rdar://problem/48461116>
1493
1494         Reviewed by Geoffrey Garen.
1495
1496         When IDBTransaction is ready to commit, a commit operation would be schedule to 
1497         m_pendingTransactionOperationQueue. If connection to IDBServer is lost, pending operations are moved to 
1498         m_transactionOperationsInProgressQueue and will be completed with TransactionOperation::doComplete. doComplete 
1499         executes complete function of the operation, clears the complete function, and then removes the operation from 
1500         m_transactionOperationsInProgressQueue. In doComplete, we do early return when complete function is null, 
1501         since the doComplete could be invoked twice due to the race conditions between receiving "operation complete" 
1502         message from server and client-side abort.
1503
1504         However, commit operation does not have a complete function because it should be the last operation of 
1505         transaction and it gets removed from queue in its perform function. A commit operation would not be removed from 
1506         m_transactionOperationsInProgressQueue because of the early return. It would be removed from 
1507         m_transactionOperationMap, which may hold the last ref to the commit operation, in 
1508         IDBTransaction::connectionClosedFromServer. In this case, when pendingOperationTimerFired is called later, the 
1509         commit operation left in m_transactionOperationsInProgressQueue would be used and found to be freed. We should
1510         not use null check of complete function to decide whether an operation is completed.
1511
1512         * Modules/indexeddb/client/TransactionOperation.h:
1513         (WebCore::IDBClient::TransactionOperation::doComplete):
1514
1515 2019-03-07  John Wilander  <wilander@apple.com>
1516
1517         Resource Load Statistics: Log first-party navigations with link decoration
1518         https://bugs.webkit.org/show_bug.cgi?id=195301
1519         <rdar://problem/48569971>
1520
1521         Reviewed by Brent Fulgham.
1522
1523         Test: http/tests/resourceLoadStatistics/log-cross-site-load-with-link-decoration.html
1524
1525         This patch adds two new members to WebCore::ResourceLoadStatistics:
1526         - topFrameLinkDecorationsFrom, a set of domains
1527         - gotLinkDecorationFromPrevalentResource, a boolean state
1528
1529         * loader/ResourceLoadStatistics.cpp:
1530         (WebCore::ResourceLoadStatistics::encode const):
1531         (WebCore::ResourceLoadStatistics::decode):
1532         (WebCore::ResourceLoadStatistics::toString const):
1533         (WebCore::ResourceLoadStatistics::merge):
1534         * loader/ResourceLoadStatistics.h:
1535
1536 2019-03-07  Simon Fraser  <simon.fraser@apple.com>
1537
1538         [iOS WK] REGRESSION (r242132): Fixed position banners flicker and move when scrolling (Apple, Tesla, YouTube, Reddit)
1539         https://bugs.webkit.org/show_bug.cgi?id=195396
1540         rdar://problem/48518959
1541
1542         Reviewed by Antti Koivisto.
1543         
1544         r242132 introduced two issues that contributed to jumpiness of position:fixed layers when scrolling.
1545         
1546         First, ScrollingTreeScrollingNode::wasScrolledByDelegatedScrolling() would early return if the scroll position
1547         hadn't changed. It also needs to check the supplied layoutViewport (if any), but in some cases running the
1548         notifyRelatedNodesAfterScrollPositionChange() code is necessary even without a scroll position change:
1549         if the web process has committed new scrolling tree state (e.g. with new fixed constraints) since
1550         the last call, we have to run the layer positioning code to have fixed layers re-adjust their position relative
1551         to the root. This was the primary bug fix.
1552
1553         Secondly, a layer tree commit can give ScrollingTreeFrameScrollingNode a new layout viewport, but we need to
1554         adjust this by the scrolling tree's current scroll position in case it gets used before the next scroll.
1555
1556         Currently no way to test this, as it's very timing-dependent.
1557
1558         * page/scrolling/ScrollingTreeFrameScrollingNode.cpp:
1559         (WebCore::ScrollingTreeFrameScrollingNode::commitStateBeforeChildren):
1560         (WebCore::ScrollingTreeFrameScrollingNode::scrollPositionAndLayoutViewportMatch):
1561         * page/scrolling/ScrollingTreeFrameScrollingNode.h:
1562         * page/scrolling/ScrollingTreeScrollingNode.cpp:
1563         (WebCore::ScrollingTreeScrollingNode::scrollPositionAndLayoutViewportMatch):
1564         (WebCore::ScrollingTreeScrollingNode::wasScrolledByDelegatedScrolling):
1565         * page/scrolling/ScrollingTreeScrollingNode.h:
1566
1567 2019-03-07  Youenn Fablet  <youenn@apple.com>
1568
1569         Introduce a quota manager for Cache API/Service Worker/IDB storage
1570         https://bugs.webkit.org/show_bug.cgi?id=195283
1571
1572         Reviewed by Chris Dumez.
1573
1574         Introduce a generic quota manager and quota users to be used in Network Process.
1575         Quota manager/users are scoped by client origin.
1576         Quota manager is used to check for quota by an entity wanting to execute a storage task of a given taskSize.
1577         Quota manager will check the current space used by all its quota users.
1578         If the size + taskSize is above quota, it will call a function to try extend the quota.
1579         In the meantime, the task (and all tasks that may be added) are queued.
1580
1581         Once the new quota is received, the quota manager will either allow or disallow the first task in the queue.
1582         The quota manager will try to execute as many tasks as possible with the provided quota.
1583         If some tasks are remaining and quota limit is hit, the quota manager will compute the space needed for all remaining requests
1584         and do another quota extension request.
1585
1586         * Sources.txt:
1587         * WebCore.xcodeproj/project.pbxproj:
1588         * page/ClientOrigin.h:
1589         * storage/StorageQuotaManager.cpp: Added.
1590         (WebCore::StorageQuotaManager::~StorageQuotaManager):
1591         (WebCore::StorageQuotaManager::spaceUsage const):
1592         (WebCore::StorageQuotaManager::requestSpace):
1593         (WebCore::StorageQuotaManager::askForMoreSpace):
1594         (WebCore::StorageQuotaManager::processPendingRequests):
1595         * storage/StorageQuotaManager.h: Added.
1596         (WebCore::StorageQuotaManager::StorageQuotaManager):
1597         (WebCore::StorageQuotaManager::addUser):
1598         (WebCore::StorageQuotaManager::removeUser):
1599         * storage/StorageQuotaUser.h: Added.
1600
1601 2019-03-07  John Wilander  <wilander@apple.com>
1602
1603         Resource Load Statistics: Make it possible to purge only script-accessible cookies
1604         https://bugs.webkit.org/show_bug.cgi?id=195383
1605         <rdar://problem/48570136>
1606
1607         Reviewed by Brent Fulgham.
1608
1609         Test: http/tests/resourceLoadStatistics/delete-script-accessible-cookies.html
1610
1611         This patch provides the ability to purge all script-accessible cookies while leaving
1612         HttpOnly cookies in place.
1613
1614         * loader/CookieJar.h:
1615             Added boolean enum IncludeHttpOnlyCookies for use as function parameter.
1616         * platform/network/NetworkStorageSession.h:
1617         * platform/network/cocoa/NetworkStorageSessionCocoa.mm:
1618         (WebCore::NetworkStorageSession::deleteCookiesForHostnames):
1619             Support for the new IncludeHttpOnlyCookies flag.
1620         * platform/network/curl/NetworkStorageSessionCurl.cpp:
1621         (WebCore::NetworkStorageSession::deleteCookiesForHostnames):
1622             Stubbed out the new function and added a FIXME comment.
1623         * platform/network/soup/NetworkStorageSessionSoup.cpp:
1624         (WebCore::NetworkStorageSession::deleteCookiesForHostnames):
1625             Stubbed out the new function and added a FIXME comment.
1626
1627 2019-03-06  Mark Lam  <mark.lam@apple.com>
1628
1629         Exception is a JSCell, not a JSObject.
1630         https://bugs.webkit.org/show_bug.cgi?id=195392
1631
1632         Reviewed by Saam Barati.
1633
1634         * bridge/objc/objc_utility.h:
1635         * bridge/objc/objc_utility.mm:
1636         (JSC::Bindings::throwError):
1637         * bridge/runtime_object.cpp:
1638         (JSC::Bindings::RuntimeObject::throwInvalidAccessError):
1639         * bridge/runtime_object.h:
1640
1641 2019-03-07  Devin Rousso  <drousso@apple.com>
1642
1643         Web Inspector: Canvas: lazily create the agent
1644         https://bugs.webkit.org/show_bug.cgi?id=195241
1645
1646         Reviewed by Joseph Pecoraro.
1647
1648         No functionality change.
1649
1650         * html/canvas/CanvasRenderingContext.h:
1651         * html/canvas/CanvasRenderingContext.cpp:
1652         (WebCore::CanvasRenderingContext::instances): Added.
1653         (WebCore::CanvasRenderingContext::instancesMutex): Added.
1654         (WebCore::CanvasRenderingContext::CanvasRenderingContext):
1655         (WebCore::CanvasRenderingContext::~CanvasRenderingContext):
1656
1657         * html/canvas/WebGLProgram.h:
1658         * html/canvas/WebGLProgram.cpp:
1659         (WebCore::WebGLProgram::instances): Added.
1660         (WebCore::WebGLProgram::instancesMutex): Added.
1661         (WebCore::WebGLProgram::WebGLProgram):
1662         (WebCore::WebGLProgram::~WebGLProgram):
1663         * html/canvas/WebGLRenderingContextBase.cpp:
1664         (WebCore::WebGLRenderingContextBase::~WebGLRenderingContextBase):
1665
1666         * inspector/InspectorController.cpp:
1667         (WebCore::InspectorController::InspectorController):
1668         (WebCore::InspectorController::createLazyAgents):
1669
1670         * inspector/agents/InspectorCanvasAgent.h:
1671         * inspector/agents/InspectorCanvasAgent.cpp:
1672         (WebCore::InspectorCanvasAgent::enable):
1673         (WebCore::InspectorCanvasAgent::disable):
1674         (WebCore::InspectorCanvasAgent::frameNavigated):
1675         (WebCore::InspectorCanvasAgent::didCreateCanvasRenderingContext):
1676         (WebCore::InspectorCanvasAgent::canvasDestroyed):
1677         (WebCore::InspectorCanvasAgent::didCreateProgram):
1678         (WebCore::InspectorCanvasAgent::willDeleteProgram):
1679         (WebCore::InspectorCanvasAgent::bindCanvas): Added.
1680         (WebCore::InspectorCanvasAgent::canvasDestroyedTimerFired):
1681
1682         * inspector/InspectorInstrumentation.h:
1683         (WebCore::InspectorInstrumentation::didCreateCanvasRenderingContext):
1684         (WebCore::InspectorInstrumentation::didCreateProgram):
1685         (WebCore::InspectorInstrumentation::willDeleteProgram):
1686
1687 2019-03-06  Ross Kirsling  <ross.kirsling@sony.com>
1688
1689         [Win] Remove -DUCHAR_TYPE=wchar_t stopgap and learn to live with char16_t.
1690         https://bugs.webkit.org/show_bug.cgi?id=195346
1691
1692         Reviewed by Fujii Hironori.
1693
1694         * platform/graphics/win/FontCacheWin.cpp:
1695         (WebCore::appendLinkedFonts):
1696         (WebCore::getLinkedFonts):
1697         (WebCore::FontCache::systemFallbackForCharacters):
1698         (WebCore::FontCache::fontFromDescriptionAndLogFont):
1699         (WebCore::createGDIFont):
1700         (WebCore::FontCache::getFontSelectionCapabilitiesInFamily):
1701         * platform/graphics/win/FontCustomPlatformDataCairo.cpp:
1702         (WebCore::FontCustomPlatformData::fontPlatformData):
1703         * platform/graphics/win/GlyphPageTreeNodeCairoWin.cpp:
1704         (WebCore::GlyphPage::fill):
1705         * platform/graphics/win/IconWin.cpp:
1706         (WebCore::Icon::createIconForFiles):
1707         * platform/graphics/win/MediaPlayerPrivateMediaFoundation.cpp:
1708         (WebCore::mimeTypeCache):
1709         (WebCore::MediaPlayerPrivateMediaFoundation::startCreateMediaSource):
1710         * platform/graphics/win/UniscribeController.cpp:
1711         (WebCore::UniscribeController::itemizeShapeAndPlace):
1712         (WebCore::UniscribeController::shape):
1713         * platform/network/win/DownloadBundleWin.cpp:
1714         (WebCore::DownloadBundle::appendResumeData):
1715         (WebCore::DownloadBundle::extractResumeData):
1716         * platform/text/win/LocaleWin.cpp:
1717         (WebCore::LCIDFromLocaleInternal):
1718         (WebCore::LCIDFromLocale):
1719         (WebCore::LocaleWin::getLocaleInfoString):
1720         * platform/win/BString.cpp:
1721         (WebCore::BString::BString):
1722         * platform/win/ClipboardUtilitiesWin.cpp:
1723         (WebCore::getWebLocData):
1724         (WebCore::createGlobalData):
1725         (WebCore::getFileDescriptorData):
1726         (WebCore::getURL):
1727         (WebCore::getCFData):
1728         (WebCore::setCFData):
1729         * platform/win/DragDataWin.cpp:
1730         (WebCore::DragData::asFilenames const):
1731         * platform/win/DragImageWin.cpp:
1732         (WebCore::createDragImageIconForCachedImageFilename):
1733         (WebCore::dragLabelFont):
1734         * platform/win/MIMETypeRegistryWin.cpp:
1735         (WebCore::mimeTypeForExtension):
1736         (WebCore::MIMETypeRegistry::getPreferredExtensionForMIMEType):
1737         * platform/win/PasteboardWin.cpp:
1738         (WebCore::Pasteboard::read):
1739         (WebCore::filesystemPathFromUrlOrTitle):
1740         (WebCore::Pasteboard::writeURLToDataObject):
1741         (WebCore::createGlobalImageFileDescriptor):
1742         (WebCore::createGlobalHDropContent):
1743         * platform/win/SSLKeyGeneratorWin.cpp:
1744         (WebCore::signedPublicKeyAndChallengeString):
1745         * platform/win/SharedBufferWin.cpp:
1746         (WebCore::SharedBuffer::createFromReadingFile):
1747         * rendering/RenderThemeWin.cpp:
1748         (WebCore::fillFontDescription):
1749         Use wchar helpers as needed.
1750
1751 2019-03-06  Devin Rousso  <drousso@apple.com>
1752
1753         Web Inspector: DOM Debugger: event breakpoints still fire when breakpoints are disabled
1754         https://bugs.webkit.org/show_bug.cgi?id=195377
1755         <rdar://problem/48651645>
1756
1757         Reviewed by Joseph Pecoraro and Matt Baker.
1758
1759         Test: inspector/dom-debugger/event-listener-breakpoints.html
1760
1761         * inspector/agents/InspectorDOMDebuggerAgent.cpp:
1762         (WebCore::InspectorDOMDebuggerAgent::willHandleEvent):
1763         (WebCore::InspectorDOMDebuggerAgent::willFireTimer):
1764         (WebCore::InspectorDOMDebuggerAgent::willFireAnimationFrame):
1765
1766 2019-03-06  Wenson Hsieh  <wenson_hsieh@apple.com>
1767
1768         Crash when attempting to change input type while dismissing datalist suggestions
1769         https://bugs.webkit.org/show_bug.cgi?id=195384
1770         <rdar://problem/48563718>
1771
1772         Reviewed by Brent Fulgham.
1773
1774         When closing a datalist suggestion menu, WebPageProxy sends a message to WebPage instructing it to tell its
1775         active datalist suggestions picker to close. However, for a myriad of reasons, the suggestions picker (kept
1776         alive by its text input type) may have already gone away by this point. To mitigate this, make WebPage weakly
1777         reference its active datalist suggestions picker.
1778
1779         Test: fast/forms/datalist/change-input-type-after-closing-datalist-suggestions.html
1780
1781         * platform/DataListSuggestionPicker.h:
1782
1783         Make DataListSuggestionPicker capable of being weakly referenced. Additionally, fix some minor preexisting
1784         issues in this header (#imports instead of #includes, as well as an unnecessary include of IntRect.h).
1785
1786 2019-03-06  Ryan Haddad  <ryanhaddad@apple.com>
1787
1788         Remove an unneeded assert that was added with r242113
1789         https://bugs.webkit.org/show_bug.cgi?id=195391
1790
1791         Reviewed by Simon Fraser.
1792
1793         Many layout tests are failing ASSERT(m_mediaBufferingIsSuspended). Since m_mediaBufferingIsSuspended is
1794         protected by an 'if' statement directly afterwards, the assertion should be safe to remove.
1795
1796         * page/Page.cpp:
1797         (WebCore::Page::resumeAllMediaBuffering):
1798
1799 2019-03-06  Justin Fan  <justin_fan@apple.com>
1800
1801         Unreviewed build fix. Replace a forward declaration with an include.
1802
1803         * Modules/webgpu/WebGPUTextureView.cpp:
1804         * Modules/webgpu/WebGPUTextureView.h:
1805
1806 2019-03-06  Justin Fan  <justin_fan@apple.com>
1807
1808         [Web GPU] GPUTexture and GPUTextureView updates, and related GPUBindGroup updates
1809         https://bugs.webkit.org/show_bug.cgi?id=195347
1810
1811         Reviewed by Dean Jackson.
1812
1813         Implement the ability to display image data as a GPUTexture in the rendering pipeline. Improve GPUTexture and 
1814         GPUTextureView implementations. Rename various bind group classes to GPU* to match API.
1815
1816         Test: webgpu/texture-triangle-strip.html
1817
1818         * Modules/webgpu/WebGPUBindGroupDescriptor.cpp:
1819         (WebCore::WebGPUBindGroupDescriptor::asGPUBindGroupDescriptor const): Update to validate GPUTextureView resources.
1820         * Modules/webgpu/WebGPUCommandBuffer.cpp: Move instead of copy the converted view objects.
1821         (WebCore::WebGPUCommandBuffer::copyBufferToTexture):
1822         (WebCore::WebGPUCommandBuffer::copyTextureToBuffer):
1823         (WebCore::WebGPUCommandBuffer::copyTextureToTexture):
1824         * Modules/webgpu/WebGPUCommandBuffer.h:
1825         (WebCore::WebGPUCommandBuffer::commandBuffer const): No longer returns const so used resources can be registered on it.
1826         * Modules/webgpu/WebGPUDevice.cpp:
1827         (WebCore::WebGPUDevice::createBindGroupLayout const): Rename WebGPUBindGroupLayoutDescriptor and replace unnecessary rvalue reference.
1828         * Modules/webgpu/WebGPUDevice.h: Ditto.
1829         * Modules/webgpu/WebGPUDevice.idl: Ditto.
1830         * Modules/webgpu/WebGPUProgrammablePassEncoder.cpp:
1831         (WebCore::WebGPUProgrammablePassEncoder::setBindGroup const):
1832         * Modules/webgpu/WebGPUProgrammablePassEncoder.h:
1833         * Modules/webgpu/WebGPUQueue.cpp:
1834         (WebCore::WebGPUQueue::submit):
1835         * Modules/webgpu/WebGPURenderPassDescriptor.cpp:
1836         (WebCore::WebGPURenderPassDescriptor::asGPURenderPassDescriptor const):
1837         * Modules/webgpu/WebGPUTexture.cpp:
1838         (WebCore::WebGPUTexture::~WebGPUTexture): Clean up any resources created for and from this WebGPUTexture.
1839         (WebCore::WebGPUTexture::createDefaultTextureView): Now returns an empty object other than null on failure.
1840         (WebCore::WebGPUTexture::destroy):
1841         (WebCore::WebGPUTexture::destroyImpl):
1842         * Modules/webgpu/WebGPUTexture.h: Keep a list of any views created from this texture.
1843         * Modules/webgpu/WebGPUTexture.idl: Enable destroy.
1844         * Modules/webgpu/WebGPUTextureView.cpp:
1845         (WebCore::WebGPUTextureView::create):
1846         (WebCore::WebGPUTextureView::WebGPUTextureView):
1847         (WebCore::WebGPUTextureView::destroy):
1848         * Modules/webgpu/WebGPUTextureView.h:
1849         (WebCore::WebGPUTextureView::~WebGPUTextureView): Clean up any resources backing this WebGPUTextureView.
1850         (WebCore::WebGPUTextureView::texture const):
1851         (WebCore::WebGPUTextureView::texture): Deleted.
1852         * platform/graphics/gpu/GPUBindGroupLayout.h:
1853         * platform/graphics/gpu/GPUCommandBuffer.h:
1854         (WebCore::GPUCommandBuffer::usedTextures const): Keep a list of all texture resources that will be used by this command buffer on submit.
1855         (WebCore::GPUCommandBuffer::isEncodingPass const): Added to prevent multiple pass encoders from being active on one command buffer.
1856         (WebCore::GPUCommandBuffer::setIsEncodingPass):
1857         (WebCore::GPUCommandBuffer::useTexture):
1858         * platform/graphics/gpu/GPUDevice.cpp:
1859         (WebCore::GPUDevice::tryCreateBindGroupLayout const):
1860         * platform/graphics/gpu/GPUDevice.h:
1861         * platform/graphics/gpu/GPUPipelineLayout.cpp:
1862         (WebCore::GPUPipelineLayout::GPUPipelineLayout):
1863         * platform/graphics/gpu/GPUProgrammablePassEncoder.cpp:
1864         (WebCore::GPUProgrammablePassEncoder::GPUProgrammablePassEncoder):
1865         * platform/graphics/gpu/GPUProgrammablePassEncoder.h:
1866         (WebCore::GPUProgrammablePassEncoder::setVertexBuffer):
1867         (WebCore::GPUProgrammablePassEncoder::setFragmentBuffer):
1868         (): Deleted.
1869         * platform/graphics/gpu/GPUQueue.h:
1870         * platform/graphics/gpu/GPURenderPassEncoder.h:
1871         * platform/graphics/gpu/GPUTexture.h:
1872         (WebCore::GPUTexture::isReadOnly const):
1873         (WebCore::GPUTexture::destroy):
1874         * platform/graphics/gpu/cocoa/GPUBindGroupLayoutMetal.mm:
1875         (WebCore::MTLDataTypeForBindingType):
1876         (WebCore::GPUBindGroupLayout::tryCreate):
1877         * platform/graphics/gpu/cocoa/GPUCommandBufferMetal.mm:
1878         (WebCore::GPUCommandBuffer::create):
1879         (WebCore::GPUCommandBuffer::~GPUCommandBuffer): Ensure blitEncoder is ended before releasing it.
1880         (WebCore::GPUCommandBuffer::endBlitEncoding):
1881         (WebCore::GPUCommandBuffer::copyBufferToTexture): Ensure textures are marked for usage before submission occurs.
1882         (WebCore::GPUCommandBuffer::copyTextureToBuffer):
1883         (WebCore::GPUCommandBuffer::copyTextureToTexture):
1884         * platform/graphics/gpu/cocoa/GPUDeviceMetal.mm:
1885         (WebCore::GPUDevice::create):
1886         (WebCore::GPUDevice::GPUDevice):
1887         * platform/graphics/gpu/cocoa/GPUProgrammablePassEncoderMetal.mm:
1888         (WebCore::GPUProgrammablePassEncoder::endPass):
1889         (WebCore::GPUProgrammablePassEncoder::setBindGroup): Now supports texture resources.
1890         (WebCore::GPUProgrammablePassEncoder::setResourceAsBufferOnEncoder): Just moved.
1891         (WebCore::GPUProgrammablePassEncoder::setResourceAsTextureOnEncoder):
1892         * platform/graphics/gpu/cocoa/GPUQueueMetal.mm:
1893         (WebCore::GPUQueue::submit): Ensures destroyed GPUTextures are not submitted.
1894         * platform/graphics/gpu/cocoa/GPURenderPassEncoderMetal.mm:
1895         (WebCore::GPURenderPassEncoder::tryCreate): Ensure any other encoders are ended before attempting to activate a new one.
1896         (WebCore::GPURenderPassEncoder::platformPassEncoder const):
1897         (WebCore::GPURenderPassEncoder::endPass): Invalidates the MTLCommandEncoder upon success.
1898         (WebCore::GPURenderPassEncoder::setPipeline):
1899         (WebCore::GPURenderPassEncoder::setVertexBuffers):
1900         (WebCore::GPURenderPassEncoder::draw):
1901         (WebCore::GPURenderPassEncoder::useResource):
1902         (WebCore::GPURenderPassEncoder::setVertexBuffer):
1903         (WebCore::GPURenderPassEncoder::setFragmentBuffer):
1904         * platform/graphics/gpu/cocoa/GPUSwapChainMetal.mm:
1905         (WebCore::GPUSwapChain::getNextTexture):
1906         * platform/graphics/gpu/cocoa/GPUTextureMetal.mm:
1907         (WebCore::storageModeForPixelFormatAndSampleCount): 
1908                 Always create MTLStorageModePrivate textures on macOS, as Web GPU doesn't provide CPU access to textures anyway.
1909         (WebCore::tryCreateMtlTextureDescriptor):
1910         (WebCore::GPUTexture::create):
1911         (WebCore::GPUTexture::GPUTexture):
1912         (WebCore::GPUTexture::tryCreateDefaultTextureView): Renamed from createDefaultTextureView.
1913
1914         Update files and symbols in project:
1915         * CMakeLists.txt:
1916         * DerivedSources-input.xcfilelist:
1917         * DerivedSources-output.xcfilelist:
1918         * DerivedSources.make:
1919         * Modules/streams/WebGPUBindGroupLayoutDescriptor.h: Removed.
1920         * Modules/webgpu/GPUBindGroupLayoutBinding.h: Renamed from Source/WebCore/platform/graphics/gpu/GPUBindGroupLayoutBinding.h.
1921         * Modules/webgpu/GPUBindGroupLayoutBinding.idl: Renamed from Source/WebCore/Modules/webgpu/WebGPUBindGroupLayoutBinding.idl.
1922         * Modules/webgpu/GPUBindGroupLayoutDescriptor.h: Renamed from Source/WebCore/platform/graphics/gpu/GPUBindGroupLayoutDescriptor.h.
1923         * Modules/webgpu/GPUBindGroupLayoutDescriptor.idl: Renamed from Source/WebCore/Modules/webgpu/WebGPUBindGroupLayoutDescriptor.idl.
1924         * Modules/webgpu/GPUShaderStageBit.h: Renamed from Source/WebCore/Modules/webgpu/WebGPUShaderStageBit.h.
1925         * Modules/webgpu/GPUShaderStageBit.idl: Renamed from Source/WebCore/Modules/webgpu/WebGPUShaderStageBit.idl.
1926         * Sources.txt:
1927         * WebCore.xcodeproj/project.pbxproj:
1928         * bindings/js/WebCoreBuiltinNames.h:
1929
1930 2019-03-06  Myles C. Maxfield  <mmaxfield@apple.com>
1931
1932         [WHLSL] Pack and unpack data at entry points and exit points
1933         https://bugs.webkit.org/show_bug.cgi?id=193877
1934
1935         Reviewed by Dean Jackson.
1936
1937         This implements the bulk of the rest of the Metal code generation piece.
1938         Specifically, this patch adds support for the packing and unpacking steps
1939         at the beginning of the entry point functions and all returns from those
1940         functions. It does this by creating an object, EntryPointScaffolding, that
1941         knows how to emit all the helper types, packing / unpacking code, and the
1942         function signature. This patch also accepts parts of the
1943         PipelineStateDescriptor so we know the data layout we should be packing and
1944         unpacking.
1945
1946         This is the last patch before enough of the compiler is present that we can
1947         start testing it. The next patch will start porting the test suite.
1948
1949         * Modules/webgpu/WHLSL/Metal/WHLSLEntryPointScaffolding.cpp:
1950         (WebCore::WHLSL::Metal::attributeForSemantic):
1951         (WebCore::WHLSL::Metal::EntryPointScaffolding::EntryPointScaffolding):
1952         (WebCore::WHLSL::Metal::EntryPointScaffolding::mappedBindGroups const):
1953         (WebCore::WHLSL::Metal::EntryPointScaffolding::resourceHelperTypes):
1954         (WebCore::WHLSL::Metal::EntryPointScaffolding::resourceSignature):
1955         (WebCore::WHLSL::Metal::EntryPointScaffolding::builtInsSignature):
1956         (WebCore::WHLSL::Metal::EntryPointScaffolding::mangledInputPath):
1957         (WebCore::WHLSL::Metal::EntryPointScaffolding::mangledOutputPath):
1958         (WebCore::WHLSL::Metal::EntryPointScaffolding::unpackResourcesAndNamedBuiltIns):
1959         (WebCore::WHLSL::Metal::VertexEntryPointScaffolding::VertexEntryPointScaffolding):
1960         (WebCore::WHLSL::Metal::VertexEntryPointScaffolding::helperTypes):
1961         (WebCore::WHLSL::Metal::VertexEntryPointScaffolding::signature):
1962         (WebCore::WHLSL::Metal::VertexEntryPointScaffolding::unpack):
1963         (WebCore::WHLSL::Metal::VertexEntryPointScaffolding::pack):
1964         (WebCore::WHLSL::Metal::FragmentEntryPointScaffolding::FragmentEntryPointScaffolding):
1965         (WebCore::WHLSL::Metal::FragmentEntryPointScaffolding::helperTypes):
1966         (WebCore::WHLSL::Metal::FragmentEntryPointScaffolding::signature):
1967         (WebCore::WHLSL::Metal::FragmentEntryPointScaffolding::unpack):
1968         (WebCore::WHLSL::Metal::FragmentEntryPointScaffolding::pack):
1969         (WebCore::WHLSL::Metal::ComputeEntryPointScaffolding::ComputeEntryPointScaffolding):
1970         (WebCore::WHLSL::Metal::ComputeEntryPointScaffolding::helperTypes):
1971         (WebCore::WHLSL::Metal::ComputeEntryPointScaffolding::signature):
1972         (WebCore::WHLSL::Metal::ComputeEntryPointScaffolding::unpack):
1973         (WebCore::WHLSL::Metal::ComputeEntryPointScaffolding::pack):
1974         (WebCore::WHLSL::Metal::EntryPointScaffolding::helperTypes): Deleted.
1975         (WebCore::WHLSL::Metal::EntryPointScaffolding::signature): Deleted.
1976         (WebCore::WHLSL::Metal::EntryPointScaffolding::unpack): Deleted.
1977         (WebCore::WHLSL::Metal::EntryPointScaffolding::pack): Deleted.
1978         * Modules/webgpu/WHLSL/Metal/WHLSLEntryPointScaffolding.h:
1979         (WebCore::WHLSL::Metal::EntryPointScaffolding::parameterVariables):
1980         * Modules/webgpu/WHLSL/Metal/WHLSLFunctionWriter.cpp:
1981         (WebCore::WHLSL::Metal::FunctionDeclarationWriter::toString):
1982         (WebCore::WHLSL::Metal::FunctionDeclarationWriter::visit):
1983         (WebCore::WHLSL::Metal::FunctionDefinitionWriter::FunctionDefinitionWriter):
1984         (WebCore::WHLSL::Metal::FunctionDefinitionWriter::generateNextVariableName):
1985         (WebCore::WHLSL::Metal::FunctionDefinitionWriter::visit):
1986         (WebCore::WHLSL::Metal::FunctionDefinitionWriter::constantExpressionString):
1987         (WebCore::WHLSL::Metal::RenderFunctionDefinitionWriter::RenderFunctionDefinitionWriter):
1988         (WebCore::WHLSL::Metal::RenderFunctionDefinitionWriter::takeVertexMappedBindGroups):
1989         (WebCore::WHLSL::Metal::RenderFunctionDefinitionWriter::takeFragmentMappedBindGroups):
1990         (WebCore::WHLSL::Metal::RenderFunctionDefinitionWriter::createEntryPointScaffolding):
1991         (WebCore::WHLSL::Metal::ComputeFunctionDefinitionWriter::ComputeFunctionDefinitionWriter):
1992         (WebCore::WHLSL::Metal::ComputeFunctionDefinitionWriter::takeMappedBindGroups):
1993         (WebCore::WHLSL::Metal::ComputeFunctionDefinitionWriter::createEntryPointScaffolding):
1994         (WebCore::WHLSL::Metal::sharedMetalFunctions):
1995         (WebCore::WHLSL::Metal::metalFunctions):
1996         * Modules/webgpu/WHLSL/Metal/WHLSLFunctionWriter.h:
1997         * Modules/webgpu/WHLSL/Metal/WHLSLMappedBindings.h: Copied from Source/WebCore/Modules/webgpu/WHLSL/Metal/WHLSLMetalCodeGenerator.h.
1998         * Modules/webgpu/WHLSL/Metal/WHLSLMetalCodeGenerator.cpp:
1999         (WebCore::WHLSL::Metal::generateMetalCodeShared):
2000         (WebCore::WHLSL::Metal::generateMetalCode):
2001         * Modules/webgpu/WHLSL/Metal/WHLSLMetalCodeGenerator.h:
2002         * Modules/webgpu/WHLSL/WHLSLIntrinsics.h:
2003         (WebCore::WHLSL::Intrinsics::float2Type const):
2004         * Modules/webgpu/WHLSL/WHLSLPipelineDescriptor.h: Added.
2005         * Modules/webgpu/WHLSL/WHLSLPrepare.cpp: Added.
2006         (WebCore::WHLSL::prepareShared):
2007         (WebCore::WHLSL::prepare):
2008         * Modules/webgpu/WHLSL/WHLSLPrepare.h: Copied from Source/WebCore/Modules/webgpu/WHLSL/Metal/WHLSLMetalCodeGenerator.h.
2009         * Modules/webgpu/WHLSL/WHLSLSemanticMatcher.cpp: Added.
2010         (WebCore::WHLSL::findEntryPoint):
2011         (WebCore::WHLSL::matchMode):
2012         (WebCore::WHLSL::matchResources):
2013         (WebCore::WHLSL::matchInputsOutputs):
2014         (WebCore::WHLSL::isAcceptableFormat):
2015         (WebCore::WHLSL::matchVertexAttributes):
2016         (WebCore::WHLSL::matchColorAttachments):
2017         (WebCore::WHLSL::matchDepthAttachment):
2018         (WebCore::WHLSL::matchSemantics):
2019         * Modules/webgpu/WHLSL/WHLSLSemanticMatcher.h: Copied from Source/WebCore/Modules/webgpu/WHLSL/Metal/WHLSLEntryPointScaffolding.cpp.
2020         * Sources.txt:
2021         * WebCore.xcodeproj/project.pbxproj:
2022
2023 2019-03-06  Wenson Hsieh  <wenson_hsieh@apple.com>
2024
2025         Move RenderObject::isTransparentOrFullyClippedRespectingParentFrames() to RenderLayer
2026         https://bugs.webkit.org/show_bug.cgi?id=195300
2027
2028         Reviewed by Simon Fraser.
2029
2030         Move isTransparentOrFullyClippedRespectingParentFrames() from RenderObject to RenderLayer, since this function
2031         asks questions about RenderLayers rather than their renderers. No change in behavior.
2032
2033         * rendering/RenderLayer.cpp:
2034         (WebCore::enclosingFrameRenderLayer):
2035         (WebCore::parentLayerCrossFrame):
2036
2037         Some static helpers currently in RenderObject that walk up the layer hierarchy through subframes are redundant
2038         with static helpers in RenderLayer. Now that isTransparentOrFullyClippedRespectingParentFrames exists in
2039         RenderLayer, simply use this existing helper instead and split logic to grab the enclosing layer around the
2040         owner element of a frame into a separate helper.
2041
2042         * rendering/RenderLayer.h:
2043         * rendering/RenderObject.cpp:
2044         (WebCore::enclosingFrameRenderLayer): Deleted.
2045         (WebCore::parentLayerCrossingFrameBoundaries): Deleted.
2046         (WebCore::RenderObject::isTransparentOrFullyClippedRespectingParentFrames const): Deleted.
2047
2048         Moved from RenderObject.
2049
2050         * rendering/RenderObject.h:
2051
2052 2019-03-06  Sihui Liu  <sihui_liu@apple.com>
2053
2054         Assertion Failed: m_databaseQueue.isKilled() in UniqueIDBDatabase::~UniqueIDBDatabase()
2055         https://bugs.webkit.org/show_bug.cgi?id=195073
2056         <rdar://problem/48285200>
2057
2058         Reviewed by Geoffrey Garen.
2059
2060         r240931 removed a retain cycle between IDBConnectionToServer and IDBConnectionToServerDelegate, so 
2061         IDBConnectionToServerDelegate, or InProcessIDBServer would not live forever. When IDBDatabase is gone, 
2062         InProcessIDBServer would schedule a notifification to IDBServer with databaseConnectionClosed. IDBServer would 
2063         then notify UniqueIDBDatabase. When UniqueIDBDatabase finds all database connections are gone, it would acquires
2064         its only reference pointer from IDBServer schedule and perform a shutdown that kills its database task queue.
2065
2066         The assertion failure tells us UniqueIDBDatabase was destructed at when IDBServer was destructed, which means 
2067         UniqueIDBDatabase had not acquired its pointer. It's probably because UniqueIDBDatabase had unfinished tasks or
2068         the operation timer function had not been executed. Since UniqueIDBDatabase needs to complete shutdown process,
2069         we should make IDBServer live as long as UniqueIDBDatabase by keeping a reference pointer of IDBServer in 
2070         UniqueIDBDatabase. 
2071
2072         * Modules/indexeddb/server/UniqueIDBDatabase.cpp:
2073         (WebCore::IDBServer::UniqueIDBDatabase::UniqueIDBDatabase):
2074         (WebCore::IDBServer::UniqueIDBDatabase::deleteBackingStore):
2075         (WebCore::IDBServer::UniqueIDBDatabase::scheduleShutdownForClose):
2076         (WebCore::IDBServer::UniqueIDBDatabase::openBackingStore):
2077         (WebCore::IDBServer::UniqueIDBDatabase::postDatabaseTask):
2078         (WebCore::IDBServer::UniqueIDBDatabase::postDatabaseTaskReply):
2079         (WebCore::IDBServer::UniqueIDBDatabase::immediateCloseForUserDelete):
2080         (WebCore::IDBServer::UniqueIDBDatabase::notifyServerAboutClose):
2081         * Modules/indexeddb/server/UniqueIDBDatabase.h:
2082         (WebCore::IDBServer::UniqueIDBDatabase::server):
2083
2084 2019-03-06  Rob Buis  <rbuis@igalia.com>
2085
2086         Consider supporting the `referrerpolicy` attribute.
2087         https://bugs.webkit.org/show_bug.cgi?id=179053
2088
2089         Reviewed by Darin Adler.
2090
2091         This patch adds 'referrerpolicy' attribute support for iframe.
2092         If set, the value is restricted to the ReferrerPolicy enum, and
2093         if valid it is used for the subframe load.
2094         If not set or invalid, the current behavior is kept.
2095
2096         Tests: http/tests/referrer-policy-iframe/no-referrer-when-downgrade/cross-origin-http-http.html
2097                http/tests/referrer-policy-iframe/no-referrer-when-downgrade/cross-origin-http.https.html
2098                http/tests/referrer-policy-iframe/no-referrer-when-downgrade/same-origin.html
2099                http/tests/referrer-policy-iframe/no-referrer/cross-origin-http-http.html
2100                http/tests/referrer-policy-iframe/no-referrer/cross-origin-http.https.html
2101                http/tests/referrer-policy-iframe/no-referrer/same-origin.html
2102                http/tests/referrer-policy-iframe/origin-when-cross-origin/cross-origin-http-http.html
2103                http/tests/referrer-policy-iframe/origin-when-cross-origin/cross-origin-http.https.html
2104                http/tests/referrer-policy-iframe/origin-when-cross-origin/same-origin.html
2105                http/tests/referrer-policy-iframe/origin/cross-origin-http-http.html
2106                http/tests/referrer-policy-iframe/origin/cross-origin-http.https.html
2107                http/tests/referrer-policy-iframe/origin/same-origin.html
2108                http/tests/referrer-policy-iframe/same-origin/cross-origin-http-http.html
2109                http/tests/referrer-policy-iframe/same-origin/cross-origin-http.https.html
2110                http/tests/referrer-policy-iframe/same-origin/same-origin.html
2111                http/tests/referrer-policy-iframe/strict-origin-when-cross-origin/cross-origin-http-http.html
2112                http/tests/referrer-policy-iframe/strict-origin-when-cross-origin/cross-origin-http.https.html
2113                http/tests/referrer-policy-iframe/strict-origin-when-cross-origin/same-origin.html
2114                http/tests/referrer-policy-iframe/strict-origin/cross-origin-http-http.html
2115                http/tests/referrer-policy-iframe/strict-origin/cross-origin-http.https.html
2116                http/tests/referrer-policy-iframe/strict-origin/same-origin.html
2117                http/tests/referrer-policy-iframe/unsafe-url/cross-origin-http-http.html
2118                http/tests/referrer-policy-iframe/unsafe-url/cross-origin-http.https.html
2119                http/tests/referrer-policy-iframe/unsafe-url/same-origin.html
2120
2121         * html/HTMLAttributeNames.in:
2122         * html/HTMLFrameOwnerElement.h:
2123         (WebCore::HTMLFrameOwnerElement::referrerPolicy const):
2124         * html/HTMLIFrameElement.cpp:
2125         (WebCore::HTMLIFrameElement::setReferrerPolicyForBindings):
2126         (WebCore::HTMLIFrameElement::referrerPolicyForBindings const):
2127         (WebCore::HTMLIFrameElement::referrerPolicy const):
2128         * html/HTMLIFrameElement.h:
2129         * html/HTMLIFrameElement.idl:
2130         * loader/SubframeLoader.cpp:
2131         (WebCore::SubframeLoader::loadSubframe):
2132         * page/RuntimeEnabledFeatures.h:
2133         (WebCore::RuntimeEnabledFeatures::referrerPolicyAttributeEnabled const):
2134         (WebCore::RuntimeEnabledFeatures::setReferrerPolicyAttributeEnabled):
2135         * platform/ReferrerPolicy.cpp:
2136         (WebCore::parseReferrerPolicy):
2137         * platform/ReferrerPolicy.h:
2138
2139 2019-03-05  Takashi Komori  <Takashi.Komori@sony.com>
2140
2141         [curl] Remove unnecessary file.
2142         https://bugs.webkit.org/show_bug.cgi?id=195350
2143
2144         Reviewed by Fujii Hironori.
2145
2146         Removed unused file.
2147
2148         No new tests. No change in behavior.
2149
2150         * platform/network/curl/CookieJarCurlDatabase.cpp: Removed.
2151
2152 2019-03-05  Eric Liang  <ericliang@apple.com>
2153
2154         AX: Add remote search support for keyboard focusable element search type
2155         https://bugs.webkit.org/show_bug.cgi?id=195336
2156
2157         Reviewed by Chris Fleizach.
2158
2159         Added AXKeyboardFocusable search key to return default keyboard-focusable elements for accessibility.
2160
2161         Test: accessibility/mac/search-predicate-keyboard-focusable.html
2162
2163         * accessibility/AccessibilityObject.cpp:
2164         (WebCore::AccessibilityObject::isAccessibilityObjectSearchMatchAtIndex):
2165         (WebCore::AccessibilityObject::isKeyboardFocusable const):
2166         * accessibility/AccessibilityObject.h:
2167         * accessibility/mac/WebAccessibilityObjectWrapperBase.mm:
2168         (createAccessibilitySearchKeyMap):
2169
2170 2019-03-05  Don Olmstead  <don.olmstead@sony.com>
2171
2172         [WinCairo] Enable CSS Typed OM
2173         https://bugs.webkit.org/show_bug.cgi?id=195340
2174
2175         Reviewed by Myles C. Maxfield.
2176
2177         * bindings/js/CallTracerTypes.h:
2178
2179 2019-03-05  Sihui Liu  <sihui_liu@apple.com>
2180
2181         Fix a typo in Web SQL quirk
2182         https://bugs.webkit.org/show_bug.cgi?id=195338
2183
2184         Reviewed by Geoffrey Garen.
2185
2186         * page/Quirks.cpp:
2187         (WebCore::Quirks::hasWebSQLSupportQuirk const):
2188
2189 2019-03-05  Daniel Bates  <dabates@apple.com>
2190
2191         [iOS] Should not scroll when checkbox, radio, submit, reset, or button is spacebar activated
2192         https://bugs.webkit.org/show_bug.cgi?id=195281
2193         <rdar://problem/48564347>
2194
2195         Reviewed by Simon Fraser.
2196
2197         Do not call the base class's default event handler (HTMLTextFormControlElement::defaultEventHandler())
2198         when WebCore sees a keydown of the spacebar as we consider such an event as handled.
2199         Otherwise, calling the base class's default event handler ultimately gives the embedding
2200         client a chance to wrongly handle the event. In the case of iOS, keydown of the spacebar
2201         causes the page to scroll.
2202
2203         WebCore implements spacebar activation on keydown for form controls. For IE compatibility
2204         WebCore does not mark such keydown events as handled so that a DOM keypress event will
2205         be subsequently dispatched. The current logic only skips calling the base class's default
2206         event handler if the DOM event was not marked handled. This is insufficient. We need to
2207         know whether WebCore handled the event. If asking the input type to handle the key down
2208         marks the DOM event as handled then, clearly, WebCore handled the event. However, if the
2209         event is not marked as handled, but WebCore actually accounted for this event then we need
2210         to know this so that we do not call the base class's default event handler and ultimately
2211         the embedding client asking for an interpretation of the key event. Towards this, have
2212         InputType::handleKeydownEvent() return a bit whether or not the base class's default
2213         event handler should be invoked.
2214
2215         Tests: fast/events/ios/activating-button-should-not-scroll-page.html
2216                fast/events/ios/activating-checkbox-should-not-scroll-page.html
2217                fast/events/ios/activating-radio-button-should-not-scroll-page.html
2218                fast/events/ios/activating-reset-button-should-not-scroll-page.html
2219                fast/events/ios/activating-submit-button-should-not-scroll-page.html
2220
2221         * html/BaseCheckableInputType.cpp:
2222         (WebCore::BaseCheckableInputType::handleKeydownEvent): Return ShouldCallBaseEventHandler::No
2223         if WebCore handled the spacebar activation. Otherewise, return ShouldCallBaseEventHandler::Yes.
2224         * html/BaseCheckableInputType.h:
2225         * html/BaseChooserOnlyDateAndTimeInputType.cpp:
2226         (WebCore::BaseChooserOnlyDateAndTimeInputType::handleKeydownEvent): Ditto.
2227         * html/BaseChooserOnlyDateAndTimeInputType.h:
2228         * html/BaseClickableWithKeyInputType.cpp:
2229         (WebCore::BaseClickableWithKeyInputType::handleKeydownEvent): Keep our current behavior by returning ShouldCallBaseEventHandler::Yes.
2230         * html/BaseClickableWithKeyInputType.h:
2231         * html/HTMLInputElement.cpp:
2232         (WebCore::HTMLInputElement::defaultEventHandler): Do not fallthrough and call the base class's default
2233         event handler if the input type told us it handled the event regardless of whether the event was handled
2234         from the perspective of the DOM.
2235         * html/InputType.cpp:
2236         (WebCore::InputType::handleKeydownEvent): Keep our current behavior by returning ShouldCallBaseEventHandler::Yes.
2237         * html/InputType.h:
2238
2239         * html/NumberInputType.cpp:
2240         (WebCore::NumberInputType::handleKeydownEvent):
2241         * html/NumberInputType.h:
2242         * html/RadioInputType.cpp:
2243         (WebCore::RadioInputType::handleKeydownEvent):
2244         * html/RadioInputType.h:
2245         * html/RangeInputType.cpp:
2246         (WebCore::RangeInputType::handleKeydownEvent):
2247         * html/RangeInputType.h:
2248         * html/SearchInputType.cpp:
2249         (WebCore::SearchInputType::handleKeydownEvent):
2250         * html/SearchInputType.h:
2251         * html/TextFieldInputType.cpp:
2252         (WebCore::TextFieldInputType::handleKeydownEvent):
2253         * html/TextFieldInputType.h:
2254         Keep our current behavior by returning ShouldCallBaseEventHandler::Yes.
2255
2256 2019-03-05  Takashi Komori  <Takashi.Komori@sony.com>
2257
2258         [Curl] Implement Cookie Accept Policy.
2259         https://bugs.webkit.org/show_bug.cgi?id=191645
2260
2261         Reviewed by Fujii Hironori.
2262
2263         Make Curl network layer respect to coookie accept policy.
2264         This patch fixes tests below on TestRunner, but doesn't fix tests on DumpRenderTree.
2265
2266         Tests: http/tests/cookies/only-accept-first-party-cookies.html
2267                http/tests/cookies/third-party-cookie-relaxing.html
2268                http/tests/security/cookies/third-party-cookie-blocking-redirect.html
2269                http/tests/security/cookies/third-party-cookie-blocking-user-action.html
2270                http/tests/security/cookies/third-party-cookie-blocking-xslt.xml
2271                http/tests/security/cookies/third-party-cookie-blocking.html
2272
2273         * platform/network/curl/CookieJarCurl.cpp:
2274         (WebCore::cookiesForSession):
2275         (WebCore::CookieJarCurl::setCookiesFromDOM const):
2276         (WebCore::CookieJarCurl::setCookiesFromHTTPResponse const):
2277         (WebCore::CookieJarCurl::setCookieAcceptPolicy const):
2278         (WebCore::CookieJarCurl::cookieAcceptPolicy const):
2279         (WebCore::CookieJarCurl::getRawCookies const):
2280         * platform/network/curl/CookieJarCurl.h:
2281         * platform/network/curl/CookieJarDB.cpp:
2282         (WebCore::CookieJarDB::openDatabase):
2283         (WebCore::CookieJarDB::isEnabled const):
2284         (WebCore::CookieJarDB::checkCookieAcceptPolicy):
2285         (WebCore::CookieJarDB::hasCookies):
2286         (WebCore::CookieJarDB::searchCookies):
2287         (WebCore::CookieJarDB::canAcceptCookie):
2288         (WebCore::CookieJarDB::setCookie):
2289         (WebCore::CookieJarDB::setEnabled): Deleted.
2290         * platform/network/curl/CookieJarDB.h:
2291         (WebCore::CookieJarDB::setAcceptPolicy):
2292         (WebCore::CookieJarDB::acceptPolicy const):
2293         * platform/network/curl/CookieUtil.cpp:
2294         (WebCore::CookieUtil::parseCookieAttributes):
2295         (WebCore::CookieUtil::parseCookieHeader):
2296         * platform/network/curl/CurlResourceHandleDelegate.cpp:
2297         (WebCore::handleCookieHeaders):
2298         (WebCore::CurlResourceHandleDelegate::curlDidReceiveResponse):
2299
2300 2019-03-05  Zalan Bujtas  <zalan@apple.com>
2301
2302         [ContentChangeObserver] Assert on if notify content change is allowed
2303         https://bugs.webkit.org/show_bug.cgi?id=195332
2304         <rdar://problem/48603276>
2305
2306         Reviewed by Simon Fraser.
2307
2308         Assert we don't notify the client about the state change while in handleSyntheticClick().
2309
2310         * page/ios/ContentChangeObserver.cpp:
2311         (WebCore::ContentChangeObserver::domTimerExecuteDidStart):
2312         (WebCore::ContentChangeObserver::domTimerExecuteDidFinish):
2313         (WebCore::ContentChangeObserver::adjustObservedState):
2314         * page/ios/ContentChangeObserver.h:
2315         (WebCore::ContentChangeObserver::isObservingContentChanges const):
2316         (WebCore::ContentChangeObserver::isNotifyContentChangeAllowed const):
2317
2318 2019-03-05  Said Abou-Hallawa  <sabouhallawa@apple.com>
2319
2320         SVGPathSegList.insertItemBefore() should fail if the newItem belongs to an animating animPathSegList
2321         https://bugs.webkit.org/show_bug.cgi?id=195333
2322         <rdar://problem/48475802>
2323
2324         Reviewed by Simon Fraser.
2325
2326         Because the SVG1.1 specs states that the newItem should be removed from
2327         its original list before adding it to another list,
2328         SVGPathSegList.insertItemBefore() should fail if the new item belongs to
2329         an animating animPathSegList since it is read-only.
2330
2331         Test: svg/dom/SVGPathSegList-insert-from-animating-animPathSegList.svg
2332
2333         * svg/SVGPathSegList.cpp:
2334         (WebCore::SVGPathSegList::processIncomingListItemValue):
2335
2336 2019-03-05  Zalan Bujtas  <zalan@apple.com>
2337
2338         [ContentChangeObserver] Send content change notification through adjustObservedState
2339         https://bugs.webkit.org/show_bug.cgi?id=195328
2340         <rdar://problem/48601143>
2341
2342         Reviewed by Simon Fraser.
2343
2344         Have a dedicated place for the notification logic.
2345
2346         * page/ios/ContentChangeObserver.cpp:
2347         (WebCore::ContentChangeObserver::stopDurationBasedContentObservation):
2348         (WebCore::ContentChangeObserver::didInstallDOMTimer):
2349         (WebCore::ContentChangeObserver::didRemoveDOMTimer):
2350         (WebCore::ContentChangeObserver::domTimerExecuteDidFinish):
2351         (WebCore::ContentChangeObserver::styleRecalcDidFinish):
2352         (WebCore::ContentChangeObserver::mouseMovedDidStart):
2353         (WebCore::ContentChangeObserver::adjustObservedState):
2354         (WebCore::ContentChangeObserver::registerDOMTimer): Deleted.
2355         (WebCore::ContentChangeObserver::unregisterDOMTimer): Deleted.
2356         (WebCore::ContentChangeObserver::notifyContentChangeIfNeeded): Deleted.
2357         * page/ios/ContentChangeObserver.h:
2358         (WebCore::ContentChangeObserver::registerDOMTimer):
2359         (WebCore::ContentChangeObserver::unregisterDOMTimer):
2360
2361 2019-03-05  Youenn Fablet  <youenn@apple.com>
2362
2363         MockLibWebRTCPeerConnection is leaking some session description
2364         https://bugs.webkit.org/show_bug.cgi?id=195315
2365         <rdar://problem/47840038>
2366
2367         Reviewed by David Kilzer.
2368
2369         Make sure to release raw pointers given from WebCore to mock libwebrtc layer.
2370         Covered by existing tests when run in leaks mode.
2371
2372         * testing/MockLibWebRTCPeerConnection.cpp:
2373         (WebCore::MockLibWebRTCPeerConnection::SetLocalDescription):
2374         (WebCore::MockLibWebRTCPeerConnection::SetRemoteDescription):
2375
2376 2019-03-05  Ryan Haddad  <ryanhaddad@apple.com>
2377
2378         Unreviewed, rolling out r242403.
2379
2380         Caused layout test crashes on iOS simulator.
2381
2382         Reverted changeset:
2383
2384         "[ContentChangeObserver] Introduce fixed duration content
2385         observation"
2386         https://bugs.webkit.org/show_bug.cgi?id=195295
2387         https://trac.webkit.org/changeset/242403
2388
2389 2019-03-05  Frederic Wang  <fwang@igalia.com>
2390
2391         Web Inspector: Better categorize CPU usage per-thread / worker
2392         https://bugs.webkit.org/show_bug.cgi?id=194564
2393
2394         Unreviewed compilation fix.
2395
2396         * page/ResourceUsageData.h: Add missing headers.
2397
2398 2019-03-05  Frederic Wang  <fwang@igalia.com>
2399
2400         Share more code for updating the state of frame scrolling nodes
2401         https://bugs.webkit.org/show_bug.cgi?id=195254
2402
2403         Unreviewed compilation warning fix.
2404
2405         * page/scrolling/AsyncScrollingCoordinator.cpp:
2406         (WebCore::AsyncScrollingCoordinator::frameViewLayoutUpdated): Add UNUSED_PARAM on non-Cocoa
2407         platforms.
2408
2409 2019-03-05  Cathie Chen  <cathiechen@igalia.com>
2410
2411         The include file in ScrollingStateFrameHostingNode.h is wrong.
2412         https://bugs.webkit.org/show_bug.cgi?id=195280
2413
2414         Reviewed by Frédéric Wang.
2415
2416         * page/scrolling/ScrollingStateFrameHostingNode.h:
2417
2418 2019-03-04  Justin Fan  <justin_fan@apple.com>
2419
2420         Unreviewed build fix for High Sierra.
2421
2422         * platform/graphics/gpu/cocoa/GPUBufferMetal.mm: Should fix "global constructor" error.
2423
2424 2019-03-04  Brent Fulgham  <bfulgham@apple.com>
2425
2426         Use a SQLite database to hold the ResourceLoadStatistics data
2427         https://bugs.webkit.org/show_bug.cgi?id=194867
2428         <rdar://problem/24240854>
2429
2430         Reviewed by Chris Dumez.
2431
2432         Add a new runtime feature flag to support use of an experimental database
2433         back-end. Also expose some SQLite function calls for use outside of WebCore.
2434
2435         No change in functionality, so no new tests.
2436
2437         * page/RuntimeEnabledFeatures.h:
2438         (WebCore::RuntimeEnabledFeatures::setItpDatabaseModeEnabled):
2439         (WebCore::RuntimeEnabledFeatures::itpDatabaseModeEnabled const):
2440         * platform/sql/SQLiteDatabase.h:
2441         * platform/sql/SQLiteStatement.h:
2442
2443 2019-03-04  Justin Fan  <justin_fan@apple.com>
2444
2445         [Web GPU] Blitting function prototypes
2446         https://bugs.webkit.org/show_bug.cgi?id=195224
2447         <rdar://problem/48538902>
2448
2449         Reviewed by Dean Jackson.
2450
2451         Implement barebones GPUCommandBuffer::copy* prototypes while rounding out GPUTexture implementation details.
2452
2453         Test: webgpu/blit-commands.html
2454
2455         * Modules/webgpu/GPUOrigin3D.h: Added.
2456         * Modules/webgpu/GPUOrigin3D.idl: Added.
2457         * Modules/webgpu/WebGPUCommandBuffer.cpp: Add copy view struct implementations.
2458         (WebCore::WebGPUBufferCopyView::asGPUBufferCopyView const): Added.
2459         (WebCore::WebGPUTextureCopyView::asGPUTextureCopyView const): Added.
2460         (WebCore::WebGPUCommandBuffer::copyBufferToBuffer): Added.
2461         (WebCore::WebGPUCommandBuffer::copyBufferToTexture): Added.
2462         (WebCore::WebGPUCommandBuffer::copyTextureToBuffer): Added.
2463         (WebCore::WebGPUCommandBuffer::copyTextureToTexture): Added.
2464         * Modules/webgpu/WebGPUCommandBuffer.h: Add new functions and supporting structs.
2465         * Modules/webgpu/WebGPUCommandBuffer.idl: Ditto.
2466         * Modules/webgpu/WebGPURenderPassDescriptor.cpp: Refactor constructors to copy the entire base class.
2467         (WebCore::GPURenderPassColorAttachmentDescriptor::GPURenderPassColorAttachmentDescriptor):
2468         (WebCore::GPURenderPassDepthStencilAttachmentDescriptor::GPURenderPassDepthStencilAttachmentDescriptor):
2469         (WebCore::WebGPURenderPassDescriptor::asGPURenderPassDescriptor const):
2470         (WebCore::attachment): Deleted.
2471         * Modules/webgpu/WebGPUTexture.h:
2472         (WebCore::WebGPUTexture::texture const): Added.
2473         * platform/graphics/gpu/GPUBuffer.h:
2474         (WebCore::GPUBuffer::byteLength const): Added.
2475         (WebCore::GPUBuffer::isTransferSource const): Added.
2476         (WebCore::GPUBuffer::isTransferDestination const): Renamed from isTransferDst. Refactored for OptionSet API.
2477         (WebCore::GPUBuffer::isVertex const): Ditto.
2478         (WebCore::GPUBuffer::isUniform const): Ditto.
2479         (WebCore::GPUBuffer::isStorage const): Ditto.
2480         (WebCore::GPUBuffer::isMappable const): Ditto.
2481         (WebCore::GPUBuffer::isMapWrite const): Ditto.
2482         (WebCore::GPUBuffer::isMapRead const): Ditto.
2483         * platform/graphics/gpu/GPUBufferUsage.h: Refactored for better bit flag style.
2484         * platform/graphics/gpu/GPUCommandBuffer.h:
2485         (WebCore::GPUCommandBuffer::blitEncoder const): Added.
2486         * platform/graphics/gpu/GPURenderPassDescriptor.h: 
2487         * platform/graphics/gpu/GPUTexture.h: Cache usage flags for reference.
2488         (WebCore::GPUTexture::isTransferSrc const): Added.
2489         (WebCore::GPUTexture::isTransferDst const): Added.
2490         (WebCore::GPUTexture::isOutputAttachment const): Added.
2491         * platform/graphics/gpu/GPUTextureUsage.h: Refactor to match GPUBufferUsage.h.
2492         * platform/graphics/gpu/cocoa/GPUBufferMetal.mm:
2493         (WebCore::GPUBuffer::validateBufferUsage): Renamed from validateBufferCreate, refactored for OptionSet.
2494         (WebCore::GPUBuffer::tryCreate):
2495         (WebCore::GPUBuffer::GPUBuffer):
2496         (WebCore::GPUBuffer::isReadOnly const):
2497         (WebCore::GPUBuffer::setSubData): Add alignment check according to Metal docs.
2498         * platform/graphics/gpu/cocoa/GPUCommandBufferMetal.mm: 
2499         (WebCore::GPUCommandBuffer::create): No need to use this alias here.
2500         (WebCore::GPUCommandBuffer::GPUCommandBuffer): Ditto.
2501         (WebCore::GPUCommandBuffer::copyBufferToBuffer): Added.
2502         (WebCore::GPUCommandBuffer::copyBufferToTexture): Added.
2503         (WebCore::GPUCommandBuffer::copyTextureToBuffer): Added. 
2504         (WebCore::GPUCommandBuffer::copyTextureToTexture): Added. 
2505         * platform/graphics/gpu/cocoa/GPUQueueMetal.mm:
2506         (WebCore::GPUQueue::submit): End encoding on the MTLCommandBuffer's blitCommandEncoder if it was used.
2507         * platform/graphics/gpu/cocoa/GPUSwapChainMetal.mm:
2508         (WebCore::GPUSwapChain::getNextTexture): Now provide usage flags to texture creation.
2509         * platform/graphics/gpu/cocoa/GPUTextureMetal.mm:
2510         (WebCore::mtlTextureUsageForGPUTextureUsageFlags): Refactor validation.
2511         (WebCore::tryCreateMtlTextureDescriptor): Ditto.
2512         (WebCore::GPUTexture::tryCreate): Now provide usage flags to texture creation.
2513         (WebCore::GPUTexture::create): Ditto.
2514         (WebCore::GPUTexture::GPUTexture): Ditto.
2515         (WebCore::GPUTexture::createDefaultTextureView): Ditto.
2516
2517 2019-03-04  Zalan Bujtas  <zalan@apple.com>
2518
2519         [ContentChangeObserver] Introduce fixed duration content observation
2520         https://bugs.webkit.org/show_bug.cgi?id=195295
2521         <rdar://problem/48579913>
2522
2523         Reviewed by Simon Fraser.
2524
2525         Some pages have a runloop-like scheduling setup where the content triggering change happens at a nested timer firing.
2526         This patch helps finding cases like that using a 32ms long fixed window. Currently nested timers get dropped on the floor and
2527         we stop observing for content changes before they even get fired.
2528
2529         Test: fast/events/touch/ios/visibility-change-happens-on-timer-hops.html
2530
2531         * page/ios/ContentChangeObserver.cpp:
2532         (WebCore::ContentChangeObserver::ContentChangeObserver):
2533         (WebCore::ContentChangeObserver::startContentObservationForDuration):
2534         (WebCore::ContentChangeObserver::stopDurationBasedContentObservation):
2535         (WebCore::ContentChangeObserver::hasDeterminateState const):
2536         (WebCore::ContentChangeObserver::adjustObservedState):
2537         * page/ios/ContentChangeObserver.h:
2538         (WebCore::ContentChangeObserver::isObservingContentChanges const):
2539         (WebCore::ContentChangeObserver::hasPendingActivity const):
2540
2541 2019-03-04  Wenson Hsieh  <wenson_hsieh@apple.com>
2542
2543         Native text selection UI is incorrectly suppressed in Microsoft Visio
2544         https://bugs.webkit.org/show_bug.cgi?id=195178
2545         <rdar://problem/48519394>
2546
2547         Reviewed by Darin Adler.
2548
2549         Currently, our heuristics for detecting hidden editable areas attempt to search for empty parent renderers with
2550         "overflow: hidden". It does this by ascending the layer tree in search of renderers that have an empty content
2551         size, and whose renderers' styles indicate that they have overflow: hidden in the X or Y directions. This fails
2552         in the case where a child renderer is positioned out of flow, relative to one of its parent layers, since the
2553         child will be visible, but we'll incorrectly believe that it is hidden. This leads to selection UI unexpectedly
2554         disappearing in the online version of Microsoft Visio.
2555
2556         To fix this, we check whether the enclosing layer around the editable element has an empty clip rect; if the
2557         element is inside of a subframe, we additionally walk up to each enclosing frame's layer and check if that
2558         frame's layer has an empty clip rect.
2559
2560         Test: editing/selection/ios/do-not-hide-selection-in-visible-container.html
2561
2562         * rendering/RenderObject.cpp:
2563         (WebCore::RenderObject::isTransparentOrFullyClippedRespectingParentFrames const):
2564
2565 2019-03-01  Ryosuke Niwa  <rniwa@webkit.org>
2566
2567         gPictureOwnerMap is unnecessary
2568         https://bugs.webkit.org/show_bug.cgi?id=195228
2569
2570         Reviewed by Zalan Bujtas.
2571
2572         Just store in HTMLImageElement. An extra pointer isn't going to affect the memory use here.
2573         If anything, we should worry about m_editableImage and m_pendingClonedAttachmentID instead.
2574
2575         * html/HTMLImageElement.cpp:
2576         (WebCore::HTMLImageElement::pictureElement const):
2577         (WebCore::HTMLImageElement::setPictureElement):
2578         * html/HTMLImageElement.h:
2579
2580 2019-03-04  Daniel Bates  <dabates@apple.com>
2581
2582         [iOS] Caret x-position in empty text area does not match text field
2583         https://bugs.webkit.org/show_bug.cgi?id=195125
2584         <rdar://problem/47161070>
2585
2586         Remove the word "use" in the added comment to make it read well.
2587
2588         * css/html.css:
2589         (textarea):
2590
2591 2019-03-04  Joseph Pecoraro  <pecoraro@apple.com>
2592
2593         ITMLKit Inspector: Data Bindings / Associated Data for nodes
2594         https://bugs.webkit.org/show_bug.cgi?id=195290
2595         <rdar://problem/48304019>
2596
2597         Reviewed by Devin Rousso.
2598
2599         * inspector/agents/InspectorDOMAgent.h:
2600         * inspector/agents/InspectorDOMAgent.cpp:
2601         (WebCore::InspectorDOMAgent::getDataBindingsForNode):
2602         (WebCore::InspectorDOMAgent::getAssociatedDataForNode):
2603         Stub these for web pages, they will only be used for ITMLKit right now.
2604
2605 2019-03-04  Daniel Bates  <dabates@apple.com>
2606
2607         [iOS] Caret x-position in empty text area does not match text field
2608         https://bugs.webkit.org/show_bug.cgi?id=195125
2609         <rdar://problem/47161070>
2610
2611         Reviewed by Darin Adler.
2612
2613         Fix up User Agent styles for <textarea> on iOS such that they have the same left padding
2614         width and same text-indent as <input type="text">. This makes the x-position of the caret
2615         in an empty textarea match the position of the caret in an empty text field.
2616
2617         Test: fast/forms/textarea/ios/caret-x-position-in-textarea-matches-textfield.html
2618
2619         * css/html.css:
2620         (textarea): For iOS Family, do not use the padding shorthand property. Instead explicitly specify
2621         padding-top and padding-bottom to be 2px to keep our current behavior (because it looks reasonable)
2622         and do not specify left and right padding so that we inherit the padding set earlier in this file.
2623         (textarea::placeholder): Deleted. This was added to "try" to make fix up the position of the placeholder
2624         text so as to match the position of the textarea's inner text and the position of a text field's inner
2625         text. This fix up may have worked out visually when it was added, but based on the discovery of the
2626         hardcoded 3px left and right padding (see below remark) it looks like it was always one pixel too short.
2627         * html/HTMLTextAreaElement.cpp:
2628         (WebCore::HTMLTextAreaElement::createInnerTextStyle): Remove hardcoded 3px left and right padding.
2629
2630 2019-03-04  Youenn Fablet  <youenn@apple.com>
2631
2632         Make sure to correctly notify of end of a ServiceWorkerJob when the context is stopped
2633         https://bugs.webkit.org/show_bug.cgi?id=195195
2634
2635         Reviewed by Chris Dumez.
2636
2637         Before the patch, we were notifying that some jobs were finished too aggressively at context stop time.
2638         This was confusing the Network Process.
2639         Only notify such jobs that have pending loads.
2640         Improve the tracking of jobs doing registration resolution to ensure the Network Process gets notified
2641         in case of a registration promise being resolved but the settling callback being not yet called while the context is stopped.
2642
2643         Covered by existing tests not crashing anymore, in particular imported/w3c/web-platform-tests/service-workers/service-worker/skip-waiting.https.html.
2644
2645         * workers/service/ServiceWorkerContainer.cpp:
2646         (WebCore::ServiceWorkerContainer::jobResolvedWithRegistration):
2647         (WebCore::ServiceWorkerContainer::notifyRegistrationIsSettled):
2648         (WebCore::ServiceWorkerContainer::stop):
2649         * workers/service/ServiceWorkerContainer.h:
2650         * workers/service/ServiceWorkerJob.cpp:
2651         (WebCore::ServiceWorkerJob::cancelPendingLoad):
2652         * workers/service/ServiceWorkerJob.h:
2653         (WebCore::ServiceWorkerJob::isLoading const):
2654
2655 2019-03-04  Chris Dumez  <cdumez@apple.com>
2656
2657         [iOS] Improve our file picker
2658         https://bugs.webkit.org/show_bug.cgi?id=195284
2659         <rdar://problem/45655856>
2660
2661         Reviewed by Tim Horton and Wenson Hsieh.
2662
2663         Export UTIUtilities.h so that it can be used from WebKit2.
2664
2665         * WebCore.xcodeproj/project.pbxproj:
2666
2667 2019-03-04  Zalan Bujtas  <zalan@apple.com>
2668
2669         [ContentChangeObserver] Decouple mouseMoved event and the "is observing content change" status.
2670         https://bugs.webkit.org/show_bug.cgi?id=195286
2671
2672         Reviewed by Simon Fraser.
2673
2674         Now isObservingContentChanges returns true only when we are actively observing content change during timer firing and/or style recalculating.
2675         This patch also renames a couple of functions to follow the didStart/didFinish pattern.
2676
2677         * page/ios/ContentChangeObserver.cpp:
2678         (WebCore::ContentChangeObserver::domTimerExecuteDidStart):
2679         (WebCore::ContentChangeObserver::domTimerExecuteDidFinish):
2680         (WebCore::ContentChangeObserver::styleRecalcDidStart):
2681         (WebCore::ContentChangeObserver::styleRecalcDidFinish):
2682         (WebCore::ContentChangeObserver::mouseMovedDidStart):
2683         (WebCore::ContentChangeObserver::mouseMovedDidFinish):
2684         (WebCore::ContentChangeObserver::setShouldObserveNextStyleRecalc):
2685         (WebCore::ContentChangeObserver::StyleChangeScope::StyleChangeScope):
2686         (WebCore::ContentChangeObserver::MouseMovedScope::MouseMovedScope):
2687         (WebCore::ContentChangeObserver::MouseMovedScope::~MouseMovedScope):
2688         (WebCore::ContentChangeObserver::StyleRecalcScope::StyleRecalcScope):
2689         (WebCore::ContentChangeObserver::StyleRecalcScope::~StyleRecalcScope):
2690         (WebCore::ContentChangeObserver::DOMTimerScope::DOMTimerScope):
2691         (WebCore::ContentChangeObserver::DOMTimerScope::~DOMTimerScope):
2692         (WebCore::ContentChangeObserver::startObservingDOMTimerExecute): Deleted.
2693         (WebCore::ContentChangeObserver::stopObservingDOMTimerExecute): Deleted.
2694         (WebCore::ContentChangeObserver::startObservingStyleRecalc): Deleted.
2695         (WebCore::ContentChangeObserver::stopObservingStyleRecalc): Deleted.
2696         (WebCore::ContentChangeObserver::startObservingMouseMoved): Deleted.
2697         (WebCore::ContentChangeObserver::stopObservingMouseMoved): Deleted.
2698         (WebCore::ContentChangeObserver::setShouldObserveStyleRecalc): Deleted.
2699         * page/ios/ContentChangeObserver.h:
2700         (WebCore::ContentChangeObserver::setShouldObserveDOMTimerScheduling):
2701         (WebCore::ContentChangeObserver::isObservingDOMTimerScheduling const):
2702         (WebCore::ContentChangeObserver::isObservingStyleRecalc const):
2703         (WebCore::ContentChangeObserver::isObservingContentChanges const):
2704         (WebCore::ContentChangeObserver::startObservingDOMTimerScheduling): Deleted.
2705         (WebCore::ContentChangeObserver::stopObservingDOMTimerScheduling): Deleted.
2706         (WebCore::ContentChangeObserver::shouldObserveStyleRecalc const): Deleted.
2707
2708 2019-03-04  Yusuke Suzuki  <ysuzuki@apple.com>
2709
2710         [JSC] Offer @makeTypeError instead of exposing @TypeError
2711         https://bugs.webkit.org/show_bug.cgi?id=193858
2712
2713         Reviewed by Mark Lam.
2714
2715         Use @makeTypeError instead.
2716
2717         * Modules/mediastream/RTCPeerConnection.js:
2718         * Modules/mediastream/RTCPeerConnectionInternals.js:
2719         * Modules/streams/ReadableByteStreamInternals.js:
2720         (readableByteStreamControllerClose):
2721         (readableByteStreamControllerPullInto):
2722         * Modules/streams/ReadableStream.js:
2723         (cancel):
2724         (pipeTo):
2725         * Modules/streams/ReadableStreamBYOBReader.js:
2726         (cancel):
2727         (read):
2728         * Modules/streams/ReadableStreamDefaultReader.js:
2729         (cancel):
2730         (read):
2731         * Modules/streams/ReadableStreamInternals.js:
2732         (readableStreamReaderGenericRelease):
2733         * Modules/streams/WritableStream.js:
2734         (abort):
2735         (close):
2736         (write):
2737         (getter.closed):
2738         (getter.ready):
2739
2740 2019-03-04  Simon Fraser  <simon.fraser@apple.com>
2741
2742         Share more code between overflow and frame scrolling nodes, fixing overflow scrollbar display
2743         https://bugs.webkit.org/show_bug.cgi?id=195258
2744
2745         Reviewed by Antti Koivisto.
2746
2747         This patch moves management of scrollbar layers and scrollbar painters ("NSScrollerImp") down to
2748         ScrollingStateScrollingNode to be shared between frame and overflow nodes, allowing for
2749         scrolling thread updates of overflow scrollbars. It also moves some scrolling tree-side code
2750         to ScrollingTreeScrollingNodeDelegateMac to be shared between the "tree" nodes for overflow and frames.
2751
2752         Layers for scrollbars are given to scrolling state nodes via setNodeLayers() now, and
2753         RenderLayerCompositor::updateScrollingNodeLayers() is added to provide a bottleneck to call that.
2754         At some point AsyncScrollingCoordinator::scrollableAreaScrollbarLayerDidChange() should be relieved
2755         of the responsibility of pushing scrollbar layers (but the scrolling state tree needs to hold
2756         references to GraphicsLayers before that becomes safe).
2757         
2758         The actual fix that allows overflow scrollbars to show is the change in
2759         AsyncScrollingCoordinator::scrollableAreaScrollbarLayerDidChange() that calls scrollableArea.*ScrollbarLayerDidChange()
2760         for all ScrollableAreas. This ensures that the CALayer is pushed onto the NSScrollerImp.
2761
2762         * SourcesCocoa.txt:
2763         * WebCore.xcodeproj/project.pbxproj:
2764         * page/scrolling/AsyncScrollingCoordinator.cpp:
2765         (WebCore::AsyncScrollingCoordinator::scrollableAreaScrollbarLayerDidChange):
2766         (WebCore::AsyncScrollingCoordinator::setNodeLayers):
2767         (WebCore::AsyncScrollingCoordinator::setFrameScrollingNodeState):
2768         (WebCore::AsyncScrollingCoordinator::setScrollingNodeScrollableAreaGeometry):
2769         * page/scrolling/ScrollingCoordinator.h:
2770         * page/scrolling/ScrollingStateFrameScrollingNode.cpp:
2771         (WebCore::ScrollingStateFrameScrollingNode::ScrollingStateFrameScrollingNode):
2772         (WebCore::ScrollingStateFrameScrollingNode::setAllPropertiesChanged):
2773         (WebCore::ScrollingStateFrameScrollingNode::setVerticalScrollbarLayer): Deleted.
2774         (WebCore::ScrollingStateFrameScrollingNode::setHorizontalScrollbarLayer): Deleted.
2775         (WebCore::ScrollingStateFrameScrollingNode::setScrollerImpsFromScrollbars): Deleted.
2776         * page/scrolling/ScrollingStateFrameScrollingNode.h:
2777         * page/scrolling/ScrollingStateScrollingNode.cpp:
2778         (WebCore::ScrollingStateScrollingNode::ScrollingStateScrollingNode):
2779         (WebCore::ScrollingStateScrollingNode::setAllPropertiesChanged):
2780         (WebCore::ScrollingStateScrollingNode::setHorizontalScrollbarLayer):
2781         (WebCore::ScrollingStateScrollingNode::setVerticalScrollbarLayer):
2782         (WebCore::ScrollingStateScrollingNode::setScrollerImpsFromScrollbars):
2783         * page/scrolling/ScrollingStateScrollingNode.h:
2784         (WebCore::ScrollingStateScrollingNode::horizontalScrollbarLayer const):
2785         (WebCore::ScrollingStateScrollingNode::verticalScrollbarLayer const):
2786         (WebCore::ScrollingStateScrollingNode::verticalScrollerImp const):
2787         (WebCore::ScrollingStateScrollingNode::horizontalScrollerImp const):
2788         * page/scrolling/ScrollingTree.cpp:
2789         (WebCore::ScrollingTree::setOrClearLatchedNode):
2790         (WebCore::ScrollingTree::handleWheelEvent):
2791         * page/scrolling/mac/ScrollingStateScrollingNodeMac.mm: Renamed from Source/WebCore/page/scrolling/mac/ScrollingStateFrameScrollingNodeMac.mm.
2792         (WebCore::ScrollingStateScrollingNode::setScrollerImpsFromScrollbars):
2793         * page/scrolling/mac/ScrollingTreeFrameScrollingNodeMac.h:
2794         * page/scrolling/mac/ScrollingTreeFrameScrollingNodeMac.mm:
2795         (WebCore::ScrollingTreeFrameScrollingNodeMac::commitStateBeforeChildren):
2796         (WebCore::ScrollingTreeFrameScrollingNodeMac::handleWheelEvent):
2797         (WebCore::ScrollingTreeFrameScrollingNodeMac::repositionRelatedLayers):
2798         (WebCore::ScrollingTreeFrameScrollingNodeMac::~ScrollingTreeFrameScrollingNodeMac): Deleted.
2799         (WebCore::ScrollingTreeFrameScrollingNodeMac::releaseReferencesToScrollerImpsOnTheMainThread): Deleted.
2800         * page/scrolling/mac/ScrollingTreeOverflowScrollingNodeMac.h:
2801         * page/scrolling/mac/ScrollingTreeOverflowScrollingNodeMac.mm:
2802         (WebCore::ScrollingTreeOverflowScrollingNodeMac::commitStateBeforeChildren):
2803         (WebCore::ScrollingTreeOverflowScrollingNodeMac::handleWheelEvent):
2804         (WebCore::ScrollingTreeOverflowScrollingNodeMac::repositionRelatedLayers):
2805         * page/scrolling/mac/ScrollingTreeScrollingNodeDelegateMac.h:
2806         * page/scrolling/mac/ScrollingTreeScrollingNodeDelegateMac.mm:
2807         (WebCore::ScrollingTreeScrollingNodeDelegateMac::~ScrollingTreeScrollingNodeDelegateMac):
2808         (WebCore::ScrollingTreeScrollingNodeDelegateMac::updateFromStateNode):
2809         (WebCore::ScrollingTreeScrollingNodeDelegateMac::handleWheelEvent):
2810         (WebCore::ScrollingTreeScrollingNodeDelegateMac::updateScrollbarPainters):
2811         (WebCore::ScrollingTreeScrollingNodeDelegateMac::releaseReferencesToScrollerImpsOnTheMainThread):
2812         * platform/ScrollbarThemeComposite.h:
2813         * rendering/RenderLayerCompositor.cpp:
2814         (WebCore::RenderLayerCompositor::didChangePlatformLayerForLayer):
2815         (WebCore::RenderLayerCompositor::updateScrollingNodeLayers):
2816         (WebCore::RenderLayerCompositor::updateScrollingNodeForScrollingRole):
2817         * rendering/RenderLayerCompositor.h:
2818
2819 2019-03-04  Jer Noble  <jer.noble@apple.com>
2820
2821         Remove HEVC as a codec requiring hardware support.
2822         https://bugs.webkit.org/show_bug.cgi?id=194960
2823         <rdar://problem/47741432>
2824
2825         Reviewed by Eric Carlson.
2826
2827         * page/cocoa/SettingsBaseCocoa.mm:
2828         (WebCore::SettingsBase::defaultMediaContentTypesRequiringHardwareSupport):
2829
2830 2019-03-04  Jer Noble  <jer.noble@apple.com>
2831
2832         [iOS] Fullscreen "stay in page" option breaks video playback
2833         https://bugs.webkit.org/show_bug.cgi?id=195277
2834         <rdar://problem/48537317>
2835
2836         Reviewed by Eric Carlson.
2837
2838         Add a LOG entry when playback is rejected due to media playback suspension.
2839
2840         * html/MediaElementSession.cpp:
2841         (WebCore::MediaElementSession::playbackPermitted const):
2842
2843 2019-03-04  Tim Horton  <timothy_horton@apple.com>
2844
2845         Fix the build.
2846
2847         * dom/Document.h:
2848
2849 2019-03-03  Zalan Bujtas  <zalan@apple.com>
2850
2851         [ContentChangeObserver] Content observation should be limited to the current document.
2852         https://bugs.webkit.org/show_bug.cgi?id=195256
2853         <rdar://problem/48544402>
2854
2855         Move ContentChangeObserver from Page to Document.
2856         It limits content observation to the target node's owner document.
2857
2858         Reviewed by Simon Fraser.
2859
2860         * dom/Document.cpp:
2861         (WebCore::m_contentChangeObserver):
2862         (WebCore::Document::updateStyleIfNeeded):
2863         (WebCore::Document::willDetachPage):
2864         (WebCore::Document::platformSuspendOrStopActiveDOMObjects):
2865         (WebCore::m_undoManager): Deleted.
2866         * dom/Document.h:
2867         (WebCore::Document::contentChangeObserver):
2868         * page/DOMTimer.cpp:
2869         (WebCore::DOMTimer::install):
2870         (WebCore::DOMTimer::removeById):
2871         (WebCore::DOMTimer::fired):
2872         * page/Frame.cpp:
2873         (WebCore::Frame::willDetachPage):
2874         * page/Page.cpp:
2875         (WebCore::Page::Page):
2876         * page/Page.h:
2877         (WebCore::Page::pointerLockController const):
2878         (WebCore::Page::contentChangeObserver): Deleted.
2879         * page/ios/ContentChangeObserver.cpp:
2880         (WebCore::ContentChangeObserver::ContentChangeObserver):
2881         (WebCore::ContentChangeObserver::didInstallDOMTimer):
2882         (WebCore::ContentChangeObserver::stopObservingDOMTimerExecute):
2883         (WebCore::ContentChangeObserver::stopObservingStyleRecalc):
2884         (WebCore::ContentChangeObserver::clearTimersAndReportContentChange):
2885         (WebCore::ContentChangeObserver::startObservingMouseMoved):
2886         (WebCore::ContentChangeObserver::hasDeterminateState const):
2887         (WebCore::ContentChangeObserver::adjustObservedState):
2888         (WebCore::ContentChangeObserver::notifyContentChangeIfNeeded):
2889         (WebCore::ContentChangeObserver::StyleChangeScope::StyleChangeScope):
2890         (WebCore::ContentChangeObserver::StyleChangeScope::~StyleChangeScope):
2891         (WebCore::ContentChangeObserver::MouseMovedScope::MouseMovedScope):
2892         (WebCore::ContentChangeObserver::MouseMovedScope::~MouseMovedScope):
2893         (WebCore::ContentChangeObserver::StyleRecalcScope::StyleRecalcScope):
2894         (WebCore::ContentChangeObserver::StyleRecalcScope::~StyleRecalcScope):
2895         (WebCore::ContentChangeObserver::DOMTimerScope::DOMTimerScope):
2896         (WebCore::ContentChangeObserver::DOMTimerScope::~DOMTimerScope):
2897         (WebCore::hasPendingStyleRecalc): Deleted.
2898         * page/ios/ContentChangeObserver.h:
2899         * page/ios/EventHandlerIOS.mm:
2900         (WebCore::EventHandler::mouseMoved):
2901         * rendering/updating/RenderTreeUpdater.cpp:
2902         (WebCore::RenderTreeUpdater::updateElementRenderer):
2903
2904 2019-03-02  Simon Fraser  <simon.fraser@apple.com>
2905
2906         Share more code for updating the state of frame scrolling nodes
2907         https://bugs.webkit.org/show_bug.cgi?id=195254
2908
2909         Reviewed by Antti Koivisto.
2910
2911         Responsibility for updating state on ScrollingStateFrameScrolling nodes was split between
2912         AsyncScrollingCoordinator::frameViewLayoutUpdated(), which is called post-layout, and
2913         RenderLayerCompositor. This patch gives that responsibility entirely to RenderLayerCompositor,
2914         ensuring that we update frame scrolling nodes at the same time as the rest of the scrolling
2915         state tree.
2916         
2917         We also share code between updating ScrollingStateFrameScrollingNodes and
2918         ScrollingStateOverflowScrollingNodews, since both can be updated from a ScrollableArea.
2919         Some minor cleanup of ScrollableArea is doing to help. For the first time, we're pushing
2920         ScrollableAreaParameters for overflow scrolling nodes, allowing rubber-banding to work
2921         on macOS.
2922
2923         * page/scrolling/AsyncScrollingCoordinator.cpp:
2924         (WebCore::AsyncScrollingCoordinator::frameViewLayoutUpdated):
2925         (WebCore::AsyncScrollingCoordinator::setRectRelativeToParentNode):
2926         (WebCore::AsyncScrollingCoordinator::setFrameScrollingNodeState):
2927         (WebCore::AsyncScrollingCoordinator::setScrollingNodeScrollableAreaGeometry):
2928         (WebCore::AsyncScrollingCoordinator::setViewportConstraintedNodeConstraints):
2929         (WebCore::AsyncScrollingCoordinator::setScrollingNodeGeometry): Deleted.
2930         (WebCore::AsyncScrollingCoordinator::setViewportConstraintedNodeGeometry): Deleted.
2931         * page/scrolling/AsyncScrollingCoordinator.h:
2932         * page/scrolling/ScrollingCoordinator.h:
2933         (WebCore::ScrollingCoordinator::setRectRelativeToParentNode):
2934         (WebCore::ScrollingCoordinator::setScrollingNodeScrollableAreaGeometry):
2935         (WebCore::ScrollingCoordinator::setFrameScrollingNodeState):
2936         (WebCore::ScrollingCoordinator::setViewportConstraintedNodeConstraints):
2937         (WebCore::ScrollingCoordinator::setScrollingNodeGeometry): Deleted.
2938         (WebCore::ScrollingCoordinator::setViewportConstraintedNodeGeometry): Deleted.
2939         * platform/ScrollView.h:
2940         (WebCore::ScrollView::horizontalScrollbarMode const): Deleted.
2941         (WebCore::ScrollView::verticalScrollbarMode const): Deleted.
2942         * platform/ScrollableArea.cpp:
2943         (WebCore::ScrollableArea::reachableTotalContentsSize const):
2944         * platform/ScrollableArea.h:
2945         (WebCore::ScrollableArea::horizontalScrollbarMode const):
2946         (WebCore::ScrollableArea::verticalScrollbarMode const):
2947         * rendering/RenderLayer.cpp:
2948         (WebCore::RenderLayer::overhangAmount const):
2949         (WebCore::RenderLayer::reachableTotalContentsSize const):
2950         (WebCore::RenderLayer::scrollableContentsSize const): Deleted.
2951         * rendering/RenderLayer.h:
2952         * rendering/RenderLayerCompositor.cpp:
2953         (WebCore::RenderLayerCompositor::updateCompositingLayers):
2954         (WebCore::RenderLayerCompositor::updateBackingAndHierarchy):
2955         (WebCore::RenderLayerCompositor::updateScrollingNodeForViewportConstrainedRole):
2956         (WebCore::RenderLayerCompositor::rootParentRelativeScrollableRect const):
2957         (WebCore::RenderLayerCompositor::parentRelativeScrollableRect const):
2958         (WebCore::RenderLayerCompositor::updateScrollingNodeForScrollingRole):
2959         (WebCore::RenderLayerCompositor::updateScrollingNodeForFrameHostingRole):
2960         (WebCore::RenderLayerCompositor::computeFrameScrollingGeometry const): Deleted.
2961         (WebCore::RenderLayerCompositor::computeFrameHostingGeometry const): Deleted.
2962         (WebCore::RenderLayerCompositor::computeOverflowScrollingGeometry const): Deleted.
2963         * rendering/RenderLayerCompositor.h:
2964
2965 2019-03-02  Darin Adler  <darin@apple.com>
2966
2967         Retire legacy dtoa function and DecimalNumber class
2968         https://bugs.webkit.org/show_bug.cgi?id=195253
2969
2970         Reviewed by Daniel Bates.
2971
2972         * css/CSSPrimitiveValue.cpp:
2973         (WebCore::CSSPrimitiveValue::formatNumberValue const): Use makeString instead
2974         of DecimalNumber. Also changed return type to String and use StringView and
2975         removed special handling of literals.
2976         (WebCore::CSSPrimitiveValue::formatNumberForCustomCSSText const): Removed an
2977         unnecessary use of StringBuilder.
2978
2979         * css/CSSPrimitiveValue.h: Updated for changes to formatNumberValue.
2980
2981 2019-03-03  Michael Catanzaro  <mcatanzaro@igalia.com>
2982
2983         [SOUP] Cleanups in SoupNetworkSession
2984         https://bugs.webkit.org/show_bug.cgi?id=195247
2985
2986         Reviewed by Daniel Bates.
2987
2988         This renames clientCertificates to allowedCertificates, since they are not client
2989         certificates at all, but server certificates. It also adds a using statement to avoid
2990         repeating the long type of the map, and avoids an unnecessary copy.
2991
2992         * platform/network/soup/SoupNetworkSession.cpp:
2993         (WebCore::allowedCertificates):
2994         (WebCore::SoupNetworkSession::checkTLSErrors):
2995         (WebCore::SoupNetworkSession::allowSpecificHTTPSCertificateForHost):
2996         (WebCore::clientCertificates): Deleted.
2997
2998 2019-03-03  Michael Catanzaro  <mcatanzaro@igalia.com>
2999
3000         -Wformat error in SharedBuffer::tryCreateArrayBuffer
3001         https://bugs.webkit.org/show_bug.cgi?id=195004
3002
3003         Reviewed by Darin Adler.
3004
3005         Seems C++ has no format specifier appropriate for printing the result of sizeof. We should
3006         just not try to print it. Anyway, that's easy in this case, because sizeof(char) is
3007         guaranteed to be 1. This code was an attempt to be pedantic to account for mythical systems
3008         with char larger than one byte, but perhaps it didn't realize sizeof always returns
3009         multiples of char and so sizeof(char) is always one even on such mythical systems.
3010
3011         Note the sizeof(char) use two lines up is left since it's not clear that switching it to 1
3012         would actually be more readable.
3013
3014         * platform/SharedBuffer.cpp:
3015         (WebCore::SharedBuffer::tryCreateArrayBuffer const):
3016
3017 2019-03-03  Tim Horton  <timothy_horton@apple.com>
3018
3019         Remove some more unused 32-bit code
3020         https://bugs.webkit.org/show_bug.cgi?id=195255
3021
3022         Reviewed by Darin Adler.
3023
3024         * platform/gamepad/cocoa/GameControllerGamepad.h:
3025         * platform/gamepad/cocoa/GameControllerGamepad.mm:
3026         * platform/gamepad/cocoa/GameControllerGamepadProvider.h:
3027         * platform/gamepad/cocoa/GameControllerGamepadProvider.mm:
3028         * platform/graphics/cocoa/FontCascadeCocoa.mm:
3029         * platform/mac/PlatformEventFactoryMac.mm:
3030         (WebCore::globalPointForEvent):
3031         (WebCore::pointForEvent):
3032         (WebCore::mouseButtonForEvent):
3033         (WebCore::PlatformMouseEventBuilder::PlatformMouseEventBuilder):
3034         * rendering/RenderThemeMac.mm:
3035         (WebCore::RenderThemeMac::servicesRolloverButtonCell const):
3036         (WebCore::RenderThemeMac::paintImageControlsButton):
3037         (WebCore::RenderThemeMac::imageControlsButtonSize const):
3038         (WebCore::RenderThemeMac::imageControlsButtonPositionOffset const):
3039
3040 2019-03-02  Zalan Bujtas  <zalan@apple.com>
3041
3042         [ContentChangeObserver] Introduce ContentChangeObserver::MouseMovedScope
3043         https://bugs.webkit.org/show_bug.cgi?id=195252
3044         <rdar://problem/48539446>
3045
3046         Reviewed by Simon Fraser.
3047
3048         Scope the mouse-moved event to make the callsites less error-prone. 
3049
3050         * page/ios/ContentChangeObserver.cpp:
3051         (WebCore::ContentChangeObserver::startObservingMouseMoved):
3052         (WebCore::ContentChangeObserver::stopObservingMouseMoved):
3053         (WebCore::ContentChangeObserver::MouseMovedScope::MouseMovedScope):
3054         (WebCore::ContentChangeObserver::MouseMovedScope::~MouseMovedScope):
3055         (WebCore::ContentChangeObserver::startObservingContentChanges): Deleted.
3056         (WebCore::ContentChangeObserver::stopObservingContentChanges): Deleted.
3057         * page/ios/ContentChangeObserver.h:
3058         * page/ios/EventHandlerIOS.mm:
3059         (WebCore::EventHandler::mouseMoved):
3060
3061 2019-03-02  Zalan Bujtas  <zalan@apple.com>
3062
3063         [ContentChangeObserver] Introduce ContentChangeObserver::adjustObservedState
3064         https://bugs.webkit.org/show_bug.cgi?id=195244
3065         <rdar://problem/48536737>
3066
3067         Reviewed by Simon Fraser.
3068
3069         Move state change handling code to adjustObservedState() and introduce signalContentChangeIfNeeded() to
3070         let the client know about the state change (or lack of state change).
3071
3072         Test: fast/events/touch/ios/visibility-change-happens-at-the-second-timer.html
3073
3074         * page/ios/ContentChangeObserver.cpp:
3075         (WebCore::ContentChangeObserver::didInstallDOMTimer):
3076         (WebCore::ContentChangeObserver::didRemoveDOMTimer):
3077         (WebCore::ContentChangeObserver::stopObservingDOMTimerExecute):
3078         (WebCore::ContentChangeObserver::stopObservingStyleRecalc):
3079         (WebCore::ContentChangeObserver::clearTimersAndReportContentChange):
3080         (WebCore::ContentChangeObserver::didContentVisibilityChange):
3081         (WebCore::ContentChangeObserver::addObservedDOMTimer):
3082         (WebCore::ContentChangeObserver::removeObservedDOMTimer):
3083         (WebCore::ContentChangeObserver::setShouldObserveStyleRecalc):
3084         (WebCore::ContentChangeObserver::adjustObservedState):
3085         (WebCore::ContentChangeObserver::signalContentChangeIfNeeded):
3086         * page/ios/ContentChangeObserver.h:
3087         (WebCore::ContentChangeObserver::isObservingDOMTimerScheduling const):
3088         (WebCore::ContentChangeObserver::addObservedDOMTimer): Deleted.
3089         (WebCore::ContentChangeObserver::setShouldObserveStyleRecalc): Deleted.
3090
3091 2019-03-02  Zalan Bujtas  <zalan@apple.com>
3092
3093         [ContentChangeObserver] Move away from WKContentChange values
3094         https://bugs.webkit.org/show_bug.cgi?id=195240
3095         <rdar://problem/48532358>
3096
3097         Reviewed by Simon Fraser.
3098
3099         This is in preparation for moving towards a state machine-like implementation.
3100
3101         * page/ios/ContentChangeObserver.cpp:
3102         (WebCore::ContentChangeObserver::didInstallDOMTimer): Do not install the timer if we are already in "hover" state.
3103         (WebCore::ContentChangeObserver::didRemoveDOMTimer):
3104         (WebCore::ContentChangeObserver::startObservingDOMTimerExecute):
3105         (WebCore::ContentChangeObserver::stopObservingDOMTimerExecute):
3106         (WebCore::ContentChangeObserver::startObservingStyleRecalc): No need to start observing the style recalc if we are already in "hover" state.
3107         (WebCore::ContentChangeObserver::stopObservingStyleRecalc):
3108         (WebCore::ContentChangeObserver::clearTimersAndReportContentChange):
3109         (WebCore::ContentChangeObserver::didContentVisibilityChange):
3110         (WebCore::ContentChangeObserver::startObservingContentChanges):
3111         (WebCore::ContentChangeObserver::observedContentChange const):
3112         (WebCore::ContentChangeObserver::removeObservedDOMTimer):
3113         (WebCore::ContentChangeObserver::hasDeterminedState const):
3114         (WebCore::ContentChangeObserver::observedContentChange): Deleted.
3115         (WebCore::ContentChangeObserver::resetObservedContentChange): Deleted.
3116         (WebCore::ContentChangeObserver::setObservedContentChange): Deleted.
3117         (WebCore::ContentChangeObserver::addObservedDOMTimer): Deleted.
3118         * page/ios/ContentChangeObserver.h:
3119         (WebCore::ContentChangeObserver::addObservedDOMTimer):
3120         (WebCore::ContentChangeObserver::clearObservedDOMTimers):
3121         (WebCore::ContentChangeObserver::hasVisibleChangeState const):
3122         (WebCore::ContentChangeObserver::hasObservedDOMTimer const):
3123         (WebCore::ContentChangeObserver::setHasNoChangeState):
3124         (WebCore::ContentChangeObserver::setHasIndeterminateState):
3125         (WebCore::ContentChangeObserver::setHasVisibleChangeState):
3126         (WebCore::ContentChangeObserver::countOfObservedDOMTimers const): Deleted.
3127
3128 2019-03-02  Wenson Hsieh  <wenson_hsieh@apple.com>
3129
3130         [iOS] Programmatic paste access should be granted when copying and pasting within the same origin
3131         https://bugs.webkit.org/show_bug.cgi?id=195053
3132         <rdar://problem/48134710>
3133
3134         Reviewed by Ryosuke Niwa.
3135
3136         Plumb the document pasteboard identifier through the client when making a DOM paste access request. See WebKit
3137         ChangeLog for more details.
3138
3139         Test: editing/pasteboard/ios/dom-paste-same-origin.html
3140
3141         * WebCore.xcodeproj/project.pbxproj:
3142         * dom/DOMPasteAccess.h: Renamed from Source/WebCore/dom/DOMPasteAccessPolicy.h.
3143
3144         Introduce DOMPasteAccessResponse, which is either DeniedForGesture, GrantedForCommand, or GrantedForGesture. In
3145         particular, when pasteboard identifiers match, we only grant access for the current paste command, rather than
3146         throughout the user gesture.
3147
3148         * dom/UserGestureIndicator.h:
3149         (WebCore::UserGestureToken::didRequestDOMPasteAccess):
3150         * loader/EmptyClients.cpp:
3151         * page/EditorClient.h:
3152         * page/Frame.cpp:
3153         (WebCore::Frame::requestDOMPasteAccess):
3154
3155 2019-02-27  Darin Adler  <darin@apple.com>
3156
3157         Fixed makeString(float) to do shortest-form serialization without first converting to double
3158         https://bugs.webkit.org/show_bug.cgi?id=195142
3159
3160         Reviewed by Daniel Bates.
3161
3162         * platform/graphics/Color.cpp: Removed unneeded include of DecimalNumber.h.
3163
3164 2019-03-02  Simon Fraser  <simon.fraser@apple.com>
3165
3166         REGRESSION (r242132): Incorrect positioning with multiple position:fixed elements
3167         https://bugs.webkit.org/show_bug.cgi?id=195246
3168
3169         Reviewed by Frederic Wang.
3170
3171         r242132 introduced a bug where the management of 'cumulativeDelta' in ScrollingTree::notifyRelatedNodesRecursive
3172         was incorrect. This value should propagate from ancestors to descendants, but not between siblings in the scrolling
3173         tree, which it did, causing sibling position:fixed to behave incorrectly.
3174
3175         Test: scrollingcoordinator/mac/multiple-fixed.html
3176
3177         * page/scrolling/ScrollingTree.cpp:
3178         (WebCore::ScrollingTree::notifyRelatedNodesRecursive):
3179         * page/scrolling/ScrollingTree.h:
3180
3181 2019-03-02  Darin Adler  <darin@apple.com>
3182
3183         Improve some comments
3184         https://bugs.webkit.org/show_bug.cgi?id=195243
3185
3186         Reviewed by Daniel Bates.
3187
3188         * accessibility/ios/WebAccessibilityObjectWrapperIOS.mm:
3189         (-[WebAccessibilityObjectWrapper _addAccessibilityObject:toTextMarkerArray:]):
3190         Fix a typo in a comment.
3191
3192         * dom/RadioButtonGroups.cpp: Fix a typo in a comment.
3193         (WebCore::RadioButtonGroups::checkedButtonForGroup const): Use nullptr instead of 0.
3194
3195         * html/HTMLInputElement.cpp:
3196         (WebCore::HTMLInputElement::~HTMLInputElement): Improved a comment, but sadly made
3197         it a bit longer. Use nullptr instead of 0.
3198         (WebCore::HTMLInputElement::didMoveToNewDocument): Added a comment.
3199
3200 2019-03-01  Wenson Hsieh  <wenson_hsieh@apple.com>
3201
3202         [Datalist] fast/forms/datalist/datalist-child-validation.html crashes with a debug assertion in isValidFormControlElement()
3203         https://bugs.webkit.org/show_bug.cgi?id=190620
3204         <rdar://problem/19226679>
3205
3206         Reviewed by Ryosuke Niwa.
3207
3208         Fixes and re-enables an existing layout test that is asserting on debug builds (and failing on release builds).
3209         To understand why we hit this assertion, we first note several observations:
3210
3211             -   The validity of a form control (`isValid()`) depends on the value of `willValidate()`.
3212             -   Both of these results are cached in member variables: `m_isValid` and `m_willValidate`, respectively.
3213             -   `willValidate()` changes the cached value of `m_willValidate` if necessary, but `isValid()` uses the
3214                 cached value without update.
3215
3216         Now, consider the following scenario:
3217
3218             1.  Something changes in the DOM that changes the result of `willValidate()`. This can happen as a result of
3219                 several things:
3220                 a.  The form control changes readonly state
3221                 b.  The form control changes disabled state
3222                 c.  The form control is added to a datalist element
3223                 d.  The form control is removed from a datalist element
3224             2.  Call `willValidate()`.
3225             3.  Call `isValid()`.
3226
3227         In scenarios (a) - (c), we ensure that cached form control validity (`m_isValid`) is updated alongside
3228         `m_willValidate` by invoking `setNeedsWillValidateCheck()`, such that the result of `isValid()` matches the
3229         result of `m_isValid` in step (3). However, in the last scenario (d), we don't do this, which causes form
3230         control validity to fall out of sync with the result of `isValid()`. To fix the bug, we update willValidate and
3231         isValid when a form control is removed from an ancestor, only if one of its ancestors is a datalist element.
3232
3233         * html/HTMLFormControlElement.cpp:
3234         (WebCore::HTMLFormControlElement::insertedIntoAncestor):
3235         (WebCore::HTMLFormControlElement::removedFromAncestor):
3236
3237         Make a couple of minor tweaks:
3238           - Currently, we always invalidate `m_dataListAncestorState` by resetting the state to `Unknown` when the form
3239             control is removed from an ancestor or inserted. Instead, we only need to reset it when the form control
3240             already has an ancestor that is a datalist (in the case where it's being removed) or when the form control
3241             does not yet have an ancestor (in the case where it is being added).
3242           - If the form control was inside a datalist prior to removal, recompute its cached value of `m_willValidate`,
3243             as well as its cached validity (`m_isValid`).
3244
3245 2019-03-01  Darin Adler  <darin@apple.com>
3246
3247         Finish removing String::format
3248         https://bugs.webkit.org/show_bug.cgi?id=194893
3249
3250         Reviewed by Daniel Bates.
3251
3252         * dom/Document.cpp:
3253         (WebCore::Document::lastModified const): Use makeString and pad.
3254         * html/FTPDirectoryDocument.cpp:
3255         (WebCore::processFileDateString): Ditto.
3256
3257         * mathml/MathMLElement.cpp:
3258         (WebCore::convertToPercentageIfNeeded): Use makeString and FormattedNumber.
3259
3260         * page/cocoa/ResourceUsageOverlayCocoa.mm:
3261         (WebCore::ResourceUsageOverlay::platformDraw): Use makeString and pad.
3262
3263         * page/linux/ResourceUsageOverlayLinux.cpp:
3264         (WebCore::cpuUsageString): Use makeString, FormattedNumber, and pad.
3265         (WebCore::gcTimerString): Use String::number.
3266
3267         * platform/DateComponents.cpp:
3268         (WebCore::DateComponents::toStringForTime const): Use makeString and pad.
3269         (WebCore::DateComponents::toString const): Ditto.
3270
3271         * platform/LocalizedStrings.cpp: Removed comment that mentioned String::format,
3272         and that was also inaccurate.
3273
3274         * platform/audio/HRTFElevation.cpp:
3275         (WebCore::HRTFElevation::calculateKernelsForAzimuthElevation):
3276         Use makeString and pad.
3277         * platform/mock/MockRealtimeVideoSource.cpp:
3278         (WebCore::MockRealtimeVideoSource::drawText): Ditto.
3279         * rendering/RenderLayerCompositor.cpp:
3280         (WebCore::RenderLayerCompositor::logLayerInfo): Ditto.
3281         * rendering/RenderTheme.cpp:
3282         (WebCore::RenderTheme::formatMediaControlsTime const): Ditto.
3283
3284 2019-03-01  Chris Dumez  <cdumez@apple.com>
3285
3286         Do not attempt to set WAL Journal mode on a readonly SQLite database
3287         https://bugs.webkit.org/show_bug.cgi?id=195237
3288
3289         Reviewed by Simon Fraser.
3290
3291         This avoids logging errors when opening the database.
3292
3293         * platform/sql/SQLiteDatabase.cpp:
3294         (WebCore::SQLiteDatabase::open):
3295         (WebCore::SQLiteDatabase::useWALJournalMode):
3296         * platform/sql/SQLiteDatabase.h:
3297
3298 2019-03-01  Antoine Quint  <graouts@apple.com>
3299
3300         [iOS] Turn mouse event simulation on by default
3301         https://bugs.webkit.org/show_bug.cgi?id=195218
3302         <rdar://problem/48516794>
3303
3304         Reviewed by Dean Jackson.
3305
3306         * page/RuntimeEnabledFeatures.h:
3307
3308 2019-03-01  Chris Dumez  <cdumez@apple.com>
3309
3310         Disable NetworkStateNotifier::singleton()'s isMainThread() assertion when the WebThread is enabled
3311         https://bugs.webkit.org/show_bug.cgi?id=195230
3312         <rdar://problem/47925359>
3313
3314         Reviewed by Ryosuke Niwa.
3315
3316         Disable NetworkStateNotifier::singleton()'s isMainThread() assertion when the WebThread is enabled
3317         to address crashes on iOS WK1.
3318
3319         * platform/network/NetworkStateNotifier.cpp:
3320         (WebCore::shouldSuppressThreadSafetyCheck):
3321         (WebCore::NetworkStateNotifier::singleton):
3322
3323 2019-03-01  Simon Fraser  <simon.fraser@apple.com>
3324
3325         Show mouse event regions in the overlay
3326         https://bugs.webkit.org/show_bug.cgi?id=195227
3327
3328         Reviewed by Tim Horton.
3329
3330         Enhance event region overlays to show more kinds of events.
3331
3332         * page/DebugPageOverlays.cpp:
3333         (WebCore::touchEventRegionColors):
3334         (WebCore::NonFastScrollableRegionOverlay::drawRect):
3335
3336 2019-03-01  Zalan Bujtas  <zalan@apple.com>
3337
3338         [ContentChangeObserver] Check for pending style recalcs at the end of each timer run.
3339         https://bugs.webkit.org/show_bug.cgi?id=195220
3340         <rdar://problem/48518979>
3341
3342         Reviewed by Simon Fraser.
3343
3344         didScheduleStyleRecalc callback was introduced to see if a style recalc is scheduled while firing the DOM timer. However it does not handle the case
3345         when in addition to this style recalc scheduling, something later (though during the same timer firing) triggers a sync style recalc.
3346         Let's just check if we've got a pending style recalc when the DOM timer comes back.
3347
3348         Test: fast/events/touch/ios/style-recalc-schedule-and-force-relalc.html
3349
3350         * dom/Document.cpp:
3351         (WebCore::Document::scheduleStyleRecalc):
3352         * page/ios/ContentChangeObserver.cpp:
3353         (WebCore::hasPendingStyleRecalc):
3354         (WebCore::ContentChangeObserver::startObservingDOMTimerExecute):
3355         (WebCore::ContentChangeObserver::stopObservingDOMTimerExecute):
3356         (WebCore::ContentChangeObserver::startObservingContentChanges):
3357         (WebCore::ContentChangeObserver::didScheduleStyleRecalc): Deleted.
3358         * page/ios/ContentChangeObserver.h:
3359         (WebCore::ContentChangeObserver::startObservingStyleRecalcScheduling): Deleted.
3360         (WebCore::ContentChangeObserver::stopObservingStyleRecalcScheduling): Deleted.
3361         (WebCore::ContentChangeObserver::isObservingStyleRecalcScheduling const): Deleted.
3362
3363 2019-03-01  John Wilander  <wilander@apple.com>
3364
3365         Resource Load Statistics: Further restrict client-side cookie persistence after cross-site navigations with link decoration
3366         https://bugs.webkit.org/show_bug.cgi?id=195196
3367         <rdar://problem/48006419>
3368