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