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