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