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