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