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