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