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