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