Unreviewed, manual rollout of r228866 causing EGL_BAD_CONTEXT errors
[WebKit-https.git] / Source / WebCore / ChangeLog
1 2018-02-26  Philippe Normand  <pnormand@igalia.com>
2
3         Unreviewed, manual rollout of r228866 causing EGL_BAD_CONTEXT errors
4
5         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp:
6         (WebCore::MediaPlayerPrivateGStreamerBase::ensureGstGLContext):
7         Create an EGL display, even in Wayland.
8
9 2018-02-21  Sergio Villar Senin  <svillar@igalia.com>
10
11         [WebVR][OpenVR] Retrieve displayId and the z-depth of eye view frustum
12         https://bugs.webkit.org/show_bug.cgi?id=182999
13
14         Reviewed by Žan Doberšek.
15
16         Retrieve the z-depth of the eye view frustum and the HMD unique id.
17         The unique identifier is generated by the VRPlatormManager whereas
18         we use the default values from the spec for the z-depth (those can
19         be changed by applications later via JavaScript).
20
21         Once this lands the only remaining data to be retrieved from VR
22         backends for VRDisplay is the pose (getPose() call) and the frame
23         data (getFrameData() call).
24
25         * Modules/webvr/VRDisplay.cpp:
26         (WebCore::VRDisplay::VRDisplay):
27         (WebCore::VRDisplay::displayId const): Deleted.
28         (WebCore::VRDisplay::displayName const): Deleted.
29         (WebCore::VRDisplay::depthNear const): Deleted.
30         (WebCore::VRDisplay::setDepthNear): Deleted.
31         (WebCore::VRDisplay::depthFar const): Deleted.
32         (WebCore::VRDisplay::setDepthFar): Deleted.
33         * Modules/webvr/VRDisplay.h:
34         (WebCore::VRDisplay::displayId const): Moved implementation from
35         source file.
36         (WebCore::VRDisplay::displayName const): Ditto.
37         (WebCore::VRDisplay::depthNear const):
38         (WebCore::VRDisplay::setDepthNear):
39         (WebCore::VRDisplay::depthFar const):
40         (WebCore::VRDisplay::setDepthFar):
41         * platform/vr/VRManager.cpp:
42         (WebCore::VRManager::generateUniqueDisplayIdentifier):
43         * platform/vr/VRManager.h:
44         * platform/vr/VRPlatformDisplay.h:
45         * platform/vr/openvr/VRPlatformDisplayOpenVR.cpp:
46         (WebCore::VRPlatformDisplayOpenVR::VRPlatformDisplayOpenVR):
47
48 2018-02-26  Charlie Turner  <cturner@igalia.com>
49
50         Fix build error with !LOG_DISABLED
51         https://bugs.webkit.org/show_bug.cgi?id=183049
52
53         Reviewed by Philippe Normand.
54
55         The following error message was being reported when doing a
56         release build with -DLOG_DISABLED=0:
57
58         ../../Source/WebCore/dom/messageports/MessagePortChannel.cpp: In member function ‘void WebCore::MessagePortChannel::entanglePortWithProcess(const WebCore::MessagePortIdentifier&, WebCore::ProcessIdentifier)’:
59 ../../Source/WebCore/dom/messageports/MessagePortChannel.cpp:85:111: error: ‘logString’ was not declared in this scope
60      LOG(MessagePorts, "MessagePortChannel %s (%p) entangling port %s (that port has %zu messages available)", logString().utf8().data(), this, port.logString().utf8().data(), m_pendingMessages[i].size());
61
62         Other uses of logString are guarded by !LOG_DISABLED rather than
63         NDEBUG, which was the cause of this issue.
64
65         * dom/messageports/MessagePortChannel.h: Guard using !LOG_DISABLED
66         rather than NDEBUG.
67
68 2018-02-26  Carlos Garcia Campos  <cgarcia@igalia.com>
69
70         [GStreamer] User current executable name instead of g_get_prgname() for gst_init
71         https://bugs.webkit.org/show_bug.cgi?id=183119
72
73         Reviewed by Philippe Normand.
74
75         g_get_prgname() is only set for programs using GOptionContext, calling gtk_init or explicitly calling
76         g_set_prgname(). Use WTF::getCurrentExecutableName() instead.
77
78         * platform/graphics/gstreamer/GStreamerUtilities.cpp:
79         (WebCore::initializeGStreamer):
80
81 2018-02-25  Wenson Hsieh  <wenson_hsieh@apple.com>
82
83         [Extra zoom mode] Disable downloadable binary fonts by default
84         https://bugs.webkit.org/show_bug.cgi?id=183102
85         <rdar://problem/37860699>
86
87         Reviewed by Tim Horton.
88
89         Disable downloadable binary fonts by default in extra zoom mode by making the initial value of
90         `downloadableBinaryFontsEnabled` conditional. Layout tests are not possible at this time; test to be added once
91         layout test support is in place.
92
93         * page/Settings.yaml:
94         * page/SettingsBase.cpp:
95         (WebCore::SettingsBase::defaultDownloadableBinaryFontsEnabled):
96         * page/SettingsBase.h:
97
98 2018-02-25  Chris Dumez  <cdumez@apple.com>
99
100         Service workers do not work well inside Web.app
101         https://bugs.webkit.org/show_bug.cgi?id=183105
102         <rdar://problem/37864140>
103
104         Reviewed by Youenn Fablet.
105
106         SessionID::defaultSessionID() was hardcoded in the ServiceWorkerThread constructor
107         instead of using the sessionID of the SWServer that created the service worker thread.
108         As a result, when the Service Worker would establish a SWClientConnection to the
109         server, it would use the wrong sessionID and would end up using a different SWServer
110         (Since we have a different SWServer instance per sessionID). As a result,
111         ServiceWorkerRegistration / ServiceWorker objects inside the service worker would not
112         be kept in sync with the server (since they registered themselves with the wrong
113         SWServer).
114
115         Covered by new API test.
116
117         * workers/service/ServiceWorkerContextData.cpp:
118         (WebCore::ServiceWorkerContextData::isolatedCopy const):
119         * workers/service/ServiceWorkerContextData.h:
120         (WebCore::ServiceWorkerContextData::encode const):
121         (WebCore::ServiceWorkerContextData::decode):
122         * workers/service/context/ServiceWorkerThread.cpp:
123         (WebCore::ServiceWorkerThread::ServiceWorkerThread):
124         * workers/service/context/ServiceWorkerThreadProxy.cpp:
125         (WebCore::createPageForServiceWorker):
126         (WebCore::ServiceWorkerThreadProxy::ServiceWorkerThreadProxy):
127         * workers/service/server/RegistrationDatabase.cpp:
128         (WebCore::RegistrationDatabase::importRecords):
129         * workers/service/server/RegistrationStore.h:
130         (WebCore::RegistrationStore::server):
131         * workers/service/server/SWServer.cpp:
132         (WebCore::SWServer::updateWorker):
133         * workers/service/server/SWServerWorker.cpp:
134         (WebCore::SWServerWorker::contextData const):
135
136 2018-02-24  Fujii Hironori  <Hironori.Fujii@sony.com>
137
138         Null-dereference of the second argument `resource` of DocumentLoader::scheduleSubstituteResourceLoad
139         https://bugs.webkit.org/show_bug.cgi?id=182920
140
141         Reviewed by Darin Adler.
142
143         A test case
144         imported/w3c/web-platform-tests/html/browsers/offline/appcache/workers/appcache-worker.html
145         always crashes due to a null-dereference if compiled and optimized
146         by GCC 7.2. The second argument `resource` of
147         DocumentLoader::scheduleSubstituteResourceLoad can be null if the
148         resource can't be found in cache. I guess GCC optimizes inline
149         HashMap::add based on assuming the `resource` never becomes null
150         because its type is SubstituteResource&.
151
152         This changes introduces a new method
153         DocumentLoader::scheduleCannotShowURLError because it looks tricky
154         to pass a nullptr to the second argument of
155         scheduleSubstituteResourceLoad.
156
157         No new tests (Covered by existing tests).
158
159         * loader/DocumentLoader.cpp:
160         (WebCore::DocumentLoader::scheduleCannotShowURLError): Added a new method.
161         * loader/DocumentLoader.h:
162         * loader/appcache/ApplicationCacheHost.cpp:
163         (WebCore::ApplicationCacheHost::maybeLoadResource):
164         Call scheduleCannotShowURLError if the resource not found in the appcache.
165
166 2018-02-17  Darin Adler  <darin@apple.com>
167
168         Prepare for ExtendedColor changes (first step)
169         https://bugs.webkit.org/show_bug.cgi?id=182904
170
171         Reviewed by Sam Weinig.
172
173         * css/CSSValuePool.cpp:
174         (WebCore::CSSValuePool::createColorValue): Use HashMap::ensure.
175         (WebCore::CSSValuePool::createFontFamilyValue): Ditto.
176         (WebCore::CSSValuePool::createFontFaceValue): Ditto.
177
178         * css/parser/CSSParserFastPaths.cpp:
179         (WebCore::CSSParserFastPaths::maybeParseValue): Tightened up
180         the logic a bit.
181
182         * html/canvas/CanvasRenderingContext2D.cpp: Removed many unneeded includes.
183
184         * inspector/InspectorCanvas.cpp:
185         (WebCore::InspectorCanvas::recordAction): Updated for Ref instead of
186         RefPtr and to use move semantics.
187         (WebCore::buildArrayForAffineTransform): Return Ref instead of RefPtr.
188         (WebCore::buildArrayForVector): Ditto.
189         (WebCore::InspectorCanvas::buildInitialState): Ditto. Also use auto more.
190         (WebCore::InspectorCanvas::buildAction): Ditto.
191         (WebCore::InspectorCanvas::buildArrayForCanvasGradient): Ditto.
192         (WebCore::InspectorCanvas::buildArrayForCanvasPattern): Ditto.
193         (WebCore::InspectorCanvas::buildArrayForImageData): Ditto.
194         * inspector/InspectorCanvas.h: Updated for the above. Also us "using" instead
195         of typedef and removed unneeded ErrorString typedef and some includes.
196
197         * page/DragController.cpp:
198         (WebCore::DragController::concludeEditDrag): Use auto and Ref.
199
200         * platform/DragData.h: Used pragma once and reorganized includes a bit.
201
202         * platform/graphics/ImageFrame.h:
203         (WebCore::ImageFrame::frameBytes const): Use uint32_t instead of RGBA32 to
204         prepare for removal of the RGBA32 type coming in a future patch.
205         * platform/graphics/ImageSource.cpp:
206         (WebCore::ImageSource::cacheNativeImageAtIndex): Ditto.
207         (WebCore::ImageSource::canUseAsyncDecoding): Ditto.
208
209         * platform/graphics/cocoa/GraphicsContextCocoa.mm: Tweaked #if for Mac-only
210         code to use PLATFORM(MAC) to be easier to read.
211         (WebCore::GraphicsContext::focusRingColor): Use sRGBColorSpaceRef instead of
212         calling CGColorSpaceCreateWithName each time.
213
214         * platform/graphics/texmap/TextureMapperFPSCounter.cpp: Added include needed
215         now that it was removed from some header.
216
217         * platform/graphics/win/GraphicsContextPlatformPrivateDirect2D.h: Use uint32_t
218         instead of RGBA32 to prepare for removal of the RGBA32 type coming in a future patch.
219         * platform/image-decoders/ScalableImageDecoder.cpp:
220         (WebCore::ScalableImageDecoder::frameBytesAtIndex const): Ditto.
221         * platform/image-decoders/cairo/ImageBackingStoreCairo.cpp:
222         (WebCore::ImageBackingStore::image const): Ditto.
223         * platform/image-decoders/gif/GIFImageDecoder.cpp:
224         (WebCore::GIFImageDecoder::haveDecodedRow): Ditto.
225         * platform/image-decoders/jpeg/JPEGImageDecoder.cpp:
226         (WebCore::setPixel): Ditto.
227         (WebCore::JPEGImageDecoder::outputScanlines): Ditto.
228         * platform/image-decoders/png/PNGImageDecoder.cpp:
229         (WebCore::PNGImageDecoder::rowAvailable): Ditto.
230         (WebCore::PNGImageDecoder::frameComplete): Ditto.
231         * platform/image-decoders/webp/WEBPImageDecoder.cpp:
232         (WebCore::WEBPImageDecoder::decodeFrame): Ditto.
233         (WebCore::WEBPImageDecoder::applyPostProcessing): Ditto.
234
235         * platform/mac/PlatformPasteboardMac.mm:
236         (WebCore::PlatformPasteboard::color): Added comments.
237
238         * rendering/EllipsisBox.cpp:
239         (WebCore::EllipsisBox::paintSelection): Use Color::isVisible.
240
241 2018-02-23  Chris Dumez  <cdumez@apple.com>
242
243         Crash under SchemeRegistry::shouldTreatURLSchemeAsLocal(WTF::String const&)
244         https://bugs.webkit.org/show_bug.cgi?id=183066
245         <rdar://problem/37804111>
246
247         Reviewed by Ryosuke Niwa.
248
249         SecurityOrigin objects are constructed on various threads. However, someone added a
250         shouldTreatAsPotentiallyTrustworthy() call to the SecurityOrigin constructor which
251         was not thread safe. This is because this function relies on SchemeRegistry::shouldTreatURLSchemeAsSecure()
252         and SchemeRegistry::shouldTreatURLSchemeAsLocal() which were relying on global static HashMaps without
253         locks.
254
255         Update SecurityOrigin to initialize m_isPotentiallyTrustworthy lazily, to avoid paying
256         initialization cost in the constructor. This is only queries by SecurityContext::isSecureContext().
257
258         Make SchemeRegistry::shouldTreatURLSchemeAsLocal() and SchemeRegistry::shouldTreatURLSchemeAsSecure()
259         thread-safe, since they are needed to initialize SecurityOrigin::m_isPotentiallyTrustworthy from
260         various threads.
261
262         SchemeRegistry::shouldTreatURLSchemeAsSecure() is only called from SecurityOrigin (which requires
263         thread-safety), and getUserMedia() which is not hot code so the extra locking there should not
264         be an issue.
265
266         SchemeRegistry::shouldTreatURLSchemeAsLocal() is called from SecurityOrigin (which requires thread-
267         safety). It is also called from isQuickLookPreviewURL(), MHTMLArchive::create(), Page::userStyleSheetLocationChanged(),
268         isRemoteWebArchive() and HTMLPlugInImageElement. All these are not hot code so I do not think
269         we need a fast path.
270
271         * page/SecurityOrigin.cpp:
272         (WebCore::isLoopbackIPAddress):
273         (WebCore::shouldTreatAsPotentiallyTrustworthy):
274         (WebCore::SecurityOrigin::isPotentiallyTrustworthy const):
275         (WebCore::SecurityOrigin::isLocalHostOrLoopbackIPAddress):
276         * page/SecurityOrigin.h:
277         * platform/SchemeRegistry.cpp:
278         (WebCore::localURLSchemesLock):
279         (WebCore::localURLSchemes):
280         (WebCore::secureSchemesLock):
281         (WebCore::secureSchemes):
282         (WebCore::SchemeRegistry::registerURLSchemeAsLocal):
283         (WebCore::SchemeRegistry::removeURLSchemeRegisteredAsLocal):
284         (WebCore::SchemeRegistry::shouldTreatURLSchemeAsLocal):
285         (WebCore::SchemeRegistry::registerURLSchemeAsSecure):
286         (WebCore::SchemeRegistry::shouldTreatURLSchemeAsSecure):
287         * platform/SchemeRegistry.h:
288
289 2018-02-23  Christopher Reid  <chris.reid@sony.com>
290
291         [Curl] Cookie Database files are wrongfully getting deleted when the database is opened
292         https://bugs.webkit.org/show_bug.cgi?id=183051
293
294         Reviewed by Per Arne Vollan.
295
296         The file stat logic was backwards causing a wrongful detection of database corruption.
297         Fixed the logic and abstracted these calls to use FileSystem.
298
299         * platform/network/curl/CookieJarDB.cpp:
300
301 2018-02-23  Zalan Bujtas  <zalan@apple.com>
302
303         [RenderTreeBuilder] Make RenderTreeBuilder::* classes WTF_MAKE_FAST_ALLOCATED
304         https://bugs.webkit.org/show_bug.cgi?id=183084
305         <rdar://problem/37828706>
306
307         Reviewed by Antti Koivisto.
308
309         * rendering/updating/RenderTreeBuilderBlock.h:
310         * rendering/updating/RenderTreeBuilderBlockFlow.h:
311         * rendering/updating/RenderTreeBuilderContinuation.h:
312         * rendering/updating/RenderTreeBuilderFirstLetter.h:
313         * rendering/updating/RenderTreeBuilderFormControls.h:
314         * rendering/updating/RenderTreeBuilderFullScreen.h:
315         * rendering/updating/RenderTreeBuilderInline.h:
316         * rendering/updating/RenderTreeBuilderList.h:
317         * rendering/updating/RenderTreeBuilderMathML.h:
318         * rendering/updating/RenderTreeBuilderMultiColumn.h:
319         * rendering/updating/RenderTreeBuilderRuby.h:
320         * rendering/updating/RenderTreeBuilderSVG.h:
321         * rendering/updating/RenderTreeBuilderTable.h:
322         * rendering/updating/RenderTreeUpdaterGeneratedContent.h:
323
324 2018-02-23  Zalan Bujtas  <zalan@apple.com>
325
326         [RenderTreeBuilder] Move RenderFullScreen::createPlaceholder to RenderTreeBuilder
327         https://bugs.webkit.org/show_bug.cgi?id=183027
328         <rdar://problem/37773058>
329
330         Reviewed by Antti Koivisto.
331
332         No change in functionality.
333
334         * dom/Document.cpp:
335         (WebCore::Document::setFullScreenRenderer):
336         * dom/Document.h:
337         * rendering/RenderFullScreen.cpp:
338         (WebCore::RenderFullScreenPlaceholder::RenderFullScreenPlaceholder):
339         (WebCore::RenderFullScreenPlaceholder::isRenderFullScreenPlaceholder const):
340         (WebCore::RenderFullScreen::wrapNewRenderer):
341         (WebCore::RenderFullScreen::wrapExistingRenderer):
342         (): Deleted.
343         (WebCore::RenderFullScreen::createPlaceholder): Deleted.
344         * rendering/RenderFullScreen.h:
345         * rendering/updating/RenderTreeBuilder.cpp:
346         (WebCore::RenderTreeBuilder::createPlaceholderForFullScreen):
347         * rendering/updating/RenderTreeBuilder.h:
348         * rendering/updating/RenderTreeBuilderFullScreen.cpp:
349         (WebCore::RenderTreeBuilder::FullScreen::createPlaceholder):
350         * rendering/updating/RenderTreeBuilderFullScreen.h:
351
352 2018-02-23  Zalan Bujtas  <zalan@apple.com>
353
354         [RenderTreeBuilder] Add WARN_UNUSED_RETURN to detach()
355         https://bugs.webkit.org/show_bug.cgi?id=183073
356         <rdar://problem/37814585>
357
358         Reviewed by Antti Koivisto.
359
360         So that we don't destroy a renderer accidentally.
361
362         * rendering/updating/RenderTreeBuilderBlock.h:
363         * rendering/updating/RenderTreeBuilderRuby.h:
364         * rendering/updating/RenderTreeBuilderSVG.h:
365
366 2018-02-22  Antoine Quint  <graouts@apple.com>
367
368         REGRESSION (r228445): A big pause button shows over YouTube videos if you tap "Tap To Unmute" on iOS
369         https://bugs.webkit.org/show_bug.cgi?id=183074
370         <rdar://problem/37747028>
371
372         Reviewed by Eric Carlson.
373
374         Test: media/modern-media-controls/start-support/start-support-disable-controls-and-re-enable-post-play.html
375
376         In the fix for webkit.org/b/182668, we made it so that when the "controls" attribute is absent from a media
377         element we stop listening to the bulk of media events and prevent controls from updating any DOM properties
378         so as to minimize the amount of CPU usage by the Web process.
379
380         An unfortunate side effect was that, if the media controls were disabled at the time the video starts playing,
381         the StartSupport class would thus not catch the "play" event and would not be able to set the "hasPlayed"
382         property to "true" on the MediaController, which would then prevent the _shouldShowStartButton() from returning
383         "false". As a result, if the "controls" attribute was turned back on after the media started playing, they
384         would default to showing the start button, which would be then in the play state, ie. showing the pause icon.
385
386         We now set the "hasPlayed" property in the "play" event handler on MediaController, which is always registered
387         regardless of the "controls" attribute setting. We also ensure we invalidate the "showStartButton" property on
388         the media controls when StartSupport is enabled, which is the case when the "controls" attribute is toggled back
389         to "true" from a previous "false" value.
390
391         * Modules/modern-media-controls/media/media-controller.js:
392         (MediaController.prototype.handleEvent):
393         * Modules/modern-media-controls/media/start-support.js:
394         (StartSupport):
395         (StartSupport.prototype.enable):
396         (StartSupport.prototype.handleEvent):
397         (StartSupport.prototype._updateShowsStartButton):
398
399 2018-02-23  Carlos Garcia Campos  <cgarcia@igalia.com>
400
401         [GStreamer][MiniBrowser] Honor GStreamer command line parameters in MiniBrowser
402         https://bugs.webkit.org/show_bug.cgi?id=173655
403         <rdar://problem/37706341>
404
405         Reviewed by Philippe Normand.
406
407         Do not assume gst is only used in the WebProcess, the MIMETypeRegistry also uses gst to get the list of
408         supported media types. Move the code to extract gst options from the process command line to a helper function
409         and use it in the UI process to pass the options to the WebProcess, but also in the current process when gst is
410         initialized without providing options.
411
412         Fixes several unit tests that use MIMETypeRegistry in the UI process.
413
414         * platform/graphics/gstreamer/GStreamerUtilities.cpp:
415         (WebCore::extractGStreamerOptionsFromCommandLine): Helper to get the gst options from the current process
416         command line.
417         (WebCore::initializeGStreamer): Ensure this is called once. Get the gst options from the given vector or extract
418         it from the command line if not provided.
419         * platform/graphics/gstreamer/GStreamerUtilities.h:
420         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp:
421         (WebCore::MediaPlayerPrivateGStreamerBase::initializeGStreamerAndRegisterWebKitElements): Bring back the gst
422         initialization here.
423
424 2018-02-23  Philippe Normand  <pnormand@igalia.com>
425
426         [GStreamer] HTTP totalBytes query returns 0 after seeking (sometimes)
427         https://bugs.webkit.org/show_bug.cgi?id=183002
428
429         Reviewed by Xabier Rodriguez-Calvar.
430
431         * platform/graphics/gstreamer/WebKitWebSourceGStreamer.cpp:
432         (webkit_web_src_init): Initialize member variables. Also no need
433         to set the appsrc size at that point.
434         (webKitWebSrcStop): There is no need to reset the size when
435         seeking. Size should in most cases represent the Content-Length
436         response attribute, even when seeking.
437         (webKitWebSrcStart): No need to reset the size attribute.
438         (webKitWebSrcQueryWithParent): Let appsrc handle DURATION queries.
439         (CachedResourceStreamingClient::responseReceived): Emit duration notification one time only.
440
441 2018-02-23  Philippe Normand  <pnormand@igalia.com>
442
443         [GStreamer] media/video-src-blob-using-open-panel.html crashes in Debug
444         https://bugs.webkit.org/show_bug.cgi?id=183005
445
446         Reviewed by Xabier Rodriguez-Calvar.
447
448         Test: media/video-src-blob-using-open-panel.html
449
450         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:
451         (WebCore::convertToInternalProtocol): Also convert blob URIs
452         because they're handled by our httpsrc element.
453         * platform/graphics/gstreamer/WebKitWebSourceGStreamer.cpp:
454         (webKitWebSrcGetProtocols): Prefix blob URIs too, for consistency purpose.
455
456 2018-02-22  Yusuke Suzuki  <utatane.tea@gmail.com>
457
458         Remove currentTime() / currentTimeMS()
459         https://bugs.webkit.org/show_bug.cgi?id=183052
460
461         Reviewed by Mark Lam.
462
463         * Modules/geolocation/Geolocation.cpp:
464         (WebCore::Geolocation::haveSuitableCachedPosition):
465         * dom/DOMTimeStamp.h:
466         (WebCore::convertSecondsToDOMTimeStamp):
467         * fileapi/File.cpp:
468         (WebCore::File::File):
469         (WebCore::File::lastModified const):
470         * history/HistoryItem.cpp:
471         (WebCore::generateSequenceNumber):
472         * html/BaseDateAndTimeInputType.cpp:
473         (WebCore::BaseDateAndTimeInputType::defaultValueForStepUp const):
474         * html/DateTimeInputType.cpp:
475         (WebCore::DateTimeInputType::defaultValueForStepUp const):
476         * html/MonthInputType.cpp:
477         (WebCore::MonthInputType::defaultValueForStepUp const):
478         * html/TimeInputType.cpp:
479         (WebCore::TimeInputType::defaultValueForStepUp const):
480         * inspector/agents/InspectorNetworkAgent.cpp:
481         (WebCore::InspectorNetworkAgent::willSendRequest):
482         (WebCore::InspectorNetworkAgent::willSendWebSocketHandshakeRequest):
483         * loader/EmptyFrameLoaderClient.h:
484         * loader/FormSubmission.cpp:
485         (WebCore::generateFormDataIdentifier):
486         * loader/FrameLoader.cpp:
487         (WebCore::FrameLoader::clientRedirected):
488         * loader/FrameLoader.h:
489         * loader/FrameLoaderClient.h:
490         * loader/NavigationScheduler.cpp:
491         * page/History.cpp:
492         (WebCore::History::stateObjectAdded):
493         * page/History.h:
494         * page/PageOverlay.cpp:
495         (WebCore::PageOverlay::startFadeAnimation):
496         (WebCore::PageOverlay::fadeAnimationTimerFired):
497         * page/PageOverlay.h:
498         * platform/graphics/cg/GraphicsContextCG.cpp:
499         (WebCore::GraphicsContext::drawNativeImage):
500         * platform/ios/LegacyTileLayerPool.h:
501         * platform/ios/LegacyTileLayerPool.mm:
502         (WebCore::LegacyTileLayerPool::LegacyTileLayerPool):
503         (WebCore::LegacyTileLayerPool::addLayer):
504         (WebCore::LegacyTileLayerPool::decayedCapacity const):
505         (WebCore::LegacyTileLayerPool::prune):
506         * platform/ios/SystemMemoryIOS.cpp:
507         (WebCore::systemMemoryLevel):
508         * platform/mediastream/mac/DisplayCaptureSourceCocoa.cpp:
509         * platform/mediastream/mac/ScreenDisplayCaptureSourceMac.mm:
510
511 2018-02-22  Per Arne Vollan  <pvollan@apple.com>
512
513         The WebContent process should not use NSScreen in the screenDepth implementation.
514         https://bugs.webkit.org/show_bug.cgi?id=183048
515
516         Reviewed by Brent Fulgham.
517
518         NSScreen method calls should be done in the UIProcess, since these calls will communicate with
519         the WindowServer. The screen depth property can be retrieved in the UIProcess, and sent to the
520         WebContent process, where it is cached. Whenever screen properties change, the UIProcess will
521         send the new screen properties to the WebProcess.
522
523         No new tests, covered by existing tests.
524
525         * platform/ScreenProperties.h:
526         (WebCore::ScreenProperties::encode const):
527         (WebCore::ScreenProperties::decode):
528         * platform/mac/PlatformScreenMac.mm:
529         (WebCore::getScreenProperties):
530         (WebCore::screenDepth):
531         (WebCore::screenDepthPerComponent):
532         (WebCore::screenRect):
533         (WebCore::screenAvailableRect):
534
535 2018-02-22  Zalan Bujtas  <zalan@apple.com>
536
537         [RenderTreeBuilder] Rename insertChild() -> attach(), takeChild() -> detach() and removeAndDestroy() -> destroy()
538         https://bugs.webkit.org/show_bug.cgi?id=183061
539         <rdar://problem/37800269>
540
541         Reviewed by Ryosuke Niwa.
542
543         ...and moveChildTo() -> move() (moveChildrenTo() -> moveChildren()),
544         removeFromParentAndDestroyCleaningUpAnonymousWrappers() -> destroyAndCleanUpAnonymousWrappers()
545
546         No change in functionality.
547
548         * dom/Document.cpp:
549         (WebCore::Document::destroyRenderTree):
550         (WebCore::Document::setFullScreenRenderer):
551         * rendering/RenderBlockFlow.cpp:
552         (WebCore::RenderBlockFlow::styleDidChange):
553         * rendering/RenderButton.cpp:
554         (WebCore::RenderButton::setText):
555         * rendering/RenderElement.cpp:
556         (WebCore::RenderElement::didAttachChild):
557         (WebCore::RenderElement::didInsertChild): Deleted.
558         * rendering/RenderElement.h:
559         * rendering/RenderFullScreen.cpp:
560         (WebCore::RenderFullScreen::wrapNewRenderer):
561         (WebCore::RenderFullScreen::wrapExistingRenderer):
562         (WebCore::RenderFullScreen::unwrapRenderer):
563         (WebCore::RenderFullScreen::createPlaceholder):
564         * rendering/RenderMenuList.cpp:
565         (RenderMenuList::didAttachChild):
566         (RenderMenuList::setText):
567         (RenderMenuList::didInsertChild): Deleted.
568         * rendering/RenderMenuList.h:
569         * rendering/RenderQuote.cpp:
570         (WebCore::RenderQuote::updateTextRenderer):
571         * rendering/RenderTextFragment.cpp:
572         (WebCore::RenderTextFragment::setText):
573         * rendering/updating/RenderTreeBuilder.cpp:
574         (WebCore::RenderTreeBuilder::destroy):
575         (WebCore::RenderTreeBuilder::attach):
576         (WebCore::RenderTreeBuilder::attachIgnoringContinuation):
577         (WebCore::RenderTreeBuilder::detach):
578         (WebCore::RenderTreeBuilder::attachToRenderElement):
579         (WebCore::RenderTreeBuilder::attachToRenderElementInternal):
580         (WebCore::RenderTreeBuilder::move):
581         (WebCore::RenderTreeBuilder::moveAllChildren):
582         (WebCore::RenderTreeBuilder::moveChildren):
583         (WebCore::RenderTreeBuilder::moveAllChildrenIncludingFloats):
584         (WebCore::RenderTreeBuilder::makeChildrenNonInline):
585         (WebCore::RenderTreeBuilder::splitAnonymousBoxesAroundChild):
586         (WebCore::RenderTreeBuilder::childFlowStateChangesAndAffectsParentBlock):
587         (WebCore::RenderTreeBuilder::destroyAndCleanUpAnonymousWrappers):
588         (WebCore::RenderTreeBuilder::detachFromRenderGrid):
589         (WebCore::RenderTreeBuilder::detachFromRenderElement):
590         (WebCore::RenderTreeBuilder::attachToRenderGrid):
591         (WebCore::RenderTreeBuilder::removeAndDestroy): Deleted.
592         (WebCore::RenderTreeBuilder::insertChild): Deleted.
593         (WebCore::RenderTreeBuilder::insertChildIgnoringContinuation): Deleted.
594         (WebCore::RenderTreeBuilder::takeChild): Deleted.
595         (WebCore::RenderTreeBuilder::insertChildToRenderElement): Deleted.
596         (WebCore::RenderTreeBuilder::insertChildToRenderElementInternal): Deleted.
597         (WebCore::RenderTreeBuilder::moveChildTo): Deleted.
598         (WebCore::RenderTreeBuilder::moveAllChildrenTo): Deleted.
599         (WebCore::RenderTreeBuilder::moveChildrenTo): Deleted.
600         (WebCore::RenderTreeBuilder::moveAllChildrenIncludingFloatsTo): Deleted.
601         (WebCore::RenderTreeBuilder::removeFromParentAndDestroyCleaningUpAnonymousWrappers): Deleted.
602         (WebCore::RenderTreeBuilder::takeChildFromRenderGrid): Deleted.
603         (WebCore::RenderTreeBuilder::takeChildFromRenderElement): Deleted.
604         (WebCore::RenderTreeBuilder::insertChildToRenderGrid): Deleted.
605         * rendering/updating/RenderTreeBuilder.h:
606         * rendering/updating/RenderTreeBuilderBlock.cpp:
607         (WebCore::RenderTreeBuilder::Block::attach):
608         (WebCore::RenderTreeBuilder::Block::insertChildToContinuation):
609         (WebCore::RenderTreeBuilder::Block::attachIgnoringContinuation):
610         (WebCore::RenderTreeBuilder::Block::removeLeftoverAnonymousBlock):
611         (WebCore::RenderTreeBuilder::Block::detach):
612         (WebCore::RenderTreeBuilder::Block::dropAnonymousBoxChild):
613         (WebCore::RenderTreeBuilder::Block::insertChild): Deleted.
614         (WebCore::RenderTreeBuilder::Block::insertChildIgnoringContinuation): Deleted.
615         (WebCore::RenderTreeBuilder::Block::takeChild): Deleted.
616         * rendering/updating/RenderTreeBuilderBlock.h:
617         * rendering/updating/RenderTreeBuilderBlockFlow.cpp:
618         (WebCore::RenderTreeBuilder::BlockFlow::attach):
619         (WebCore::RenderTreeBuilder::BlockFlow::moveAllChildrenIncludingFloats):
620         (WebCore::RenderTreeBuilder::BlockFlow::insertChild): Deleted.
621         (WebCore::RenderTreeBuilder::BlockFlow::moveAllChildrenIncludingFloatsTo): Deleted.
622         * rendering/updating/RenderTreeBuilderBlockFlow.h:
623         * rendering/updating/RenderTreeBuilderContinuation.cpp:
624         (WebCore::RenderTreeBuilder::Continuation::cleanupOnDestroy):
625         * rendering/updating/RenderTreeBuilderFirstLetter.cpp:
626         (WebCore::RenderTreeBuilder::FirstLetter::cleanupOnDestroy):
627         (WebCore::RenderTreeBuilder::FirstLetter::updateStyle):
628         (WebCore::RenderTreeBuilder::FirstLetter::createRenderers):
629         * rendering/updating/RenderTreeBuilderFormControls.cpp:
630         (WebCore::RenderTreeBuilder::FormControls::attach):
631         (WebCore::RenderTreeBuilder::FormControls::detach):
632         (WebCore::RenderTreeBuilder::FormControls::findOrCreateParentForChild):
633         (WebCore::RenderTreeBuilder::FormControls::insertChild): Deleted.
634         (WebCore::RenderTreeBuilder::FormControls::takeChild): Deleted.
635         * rendering/updating/RenderTreeBuilderFormControls.h:
636         * rendering/updating/RenderTreeBuilderFullScreen.cpp:
637         (WebCore::RenderTreeBuilder::FullScreen::cleanupOnDestroy):
638         * rendering/updating/RenderTreeBuilderInline.cpp:
639         (WebCore::RenderTreeBuilder::Inline::attach):
640         (WebCore::RenderTreeBuilder::Inline::insertChildToContinuation):
641         (WebCore::RenderTreeBuilder::Inline::attachIgnoringContinuation):
642         (WebCore::RenderTreeBuilder::Inline::splitFlow):
643         (WebCore::RenderTreeBuilder::Inline::splitInlines):
644         (WebCore::RenderTreeBuilder::Inline::childBecameNonInline):
645         (WebCore::RenderTreeBuilder::Inline::insertChild): Deleted.
646         (WebCore::RenderTreeBuilder::Inline::insertChildIgnoringContinuation): Deleted.
647         * rendering/updating/RenderTreeBuilderInline.h:
648         * rendering/updating/RenderTreeBuilderList.cpp:
649         (WebCore::RenderTreeBuilder::List::updateItemMarker):
650         * rendering/updating/RenderTreeBuilderMathML.cpp:
651         (WebCore::RenderTreeBuilder::MathML::makeFences):
652         (WebCore::RenderTreeBuilder::MathML::attach):
653         (WebCore::RenderTreeBuilder::MathML::insertChild): Deleted.
654         * rendering/updating/RenderTreeBuilderMathML.h:
655         * rendering/updating/RenderTreeBuilderMultiColumn.cpp:
656         (WebCore::RenderTreeBuilder::MultiColumn::createFragmentedFlow):
657         (WebCore::RenderTreeBuilder::MultiColumn::destroyFragmentedFlow):
658         (WebCore::RenderTreeBuilder::MultiColumn::processPossibleSpannerDescendant):
659         (WebCore::RenderTreeBuilder::MultiColumn::handleSpannerRemoval):
660         * rendering/updating/RenderTreeBuilderRuby.cpp:
661         (WebCore::RenderTreeBuilder::Ruby::moveInlineChildren):
662         (WebCore::RenderTreeBuilder::Ruby::moveBlockChildren):
663         (WebCore::RenderTreeBuilder::Ruby::attach):
664         (WebCore::RenderTreeBuilder::Ruby::findOrCreateParentForChild):
665         (WebCore::RenderTreeBuilder::Ruby::rubyBaseSafe):
666         (WebCore::RenderTreeBuilder::Ruby::detach):
667         (WebCore::RenderTreeBuilder::Ruby::insertChild): Deleted.
668         (WebCore::RenderTreeBuilder::Ruby::takeChild): Deleted.
669         * rendering/updating/RenderTreeBuilderRuby.h:
670         * rendering/updating/RenderTreeBuilderSVG.cpp:
671         (WebCore::RenderTreeBuilder::SVG::attach):
672         (WebCore::RenderTreeBuilder::SVG::detach):
673         (WebCore::RenderTreeBuilder::SVG::insertChild): Deleted.
674         (WebCore::RenderTreeBuilder::SVG::takeChild): Deleted.
675         * rendering/updating/RenderTreeBuilderSVG.h:
676         * rendering/updating/RenderTreeBuilderTable.cpp:
677         (WebCore::RenderTreeBuilder::Table::findOrCreateParentForChild):
678         (WebCore::RenderTreeBuilder::Table::attach):
679         (WebCore::RenderTreeBuilder::Table::collapseAndDestroyAnonymousSiblingRows):
680         (WebCore::RenderTreeBuilder::Table::insertChild): Deleted.
681         * rendering/updating/RenderTreeBuilderTable.h:
682         * rendering/updating/RenderTreeUpdater.cpp:
683         (WebCore::RenderTreeUpdater::createRenderer):
684         (WebCore::RenderTreeUpdater::createTextRenderer):
685         (WebCore::RenderTreeUpdater::tearDownRenderers):
686         (WebCore::RenderTreeUpdater::tearDownTextRenderer):
687         (WebCore::RenderTreeUpdater::tearDownLeftoverPaginationRenderersIfNeeded):
688         * rendering/updating/RenderTreeUpdaterGeneratedContent.cpp:
689         (WebCore::createContentRenderers):
690
691 2018-02-22  Chris Dumez  <cdumez@apple.com>
692
693         ResourceRequestBase::isolatedCopy() fails to isolate copy the cachePartition
694         https://bugs.webkit.org/show_bug.cgi?id=183059
695         <rdar://problem/37800202>
696
697         Reviewed by Youenn Fablet.
698
699         Update ResourceRequestBase::setAsIsolatedCopy() to call isolatedCopy() on the cachePartition as well,
700         given that it is a String and it would not be safe to send it to another thread otherwise.
701
702         * platform/network/ResourceRequestBase.cpp:
703         (WebCore::ResourceRequestBase::setAsIsolatedCopy):
704
705 2018-02-22  Chris Dumez  <cdumez@apple.com>
706
707         ServiceWorkerContainer::startScriptFetchForJob() fails to isolate copy the registrationKey before passing it to the main thread
708         https://bugs.webkit.org/show_bug.cgi?id=183050
709         <rdar://problem/37796881>
710
711         Reviewed by Youenn Fablet.
712
713         Create an isolated copy of the registrationKey before passing it to the main thread in ServiceWorkerContainer's
714         startScriptFetchForJob() / jobFinishedLoadingScript() / jobFailedLoadingScript().
715
716         * workers/service/ServiceWorkerContainer.cpp:
717         (WebCore::ServiceWorkerContainer::startScriptFetchForJob):
718         (WebCore::ServiceWorkerContainer::jobFinishedLoadingScript):
719         (WebCore::ServiceWorkerContainer::jobFailedLoadingScript):
720
721 2018-02-22  Chris Dumez  <cdumez@apple.com>
722
723         ServiceWorkerContainer::scheduleJob() fails to isolate copy the jobData before passing it to the main thread
724         https://bugs.webkit.org/show_bug.cgi?id=183046
725         <rdar://problem/37793395>
726
727         Reviewed by Youenn Fablet.
728
729         Make sure we isolate copy the jobData before passing it to the main thread in ServiceWorkerContainer::scheduleJob().
730         The jobData contains Strings / URLs so it is not safe to have non-isolated copies of it on various threads.
731
732         * workers/service/ServiceWorkerContainer.cpp:
733         (WebCore::ServiceWorkerContainer::scheduleJob):
734
735 2018-02-22  Basuke Suzuki  <Basuke.Suzuki@sony.com>
736
737         [Curl] Fix warning on clang.
738         https://bugs.webkit.org/show_bug.cgi?id=182986
739
740         Reviewed by Konstantin Tokarev.
741
742         No new tests because there's no behaviro changes.
743
744         * platform/network/curl/CurlResourceHandleDelegate.cpp:
745         (WebCore::CurlResourceHandleDelegate::curlDidSendData):
746         (WebCore::CurlResourceHandleDelegate::curlDidReceiveBuffer):
747         (WebCore::CurlResourceHandleDelegate::curlDidFailWithError):
748         * platform/network/curl/CurlResourceHandleDelegate.h:
749
750 2018-02-22  Youenn Fablet  <youenn@apple.com>
751
752         WorkerCacheStorageConnection::doRemove can assert in case two frames try to delete the same cache at the same time
753         https://bugs.webkit.org/show_bug.cgi?id=183041
754
755         Reviewed by Chris Dumez.
756
757         * Modules/cache/WorkerCacheStorageConnection.cpp:
758         (WebCore::WorkerCacheStorageConnection::doRemove): Update the assertion to accept the
759         case of an already deleted cache, i.e. returned identifer is 0.
760
761 2018-02-22  Alejandro G. Castro  <alex@igalia.com>
762
763         Remove some code leftovers in LibWebRTCMediaEndpoint and RealtimeOutgoingVideoSource classes
764         https://bugs.webkit.org/show_bug.cgi?id=183031
765
766         Reviewed by Youenn Fablet.
767
768         This include and namespace are not required in the file.
769
770         Just removing unused code, no tests required.
771
772         * Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.cpp:
773
774 2018-02-22  Chris Dumez  <cdumez@apple.com>
775
776         Document.open() cancels existing provisional load but not navigation policy check
777         https://bugs.webkit.org/show_bug.cgi?id=183012
778         <rdar://problem/37755831>
779
780         Reviewed by Alex Christensen.
781
782         Test: fast/dom/Document/open-with-pending-load-async-policy.html
783
784         * dom/Document.cpp:
785         (WebCore::Document::open):
786         The existing code was calling FrameLoader::stopAllLoaders() when the loader's state
787         is FrameStateProvisional. The issue is that the FrameLoader's state only gets set
788         to FrameStateProvisional after the policy decision for the navigation is made.
789         This means that we fail to cancel a pending load if is still in the policy decision
790         stage, which can happen when the policy decision is made asynchronously. We now
791         also cancel such pending navigation policy checks as well.
792
793         * loader/PolicyChecker.cpp:
794         (WebCore::PolicyChecker::checkNavigationPolicy):
795         Make sure the m_delegateIsDecidingNavigationPolicy flag gets reset inside the
796         lambda. Otherwise, it gets reset too early when the policy decision is made
797         asynchronously.
798
799 2018-02-22  Youenn Fablet  <youenn@apple.com>
800
801         Add release asserts for service worker fetch and postMessage events
802         https://bugs.webkit.org/show_bug.cgi?id=183025
803         rdar://problem/37765052
804
805         Reviewed by Daniel Bates.
806
807         Add release assertion so that a service worker will only dispatch a message event
808         for clients and service workers with the same origin.
809         No change of behavior.
810
811         * platform/network/ResourceRequestBase.h:
812         * workers/service/context/ServiceWorkerThread.cpp:
813         (WebCore::ServiceWorkerThread::postMessageToServiceWorker):
814         * workers/service/context/ServiceWorkerThreadProxy.h:
815
816 2018-02-22  Miguel Gomez  <magomez@igalia.com>
817
818         including both gl3.h and gl2.h when USE_OPENGL_ES is enabled
819         https://bugs.webkit.org/show_bug.cgi?id=183008
820
821         Reviewed by Michael Catanzaro.
822
823         Don't include GLES3 headers as we stick to GLES2 API resources.
824
825         No new tests, no behavior change.
826
827         * platform/graphics/GLContext.cpp:
828
829 2018-02-22  Ms2ger  <Ms2ger@igalia.com>
830
831         [GTK][WPE] Fix some build errors in service workers code
832         https://bugs.webkit.org/show_bug.cgi?id=182966
833
834         Reviewed by Žan Doberšek.
835
836         No new tests: no change in behavior.
837
838         * workers/service/ServiceWorkerProvider.h: add missing forward declaration.
839
840 2018-02-21  Zalan Bujtas  <zalan@apple.com>
841
842         [RenderTreeBuilder] Move RenderObject::insertedInto() mutation logic to RenderTreeBuilder
843         https://bugs.webkit.org/show_bug.cgi?id=183022
844         <rdar://problem/37764326>
845
846         Reviewed by Antti Koivisto.
847
848         No change in functionality.
849
850         * rendering/RenderObject.cpp:
851         (WebCore::RenderObject::insertedIntoTree):
852         * rendering/updating/RenderTreeBuilder.cpp:
853         (WebCore::RenderTreeBuilder::insertChildToRenderElementInternal):
854         (WebCore::RenderTreeBuilder::moveChildrenTo):
855         (WebCore::RenderTreeBuilder::multiColumnDescendantInserted): Deleted.
856         * rendering/updating/RenderTreeBuilder.h:
857
858 2018-02-21  Tim Horton  <timothy_horton@apple.com>
859
860         Include all Cocoa sources in all Cocoa platform builds
861         https://bugs.webkit.org/show_bug.cgi?id=183026
862         <rdar://problem/37513101>
863
864         Reviewed by Dan Bernstein.
865
866         Similar to r228571, don't have separate Sources files for iOS and Mac.
867         All sources now have #ifdefs that ensure that only the right ones
868         build on the right platforms. This makes it much easier to reason
869         about what builds where by just looking at the sources.
870
871         * SourcesCocoa.txt:
872         * SourcesIOS.txt: Removed.
873         * SourcesMac.txt: Removed.
874         * WebCore.xcodeproj/project.pbxproj:
875         * editing/WebContentReader.h:
876         * platform/mediastream/mac/ScreenDisplayCaptureSourceMac.h:
877
878 2018-02-21  Youenn Fablet  <youenn@apple.com>
879
880         Make SubstituteResource take a ResourceResponse r-value
881         https://bugs.webkit.org/show_bug.cgi?id=183020
882
883         Reviewed by Alex Christensen.
884
885         No change of behavior.
886         Make SubstituteResource take a ResourceResponse r-value.
887         Update ArchiveResource accordingly.
888         Take benefit of that in ApplicationCacheResource to set the response source to ApplicationCache
889         before passing it to SubstituteResource constructor.
890
891         * loader/SubstituteResource.h:
892         (WebCore::SubstituteResource::SubstituteResource):
893         (WebCore::SubstituteResource::resourceResponse): Deleted.
894         * loader/appcache/ApplicationCacheResource.cpp:
895         (WebCore::ApplicationCacheResource::create):
896         (WebCore::ApplicationCacheResource::ApplicationCacheResource):
897         * loader/appcache/ApplicationCacheResource.h:
898         (WebCore::ApplicationCacheResource::create): Deleted.
899         * loader/archive/ArchiveResource.cpp:
900         (WebCore::ArchiveResource::ArchiveResource):
901
902 2018-02-21  Zalan Bujtas  <zalan@apple.com>
903
904         [RenderTreeBuilder] ::willBeRemoved() does not need RenderTreeBuilder anymore.
905         https://bugs.webkit.org/show_bug.cgi?id=183019
906         <rdar://problem/37761421>
907
908         Reviewed by Antti Koivisto.
909
910         All the willBeDestroyed() mutations have been moved over to RenderTreeBuilder. 
911
912         No change in functionality.
913
914         * rendering/RenderBlock.cpp:
915         (WebCore::RenderBlock::willBeDestroyed):
916         * rendering/RenderBlock.h:
917         * rendering/RenderBlockFlow.cpp:
918         (WebCore::RenderBlockFlow::willBeDestroyed):
919         * rendering/RenderBlockFlow.h:
920         * rendering/RenderBox.cpp:
921         (WebCore::RenderBox::willBeDestroyed):
922         * rendering/RenderBox.h:
923         * rendering/RenderBoxModelObject.cpp:
924         (WebCore::RenderBoxModelObject::willBeDestroyed):
925         * rendering/RenderBoxModelObject.h:
926         * rendering/RenderCounter.cpp:
927         (WebCore::RenderCounter::willBeDestroyed):
928         * rendering/RenderCounter.h:
929         * rendering/RenderElement.cpp:
930         (WebCore::RenderElement::willBeDestroyed):
931         * rendering/RenderElement.h:
932         * rendering/RenderEmbeddedObject.cpp:
933         (WebCore::RenderEmbeddedObject::willBeDestroyed):
934         * rendering/RenderEmbeddedObject.h:
935         * rendering/RenderFragmentedFlow.cpp:
936         (WebCore::RenderFragmentedFlow::willBeDestroyed):
937         * rendering/RenderFragmentedFlow.h:
938         * rendering/RenderImage.cpp:
939         (WebCore::RenderImage::willBeDestroyed):
940         * rendering/RenderImage.h:
941         * rendering/RenderInline.cpp:
942         (WebCore::RenderInline::willBeDestroyed):
943         * rendering/RenderInline.h:
944         * rendering/RenderLayerModelObject.cpp:
945         (WebCore::RenderLayerModelObject::willBeDestroyed):
946         * rendering/RenderLayerModelObject.h:
947         * rendering/RenderListBox.cpp:
948         (WebCore::RenderListBox::willBeDestroyed):
949         * rendering/RenderListBox.h:
950         * rendering/RenderListMarker.cpp:
951         (WebCore::RenderListMarker::willBeDestroyed):
952         * rendering/RenderListMarker.h:
953         * rendering/RenderMenuList.cpp:
954         (WebCore::RenderMenuList::willBeDestroyed):
955         * rendering/RenderMenuList.h:
956         * rendering/RenderObject.cpp:
957         (WebCore::RenderObject::willBeDestroyed):
958         (WebCore::RenderObject::destroy):
959         * rendering/RenderObject.h:
960         * rendering/RenderReplaced.cpp:
961         (WebCore::RenderReplaced::willBeDestroyed):
962         * rendering/RenderReplaced.h:
963         * rendering/RenderSearchField.cpp:
964         (WebCore::RenderSearchField::willBeDestroyed):
965         * rendering/RenderSearchField.h:
966         * rendering/RenderSnapshottedPlugIn.cpp:
967         (WebCore::RenderSnapshottedPlugIn::willBeDestroyed):
968         * rendering/RenderSnapshottedPlugIn.h:
969         * rendering/RenderText.cpp:
970         (WebCore::RenderText::willBeDestroyed):
971         * rendering/RenderText.h:
972         * rendering/RenderTextControlMultiLine.cpp:
973         (WebCore::RenderTextControlMultiLine::willBeDestroyed):
974         * rendering/RenderTextControlMultiLine.h:
975         * rendering/RenderVideo.cpp:
976         (WebCore::RenderVideo::willBeDestroyed):
977         * rendering/RenderVideo.h:
978         * rendering/RenderWidget.cpp:
979         (WebCore::RenderWidget::willBeDestroyed):
980         * rendering/RenderWidget.h:
981         * rendering/svg/RenderSVGBlock.cpp:
982         (WebCore::RenderSVGBlock::willBeDestroyed):
983         * rendering/svg/RenderSVGBlock.h:
984         * rendering/svg/RenderSVGImage.cpp:
985         (WebCore::RenderSVGImage::willBeDestroyed):
986         * rendering/svg/RenderSVGImage.h:
987         * rendering/svg/RenderSVGInline.cpp:
988         (WebCore::RenderSVGInline::willBeDestroyed):
989         * rendering/svg/RenderSVGInline.h:
990         * rendering/svg/RenderSVGModelObject.cpp:
991         (WebCore::RenderSVGModelObject::willBeDestroyed):
992         * rendering/svg/RenderSVGModelObject.h:
993         * rendering/svg/RenderSVGResourceContainer.cpp:
994         (WebCore::RenderSVGResourceContainer::willBeDestroyed):
995         * rendering/svg/RenderSVGResourceContainer.h:
996         * rendering/svg/RenderSVGRoot.cpp:
997         (WebCore::RenderSVGRoot::willBeDestroyed):
998         * rendering/svg/RenderSVGRoot.h:
999         * rendering/svg/RenderSVGText.cpp:
1000         (WebCore::RenderSVGText::willBeDestroyed):
1001         * rendering/svg/RenderSVGText.h:
1002
1003 2018-02-21  Per Arne Vollan  <pvollan@apple.com>
1004
1005         The WebContent process should not use NSScreen in the screenAvailableRect/screenRect implementations.
1006         https://bugs.webkit.org/show_bug.cgi?id=182855
1007
1008         Reviewed by Brent Fulgham.
1009
1010         On macOS, the functions screenAvailableRect and screenRect is implemented using NSScreen, which is communicating
1011         with the WindowServer. To avoid this WindowServer communication from the WebContent process when calling
1012         screenAvailableRect and screenRect, it is possible to let the UIProcess send a message to the WebContent
1013         process whenever there is a change in the display properties, and have the WebContent process cache these
1014         display properties. This message should also be sent to a newly started WebContent process.
1015
1016         No new tests, covered by existing tests.
1017
1018         * WebCore.xcodeproj/project.pbxproj:
1019         * platform/PlatformScreen.h:
1020         * platform/mac/PlatformScreenMac.mm:
1021         (WebCore::getScreenProperties):
1022         (WebCore::screenProperties):
1023         (WebCore::setScreenProperties):
1024         (WebCore::screenRect):
1025         (WebCore::screenAvailableRect):
1026         * platform/ScreenProperties.h: Added.
1027         (WebCore::ScreenProperties::encode const):
1028         (WebCore::ScreenProperties::decode):
1029
1030 2018-02-21  Christopher Reid  <chris.reid@sony.com>
1031
1032         [Curl] Curl Cookie Database File should be configurable using NetworkProcessCreationParameters
1033         https://bugs.webkit.org/show_bug.cgi?id=182751
1034
1035         Reviewed by Youenn Fablet.
1036
1037         No change in behavior.
1038
1039         Adding support to set a custom CookieJar Database.
1040         Took CookieJarDB::open() out of its constructor because both the Network and Web process
1041         were trying to open the journal files but one process was failing due to a lack of permission.
1042         Now the database file is lazily opened and only the Network process will try to open the database.
1043         Some cleanup was done to CookieJarDB too.
1044
1045         * platform/network/NetworkStorageSession.h:
1046         * platform/network/curl/CookieJarDB.cpp:
1047         * platform/network/curl/CookieJarDB.h:
1048         * platform/network/curl/NetworkStorageSessionCurl.cpp:
1049
1050 2018-02-21  Chris Dumez  <cdumez@apple.com>
1051
1052         Regression(r228708): Crash under WebCore::MediaResource::responseReceived(WebCore::CachedResource&, WebCore::ResourceResponse const&)
1053         https://bugs.webkit.org/show_bug.cgi?id=183018
1054         <rdar://problem/37754154>
1055
1056         Reviewed by Eric Carlson.
1057
1058         The fix at r228708 was trying to address the fact that avplayer sometimes
1059         deallocates WebCoreNSURLSessionDataTask objects on a non-main thread, which
1060         was not safe because its _resource data member needs to be deallocated on
1061         the main thread.
1062
1063         The issue is that r228708 caused _resource to outlive its WebCoreNSURLSessionDataTask.
1064         This is an issue because _resource has a client data member (of type WebCoreNSURLSessionDataTaskClient)
1065         which has a raw pointer to the WebCoreNSURLSessionDataTask. This means that the main thread could
1066         call methods like responseReceived() on the resource, which would call responseReceived() on the
1067         client, which would try to call [WebCoreNSURLSessionDataTask receivedResponse:] with an invalid
1068         m_task pointer.
1069
1070         To address the issue, I introduced a clearTask() method on WebCoreNSURLSessionDataTaskClient, which
1071         gets called from a non-main thread to clear the client's m_task pointer when the task is destroyed
1072         on a non-main thread. So that this is safe, every time the client tries to use m_task, we now
1073         acquire a lock for thread-safety and do a null-check on m_task.
1074
1075         No new tests, no known reproduction case.
1076
1077         * platform/graphics/PlatformMediaResourceLoader.h:
1078         (WebCore::PlatformMediaResource::client):
1079         * platform/network/cocoa/WebCoreNSURLSession.mm:
1080         (WebCore::WebCoreNSURLSessionDataTaskClient::clearTask):
1081         (WebCore::WebCoreNSURLSessionDataTaskClient::dataSent):
1082         (WebCore::WebCoreNSURLSessionDataTaskClient::responseReceived):
1083         (WebCore::WebCoreNSURLSessionDataTaskClient::shouldCacheResponse):
1084         (WebCore::WebCoreNSURLSessionDataTaskClient::dataReceived):
1085         (WebCore::WebCoreNSURLSessionDataTaskClient::redirectReceived):
1086         (WebCore::WebCoreNSURLSessionDataTaskClient::accessControlCheckFailed):
1087         (WebCore::WebCoreNSURLSessionDataTaskClient::loadFailed):
1088         (WebCore::WebCoreNSURLSessionDataTaskClient::loadFinished):
1089         (-[WebCoreNSURLSessionDataTask dealloc]):
1090
1091 2018-02-21  Youenn Fablet  <youenn@apple.com>
1092
1093         Move AppCache loading to the NetworkProcess
1094         https://bugs.webkit.org/show_bug.cgi?id=178540
1095         <rdar://problem/37119346>
1096
1097         Reviewed by Alex Christensen.
1098
1099         Covered by existing tests.
1100
1101         Use ApplicationResourceLoader for cache entry loading.
1102         Remove all ResourceHandle use from ApplicationCacheGroup.
1103         Renamed m_loader in m_manifestLoader and added a new m_entryLoader to load cache entries.
1104
1105         Updated ApplicationCacheResourceLoader to handle different types of CachedResource.
1106         This allows in particular to handle redirections based on the resource type and create the ApplicationCacheResource with the right type.
1107         Use Include as credentials mode as per specification.
1108
1109         Add a new ApplicationCache ResourceResonse::Source.
1110         This allows fixing an assertion and should allow better inspector support if needs be.
1111
1112         * inspector/agents/InspectorNetworkAgent.cpp:
1113         (WebCore::responseSource):
1114         * loader/ResourceLoader.cpp:
1115         (WebCore::logResourceResponseSource):
1116         * loader/SubstituteResource.h:
1117         (WebCore::SubstituteResource::resourceResponse):
1118         * loader/appcache/ApplicationCacheGroup.cpp:
1119         (WebCore::ApplicationCacheGroup::stopLoading):
1120         (WebCore::ApplicationCacheGroup::update):
1121         (WebCore::ApplicationCacheGroup::didFinishLoading):
1122         (WebCore::ApplicationCacheGroup::didFinishLoadingEntry):
1123         (WebCore::ApplicationCacheGroup::didFail):
1124         (WebCore::ApplicationCacheGroup::didFailLoadingEntry):
1125         (WebCore::ApplicationCacheGroup::checkIfLoadIsComplete):
1126         (WebCore::ApplicationCacheGroup::startLoadingEntry):
1127         * loader/appcache/ApplicationCacheGroup.h:
1128         * loader/appcache/ApplicationCacheResource.cpp:
1129         (WebCore::ApplicationCacheResource::ApplicationCacheResource):
1130         * loader/appcache/ApplicationCacheResourceLoader.cpp:
1131         (WebCore::ApplicationCacheResourceLoader::create):
1132         (WebCore::ApplicationCacheResourceLoader::ApplicationCacheResourceLoader):
1133         (WebCore::ApplicationCacheResourceLoader::responseReceived):
1134         (WebCore::ApplicationCacheResourceLoader::redirectReceived):
1135         * loader/appcache/ApplicationCacheResourceLoader.h:
1136         * platform/network/ResourceResponseBase.h:
1137         * platform/network/cocoa/ResourceResponseCocoa.mm:
1138         (WebCore::ResourceResponse::platformCertificateInfo const):
1139         * testing/Internals.cpp:
1140         (WebCore::responseSourceToString):
1141
1142 2018-02-21  Zalan Bujtas  <zalan@apple.com>
1143
1144         [RenderTreeBuilder] Move RenderBoxModelObject::willBeRemoved() mutation logic to RenderTreeBuilder
1145         https://bugs.webkit.org/show_bug.cgi?id=183014
1146         <rdar://problem/37757428>
1147
1148         Reviewed by Antti Koivisto.
1149
1150         No change in functionality.
1151
1152         * Sources.txt:
1153         * WebCore.xcodeproj/project.pbxproj:
1154         * rendering/RenderBoxModelObject.cpp:
1155         (WebCore::RenderBoxModelObject::~RenderBoxModelObject):
1156         (WebCore::RenderBoxModelObject::willBeDestroyed):
1157         (WebCore::RenderBoxModelObject::continuationChainNode const):
1158         (): Deleted.
1159         (WebCore::RenderBoxModelObject::removeAndDestroyAllContinuations): Deleted.
1160         * rendering/RenderBoxModelObject.h:
1161         * rendering/updating/RenderTreeBuilder.cpp:
1162         (WebCore::RenderTreeBuilder::RenderTreeBuilder):
1163         (WebCore::RenderTreeBuilder::removeAndDestroy):
1164         * rendering/updating/RenderTreeBuilder.h:
1165         (WebCore::RenderTreeBuilder::continuationBuilder):
1166         * rendering/updating/RenderTreeBuilderContinuation.cpp: Added.
1167         (WebCore::RenderTreeBuilder::Continuation::Continuation):
1168         (WebCore::RenderTreeBuilder::Continuation::cleanupOnDestroy):
1169         * rendering/updating/RenderTreeBuilderContinuation.h: Added.
1170
1171 2018-02-21  Youenn Fablet  <youenn@apple.com>
1172
1173         ServiceWorkerJob::m_lastResponse is unneeded
1174         https://bugs.webkit.org/show_bug.cgi?id=183013
1175
1176         Reviewed by Chris Dumez.
1177
1178         Remove this field since not used anywhere.
1179
1180         * workers/service/ServiceWorkerJob.cpp:
1181         (WebCore::ServiceWorkerJob::didReceiveResponse):
1182         * workers/service/ServiceWorkerJob.h:
1183
1184 2018-02-21  Youenn Fablet  <youenn@apple.com>
1185
1186         Use ResourceLoader to load appcache manifest
1187         https://bugs.webkit.org/show_bug.cgi?id=182861
1188
1189         Reviewed by Alex Christensen.
1190
1191         Covered by updated tests.
1192
1193         Add ApplicationCacheResourceLoader to load an ApplicationCacheResource from a ResourceLoader.
1194         Make use of it to load the app cache manifest.
1195         Future work should load entries using the same loader.
1196
1197         Remove manifest handle.
1198         Ensure that DocumentLoader does not register the manifest resource loader as its lifetime
1199         is handled by its ApplicationCacheGroup.
1200
1201         Add a ResourceLoader option to bypass the application cache.
1202         Use it for manifest loading.
1203
1204         * Sources.txt:
1205         * WebCore.xcodeproj/project.pbxproj:
1206         * loader/DocumentLoader.cpp:
1207         (WebCore::DocumentLoader::addSubresourceLoader):
1208         * loader/ResourceLoaderOptions.h:
1209         * loader/appcache/ApplicationCacheGroup.cpp:
1210         (WebCore::ApplicationCacheGroup::stopLoading):
1211         (WebCore::ApplicationCacheGroup::update):
1212         (WebCore::ApplicationCacheGroup::createRequest):
1213         (WebCore::ApplicationCacheGroup::didReceiveResponseAsync):
1214         (WebCore::ApplicationCacheGroup::didReceiveData):
1215         (WebCore::ApplicationCacheGroup::didFinishLoading):
1216         (WebCore::ApplicationCacheGroup::didFail):
1217         (WebCore::ApplicationCacheGroup::didFinishLoadingManifest):
1218         (WebCore::ApplicationCacheGroup::checkIfLoadIsComplete):
1219         * loader/appcache/ApplicationCacheGroup.h:
1220         * loader/appcache/ApplicationCacheHost.cpp:
1221         (WebCore::ApplicationCacheHost::maybeLoadResource):
1222         (WebCore::ApplicationCacheHost::maybeLoadFallbackForRedirect):
1223         (WebCore::ApplicationCacheHost::maybeLoadFallbackForResponse):
1224         (WebCore::ApplicationCacheHost::maybeLoadFallbackForError):
1225         * loader/appcache/ApplicationCacheResourceLoader.cpp: Added.
1226         * loader/appcache/ApplicationCacheResourceLoader.h: Added.
1227
1228 2018-02-21  Don Olmstead  <don.olmstead@sony.com>
1229
1230         [CMake][Win] Use cmakeconfig.h rather than config.h and Platform.h
1231         https://bugs.webkit.org/show_bug.cgi?id=182883
1232
1233         Reviewed by Per Arne Vollan.
1234
1235         No new tests. No change in behavior.
1236
1237         * WebCorePrefix.h:
1238         * config.h:
1239         * testing/js/WebCoreTestSupportPrefix.h:
1240
1241 2018-02-21  Zalan Bujtas  <zalan@apple.com>
1242
1243         [RenderTreeBuilder] Move RenderView::willBeRemoved() mutation logic to RenderTreeBuilder
1244         https://bugs.webkit.org/show_bug.cgi?id=183009
1245
1246         Reviewed by Antti Koivisto.
1247
1248         No change in functionality.
1249
1250         * dom/Document.cpp:
1251         (WebCore::Document::destroyRenderTree):
1252         * rendering/RenderView.cpp:
1253         (WebCore::RenderView::~RenderView):
1254         (WebCore::RenderView::willBeDestroyed): Deleted.
1255         * rendering/RenderView.h:
1256
1257 2018-02-21  Michael Catanzaro  <mcatanzaro@igalia.com>
1258
1259         [GTK] USE_UPOWER causes crashes inside a chroot or on systems with broken dbus/upower
1260         https://bugs.webkit.org/show_bug.cgi?id=181825
1261
1262         Reviewed by Carlos Garcia Campos.
1263
1264         We could fix this crash, but that would not be good enough, because upower-glib is a
1265         synchronous API that wraps D-Bus calls. That's not acceptable for use in the web process.
1266         Rewrite LowPowerModeNotifierGLib to use upower's D-Bus API directly, instead.
1267
1268         Note that this also enables LowPowerModeNotifier for WPE, since the USE(UPOWER) build
1269         flag is no longer needed.
1270
1271         * platform/LowPowerModeNotifier.cpp:
1272         * platform/LowPowerModeNotifier.h:
1273         * platform/glib/LowPowerModeNotifierGLib.cpp:
1274         (WebCore::LowPowerModeNotifier::LowPowerModeNotifier):
1275         (WebCore::LowPowerModeNotifier::updateWarningLevel):
1276         (WebCore::LowPowerModeNotifier::warningLevelChanged):
1277         (WebCore::LowPowerModeNotifier::gPropertiesChangedCallback):
1278         (WebCore::LowPowerModeNotifier::~LowPowerModeNotifier):
1279         (WebCore::LowPowerModeNotifier::updateState): Deleted.
1280         (WebCore::LowPowerModeNotifier::warningLevelCallback): Deleted.
1281
1282 2018-02-21  Chris Dumez  <cdumez@apple.com>
1283
1284         VTTCue constructor should use 'double' type for startTime / endTime
1285         https://bugs.webkit.org/show_bug.cgi?id=182988
1286
1287         Reviewed by Eric Carlson.
1288
1289         VTTCue constructor should use 'double' type for startTime / endTime, not
1290         'unrestricted double':
1291         - https://w3c.github.io/webvtt/#the-vttcue-interface
1292
1293         Otherwise, we end up potentially returning NaN for TextTrackCue.startTime / endTime,
1294         even though those correctly use type 'double':
1295         - https://html.spec.whatwg.org/multipage/media.html#texttrackcue
1296
1297         The new behavior is consistent with Firefox and Chrome.
1298
1299         No new tests, updated existing test.
1300
1301         * bindings/js/JSDOMConvertNumbers.h:
1302         (WebCore::JSConverter<IDLDouble>::convert):
1303         Add assertion to make sure our implementation never tries to return NaN
1304         for an IDL attribute of type 'double'. This would be invalid as per Web
1305         IDL spec and would crash if the NaN being returned was impure as JSValue
1306         could not store it as a double.
1307
1308         * html/track/VTTCue.idl:
1309         Update constructor parameters to use 'double' type instead of 'unrestricted
1310         double', as per:
1311         - https://w3c.github.io/webvtt/#the-vttcue-interface
1312
1313 2018-02-21  Zalan Bujtas  <zalan@apple.com>
1314
1315         [RenderTreeBuilder] Move RenderTextFragment::willBeRemoved() mutation logic to RenderTreeBuilder
1316         https://bugs.webkit.org/show_bug.cgi?id=182946
1317         <rdar://problem/37690039>
1318
1319         Reviewed by Antti Koivisto.
1320
1321         No change in functionality.
1322
1323         * rendering/RenderTextFragment.cpp:
1324         (WebCore::RenderTextFragment::willBeDestroyed):
1325         * rendering/updating/RenderTreeBuilder.cpp:
1326         (WebCore::RenderTreeBuilder::takeChild):
1327         * rendering/updating/RenderTreeBuilderFirstLetter.cpp:
1328         (WebCore::RenderTreeBuilder::FirstLetter::cleanupOnRemoval):
1329         * rendering/updating/RenderTreeBuilderFirstLetter.h:
1330
1331 2018-02-21  Ms2ger  <Ms2ger@igalia.com>
1332
1333         [GCrypt] Remove unsound assertion from CryptoKeyRSA::exportData().
1334         https://bugs.webkit.org/show_bug.cgi?id=183001
1335
1336         Reviewed by Philippe Normand.
1337
1338         This function is called from structured cloning, in particular when storing
1339         a key in IndexedDB. This would trip the assertion if the key in question is
1340         non-exportable.
1341
1342         The assertion was copied from the macOS implementation in r172389; it was
1343         subsequently removed there in r172898 to handle this case.
1344
1345         Test: crypto/subtle/rsa-indexeddb-non-exportable.html
1346
1347         * crypto/gcrypt/CryptoKeyRSAGCrypt.cpp:
1348         (WebCore::CryptoKeyRSA::exportData const): remove assertion.
1349
1350 2018-02-21  Myles C. Maxfield  <mmaxfield@apple.com>
1351
1352         [Cocoa] Make system-ui obey the user-installed-font policy
1353         https://bugs.webkit.org/show_bug.cgi?id=182860
1354         <rdar://problem/36158249>
1355
1356         Reviewed by Antti Koivisto.
1357
1358         We have a completely different codepath for system-ui which makes it follow the system's
1359         font cascade list. This codepath (along with all the other relevant places which create
1360         system fonts) needs to obey the AllowUserInstalledFonts enum. This patch is fairly
1361         mechanical; we simply are hooking up the flag across SystemFontDatabase.
1362
1363         There are a few places which creates system fonts which this patch doesn't touch. This is
1364         not a problem because all the remaining places either:
1365         1) Simply pull out some attributes of the font (name, weight, size, etc.) and then throw
1366         away the font object itself, or
1367         2) Use the font in an environment where script cannot access the characters rendered (such
1368         as DragImages or the fullscreen placeholder view or the inside of the attachment element).
1369
1370         Test: fast/text/user-installed-fonts/system-ui.html
1371
1372         * platform/graphics/cocoa/FontCacheCoreText.cpp:
1373         (WebCore::FontDatabase::collectionForFamily):
1374         (WebCore::FontDatabase::fontForPostScriptName):
1375         (WebCore::fontWithFamily):
1376         (WebCore::installedFontMandatoryAttributes):
1377         (WebCore::createSpecificFontForInstalledFonts):
1378         * platform/graphics/cocoa/FontCacheCoreText.h:
1379         * platform/graphics/cocoa/FontDescriptionCocoa.cpp:
1380         (WebCore::SystemFontDatabase::CoreTextCascadeListParameters::operator== const):
1381         (WebCore::SystemFontDatabase::CoreTextCascadeListParameters::hash const):
1382         (WebCore::SystemFontDatabase::systemFontCascadeList):
1383         (WebCore::SystemFontDatabase::removeCascadeList):
1384         (WebCore::SystemFontDatabase::computeCascadeList):
1385         (WebCore::systemFontParameters):
1386         (WebCore::systemFontCascadeList):
1387         (WebCore::FontCascadeDescription::effectiveFamilyCount const):
1388         (WebCore::FontCascadeDescription::effectiveFamilyAt const):
1389         * platform/graphics/ios/FontCacheIOS.mm:
1390         (WebCore::platformFontWithFamilySpecialCase):
1391         * platform/graphics/mac/FontCacheMac.mm:
1392         (WebCore::platformFontWithFamilySpecialCase):
1393
1394 2018-02-21  Chris Dumez  <cdumez@apple.com>
1395
1396         Unreviewed attempt to fix build after r228867.
1397
1398         * Modules/webvr/VRStageParameters.cpp:
1399
1400 2018-02-21  Philippe Normand  <pnormand@igalia.com>
1401
1402         [GStreamer] Rewrite purgeInvalid*Tracks methods
1403         https://bugs.webkit.org/show_bug.cgi?id=183004
1404
1405         Reviewed by Carlos Garcia Campos.
1406
1407         Removing items from a hashmap while iterating is bad.
1408
1409         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:
1410         (WebCore::MediaPlayerPrivateGStreamer::purgeInvalidAudioTracks):
1411         Safely remove items from the hashmap using removeIf().
1412         (WebCore::MediaPlayerPrivateGStreamer::purgeInvalidVideoTracks): Ditto.
1413         (WebCore::MediaPlayerPrivateGStreamer::purgeInvalidTextTracks): Ditto.
1414
1415 2018-02-21  Chris Dumez  <cdumez@apple.com>
1416
1417         Unreviewed attempt to fix build after r228867.
1418
1419         * Modules/webvr/VRStageParameters.cpp:
1420
1421 2018-02-21  Philippe Normand  <pnormand@igalia.com>
1422
1423         [GStreamer] Crash in Debug build when purging invalid tracks
1424         https://bugs.webkit.org/show_bug.cgi?id=182997
1425
1426         Reviewed by Xabier Rodriguez-Calvar.
1427
1428         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:
1429         (WebCore::MediaPlayerPrivateGStreamer::purgeInvalidAudioTracks): Clear the hashmap when there is no valid track left.
1430         (WebCore::MediaPlayerPrivateGStreamer::purgeInvalidVideoTracks): Ditto.
1431         (WebCore::MediaPlayerPrivateGStreamer::purgeInvalidTextTracks): Ditto.
1432         * platform/graphics/gstreamer/TrackPrivateBaseGStreamer.cpp:
1433         (WebCore::TrackPrivateBaseGStreamer::getLanguageCode): Demote debugging, this appears too much at least with playbin2.
1434         (WebCore::TrackPrivateBaseGStreamer::getTag): Ditto.
1435
1436 2018-02-21  Philippe Normand  <pnormand@igalia.com>
1437
1438         [GStreamer] We need to adopt GstGlDisplays after GStreamer 1.13.1
1439         https://bugs.webkit.org/show_bug.cgi?id=182996
1440
1441         Reviewed by Xabier Rodriguez-Calvar.
1442
1443         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp:
1444         (WebCore::MediaPlayerPrivateGStreamerBase::ensureGstGLContext):
1445         Adopt references when running with GStreamer 1.13.1 to avoid
1446         memory leaks.
1447
1448 2018-02-20  Philippe Normand  <pnormand@igalia.com>
1449
1450         [GTK] Layout test media/track/track-in-band-duplicate-tracks-when-source-changes.html failing since r228617
1451         https://bugs.webkit.org/show_bug.cgi?id=160131
1452         <rdar://problem/35873985>
1453
1454         Reviewed by Michael Catanzaro.
1455
1456         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:
1457         (WebCore::MediaPlayerPrivateGStreamer::notifyPlayerOfText): We
1458         can't assume the pad has a sticky event here like implemented in
1459         InbandTextTrackPrivateGStreamer because it might be emitted after
1460         the track was created. So fallback to a dummy stream ID like in
1461         the Audio and Video tracks.
1462
1463 2018-02-20  Sergio Villar Senin  <svillar@igalia.com>
1464
1465         [WebVR][OpenVR] Retrieve stage parameters
1466         https://bugs.webkit.org/show_bug.cgi?id=182976
1467
1468         Reviewed by Žan Doberšek.
1469
1470         Use OpenVR to retrieve stage parameters, i.e., play area size and
1471         the transformation from sitting to standing position. It includes
1472         the same fallback used by Firefox to provide sensible values in case
1473         we cannot get the required information from the VR SDK (it's quite
1474         common not to have defined a play area).
1475
1476         * Modules/webvr/VRDisplay.cpp:
1477         (WebCore::VRDisplay::stageParameters const):
1478         * Modules/webvr/VRDisplay.h:
1479         * Modules/webvr/VRStageParameters.cpp:
1480         (WebCore::VRStageParameters::VRStageParameters):
1481         (WebCore::VRStageParameters::sittingToStandingTransform const):
1482         (WebCore::VRStageParameters::sizeX const):
1483         (WebCore::VRStageParameters::sizeZ const):
1484         * Modules/webvr/VRStageParameters.h:
1485         (WebCore::VRStageParameters::create):
1486         * platform/vr/VRPlatformDisplay.h:
1487         * platform/vr/openvr/VRPlatformDisplayOpenVR.cpp:
1488         (WebCore::VRPlatformDisplayOpenVR::VRPlatformDisplayOpenVR):
1489         (WebCore::VRPlatformDisplayOpenVR::updateStageParameters):
1490         * platform/vr/openvr/VRPlatformDisplayOpenVR.h:
1491
1492 2018-02-21  Philippe Normand  <pnormand@igalia.com>
1493
1494         [GStreamer] Create a Wayland GL display instead of EGL
1495         https://bugs.webkit.org/show_bug.cgi?id=182968
1496
1497         Reviewed by Xabier Rodriguez-Calvar.
1498
1499         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp:
1500         (WebCore::MediaPlayerPrivateGStreamerBase::ensureGstGLContext):
1501         Add logging and instantiate a GstDisplayWayland display instead of
1502         an EGL display when running under a Wayland compositor.
1503
1504 2018-02-21  Zalan Bujtas  <zalan@apple.com>
1505
1506         [RenderTreeBuilder] Move RenderFullScreen::willBeRemoved() mutation logic to RenderTreeBuilder
1507         https://bugs.webkit.org/show_bug.cgi?id=182947
1508         <rdar://problem/37690848>
1509
1510         Reviewed by Antti Koivisto.
1511
1512         No change in functionality.
1513
1514         * Sources.txt:
1515         * WebCore.xcodeproj/project.pbxproj:
1516         * rendering/RenderFullScreen.cpp:
1517         (WebCore::RenderFullScreen::willBeDestroyed):
1518         * rendering/updating/RenderTreeBuilder.cpp:
1519         (WebCore::RenderTreeBuilder::takeChild):
1520         * rendering/updating/RenderTreeBuilder.h:
1521         (WebCore::RenderTreeBuilder::fullScreenBuilder):
1522         * rendering/updating/RenderTreeBuilderFullScreen.cpp: Added.
1523         (WebCore::RenderTreeBuilder::FullScreen::FullScreen):
1524         (WebCore::RenderTreeBuilder::FullScreen::cleanupOnRemoval):
1525         * rendering/updating/RenderTreeBuilderFullScreen.h: Added.
1526         * rendering/updating/RenderTreeBuilderMathML.cpp:
1527
1528 2018-02-20  Zalan Bujtas  <zalan@apple.com>
1529
1530         [RenderTreeBuilder] Move RenderListItem::willBeRemoved() mutation logic to RenderTreeBuilder
1531         https://bugs.webkit.org/show_bug.cgi?id=182943
1532         <rdar://problem/37689029>
1533
1534         Reviewed by Antti Koivisto.
1535
1536         We don't need to destroy the marker in RenderListItem::willBeRemoved(), because it gets deleted
1537         in RenderTreeBuilder::removeAndDestroy() together with RenderListItem (as long as the marker is
1538         the RenderListItem's descendent). 
1539
1540         Covered by existing tests.
1541
1542         * rendering/RenderListItem.cpp:
1543         (WebCore::RenderListItem::~RenderListItem):
1544         (WebCore::RenderListItem::willBeDestroyed): Deleted.
1545         * rendering/RenderListItem.h:
1546
1547 2018-02-20  Nan Wang  <n_wang@apple.com>
1548
1549         AX: Keyboard focus not following VoiceOver cursor into web content or within web content.
1550         https://bugs.webkit.org/show_bug.cgi?id=182752
1551         <rdar://problem/37518233>
1552
1553         Reviewed by Ryosuke Niwa.
1554
1555         Call the assistive technology specific method for becoming first responder.
1556
1557         Test: accessibility/mac/accessibility-make-first-responder.html
1558
1559         * accessibility/mac/WebAccessibilityObjectWrapperMac.mm:
1560         (-[WebAccessibilityObjectWrapper _accessibilitySetValue:forAttribute:]):
1561         * page/ChromeClient.h:
1562
1563 2018-02-20  Tim Horton  <timothy_horton@apple.com>
1564
1565         Introduce HAVE(IOSURFACE_ACCELERATOR)
1566         https://bugs.webkit.org/show_bug.cgi?id=182955
1567         <rdar://problem/37699510>
1568
1569         Reviewed by Sam Weinig.
1570
1571         No new tests, no change in behavior.
1572
1573         Introduce HAVE(IOSURFACE_ACCELERATOR) and guard all uses of
1574         IOSurfaceAccelerator behind it.
1575
1576         Rename USE(IOSURFACE) to HAVE(IOSURFACE) for accuracy.
1577
1578         * page/cocoa/MemoryReleaseCocoa.mm:
1579         * platform/graphics/ca/TileController.cpp:
1580         * platform/graphics/cg/IOSurfacePool.cpp:
1581         * platform/graphics/cg/IOSurfacePool.h:
1582         * platform/graphics/cg/ImageBufferCG.cpp:
1583         * platform/graphics/cocoa/IOSurface.h:
1584         * platform/graphics/cocoa/IOSurface.mm:
1585         * platform/graphics/cocoa/IOSurfacePoolCocoa.mm:
1586         * platform/graphics/cv/VideoTextureCopierCV.cpp:
1587         * platform/graphics/cv/VideoTextureCopierCV.h:
1588
1589 2018-02-20  Chris Dumez  <cdumez@apple.com>
1590
1591         Provisional load may get committed before receiving the decidePolicyForNavigationResponse response
1592         https://bugs.webkit.org/show_bug.cgi?id=182720
1593         <rdar://problem/37515204>
1594
1595         Reviewed by Alex Christensen.
1596
1597         Wait for the policy response from the client after receiving a resource response,
1598         before sending the NetworkResourceLoader::ContinueDidReceiveResponse IPC back to
1599         the NetworkProcess. Otherwise, the network process may start sending us data and
1600         we may end up committing the provisional load before receiving the policy decision
1601         fron the client.
1602
1603         Change is covered by new API test.
1604
1605         * loader/DocumentLoader.cpp:
1606         (WebCore::DocumentLoader::responseReceived):
1607         * loader/NetscapePlugInStreamLoader.cpp:
1608         (WebCore::NetscapePlugInStreamLoader::didReceiveResponse):
1609         * loader/NetscapePlugInStreamLoader.h:
1610         * loader/ResourceLoader.cpp:
1611         (WebCore::ResourceLoader::deliverResponseAndData):
1612         (WebCore::ResourceLoader::loadDataURL):
1613         (WebCore::ResourceLoader::didReceiveResponse):
1614         (WebCore::ResourceLoader::didReceiveResponseAsync):
1615         * loader/ResourceLoader.h:
1616         * loader/SubresourceLoader.cpp:
1617         (WebCore::SubresourceLoader::didReceiveResponse):
1618         (WebCore::SubresourceLoader::didReceiveResponsePolicy):
1619         (WebCore::SubresourceLoader::willCancel):
1620         * loader/SubresourceLoader.h:
1621         * loader/ios/PreviewLoader.mm:
1622         (-[WebPreviewLoader _sendDidReceiveResponseIfNecessary]):
1623
1624 2018-02-20  Chris Dumez  <cdumez@apple.com>
1625
1626         Crash under JSC::JSCell::toNumber(JSC::ExecState*)
1627         https://bugs.webkit.org/show_bug.cgi?id=182984
1628         <rdar://problem/37694346>
1629
1630         Reviewed by Mark Lam.
1631
1632         The issue was caused by DOMMatrix attributes potentially returning "impure"
1633         NaN values. We would call JSC::jsNumber(double) to construct the JSValue
1634         but this is only safe for pure NaN values. Make sure we purify the double
1635         returned by the implementation for IDL attributes of type 'unrestricted double'
1636         before calling JSC::jsNumber(double).
1637
1638         No new tests, extended existing test.
1639
1640         * bindings/js/JSDOMConvertNumbers.h:
1641         (WebCore::JSConverter<IDLUnrestrictedDouble>::convert):
1642         * testing/TypeConversions.h:
1643         (WebCore::TypeConversions::testImpureNaNUnrestrictedDouble const):
1644         (WebCore::TypeConversions::testImpureNaN2UnrestrictedDouble const):
1645         (WebCore::TypeConversions::testQuietNaNUnrestrictedDouble const):
1646         * testing/TypeConversions.idl:
1647
1648 2018-02-20  Tim Horton  <timothy_horton@apple.com>
1649
1650         Make more use of USE(OPENGL_ES) where it makes sense
1651         https://bugs.webkit.org/show_bug.cgi?id=182957
1652         <rdar://problem/37699443>
1653
1654         Reviewed by Dan Bernstein.
1655
1656         No new tests, no behavior change.
1657
1658         Make use of USE(OPENGL_ES) for CoreVideo functions that differ based
1659         on GL availability. Also adjust GraphicsContext3D in the same way.
1660
1661         * platform/cocoa/CoreVideoSoftLink.cpp:
1662         * platform/cocoa/CoreVideoSoftLink.h:
1663         * platform/graphics/GraphicsContext3D.h:
1664         * platform/graphics/cv/TextureCacheCV.mm:
1665         (WebCore::TextureCacheCV::create):
1666         (WebCore::TextureCacheCV::textureFromImage):
1667         * platform/graphics/cv/VideoTextureCopierCV.cpp:
1668         (WebCore::enumToStringMap):
1669         (WebCore::VideoTextureCopierCV::initializeContextObjects):
1670         (WebCore::VideoTextureCopierCV::initializeUVContextObjects):
1671         (WebCore::VideoTextureCopierCV::copyImageToPlatformTexture):
1672         (WebCore::VideoTextureCopierCV::copyVideoTextureToPlatformTexture):
1673
1674 2018-02-20  Nan Wang  <n_wang@apple.com>
1675
1676         AX: AOM: Dispatch accessibleclick event
1677         https://bugs.webkit.org/show_bug.cgi?id=180898
1678         <rdar://problem/36086710>
1679
1680         Reviewed by Ryosuke Niwa.
1681
1682         Accessibility events.
1683         Spec: https://wicg.github.io/aom/spec/phase2.html
1684
1685         This patch allows developers to register event handlers on Elements
1686         for custom accessibility events.
1687
1688         Accessibility events go through a capturing and bubbling phase just
1689         like DOM events, but in the accessibility tree.
1690
1691         Implemented "accessibleclick" event.
1692
1693         Test: accessibility/mac/AOM-events.html
1694
1695         * accessibility/AccessibilityObject.cpp:
1696         (WebCore::AccessibilityObject::press):
1697         (WebCore::AccessibilityObject::dispatchAccessibilityEvent):
1698         * accessibility/AccessibilityObject.h:
1699         * accessibility/mac/WebAccessibilityObjectWrapperMac.mm:
1700         (-[WebAccessibilityObjectWrapper accessibilityPerformAction:]):
1701         * dom/Element.idl:
1702         * dom/EventDispatcher.cpp:
1703         (WebCore::dispatchEventWithType):
1704         (WebCore::EventDispatcher::dispatchEvent):
1705         * dom/EventDispatcher.h:
1706         * dom/EventNames.h:
1707         * dom/EventPath.cpp:
1708         (WebCore::EventPath::EventPath):
1709         * dom/EventPath.h:
1710
1711 2018-02-20  Wenson Hsieh  <wenson_hsieh@apple.com>
1712
1713         [iOS 11.3 Beta] Can't copy a URL from Safari and paste it into the Gmail app
1714         https://bugs.webkit.org/show_bug.cgi?id=182952
1715         <rdar://problem/37636190>
1716
1717         Reviewed by Tim Horton.
1718
1719         After r220865 refactored the iOS copy codepaths to use NSItemProviders, we stopped writing the URL as plain text
1720         to the pasteboard. However, this means clients that only check for "text/plain" (or one of its aliases) on the
1721         pasteboard won't read any data on paste.
1722
1723         To fix this, we restore the pre-iOS 11.3 behavior of writing both the URL and plain text to the pasteboard.
1724         Since we're using item providers, we also ensure that the NSURL is at a higher fidelity than the string to make
1725         it clear that the data should be consumed as a URL.
1726
1727         This patch also rebaselines an existing drag and drop test to cover this change, and adds a new API test,
1728         ActionSheetTests.CopyLinkWritesURLAndPlainText, which simulates copying a link using the share sheet and pasting
1729         into a DataTransfer-dumping test harness.
1730
1731         * platform/ios/PlatformPasteboardIOS.mm:
1732         (WebCore::PlatformPasteboard::write):
1733
1734 2018-02-20  Eric Carlson  <eric.carlson@apple.com>
1735
1736         [iOS] Returning from Auto-PiP causes Safari to be unresponsive
1737         https://bugs.webkit.org/show_bug.cgi?id=182977
1738         <rdar://problem/37685981>
1739
1740         Reviewed by Jer Noble.
1741
1742         Remove the error handling added in r228115, it breaks auto-pip.
1743
1744         * platform/ios/VideoFullscreenInterfaceAVKit.mm:
1745         (VideoFullscreenInterfaceAVKit::applicationDidBecomeActive):
1746         (VideoFullscreenInterfaceAVKit::enterFullscreenStandard):
1747         (VideoFullscreenInterfaceAVKit::exitFullscreen):
1748         (VideoFullscreenInterfaceAVKit::cleanupFullscreen):
1749         (VideoFullscreenInterfaceAVKit::didStartPictureInPicture):
1750         (VideoFullscreenInterfaceAVKit::prepareForPictureInPictureStopWithCompletionHandler):
1751         (VideoFullscreenInterfaceAVKit::exitFullscreenHandler):
1752         (VideoFullscreenInterfaceAVKit::enterFullscreenHandler):
1753
1754 2018-02-20  Jer Noble  <jer.noble@apple.com>
1755
1756         [EME] Adopt new AVContentKeySession success delegate callback
1757         https://bugs.webkit.org/show_bug.cgi?id=182974
1758         <rdar://problem/36079035>
1759
1760         Reviewed by Eric Carlson.
1761
1762         Store the updateLicenseCallback if the new protocol method is present and supported.
1763
1764         * platform/graphics/avfoundation/objc/CDMInstanceFairPlayStreamingAVFObjC.h:
1765         * platform/graphics/avfoundation/objc/CDMInstanceFairPlayStreamingAVFObjC.mm:
1766         (-[WebCoreFPSContentKeySessionDelegate contentKeySession:contentKeyRequestDidSucceed:]):
1767         (WebCore::CDMInstanceFairPlayStreamingAVFObjC::updateLicense):
1768         (WebCore::CDMInstanceFairPlayStreamingAVFObjC::didFailToProvideRequest):
1769         (WebCore::CDMInstanceFairPlayStreamingAVFObjC::requestDidSucceed):
1770
1771 2018-02-19  Dean Jackson  <dino@apple.com>
1772
1773         Handle all writing-modes in downcast
1774         https://bugs.webkit.org/show_bug.cgi?id=182949
1775         <rdar://problem/37710687>
1776
1777         Reviewed by Myles Maxfield.
1778
1779         It appears we forgot to handle the deprecated "lr"
1780         writing-mode value.
1781
1782         Test: fast/writing-mode/svg-writing-modes.html
1783
1784         * css/CSSPrimitiveValueMappings.h:
1785         (WebCore::CSSPrimitiveValue::operator WritingMode const):
1786
1787 2018-02-20  Zan Dobersek  <zdobersek@igalia.com>
1788
1789         [Cairo] Drop target GraphicsContext usage in Cairo operations
1790         https://bugs.webkit.org/show_bug.cgi?id=182964
1791
1792         Reviewed by Carlos Garcia Campos.
1793
1794         The GraphicsContext parameters in various Cairo operations are not used
1795         anymore, so they can be removed. Callsites are updated to reflect this.
1796
1797         * platform/graphics/cairo/CairoOperations.cpp:
1798         (WebCore::Cairo::drawShadowLayerBuffer):
1799         (WebCore::Cairo::fillShadowBuffer):
1800         (WebCore::Cairo::drawPathShadow):
1801         (WebCore::Cairo::drawGlyphsShadow):
1802         (WebCore::Cairo::fillRect):
1803         (WebCore::Cairo::fillRoundedRect):
1804         (WebCore::Cairo::fillRectWithRoundedHole):
1805         (WebCore::Cairo::fillPath):
1806         (WebCore::Cairo::strokeRect):
1807         (WebCore::Cairo::strokePath):
1808         (WebCore::Cairo::drawGlyphs):
1809         (WebCore::Cairo::drawNativeImage):
1810         (WebCore::Cairo::drawSurface):
1811         * platform/graphics/cairo/CairoOperations.h:
1812         * platform/graphics/cairo/FontCairo.cpp:
1813         (WebCore::FontCascade::drawGlyphs):
1814         * platform/graphics/cairo/GraphicsContextCairo.cpp:
1815         (WebCore::GraphicsContext::drawNativeImage):
1816         (WebCore::GraphicsContext::fillPath):
1817         (WebCore::GraphicsContext::strokePath):
1818         (WebCore::GraphicsContext::fillRect):
1819         (WebCore::GraphicsContext::strokeRect):
1820         (WebCore::GraphicsContext::platformFillRoundedRect):
1821         (WebCore::GraphicsContext::fillRectWithRoundedHole):
1822         * platform/graphics/cairo/GraphicsContextImplCairo.cpp:
1823         (WebCore::GraphicsContextImplCairo::fillRect):
1824         (WebCore::GraphicsContextImplCairo::fillRoundedRect):
1825         (WebCore::GraphicsContextImplCairo::fillRectWithRoundedHole):
1826         (WebCore::GraphicsContextImplCairo::fillPath):
1827         (WebCore::GraphicsContextImplCairo::strokeRect):
1828         (WebCore::GraphicsContextImplCairo::strokePath):
1829         (WebCore::GraphicsContextImplCairo::drawGlyphs):
1830         (WebCore::GraphicsContextImplCairo::drawNativeImage):
1831         * platform/graphics/win/MediaPlayerPrivateMediaFoundation.cpp:
1832         (WebCore::MediaPlayerPrivateMediaFoundation::Direct3DPresenter::paintCurrentFrame):
1833
1834 2018-02-20  Sergio Villar Senin  <svillar@igalia.com>
1835
1836         [WebVR][OpenVR] Retrieve eye parameters and field of view
1837         https://bugs.webkit.org/show_bug.cgi?id=182962
1838
1839         Reviewed by Žan Doberšek.
1840
1841         Get the required data from OpenVR to fill in the VREyeParameters and
1842         the VRFieldOfView objects.
1843
1844         * Modules/webvr/VRDisplay.cpp: Create some attributes in the
1845         body of the constructor instead in the member initialization list to
1846         avoid calling getDisplayInfo() multiple times.
1847         (WebCore::VRDisplay::VRDisplay):
1848         (WebCore::VRDisplay::capabilities const):
1849         (WebCore::VRDisplay::getEyeParameters const):
1850         * Modules/webvr/VRDisplay.h:
1851         * Modules/webvr/VREyeParameters.cpp:
1852         (WebCore::VREyeParameters::VREyeParameters): Added new attributes to
1853         the constructor.
1854         (WebCore::VREyeParameters::offset const): Return a Ref instead of
1855         a raw pointer.
1856         (WebCore::VREyeParameters::renderWidth const):
1857         (WebCore::VREyeParameters::renderHeight const):
1858         * Modules/webvr/VREyeParameters.h:
1859         (WebCore::VREyeParameters::create):
1860         * Modules/webvr/VRFieldOfView.cpp: Removed. All the impletementation
1861         fits perfectly in the header file.
1862         * Modules/webvr/VRFieldOfView.h:
1863         (WebCore::VRFieldOfView::create):
1864         (WebCore::VRFieldOfView::upDegrees const):
1865         (WebCore::VRFieldOfView::rightDegrees const):
1866         (WebCore::VRFieldOfView::downDegrees const):
1867         (WebCore::VRFieldOfView::leftDegrees const):
1868         (WebCore::VRFieldOfView::VRFieldOfView):
1869         * Sources.txt:
1870         * platform/vr/VRPlatformDisplay.h: Added some more data to the
1871         VRPlatformDisplayInfo struct.
1872         * platform/vr/openvr/VRPlatformDisplayOpenVR.cpp:
1873         (WebCore::VRPlatformDisplayOpenVR::VRPlatformDisplayOpenVR):
1874         (WebCore::VRPlatformDisplayOpenVR::computeFieldOfView): Computes the
1875         up/down/left/right FOV angles in degrees from the raw project
1876         values returned by OpenVR.
1877         (WebCore::VRPlatformDisplayOpenVR::updateEyeParameters): Fills in
1878         the eye parameter info.
1879         (WebCore::VRPlatformDisplayOpenVR::~VRPlatformDisplayOpenVR):
1880         * platform/vr/openvr/VRPlatformDisplayOpenVR.h:
1881
1882 2018-02-20  Philippe Normand  <pnormand@igalia.com>
1883
1884         [GStreamer][MiniBrowser] Honor GStreamer command line parameters in MiniBrowser
1885         https://bugs.webkit.org/show_bug.cgi?id=173655
1886
1887         Reviewed by Xabier Rodriguez-Calvar.
1888
1889         The FIXME in GStreamerUtilities.cpp asks to pass the command line
1890         parameters to the GStreamer initialization function.
1891
1892         Based on initial patch by: Vanessa Chipirrás Navalón  <vchipirras@igalia.com>
1893
1894         * Modules/webaudio/AudioContext.cpp:
1895         (WebCore::AudioContext::constructCommon): Removes the call to the method
1896         that GStreamer initializes. It is no longer necessary.
1897         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp:
1898         (WebCore::MediaPlayerPrivateGStreamerBase::initializeGStreamerAndRegisterWebKitElements): Ditto
1899         * platform/graphics/gstreamer/mse/MediaPlayerPrivateGStreamerMSE.cpp:
1900         (WebCore::initializeGStreamerAndRegisterWebKitMSEElement): Ditto
1901         * platform/graphics/gstreamer/GStreamerUtilities.cpp:
1902         (WebCore::initializeGStreamer): Receive the GStreamer options and initialize GStreamer.
1903         * platform/graphics/gstreamer/GStreamerUtilities.h: Add vector which contains
1904         GStreamer options as the input parameter of the initializeGStreamer() method.
1905
1906 2018-02-20  Miguel Gomez  <magomez@igalia.com>
1907
1908         [GTK] whatsapp web blurry in some parts, sharp on others
1909         https://bugs.webkit.org/show_bug.cgi?id=182673
1910
1911         Reviewed by Carlos Garcia Campos.
1912
1913         CoordinatedGraphicsLayer::createBackingStore() uses the scale factor returned by effectiveContentsScale(),
1914         which is always 1 if selfOrAncestorHaveNonAffineTransforms() returns true. But this fuction always returns
1915         true if the layer has an AnimatedPropertyTransform animation, which means that layers with those animations
1916         won't use the appropriate scale factor, causing blurry renderings.
1917
1918         This patch removes the animations check, so animated layers properly use the required scale factor.
1919
1920         No new tests, no behavior change.
1921
1922         * platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.cpp:
1923         (WebCore::CoordinatedGraphicsLayer::selfOrAncestorHaveNonAffineTransforms):
1924
1925 2018-02-20  Zan Dobersek  <zdobersek@igalia.com>
1926
1927         [Cairo] Leverage ShadowBlur without using scratch buffer, target GraphicsContext
1928         https://bugs.webkit.org/show_bug.cgi?id=182958
1929
1930         Reviewed by Carlos Garcia Campos.
1931
1932         To allow ShadowBlur usage in different threads, avoid the ShadowBlur
1933         class using the scratch buffer internally. The current implementation of
1934         that scratch buffer is not thread-safe and its usage in such conditions
1935         can lead to crashes.
1936
1937         Instead, the new methods use a temporary ImageBuffer object for drawing.
1938         This does negate the efficiency of possibly reusing the scratch buffer,
1939         but at this point that is not yet the priority. This only affects ports
1940         using Cairo for drawing.
1941
1942         The added methods don't require a target GraphicsContext object to be
1943         passed in, instead they accept buffer draw callbacks that are invoked
1944         with the temporary ImageBuffer object containing the rasterized shadow,
1945         as well as position and size parameters. The CTM and clip bounds values
1946         also have to be passed in manually. In CairoOperations.cpp, the provided
1947         callbacks invoke commands that are equivalent in effect to those that
1948         would otherwise be invoked on the target GraphicsContext object in the
1949         ShadowBlur class.
1950
1951         For now, this approach has to avoid the tiling-based drawing of the
1952         rectangular shadows in drawRectShadow() and inset shadows in
1953         drawInsetShadow(), and instead stick to the non-tiling fallback. While
1954         only affecting Cairo-using ports, with some refactoring it should be
1955         possible to again leverage the tiling-based approach as well.
1956
1957         The beginShadowLayer() and endShadowLayer() functions, which are only
1958         used in CairoOperations.cpp, are replaced with the drawShadowLayer()
1959         method. This one accepts an additional callback that allows the caller
1960         to explicitly draw the shadow shape using the provided shadowing
1961         GraphicsContext object. As with the other two new methods, a temporary
1962         ImageBuffer object is used, and the buffer draw callback is invoked to
1963         allow caller to properly handle the shadowing output.
1964
1965         In CairoOperations.cpp, the new ShadowBlur methods are exercised, with
1966         direct Cairo operation invocation replacing the GraphicsContext calls
1967         otherwise done through ShadowBlur. ShadowState object now also has to
1968         track the global alpha and the global composite operator values so that
1969         it can properly rasterize the resulting shadow into the final image.
1970
1971         No new tests -- no change in behavior.
1972
1973         * platform/graphics/ShadowBlur.cpp:
1974         (WebCore::ShadowBlur::adjustBlurRadius):
1975         (WebCore::ShadowBlur::calculateLayerBoundingRect):
1976         (WebCore::ShadowBlur::drawRectShadow):
1977         (WebCore::ShadowBlur::drawInsetShadow):
1978         (WebCore::ShadowBlur::drawShadowLayer):
1979         (WebCore::ShadowBlur::beginShadowLayer): Deleted.
1980         (WebCore::ShadowBlur::endShadowLayer): Deleted.
1981         * platform/graphics/ShadowBlur.h:
1982         * platform/graphics/cairo/CairoOperations.cpp:
1983         (WebCore::Cairo::drawShadowLayerBuffer):
1984         (WebCore::Cairo::fillShadowBuffer):
1985         (WebCore::Cairo::drawPathShadow):
1986         (WebCore::Cairo::drawGlyphsShadow):
1987         (WebCore::Cairo::ShadowState::ShadowState):
1988         (WebCore::Cairo::fillRect):
1989         (WebCore::Cairo::fillRoundedRect):
1990         (WebCore::Cairo::fillRectWithRoundedHole):
1991         (WebCore::Cairo::drawSurface):
1992         * platform/graphics/cairo/CairoOperations.h:
1993         Default-initialize FillSource::fillRule to RULE_NONZERO.
1994         * platform/graphics/cairo/PlatformContextCairo.h:
1995         Drop the ShadowBlur.h include, it's moved to CairoOperations.cpp.
1996         * rendering/RenderThemeGtk.cpp:
1997         Explicitly include the FloatRoundedRect.h header now that it's not
1998         included through the ShadowBlur.h header via PlatformContextCairo.h.
1999
2000 2018-02-20  Sergio Villar Senin  <svillar@igalia.com>
2001
2002         [WebVR] Use RuntimeEnabledFeatures to enable/disable WebVR
2003         https://bugs.webkit.org/show_bug.cgi?id=182961
2004
2005         Reviewed by Xabier Rodriguez-Calvar.
2006
2007         The shared feature was properly added to RuntimeEnabledFeatures some
2008         time ago but the code was instead using a private method in
2009         NavigatorWebVR to temporarily disable it. WebVR is enabled in
2010         WebPreferences.yaml for GTK+ & WPE as default experimental feature.
2011
2012         * Modules/webvr/NavigatorWebVR.cpp:
2013         (WebCore::NavigatorWebVR::getVRDisplays):
2014         (WebCore::NavigatorWebVR::vrEnabled): Deleted.
2015
2016 2018-02-19  Antti Koivisto  <antti@apple.com>
2017
2018         Use selector filter when invalidating descendants
2019         https://bugs.webkit.org/show_bug.cgi?id=182839
2020         <rdar://problem/37581072>
2021
2022         Reviewed by Zalan Bujtas.
2023
2024         We can make descendant invalidation faster by enabling filtering.
2025
2026         * css/SelectorFilter.cpp:
2027         (WebCore::SelectorFilter::initializeParentStack):
2028
2029             Traverse and reverse the ancestor chain, and push it.
2030
2031         (WebCore::SelectorFilter::pushParent):
2032         (WebCore::SelectorFilter::pushParentInitializingIfNeeded):
2033
2034             Add a version of pushParent that can initialize the stack.
2035
2036         (WebCore::SelectorFilter::popParent):
2037         (WebCore::SelectorFilter::popParentsUntil):
2038
2039             Pop until a given parent element.
2040
2041         (WebCore::SelectorFilter::pushParentStackFrame): Deleted.
2042         (WebCore::SelectorFilter::popParentStackFrame): Deleted.
2043
2044             These were the same as push/popParent.
2045
2046         * css/SelectorFilter.h:
2047         (WebCore::SelectorFilter::popParent): Deleted.
2048         * style/StyleInvalidator.cpp:
2049         (WebCore::Style::Invalidator::invalidateStyleForDescendants):
2050
2051             Use pushParentInitializingIfNeeded.
2052
2053         (WebCore::Style::Invalidator::invalidateStyleWithMatchElement):
2054
2055             Use selector filter when doing descendant tree invalidation.
2056             Make sure to pop it until the parent when reusing.
2057
2058 2018-02-19  Fujii Hironori  <Hironori.Fujii@sony.com>
2059
2060         null m_lastNodeInserted dereference at ReplaceSelectionCommand::InsertedNodes::lastLeafInserted
2061         https://bugs.webkit.org/show_bug.cgi?id=161947
2062
2063         Reviewed by Ryosuke Niwa.
2064
2065         InsertedNodes happened to be empty if the inserted nodes were
2066         removed. Add more checks if InsertedNodes is empty.
2067
2068         No new tests (Covered by existing tests).
2069
2070         * editing/ReplaceSelectionCommand.cpp:
2071         (WebCore::ReplaceSelectionCommand::doApply): Return early if InsertedNodes becomes empty.
2072         * editing/ReplaceSelectionCommand.h:
2073         (WebCore::ReplaceSelectionCommand::InsertedNodes::isEmpty): New method.
2074         (WebCore::ReplaceSelectionCommand::InsertedNodes::lastLeafInserted const):
2075         Assert m_lastNodeInserted is not null.
2076         (WebCore::ReplaceSelectionCommand::InsertedNodes::pastLastLeaf const): Ditto.
2077
2078 2018-02-19  Said Abou-Hallawa  <sabouhallawa@apple.com>
2079
2080         Add SVGPropertyTraits::fromString() to all the SVG animated types
2081         https://bugs.webkit.org/show_bug.cgi?id=182901
2082
2083         Reviewed by Dean Jackson.
2084
2085         This is a work toward https://bugs.webkit.org/show_bug.cgi?id=168586. The
2086         goal is is to templatize the SVGAnimatedType class and to use SVGPropertyTraits
2087         methods inside the template functions.
2088
2089         * WebCore.xcodeproj/project.pbxproj: Move the enum and the SVGPropertyTraits
2090         from SVGMarkerElement.h to SVGMarkerTypes.h.
2091         * svg/SVGAngle.h:
2092         (WebCore::SVGAngle::SVGAngle): Delete unused constructor and create() method.
2093         * svg/SVGAngleValue.h:
2094         * svg/SVGAnimateMotionElement.cpp:
2095         (WebCore::parsePoint): Deleted. Move this function to SVGParserUtilities.cpp
2096         * svg/SVGAnimatedAngle.cpp:
2097         (WebCore::SVGAnimatedAngleAnimator::constructFromString): Use SVGPropertyTraits::fromString().
2098         * svg/SVGAnimatedBoolean.cpp:
2099         (WebCore::SVGAnimatedBooleanAnimator::constructFromString): Ditto.
2100         * svg/SVGAnimatedColor.cpp:
2101         (WebCore::SVGAnimatedColorAnimator::constructFromString): Ditto.
2102         (WebCore::SVGAnimatedColorAnimator::addAnimatedTypes): Use const.
2103         (WebCore::SVGAnimatedColorAnimator::calculateAnimatedValue): Ditto.
2104         * svg/SVGAnimatedEnumeration.cpp:
2105         (WebCore::SVGAnimatedEnumerationAnimator::constructFromString): Ditto.
2106         * svg/SVGAnimatedInteger.cpp:
2107         (WebCore::SVGAnimatedIntegerAnimator::constructFromString): Ditto.
2108         * svg/SVGAnimatedIntegerOptionalInteger.cpp:
2109         (WebCore::SVGAnimatedIntegerOptionalIntegerAnimator::constructFromString): Ditto.
2110         * svg/SVGAnimatedLength.cpp:
2111         * svg/SVGAnimatedLengthList.cpp:
2112         (WebCore::SVGAnimatedLengthListAnimator::constructFromString): Ditto.
2113         * svg/SVGAnimatedNumber.cpp:
2114         (WebCore::SVGAnimatedNumberAnimator::constructFromString): Ditto
2115         (WebCore::parseNumberFromString):
2116         * svg/SVGAnimatedNumberList.cpp:
2117         (WebCore::SVGAnimatedNumberListAnimator::constructFromString): Ditto.
2118         * svg/SVGAnimatedNumberOptionalNumber.cpp:
2119         (WebCore::SVGAnimatedNumberOptionalNumberAnimator::constructFromString): Ditto.
2120         * svg/SVGAnimatedPath.cpp:
2121         (WebCore::SVGAnimatedPathAnimator::constructFromString): Ditto.
2122         * svg/SVGAnimatedPointList.cpp:
2123         (WebCore::SVGAnimatedPointListAnimator::constructFromString): Ditto.
2124         * svg/SVGAnimatedPreserveAspectRatio.cpp:
2125         (WebCore::SVGAnimatedPreserveAspectRatioAnimator::constructFromString): Ditto.
2126         * svg/SVGAnimatedRect.cpp:
2127         (WebCore::SVGAnimatedRectAnimator::constructFromString): Ditto.
2128         * svg/SVGAnimatedString.cpp:
2129         (WebCore::SVGAnimatedStringAnimator::constructFromString): Ditto.
2130         * svg/SVGAnimatedTransformList.cpp:
2131         (WebCore::SVGAnimatedTransformListAnimator::constructFromString): Ditto.
2132         * svg/SVGLength.h:
2133         (WebCore::SVGLength::SVGLength): Delete unused constructor and create() method.
2134         * svg/SVGLengthListValues.h:
2135         (WebCore::SVGPropertyTraits<SVGLengthListValues>::fromString): New SVGPropertyTraits method.
2136         (WebCore::SVGPropertyTraits<SVGLengthListValues>::parse): Ditto.
2137         * svg/SVGMarkerElement.h:
2138         (WebCore::SVGPropertyTraits<SVGMarkerUnitsType>::highestEnumValue): Deleted.
2139         (WebCore::SVGPropertyTraits<SVGMarkerUnitsType>::toString): Deleted.
2140         (WebCore::SVGPropertyTraits<SVGMarkerUnitsType>::fromString): Deleted.
2141         (WebCore::SVGIDLEnumLimits<SVGMarkerOrientType>::highestExposedEnumValue): Deleted.
2142         (WebCore::SVGPropertyTraits<SVGMarkerOrientType>::highestEnumValue): Deleted.
2143         (WebCore::SVGPropertyTraits<SVGMarkerOrientType>::fromString): Deleted.
2144         * svg/SVGMarkerTypes.h: Added.
2145         (WebCore::SVGPropertyTraits<SVGMarkerUnitsType>::highestEnumValue):
2146         (WebCore::SVGPropertyTraits<SVGMarkerUnitsType>::toString):
2147         (WebCore::SVGPropertyTraits<SVGMarkerUnitsType>::fromString):
2148         (WebCore::SVGPropertyTraits<SVGMarkerOrientType>::highestEnumValue):
2149         (WebCore::SVGPropertyTraits<SVGMarkerOrientType>::fromString):
2150         (WebCore::SVGIDLEnumLimits<SVGMarkerOrientType>::highestExposedEnumValue):
2151         * svg/SVGMatrix.h: Delete unused constructor and create method.
2152         * svg/SVGNumber.h:
2153         (WebCore::SVGNumber::SVGNumber): Ditto.
2154         * svg/SVGNumberListValues.h:
2155         (WebCore::SVGPropertyTraits<SVGNumberListValues>::fromString): New SVGPropertyTraits method.
2156         * svg/SVGParserUtilities.cpp:
2157         (WebCore::parsePoint): This is moved from SVGAnimateMotionElement.cpp
2158         * svg/SVGParserUtilities.h:
2159         * svg/SVGPathByteStream.h:
2160         (WebCore::SVGPathByteStream::SVGPathByteStream):
2161         (WebCore::SVGPathByteStream::operator=): Add copy and move assignment operators.
2162         (WebCore::SVGPathByteStream::copy const): Use the copy assignment.
2163         (WebCore::SVGPathByteStream::isEmpty const): Use Data.isEmpty().
2164         (WebCore::SVGPropertyTraits<SVGPathByteStream>::initialValue): New SVGPropertyTraits method.
2165         (WebCore::SVGPropertyTraits<SVGPathByteStream>::fromString): Ditto.
2166         * svg/SVGPathUtilities.cpp:
2167         (WebCore::addToSVGPathByteStream): Answer Simon's questions which were added in r190844.
2168         * svg/SVGPoint.h:
2169         (WebCore::SVGPoint::SVGPoint): Delete unused constructor and create method.
2170         * svg/SVGPointListValues.h:
2171         (WebCore::SVGPropertyTraits<SVGPointListValues>::fromString): New SVGPropertyTraits method.
2172         * svg/SVGPolyElement.cpp:
2173         (WebCore::SVGPolyElement::parseAttribute): Use the move assignment operator.
2174         * svg/SVGPreserveAspectRatio.h:
2175         (WebCore::SVGPreserveAspectRatio::SVGPreserveAspectRatio): Delete unused constructor and create method.
2176         * svg/SVGPreserveAspectRatioValue.cpp:
2177         (WebCore::SVGPreserveAspectRatioValue::SVGPreserveAspectRatioValue): Add new constructor.
2178         * svg/SVGPreserveAspectRatioValue.h:
2179         (WebCore::SVGPropertyTraits<SVGPreserveAspectRatioValue>::fromString): New SVGPropertyTraits method.
2180         (WebCore::SVGPropertyTraits<SVGPreserveAspectRatioValue>::toString): Ditto.
2181         * svg/SVGRect.h:
2182         (WebCore::SVGRect::SVGRect): Delete unused constructor and create method.
2183         * svg/SVGRectTraits.h: Removed.
2184         * svg/SVGTransform.h:
2185         (WebCore::SVGTransform::SVGTransform): Delete unused constructor and create method.
2186         * svg/SVGTransformListValues.h:
2187         (WebCore::SVGPropertyTraits<SVGTransformListValues>::fromString): New SVGPropertyTraits method.
2188         * svg/properties/SVGPropertyTearOff.h: Delete unused create method.
2189         * svg/properties/SVGPropertyTraits.h: New SVGPropertyTraits methods.
2190         (WebCore::SVGPropertyTraits<bool>::fromString): 
2191         (WebCore::SVGPropertyTraits<Color>::initialValue):
2192         (WebCore::SVGPropertyTraits<Color>::fromString):
2193         (WebCore::SVGPropertyTraits<Color>::parse):
2194         (WebCore::SVGPropertyTraits<Color>::toString):
2195         (WebCore::SVGPropertyTraits<int>::fromString):
2196         (WebCore::SVGPropertyTraits<float>::fromString):
2197         (WebCore::SVGPropertyTraits<float>::parse):
2198         (WebCore::SVGPropertyTraits<FloatPoint>::initialValue):
2199         (WebCore::SVGPropertyTraits<FloatPoint>::fromString):
2200         (WebCore::SVGPropertyTraits<FloatPoint>::parse):
2201         (WebCore::SVGPropertyTraits<FloatPoint>::toString):
2202         (WebCore::SVGPropertyTraits<FloatRect>::initialValue):
2203         (WebCore::SVGPropertyTraits<FloatRect>::fromString):
2204         (WebCore::SVGPropertyTraits<FloatRect>::parse):
2205         (WebCore::SVGPropertyTraits<FloatRect>::toString):
2206         (WebCore::SVGPropertyTraits<String>::fromString):
2207         (WebCore::SVGPropertyTraits<String>::parse):
2208         (WebCore::SVGPropertyTraits<String>::toString):
2209
2210 2018-02-19  Antoine Quint  <graouts@apple.com>
2211
2212         [Modern Media Controls] Implement a compact set of media controls
2213         https://bugs.webkit.org/show_bug.cgi?id=182937
2214         <rdar://problem/37682257>
2215
2216         Reviewed by Eric Carlson.
2217
2218         We add a new type of media controls used when we need stripped down and compact controls. The new
2219         CompactMediaControls only show a play/pause button and an invalid placard and disregard all media
2220         events that are not relevant to the display of these controls.
2221
2222         To distinguish cases where we need to show compact media controls, we expose a new property on
2223         MediaControlsHost called "compactMode".
2224
2225         Tests: media/modern-media-controls/compact-media-controls/compact-media-controls-constructor.html
2226                media/modern-media-controls/compact-media-controls/compact-media-controls-layout.html
2227
2228         * Modules/mediacontrols/MediaControlsHost.cpp:
2229         (WebCore::MediaControlsHost::base64StringForIconNameAndType const):
2230         (WebCore::MediaControlsHost::compactMode const):
2231         * Modules/mediacontrols/MediaControlsHost.h:
2232         (WebCore::MediaControlsHost::setSimulateCompactMode):
2233         * Modules/mediacontrols/MediaControlsHost.idl:
2234         * Modules/modern-media-controls/controls/compact-media-controls.js: Added.
2235         (CompactMediaControls.prototype.get scaleFactor):
2236         (CompactMediaControls.prototype.set scaleFactor):
2237         (CompactMediaControls.prototype.get shouldCenterControlsVertically):
2238         (CompactMediaControls.prototype.set shouldCenterControlsVertically):
2239         (CompactMediaControls.prototype.get placard):
2240         (CompactMediaControls.prototype.set placard):
2241         (CompactMediaControls.prototype.layout):
2242         (CompactMediaControls.prototype.commitProperty):
2243         * Modules/modern-media-controls/controls/icon-service.js:
2244         (const.iconService.new.IconService.prototype._fileNameAndPlatformForIconAndLayoutTraits):
2245         (const.iconService.new.IconService):
2246         * Modules/modern-media-controls/controls/inline-media-controls.js:
2247         * Modules/modern-media-controls/controls/layout-item.js:
2248         * Modules/modern-media-controls/js-files:
2249         * Modules/modern-media-controls/main.js:
2250         * Modules/modern-media-controls/media/media-controller.js:
2251         (MediaController.prototype.get layoutTraits):
2252         (MediaController.prototype._supportingObjectClasses): Compute the set of MediaControllerSupport classes based
2253         on the layout traits such that in compact mode we only return PlacardSupport and PlaybackSupport.
2254         (MediaController.prototype._updateControlsIfNeeded):
2255         (MediaController.prototype._controlsClassForLayoutTraits):
2256         (MediaController.prototype._shouldControlsBeAvailable):
2257         * Modules/modern-media-controls/media/placard-support.js:
2258         (PlacardSupport.prototype.get mediaEvents): Only track the "error" event in compact mode since this is the only
2259         relevant placard.
2260         * Modules/modern-media-controls/media/playback-support.js:
2261         (PlaybackSupport.prototype.syncControl): Only show or hide the play/pause button based on the playback state
2262         when in compact mode.
2263         (PlaybackSupport):
2264         * WebCore.xcodeproj/project.pbxproj:
2265
2266 2018-02-19  Antoine Quint  <graouts@apple.com>
2267
2268         [Web Animations] Make KeyframeEffect target nullable and read-write
2269         https://bugs.webkit.org/show_bug.cgi?id=182741
2270
2271         Reviewed by Dean Jackson.
2272
2273         We used to completely disregard null targets, for instance not parsing keyframes, but targets
2274         can be null and are also supposed to be read-write for KeyframeEffect. We now update the IDL
2275         for KeyframeEffect to mark the target property as read-write and update the implementation
2276         to correctly handle null targets.
2277
2278         This revealed a few issues in our implementation by allowing more WPT tests to run. So we also
2279         ensure that:
2280         
2281         - we don't crash when parsing font-related properties by calling update() on the generated
2282         RenderStyle's FontCascade when parsing keyframes.
2283
2284         - CSS properties are provided as camel-case and not as hyphenated form
2285
2286         - values provided in keyframes dictionaries are only read for valid properties
2287
2288         - styles for effect targets are invalidated as soon as the timing model for that animation
2289         is changed
2290
2291         * animation/KeyframeEffect.idl:
2292         * animation/KeyframeEffectReadOnly.cpp:
2293         (WebCore::invalidateElement): Add a new utility method to invalidate a given element since
2294         we may want to invalidate not only the current target (m_target) but also a previous target.
2295         (WebCore::IDLAttributeNameToAnimationPropertyName): Move this function below CSSPropertyIDToIDLAttributeName
2296         so that it can call that function. We also check that we reject CSS properties that are not provided in
2297         camel-case form (eg. "font-size" vs. "fontSize").
2298         (WebCore::processIterableKeyframes): Only read the JS values if we know that the provided JS property name
2299         maps to a valid CSS property.
2300         (WebCore::KeyframeEffectReadOnly::processKeyframes): Allow keyframes to be processed even if the effect's
2301         target is null.
2302         (WebCore::KeyframeEffectReadOnly::setTarget): Notify the animation that the effect target has changed and
2303         invalidate the style of the new target and the old targets, if any. We also update the blending keyframes
2304         since this task may not have been completed in a previous call to processKeyframes() due to the target being
2305         null at that time.
2306         (WebCore::KeyframeEffectReadOnly::invalidate): Use the invalidateElement() utility.
2307         * animation/KeyframeEffectReadOnly.h:
2308         * animation/WebAnimation.cpp:
2309         (WebCore::WebAnimation::effectTargetDidChange): This method is called in KeyframeEffectReadOnly::setTarget()
2310         to inform the animation of the previous effect target and the new one upon a target change. This allows us to
2311         forward this information onto the timeline so that we correctly add or remove the targets from the list of
2312         animated elements.
2313         * animation/WebAnimation.h:
2314
2315 2018-02-19  Chris Dumez  <cdumez@apple.com>
2316
2317         Crash under MIMETypeRegistry::isSupportedJavaScriptMIMEType()
2318         https://bugs.webkit.org/show_bug.cgi?id=182927
2319         <rdar://problem/37675748>
2320
2321         Reviewed by Antti Koivisto.
2322
2323         Make it safe to call MIMETypeRegistry::isSupportedJavaScriptMIMEType() from the non-main thread.
2324         It is currently being called from a background thread in the following places:
2325         - ServiceWorkerJob::didReceiveResponse()
2326         - WorkerGlobalScope::importScripts()
2327
2328         These call sites on non-main threads were added recently with the support for service workers.
2329
2330         No new tests, already covered by existing tests that flakily experience service worker
2331         process crashes.
2332
2333         * platform/MIMETypeRegistry.cpp:
2334         (WebCore::MIMETypeRegistry::isSupportedJavaScriptMIMEType):
2335
2336 2018-02-19  Dean Jackson  <dino@apple.com>
2337
2338         SIGFPE @ int WebCore::SVGToOTFFontConverter::scaleUnitsPerEm<int> const + 45
2339         https://bugs.webkit.org/show_bug.cgi?id=182944
2340         <rdar://problem/35369984>
2341
2342         Reviewed by Myles Maxfield.
2343
2344         Avoid a divide-by-zero.
2345
2346         Test: svg/text/font-bad-unitsperem.html
2347
2348         * svg/SVGFontFaceElement.cpp:
2349         (WebCore::SVGFontFaceElement::unitsPerEm const):
2350
2351 2018-02-19  Tim Horton  <timothy_horton@apple.com>
2352
2353         REGRESSION (r219342): Touch event coordinates and elementFromPoint coordinates differ
2354         https://bugs.webkit.org/show_bug.cgi?id=182910
2355         <rdar://problem/37533950>
2356
2357         Reviewed by Simon Fraser.
2358
2359         We reverted other changes to the definition of client coordinates
2360         in r219829 due to compatibility concerns. However, we failed to revert
2361         r219342 on trunk, leaving elementFromPoint() using coordinates relative
2362         to the layout viewport.
2363
2364         Add a currently off-by-default setting to switch on layout-viewport-relative
2365         client coordinates and guard the elementFromPoint changes behind it.
2366         A future patch should roll r219829 back in also behind this setting, so
2367         that everything remains consistent regardless of which coordinate space we choose.
2368
2369         * dom/TreeScope.cpp:
2370         (WebCore::absolutePointIfNotClipped):
2371         * page/Settings.yaml:
2372         * rendering/RenderLayer.cpp:
2373         (WebCore::RenderLayer::hitTest):
2374
2375 2018-02-19  Eric Carlson  <eric.carlson@apple.com>
2376
2377         [Extra zoom mode] Don't allow PiP media playback
2378         https://bugs.webkit.org/show_bug.cgi?id=182930
2379         <rdar://problem/37676259>
2380
2381         Reviewed by Andy Estes.
2382
2383         * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
2384         (WebCore::MediaPlayerPrivateAVFoundationObjC::createAVPlayerLayer): Don't call setPIPModeEnabled:
2385         if it isn't implemented.
2386         (WebCore::MediaPlayerPrivateAVFoundationObjC::setVideoFullscreenMode): Ditto.
2387
2388 2018-02-19  Antoine Quint  <graouts@apple.com>
2389
2390         [Web Animations] Decouple parsing JS keyframes and computing blending keyframes
2391         https://bugs.webkit.org/show_bug.cgi?id=182939
2392         <rdar://problem/37678364>
2393
2394         Reviewed by Dean Jackson.
2395
2396         Move all the code used to create the KeyframeList into a dedicated updateBlendingKeyframes() method.
2397
2398         No new tests since this code change has no user-visible impact.
2399
2400         * animation/KeyframeEffectReadOnly.cpp:
2401         (WebCore::KeyframeEffectReadOnly::processKeyframes):
2402         (WebCore::KeyframeEffectReadOnly::updateBlendingKeyframes):
2403         * animation/KeyframeEffectReadOnly.h:
2404
2405 2018-02-19  Jer Noble  <jer.noble@apple.com>
2406
2407         [EME] Add mechanism for MediaKeySession to react to HDCP changes
2408         https://bugs.webkit.org/show_bug.cgi?id=182935
2409
2410         Reviewed by Eric Carlson.
2411
2412         Add a client callback interface to CDMInterface to allow subclasses to communicate up to
2413         MediaKeySEssion. Add a virtual method to CDMInterface to allow it to be notified of HDCP
2414         status changes. Override this method in CDMInstanceFairPlayStreamingAVFObjC. Hook up the
2415         outputObscuredDueToInsufficientExternalProtectionChanged() methods in both
2416         MediaPlayerPrivateAVFoundationObjC and MediaPlayerPrivateMediaSourceAVFObjC to this new
2417         CDMInstance method. Add an Internals method to simulate an HDCP error for testing purposes.
2418
2419         * Modules/encryptedmedia/MediaKeySession.cpp:
2420         (WebCore::MediaKeySession::MediaKeySession):
2421         (WebCore::MediaKeySession::~MediaKeySession):
2422         (WebCore::MediaKeySession::updateKeyStatuses):
2423         * Modules/encryptedmedia/MediaKeySession.h:
2424         * platform/encryptedmedia/CDMInstance.h:
2425         (WebCore::CDMInstance::setHDCPStatus):
2426         (WebCore::CDMInstance::setClient):
2427         (WebCore::CDMInstance::clearClient):
2428         * platform/graphics/MediaPlayer.cpp:
2429         (WebCore::MediaPlayer::beginSimulatedHDCPError):
2430         (WebCore::MediaPlayer::endSimulatedHDCPError):
2431         * platform/graphics/MediaPlayer.h:
2432         * platform/graphics/MediaPlayerPrivate.h:
2433         (WebCore::MediaPlayerPrivateInterface::beginSimulatedHDCPError):
2434         (WebCore::MediaPlayerPrivateInterface::endSimulatedHDCPError):
2435         * platform/graphics/avfoundation/objc/CDMInstanceFairPlayStreamingAVFObjC.h:
2436         * platform/graphics/avfoundation/objc/CDMInstanceFairPlayStreamingAVFObjC.mm:
2437         (WebCore::CDMInstanceFairPlayStreamingAVFObjC::setClient):
2438         (WebCore::CDMInstanceFairPlayStreamingAVFObjC::clearClient):
2439         (WebCore::CDMInstanceFairPlayStreamingAVFObjC::sessionIdentifierChanged):
2440         (WebCore::CDMInstanceFairPlayStreamingAVFObjC::outputObscuredDueToInsufficientExternalProtectionChanged):
2441         * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.h:
2442         * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
2443         (WebCore::MediaPlayerPrivateAVFoundationObjC::outputObscuredDueToInsufficientExternalProtectionChanged):
2444         (WebCore::playerKVOProperties):
2445         (-[WebCoreAVFMovieObserver observeValueForKeyPath:ofObject:change:context:]):
2446         * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.h:
2447         * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.mm:
2448         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::outputObscuredDueToInsufficientExternalProtectionChanged):
2449         * platform/graphics/avfoundation/objc/SourceBufferPrivateAVFObjC.h:
2450         * platform/graphics/avfoundation/objc/SourceBufferPrivateAVFObjC.mm:
2451         (-[WebAVSampleBufferErrorListener observeValueForKeyPath:ofObject:change:context:]):
2452         (WebCore::SourceBufferPrivateAVFObjC::outputObscuredDueToInsufficientExternalProtectionChanged):
2453         * testing/Internals.cpp:
2454         (WebCore::Internals::beginSimulatedHDCPError):
2455         (WebCore::Internals::endSimulatedHDCPError):
2456         * testing/Internals.h:
2457         * testing/Internals.idl:
2458
2459 2018-02-19  Chris Dumez  <cdumez@apple.com>
2460
2461         CrashTracer: com.apple.WebKit.WebContent at WebCore: WebCore::TimerBase::~TimerBase
2462         https://bugs.webkit.org/show_bug.cgi?id=182931
2463         <rdar://problem/37602962>
2464
2465         Reviewed by Antti Koivisto.
2466
2467         Make sure PlatformMediaResource is ThreadSafeRefCounted since it is being
2468         used from several threads in WebCoreNSURLSession. Also make sure it is
2469         always destroyed on the main thread since it ends up destroying a
2470         CachedRawResource object.
2471
2472         No new tests, no known reproduction case.
2473
2474         * platform/graphics/PlatformMediaResourceLoader.h:
2475         * platform/network/cocoa/WebCoreNSURLSession.mm:
2476         (-[WebCoreNSURLSessionDataTask dealloc]):
2477
2478 2018-02-19  Zalan Bujtas  <zalan@apple.com>
2479
2480         [RenderTreeBuilder] Rename RenderTreeBuilder::removeAndDestroyChild() -> removeAndDestroy()
2481         https://bugs.webkit.org/show_bug.cgi?id=182934
2482         <rdar://problem/37678241>
2483
2484         Reviewed by Antti Koivisto.
2485
2486         No change in functionality.
2487
2488         * dom/Document.cpp:
2489         (WebCore::Document::setFullScreenRenderer):
2490         * rendering/RenderBoxModelObject.cpp:
2491         (WebCore::RenderBoxModelObject::removeAndDestroyAllContinuations):
2492         * rendering/RenderButton.cpp:
2493         (WebCore::RenderButton::setText):
2494         * rendering/RenderFullScreen.cpp:
2495         (WebCore::RenderFullScreen::willBeDestroyed):
2496         (WebCore::RenderFullScreen::unwrapRenderer):
2497         * rendering/RenderListItem.cpp:
2498         (WebCore::RenderListItem::willBeDestroyed):
2499         * rendering/RenderTextFragment.cpp:
2500         (WebCore::RenderTextFragment::willBeDestroyed):
2501         (WebCore::RenderTextFragment::setText):
2502         * rendering/RenderView.cpp:
2503         (WebCore::RenderView::willBeDestroyed):
2504         * rendering/updating/RenderTreeBuilder.cpp:
2505         (WebCore::RenderTreeBuilder::removeAndDestroy):
2506         (WebCore::RenderTreeBuilder::removeFromParentAndDestroyCleaningUpAnonymousWrappers):
2507         (WebCore::RenderTreeBuilder::removeAndDestroyChild): Deleted.
2508         * rendering/updating/RenderTreeBuilder.h:
2509         * rendering/updating/RenderTreeBuilderBlock.cpp:
2510         (WebCore::RenderTreeBuilder::Block::takeChild):
2511         * rendering/updating/RenderTreeBuilderFirstLetter.cpp:
2512         (WebCore::RenderTreeBuilder::FirstLetter::updateStyle):
2513         (WebCore::RenderTreeBuilder::FirstLetter::createRenderers):
2514         * rendering/updating/RenderTreeBuilderList.cpp:
2515         (WebCore::RenderTreeBuilder::List::updateItemMarker):
2516         * rendering/updating/RenderTreeBuilderMultiColumn.cpp:
2517         (WebCore::RenderTreeBuilder::MultiColumn::destroyFragmentedFlow):
2518         (WebCore::RenderTreeBuilder::MultiColumn::handleSpannerRemoval):
2519         * rendering/updating/RenderTreeBuilderRuby.cpp:
2520         (WebCore::RenderTreeBuilder::Ruby::moveBlockChildren):
2521         (WebCore::RenderTreeBuilder::Ruby::takeChild):
2522
2523 2018-02-19  Daniel Bates  <dabates@apple.com>
2524
2525         Do not block authentication challenge to navigated resources
2526         https://bugs.webkit.org/show_bug.cgi?id=182807
2527         <rdar://problem/37481619>
2528
2529         Reviewed by Brent Fulgham.
2530
2531         Blocking the main resource from asking for credentials depending on how it was
2532         navigated to could be confusing to a person and breaks web compatibility. Restore
2533         the behavior before r224134.
2534
2535         * loader/FrameLoader.cpp:
2536         (WebCore::FrameLoader::receivedFirstData):
2537         * loader/ResourceLoader.cpp:
2538         (WebCore::ResourceLoader::init):
2539         (WebCore::ResourceLoader::willSendRequestInternal):
2540         (WebCore::ResourceLoader::didBlockAuthenticationChallenge):
2541         (WebCore::ResourceLoader::isAllowedToAskUserForCredentials const):
2542         (WebCore::ResourceLoader::isMixedContent const): Deleted.
2543         * loader/ResourceLoader.h:
2544         (WebCore::ResourceLoader::wasAuthenticationChallengeBlocked const):
2545         (WebCore::ResourceLoader::wasInsecureRequestSeen const): Deleted.
2546
2547 2018-02-17  Antoine Quint  <graouts@apple.com>
2548
2549         [Web Animations] Store all parsed keyframe input information in a single structure
2550         https://bugs.webkit.org/show_bug.cgi?id=182903
2551
2552         Reviewed by Dean Jackson.
2553
2554         When parsing keyframe input provided through the JS API, we used to create several data structures.
2555         During parsing we would create a Vector<ProcessedKeyframe> where we would store the validated values
2556         for "offset", "easing" and "composite" as well as CSS properties and CSS values as strings. 
2557
2558         Then we would create a KeyframeList, a class that pre-dates the work on Web Animations and is used
2559         for hardware animations, with RenderStyle objects that are used for CSS property blending at runtime.
2560         Once the KeyframeList was created, the Vector<ProcessedKeyframe> was discarded.
2561
2562         Since KeyframeList did not know about nullable offsets, timing functions and composite operations, and
2563         because we do not with to modify a legacy class that we will eventually remove once all the Web Animations
2564         work is complete, we also stored the parsed offsets as m_offsets, the timing functions as m_timingFunctions
2565         and the composite operations as m_compositeOperations.
2566
2567         In this patch we rename the ProcessedKeyframe structure used temporarily during parsing to ParsedKeyframe and
2568         store both the input and processed data related to a given keyframe in that single structure which we keep
2569         around as m_parsedKeyframes when we finished processing the keyframes input. This update ParsedKeyframe structure
2570         allows to keep around the original nullable offsets, the original CSS properties and CSS values as strings as
2571         a HashMap<CSSPropertyID, String>, as well as the CSS properties and CSS values as CSSValue objects using a
2572         MutableStyleProperties object. 
2573
2574         This has the benefit of reducing the number of members, but also pave the way for supporting read-write targets
2575         where we will be able to decouple parsing keyframes and creating a KeyframeList, which requires a valid target
2576         to create RenderStyle objects used for blending, since the original parsing-time information is now stored.
2577
2578         Finally, this allowed getKeyframes() to be more compliant by returning the CSS values as originally provided in
2579         the keyframe input with shorthand properties when provided, rather than the long-hands we used to read back
2580         through RenderStyle objects.
2581
2582         The generated KeyframeList is now stored as m_blendingKeyframes and is only used for the purpose of interfacing
2583         with hardware animations and CSS property blending.
2584
2585         While ProcessedKeyframe was copyable due to holding only simple types, ParsedKeyframe is not since it uses a Ref
2586         to hold the MutableStyleProperties. This uncovered some cases where we copied ProcessedKeyframe objects, we now
2587         ensure that the ParsedKeyframe objects are moved instead, which was the correct thing to do all along.
2588
2589         * animation/KeyframeEffectReadOnly.cpp:
2590         (WebCore::computeMissingKeyframeOffsets): While we used to store std::optional<double> for the computed offset,
2591         we now store a simple double, which makes more sense since the computed offset is eventually a fully resolved
2592         value after calling computeMissingKeyframeOffsets(). So we now compute the final computed offset without resorting
2593         to intermediate nullable computed offsets.
2594         (WebCore::processIterableKeyframes):
2595         (WebCore::processPropertyIndexedKeyframes):
2596         (WebCore::KeyframeEffectReadOnly::KeyframeEffectReadOnly):
2597         (WebCore::KeyframeEffectReadOnly::copyPropertiesFromSource):
2598         (WebCore::KeyframeEffectReadOnly::getKeyframes):
2599         (WebCore::KeyframeEffectReadOnly::processKeyframes):
2600         (WebCore::KeyframeEffectReadOnly::computeStackingContextImpact):
2601         (WebCore::KeyframeEffectReadOnly::shouldRunAccelerated):
2602         (WebCore::KeyframeEffectReadOnly::getAnimatedStyle):
2603         (WebCore::KeyframeEffectReadOnly::setAnimatedPropertiesInStyle):
2604         (WebCore::KeyframeEffectReadOnly::startOrStopAccelerated):
2605         * animation/KeyframeEffectReadOnly.h:
2606         (WebCore::KeyframeEffectReadOnly::ParsedKeyframe::ParsedKeyframe):
2607
2608 2018-02-19  Zalan Bujtas  <zalan@apple.com>
2609
2610         [RenderTreeBuilder] Remove redundant RenderObject::removeFromParentAndDestroy
2611         https://bugs.webkit.org/show_bug.cgi?id=182926
2612         <rdar://problem/37674997>
2613
2614         Reviewed by Antti Koivisto.
2615
2616         Call RenderTreeBuilder::removeAndDestroyChild() directly instead. 
2617
2618         No change in functionality.
2619
2620         * dom/Document.cpp:
2621         (WebCore::Document::setFullScreenRenderer):
2622         * rendering/RenderBoxModelObject.cpp:
2623         (WebCore::RenderBoxModelObject::removeAndDestroyAllContinuations):
2624         * rendering/RenderButton.cpp:
2625         (WebCore::RenderButton::setText):
2626         * rendering/RenderFullScreen.cpp:
2627         (WebCore::RenderFullScreen::willBeDestroyed):
2628         (WebCore::RenderFullScreen::unwrapRenderer):
2629         * rendering/RenderListItem.cpp:
2630         (WebCore::RenderListItem::willBeDestroyed):
2631         * rendering/RenderObject.cpp:
2632         (WebCore::RenderObject::removeFromParentAndDestroy): Deleted.
2633         * rendering/RenderObject.h:
2634         * rendering/RenderTextFragment.cpp:
2635         (WebCore::RenderTextFragment::willBeDestroyed):
2636         (WebCore::RenderTextFragment::setText):
2637         * rendering/updating/RenderTreeBuilder.cpp:
2638         (WebCore::RenderTreeBuilder::removeFromParentAndDestroyCleaningUpAnonymousWrappers):
2639         * rendering/updating/RenderTreeBuilderBlock.cpp:
2640         (WebCore::RenderTreeBuilder::Block::takeChild):
2641         * rendering/updating/RenderTreeBuilderList.cpp:
2642         (WebCore::RenderTreeBuilder::List::updateItemMarker):
2643         * rendering/updating/RenderTreeBuilderMultiColumn.cpp:
2644         (WebCore::RenderTreeBuilder::MultiColumn::destroyFragmentedFlow):
2645         (WebCore::RenderTreeBuilder::MultiColumn::handleSpannerRemoval):
2646         * rendering/updating/RenderTreeBuilderRuby.cpp:
2647         (WebCore::RenderTreeBuilder::Ruby::moveBlockChildren):
2648         (WebCore::RenderTreeBuilder::Ruby::takeChild):
2649
2650 2018-02-19  Tim Horton  <timothy_horton@apple.com>
2651
2652         Increase text autosizing constants for extra zoom mode
2653         https://bugs.webkit.org/show_bug.cgi?id=182919
2654         <rdar://problem/37671259>
2655
2656         Reviewed by Wenson Hsieh.
2657
2658         * page/Settings.yaml:
2659         * page/SettingsBase.cpp:
2660         (WebCore::SettingsBase::defaultMinimumZoomFontSize):
2661         (WebCore::SettingsBase::defaultOneLineTextMultiplierCoefficient):
2662         (WebCore::SettingsBase::defaultMultiLineTextMultiplierCoefficient):
2663         (WebCore::SettingsBase::defaultMaxTextAutosizingScaleIncrease):
2664         * page/SettingsBase.h:
2665         * rendering/RenderBlockFlow.cpp:
2666         (WebCore::oneLineTextMultiplier):
2667         (WebCore::textMultiplier):
2668         (WebCore::RenderBlockFlow::adjustComputedFontSizes):
2669         * rendering/TextAutoSizing.cpp:
2670         (WebCore::TextAutoSizingValue::adjustTextNodeSizes):
2671         Make autosizing constants settings, and change their default values.
2672
2673 2018-02-17  Antoine Quint  <graouts@apple.com>
2674
2675         [Web Animations] Accept null composite modes in keyframes
2676         https://bugs.webkit.org/show_bug.cgi?id=182902
2677
2678         Reviewed by Dean Jackson.
2679
2680         The Web Animations spec used to specify that that composite modes should be non-null and instead not be
2681         provided when specifying keyframes, but now null values are accepted. We update the IDL input types used
2682         when parsing keyframes to allow for null values.
2683
2684         We had already updated the getKeyframes() output in webkit.org/b/182600.
2685
2686         * animation/KeyframeEffectReadOnly.cpp:
2687         (WebCore::processIterableKeyframes):
2688         (WebCore::processKeyframeLikeObject):
2689         (WebCore::processPropertyIndexedKeyframes):
2690         * animation/KeyframeEffectReadOnly.h:
2691         * animation/KeyframeEffectReadOnly.idl:
2692
2693 2018-02-19  Ms2ger  <Ms2ger@igalia.com>
2694
2695         Explicitly qualify some method calls on this in lamdas in Service Worker code.
2696         https://bugs.webkit.org/show_bug.cgi?id=182875
2697
2698         Reviewed by Chris Dumez.
2699
2700         This is necessary for the code to build with GCC 5. Other code already
2701         appears to have been adapted similarly.
2702
2703         No change in functionality.
2704
2705         * loader/DocumentLoader.cpp:
2706         (WebCore::DocumentLoader::redirectReceived):
2707         (WebCore::DocumentLoader::startLoadingMainResource):
2708         * workers/service/ServiceWorkerContainer.cpp:
2709         (WebCore::ServiceWorkerContainer::ready):
2710         (WebCore::ServiceWorkerContainer::getRegistration):
2711         (WebCore::ServiceWorkerContainer::getRegistrations):
2712         (WebCore::ServiceWorkerContainer::didFinishGetRegistrationsRequest):
2713         * workers/service/ServiceWorkerGlobalScope.cpp:
2714         (WebCore::ServiceWorkerGlobalScope::updateExtendedEventsSet):
2715         * workers/service/server/SWServer.cpp:
2716         (WebCore::SWServer::claim):
2717         (WebCore::SWServer::Connection::resolveRegistrationReadyRequests):
2718         * workers/service/server/SWServerRegistration.cpp:
2719         (WebCore::SWServerRegistration::updateRegistrationState):
2720         (WebCore::SWServerRegistration::setUpdateViaCache):
2721         (WebCore::SWServerRegistration::setLastUpdateTime):
2722         (WebCore::SWServerRegistration::fireUpdateFoundEvent):
2723         * workers/service/server/SWServerWorker.cpp:
2724         (WebCore::SWServerWorker::setState):
2725
2726 2018-02-19  Zalan Bujtas  <zalan@apple.com>
2727
2728         [RenderTreeBuilder] Move RenderElement::removeAndDestroyChild() to RenderTreeBuilder
2729         https://bugs.webkit.org/show_bug.cgi?id=182915
2730         <rdar://problem/37658123>
2731
2732         Reviewed by Antti Koivisto.
2733
2734         No change in functionality.
2735
2736         * rendering/RenderElement.cpp:
2737         (WebCore::RenderElement::removeAndDestroyChild): Deleted.
2738         * rendering/RenderElement.h:
2739         (WebCore::RenderElement::isChildAllowed const):
2740         * rendering/RenderObject.cpp:
2741         (WebCore::RenderObject::removeFromParentAndDestroy):
2742         * rendering/RenderView.cpp:
2743         (WebCore::RenderView::willBeDestroyed):
2744         * rendering/updating/RenderTreeBuilder.cpp:
2745         (WebCore::RenderTreeBuilder::removeAndDestroyChild):
2746         (WebCore::RenderTreeBuilder::removeFromParentAndDestroyCleaningUpAnonymousWrappers):
2747         * rendering/updating/RenderTreeBuilder.h:
2748         * rendering/updating/RenderTreeBuilderFirstLetter.cpp:
2749         (WebCore::RenderTreeBuilder::FirstLetter::updateStyle):
2750         (WebCore::RenderTreeBuilder::FirstLetter::createRenderers):
2751
2752 2018-02-12  Sergio Villar Senin  <svillar@igalia.com>
2753
2754         [WebVR][OpenVR] Implement getVRDisplays()
2755         https://bugs.webkit.org/show_bug.cgi?id=182692
2756
2757         Reviewed by Žan Doberšek.
2758
2759         This provides an implementation of Navigator's getVRDisplays()
2760         method using OpenVR as backend. It queues several promises in
2761         a queue and resolves them all just once. The information retrieved
2762         is very minimal for the time being, but this change lays the ground
2763         for all the changes that are about to land.
2764
2765         The VR code uses a VRManager which is the interface with the
2766         platform code and the responsible for instantiating the right
2767         platform code. This platform code is currently being implemented
2768         using OpenVR but could we also ported in the future to OpenXR or any
2769         other VR SDK.
2770
2771         * CMakeLists.txt:
2772         * Modules/webvr/NavigatorWebVR.cpp:
2773         (WebCore::NavigatorWebVR::getVRDisplays):
2774         (WebCore::NavigatorWebVR::vrEnabled):
2775         * Modules/webvr/NavigatorWebVR.h:
2776         * Modules/webvr/VRDisplay.cpp:
2777         (WebCore::VRDisplay::create):
2778         (WebCore::VRDisplay::VRDisplay):
2779         (WebCore::VRDisplay::isConnected const):
2780         (WebCore::VRDisplay::displayName const):
2781         * Modules/webvr/VRDisplay.h:
2782         * Modules/webvr/VRDisplayCapabilities.cpp:
2783         (WebCore::VRDisplayCapabilities::VRDisplayCapabilities):
2784         (WebCore::VRDisplayCapabilities::hasPosition const):
2785         (WebCore::VRDisplayCapabilities::hasOrientation const):
2786         (WebCore::VRDisplayCapabilities::hasExternalDisplay const):
2787         (WebCore::VRDisplayCapabilities::canPresent const):
2788         (WebCore::VRDisplayCapabilities::maxLayer const):
2789         * Modules/webvr/VRDisplayCapabilities.h:
2790         (WebCore::VRDisplayCapabilities::create):
2791         * Sources.txt:
2792         * platform/vr/VRManager.cpp: Added. This is the main interface used by bindings code to
2793         access VR devices data provided by platform code.
2794         (WebCore::VRManager::singleton):
2795         (WebCore::VRManager::VRManager):
2796         (WebCore::VRManager::~VRManager):
2797         (WebCore::VRManager::refreshVRDevices):
2798         * platform/vr/VRManager.h: Added.
2799         * platform/vr/VRPlatformDisplay.h: Added. Abstraction of a VR display system. To be
2800         implemented by backends like OpenVR, OpenXR...
2801         * platform/vr/VRPlatformManager.h: Added. Abstraction of the platform specific class which
2802         retrieves data from VR devices. To be implemented by backends like OpenVR, OpenXR...
2803         * platform/vr/openvr/VRPlatformDisplayOpenVR.cpp: Added.
2804         (WebCore::VRPlatformDisplayOpenVR::VRPlatformDisplayOpenVR):
2805         * platform/vr/openvr/VRPlatformDisplayOpenVR.h: Added.
2806         * platform/vr/openvr/VRPlatformManagerOpenVR.cpp: Added.
2807         (WebCore::VRPlatformManagerOpenVR::create):
2808         (WebCore::VRPlatformManagerOpenVR::VRPlatformManagerOpenVR):
2809         (WebCore::VRPlatformManagerOpenVR::~VRPlatformManagerOpenVR):
2810         (WebCore::VRPlatformManagerOpenVR::initOpenVR):
2811         * platform/vr/openvr/VRPlatformManagerOpenVR.h: Added.
2812         * WebCore.xcodeproj/project.pbxproj:
2813
2814 2018-02-19  Manuel Rego Casasnovas  <rego@igalia.com>
2815
2816         [css-grid] Apply automatic minimum size clamping to spanning items too
2817         https://bugs.webkit.org/show_bug.cgi?id=182684
2818
2819         Reviewed by Javier Fernandez.
2820
2821         In r225776 we added the conditions from the spec to apply
2822         the automatic minimum size clamping when required
2823         but only to non-spanning items.
2824         See: https://drafts.csswg.org/css-grid/#min-size-auto
2825
2826         This patch moves the code from GridTrackSizingAlgorithm::sizeTrackToFitNonSpanningItem()
2827         to GridTrackSizingAlgorithmStrategy::minSizeForChild()
2828         that way the clamping is applied for both spanning and non-spanning items.
2829
2830         This somehow reverts r225776, as it was adding some duplicated code.
2831         All the checks to know if we should use that part of the spec
2832         were already present in GridTrackSizingAlgorithmStrategy::minSizeForChild().
2833
2834         Apart from using the previous code, there's a new loop to verify
2835         that the max track sizing function is fixed for all the tracks of the item.
2836
2837         Tests: imported/w3c/web-platform-tests/css/css-grid/grid-items/grid-minimum-size-grid-items-024.html
2838                imported/w3c/web-platform-tests/css/css-grid/grid-items/grid-minimum-size-grid-items-025.html
2839
2840         * rendering/GridTrackSizingAlgorithm.cpp:
2841         (WebCore::GridTrackSizingAlgorithm::sizeTrackToFitNonSpanningItem):
2842         (WebCore::GridTrackSizingAlgorithmStrategy::minSizeForChild const):
2843
2844 2018-02-19  Philippe Normand  <pnormand@igalia.com>
2845
2846         [GTK][GStreamer] Replaying a webm video twice causes the video to stop getting rendered
2847         https://bugs.webkit.org/show_bug.cgi?id=176789
2848
2849         Reviewed by Xabier Rodriguez-Calvar.
2850
2851         Ensure the wrapped GstGLContext is set when the pipeline goes from
2852         READY to PAUSED state. This is a workaround for
2853         https://bugzilla.gnome.org/show_bug.cgi?id=757933.
2854
2855         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:
2856         (WebCore::MediaPlayerPrivateGStreamer::~MediaPlayerPrivateGStreamer): Add debug statement.
2857         (WebCore::MediaPlayerPrivateGStreamer::readyTimerFired): Ditto.
2858         (WebCore::MediaPlayerPrivateGStreamer::changePipelineState):
2859         Ensure the wrapped GstGLContext is set when the pipeline goes from
2860         READY to PAUSED state.
2861         (WebCore::MediaPlayerPrivateGStreamer::didEnd): Add debug statement.
2862         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp:
2863         Change the requestGLContext to be a method instead of a static
2864         function. Being a static function was a requirement for the now-removed OpenWebRTC player.
2865         (WebCore::MediaPlayerPrivateGStreamerBase::handleSyncMessage): Add
2866         debug statement, fix requestGLContext usage.
2867         (WebCore::MediaPlayerPrivateGStreamerBase::requestGLContext): Refactor as method.
2868         (WebCore::MediaPlayerPrivateGStreamerBase::flushCurrentBuffer): Fix requestGLContext usage.
2869         (WebCore::MediaPlayerPrivateGStreamerBase::createVideoSinkGL): Remove fixed FIXME.
2870         (WebCore::MediaPlayerPrivateGStreamerBase::ensureGLVideoSinkContext):
2871         Set display and app wrapped contexts on the video sink.
2872         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.h:
2873
2874 2018-02-19  Xabier Rodriguez Calvar  <calvaris@igalia.com>
2875
2876         [GStreamer] Crash in WebCore::MediaPlayerRequestInstallMissingPluginsCallback::complete
2877         https://bugs.webkit.org/show_bug.cgi?id=166733
2878
2879         Reviewed by Philippe Normand.
2880
2881         There are a couple of issues to tackle here.
2882
2883         First is handling getting more than one missing plugin
2884         installation request at the same time. For this we add the request
2885         to a Vector and handle them there.
2886
2887         Second is that if the player is dead and we still get the result,
2888         bad things happen. For that we "weaked" the pointer capture by the
2889         lambda.
2890
2891         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:
2892         (WebCore::MediaPlayerPrivateGStreamer::~MediaPlayerPrivateGStreamer):
2893         Handle Vector of callbacks.
2894         (WebCore::MediaPlayerPrivateGStreamer::handleMessage): Weak
2895         private player pointer and put the callback in the Vector.
2896         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.h:
2897         Callback becomes Vector.
2898         * platform/graphics/gstreamer/MediaPlayerRequestInstallMissingPluginsCallback.h:
2899         (WebCore::MediaPlayerRequestInstallMissingPluginsCallback::create):
2900         (WebCore::MediaPlayerRequestInstallMissingPluginsCallback::complete):
2901         (WebCore::MediaPlayerRequestInstallMissingPluginsCallback::MediaPlayerRequestInstallMissingPluginsCallback):
2902         Callback function is refactored into a "using" type and added self
2903         as parameter to the function.
2904
2905 2018-02-19  Philippe Normand  <pnormand@igalia.com>
2906
2907         [GStreamer] Playbin3 support
2908         https://bugs.webkit.org/show_bug.cgi?id=182530
2909
2910         Reviewed by Xabier Rodriguez-Calvar.
2911
2912         This patch introduces opt-in support for the playbin3 GStreamer
2913         element. This new playback element is still considered
2914         experimental but it can still be very useful for media assets
2915         containing multiple tracks of the same type. In such scenario
2916         audio/video decoders would be created only for the selected tracks
2917         whereas playbin2 creates decoder for each track.
2918
2919         * platform/graphics/gstreamer/AudioTrackPrivateGStreamer.cpp: Take
2920         a weak pointer of the media player instead of playbin and call the
2921         player when enabling tracks. Also use the GstStream API instead of
2922         inspecting the pad when playbin3 is used.
2923         (WebCore::AudioTrackPrivateGStreamer::AudioTrackPrivateGStreamer):
2924         (WebCore::AudioTrackPrivateGStreamer::disconnect):
2925         (WebCore::AudioTrackPrivateGStreamer::markAsActive):
2926         (WebCore::AudioTrackPrivateGStreamer::setEnabled):
2927         * platform/graphics/gstreamer/AudioTrackPrivateGStreamer.h:
2928         * platform/graphics/gstreamer/GRefPtrGStreamer.cpp: GstStream and
2929         GstStreamCollection smart pointer support.
2930         (WTF::adoptGRef):
2931         (WTF::refGPtr<GstStream>):
2932         (WTF::derefGPtr<GstStream>):
2933         (WTF::refGPtr<GstStreamCollection>):
2934         (WTF::derefGPtr<GstStreamCollection>):
2935         * platform/graphics/gstreamer/GRefPtrGStreamer.h:
2936         * platform/graphics/gstreamer/InbandTextTrackPrivateGStreamer.cpp:
2937         Use the GstStream API instead of inspecting the pad when playbin3
2938         is used.
2939         (WebCore::InbandTextTrackPrivateGStreamer::InbandTextTrackPrivateGStreamer):
2940         (WebCore::InbandTextTrackPrivateGStreamer::disconnect):
2941         * platform/graphics/gstreamer/InbandTextTrackPrivateGStreamer.h:
2942         (WebCore::InbandTextTrackPrivateGStreamer::create):
2943         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:
2944         (WebCore::MediaPlayerPrivateGStreamer::~MediaPlayerPrivateGStreamer):
2945         m_{audio,video,text}Tracks are now hashmaps, which is a bit more
2946         convenient to use than Vectors.
2947         (WebCore::MediaPlayerPrivateGStreamer::updateTracks): Update our
2948         tracks implementations depending on the streams stored in the
2949         collection.
2950         (WebCore::MediaPlayerPrivateGStreamer::enableTrack): Activate the
2951         given track. This method is called by the TrackPrivate
2952         implementations.
2953         (WebCore::MediaPlayerPrivateGStreamer::notifyPlayerOfVideo):
2954         Refactored legacy (playbin2) support for track hashmap storage.
2955         (WebCore::MediaPlayerPrivateGStreamer::notifyPlayerOfAudio): Ditto.
2956         (WebCore::MediaPlayerPrivateGStreamer::notifyPlayerOfText): Ditto.
2957         (WebCore::MediaPlayerPrivateGStreamer::newTextSample): Use track hashmap storage.
2958         (WebCore::MediaPlayerPrivateGStreamer::handleMessage): React on
2959         playbin3 GstStream messages, store the collection provided and
2960         activate the given selected streams accordingly.
2961         (WebCore::MediaPlayerPrivateGStreamer::purgeInvalidAudioTracks): Invalidate tracks no longer needed.
2962         (WebCore::MediaPlayerPrivateGStreamer::purgeInvalidVideoTracks): Ditto.
2963         (WebCore::MediaPlayerPrivateGStreamer::purgeInvalidTextTracks): Ditto.
2964         (WebCore::MediaPlayerPrivateGStreamer::sourceSetupCallback):
2965         Refactoring, use source-setup signal instead of the source
2966         property which is not supported in playbin3.
2967         (WebCore::MediaPlayerPrivateGStreamer::uriDecodeBinElementAddedCallback):
2968         Promoted logging messages, GST_TRACE should be used for very
2969         frequent and less interesting messages.
2970         (WebCore::MediaPlayerPrivateGStreamer::downloadBufferFileCreatedCallback): Ditto.
2971         (WebCore::MediaPlayerPrivateGStreamer::sourceSetup): Called by the source-setup signal handler.
2972         (WebCore::MediaPlayerPrivateGStreamer::setDownloadBuffering): Debugging message added.
2973         (WebCore::MediaPlayerPrivateGStreamer::setPreload): Ditto.
2974         (WebCore::MediaPlayerPrivateGStreamer::createGSTPlayBin): Create a
2975         playbin3 element if USE(GSTREAMER_PLAYBIN3) was enabled and
2976         connect to playbin2 signals otherwise.
2977         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.h:
2978         (WebCore::MediaPlayerPrivateGStreamer::createWeakPtr): Promoted to public.
2979         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.h:
2980         New StreamCollectionChanged notification type, used the sub-class.
2981         * platform/graphics/gstreamer/TrackPrivateBaseGStreamer.cpp:
2982         (WebCore::TrackPrivateBaseGStreamer::TrackPrivateBaseGStreamer): Support for GstStream API.
2983         (WebCore::TrackPrivateBaseGStreamer::disconnect): Clear GstStream too.
2984         (WebCore::TrackPrivateBaseGStreamer::tagsChanged): Get tags from GstStream.
2985         (WebCore::TrackPrivateBaseGStreamer::notifyTrackOfActiveChanged): No need to check m_pad twice.
2986         (WebCore::TrackPrivateBaseGStreamer::notifyTrackOfTagsChanged): Ditto.
2987         * platform/graphics/gstreamer/TrackPrivateBaseGStreamer.h:
2988         * platform/graphics/gstreamer/VideoTrackPrivateGStreamer.cpp: Take
2989         a weak pointer of the media player instead of playbin and call the
2990         player when enabling tracks. Also use the GstStream API instead of
2991         inspecting the pad when playbin3 is used.
2992         (WebCore::VideoTrackPrivateGStreamer::VideoTrackPrivateGStreamer):
2993         (WebCore::VideoTrackPrivateGStreamer::disconnect):
2994         (WebCore::VideoTrackPrivateGStreamer::markAsActive):
2995         (WebCore::VideoTrackPrivateGStreamer::setSelected):
2996         * platform/graphics/gstreamer/VideoTrackPrivateGStreamer.h:
2997         * platform/graphics/gstreamer/mse/AppendPipeline.cpp: Pass player pointer to track constructor.
2998         (WebCore::AppendPipeline::connectDemuxerSrcPadToAppsink):
2999         * platform/graphics/gstreamer/mse/MediaPlayerPrivateGStreamerMSE.cpp: Source-setup signal handler.
3000         (WebCore::MediaPlayerPrivateGStreamerMSE::sourceSetup):
3001         * platform/graphics/gstreamer/mse/MediaPlayerPrivateGStreamerMSE.h:
3002
3003 2018-02-19  Fujii Hironori  <Hironori.Fujii@sony.com>
3004
3005         REGRESSION(r219298): RELEASE_ASSERT(!m_owningPointerForClose) fails in WebCore::IDBServer::UniqueIDBDatabase::scheduleShutdownForClose
3006         https://bugs.webkit.org/show_bug.cgi?id=174354
3007         <rdar://problem/33294987>
3008
3009         Reviewed by Michael Catanzaro.
3010
3011         UniqueIDBDatabase::invokeOperationAndTransactionTimer was called
3012         even after m_owningPointerForClose was set in
3013         UniqueIDBDatabase::didDeleteBackingStore.
3014
3015         No new tests (Covered by existing tests).
3016
3017         * Modules/indexeddb/server/UniqueIDBDatabase.cpp:
3018         (WebCore::IDBServer::UniqueIDBDatabase::didDeleteBackingStore):
3019         Do not start deleting the UniqueIDBDatabase. Just call invokeOperationAndTransactionTimer.
3020         (WebCore::IDBServer::UniqueIDBDatabase::invokeOperationAndTransactionTimer):
3021         Assert m_owningPointerForClose is null.
3022
3023 2018-02-18  Yoshiaki Jitsukawa  <Yoshiaki.Jitsukawa@sony.com>
3024
3025         Fix build error after r228417 without ACCESSIBILITY
3026         https://bugs.webkit.org/show_bug.cgi?id=182914
3027
3028         Reviewed by Chris Fleizach.
3029
3030         An inline empty version of AXObjectCache::deferFocusdUIElementChangeIfNeeded()
3031         needs to be defined if not HAVE(ACCESSIBILITY). 
3032
3033         * accessibility/AXObjectCache.h:
3034         (WebCore::AXObjectCache::deferFocusedUIElementChangeIfNeeded):
3035
3036 2018-02-18  Zalan Bujtas  <zalan@apple.com>
3037
3038         [RenderTreeBuilder] REGRESSION(r228238) Detach renderer before destroying its subtree.
3039         https://bugs.webkit.org/show_bug.cgi?id=182908
3040         <rdar://problem/37619394>
3041
3042         Reviewed by Antti Koivisto.
3043
3044         Prior to r228238 we first detached the to-be-destroyed renderer and then
3045         started nuking its descendants. r228238 changed the order and now the descendants are
3046         destroyed while they are still attached to the tree. Apparently some of the takeChild()
3047         normalization logic gets triggered now that the renderers still have access to their previous/next
3048         siblings. This is unexpected and it shouldn't matter whether the subtree is still attached.
3049         Let's revert it to the original order for now (see webkit.org/b/182909).
3050
3051         Test: fast/block/crash-when-subtree-is-still-attached.html
3052
3053         * rendering/RenderElement.cpp:
3054         (WebCore::RenderElement::removeAndDestroyChild):
3055
3056 2018-02-18  Charlie Turner  <cturner@igalia.com>
3057
3058         [GStreamer] Push smaller buffers from HTTP source
3059         https://bugs.webkit.org/show_bug.cgi?id=182829
3060
3061         Reviewed by Philippe Normand.
3062
3063         Split the received buffer into smaller buffers of a size consistent
3064         with the basesrc (4KiB). It is important not to push large buffers
3065         into the appsrc (where large is relative to the appsrc's configured
3066         byte size). If large buffers are pushed, then when they are internally
3067         dequeued by the appsrc, the buffering percentage can dramatically
3068         plummet due to a large amount of bytes being removed after a push. This
3069         can in turn trick the media player into thinking it needs to buffer,
3070         and then issuing a spurious set of playing->paused then
3071         paused->playing transitions, which by the time the buffering logic
3072         completes, data are already available.
3073
3074         * platform/graphics/gstreamer/WebKitWebSourceGStreamer.cpp:
3075         (CachedResourceStreamingClient::dataReceived):
3076
3077 2018-02-17  Darin Adler  <darin@apple.com>
3078
3079         Web Inspector: get rid of remaining uses of OptOutput<T>
3080         https://bugs.webkit.org/show_bug.cgi?id=180607
3081
3082         Reviewed by Brian Burg.
3083
3084         * inspector/InspectorStyleSheet.cpp:
3085         (WebCore::buildSourceRangeObject): Take a const Vector& instead of a Vector*.
3086         (WebCore::InspectorStyle::buildObjectForStyle const): Pass lineEndings() instead
3087         of lineEndings().get().
3088         (WebCore::InspectorStyle::styleWithProperties const): Ditto.
3089         (WebCore::InspectorStyleSheet::buildObjectForSelectorList): Ditto.
3090         (WebCore::InspectorStyleSheet::lineEndings const): Return a Vector instead of
3091         a std::unique_ptr<Vector>.
3092         (WebCore::InspectorStyleSheetForInlineStyle::lineEndings const): Ditto.
3093         * inspector/InspectorStyleSheet.h: Updated for the above.
3094
3095         * inspector/agents/InspectorCSSAgent.h: Removed some bogus const.
3096         * inspector/agents/InspectorCanvasAgent.cpp: Ditto.
3097         * inspector/agents/InspectorCanvasAgent.h: Ditto.
3098
3099         * inspector/agents/InspectorDOMDebuggerAgent.cpp: Improved type of global strings
3100         so we don't waste space with a pointer to the string.
3101         (WebCore::InspectorDOMDebuggerAgent::setEventListenerBreakpoint): Removed
3102         explicit creation of String, which was wasteful and unnecessary.
3103         (WebCore::InspectorDOMDebuggerAgent::setInstrumentationBreakpoint): Ditto.
3104         (WebCore::InspectorDOMDebuggerAgent::removeEventListenerBreakpoint): Ditto.
3105         (WebCore::InspectorDOMDebuggerAgent::removeInstrumentationBreakpoint): Ditto.
3106         (WebCore::InspectorDOMDebuggerAgent::setXHRBreakpoint): Removed bogus const.
3107
3108         * inspector/agents/InspectorDOMDebuggerAgent.h: Removed bogus const and use
3109         final instead of override.
3110         * inspector/agents/InspectorPageAgent.cpp: Ditto.
3111         * inspector/agents/InspectorPageAgent.h: Ditto.
3112
3113 2018-02-16  Zalan Bujtas  <zalan@apple.com>
3114
3115         [RenderTreeBuilder] Cleanup RenderTreeBuilder
3116         https://bugs.webkit.org/show_bug.cgi?id=182899
3117         <rdar://problem/37627888>
3118
3119         Reviewed by Antti Koivisto.
3120
3121         No change in functionality.
3122
3123         * rendering/RenderBlockFlow.cpp:
3124         (WebCore::RenderBlockFlow::styleDidChange):
3125         * rendering/updating/RenderTreeBuilder.cpp:
3126         (WebCore::RenderTreeBuilder::takeChild):
3127         (WebCore::RenderTreeBuilder::moveChildTo):
3128         (WebCore::RenderTreeBuilder::moveAllChildrenTo):
3129         (WebCore::RenderTreeBuilder::moveChildrenTo):
3130         (WebCore::RenderTreeBuilder::moveAllChildrenIncludingFloatsTo):
3131         (WebCore::RenderTreeBuilder::makeChildrenNonInline):
3132         (WebCore::RenderTreeBuilder::splitAnonymousBoxesAroundChild):
3133         (WebCore::RenderTreeBuilder::takeChildFromRenderMenuList): Deleted.
3134         (WebCore::RenderTreeBuilder::takeChildFromRenderButton): Deleted.
3135         * rendering/updating/RenderTreeBuilder.h:
3136         (WebCore::RenderTreeBuilder::current):
3137         * rendering/updating/RenderTreeBuilderBlock.cpp:
3138         (WebCore::RenderTreeBuilder::Block::dropAnonymousBoxChild):
3139         * rendering/updating/RenderTreeBuilderBlockFlow.cpp:
3140         (WebCore::RenderTreeBuilder::BlockFlow::moveAllChildrenIncludingFloatsTo):
3141         * rendering/updating/RenderTreeBuilderFormControls.cpp:
3142         (WebCore::RenderTreeBuilder::FormControls::takeChild):
3143         * rendering/updating/RenderTreeBuilderFormControls.h:
3144         * rendering/updating/RenderTreeBuilderMultiColumn.cpp:
3145         (WebCore::RenderTreeBuilder::MultiColumn::createFragmentedFlow):
3146         (WebCore::RenderTreeBuilder::MultiColumn::destroyFragmentedFlow):
3147         * rendering/updating/RenderTreeBuilderRuby.cpp:
3148         (WebCore::RenderTreeBuilder::Ruby::moveInlineChildren):
3149         (WebCore::RenderTreeBuilder::Ruby::moveBlockChildren):
3150         (WebCore::RenderTreeBuilder::Ruby::takeChild):
3151         * rendering/updating/RenderTreeBuilderTable.cpp:
3152         (WebCore::RenderTreeBuilder::Table::collapseAndDestroyAnonymousSiblingRows):
3153
3154 2018-02-16  Daniel Bates  <dabates@apple.com>
3155
3156         Remove UTF-32 BOM parsing code
3157         https://bugs.webkit.org/show_bug.cgi?id=182900
3158         <rdar://problem/37238717>
3159
3160         Reviewed by Alexey Proskuryakov.
3161
3162         The UTF-32 encodings were removed from the text codec registry in r224747. So,
3163         we no longer need code to parse UTF-32{BE, LE} BOM or encode and decode these
3164         variants.
3165
3166         * dom/TextDecoder.cpp:
3167         (WebCore::codeUnitByteSize):
3168         * loader/TextResourceDecoder.cpp:
3169         (WebCore::TextResourceDecoder::checkForBOM):
3170         (WebCore::TextResourceDecoder::checkForHeadCharset):
3171         * platform/text/TextEncoding.cpp:
3172         (WebCore::TextEncoding::isNonByteBasedEncoding const):
3173         (WebCore::UTF32BigEndianEncoding): Deleted.
3174         (WebCore::UTF32LittleEndianEncoding): Deleted.
3175         * platform/text/TextEncoding.h:
3176
3177 2018-02-16  Zalan Bujtas  <zalan@apple.com>
3178
3179         [RenderTreeBuilder] Move RenderBoxModelObject::moveChild*() to RenderTreeBuilder
3180         https://bugs.webkit.org/show_bug.cgi?id=182896
3181         <rdar://problem/37623051>
3182
3183         Reviewed by Antti Koivisto.
3184
3185         No change in functionality.
3186
3187         * rendering/RenderBlock.h:
3188         (WebCore::RenderBlock::moveAllChildrenIncludingFloatsTo): Deleted.
3189         * rendering/RenderBlockFlow.cpp:
3190         (WebCore::RenderBlockFlow::styleDidChange):
3191         (WebCore::RenderBlockFlow::moveAllChildrenIncludingFloatsTo): Deleted.
3192         * rendering/RenderBlockFlow.h:
3193         * rendering/RenderBoxModelObject.cpp:
3194         (WebCore::RenderBoxModelObject::moveChildTo): Deleted.
3195         (WebCore::RenderBoxModelObject::moveChildrenTo): Deleted.
3196         (WebCore::RenderBoxModelObject::moveAllChildrenToInternal): Deleted.
3197         * rendering/RenderBoxModelObject.h:
3198         (WebCore::RenderBoxModelObject::moveChildTo): Deleted.
3199         (WebCore::RenderBoxModelObject::moveAllChildrenTo): Deleted.
3200         (WebCore::RenderBoxModelObject::moveChildrenTo): Deleted.
3201         * rendering/updating/RenderTreeBuilder.cpp:
3202         (WebCore::RenderTreeBuilder::moveChildTo):
3203         (WebCore::RenderTreeBuilder::moveAllChildrenTo):
3204         (WebCore::RenderTreeBuilder::moveChildrenTo):
3205         (WebCore::RenderTreeBuilder::moveAllChildrenIncludingFloatsTo):
3206         (WebCore::RenderTreeBuilder::makeChildrenNonInline):
3207         (WebCore::RenderTreeBuilder::splitAnonymousBoxesAroundChild):
3208         * rendering/updating/RenderTreeBuilder.h:
3209         * rendering/updating/RenderTreeBuilderBlock.cpp:
3210         (WebCore::moveAllChildrenToInternal):
3211         (WebCore::RenderTreeBuilder::Block::removeLeftoverAnonymousBlock):
3212         (WebCore::RenderTreeBuilder::Block::takeChild):
3213         (WebCore::RenderTreeBuilder::Block::dropAnonymousBoxChild):
3214         * rendering/updating/RenderTreeBuilderBlockFlow.cpp:
3215         (WebCore::RenderTreeBuilder::BlockFlow::moveAllChildrenIncludingFloatsTo):
3216         * rendering/updating/RenderTreeBuilderBlockFlow.h:
3217         * rendering/updating/RenderTreeBuilderMultiColumn.cpp:
3218         (WebCore::RenderTreeBuilder::MultiColumn::createFragmentedFlow):
3219         (WebCore::RenderTreeBuilder::MultiColumn::destroyFragmentedFlow):
3220         * rendering/updating/RenderTreeBuilderRuby.cpp:
3221         (WebCore::RenderTreeBuilder::Ruby::moveInlineChildren):
3222         (WebCore::RenderTreeBuilder::Ruby::moveBlockChildren):
3223         (WebCore::RenderTreeBuilder::Ruby::takeChild):
3224         * rendering/updating/RenderTreeBuilderTable.cpp:
3225         (WebCore::RenderTreeBuilder::Table::collapseAndDestroyAnonymousSiblingRows):
3226
3227 2018-02-16  Andy Estes  <aestes@apple.com>
3228
3229         [Cocoa] Stop using non-prefixed vDSP functions in 32-bit builds
3230         https://bugs.webkit.org/show_bug.cgi?id=182898
3231         <rdar://problem/37195079>
3232
3233         Reviewed by Tim Horton.
3234
3235         There's no need to use non-prefixed vDSP function aliases on 32-bit builds.
3236         The vDSP-prefixed versions are available on all Cocoa platforms we currently support.
3237
3238         * platform/audio/DirectConvolver.cpp:
3239         (WebCore::DirectConvolver::process):
3240         * platform/audio/VectorMath.cpp:
3241         (WebCore::VectorMath::vsmul):
3242         (WebCore::VectorMath::vadd):
3243         (WebCore::VectorMath::vmul):
3244         (WebCore::VectorMath::zvmul):
3245
3246 2018-02-16  Ryan Haddad  <ryanhaddad@apple.com>
3247
3248         Unreviewed, rolling out r228575.
3249
3250         Introduced LayoutTest crashes under GuardMalloc.
3251
3252         Reverted changeset:
3253
3254         "Use ResourceLoader to load appcache manifest"
3255         https://bugs.webkit.org/show_bug.cgi?id=182861
3256         https://trac.webkit.org/changeset/228575
3257
3258 2018-02-16  Dean Jackson  <dino@apple.com>
3259
3260         Use OPENGL macros to be more clear about which OpenGL/ES WebGL uses on Cocoa
3261         https://bugs.webkit.org/show_bug.cgi?id=182894
3262
3263         Reviewed by Tim Horton.
3264
3265         Adjust the places where we check for PLATFORM(MAC) or
3266         PLATFORM(IOS) related to WebGL, and instead rely
3267         on USE(OPENGL) USE(OPENGL_ES).
3268
3269         * CMakeLists.txt:
3270         * PlatformGTK.cmake:
3271         * platform/graphics/GLContext.cpp:
3272         (WebCore::initializeOpenGLShimsIfNeeded):
3273         * platform/graphics/GraphicsContext3DPrivate.cpp:
3274         * platform/graphics/OpenGLESShims.h:
3275         * platform/graphics/cairo/ImageBufferCairo.cpp:
3276         * platform/graphics/egl/GLContextEGL.cpp:
3277         (WebCore::GLContextEGL::getEGLConfig):
3278         (WebCore::GLContextEGL::createContext):
3279         (WebCore::GLContextEGL::createSharingContext):
3280         * platform/graphics/egl/GLContextEGLWPE.cpp:
3281         (WebCore::GLContextEGL::createWPEContext):
3282         * platform/graphics/egl/GLContextEGLWayland.cpp:
3283         (WebCore::GLContextEGL::createWaylandContext):
3284         * platform/graphics/egl/GLContextEGLX11.cpp:
3285         (WebCore::GLContextEGL::createPixmapContext):
3286         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp:
3287         (WebCore::MediaPlayerPrivateGStreamerBase::ensureGstGLContext):
3288         * platform/graphics/gstreamer/VideoTextureCopierGStreamer.cpp:
3289         (WebCore::VideoTextureCopierGStreamer::VideoTextureCopierGStreamer):
3290         (WebCore::VideoTextureCopierGStreamer::~VideoTextureCopierGStreamer):
3291         (WebCore::VideoTextureCopierGStreamer::copyVideoTextureToPlatformTexture):
3292         * platform/graphics/gstreamer/VideoTextureCopierGStreamer.h:
3293         * platform/graphics/opengl/Extensions3DOpenGLES.cpp:
3294         * platform/graphics/opengl/Extensions3DOpenGLES.h:
3295         * platform/graphics/opengl/GraphicsContext3DOpenGLES.cpp:
3296         (WebCore::GraphicsContext3D::create):
3297         (WebCore::GraphicsContext3D::GraphicsContext3D):
3298         (WebCore::GraphicsContext3D::isGLES2Compliant const):
3299         * platform/graphics/texmap/GraphicsContext3DTextureMapper.cpp:
3300         (WebCore::GraphicsContext3D::create):
3301         (WebCore::GraphicsContext3D::GraphicsContext3D):
3302         (WebCore::GraphicsContext3D::~GraphicsContext3D):
3303         (WebCore::GraphicsContext3D::isGLES2Compliant const):
3304         (WebCore::GraphicsContext3D::getExtensions):
3305         * platform/graphics/texmap/TextureMapperContextAttributes.cpp:
3306         (WebCore::TextureMapperContextAttributes::initialize):
3307         * platform/graphics/texmap/TextureMapperGL.cpp:
3308         (WebCore::TextureMapperGLData::~TextureMapperGLData):
3309         (WebCore::TextureMapperGLData::getVAO):
3310         (WebCore::TextureMapperGL::beginPainting):
3311         (WebCore::TextureMapperGL::endPainting):
3312         * platform/graphics/texmap/TextureMapperGLHeaders.h:
3313         * platform/graphics/texmap/TextureMapperShaderProgram.cpp:
3314         (WebCore::TextureMapperShaderProgram::create):
3315
3316 2018-02-16  Zalan Bujtas  <zalan@apple.com>
3317
3318         [RenderTreeBuilder] Move RenderElement::insertChildInternal() to RenderTreeBuilder
3319         https://bugs.webkit.org/show_bug.cgi?id=182885
3320         <rdar://problem/37617371>
3321
3322         Reviewed by Antti Koivisto.
3323
3324         No change in functionality.
3325
3326         * rendering/RenderElement.cpp:
3327         (WebCore::RenderElement::insertChildInternal): Deleted.
3328         * rendering/RenderObject.h:
3329         * rendering/updating/RenderTreeBuilder.cpp:
3330         (WebCore::RenderTreeBuilder::insertChildToRenderElement):
3331
3332 2018-02-16  Youenn Fablet  <youenn@apple.com>
3333
3334         Allow specifying which plug-ins are supported
3335         https://bugs.webkit.org/show_bug.cgi?id=182748
3336
3337         Reviewed by Chris Dumez.
3338
3339         Tests: http/tests/plugins/nounsupported-plugin.html
3340                http/tests/plugins/supported-plugin-all-origin-visibility.html
3341                http/tests/plugins/supported-plugin-on-specific-origin.html
3342                http/tests/plugins/supported-plugin-origin-specific-visibility.html
3343                http/tests/plugins/unsupported-plugin-on-specific-origin.html
3344                plugins/unsupported-plugin.html
3345
3346         Added support for computing plugin web visibility with the added knowledge of supported plugins.
3347         In case of a plugin failing to be created due to being unsupported, update the UI
3348         to use mark the plugin as "Unexpected plug in".
3349
3350         Added internal API to retrieve the plug-in error description message.
3351
3352         * English.lproj/Localizable.strings:
3353         * WebCore.xcodeproj/project.pbxproj:
3354         * html/HTMLPlugInElement.cpp:
3355         (WebCore::HTMLPlugInElement::setReplacement):
3356         * html/HTMLPlugInElement.h:
3357         * loader/EmptyClients.cpp:
3358         * platform/LocalizedStrings.cpp:
3359         (WebCore::unsupportedPluginText):
3360         * platform/LocalizedStrings.h:
3361         * plugins/PluginData.cpp:
3362         (WebCore::PluginData::initPlugins):
3363         * plugins/PluginData.h:
3364         (WebCore::decodePluginNames):
3365         (WebCore::encodePluginNames):
3366         (WebCore::SupportedPluginNames::decode):
3367         (WebCore::SupportedPluginNames::encode const):
3368         * plugins/PluginInfoProvider.h:
3369         * rendering/RenderEmbeddedObject.cpp:
3370         (WebCore::unavailablePluginReplacementText):
3371         * rendering/RenderEmbeddedObject.h:
3372         (WebCore::RenderEmbeddedObject::pluginReplacementTextIfUnavailable const):
3373         * testing/Internals.cpp:
3374         (WebCore::Internals::unavailablePluginReplacementText):
3375         * testing/Internals.h:
3376         * testing/Internals.idl:
3377
3378 2018-02-16  Chris Dumez  <cdumez@apple.com>
3379
3380         http/tests/security/http-0.9/xhr-blocked.html is flaky
3381         https://bugs.webkit.org/show_bug.cgi?id=182857
3382         <rdar://problem/37616958>
3383
3384         Reviewed by Antti Koivisto.
3385
3386         WebCoreResourceHandleAsOperationQueueDelegate does not own the messageQueue and
3387         the detachHandle function was failing to nullout m_messageQueue when the resourceHandle
3388         gets destroyed. This means that callFunctionOnMainThread would sometimes try to append
3389         to a dead messageQueue.
3390
3391         No new tests, already covered by:
3392         http/tests/security/http-0.9/xhr-blocked.html is flaky
3393
3394         * platform/network/mac/WebCoreResourceHandleAsOperat