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