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