[GStreamer] Start implementing Audio/VideoTrackPrivateGSTreamer::kind method
[WebKit-https.git] / Source / WebCore / ChangeLog
1 2018-04-23  Thibault Saunier  <tsaunier@igalia.com>
2
3         [GStreamer] Start implementing Audio/VideoTrackPrivateGSTreamer::kind method
4         https://bugs.webkit.org/show_bug.cgi?id=184650
5
6         Reviewed by Philippe Normand.
7
8         In the playbin3 case we can assume that if the GstStream is selected by default,
9         it is the Main track of that kind.
10
11         No new tests are added as:
12             * It relies on playbin3 case which support might be compiled out
13             * we already have a few test that are currently disabled in the mediastream
14               testsuite. This patch is part of the work to enable them.
15
16         * platform/graphics/gstreamer/AudioTrackPrivateGStreamer.cpp:
17         (WebCore::AudioTrackPrivateGStreamer::kind const):
18         * platform/graphics/gstreamer/AudioTrackPrivateGStreamer.h:
19         * platform/graphics/gstreamer/VideoTrackPrivateGStreamer.cpp:
20         (WebCore::VideoTrackPrivateGStreamer::kind const):
21         * platform/graphics/gstreamer/VideoTrackPrivateGStreamer.h:
22
23 2018-04-23  Alicia Boya García  <aboya@igalia.com>
24
25         [MSE] Add allSamplesInTrackEnqueued event
26         https://bugs.webkit.org/show_bug.cgi?id=184737
27
28         MediaSource has a .endOfStream() method to signal when there are no more frames
29         after the ones currently buffered.
30
31         This bit of data is important for some multimedia frameworks. For instance, in
32         GStreamer a stream of frames being decoded should be terminated by a
33         'end-of-stream' (EOS) event that has a similar meaning. Some GStreamer elements
34         will expect this event in order to work properly under some circumstances.
35
36         Unfortunately currently WebKit provides no mechanism for this: an event of
37         sorts should be emitted after no more frames are going to be enqueued to signal
38         the end of the stream. The closest mechanism WebKit has for this is
39         `markEndOfStream()`, but it's not exactly the same: markEndOfStream() informs
40         that -- as far as network buffering is concerned -- we are done; but at that
41         point there may still be (and often are) many frames waiting in the
42         decodeQueue, so it would be wrong to signal the decoder that there are no more
43         frames.
44
45         This patch introduces a new optional method in SourceBufferPrivate,
46         `allSamplesInTrackEnqueued(const AtomicString& trackID)` that is called
47         whenever the MediaSource is in "ended" state (the user has called
48         `MediaSource.endOfStream()`) and the decodeQueue is empty. Media framework
49         implementations can use this method to send a EOS event to a decoder that needs
50         it.
51
52         Reviewed by Xabier Rodriguez-Calvar.
53
54         * Modules/mediasource/MediaSource.cpp:
55         (WebCore::MediaSource::streamEndedWithError):
56         * Modules/mediasource/SourceBuffer.cpp:
57         (WebCore::SourceBuffer::provideMediaData):
58         (WebCore::SourceBuffer::trySignalAllSamplesInTrackEnqueued):
59         (WebCore::SourceBuffer::trySignalAllSamplesEnqueued):
60         * Modules/mediasource/SourceBuffer.h:
61         * platform/graphics/SourceBufferPrivate.h:
62         (WebCore::SourceBufferPrivate::allSamplesInTrackEnqueued):
63         * platform/graphics/gstreamer/mse/MediaSourceClientGStreamerMSE.cpp:
64         (WebCore::MediaSourceClientGStreamerMSE::allSamplesInTrackEnqueued):
65         * platform/graphics/gstreamer/mse/MediaSourceClientGStreamerMSE.h:
66         * platform/graphics/gstreamer/mse/PlaybackPipeline.cpp:
67         (WebCore::PlaybackPipeline::allSamplesInTrackEnqueued):
68         * platform/graphics/gstreamer/mse/PlaybackPipeline.h:
69         * platform/graphics/gstreamer/mse/SourceBufferPrivateGStreamer.cpp:
70         (WebCore::SourceBufferPrivateGStreamer::allSamplesInTrackEnqueued):
71         * platform/graphics/gstreamer/mse/SourceBufferPrivateGStreamer.h:
72
73 2018-04-23  Ms2ger  <Ms2ger@igalia.com>
74
75         Avoid uninitialized memory read.
76         https://bugs.webkit.org/show_bug.cgi?id=184505
77         <rdar://problem/39348325>
78
79         Reviewed by Dean Jackson.
80
81         Test: imported/w3c/web-platform-tests/2dcontext/imagebitmap/createImageBitmap-bounds.html
82
83         * html/ImageBitmap.cpp:
84         (WebCore::croppedSourceRectangleWithFormatting):
85
86 2018-04-23  Zan Dobersek  <zdobersek@igalia.com>
87
88         [TexMap] Drop RefCounted inheritance off of TextureMapperBackingStore
89         https://bugs.webkit.org/show_bug.cgi?id=184810
90
91         Reviewed by Carlos Garcia Campos.
92
93         Turn TextureMapperBackingStore into a simple interface that doesn't
94         inherit from RefCounted<>. Instead, push that inheritance off to the
95         classes that implement the TextureMapperBackingStore interface. This
96         narrows down the purpose of TextureMapperBackingStore towards a simple
97         interface that TextureMapper algorithms can work with.
98
99         TextureMapperLayer has its m_backingStore member variable turn into
100         a simple pointer instead of a RefPtr<>. Setter method and call sites of
101         that method are updated to reflect that.
102
103         TextureMapperTiledBackingStore now inherits from RefCounted<> directly,
104         instead of through TextureMapperBackingStore.
105
106         * platform/graphics/texmap/GraphicsLayerTextureMapper.cpp:
107         (WebCore::GraphicsLayerTextureMapper::commitLayerChanges):
108         (WebCore::GraphicsLayerTextureMapper::updateBackingStoreIfNeeded):
109         * platform/graphics/texmap/GraphicsLayerTextureMapper.h:
110         * platform/graphics/texmap/TextureMapperBackingStore.h:
111         * platform/graphics/texmap/TextureMapperLayer.cpp:
112         (WebCore::TextureMapperLayer::setBackingStore):
113         * platform/graphics/texmap/TextureMapperLayer.h:
114         * platform/graphics/texmap/TextureMapperTiledBackingStore.h:
115
116 2018-04-22  Zan Dobersek  <zdobersek@igalia.com>
117
118         [AsyncScrolling] Add generic ScrollingThread implementation
119         https://bugs.webkit.org/show_bug.cgi?id=184809
120
121         Reviewed by Yusuke Suzuki.
122
123         Add a generic ScrollingThread implementation that internally uses
124         RunLoop facilities to run the scrolling thread and dispatch
125         callbacks on that thread.
126
127         ScrollingThread::initializeRunLoop() retrieves address of the
128         thread-specific RunLoop and signals the Condition object.
129         ScrollingThread::wakeUpRunLoop() uses RunLoop::dispatch() to schedule
130         callback dispatches on the scrolling thread.
131
132         ScrollingThread::createThreadIfNeeded() mimics Cocoa implementation and
133         waits for the RunLoop address to be retrieved before continuing.
134
135         * SourcesGTK.txt: Add to build.
136         * SourcesWPE.txt: Ditto.
137         * page/scrolling/ScrollingThread.cpp:
138         (WebCore::ScrollingThread::createThreadIfNeeded):
139         * page/scrolling/ScrollingThread.h:
140         * page/scrolling/generic/ScrollingThreadGeneric.cpp: Added.
141         (WebCore::ScrollingThread::initializeRunLoop):
142         (WebCore::ScrollingThread::wakeUpRunLoop):
143
144 2018-04-22  Zan Dobersek  <zdobersek@igalia.com>
145
146         [CoordinatedGraphics] Unused contentsSize, coveredRect attributes in CoordinatedGraphicsState
147         https://bugs.webkit.org/show_bug.cgi?id=184811
148
149         Reviewed by Carlos Garcia Campos.
150
151         Remove the unused contentsSize and coveredRect attributes on the
152         CoordinatedGraphicsState struct. CoordinatedGraphicsLayer::coverRect()
153         method is now unused and can also be removed.
154
155         * platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.h:
156         * platform/graphics/texmap/coordinated/CoordinatedGraphicsState.h:
157
158 2018-04-21  Daniel Bates  <dabates@apple.com>
159
160         Cleanup CookieRequestHeaderFieldProxy
161         https://bugs.webkit.org/show_bug.cgi?id=184868
162
163         Remove extraneous whitespace that I inadvertently added.
164
165         * platform/network/CookieRequestHeaderFieldProxy.h:
166         (WebCore::CookieRequestHeaderFieldProxy::decode):
167
168 2018-04-21  Daniel Bates  <dabates@apple.com>
169
170         Cleanup CookieRequestHeaderFieldProxy
171         https://bugs.webkit.org/show_bug.cgi?id=184868
172
173         Reviewed by Youenn Fablet.
174
175         Simplify the struct CookieRequestHeaderFieldProxy and make it consistent with other structs.
176         Among other changes, remove constructors for CookieRequestHeaderFieldProxy as they are
177         unnecessary as all supported compilers support non-static data member initializers (NSDMI)
178         for aggregates, remove prefix "m_" from the name of fields as this is struct exists for
179         convenience and offers no encapsulation and simplify decoding logic of this struct.
180
181         No functionality changed. So, no new tests.
182
183         * loader/CookieJar.cpp:
184         (WebCore::cookieRequestHeaderFieldProxy):
185         * platform/network/CookieRequestHeaderFieldProxy.h:
186         (WebCore::CookieRequestHeaderFieldProxy::encode const):
187         (WebCore::CookieRequestHeaderFieldProxy::decode):
188         (WebCore::CookieRequestHeaderFieldProxy::CookieRequestHeaderFieldProxy): Deleted.
189         * platform/network/SocketStreamHandleImpl.cpp:
190         (WebCore::cookieDataForHandshake):
191         * platform/network/cf/CookieJarCFNet.cpp:
192         (WebCore::cookieRequestHeaderFieldValue):
193         * platform/network/curl/CookieJarCurl.cpp:
194         (WebCore::cookieRequestHeaderFieldValue):
195         * platform/network/curl/CookieJarCurlDatabase.cpp:
196         (WebCore::CookieJarCurlDatabase::cookieRequestHeaderFieldValue const):
197         * platform/network/mac/CookieJarMac.mm:
198         (WebCore::cookieRequestHeaderFieldValue):
199         * platform/network/soup/CookieJarSoup.cpp:
200         (WebCore::cookieRequestHeaderFieldValue):
201
202 2018-04-21  Antoine Quint  <graouts@apple.com>
203
204         [Modern Media Controls] Show a loading indicator after pressing the play button in compact mode
205         https://bugs.webkit.org/show_bug.cgi?id=184863
206         <rdar://problem/38939468>
207
208         Reviewed by Dean Jackson.
209
210         We now display a loading indicator after pressing the play button when in compact mode. We also update the
211         behavior to use assets provided through WebKitAdditions (see webkit.org/b/184862) for the play button and
212         the invalid icon. Additionally, we always show a 20% opaque black overlay in the background while any piece
213         of user interface is up.
214
215         * Modules/modern-media-controls/controls/compact-activity-indicator.css: Added.
216         (button.compact-activity-indicator > picture): The loading indicator asset is a sprite made of 23 frames, so
217         we specify the mask size (since all buttons are rendered via a mask) to be 23 * 100% the rendered size. The
218         display of the loading indicator is performed with a first intro animation which runs once through the first
219         8 frames and then a continuously looping animation going through the remaining frames. We use a frames()
220         timing function to achieve the frame-by-frame effect while using only from/to keyframe animations. When we
221         fade out, we use a simply opacity fade, which is combined with the spinning animation. We use CSS variables
222         to encode both animations so they can be used combined or one at a time without redefining the whole animation
223         property.
224         (button.compact-activity-indicator.spins > picture): Use the "spins" animation variable when spinning.
225         (button.compact-activity-indicator.spins.fades-out > picture): Combine the "spins" and "fades-out" animation
226         variables when fading out.
227         (@keyframes compact-activity-indicator-intro): Animation going through the first 8 frames of the loading indicator.
228         (@keyframes compact-activity-indicator-loop): Animation going through the remaining frames of the loading indicator.
229         (@keyframes compact-activity-indicator-fades-out): Animation fading opacity from 1 to 0.
230         * Modules/modern-media-controls/controls/compact-activity-indicator.js: Added.
231         (CompactActivityIndicator):
232         (CompactActivityIndicator.prototype.show): Add the "spins" CSS class to show the control spinning with the intro animation.
233         (CompactActivityIndicator.prototype.hide): Add the "fades-out" CSS class to hide the control, removing both this class and
234         the "spins" class when the fade-out animation completes.
235         * Modules/modern-media-controls/controls/compact-media-controls.css: Added.
236         (.media-controls.compact:before): Add a 20% black overlay over the video frame to provide contrast for controls.
237         (.media-controls.compact button): Ensure buttons are sized to use the entire video frame so that their hit region
238         comprises the whole video frame.
239         (.media-controls.compact button > picture): Override default blending styles for a simple solid white mask.
240         (.media-controls.compact button:active > picture): Turn off the scale down effect when pressing a button.
241         * Modules/modern-media-controls/controls/compact-media-controls.js: Expose a "state" property for the compact media controls,
242         which can be exlusively one of three: "paused", "pending" and "invalid".
243         (CompactMediaControls.):
244         (CompactMediaControls.prototype.get state):
245         (CompactMediaControls.prototype.set state):
246         (CompactMediaControls.prototype.layout): In the "paused" state, show the play button. In the "pending" state show
247         the loading indicator. In the "invalid" state show the invalid button.
248         (CompactMediaControls.prototype.get placard): Deleted.
249         (CompactMediaControls.prototype.set placard): Deleted.
250         * Modules/modern-media-controls/js-files:
251         * Modules/modern-media-controls/media/compact-media-controls-support.js: Added.
252         (CompactMediaControlsSupport.prototype.get mediaEvents):
253         (CompactMediaControlsSupport.prototype.handleEvent): Make the controls enter the "paused" state when receiving a "pause"
254         event. Make the controls enter the "invalid" state when receiving an "error" event. 
255         (CompactMediaControlsSupport.prototype.enable):
256         (CompactMediaControlsSupport.prototype.disable):
257         (CompactMediaControlsSupport.prototype.buttonWasPressed): Play the media when pressing the play button and make the controls
258         enter the "pending" state. When pressing the loading indicator, pause the media and make the controls enter the "paused" state.
259         (CompactMediaControlsSupport.prototype._buttons):
260         (CompactMediaControlsSupport):
261         * Modules/modern-media-controls/media/media-controller.js:
262         (MediaController.prototype._supportingObjectClasses): Only use CompactMediaControlsSupport as a media controller supporting object
263         in the compact mode.
264         * Modules/modern-media-controls/media/placard-support.js:
265         (PlacardSupport.prototype.get mediaEvents): This media controller support object no longer needs to deal with compact mode.
266         * Modules/modern-media-controls/media/playback-support.js:
267         (PlaybackSupport.prototype.syncControl): This media controller support object no longer needs to deal with compact mode.
268         (PlaybackSupport):
269
270 2018-04-21  Antoine Quint  <graouts@apple.com>
271
272         [Modern Media Controls] Obtain compact mode icons through WebKitAdditions
273         https://bugs.webkit.org/show_bug.cgi?id=184862
274         <rdar://problem/39621645>
275
276         Reviewed by Jon Lee.
277
278         * Modules/modern-media-controls/controls/button.js:
279         (Button.prototype._updateImageMetrics): Handle PDF assets where the image source's intrinsic size needs
280         to be adjusted for the device pixel density.
281         (Button):
282         * Modules/modern-media-controls/controls/icon-service.js: Expect three additional icons provided through
283         WebKitAdditions, including two in the PDF format, so we add support for this format.
284         * WebCore.xcodeproj/project.pbxproj: Copy additional assets from the WebKitAdditions build directory should
285         any be present.
286
287 2018-04-21  Dean Jackson  <dino@apple.com>
288
289         Expose whether you've build with the Apple Internal SDK
290         https://bugs.webkit.org/show_bug.cgi?id=184864
291
292         Reviewed by Wenson Hsieh.
293
294         Internals API to let a test know if it is running with the
295         Apple internal SDK.
296
297         * testing/Internals.cpp:
298         (WebCore::usingAppleInternalSDK const):
299         * testing/Internals.h:
300         * testing/Internals.idl:
301
302 2018-04-20  Nan Wang  <n_wang@apple.com>
303
304         AX: AOM does not work with DOM Level 1 events
305         https://bugs.webkit.org/show_bug.cgi?id=184847
306
307         Reviewed by Chris Fleizach.
308
309         Added the accessibility events to the HTML attribute names.
310
311         Test cases are added to the existing layout tests.
312
313         * html/HTMLAttributeNames.in:
314         * html/HTMLElement.cpp:
315         (WebCore::HTMLElement::createEventHandlerNameMap):
316
317 2018-04-20  Carlos Garcia Campos  <cgarcia@igalia.com>
318
319         REGRESSION(r228088): [SOUP] Check TLS errors for WebSockets on GTlsConnection::accept-certificate
320         https://bugs.webkit.org/show_bug.cgi?id=184804
321
322         Reviewed by Michael Catanzaro.
323
324         * platform/network/soup/SocketStreamHandleImpl.h: Add a public url getter.
325         * platform/network/soup/SocketStreamHandleImplSoup.cpp:
326         (WebCore::acceptCertificateCallback): Call SoupNetworkSession::checkTLSErrors() to decide whether to accept the
327         certificate or not.
328         (WebCore::connectProgressCallback): Receive the SocketStreamHandle and pass it to acceptCertificateCallback callback.
329         (WebCore::socketClientEventCallback): Ditto.
330         (WebCore::SocketStreamHandleImpl::create): Always connect to network events.
331         (WebCore::wssConnectionAcceptCertificateCallback): Deleted.
332         (WebCore::wssSocketClientEventCallback): Deleted.
333
334 2018-04-20  Carlos Garcia Campos  <cgarcia@igalia.com>
335
336         [SOUP] Do TLS error checking on GTlsConnection::accept-certificate
337         https://bugs.webkit.org/show_bug.cgi?id=184480
338
339         Reviewed by Michael Catanzaro.
340
341         * platform/network/soup/ResourceError.h: Change tlsError to recieve a failing URL instead of a SoupRequest,
342         since the request was only used to get the failing URL.
343         * platform/network/soup/ResourceErrorSoup.cpp:
344         (WebCore::ResourceError::tlsError): Use the given failing URL.
345         * platform/network/soup/SoupNetworkSession.cpp:
346         (WebCore::SoupNetworkSession::SoupNetworkSession): Use ssl-strict when creating the SoupSession to handle the
347         certificates ourselves by connecting to GTlsConnection::accept-certificate.
348         (WebCore::SoupNetworkSession::checkTLSErrors): Updated to receive a URL, certificate and errors instead of
349         receiving a SoupRequest and SoupMessage and extract the url, certirficate and errors from them. Also return the
350         optional error directly instead of using a completion handler since the function is always synchronous.
351         * platform/network/soup/SoupNetworkSession.h:
352
353 2018-04-20  Tim Horton  <timothy_horton@apple.com>
354
355         Adjust geolocation feature flag
356         https://bugs.webkit.org/show_bug.cgi?id=184856
357
358         Reviewed by Wenson Hsieh.
359
360         * Configurations/FeatureDefines.xcconfig:
361
362 2018-04-20  Chris Dumez  <cdumez@apple.com>
363
364         Unreviewed attempt to fix Windows build after r230875.
365
366         * platform/network/cf/CookieJarCFNet.cpp:
367         (WebCore::cookieRequestHeaderFieldValue):
368         * platform/network/curl/CookieJarCurlDatabase.cpp:
369
370 2018-04-20  Chris Dumez  <cdumez@apple.com>
371
372         REGRESSION (r229828): web view doesn’t update or respond to resizing until client calls policy decision handler
373         https://bugs.webkit.org/show_bug.cgi?id=184210
374         <rdar://problem/39072354>
375
376         Reviewed by Wenson Hsieh.
377
378         r229828 tried to have some API tests happy on iOS by freezing the layer tree
379         during the navigation policy decision. However, this is observable by the client
380         application and a regression from when the policy delegate was synchronous.
381
382         To address the issue, this patch reverts r229828 and instead updates the iOS
383         API tests to wait for the next presentation update after navigating
384         before interacting with the view.
385
386         * loader/FrameLoaderClient.h:
387         * loader/PolicyChecker.cpp:
388         (WebCore::PolicyChecker::checkNavigationPolicy):
389
390 2018-04-20  Brent Fulgham  <bfulgham@apple.com>
391
392         Limit cookie header access to Network process
393         https://bugs.webkit.org/show_bug.cgi?id=184764
394         <rdar://problem/36785285>
395
396         Reviewed by Youenn Fablet.
397
398         Revise the handling of cookie request headers so that we don't interact with them in the
399         WebContent process. They are only needed for interaction with the server and the network
400         process, so we should limit their scope to just the Network process.
401
402         Instead, we should handle a token that represents the cookie headers in the WebContent
403         process, which can be converted to the relevant cookie data in the network process when
404         needed.
405
406         * Modules/websockets/WebSocketChannel.cpp:
407         (WebCore::WebSocketChannel::didOpenSocketStream):
408         * Modules/websockets/WebSocketHandshake.cpp:
409         (WebCore::WebSocketHandshake::clientHandshakeMessage const):
410         (WebCore::WebSocketHandshake::clientHandshakeRequest const):
411         (WebCore::WebSocketHandshake::clientHandshakeCookieRequestHeaderFieldProxy const):
412         (WebCore::WebSocketHandshake::clientHandshakeMessage): Deleted.
413         (WebCore::WebSocketHandshake::clientHandshakeRequest): Deleted.
414         * Modules/websockets/WebSocketHandshake.h:
415         * WebCore.xcodeproj/project.pbxproj:
416         * loader/CookieJar.cpp:
417         (WebCore::cookieRequestHeaderFieldProxy):
418         * loader/CookieJar.h:
419         * platform/network/CookieRequestHeaderFieldProxy.h: Added.
420         (WebCore::CookieRequestHeaderFieldProxy::CookieRequestHeaderFieldProxy):
421         (WebCore::CookieRequestHeaderFieldProxy::isolatedCopy const):
422         (WebCore::CookieRequestHeaderFieldProxy::encode const):
423         (WebCore::CookieRequestHeaderFieldProxy::decode):
424         * platform/network/PlatformCookieJar.h:
425         * platform/network/SocketStreamHandle.cpp:
426         (WebCore::SocketStreamHandle::sendHandshake):
427         * platform/network/SocketStreamHandle.h:
428         * platform/network/SocketStreamHandleImpl.cpp:
429         (WebCore::SocketStreamHandleImpl::platformSendHandshake):
430         * platform/network/cf/SocketStreamHandleImpl.h:
431         * platform/network/curl/CookieJarCurl.cpp:
432         (WebCore::cookieRequestHeaderFieldValue):
433         * platform/network/curl/CookieJarCurl.h:
434         * platform/network/curl/SocketStreamHandleImpl.h:
435         * platform/network/mac/CookieJarMac.mm:
436         (WebCore::cookieRequestHeaderFieldValue):
437         * platform/network/soup/CookieJarSoup.cpp:
438         (WebCore::cookieRequestHeaderFieldValue):
439         * platform/network/soup/SocketStreamHandleImpl.h:
440
441 2018-04-20  Daniel Bates  <dabates@apple.com>
442
443         Hide Strong Password label when text field is too narrow
444         https://bugs.webkit.org/show_bug.cgi?id=184785
445         <rdar://problem/38183939>
446
447         Reviewed by Zalan Bujtas.
448
449         We accomplish this illusion by allowing the text field's decorations to wrap, specifying flex
450         shrink factors, a flex basis and hiding overflow. Hiding overflow is accomplished by a
451         combination of setting "overflow: hidden", "text-overflow: clip", and patching RenderTextControlSingleLine::layout()
452         to ensure that the height of the container element is equal to the intrinsic height of the
453         inner elements. Because the container is a flex box and we want to vertically center its
454         contents we also need to fix up the y-position of the container element as it may have flexed
455         as a result of forcing its height to match the intrinsic height of the inner elements.
456
457         * css/html.css:
458         (input::-webkit-strong-password-auto-fill-button): Specify a flex-shrink factor and prevent
459         wrapping of the "Strong Password" text when flexed.
460         * html/shadow/TextControlInnerElements.cpp:
461         (WebCore::TextControlInnerContainer::TextControlInnerContainer): Register for a custom style
462         resolution callback so that we can style the container if it is a Strong Password or Strong
463         Confirmation Password text field. Ideally we could accomplish this effect with a user agent-
464         specific pseudo class together with a selector definition in the user agent style sheet,
465         html.css. Unfortunately the style resolver does not seem to apply pseudo classes to
466         shadow DOM pseudo elements (why?). Therefore we use a custom style resolution callback to
467         achieve the same effect.
468         (WebCore::isStrongPasswordTextField): Returns whether the specified DOM element is a Strong
469         Password text field.
470         (WebCore::TextControlInnerContainer::resolveCustomStyle): Conditionally apply CSS properties
471         "flex-wrap: wrap" and overflow: hidden" if the shadow host of this container is a Strong
472         Password text field.
473         (WebCore::TextControlInnerElement::resolveCustomStyle): Conditionally style the inner text
474         if the shadow host of this container is a Strong Password text field. We need to apply these
475         styles here as opposed to in html.css for the same reason we need to apply the styles to
476         the container in a custom style resolution callback. See the comments for TextControlInnerContainer()
477         above for more details
478         * html/shadow/TextControlInnerElements.h:
479         * rendering/RenderTextControlSingleLine.cpp:
480         (WebCore::resetOverriddenHeight): Added. Incorporates the logic from setNeedsLayoutOnAncestors().
481         (WebCore::RenderTextControlSingleLine::layout): Override the height of the container element to
482         match the height of the inner elements when this text field is a Strong Password field. We cache
483         the container's logical top before adjusting its height so that we can restore it after performing
484         a second layout of this renderer. This is needed because we vertically center the elements in this
485         renderer and adjusting the height of the container may cause it to flex and re-position along its
486         cross axis when the container's height is taller than the inner element's height (e.g. the "Strong
487         Password" label wraps to the next line). This re-positioning causes a noticeable jitter when
488         transitioning from a field that has a visible "Strong Password" label to one that does not. Caching
489         and restoring the logical top of the container element avoids this jitter.
490         (WebCore::setNeedsLayoutOnAncestors): Deleted. Moved its implementation into resetOverriddenHeight().
491
492 2018-04-20  Dean Jackson  <dino@apple.com>
493
494         Render a badge on system preview images
495         https://bugs.webkit.org/show_bug.cgi?id=184854
496         <rdar://problem/39615154>
497
498         Reviewed by Tim Horton.
499
500         At paint time, if a RenderImage is an image element
501         which is identified as a system preview, then draw
502         a little badge in the top right corner.
503
504         It is expected that platforms will override the
505         default rendering with something that identifies
506         how a system preview will operate. e.g. QuickLook
507         on Apple systems.
508
509         Test: system-preview/badge.html
510
511         * rendering/RenderImage.cpp:
512         (WebCore::RenderImage::paintIntoRect): If we are
513         a system preview, call RenderTheme to draw a badge.
514         * rendering/RenderTheme.cpp:
515         (WebCore::RenderTheme::paintSystemPreviewBadge): A default
516         implementation that draws a red circle.
517         * rendering/RenderTheme.h:
518
519 2018-04-20  Brian Burg  <bburg@apple.com>
520
521         Web Inspector: remove some dead code in IdentifiersFactory
522         https://bugs.webkit.org/show_bug.cgi?id=184839
523
524         Reviewed by Timothy Hatcher.
525
526         * inspector/InspectorController.cpp:
527         (WebCore::InspectorController::setProcessId): Deleted.
528         * inspector/InspectorController.h:
529
530 2018-04-20  Chris Dumez  <cdumez@apple.com>
531
532         Use WindowProxy in DOMWindow.idl
533         https://bugs.webkit.org/show_bug.cgi?id=184820
534
535         Reviewed by Sam Weinig.
536
537         Use WindowProxy in DOMWindow.idl to match the specification more closely.
538
539         * bindings/js/JSWindowProxy.h:
540         * bindings/js/WindowProxy.cpp:
541         (WebCore::WindowProxy::window const):
542         * bindings/js/WindowProxy.h:
543         * bindings/scripts/CodeGeneratorJS.pm:
544         (NativeToJSValueDOMConvertNeedsState):
545         * dom/Document.cpp:
546         * dom/Document.h:
547         * dom/Document.idl:
548         * page/DOMWindow.cpp:
549         (WebCore::DOMWindow::focus):
550         (WebCore::DOMWindow::self const):
551         (WebCore::DOMWindow::opener const):
552         (WebCore::DOMWindow::parent const):
553         (WebCore::DOMWindow::top const):
554         (WebCore::DOMWindow::open):
555         * page/DOMWindow.h:
556         * page/DOMWindow.idl:
557         * testing/Internals.cpp:
558         (WebCore::Internals::openDummyInspectorFrontend):
559         * testing/Internals.h:
560         * testing/Internals.idl:
561
562 2018-04-20  Chris Dumez  <cdumez@apple.com>
563
564         Update cross-origin SecurityError messages to not include the target origin
565         https://bugs.webkit.org/show_bug.cgi?id=184803
566         <rdar://problem/39547724>
567
568         Reviewed by Sam Weinig.
569
570         No new tests, rebaselined existing tests.
571
572         * bindings/js/JSDOMBindingSecurity.cpp:
573         (WebCore::canAccessDocument):
574         (WebCore::BindingSecurity::shouldAllowAccessToFrame):
575         (WebCore::BindingSecurity::shouldAllowAccessToDOMWindow):
576         * page/DOMWindow.cpp:
577         (WebCore::DOMWindow::crossDomainAccessErrorMessage):
578         (WebCore::DOMWindow::isInsecureScriptAccess):
579         * page/DOMWindow.h:
580         * page/Location.cpp:
581         (WebCore::Location::reload):
582
583 2018-04-20  Chris Nardi  <cnardi@chromium.org>
584
585         Update HSL/HSLA parsing to match CSS Color 4
586         https://bugs.webkit.org/show_bug.cgi?id=180528
587         <rdar://problem/35926675>
588
589         CSS Color 4 specifies a comma optional syntax for HSL/HSLA, as well as allowing angle values for the
590         hue and percent alpha values. Update our parsing to match this.
591
592         Reviewed by Simon Fraser.
593
594         This change also updates the import of WPT css-color to test the changes.
595
596         Tests: LayoutTests/imported/w3c/web-platform-tests/css/css-color/hsl{a}-{001-008}.html
597
598         * css/parser/CSSPropertyParserHelpers.cpp:
599         (WebCore::CSSPropertyParserHelpers::parseHSLParameters):
600         (WebCore::CSSPropertyParserHelpers::parseColorFunction):
601         (WebCore::CSSPropertyParserHelpers::consumeColor):
602         * platform/graphics/Color.cpp:
603         (WebCore::calcHue):
604         (WebCore::makeRGBAFromHSLA):
605
606 2018-04-20  Wenson Hsieh  <wenson_hsieh@apple.com>
607
608         [Extra zoom mode] Injected bundle form client should be notified when editing text fields
609         https://bugs.webkit.org/show_bug.cgi?id=184822
610         <rdar://problem/38807319>
611
612         Reviewed by Tim Horton.
613
614         Export the constructor and destructor of UserTypingGestureIndicator for use in WebKit (see WebPage.cpp).
615
616         Test: fast/forms/extrazoom/edit-text-field-calls-injected-bundle.html
617
618         * dom/UserTypingGestureIndicator.h:
619
620 2018-04-18  Jer Noble  <jer.noble@apple.com>
621
622         Don't put build products into WK_ALTERNATE_WEBKIT_SDK_PATH for engineering builds
623         https://bugs.webkit.org/show_bug.cgi?id=184762
624
625         Reviewed by Dan Bernstein.
626
627         * Configurations/WebCore.xcconfig:
628         * WebCore.xcodeproj/project.pbxproj:
629
630 2018-04-20  Daniel Bates  <dabates@apple.com>
631
632         Remove code for compilers that did not support NSDMI for aggregates
633         https://bugs.webkit.org/show_bug.cgi?id=184599
634
635         Reviewed by Per Arne Vollan.
636
637         Remove workaround for earlier Visual Studio versions that did not support non-static data
638         member initializers (NSDMI) for aggregates. We have since updated all the build.webkit.org
639         and EWS bots to a newer version that supports this feature.
640
641         * Modules/cache/CacheQueryOptions.h:
642         (WebCore::CacheQueryOptions::CacheQueryOptions): Deleted.
643         * dom/Node.h:
644         (WebCore::Node::InsertionType::InsertionType): Deleted.
645         (WebCore::Node::RemovalType::RemovalType): Deleted.
646         * html/canvas/CanvasStyle.h:
647         (WebCore::CanvasStyle::CMYKAColor::CMYKAColor): Deleted.
648         * page/EventHandler.h:
649         (WebCore::EventHandler::DragTargetResponse::DragTargetResponse): Deleted.
650         * page/animation/CSSAnimationController.h:
651         (WebCore::AnimationUpdate::AnimationUpdate): Deleted.
652         * platform/graphics/FontSelectionAlgorithm.h:
653         (WebCore::FontSelectionRequest::tied const):
654         (WebCore::FontSelectionRequest::FontSelectionRequest): Deleted.
655         (WebCore::FontSelectionCapabilities::FontSelectionCapabilities): Deleted.
656         * platform/mediastream/IceCandidate.h:
657         (WebCore::IceCandidate::IceCandidate): Deleted.
658         * platform/text/StringWithDirection.h:
659         (WebCore::StringWithDirection::StringWithDirection): Deleted.
660         * rendering/MarkedText.h:
661         (WebCore::MarkedText::MarkedText): Deleted.
662         * style/StyleUpdate.h:
663         (WebCore::Style::ElementUpdate::ElementUpdate): Deleted.
664         (WebCore::Style::ElementUpdates::ElementUpdates): Deleted.
665         (WebCore::Style::TextUpdate::TextUpdate): Deleted.
666
667 2018-04-20  Youenn Fablet  <youenn@apple.com>
668
669         WebPage sometimes incorrectly rules out PDF as a mime type that can be showed
670         https://bugs.webkit.org/show_bug.cgi?id=184369
671
672         Reviewed by Chris Dumez.
673
674         WebPage does need to check for plugins at reception of the response.
675         In that case, the page URL is the URL from which we are navigating out.
676         Add plugin API to check for plugin availability with an extra URL parameter to cover that case.
677
678         Covered by API test.
679
680         * plugins/PluginData.cpp:
681         (WebCore::PluginData::supportsWebVisibleMimeTypeForURL const):
682         (WebCore::PluginData::supportsWebVisibleMimeType const):
683         * plugins/PluginData.h:
684
685 2018-04-20  Daniel Bates  <dabates@apple.com>
686
687         Remove Strong Password decoration when text field type changes
688         https://bugs.webkit.org/show_bug.cgi?id=184795
689         <rdar://problem/38325108>
690
691         Reviewed by Antti Koivisto.
692
693         Remove the Strong Password decoration when the text field's type changes to avoid interfering
694         with web sites that allow a person to show/hide their password.
695
696         Test: fast/forms/auto-fill-button/hide-strong-password-when-field-type-changes.html
697
698         * html/HTMLInputElement.cpp:
699         (WebCore::HTMLInputElement::updateType):
700
701 2018-04-20  Javier Fernandez  <jfernandez@igalia.com>
702
703         Update Alignment shorthands to the spec now that they are not ambiguous
704         https://bugs.webkit.org/show_bug.cgi?id=184812
705
706         Reviewed by Antti Koivisto.
707
708         Now that the issue [1] about the syntax ambiguity has been resolved we
709         don't need to use the custom syntax anymore. The Alignment shorthands
710         use now the simple syntax, defined based on the longhands' syntax.
711
712         Since we allow all the values valid for each longhand, we'll update
713         in this CL the corresponding web platform tests. Additionally, this CL
714         updates also the shorthand serialization tests [2], which didn't
715         consider the new value 'legacy' for justify-items (and place-items) due
716         to the bug [3] Firefox still has pending to be fixed.
717
718         [1] https://github.com/w3c/csswg-drafts/issues/1001
719         [2] css/css-align/default-alignment/shorthand-serialization-001.html
720         [3] https://bugzilla.mozilla.org/show_bug.cgi?id=1363875
721
722         Tests: imported/w3c/web-platform-tests/css/css-align/default-alignment/shorthand-serialization-001.html
723                imported/w3c/web-platform-tests/css/css-align/gaps/gap-normal-computed-001.html
724                imported/w3c/web-platform-tests/css/css-align/gaps/gap-normal-used-001.html
725                imported/w3c/web-platform-tests/css/css-align/gaps/gap-normal-used-002.html
726
727         * css/parser/CSSPropertyParser.cpp:
728         (WebCore::CSSPropertyParser::consumePlaceContentShorthand): Using the justify-content and align-content parsing logic to parse the shorthand.
729         (WebCore::CSSPropertyParser::consumePlaceItemsShorthand): Using the justify-items and align-items parsing logic to parse the shorthand.
730         (WebCore::CSSPropertyParser::consumePlaceSelfShorthand): Using the justify-self and align-self parsing logic to parse the shorthand.
731
732 2018-04-20  Daniel Bates  <dabates@apple.com>
733
734         Unreviewed, rolling out r230117.
735
736         Broke find-in-page for PDFs
737
738         Reverted changeset:
739
740         "ASSERTION FAILED: ASSERT(!containsImage ||
741         MIMETypeRegistry::isSupportedImageResourceMIMEType([resource
742         MIMEType])) in -[NSPasteboard(WebExtras)
743         _web_writePromisedRTFDFromArchive:containsImage:]"
744         https://bugs.webkit.org/show_bug.cgi?id=184161
745         https://trac.webkit.org/changeset/230117
746
747 2018-04-20  Eric Carlson  <eric.carlson@apple.com>
748
749         Pausing should clear m_waitingToEnterFullscreen
750         https://bugs.webkit.org/show_bug.cgi?id=184831
751         <rdar://problem/39602852>
752
753         Reviewed by Jer Noble.
754
755         * html/HTMLMediaElement.cpp:
756         (WebCore::HTMLMediaElement::pause): Clear m_waitingToEnterFullscreen
757
758 2018-04-20  Eric Carlson  <eric.carlson@apple.com>
759
760         [Extra zoom mode] Disable CA transactions while setting up for fullscreen
761         https://bugs.webkit.org/show_bug.cgi?id=184817
762         <rdar://problem/39596075>
763
764         Reviewed by Jer Noble.
765
766         This was tested manually as it is not possible to write an automated test for this.
767
768         * platform/ios/VideoFullscreenInterfaceAVKit.mm:
769         (VideoFullscreenInterfaceAVKit::doSetup): Move the call to disable CA transactions outside
770         of the EXTRA_ZOOM_MODE check, the [CATransaction commit] was already unguarded.
771
772 2018-04-20  Youenn Fablet  <youenn@apple.com>
773
774         Make PluginData cache its web visible plugins
775         https://bugs.webkit.org/show_bug.cgi?id=184421
776
777         Reviewed by Chris Dumez.
778
779         Buffer visible plugins until the page URL changes.
780         For that purpose, we now cache the visible plugins and the URL it was computed from in PluginData.
781
782         Update plugin info provider API to pass the URL used to check for plugin visibility.
783
784         No observable change of behavior.
785
786         * loader/EmptyClients.cpp:
787         * plugins/PluginData.cpp:
788         (WebCore::PluginData::webVisiblePlugins const):
789         (WebCore::PluginData::publiclyVisiblePlugins const):
790         (WebCore::PluginData::supportsMimeType const):
791         * plugins/PluginData.h:
792         * plugins/PluginInfoProvider.h:
793
794 2018-04-20  Chris Dumez  <cdumez@apple.com>
795
796         Unreviewed build fix after r230840.
797
798         * bindings/js/JSWindowProxy.cpp:
799         (WebCore::JSWindowProxy::attachDebugger):
800
801 2018-04-20  Chris Dumez  <cdumez@apple.com>
802
803         Unreviewed attempt to fix the Windows build after r230831.
804
805         * bindings/js/JSWindowProxy.cpp:
806         (WebCore::JSWindowProxy::create):
807         (WebCore::JSWindowProxy::attachDebugger):
808
809 2018-04-20  Chris Nardi  <cnardi@chromium.org>
810
811         Omit default value when serializing font-feature-settings
812         https://bugs.webkit.org/show_bug.cgi?id=182382
813
814         Reviewed by Myles C. Maxfield.
815
816         According to the shortest-serialization principle [1], values should be omitted if their omission
817         wouldn't change the value of reparsing. As "1"/"on" is the default value for font-feature-settings,
818         omit this when serializing, matching the behavior of Firefox and Chrome.
819
820         [1]: https://github.com/w3c/csswg-drafts/issues/1564
821
822         Updated css3/font-feature-settings-parsing.html, fast/css/inherited-properties-rare-text.html,
823         and fast/text/font-face-javascript.html.
824
825         * css/CSSFontFeatureValue.cpp:
826         (WebCore::CSSFontFeatureValue::customCSSText const):
827
828 2018-04-19  Alexey Proskuryakov  <ap@apple.com>
829
830         More WK_ALTERNATE_FRAMEWORKS_DIR adoption in WebCore
831         https://bugs.webkit.org/show_bug.cgi?id=184805
832
833         Reviewed by Dan Bernstein.
834
835         * Configurations/WebCoreTestShim.xcconfig:
836         * Configurations/WebCoreTestSupport.xcconfig:
837
838 2018-04-19  Brady Eidson  <beidson@apple.com>
839
840         Make back forward cache work with process swapping.
841         <rdar://problem/38676604> and https://bugs.webkit.org/show_bug.cgi?id=184793
842
843         Reviewed by Chris Dumez.
844
845         Covered by API tests.
846
847         * loader/FrameLoader.cpp:
848         (WebCore::FrameLoader::loadWithNavigationAction):
849         (WebCore::FrameLoader::load):
850         (WebCore::FrameLoader::loadWithDocumentLoader):
851         (WebCore::FrameLoader::reloadWithOverrideEncoding):
852         (WebCore::FrameLoader::reload):
853         (WebCore::FrameLoader::commitProvisionalLoad):
854         (WebCore::FrameLoader::loadDifferentDocumentItem):
855         * loader/FrameLoader.h:
856
857 2018-04-19  Chris Dumez  <cdumez@apple.com>
858
859         Rename JSDOMWindowProxy to JSWindowProxy
860         https://bugs.webkit.org/show_bug.cgi?id=184797
861
862         Reviewed by Sam Weinig.
863
864         Rename JSDOMWindowProxy to JSWindowProxy for consistency with WindowProxy.
865
866         * Sources.txt:
867         * WebCore.xcodeproj/project.pbxproj:
868         * bindings/IDLTypes.h:
869         * bindings/js/JSBindingsAllInOne.cpp:
870         * bindings/js/JSDOMConvertWindowProxy.h:
871         * bindings/js/JSDOMWindowBase.cpp:
872         (WebCore::JSDOMWindowBase::JSDOMWindowBase):
873         (WebCore::JSDOMWindowBase::finishCreation):
874         (WebCore::JSDOMWindowBase::proxy const):
875         (WebCore::toJSDOMWindow):
876         * bindings/js/JSDOMWindowBase.h:
877         * bindings/js/JSDOMWindowCustom.cpp:
878         (WebCore::JSDOMWindow::toWrapped):
879         * bindings/js/JSEventTargetCustom.cpp:
880         (WebCore::JSEventTarget::toWrapped):
881         * bindings/js/JSRemoteDOMWindowBase.cpp:
882         (WebCore::JSRemoteDOMWindowBase::JSRemoteDOMWindowBase):
883         (WebCore::toJSRemoteDOMWindow):
884         * bindings/js/JSRemoteDOMWindowBase.h:
885         * bindings/js/JSWindowProxy.cpp: Renamed from Source/WebCore/bindings/js/JSDOMWindowProxy.cpp.
886         (WebCore::JSWindowProxy::JSWindowProxy):
887         (WebCore::JSWindowProxy::finishCreation):
888         (WebCore::JSWindowProxy::create):
889         (WebCore::JSWindowProxy::destroy):
890         (WebCore::JSWindowProxy::setWindow):
891         (WebCore::JSWindowProxy::attachDebugger):
892         (WebCore::JSWindowProxy::wrapped const):
893         (WebCore::JSWindowProxy::toWrapped):
894         (WebCore::toJS):
895         (WebCore::toJSWindowProxy):
896         * bindings/js/JSWindowProxy.h: Renamed from Source/WebCore/bindings/js/JSDOMWindowProxy.h.
897         (WebCore::toJS):
898         (WebCore::toJSWindowProxy):
899         * bindings/js/ScriptController.cpp:
900         (WebCore::ScriptController::initScriptForWindowProxy):
901         * bindings/js/ScriptController.h:
902         * bindings/js/WindowProxy.cpp:
903         (WebCore::WindowProxy::createJSWindowProxy):
904         (WebCore::WindowProxy::jsWindowProxiesAsVector const):
905         (WebCore::WindowProxy::createJSWindowProxyWithInitializedScript):
906         * bindings/js/WindowProxy.h:
907         (WebCore::WindowProxy::jsWindowProxy):
908         (WebCore::WindowProxy::existingJSWindowProxy const):
909         * bindings/scripts/CodeGeneratorJS.pm:
910         (AddToIncludesForIDLType):
911         (GenerateHeader):
912         (GenerateOverloadDispatcher):
913         (GenerateImplementation):
914         * bindings/scripts/test/JS/JSTestObj.cpp:
915         (WebCore::jsTestObjPrototypeFunctionOverloadedMethodOverloadDispatcher):
916         * page/Frame.cpp:
917         * page/csp/ContentSecurityPolicy.cpp:
918         (WebCore::ContentSecurityPolicy::didCreateWindowProxy const):
919         * page/csp/ContentSecurityPolicy.h:
920
921 2018-04-19  Dirk Schulze  <krit@webbkit.org>
922
923         Introduce SVGGeometryElement interface
924         https://bugs.webkit.org/show_bug.cgi?id=184768
925
926         Reviewed by Antti Koivisto.
927
928         Start implementing SVGGeometryElement interface from SVG2.
929         https://svgwg.org/svg2-draft/types.html#InterfaceSVGGeometryElement
930
931         Start with SVGPathElement only for now. Also, just inferface gets implemented
932         by this patch. No new functionality like isPointInFill yet.
933         Fix getPointAtLength and make it more restrictive. This follows the spec and
934         all other implementations.
935
936         Added additional test scenarios to existing tests.
937
938         * CMakeLists.txt:
939         * DerivedSources.make:
940         * Sources.txt:
941         * WebCore.xcodeproj/project.pbxproj:
942         * bindings/scripts/CodeGeneratorJS.pm:
943         (GetGnuVTableOffsetForType):
944         * svg/SVGAllInOne.cpp:
945         * svg/SVGGeometryElement.cpp: Added.
946         (WebCore::SVGGeometryElement::SVGGeometryElement):
947         (WebCore::SVGGeometryElement::isSupportedAttribute):
948         (WebCore::SVGGeometryElement::parseAttribute):
949         (WebCore::SVGGeometryElement::svgAttributeChanged):
950         (WebCore::SVGGeometryElement::createElementRenderer):
951         * svg/SVGGeometryElement.h: Added.
952         * svg/SVGGeometryElement.idl: Added.
953         * svg/SVGGradientElement.cpp:
954         * svg/SVGPathElement.cpp:
955         (WebCore::SVGPathElement::SVGPathElement):
956         (WebCore::SVGPathElement::parseAttribute):
957         (WebCore::SVGPathElement::svgAttributeChanged):
958         (WebCore::SVGPathElement::insertedIntoAncestor):
959         (WebCore::SVGPathElement::removedFromAncestor):
960         * svg/SVGPathElement.h:
961         * svg/SVGPathElement.idl:
962
963 2018-04-19  Tadeu Zagallo  <tzagallo@apple.com>
964
965         REGRESSION(r227340): ArrayBuffers were not being serialized when sent via MessagePorts
966         https://bugs.webkit.org/show_bug.cgi?id=184254
967         <rdar://problem/39140200>
968
969         Reviewed by Daniel Bates.
970
971         Add a new encoding method to SerializedScriptValue that includes ArrayBuffers.
972
973         Test: workers/message-port.html
974
975         * bindings/js/SerializedScriptValue.h:
976         (WebCore::SerializedScriptValue::encode const):
977         (WebCore::SerializedScriptValue::decode):
978         * dom/messageports/MessageWithMessagePorts.h:
979         (WebCore::MessageWithMessagePorts::encode const):
980         (WebCore::MessageWithMessagePorts::decode):
981
982 2018-04-19  David Kilzer  <ddkilzer@apple.com>
983
984         Enable Objective-C weak references
985         <https://webkit.org/b/184789>
986         <rdar://problem/39571716>
987
988         Reviewed by Dan Bernstein.
989
990         * Configurations/Base.xcconfig:
991         (CLANG_ENABLE_OBJC_WEAK): Enable.
992
993 2018-04-19  Antti Koivisto  <antti@apple.com>
994
995         Don't use RenderTreeBuilder::current() in RenderTreeUpdater
996         https://bugs.webkit.org/show_bug.cgi?id=184794
997
998         Reviewed by Zalan Bujtas.
999
1000         Pass the builder as a parameter where needed.
1001
1002         * rendering/updating/RenderTreeUpdater.cpp:
1003         (WebCore::RenderTreeUpdater::updateElementRenderer):
1004         (WebCore::RenderTreeUpdater::updateTextRenderer):
1005         (WebCore::RenderTreeUpdater::tearDownRenderers):
1006         (WebCore::RenderTreeUpdater::tearDownRenderer):
1007         (WebCore::RenderTreeUpdater::tearDownTextRenderer):
1008         (WebCore::RenderTreeUpdater::tearDownLeftoverPaginationRenderersIfNeeded):
1009         (WebCore::RenderTreeUpdater::tearDownLeftoverShadowHostChildren):
1010         * rendering/updating/RenderTreeUpdater.h:
1011         * rendering/updating/RenderTreeUpdaterGeneratedContent.cpp:
1012         (WebCore::RenderTreeUpdater::GeneratedContent::updatePseudoElement):
1013         (WebCore::RenderTreeUpdater::GeneratedContent::removeBeforePseudoElement):
1014         (WebCore::RenderTreeUpdater::GeneratedContent::removeAfterPseudoElement):
1015         * rendering/updating/RenderTreeUpdaterGeneratedContent.h:
1016
1017 2018-04-19  Eric Carlson  <eric.carlson@apple.com>
1018
1019         Runtime logging during GC can cause crash
1020         https://bugs.webkit.org/show_bug.cgi?id=184792
1021         <rdar://problem/39567927>
1022
1023         Reviewed by Jer Noble.
1024
1025         Test: media/destructor-logging-crash.html
1026
1027         * dom/Document.cpp:
1028         (WebCore::Document::~Document): Clear the logger observer immediately so anything logged
1029         as a side effect of the destructor won't cause a problem.
1030         (WebCore::Document::didLogMessage): Create the ConsoleMessage in a task.
1031         * dom/Document.h:
1032
1033 2018-04-19  Youenn Fablet  <youenn@apple.com>
1034
1035         Web Inspector backend should get headers & cookies from network process separately from resource requests
1036         https://bugs.webkit.org/show_bug.cgi?id=184396
1037         <rdar://problem/38877384>
1038
1039         Reviewed by Brian Burg.
1040
1041         Add two new loader strategies to get response and network metrics directly from
1042         NetworkProcess based on resource loader identifier.
1043         Use these methods in InspectorNetworkAgent when response/metrics might be filtered.
1044
1045         Covered by existing tests, in particular http/tests/inspector/network/fetch-network-data.html which would fail
1046         without this since we are now setting the sourceOrigin for NetworkResourceLoader, which is used to sanitize response headers.
1047
1048         * inspector/agents/InspectorNetworkAgent.cpp:
1049         (WebCore::InspectorNetworkAgent::didReceiveResponse):
1050         (WebCore::InspectorNetworkAgent::didFinishLoading):
1051         * loader/LoaderStrategy.cpp:
1052         (WebCore::LoaderStrategy::responseFromResourceLoaIdentifier):
1053         (WebCore::LoaderStrategy::networkMetricsFromResourceLoaIdentifier):
1054         * loader/LoaderStrategy.h:
1055
1056 2018-04-19  Wenson Hsieh  <wenson_hsieh@apple.com>
1057
1058         [Extra zoom mode] Add a mechanism to extend the height of the layout viewport in extra zoom mode
1059         https://bugs.webkit.org/show_bug.cgi?id=184782
1060         <rdar://problem/38346712>
1061
1062         Reviewed by Tim Horton.
1063
1064         Add a new helper on FrameView to compute an expanded layout viewport size, as well as a new setting for the
1065         height expansion factor when computing visual viewport dimensions. See WebKit/ChangeLog for more detail.
1066
1067         Test: fast/visual-viewport/extrazoom/layout-viewport-after-scrolling-and-resizing.html
1068
1069         * page/FrameView.cpp:
1070         (WebCore::FrameView::expandedLayoutViewportSize):
1071         * page/FrameView.h:
1072         * page/Settings.yaml:
1073
1074 2018-04-19  Chris Dumez  <cdumez@apple.com>
1075
1076         REGRESSION (r229133): decidePolicyForNavigationAction not called for loading an HTML string
1077         https://bugs.webkit.org/show_bug.cgi?id=184209
1078         <rdar://problem/39145306>
1079
1080         Reviewed by Ryosuke Niwa.
1081
1082         In r229133, we stopped doing navigation policy checks for about:blank because about:blank
1083         loads need to happen synchronously for Web-compatibility. However, this regressed loading
1084         an HTML string in a WebView because in such cases, the URL is also about:blank with
1085         substitute data.
1086
1087         In this patch, we take a more conservative approach and restore policy checking for
1088         'about:blank' but using synchronous IPC.
1089
1090         * loader/PolicyChecker.cpp:
1091         (WebCore::PolicyChecker::checkNavigationPolicy):
1092
1093 2018-04-19  Chris Nardi  <cnardi@chromium.org>
1094
1095         Support calc() in webkit-gradient and cross-fade
1096         https://bugs.webkit.org/show_bug.cgi?id=182225
1097
1098         Reviewed by Simon Fraser.
1099
1100         calc() was previously unsupported in webkit-gradient and webkit-cross-fade, but both should take calc() values.
1101         Update the code to support calc() values.
1102
1103         Tests: LayoutTests/css3/calc/cross-fade-calc.html
1104                LayoutTests/css3/calc/webkit-gradient-calc.html
1105
1106         * css/parser/CSSPropertyParserHelpers.cpp:
1107         (WebCore::CSSPropertyParserHelpers::consumeDeprecatedGradientColorStop):
1108         (WebCore::CSSPropertyParserHelpers::consumeCrossFade):
1109
1110 2018-04-17  Filip Pizlo  <fpizlo@apple.com>
1111
1112         The InternalFunction hierarchy should be in IsoSubspaces
1113         https://bugs.webkit.org/show_bug.cgi?id=184721
1114
1115         Reviewed by Saam Barati.
1116
1117         No new tests because no new behavior.
1118
1119         * bindings/js/WebCoreJSClientData.cpp:
1120         (WebCore::JSVMClientData::JSVMClientData):
1121         * bindings/js/WebCoreJSClientData.h:
1122         (WebCore::JSVMClientData::runtimeMethodSpace):
1123         * bridge/runtime_method.cpp:
1124         (JSC::RuntimeMethod::subspaceForImpl):
1125         * bridge/runtime_method.h:
1126
1127 2018-04-19  Brady Eidson  <beidson@apple.com>
1128
1129         Add globally-unique HistoryItem identifiers (and have WebKit2 adopt them).
1130         <rdar://problem/39533949> and https://bugs.webkit.org/show_bug.cgi?id=184750
1131
1132         Reviewed by Ryosuke Niwa.
1133
1134         No new tests (Refactor, no behavior change).
1135
1136         In WebCore, we:
1137         - Add a process-unique "BackForwardItemIdentifier"
1138         - Make all HistoryItems have such an identifier as a member
1139
1140         * WebCore.xcodeproj/project.pbxproj:
1141
1142         * history/BackForwardItemIdentifier.h: Added.
1143         (WebCore::BackForwardItemIdentifier::logString const):
1144         (WebCore::operator==):
1145         (WebCore::BackForwardItemIdentifier::encode const):
1146         (WebCore::BackForwardItemIdentifier::decode):
1147         (WebCore::BackForwardItemIdentifier::hash const):
1148         (WTF::BackForwardItemIdentifierHash::hash):
1149         (WTF::BackForwardItemIdentifierHash::equal):
1150         (WTF::HashTraits<WebCore::BackForwardItemIdentifier>::emptyValue):
1151         (WTF::HashTraits<WebCore::BackForwardItemIdentifier>::constructDeletedValue):
1152         (WTF::HashTraits<WebCore::BackForwardItemIdentifier>::isDeletedValue):
1153
1154         * history/HistoryItem.cpp:
1155         (WebCore::HistoryItem::generateSequenceNumber):
1156         (WebCore::HistoryItem::HistoryItem):
1157         (WebCore::generateSequenceNumber): Deleted.
1158
1159         * history/HistoryItem.h:
1160         (WebCore::HistoryItem::create):
1161         (WebCore::HistoryItem::identifier const):
1162
1163 2018-04-19  Nan Wang  <n_wang@apple.com>
1164
1165         AX: AOM: respect the accessibility setting for dispatching the accessible events
1166         https://bugs.webkit.org/show_bug.cgi?id=184619
1167
1168         Reviewed by Ryosuke Niwa.
1169
1170         Added accessibilityEventsEnabled as a setting on the page.
1171
1172         Test: accessibility/ios-simulator/accessibility-events-setting.html
1173
1174         * accessibility/AccessibilityObject.cpp:
1175         (WebCore::AccessibilityObject::shouldDispatchAccessibilityEvent const):
1176         * page/Settings.yaml:
1177         * testing/InternalSettings.cpp:
1178         (WebCore::InternalSettings::Backup::Backup):
1179         (WebCore::InternalSettings::Backup::restoreTo):
1180         (WebCore::InternalSettings::setAccessibilityEventsEnabled):
1181         * testing/InternalSettings.h:
1182         * testing/InternalSettings.idl:
1183
1184 2018-04-18  Jer Noble  <jer.noble@apple.com>
1185
1186         Fix build when WK_ALTERNATE_FRAMEWORKS_DIR is set to non-empty value
1187         https://bugs.webkit.org/show_bug.cgi?id=184693
1188         <rdar://problem/39491884>
1189
1190         Reviewed by Tim Horton.
1191
1192         * Configurations/WebCore.xcconfig:
1193
1194 2018-04-19  Eric Stobbart  <ericstobbart@gmail.com>
1195
1196         Change MediaSource WebCore to return NewObject for SourceBuffers
1197         https://bugs.webkit.org/show_bug.cgi?id=184642
1198
1199         Reviewed by Chris Dumez.
1200
1201         Minor change inline with IDL documentation
1202
1203         * Modules/mediasource/MediaSource.cpp:
1204         (WebCore::MediaSource::addSourceBuffer):
1205         (): Deleted.
1206         * Modules/mediasource/MediaSource.h:
1207         * Modules/mediasource/MediaSource.idl:
1208
1209 2018-04-19  Yusuke Suzuki  <utatane.tea@gmail.com>
1210
1211         Unreviewed, build fix for Ubuntu LTS GCC
1212         https://bugs.webkit.org/show_bug.cgi?id=184756
1213
1214         The variable name "windowProxy" (with auto&) conflicts with the function name "windowProxy".
1215
1216         * bindings/js/ScriptController.cpp:
1217         (WebCore::ScriptController::updateDocument):
1218         (WebCore::ScriptController::collectIsolatedContexts):
1219
1220 2018-04-19  Manuel Rego Casasnovas  <rego@igalia.com>
1221
1222         Caret rendered at incorrect location inside empty table cell
1223         https://bugs.webkit.org/show_bug.cgi?id=85385
1224
1225         Reviewed by Zalan Bujtas.
1226
1227         This is based on a previous patch by Shezan Baig <shezbaig.wk@gmail.com>.
1228
1229         This fixes the position of the caret in empty cells,
1230         that was painted lower than expected
1231         (and then modified when you start to edit the cell).
1232
1233         Ensures that editable table cells have at least one line when
1234         they are laid out. This ensures that the cell's intrinsic before/after
1235         padding is calculated correctly, which results in the caret location
1236         being calculated correctly.
1237
1238         Test: editing/caret/caret-in-empty-cell.html
1239
1240         * rendering/RenderTableCell.cpp:
1241         (WebCore::RenderTableCell::hasLineIfEmpty): Override method to consider
1242         that it has an an empty line if the table cell is editable.
1243         * rendering/RenderTableCell.h:
1244
1245 2018-04-18  Daniel Bates  <dabates@apple.com>
1246
1247         Cleanup TextControlInnerElements
1248         https://bugs.webkit.org/show_bug.cgi?id=184475
1249
1250         Reviewed by Antti Koivisto.
1251
1252         Clean up TextControlInnerElement::resolveCustomStyle(), move the implementation of
1253         TextControlPlaceholderElement::create() from the header to the cpp file, replace
1254         fancy comments to demarcate classes with MARK: so that they show up in Xcode's
1255         function menu.
1256
1257         * html/shadow/TextControlInnerElements.cpp:
1258         (WebCore::TextControlInnerElement::resolveCustomStyle):
1259         (WebCore::TextControlPlaceholderElement::TextControlPlaceholderElement):
1260         (WebCore::TextControlPlaceholderElement::create):
1261         * html/shadow/TextControlInnerElements.h:
1262
1263 2018-04-18  Chris Dumez  <cdumez@apple.com>
1264
1265         Rename WindowProxyController to WindowProxy
1266         https://bugs.webkit.org/show_bug.cgi?id=184756
1267
1268         Reviewed by Sam Weinig.
1269
1270         Rename WindowProxyController to WindowProxy for clarity. When the IDL uses WindowProxy, the implementation
1271         needed use WindowProxyController type, which was a bit confusing.
1272
1273         * Sources.txt:
1274         * WebCore.xcodeproj/project.pbxproj:
1275         * bindings/js/DOMWrapperWorld.cpp:
1276         (WebCore::DOMWrapperWorld::~DOMWrapperWorld):
1277         (WebCore::DOMWrapperWorld::clearWrappers):
1278         * bindings/js/DOMWrapperWorld.h:
1279         (WebCore::DOMWrapperWorld::didCreateWindowProxy):
1280         (WebCore::DOMWrapperWorld::didDestroyWindowProxy):
1281         * bindings/js/JSBindingsAllInOne.cpp:
1282         * bindings/js/JSDOMWindowBase.cpp:
1283         (WebCore::toJS):
1284         * bindings/js/JSDOMWindowProxy.cpp:
1285         (WebCore::toJS):
1286         (WebCore::toJSDOMWindowProxy):
1287         * bindings/js/JSDOMWindowProxy.h:
1288         (WebCore::toJS):
1289         (WebCore::toJSDOMWindowProxy):
1290         * bindings/js/ScriptCachedFrameData.cpp:
1291         (WebCore::ScriptCachedFrameData::ScriptCachedFrameData):
1292         (WebCore::ScriptCachedFrameData::restore):
1293         * bindings/js/ScriptController.cpp:
1294         (WebCore::ScriptController::evaluateInWorld):
1295         (WebCore::ScriptController::loadModuleScriptInWorld):
1296         (WebCore::ScriptController::linkAndEvaluateModuleScriptInWorld):
1297         (WebCore::ScriptController::evaluateModule):
1298         (WebCore::ScriptController::setupModuleScriptHandlers):
1299         (WebCore::ScriptController::windowProxy):
1300         (WebCore::ScriptController::enableEval):
1301         (WebCore::ScriptController::enableWebAssembly):
1302         (WebCore::ScriptController::disableEval):
1303         (WebCore::ScriptController::disableWebAssembly):
1304         (WebCore::ScriptController::updateDocument):
1305         (WebCore::ScriptController::collectIsolatedContexts):
1306         (WebCore::ScriptController::windowScriptNPObject):
1307         (WebCore::ScriptController::executeIfJavaScriptURL):
1308         * bindings/js/ScriptController.h:
1309         (WebCore::ScriptController::globalObject):
1310         * bindings/js/ScriptControllerMac.mm:
1311         (WebCore::ScriptController::windowScriptObject):
1312         * bindings/js/ScriptState.cpp:
1313         (WebCore::mainWorldExecState):
1314         * bindings/js/WindowProxy.cpp: Renamed from Source/WebCore/bindings/js/WindowProxyController.cpp.
1315         (WebCore::WindowProxy::WindowProxy):
1316         (WebCore::WindowProxy::~WindowProxy):
1317         (WebCore::WindowProxy::destroyJSWindowProxy):
1318         (WebCore::WindowProxy::createJSWindowProxy):
1319         (WebCore::WindowProxy::jsWindowProxiesAsVector const):
1320         (WebCore::WindowProxy::createJSWindowProxyWithInitializedScript):
1321         (WebCore::WindowProxy::clearJSWindowProxiesNotMatchingDOMWindow):
1322         (WebCore::WindowProxy::setDOMWindow):
1323         (WebCore::WindowProxy::attachDebugger):
1324         * bindings/js/WindowProxy.h: Renamed from Source/WebCore/bindings/js/WindowProxyController.h.
1325         (WebCore::WindowProxy::jsWindowProxies const):
1326         (WebCore::WindowProxy::releaseJSWindowProxies):
1327         (WebCore::WindowProxy::setJSWindowProxies):
1328         (WebCore::WindowProxy::jsWindowProxy):
1329         (WebCore::WindowProxy::existingJSWindowProxy const):
1330         (WebCore::WindowProxy::globalObject):
1331         * loader/FrameLoader.cpp:
1332         (WebCore::FrameLoader::clear):
1333         (WebCore::FrameLoader::dispatchDidClearWindowObjectInWorld):
1334         * page/AbstractFrame.cpp:
1335         (WebCore::AbstractFrame::AbstractFrame):
1336         * page/AbstractFrame.h:
1337         (WebCore::AbstractFrame::windowProxy):
1338         (WebCore::AbstractFrame::windowProxy const):
1339         * page/Page.cpp:
1340         (WebCore::Page::setDebugger):
1341         * page/RemoteDOMWindow.cpp:
1342         (WebCore::RemoteDOMWindow::self const):
1343         (WebCore::RemoteDOMWindow::top const):
1344         (WebCore::RemoteDOMWindow::opener const):
1345         (WebCore::RemoteDOMWindow::parent const):
1346         * page/RemoteDOMWindow.h:
1347
1348 2018-04-18  Chris Dumez  <cdumez@apple.com>
1349
1350         Set RemoteDOMWindow's initial opener
1351         https://bugs.webkit.org/show_bug.cgi?id=184716
1352
1353         Reviewed by Sam Weinig.
1354
1355         Add support for WindowProxy type in the IDL. The implementation should
1356         return a WindowProxyController and toJS() will take care of converting
1357         this into a JSValue via JSDOMWindowProxy.
1358
1359         No new tests, rebaselined existing test.
1360
1361         * WebCore.xcodeproj/project.pbxproj:
1362         * bindings/IDLTypes.h:
1363         * bindings/js/JSDOMConvertWindowProxy.h: Added.
1364         (WebCore::JSConverter<IDLWindowProxy>::convert):
1365         * bindings/js/JSDOMWindowBase.cpp:
1366         (WebCore::toJS):
1367         * bindings/js/JSDOMWindowBase.h:
1368         (WebCore::toJS):
1369         * bindings/js/JSDOMWindowProxy.cpp:
1370         (WebCore::toJS):
1371         (WebCore::toJSDOMWindowProxy):
1372         * bindings/js/JSDOMWindowProxy.h:
1373         (WebCore::toJS):
1374         (WebCore::toJSDOMWindowProxy):
1375         * bindings/js/JSRemoteDOMWindowBase.cpp:
1376         * bindings/js/JSRemoteDOMWindowBase.h:
1377         * bindings/scripts/CodeGenerator.pm:
1378         (IsBuiltinType):
1379         * bindings/scripts/CodeGeneratorJS.pm:
1380         (AddToIncludesForIDLType):
1381         (GetBaseIDLType):
1382         * page/RemoteDOMWindow.cpp:
1383         (WebCore::RemoteDOMWindow::self const):
1384         (WebCore::RemoteDOMWindow::top const):
1385         (WebCore::RemoteDOMWindow::opener const):
1386         (WebCore::RemoteDOMWindow::parent const):
1387         * page/RemoteDOMWindow.h:
1388         * page/RemoteDOMWindow.idl:
1389         * page/RemoteFrame.h:
1390
1391 2018-04-18  Dean Jackson  <dino@apple.com>
1392
1393         Detect system preview links
1394         https://bugs.webkit.org/show_bug.cgi?id=184753
1395         <rdar://problem/39500514>
1396
1397         Reviewed by Antoine Quint.
1398
1399         Detect a special type of link anchor, which we're calling System Previews.
1400         Ultimately this will allow WebKit to present such links in a special
1401         way.
1402
1403         A System Preview link is an <a> element, with a rel attribute that
1404         includes "system-preview". It has a single element child, which is
1405         either an <img> or a <picture>.
1406
1407         Test: system-preview/detection.html
1408
1409         * html/HTMLAnchorElement.cpp:
1410         (WebCore::HTMLAnchorElement::relList): Add braces.
1411         (WebCore::HTMLAnchorElement::isSystemPreviewLink const): New
1412         function.
1413         * html/HTMLAnchorElement.h:
1414
1415         * html/HTMLImageElement.cpp:
1416         (WebCore::HTMLImageElement::isSystemPreviewImage const): Ask the
1417         parent if it is a system preview link.
1418         * html/HTMLImageElement.h:
1419         * html/HTMLPictureElement.cpp:
1420         (WebCore::HTMLPictureElement::isSystemPreviewImage const): Ditto.
1421         * html/HTMLPictureElement.h:
1422
1423         * testing/Internals.cpp: Testing helpers.
1424         (WebCore::Internals::systemPreviewRelType):
1425         (WebCore::Internals::isSystemPreviewLink const):
1426         (WebCore::Internals::isSystemPreviewImage const):
1427         * testing/Internals.h:
1428         * testing/Internals.idl:
1429
1430 2018-04-18  Antti Koivisto  <antti@apple.com>
1431
1432         :active pseudo class doesn't deactivate when using pressure sensitive trackpad
1433         https://bugs.webkit.org/show_bug.cgi?id=181680
1434
1435         Reviewed by Beth Dakin.
1436
1437         Trackpad sends a mouse force event with force of zero after mouse up event. This causes the element under cursor
1438         activate again.
1439
1440         Even a fake event test doesn't appear to be currently possible as TestRunner crashes if you try to send mouseForceChanged.
1441         All the tests using it are skipped.
1442
1443         * page/EventHandler.cpp:
1444         (WebCore::EventHandler::handleMouseForceEvent):
1445
1446         Don't add HitTestRequest::Active if the force of the force event is zero.
1447
1448 2018-04-18  Megan Gardner  <megan_gardner@apple.com>
1449
1450         Ensure correct screen sizes
1451         https://bugs.webkit.org/show_bug.cgi?id=184757
1452         
1453         Reviewed by Wenson Hsieh.
1454         
1455         Make sure that the screen sizes are actually correct.
1456
1457         Not currently testable, will add tests when it is.
1458
1459         * platform/ios/PlatformScreenIOS.mm:
1460
1461 2018-04-18  Nan Wang  <n_wang@apple.com>
1462
1463         AX: [macOS] WebKit hangs when triggering an alert from an AOM increment event
1464         https://bugs.webkit.org/show_bug.cgi?id=184742
1465
1466         Reviewed by Chris Fleizach.
1467
1468         Made increment and decrement actions on the macOS to be async. So that VoiceOver
1469         won't hang indefinitely if performing the actions causes an alert or other modal
1470         behaviors.
1471
1472         Test: accessibility/mac/async-increment-decrement-action.html
1473
1474         * accessibility/mac/WebAccessibilityObjectWrapperMac.mm:
1475         (-[WebAccessibilityObjectWrapper accessibilityPerformIncrementAction]):
1476         (-[WebAccessibilityObjectWrapper _accessibilityPerformIncrementAction]):
1477         (-[WebAccessibilityObjectWrapper accessibilityPerformDecrementAction]):
1478         (-[WebAccessibilityObjectWrapper _accessibilityPerformDecrementAction]):
1479         (-[WebAccessibilityObjectWrapper accessibilityPerformAction:]):
1480
1481 2018-04-18  Youenn Fablet  <youenn@apple.com>
1482
1483         MediaResourceLoader should set its fetch destination
1484         https://bugs.webkit.org/show_bug.cgi?id=184746
1485
1486         Reviewed by Eric Carlson.
1487
1488         Covered by updated test.
1489
1490         * loader/MediaResourceLoader.cpp:
1491         (WebCore::MediaResourceLoader::requestResource):
1492
1493 2018-04-18  Jer Noble  <jer.noble@apple.com>
1494
1495         Fix runtime errors in simulator while playing media
1496         https://bugs.webkit.org/show_bug.cgi?id=184751
1497
1498         Reviewed by Eric Carlson.
1499
1500         AVURLAssetHTTPCookiesKey may not be present, and AVPlayer may not respond to certain methods.
1501
1502         * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
1503         (WebCore::MediaPlayerPrivateAVFoundationObjC::createAVAssetForURL):
1504         (WebCore::MediaPlayerPrivateAVFoundationObjC::createAVPlayer):
1505         (WebCore::MediaPlayerPrivateAVFoundationObjC::updateDisableExternalPlayback):
1506         (WebCore::MediaPlayerPrivateAVFoundationObjC::setShouldDisableSleep):
1507
1508 2018-04-18  Jer Noble  <jer.noble@apple.com>
1509
1510         Ignore ASSERT when setting AVAudioSessionCategory returns an error on simulator.
1511         https://bugs.webkit.org/show_bug.cgi?id=184698
1512
1513         Reviewed by Eric Carlson.
1514
1515         * platform/audio/ios/AudioSessionIOS.mm:
1516         * platform/audio/mac/AudioSessionMac.cpp:
1517
1518 2018-04-18  Sihui Liu  <sihui_liu@apple.com>
1519
1520         REGRESSION: Using the reload button while offline pushes identical pages onto the back/forward list
1521         https://bugs.webkit.org/show_bug.cgi?id=184570
1522         <rdar://problem/34807323>
1523
1524         Reviewed by Chris Dumez.
1525
1526         Set FrameLoadType properly when error occurs in reload.
1527
1528         tests: Tools/TestWebKitAPI/Tests/WebKitCocoa/LoadAlternateHTMLString.mm
1529
1530         * loader/FrameLoader.cpp:
1531         (WebCore::FrameLoader::load):
1532
1533 2018-04-18  Chris Dumez  <cdumez@apple.com>
1534
1535         Add support for converting a local window to a remote window
1536         https://bugs.webkit.org/show_bug.cgi?id=184515
1537         <rdar://problem/39011318>
1538
1539         Reviewed by Ryosuke Niwa.
1540
1541         Add initial support for process-swapping when navigating cross-origin as a result
1542         of a window.open(). The window object returned by window.open() is initially same
1543         origin and is for about:blank. The navigation cross-origin then happens and the
1544         JS wrappers for the window then point to a cross-origin window which is remote (i.e.
1545         hosted in another WebProcess).
1546
1547         The RemoteDOMWindow exposed to JS looks like a regular cross-origin Window with a few
1548         exceptions due to our incomplete implementation (e.g. w.location returns null) and 
1549         most of its API is currently not functional. The RemoteDOMWindow API will be implemented
1550         in a follow-up by relying on IPC.
1551
1552         Test: http/tests/navigation/process-swap-window-open.html
1553
1554         * bindings/js/JSDOMGlobalObject.cpp:
1555         (WebCore::JSDOMGlobalObject::scriptExecutionContext const):
1556         * bindings/js/JSDOMPromiseDeferred.h:
1557         * bindings/js/JSDOMWindowProperties.cpp:
1558         (WebCore::JSDOMWindowProperties::getOwnPropertySlot):
1559         * bindings/js/JSDOMWindowProxy.cpp:
1560         (WebCore::JSDOMWindowProxy::finishCreation):
1561         (WebCore::JSDOMWindowProxy::create):
1562         * bindings/js/JSDOMWindowProxy.h:
1563         * bindings/js/JSDOMWrapper.cpp:
1564         (WebCore::JSDOMObject::JSDOMObject):
1565         * bindings/js/JSDOMWrapper.h:
1566         * bindings/js/WindowProxyController.cpp:
1567         (WebCore::WindowProxyController::createWindowProxy):
1568         (WebCore::WindowProxyController::setDOMWindowForWindowProxy):
1569         * bridge/objc/WebScriptObject.mm:
1570         (-[WebScriptObject _isSafeScript]):
1571         Teach more of our bindings code about RemoteDOMWindows.
1572
1573         * dom/Document.cpp:
1574         (WebCore::Document::createDOMWindow):
1575         * loader/FrameLoaderClient.h:
1576         Add FrameLoaderClient function to notify the client when a DOMWindow is constructed in
1577         the frame. This is needed for WebKit2 to link the old window to its new representation
1578         in the new WebProcess.
1579
1580 2018-04-17  Zan Dobersek  <zdobersek@igalia.com>
1581
1582         [CMake] Add and enable the ENABLE_CSS_ANIMATIONS_LEVEL_2 feature define
1583         https://bugs.webkit.org/show_bug.cgi?id=184681
1584
1585         Reviewed by Carlos Garcia Campos.
1586
1587         * Sources.txt: Include CSSAnimationTriggerScrollValue.cpp in the build.
1588         * WebCore.xcodeproj/project.pbxproj: Remove CSSAnimationTriggerScrollValue.cpp
1589         build target now that it's built via Sources.txt.
1590
1591 2018-04-17  Zan Dobersek  <zdobersek@igalia.com>
1592
1593         [CoordGraphics] CoordinatedImageBacking can simplify image drawing
1594         https://bugs.webkit.org/show_bug.cgi?id=183986
1595
1596         Reviewed by Michael Catanzaro.
1597
1598         In CoordinatedImageBacking::update(), when drawing the image into a
1599         freshly-created image backing, we can avoid save-and-restoring the
1600         painting context. We also don't have to clip it, since the clipping area
1601         is the same as the image (and buffer) bounds. Since the buffer is
1602         initialized to transparent color, we can use the CompositeCopy operator
1603         to just copy image data into the destination since there's nothing to
1604         paint the source over.
1605
1606         No new tests -- no change in functionality.
1607
1608         * platform/graphics/texmap/coordinated/CoordinatedImageBacking.cpp:
1609         (WebCore::CoordinatedImageBacking::update):
1610
1611 2018-04-17  Michael Catanzaro  <mcatanzaro@igalia.com>
1612
1613         [GTK] Webkit should spoof as Safari on a Mac for Outlook.com
1614         https://bugs.webkit.org/show_bug.cgi?id=184573
1615
1616         Reviewed by Carlos Alberto Lopez Perez.
1617
1618         Add quirk for outlook.live.com.
1619
1620         * platform/UserAgentQuirks.cpp:
1621         (WebCore::urlRequiresMacintoshPlatform):
1622
1623 2018-04-17  Mark Lam  <mark.lam@apple.com>
1624
1625         Templatize CodePtr/Refs/FunctionPtrs with PtrTags.
1626         https://bugs.webkit.org/show_bug.cgi?id=184702
1627         <rdar://problem/35391681>
1628
1629         Reviewed by Filip Pizlo and Saam Barati.
1630
1631         No new tests. This is covered by existing tests.
1632
1633         * WebCore.xcodeproj/project.pbxproj:
1634         * css/ElementRuleCollector.cpp:
1635         (WebCore::ElementRuleCollector::ruleMatches):
1636         * cssjit/CSSPtrTag.h: Added.
1637         * cssjit/CompiledSelector.h:
1638         * cssjit/FunctionCall.h:
1639         (WebCore::FunctionCall::FunctionCall):
1640         (WebCore::FunctionCall::setFunctionAddress):
1641         (WebCore::FunctionCall::prepareAndCall):
1642         * cssjit/SelectorCompiler.cpp:
1643         (WebCore::SelectorCompiler::compileSelector):
1644         (WebCore::SelectorCompiler::SelectorFragment::appendUnoptimizedPseudoClassWithContext):
1645         (WebCore::SelectorCompiler::addPseudoClassType):
1646         (WebCore::SelectorCompiler::SelectorCodeGenerator::compile):
1647         (WebCore::SelectorCompiler::SelectorCodeGenerator::generateElementAttributeFunctionCallValueMatching):
1648         (WebCore::SelectorCompiler::SelectorCodeGenerator::generateElementFunctionCallTest):
1649         (WebCore::SelectorCompiler::SelectorCodeGenerator::generateContextFunctionCallTest):
1650         * cssjit/SelectorCompiler.h:
1651         (WebCore::SelectorCompiler::ruleCollectorSimpleSelectorCheckerFunction):
1652         (WebCore::SelectorCompiler::querySelectorSimpleSelectorCheckerFunction):
1653         (WebCore::SelectorCompiler::ruleCollectorSelectorCheckerFunctionWithCheckingContext):
1654         (WebCore::SelectorCompiler::querySelectorSelectorCheckerFunctionWithCheckingContext):
1655         * dom/SelectorQuery.cpp:
1656         (WebCore::SelectorDataList::executeCompiledSingleMultiSelectorData const):
1657         (WebCore::SelectorDataList::execute const):
1658         * dom/SelectorQuery.h:
1659
1660 2018-04-17  Tadeu Zagallo  <tzagallo@apple.com>
1661
1662         Retain MessagePortChannel for transfer when disentangling ports
1663         https://bugs.webkit.org/show_bug.cgi?id=184502
1664         <rdar://problem/39372771>
1665
1666         Reviewed by Geoffrey Garen.
1667
1668         MessagePortChannels should be retained while ports are being transferred, but that was only
1669         happening when sending a port through another port, but not when sending it through a worker.
1670
1671         Test: workers/worker-to-worker.html
1672
1673         * dom/messageports/MessagePortChannel.cpp:
1674         (WebCore::MessagePortChannel::entanglePortWithProcess):
1675         (WebCore::MessagePortChannel::disentanglePort):
1676         (WebCore::MessagePortChannel::postMessageToRemote):
1677         (WebCore::MessagePortChannel::takeAllMessagesForPort):
1678
1679 2018-04-17  Tadeu Zagallo  <tzagallo@apple.com>
1680
1681         References from CSSStyleDeclaration to CSSValues should be weak
1682         https://bugs.webkit.org/show_bug.cgi?id=180280
1683         <rdar://problem/35804869>
1684
1685         Reviewed by Geoffrey Garen.
1686
1687         No new tests - used the existing test to verify the leak
1688
1689         * css/DeprecatedCSSOMValue.h:
1690         (WebCore::DeprecatedCSSOMValue::weakPtrFactory):
1691         * css/PropertySetCSSStyleDeclaration.cpp:
1692         (WebCore::PropertySetCSSStyleDeclaration::wrapForDeprecatedCSSOM):
1693         * css/PropertySetCSSStyleDeclaration.h:
1694
1695 2018-04-17  Jonathan Bedard  <jbedard@apple.com>
1696
1697         Unreviewed rollout of r230632. Regression in memory usage.
1698
1699         That bug tracked in https://bugs.webkit.org/show_bug.cgi?id=184569.
1700
1701         Tests: animations/animation-internals-api-multiple-keyframes.html
1702                animations/animation-internals-api.html
1703                transitions/transition-drt-api-delay.html
1704                transitions/transition-drt-api.html
1705
1706         * page/RuntimeEnabledFeatures.h:
1707         * testing/Internals.cpp:
1708         (WebCore::Internals::pseudoElement): Deleted.
1709         * testing/Internals.h:
1710         * testing/Internals.idl:
1711
1712 2018-04-17  Tadeu Zagallo  <tzagallo@apple.com>
1713
1714         Do not unregister MessagePorts on deallocation if it has been disentangled
1715         https://bugs.webkit.org/show_bug.cgi?id=184285
1716         <rdar://problem/39256714>
1717
1718         Reviewed by Darin Adler.
1719
1720         Test: workers/message-port-gc.html
1721
1722         * dom/MessagePort.cpp:
1723         (WebCore::MessagePort::deref const):
1724
1725 2018-04-17  Basuke Suzuki  <Basuke.Suzuki@sony.com>
1726
1727         [Curl] Fix timing of reporting error to the client
1728         https://bugs.webkit.org/show_bug.cgi?id=184707
1729
1730         Before checking the result code, check the status of callback invocation and
1731         do the right thing.
1732
1733         Reviewed by Youenn Fablet.
1734
1735         No new tests because there's no new behavior.
1736
1737         * platform/network/curl/CurlRequest.cpp:
1738         (WebCore::CurlRequest::didCompleteTransfer):
1739         * platform/network/curl/CurlRequest.h:
1740         (WebCore::CurlRequest::needToInvokeDidReceiveResponse const):
1741
1742 2018-04-17  Basuke Suzuki  <Basuke.Suzuki@sony.com>
1743
1744         [Curl] Export authentication information to be used by the client.
1745         https://bugs.webkit.org/show_bug.cgi?id=184709
1746
1747         Just added getters for username and password member variables.
1748
1749         Reviewed by Alex Christensen.
1750
1751         No new tests because there's no new behavior.
1752
1753         * platform/network/curl/CurlRequest.h:
1754         (WebCore::CurlRequest::user const):
1755         (WebCore::CurlRequest::password const):
1756
1757 2018-04-17  Chris Dumez  <cdumez@apple.com>
1758
1759         REGRESSION (r229831): CMD-clicking an iCloud web app link unexpectedly opens that link in a new tab and the current tab
1760         https://bugs.webkit.org/show_bug.cgi?id=184678
1761         <rdar://problem/39422122>
1762
1763         Reviewed by Alex Christensen.
1764
1765         Frament navigations need to happen synchronously for Web-compatibility. Because of this,
1766         r225657 added code to make sure that if the client does not make the navigation policy
1767         decision synchronously for frament navigations, then we'll stop waiting for the client
1768         and proceed with the navigation. However, r229831 make the navigation policy decision
1769         IPC decision, meaning that even if the client responds synchronously, it would be
1770         asynchronously from WebCore's point of view. As a result, we would always ignore the
1771         client's policy decision when doing a fragment navigation.
1772
1773         This is an issue on iclould.com because the web-app links are fragment URLs. When you
1774         CMD+click one of these link, we do the navigation policy check. As a result of this
1775         check, Safari responds IGNORE to the policy decision and instead decides to load the
1776         link in a new tab (because CMD key is pressed). Due to the bug mentioned above, we
1777         would not obey the IGNORE policy decision from Safari and load the link in the current
1778         tab, even though Safari would already be loading it in a new tab.
1779
1780         To address the issue, I reintroduced a synchronous code path for navigation policy
1781         decision making, backed by synchronous IPC. This synchronous code path is now used for
1782         fragment navigations to restore pre-r229831 behavior. If the client does not answer
1783         synchronously, we'll proceed with the navigation anyway, as was happening pre-r229831.
1784
1785         Test: http/tests/navigation/fragment-navigation-policy-ignore.html
1786
1787         * loader/EmptyClients.cpp:
1788         (WebCore::EmptyFrameLoaderClient::dispatchDecidePolicyForNavigationAction):
1789         * loader/EmptyFrameLoaderClient.h:
1790         * loader/FrameLoader.cpp:
1791         (WebCore::FrameLoader::loadURL):
1792         (WebCore::FrameLoader::loadWithDocumentLoader):
1793         * loader/FrameLoaderClient.h:
1794         * loader/PolicyChecker.cpp:
1795         (WebCore::PolicyChecker::checkNavigationPolicy):
1796         * loader/PolicyChecker.h:
1797
1798 2018-04-17  Matt Lewis  <jlewis3@apple.com>
1799
1800         Unreviewed, rolling out r230713.
1801
1802         This caused internal build failures.
1803
1804         Reverted changeset:
1805
1806         "Implement checked cast for DDResultRef once
1807         DDResultGetTypeID() is available"
1808         https://bugs.webkit.org/show_bug.cgi?id=184554
1809         https://trac.webkit.org/changeset/230713
1810
1811 2018-04-17  Chris Dumez  <cdumez@apple.com>
1812
1813         Add bindings code for RemoteDOMWindow
1814         https://bugs.webkit.org/show_bug.cgi?id=184653
1815
1816         Reviewed by Ryosuke Niwa.
1817
1818         Add bindings code for RemoteDOMWindow. A RemoteDOMWindow behaves exactly like a cross-origin
1819         DOMWindow, which is backed by a RemoteDOMWindow object instead of a DOMWindow one. Since
1820         a RemoteDOMWindow is always cross origin, we do not need cross-origin checks and the bindings
1821         code is identical to the DOMWindow code paths from cross-origin handling.
1822
1823         No new tests, this code will be used and tested via Bug 184515.
1824
1825         * CMakeLists.txt:
1826         * DerivedSources.make:
1827         * Sources.txt:
1828         * WebCore.xcodeproj/project.pbxproj:
1829         * bindings/js/JSBindingsAllInOne.cpp:
1830         * bindings/js/JSDOMWindowCustom.cpp:
1831         (WebCore::jsDOMWindowGetOwnPropertySlotRestrictedAccess):
1832         (WebCore::JSDOMWindow::getOwnPropertySlot):
1833         (WebCore::JSDOMWindow::getOwnPropertySlotByIndex):
1834         (WebCore::addCrossOriginWindowOwnPropertyNames):
1835         * bindings/js/JSDOMWindowCustom.h:
1836
1837         * bindings/js/JSRemoteDOMWindowBase.cpp: Added.
1838         (WebCore::JSRemoteDOMWindowBase::JSRemoteDOMWindowBase):
1839         (WebCore::JSRemoteDOMWindowBase::destroy):
1840         (WebCore::JSRemoteDOMWindowBase::javaScriptRuntimeFlags):
1841         (WebCore::toJS):
1842         (WebCore::toJSRemoteDOMWindow):
1843         * bindings/js/JSRemoteDOMWindowBase.h: Added.
1844         JSRemoteDOMWindow unfortunately currently needs to be a global object because of:
1845         1. a JSProxy's target needs to be a JSGlobalObject currently
1846         2. The 'structure()->setGlobalObject(vm, &window);' call in
1847            JSDOMWindowProxy::setWindow(VM&, JSDOMGlobalObject&) which requires a JSGlobalObject.
1848         Ideally, this wouldn't be the case in the future but this would require some code refactoring.
1849         Our DOM global objects normally subclass JSDOMGlobalObject so I decided to subclass JSDOMGlobalObject,
1850         which brings some things our bindings code expect. However, subclassing JSDOMGlobalObject directly is
1851         problematic because it does not hold the m_wrapped implementation pointer. To address this issue, all
1852         our our DOM global objects have a JS*Base base class which subclasses JSDOMGlobalObject and stores the
1853         m_wrapped implementation pointer. I followed the same pattern here.
1854
1855         (WebCore::toJS):
1856         * bindings/js/JSRemoteDOMWindowCustom.cpp: Added.
1857         (WebCore::JSRemoteDOMWindow::getOwnPropertySlot):
1858         (WebCore::JSRemoteDOMWindow::getOwnPropertySlotByIndex):
1859         (WebCore::JSRemoteDOMWindow::put):
1860         (WebCore::JSRemoteDOMWindow::putByIndex):
1861         (WebCore::JSRemoteDOMWindow::deleteProperty):
1862         (WebCore::JSRemoteDOMWindow::deletePropertyByIndex):
1863         (WebCore::JSRemoteDOMWindow::getOwnPropertyNames):
1864         (WebCore::JSRemoteDOMWindow::defineOwnProperty):
1865         (WebCore::JSRemoteDOMWindow::getPrototype):
1866         (WebCore::JSRemoteDOMWindow::preventExtensions):
1867         (WebCore::JSRemoteDOMWindow::toStringName):
1868         * bindings/scripts/CodeGeneratorJS.pm:
1869         (IsDOMGlobalObject):
1870         (GenerateHeader):
1871         (GenerateOverloadDispatcher):
1872         (GenerateImplementation):
1873         * page/RemoteDOMWindow.idl: Added.
1874
1875 2018-04-17  David Kilzer  <ddkilzer@apple.com>
1876
1877         Implement checked cast for DDResultRef once DDResultGetTypeID() is available
1878         <https://webkit.org/b/184554>
1879         <rdar://problem/36241894>
1880
1881         Reviewed by Brent Fulgham.
1882
1883         * editing/cocoa/DataDetection.mm:
1884         (WebCore::detectItemAtPositionWithRange): Implement checked cast
1885         for DDResultRef.
1886
1887 2018-04-17  Said Abou-Hallawa  <sabouhallawa@apple.com>
1888
1889         Animated GIF imagery with finite looping are falling one loop short
1890         https://bugs.webkit.org/show_bug.cgi?id=183153
1891
1892         Reviewed by Simon Fraser.
1893
1894         The Netscape Looping Application Extension is a block which may be added
1895         to a GIF file to tell the viewer to loop through the entire GIF frames.
1896         This is communicated through two bytes designated for the "loopCount" in
1897         this block.
1898
1899         The entire block may not be found in the GIF, in which case the GIF is 
1900         supposed to animate its entire frames only once.
1901
1902         If the block exists and loopCount = 0, this means the image has to loop
1903         through its frames indefinitely.
1904
1905         If the block exist and loopCount > 0, this should mean the image has to
1906         loop through its frames loopCount + 1 times. The extra loop seems to be
1907         the consensus among most of the GIF generators and viewers. For example,
1908         if the image designer wants the image to loop through its frames n times:
1909         -- The GIF generator (e.g. Adobe Photoshop and https://ezgif.com/maker) 
1910            will write n - 1 for loopCount. However http://gifmaker.me and 
1911            http://gifmaker.org write n for loopCount.
1912         -- The browser (e.g. Chrome 65.0.3325 181 and FireFox Quantum 59.0.2) will
1913            translate loopCount = n - 1 to: animate GIF once + loop n - 1, which 
1914            means loop the GIF n times.
1915
1916         Because the specs are not really clear about this, we are going to consider
1917         the agreed-upon behavior among most of the web browsers the specs here.
1918
1919         * platform/graphics/cg/ImageDecoderCG.cpp:
1920         (WebCore::ImageDecoderCG::repetitionCount const):
1921         * platform/image-decoders/gif/GIFImageDecoder.cpp:
1922         (WebCore::GIFImageDecoder::repetitionCount const):
1923
1924 2018-04-17  Saam Barati  <sbarati@apple.com>
1925
1926         Add system trace points for process launch and for initializeWebProcess
1927         https://bugs.webkit.org/show_bug.cgi?id=184669
1928
1929         Reviewed by Simon Fraser.
1930
1931         No testing needed because there is no new functionality here.
1932
1933         * loader/FrameLoader.cpp:
1934         (WebCore::FrameLoader::provisionalLoadStarted):
1935         (WebCore::FrameLoader::checkLoadCompleteForThisFrame):
1936         * loader/SubresourceLoader.cpp:
1937         (WebCore::SubresourceLoader::willSendRequestInternal):
1938         (WebCore::SubresourceLoader::didFinishLoading):
1939         (WebCore::SubresourceLoader::didFail):
1940         (WebCore::SubresourceLoader::didCancel):
1941
1942 2018-04-17  Eric Carlson  <eric.carlson@apple.com>
1943
1944         [iOS] AirPlay device name is sometimes wrong
1945         https://bugs.webkit.org/show_bug.cgi?id=184543
1946         <rdar://problem/39105498>
1947
1948         Reviewed by Jer Noble.
1949
1950         No new tests, this can only be tested with a specific hardware setup.
1951
1952         * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
1953         (WebCore::exernalDeviceDisplayNameForPlayer): Get the device name from the AVOutputContext
1954         when possible.
1955
1956 2018-04-17  Carlos Alberto Lopez Perez  <clopez@igalia.com>
1957
1958         [GTK] Build fix after r230529 (WaylandCompositorDisplay leaks its wl_display)
1959         https://bugs.webkit.org/show_bug.cgi?id=184406
1960
1961         Rubber-stamped by Michael Catanzaro.
1962
1963         Fix build with clang 3.8
1964
1965         No new tests, it is a build fix.
1966
1967         * platform/graphics/wayland/PlatformDisplayWayland.cpp:
1968         (WebCore::PlatformDisplayWayland::create):
1969
1970 2018-04-16  Antoine Quint  <graouts@apple.com>
1971
1972         Layout Test animations/needs-layout.html is a flaky Image Failure.
1973         https://bugs.webkit.org/show_bug.cgi?id=172397
1974
1975         Reviewed by Dean Jackson.
1976
1977         Animations that animate a transform and uses a relative value for either the x or y components
1978         require a layout before starting, which CSSAnimationController would perform in the call to
1979         CSSAnimationControllerPrivate::animationTimerFired() made immediately after a CSS animation was
1980         created.
1981
1982         We now perform a similar task where upon setting new blending keyframes we compute a flag indicating
1983         if the keyframe effect is animating a transform with relative x or y components. Then, when we perform
1984         the first invalidation task, which runs in the next run loop after a change to the timing model has
1985         been made, such as a call to play() on a CSSAnimation made in the TreeResolver::createAnimatedElementUpdate()
1986         where the CSSAnimation was created, we call forceLayout() on this element's FrameView. We also ensure
1987         we commit animations on the compositor immediately after that too, instead of waiting until the next
1988         DisplayRefreshMonitor callback.
1989
1990         * animation/DocumentTimeline.cpp:
1991         (WebCore::DocumentTimeline::performInvalidationTask):
1992         (WebCore::DocumentTimeline::updateAnimations):
1993         * animation/KeyframeEffectReadOnly.cpp:
1994         (WebCore::KeyframeEffectReadOnly::forceLayoutIfNeeded):
1995         (WebCore::KeyframeEffectReadOnly::setBlendingKeyframes):
1996         (WebCore::KeyframeEffectReadOnly::computedNeedsForcedLayout):
1997         (WebCore::KeyframeEffectReadOnly::applyPendingAcceleratedActions):
1998         * animation/KeyframeEffectReadOnly.h:
1999
2000 2018-04-16  Pablo Saavedra  <psaavedra@igalia.com>
2001
2002         Inconsistent EGL defines in ImageBufferCairo
2003         https://bugs.webkit.org/show_bug.cgi?id=184661
2004
2005         Reviewed by Žan Doberšek.
2006
2007         On revision r219391 libepoxy is added. The headers in
2008         ImageBufferCairo.cpp become inconsistent when 2D canvas is enabled
2009         (-DENABLE_ACCELERATED_2D_CANVAS=ON) due to a redefinition error during
2010         the Webkit build:
2011
2012             ...
2013             /usr/include/GLES2/gl2.h:503:82: error: 'voi
2014             epoxy_glAttachShader(GLuint, GLuint)' redeclared as different kind
2015             of symbol
2016             GL_APICALL void         GL_APIENTRY glAttachShader (GLuint
2017             program, GLuint shader);
2018
2019         No new tests.
2020
2021         * platform/graphics/cairo/ImageBufferCairo.cpp:
2022
2023 2018-04-16  Filip Pizlo  <fpizlo@apple.com>
2024
2025         MutationObserver should be in an IsoHeap
2026         https://bugs.webkit.org/show_bug.cgi?id=184671
2027         <rdar://problem/36081981>
2028
2029         Reviewed by Sam Weinig.
2030
2031         No new tests because no new behavior.
2032
2033         * dom/MutationObserver.cpp:
2034         * dom/MutationObserver.h:
2035
2036 2018-04-16  Youenn Fablet  <youenn@apple.com>
2037
2038         Use NetworkLoadChecker to handle synchronous HTTP loads
2039         https://bugs.webkit.org/show_bug.cgi?id=184240
2040
2041         Reviewed by Chris Dumez.
2042
2043         Update LoaderStrategy::loadResourceSynchronously to pass FetchOptions directly.
2044         Update various call sites accordingly. This allows NetworkProcess to do all necessary checks.
2045         Add an option to disable security checks if NetworkProcess does it for WebProcess.
2046         This option will be also used for regular asynchronous loads in future patches.
2047
2048         Update DocumentThreadableLoader to bypass preflighting and response validation checks in case they are done in NetworkProcess.
2049
2050         Covered by existing and rebased tests.
2051
2052         * loader/CrossOriginPreflightChecker.cpp:
2053         (WebCore::CrossOriginPreflightChecker::doPreflight):
2054         * loader/DocumentThreadableLoader.cpp:
2055         (WebCore::DocumentThreadableLoader::DocumentThreadableLoader):
2056         (WebCore::DocumentThreadableLoader::loadRequest):
2057         * loader/FrameLoader.cpp:
2058         (WebCore::FrameLoader::loadResourceSynchronously):
2059         * loader/FrameLoader.h:
2060         * loader/LoaderStrategy.h:
2061         * xml/XSLTProcessorLibxslt.cpp:
2062         (WebCore::docLoaderFunc):
2063         * xml/parser/XMLDocumentParserLibxml2.cpp:
2064         (WebCore::openFunc):
2065
2066 2018-04-16  Christopher Reid  <chris.reid@sony.com>
2067
2068         [WinCairo] Media elements should be enabled by default
2069         https://bugs.webkit.org/show_bug.cgi?id=184597
2070
2071         Reviewed by Per Arne Vollan.
2072
2073         Enabling media elements by default with media foundation.
2074
2075         * page/SettingsDefaultValues.h:
2076
2077 2018-04-16  Christopher Reid  <chris.reid@sony.com>
2078
2079         [Curl] Add the Accept-Language field to curl request headers
2080         https://bugs.webkit.org/show_bug.cgi?id=184605
2081
2082         Reviewed by Alex Christensen.
2083
2084         Add Accept-Language field to curl request headers
2085
2086         * platform/network/curl/CurlRequest.cpp:
2087         * platform/network/curl/CurlRequest.h:
2088
2089 2018-04-16  Chris Dumez  <cdumez@apple.com>
2090
2091         Move more WindowProxy-related logic from ScriptController to WindowProxyController
2092         https://bugs.webkit.org/show_bug.cgi?id=184640
2093
2094         Reviewed by Ryosuke Niwa.
2095
2096         Move more WindowProxy-related logic from ScriptController to WindowProxyController,
2097         for clarity.
2098
2099         * bindings/js/JSDOMWindowProxy.cpp:
2100         (WebCore::JSDOMWindowProxy::attachDebugger):
2101         * bindings/js/JSDOMWindowProxy.h:
2102         * bindings/js/ScriptCachedFrameData.cpp:
2103         (WebCore::ScriptCachedFrameData::ScriptCachedFrameData):
2104         (WebCore::ScriptCachedFrameData::restore):
2105         * bindings/js/ScriptController.cpp:
2106         (WebCore::ScriptController::~ScriptController):
2107         (WebCore::ScriptController::initScriptForWindowProxy):
2108         * bindings/js/ScriptController.h:
2109         (WebCore::ScriptController::existingCacheableBindingRootObject const):
2110         * bindings/js/WindowProxyController.cpp:
2111         (WebCore::collectGarbageAfterWindowProxyDestruction):
2112         (WebCore::WindowProxyController::~WindowProxyController):
2113         (WebCore::WindowProxyController::clearWindowProxiesNotMatchingDOMWindow):
2114         (WebCore::WindowProxyController::setDOMWindowForWindowProxy):
2115         (WebCore::WindowProxyController::attachDebugger):
2116         * bindings/js/WindowProxyController.h:
2117         * loader/FrameLoader.cpp:
2118         (WebCore::FrameLoader::clear):
2119         * page/Page.cpp:
2120         (WebCore::Page::setDebugger):
2121
2122 2018-04-16  Thibault Saunier  <tsaunier@igalia.com>
2123
2124         [GStreamer] Set *TrackPrivateGStreamer::active based on GstStream default select in constructor
2125         https://bugs.webkit.org/show_bug.cgi?id=184652
2126
2127         Reviewed by Philippe Normand.
2128
2129         In the constructor we should mark selected streams based on the default values from GstStream,
2130         if the user changes them, they will be updated as required later on.
2131
2132         No new tests are added as we already have a few ones that are currently disabled in
2133         the mediastream testsuite. This patch is part of the work to enable them.
2134
2135         * platform/graphics/gstreamer/AudioTrackPrivateGStreamer.cpp:
2136         (WebCore::AudioTrackPrivateGStreamer::AudioTrackPrivateGStreamer):
2137         * platform/graphics/gstreamer/VideoTrackPrivateGStreamer.cpp:
2138         (WebCore::VideoTrackPrivateGStreamer::VideoTrackPrivateGStreamer):
2139
2140 2018-04-16  Thibault Saunier  <tsaunier@igalia.com>
2141
2142         [GStreamer] Set TrackPrivateBaseGStreamer metadata information even if no client is avalaible
2143         https://bugs.webkit.org/show_bug.cgi?id=184651
2144
2145         Reviewed by Philippe Normand.
2146
2147         We can't notify the client if none is connected, but still we need to fill our metadatas from
2148         the provided GstTagList, especially in the case of playbin3 where the client is not set yet
2149         at construct time but the metadata might already be preset (and won't be updated later on).
2150
2151         No new tests are added as we already have a few ones that are currently disabled in
2152         the mediastream testsuite. This patch is part of the work to enable them.
2153
2154         * platform/graphics/gstreamer/TrackPrivateBaseGStreamer.cpp:
2155         (WebCore::TrackPrivateBaseGStreamer::notifyTrackOfTagsChanged):
2156
2157 2018-04-16  Antoine Quint  <graouts@apple.com>
2158
2159         [Web Animations] Ensure we never return -0 through the API
2160         https://bugs.webkit.org/show_bug.cgi?id=184644
2161
2162         Reviewed by Dean Jackson.
2163
2164         We could sometimes return -0 instead of 0, which is surprising and leads to an error in WPT tests.
2165         This would happen when playbackRate < 0.
2166
2167         * animation/WebAnimationUtilities.h:
2168         (WebCore::secondsToWebAnimationsAPITime):
2169
2170 2018-04-15  Antoine Quint  <graouts@apple.com>
2171
2172         [Web Animations] Animations do not naturally get a finish event
2173         https://bugs.webkit.org/show_bug.cgi?id=184639
2174         <rdar://problem/39397649>
2175
2176         Reviewed by Jon Lee.
2177
2178         We must call updateFinishedState() when an animation gets sampled as it means its timeline's time has progressed
2179         and it may have crossed to a finished state. Calling updateFinishedState() when sampling means that we'll correctly
2180         set the animation's hold time to its end value, which means that currentTime() will now always be clamped to return
2181         the end time once its has reached it, so we must not schedule animations to resolve immediately anymore since otherwise
2182         they will keep being scheduled in a loop.
2183
2184         * animation/WebAnimation.cpp:
2185         (WebCore::WebAnimation::timeToNextRequiredTick const):
2186         (WebCore::WebAnimation::resolve):
2187
2188 2018-04-15  Chris Dumez  <cdumez@apple.com>
2189
2190         Change Event's returnValue so it doesn't expose a new primitive
2191         https://bugs.webkit.org/show_bug.cgi?id=184415
2192
2193         Reviewed by Darin Adler.
2194
2195         Update Event.returnValue setter to match the latest DOM specification after:
2196         - https://github.com/whatwg/dom/pull/626
2197
2198         In particular, the returnValue setter is now a no-op if the new flag value
2199         is true. If the input flag value is false, it only sets the 'canceled' flag
2200         if the event is cancelable and the event’s in passive listener flag is unset.
2201
2202         Test: imported/w3c/web-platform-tests/dom/events/Event-returnValue.html
2203
2204         * dom/Event.cpp:
2205         (WebCore::Event::setLegacyReturnValue):
2206         (WebCore::Event::setCanceledFlagIfPossible):
2207         (WebCore::Event::preventDefault):
2208         * dom/Event.h:
2209
2210 2018-04-14  Thibault Saunier  <tsaunier@igalia.com>
2211
2212         [GStreamer] Expose a method to retrieve the GstStream from a TrackPrivateBaseGStreamer
2213         https://bugs.webkit.org/show_bug.cgi?id=184620
2214
2215         Reviewed by Philippe Normand.
2216
2217         This is a minor change, a dedicated test doesn't really make sense here.
2218
2219         * platform/graphics/gstreamer/TrackPrivateBaseGStreamer.h:
2220         (WebCore::TrackPrivateBaseGStreamer::stream):
2221
2222 2018-04-13  Ryosuke Niwa  <rniwa@webkit.org>
2223
2224         WebKit crashes when libwebrtc.dylib is missing
2225         https://bugs.webkit.org/show_bug.cgi?id=184607
2226
2227         Rubber-stamped by Jer Noble.
2228
2229         Don't call LibWebRTC related code when libwebrtc is not available.
2230
2231         * dom/Document.cpp:
2232         (WebCore::Document::prepareForDestruction):
2233         (WebCore::Document::suspend):
2234
2235 2018-04-13  Chris Dumez  <cdumez@apple.com>
2236
2237         Split WindowProxy handling out of ScriptController and into a new class owned by AbstractFrame
2238         https://bugs.webkit.org/show_bug.cgi?id=184591
2239
2240         Reviewed by Sam Weinig.
2241
2242         Split WindowProxy handling out of ScriptController and into a new class owned by AbstractFrame.
2243         RemoteFrames do not need a ScriptController but do need to maintain WindowProxies.
2244         This is work towards fixing Bug 184515.
2245
2246         * Sources.txt:
2247         * WebCore.xcodeproj/project.pbxproj:
2248         * bindings/js/DOMWrapperWorld.cpp:
2249         (WebCore::DOMWrapperWorld::~DOMWrapperWorld):
2250         (WebCore::DOMWrapperWorld::clearWrappers):
2251         * bindings/js/DOMWrapperWorld.h:
2252         (WebCore::DOMWrapperWorld::didCreateWindowProxy):
2253         (WebCore::DOMWrapperWorld::didDestroyWindowProxy):
2254         * bindings/js/JSBindingsAllInOne.cpp:
2255         * bindings/js/JSDOMWindowBase.cpp:
2256         (WebCore::toJSDOMWindow):
2257         * bindings/js/JSDOMWindowProxy.cpp:
2258         (WebCore::toJS):
2259         (WebCore::toJSDOMWindowProxy):
2260         * bindings/js/ScriptCachedFrameData.cpp:
2261         (WebCore::ScriptCachedFrameData::ScriptCachedFrameData):
2262         (WebCore::ScriptCachedFrameData::restore):
2263         * bindings/js/ScriptController.cpp:
2264         (WebCore::ScriptController::~ScriptController):
2265         (WebCore::ScriptController::evaluateInWorld):
2266         (WebCore::ScriptController::loadModuleScriptInWorld):
2267         (WebCore::ScriptController::linkAndEvaluateModuleScriptInWorld):
2268         (WebCore::ScriptController::evaluateModule):
2269         (WebCore::ScriptController::clearWindowProxiesNotMatchingDOMWindow):
2270         (WebCore::ScriptController::setDOMWindowForWindowProxy):
2271         (WebCore::ScriptController::initScriptForWindowProxy):
2272         (WebCore::ScriptController::setupModuleScriptHandlers):
2273         (WebCore::ScriptController::windowProxyController):
2274         (WebCore::ScriptController::enableEval):
2275         (WebCore::ScriptController::enableWebAssembly):
2276         (WebCore::ScriptController::disableEval):
2277         (WebCore::ScriptController::disableWebAssembly):
2278         (WebCore::ScriptController::attachDebugger):
2279         (WebCore::ScriptController::updateDocument):
2280         (WebCore::ScriptController::collectIsolatedContexts):
2281         (WebCore::ScriptController::windowScriptNPObject):
2282         (WebCore::ScriptController::executeIfJavaScriptURL):
2283         * bindings/js/ScriptController.h:
2284         (WebCore::ScriptController::globalObject):
2285         * bindings/js/ScriptControllerMac.mm:
2286         (WebCore::ScriptController::windowScriptObject):
2287         * bindings/js/ScriptState.cpp:
2288         (WebCore::mainWorldExecState):
2289         * bindings/js/WindowProxyController.cpp: Added.
2290         (WebCore::WindowProxyController::WindowProxyController):
2291         (WebCore::WindowProxyController::destroyWindowProxy):
2292         (WebCore::WindowProxyController::createWindowProxy):
2293         (WebCore::WindowProxyController::windowProxies):
2294         (WebCore::WindowProxyController::createWindowProxyWithInitializedScript):
2295         * bindings/js/WindowProxyController.h: Added.
2296         (WebCore::WindowProxyController::releaseWindowProxies):
2297         (WebCore::WindowProxyController::setWindowProxies):
2298         (WebCore::WindowProxyController::windowProxy):
2299         (WebCore::WindowProxyController::existingWindowProxy const):
2300         (WebCore::WindowProxyController::globalObject):
2301         * loader/FrameLoader.cpp:
2302         (WebCore::FrameLoader::dispatchDidClearWindowObjectInWorld):
2303         * page/AbstractFrame.cpp:
2304         (WebCore::AbstractFrame::AbstractFrame):
2305         * page/AbstractFrame.h:
2306         (WebCore::AbstractFrame::windowProxyController):
2307         (WebCore::AbstractFrame::windowProxyController const):
2308
2309 2018-04-13  Brady Eidson  <beidson@apple.com>
2310
2311         Introduce SuspendedPageProxy to keep old web processes around after their WebPageProxy has been swapped to a new one.
2312         https://bugs.webkit.org/show_bug.cgi?id=184559
2313
2314         Reviewed by Alex Christensen.
2315
2316         Covered by new API test.
2317
2318         WebCore changes rework the meaning of a "ForSuspension" policy to simply navigate the page to about:blank.
2319
2320         * loader/DocumentLoader.cpp:
2321         (WebCore::DocumentLoader::redirectReceived):
2322         (WebCore::DocumentLoader::willSendRequest):
2323         (WebCore::DocumentLoader::startLoadingMainResource):
2324         * loader/DocumentLoader.h:
2325
2326         * loader/FrameLoader.cpp:
2327         (WebCore::FrameLoader::init):
2328         (WebCore::FrameLoader::continueLoadAfterNavigationPolicy):
2329
2330 2018-04-13  Chris Dumez  <cdumez@apple.com>
2331
2332         input.webkitEntries does not work as expected when folder contains accented chars
2333         https://bugs.webkit.org/show_bug.cgi?id=184517
2334         <rdar://problem/39265537>
2335
2336         Reviewed by Alex Christensen.
2337
2338         Use String::fromUTF8() to construct a WTF String from the char* returned by
2339         dirname() in FileSystem::directoryName(). Previously, we were just calling
2340         the String constructor, which would treat the input as latin 1 instead of
2341         UTF-8.
2342
2343         Change is covered by an API test rather than a layout test due to file versioning
2344         limitations.
2345
2346         * platform/posix/FileSystemPOSIX.cpp:
2347         (WebCore::FileSystem::directoryName):
2348
2349 2018-04-13  Yusuke Suzuki  <utatane.tea@gmail.com>
2350
2351         [WebCore] Use @getByIdDirectPrivate / @putByIdDirectPrivate in WebCore JS
2352         https://bugs.webkit.org/show_bug.cgi?id=184401
2353
2354         Rubber stamped by Saam Barati.
2355
2356         Apply bug 183970 changes to WebCore JS too. This offers solid type checking
2357         with @getByIdDirectPrivate().
2358
2359         * Modules/mediastream/RTCPeerConnection.js:
2360         (initializeRTCPeerConnection):
2361         (getLocalStreams):
2362         (getStreamById):
2363         (addStream):
2364         * Modules/mediastream/RTCPeerConnectionInternals.js:
2365         (isRTCPeerConnection):
2366         * Modules/streams/ReadableByteStreamController.js:
2367         (enqueue):
2368         (error):
2369         (close):
2370         (getter.byobRequest):
2371         * Modules/streams/ReadableByteStreamInternals.js:
2372         (privateInitializeReadableStreamBYOBReader):
2373         (privateInitializeReadableByteStreamController):
2374         (privateInitializeReadableStreamBYOBRequest):
2375         (isReadableByteStreamController):
2376         (isReadableStreamBYOBRequest):
2377         (isReadableStreamBYOBReader):
2378         (readableByteStreamControllerCancel):
2379         (readableByteStreamControllerError):
2380         (readableByteStreamControllerClose):
2381         (readableByteStreamControllerClearPendingPullIntos):
2382         (readableByteStreamControllerGetDesiredSize):
2383         (readableStreamHasBYOBReader):
2384         (readableStreamHasDefaultReader):
2385         (readableByteStreamControllerHandleQueueDrain):
2386         (readableByteStreamControllerPull):
2387         (readableByteStreamControllerShouldCallPull):
2388         (readableByteStreamControllerCallPullIfNeeded):
2389         (readableByteStreamControllerEnqueue):
2390         (readableByteStreamControllerEnqueueChunk):
2391         (readableByteStreamControllerRespondWithNewView):
2392         (readableByteStreamControllerRespond):
2393         (readableByteStreamControllerRespondInternal):
2394         (readableByteStreamControllerRespondInReadableState):
2395         (readableByteStreamControllerRespondInClosedState):
2396         (readableByteStreamControllerProcessPullDescriptors):
2397         (readableByteStreamControllerFillDescriptorFromQueue):
2398         (readableByteStreamControllerShiftPendingDescriptor):
2399         (readableByteStreamControllerInvalidateBYOBRequest):
2400         (readableByteStreamControllerCommitDescriptor):
2401         (readableStreamFulfillReadIntoRequest):
2402         (readableByteStreamControllerPullInto):
2403         (readableStreamAddReadIntoRequest):
2404         * Modules/streams/ReadableStream.js:
2405         (initializeReadableStream):
2406         (pipeThrough):
2407         * Modules/streams/ReadableStreamBYOBReader.js:
2408         (cancel):
2409         (read):
2410         (releaseLock):
2411         (getter.closed):
2412         * Modules/streams/ReadableStreamBYOBRequest.js:
2413         (respond):
2414         (respondWithNewView):
2415         (getter.view):
2416         * Modules/streams/ReadableStreamDefaultController.js:
2417         (error):
2418         * Modules/streams/ReadableStreamDefaultReader.js:
2419         (cancel):
2420         (read):
2421         (releaseLock):
2422         (getter.closed):
2423         * Modules/streams/ReadableStreamInternals.js:
2424         (privateInitializeReadableStreamDefaultReader):
2425         (readableStreamReaderGenericInitialize):
2426         (readableStreamDefaultControllerError):
2427         (readableStreamPipeTo):
2428         (readableStreamTee):
2429         (isReadableStream):
2430         (isReadableStreamDefaultReader):
2431         (isReadableStreamDefaultController):
2432         (readableStreamError):
2433         (readableStreamDefaultControllerCallPullIfNeeded):
2434         (readableStreamDefaultControllerGetDesiredSize):
2435         (readableStreamReaderGenericCancel):
2436         (readableStreamCancel):
2437         (readableStreamDefaultControllerCancel):
2438         (readableStreamDefaultControllerPull):
2439         (readableStreamDefaultControllerClose):
2440         (readableStreamClose):
2441         (readableStreamFulfillReadRequest):
2442         (readableStreamDefaultReaderRead):
2443         (readableStreamAddReadRequest):
2444         (isReadableStreamDisturbed):
2445         (readableStreamReaderGenericRelease):
2446         (readableStreamDefaultControllerCanCloseOrEnqueue):
2447         (privateInitializeReadableStreamDefaultController): Deleted.
2448         * Modules/streams/StreamInternals.js:
2449         (validateAndNormalizeQueuingStrategy):
2450         * Modules/streams/WritableStream.js:
2451         (initializeWritableStream):
2452         (abort):
2453         (close):
2454         (write):
2455         (getter.closed):
2456         (getter.ready):
2457         (getter.state):
2458         * Modules/streams/WritableStreamInternals.js:
2459         (isWritableStream):
2460         (syncWritableStreamStateWithQueue):
2461         (errorWritableStream):
2462         (callOrScheduleWritableStreamAdvanceQueue):
2463         * bindings/js/JSDOMBindingInternals.js:
2464         (mapLikeForEach):
2465
2466 2018-04-12  Antoine Quint  <graouts@apple.com>
2467
2468         [Web Animations] Turn CSS Animations and CSS Transitions as Web Animations on by default
2469         https://bugs.webkit.org/show_bug.cgi?id=184569
2470         <rdar://problem/38671301>
2471
2472         Reviewed by Jon Lee.
2473
2474         We now set the CSS Animations and CSS Transitions as Web Animations flag on by default. To ensure that some remaining
2475         tests pass with this flag on, we expose a way to get to a PseudoElement via a new internals.pseudoElement() method. This
2476         allows tests that used internals.pauseAnimationAtTimeOnPseudoElement() and internals.pauseTransitionAtTimeOnPseudoElement()
2477         to now work with the Web Animations API.
2478
2479         * page/RuntimeEnabledFeatures.h:
2480         * testing/Internals.cpp:
2481         (WebCore::Internals::pseudoElement):
2482         * testing/Internals.h:
2483         * testing/Internals.idl:
2484
2485 2018-04-13  Sergio Villar Senin  <svillar@igalia.com>
2486
2487         [WebVR][OpenVR] Implement requestPresent()/exitPresent() and getLayers()
2488         https://bugs.webkit.org/show_bug.cgi?id=184530
2489
2490         Reviewed by Žan Doberšek.
2491
2492         WebVR apps should invoke requestPresent() to start presenting contents of a VRLayerInit
2493         (right now a HTML canvas with a WebGL context) on the VRDisplay. This request might fail for
2494         a variety of reasons and can be eventually cancelled with exitPresent(). Once we are
2495         presenting we could access the presenting layers (right now just one) with getLayers().
2496
2497         Note that we are not presenting anything to the HMD yet, that will be done later in a follow
2498         up patch.
2499
2500         I took the chance to correct a mistak in the VRDisplayCapabilities object which has a method
2501         that should be called maxLayers instead of maxLayer.
2502
2503         * Modules/webvr/VRDisplay.cpp:
2504         (WebCore::VRDisplay::requestPresent):
2505         (WebCore::VRDisplay::stopPresenting):
2506         (WebCore::VRDisplay::exitPresent):
2507         (WebCore::VRDisplay::getLayers const):
2508         (WebCore::VRDisplay::isPresenting const): Deleted. Implemented in the header file.
2509         * Modules/webvr/VRDisplay.h:
2510         (WebCore::VRDisplay::isPresenting const):
2511         * Modules/webvr/VRDisplayCapabilities.h:
2512         (WebCore::VRDisplayCapabilities::maxLayers const): Renamed from maxLayer().
2513         (WebCore::VRDisplayCapabilities::maxLayer const): Deleted.
2514         * Modules/webvr/VRDisplayCapabilities.idl:
2515
2516 2018-04-13  Miguel Gomez  <magomez@igalia.com>
2517
2518         REGRESSION(r230627): [GTK][WPE] Possible deadlock when destroying the player in non AC mode
2519         https://bugs.webkit.org/show_bug.cgi?id=184583
2520
2521         Reviewed by Carlos Garcia Campos.
2522
2523         In non AC mode, ensure that a deadlock can't happen when destroying MediaPlayerPrivateGStreamerBase.
2524
2525         Covered by existent tests.
2526
2527         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp:
2528         (WebCore::MediaPlayerPrivateGStreamerBase::~MediaPlayerPrivateGStreamerBase):
2529         (WebCore::MediaPlayerPrivateGStreamerBase::triggerRepaint):
2530         (WebCore::MediaPlayerPrivateGStreamerBase::cancelRepaint):
2531         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.h:
2532
2533 2018-04-13  Miguel Gomez  <magomez@igalia.com>
2534
2535         [GTK] [gstreamer] video won't unpause when built with -DUSE_GSTREAMER_GL=OFF
2536         https://bugs.webkit.org/show_bug.cgi?id=183362
2537
2538         Reviewed by Carlos Garcia Campos.
2539
2540         Remove the drawCancelled flag and use a new one to indicate that the player is being destroyed.
2541         That new flag is only enabled on destruction and it's not modified by cancelRepaint(), which
2542         can be used to handle the pause event without avoiding future renderings. Also cancelRepaint()
2543         has only effect when not in AC mode.
2544
2545         Covered by existent tests.
2546
2547         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp:
2548         (WebCore::MediaPlayerPrivateGStreamerBase::~MediaPlayerPrivateGStreamerBase):
2549         (WebCore::MediaPlayerPrivateGStreamerBase::triggerRepaint):
2550         (WebCore::MediaPlayerPrivateGStreamerBase::cancelRepaint):
2551         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.h:
2552
2553 2018-04-13  Xabier Rodriguez Calvar  <calvaris@igalia.com>
2554
2555         [GStreamer] Convert GStreamerUtilities in GStreamerCommon and include the GStreamer smart pointer traits
2556         https://bugs.webkit.org/show_bug.cgi?id=184533
2557
2558         Reviewed by Philippe Normand.
2559
2560         Renamed GStreamerUtilities* files into GStreamerCommon* and
2561         modified files including them accordingly. Include
2562         GRefPtrGStreamer.h and GUniquePtrGStreamer.h in GStreamerCommon.h
2563         to avoid problems destroying objects when those files are
2564         forgotten to be included.
2565
2566         * Modules/webaudio/AudioContext.cpp:
2567         * platform/GStreamer.cmake:
2568         * platform/audio/gstreamer/WebKitWebAudioSourceGStreamer.cpp:
2569         * platform/graphics/gstreamer/AudioTrackPrivateGStreamer.h:
2570         * platform/graphics/gstreamer/GStreamerCommon.cpp: Renamed from Source/WebCore/platform/graphics/gstreamer/GStreamerUtilities.cpp.
2571         * platform/graphics/gstreamer/GStreamerCommon.h: Renamed from Source/WebCore/platform/graphics/gstreamer/GStreamerUtilities.h.
2572         * platform/graphics/gstreamer/ImageGStreamer.h:
2573         * platform/graphics/gstreamer/ImageGStreamerCairo.cpp:
2574         * platform/graphics/gstreamer/InbandTextTrackPrivateGStreamer.cpp:
2575         * platform/graphics/gstreamer/InbandTextTrackPrivateGStreamer.h:
2576         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:
2577         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.h:
2578         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp:
2579         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.h:
2580         * platform/graphics/gstreamer/MediaSampleGStreamer.cpp:
2581         * platform/graphics/gstreamer/MediaSampleGStreamer.h:
2582         * platform/graphics/gstreamer/TextCombinerGStreamer.cpp:
2583         * platform/graphics/gstreamer/TrackPrivateBaseGStreamer.cpp:
2584         * platform/graphics/gstreamer/TrackPrivateBaseGStreamer.h:
2585         * platform/graphics/gstreamer/VideoSinkGStreamer.cpp:
2586         * platform/graphics/gstreamer/VideoTrackPrivateGStreamer.h:
2587         * platform/graphics/gstreamer/WebKitWebSourceGStreamer.cpp:
2588         * platform/graphics/gstreamer/eme/GStreamerEMEUtilities.cpp:
2589         * platform/graphics/gstreamer/eme/GStreamerEMEUtilities.h:
2590         * platform/graphics/gstreamer/eme/WebKitClearKeyDecryptorGStreamer.cpp:
2591         * platform/graphics/gstreamer/eme/WebKitCommonEncryptionDecryptorGStreamer.cpp:
2592         * platform/graphics/gstreamer/mse/AppendPipeline.cpp:
2593         * platform/graphics/gstreamer/mse/AppendPipeline.h:
2594         * platform/graphics/gstreamer/mse/GStreamerMediaDescription.cpp:
2595         * platform/graphics/gstreamer/mse/GStreamerMediaDescription.h:
2596         * platform/graphics/gstreamer/mse/MediaPlayerPrivateGStreamerMSE.cpp:
2597         * platform/graphics/gstreamer/mse/MediaPlayerPrivateGStreamerMSE.h:
2598         * platform/graphics/gstreamer/mse/MediaSourceClientGStreamerMSE.h:
2599         * platform/graphics/gstreamer/mse/PlaybackPipeline.cpp:
2600         * platform/graphics/gstreamer/mse/SourceBufferPrivateGStreamer.cpp:
2601         * platform/graphics/gstreamer/mse/WebKitMediaSourceGStreamer.cpp:
2602         * platform/graphics/gstreamer/mse/WebKitMediaSourceGStreamer.h:
2603
2604 2018-04-12  Christopher Reid  <chris.reid@sony.com>
2605
2606         [Curl] Fix clang build error in CurlContext.cpp
2607         https://bugs.webkit.org/show_bug.cgi?id=184561
2608
2609         Reviewed by Darin Adler.
2610
2611         MSVC allows explicit template specialization in classes but gcc/clang do not.
2612
2613         * platform/network/curl/CurlContext.cpp:
2614
2615 2018-04-12  Christopher Reid  <chris.reid@sony.com>
2616
2617         [Curl] Cookie Database on memory path should be :memory:
2618         https://bugs.webkit.org/show_bug.cgi?id=184572
2619
2620         Reviewed by Alex Christensen.
2621
2622         CookieJarDB::isOnMemory is comparing the database path with :onmemory: but it should be using :memory:
2623         For reference, see: https://www.sqlite.org/inmemorydb.html
2624
2625         * platform/network/curl/CookieJarDB.h:
2626
2627 2018-04-12  Daniel Bates  <dabates@apple.com>
2628
2629         Attmept to fix the Windows build following <https://trac.webkit.org/changeset/230602/>
2630         (https://bugs.webkit.org/show_bug.cgi?id=184386)
2631
2632         Visual Studio cannot prove that all cases in the switch are covered :(
2633         So, add an ASSERT_NOT_REACHED() and a return a value outside of the switch block. 
2634
2635         * loader/cache/CachedResourceLoader.cpp:
2636         (WebCore::destinationForType):
2637
2638 2018-04-12  Chris Dumez  <cdumez@apple.com>
2639
2640         Introduce remote variants of Frame / DOMWindow classes
2641         https://bugs.webkit.org/show_bug.cgi?id=184467
2642         <rdar://problem/39011267>
2643
2644         Reviewed by Ryosuke Niwa.
2645
2646         Introduce remote variants of Frame / DOMWindow classes, for when these frames / windows
2647         are hosted on another WebProcess. Those will be used in a follow-up patch.
2648
2649         The hierarchy is as follows (class naming will be improved in a follow-up patch to minimise
2650         patch size):
2651         - AbstractFrame: A frame that can be either local or remote (hosted on another WebProcess)
2652             - Frame: A local frame
2653             - RemoteFrame: A frame hosted on another WebProcess. A RemoteFrame's window is also remote.
2654         - AbstractDOMWindow: A window that be either local or remote (hosted on another WebProcess)
2655             - DOMWindow: A local DOMWindow
2656             - RemoteDOMWindow: A window hosted on another WebProcess. A RemoteDOMWindow's frame is also
2657               remote. A RemoteDOMWindow is always cross-origin.
2658
2659         This patch introduces global identifiers (unique across all WebProcesses) for both Frames and
2660         Windows. This is useful as we need to know which Frame / DOMWindow a particular RemoteFrame /
2661         RemoteDOMWindow is pointing to.
2662
2663         Follow-up patch will add support for converting a local DOMWindow / Frame into a remote ones,
2664         when a newly opened window (via window.open) is navigated cross-origin (Bug 184515).
2665
2666         Other things we'll need to implement in follow-ups:
2667         - RemoteDOMWindow will need to know about its opener in order to support the window.opener
2668           API. Internally, the opener will be stored as a RemoteFrame so that window.opener always
2669           returns the current window in the opener frame (which changes upon navigation).
2670         - Nullify a RemoteDOMWindow's frame whenever the window it is pointing to becomes frameless.
2671           A frameless window behaves very differently (e.g. very little API is exposed to the Web).
2672           This happens when either the newly opened window is either closed or navigated.
2673
2674         * Sources.txt:
2675         * WebCore.xcodeproj/project.pbxproj:
2676         * loader/ContentFilter.cpp:
2677         (WebCore::ContentFilter::didDecide):
2678         * page/AbstractDOMWindow.cpp: Added.
2679         (WebCore::AbstractDOMWindow::AbstractDOMWindow):
2680         (WebCore::AbstractDOMWindow::~AbstractDOMWindow):
2681         * page/AbstractDOMWindow.h: Added.
2682         (WebCore::AbstractDOMWindow::identifier const):
2683         * page/AbstractFrame.cpp: Added.
2684         (WebCore::AbstractFrame::AbstractFrame):
2685         (WebCore::AbstractFrame::~AbstractFrame):
2686         * page/AbstractFrame.h: Added.
2687         (WebCore::AbstractFrame::window const):
2688         * page/DOMWindow.cpp:
2689         (WebCore::DOMWindow::DOMWindow):
2690         * page/DOMWindow.h:
2691         (isType):
2692         * page/Frame.cpp:
2693         (WebCore::Frame::window const):
2694         (WebCore::Frame::virtualWindow const):
2695         * page/Frame.h:
2696         (isType):
2697         * page/GlobalFrameIdentifier.h: Added.
2698         (WebCore::GlobalFrameIdentifier::encode const):
2699         (WebCore::GlobalFrameIdentifier::decode):
2700         * page/GlobalWindowIdentifier.h: Added.
2701         (WebCore::operator==):
2702         (WebCore::GlobalWindowIdentifier::hash const):
2703         (WebCore::GlobalWindowIdentifier::encode const):
2704         (WebCore::GlobalWindowIdentifier::decode):
2705         (WTF::GlobalWindowIdentifierHash::hash):
2706         (WTF::GlobalWindowIdentifierHash::equal):
2707         (WTF::HashTraits<WebCore::GlobalWindowIdentifier>::emptyValue):
2708         (WTF::HashTraits<WebCore::GlobalWindowIdentifier>::constructDeletedValue):
2709         (WTF::HashTraits<WebCore::GlobalWindowIdentifier>::isDeletedValue):
2710
2711         * page/RemoteDOMWindow.cpp: Added.
2712         (WebCore::RemoteDOMWindow::RemoteDOMWindow):
2713         (WebCore::RemoteDOMWindow::~RemoteDOMWindow):
2714         (WebCore::RemoteDOMWindow::self const):
2715         (WebCore::RemoteDOMWindow::location const):
2716         (WebCore::RemoteDOMWindow::close):
2717         (WebCore::RemoteDOMWindow::closed const):
2718         (WebCore::RemoteDOMWindow::focus):
2719         (WebCore::RemoteDOMWindow::blur):
2720         (WebCore::RemoteDOMWindow::length const):
2721         (WebCore::RemoteDOMWindow::top const):
2722         (WebCore::RemoteDOMWindow::opener const):
2723         (WebCore::RemoteDOMWindow::parent const):
2724         (WebCore::RemoteDOMWindow::postMessage):
2725         The DOM API exposed on RemoteDOMWindow is only the subset of the DOMWindow API that is exposed cross origin,
2726         since remote DOMWindow are always from a different origin. The short-term plan is to implement these in a
2727         follow-up by relying on IPC (synchronous when necessary) to fetch the information from the real window in
2728         the WebProcess where it lives. Longer term, we should probably keep RemoteDOMWindow members in sync with the
2729         DOMWindow they're pointing to, so we do not have to rely on synchronous IPC.
2730
2731         * page/RemoteDOMWindow.h: Added.
2732         (isType):
2733         * page/RemoteFrame.cpp: Added.
2734         (WebCore::RemoteFrame::RemoteFrame):
2735         (WebCore::RemoteFrame::~RemoteFrame):
2736         (WebCore::RemoteFrame::virtualWindow const):
2737         * page/RemoteFrame.h: Added.
2738         (isType):
2739
2740 2018-04-12  Daniel Bates  <dabates@apple.com>
2741
2742         Content-Type not enforced for <script> allows for XSS
2743         https://bugs.webkit.org/show_bug.cgi?id=184386
2744         <rdar://problem/39112268>
2745
2746         Reviewed by Brady Eidson.
2747
2748         As per the Fetch standard, <https://fetch.spec.whatwg.org/#should-response-to-request-be-blocked-due-to-mime-type?> (16 March 2018),
2749         we should block JavaScript scripts that are served with MIME type text/csv, or a MIME type
2750         that begins with "audio/", "image/" or "video/".
2751
2752         As a side benefit of this change we now set the destination property [1] on preload requests.
2753
2754         [1] <https://fetch.spec.whatwg.org/#concept-request-destination>
2755
2756         Tests: http/tests/security/script-with-banned-mimetype.html
2757                http/tests/workers/worker-importScripts-banned-mimetype.html
2758
2759         * Sources.txt: Add file FetchIdioms.cpp.
2760         * WebCore.xcodeproj/project.pbxproj: Add files FetchIdioms.{cpp, h}.
2761         * dom/LoadableClassicScript.cpp:
2762         (WebCore::LoadableClassicScript::notifyFinished): Check the MIME type of the response and
2763         block the script if applicable.
2764         * dom/LoadableScript.h: Add error type MIMEType.
2765         * loader/FetchIdioms.cpp: Added.
2766         (WebCore::shouldBlockResponseDueToMIMEType): Implements the "Should response to request be blocked
2767         due to its MIME type?" algorithm from the Fetch standard.
2768         * loader/FetchIdioms.h: Added.
2769         * loader/FetchOptions.h:
2770         (WebCore::isScriptLikeDestination): Implements the definition of "script like" as per <https://fetch.spec.whatwg.org/#request-destination-script-like>.
2771         * loader/cache/CachedResourceLoader.cpp:
2772         (WebCore::CachedResourceLoader::requestImage): Removed logic to set the destination property as
2773         CachedResourceLoader::requestResource() is now responsible for doing this.
2774         (WebCore::CachedResourceLoader::requestFont): Ditto.
2775         (WebCore::CachedResourceLoader::requestTextTrack): Ditto.
2776         (WebCore::CachedResourceLoader::requestCSSStyleSheet): Ditto.
2777         (WebCore::CachedResourceLoader::requestScript): Ditto.
2778         (WebCore::CachedResourceLoader::requestXSLStyleSheet): Ditto.
2779         (WebCore::CachedResourceLoader::requestMedia): Update comment to express that we should assert
2780         that the destination property is either video or audio.
2781         (WebCore::CachedResourceLoader::requestIcon): Remove logic to set the destination property as
2782         CachedResourceLoader::requestResource() is now responsible for doing this.
2783         (WebCore::CachedResourceLoader::requestRawResource): Removed assertion as this function is used to
2784         load many kinds of requests that have different destination properties. The caller is responsible
2785         for setting the appropriate destintion property.
2786         (WebCore::CachedResourceLoader::requestMainResource): Remove logic to set the destination property
2787         as CachedResourceLoader::requestResource() is now responsible for doing this.
2788         (WebCore::destinationForType): Helper function that maps CachedResource::Type to FetchOptions::Destination.
2789         (WebCore::CachedResourceLoader::requestResource): Set the destination property on the request if not
2790         already set.
2791         * loader/cache/CachedResourceLoader.h: Segregate requestRawResource() from the other request functions
2792         and add a comment to explain what it is used for.
2793         * workers/Worker.cpp:
2794         (WebCore::Worker::create):
2795         * workers/WorkerScriptLoader.cpp:
2796         (WebCore::WorkerScriptLoader::loadSynchronously): Set the destination property to FetchOptions::Destination::Script
2797         and store it in an instance variable as we will need to reference it once we receive the HTTP response.
2798         Note that this function is only used to support the Web API importScripts().
2799         (WebCore::WorkerScriptLoader::loadAsynchronously): Store the passed destination property in an
2800         instance as we will need to reference it once we receive the HTTP response.
2801         (WebCore::WorkerScriptLoader::didReceiveResponse): Check the MIME type of the response and
2802         block the script if applicable.
2803         * workers/WorkerScriptLoader.h:
2804         * workers/service/ServiceWorkerJob.cpp:
2805         (WebCore::ServiceWorkerJob::fetchScriptWithContext): Set the destination property to FetchOptions::Destination::Serviceworker.
2806
2807 2018-04-12  Antoine Quint  <graouts@apple.com>
2808
2809         [Web Animations] Fix a host of small CSS Animations and CSS Transitions issues
2810         https://bugs.webkit.org/show_bug.cgi?id=184555
2811
2812         Reviewed by Dean Jackson.
2813
2814         A series of small and intertwined issues were preventing a number of CSS Animations and CSS Trantions
2815         tests to fail when expressed as Web Animations.
2816
2817         * animation/AnimationTimeline.cpp:
2818         (WebCore::AnimationTimeline::updateCSSAnimationsForElement): Pass the old and new RenderStyles to CSSAnimation::create()
2819         since we're refactoring DeclarativeAnimation to create blending keyframes in initialize(), no longer requiring each subclass
2820         to create them.
2821         (WebCore::AnimationTimeline::cssAnimationForElementAndProperty): Return the animation, if any, for a property animated by
2822         a CSS animation, so that we can determine if a property is already being animated when running a CSS Transition.
2823         (WebCore::AnimationTimeline::updateCSSTransitionsForElement): Since a property can be specified twice in a "transition" property,
2824         once via "all" and once explicitly, ensure we look at all currently running transitions for the currently-processed property to
2825         see if we need to cancel this transition. Previously, we used to only see if it had been transitioned in the old style. We also
2826         start transitions even if the duration is 0 provided the delay is a positive, non-zero value. Then, if there is a CSS Animation
2827         for this property already running, use that animation's original unanimated style as the from value.
2828         * animation/AnimationTimeline.h:
2829         * animation/CSSAnimation.cpp:
2830         (WebCore::CSSAnimation::create): The animation name is now set in the CSSAnimation constructor.
2831         (WebCore::CSSAnimation::CSSAnimation): Set the animation name and keep a copy of the unanimated style such that we can
2832         get it when a CSS Transition is created and takes precedence over this CSS Animation.
2833         (WebCore::CSSAnimation::initialize): Deleted.
2834         * animation/CSSAnimation.h:
2835         * animation/CSSTransition.cpp:
2836         (WebCore::CSSTransition::create):
2837         (WebCore::CSSTransition::initialize):
2838         * animation/CSSTransition.h:
2839         * animation/DeclarativeAnimation.cpp:
2840         (WebCore::DeclarativeAnimation::initialize): Call the new computeDeclarativeAnimationBlendingKeyframes() on the KeyframeEffect
2841         directly in this method so that subclasses don't need to create it manually, but most important so that keyframes are created
2842         before timing properties are set based on the backing animation.
2843         * animation/DeclarativeAnimation.h:
2844         * animation/KeyframeEffectReadOnly.cpp:
2845         (WebCore::KeyframeEffectReadOnly::getKeyframes): Ensure we have a CSSValue before trying to serialize it.
2846         (WebCore::KeyframeEffectReadOnly::computeDeclarativeAnimationBlendingKeyframes):
2847         (WebCore::KeyframeEffectReadOnly::computeCSSAnimationBlendingKeyframes): Use the animation's unanimated style to compute keyframes,
2848         instead of a default RenderStyle which would not use the right values for implicit keyframes.
2849         (WebCore::KeyframeEffectReadOnly::stylesWouldYieldNewCSSTransitionsBlendingKeyframes const): Look at the property used to create
2850         the transition rather than that specified on the backing Animation object since it can be CSSPropertyInvalid in the case of
2851         "transition: all".
2852         (WebCore::KeyframeEffectReadOnly::setAnimatedPropertiesInStyle): If we're dealing with a CSS animation, we consider the first and
2853         last keyframes to always have the property listed since the underlying style was provided and should be captured.
2854         * animation/KeyframeEffectReadOnly.h:
2855         * style/StyleTreeResolver.cpp:
2856         (WebCore::Style::TreeResolver::createAnimatedElementUpdate): Apply CSS Animations after CSS Trasitions since they take precedence.
2857
2858 2018-04-12  Antoine Quint  <graouts@apple.com>
2859
2860         [Web Animations] Only cancel declarative animations upon element removal
2861         https://bugs.webkit.org/show_bug.cgi?id=184553
2862
2863         Reviewed by Dean Jackson.
2864
2865         Ensure we only call cancel() on CSSAnimation and CSSTransition objects as we might otherwise reject
2866         the ready promise and produce spurious logging from WPT tests.
2867
2868         * animation/AnimationTimeline.cpp:
2869         (WebCore::AnimationTimeline::cancelDeclarativeAnimationsForElement):
2870         (WebCore::AnimationTimeline::cancelAnimationsForElement): Deleted.
2871         * animation/AnimationTimeline.h:
2872         * dom/Element.cpp:
2873         (WebCore::Element::removedFromAncestor):
2874         * dom/PseudoElement.cpp:
2875         (WebCore::PseudoElement::clearHostElement):
2876         * rendering/updating/RenderTreeUpdater.cpp:
2877         (WebCore::RenderTreeUpdater::tearDownRenderers):
2878
2879 2018-04-12  Ryan Haddad  <ryanhaddad@apple.com>
2880
2881         Unreviewed, rolling out r230554.
2882
2883         The non-ASCII character in the filename causes issues with SVN
2884
2885         Reverted changeset:
2886
2887         "input.webkitEntries does not work as expected when folder
2888         contains accented chars"
2889         https://bugs.webkit.org/show_bug.cgi?id=184517
2890         https://trac.webkit.org/changeset/230554
2891
2892 2018-04-12  Alicia Boya García  <aboya@igalia.com>
2893
2894         [MSE] Add isValid() assertions on PlatformTimeRanges::add() range ends
2895         https://bugs.webkit.org/show_bug.cgi?id=180253
2896
2897         Right now it's checked that start <= end but it's not checked that
2898         neither of them is undefined.
2899
2900         When this happens, the bug can be hard to track down.
2901
2902         The assertion is not enabled for Mac because there is currently a test
2903         that is hitting it.
2904
2905         Reviewed by Jer Noble.
2906
2907         * platform/graphics/PlatformTimeRanges.cpp:
2908         (WebCore::PlatformTimeRanges::add):
2909
2910 2018-04-12  Chris Dumez  <cdumez@apple.com>
2911
2912         Process::setIdentifier() / Process::identifier() do not need a lock
2913         https://bugs.webkit.org/show_bug.cgi?id=184544
2914
2915         Reviewed by Brady Eidson.
2916
2917         Process::setIdentifier() / Process::identifier() do not need a lock.
2918         Process::setIdentifier() gets called in ChildProcess::initialize(),
2919         before we start any background threads. It is then safe to query
2920         this process identifier later on from background threads without
2921         locks.
2922
2923         * platform/Process.cpp:
2924         (WebCore::Process::setIdentifier):
2925         (WebCore::Process::identifier):
2926
2927 2018-04-12  Antoine Quint  <graouts@apple.com>
2928
2929         Unreviewed, fix the Windows build.
2930
2931         * animation/DocumentTimeline.cpp:
2932         (WebCore::DocumentTimeline::computeExtentOfAnimation const):
2933
2934 2018-04-12  Antoine Quint  <graouts@apple.com>
2935
2936         [Web Animations] Suspend animations when required
2937         https://bugs.webkit.org/show_bug.cgi?id=184541
2938
2939         Reviewed by Jon Lee.
2940
2941         Animations managed by CSSAnimationController get suspended under a number of scenarios, we now add the possibility
2942         to suspend animations on a DocumentTimeline as well such that Web Animations and CSS Animations and CSS Transitions
2943         implemented as Web Animations get suspended under the same conditions as well. We also update the implementation for
2944         Internals::numberOfActiveAnimations() such that tests checking that animations get suspended pass.
2945
2946         * animation/DocumentTimeline.cpp:
2947         (WebCore::DocumentTimeline::suspendAnimations): When asked to be suspended, the DocumentTimeline cancels pending
2948         invalidation tasks and updates all of the animations it manages, including those running on the compositor.
2949         (WebCore::DocumentTimeline::resumeAnimations): When asked to be resumed, the DocumentTimeline resumes animations
2950         it manages and rewinds its invalidation timer.
2951         (WebCore::DocumentTimeline::animationsAreSuspended):
2952         (WebCore::DocumentTimeline::numberOfActiveAnimationsForTesting const): Called by Internals::numberOfActiveAnimations(),
2953         this returns the number of animations managed by this timeline that are not suspended.
2954         (WebCore::DocumentTimeline::currentTime):
2955         (WebCore::DocumentTimeline::timingModelDidChange): Ensure the invalidation timer is not rewound if the timeline
2956         is suspended.
2957         * animation/DocumentTimeline.h:
2958         * animation/WebAnimation.cpp:
2959         (WebCore::WebAnimation::setTimeline): When moving to a new timeline, ensure we match the new timeline's animation state.
2960         (WebCore::WebAnimation::setSuspended): Toggle the accelerated running state of any backing hardware animations when
2961         the suspension state of an animation changes.
2962         * animation/WebAnimation.h:
2963         (WebCore::WebAnimation::isSuspended const):
2964         * dom/Document.cpp:
2965         (WebCore::Document::didBecomeCurrentDocumentInFrame):
2966         (WebCore::Document::resume):
2967         * dom/Document.h:
2968         * history/CachedFrame.cpp:
2969         (WebCore::CachedFrameBase::restore):
2970         * page/Frame.cpp:
2971         (WebCore::Frame::clearTimers):
2972         * page/Page.cpp:
2973         (WebCore::Page::setIsVisibleInternal):
2974         (WebCore::Page::hiddenPageCSSAnimationSuspensionStateChanged):
2975         * testing/Internals.cpp:
2976         (WebCore::Internals::numberOfActiveAnimations const):
2977         (WebCore::Internals::animationsAreSuspended const):
2978         (WebCore::Internals::suspendAnimations const):
2979         (WebCore::Internals::resumeAnimations const):
2980
2981 2018-04-12  Antoine Quint  <graouts@apple.com>
2982
2983         [Web Animations] Throttle animations when lowPowerMode is on
2984         https://bugs.webkit.org/show_bug.cgi?id=184540
2985
2986         Reviewed by Jon Lee.
2987
2988         Ensure animations are sampled at a lower frequency when lowPowerMode is on.
2989
2990         * animation/DocumentTimeline.cpp:
2991         (WebCore::DocumentTimeline::updateThrottlingState):
2992         (WebCore::DocumentTimeline::animationInterval const):
2993         (WebCore::DocumentTimeline::updateAnimationSchedule):
2994         (WebCore::DocumentTimeline::scheduleAnimationResolution):
2995         * animation/DocumentTimeline.h:
2996         * page/Page.cpp:
2997         (WebCore::Page::handleLowModePowerChange):
2998         * testing/Internals.cpp:
2999         (WebCore::Internals::animationsInterval const):
3000
3001 2018-04-12  Antoine Quint  <graouts@apple.com>
3002
3003         [Web Animations] Ensure elements overlapping with elements animating also get composited
3004         https://bugs.webkit.org/show_bug.cgi?id=184539
3005
3006         Reviewed by Jon Lee.
3007
3008         A number of compositing tests failed because we didn't call into the Web Animations engine while various calls
3009         on RenderLayer and RenderLayerBacking were made. We bring the functionality over from CSSAnimationController to
3010         DocumentTimeline and KeyframeAnimation to KeyframeEffectReadOnly.
3011
3012         * animation/AnimationTimeline.cpp:
3013         (WebCore::AnimationTimeline::animationsForElement const): Update this method's signature to be const since it
3014         should be callable by other const method.
3015         (WebCore::AnimationTimeline::animationsForElement): Deleted.
3016         * animation/AnimationTimeline.h:
3017         * animation/DocumentTimeline.cpp:
3018         (WebCore::DocumentTimeline::computeExtentOfAnimation const): Adapt this method from CSSAnimationController.
3019         (WebCore::DocumentTimeline::isRunningAnimationOnRenderer const): Adapt this method from CSSAnimationController.
3020         (WebCore::DocumentTimeline::isRunningAcceleratedAnimationOnRenderer const): Adapt this method from CSSAnimationController.
3021         * animation/DocumentTimeline.h:
3022         * animation/KeyframeEffectReadOnly.cpp:
3023         (WebCore::KeyframeEffectReadOnly::computeExtentOfTransformAnimation const): Bring this method over from KeyframeAnimation.
3024         (WebCore::containsRotation): Bring this method over from KeyframeAnimation.
3025         (WebCore::KeyframeEffectReadOnly::computeTransformedExtentViaTransformList const): Bring this method over from KeyframeAnimation.
3026         (WebCore::KeyframeEffectReadOnly::computeTransformedExtentViaMatrix const): Bring this method over from KeyframeAnimation.
3027         * animation/KeyframeEffectReadOnly.h:
3028         (WebCore::KeyframeEffectReadOnly::animatedProperties const): DocumentTimeline::computeExtentOfAnimation() needs to get a list
3029         of all animated properties to see if a transform is animated, so we now expose such a list.
3030         * rendering/RenderLayer.cpp:
3031         (WebCore::RenderLayer::currentTransform const): Update this method to call into DocumentTimeline if the CSS Animations
3032         and CSS Transitions as Web Animations flag is on.
3033         (WebCore::RenderLayer::calculateClipRects const): Update this method to call into DocumentTimeline if the CSS Animations
3034         and CSS Transitions as Web Animations flag is on.
3035         * rendering/RenderLayerBacking.cpp:
3036         (WebCore::RenderLayerBacking::updateGeometry): Update this method to call into DocumentTimeline if the CSS Animations
3037         and CSS Transitions as Web Animations flag is on.
3038         * rendering/RenderLayerCompositor.cpp:
3039         (WebCore::RenderLayerCompositor::isRunningTransformAnimation const): Update this method to call into DocumentTimeline
3040         if the CSS Animations and CSS Transitions as Web Animations flag is on.
3041         * rendering/RenderObject.h:
3042         (WebCore::RenderObject::documentTimeline const):
3043
3044 2018-04-11  Antoine Quint  <graouts@apple.com>
3045
3046         [Web Animations] Enable seeking for hardware animations
3047         https://bugs.webkit.org/show_bug.cgi?id=184518
3048
3049         Reviewed by Dean Jackson.
3050
3051         Hardware animations had lagged behind software animations in support and this patch bring their respective level
3052         of support closer to one another. Importantly, we add the ability to seek an animation added to a GraphicsLayerCA
3053         since many tests pause and seek animations to test their state. Animations may also have their playback state changed
3054         along with their current time in the same run loop, so we now maintain a list of pending processing actions for
3055         hardware animations.
3056
3057         * animation/DocumentTimeline.cpp:
3058         (WebCore::DocumentTimeline::updateAnimationSchedule): If we have animations queued up for updates to their accelerated
3059         state we can schedule animation resolution immediately since we've already established we'll have work to do.
3060         (WebCore::DocumentTimeline::updateAnimations): Factor the updates of pending accelerated animations out in a dedicated
3061         method.
3062         (WebCore::DocumentTimeline::applyPendingAcceleratedAnimations): Go through all pending accelerated animations and update
3063         their state.
3064         * animation/KeyframeEffectReadOnly.cpp:
3065         (WebCore::KeyframeEffectReadOnly::setBlendingKeyframes): Update the m_shouldRunAccelerated flag when setting blending keyframes.
3066         (WebCore::KeyframeEffectReadOnly::apply): Ensure we finish accelerated animations if the progress is 1 or null (no longer active).
3067         start accelerated animations if the animation is starting and always resolve styles in software as well to ensure that
3068         hit testing will work as expected.
3069         (WebCore::KeyframeEffectReadOnly::computeShouldRunAccelerated):
3070         (WebCore::KeyframeEffectReadOnly::animationPlayStateDidChange): Called by WebAnimation when play() or pause() is called
3071         with the appropriate flag.
3072         (WebCore::KeyframeEffectReadOnly::animationDidSeek): Called by WebAnimation when the currentTime property is set.
3073         (WebCore::KeyframeEffectReadOnly::addPendingAcceleratedAction): Add the provided action to the list of pending accelerated
3074         actions and notify the animation that the accelerated state needs changing.
3075         (WebCore::KeyframeEffectReadOnly::applyPendingAcceleratedActions): Called by DocumentTimeline, through WebAnimation, to apply
3076         all pending accelerated actions.
3077         (WebCore::KeyframeEffectReadOnly::backingAnimationForCompositedRenderer const): If we're dealing with a declarative animation,
3078         we already have a backing Animation object, so use it directly. Otherwise, create one and ensure it reflects all timing properties
3079         for the animation.
3080         (WebCore::KeyframeEffectReadOnly::shouldRunAccelerated): Deleted.
3081         (WebCore::KeyframeEffectReadOnly::startOrStopAccelerated): Deleted.
3082         * animation/WebAnimation.cpp:
3083         (WebCore::WebAnimation::setCurrentTime): Call animationDidSeek() on the effect to ensure its accelerated animation gets seeked.
3084         (WebCore::WebAnimation::play): Call animationPlayStateDidChange() on the effect to ensure its accelerated animation is started or resumed.
3085         (WebCore::WebAnimation::pause): Call animationPlayStateDidChange() on the effect to ensure its accelerated animation gets paused.
3086         (WebCore::WebAnimation::acceleratedStateDidChange): 
3087         (WebCore::WebAnimation::applyPendingAcceleratedActions):
3088         (WebCore::WebAnimation::acceleratedRunningStateDidChange): Deleted.
3089         (WebCore::WebAnimation::startOrStopAccelerated): Deleted.
3090         * platform/graphics/GraphicsLayer.h:
3091         (WebCore::GraphicsLayer::seekAnimation):
3092         * platform/graphics/ca/GraphicsLayerCA.cpp:
3093         (WebCore::GraphicsLayerCA::addProcessingActionForAnimation): Add an AnimationProcessingAction to the list of such actions for a
3094         given animation name. In case we already have a Remove action, we ignore the action since the hardware animation will have been
3095         removed by the time we try to apply this processing action.
3096         (WebCore::GraphicsLayerCA::pauseAnimation): Add a Pause processing action.
3097         (WebCore::GraphicsLayerCA::seekAnimation): Add a Seek processing action.
3098         (WebCore::GraphicsLayerCA::removeAnimation): Add a Remove processing action.
3099         (WebCore::GraphicsLayerCA::updateAnimations): First ensure that all animations pending commit are committed and then update
3100         all animations based on the actions added through addProcessingActionForAnimation().
3101         (WebCore::GraphicsLayerCA::seekCAAnimationOnLayer): Generate a new animation based on the new seek time provided.
3102         * platform/graphics/ca/GraphicsLayerCA.h:
3103         (WebCore::GraphicsLayerCA::AnimationProcessingAction::AnimationProcessingAction):
3104         * rendering/RenderBoxModelObject.cpp:
3105         (WebCore::RenderBoxModelObject::animationSeeked):
3106         * rendering/RenderLayerBacking.cpp:
3107         (WebCore::RenderLayerBacking::animationSeeked):
3108         * rendering/RenderLayerCompositor.cpp:
3109         (WebCore::RenderLayerCompositor::requiresCompositingForAnimation const): Fix an issue where we would run the CSSAnimationController
3110         logic even when the legacy animation engine was disabled.
3111
3112 2018-04-12  Xabier Rodriguez Calvar  <calvaris@igalia.com>
3113
3114         Unreviewed, fix GStreamer builds
3115
3116         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:
3117         (WebCore::MediaPlayerPrivateGStreamer::handleMessage): We were
3118         passing a String to a GST_WARNING call.
3119
3120 2018-04-11  Chris Dumez  <cdumez@apple.com>
3121
3122         input.webkitEntries does not work as expected when folder contains accented chars
3123         https://bugs.webkit.org/show_bug.cgi?id=184517
3124         <rdar://problem/39265537>
3125
3126         Reviewed by Ryosuke Niwa.
3127
3128         Use String::fromUTF8() to construct a WTF String from the char* returned by
3129         dirname() in FileSystem::directoryName(). Previously, we were just calling
3130         the String constructor, which would treat the input as latin 1 instead of
3131         UTF-8.
3132
3133         Test: fast/forms/file/entries-api/webkitEntries-nonascii-folder-name.html
3134
3135         * platform/posix/FileSystemPOSIX.cpp:
3136         (WebCore::FileSystem::directoryName):
3137
3138 2018-04-11  Youenn Fablet  <youenn@apple.com>
3139
3140         Preventively expect UTF8 strings from libwebrtc SDP and error messages
3141         https://bugs.webkit.org/show_bug.cgi?id=184509
3142
3143         Reviewed by Eric Carlson.
3144
3145         Make WebCore code expect any libwebrtc string to contain UTF-8.
3146         Currently SDPs do not contain any UTF-8 specific character
3147         but https://tools.ietf.org/html/rfc4566 allows it.
3148
3149         Add Internals API to set track id so that we can inject UTF-8 inside some WebRTC tests.
3150         Test: webrtc/utf8-sdp.html
3151
3152         * Modules/mediastream/MediaStreamTrack.h:
3153         (WebCore::MediaStreamTrack::setIdForTesting):
3154         * Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.cpp:
3155         (WebCore::fromStdString):
3156         (WebCore::fromSessionDescription):
3157         (WebCore::LibWebRTCMediaEndpoint::doSetLocalDescription):
3158         (WebCore::LibWebRTCMediaEndpoint::doSetRemoteDescription):
3159         (WebCore::LibWebRTCMediaEndpoint::mediaStreamFromRTCStream):
3160         (WebCore::LibWebRTCMediaEndpoint::addRemoteTrack):
3161         (WebCore::LibWebRTCMediaEndpoint::addDataChannel):
3162         (WebCore::LibWebRTCMediaEndpoint::OnIceCandidate):
3163         (WebCore::LibWebRTCMediaEndpoint::createSessionDescriptionSucceeded):
3164         (WebCore::LibWebRTCMediaEndpoint::createSessionDescriptionFailed):
3165         (WebCore::LibWebRTCMediaEndpoint::setLocalSessionDescriptionFailed):
3166         (WebCore::LibWebRTCMediaEndpoint::setRemoteSessionDescriptionFailed):
3167         (WebCore::trackId): Deleted.
3168         * Modules/mediastream/libwebrtc/LibWebRTCPeerConnectionBackend.cpp:
3169         (WebCore::fromStdString):
3170         (WebCore::LibWebRTCPeerConnectionBackend::doAddIceCandidate):
3171         (WebCore::createReceiverForSource):
3172         * platform/mediastream/MediaStreamTrackPrivate.h:
3173         (WebCore::MediaStreamTrackPrivate::setIdForTesting):
3174         * testing/Internals.cpp:
3175         (WebCore::Internals::setMediaStreamTrackIdentifier):
3176         * testing/Internals.h:
3177         * testing/Internals.idl:
3178
3179 2018-04-11  Said Abou-Hallawa  <sabouhallawa@apple.com>
3180
3181         Cache glyphs (using display lists) when painting at high frequency
3182         https://bugs.webkit.org/show_bug.cgi?id=178750
3183         <rdar://problem/35201729>
3184
3185         Reviewed by Antti Koivisto.
3186
3187         This patch adds support for caching of glyph drawing commands when painting
3188         at high frequency. Caching the glyph drawing will be done using DisplayLists.
3189
3190         GlyphDisplayListCache is basically a hash map which maps InlineTextBox
3191         or SimpleLineLayout::Run to DisplayList. Before adding a new entry to it
3192         we have to check whether the conditions for caching the glyph DisplayList
3193         are met or not. If no entry is found for a given run, a new DisplayList
3194         is created and a new entry is add to the cache.
3195
3196         * WebCore.xcodeproj/project.pbxproj:
3197         * page/MemoryRelease.cpp:
3198         (WebCore::releaseNoncriticalMemory): Make GlyphDisplayListCache respond
3199         to memory pressure.
3200
3201         * platform/graphics/FontCascade.cpp:
3202         (WebCore::FontCascade::displayListForTextRun const):
3203         * platform/graphics/FontCascade.h:
3204         (WebCore::FontCascade::displayListForTextRun):
3205         Record the drawing of a glyph run into a DisplayList.
3206
3207         * rendering/GlyphDisplayListCache.h: Added.
3208         (WebCore::GlyphDisplayListCache::singleton):
3209         (WebCore::GlyphDisplayListCache::get):
3210         (WebCore::GlyphDisplayListCache::remove):
3211         (WebCore::GlyphDisplayListCache::clear):
3212         (WebCore::GlyphDisplayListCache::size const):
3213         (WebCore::GlyphDisplayListCache::sizeInBytes const):
3214         A simple cache for the TextRun DisplayList. Adding a new entry in the
3215         cache happens under restricted conditions. So this cache is not expected
3216         to grow much.
3217
3218         * rendering/InlineTextBox.cpp:
3219         (WebCore::InlineTextBox::~InlineTextBox):
3220         (WebCore::InlineTextBox::paint):
3221         (WebCore::InlineTextBox::paintMarkedTexts):
3222         (WebCore::InlineTextBox::paintMarkedTextBackground):
3223         (WebCore::InlineTextBox::paintMarkedTextForeground):
3224         (WebCore::InlineTextBox::paintMarkedTextDecoration):
3225         (WebCore::InlineTextBox::paintCompositionBackground):
3226         (WebCore::InlineTextBox::paintCompositionUnderlines const):
3227         (WebCore::InlineTextBox::paintCompositionUnderline const):
3228         * rendering/InlineTextBox.h:
3229         (WebCore::InlineTextBox::paintMarkedTexts):
3230         InlineTextBox::paintMarkedTextForeground() now requires PaintInfo to know
3231         whether the entry in the GlyphDisplayListCache should be removed or not.
3232         Change all the GraphicsContext arguments to be PaintInfo.
3233
3234         * rendering/SimpleLineLayout.cpp:
3235         (WebCore::SimpleLineLayout::Layout::~Layout):
3236         * rendering/SimpleLineLayout.h:
3237         * rendering/SimpleLineLayoutFunctions.cpp:
3238         (WebCore::SimpleLineLayout::paintFlow):
3239         (WebCore::SimpleLineLayout::simpleLineLayoutWillBeDeleted):
3240         * rendering/SimpleLineLayoutFunctions.h:
3241         * rendering/SimpleLineLayoutResolver.h:
3242         (WebCore::SimpleLineLayout::RunResolver::Run::simpleRun const):
3243         Implement the glyph caching for SimpleLineLayout::Run.
3244
3245         * rendering/TextPainter.cpp:
3246         (WebCore::TextPainter::paintTextOrEmphasisMarks): If the DisplayList is
3247         available, replay it back into the GraphicsContext. Make sure to reset to
3248         the DisplayList pointer to nullptr after painting.
3249
3250         (WebCore::TextPainter::clearGlyphDisplayLists):
3251         (WebCore::TextPainter::shouldUseGlyphDisplayList): Check whether we should
3252         use DisplayList to the draw glyph run.
3253
3254         * rendering/TextPainter.h:
3255         (WebCore::TextPainter::setGlyphDisplayListIfNeeded): Check whether we should
3256         should use DisplayList to the draw glyph run and if we should, ensure first
3257         the DisplayList is cached and set it in the TextPainter so it uses it when
3258         the run is painted.
3259
3260         (WebCore::TextPainter::removeGlyphDisplayList): Remove the cached DisplayList
3261         entry for a glyph layout run.
3262
3263 2018-04-11  Brent Fulgham  <bfulgham@apple.com>
3264
3265         GraphicsLayerCA::createPlatformCALayer always disables extended color in its backing store
3266         https://bugs.webkit.org/show_bug.cgi?id=184367
3267         <rdar://problem/39249074>
3268
3269         Reviewed by Simon Fraser.
3270
3271         'createPlatformCALayer' always passes a nil widget, which early returns from 'screenSupportsExtendedColor'
3272         with false. Instead, we should just pass the widget (nil or not) to the screen properties methods,
3273         which will use the primary screen if no screen is specified. I.e., we shouldn't do an early return
3274         here if the passed widget is nil.
3275
3276         * platform/mac/PlatformScreenMac.mm:
3277         (WebCore::screenSupportsExtendedColor):
3278
3279 2018-04-11  Youenn Fablet  <youenn@apple.com>
3280
3281         Pass FetchOptions and SecurityOrigin as load parameters from WebProcess to NetworkProcess
3282         https://bugs.webkit.org/show_bug.cgi?id=184374
3283
3284         Reviewed by Chris Dumez.
3285
3286         Add support for SecurityOrigin encode/decode routines.
3287
3288         * page/SecurityOrigin.h:
3289
3290 2018-04-11  Thibault Saunier  <tsaunier@igalia.com>
3291
3292         [GStreamer] Use of playbin3 when USE_PLAYBIN3 environment variable is set
3293         https://bugs.webkit.org/show_bug.cgi?id=184498
3294
3295         Reviewed by Philippe Normand.
3296
3297         [GStreamer] Use of playbin3 when USE_PLAYBIN3 environment variable is set
3298
3299         This is the same behaviour as with playbin itself.
3300
3301         Make sure to keep using "playbin" for MediaSource.
3302
3303         No test added as this is basically a small rework of the way we expose a feature.
3304
3305         * platform/graphics/gstreamer/AudioTrackPrivateGStreamer.cpp:
3306         * platform/graphics/gstreamer/AudioTrackPrivateGStreamer.h:
3307         * platform/graphics/gstreamer/GRefPtrGStreamer.cpp:
3308         * platform/graphics/gstreamer/GRefPtrGStreamer.h:
3309         * platform/graphics/gstreamer/InbandTextTrackPrivateGStreamer.cpp:
3310         * platform/graphics/gstreamer/InbandTextTrackPrivateGStreamer.h:
3311         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:
3312         (WebCore::MediaPlayerPrivateGStreamer::load):
3313         (WebCore::MediaPlayerPrivateGStreamer::enableTrack):
3314         (WebCore::MediaPlayerPrivateGStreamer::handleMessage):
3315         (WebCore::MediaPlayerPrivateGStreamer::createGSTPlayBin):
3316         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.h:
3317         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.h:
3318         * platform/graphics/gstreamer/TrackPrivateBaseGStreamer.cpp:
3319         (WebCore::TrackPrivateBaseGStreamer::disconnect):
3320         (WebCore::TrackPrivateBaseGStreamer::tagsChanged):
3321         * platform/graphics/gstreamer/TrackPrivateBaseGStreamer.h:
3322         * platform/graphics/gstreamer/VideoTrackPrivateGStreamer.cpp:
3323         * platform/graphics/gstreamer/VideoTrackPrivateGStreamer.h:
3324
3325 2018-04-10  Alex Christensen  <achristensen@webkit.org>
3326
3327         IDN spoofing with Hebrew combining characters
3328         https://bugs.webkit.org/show_bug.cgi?id=184472
3329         <rdar://problem/39148687>
3330
3331         Reviewed by Brent Fulgham.
3332
3333         Covered by new API tests.
3334
3335         * platform/mac/WebCoreNSURLExtras.mm:
3336         (WebCore::isLookalikeCharacter):
3337         Punycode-encode hosts with Hebrew combining marks that look like dots
3338         and Vav with a combining dot above like we do with dotless i and j.
3339
3340 2018-04-11  Brent Fulgham  <bfulgham@apple.com>
3341
3342         Show punycode if URL contains Latin dum character
3343         https://bugs.webkit.org/show_bug.cgi?id=184477
3344         <rdar://problem/39121999>
3345
3346         Reviewed by David Kilzer.
3347
3348         Revise our "lookalike character" logic to include the small
3349         Latin dum character.
3350
3351         Test: fast/url/host.html
3352
3353         * platform/mac/WebCoreNSURLExtras.mm:
3354         (WebCore::isLookalikeCharacter):
3355
3356 2018-04-11  Michael Catanzaro  <mcatanzaro@igalia.com>
3357
3358         [GTK] WaylandCompositorDisplay leaks its wl_display
3359         https://bugs.webkit.org/show_bug.cgi?id=184406
3360
3361         Reviewed by Carlos Garcia Campos.
3362
3363         Well, this was harder than expected. We really just want to fix a small leak in the WebKit
3364         layer, but that requires a change in how WaylandCompositorDisplay calls the
3365         PlatformDisplayWayland constructor, to pass NativeDisplayOwned::Yes. That means
3366         WaylandCompositorDisplay can no longer use PlatformDisplayWayland's protected default
3367         constructor. Problem is that the normal PlatformDisplayWayland constructor calls
3368         PlatformDisplayWayland::initialize, which calls PlatformDisplayWayland::registryGlobal,
3369         which is a virtual function. The WaylandCompositorDisplay portion of the object is not
3370         constructed yet at this point, so WaylandCompositorDisplay::registryGlobal will never be
3371         called if we do that. I had to revert the previous version of this fix due to this problem.
3372         It had broken accelerated compositing.
3373
3374         I'm reminded of Effective C++ item #9: Never call virtual functions during construction or
3375         destruction ("because such calls will never go to a more derived class than that of the
3376         currently executing constructor or destructor"). This code is fragile and likely to break
3377         again in the future, so let's refactor it a bit. Instead of calling initialize in the
3378         constructor, we'll call it from create functions. We'll have to add a couple create
3379         functions, and make the constructor protected to ensure it's not possible to create a
3380         PlatformDisplayWayland without initializing it. For good parallelism, do the same for the
3381         other PlatformDisplay classes.
3382
3383         This commit additionally removes PlatformDisplayWayland's protected default constructor,
3384         since it's not needed anymore.
3385
3386         The NativeDisplayOwned arguments to the PlatformDisplay constructors are now mandatory,
3387         instead of using NativeDisplayOwned::No as the default value, since that was dangerously
3388         close to being the cause of this leak, and the constructors are now accessed from private
3389         create functions anyway. Some more caution when using default parameter values is warranted
3390         in the future.
3391
3392         Lastly, since we have to change PlatformDisplay::createPlatformDisplay to use the new create
3393         functions, take the opportunity to move things around a bit for clarity. There should be no
3394         change in behavior. I was just disappointed that the PlatformDisplay