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