Shrink various loading-related enums to shrink CachedResource
[WebKit-https.git] / Source / WebCore / ChangeLog
1 2018-07-09  Simon Fraser  <simon.fraser@apple.com>
2
3         Shrink various loading-related enums to shrink CachedResource
4         https://bugs.webkit.org/show_bug.cgi?id=187443
5
6         Reviewed by Chris Dumez.
7         
8         ResourceRequestBase, ResourceResponseBase, ResourceLoaderOptions, FetchOptions and
9         CachedResource have a lot of enum members variables most of which took 4 bytes each.
10         These can be packed much more efficiently if the enums are declared with an 8-bit size.
11         This requires turning enums into enum classes in some cases.
12         
13         This reduces the size of CachedResource from 1464 to 1384 bytes, which saves about 49KB
14         over the ~600 CachedResources on nytimes.com.
15
16         * Modules/fetch/FetchLoader.cpp:
17         (WebCore::FetchLoader::startLoadingBlobURL):
18         (WebCore::FetchLoader::start):
19         * css/StyleRuleImport.cpp:
20         (WebCore::StyleRuleImport::requestStyleSheet):
21         * fileapi/FileReaderLoader.cpp:
22         (WebCore::FileReaderLoader::start):
23         * html/MediaDocument.cpp:
24         (WebCore::MediaDocumentParser::createDocumentStructure):
25         * html/PluginDocument.cpp:
26         (WebCore::PluginDocumentParser::appendBytes):
27         * html/parser/CSSPreloadScanner.cpp:
28         (WebCore::CSSPreloadScanner::emitRule):
29         * html/parser/HTMLPreloadScanner.cpp:
30         (WebCore::TokenPreloadScanner::StartTagScanner::resourceType const):
31         * inspector/NetworkResourcesData.cpp:
32         (WebCore::shouldBufferResourceData):
33         * inspector/agents/InspectorNetworkAgent.cpp:
34         (WebCore::InspectorNetworkAgent::didReceiveResponse):
35         (WebCore::InspectorNetworkAgent::loadResource):
36         (WebCore::InspectorNetworkAgent::cachedResourceContent):
37         * inspector/agents/InspectorPageAgent.cpp:
38         (WebCore::InspectorPageAgent::sourceMapURLForResource):
39         (WebCore::InspectorPageAgent::inspectorResourceType):
40         * loader/ApplicationManifestLoader.cpp:
41         (WebCore::ApplicationManifestLoader::startLoading):
42         * loader/ContentFilter.cpp:
43         (WebCore::ContentFilter::deliverResourceData):
44         * loader/DocumentLoader.cpp:
45         (WebCore::DocumentLoader::notifyFinished):
46         (WebCore::DocumentLoader::willSendRequest):
47         (WebCore::DocumentLoader::tryLoadingRedirectRequestFromApplicationCache):
48         (WebCore::DocumentLoader::subresource const):
49         (WebCore::DocumentLoader::loadMainResource):
50         * loader/DocumentThreadableLoader.cpp:
51         (WebCore::DocumentThreadableLoader::DocumentThreadableLoader):
52         (WebCore::DocumentThreadableLoader::makeCrossOriginAccessRequest):
53         (WebCore::DocumentThreadableLoader::makeSimpleCrossOriginAccessRequest):
54         (WebCore::DocumentThreadableLoader::preflightSuccess):
55         (WebCore::DocumentThreadableLoader::loadRequest):
56         * loader/FetchOptions.h:
57         (WebCore::FetchOptions::FetchOptions):
58         * loader/FrameLoader.cpp:
59         (WebCore::FrameLoader::loadFrameRequest):
60         (WebCore::FrameLoader::loadURL):
61         (WebCore::FrameLoader::load):
62         (WebCore::FrameLoader::reloadWithOverrideEncoding):
63         (WebCore::FrameLoader::reload):
64         (WebCore::FrameLoader::defaultRequestCachingPolicy):
65         (WebCore::FrameLoader::addExtraFieldsToRequest):
66         (WebCore::FrameLoader::loadedResourceFromMemoryCache):
67         (WebCore::FrameLoader::loadDifferentDocumentItem):
68         * loader/LinkLoader.cpp:
69         (WebCore::LinkLoader::resourceTypeFromAsAttribute):
70         (WebCore::createLinkPreloadResourceClient):
71         (WebCore::LinkLoader::isSupportedType):
72         (WebCore::LinkLoader::prefetchIfNeeded):
73         * loader/MediaResourceLoader.cpp:
74         (WebCore::MediaResourceLoader::requestResource):
75         * loader/NavigationScheduler.cpp:
76         (WebCore::NavigationScheduler::scheduleLocationChange):
77         * loader/NetscapePlugInStreamLoader.cpp:
78         (WebCore::NetscapePlugInStreamLoader::NetscapePlugInStreamLoader):
79         * loader/ResourceLoadInfo.cpp:
80         (WebCore::toResourceType):
81         * loader/ResourceLoader.cpp:
82         (WebCore::ResourceLoader::init):
83         (WebCore::ResourceLoader::start):
84         (WebCore::ResourceLoader::setDataBufferingPolicy):
85         (WebCore::ResourceLoader::addDataOrBuffer):
86         (WebCore::ResourceLoader::willSendRequestInternal):
87         (WebCore::ResourceLoader::didReceiveResponse):
88         (WebCore::ResourceLoader::didReceiveDataOrBuffer):
89         (WebCore::ResourceLoader::didFinishLoadingOnePart):
90         (WebCore::ResourceLoader::cleanupForError):
91         * loader/ResourceLoader.h:
92         (WebCore::ResourceLoader::shouldSendResourceLoadCallbacks const):
93         (WebCore::ResourceLoader::shouldSniffContent const):
94         (WebCore::ResourceLoader::shouldIncludeCertificateInfo const):
95         * loader/ResourceLoaderOptions.h:
96         * loader/ResourceTimingInformation.cpp:
97         (WebCore::ResourceTimingInformation::addResourceTiming):
98         (WebCore::ResourceTimingInformation::storeResourceTimingInitiatorInformation):
99         * loader/SubresourceLoader.cpp:
100         (WebCore::SubresourceLoader::SubresourceLoader):
101         (WebCore::SubresourceLoader::willSendRequestInternal):
102         (WebCore::SubresourceLoader::shouldCreatePreviewLoaderForResponse const):
103         (WebCore::SubresourceLoader::didReceiveResponse):
104         (WebCore::logResourceLoaded):
105         (WebCore::SubresourceLoader::didFinishLoading):
106         (WebCore::SubresourceLoader::didFail):
107         (WebCore::SubresourceLoader::didCancel):
108         * loader/cache/CachedApplicationManifest.cpp:
109         (WebCore::CachedApplicationManifest::CachedApplicationManifest):
110         * loader/cache/CachedApplicationManifest.h:
111         * loader/cache/CachedCSSStyleSheet.cpp:
112         (WebCore::CachedCSSStyleSheet::CachedCSSStyleSheet):
113         * loader/cache/CachedCSSStyleSheet.h:
114         * loader/cache/CachedFont.h:
115         * loader/cache/CachedImage.cpp:
116         (WebCore::CachedImage::CachedImage):
117         (WebCore::CachedImage::updateBuffer):
118         (WebCore::CachedImage::updateData):
119         * loader/cache/CachedImage.h:
120         * loader/cache/CachedRawResource.cpp:
121         (WebCore::CachedRawResource::updateBuffer):
122         (WebCore::CachedRawResource::updateData):
123         (WebCore::CachedRawResource::finishLoading):
124         (WebCore::CachedRawResource::canReuse const):
125         * loader/cache/CachedResource.cpp:
126         (WebCore::CachedResource::defaultPriorityForResourceType):
127         (WebCore::deadDecodedDataDeletionIntervalForResourceType):
128         (WebCore::CachedResource::CachedResource):
129         (WebCore::CachedResource::load):
130         (WebCore::CachedResource::updateBuffer):
131         (WebCore::CachedResource::updateData):
132         (WebCore::CachedResource::isCORSSameOrigin const):
133         (WebCore::CachedResource::freshnessLifetime const):
134         (WebCore::CachedResource::setResponse):
135         (WebCore::CachedResource::addClientToSet):
136         (WebCore::CachedResource::areAllClientsXMLHttpRequests const):
137         * loader/cache/CachedResource.h:
138         (WebCore::CachedResource::isImage const):
139         (WebCore::CachedResource::isMainOrMediaOrIconOrRawResource const):
140         (WebCore::CachedResource::ignoreForRequestCount const):
141         (WebCore::CachedResource::shouldSendResourceLoadCallbacks const):
142         * loader/cache/CachedResourceLoader.cpp:
143         (WebCore::createResource):
144         (WebCore::CachedResourceLoader::requestImage):
145         (WebCore::CachedResourceLoader::requestFont):
146         (WebCore::CachedResourceLoader::requestTextTrack):
147         (WebCore::CachedResourceLoader::requestCSSStyleSheet):
148         (WebCore::CachedResourceLoader::requestScript):
149         (WebCore::CachedResourceLoader::requestXSLStyleSheet):
150         (WebCore::CachedResourceLoader::requestSVGDocument):
151         (WebCore::CachedResourceLoader::requestLinkResource):
152         (WebCore::CachedResourceLoader::requestMedia):
153         (WebCore::CachedResourceLoader::requestIcon):
154         (WebCore::CachedResourceLoader::requestRawResource):
155         (WebCore::CachedResourceLoader::requestBeaconResource):
156         (WebCore::CachedResourceLoader::requestMainResource):
157         (WebCore::CachedResourceLoader::requestApplicationManifest):
158         (WebCore::contentTypeFromResourceType):
159         (WebCore::CachedResourceLoader::checkInsecureContent const):
160         (WebCore::CachedResourceLoader::allowedByContentSecurityPolicy const):
161         (WebCore::CachedResourceLoader::canRequest):
162         (WebCore::CachedResourceLoader::canRequestInContentDispositionAttachmentSandbox const):
163         (WebCore::CachedResourceLoader::shouldUpdateCachedResourceWithCurrentRequest):
164         (WebCore::isResourceSuitableForDirectReuse):
165         (WebCore::destinationForType):
166         (WebCore::CachedResourceLoader::loadResource):
167         (WebCore::CachedResourceLoader::determineRevalidationPolicy const):
168         (WebCore::CachedResourceLoader::cachePolicy const):
169         (WebCore::CachedResourceLoader::preload):
170         (WebCore::CachedResourceLoader::warnUnusedPreloads):
171         (WebCore::CachedResourceLoader::clearPreloads):
172         (WebCore::CachedResourceLoader::defaultCachedResourceOptions):
173         * loader/cache/CachedResourceRequest.cpp:
174         (WebCore::CachedResourceRequest::updateAccordingCacheMode):
175         * loader/cache/CachedResourceRequest.h:
176         * loader/cache/CachedSVGDocument.cpp:
177         (WebCore::CachedSVGDocument::CachedSVGDocument):
178         * loader/cache/CachedSVGDocument.h:
179         * loader/cache/CachedSVGFont.cpp:
180         (WebCore::CachedSVGFont::CachedSVGFont):
181         * loader/cache/CachedSVGFont.h:
182         * loader/cache/CachedScript.cpp:
183         (WebCore::CachedScript::CachedScript):
184         * loader/cache/CachedScript.h:
185         * loader/cache/CachedTextTrack.cpp:
186         (WebCore::CachedTextTrack::CachedTextTrack):
187         (WebCore::CachedTextTrack::doUpdateBuffer):
188         * loader/cache/CachedTextTrack.h:
189         * loader/cache/CachedXSLStyleSheet.cpp:
190         (WebCore::CachedXSLStyleSheet::CachedXSLStyleSheet):
191         * loader/cache/CachedXSLStyleSheet.h:
192         * loader/cache/MemoryCache.cpp:
193         (WebCore::MemoryCache::getStatistics):
194         * loader/icon/IconLoader.cpp:
195         (WebCore::IconLoader::startLoading):
196         * loader/mac/ResourceLoaderMac.mm:
197         (WebCore::ResourceLoader::willCacheResponseAsync):
198         * page/DOMWindow.cpp:
199         (WebCore::DOMWindow::createWindow):
200         * page/EventSource.cpp:
201         (WebCore::EventSource::connect):
202         * platform/ReferrerPolicy.h:
203         * platform/graphics/avfoundation/objc/WebCoreAVFResourceLoader.mm:
204         (WebCore::WebCoreAVFResourceLoader::startLoading):
205         * platform/ios/QuickLook.mm:
206         (WebCore::registerQLPreviewConverterIfNeeded):
207         * platform/network/CacheValidation.cpp:
208         (WebCore::updateRedirectChainStatus):
209         (WebCore::redirectChainAllowsReuse):
210         * platform/network/CacheValidation.h:
211         (WebCore::RedirectChainCacheStatus::RedirectChainCacheStatus):
212         * platform/network/ResourceErrorBase.h:
213         * platform/network/ResourceLoadPriority.h:
214         * platform/network/ResourceRequestBase.cpp:
215         (WebCore::ResourceRequestBase::httpBody const):
216         (WebCore::ResourceRequestBase::updatePlatformRequest const):
217         (WebCore::ResourceRequestBase::updateResourceRequest const):
218         * platform/network/ResourceRequestBase.h:
219         * platform/network/ResourceResponseBase.h:
220         * platform/network/StoredCredentialsPolicy.h:
221         * platform/network/cf/ResourceRequest.h:
222         (WebCore::ResourceRequest::ResourceRequest):
223         * platform/network/cf/ResourceRequestCFNet.cpp:
224         (WebCore::toPlatformRequestCachePolicy):
225         (WebCore::fromPlatformRequestCachePolicy):
226         (WebCore::ResourceRequest::doUpdateResourceRequest):
227         * platform/network/cocoa/ResourceRequestCocoa.mm:
228         (WebCore::fromPlatformRequestCachePolicy):
229         (WebCore::toPlatformRequestCachePolicy):
230         (WebCore::ResourceRequest::doUpdateResourceRequest):
231         * platform/network/cocoa/WebCoreNSURLSession.mm:
232         (-[WebCoreNSURLSessionDataTask resource:receivedRedirect:request:completionHandler:]):
233         * platform/network/ios/PreviewConverter.mm:
234         (WebCore::PreviewConverter::safeRequest const):
235         * platform/network/mac/ResourceHandleMac.mm:
236         (WebCore::ResourceHandle::createNSURLConnection):
237         (WebCore::ResourceHandle::start):
238         (WebCore::ResourceHandle::platformLoadResourceSynchronously):
239         * platform/network/mac/WebCoreResourceHandleAsOperationQueueDelegate.mm:
240         (-[WebCoreResourceHandleAsOperationQueueDelegate connection:willSendRequest:redirectResponse:]):
241         (-[WebCoreResourceHandleAsOperationQueueDelegate connection:didReceiveResponse:]):
242         * testing/Internals.cpp:
243         (WebCore::toResourceRequestCachePolicy):
244         * workers/WorkerScriptLoader.cpp:
245         (WebCore::WorkerScriptLoader::loadSynchronously):
246         (WebCore::WorkerScriptLoader::loadAsynchronously):
247         * xml/XMLHttpRequest.cpp:
248         (WebCore::XMLHttpRequest::createRequest):
249
250 2018-07-09  Antoine Quint  <graouts@apple.com>
251
252         [Web Animations] Make WPT test at interfaces/DocumentTimeline/constructor.html pass reliably
253         https://bugs.webkit.org/show_bug.cgi?id=186498
254         <rdar://problem/41000205>
255         
256         Reviewed by Dean Jackson.
257
258         Add a Constructor to the DocumentTimeline IDL to match the spec and ensure we respect the provided
259         origin time. To ensure all DocumentTimeline instances report matching current times, we read the
260         current time from the "main" document timeline, the one created by the Document automatically.
261
262         * CMakeLists.txt:
263         * DerivedSources.make:
264         * Sources.txt:
265         * WebCore.xcodeproj/project.pbxproj:
266         * animation/DocumentTimeline.cpp:
267         (WebCore::DocumentTimeline::create):
268         (WebCore::DocumentTimeline::DocumentTimeline):
269         (WebCore::DocumentTimeline::currentTime):
270         * animation/DocumentTimeline.h:
271         * animation/DocumentTimeline.idl:
272         * animation/DocumentTimelineOptions.h:
273         * animation/DocumentTimelineOptions.idl:
274
275 2018-07-09  Antoine Quint  <graouts@apple.com>
276
277         [Web Animations] Support overlapping keyframes
278         https://bugs.webkit.org/show_bug.cgi?id=187481
279         <rdar://problem/41988674>
280
281         Reviewed by Dean Jackson.
282
283         We now support parsing of multiple keyframes for the same offset.
284
285         * animation/KeyframeEffectReadOnly.cpp:
286         (WebCore::computeMissingKeyframeOffsets): Keyframes with a null offset that don't yet have a non-zero
287         computed offset are keyframes with an offset that needs to be computed.
288         (WebCore::KeyframeEffectReadOnly::processKeyframes): Only file an exception if an offset is found that
289         is lower than a previously-parsed one, allowing offsets with the same value.
290         * rendering/style/KeyframeList.cpp:
291         (WebCore::KeyframeList::insert): Remove the assertion that prevented an offset to be found more than once.
292
293 2018-07-09  Youenn Fablet  <youenn@apple.com>
294
295         StringView operator==(char*) should check the length of the string
296         https://bugs.webkit.org/show_bug.cgi?id=187422
297
298         Reviewed by Chris Dumez.
299
300         Covered by existing tests.
301
302         * Modules/indexeddb/server/SQLiteIDBBackingStore.cpp:
303         (WebCore::IDBServer::SQLiteIDBBackingStore::databaseNameFromEncodedFilename):
304
305 2018-07-09  Simon Fraser  <simon.fraser@apple.com>
306
307         Shrink WebCore::Pair
308         https://bugs.webkit.org/show_bug.cgi?id=187450
309
310         Reviewed by Sam Weinig.
311
312         Move m_encoding to pack in with m_refCount and remove the virtual destructor,
313         shrinking the class from 40 to 24 bytes.
314         Also make the enum take only a byte, in case it gets used elsewhere
315         
316         There are about 500 Pairs on nytimes.com, so this memory saving is non-trivial.
317
318         * css/Pair.h:
319
320 2018-07-09  Yusuke Suzuki  <utatane.tea@gmail.com>
321
322         [WebCore] Annotate classes with WTF_MAKE_FAST_ALLOCATED as much as possible
323         https://bugs.webkit.org/show_bug.cgi?id=187474
324
325         Reviewed by Mark Lam.
326
327         When opening cnn.com, debugger says that so many objects in WebCore are allocated
328         from system allocator. This patch attempts to annotate these found classes with
329         WTF_MAKE_FAST_ALLOCATED.
330
331         We also annotate WebAudio classes with `final` to make WebAudio class hierarchy solid.
332
333         No behavior change.
334
335         * Modules/indexeddb/IDBIndex.h:
336         * Modules/indexeddb/IDBObjectStore.h:
337         * Modules/indexeddb/client/IDBConnectionProxy.h:
338         * Modules/mediastream/UserMediaController.h:
339         * Modules/mediastream/libwebrtc/LibWebRTCPeerConnectionBackend.h:
340         * Modules/webaudio/AsyncAudioDecoder.h:
341         * Modules/webaudio/AudioListener.h:
342         (WebCore::AudioListener::create): Deleted.
343         (WebCore::AudioListener::setPosition): Deleted.
344         (WebCore::AudioListener::position const): Deleted.
345         (WebCore::AudioListener::setOrientation): Deleted.
346         (WebCore::AudioListener::orientation const): Deleted.
347         (WebCore::AudioListener::setUpVector): Deleted.
348         (WebCore::AudioListener::upVector const): Deleted.
349         (WebCore::AudioListener::setVelocity): Deleted.
350         (WebCore::AudioListener::velocity const): Deleted.
351         (WebCore::AudioListener::setDopplerFactor): Deleted.
352         (WebCore::AudioListener::dopplerFactor const): Deleted.
353         (WebCore::AudioListener::setSpeedOfSound): Deleted.
354         (WebCore::AudioListener::speedOfSound const): Deleted.
355         * Modules/webaudio/AudioNode.h:
356         * Modules/webaudio/AudioNodeInput.h:
357         (WebCore::AudioNodeInput::node const): Deleted.
358         * Modules/webaudio/AudioNodeOutput.h:
359         * Modules/webaudio/AudioParam.h:
360         (WebCore::AudioParam::create): Deleted.
361         (WebCore::AudioParam::name const): Deleted.
362         (WebCore::AudioParam::minValue const): Deleted.
363         (WebCore::AudioParam::maxValue const): Deleted.
364         (WebCore::AudioParam::defaultValue const): Deleted.
365         (WebCore::AudioParam::units const): Deleted.
366         (WebCore::AudioParam::resetSmoothedValue): Deleted.
367         (WebCore::AudioParam::setSmoothingConstant): Deleted.
368         (WebCore::AudioParam::setValueAtTime): Deleted.
369         (WebCore::AudioParam::linearRampToValueAtTime): Deleted.
370         (WebCore::AudioParam::exponentialRampToValueAtTime): Deleted.
371         (WebCore::AudioParam::setTargetAtTime): Deleted.
372         (WebCore::AudioParam::setValueCurveAtTime): Deleted.
373         (WebCore::AudioParam::cancelScheduledValues): Deleted.
374         (WebCore::AudioParam::hasSampleAccurateValues): Deleted.
375         (WebCore::AudioParam::AudioParam): Deleted.
376         * Modules/webaudio/AudioParamTimeline.h:
377         * Modules/webaudio/AudioProcessingEvent.h:
378         (WebCore::AudioProcessingEvent::create): Deleted.
379         (WebCore::AudioProcessingEvent::createForBindings): Deleted.
380         (WebCore::AudioProcessingEvent::inputBuffer): Deleted.
381         (WebCore::AudioProcessingEvent::outputBuffer): Deleted.
382         (WebCore::AudioProcessingEvent::playbackTime const): Deleted.
383         * Modules/webaudio/BiquadDSPKernel.h:
384         (WebCore::BiquadDSPKernel::BiquadDSPKernel): Deleted.
385         (WebCore::BiquadDSPKernel::biquadProcessor): Deleted.
386         * Modules/webaudio/BiquadFilterNode.h:
387         (WebCore::BiquadFilterNode::create): Deleted.
388         (WebCore::BiquadFilterNode::frequency): Deleted.
389         (WebCore::BiquadFilterNode::q): Deleted.
390         (WebCore::BiquadFilterNode::gain): Deleted.
391         (WebCore::BiquadFilterNode::detune): Deleted.
392         (WebCore::BiquadFilterNode::biquadProcessor): Deleted.
393         * Modules/webaudio/BiquadProcessor.h:
394         (WebCore::BiquadProcessor::filterCoefficientsDirty const): Deleted.
395         (WebCore::BiquadProcessor::hasSampleAccurateValues const): Deleted.
396         (WebCore::BiquadProcessor::parameter1): Deleted.
397         (WebCore::BiquadProcessor::parameter2): Deleted.
398         (WebCore::BiquadProcessor::parameter3): Deleted.
399         (WebCore::BiquadProcessor::parameter4): Deleted.
400         (WebCore::BiquadProcessor::type const): Deleted.
401         * Modules/webaudio/ChannelMergerNode.h:
402         * Modules/webaudio/ChannelSplitterNode.h:
403         * Modules/webaudio/DelayDSPKernel.h:
404         (WebCore::DelayDSPKernel::maxDelayTime const): Deleted.
405         (WebCore::DelayDSPKernel::setDelayFrames): Deleted.
406         (WebCore::DelayDSPKernel::delayProcessor): Deleted.
407         * Modules/webaudio/DelayNode.h:
408         * Modules/webaudio/DelayProcessor.h:
409         (WebCore::DelayProcessor::delayTime const): Deleted.
410         (WebCore::DelayProcessor::maxDelayTime): Deleted.
411         * Modules/webaudio/DynamicsCompressorNode.h:
412         (WebCore::DynamicsCompressorNode::create): Deleted.
413         (WebCore::DynamicsCompressorNode::threshold): Deleted.
414         (WebCore::DynamicsCompressorNode::knee): Deleted.
415         (WebCore::DynamicsCompressorNode::ratio): Deleted.
416         (WebCore::DynamicsCompressorNode::attack): Deleted.
417         (WebCore::DynamicsCompressorNode::release): Deleted.
418         (WebCore::DynamicsCompressorNode::reduction): Deleted.
419         * Modules/webaudio/GainNode.h:
420         (WebCore::GainNode::create): Deleted.
421         (WebCore::GainNode::gain): Deleted.
422         * Modules/webaudio/MediaElementAudioSourceNode.h:
423         (WebCore::MediaElementAudioSourceNode::mediaElement): Deleted.
424         * Modules/webaudio/MediaStreamAudioDestinationNode.h:
425         (WebCore::MediaStreamAudioDestinationNode::stream): Deleted.
426         * Modules/webaudio/MediaStreamAudioSourceNode.h:
427         (WebCore::MediaStreamAudioSourceNode::mediaStream): Deleted.
428         * Modules/webaudio/OfflineAudioCompletionEvent.h:
429         (WebCore::OfflineAudioCompletionEvent::renderedBuffer): Deleted.
430         * Modules/webaudio/OfflineAudioDestinationNode.h:
431         (WebCore::OfflineAudioDestinationNode::create): Deleted.
432         * Modules/webaudio/PannerNode.h:
433         (WebCore::PannerNode::create): Deleted.
434         (WebCore::PannerNode::panningModel const): Deleted.
435         (WebCore::PannerNode::position const): Deleted.
436         (WebCore::PannerNode::setPosition): Deleted.
437         (WebCore::PannerNode::orientation const): Deleted.
438         (WebCore::PannerNode::setOrientation): Deleted.
439         (WebCore::PannerNode::velocity const): Deleted.
440         (WebCore::PannerNode::setVelocity): Deleted.
441         (WebCore::PannerNode::refDistance): Deleted.
442         (WebCore::PannerNode::setRefDistance): Deleted.
443         (WebCore::PannerNode::maxDistance): Deleted.
444         (WebCore::PannerNode::setMaxDistance): Deleted.
445         (WebCore::PannerNode::rolloffFactor): Deleted.
446         (WebCore::PannerNode::setRolloffFactor): Deleted.
447         (WebCore::PannerNode::coneInnerAngle const): Deleted.
448         (WebCore::PannerNode::setConeInnerAngle): Deleted.
449         (WebCore::PannerNode::coneOuterAngle const): Deleted.
450         (WebCore::PannerNode::setConeOuterAngle): Deleted.
451         (WebCore::PannerNode::coneOuterGain const): Deleted.
452         (WebCore::PannerNode::setConeOuterGain): Deleted.
453         (WebCore::PannerNode::distanceGain): Deleted.
454         (WebCore::PannerNode::coneGain): Deleted.
455         * Modules/webaudio/PeriodicWave.h:
456         (WebCore::PeriodicWave::rateScale const): Deleted.
457         (WebCore::PeriodicWave::periodicWaveSize const): Deleted.
458         (WebCore::PeriodicWave::sampleRate const): Deleted.
459         (WebCore::PeriodicWave::numberOfRanges const): Deleted.
460         * Modules/webaudio/RealtimeAnalyser.h:
461         * Modules/webaudio/ScriptProcessorNode.h:
462         (WebCore::ScriptProcessorNode::bufferSize const): Deleted.
463         (WebCore::ScriptProcessorNode::doubleBufferIndex const): Deleted.
464         (WebCore::ScriptProcessorNode::swapBuffers): Deleted.
465         * Modules/webaudio/WaveShaperDSPKernel.h:
466         (WebCore::WaveShaperDSPKernel::waveShaperProcessor): Deleted.
467         * Modules/webaudio/WaveShaperProcessor.h:
468         (WebCore::WaveShaperProcessor::curve): Deleted.
469         (WebCore::WaveShaperProcessor::oversample const): Deleted.
470         * dom/MessagePort.h:
471         * html/FormAssociatedElement.h:
472         * loader/LinkPreloadResourceClients.h:
473         * page/WheelEventDeltaFilter.h:
474         * page/mac/WheelEventDeltaFilterMac.h:
475         * platform/RemoteCommandListener.h:
476         * platform/audio/AudioDSPKernel.h:
477         * platform/audio/AudioProcessor.h:
478         * platform/audio/PlatformMediaSession.h:
479         * platform/graphics/avfoundation/objc/VideoFullscreenLayerManagerObjC.h:
480         * platform/mediastream/libwebrtc/LibWebRTCAudioModule.h:
481         * platform/mediastream/libwebrtc/LibWebRTCProviderCocoa.h:
482         * workers/service/ServiceWorkerContainer.h:
483
484 2018-07-09  Simon Fraser  <simon.fraser@apple.com>
485
486         Shrink RenderSVGShape
487         https://bugs.webkit.org/show_bug.cgi?id=187459
488
489         Reviewed by Zalan Bujtas.
490
491         Shrink RenderSVGShape from 328 to 320 bytes by moving the bits before the AffineTransform,
492         which is 16-byte aligned. This saves 9.6KB on nytimes.com.
493
494         * rendering/svg/RenderSVGShape.h:
495
496 2018-07-09  Simon Fraser  <simon.fraser@apple.com>
497
498         Shrink CSSFontFace
499         https://bugs.webkit.org/show_bug.cgi?id=187456
500
501         Reviewed by Anders Carlsson.
502
503         Shrink CSSFontFace by 56 bytes, from 288 to 256 bytes, mostly by defining enums as 8-bit,
504         but also re-ordering the member variables. There are over 400 of these objects on nytimes.com,
505         so this saves about 22KB.
506
507         * css/CSSFontFace.cpp:
508         (WebCore::CSSFontFace::CSSFontFace):
509         * css/CSSFontFace.h:
510         * platform/text/TextFlags.h:
511         * rendering/style/RenderStyleConstants.h:
512
513 2018-07-09  Commit Queue  <commit-queue@webkit.org>
514
515         Unreviewed, rolling out r233612.
516         https://bugs.webkit.org/show_bug.cgi?id=187475
517
518         Revision caused the api test LinkColorWithSystemAppearance to
519         fail on all systems. (Requested by Truitt on #webkit).
520
521         Reverted changeset:
522
523         "Semantic colors don't update when accessibility Increase
524         Contrast mode is enabled."
525         https://bugs.webkit.org/show_bug.cgi?id=187425
526         https://trac.webkit.org/changeset/233612
527
528 2018-07-09  Philippe Normand  <pnormand@igalia.com>
529
530         [GStreamer] Remove useless workaround
531         https://bugs.webkit.org/show_bug.cgi?id=186921
532
533         Reviewed by Xabier Rodriguez-Calvar.
534
535         In bug 67407 a workaround was added for GStreamer 0.10. With 1.x
536         the media/video-reverse-play-duration.html test passes without any
537         workaround needed. The other test mentioned in that bug was
538         removed, it seems.
539
540         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:
541         (WebCore::MediaPlayerPrivateGStreamer::playbackPosition const):
542         Removed early return, position queries shouldn't be avoided on EOS
543         because the pipeline is in READY state, not NULL.
544         (WebCore::MediaPlayerPrivateGStreamer::currentMediaTime const):
545
546 2018-07-08  Simon Fraser  <simon.fraser@apple.com>
547
548         Optimize packing of RenderSVGViewportContainer
549         https://bugs.webkit.org/show_bug.cgi?id=187458
550
551         Reviewed by Zalan Bujtas.
552
553         Shrink RenderSVGViewportContainer from 296 bytes to 280 bytes, saving about 6KB on nytimes.com.
554
555         * rendering/svg/RenderSVGContainer.cpp:
556         (WebCore::RenderSVGContainer::RenderSVGContainer):
557         * rendering/svg/RenderSVGContainer.h:
558         * rendering/svg/RenderSVGViewportContainer.h:
559
560 2018-07-08  Simon Fraser  <simon.fraser@apple.com>
561
562         Shrink RenderTableSection
563         https://bugs.webkit.org/show_bug.cgi?id=187457
564
565         Reviewed by Zalan Bujtas.
566
567         Shrink RenderTableSection from 344 to 336 bytes, saving about 3.6KB on nytimes.com.
568
569         * rendering/RenderTableSection.h:
570
571 2018-07-08  Simon Fraser  <simon.fraser@apple.com>
572
573         Optimize packing of RootInlineBox
574         https://bugs.webkit.org/show_bug.cgi?id=187430
575
576         Reviewed by Zalan Bujtas.
577
578         In InlineBox, move the m_logicalWidth float up next to the m_expansion float with m_topLeft next; this
579         avoids padding of 4 bytes after this float.
580         
581         In InlineFlowBox, move the bitfields before the pointers so they can snug up into the
582         4 bytes after m_expansion in the base class.
583         
584         The comment about m_lineBreakPos's padding in RootInlineBox is wrong; just move it to the end
585         to avoid padding before the m_lineBreakObj pointer.
586         
587         Make m_logicalWidth private and have derived classes use the accessor.
588         
589         Make EllipsisBox 4 bytes smaller too.
590
591         * rendering/EllipsisBox.cpp:
592         (WebCore::EllipsisBox::EllipsisBox):
593         (WebCore::EllipsisBox::paintMarkupBox):
594         (WebCore::EllipsisBox::nodeAtPoint):
595         * rendering/EllipsisBox.h:
596         * rendering/InlineBox.h:
597         (WebCore::InlineBox::InlineBox):
598         * rendering/InlineFlowBox.cpp:
599         * rendering/InlineFlowBox.h:
600         (WebCore::InlineFlowBox::InlineFlowBox):
601         (WebCore::InlineFlowBox::frameRectIncludingLineHeight const):
602         * rendering/InlineTextBox.cpp:
603         (WebCore::InlineTextBox::localSelectionRect const):
604         (WebCore::InlineTextBox::paint):
605         (WebCore::InlineTextBox::paintPlatformDocumentMarker):
606         (WebCore::InlineTextBox::paintMarkedTextBackground):
607         (WebCore::InlineTextBox::paintCompositionUnderline const):
608         * rendering/RootInlineBox.cpp:
609         (WebCore::RootInlineBox::RootInlineBox):
610         * rendering/RootInlineBox.h:
611
612 2018-07-08  Antoine Quint  <graouts@apple.com>
613
614         [Web Animations] A number of tests report an incorrect computed offset
615         https://bugs.webkit.org/show_bug.cgi?id=187410
616         <rdar://problem/41905790>
617
618         Reviewed by Dean Jackson.
619
620         While we would correctly avoid computing missing offsets when processing the first keyframe following the last
621         keyframes with a specified offset, we were forgetting to update the index of the last keyframe with a specified
622         offset which meant we would accidentally override a specified offset with an automically-computed one.
623
624         * animation/KeyframeEffectReadOnly.cpp:
625         (WebCore::computeMissingKeyframeOffsets):
626
627 2018-07-08  David Kilzer  <ddkilzer@apple.com>
628
629         DOMMatrix.invertSelf() returns garbage values for a non-invertible matrix
630         <https://webkit.org/b/187446>
631         <rdar://problem/41853187>
632
633         Reviewed by Daniel Bates.
634
635         Test: http/wpt/css/geometry/DOMMatrix-invertSelf.html
636
637         * css/DOMMatrix.cpp:
638         (WebCore::DOMMatrix::invertSelf): Add missing `else`, and
639         restructure to use positive logic.
640
641 2018-07-07  Wenson Hsieh  <wenson_hsieh@apple.com>
642
643         Introduce a layout milestone to track when the document contains a large number of rendered characters
644         https://bugs.webkit.org/show_bug.cgi?id=187412
645         <rdar://problem/41744338>
646
647         Reviewed by Ryosuke Niwa.
648
649         Implements a new layout milestone: `DidRenderSignificantAmountOfText`. This is similar to the existing
650         `DidFirstVisuallyNonEmptyLayout` milestone, but with a few important additional constraints:
651
652         • The minimum threshold of rendered characters is much larger (3000 instead of 200).
653         • The mean length of a text node must be large (at least 50).
654
655         This is a (computationally) lightweight heuristic intended to estimate the likelihood that a page is capable of
656         being presented in Reader mode. In many article-like pages, the average length of a text node is significantly
657         longer than other types of pages; thus, on pages where the average length of a text node is very large *and*
658         there is a large quantity of text, we can use this as a cue to opportunistically detect and enter Safari reader
659         mode on watchOS.
660
661         Test: RenderingProgressTests.DidRenderSignificantAmountOfText
662
663         * page/FrameView.cpp:
664         (WebCore::FrameView::reset):
665
666         Clear out new state members that keep track of whether the significant rendered text milestone has been met.
667
668         (WebCore::elementOverflowRectIsLargerThanThreshold):
669
670         Factor out logic to grab the overflow height of an element into a separate helper function.
671
672         (WebCore::FrameView::qualifiesAsVisuallyNonEmpty const):
673         (WebCore::FrameView::updateSignificantRenderedTextMilestoneIfNeeded):
674
675         Determines whether to fire this new milestone after the next layout pass is finished. The logic here is similar
676         to the logic in qualifiesAsVisuallyNonEmpty, requiring that there are not still pending stylesheets in the head
677         and that the document height is at least a minimum threshold. However, unlike the first visually non-empty
678         layout, this milestone is never guaranteed to fire.
679
680         (WebCore::FrameView::fireLayoutRelatedMilestonesIfNeeded):
681         * page/FrameView.h:
682         (WebCore::FrameView::incrementVisuallyNonEmptyCharacterCount):
683         * page/LayoutMilestones.h:
684
685 2018-07-06  Timothy Hatcher  <timothy@apple.com>
686
687         Semantic colors don't update when accessibility Increase Contrast mode is enabled.
688         https://bugs.webkit.org/show_bug.cgi?id=187425
689         rdar://problem/39948240
690
691         Reviewed by Tim Horton.
692
693         Added a listener for the accessibility change notification to invalidate our color caches.
694
695         Removed calls to RenderTheme::singleton().platformColorsDidChange() in Page, since that
696         ended up calling Page::updateStyleForAllPagesAfterGlobalChangeInEnvironment multiple times.
697         Instead, changed the functions to use the new instance version instead.
698
699         * page/Page.cpp:
700         (WebCore::Page::updateStyleAfterChangeInEnvironment): Added. Gives Page a direct way to do this work
701         per instance instead of on all pages (since appearance can be difference per view).
702         (WebCore::Page::updateStyleForAllPagesAfterGlobalChangeInEnvironment): Call updateStyleAfterChangeInEnvironment.
703         (WebCore::Page::setUseSystemAppearance): Call updateStyleAfterChangeInEnvironment.
704         (WebCore::Page::setUseDarkAppearance): Added. Call updateStyleAfterChangeInEnvironment.
705         * page/Page.h:
706         (WebCore::Page::setUseDarkAppearance): Moved to the implementation file.
707         * platform/mac/LocalDefaultSystemAppearance.mm:
708         (WebCore::LocalDefaultSystemAppearance::LocalDefaultSystemAppearance): Removed recursive check since it was interfering
709         with the setting of m_usingDarkAppearance and causing the wrong color cache to be used.
710         (WebCore::LocalDefaultSystemAppearance::~LocalDefaultSystemAppearance): Ditto.
711         * rendering/RenderThemeMac.mm:
712         (-[WebCoreRenderThemeNotificationObserver init]): Listen for NSWorkspaceAccessibilityDisplayOptionsDidChangeNotification.
713         (-[WebCoreRenderThemeNotificationObserver systemColorsDidChange:]): Removed assert since multiple notifications are used now.
714
715 2018-07-06  Ryosuke Niwa  <rniwa@webkit.org>
716
717         Make ReasonForSuspension enum class
718         https://bugs.webkit.org/show_bug.cgi?id=187405
719
720         Reviewed by Zalan Bujtas.
721
722         Made ReasonForSuspension an enum class instead of enum and moved out of ActiveDOMObject.
723
724         * Modules/geolocation/Geolocation.cpp:
725         (WebCore::Geolocation::suspend):
726         * Modules/websockets/WebSocket.cpp:
727         (WebCore::WebSocket::suspend):
728         * dom/ActiveDOMObject.h:
729         * dom/Document.cpp:
730         (WebCore::Document::didBecomeCurrentDocumentInFrame):
731         (WebCore::Document::suspendActiveDOMObjects):
732         (WebCore::Document::resumeActiveDOMObjects):
733         (WebCore::Document::suspend):
734         (WebCore::Document::resume):
735         (WebCore::Document::suspendScheduledTasks):
736         (WebCore::Document::resumeScheduledTasks):
737         * dom/Document.h:
738         * dom/ScriptExecutionContext.cpp:
739         (WebCore::ScriptExecutionContext::suspendActiveDOMObjects):
740         (WebCore::ScriptExecutionContext::resumeActiveDOMObjects):
741         * dom/ScriptExecutionContext.h:
742         (WebCore::ScriptExecutionContext::reasonForSuspendingActiveDOMObjects const):
743         * history/CachedFrame.cpp:
744         (WebCore::CachedFrameBase::restore):
745         (WebCore::CachedFrame::CachedFrame):
746         * html/HTMLMediaElement.cpp:
747         (WebCore::HTMLMediaElement::suspend):
748         * html/HTMLSourceElement.cpp:
749         (WebCore::HTMLSourceElement::suspend):
750         * inspector/PageScriptDebugServer.cpp:
751         (WebCore::PageScriptDebugServer::setJavaScriptPaused):
752         * loader/FrameLoader.cpp:
753         (WebCore::FrameLoader::commitProvisionalLoad):
754         * page/Frame.cpp:
755         (WebCore::Frame::suspendActiveDOMObjectsAndAnimations):
756         (WebCore::Frame::resumeActiveDOMObjectsAndAnimations):
757         * page/PageGroupLoadDeferrer.cpp:
758         (WebCore::PageGroupLoadDeferrer::PageGroupLoadDeferrer):
759         (WebCore::PageGroupLoadDeferrer::~PageGroupLoadDeferrer):
760         * xml/XMLHttpRequest.cpp:
761         (WebCore::XMLHttpRequest::suspend):
762
763 2018-07-06  Nan Wang  <n_wang@apple.com>
764
765         AX: add a subrole for meter elements on macOS
766         https://bugs.webkit.org/show_bug.cgi?id=187409
767         <rdar://problem/41905702>
768
769         Reviewed by Chris Fleizach.
770
771         Test: accessibility/mac/meter-subrole.html
772
773         * accessibility/mac/WebAccessibilityObjectWrapperMac.mm:
774         (-[WebAccessibilityObjectWrapper subrole]):
775
776 2018-07-06  Jeremy Jones  <jeremyj@apple.com>
777
778         For <video> element, use video fullscreen instead of element fullscreen.
779         https://bugs.webkit.org/show_bug.cgi?id=186093
780         rdar://problem/40144751
781
782         Reviewed by Jer Noble.
783
784         Some pages use webkitRequestFullscreen directly on the video element, without any custom controls.
785         This will prevent native fullscreeen presentation mode conrols from being used.
786
787         This change makes webkitRequestFullscreen on a video element call webKitSetPresentationMode.
788
789         * dom/Element.h:
790         * html/HTMLVideoElement.cpp:
791         (WebCore::HTMLVideoElement::webkitRequestFullscreen):
792         * html/HTMLVideoElement.h:
793
794 2018-07-06  Youenn Fablet  <youenn@apple.com>
795
796         WebRTC MediaStreamTrack Enable / Disable causes video delay / lag
797         https://bugs.webkit.org/show_bug.cgi?id=186889
798         <rdar://problem/41370285>
799
800         Reviewed by Eric Carlson.
801
802         Libwebrtc expects a continuous flow of calls for audio data since the API
803         does not provide any possiblity to give timestamps.
804
805         We were optimizing previously when a source is muted so that we would not transmit audio data.
806         This breaks synchronization between audio and video frames (which are timestamped).
807
808         This patch reverts the optimization and instead makes sure to send zeros for silenced audio tracks.
809
810         This requires MediaStreamTrackPrivate to send audio data even if disabled,
811         so that RealtimeOutgoingAudioSource will continue sending zeros at the correct pace.
812         This also requires WebAudioSourceProviderAVFObjC to exit early if its track is disabled.
813
814         Covered by existing tests.
815         Manual testing shows that synchronization is kept.
816
817         * platform/mediastream/MediaStreamTrackPrivate.cpp:
818         (WebCore::MediaStreamTrackPrivate::audioSamplesAvailable):
819         * platform/mediastream/RealtimeOutgoingAudioSource.cpp:
820         (WebCore::RealtimeOutgoingAudioSource::RealtimeOutgoingAudioSource):
821         (WebCore::RealtimeOutgoingAudioSource::initializeConverter):
822         (WebCore::RealtimeOutgoingAudioSource::stop):
823         (WebCore::RealtimeOutgoingAudioSource::sourceMutedChanged):
824         (WebCore::RealtimeOutgoingAudioSource::sourceEnabledChanged):
825         (WebCore::RealtimeOutgoingAudioSource::handleMutedIfNeeded): Deleted.
826         * platform/mediastream/RealtimeOutgoingAudioSource.h:
827         (WebCore::RealtimeOutgoingAudioSource::pullAudioData):
828         (WebCore::RealtimeOutgoingAudioSource::isSilenced const):
829         (WebCore::RealtimeOutgoingAudioSource::sendSilence): Deleted.
830         * platform/mediastream/mac/RealtimeOutgoingAudioSourceCocoa.cpp:
831         (WebCore::RealtimeOutgoingAudioSourceCocoa::pullAudioData):
832         (WebCore::RealtimeOutgoingAudioSourceCocoa::handleMutedIfNeeded): Deleted.
833         (WebCore::RealtimeOutgoingAudioSourceCocoa::sendSilence): Deleted.
834         * platform/mediastream/mac/RealtimeOutgoingAudioSourceCocoa.h:
835         * platform/mediastream/mac/WebAudioSourceProviderAVFObjC.mm:
836         (WebCore::WebAudioSourceProviderAVFObjC::audioSamplesAvailable):
837
838 2018-07-06  Youenn Fablet  <youenn@apple.com>
839
840         Make RealtimeOutgoingVideoSource use DestructionThread::Main
841         https://bugs.webkit.org/show_bug.cgi?id=187402
842
843         Reviewed by Chris Dumez.
844
845         No change of behavior.
846
847         * platform/mediastream/RealtimeOutgoingVideoSource.h:
848
849 2018-07-06  Ryosuke Niwa  <rniwa@webkit.org>
850
851         Make HTMLMediaElement::remove*Track take a Ref<>&&
852         https://bugs.webkit.org/show_bug.cgi?id=187407
853
854         Reviewed by Zalan Bujtas.
855
856         Make these functions take Ref<>&& since they can delete track objects.
857
858         * html/HTMLMediaElement.cpp:
859         (WebCore::HTMLMediaElement::removeAudioTrack):
860         (WebCore::HTMLMediaElement::removeTextTrack):
861         (WebCore::HTMLMediaElement::removeVideoTrack):
862         (WebCore::HTMLMediaElement::forgetResourceSpecificTracks):
863         * html/HTMLMediaElement.h:
864
865 2018-07-06  Antoine Quint  <graouts@apple.com>
866
867         [Web Animations] Make WPT test at interfaces/KeyframeEffect/processing-a-keyframes-argument-002.html pass reliably
868         https://bugs.webkit.org/show_bug.cgi?id=186502
869         <rdar://problem/41000229>l
870
871         Reviewed by Dean Jackson.
872
873         Ensure we only attempt to convert defined objects or we risk to throw errors in valid situations.
874
875         * animation/KeyframeEffectReadOnly.cpp:
876         (WebCore::processKeyframeLikeObject):
877
878 2018-07-05  Antoine Quint  <graouts@apple.com>
879
880         [Web Animations] Make WPT test at interfaces/Animation/finish.html pass reliably
881         https://bugs.webkit.org/show_bug.cgi?id=186496
882         <rdar://problem/41000179>
883
884         Reviewed by Dean Jackson.
885
886         We used to only resolve animations that had a target element, but animations need not have a target and their
887         current time should still advance so that their finished promise may resolve. We now maintain a list of animations
888         without targets and we iterate through them as well as animations with targets in DocumentTimeline::updateAnimations().
889
890         * animation/AnimationTimeline.cpp:
891         (WebCore::AnimationTimeline::addAnimation):
892         (WebCore::AnimationTimeline::removeAnimation):
893         (WebCore::AnimationTimeline::animationWasAddedToElement):
894         (WebCore::AnimationTimeline::animationWasRemovedFromElement):
895         * animation/AnimationTimeline.h:
896         (WebCore::AnimationTimeline:: const):
897         * animation/DocumentTimeline.cpp:
898         (WebCore::DocumentTimeline::updateAnimations):
899         * animation/WebAnimation.cpp:
900         (WebCore::WebAnimation::resolve):
901         * animation/WebAnimation.h:
902
903 2018-07-05  Antoine Quint  <graouts@apple.com>
904
905         [Web Animations] Make WPT test at interfaces/Animation/finished.html pass reliably
906         https://bugs.webkit.org/show_bug.cgi?id=186497
907         <rdar://problem/41000193>
908
909         Reviewed by Dean Jackson.
910
911         We need to ensure the finished state is updated as a result of any timing property changing.
912
913         * animation/AnimationEffectReadOnly.cpp:
914         (WebCore::AnimationEffectReadOnly::timingDidChange):
915         * animation/WebAnimation.cpp:
916         (WebCore::WebAnimation::effectTimingPropertiesDidChange):
917         * animation/WebAnimation.h:
918
919 2018-07-06  Antoine Quint  <graouts@apple.com>
920
921         [Web Animations] Using a Web Animation leaks the Document
922         https://bugs.webkit.org/show_bug.cgi?id=187088
923         <rdar://problem/41392046>
924
925         Reviewed by Darin Adler.
926
927         Test: webanimations/leak-document-with-web-animation.html
928
929         We need to ensure that any remaining animation is cleared when the DocumentTimeline is detached from its Document.
930         We rename WebAnimation::prepareAnimationForRemoval() to WebAnimation::remove() since it really actively disassociates
931         the animation from its timeline.
932
933         An earlier version of this patch (r233349) was rolled out due to crashes caught in the ASan configuration. The following
934         changes were made to make it safe:
935
936         - We protect the DocumentAnimationScheduler instance in displayRefreshFired() against code that might run in a
937         requestAnimationFrame() callback that would trigger the object to be deleted.
938
939         - We protect the WebAnimation instance in remove() against setEffectInternal() or setTimelineInternal() potentially
940         causing the object to be deleted. Similar protections were addede to setEffect() and setTimeline().
941
942         - We changed ~DocumentTimeline() to a default implementation to ensure it calls ~DisplayRefreshMonitorClient()
943         to avoid callbacks after the object has been marked for deletion.
944
945
946         * animation/AnimationTimeline.cpp:
947         (WebCore::AnimationTimeline::removeAnimationsForElement): We no longer need the call to removeAnimation()
948         since the new WebAnimation::remove() method will also set the timeline to null which will eventually call
949         removeAnimation() on the disassociated timeline.
950         * animation/DeclarativeAnimation.cpp:
951         (WebCore::DeclarativeAnimation::remove):
952         (WebCore::DeclarativeAnimation::prepareAnimationForRemoval): Deleted.
953         * animation/DeclarativeAnimation.h:
954         * animation/DocumentAnimationScheduler.cpp:
955         (WebCore::DocumentAnimationScheduler::displayRefreshFired):
956         * animation/DocumentTimeline.cpp:
957         (WebCore::DocumentTimeline::detachFromDocument): Call remove() on all known animations.
958         (WebCore::DocumentTimeline::~DocumentTimeline): Deleted.
959         * animation/WebAnimation.cpp:
960         (WebCore::WebAnimation::remove): Set the timeline to null to fully disassociate this animation from its timeline.
961         (WebCore::WebAnimation::setEffect):
962         (WebCore::WebAnimation::setEffectInternal):
963         (WebCore::WebAnimation::setTimeline): Factor the internal timeline-association code out of this JS API method so
964         that we can call this code without any JS-facing implications.
965         (WebCore::WebAnimation::setTimelineInternal):
966         (WebCore::WebAnimation::prepareAnimationForRemoval): Deleted.
967         * animation/WebAnimation.h:
968
969 2018-07-06  Daniel Bates  <dabates@apple.com>
970
971         Remove Strong Confirmation Password button
972         https://bugs.webkit.org/show_bug.cgi?id=187306
973         <rdar://problem/41795185>
974
975         Reviewed by Sam Weinig.
976
977         Remove support for the Strong Confirmation Password button because we never made use of it.
978
979         * English.lproj/Localizable.strings:
980         * accessibility/ios/WebAccessibilityObjectWrapperIOS.mm:
981         (-[WebAccessibilityObjectWrapper _accessibilityIsStrongPasswordField]):
982         * accessibility/mac/WebAccessibilityObjectWrapperMac.mm:
983         (-[WebAccessibilityObjectWrapper accessibilityAttributeValue:]):
984         * html/HTMLInputElement.h:
985         (WebCore::HTMLInputElement::hasAutoFillStrongPasswordButton const):
986         * html/HTMLTextFormControlElement.h:
987         * html/TextFieldInputType.cpp:
988         (WebCore::autoFillButtonTypeToAccessibilityLabel):
989         (WebCore::autoFillButtonTypeToAutoFillButtonText):
990         (WebCore::autoFillButtonTypeToAutoFillButtonPseudoClassName):
991         (WebCore::isAutoFillButtonTypeChanged):
992         * platform/LocalizedStrings.cpp:
993         (WebCore::AXAutoFillStrongConfirmationPasswordLabel): Deleted.
994         * platform/LocalizedStrings.h:
995         * rendering/RenderTextControlSingleLine.cpp:
996         (WebCore::RenderTextControlSingleLine::layout):
997         * testing/Internals.cpp:
998         (WebCore::toAutoFillButtonType):
999         (WebCore::toInternalsAutoFillButtonType):
1000         * testing/Internals.h:
1001         * testing/Internals.idl:
1002
1003 2018-07-06  Carlos Garcia Campos  <cgarcia@igalia.com>
1004
1005         [GTK][WPE] REGRESSION(r233239): proxy settings not applied after r233239
1006         https://bugs.webkit.org/show_bug.cgi?id=187381
1007
1008         Reviewed by Yusuke Suzuki.
1009
1010         This is because the static variable for proxy settings was replaced by a NeverDestroyed, but the function is not
1011         returning a reference, but a copy. This is causing several unit tests to fail.
1012
1013         * platform/network/soup/SoupNetworkSession.cpp:
1014         (WebCore::proxySettings):
1015
1016 2018-07-06  Frederic Wang  <fwang@igalia.com>
1017
1018         [Crash] Illegal use of uninitialized std::optional value in WebCore::AnimationBase::updateStateMachine
1019         https://bugs.webkit.org/show_bug.cgi?id=187382
1020
1021         Reviewed by Carlos Garcia Campos.
1022
1023         WebCore::AnimationBase::updateStateMachine has two potential places where the use of an
1024         uninitialized std:optional value is possible and one of them is hit when using Google drive.
1025         Since that old animation code is going to be removed soon, we just quickly patch this issue
1026         via value_or() so that we can restore the ASSERT added in bug 186536.
1027
1028         No new tests, code is going to be removed soon.
1029
1030         * page/animation/AnimationBase.cpp:
1031         (WebCore::AnimationBase::updateStateMachine): Use value_or(0) to avoid potential crashes.
1032
1033 2018-07-06  Frederic Wang  <fwang@igalia.com>
1034
1035         Rename HTMLTreeBuilder::didCreateCustomOrCallbackElement
1036         https://bugs.webkit.org/show_bug.cgi?id=187317
1037
1038         Reviewed by Ryosuke Niwa.
1039
1040         This function is called with a new custom element or the fallback HTMLUnknownElement element
1041         so we rename it didCreateCustomOrFallbackElement.
1042
1043         No new tests, behavior unchanged.
1044
1045         * html/parser/HTMLDocumentParser.cpp:
1046         (WebCore::HTMLDocumentParser::runScriptsForPausedTreeBuilder):
1047         * html/parser/HTMLTreeBuilder.cpp:
1048         (WebCore::HTMLTreeBuilder::didCreateCustomOrFallbackElement):
1049         (WebCore::HTMLTreeBuilder::didCreateCustomOrCallbackElement): Deleted.
1050         * html/parser/HTMLTreeBuilder.h:
1051
1052 2018-07-05  Ryosuke Niwa  <rniwa@webkit.org>
1053
1054         REGRESSION(r233496): macOS Sierra hits debug assertions in TrackListBase::suspend
1055         https://bugs.webkit.org/show_bug.cgi?id=187378
1056         <rdar://problem/41878885>
1057
1058         Reviewed by Eric Carlson.
1059
1060         These assertions were wrong since inline debugger, alert, etc... can suspend active DOM objects without
1061         calling canSuspendForDocumentSuspension. Fixed the bug by removing the assertion and instead suspending
1062         and resuming the generic event queue.
1063
1064         * Modules/mediasource/MediaSource.cpp:
1065         (WebCore::MediaSource::suspend):
1066         (WebCore::MediaSource::resume):
1067         * Modules/mediasource/SourceBuffer.cpp:
1068         (WebCore::SourceBuffer::suspend):
1069         (WebCore::SourceBuffer::resume):
1070         * Modules/mediasource/SourceBufferList.cpp:
1071         (WebCore::SourceBufferList::suspend):
1072         (WebCore::SourceBufferList::resume):
1073         * html/track/TrackListBase.cpp:
1074         (WebCore::TrackListBase::suspend):
1075         (WebCore::TrackListBase::resume):
1076
1077 2018-07-05  Youenn Fablet  <youenn@apple.com>
1078
1079         REGRESSION (r230843): Flash doesn't work; Produces blue box on page
1080         https://bugs.webkit.org/show_bug.cgi?id=187346
1081         <rdar://problem/41773974>
1082
1083         Reviewed by Ryosuke Niwa.
1084
1085         Introduce clearPagesPluginData used by WebProcess when a plugin policy changes.
1086         Add a new internals API to get the plugin count as navigator.plugin is filtering plugins.
1087
1088         Test: http/tests/plugins/plugin-allow-then-reload.html
1089
1090         * plugins/PluginData.h:
1091         * plugins/PluginInfoProvider.cpp:
1092         (WebCore::PluginInfoProvider::clearPagesPluginData):
1093         * plugins/PluginInfoProvider.h:
1094         * testing/Internals.cpp:
1095         (WebCore::Internals::pluginCount):
1096         * testing/Internals.h:
1097         * testing/Internals.idl:
1098
1099 2018-07-05  Brady Eidson  <beidson@apple.com>
1100
1101         IndexedDB operations in a Page fail after a StorageProcess crash.
1102         <rdar://problem/41626526> and https://bugs.webkit.org/show_bug.cgi?id=187123
1103
1104         Reviewed by Alex Christensen.
1105
1106         Test: storage/indexeddb/modern/opendatabase-after-storage-crash.html
1107
1108         When the connection to a StorageProcess goes away, explicitly tell all of the WebPages
1109         in the WebProcess about it.
1110         
1111         This puts Documents/Workers in an error mode where requests fail instead of timeout.
1112         It also clears the Page's connection so *new* Documents and Workers will get a fresh 
1113         new connection that works.
1114         
1115         * Modules/indexeddb/client/IDBConnectionToServer.cpp:
1116         (WebCore::IDBClient::IDBConnectionToServer::callResultFunctionLater):
1117         (WebCore::IDBClient::IDBConnectionToServer::deleteDatabase):
1118         (WebCore::IDBClient::IDBConnectionToServer::openDatabase):
1119         (WebCore::IDBClient::IDBConnectionToServer::createObjectStore):
1120         (WebCore::IDBClient::IDBConnectionToServer::deleteObjectStore):
1121         (WebCore::IDBClient::IDBConnectionToServer::renameObjectStore):
1122         (WebCore::IDBClient::IDBConnectionToServer::clearObjectStore):
1123         (WebCore::IDBClient::IDBConnectionToServer::createIndex):
1124         (WebCore::IDBClient::IDBConnectionToServer::deleteIndex):
1125         (WebCore::IDBClient::IDBConnectionToServer::renameIndex):
1126         (WebCore::IDBClient::IDBConnectionToServer::putOrAdd):
1127         (WebCore::IDBClient::IDBConnectionToServer::getRecord):
1128         (WebCore::IDBClient::IDBConnectionToServer::getAllRecords):
1129         (WebCore::IDBClient::IDBConnectionToServer::getCount):
1130         (WebCore::IDBClient::IDBConnectionToServer::deleteRecord):
1131         (WebCore::IDBClient::IDBConnectionToServer::openCursor):
1132         (WebCore::IDBClient::IDBConnectionToServer::iterateCursor):
1133         (WebCore::IDBClient::IDBConnectionToServer::establishTransaction):
1134         (WebCore::IDBClient::IDBConnectionToServer::commitTransaction):
1135         (WebCore::IDBClient::IDBConnectionToServer::didFinishHandlingVersionChangeTransaction):
1136         (WebCore::IDBClient::IDBConnectionToServer::abortTransaction):
1137         (WebCore::IDBClient::IDBConnectionToServer::didFireVersionChangeEvent):
1138         (WebCore::IDBClient::IDBConnectionToServer::confirmDidCloseFromServer):
1139         (WebCore::IDBClient::IDBConnectionToServer::connectionToServerLost):
1140         (WebCore::IDBClient::IDBConnectionToServer::openDBRequestCancelled):
1141         (WebCore::IDBClient::IDBConnectionToServer::databaseConnectionPendingClose):
1142         (WebCore::IDBClient::IDBConnectionToServer::databaseConnectionClosed):
1143         (WebCore::IDBClient::IDBConnectionToServer::abortOpenAndUpgradeNeeded):
1144         (WebCore::IDBClient::IDBConnectionToServer::getAllDatabaseNames):
1145         * Modules/indexeddb/client/IDBConnectionToServer.h:
1146
1147         * Modules/indexeddb/shared/IDBError.h:
1148         (WebCore::IDBError::serverConnectionLostError):
1149
1150         * page/Page.cpp:
1151         (WebCore::Page::setSessionID):
1152         (WebCore::Page::idbConnection):
1153         (WebCore::Page::optionalIDBConnection):
1154         (WebCore::Page::clearIDBConnection):
1155         * page/Page.h:
1156
1157 2018-07-05  Ryosuke Niwa  <rniwa@webkit.org>
1158
1159         Youtube video pages crash after a couple of minutes
1160         https://bugs.webkit.org/show_bug.cgi?id=187316
1161
1162         Reviewed by Antti Koivisto.
1163
1164         The crash was caused by HTMLMediaElement::stopWithoutDestroyingMediaPlayer invoking updatePlaybackControlsManager,
1165         which traverses all media players across different documents including the one in the main frame while its iframe
1166         is getting removed (to update the Touch Bar's media control).
1167
1168         Fixed the bug by making this code async in both stopWithoutDestroyingMediaPlayer and ~HTMLMediaElement. To do this,
1169         this patch moves the timer to update the playback controls manager from HTMLMediaElement to Page since scheduling
1170         a timer owned by HTMLMediaElement in its destructor wouldn't work as the timer would get destructed immediately.
1171
1172         Also replaced the call to clientWillPausePlayback by a call to stopSession in stopWithoutDestroyingMediaPlayer
1173         since the former also updates the layout synchronously via updateNowPlayingInfo; the latter function schedules
1174         a timer via scheduleUpdateNowPlayingInfo instead.
1175
1176         Test: media/remove-video-best-media-element-in-main-frame-crash.html
1177
1178         * html/HTMLMediaElement.cpp:
1179         (WebCore::HTMLMediaElement::~HTMLMediaElement): Call scheduleUpdatePlaybackControlsManager now that timer has been
1180         moved to Page.
1181         (WebCore::HTMLMediaElement::bestMediaElementForShowingPlaybackControlsManager): Made this return a RefPtr instead of
1182         a raw pointer while we're at it.
1183         (WebCore::HTMLMediaElement::clearMediaPlayer): Call scheduleUpdatePlaybackControlsManager.
1184         (WebCore::HTMLMediaElement::stopWithoutDestroyingMediaPlayer): Ditto. Also invoke stopSession instead of
1185         clientWillPausePlayback on MediaSession since clientWillPausePlayback will synchronously try to update the layout.
1186         (WebCore::HTMLMediaElement::contextDestroyed):
1187         (WebCore::HTMLMediaElement::stop):
1188         (WebCore::HTMLMediaElement::schedulePlaybackControlsManagerUpdate): Renamed from scheduleUpdatePlaybackControlsManager.
1189         (WebCore::HTMLMediaElement::updatePlaybackControlsManager): Moved to Page::playbackControlsManagerUpdateTimerFired.
1190         * html/HTMLMediaElement.h:
1191         * page/Page.cpp:
1192         (WebCore::Page::Page):
1193         (WebCore::Page::schedulePlaybackControlsManagerUpdate): Added.
1194         (WebCore::Page::playbackControlsManagerUpdateTimerFired): Moved from HTMLMediaElement::updatePlaybackControlsManager.
1195         * page/Page.h:
1196         * testing/Internals.cpp:
1197         (WebCore::Internals::bestMediaElementForShowingPlaybackControlsManager):
1198         * testing/Internals.h:
1199
1200 2018-07-05  Ryosuke Niwa  <rniwa@webkit.org>
1201
1202         REGRESSION(r233496): Crash in WebCore::VideoTrack::clearClient()
1203         https://bugs.webkit.org/show_bug.cgi?id=187377
1204
1205         Reviewed by Simon Fraser.
1206
1207         Clear m_client of an audio track or a video track before removing it from the list
1208         since TrackListBase::m_inbandTracks may hold the last ref to the track.
1209
1210         * html/HTMLMediaElement.cpp:
1211         (WebCore::HTMLMediaElement::removeAudioTrack):
1212         (WebCore::HTMLMediaElement::removeVideoTrack):
1213
1214 2018-07-05  Fujii Hironori  <Hironori.Fujii@sony.com>
1215
1216         REGRESSION(r233495) [cairo] drawGlyphsShadow should use the fast path for zero blur-radius
1217         https://bugs.webkit.org/show_bug.cgi?id=187336
1218
1219         Reviewed by Carlos Garcia Campos.
1220
1221         drawGlyphsShadow has a fast path to draw a shadow without a shadow
1222         layer. Since r233495, it is not used for zero blur-radius shadow.
1223
1224         In Bug 187244, I changed ShadowState::isRequired not to check
1225         blur-radius is zero. This is not a right fix.
1226
1227         This change reverts r233495.
1228
1229         No new tests (Covered by existing tests).
1230
1231         * platform/graphics/cairo/CairoOperations.cpp:
1232         (WebCore::Cairo::ShadowState::isRequired const): Return false if
1233         'blur' is zero.
1234         (WebCore::Cairo::fillRectWithRoundedHole): Use
1235         ShadowState::isVisible instead of ShadowState::isRequired to check
1236         a shadow should be drawn.
1237
1238 2018-07-05  Timothy Hatcher  <timothy@apple.com>
1239
1240         Rename and flip the meaning of defaultAppearance to be useDarkAppearance.
1241         https://bugs.webkit.org/show_bug.cgi?id=187369
1242         rdar://problem/41870420
1243
1244         Reviewed by Tim Horton.
1245
1246         * Modules/mediasession/WebMediaSessionManager.cpp:
1247         (WebCore::WebMediaSessionManager::showPlaybackTargetPicker):
1248         * css/MediaQueryEvaluator.cpp:
1249         (WebCore::prefersDarkInterfaceEvaluate):
1250         * css/StyleColor.h:
1251         * dom/Document.cpp:
1252         (WebCore::Document::useDarkAppearance const):
1253         (WebCore::Document::styleColorOptions const):
1254         (WebCore::Document::useDefaultAppearance const): Deleted.
1255         * dom/Document.h:
1256         * inspector/InspectorOverlay.cpp:
1257         (WebCore::InspectorOverlay::paint):
1258         * page/Page.cpp:
1259         (WebCore::Page::useDarkAppearance const):
1260         (WebCore::Page::defaultAppearance const): Deleted.
1261         * page/Page.h:
1262         (WebCore::Page::setUseDarkAppearance):
1263         (WebCore::Page::setDefaultAppearance): Deleted.
1264         * platform/Theme.h:
1265         * platform/graphics/MediaPlaybackTargetPicker.h:
1266         * platform/graphics/avfoundation/objc/MediaPlaybackTargetPickerMac.h:
1267         * platform/graphics/avfoundation/objc/MediaPlaybackTargetPickerMac.mm:
1268         (WebCore::MediaPlaybackTargetPickerMac::showPlaybackTargetPicker):
1269         * platform/mac/DragImageMac.mm:
1270         (WebCore::createDragImageForLink):
1271         * platform/mac/LocalDefaultSystemAppearance.h:
1272         * platform/mac/LocalDefaultSystemAppearance.mm:
1273         (WebCore::LocalDefaultSystemAppearance::LocalDefaultSystemAppearance):
1274         * platform/mac/ThemeMac.h:
1275         * platform/mac/ThemeMac.mm:
1276         (WebCore::ThemeMac::paint):
1277         * platform/mock/MediaPlaybackTargetPickerMock.cpp:
1278         (WebCore::MediaPlaybackTargetPickerMock::showPlaybackTargetPicker):
1279         * platform/mock/MediaPlaybackTargetPickerMock.h:
1280         * rendering/InlineTextBox.cpp:
1281         (WebCore::InlineTextBox::resolveStyleForMarkedText):
1282         * rendering/RenderLayerBacking.cpp:
1283         (WebCore::RenderLayerBacking::paintContents):
1284         * rendering/RenderLayerCompositor.cpp:
1285         (WebCore::RenderLayerCompositor::paintContents):
1286         * rendering/RenderTheme.cpp:
1287         (WebCore::RenderTheme::paint):
1288         * rendering/RenderThemeMac.mm:
1289         (WebCore::RenderThemeMac::documentViewFor const):
1290         (WebCore::RenderThemeMac::platformActiveSelectionBackgroundColor const):
1291         (WebCore::RenderThemeMac::platformInactiveSelectionBackgroundColor const):
1292         (WebCore::RenderThemeMac::supportsSelectionForegroundColors const):
1293         (WebCore::RenderThemeMac::platformActiveSelectionForegroundColor const):
1294         (WebCore::RenderThemeMac::platformInactiveSelectionForegroundColor const):
1295         (WebCore::RenderThemeMac::platformActiveListBoxSelectionBackgroundColor const):
1296         (WebCore::RenderThemeMac::platformInactiveListBoxSelectionBackgroundColor const):
1297         (WebCore::RenderThemeMac::platformActiveListBoxSelectionForegroundColor const):
1298         (WebCore::RenderThemeMac::platformInactiveListBoxSelectionForegroundColor const):
1299         (WebCore::RenderThemeMac::platformActiveTextSearchHighlightColor const):
1300         (WebCore::RenderThemeMac::colorCache const):
1301         (WebCore::RenderThemeMac::systemColor const):
1302         (WebCore::RenderThemeMac::paintCellAndSetFocusedElementNeedsRepaintIfNecessary):
1303         (WebCore::RenderThemeMac::paintSliderThumb):
1304         * svg/graphics/SVGImage.cpp:
1305         (WebCore::SVGImage::draw):
1306
1307 2018-07-05  Commit Queue  <commit-queue@webkit.org>
1308
1309         Unreviewed, rolling out r233539.
1310         https://bugs.webkit.org/show_bug.cgi?id=187368
1311
1312         Changes made for youtube crashes has caused 15 api failures
1313         (Requested by Truitt on #webkit).
1314
1315         Reverted changeset:
1316
1317         "Youtube video pages crash after a couple of minutes"
1318         https://bugs.webkit.org/show_bug.cgi?id=187316
1319         https://trac.webkit.org/changeset/233539
1320
1321 2018-07-05  Chris Dumez  <cdumez@apple.com>
1322
1323         Update Element API to use qualifiedName instead of name/localName where applicable
1324         https://bugs.webkit.org/show_bug.cgi?id=187347
1325
1326         Reviewed by Darin Adler.
1327
1328         Update Element API to use qualifiedName instead of name/localName where applicable. Naming
1329         is now consistent with the IDL and the specification:
1330         - https://dom.spec.whatwg.org/#element
1331
1332         Our implementation properly deals with qualified names already, even though the parameters
1333         were named localName.
1334
1335         * dom/Element.cpp:
1336         (WebCore::Element::getAttribute const):
1337         (WebCore::Element::toggleAttribute):
1338         (WebCore::Element::setAttribute):
1339         (WebCore::Element::removeAttribute):
1340         (WebCore::Element::getAttributeNode):
1341         (WebCore::Element::hasAttribute const):
1342         * dom/Element.h:
1343
1344 2018-07-04  Ryosuke Niwa  <rniwa@webkit.org>
1345
1346         Youtube video pages crash after a couple of minutes
1347         https://bugs.webkit.org/show_bug.cgi?id=187316
1348
1349         Reviewed by Antti Koivisto.
1350
1351         The crash was caused by HTMLMediaElement::stopWithoutDestroyingMediaPlayer invoking updatePlaybackControlsManager,
1352         which traverses all media players across different documents including the one in the main frame while its iframe
1353         is getting removed (to update the Touch Bar's media control).
1354
1355         Fixed the bug by making this code async in both stopWithoutDestroyingMediaPlayer and ~HTMLMediaElement. To do this,
1356         this patch moves the timer to update the playback controls manager from HTMLMediaElement to Page since scheduling
1357         a timer owned by HTMLMediaElement in its destructor wouldn't work as the timer would get destructed immediately.
1358
1359         Also replaced the call to clientWillPausePlayback by a call to stopSession in stopWithoutDestroyingMediaPlayer
1360         since the former also updates the layout synchronously via updateNowPlayingInfo; the latter function schedules
1361         a timer via scheduleUpdateNowPlayingInfo instead.
1362
1363         Test: media/remove-video-best-media-element-in-main-frame-crash.html
1364
1365         * html/HTMLMediaElement.cpp:
1366         (WebCore::HTMLMediaElement::~HTMLMediaElement): Call scheduleUpdatePlaybackControlsManager now that timer has been
1367         moved to Page.
1368         (WebCore::HTMLMediaElement::bestMediaElementForShowingPlaybackControlsManager): Made this return a RefPtr instead of
1369         a raw pointer while we're at it.
1370         (WebCore::HTMLMediaElement::clearMediaPlayer): Call scheduleUpdatePlaybackControlsManager.
1371         (WebCore::HTMLMediaElement::stopWithoutDestroyingMediaPlayer): Ditto. Also invoke stopSession instead of
1372         clientWillPausePlayback on MediaSession since clientWillPausePlayback will synchronously try to update the layout.
1373         (WebCore::HTMLMediaElement::contextDestroyed):
1374         (WebCore::HTMLMediaElement::stop):
1375         (WebCore::HTMLMediaElement::scheduleUpdatePlaybackControlsManager):
1376         (WebCore::HTMLMediaElement::updatePlaybackControlsManager): Moved to Page::schedulePlaybackControlsManagerUpdate.
1377         * html/HTMLMediaElement.h:
1378         * page/Page.cpp:
1379         (WebCore::Page::schedulePlaybackControlsManagerUpdate): Added.
1380         * page/Page.h:
1381         * testing/Internals.cpp:
1382         (WebCore::Internals::bestMediaElementForShowingPlaybackControlsManager):
1383         * testing/Internals.h:
1384
1385 2018-07-05  Zalan Bujtas  <zalan@apple.com>
1386
1387         Do not assume that hypen's width can be computed using the simplified text measure codepath.
1388         https://bugs.webkit.org/show_bug.cgi?id=187352
1389         <rdar://problem/40821283>
1390
1391         Reviewed by Simon Fraser.
1392
1393         Just because the text content is qualified for simplified text measure, it does not necessarily mean the hyphen is simple enough as well.
1394
1395         Test: fast/text/hyphen-is-complex-crash.html
1396
1397         * rendering/SimpleLineLayoutTextFragmentIterator.cpp:
1398         (WebCore::SimpleLineLayout::TextFragmentIterator::Style::Style):
1399         (WebCore::SimpleLineLayout::TextFragmentIterator::TextFragmentIterator):
1400         * rendering/SimpleLineLayoutTextFragmentIterator.h:
1401
1402 2018-07-05  Eric Carlson  <eric.carlson@apple.com>
1403
1404         Video sometimes flickers when playing to AppleTV
1405         https://bugs.webkit.org/show_bug.cgi?id=187193
1406         <rdar://problem/40153865>
1407
1408         Unreviewed, fix a broken API test.
1409
1410         * platform/audio/ios/AudioSessionIOS.mm:
1411         (WebCore::AudioSession::setCategory): None should set the category to AVAudioSessionCategoryAmbient, 
1412         because it signals that WebKit is not playing audio so we want allow other apps to play.
1413
1414 2018-07-05  Per Arne Vollan  <pvollan@apple.com>
1415
1416         Use ENABLE(WEBPROCESS_WINDOWSERVER_BLOCKING) in ScrollAnimatorMac.mm
1417         https://bugs.webkit.org/show_bug.cgi?id=187334
1418
1419         Reviewed by Alex Christensen.
1420
1421         Use ENABLE(WEBPROCESS_WINDOWSERVER_BLOCKING) instead of __MAC_OS_X_VERSION_MIN_REQUIRED when deciding
1422         to use NSTimer or NSAnimation for scrollbar animation.
1423
1424         No new tests. No change in behavior.
1425
1426         * platform/mac/ScrollAnimatorMac.mm:
1427         (-[WebScrollbarPartAnimation initWithScrollbar:featureToAnimate:animateFrom:animateTo:duration:]):
1428         (-[WebScrollbarPartAnimation startAnimation]):
1429         (-[WebScrollbarPartAnimation setCurrentProgress:setCurrentProgress:]):
1430
1431 2018-07-05  Timothy Hatcher  <timothy@apple.com>
1432
1433         Don't invert text color for selections in light mode.
1434         https://bugs.webkit.org/show_bug.cgi?id=187349
1435         rdar://problem/41297946
1436
1437         Reviewed by Tim Horton.
1438
1439         Fix color caching in RenderTheme so we don't cache a dark mode color
1440         for a light appearance, or vise versa. Use the new color caching
1441         in RenderThemeMac, and clear the color caches in purgeCaches.
1442
1443         Allow supportsSelectionForegroundColors to conditionalize on StyleColor::Options.
1444         Return true only in dark mode.
1445
1446         * rendering/RenderTheme.cpp:
1447         (WebCore::RenderTheme::activeSelectionBackgroundColor const):
1448         (WebCore::RenderTheme::inactiveSelectionBackgroundColor const):
1449         (WebCore::RenderTheme::activeSelectionForegroundColor const):
1450         (WebCore::RenderTheme::inactiveSelectionForegroundColor const):
1451         (WebCore::RenderTheme::activeListBoxSelectionBackgroundColor const):
1452         (WebCore::RenderTheme::inactiveListBoxSelectionBackgroundColor const):
1453         (WebCore::RenderTheme::activeListBoxSelectionForegroundColor const):
1454         (WebCore::RenderTheme::inactiveListBoxSelectionForegroundColor const):
1455         (WebCore::RenderTheme::purgeCaches):
1456         (WebCore::RenderTheme::platformColorsDidChange):
1457         (WebCore::RenderTheme::activeTextSearchHighlightColor const):
1458         (WebCore::RenderTheme::inactiveTextSearchHighlightColor const):
1459         * rendering/RenderTheme.h:
1460         (WebCore::RenderTheme::supportsSelectionForegroundColors const):
1461         (WebCore::RenderTheme::supportsListBoxSelectionForegroundColors const):
1462         (WebCore::RenderTheme::colorCache const):
1463         (WebCore::RenderTheme::purgeCaches): Deleted.
1464         * rendering/RenderThemeMac.h:
1465         * rendering/RenderThemeMac.mm:
1466         (WebCore::RenderThemeMac::purgeCaches):
1467         (WebCore::RenderThemeMac::supportsSelectionForegroundColors const):
1468         (WebCore::RenderThemeMac::platformActiveSelectionForegroundColor const):
1469         (WebCore::RenderThemeMac::platformInactiveSelectionForegroundColor const):
1470         (WebCore::RenderThemeMac::platformColorsDidChange):
1471         (WebCore::RenderThemeMac::colorCache const):
1472         (WebCore::RenderThemeMac::systemColor const):
1473
1474 2018-07-05  Zalan Bujtas  <zalan@apple.com>
1475
1476         SimpleLineLayout::FlowContents wastes 54KB of Vector capacity on nytimes.com
1477         https://bugs.webkit.org/show_bug.cgi?id=186709
1478         <rdar://problem/41173793>
1479
1480         Reviewed by Simon Fraser.
1481
1482         The size of the m_segments vector in SimpleLineLayoutFlowContents is alway pre-computed and don't change after the initial append.  
1483
1484         Not testable.
1485
1486         * rendering/SimpleLineLayoutFlowContents.h:
1487
1488 2018-07-05  Nan Wang  <n_wang@apple.com>
1489
1490         AX: setValue on text controls should send out key events
1491         https://bugs.webkit.org/show_bug.cgi?id=186690
1492         <rdar://problem/41169985>
1493
1494         Reviewed by Chris Fleizach.
1495
1496         Use Editor's insertText function when the text control element is being
1497         focused, so that the InputEvent will be dispatched properly.
1498
1499         Test: accessibility/mac/set-value-editable-dispatch-events.html
1500
1501         * accessibility/AccessibilityRenderObject.cpp:
1502         (WebCore::AccessibilityRenderObject::setValue):
1503
1504 2018-07-05  Chris Dumez  <cdumez@apple.com>
1505
1506         ASSERT(m_dictionaryStack.size() == 1) assertion hit in ~KeyedDecoderCF() when decoding fails
1507         https://bugs.webkit.org/show_bug.cgi?id=187152
1508
1509         Reviewed by Brent Fulgham.
1510
1511         Whenever a call to KeyedDecoderCF::beginArrayElement() succeeds (returns true), it
1512         appends an item to m_dictionaryStack which is expected to get popped later on via
1513         a matching call to KeyedDecoderCF::endArrayElement(). The ASSERT(m_dictionaryStack.size() == 1)
1514         assertion in the destructor protects against a begin / end mismatch.
1515
1516         However, there was a bug in KeyedDecoder::decodeObjects(), which would cause us to return early
1517         after a call to beginArrayElement() when the lambda function call returns false, causing us
1518         not to call the matching endArrayElement() in this case. This patch addresses the issue by
1519         calling endArrayElement() before returning early.
1520
1521         This bug was uncovered by r233309 which slightly changed the ITP encoding / decoding format.
1522         Because empty HashCountedSets are now expected to be encoded as empty array, decoding of old
1523         data fails and we hit the buggy code path.
1524
1525         * platform/KeyedCoding.h:
1526         (WebCore::KeyedDecoder::decodeObjects):
1527
1528 2018-07-05  Antti Koivisto  <antti@apple.com>
1529
1530         Move CSSParserContext to a file of its own
1531         https://bugs.webkit.org/show_bug.cgi?id=187342
1532
1533         Reviewed by Zalan Bujtas.
1534
1535         Move it out from CSSParserMode.h and CSSParser.cpp.
1536
1537         * Sources.txt:
1538         * WebCore.xcodeproj/project.pbxproj:
1539         * contentextensions/ContentExtensionParser.cpp:
1540         * css/PropertySetCSSStyleDeclaration.h:
1541         * css/StyleProperties.h:
1542         * css/StyleSheetContents.h:
1543         * css/parser/CSSDeferredParser.h:
1544         * css/parser/CSSParser.cpp:
1545         (WebCore::strictCSSParserContext): Deleted.
1546         (WebCore::CSSParserContext::CSSParserContext): Deleted.
1547         (WebCore::operator==): Deleted.
1548         * css/parser/CSSParser.h:
1549         * css/parser/CSSParserContext.cpp: Added.
1550         (WebCore::strictCSSParserContext):
1551         (WebCore::CSSParserContext::CSSParserContext):
1552         (WebCore::operator==):
1553
1554         Also add the missing textAutosizingEnabled bit.
1555
1556         * css/parser/CSSParserContext.h: Copied from Source/WebCore/css/parser/CSSParserMode.h.
1557         (WebCore::CSSParserContextHash::hash):
1558
1559         Also add the missing bits to the hash function.
1560         
1561         (WebCore::isQuirksModeBehavior): Deleted.
1562         (WebCore::isUASheetBehavior): Deleted.
1563         (WebCore::isUnitLessValueParsingEnabledForMode): Deleted.
1564         (WebCore::isCSSViewportParsingEnabledForMode): Deleted.
1565         (WebCore::strictToCSSParserMode): Deleted.
1566         (WebCore::isStrictParserMode): Deleted.
1567         * css/parser/CSSParserIdioms.h:
1568         * css/parser/CSSParserImpl.h:
1569         * css/parser/CSSParserMode.h:
1570         (WebCore::CSSParserContext::completeURL const): Deleted.
1571         (WebCore::operator!=): Deleted.
1572         (WebCore::CSSParserContextHash::hash): Deleted.
1573         (WebCore::CSSParserContextHash::equal): Deleted.
1574         (WTF::HashTraits<WebCore::CSSParserContext>::constructDeletedValue): Deleted.
1575         (WTF::HashTraits<WebCore::CSSParserContext>::isDeletedValue): Deleted.
1576         (WTF::HashTraits<WebCore::CSSParserContext>::emptyValue): Deleted.
1577         * css/parser/CSSPropertyParserHelpers.h:
1578         * css/parser/CSSSelectorParser.cpp:
1579         * css/parser/CSSVariableParser.cpp:
1580
1581 2018-07-05  Antoine Quint  <graouts@apple.com>
1582
1583         [Web Animations] The ready promise should initially be resolved
1584         https://bugs.webkit.org/show_bug.cgi?id=187341
1585         <rdar://problem/41844711>
1586
1587         Reviewed by Dean Jackson.
1588
1589         The Web Animations spec mandates that the ready promise is initially resolved.
1590
1591         * animation/WebAnimation.cpp:
1592         (WebCore::WebAnimation::WebAnimation):
1593
1594 2018-07-05  Sergio Villar Senin  <svillar@igalia.com>
1595
1596         [WebVR] Fix VRDisplayEvent implementation
1597         https://bugs.webkit.org/show_bug.cgi?id=187337
1598
1599         Reviewed by Žan Doberšek.
1600
1601         VRDisplayEvent implementation had two issues. First there were no attributes storing the
1602         VRDisplay the event refers to. Secondly the VRDisplayEventReason is not mandatory so it
1603         should be handled via an optional.
1604
1605         * Modules/webvr/VRDisplayEvent.cpp:
1606         (WebCore::VRDisplayEvent::VRDisplayEvent):
1607         (WebCore::VRDisplayEvent::display const): Deleted.
1608         (WebCore::VRDisplayEvent::reason const): Deleted.
1609         * Modules/webvr/VRDisplayEvent.h:
1610
1611 2018-07-04  Carlos Garcia Campos  <cgarcia@igalia.com>
1612
1613         REGRESSION(r233325): [GTK] Broke 40 animations tests
1614         https://bugs.webkit.org/show_bug.cgi?id=187264
1615
1616         Reviewed by Žan Doberšek.
1617
1618         This is because DocumentAnimationScheduler uses DisplayRefreshMonitor, that is only used by GTK port when
1619         accelerated compositing is enabled. Add a GTK display refresh monitor implementation to be used as the default.
1620
1621         * PlatformGTK.cmake: Add new file to compilation.
1622         * platform/graphics/DisplayRefreshMonitor.cpp:
1623         (WebCore::DisplayRefreshMonitor::createDefaultDisplayRefreshMonitor): Create DisplayRefreshMonitorGtk in GTK.
1624         * platform/graphics/gtk/DisplayRefreshMonitorGtk.cpp: Added.
1625         (WebCore::DisplayRefreshMonitorGtk::DisplayRefreshMonitorGtk):
1626         (WebCore::DisplayRefreshMonitorGtk::~DisplayRefreshMonitorGtk):
1627         (WebCore::onFrameClockUpdate):
1628         (WebCore::DisplayRefreshMonitorGtk::requestRefreshCallback):
1629         (WebCore::DisplayRefreshMonitorGtk::displayLinkFired):
1630         * platform/graphics/gtk/DisplayRefreshMonitorGtk.h: Added.
1631         (WebCore::DisplayRefreshMonitorGtk::create):
1632
1633 2018-07-04  Antti Koivisto  <antti@apple.com>
1634
1635         Reparse user stylesheets when _useSystemAppearance changes
1636         https://bugs.webkit.org/show_bug.cgi?id=187312
1637         <rdar://problem/38565834>
1638
1639         Reviewed by Tim Horton.
1640
1641         This setting may affect user stylesheet parsing. Reparse if it changes.
1642
1643         Test: fast/media/use-system-appearance-user-stylesheet-parsing.html
1644
1645         * page/Page.cpp:
1646         (WebCore::Page::setUseSystemAppearance):
1647         * page/Page.h:
1648         (WebCore::Page::setUseSystemAppearance): Deleted.
1649         * testing/Internals.cpp:
1650         (WebCore::Internals::setUseSystemAppearance):
1651         * testing/Internals.h:
1652         * testing/Internals.idl:
1653
1654 2018-07-04  Thibault Saunier  <tsaunier@igalia.com>
1655
1656         RealtimeIncomingVideoSources: Call stop() directly in the destructor
1657         https://bugs.webkit.org/show_bug.cgi?id=187303
1658
1659         Reviewed by Youenn Fablet.
1660
1661         Avoiding to call stopProducingData when we are not actually producing data.
1662
1663         This fixes tests that will run once the WPE/GTK PeerConnection implementation is merged.
1664
1665         * platform/mediastream/RealtimeIncomingVideoSource.h:
1666         (WebCore::RealtimeIncomingVideoSource::~RealtimeIncomingVideoSource):
1667
1668 2018-07-04  Thibault Saunier  <tsaunier@igalia.com>
1669
1670         [GTK][WPE] Stop pushing the StreamCollection as event in GStreamerMediaStreamSource
1671         https://bugs.webkit.org/show_bug.cgi?id=187304
1672
1673         Reviewed by Philippe Normand.
1674
1675         We let parsebin build the StreamCollection for us and pass extra metadata through the
1676         `TAG_EVENT` pushing the collection ourself is not bringing anything but adds extra work in the
1677         MediaPlayerGStreamer duplicating the STREAM_COLLECTION message for no good reason.
1678
1679         MediaStream layout tests already test that code path.
1680
1681         * platform/mediastream/gstreamer/GStreamerMediaStreamSource.cpp:
1682         (WebCore::webkitMediaStreamSrcPadProbeCb):
1683
1684 2018-07-04  Frederic Wang  <fwang@igalia.com>
1685
1686         [WebIDL] Remove custom bindings for HTMLDocument
1687         https://bugs.webkit.org/show_bug.cgi?id=173444
1688
1689         Unreviewed, add missing bugzilla link for FIXME comments.
1690
1691         * dom/Document.cpp:
1692         (WebCore::Document::closeForBindings):
1693         (WebCore::Document::write):
1694         (WebCore::Document::writeln):
1695
1696 2018-07-04  Tim Horton  <timothy_horton@apple.com>
1697
1698         Introduce PLATFORM(IOSMAC)
1699         https://bugs.webkit.org/show_bug.cgi?id=187315
1700
1701         Reviewed by Dan Bernstein.
1702
1703         * Configurations/Base.xcconfig:
1704         * Configurations/FeatureDefines.xcconfig:
1705         * Configurations/WebCore.xcconfig:
1706         * Modules/geolocation/ios/GeolocationPositionIOS.mm:
1707         (WebCore::GeolocationPosition::GeolocationPosition):
1708         * page/cocoa/MemoryReleaseCocoa.mm:
1709         (WebCore::platformReleaseMemory):
1710         * platform/audio/ios/AudioSessionIOS.mm:
1711         (WebCore::AudioSession::setCategory):
1712         (WebCore::AudioSession::routingContextUID const):
1713         * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
1714         (WebCore::MediaPlayerPrivateAVFoundationObjC::createAVPlayer):
1715         (WebCore::MediaPlayerPrivateAVFoundationObjC::setShouldDisableSleep):
1716         * platform/ios/PlatformPasteboardIOS.mm:
1717         (WebCore::registerItemToPasteboard):
1718         * platform/ios/WebItemProviderPasteboard.mm:
1719         (-[WebItemProviderRegistrationInfoList itemProvider]):
1720
1721 2018-07-03  Antoine Quint  <graouts@apple.com>
1722
1723         [Web Animations] Make WPT test at timing-model/timelines/timelines.html pass reliably
1724         https://bugs.webkit.org/show_bug.cgi?id=186508
1725         <rdar://problem/41000260>
1726
1727         Reviewed by Dean Jackson.
1728
1729         The remaining failing assertion in this test assumes that the ready promise for an animation is fired
1730         prior to requestAnimationFrame callbacks being fired in the current event loop such that registering
1731         the requestAnimationFrame() call within the ready promise has its callback fired with the same timeline
1732         time. To ensure that is true, we perform a microtask checkpoint as soon as we're done running pending
1733         tasks, which will resolve the ready promise for any play-pending animations.
1734
1735         * animation/DocumentTimeline.cpp:
1736         (WebCore::DocumentTimeline::updateAnimations):
1737
1738 2018-07-03  Ryosuke Niwa  <rniwa@webkit.org>
1739
1740         Nullptr crash accessing Document in GenericEventQueue::dispatchOneEvent()
1741         https://bugs.webkit.org/show_bug.cgi?id=187284
1742
1743         Reviewed by Eric Carlson.
1744
1745         The null pointer crash was caused by some GenericEventQueue dispatching an event in a stopped document,
1746         which does not have a valid script execution context because some uses of GenericEventQueue in media code
1747         was not closing the queue upon stopping of all active DOM objects.
1748
1749         Fixed all uses of GenericEventQueue which did not suspend or stop the queue with active DOM objects.
1750         Made SourceBufferList and TrackListBase (along with AudioTrackList, TextTrackList, and VideoTrackList)
1751         inherit from ActiveDOMObject instead of ContextDestructionObserver to do this.
1752
1753         Also fixed a bug that media elements inside a template element (and other cases where the document doesn't
1754         have a browsing context) were scheduling events since this would hit the newly added debug assertion in
1755         GenericEventQueue::dispatchOneEvent.
1756
1757         Test: media/track/video-track-addition-and-frame-removal.html
1758
1759         * Modules/encryptedmedia/legacy/WebKitMediaKeySession.cpp:
1760         (WebCore::WebKitMediaKeySession::suspend): Assert that we never try to suspend when the document has
1761         this object alive since canSuspendForDocumentSuspension always returns false.
1762         (WebCore::WebKitMediaKeySession::resume): Ditto.
1763         (WebCore::WebKitMediaKeySession::stop): Stop the event queue to avoid the crash.
1764         * Modules/encryptedmedia/legacy/WebKitMediaKeySession.h:
1765         * Modules/mediasource/MediaSource.cpp:
1766         (WebCore::MediaSource::removeSourceBuffer): Don't do any work to update tracks when the active DOM
1767         objects are stopped since this MediaSource and the related media objects are about to be destructed.
1768         (WebCore::MediaSource::suspend): Assert that m_asyncEventQueue is empty as canSuspendForDocumentSuspension
1769         returns false whenever the queue is not empty.
1770         (WebCore::MediaSource::resume): Ditto.
1771         * Modules/mediasource/MediaSource.h:
1772         * Modules/mediasource/SourceBuffer.cpp:
1773         (WebCore::SourceBuffer::suspend): Ditto.
1774         (WebCore::SourceBuffer::resume): Ditto.
1775         (WebCore::SourceBuffer::stop): Stop the event queue to avoid the crash.
1776         * Modules/mediasource/SourceBuffer.h:
1777         * Modules/mediasource/SourceBufferList.cpp:
1778         (WebCore::SourceBufferList): Made this an active DOM object.
1779         (WebCore::SourceBufferList::SourceBufferList):
1780         (WebCore::SourceBufferList::canSuspendForDocumentSuspension const): Added. Return false when there are
1781         pending events to match other media code.
1782         (WebCore::SourceBufferList::suspend): Added. Assert that the event queue is empty here.
1783         (WebCore::SourceBufferList::resume): Ditto.
1784         (WebCore::SourceBufferList::stop): Added. Stop the event queue to avoid the crash.
1785         (WebCore::SourceBufferList::activeDOMObjectName const): Added.
1786         * Modules/mediasource/SourceBufferList.h:
1787         (WebCore::SourceBufferList): Made this an active DOM object.
1788         * Modules/mediasource/SourceBufferList.idl:
1789         * dom/Document.h:
1790         (WebCore::Document::hasBrowsingContext const): Added.
1791         * dom/GenericEventQueue.cpp:
1792         (WebCore::GenericEventQueue::dispatchOneEvent): Added an assertion to catch when an event is dispatched
1793         inside a stopped document, which is never correct and causes this crash down the line.
1794         * html/HTMLMediaElement.cpp:
1795         (WebCore::HTMLMediaElement::playInternal): Exit early when the document doesn't have a browsing context;
1796         e.g. when the media element is inside a template element.
1797         (WebCore::HTMLMediaElement::pauseInternal): Ditto.
1798         (WebCore::HTMLMediaElement::sourceWasAdded): Ditto.
1799         * html/track/AudioTrackList.cpp:
1800         (AudioTrackList::activeDOMObjectName const): Added.
1801         * html/track/AudioTrackList.h:
1802         * html/track/AudioTrackList.idl:
1803         * html/track/TextTrackList.cpp::
1804         (TextTrackList::activeDOMObjectName const): Added.
1805         * html/track/TextTrackList.h:
1806         * html/track/TextTrackList.idl:
1807         * html/track/TrackListBase.cpp:
1808         (WebCore::TrackListBase): Made this an active DOM object.
1809         (WebCore::TrackListBase::TrackListBase): 
1810         (WebCore::TrackListBase::canSuspendForDocumentSuspension const): Added. Return false when there are pending events
1811         to match other media code.
1812         (WebCore::TrackListBase::suspend): Added. Assert that the event queue is empty here.
1813         (WebCore::TrackListBase::resume): Ditto.
1814         (WebCore::TrackListBase::stop): Added. Stop the event queue to avoid the crash.
1815         * html/track/TrackListBase.h:
1816         * html/track/VideoTrackList.cpp:
1817         (VideoTrackList::activeDOMObjectName const): Added.
1818         * html/track/VideoTrackList.h:
1819         * html/track/VideoTrackList.idl:
1820
1821 2018-07-03  Fujii Hironori  <Hironori.Fujii@sony.com>
1822
1823         [cairo] Doesn't paint box-shadow with zero blur-radius
1824         https://bugs.webkit.org/show_bug.cgi?id=187244
1825
1826         Reviewed by Žan Doberšek.
1827
1828         Cairo::ShadowState::isRequired() returned false if blur-radius is
1829         zero.
1830
1831         No new tests (Covered by existing tests).
1832
1833         * platform/graphics/cairo/CairoOperations.cpp:
1834         (WebCore::Cairo::ShadowState::isRequired const): Do not check blur
1835         is zero.
1836
1837 2018-07-03  Ryosuke Niwa  <rniwa@webkit.org>
1838
1839         Add a release assert to diagnose infinite recursions in removeAllEventListeners()
1840         https://bugs.webkit.org/show_bug.cgi?id=187287
1841
1842         Reviewed by Keith Miller.
1843
1844         Assert that we never re-enter removeAllEventListeners per thread.
1845
1846         * dom/EventTarget.cpp:
1847         (WebCore::EventTarget::removeAllEventListeners):
1848         * platform/ThreadGlobalData.h:
1849         (WebCore::ThreadGlobalData::ThreadGlobalData::isInRemoveAllEventListeners const):
1850         (WebCore::ThreadGlobalData::ThreadGlobalData::setIsInRemoveAllEventListeners):
1851
1852 2018-07-03  Chris Dumez  <cdumez@apple.com>
1853
1854         performance-api/performance-observer-no-document-leak.html is flaky
1855         https://bugs.webkit.org/show_bug.cgi?id=186938
1856         <rdar://problem/41379336>
1857
1858         Reviewed by Simon Fraser.
1859
1860         Add internals API to get the identifier of a document and to ask if the document with
1861         a given identifier is still alive. This is helpful to write tests for document leaking
1862         fixes.
1863
1864         * testing/Internals.cpp:
1865         (WebCore::Internals::documentIdentifier const):
1866         (WebCore::Internals::isDocumentAlive const):
1867         * testing/Internals.h:
1868         * testing/Internals.idl:
1869
1870 2018-07-03  Chris Dumez  <cdumez@apple.com>
1871
1872         Improve window.event compliance: Should not be set when target is in shadow tree
1873         https://bugs.webkit.org/show_bug.cgi?id=186266
1874
1875         Reviewed by Ryosuke Niwa.
1876
1877         Stop exposing window.event to Shadow DOM by not setting window.event if the event's target
1878         is a Node inside a shadow tree. This is as per the latest DOM specification:
1879         - https://github.com/whatwg/dom/pull/407
1880
1881         This aligns our behavior with Blink as well:
1882         - https://bugs.chromium.org/p/chromium/issues/detail?id=779461
1883
1884         Tests: imported/w3c/web-platform-tests/dom/events/event-global.html
1885                imported/w3c/web-platform-tests/dom/events/event-global.worker.html
1886
1887         * bindings/js/JSEventListener.cpp:
1888         (WebCore::JSEventListener::handleEvent):
1889
1890 2018-07-03  Chris Dumez  <cdumez@apple.com>
1891
1892         [Cocoa] Disable vnode guard related simulated crashes for WKTR / DRT and WebSQL
1893         https://bugs.webkit.org/show_bug.cgi?id=187270
1894         <rdar://problem/40674034>
1895
1896         Reviewed by Geoffrey Garen.
1897
1898         Disable vnode guard related simulated crashes for WebSQL by setting the expected
1899         environment variable, if not already set by WKTR / DRT.
1900
1901         * Modules/webdatabase/DatabaseManager.cpp:
1902         (WebCore::DatabaseManager::initialize):
1903         (WebCore::DatabaseManager::platformInitialize):
1904         * Modules/webdatabase/DatabaseManager.h:
1905         * Modules/webdatabase/cocoa/DatabaseManagerCocoa.mm: Added.
1906         (WebCore::DatabaseManager::paltformInitialize):
1907         * SourcesCocoa.txt:
1908         * WebCore.xcodeproj/project.pbxproj:
1909         * platform/FileSystem.h:
1910         * platform/posix/FileSystemPOSIX.cpp:
1911         (WebCore::FileSystem::realPath):
1912         * platform/win/FileSystemWin.cpp:
1913         (WebCore::FileSystem::realPath):
1914
1915 2018-07-03  Eric Carlson  <eric.carlson@apple.com>
1916
1917         Don't allow autoplay when the element is suspended
1918         https://bugs.webkit.org/show_bug.cgi?id=187299
1919         <rdar://problem/41044691>
1920
1921         Reviewed by Youenn Fablet.
1922         
1923         Block autoplay when a media element is suspended. Add more release logging to the methods
1924         that handle autoplay attempts to help diagnose future media playback problems.
1925
1926         * html/HTMLMediaElement.cpp:
1927         (WebCore::convertEnumerationToString): Convert PlaybackWithoutUserGesture to a string.
1928         (WebCore::HTMLMediaElement::dispatchPlayPauseEventsIfNeedsQuirks): Add logging.
1929         (WebCore::HTMLMediaElement::hardwareMutedStateDidChange): Ditto.
1930         (WebCore::HTMLMediaElement::handleAutoplayEvent): Ditto.
1931         (WebCore::HTMLMediaElement::userDidInterfereWithAutoplay): Ditto.
1932         (WebCore::HTMLMediaElement::setPlaybackWithoutUserGesture): Ditto.
1933         * html/HTMLMediaElement.h:
1934         (WTF::LogArgument<WebCore::HTMLMediaElement::PlaybackWithoutUserGesture>::toString):
1935
1936         * html/MediaElementSession.cpp:
1937         (WebCore::MediaElementSession::playbackPermitted const): Playback is not permitted when the
1938         element is suspended.
1939         * html/MediaElementSession.h:
1940
1941 2018-07-03  Zalan Bujtas  <zalan@apple.com>
1942
1943         [LFC] Generate anonymous inline box for text content.
1944         https://bugs.webkit.org/show_bug.cgi?id=187301
1945
1946         Reviewed by Antti Koivisto.
1947
1948         Always have a inline container for text content (and no dedicated text renderer).
1949
1950         * layout/layouttree/LayoutInlineBox.cpp:
1951         (WebCore::Layout::InlineBox::InlineBox):
1952         * layout/layouttree/LayoutInlineBox.h:
1953         (WebCore::Layout::InlineBox::setContent):
1954         * layout/layouttree/LayoutTreeBuilder.cpp:
1955         (WebCore::Layout::TreeBuilder::createSubTree):
1956
1957 2018-07-03  Basuke Suzuki  <Basuke.Suzuki@sony.com>
1958
1959         [Curl] Embed certificate information into ResourceResponse.
1960         https://bugs.webkit.org/show_bug.cgi?id=187102
1961
1962         Reviewed by Youenn Fablet.
1963
1964         No new tests but tested internally.
1965
1966         Collect certificate information from the communication and put them into
1967         ResourceResponse for the sake of advanced security checking and information
1968         providing to the user.
1969
1970         * platform/Curl.cmake:
1971         * platform/network/curl/CertificateInfo.cpp: Copied from Source/WebCore/platform/network/curl/CertificateInfo.h.
1972         (WebCore::CertificateInfo::CertificateInfo):
1973         (WebCore::CertificateInfo::isolatedCopy const):
1974         (WebCore::CertificateInfo::makeCertificate):
1975         * platform/network/curl/CertificateInfo.h:
1976         (WebCore::CertificateInfo::verificationError const):
1977         (WebCore::CertificateInfo::certificateChain const):
1978         (WebCore::operator==):
1979         (WebCore::CertificateInfo::CertificateInfo): Deleted.
1980         * platform/network/curl/CurlRequest.cpp:
1981         (WebCore::CurlRequest::didReceiveHeader):
1982         (WebCore::CurlRequest::didCompleteTransfer):
1983         * platform/network/curl/CurlRequest.h:
1984         (WebCore::CurlRequest::getCertificateInfo const):
1985         (WebCore::CurlRequest::getNetworkLoadMetrics const):
1986         (WebCore::CurlRequest::getNetworkLoadMetrics): Deleted.
1987         * platform/network/curl/CurlResourceHandleDelegate.cpp:
1988         (WebCore::CurlResourceHandleDelegate::curlDidReceiveResponse):
1989         (WebCore::CurlResourceHandleDelegate::curlDidComplete):
1990         * platform/network/curl/CurlSSLHandle.cpp:
1991         (WebCore::CurlSSLHandle::setHostAllowsAnyHTTPSCertificate):
1992         (WebCore::CurlSSLHandle::canIgnoredHTTPSCertificate):
1993         * platform/network/curl/CurlSSLHandle.h:
1994         * platform/network/curl/CurlSSLVerifier.cpp:
1995         (WebCore::CurlSSLVerifier::CurlSSLVerifier):
1996         (WebCore::CurlSSLVerifier::verifyCallback):
1997         (WebCore::StackOfX509::StackOfX509): For RAII. Used in pemDataFromCtx().
1998         (WebCore::StackOfX509::~StackOfX509): Ditto.
1999         (WebCore::StackOfX509::count): Ditto.
2000         (WebCore::StackOfX509::item): Ditto.
2001         (WebCore::BIOHolder::BIOHolder): Ditto.
2002         (WebCore::BIOHolder::~BIOHolder): Ditto.
2003         (WebCore::BIOHolder::write): Ditto.
2004         (WebCore::BIOHolder::asCertificate): Ditto.
2005         (WebCore::pemDataFromCtx): Become simple static function.
2006         (WebCore::convertToSSLCertificateFlags): Ditto.
2007         (WebCore::CurlSSLVerifier::certVerifyCallback): Deleted.
2008         (WebCore::CurlSSLVerifier::getPemDataFromCtx): Deleted.
2009         (WebCore::CurlSSLVerifier::convertToSSLCertificateFlags): Deleted.
2010         * platform/network/curl/CurlSSLVerifier.h:
2011         (WebCore::CurlSSLVerifier::verificationError):
2012         (WebCore::CurlSSLVerifier::certificateChain const):
2013         * platform/network/curl/ResourceError.h:
2014         * platform/network/curl/ResourceErrorCurl.cpp:
2015         (WebCore::ResourceError::isSSLConnectError const):
2016         (WebCore::ResourceError::isSSLCertVerificationError const):
2017         (WebCore::ResourceError::hasSSLConnectError const): Deleted.
2018         * platform/network/curl/ResourceResponse.h:
2019         * platform/network/curl/ResourceResponseCurl.cpp:
2020         (WebCore::ResourceResponse::setCertificateInfo):
2021         (WebCore::ResourceResponse::setDeprecatedNetworkLoadMetrics):
2022
2023 2018-07-02  Simon Fraser  <simon.fraser@apple.com>
2024
2025         Clean up the layer volatility code and logging
2026         https://bugs.webkit.org/show_bug.cgi?id=187286
2027
2028         Reviewed by Tim Horton.
2029
2030         Export a function.
2031
2032         * platform/graphics/cocoa/IOSurface.h:
2033
2034 2018-07-03  Commit Queue  <commit-queue@webkit.org>
2035
2036         Unreviewed, rolling out r233112.
2037         https://bugs.webkit.org/show_bug.cgi?id=187300
2038
2039         this revision is causing crashes on iOS 11 simulator
2040         (Requested by Truitt on #webkit).
2041
2042         Reverted changeset:
2043
2044         "[Fullscreen] Restore ASSERT_NOT_REACHED() checks in exit
2045         fullscreen handler after r231924"
2046         https://bugs.webkit.org/show_bug.cgi?id=186945
2047         https://trac.webkit.org/changeset/233112
2048
2049 2018-07-03  Chris Dumez  <cdumez@apple.com>
2050
2051         Implement support for Element.toggleAttribute
2052         https://bugs.webkit.org/show_bug.cgi?id=186883
2053
2054         Reviewed by Sam Weinig.
2055
2056         Implement support for Element.toggleAttribute as per:
2057         - https://github.com/whatwg/dom/issues/461
2058         - https://dom.spec.whatwg.org/#dom-element-toggleattribute
2059
2060         This was already implemented in Blink:
2061         - https://bugs.chromium.org/p/chromium/issues/detail?id=854960
2062
2063         Edge expressed public support:
2064         - https://github.com/whatwg/dom/issues/461#issuecomment-398206390
2065
2066         Gecko is working on it:
2067         - https://bugzilla.mozilla.org/show_bug.cgi?id=1469592
2068
2069         * dom/Element.cpp:
2070         (WebCore::Element::toggleAttribute):
2071         * dom/Element.h:
2072         * dom/Element.idl:
2073
2074 2018-07-03  Zalan Bujtas  <zalan@apple.com>
2075
2076         [LFC] Implement minimum/maximum content width logic.
2077         https://bugs.webkit.org/show_bug.cgi?id=187241
2078
2079         Reviewed by Antti Koivisto.
2080
2081         Compute the minimum/maximum content width if needed and cache the values on the formatting state.
2082
2083         * layout/FormattingContext.cpp:
2084         (WebCore::Layout::FormattingContext::computeFloatingWidthAndMargin const):
2085         (WebCore::Layout::FormattingContext::computeOutOfFlowHorizontalGeometry const):
2086         (WebCore::Layout::FormattingContext::layoutOutOfFlowDescendants const):
2087         * layout/FormattingContext.h:
2088         * layout/FormattingContextGeometry.cpp:
2089         (WebCore::Layout::FormattingContext::Geometry::shrinkToFitWidth):
2090         (WebCore::Layout::FormattingContext::Geometry::outOfFlowNonReplacedHorizontalGeometry):
2091         (WebCore::Layout::FormattingContext::Geometry::floatingNonReplacedWidthAndMargin):
2092         (WebCore::Layout::FormattingContext::Geometry::outOfFlowHorizontalGeometry):
2093         (WebCore::Layout::FormattingContext::Geometry::floatingWidthAndMargin):
2094         (WebCore::Layout::shrinkToFitWidth): Deleted.
2095         * layout/FormattingState.cpp:
2096         (WebCore::Layout::FormattingState::FormattingState):
2097         * layout/FormattingState.h:
2098         (WebCore::Layout::FormattingState::setMinimumMaximumContentWidth):
2099         (WebCore::Layout::FormattingState::clearMinimumMaximumContentWidth):
2100         (WebCore::Layout::FormattingState::minimumMaximumContentWidth const):
2101         * layout/LayoutContext.cpp:
2102         (WebCore::Layout::LayoutContext::establishedFormattingState):
2103         * layout/LayoutContext.h:
2104         * layout/Verification.cpp:
2105         (WebCore::Layout::LayoutContext::verifyAndOutputMismatchingLayoutTree const):
2106         * layout/blockformatting/BlockFormattingContext.cpp:
2107         (WebCore::Layout::BlockFormattingContext::createFormattingState const):
2108         (WebCore::Layout::BlockFormattingContext::minimumMaximumContentWidth const):
2109         * layout/blockformatting/BlockFormattingContext.h:
2110         * layout/blockformatting/BlockFormattingContextGeometry.cpp:
2111         (WebCore::Layout::BlockFormattingContext::Geometry::minimumMaximumContentWidthNeedsChildrenWidth):
2112         (WebCore::Layout::BlockFormattingContext::Geometry::minimumMaximumContentWidth):
2113         * layout/blockformatting/BlockFormattingState.cpp:
2114         (WebCore::Layout::BlockFormattingState::BlockFormattingState):
2115         * layout/blockformatting/BlockFormattingState.h:
2116         * layout/inlineformatting/InlineFormattingContext.cpp:
2117         (WebCore::Layout::InlineFormattingContext::createFormattingState const):
2118         (WebCore::Layout::InlineFormattingContext::minimumMaximumContentWidth const):
2119         * layout/inlineformatting/InlineFormattingContext.h:
2120         * layout/inlineformatting/InlineFormattingState.cpp:
2121         (WebCore::Layout::InlineFormattingState::InlineFormattingState):
2122         * layout/inlineformatting/InlineFormattingState.h:
2123         * page/FrameViewLayoutContext.cpp:
2124
2125 2018-07-03  Jonathan Bedard  <jbedard@apple.com>
2126
2127         Unreviewed, rolling out r233461.
2128
2129         Assertions triggered during iOS 11 debug layout and API tests
2130
2131         Reverted changeset:
2132
2133         "[iOS] Add assert to catch improper use of WebCore::Timer in
2134         UI Process"
2135         https://bugs.webkit.org/show_bug.cgi?id=185330
2136         https://trac.webkit.org/changeset/233461
2137
2138 2018-07-03  Jer Noble  <jer.noble@apple.com>
2139
2140         Update Fullscreen anti-phishing alert text
2141         https://bugs.webkit.org/show_bug.cgi?id=187199
2142         <rdar://problem/41162543>
2143
2144         Reviewed by Brent Fulgham.
2145
2146         * English.lproj/Localizable.strings:
2147
2148 2018-07-03  Frederic Wang  <fwang@igalia.com>
2149
2150         REGRESSION (r232186): Hardware-accelerated CSS animations using steps() timing function no longer work
2151         https://bugs.webkit.org/show_bug.cgi?id=186129
2152
2153         Reviewed by Antoine Quint.
2154
2155         When the WebAnimationsCSSIntegration flag is enabled, animating the transform property with
2156         a steps() timing function no longer works. This is because the WebAnimation code wrongly
2157         assumes that the transform property can always be accelerated (for counterexamples, see
2158         GraphicsLayerCA::animationCanBeAccelerated). For consistency with AnimationBase, we make
2159         WebAnimation fallback to non-accelerated mode when RenderBoxModelObject::startAnimation
2160         fails. This addresses the regression previously mentioned.
2161
2162         Test: http/wpt/css/css-animations/start-animation-001.html
2163
2164         * animation/KeyframeEffectReadOnly.cpp:
2165         (WebCore::KeyframeEffectReadOnly::applyPendingAcceleratedActions): Fallback to
2166         non-accelerated mode if startAnimation failed.
2167
2168 2018-07-03  David Kilzer  <ddkilzer@apple.com>
2169
2170         [iOS] Add assert to catch improper use of WebCore::Timer in UI Process
2171         <https://webkit.org/b/185330>
2172         <rdar://problem/32816079>
2173
2174         Reviewed by Darin Adler.
2175
2176         * platform/RuntimeApplicationChecks.cpp:
2177         (WebCore::s_webKitProcessType): Add. Global to track process
2178         type.
2179         (WebCore::setWebKitProcessType): Implement new function that is
2180         called when initializing Web, Network, and Storage processes.
2181         (WebCore::isInNetworkProcess): Add.
2182         (WebCore::isInStorageProcess): Add.
2183         (WebCore::isInWebProcess): Add.
2184         - Check value in s_webKitProcessType to determine which process
2185           is currently running.
2186         * platform/RuntimeApplicationChecks.h:
2187         (WebCore::isInNetworkProcess): Add.
2188         (WebCore::isInStorageProcess): Add.
2189         (WebCore::isInWebProcess):
2190         - Make available for all platforms.
2191
2192         * platform/Timer.cpp:
2193         (WebCore::TimerBase::TimerBase): Add assert and os_log_fault.
2194         This catches the unwanted behavior on iOS using isAllowed().
2195         (WebCore::TimerBase::isAllowed): Add implementation.
2196         * platform/Timer.h:
2197         (WebCore::TimerBase::isAllowed): Add declaration.
2198
2199         * platform/cocoa/RuntimeApplicationChecksCocoa.mm:
2200         (WebCore::isInWebProcess): Delete.  Replace with method in
2201         RuntimeApplicationChecks.cpp.
2202
2203 2018-07-02  Antti Koivisto  <antti@apple.com>
2204
2205         Tighter limit for canvas memory use on iOS
2206         https://bugs.webkit.org/show_bug.cgi?id=187279
2207         <rdar://problem/38420562>
2208
2209         Reviewed by Simon Fraser.
2210
2211         We allowed 448MB of canvas buffer memory. This is still too much in some cases. Painting a large
2212         canvas may also requires several other temporary canvas sized buffers getting us easily over
2213         the process size limit.
2214
2215         * html/HTMLCanvasElement.cpp:
2216         (WebCore::maxActivePixelMemory):
2217
2218         Drop to (ramSize() / 4) which computes to 224MB on 2GB devices.
2219
2220 2018-07-02  Myles C. Maxfield  <mmaxfield@apple.com>
2221
2222         [Cocoa] Google Fonts doesn't work if the user has the requested font locally-installed
2223         https://bugs.webkit.org/show_bug.cgi?id=187228
2224         <rdar://problem/40967280>
2225
2226         Reviewed by Brent Fulgham.
2227
2228         This is due to the local() items in the src: descriptor in the @font-family blocks.
2229
2230         This is because of a behavior difference between CSSFontFaceSource::load() and CSSFontFaceSource::font().
2231         load() is supposed to set the status() to Success iff the font can be used, and then CSSFontFaceSource::font()
2232         is supposed to return the font itself to use. load() works by constructing a dummy FontDescription and
2233         performing a system lookup (to see if the local font really exists). However, this dummy FontDescription
2234         doesn't set the ShouldAllowUserInstalledFonts flag. Then, in CSSFontFaceSource::font(), a similar lookup is
2235         performed, except this one has the original FontDescription (with the correct value of the
2236         ShouldAllowUserInstalledFonts flag set. Therefore, the two functions disagree about the state of the flag.
2237
2238         When the CSSFontFaceSource's status gets set to Success, that means "this is the font face source that
2239         represents the @font-face block" but when CSSFontFaceSource::font() returns nullptr, that means "The font face
2240         source can't be used for some reason" so we then continue searching down the font-family list (and render the
2241         text in Helvetica or whatever comes next).
2242
2243         The solution is simple - just set the ShouldAllowUserInstalledFonts flag correctly in the dummy
2244         FontDescription.
2245
2246         Test: fast/text/user-installed-fonts/local.html
2247
2248         * css/CSSFontFace.cpp:
2249         (WebCore::CSSFontFace::allowUserInstalledFonts const):
2250         * css/CSSFontFace.h:
2251         * css/CSSFontFaceSet.cpp:
2252         (WebCore::CSSFontFaceSet::ensureLocalFontFacesForFamilyRegistered):
2253         * css/CSSFontFaceSource.cpp:
2254         (WebCore::CSSFontFaceSource::load):
2255
2256 2018-06-29  Ryosuke Niwa  <rniwa@webkit.org>
2257
2258         Generate event and event target interface types directly instead of via macros
2259         https://bugs.webkit.org/show_bug.cgi?id=187215
2260
2261         Reviewed by Chris Dumez.
2262
2263         Made make_event_factory.pl directly generate EventInterface enum values and toJSNewlyCreated for Event,
2264         and EventTargetInterface enum values and toJS for EventTarget. Removed the code to generate EventFactory::create
2265         since it was never even compiled or used anywhere.
2266
2267         This patch faithfully replicates what the macro used to generate but we should consider always generating either
2268         toJS or toJSNewlyCreated for both interfaces in the future.
2269
2270         No new tests since there should be no observable behavioral changes.
2271
2272         * DerivedSources.make: Generate EventTargetFactory.cpp, which is used to generate toJS function for EventTarget.
2273         * Sources.txt:
2274         * WebCore.xcodeproj/project.pbxproj:
2275         * bindings/js/JSEventCustom.cpp:
2276         (WebCore::toJSNewlyCreated): Deleted. Now generated directly in EventFactory.cpp.
2277         * bindings/js/JSEventTargetCustom.cpp:
2278         (WebCore::JSEventTarget::toWrapped): Removed the use of TRY_TO_UNWRAP_WITH_INTERFACE.
2279         (WebCore::toJS): Deleted. Now generated directly in EventFactory.cpp.
2280         * bindings/scripts/InFilesCompiler.pm:
2281         (generateInterfacesHeader): Use #pragma once. Generate enum values directly. Added the support for suffixing
2282         each type name with namespace for EventTarget.
2283         * dom/Event.h: Removed the declaration of EventInterface enum. It's now directly generated in EventInterfaces.h
2284         * dom/EventNames.in: Generate toJSNewlyCreated.
2285         * dom/EventTarget.h: Removed the declaration of EventTargetInterface as it's now done in EventTargetInterfaces.h.
2286         * dom/EventTargetFactory.in: Generate toJS.
2287         * dom/make_event_factory.pl:
2288         (defaultParameters): Added two new options. factoryFunction specifies whether toJS or toJSNewlyCreated is generated,
2289         and useNamespaceAsSuffix specifies whether each entry should be suffixed by the namespace (used by EventTarget).
2290         (generateCode): Added a missing semicolon.
2291         (generateImplementation): Removed the early exit for EventTarget since we now need to generate its toJS function.
2292         Replaced the code to generate EventFactory::create by the one to generate toJS / toJSNewlyCreated.
2293
2294 2018-07-02  Zalan Bujtas  <zalan@apple.com>
2295
2296         HTML widget displays blank when playing on page
2297         https://bugs.webkit.org/show_bug.cgi?id=187272
2298         <rdar://problem/39317899>
2299
2300         Reviewed by Simon Fraser.
2301
2302         When a composited layer gains content (in this particular case, going from NoContentsLayer to ContentsLayerForMedia),
2303         we need to size the associated graphics layer accordingly (NoContentsLayer means zero sized graphics layer).  
2304
2305         Not testable on iOS.
2306
2307         * rendering/RenderLayerBacking.cpp:
2308         (WebCore::RenderLayerBacking::updateConfiguration):
2309
2310 2018-07-02  David Kilzer  <ddkilzer@apple.com>
2311
2312         Refactor InlineTextBox::emphasisMarkExistsAndIsAbove()
2313         <https://webkit.org/b/187204>
2314
2315         Reviewed by Darin Adler.
2316
2317         No new tests since there is no change in behavior.
2318
2319         Refactor emphasisMarkExistsAndIsAbove() to return a
2320         std::optional<bool> instead of returning a bool and taking a
2321         std::optional<bool> argument.  The state returned is now:
2322         - std::nullopt => emphasis mark doesn't exist or is suppressed.
2323         - false => emphasis mark exists and is not suppressed, but is not above.
2324         - true => emphasis mark exists and is not suppressed, and is above.
2325
2326         * rendering/InlineFlowBox.cpp:
2327         (WebCore::InlineFlowBox::placeBoxesInBlockDirection):
2328         (WebCore::InlineFlowBox::addTextBoxVisualOverflow):
2329         (WebCore::InlineFlowBox::computeOverAnnotationAdjustment const):
2330         (WebCore::InlineFlowBox::computeUnderAnnotationAdjustment const):
2331         - Update for refactored method.  Remove some redundant checks
2332           for TextEmphasisMark::None that already happen in
2333           emphasisMarkExistsAndIsAbove().
2334         * rendering/InlineTextBox.cpp:
2335         (WebCore::emphasisPositionHasNeitherLeftNorRight): Delete.
2336         - Replaced by an OptionSet<TextEmphasisPosition>.
2337         (WebCore::InlineTextBox::emphasisMarkExistsAndIsAbove const):
2338         - Refactor as described above.
2339         (WebCore::InlineTextBox::paintMarkedTextForeground):
2340         - Update for refactored method.
2341         * rendering/InlineTextBox.h:
2342         (WebCore::InlineTextBox::emphasisMarkExistsAndIsAbove const):
2343         - Update for new method signature.
2344
2345 2018-07-02  Megan Gardner  <megan_gardner@apple.com>
2346
2347         Enable copy paste on iOS apps for Mac
2348         https://bugs.webkit.org/show_bug.cgi?id=187194
2349         <rdar://problem/41451148>
2350
2351         Reviewed by Darin Adler.
2352
2353         Difficult to test this platform.
2354
2355         UIKit doesn't support itemProviders for iOS apps for Mac, so we need to revert to the
2356         older way of setting a dictionary of objects and keys for items. Not everything is
2357         availble in this form, and we haven't cleaned up our itemProvider code yet, so we 
2358         need to case some things out for now. Hopefully in the future, this will be implmented
2359         and can just work as expected, but for now, this is the best workaround.
2360
2361         * platform/ios/PlatformPasteboardIOS.mm:
2362         (WebCore::registerItemToPasteboard):
2363         (WebCore::PlatformPasteboard::write):
2364         (WebCore::PlatformPasteboard::readURL):
2365         * platform/ios/WebItemProviderPasteboard.h:
2366         * platform/ios/WebItemProviderPasteboard.mm:
2367         (-[WebItemProviderRegistrationInfoList itemProvider]):
2368
2369 2018-07-02  Eric Carlson  <eric.carlson@apple.com>
2370
2371         Video sometimes flickers when playing to AppleTV
2372         https://bugs.webkit.org/show_bug.cgi?id=187193
2373         <rdar://problem/40153865>
2374
2375         Reviewed by Jer Noble and Youenn Fablet.
2376         
2377         No new tests, existing test updated.
2378
2379         Delay 100ms before changing the iOS audio session category because it is an expensive and
2380         potentially disruptive operation, and changing an audio or video element configuration
2381         can result in several quick, ultimately unnecessary, category changes.
2382
2383         * platform/audio/PlatformMediaSession.cpp:
2384         (WebCore::PlatformMediaSession::clientWillBeginPlayback): Add logging.
2385
2386         * platform/audio/PlatformMediaSessionManager.cpp:
2387         (WebCore::PlatformMediaSessionManager::PlatformMediaSessionManager): Initialize timer.
2388         (WebCore::PlatformMediaSessionManager::removeSession): Deactivate audio session when there
2389         are no sessions.
2390         (WebCore::PlatformMediaSessionManager::updateSessionStateTimerFired): New, update session now.
2391         (WebCore::PlatformMediaSessionManager::updateSessionState): Add parameter.
2392         * platform/audio/PlatformMediaSessionManager.h:
2393
2394         * platform/audio/cocoa/MediaSessionManagerCocoa.cpp:
2395         (PlatformMediaSessionManager::updateSessionState): Defer update if it isn't supposed to happen
2396         immediately.
2397
2398         * platform/audio/ios/AudioSessionIOS.mm:
2399         (WebCore::AudioSession::setCategory): Drive-by: setting the audio category to nil is a noop,
2400         so don't waste time doing it.
2401         (WebCore::AudioSession::tryToSetActive): Allow other apps to resume playback when we deactivate
2402         the audio session.
2403
2404         * platform/Timer.h:
2405         (WebCore::DeferrableOneShotTimer): Add WTF_MAKE_FAST_ALLOCATED so it can be used in a unique_ptr.
2406
2407 2018-07-02  Wenson Hsieh  <wenson_hsieh@apple.com>
2408
2409         Clean up some spellchecking code
2410         https://bugs.webkit.org/show_bug.cgi?id=187238
2411
2412         Reviewed by Tim Horton.
2413
2414         A few minor tweaks to modernize some spellchecking code. No change in behavior.
2415
2416         * editing/AlternativeTextController.cpp:
2417         (WebCore::AlternativeTextController::timerFired):
2418         * editing/Editor.cpp:
2419         (WebCore::Editor::markMisspellingsAfterTypingToWord):
2420
2421         Use move semantics when passing Ranges to markAllMisspellingsAndBadGrammarInRanges.
2422
2423         (WebCore::Editor::markAllMisspellingsAndBadGrammarInRanges):
2424
2425         Change this to take RefPtr<Range>&& instead of Range*.
2426
2427         (WebCore::Editor::markMisspellingsAndBadGrammar):
2428
2429         Remove an unnecessary call to `RefPtr::get()`.
2430
2431         * editing/Editor.h:
2432         * editing/TextCheckingHelper.cpp:
2433         (WebCore::TextCheckingParagraph::invalidateParagraphRangeValues):
2434         (WebCore::TextCheckingParagraph::checkingStart const):
2435         (WebCore::TextCheckingParagraph::checkingEnd const):
2436         (WebCore::TextCheckingParagraph::checkingLength const):
2437         (WebCore::TextCheckingParagraph::automaticReplacementStart const):
2438         (WebCore::TextCheckingParagraph::automaticReplacementLength const):
2439
2440         Currently, all of these cached range offsets are `int`s, and use a value of -1 to denote that their values are
2441         missing and must be recomputed. Instead, make these `std::optional`s and let `std::nullopt` represent the
2442         missing value.
2443
2444         * editing/TextCheckingHelper.h:
2445
2446 2018-07-02  Antoine Quint  <graouts@apple.com>
2447
2448         Crash in WebCore::WebAnimation::timeToNextRequiredTick when running imported/w3c/web-platform-tests/web-animations/interfaces/Animatable/animate-no-browsing-context.html
2449         https://bugs.webkit.org/show_bug.cgi?id=187145
2450
2451         Reviewed by Dean Jackson.
2452
2453         Ensure we have a resolved time value before trying to use it.
2454
2455         * animation/WebAnimation.cpp:
2456         (WebCore::WebAnimation::timeToNextRequiredTick const):
2457
2458 2018-07-02  Antoine Quint  <graouts@apple.com>
2459
2460         [Web Animations] Crash in KeyframeEffectReadOnly::applyPendingAcceleratedActions()
2461         https://bugs.webkit.org/show_bug.cgi?id=187139
2462
2463         Reviewed by Dean Jackson.
2464
2465         Ensure we have a resolved time value before trying to use it.
2466
2467         * animation/KeyframeEffectReadOnly.cpp:
2468         (WebCore::KeyframeEffectReadOnly::applyPendingAcceleratedActions):
2469
2470 2018-07-02  Youenn Fablet  <youenn@apple.com>
2471
2472         Reject getUserMedia promise if capture fails
2473         https://bugs.webkit.org/show_bug.cgi?id=187190
2474
2475         Reviewed by Eric Carlson.
2476
2477         In case PendingActivationMediaStream is notified of a change,
2478         Check whether any track failed to capture.
2479         If so, reject the promise.
2480         Add more release logging in error case.
2481
2482         Covered by manual testing.
2483
2484         * Modules/mediastream/UserMediaRequest.cpp:
2485         (WebCore::UserMediaRequest::PendingActivationMediaStream::~PendingActivationMediaStream):
2486         (WebCore::UserMediaRequest::PendingActivationMediaStream::characteristicsChanged):
2487         (WebCore::UserMediaRequest::mediaStreamIsReady):
2488         (WebCore::UserMediaRequest::mediaStreamDidFail):
2489         * Modules/mediastream/UserMediaRequest.h:
2490         * platform/mediastream/MediaStreamPrivate.h:
2491         * platform/mediastream/RealtimeMediaSource.cpp:
2492         (WebCore::RealtimeMediaSource::captureFailed):
2493         * platform/mediastream/mac/AVVideoCaptureSource.mm:
2494         (WebCore::AVVideoCaptureSource::setupCaptureSession):
2495
2496 2018-07-01  Fujii Hironori  <Hironori.Fujii@sony.com>
2497
2498         [WK2] fast/parser/document-open-in-unload.html makes the following test crash
2499         https://bugs.webkit.org/show_bug.cgi?id=98345
2500         <rdar://problem/12474923>
2501
2502         Reviewed by Ryosuke Niwa.
2503
2504         m_documentLoader can become null in the middle of
2505         FrameLoader::commitProvisionalLoad by stopping the loading.
2506
2507         No new tests (Covered by existing tests).
2508
2509         * loader/FrameLoader.cpp:
2510         (WebCore::FrameLoader::commitProvisionalLoad): Do null check of m_documentLoader.
2511
2512 2018-07-01  Myles C. Maxfield  <mmaxfield@apple.com>
2513
2514         [Cocoa] LastResort in the font family list causes emoji with joiners to be rendered as multiple .notdef characters
2515         https://bugs.webkit.org/show_bug.cgi?id=187209
2516         <rdar://problem/40920785>
2517
2518         Reviewed by Darin Adler.
2519
2520         Inside our complex text codepath, we perform our own font fallback, which
2521         includes a function that asks "can this font support this grapheme cluster?"
2522         Because of the mechanics of how fonts work, the implementation of this
2523         function is "Does the font's cmap table support every character of the
2524         cluster?" We were using Font::glyphForCharacter() to determine this; however,
2525         this function maps certain control characters to the zero width space
2526         character (with the intention that these control characters shouldn't be
2527         visible in the fast text codepath). That replacement, however, was causing
2528         us to get false negatives, because Apple Color Emoji doesn't support zero
2529         width space. Therefore, Apple Color Emoji was looking like it didn't support
2530         emoji combining sequences.
2531
2532         The best solution to this would be to get Font::glyphForCharacter() to stop
2533         performing these replacements (see https://bugs.webkit.org/show_bug.cgi?id=187166).
2534         However, that is too risky of a change to be making right now. Instead,
2535         a more localized solution is to implement a version of "Does the font's cmap
2536         table support every character of the cluster" that doesn't perform the
2537         substitutions. This patch does exactly that, and uses a bit vector to cache
2538         the results. In order to not have a giant bit vector, we take the old code
2539         path if we know the substitutions won't affect us (and uses ASSERT()s to 
2540         validate this) so the bit vector only holds at maximum 3 words of storage.
2541
2542         Test: fast/text/emoji-with-joiner.html
2543
2544         * platform/graphics/Font.cpp:
2545         (WebCore::codePointSupportIndex):
2546         (WebCore::createAndFillGlyphPage):
2547         (WebCore::Font::platformSupportsCodePoint const):
2548         (WebCore::Font::supportsCodePoint const):
2549         (WebCore::Font::canRenderCombiningCharacterSequence const):
2550         * platform/graphics/Font.h:
2551         * platform/graphics/cocoa/FontCocoa.mm:
2552         (WebCore::Font::platformSupportsCodePoint const):
2553
2554 2018-07-01  Wenson Hsieh  <wenson_hsieh@apple.com>
2555
2556         [macOS] Text replacements that end with symbols are expanded immediately
2557         https://bugs.webkit.org/show_bug.cgi?id=187225
2558         <rdar://problem/41112433>
2559
2560         Reviewed by Darin Adler.
2561
2562         In shipping Safari, enabling grammar correction causes text shortcuts that end with symbols or punctuation marks
2563         to immediately trigger when typing; normally, when grammar correction is off, this is only triggered after the
2564         user has additionally inserted a punctuation mark or whitespace character after the replaced text.
2565
2566         This bug happens because enabling grammar checking causes the spell checking range to expand to the range of the
2567         full sentence, so any text checking results that replace an existing range are triggered as long as they end
2568         anywhere in the sentence. In contrast, when grammar checking is disabled, the spell checking range is limited to
2569         the nearest adjacent word, which prevents text replacement from occurring elsewhere in the sentence.
2570
2571         However, after r232530, we now always expand the spell checking range to the extent of the sentence when a word
2572         is typed regardless of whether grammar checking is enabled, which means that the issue described above now
2573         happens everywhere. To fix this recent regression and the existing bug, we:
2574
2575         -   Augment our spellchecking codepaths to include a new automatic text replacement range, alongside
2576             spellchecking and paragraph ranges.
2577         -   Let this automatic text replacement range be the range of the adjacent word in the case where the user has
2578             finished typing a word.
2579         -   When marking and replacing text checking results, consult this new automatic text replacement instead of the
2580             spellchecking range.
2581
2582         This keeps the behavior grammar and sentence retro correction results intact, while limiting the scope in which
2583         text replacement results are applied.
2584
2585         Test: editing/spelling/text-replacement-after-typing-to-word.html
2586
2587         * editing/AlternativeTextController.cpp:
2588         (WebCore::AlternativeTextController::timerFired):
2589         * editing/Editor.cpp:
2590         (WebCore::Editor::replaceSelectionWithFragment):
2591         (WebCore::Editor::markMisspellingsAfterTypingToWord):
2592
2593         Pass in the adjacent word range for the `automaticReplacementRange`, instead of the spell checking range (which
2594         may be extended to the full range of the sentence).
2595
2596         (WebCore::Editor::markAllMisspellingsAndBadGrammarInRanges):
2597
2598         Add an `automaticReplacementRange` argument to markAllMisspellingsAndBadGrammarInRanges, and adjust call sites
2599         to pass in a range (generally the same as the spell checking range, but in the case where a word has been typed,
2600         this is a narrower range).
2601
2602         (WebCore::correctSpellcheckingPreservingTextCheckingParagraph):
2603         (WebCore::Editor::markAndReplaceFor):
2604
2605         When replacing text, only allow text replacement in the automatic replacement range rather than the spell
2606         checking range.
2607
2608         (WebCore::Editor::markMisspellingsAndBadGrammar):
2609         * editing/Editor.h:
2610         * editing/SpellChecker.cpp:
2611         (WebCore::SpellCheckRequest::SpellCheckRequest):
2612
2613         Add a new version of this constructor that takes a single Range representing both the spellchecking range and
2614         the automatic text replacement range, for convenience.
2615
2616         (WebCore::SpellCheckRequest::create):
2617         * editing/SpellChecker.h:
2618
2619         Add plumbing for the automatic replacement range.
2620
2621         (WebCore::SpellCheckRequest::automaticReplacementRange const):
2622         * editing/TextCheckingHelper.cpp:
2623
2624         Add plumbing for the automatic replacement range, and new helpers to locate the range as offsets within the
2625         text checking paragraph range.
2626
2627         (WebCore::TextCheckingParagraph::TextCheckingParagraph):
2628         (WebCore::TextCheckingParagraph::invalidateParagraphRangeValues):
2629         (WebCore::TextCheckingParagraph::automaticReplacementStart const):
2630         (WebCore::TextCheckingParagraph::automaticReplacementLength const):
2631         * editing/TextCheckingHelper.h:
2632
2633 2018-06-30  David Kilzer  <ddkilzer@apple.com>
2634
2635         Follow-up: Fix clang static analyzer warnings: Garbage return value
2636         <https://webkit.org/b/187224>
2637
2638         Address review feedback from Eric Carlson.
2639
2640         * platform/mediastream/MediaConstraints.h:
2641         (WebCore::NumericConstraint::valueForCapabilityRange const):
2642         - Use brace initialization for more local variables.
2643
2644 2018-06-30  Michael Catanzaro  <mcatanzaro@igalia.com>
2645
2646         Asan false positive: stack use after scope under WebCore::ApplyPropertyBorderImageModifier in WebCore::Length::Length(WebCore::Length&&)
2647         https://bugs.webkit.org/show_bug.cgi?id=186980
2648         <rdar://problem/41409838>
2649
2650         Reviewed by Oliver Hunt.
2651
2652         We believe that we have found a bug in GCC's address sanitizer. It is blocking work on other
2653         issues, so work around it by changing a temporary into a local variable.
2654
2655         * css/StyleBuilderCustom.h:
2656         (WebCore::ApplyPropertyBorderImageModifier::applyInitialValue):
2657
2658 2018-06-30  David Kilzer  <ddkilzer@apple.com>
2659
2660         Fix clang static analyzer warnings: Garbage return value
2661         <https://webkit.org/b/187224>
2662
2663         Reviewed by Eric Carlson.
2664
2665         * platform/mediastream/MediaConstraints.h:
2666         (WebCore::NumericConstraint::valueForCapabilityRange const):
2667         - Use brace initialization for local variables.
2668
2669 2018-06-30  Zalan Bujtas  <zalan@apple.com>
2670
2671         [LFC] Do not add the containing block's offset while computing the out-of-flow static position.
2672         https://bugs.webkit.org/show_bug.cgi?id=187202
2673
2674         Reviewed by Antti Koivisto.
2675
2676         The static position for an out-of-flow elements is
2677         1. the distance from the parent's border box.
2678         2. climbing up on the containing block chain and offset the containers until we reach the out-of-flow element's containing block.
2679
2680         * layout/FormattingContextGeometry.cpp:
2681         (WebCore::Layout::staticVerticalPositionForOutOfFlowPositioned):
2682         (WebCore::Layout::staticHorizontalPositionForOutOfFlowPositioned):
2683
2684 2018-06-30  Zalan Bujtas  <zalan@apple.com>
2685
2686         [LFC] If the top and bottom margins of a box are adjoining, then it is possible for margins to collapse through it.
2687         https://bugs.webkit.org/show_bug.cgi?id=187220
2688
2689         Reviewed by Antti Koivisto.
2690
2691         * layout/blockformatting/BlockMarginCollapse.cpp:
2692         (WebCore::Layout::isMarginBottomCollapsedThrough):
2693         (WebCore::Layout::BlockFormattingContext::MarginCollapse::collapsedMarginTopFromFirstChild):
2694         (WebCore::Layout::BlockFormattingContext::MarginCollapse::marginTop):
2695         (WebCore::Layout::BlockFormattingContext::MarginCollapse::marginBottom):
2696         (WebCore::Layout::BlockFormattingContext::MarginCollapse::isMarginBottomCollapsedWithParent):
2697         (WebCore::Layout::BlockFormattingContext::MarginCollapse::collapsedMarginBottomFromLastChild):
2698
2699 2018-06-30  Zalan Bujtas  <zalan@apple.com>
2700
2701         [LFC] Adjust final out-of-flow position with the computed margin value.
2702         https://bugs.webkit.org/show_bug.cgi?id=187219
2703
2704         Reviewed by Antti Koivisto.
2705
2706         * layout/FormattingContext.cpp:
2707         (WebCore::Layout::FormattingContext::computeOutOfFlowVerticalGeometry const):
2708         (WebCore::Layout::FormattingContext::computeOutOfFlowHorizontalGeometry const):
2709
2710 2018-06-29  Antoine Quint  <graouts@apple.com>
2711
2712         [Web Animations] Make WPT test at timing-model/timelines/document-timelines.html pass reliably
2713         https://bugs.webkit.org/show_bug.cgi?id=186507
2714         <rdar://problem/41000257>
2715
2716         Reviewed by Dean Jackson.
2717
2718         The Web Animations spec, along with the HTML5 event loop spec, specify some assumptions on the time reported by
2719         document.timeline.currentTime:
2720
2721         - it should only increase once per frame
2722         - it should have the same value as the timestamp passed to requestAnimationFrame() callbacks
2723
2724         The WPT test at web-platform-tests/web-animations/timing-model/timelines/document-timelines.html relies on these
2725         assumptions to be true so that we check that the start time of a new animation is not the same as the timeline time
2726         when it was created, since it will be in the "play-pending" state for a frame.
2727
2728         In order to support this, we add two new methods on DocumentAnimationScheduler. First, when a scheduled display update
2729         fires, we record the timestamp and expose it via lastTimestamp() such that DocumentTimeline and ScriptedAnimationController
2730         can use the same value when updating animations. Then, to know whether code is run as a result of a display update, we
2731         expose isFiring().
2732
2733         Now, within DocumentTimeline::currentTime(), we can cache the current time this way:
2734
2735         - if we're in the middle of a display update, use the value returned by lastTimestamp().
2736         - otherwise, compute what would have been the ideal number of frames (at 60fps or less if throttled) and add those to
2737         the lastTimestamp() value.
2738
2739         Then, we remove this cached current time when both currently-running JavaScript has completed and all animation update
2740         code has completed by waiting on the invalidation task to run.
2741
2742         * animation/DocumentAnimationScheduler.cpp:
2743         (WebCore::DocumentAnimationScheduler::displayRefreshFired):
2744         * animation/DocumentAnimationScheduler.h:
2745         (WebCore::DocumentAnimationScheduler::lastTimestamp):
2746         (WebCore::DocumentAnimationScheduler::isFiring const):
2747         * animation/DocumentTimeline.cpp:
2748         (WebCore::DocumentTimeline::currentTime):
2749         (WebCore::DocumentTimeline::performInvalidationTask):
2750         (WebCore::DocumentTimeline::maybeClearCachedCurrentTime):
2751         * animation/DocumentTimeline.h:
2752         * dom/ScriptedAnimationController.cpp:
2753         (WebCore::ScriptedAnimationController::serviceScriptedAnimations):
2754         (WebCore::ScriptedAnimationController::documentAnimationSchedulerDidFire):
2755
2756 2018-06-29  Nan Wang  <n_wang@apple.com>
2757
2758         Crash under WebCore::AXObjectCache::handleMenuItemSelected
2759         https://bugs.webkit.org/show_bug.cgi?id=186918
2760         <rdar://problem/41365984>
2761
2762         Reviewed by Chris Fleizach.
2763
2764         When a node is being destroyed, we deregister it from the AX cache through the Node's destructor.
2765         But we did not remove the corresponding entry from the m_deferredFocusedNodeChange list. It would
2766         then lead to a crash if we try to access the deleted node from m_deferredFocusedNodeChange.
2767         Fixed it by removing the entry if the newly focused node is being destroyed.
2768
2769         Test: accessibility/accessibility-crash-focused-element-change.html
2770
2771         * accessibility/AXObjectCache.cpp:
2772         (WebCore::AXObjectCache::remove):
2773
2774 2018-06-29  Antti Koivisto  <antti@apple.com>
2775
2776         REGRESSION (r232806): Facebook login fields have blue fill background instead of white
2777         https://bugs.webkit.org/show_bug.cgi?id=187207
2778         <rdar://problem/41606349>
2779
2780         Reviewed by Tim Horton.
2781
2782         This happens because a 'prefers-dark-interface' media query on UA sheet always evaluates to true in dark mode.
2783
2784         Tests: fast/forms/input-background-ua-media-query.html
2785
2786         * css/MediaQueryEvaluator.cpp:
2787         (WebCore::prefersDarkInterfaceEvaluate):
2788
2789         Make prefers-dark-interface media query match only when using system appearance.
2790
2791 2018-06-29  Daniel Bates  <dabates@apple.com>
2792
2793         REGRESSION (r230921): Cannot log in to forums.swift.org using GitHub account
2794         https://bugs.webkit.org/show_bug.cgi?id=187197
2795         <rdar://problem/40420821>
2796
2797         Reviewed by Brent Fulgham.
2798
2799         Fixes an issue where a Same-Site cookies are not sent with any child window load if the
2800         load is cross-origin with respect to the window's opener. One example where this issue
2801         manifest itself was in the GitHub sign in flow on forums.swift.org.
2802
2803         Currently we always consider the origin of the window's opener (if we have one) when
2804         determining whether a frame load request is same-origin and hence should send Same-Site
2805         cookies when performing the request. So, when page A.com opens a child window to B.com and
2806         then a person clicks a hyperlink or submits a form to B.com/b2 then we do not send Same-
2807         Site cookies with the request to B.com/b2 (because its origin, B.com, is cross-origin
2808         with its opener, A.com). But we should send Same-Site cookies with the request to B.com/b2
2809         because it is same-origin with the page that initiated the request, B.com. Instead of
2810         always considering the origin the window's opener for every frame load we should only
2811         consider it for the first non-empty document load.
2812
2813         Tests: http/tests/cookies/same-site/fetch-in-about-blank-popup.html
2814                http/tests/cookies/same-site/post-from-cross-site-popup.html
2815
2816         * loader/FrameLoader.cpp:
2817         (WebCore::FrameLoader::addExtraFieldsToRequest):
2818
2819 2018-06-29  Nan Wang  <n_wang@apple.com>
2820
2821         AX: [iOS] VoiceOver scroll position is jumpy in frames
2822         https://bugs.webkit.org/show_bug.cgi?id=186956
2823
2824         Reviewed by Simon Fraser.
2825
2826         iOS is using delegate scrolling and we should not take into account
2827         the scroll offset when converting rects.
2828
2829         Also fixed a issue where we want to scroll the element into view even
2830         if it's partially visible.
2831
2832         Test: fast/scrolling/ios/iframe-scroll-into-view.html
2833
2834         * accessibility/AccessibilityObject.cpp:
2835         (WebCore::AccessibilityObject::scrollToMakeVisible const):
2836         * platform/ScrollView.cpp:
2837         (WebCore::ScrollView::contentsToContainingViewContents const):
2838
2839 2018-06-29  Chris Dumez  <cdumez@apple.com>
2840
2841         WebKitLegacy: Can trigger recursive loads triggering debug assertions
2842         https://bugs.webkit.org/show_bug.cgi?id=187121
2843         <rdar://problem/41259430>
2844
2845         Reviewed by Brent Fulgham.
2846
2847         In order to support asynchronous policy delegates, r229722 added a call to
2848         FrameLoader::clearProvisionalLoadForPolicyCheck() when starting a navigation
2849         policy decision in PolicyChecker::checkNavigationPolicy(). This calls
2850         stopLoading() on the current provisional loader if there is one, and potentially
2851         calls the didFailProvisionalLoadWithError cleint delegate. This delegate call
2852         is synchronous on WebKit1, so the client may start a new load from this delegate
2853         and re-enter Webcore. This happens in practive with Quickens 2017 / 2018 on Mac.
2854
2855         Before r229722, this was not an issue because pending loads were canceled after
2856         the (asynchronous) navigation policy decision, via FrameLoader::stopAllLoaders().
2857         FrameLoader::stopAllLoaders() sets a m_inStopAllLoaders flag and we return early
2858         in FrameLoader::loadRequest() when this flag is set to prevent recursive loads.
2859
2860         To maintain shipping behavior as much as possible, this patch introduces a similar
2861         inClearProvisionalLoadForPolicyCheck which gets set during
2862         FrameLoader::clearProvisionalLoadForPolicyCheck() and we prevent new loads while
2863         this flag is set.
2864
2865         I have verified that Quickens 2017 / 2018 works again after this change and I added
2866         API test coverage for this behavior.
2867
2868         * loader/FrameLoader.cpp:
2869         (WebCore::FrameLoader::loadURL):
2870         (WebCore::FrameLoader::load):
2871         (WebCore::FrameLoader::clearProvisionalLoadForPolicyCheck):
2872         * loader/FrameLoader.h:
2873
2874 2018-06-25  Said Abou-Hallawa  <sabouhallawa@apple.com>
2875
2876         Infinite loop if a <use> element references its ancestor and the DOMNodeInserted event handler of one its ancestor's descents updates the document style
2877         https://bugs.webkit.org/show_bug.cgi?id=186925
2878
2879         Reviewed by Antti Koivisto.
2880
2881         This patches fixes two issues:
2882         -- SVGTRefTargetEventListener should not assume it has to be attached to
2883         target when its handleEvent() is called.
2884         Because SVGTRefTargetEventListener::handleEvent() references the target
2885         element, we just return if the listener is detached.
2886
2887         -- The <use> element should not clone its shadow tree if it references one
2888         of its ancestors. The DOMNodeInserted of any node in the target element
2889         tree may issue a document command. This document command will cause the 
2890         shadow tree to be re-cloned so this will cause infinite loop to happen.
2891
2892         Test: svg/dom/svg-use-infinite-loop-cloning.html
2893
2894         * svg/SVGTRefElement.cpp:
2895         (WebCore::SVGTRefTargetEventListener::handleEvent):
2896         * svg/SVGUseElement.cpp:
2897         (WebCore::SVGUseElement::updateShadowTree):
2898
2899 2018-06-29  Manuel Rego Casasnovas  <rego@igalia.com>
2900
2901         [WPE] Three CSS Grid Layout tests crash due to valueless std::optional access
2902         https://bugs.webkit.org/show_bug.cgi?id=186752
2903
2904         Reviewed by Frédéric Wang.
2905
2906         This is a simple fix for the crash we're getting on WPE
2907         in IndefiniteSizeStrategy::freeSpaceForStretchAutoTracksStep().
2908
2909         Covered by existent tests, just remove them from TestExpectations file.
2910
2911         * rendering/GridTrackSizingAlgorithm.cpp:
2912         (WebCore::IndefiniteSizeStrategy::freeSpaceForStretchAutoTracksStep const):
2913         Check if minSize is null before trying to access it's value.
2914
2915 2018-06-29  David Fenton  <david_fenton@apple.com>
2916
2917         Unreviewed, rolling out r233349.
2918
2919         caused 42 crashes on iOS GuardMalloc and iOS ASan tests
2920
2921         Reverted changeset:
2922
2923         "[Web Animations] Using a Web Animation leaks the Document"
2924         https://bugs.webkit.org/show_bug.cgi?id=187088
2925         https://trac.webkit.org/changeset/233349
2926
2927 2018-06-29  Jer Noble  <jer.noble@apple.com>
2928
2929         Returning PiP'd video to fullscreen while playing leaves video muted.
2930         https://bugs.webkit.org/show_bug.cgi?id=187181
2931         <rdar://problem/41408335>
2932
2933         Reviewed by Eric Carlson.
2934
2935         Test: media/picture-in-picture-interruption.html
2936
2937         Don't reset the media session's state at the end of an interruption if it wasn't changed an the beginning of one.
2938
2939         * platform/audio/PlatformMediaSession.cpp:
2940         (WebCore::PlatformMediaSession::endInterruption):
2941         * testing/Internals.cpp:
2942         (WebCore::Internals::mediaSessionState):
2943         * testing/Internals.h:
2944         * testing/Internals.idl:
2945
2946 2018-06-29  Zalan Bujtas  <zalan@apple.com>
2947
2948         [LFC] When the formatting root is also a containing block for out-of-flow elements.
2949         https://bugs.webkit.org/show_bug.cgi?id=187179
2950
2951         Reviewed by Antti Koivisto.
2952
2953         Out-of-flow descendants' layout requires their containing block height to be computed. This patch takes care of the case
2954         when the containing block is also a formatting context root (e.g. relative positioned with overflow other than visible).
2955
2956         * layout/Verification.cpp:
2957         (WebCore::Layout::LayoutContext::verifyAndOutputMismatchingLayoutTree const):
2958         * layout/blockformatting/BlockFormattingContext.cpp:
2959         (WebCore::Layout::BlockFormattingContext::layoutFormattingContextRoot const):
2960
2961 2018-06-29  Zalan Bujtas  <zalan@apple.com>
2962
2963         [LFC] Do not skip the next inflow sibling after finishing a formatting context root layout.
2964         https://bugs.webkit.org/show_bug.cgi?id=187178
2965
2966         Reviewed by Antti Koivisto.
2967
2968         Since the block formatting layout is based on pre-order traversal, after finishing a formatting
2969         context layout (which takes care of its entire subtre), we need to visit the next (in-flow)sibling. 
2970
2971         * layout/blockformatting/BlockFormattingContext.cpp:
2972         (WebCore::Layout::BlockFormattingContext::layout const):
2973
2974 2018-06-29  Zalan Bujtas  <zalan@apple.com>
2975
2976         [LFC] The static position for an out-of-flow box should include the previous sibling's collapsed margin
2977         https://bugs.webkit.org/show_bug.cgi?id=187169
2978
2979         Reviewed by Antti Koivisto.
2980
2981         When computing the static position of an absolutely positioned box, we need to look at the previous sibling's bottom margin.
2982         If the previous sibling happens to collapse its bottom margin with the parent's bottom margin, we still need to account for it
2983         and compute the static vertical position as if the bottom margin was not collapsed.
2984
2985         * layout/FormattingContext.cpp:
2986         (WebCore::Layout::FormattingContext::computeFloatingHeightAndMargin const):
2987         (WebCore::Layout::FormattingContext::computeOutOfFlowVerticalGeometry const):
2988         * layout/FormattingContextGeometry.cpp:
2989         (WebCore::Layout::staticVerticalPositionForOutOfFlowPositioned):
2990         * layout/LayoutContext.cpp:
2991         (WebCore::Layout::LayoutContext::initializeRoot):
2992         * layout/Verification.cpp:
2993         (WebCore::Layout::outputMismatchingBoxInformationIfNeeded):
2994         * layout/blockformatting/BlockFormattingContext.cpp:
2995         (WebCore::Layout::BlockFormattingContext::computeInFlowHeightAndMargin const):
2996         * layout/displaytree/DisplayBox.cpp:
2997         (WebCore::Display::Box::nonCollapsedMarginBox const):
2998         * layout/displaytree/DisplayBox.h:
2999         (WebCore::Display::Box::setHasValidVerticalNonCollapsedMargin):
3000         (WebCore::Display::Box::setVerticalMargin):
3001         (WebCore::Display::Box::setVerticalNonCollapsedMargin):
3002         (WebCore::Display::Box::nonCollapsedMarginTop const):
3003         (WebCore::Display::Box::nonCollapsedMarginBottom const):
3004
3005 2018-06-27  Antoine Quint  <graouts@apple.com>
3006
3007         [Web Animations] Using a Web Animation leaks the Document
3008         https://bugs.webkit.org/show_bug.cgi?id=187088
3009         <rdar://problem/41392046>
3010
3011         Reviewed by Dean Jackson.
3012
3013         Test: webanimations/leak-document-with-web-animation.html
3014
3015         We need to ensure that any remaining animation is cleared when the DocumentTimeline is detached from its Document.
3016         We rename WebAnimation::prepareAnimationForRemoval() to WebAnimation::remove() since it really actively disassociates
3017         the animation from its timeline.
3018
3019         * animation/AnimationTimeline.cpp:
3020         (WebCore::AnimationTimeline::removeAnimationsForElement): We no longer need the call to removeAnimation()
3021         since the new WebAnimation::remove() method will also set the timeline to null which will eventually call
3022         removeAnimation() on the disassociated timeline.
3023         * animation/DeclarativeAnimation.cpp:
3024         (WebCore::DeclarativeAnimation::remove):
3025         (WebCore::DeclarativeAnimation::prepareAnimationForRemoval): Deleted.
3026         * animation/DeclarativeAnimation.h:
3027         * animation/DocumentTimeline.cpp:
3028         (WebCore::DocumentTimeline::detachFromDocument): Call remove() on all known animations.
3029         * animation/WebAnimation.cpp:
3030         (WebCore::WebAnimation::remove): Set the timeline to null to fully disassociate this animation from its timeline.
3031         (WebCore::WebAnimation::setTimeline): Factor the internal timeline-association code out of this JS API method so
3032         that we can call this code without any JS-facing implications.
3033         (WebCore::WebAnimation::setTimelineInternal):
3034         (WebCore::WebAnimation::prepareAnimationForRemoval): Deleted.
3035         * animation/WebAnimation.h:
3036
3037 2018-06-28  Zalan Bujtas  <zalan@apple.com>
3038
3039         [LFC] Out-of-flow positioned height does not necessarily equal to "bottom - top".
3040         https://bugs.webkit.org/show_bug.cgi?id=187168
3041
3042         Reviewed by Antti Koivisto.
3043
3044         According to the spec "For absolutely positioned elements, the used values of the vertical dimensions must satisfy this constraint:
3045         'top' + 'margin-top' + 'border-top-width' + 'padding-top' + 'height' + 'padding-bottom' + 'border-bottom-width' + 'margin-bottom' + 'bottom' = height of containing block"
3046         With a non-auto "height" value, the bottom - top does not necessarily compute to the height of the element.
3047
3048         * layout/FormattingContext.cpp:
3049         (WebCore::Layout::FormattingContext::computeOutOfFlowVerticalGeometry const):
3050
3051 2018-06-28  Olivia Barnett  <obarnett@apple.com>
3052
3053         Find in page for typographic quotes does not find low (German) quotes
3054         https://bugs.webkit.org/show_bug.cgi?id=187164
3055         <rdar://problem/29612785>
3056
3057         Reviewed by Tim Horton.
3058
3059         Added additional quote test to LayoutTests/fast/text/find-quotes.html.
3060
3061         Added functionality to replace German quotes when matching.
3062
3063         * editing/TextIterator.cpp:
3064         (WebCore::foldQuoteMark):
3065         (WebCore::foldQuoteMarks):
3066
3067 2018-06-28  Antti Koivisto  <antti@apple.com>
3068
3069         REGRESSION (233281): fast/dom/location-new-window-no-crash.html and some other tests are timing out
3070         https://bugs.webkit.org/show_bug.cgi?id=187156
3071
3072         Reviewed by Zalan Bujtas.
3073
3074         We need still need to re-enable memory cache client calls even when not doing other post-resolution callbacks.
3075
3076         * style/StyleTreeResolver.cpp:
3077         (WebCore::Style::memoryCacheClientCallsResumeQueue):
3078
3079         Add a separate queue for this.
3080
3081         (WebCore::Style::suspendMemoryCacheClientCalls):
3082         (WebCore::Style::PostResolutionCallbackDisabler::~PostResolutionCallbackDisabler):
3083
3084 2018-06-28  Wenson Hsieh  <wenson_hsieh@apple.com>
3085
3086         [iOS] DataTransfer.getData always returns the empty string when dropping text
3087         https://bugs.webkit.org/show_bug.cgi?id=187130
3088         <rdar://problem/41014117>
3089
3090         Reviewed by Ryosuke Niwa.
3091
3092         Currently, DataTransfer.getData() always returns the empty string on drop. This is because all data on drop is
3093         backed by local files in the temporary directory, so the number of files is never 0; this, combined with the
3094         fact that WebKit will suppress access to the DataTransfer object if there is one or more file in the pasteboard,
3095         means that getData() never works for drag and drop on iOS at the moment. To fix this, we need to know whether a
3096         dropped item provider is a file.
3097
3098         Ideally, we'd have a flag to tell us whether or not an NSItemProvider being dropped is a file, or instead just
3099         inline data - in fact, this flag already exists in the form of UIPreferredPresentationStyle. Unfortunately, not
3100         all apps that vend draggable files specify this, so we can't simply ask the item provider whether it's intended
3101         to be a file. As a workaround, we can use several heuristics to determine the "file content state" of the drag
3102         pasteboard on iOS (see below for more details).
3103
3104         This patch adds some plumbing through the client layers to grab a list of item information describing each
3105         dropped item provider on iOS. Using this information, we tweak the logic in Pasteboard::fileContentState to make
3106         an educated guess at whether or not the pasteboard really contains files; if we determine that the pasteboard
3107         probably contains no files, we'll allow DataTransfer.getData() to retrieve information from the pasteboard.
3108         Otherwise, if the pasteboard may contain files, we'll fall back to our current behavior of including the "Files"
3109         type in DataTransfer.types and allowing the page to grab file data using DataTransfer.files or
3110         DataTransfer.items.
3111
3112         Tests:  DataInteractionTests.DataTransferGetDataReadPlainAndRichText
3113                 DataInteractionTests.DataTransferSuppressGetDataDueToPresenceOfTextFile
3114
3115         * dom/DataTransfer.cpp:
3116         (WebCore::DataTransfer::filesFromPasteboardAndItemList const):
3117
3118         Check Pasteboard::fileContentState() to ensure that we don't expose files when DataTransfer.types does not
3119         contain the "Files" type, and vice versa, and DataTranser.files is also empty in this case.
3120
3121         * dom/DataTransferItemList.cpp:
3122         * platform/PasteboardItemInfo.h:
3123
3124         Add a couple of additional members to PasteboardItemInfo: suggestedFileName and hasDeclaredNonTextType, a flag
3125         that indicates whether or not the pasteboard item has a type representation that is a declared type, but is not
3126         a text type (i.e. does not conform to "public.text", "public.url", or rich text format with attachment types).
3127
3128         (WebCore::PasteboardItemInfo::encode const):
3129         (WebCore::PasteboardItemInfo::decode):
3130         * platform/PasteboardStrategy.h:
3131         * platform/PlatformPasteboard.h:
3132         * platform/cocoa/PasteboardCocoa.mm:
3133         (WebCore::Pasteboard::fileContentState):
3134
3135         Instead of always considering a dropped item provider on iOS to represent a file, only do so if at least one of
3136         the following conditions are met:
3137         - The drop session contains multiple item providers (flocking text selections is a very rare use case).
3138         - The item provider was explicitly marked as an attachment.
3139         - The item provider has a suggested file name.
3140         - The item provider has any other content that is not text.
3141
3142         In the case where none of the above conditions are met, the item provider (if it ends up being a file) is
3143         essentially indistinguishable from inline data. An example of this is dropping a plain text file that is
3144         unnamed, with no presentation style, and alongside no other items nor other known type representations. These
3145         are cases in which whether the item is treated as a file or as inline data is (hopefully) irrelevant.
3146
3147         * platform/ios/PlatformPasteboardIOS.mm:
3148         (WebCore::PlatformPasteboard::allPasteboardItemInfo):
3149         (WebCore::PlatformPasteboard::informationForItemAtIndex):
3150
3151 2018-06-28  Timothy Hatcher  <timothy@apple.com>
3152
3153         Don't force black text when TextIndicator draws backgrounds or all content.
3154         https://bugs.webkit.org/show_bug.cgi?id=187161
3155         rdar://problem/40434644
3156
3157         Reviewed by Tim Horton.
3158
3159         * page/TextIndicator.cpp:
3160         (WebCore::snapshotOptionsForTextIndicatorOptions):
3161         Only set SnapshotOptionsForceBlackText when TextIndicatorOptionRespectTextColor and
3162         TextIndicatorOptionPaintBackgrounds are not set.
3163
3164 2018-06-28  Timothy Hatcher  <timothy@apple.com>
3165
3166         Find on page selection color isn't adapted for dark mode.
3167         https://bugs.webkit.org/show_bug.cgi?id=187072
3168
3169         Unreviewed, revert part of r233280.
3170
3171         * rendering/RenderThemeMac.mm:
3172         (WebCore::RenderThemeMac::platformActiveTextSearchHighlightColor const): Use pure yellow again.
3173
3174 2018-06-28  Antoine Quint  <graouts@apple.com>
3175
3176         [Web Animations] Make imported/mozilla/css-animations/test_animation-starttime.html pass reliably
3177         https://bugs.webkit.org/show_bug.cgi?id=183834
3178         <rdar://problem/40997932>
3179
3180         Reviewed by Dean Jackson.
3181
3182         We need to run pending tasks in the "update animations" procedure to ensure that the start time has been set
3183         to a different time than the timeline time at the time the animation was asked to play(). This ensure the
3184         timeline current time has progressed and can be queried to a different value in a requestAnimationFrame()
3185         callback.
3186
3187         When invalidating events, we need to make sure we disregard instances when an animation has and is still pending
3188         so that we wait until we change the pending state to work out which events to enqueue.
3189
3190         * animation/DeclarativeAnimation.cpp:
3191         (WebCore::DeclarativeAnimation::invalidateDOMEvents):
3192         * animation/DocumentTimeline.cpp:
3193         (WebCore::DocumentTimeline::updateAnimations):
3194         * animation/WebAnimation.cpp:
3195         (WebCore::WebAnimation::updatePendingTasks):
3196         (WebCore::WebAnimation::timeToNextRequiredTick const):
3197         (WebCore::WebAnimation::runPendingTasks):
3198         * animation/WebAnimation.h:
3199
3200 2018-06-28  Ryosuke Niwa  <rniwa@webkit.org>
3201
3202         Release assert in ScriptController::canExecuteScripts via WebCore::SVGUseElement::insertedIntoAncestor
3203         https://bugs.webkit.org/show_bug.cgi?id=187137
3204         <rdar://problem/41081885>
3205
3206         Reviewed by Zalan Bujtas.
3207
3208         The bug was caused by SVGUseElement::notifyFinished firing a DOM event via SVGUseElement::updateExternalDocument
3209         inside SVGUseElement::insertedIntoAncestor. Ideally, we make every call to notifyFinished asynchronous
3210         but simply delay the call to updateExternalDocument() until didFinishInsertingNode() for now.
3211
3212         No new tests since the failure is caught with the newly added assertion in notifyFinished by existing SVG tests
3213         such as svg/batik/filters/filterRegions.svg and svg/batik/text/smallFonts.svg. Unfortunately, I could not
3214         construct a test case which hits this release assertion since the real crash happens when the cached resource
3215         had an error but in the all cases I could find, the resource response with an error results in a reload or
3216         an asynchronous failure callback.
3217
3218         * loader/cache/CachedResource.cpp:
3219         (WebCore::CachedResource::didAddClient): Added a FIXME.
3220         * svg/SVGUseElement.cpp:
3221         (WebCore::SVGUseElement::insertedIntoAncestor): Delay the call to updateExternalDocument.
3222         (WebCore::SVGUseElement::didFinishInsertingNode): Invoke updateExternalDocument.
3223         (WebCore::SVGUseElement::notifyFinished): Added an assertion.
3224         * svg/SVGUseElement.h:
3225
3226 2018-06-28  Chris Dumez  <cdumez@apple.com>
3227
3228         Unreviewed, rolling out r233309.
3229
3230         Invalidates previous database model without versioning
3231
3232         Reverted changeset:
3233
3234         "Fix encoding / decoding issues in ResourceLoadStatistics"
3235         https://bugs.webkit.org/show_bug.cgi?id=186890
3236         https://trac.webkit.org/changeset/233309
3237
3238 2018-06-28  Timothy Hatcher  <timothy@apple.com>
3239
3240         Focus ring color does not honor dark mode or system accent color.
3241         https://bugs.webkit.org/show_bug.cgi?id=187144
3242         rdar://problem/41105081
3243
3244         Reviewed by Tim Horton.
3245
3246         Pass the focus ring color through to the GraphicsContext methods that draw it.
3247
3248         * platform/graphics/GraphicsContext.h:
3249         * platform/graphics/cocoa/GraphicsContextCocoa.mm:
3250         (WebCore::drawFocusRingAtTime):
3251         (WebCore::drawFocusRing):
3252         (WebCore::drawFocusRingToContext):
3253         (WebCore::drawFocusRingToContextAtTime):
3254         (WebCore::GraphicsContext::drawFocusRing):
3255         (WebCore::GraphicsContext::focusRingColor): Deleted.
3256         * platform/mac/ThemeMac.mm:
3257         (WebCore::drawCellFocusRingWithFrameAtTime):
3258         * rendering/RenderElement.cpp:
3259         (WebCore::RenderElement::paintFocusRing):
3260         * rendering/RenderImage.cpp:
3261         (WebCore::RenderImage::paintAreaElementFocusRing):
3262
3263 2018-06-28  Aditya Keerthi  <akeerthi@apple.com>
3264
3265         REGRESSION (r232040): Cursor jumping in Safari text fields
3266         https://bugs.webkit.org/show_bug.cgi?id=187142
3267         <rdar://problem/41397577>
3268
3269         Reviewed by Tim Horton.
3270
3271         r232040 enabled click events to fire on nodes that are already being edited in
3272         iOS. This resulted FrameSelection::setSelection being called twice. One call
3273         originated from the UIWKTextInteractionAssistant, which snaps the caret to word
3274         boundaries. The other call originates from handleMousePressEvent in EventHandler,
3275         and uses character boundaries. Consequently, we see the caret jumping around.
3276
3277         To fix this issue, an early return was added in the handleMousePressEvent
3278         codepath, which prevents FrameSelection::setSelection from being called when
3279         clicking on a node that is already being edited. This ensures that the
3280         UIWKTextInteractionAssistant codepath is the only influence on the caret position.
3281
3282         Test: fast/events/ios/click-selectionchange-once.html
3283
3284         * page/EventHandler.cpp:
3285         (WebCore::EventHandler::handleMousePressEventSingleClick):
3286
3287 2018-06-28  Chris Dumez  <cdumez@apple.com>
3288
3289         Fix encoding / decoding issues in ResourceLoadStatistics
3290         https://bugs.webkit.org/show_bug.cgi?id=186890
3291
3292         Reviewed by Brent Fulgham.
3293
3294         * loader/ResourceLoadStatistics.cpp:
3295         (WebCore::encodeHashCountedSet):
3296         (WebCore::encodeHashSet):
3297         Do not return early if the container we're trying to encode is empty. Instead,
3298         have the encoder encode an empty array. This is important for encoding / decoding
3299         to be fully symmetric. Otherwise, when trying to decode one of these empty containers,
3300         the decoder would fail (silently since we were ignoring decoding errors). Worse, the
3301         decoder might succeed but actually be decoding the *next* container in the file, since
3302         we have several HashCountedSets / HashSets encoded one after another.
3303
3304         (WebCore::decodeHashCountedSet):
3305         (WebCore::decodeHashSet):
3306         Return a boolean to indicate if the decoding suceeded or not.
3307
3308         (WebCore::ResourceLoadStatistics::decode):
3309         Check for container decoding errors and return false when decoding fails.
3310         Otherwise, we would just silently keep going.
3311
3312 2018-06-28  Sihui Liu  <sihui_liu@apple.com>
3313
3314         Cookie API: cookie creation time is wrong
3315         https://bugs.webkit.org/show_bug.cgi?id=187101
3316
3317         Reviewed by Geoffrey Garen.
3318
3319         Covered by API test: WebKit.WKHTTPCookieStoreCreationTime.
3320
3321         * platform/network/cocoa/CookieCocoa.mm:
3322         (WebCore::Cookie::operator NSHTTPCookie * _Nullable  const):
3323
3324 2018-06-28  Zalan Bujtas  <zalan@apple.com>
3325
3326         [LFC] Add Display::Box::nonCollapsedMarginBox for verification purposes.
3327         https://bugs.webkit.org/show_bug.cgi?id=187140
3328
3329         Reviewed by Antti Koivisto.
3330
3331         * layout/FormattingContext.cpp:
3332         (WebCore::Layout::FormattingContext::computeFloatingHeightAndMargin const):
3333         (WebCore::Layout::FormattingContext::computeOutOfFlowHorizontalGeometry const):
3334         * layout/Verification.cpp:
3335         (WebCore::Layout::outputMismatchingBoxInformationIfNeeded):
3336         * layout/blockformatting/BlockFormattingContext.cpp:
3337         (WebCore::Layout::BlockFormattingContext::computeInFlowHeightAndMargin const):
3338         * layout/displaytree/DisplayBox.cpp:
3339         (WebCore::Display::Box::nonCollapsedMarginBox const):
3340         * layout/displaytree/DisplayBox.h:
3341         (WebCore::Display::Box::setVerticalNonCollapsedMargin):
3342
3343 2018-06-28  Zalan Bujtas  <zalan@apple.com>
3344
3345         [LFC] The margin bottom of the document element does not collapse with its last inflow child's bottom margin.
3346         https://bugs.webkit.org/show_bug.cgi?id=187135
3347
3348         Reviewed by Antti Koivisto.
3349
3350         * layout/blockformatting/BlockFormattingContext.h:
3351         * layout/blockformatting/BlockFormattingContextGeometry.cpp:
3352         (WebCore::Layout::BlockFormattingContext::Geometry::inFlowNonReplacedHeightAndMargin):
3353         * layout/blockformatting/BlockMarginCollapse.cpp:
3354         (WebCore::Layout::BlockFormattingContext::MarginCollapse::marginBottom):
3355         (WebCore::Layout::BlockFormattingContext::MarginCollapse::isMarginBottomCollapsedWithParent):
3356         (WebCore::Layout::BlockFormattingContext::MarginCollapse::collapsedMarginBottomFromLastChild):
3357
3358 2018-06-28  Dirk Schulze  <krit@webkit.org>
3359
3360         [css-masking] Update clip-path box mapping to unified box
3361         https://bugs.webkit.org/show_bug.cgi?id=185797
3362
3363         Reviewed by Simon Fraser.
3364
3365         The box mapping for fill-box, stroke-box, view-box on HTML elements
3366         and content-box, padding-box, margin-box, border-box for SVG elements
3367         was aligned with the transform-box CSS property.
3368
3369         Furthermore, the keywords fill changed to fill-box and stroke changed
3370         to stroke-box.
3371
3372         https://drafts.fxtf.org/css-masking-1/#typedef-geometry-box
3373
3374         Update the -webkit-clip-path property.
3375
3376         Tests: svg/clip-path/clip-path-shape-border-box-expected.svg
3377                svg/clip-path/clip-path-shape-border-box.svg
3378                svg/clip-path/clip-path-shape-content-box-expected.svg
3379                svg/clip-path/clip-path-shape-content-box.svg
3380                svg/clip-path/clip-path-shape-margin-box-expected.svg
3381                svg/clip-path/clip-path-shape-margin-box.svg
3382                svg/clip-path/clip-path-shape-padding-box-expected.svg
3383                svg/clip-path/clip-path-shape-padding-box.svg
3384
3385         * css/CSSPrimitiveValueMappings.h:
3386         (WebCore::CSSPrimitiveValue::CSSPrimitiveValue):
3387         (WebCore::CSSPrimitiveValue::operator CSSBoxType const):
3388         * css/CSSValueKeywords.in:
3389         * css/StyleBuilderConverter.h:
3390         (WebCore::StyleBuilderConverter::convertClipPath):
3391         * css/parser/CSSPropertyParser.cpp:
3392         (WebCore::consumeBasicShapeOrBox):
3393         * rendering/RenderBlock.cpp:
3394         (WebCore::RenderBlock::nodeAtPoint):
3395         * rendering/RenderLayer.cpp:
3396    &nb