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