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