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