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