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