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