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