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