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