ab683e3a72c1bebed38afe60474b2884f12ed9e5
[WebKit-https.git] / Source / WebCore / ChangeLog
1 2018-04-23  Ryan Haddad  <ryanhaddad@apple.com>
2
3         Unreviewed, speculative macOS build fix attempt.
4
5         * Modules/mediasource/SourceBuffer.cpp:
6         (WebCore::SourceBuffer::provideMediaData):
7
8 2018-04-23  Daniel Bates  <dabates@apple.com>
9
10         Implement Same-Site cookies
11         https://bugs.webkit.org/show_bug.cgi?id=159464
12         <rdar://problem/27196358>
13
14         Reviewed by Brent Fulgham.
15
16         Implements support for Same-Site cookies as per <https://tools.ietf.org/html/draft-ietf-httpbis-cookie-same-site-00>.
17         The implementation is materially consistent with the spec. though implements the computation
18         for a document's "site for cookies" indirectly as part of loading its frame. This is done to
19         avoid traversing the frame tree on each subresource request initiated by the document or one
20         of its workers. We take advantage of the fact that Web Workers and Service Workers use their
21         host document's loader to load resources on their behalf to use the correct "site for cookies"
22         for requests (e.g. fetch()) initiating by them without the need to duplicate and store the
23         host document's "site for cookies" in the worker's script execution context.
24
25         The implementation differs from the spec. in the handling of about: URLs and the empty URL
26         and makes the implementation in WebKit match the behavior of Chrome and Firefox as well as
27         consistent with origin inheritance as described in <https://html.spec.whatwg.org/multipage/browsers.html#origin>
28         (16 April 2018). Specifically, requests to about:blank, about:srcdoc and the empty URL ("")
29         are treated as same-site because these URLs inherit their origin from their owner.
30
31         Tests: http/tests/cookies/same-site/fetch-after-navigating-iframe-in-cross-origin-page.html
32                http/tests/cookies/same-site/fetch-after-top-level-navigation-from-cross-origin-page.html
33                http/tests/cookies/same-site/fetch-after-top-level-navigation-initiated-from-iframe-in-cross-origin-page.html
34                http/tests/cookies/same-site/fetch-cookies-set-in-about-blank-iframe.html
35                http/tests/cookies/same-site/fetch-in-about-blank-page.html
36                http/tests/cookies/same-site/fetch-in-cross-origin-iframe.html
37                http/tests/cookies/same-site/fetch-in-cross-origin-page.html
38                http/tests/cookies/same-site/fetch-in-cross-origin-service-worker.html
39                http/tests/cookies/same-site/fetch-in-cross-origin-worker.html
40                http/tests/cookies/same-site/fetch-in-same-origin-page.html
41                http/tests/cookies/same-site/fetch-in-same-origin-service-worker.html
42                http/tests/cookies/same-site/fetch-in-same-origin-srcdoc-iframe.html
43                http/tests/cookies/same-site/fetch-in-same-origin-worker.html
44                http/tests/cookies/same-site/popup-cross-site-post.html
45                http/tests/cookies/same-site/popup-cross-site.html
46                http/tests/cookies/same-site/popup-same-site-post.html
47                http/tests/cookies/same-site/popup-same-site-via-cross-site-redirect.html
48                http/tests/cookies/same-site/popup-same-site-via-same-site-redirect.html
49                http/tests/cookies/same-site/popup-same-site.html
50
51         * Sources.txt: Add source file SameSiteInfo.cpp.
52         * WebCore.xcodeproj/project.pbxproj: Add source files SameSiteInfo.{cpp, h}.
53         * dom/Document.cpp:
54         (WebCore::Document::initSecurityContext): Modified to call SecurityPolicy::shouldInheritSecurityOriginFromOwner().
55         (WebCore::Document::shouldInheritContentSecurityPolicyFromOwner const): Ditto.
56         (WebCore::shouldInheritSecurityOriginFromOwner): Deleted; moved to SecurityPolicy.
57         * dom/Document.h:
58         (WebCore::Document::firstPartyForSameSiteCookies const): Added.
59         (WebCore::Document::setFirstPartyForSameSiteCookies): Added.
60         * loader/CookieJar.cpp:
61         (WebCore::sameSiteInfo): Returns the same-site info for the request used to load the specified document.
62         (WebCore::cookies): Pass the same-site info down to the platform.
63         (WebCore::cookieRequestHeaderFieldProxy): Ditto.
64         (WebCore::setCookies): Ditto.
65         (WebCore::cookieRequestHeaderFieldValue): Ditto.
66         (WebCore::getRawCookies): Ditto.
67         * loader/DocumentLoader.cpp:
68         (WebCore::DocumentLoader::willSendRequest): Add same-site info to the request.
69         (WebCore::DocumentLoader::startLoadingMainResource): Update a FIXME comment to explain that
70         we can simplify ResourceRequestBase if we can remove the call to addExtraFieldsToMainResourceRequest()
71         here. Specifically, we would not need to differentiate between a request with an unspecified
72         same-site state (default state of a new request) from a request whose same-site state has
73         been explicitly set if we can assume that the same-site state of a request is set exactly
74         once. In absence of this guarantee we need an "unspecified" state to avoid overriding existing
75         same-site information computed with a null initiating document (the case of a new address bar
76         initiated load) from a load initiated by the document associated with this loader.
77         * loader/FrameLoader.cpp:
78         (WebCore::FrameLoader::setFirstPartyForCookies): Modified to also update the first party for
79         same-site cookies ("site for cookies").
80         (WebCore::FrameLoader::load): Add same-site info to the request.
81         (WebCore::FrameLoader::reload): Ditto.
82         (WebCore::FrameLoader::setOriginalURLForDownloadRequest): Ditto.
83         (WebCore::FrameLoader::addExtraFieldsToRequest): If the request does not already have
84         same-site info then compute it and add it to the request. Mark main frame main resource
85         requests as a "top-site".
86         (WebCore::FrameLoader::addSameSiteInfoToRequestIfNeeded): Implements the "'Same-site' and 'cross-site'
87         Requests" algorithm from <https://tools.ietf.org/html/draft-ietf-httpbis-cookie-same-site-00#section-2.1>.
88         (WebCore::createWindow): Add same-site info to the request.
89         * loader/FrameLoader.h:
90         * loader/ResourceLoader.cpp:
91         (WebCore::ResourceLoader::init): Ditto.
92         * page/DOMWindow.cpp:
93         (WebCore::DOMWindow::createWindow): Ditto.
94         * page/SecurityPolicy.cpp:
95         (WebCore::SecurityPolicy::shouldInheritSecurityOriginFromOwner): Moved from Document.cpp.
96         * page/SecurityPolicy.h:
97         * platform/CookiesStrategy.h:
98         * platform/network/CacheValidation.cpp:
99         (WebCore::headerValueForVary): Pass the same-site info down to the platform.
100         * platform/network/CookieRequestHeaderFieldProxy.h:
101         (WebCore::CookieRequestHeaderFieldProxy::encode const): Encode same-site bits.
102         (WebCore::CookieRequestHeaderFieldProxy::decode): Decode same-site bits.
103         * platform/network/PlatformCookieJar.h:
104         * platform/network/ResourceRequestBase.cpp:
105         (WebCore::ResourceRequestBase::setAsIsolatedCopy): Added.
106         (WebCore::ResourceRequestBase::isSameSite const): Added.
107         (WebCore::ResourceRequestBase::setIsSameSite): Added.
108         (WebCore::ResourceRequestBase::isTopSite const): Added.
109         (WebCore::ResourceRequestBase::setIsTopSite): Added.
110         (WebCore::equalIgnoringHeaderFields):
111         * platform/network/ResourceRequestBase.h:
112         (WebCore::ResourceRequestBase::isSameSiteUnspecified const): Added. See comment for DocumentLoader::startLoadingMainResource()
113         for more details.
114         (WebCore::registrableDomainsAreEqual): Added.
115         (WebCore::ResourceRequestBase::encodeBase const): Encode same-site bits.
116         (WebCore::ResourceRequestBase::decodeBase): Decode same-site bits.
117         * platform/network/SameSiteInfo.cpp: Added.
118         (WebCore::SameSiteInfo::create):
119         * platform/network/SameSiteInfo.h: Added.
120         (WebCore::SameSiteInfo::encode const):
121         (WebCore::SameSiteInfo::decode):
122         * platform/network/cf/CookieJarCFNet.cpp:
123         (WebCore::setCookiesFromDOM): Pass Same-Site info down.
124         (WebCore::cookiesForDOM): Ditto.
125         (WebCore::cookieRequestHeaderFieldValue): Ditto.
126         (WebCore::getRawCookies): Ditto.
127         * platform/network/cf/ResourceRequestCFNet.cpp:
128         (WebCore::siteForCookies): Added.
129         (WebCore::ResourceRequest::doUpdatePlatformRequest): Update platform request with same-site info.
130         (WebCore::ResourceRequest::doUpdateResourceRequest): Ditto.
131         * platform/network/cocoa/ResourceRequestCocoa.mm:
132         (WebCore::ResourceRequest::doUpdateResourceRequest): Ditto.
133         (WebCore::siteForCookies): Added.
134         (WebCore::ResourceRequest::doUpdatePlatformRequest): Update platform request with same-site info.
135         * platform/network/curl/CookieJarCurl.cpp:
136         (WebCore::cookiesForDOM): Pass Same-Site info down.
137         (WebCore::setCookiesFromDOM): Ditto.
138         (WebCore::cookieRequestHeaderFieldValue): Ditto.
139         (WebCore::getRawCookies): Ditto.
140         * platform/network/curl/CookieJarCurl.h:
141         * platform/network/curl/CookieJarCurlDatabase.cpp:
142         (WebCore::CookieJarCurlDatabase::setCookiesFromDOM const): Ditto.
143         (WebCore::CookieJarCurlDatabase::cookiesForDOM const): Ditto.
144         (WebCore::CookieJarCurlDatabase::cookieRequestHeaderFieldValue const): Ditto.
145         (WebCore::CookieJarCurlDatabase::getRawCookies const): Ditto.
146         * platform/network/curl/CookieJarCurlDatabase.h:
147         * platform/network/curl/ResourceHandleCurl.cpp:
148         (WebCore::ResourceHandle::createCurlRequest): Ditto.
149         * platform/network/mac/CookieJarMac.mm:
150         (WebCore::cookiesForURL): Added; shared function to return the cookies based on the specified criterion. 
151         (WebCore::setHTTPCookiesForURL): Moved from the bottom of the file to top to be closer to the other
152         CFNetwork helper functions. Modified to support fetching same-site cookies.
153         (WebCore::httpCookiesForURL): Moved to be under setHTTPCookiesForURL(). Modified to call cookiesForURL().
154         Note the SPI used in cookiesForURL() apply the same criterion for whether to fetch secure cookies as we
155         were computing here. That is, the CFNetwork SPI only returns secure cookies if the specified URL's scheme
156         case-insensitively matches "https".
157         (WebCore::cookiesInPartitionForURL): Wrote in terms of cookiesForURL().
158         (WebCore::cookiesForSession): Pass the Same-Site info.
159         (WebCore::cookiesForDOM): Ditto.
160         (WebCore::cookieRequestHeaderFieldValue): Ditto.
161         (WebCore::setCookiesFromDOM): Ditto.
162         (WebCore::getRawCookies): Ditto.
163         (WebCore::deleteCookie): Pass std::nullopt for the Same-Site info so that we do not consider the SameSite
164         attribute when fetching cookies to delete.
165         * platform/network/soup/CookieJarSoup.cpp:
166         (WebCore::setCookiesFromDOM): Pass the Same-Site info.
167         (WebCore::cookiesForDOM): Ditto.
168         (WebCore::cookieRequestHeaderFieldValue): Ditto.
169         (WebCore::getRawCookies): Ditto.
170         * workers/service/context/ServiceWorkerThreadProxy.cpp:
171         (WebCore::createPageForServiceWorker): Set the first party for same site cookies ("site for cookies") to
172         the script URL.
173         * xml/XSLTProcessor.cpp:
174         (WebCore::XSLTProcessor::createDocumentFromSource): Copy the first party for same-site cookies to the
175         new document.
176
177 2018-04-23  Chris Dumez  <cdumez@apple.com>
178
179         HTML String load cannot be prevented by responding 'Cancel' asynchronously in decidePolicyForNavigationAction
180         https://bugs.webkit.org/show_bug.cgi?id=184848
181         <rdar://problem/39145306>
182
183         Reviewed by Brady Eidson.
184
185         When calling loadHTMLString on a WebView, we end up doing a load for 'about:blank'
186         with substitute data. In such case, we want to do a regular asynchronous policy
187         delegate check, there is no reason we need it to be synchronous. Update our check
188         to make sure we only do a synchronous policy check for initial 'about:blank' loads
189         that do not have substitute data.
190
191         * loader/PolicyChecker.cpp:
192         (WebCore::PolicyChecker::checkNavigationPolicy):
193
194 2018-04-23  Wenson Hsieh  <wenson_hsieh@apple.com>
195
196         [Extra zoom mode] 100vw is roughly half of the viewport width in extra zoom mode
197         https://bugs.webkit.org/show_bug.cgi?id=184871
198         <rdar://problem/39477595>
199
200         Reviewed by Andy Estes.
201
202         Currently, when computing CSS viewport units, we use ViewportConfiguration::initialScaleIgnoringContentSize().
203         This method computes an initial scale from the layout width and height without relying on any information
204         derived from the current content size. This is done to ensure that the content size and viewport dimensions for
205         CSS viewport units should not be simultaneously dependent on each other.
206
207         Since shrink-to-fit heuristics depend on content size, we currently assume that shrink-to-fit is disabled when
208         computing initialScaleIgnoringContentSize, by always passing in `false` for `shouldIgnoreScalingConstraints`.
209         However, in extra zoom mode, the opposite is true: since we force both `m_canIgnoreScalingConstraints` and
210         `m_forceHorizontalShrinkToFit` to be `true` in this mode, we will always try to shrink-to-fit regardless of
211         content size.
212
213         Because of this shrink-to-fit disparity between `initialScale` and `initialScaleIgnoringContentSize`, viewport
214         units in extra zoom mode are currently computed assuming an initial scale set by the page, whereas the real
215         viewport is scaled to fit, which causes any lengths computed in terms of vw and vh to be incorrect. To fix this,
216         we introduce a version of shouldIgnoreScalingConstraints() that returns `true` iff scaling constraints are
217         always ignored, regardless of content size. We then use this in initialScaleIgnoringContentSize, instead of
218         always passing in `false` for `shouldIgnoreScalingConstraints`.
219
220         Test: fast/css/extrazoom/viewport-units-shrink-to-fit.html
221
222         * page/ViewportConfiguration.cpp:
223         (WebCore::ViewportConfiguration::shouldIgnoreScalingConstraintsRegardlessOfContentSize const):
224         (WebCore::ViewportConfiguration::initialScaleIgnoringContentSize const):
225         * page/ViewportConfiguration.h:
226
227 2018-04-23  Zalan Bujtas  <zalan@apple.com>
228
229         [Simple line layout] Generate inline boxtree using simple line layout runs.
230         https://bugs.webkit.org/show_bug.cgi?id=184833
231
232         Reviewed by Antti Koivisto.
233
234         RenderBlockFlow::ensureLineBoxes triggers line layout on the block content to replace
235         the simple line layout runs with an inline boxtree. The runs generated by the fast path
236         should always match the inline tree boxes.
237         In this patch instead of triggering layout, we just convert the simple line runs to
238         inline boxes.
239         Currently, it works with only one, non-paginated text renderer, but we should be
240         able to extend it to all the simple line layout content.   
241
242         Covered by existing tests.
243
244         * rendering/InlineBox.h:
245         (WebCore::InlineBox::setHasHyphen):
246         (WebCore::InlineBox::setCanHaveLeadingExpansion):
247         (WebCore::InlineBox::setCanHaveTrailingExpansion):
248         (WebCore::InlineBox::setForceTrailingExpansion):
249         (WebCore::InlineBox::setForceLeadingExpansion):
250         (WebCore::InlineBox::hasHyphen const):
251         (WebCore::InlineBox::canHaveLeadingExpansion const):
252         (WebCore::InlineBox::canHaveTrailingExpansion const):
253         (WebCore::InlineBox::forceTrailingExpansion const):
254         * rendering/RenderBlockFlow.cpp:
255         (WebCore::RenderBlockFlow::ensureLineBoxes):
256         * rendering/RenderBlockFlow.h:
257         * rendering/SimpleLineLayoutFlowContents.h:
258         (WebCore::SimpleLineLayout::FlowContents::segmentForRun const):
259         * rendering/SimpleLineLayoutFunctions.cpp:
260         (WebCore::SimpleLineLayout::canUseForLineBoxTree):
261         (WebCore::SimpleLineLayout::initializeInlineBox):
262         (WebCore::SimpleLineLayout::generateLineBoxTree):
263         * rendering/SimpleLineLayoutFunctions.h:
264         * rendering/SimpleLineLayoutResolver.cpp:
265         (WebCore::SimpleLineLayout::RunResolver::rangeForLine const):
266         * rendering/SimpleLineLayoutResolver.h:
267
268 2018-04-23  Zan Dobersek  <zdobersek@igalia.com>
269
270         [CoordGraphics] Remove unused trajectory cruft in CoordinatedLayerTreeHost, CoordinatedGraphicsLayer
271         https://bugs.webkit.org/show_bug.cgi?id=184881
272
273         Reviewed by Michael Catanzaro.
274
275         Remove the redundant findFirstDescendantWithContentsRecursively() and
276         setVisibleContentRectTrajectoryVector() methods on the
277         CoordinatedGraphicsLayer class.
278
279         * platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.cpp:
280         (WebCore::CoordinatedGraphicsLayer::findFirstDescendantWithContentsRecursively): Deleted.
281         (WebCore::CoordinatedGraphicsLayer::setVisibleContentRectTrajectoryVector): Deleted.
282         * platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.h:
283
284 2018-04-23  Zan Dobersek  <zdobersek@igalia.com>
285
286         [CoordGraphics] TiledBackingStore unnecessarily tracks alpha support value
287         https://bugs.webkit.org/show_bug.cgi?id=184880
288
289         Reviewed by Michael Catanzaro.
290
291         Drop the m_supportsAlpha member from the TiledBackingStore class. The
292         member value was unused. TiledBackingStore::setSupportsAlpha() method
293         is removed.
294
295         TiledBackingStore::setSupportsAlpha() invalidated the backing store,
296         so CoordinatedGraphicsLayer::setContentsOpaque() now enforces the same
297         behavior by manually updating the m_needsDisplay struct. This means
298         that during the following layer flush the backing store is repainted
299         in its entirety.
300
301         * platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.cpp:
302         (WebCore::CoordinatedGraphicsLayer::setContentsOpaque):
303         (WebCore::CoordinatedGraphicsLayer::createBackingStore):
304         * platform/graphics/texmap/coordinated/TiledBackingStore.cpp:
305         (WebCore::TiledBackingStore::TiledBackingStore):
306         (WebCore::TiledBackingStore::setSupportsAlpha): Deleted.
307         * platform/graphics/texmap/coordinated/TiledBackingStore.h:
308
309 2018-04-23  Thibault Saunier  <tsaunier@igalia.com>
310
311         [GStreamer] Start implementing Audio/VideoTrackPrivateGSTreamer::kind method
312         https://bugs.webkit.org/show_bug.cgi?id=184650
313
314         Reviewed by Philippe Normand.
315
316         In the playbin3 case we can assume that if the GstStream is selected by default,
317         it is the Main track of that kind.
318
319         No new tests are added as:
320             * It relies on playbin3 case which support might be compiled out
321             * we already have a few test that are currently disabled in the mediastream
322               testsuite. This patch is part of the work to enable them.
323
324         * platform/graphics/gstreamer/AudioTrackPrivateGStreamer.cpp:
325         (WebCore::AudioTrackPrivateGStreamer::kind const):
326         * platform/graphics/gstreamer/AudioTrackPrivateGStreamer.h:
327         * platform/graphics/gstreamer/VideoTrackPrivateGStreamer.cpp:
328         (WebCore::VideoTrackPrivateGStreamer::kind const):
329         * platform/graphics/gstreamer/VideoTrackPrivateGStreamer.h:
330
331 2018-04-23  Alicia Boya García  <aboya@igalia.com>
332
333         [MSE] Add allSamplesInTrackEnqueued event
334         https://bugs.webkit.org/show_bug.cgi?id=184737
335
336         MediaSource has a .endOfStream() method to signal when there are no more frames
337         after the ones currently buffered.
338
339         This bit of data is important for some multimedia frameworks. For instance, in
340         GStreamer a stream of frames being decoded should be terminated by a
341         'end-of-stream' (EOS) event that has a similar meaning. Some GStreamer elements
342         will expect this event in order to work properly under some circumstances.
343
344         Unfortunately currently WebKit provides no mechanism for this: an event of
345         sorts should be emitted after no more frames are going to be enqueued to signal
346         the end of the stream. The closest mechanism WebKit has for this is
347         `markEndOfStream()`, but it's not exactly the same: markEndOfStream() informs
348         that -- as far as network buffering is concerned -- we are done; but at that
349         point there may still be (and often are) many frames waiting in the
350         decodeQueue, so it would be wrong to signal the decoder that there are no more
351         frames.
352
353         This patch introduces a new optional method in SourceBufferPrivate,
354         `allSamplesInTrackEnqueued(const AtomicString& trackID)` that is called
355         whenever the MediaSource is in "ended" state (the user has called
356         `MediaSource.endOfStream()`) and the decodeQueue is empty. Media framework
357         implementations can use this method to send a EOS event to a decoder that needs
358         it.
359
360         Reviewed by Xabier Rodriguez-Calvar.
361
362         * Modules/mediasource/MediaSource.cpp:
363         (WebCore::MediaSource::streamEndedWithError):
364         * Modules/mediasource/SourceBuffer.cpp:
365         (WebCore::SourceBuffer::provideMediaData):
366         (WebCore::SourceBuffer::trySignalAllSamplesInTrackEnqueued):
367         (WebCore::SourceBuffer::trySignalAllSamplesEnqueued):
368         * Modules/mediasource/SourceBuffer.h:
369         * platform/graphics/SourceBufferPrivate.h:
370         (WebCore::SourceBufferPrivate::allSamplesInTrackEnqueued):
371         * platform/graphics/gstreamer/mse/MediaSourceClientGStreamerMSE.cpp:
372         (WebCore::MediaSourceClientGStreamerMSE::allSamplesInTrackEnqueued):
373         * platform/graphics/gstreamer/mse/MediaSourceClientGStreamerMSE.h:
374         * platform/graphics/gstreamer/mse/PlaybackPipeline.cpp:
375         (WebCore::PlaybackPipeline::allSamplesInTrackEnqueued):
376         * platform/graphics/gstreamer/mse/PlaybackPipeline.h:
377         * platform/graphics/gstreamer/mse/SourceBufferPrivateGStreamer.cpp:
378         (WebCore::SourceBufferPrivateGStreamer::allSamplesInTrackEnqueued):
379         * platform/graphics/gstreamer/mse/SourceBufferPrivateGStreamer.h:
380
381 2018-04-23  Ms2ger  <Ms2ger@igalia.com>
382
383         Avoid uninitialized memory read.
384         https://bugs.webkit.org/show_bug.cgi?id=184505
385         <rdar://problem/39348325>
386
387         Reviewed by Dean Jackson.
388
389         Test: imported/w3c/web-platform-tests/2dcontext/imagebitmap/createImageBitmap-bounds.html
390
391         * html/ImageBitmap.cpp:
392         (WebCore::croppedSourceRectangleWithFormatting):
393
394 2018-04-23  Zan Dobersek  <zdobersek@igalia.com>
395
396         [TexMap] Drop RefCounted inheritance off of TextureMapperBackingStore
397         https://bugs.webkit.org/show_bug.cgi?id=184810
398
399         Reviewed by Carlos Garcia Campos.
400
401         Turn TextureMapperBackingStore into a simple interface that doesn't
402         inherit from RefCounted<>. Instead, push that inheritance off to the
403         classes that implement the TextureMapperBackingStore interface. This
404         narrows down the purpose of TextureMapperBackingStore towards a simple
405         interface that TextureMapper algorithms can work with.
406
407         TextureMapperLayer has its m_backingStore member variable turn into
408         a simple pointer instead of a RefPtr<>. Setter method and call sites of
409         that method are updated to reflect that.
410
411         TextureMapperTiledBackingStore now inherits from RefCounted<> directly,
412         instead of through TextureMapperBackingStore.
413
414         * platform/graphics/texmap/GraphicsLayerTextureMapper.cpp:
415         (WebCore::GraphicsLayerTextureMapper::commitLayerChanges):
416         (WebCore::GraphicsLayerTextureMapper::updateBackingStoreIfNeeded):
417         * platform/graphics/texmap/GraphicsLayerTextureMapper.h:
418         * platform/graphics/texmap/TextureMapperBackingStore.h:
419         * platform/graphics/texmap/TextureMapperLayer.cpp:
420         (WebCore::TextureMapperLayer::setBackingStore):
421         * platform/graphics/texmap/TextureMapperLayer.h:
422         * platform/graphics/texmap/TextureMapperTiledBackingStore.h:
423
424 2018-04-22  Zan Dobersek  <zdobersek@igalia.com>
425
426         [AsyncScrolling] Add generic ScrollingThread implementation
427         https://bugs.webkit.org/show_bug.cgi?id=184809
428
429         Reviewed by Yusuke Suzuki.
430
431         Add a generic ScrollingThread implementation that internally uses
432         RunLoop facilities to run the scrolling thread and dispatch
433         callbacks on that thread.
434
435         ScrollingThread::initializeRunLoop() retrieves address of the
436         thread-specific RunLoop and signals the Condition object.
437         ScrollingThread::wakeUpRunLoop() uses RunLoop::dispatch() to schedule
438         callback dispatches on the scrolling thread.
439
440         ScrollingThread::createThreadIfNeeded() mimics Cocoa implementation and
441         waits for the RunLoop address to be retrieved before continuing.
442
443         * SourcesGTK.txt: Add to build.
444         * SourcesWPE.txt: Ditto.
445         * page/scrolling/ScrollingThread.cpp:
446         (WebCore::ScrollingThread::createThreadIfNeeded):
447         * page/scrolling/ScrollingThread.h:
448         * page/scrolling/generic/ScrollingThreadGeneric.cpp: Added.
449         (WebCore::ScrollingThread::initializeRunLoop):
450         (WebCore::ScrollingThread::wakeUpRunLoop):
451
452 2018-04-22  Zan Dobersek  <zdobersek@igalia.com>
453
454         [CoordinatedGraphics] Unused contentsSize, coveredRect attributes in CoordinatedGraphicsState
455         https://bugs.webkit.org/show_bug.cgi?id=184811
456
457         Reviewed by Carlos Garcia Campos.
458
459         Remove the unused contentsSize and coveredRect attributes on the
460         CoordinatedGraphicsState struct. CoordinatedGraphicsLayer::coverRect()
461         method is now unused and can also be removed.
462
463         * platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.h:
464         * platform/graphics/texmap/coordinated/CoordinatedGraphicsState.h:
465
466 2018-04-21  Daniel Bates  <dabates@apple.com>
467
468         Cleanup CookieRequestHeaderFieldProxy
469         https://bugs.webkit.org/show_bug.cgi?id=184868
470
471         Remove extraneous whitespace that I inadvertently added.
472
473         * platform/network/CookieRequestHeaderFieldProxy.h:
474         (WebCore::CookieRequestHeaderFieldProxy::decode):
475
476 2018-04-21  Daniel Bates  <dabates@apple.com>
477
478         Cleanup CookieRequestHeaderFieldProxy
479         https://bugs.webkit.org/show_bug.cgi?id=184868
480
481         Reviewed by Youenn Fablet.
482
483         Simplify the struct CookieRequestHeaderFieldProxy and make it consistent with other structs.
484         Among other changes, remove constructors for CookieRequestHeaderFieldProxy as they are
485         unnecessary as all supported compilers support non-static data member initializers (NSDMI)
486         for aggregates, remove prefix "m_" from the name of fields as this is struct exists for
487         convenience and offers no encapsulation and simplify decoding logic of this struct.
488
489         No functionality changed. So, no new tests.
490
491         * loader/CookieJar.cpp:
492         (WebCore::cookieRequestHeaderFieldProxy):
493         * platform/network/CookieRequestHeaderFieldProxy.h:
494         (WebCore::CookieRequestHeaderFieldProxy::encode const):
495         (WebCore::CookieRequestHeaderFieldProxy::decode):
496         (WebCore::CookieRequestHeaderFieldProxy::CookieRequestHeaderFieldProxy): Deleted.
497         * platform/network/SocketStreamHandleImpl.cpp:
498         (WebCore::cookieDataForHandshake):
499         * platform/network/cf/CookieJarCFNet.cpp:
500         (WebCore::cookieRequestHeaderFieldValue):
501         * platform/network/curl/CookieJarCurl.cpp:
502         (WebCore::cookieRequestHeaderFieldValue):
503         * platform/network/curl/CookieJarCurlDatabase.cpp:
504         (WebCore::CookieJarCurlDatabase::cookieRequestHeaderFieldValue const):
505         * platform/network/mac/CookieJarMac.mm:
506         (WebCore::cookieRequestHeaderFieldValue):
507         * platform/network/soup/CookieJarSoup.cpp:
508         (WebCore::cookieRequestHeaderFieldValue):
509
510 2018-04-21  Antoine Quint  <graouts@apple.com>
511
512         [Modern Media Controls] Show a loading indicator after pressing the play button in compact mode
513         https://bugs.webkit.org/show_bug.cgi?id=184863
514         <rdar://problem/38939468>
515
516         Reviewed by Dean Jackson.
517
518         We now display a loading indicator after pressing the play button when in compact mode. We also update the
519         behavior to use assets provided through WebKitAdditions (see webkit.org/b/184862) for the play button and
520         the invalid icon. Additionally, we always show a 20% opaque black overlay in the background while any piece
521         of user interface is up.
522
523         * Modules/modern-media-controls/controls/compact-activity-indicator.css: Added.
524         (button.compact-activity-indicator > picture): The loading indicator asset is a sprite made of 23 frames, so
525         we specify the mask size (since all buttons are rendered via a mask) to be 23 * 100% the rendered size. The
526         display of the loading indicator is performed with a first intro animation which runs once through the first
527         8 frames and then a continuously looping animation going through the remaining frames. We use a frames()
528         timing function to achieve the frame-by-frame effect while using only from/to keyframe animations. When we
529         fade out, we use a simply opacity fade, which is combined with the spinning animation. We use CSS variables
530         to encode both animations so they can be used combined or one at a time without redefining the whole animation
531         property.
532         (button.compact-activity-indicator.spins > picture): Use the "spins" animation variable when spinning.
533         (button.compact-activity-indicator.spins.fades-out > picture): Combine the "spins" and "fades-out" animation
534         variables when fading out.
535         (@keyframes compact-activity-indicator-intro): Animation going through the first 8 frames of the loading indicator.
536         (@keyframes compact-activity-indicator-loop): Animation going through the remaining frames of the loading indicator.
537         (@keyframes compact-activity-indicator-fades-out): Animation fading opacity from 1 to 0.
538         * Modules/modern-media-controls/controls/compact-activity-indicator.js: Added.
539         (CompactActivityIndicator):
540         (CompactActivityIndicator.prototype.show): Add the "spins" CSS class to show the control spinning with the intro animation.
541         (CompactActivityIndicator.prototype.hide): Add the "fades-out" CSS class to hide the control, removing both this class and
542         the "spins" class when the fade-out animation completes.
543         * Modules/modern-media-controls/controls/compact-media-controls.css: Added.
544         (.media-controls.compact:before): Add a 20% black overlay over the video frame to provide contrast for controls.
545         (.media-controls.compact button): Ensure buttons are sized to use the entire video frame so that their hit region
546         comprises the whole video frame.
547         (.media-controls.compact button > picture): Override default blending styles for a simple solid white mask.
548         (.media-controls.compact button:active > picture): Turn off the scale down effect when pressing a button.
549         * Modules/modern-media-controls/controls/compact-media-controls.js: Expose a "state" property for the compact media controls,
550         which can be exlusively one of three: "paused", "pending" and "invalid".
551         (CompactMediaControls.):
552         (CompactMediaControls.prototype.get state):
553         (CompactMediaControls.prototype.set state):
554         (CompactMediaControls.prototype.layout): In the "paused" state, show the play button. In the "pending" state show
555         the loading indicator. In the "invalid" state show the invalid button.
556         (CompactMediaControls.prototype.get placard): Deleted.
557         (CompactMediaControls.prototype.set placard): Deleted.
558         * Modules/modern-media-controls/js-files:
559         * Modules/modern-media-controls/media/compact-media-controls-support.js: Added.
560         (CompactMediaControlsSupport.prototype.get mediaEvents):
561         (CompactMediaControlsSupport.prototype.handleEvent): Make the controls enter the "paused" state when receiving a "pause"
562         event. Make the controls enter the "invalid" state when receiving an "error" event. 
563         (CompactMediaControlsSupport.prototype.enable):
564         (CompactMediaControlsSupport.prototype.disable):
565         (CompactMediaControlsSupport.prototype.buttonWasPressed): Play the media when pressing the play button and make the controls
566         enter the "pending" state. When pressing the loading indicator, pause the media and make the controls enter the "paused" state.
567         (CompactMediaControlsSupport.prototype._buttons):
568         (CompactMediaControlsSupport):
569         * Modules/modern-media-controls/media/media-controller.js:
570         (MediaController.prototype._supportingObjectClasses): Only use CompactMediaControlsSupport as a media controller supporting object
571         in the compact mode.
572         * Modules/modern-media-controls/media/placard-support.js:
573         (PlacardSupport.prototype.get mediaEvents): This media controller support object no longer needs to deal with compact mode.
574         * Modules/modern-media-controls/media/playback-support.js:
575         (PlaybackSupport.prototype.syncControl): This media controller support object no longer needs to deal with compact mode.
576         (PlaybackSupport):
577
578 2018-04-21  Antoine Quint  <graouts@apple.com>
579
580         [Modern Media Controls] Obtain compact mode icons through WebKitAdditions
581         https://bugs.webkit.org/show_bug.cgi?id=184862
582         <rdar://problem/39621645>
583
584         Reviewed by Jon Lee.
585
586         * Modules/modern-media-controls/controls/button.js:
587         (Button.prototype._updateImageMetrics): Handle PDF assets where the image source's intrinsic size needs
588         to be adjusted for the device pixel density.
589         (Button):
590         * Modules/modern-media-controls/controls/icon-service.js: Expect three additional icons provided through
591         WebKitAdditions, including two in the PDF format, so we add support for this format.
592         * WebCore.xcodeproj/project.pbxproj: Copy additional assets from the WebKitAdditions build directory should
593         any be present.
594
595 2018-04-21  Dean Jackson  <dino@apple.com>
596
597         Expose whether you've build with the Apple Internal SDK
598         https://bugs.webkit.org/show_bug.cgi?id=184864
599
600         Reviewed by Wenson Hsieh.
601
602         Internals API to let a test know if it is running with the
603         Apple internal SDK.
604
605         * testing/Internals.cpp:
606         (WebCore::usingAppleInternalSDK const):
607         * testing/Internals.h:
608         * testing/Internals.idl:
609
610 2018-04-20  Nan Wang  <n_wang@apple.com>
611
612         AX: AOM does not work with DOM Level 1 events
613         https://bugs.webkit.org/show_bug.cgi?id=184847
614
615         Reviewed by Chris Fleizach.
616
617         Added the accessibility events to the HTML attribute names.
618
619         Test cases are added to the existing layout tests.
620
621         * html/HTMLAttributeNames.in:
622         * html/HTMLElement.cpp:
623         (WebCore::HTMLElement::createEventHandlerNameMap):
624
625 2018-04-20  Carlos Garcia Campos  <cgarcia@igalia.com>
626
627         REGRESSION(r228088): [SOUP] Check TLS errors for WebSockets on GTlsConnection::accept-certificate
628         https://bugs.webkit.org/show_bug.cgi?id=184804
629
630         Reviewed by Michael Catanzaro.
631
632         * platform/network/soup/SocketStreamHandleImpl.h: Add a public url getter.
633         * platform/network/soup/SocketStreamHandleImplSoup.cpp:
634         (WebCore::acceptCertificateCallback): Call SoupNetworkSession::checkTLSErrors() to decide whether to accept the
635         certificate or not.
636         (WebCore::connectProgressCallback): Receive the SocketStreamHandle and pass it to acceptCertificateCallback callback.
637         (WebCore::socketClientEventCallback): Ditto.
638         (WebCore::SocketStreamHandleImpl::create): Always connect to network events.
639         (WebCore::wssConnectionAcceptCertificateCallback): Deleted.
640         (WebCore::wssSocketClientEventCallback): Deleted.
641
642 2018-04-20  Carlos Garcia Campos  <cgarcia@igalia.com>
643
644         [SOUP] Do TLS error checking on GTlsConnection::accept-certificate
645         https://bugs.webkit.org/show_bug.cgi?id=184480
646
647         Reviewed by Michael Catanzaro.
648
649         * platform/network/soup/ResourceError.h: Change tlsError to recieve a failing URL instead of a SoupRequest,
650         since the request was only used to get the failing URL.
651         * platform/network/soup/ResourceErrorSoup.cpp:
652         (WebCore::ResourceError::tlsError): Use the given failing URL.
653         * platform/network/soup/SoupNetworkSession.cpp:
654         (WebCore::SoupNetworkSession::SoupNetworkSession): Use ssl-strict when creating the SoupSession to handle the
655         certificates ourselves by connecting to GTlsConnection::accept-certificate.
656         (WebCore::SoupNetworkSession::checkTLSErrors): Updated to receive a URL, certificate and errors instead of
657         receiving a SoupRequest and SoupMessage and extract the url, certirficate and errors from them. Also return the
658         optional error directly instead of using a completion handler since the function is always synchronous.
659         * platform/network/soup/SoupNetworkSession.h:
660
661 2018-04-20  Tim Horton  <timothy_horton@apple.com>
662
663         Adjust geolocation feature flag
664         https://bugs.webkit.org/show_bug.cgi?id=184856
665
666         Reviewed by Wenson Hsieh.
667
668         * Configurations/FeatureDefines.xcconfig:
669
670 2018-04-20  Chris Dumez  <cdumez@apple.com>
671
672         Unreviewed attempt to fix Windows build after r230875.
673
674         * platform/network/cf/CookieJarCFNet.cpp:
675         (WebCore::cookieRequestHeaderFieldValue):
676         * platform/network/curl/CookieJarCurlDatabase.cpp:
677
678 2018-04-20  Chris Dumez  <cdumez@apple.com>
679
680         REGRESSION (r229828): web view doesn’t update or respond to resizing until client calls policy decision handler
681         https://bugs.webkit.org/show_bug.cgi?id=184210
682         <rdar://problem/39072354>
683
684         Reviewed by Wenson Hsieh.
685
686         r229828 tried to have some API tests happy on iOS by freezing the layer tree
687         during the navigation policy decision. However, this is observable by the client
688         application and a regression from when the policy delegate was synchronous.
689
690         To address the issue, this patch reverts r229828 and instead updates the iOS
691         API tests to wait for the next presentation update after navigating
692         before interacting with the view.
693
694         * loader/FrameLoaderClient.h:
695         * loader/PolicyChecker.cpp:
696         (WebCore::PolicyChecker::checkNavigationPolicy):
697
698 2018-04-20  Brent Fulgham  <bfulgham@apple.com>
699
700         Limit cookie header access to Network process
701         https://bugs.webkit.org/show_bug.cgi?id=184764
702         <rdar://problem/36785285>
703
704         Reviewed by Youenn Fablet.
705
706         Revise the handling of cookie request headers so that we don't interact with them in the
707         WebContent process. They are only needed for interaction with the server and the network
708         process, so we should limit their scope to just the Network process.
709
710         Instead, we should handle a token that represents the cookie headers in the WebContent
711         process, which can be converted to the relevant cookie data in the network process when
712         needed.
713
714         * Modules/websockets/WebSocketChannel.cpp:
715         (WebCore::WebSocketChannel::didOpenSocketStream):
716         * Modules/websockets/WebSocketHandshake.cpp:
717         (WebCore::WebSocketHandshake::clientHandshakeMessage const):
718         (WebCore::WebSocketHandshake::clientHandshakeRequest const):
719         (WebCore::WebSocketHandshake::clientHandshakeCookieRequestHeaderFieldProxy const):
720         (WebCore::WebSocketHandshake::clientHandshakeMessage): Deleted.
721         (WebCore::WebSocketHandshake::clientHandshakeRequest): Deleted.
722         * Modules/websockets/WebSocketHandshake.h:
723         * WebCore.xcodeproj/project.pbxproj:
724         * loader/CookieJar.cpp:
725         (WebCore::cookieRequestHeaderFieldProxy):
726         * loader/CookieJar.h:
727         * platform/network/CookieRequestHeaderFieldProxy.h: Added.
728         (WebCore::CookieRequestHeaderFieldProxy::CookieRequestHeaderFieldProxy):
729         (WebCore::CookieRequestHeaderFieldProxy::isolatedCopy const):
730         (WebCore::CookieRequestHeaderFieldProxy::encode const):
731         (WebCore::CookieRequestHeaderFieldProxy::decode):
732         * platform/network/PlatformCookieJar.h:
733         * platform/network/SocketStreamHandle.cpp:
734         (WebCore::SocketStreamHandle::sendHandshake):
735         * platform/network/SocketStreamHandle.h:
736         * platform/network/SocketStreamHandleImpl.cpp:
737         (WebCore::SocketStreamHandleImpl::platformSendHandshake):
738         * platform/network/cf/SocketStreamHandleImpl.h:
739         * platform/network/curl/CookieJarCurl.cpp:
740         (WebCore::cookieRequestHeaderFieldValue):
741         * platform/network/curl/CookieJarCurl.h:
742         * platform/network/curl/SocketStreamHandleImpl.h:
743         * platform/network/mac/CookieJarMac.mm:
744         (WebCore::cookieRequestHeaderFieldValue):
745         * platform/network/soup/CookieJarSoup.cpp:
746         (WebCore::cookieRequestHeaderFieldValue):
747         * platform/network/soup/SocketStreamHandleImpl.h:
748
749 2018-04-20  Daniel Bates  <dabates@apple.com>
750
751         Hide Strong Password label when text field is too narrow
752         https://bugs.webkit.org/show_bug.cgi?id=184785
753         <rdar://problem/38183939>
754
755         Reviewed by Zalan Bujtas.
756
757         We accomplish this illusion by allowing the text field's decorations to wrap, specifying flex
758         shrink factors, a flex basis and hiding overflow. Hiding overflow is accomplished by a
759         combination of setting "overflow: hidden", "text-overflow: clip", and patching RenderTextControlSingleLine::layout()
760         to ensure that the height of the container element is equal to the intrinsic height of the
761         inner elements. Because the container is a flex box and we want to vertically center its
762         contents we also need to fix up the y-position of the container element as it may have flexed
763         as a result of forcing its height to match the intrinsic height of the inner elements.
764
765         * css/html.css:
766         (input::-webkit-strong-password-auto-fill-button): Specify a flex-shrink factor and prevent
767         wrapping of the "Strong Password" text when flexed.
768         * html/shadow/TextControlInnerElements.cpp:
769         (WebCore::TextControlInnerContainer::TextControlInnerContainer): Register for a custom style
770         resolution callback so that we can style the container if it is a Strong Password or Strong
771         Confirmation Password text field. Ideally we could accomplish this effect with a user agent-
772         specific pseudo class together with a selector definition in the user agent style sheet,
773         html.css. Unfortunately the style resolver does not seem to apply pseudo classes to
774         shadow DOM pseudo elements (why?). Therefore we use a custom style resolution callback to
775         achieve the same effect.
776         (WebCore::isStrongPasswordTextField): Returns whether the specified DOM element is a Strong
777         Password text field.
778         (WebCore::TextControlInnerContainer::resolveCustomStyle): Conditionally apply CSS properties
779         "flex-wrap: wrap" and overflow: hidden" if the shadow host of this container is a Strong
780         Password text field.
781         (WebCore::TextControlInnerElement::resolveCustomStyle): Conditionally style the inner text
782         if the shadow host of this container is a Strong Password text field. We need to apply these
783         styles here as opposed to in html.css for the same reason we need to apply the styles to
784         the container in a custom style resolution callback. See the comments for TextControlInnerContainer()
785         above for more details
786         * html/shadow/TextControlInnerElements.h:
787         * rendering/RenderTextControlSingleLine.cpp:
788         (WebCore::resetOverriddenHeight): Added. Incorporates the logic from setNeedsLayoutOnAncestors().
789         (WebCore::RenderTextControlSingleLine::layout): Override the height of the container element to
790         match the height of the inner elements when this text field is a Strong Password field. We cache
791         the container's logical top before adjusting its height so that we can restore it after performing
792         a second layout of this renderer. This is needed because we vertically center the elements in this
793         renderer and adjusting the height of the container may cause it to flex and re-position along its
794         cross axis when the container's height is taller than the inner element's height (e.g. the "Strong
795         Password" label wraps to the next line). This re-positioning causes a noticeable jitter when
796         transitioning from a field that has a visible "Strong Password" label to one that does not. Caching
797         and restoring the logical top of the container element avoids this jitter.
798         (WebCore::setNeedsLayoutOnAncestors): Deleted. Moved its implementation into resetOverriddenHeight().
799
800 2018-04-20  Dean Jackson  <dino@apple.com>
801
802         Render a badge on system preview images
803         https://bugs.webkit.org/show_bug.cgi?id=184854
804         <rdar://problem/39615154>
805
806         Reviewed by Tim Horton.
807
808         At paint time, if a RenderImage is an image element
809         which is identified as a system preview, then draw
810         a little badge in the top right corner.
811
812         It is expected that platforms will override the
813         default rendering with something that identifies
814         how a system preview will operate. e.g. QuickLook
815         on Apple systems.
816
817         Test: system-preview/badge.html
818
819         * rendering/RenderImage.cpp:
820         (WebCore::RenderImage::paintIntoRect): If we are
821         a system preview, call RenderTheme to draw a badge.
822         * rendering/RenderTheme.cpp:
823         (WebCore::RenderTheme::paintSystemPreviewBadge): A default
824         implementation that draws a red circle.
825         * rendering/RenderTheme.h:
826
827 2018-04-20  Brian Burg  <bburg@apple.com>
828
829         Web Inspector: remove some dead code in IdentifiersFactory
830         https://bugs.webkit.org/show_bug.cgi?id=184839
831
832         Reviewed by Timothy Hatcher.
833
834         * inspector/InspectorController.cpp:
835         (WebCore::InspectorController::setProcessId): Deleted.
836         * inspector/InspectorController.h:
837
838 2018-04-20  Chris Dumez  <cdumez@apple.com>
839
840         Use WindowProxy in DOMWindow.idl
841         https://bugs.webkit.org/show_bug.cgi?id=184820
842
843         Reviewed by Sam Weinig.
844
845         Use WindowProxy in DOMWindow.idl to match the specification more closely.
846
847         * bindings/js/JSWindowProxy.h:
848         * bindings/js/WindowProxy.cpp:
849         (WebCore::WindowProxy::window const):
850         * bindings/js/WindowProxy.h:
851         * bindings/scripts/CodeGeneratorJS.pm:
852         (NativeToJSValueDOMConvertNeedsState):
853         * dom/Document.cpp:
854         * dom/Document.h:
855         * dom/Document.idl:
856         * page/DOMWindow.cpp:
857         (WebCore::DOMWindow::focus):
858         (WebCore::DOMWindow::self const):
859         (WebCore::DOMWindow::opener const):
860         (WebCore::DOMWindow::parent const):
861         (WebCore::DOMWindow::top const):
862         (WebCore::DOMWindow::open):
863         * page/DOMWindow.h:
864         * page/DOMWindow.idl:
865         * testing/Internals.cpp:
866         (WebCore::Internals::openDummyInspectorFrontend):
867         * testing/Internals.h:
868         * testing/Internals.idl:
869
870 2018-04-20  Chris Dumez  <cdumez@apple.com>
871
872         Update cross-origin SecurityError messages to not include the target origin
873         https://bugs.webkit.org/show_bug.cgi?id=184803
874         <rdar://problem/39547724>
875
876         Reviewed by Sam Weinig.
877
878         No new tests, rebaselined existing tests.
879
880         * bindings/js/JSDOMBindingSecurity.cpp:
881         (WebCore::canAccessDocument):
882         (WebCore::BindingSecurity::shouldAllowAccessToFrame):
883         (WebCore::BindingSecurity::shouldAllowAccessToDOMWindow):
884         * page/DOMWindow.cpp:
885         (WebCore::DOMWindow::crossDomainAccessErrorMessage):
886         (WebCore::DOMWindow::isInsecureScriptAccess):
887         * page/DOMWindow.h:
888         * page/Location.cpp:
889         (WebCore::Location::reload):
890
891 2018-04-20  Chris Nardi  <cnardi@chromium.org>
892
893         Update HSL/HSLA parsing to match CSS Color 4
894         https://bugs.webkit.org/show_bug.cgi?id=180528
895         <rdar://problem/35926675>
896
897         CSS Color 4 specifies a comma optional syntax for HSL/HSLA, as well as allowing angle values for the
898         hue and percent alpha values. Update our parsing to match this.
899
900         Reviewed by Simon Fraser.
901
902         This change also updates the import of WPT css-color to test the changes.
903
904         Tests: LayoutTests/imported/w3c/web-platform-tests/css/css-color/hsl{a}-{001-008}.html
905
906         * css/parser/CSSPropertyParserHelpers.cpp:
907         (WebCore::CSSPropertyParserHelpers::parseHSLParameters):
908         (WebCore::CSSPropertyParserHelpers::parseColorFunction):
909         (WebCore::CSSPropertyParserHelpers::consumeColor):
910         * platform/graphics/Color.cpp:
911         (WebCore::calcHue):
912         (WebCore::makeRGBAFromHSLA):
913
914 2018-04-20  Wenson Hsieh  <wenson_hsieh@apple.com>
915
916         [Extra zoom mode] Injected bundle form client should be notified when editing text fields
917         https://bugs.webkit.org/show_bug.cgi?id=184822
918         <rdar://problem/38807319>
919
920         Reviewed by Tim Horton.
921
922         Export the constructor and destructor of UserTypingGestureIndicator for use in WebKit (see WebPage.cpp).
923
924         Test: fast/forms/extrazoom/edit-text-field-calls-injected-bundle.html
925
926         * dom/UserTypingGestureIndicator.h:
927
928 2018-04-18  Jer Noble  <jer.noble@apple.com>
929
930         Don't put build products into WK_ALTERNATE_WEBKIT_SDK_PATH for engineering builds
931         https://bugs.webkit.org/show_bug.cgi?id=184762
932
933         Reviewed by Dan Bernstein.
934
935         * Configurations/WebCore.xcconfig:
936         * WebCore.xcodeproj/project.pbxproj:
937
938 2018-04-20  Daniel Bates  <dabates@apple.com>
939
940         Remove code for compilers that did not support NSDMI for aggregates
941         https://bugs.webkit.org/show_bug.cgi?id=184599
942
943         Reviewed by Per Arne Vollan.
944
945         Remove workaround for earlier Visual Studio versions that did not support non-static data
946         member initializers (NSDMI) for aggregates. We have since updated all the build.webkit.org
947         and EWS bots to a newer version that supports this feature.
948
949         * Modules/cache/CacheQueryOptions.h:
950         (WebCore::CacheQueryOptions::CacheQueryOptions): Deleted.
951         * dom/Node.h:
952         (WebCore::Node::InsertionType::InsertionType): Deleted.
953         (WebCore::Node::RemovalType::RemovalType): Deleted.
954         * html/canvas/CanvasStyle.h:
955         (WebCore::CanvasStyle::CMYKAColor::CMYKAColor): Deleted.
956         * page/EventHandler.h:
957         (WebCore::EventHandler::DragTargetResponse::DragTargetResponse): Deleted.
958         * page/animation/CSSAnimationController.h:
959         (WebCore::AnimationUpdate::AnimationUpdate): Deleted.
960         * platform/graphics/FontSelectionAlgorithm.h:
961         (WebCore::FontSelectionRequest::tied const):
962         (WebCore::FontSelectionRequest::FontSelectionRequest): Deleted.
963         (WebCore::FontSelectionCapabilities::FontSelectionCapabilities): Deleted.
964         * platform/mediastream/IceCandidate.h:
965         (WebCore::IceCandidate::IceCandidate): Deleted.
966         * platform/text/StringWithDirection.h:
967         (WebCore::StringWithDirection::StringWithDirection): Deleted.
968         * rendering/MarkedText.h:
969         (WebCore::MarkedText::MarkedText): Deleted.
970         * style/StyleUpdate.h:
971         (WebCore::Style::ElementUpdate::ElementUpdate): Deleted.
972         (WebCore::Style::ElementUpdates::ElementUpdates): Deleted.
973         (WebCore::Style::TextUpdate::TextUpdate): Deleted.
974
975 2018-04-20  Youenn Fablet  <youenn@apple.com>
976
977         WebPage sometimes incorrectly rules out PDF as a mime type that can be showed
978         https://bugs.webkit.org/show_bug.cgi?id=184369
979
980         Reviewed by Chris Dumez.
981
982         WebPage does need to check for plugins at reception of the response.
983         In that case, the page URL is the URL from which we are navigating out.
984         Add plugin API to check for plugin availability with an extra URL parameter to cover that case.
985
986         Covered by API test.
987
988         * plugins/PluginData.cpp:
989         (WebCore::PluginData::supportsWebVisibleMimeTypeForURL const):
990         (WebCore::PluginData::supportsWebVisibleMimeType const):
991         * plugins/PluginData.h:
992
993 2018-04-20  Daniel Bates  <dabates@apple.com>
994
995         Remove Strong Password decoration when text field type changes
996         https://bugs.webkit.org/show_bug.cgi?id=184795
997         <rdar://problem/38325108>
998
999         Reviewed by Antti Koivisto.
1000
1001         Remove the Strong Password decoration when the text field's type changes to avoid interfering
1002         with web sites that allow a person to show/hide their password.
1003
1004         Test: fast/forms/auto-fill-button/hide-strong-password-when-field-type-changes.html
1005
1006         * html/HTMLInputElement.cpp:
1007         (WebCore::HTMLInputElement::updateType):
1008
1009 2018-04-20  Javier Fernandez  <jfernandez@igalia.com>
1010
1011         Update Alignment shorthands to the spec now that they are not ambiguous
1012         https://bugs.webkit.org/show_bug.cgi?id=184812
1013
1014         Reviewed by Antti Koivisto.
1015
1016         Now that the issue [1] about the syntax ambiguity has been resolved we
1017         don't need to use the custom syntax anymore. The Alignment shorthands
1018         use now the simple syntax, defined based on the longhands' syntax.
1019
1020         Since we allow all the values valid for each longhand, we'll update
1021         in this CL the corresponding web platform tests. Additionally, this CL
1022         updates also the shorthand serialization tests [2], which didn't
1023         consider the new value 'legacy' for justify-items (and place-items) due
1024         to the bug [3] Firefox still has pending to be fixed.
1025
1026         [1] https://github.com/w3c/csswg-drafts/issues/1001
1027         [2] css/css-align/default-alignment/shorthand-serialization-001.html
1028         [3] https://bugzilla.mozilla.org/show_bug.cgi?id=1363875
1029
1030         Tests: imported/w3c/web-platform-tests/css/css-align/default-alignment/shorthand-serialization-001.html
1031                imported/w3c/web-platform-tests/css/css-align/gaps/gap-normal-computed-001.html
1032                imported/w3c/web-platform-tests/css/css-align/gaps/gap-normal-used-001.html
1033                imported/w3c/web-platform-tests/css/css-align/gaps/gap-normal-used-002.html
1034
1035         * css/parser/CSSPropertyParser.cpp:
1036         (WebCore::CSSPropertyParser::consumePlaceContentShorthand): Using the justify-content and align-content parsing logic to parse the shorthand.
1037         (WebCore::CSSPropertyParser::consumePlaceItemsShorthand): Using the justify-items and align-items parsing logic to parse the shorthand.
1038         (WebCore::CSSPropertyParser::consumePlaceSelfShorthand): Using the justify-self and align-self parsing logic to parse the shorthand.
1039
1040 2018-04-20  Daniel Bates  <dabates@apple.com>
1041
1042         Unreviewed, rolling out r230117.
1043
1044         Broke find-in-page for PDFs
1045
1046         Reverted changeset:
1047
1048         "ASSERTION FAILED: ASSERT(!containsImage ||
1049         MIMETypeRegistry::isSupportedImageResourceMIMEType([resource
1050         MIMEType])) in -[NSPasteboard(WebExtras)
1051         _web_writePromisedRTFDFromArchive:containsImage:]"
1052         https://bugs.webkit.org/show_bug.cgi?id=184161
1053         https://trac.webkit.org/changeset/230117
1054
1055 2018-04-20  Eric Carlson  <eric.carlson@apple.com>
1056
1057         Pausing should clear m_waitingToEnterFullscreen
1058         https://bugs.webkit.org/show_bug.cgi?id=184831
1059         <rdar://problem/39602852>
1060
1061         Reviewed by Jer Noble.
1062
1063         * html/HTMLMediaElement.cpp:
1064         (WebCore::HTMLMediaElement::pause): Clear m_waitingToEnterFullscreen
1065
1066 2018-04-20  Eric Carlson  <eric.carlson@apple.com>
1067
1068         [Extra zoom mode] Disable CA transactions while setting up for fullscreen
1069         https://bugs.webkit.org/show_bug.cgi?id=184817
1070         <rdar://problem/39596075>
1071
1072         Reviewed by Jer Noble.
1073
1074         This was tested manually as it is not possible to write an automated test for this.
1075
1076         * platform/ios/VideoFullscreenInterfaceAVKit.mm:
1077         (VideoFullscreenInterfaceAVKit::doSetup): Move the call to disable CA transactions outside
1078         of the EXTRA_ZOOM_MODE check, the [CATransaction commit] was already unguarded.
1079
1080 2018-04-20  Youenn Fablet  <youenn@apple.com>
1081
1082         Make PluginData cache its web visible plugins
1083         https://bugs.webkit.org/show_bug.cgi?id=184421
1084
1085         Reviewed by Chris Dumez.
1086
1087         Buffer visible plugins until the page URL changes.
1088         For that purpose, we now cache the visible plugins and the URL it was computed from in PluginData.
1089
1090         Update plugin info provider API to pass the URL used to check for plugin visibility.
1091
1092         No observable change of behavior.
1093
1094         * loader/EmptyClients.cpp:
1095         * plugins/PluginData.cpp:
1096         (WebCore::PluginData::webVisiblePlugins const):
1097         (WebCore::PluginData::publiclyVisiblePlugins const):
1098         (WebCore::PluginData::supportsMimeType const):
1099         * plugins/PluginData.h:
1100         * plugins/PluginInfoProvider.h:
1101
1102 2018-04-20  Chris Dumez  <cdumez@apple.com>
1103
1104         Unreviewed build fix after r230840.
1105
1106         * bindings/js/JSWindowProxy.cpp:
1107         (WebCore::JSWindowProxy::attachDebugger):
1108
1109 2018-04-20  Chris Dumez  <cdumez@apple.com>
1110
1111         Unreviewed attempt to fix the Windows build after r230831.
1112
1113         * bindings/js/JSWindowProxy.cpp:
1114         (WebCore::JSWindowProxy::create):
1115         (WebCore::JSWindowProxy::attachDebugger):
1116
1117 2018-04-20  Chris Nardi  <cnardi@chromium.org>
1118
1119         Omit default value when serializing font-feature-settings
1120         https://bugs.webkit.org/show_bug.cgi?id=182382
1121
1122         Reviewed by Myles C. Maxfield.
1123
1124         According to the shortest-serialization principle [1], values should be omitted if their omission
1125         wouldn't change the value of reparsing. As "1"/"on" is the default value for font-feature-settings,
1126         omit this when serializing, matching the behavior of Firefox and Chrome.
1127
1128         [1]: https://github.com/w3c/csswg-drafts/issues/1564
1129
1130         Updated css3/font-feature-settings-parsing.html, fast/css/inherited-properties-rare-text.html,
1131         and fast/text/font-face-javascript.html.
1132
1133         * css/CSSFontFeatureValue.cpp:
1134         (WebCore::CSSFontFeatureValue::customCSSText const):
1135
1136 2018-04-19  Alexey Proskuryakov  <ap@apple.com>
1137
1138         More WK_ALTERNATE_FRAMEWORKS_DIR adoption in WebCore
1139         https://bugs.webkit.org/show_bug.cgi?id=184805
1140
1141         Reviewed by Dan Bernstein.
1142
1143         * Configurations/WebCoreTestShim.xcconfig:
1144         * Configurations/WebCoreTestSupport.xcconfig:
1145
1146 2018-04-19  Brady Eidson  <beidson@apple.com>
1147
1148         Make back forward cache work with process swapping.
1149         <rdar://problem/38676604> and https://bugs.webkit.org/show_bug.cgi?id=184793
1150
1151         Reviewed by Chris Dumez.
1152
1153         Covered by API tests.
1154
1155         * loader/FrameLoader.cpp:
1156         (WebCore::FrameLoader::loadWithNavigationAction):
1157         (WebCore::FrameLoader::load):
1158         (WebCore::FrameLoader::loadWithDocumentLoader):
1159         (WebCore::FrameLoader::reloadWithOverrideEncoding):
1160         (WebCore::FrameLoader::reload):
1161         (WebCore::FrameLoader::commitProvisionalLoad):
1162         (WebCore::FrameLoader::loadDifferentDocumentItem):
1163         * loader/FrameLoader.h:
1164
1165 2018-04-19  Chris Dumez  <cdumez@apple.com>
1166
1167         Rename JSDOMWindowProxy to JSWindowProxy
1168         https://bugs.webkit.org/show_bug.cgi?id=184797
1169
1170         Reviewed by Sam Weinig.
1171
1172         Rename JSDOMWindowProxy to JSWindowProxy for consistency with WindowProxy.
1173
1174         * Sources.txt:
1175         * WebCore.xcodeproj/project.pbxproj:
1176         * bindings/IDLTypes.h:
1177         * bindings/js/JSBindingsAllInOne.cpp:
1178         * bindings/js/JSDOMConvertWindowProxy.h:
1179         * bindings/js/JSDOMWindowBase.cpp:
1180         (WebCore::JSDOMWindowBase::JSDOMWindowBase):
1181         (WebCore::JSDOMWindowBase::finishCreation):
1182         (WebCore::JSDOMWindowBase::proxy const):
1183         (WebCore::toJSDOMWindow):
1184         * bindings/js/JSDOMWindowBase.h:
1185         * bindings/js/JSDOMWindowCustom.cpp:
1186         (WebCore::JSDOMWindow::toWrapped):
1187         * bindings/js/JSEventTargetCustom.cpp:
1188         (WebCore::JSEventTarget::toWrapped):
1189         * bindings/js/JSRemoteDOMWindowBase.cpp:
1190         (WebCore::JSRemoteDOMWindowBase::JSRemoteDOMWindowBase):
1191         (WebCore::toJSRemoteDOMWindow):
1192         * bindings/js/JSRemoteDOMWindowBase.h:
1193         * bindings/js/JSWindowProxy.cpp: Renamed from Source/WebCore/bindings/js/JSDOMWindowProxy.cpp.
1194         (WebCore::JSWindowProxy::JSWindowProxy):
1195         (WebCore::JSWindowProxy::finishCreation):
1196         (WebCore::JSWindowProxy::create):
1197         (WebCore::JSWindowProxy::destroy):
1198         (WebCore::JSWindowProxy::setWindow):
1199         (WebCore::JSWindowProxy::attachDebugger):
1200         (WebCore::JSWindowProxy::wrapped const):
1201         (WebCore::JSWindowProxy::toWrapped):
1202         (WebCore::toJS):
1203         (WebCore::toJSWindowProxy):
1204         * bindings/js/JSWindowProxy.h: Renamed from Source/WebCore/bindings/js/JSDOMWindowProxy.h.
1205         (WebCore::toJS):
1206         (WebCore::toJSWindowProxy):
1207         * bindings/js/ScriptController.cpp:
1208         (WebCore::ScriptController::initScriptForWindowProxy):
1209         * bindings/js/ScriptController.h:
1210         * bindings/js/WindowProxy.cpp:
1211         (WebCore::WindowProxy::createJSWindowProxy):
1212         (WebCore::WindowProxy::jsWindowProxiesAsVector const):
1213         (WebCore::WindowProxy::createJSWindowProxyWithInitializedScript):
1214         * bindings/js/WindowProxy.h:
1215         (WebCore::WindowProxy::jsWindowProxy):
1216         (WebCore::WindowProxy::existingJSWindowProxy const):
1217         * bindings/scripts/CodeGeneratorJS.pm:
1218         (AddToIncludesForIDLType):
1219         (GenerateHeader):
1220         (GenerateOverloadDispatcher):
1221         (GenerateImplementation):
1222         * bindings/scripts/test/JS/JSTestObj.cpp:
1223         (WebCore::jsTestObjPrototypeFunctionOverloadedMethodOverloadDispatcher):
1224         * page/Frame.cpp:
1225         * page/csp/ContentSecurityPolicy.cpp:
1226         (WebCore::ContentSecurityPolicy::didCreateWindowProxy const):
1227         * page/csp/ContentSecurityPolicy.h:
1228
1229 2018-04-19  Dirk Schulze  <krit@webbkit.org>
1230
1231         Introduce SVGGeometryElement interface
1232         https://bugs.webkit.org/show_bug.cgi?id=184768
1233
1234         Reviewed by Antti Koivisto.
1235
1236         Start implementing SVGGeometryElement interface from SVG2.
1237         https://svgwg.org/svg2-draft/types.html#InterfaceSVGGeometryElement
1238
1239         Start with SVGPathElement only for now. Also, just inferface gets implemented
1240         by this patch. No new functionality like isPointInFill yet.
1241         Fix getPointAtLength and make it more restrictive. This follows the spec and
1242         all other implementations.
1243
1244         Added additional test scenarios to existing tests.
1245
1246         * CMakeLists.txt:
1247         * DerivedSources.make:
1248         * Sources.txt:
1249         * WebCore.xcodeproj/project.pbxproj:
1250         * bindings/scripts/CodeGeneratorJS.pm:
1251         (GetGnuVTableOffsetForType):
1252         * svg/SVGAllInOne.cpp:
1253         * svg/SVGGeometryElement.cpp: Added.
1254         (WebCore::SVGGeometryElement::SVGGeometryElement):
1255         (WebCore::SVGGeometryElement::isSupportedAttribute):
1256         (WebCore::SVGGeometryElement::parseAttribute):
1257         (WebCore::SVGGeometryElement::svgAttributeChanged):
1258         (WebCore::SVGGeometryElement::createElementRenderer):
1259         * svg/SVGGeometryElement.h: Added.
1260         * svg/SVGGeometryElement.idl: Added.
1261         * svg/SVGGradientElement.cpp:
1262         * svg/SVGPathElement.cpp:
1263         (WebCore::SVGPathElement::SVGPathElement):
1264         (WebCore::SVGPathElement::parseAttribute):
1265         (WebCore::SVGPathElement::svgAttributeChanged):
1266         (WebCore::SVGPathElement::insertedIntoAncestor):
1267         (WebCore::SVGPathElement::removedFromAncestor):
1268         * svg/SVGPathElement.h:
1269         * svg/SVGPathElement.idl:
1270
1271 2018-04-19  Tadeu Zagallo  <tzagallo@apple.com>
1272
1273         REGRESSION(r227340): ArrayBuffers were not being serialized when sent via MessagePorts
1274         https://bugs.webkit.org/show_bug.cgi?id=184254
1275         <rdar://problem/39140200>
1276
1277         Reviewed by Daniel Bates.
1278
1279         Add a new encoding method to SerializedScriptValue that includes ArrayBuffers.
1280
1281         Test: workers/message-port.html
1282
1283         * bindings/js/SerializedScriptValue.h:
1284         (WebCore::SerializedScriptValue::encode const):
1285         (WebCore::SerializedScriptValue::decode):
1286         * dom/messageports/MessageWithMessagePorts.h:
1287         (WebCore::MessageWithMessagePorts::encode const):
1288         (WebCore::MessageWithMessagePorts::decode):
1289
1290 2018-04-19  David Kilzer  <ddkilzer@apple.com>
1291
1292         Enable Objective-C weak references
1293         <https://webkit.org/b/184789>
1294         <rdar://problem/39571716>
1295
1296         Reviewed by Dan Bernstein.
1297
1298         * Configurations/Base.xcconfig:
1299         (CLANG_ENABLE_OBJC_WEAK): Enable.
1300
1301 2018-04-19  Antti Koivisto  <antti@apple.com>
1302
1303         Don't use RenderTreeBuilder::current() in RenderTreeUpdater
1304         https://bugs.webkit.org/show_bug.cgi?id=184794
1305
1306         Reviewed by Zalan Bujtas.
1307
1308         Pass the builder as a parameter where needed.
1309
1310         * rendering/updating/RenderTreeUpdater.cpp:
1311         (WebCore::RenderTreeUpdater::updateElementRenderer):
1312         (WebCore::RenderTreeUpdater::updateTextRenderer):
1313         (WebCore::RenderTreeUpdater::tearDownRenderers):
1314         (WebCore::RenderTreeUpdater::tearDownRenderer):
1315         (WebCore::RenderTreeUpdater::tearDownTextRenderer):
1316         (WebCore::RenderTreeUpdater::tearDownLeftoverPaginationRenderersIfNeeded):
1317         (WebCore::RenderTreeUpdater::tearDownLeftoverShadowHostChildren):
1318         * rendering/updating/RenderTreeUpdater.h:
1319         * rendering/updating/RenderTreeUpdaterGeneratedContent.cpp:
1320         (WebCore::RenderTreeUpdater::GeneratedContent::updatePseudoElement):
1321         (WebCore::RenderTreeUpdater::GeneratedContent::removeBeforePseudoElement):
1322         (WebCore::RenderTreeUpdater::GeneratedContent::removeAfterPseudoElement):
1323         * rendering/updating/RenderTreeUpdaterGeneratedContent.h:
1324
1325 2018-04-19  Eric Carlson  <eric.carlson@apple.com>
1326
1327         Runtime logging during GC can cause crash
1328         https://bugs.webkit.org/show_bug.cgi?id=184792
1329         <rdar://problem/39567927>
1330
1331         Reviewed by Jer Noble.
1332
1333         Test: media/destructor-logging-crash.html
1334
1335         * dom/Document.cpp:
1336         (WebCore::Document::~Document): Clear the logger observer immediately so anything logged
1337         as a side effect of the destructor won't cause a problem.
1338         (WebCore::Document::didLogMessage): Create the ConsoleMessage in a task.
1339         * dom/Document.h:
1340
1341 2018-04-19  Youenn Fablet  <youenn@apple.com>
1342
1343         Web Inspector backend should get headers & cookies from network process separately from resource requests
1344         https://bugs.webkit.org/show_bug.cgi?id=184396
1345         <rdar://problem/38877384>
1346
1347         Reviewed by Brian Burg.
1348
1349         Add two new loader strategies to get response and network metrics directly from
1350         NetworkProcess based on resource loader identifier.
1351         Use these methods in InspectorNetworkAgent when response/metrics might be filtered.
1352
1353         Covered by existing tests, in particular http/tests/inspector/network/fetch-network-data.html which would fail
1354         without this since we are now setting the sourceOrigin for NetworkResourceLoader, which is used to sanitize response headers.
1355
1356         * inspector/agents/InspectorNetworkAgent.cpp:
1357         (WebCore::InspectorNetworkAgent::didReceiveResponse):
1358         (WebCore::InspectorNetworkAgent::didFinishLoading):
1359         * loader/LoaderStrategy.cpp:
1360         (WebCore::LoaderStrategy::responseFromResourceLoaIdentifier):
1361         (WebCore::LoaderStrategy::networkMetricsFromResourceLoaIdentifier):
1362         * loader/LoaderStrategy.h:
1363
1364 2018-04-19  Wenson Hsieh  <wenson_hsieh@apple.com>
1365
1366         [Extra zoom mode] Add a mechanism to extend the height of the layout viewport in extra zoom mode
1367         https://bugs.webkit.org/show_bug.cgi?id=184782
1368         <rdar://problem/38346712>
1369
1370         Reviewed by Tim Horton.
1371
1372         Add a new helper on FrameView to compute an expanded layout viewport size, as well as a new setting for the
1373         height expansion factor when computing visual viewport dimensions. See WebKit/ChangeLog for more detail.
1374
1375         Test: fast/visual-viewport/extrazoom/layout-viewport-after-scrolling-and-resizing.html
1376
1377         * page/FrameView.cpp:
1378         (WebCore::FrameView::expandedLayoutViewportSize):
1379         * page/FrameView.h:
1380         * page/Settings.yaml:
1381
1382 2018-04-19  Chris Dumez  <cdumez@apple.com>
1383
1384         REGRESSION (r229133): decidePolicyForNavigationAction not called for loading an HTML string
1385         https://bugs.webkit.org/show_bug.cgi?id=184209
1386         <rdar://problem/39145306>
1387
1388         Reviewed by Ryosuke Niwa.
1389
1390         In r229133, we stopped doing navigation policy checks for about:blank because about:blank
1391         loads need to happen synchronously for Web-compatibility. However, this regressed loading
1392         an HTML string in a WebView because in such cases, the URL is also about:blank with
1393         substitute data.
1394
1395         In this patch, we take a more conservative approach and restore policy checking for
1396         'about:blank' but using synchronous IPC.
1397
1398         * loader/PolicyChecker.cpp:
1399         (WebCore::PolicyChecker::checkNavigationPolicy):
1400
1401 2018-04-19  Chris Nardi  <cnardi@chromium.org>
1402
1403         Support calc() in webkit-gradient and cross-fade
1404         https://bugs.webkit.org/show_bug.cgi?id=182225
1405
1406         Reviewed by Simon Fraser.
1407
1408         calc() was previously unsupported in webkit-gradient and webkit-cross-fade, but both should take calc() values.
1409         Update the code to support calc() values.
1410
1411         Tests: LayoutTests/css3/calc/cross-fade-calc.html
1412                LayoutTests/css3/calc/webkit-gradient-calc.html
1413
1414         * css/parser/CSSPropertyParserHelpers.cpp:
1415         (WebCore::CSSPropertyParserHelpers::consumeDeprecatedGradientColorStop):
1416         (WebCore::CSSPropertyParserHelpers::consumeCrossFade):
1417
1418 2018-04-17  Filip Pizlo  <fpizlo@apple.com>
1419
1420         The InternalFunction hierarchy should be in IsoSubspaces
1421         https://bugs.webkit.org/show_bug.cgi?id=184721
1422
1423         Reviewed by Saam Barati.
1424
1425         No new tests because no new behavior.
1426
1427         * bindings/js/WebCoreJSClientData.cpp:
1428         (WebCore::JSVMClientData::JSVMClientData):
1429         * bindings/js/WebCoreJSClientData.h:
1430         (WebCore::JSVMClientData::runtimeMethodSpace):
1431         * bridge/runtime_method.cpp:
1432         (JSC::RuntimeMethod::subspaceForImpl):
1433         * bridge/runtime_method.h:
1434
1435 2018-04-19  Brady Eidson  <beidson@apple.com>
1436
1437         Add globally-unique HistoryItem identifiers (and have WebKit2 adopt them).
1438         <rdar://problem/39533949> and https://bugs.webkit.org/show_bug.cgi?id=184750
1439
1440         Reviewed by Ryosuke Niwa.
1441
1442         No new tests (Refactor, no behavior change).
1443
1444         In WebCore, we:
1445         - Add a process-unique "BackForwardItemIdentifier"
1446         - Make all HistoryItems have such an identifier as a member
1447
1448         * WebCore.xcodeproj/project.pbxproj:
1449
1450         * history/BackForwardItemIdentifier.h: Added.
1451         (WebCore::BackForwardItemIdentifier::logString const):
1452         (WebCore::operator==):
1453         (WebCore::BackForwardItemIdentifier::encode const):
1454         (WebCore::BackForwardItemIdentifier::decode):
1455         (WebCore::BackForwardItemIdentifier::hash const):
1456         (WTF::BackForwardItemIdentifierHash::hash):
1457         (WTF::BackForwardItemIdentifierHash::equal):
1458         (WTF::HashTraits<WebCore::BackForwardItemIdentifier>::emptyValue):
1459         (WTF::HashTraits<WebCore::BackForwardItemIdentifier>::constructDeletedValue):
1460         (WTF::HashTraits<WebCore::BackForwardItemIdentifier>::isDeletedValue):
1461
1462         * history/HistoryItem.cpp:
1463         (WebCore::HistoryItem::generateSequenceNumber):
1464         (WebCore::HistoryItem::HistoryItem):
1465         (WebCore::generateSequenceNumber): Deleted.
1466
1467         * history/HistoryItem.h:
1468         (WebCore::HistoryItem::create):
1469         (WebCore::HistoryItem::identifier const):
1470
1471 2018-04-19  Nan Wang  <n_wang@apple.com>
1472
1473         AX: AOM: respect the accessibility setting for dispatching the accessible events
1474         https://bugs.webkit.org/show_bug.cgi?id=184619
1475
1476         Reviewed by Ryosuke Niwa.
1477
1478         Added accessibilityEventsEnabled as a setting on the page.
1479
1480         Test: accessibility/ios-simulator/accessibility-events-setting.html
1481
1482         * accessibility/AccessibilityObject.cpp:
1483         (WebCore::AccessibilityObject::shouldDispatchAccessibilityEvent const):
1484         * page/Settings.yaml:
1485         * testing/InternalSettings.cpp:
1486         (WebCore::InternalSettings::Backup::Backup):
1487         (WebCore::InternalSettings::Backup::restoreTo):
1488         (WebCore::InternalSettings::setAccessibilityEventsEnabled):
1489         * testing/InternalSettings.h:
1490         * testing/InternalSettings.idl:
1491
1492 2018-04-18  Jer Noble  <jer.noble@apple.com>
1493
1494         Fix build when WK_ALTERNATE_FRAMEWORKS_DIR is set to non-empty value
1495         https://bugs.webkit.org/show_bug.cgi?id=184693
1496         <rdar://problem/39491884>
1497
1498         Reviewed by Tim Horton.
1499
1500         * Configurations/WebCore.xcconfig:
1501
1502 2018-04-19  Eric Stobbart  <ericstobbart@gmail.com>
1503
1504         Change MediaSource WebCore to return NewObject for SourceBuffers
1505         https://bugs.webkit.org/show_bug.cgi?id=184642
1506
1507         Reviewed by Chris Dumez.
1508
1509         Minor change inline with IDL documentation
1510
1511         * Modules/mediasource/MediaSource.cpp:
1512         (WebCore::MediaSource::addSourceBuffer):
1513         (): Deleted.
1514         * Modules/mediasource/MediaSource.h:
1515         * Modules/mediasource/MediaSource.idl:
1516
1517 2018-04-19  Yusuke Suzuki  <utatane.tea@gmail.com>
1518
1519         Unreviewed, build fix for Ubuntu LTS GCC
1520         https://bugs.webkit.org/show_bug.cgi?id=184756
1521
1522         The variable name "windowProxy" (with auto&) conflicts with the function name "windowProxy".
1523
1524         * bindings/js/ScriptController.cpp:
1525         (WebCore::ScriptController::updateDocument):
1526         (WebCore::ScriptController::collectIsolatedContexts):
1527
1528 2018-04-19  Manuel Rego Casasnovas  <rego@igalia.com>
1529
1530         Caret rendered at incorrect location inside empty table cell
1531         https://bugs.webkit.org/show_bug.cgi?id=85385
1532
1533         Reviewed by Zalan Bujtas.
1534
1535         This is based on a previous patch by Shezan Baig <shezbaig.wk@gmail.com>.
1536
1537         This fixes the position of the caret in empty cells,
1538         that was painted lower than expected
1539         (and then modified when you start to edit the cell).
1540
1541         Ensures that editable table cells have at least one line when
1542         they are laid out. This ensures that the cell's intrinsic before/after
1543         padding is calculated correctly, which results in the caret location
1544         being calculated correctly.
1545
1546         Test: editing/caret/caret-in-empty-cell.html
1547
1548         * rendering/RenderTableCell.cpp:
1549         (WebCore::RenderTableCell::hasLineIfEmpty): Override method to consider
1550         that it has an an empty line if the table cell is editable.
1551         * rendering/RenderTableCell.h:
1552
1553 2018-04-18  Daniel Bates  <dabates@apple.com>
1554
1555         Cleanup TextControlInnerElements
1556         https://bugs.webkit.org/show_bug.cgi?id=184475
1557
1558         Reviewed by Antti Koivisto.
1559
1560         Clean up TextControlInnerElement::resolveCustomStyle(), move the implementation of
1561         TextControlPlaceholderElement::create() from the header to the cpp file, replace
1562         fancy comments to demarcate classes with MARK: so that they show up in Xcode's
1563         function menu.
1564
1565         * html/shadow/TextControlInnerElements.cpp:
1566         (WebCore::TextControlInnerElement::resolveCustomStyle):
1567         (WebCore::TextControlPlaceholderElement::TextControlPlaceholderElement):
1568         (WebCore::TextControlPlaceholderElement::create):
1569         * html/shadow/TextControlInnerElements.h:
1570
1571 2018-04-18  Chris Dumez  <cdumez@apple.com>
1572
1573         Rename WindowProxyController to WindowProxy
1574         https://bugs.webkit.org/show_bug.cgi?id=184756
1575
1576         Reviewed by Sam Weinig.
1577
1578         Rename WindowProxyController to WindowProxy for clarity. When the IDL uses WindowProxy, the implementation
1579         needed use WindowProxyController type, which was a bit confusing.
1580
1581         * Sources.txt:
1582         * WebCore.xcodeproj/project.pbxproj:
1583         * bindings/js/DOMWrapperWorld.cpp:
1584         (WebCore::DOMWrapperWorld::~DOMWrapperWorld):
1585         (WebCore::DOMWrapperWorld::clearWrappers):
1586         * bindings/js/DOMWrapperWorld.h:
1587         (WebCore::DOMWrapperWorld::didCreateWindowProxy):
1588         (WebCore::DOMWrapperWorld::didDestroyWindowProxy):
1589         * bindings/js/JSBindingsAllInOne.cpp:
1590         * bindings/js/JSDOMWindowBase.cpp:
1591         (WebCore::toJS):
1592         * bindings/js/JSDOMWindowProxy.cpp:
1593         (WebCore::toJS):
1594         (WebCore::toJSDOMWindowProxy):
1595         * bindings/js/JSDOMWindowProxy.h:
1596         (WebCore::toJS):
1597         (WebCore::toJSDOMWindowProxy):
1598         * bindings/js/ScriptCachedFrameData.cpp:
1599         (WebCore::ScriptCachedFrameData::ScriptCachedFrameData):
1600         (WebCore::ScriptCachedFrameData::restore):
1601         * bindings/js/ScriptController.cpp:
1602         (WebCore::ScriptController::evaluateInWorld):
1603         (WebCore::ScriptController::loadModuleScriptInWorld):
1604         (WebCore::ScriptController::linkAndEvaluateModuleScriptInWorld):
1605         (WebCore::ScriptController::evaluateModule):
1606         (WebCore::ScriptController::setupModuleScriptHandlers):
1607         (WebCore::ScriptController::windowProxy):
1608         (WebCore::ScriptController::enableEval):
1609         (WebCore::ScriptController::enableWebAssembly):
1610         (WebCore::ScriptController::disableEval):
1611         (WebCore::ScriptController::disableWebAssembly):
1612         (WebCore::ScriptController::updateDocument):
1613         (WebCore::ScriptController::collectIsolatedContexts):
1614         (WebCore::ScriptController::windowScriptNPObject):
1615         (WebCore::ScriptController::executeIfJavaScriptURL):
1616         * bindings/js/ScriptController.h:
1617         (WebCore::ScriptController::globalObject):
1618         * bindings/js/ScriptControllerMac.mm:
1619         (WebCore::ScriptController::windowScriptObject):
1620         * bindings/js/ScriptState.cpp:
1621         (WebCore::mainWorldExecState):
1622         * bindings/js/WindowProxy.cpp: Renamed from Source/WebCore/bindings/js/WindowProxyController.cpp.
1623         (WebCore::WindowProxy::WindowProxy):
1624         (WebCore::WindowProxy::~WindowProxy):
1625         (WebCore::WindowProxy::destroyJSWindowProxy):
1626         (WebCore::WindowProxy::createJSWindowProxy):
1627         (WebCore::WindowProxy::jsWindowProxiesAsVector const):
1628         (WebCore::WindowProxy::createJSWindowProxyWithInitializedScript):
1629         (WebCore::WindowProxy::clearJSWindowProxiesNotMatchingDOMWindow):
1630         (WebCore::WindowProxy::setDOMWindow):
1631         (WebCore::WindowProxy::attachDebugger):
1632         * bindings/js/WindowProxy.h: Renamed from Source/WebCore/bindings/js/WindowProxyController.h.
1633         (WebCore::WindowProxy::jsWindowProxies const):
1634         (WebCore::WindowProxy::releaseJSWindowProxies):
1635         (WebCore::WindowProxy::setJSWindowProxies):
1636         (WebCore::WindowProxy::jsWindowProxy):
1637         (WebCore::WindowProxy::existingJSWindowProxy const):
1638         (WebCore::WindowProxy::globalObject):
1639         * loader/FrameLoader.cpp:
1640         (WebCore::FrameLoader::clear):
1641         (WebCore::FrameLoader::dispatchDidClearWindowObjectInWorld):
1642         * page/AbstractFrame.cpp:
1643         (WebCore::AbstractFrame::AbstractFrame):
1644         * page/AbstractFrame.h:
1645         (WebCore::AbstractFrame::windowProxy):
1646         (WebCore::AbstractFrame::windowProxy const):
1647         * page/Page.cpp:
1648         (WebCore::Page::setDebugger):
1649         * page/RemoteDOMWindow.cpp:
1650         (WebCore::RemoteDOMWindow::self const):
1651         (WebCore::RemoteDOMWindow::top const):
1652         (WebCore::RemoteDOMWindow::opener const):
1653         (WebCore::RemoteDOMWindow::parent const):
1654         * page/RemoteDOMWindow.h:
1655
1656 2018-04-18  Chris Dumez  <cdumez@apple.com>
1657
1658         Set RemoteDOMWindow's initial opener
1659         https://bugs.webkit.org/show_bug.cgi?id=184716
1660
1661         Reviewed by Sam Weinig.
1662
1663         Add support for WindowProxy type in the IDL. The implementation should
1664         return a WindowProxyController and toJS() will take care of converting
1665         this into a JSValue via JSDOMWindowProxy.
1666
1667         No new tests, rebaselined existing test.
1668
1669         * WebCore.xcodeproj/project.pbxproj:
1670         * bindings/IDLTypes.h:
1671         * bindings/js/JSDOMConvertWindowProxy.h: Added.
1672         (WebCore::JSConverter<IDLWindowProxy>::convert):
1673         * bindings/js/JSDOMWindowBase.cpp:
1674         (WebCore::toJS):
1675         * bindings/js/JSDOMWindowBase.h:
1676         (WebCore::toJS):
1677         * bindings/js/JSDOMWindowProxy.cpp:
1678         (WebCore::toJS):
1679         (WebCore::toJSDOMWindowProxy):
1680         * bindings/js/JSDOMWindowProxy.h:
1681         (WebCore::toJS):
1682         (WebCore::toJSDOMWindowProxy):
1683         * bindings/js/JSRemoteDOMWindowBase.cpp:
1684         * bindings/js/JSRemoteDOMWindowBase.h:
1685         * bindings/scripts/CodeGenerator.pm:
1686         (IsBuiltinType):
1687         * bindings/scripts/CodeGeneratorJS.pm:
1688         (AddToIncludesForIDLType):
1689         (GetBaseIDLType):
1690         * page/RemoteDOMWindow.cpp:
1691         (WebCore::RemoteDOMWindow::self const):
1692         (WebCore::RemoteDOMWindow::top const):
1693         (WebCore::RemoteDOMWindow::opener const):
1694         (WebCore::RemoteDOMWindow::parent const):
1695         * page/RemoteDOMWindow.h:
1696         * page/RemoteDOMWindow.idl:
1697         * page/RemoteFrame.h:
1698
1699 2018-04-18  Dean Jackson  <dino@apple.com>
1700
1701         Detect system preview links
1702         https://bugs.webkit.org/show_bug.cgi?id=184753
1703         <rdar://problem/39500514>
1704
1705         Reviewed by Antoine Quint.
1706
1707         Detect a special type of link anchor, which we're calling System Previews.
1708         Ultimately this will allow WebKit to present such links in a special
1709         way.
1710
1711         A System Preview link is an <a> element, with a rel attribute that
1712         includes "system-preview". It has a single element child, which is
1713         either an <img> or a <picture>.
1714
1715         Test: system-preview/detection.html
1716
1717         * html/HTMLAnchorElement.cpp:
1718         (WebCore::HTMLAnchorElement::relList): Add braces.
1719         (WebCore::HTMLAnchorElement::isSystemPreviewLink const): New
1720         function.
1721         * html/HTMLAnchorElement.h:
1722
1723         * html/HTMLImageElement.cpp:
1724         (WebCore::HTMLImageElement::isSystemPreviewImage const): Ask the
1725         parent if it is a system preview link.
1726         * html/HTMLImageElement.h:
1727         * html/HTMLPictureElement.cpp:
1728         (WebCore::HTMLPictureElement::isSystemPreviewImage const): Ditto.
1729         * html/HTMLPictureElement.h:
1730
1731         * testing/Internals.cpp: Testing helpers.
1732         (WebCore::Internals::systemPreviewRelType):
1733         (WebCore::Internals::isSystemPreviewLink const):
1734         (WebCore::Internals::isSystemPreviewImage const):
1735         * testing/Internals.h:
1736         * testing/Internals.idl:
1737
1738 2018-04-18  Antti Koivisto  <antti@apple.com>
1739
1740         :active pseudo class doesn't deactivate when using pressure sensitive trackpad
1741         https://bugs.webkit.org/show_bug.cgi?id=181680
1742
1743         Reviewed by Beth Dakin.
1744
1745         Trackpad sends a mouse force event with force of zero after mouse up event. This causes the element under cursor
1746         activate again.
1747
1748         Even a fake event test doesn't appear to be currently possible as TestRunner crashes if you try to send mouseForceChanged.
1749         All the tests using it are skipped.
1750
1751         * page/EventHandler.cpp:
1752         (WebCore::EventHandler::handleMouseForceEvent):
1753
1754         Don't add HitTestRequest::Active if the force of the force event is zero.
1755
1756 2018-04-18  Megan Gardner  <megan_gardner@apple.com>
1757
1758         Ensure correct screen sizes
1759         https://bugs.webkit.org/show_bug.cgi?id=184757
1760         
1761         Reviewed by Wenson Hsieh.
1762         
1763         Make sure that the screen sizes are actually correct.
1764
1765         Not currently testable, will add tests when it is.
1766
1767         * platform/ios/PlatformScreenIOS.mm:
1768
1769 2018-04-18  Nan Wang  <n_wang@apple.com>
1770
1771         AX: [macOS] WebKit hangs when triggering an alert from an AOM increment event
1772         https://bugs.webkit.org/show_bug.cgi?id=184742
1773
1774         Reviewed by Chris Fleizach.
1775
1776         Made increment and decrement actions on the macOS to be async. So that VoiceOver
1777         won't hang indefinitely if performing the actions causes an alert or other modal
1778         behaviors.
1779
1780         Test: accessibility/mac/async-increment-decrement-action.html
1781
1782         * accessibility/mac/WebAccessibilityObjectWrapperMac.mm:
1783         (-[WebAccessibilityObjectWrapper accessibilityPerformIncrementAction]):
1784         (-[WebAccessibilityObjectWrapper _accessibilityPerformIncrementAction]):
1785         (-[WebAccessibilityObjectWrapper accessibilityPerformDecrementAction]):
1786         (-[WebAccessibilityObjectWrapper _accessibilityPerformDecrementAction]):
1787         (-[WebAccessibilityObjectWrapper accessibilityPerformAction:]):
1788
1789 2018-04-18  Youenn Fablet  <youenn@apple.com>
1790
1791         MediaResourceLoader should set its fetch destination
1792         https://bugs.webkit.org/show_bug.cgi?id=184746
1793
1794         Reviewed by Eric Carlson.
1795
1796         Covered by updated test.
1797
1798         * loader/MediaResourceLoader.cpp:
1799         (WebCore::MediaResourceLoader::requestResource):
1800
1801 2018-04-18  Jer Noble  <jer.noble@apple.com>
1802
1803         Fix runtime errors in simulator while playing media
1804         https://bugs.webkit.org/show_bug.cgi?id=184751
1805
1806         Reviewed by Eric Carlson.
1807
1808         AVURLAssetHTTPCookiesKey may not be present, and AVPlayer may not respond to certain methods.
1809
1810         * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
1811         (WebCore::MediaPlayerPrivateAVFoundationObjC::createAVAssetForURL):
1812         (WebCore::MediaPlayerPrivateAVFoundationObjC::createAVPlayer):
1813         (WebCore::MediaPlayerPrivateAVFoundationObjC::updateDisableExternalPlayback):
1814         (WebCore::MediaPlayerPrivateAVFoundationObjC::setShouldDisableSleep):
1815
1816 2018-04-18  Jer Noble  <jer.noble@apple.com>
1817
1818         Ignore ASSERT when setting AVAudioSessionCategory returns an error on simulator.
1819         https://bugs.webkit.org/show_bug.cgi?id=184698
1820
1821         Reviewed by Eric Carlson.
1822
1823         * platform/audio/ios/AudioSessionIOS.mm:
1824         * platform/audio/mac/AudioSessionMac.cpp:
1825
1826 2018-04-18  Sihui Liu  <sihui_liu@apple.com>
1827
1828         REGRESSION: Using the reload button while offline pushes identical pages onto the back/forward list
1829         https://bugs.webkit.org/show_bug.cgi?id=184570
1830         <rdar://problem/34807323>
1831
1832         Reviewed by Chris Dumez.
1833
1834         Set FrameLoadType properly when error occurs in reload.
1835
1836         tests: Tools/TestWebKitAPI/Tests/WebKitCocoa/LoadAlternateHTMLString.mm
1837
1838         * loader/FrameLoader.cpp:
1839         (WebCore::FrameLoader::load):
1840
1841 2018-04-18  Chris Dumez  <cdumez@apple.com>
1842
1843         Add support for converting a local window to a remote window
1844         https://bugs.webkit.org/show_bug.cgi?id=184515
1845         <rdar://problem/39011318>
1846
1847         Reviewed by Ryosuke Niwa.
1848
1849         Add initial support for process-swapping when navigating cross-origin as a result
1850         of a window.open(). The window object returned by window.open() is initially same
1851         origin and is for about:blank. The navigation cross-origin then happens and the
1852         JS wrappers for the window then point to a cross-origin window which is remote (i.e.
1853         hosted in another WebProcess).
1854
1855         The RemoteDOMWindow exposed to JS looks like a regular cross-origin Window with a few
1856         exceptions due to our incomplete implementation (e.g. w.location returns null) and 
1857         most of its API is currently not functional. The RemoteDOMWindow API will be implemented
1858         in a follow-up by relying on IPC.
1859
1860         Test: http/tests/navigation/process-swap-window-open.html
1861
1862         * bindings/js/JSDOMGlobalObject.cpp:
1863         (WebCore::JSDOMGlobalObject::scriptExecutionContext const):
1864         * bindings/js/JSDOMPromiseDeferred.h:
1865         * bindings/js/JSDOMWindowProperties.cpp:
1866         (WebCore::JSDOMWindowProperties::getOwnPropertySlot):
1867         * bindings/js/JSDOMWindowProxy.cpp:
1868         (WebCore::JSDOMWindowProxy::finishCreation):
1869         (WebCore::JSDOMWindowProxy::create):
1870         * bindings/js/JSDOMWindowProxy.h:
1871         * bindings/js/JSDOMWrapper.cpp:
1872         (WebCore::JSDOMObject::JSDOMObject):
1873         * bindings/js/JSDOMWrapper.h:
1874         * bindings/js/WindowProxyController.cpp:
1875         (WebCore::WindowProxyController::createWindowProxy):
1876         (WebCore::WindowProxyController::setDOMWindowForWindowProxy):
1877         * bridge/objc/WebScriptObject.mm:
1878         (-[WebScriptObject _isSafeScript]):
1879         Teach more of our bindings code about RemoteDOMWindows.
1880
1881         * dom/Document.cpp:
1882         (WebCore::Document::createDOMWindow):
1883         * loader/FrameLoaderClient.h:
1884         Add FrameLoaderClient function to notify the client when a DOMWindow is constructed in
1885         the frame. This is needed for WebKit2 to link the old window to its new representation
1886         in the new WebProcess.
1887
1888 2018-04-17  Zan Dobersek  <zdobersek@igalia.com>
1889
1890         [CMake] Add and enable the ENABLE_CSS_ANIMATIONS_LEVEL_2 feature define
1891         https://bugs.webkit.org/show_bug.cgi?id=184681
1892
1893         Reviewed by Carlos Garcia Campos.
1894
1895         * Sources.txt: Include CSSAnimationTriggerScrollValue.cpp in the build.
1896         * WebCore.xcodeproj/project.pbxproj: Remove CSSAnimationTriggerScrollValue.cpp
1897         build target now that it's built via Sources.txt.
1898
1899 2018-04-17  Zan Dobersek  <zdobersek@igalia.com>
1900
1901         [CoordGraphics] CoordinatedImageBacking can simplify image drawing
1902         https://bugs.webkit.org/show_bug.cgi?id=183986
1903
1904         Reviewed by Michael Catanzaro.
1905
1906         In CoordinatedImageBacking::update(), when drawing the image into a
1907         freshly-created image backing, we can avoid save-and-restoring the
1908         painting context. We also don't have to clip it, since the clipping area
1909         is the same as the image (and buffer) bounds. Since the buffer is
1910         initialized to transparent color, we can use the CompositeCopy operator
1911         to just copy image data into the destination since there's nothing to
1912         paint the source over.
1913
1914         No new tests -- no change in functionality.
1915
1916         * platform/graphics/texmap/coordinated/CoordinatedImageBacking.cpp:
1917         (WebCore::CoordinatedImageBacking::update):
1918
1919 2018-04-17  Michael Catanzaro  <mcatanzaro@igalia.com>
1920
1921         [GTK] Webkit should spoof as Safari on a Mac for Outlook.com
1922         https://bugs.webkit.org/show_bug.cgi?id=184573
1923
1924         Reviewed by Carlos Alberto Lopez Perez.
1925
1926         Add quirk for outlook.live.com.
1927
1928         * platform/UserAgentQuirks.cpp:
1929         (WebCore::urlRequiresMacintoshPlatform):
1930
1931 2018-04-17  Mark Lam  <mark.lam@apple.com>
1932
1933         Templatize CodePtr/Refs/FunctionPtrs with PtrTags.
1934         https://bugs.webkit.org/show_bug.cgi?id=184702
1935         <rdar://problem/35391681>
1936
1937         Reviewed by Filip Pizlo and Saam Barati.
1938
1939         No new tests. This is covered by existing tests.
1940
1941         * WebCore.xcodeproj/project.pbxproj:
1942         * css/ElementRuleCollector.cpp:
1943         (WebCore::ElementRuleCollector::ruleMatches):
1944         * cssjit/CSSPtrTag.h: Added.
1945         * cssjit/CompiledSelector.h:
1946         * cssjit/FunctionCall.h:
1947         (WebCore::FunctionCall::FunctionCall):
1948         (WebCore::FunctionCall::setFunctionAddress):
1949         (WebCore::FunctionCall::prepareAndCall):
1950         * cssjit/SelectorCompiler.cpp:
1951         (WebCore::SelectorCompiler::compileSelector):
1952         (WebCore::SelectorCompiler::SelectorFragment::appendUnoptimizedPseudoClassWithContext):
1953         (WebCore::SelectorCompiler::addPseudoClassType):
1954         (WebCore::SelectorCompiler::SelectorCodeGenerator::compile):
1955         (WebCore::SelectorCompiler::SelectorCodeGenerator::generateElementAttributeFunctionCallValueMatching):
1956         (WebCore::SelectorCompiler::SelectorCodeGenerator::generateElementFunctionCallTest):
1957         (WebCore::SelectorCompiler::SelectorCodeGenerator::generateContextFunctionCallTest):
1958         * cssjit/SelectorCompiler.h:
1959         (WebCore::SelectorCompiler::ruleCollectorSimpleSelectorCheckerFunction):
1960         (WebCore::SelectorCompiler::querySelectorSimpleSelectorCheckerFunction):
1961         (WebCore::SelectorCompiler::ruleCollectorSelectorCheckerFunctionWithCheckingContext):
1962         (WebCore::SelectorCompiler::querySelectorSelectorCheckerFunctionWithCheckingContext):
1963         * dom/SelectorQuery.cpp:
1964         (WebCore::SelectorDataList::executeCompiledSingleMultiSelectorData const):
1965         (WebCore::SelectorDataList::execute const):
1966         * dom/SelectorQuery.h:
1967
1968 2018-04-17  Tadeu Zagallo  <tzagallo@apple.com>
1969
1970         Retain MessagePortChannel for transfer when disentangling ports
1971         https://bugs.webkit.org/show_bug.cgi?id=184502
1972         <rdar://problem/39372771>
1973
1974         Reviewed by Geoffrey Garen.
1975
1976         MessagePortChannels should be retained while ports are being transferred, but that was only
1977         happening when sending a port through another port, but not when sending it through a worker.
1978
1979         Test: workers/worker-to-worker.html
1980
1981         * dom/messageports/MessagePortChannel.cpp:
1982         (WebCore::MessagePortChannel::entanglePortWithProcess):
1983         (WebCore::MessagePortChannel::disentanglePort):
1984         (WebCore::MessagePortChannel::postMessageToRemote):
1985         (WebCore::MessagePortChannel::takeAllMessagesForPort):
1986
1987 2018-04-17  Tadeu Zagallo  <tzagallo@apple.com>
1988
1989         References from CSSStyleDeclaration to CSSValues should be weak
1990         https://bugs.webkit.org/show_bug.cgi?id=180280
1991         <rdar://problem/35804869>
1992
1993         Reviewed by Geoffrey Garen.
1994
1995         No new tests - used the existing test to verify the leak
1996
1997         * css/DeprecatedCSSOMValue.h:
1998         (WebCore::DeprecatedCSSOMValue::weakPtrFactory):
1999         * css/PropertySetCSSStyleDeclaration.cpp:
2000         (WebCore::PropertySetCSSStyleDeclaration::wrapForDeprecatedCSSOM):
2001         * css/PropertySetCSSStyleDeclaration.h:
2002
2003 2018-04-17  Jonathan Bedard  <jbedard@apple.com>
2004
2005         Unreviewed rollout of r230632. Regression in memory usage.
2006
2007         That bug tracked in https://bugs.webkit.org/show_bug.cgi?id=184569.
2008
2009         Tests: animations/animation-internals-api-multiple-keyframes.html
2010                animations/animation-internals-api.html
2011                transitions/transition-drt-api-delay.html
2012                transitions/transition-drt-api.html
2013
2014         * page/RuntimeEnabledFeatures.h:
2015         * testing/Internals.cpp:
2016         (WebCore::Internals::pseudoElement): Deleted.
2017         * testing/Internals.h:
2018         * testing/Internals.idl:
2019
2020 2018-04-17  Tadeu Zagallo  <tzagallo@apple.com>
2021
2022         Do not unregister MessagePorts on deallocation if it has been disentangled
2023         https://bugs.webkit.org/show_bug.cgi?id=184285
2024         <rdar://problem/39256714>
2025
2026         Reviewed by Darin Adler.
2027
2028         Test: workers/message-port-gc.html
2029
2030         * dom/MessagePort.cpp:
2031         (WebCore::MessagePort::deref const):
2032
2033 2018-04-17  Basuke Suzuki  <Basuke.Suzuki@sony.com>
2034
2035         [Curl] Fix timing of reporting error to the client
2036         https://bugs.webkit.org/show_bug.cgi?id=184707
2037
2038         Before checking the result code, check the status of callback invocation and
2039         do the right thing.
2040
2041         Reviewed by Youenn Fablet.
2042
2043         No new tests because there's no new behavior.
2044
2045         * platform/network/curl/CurlRequest.cpp:
2046         (WebCore::CurlRequest::didCompleteTransfer):
2047         * platform/network/curl/CurlRequest.h:
2048         (WebCore::CurlRequest::needToInvokeDidReceiveResponse const):
2049
2050 2018-04-17  Basuke Suzuki  <Basuke.Suzuki@sony.com>
2051
2052         [Curl] Export authentication information to be used by the client.
2053         https://bugs.webkit.org/show_bug.cgi?id=184709
2054
2055         Just added getters for username and password member variables.
2056
2057         Reviewed by Alex Christensen.
2058
2059         No new tests because there's no new behavior.
2060
2061         * platform/network/curl/CurlRequest.h:
2062         (WebCore::CurlRequest::user const):
2063         (WebCore::CurlRequest::password const):
2064
2065 2018-04-17  Chris Dumez  <cdumez@apple.com>
2066
2067         REGRESSION (r229831): CMD-clicking an iCloud web app link unexpectedly opens that link in a new tab and the current tab
2068         https://bugs.webkit.org/show_bug.cgi?id=184678
2069         <rdar://problem/39422122>
2070
2071         Reviewed by Alex Christensen.
2072
2073         Frament navigations need to happen synchronously for Web-compatibility. Because of this,
2074         r225657 added code to make sure that if the client does not make the navigation policy
2075         decision synchronously for frament navigations, then we'll stop waiting for the client
2076         and proceed with the navigation. However, r229831 make the navigation policy decision
2077         IPC decision, meaning that even if the client responds synchronously, it would be
2078         asynchronously from WebCore's point of view. As a result, we would always ignore the
2079         client's policy decision when doing a fragment navigation.
2080
2081         This is an issue on iclould.com because the web-app links are fragment URLs. When you
2082         CMD+click one of these link, we do the navigation policy check. As a result of this
2083         check, Safari responds IGNORE to the policy decision and instead decides to load the
2084         link in a new tab (because CMD key is pressed). Due to the bug mentioned above, we
2085         would not obey the IGNORE policy decision from Safari and load the link in the current
2086         tab, even though Safari would already be loading it in a new tab.
2087
2088         To address the issue, I reintroduced a synchronous code path for navigation policy
2089         decision making, backed by synchronous IPC. This synchronous code path is now used for
2090         fragment navigations to restore pre-r229831 behavior. If the client does not answer
2091         synchronously, we'll proceed with the navigation anyway, as was happening pre-r229831.
2092
2093         Test: http/tests/navigation/fragment-navigation-policy-ignore.html
2094
2095         * loader/EmptyClients.cpp:
2096         (WebCore::EmptyFrameLoaderClient::dispatchDecidePolicyForNavigationAction):
2097         * loader/EmptyFrameLoaderClient.h:
2098         * loader/FrameLoader.cpp:
2099         (WebCore::FrameLoader::loadURL):
2100         (WebCore::FrameLoader::loadWithDocumentLoader):
2101         * loader/FrameLoaderClient.h:
2102         * loader/PolicyChecker.cpp:
2103         (WebCore::PolicyChecker::checkNavigationPolicy):
2104         * loader/PolicyChecker.h:
2105
2106 2018-04-17  Matt Lewis  <jlewis3@apple.com>
2107
2108         Unreviewed, rolling out r230713.
2109
2110         This caused internal build failures.
2111
2112         Reverted changeset:
2113
2114         "Implement checked cast for DDResultRef once
2115         DDResultGetTypeID() is available"
2116         https://bugs.webkit.org/show_bug.cgi?id=184554
2117         https://trac.webkit.org/changeset/230713
2118
2119 2018-04-17  Chris Dumez  <cdumez@apple.com>
2120
2121         Add bindings code for RemoteDOMWindow
2122         https://bugs.webkit.org/show_bug.cgi?id=184653
2123
2124         Reviewed by Ryosuke Niwa.
2125
2126         Add bindings code for RemoteDOMWindow. A RemoteDOMWindow behaves exactly like a cross-origin
2127         DOMWindow, which is backed by a RemoteDOMWindow object instead of a DOMWindow one. Since
2128         a RemoteDOMWindow is always cross origin, we do not need cross-origin checks and the bindings
2129         code is identical to the DOMWindow code paths from cross-origin handling.
2130
2131         No new tests, this code will be used and tested via Bug 184515.
2132
2133         * CMakeLists.txt:
2134         * DerivedSources.make:
2135         * Sources.txt:
2136         * WebCore.xcodeproj/project.pbxproj:
2137         * bindings/js/JSBindingsAllInOne.cpp:
2138         * bindings/js/JSDOMWindowCustom.cpp:
2139         (WebCore::jsDOMWindowGetOwnPropertySlotRestrictedAccess):
2140         (WebCore::JSDOMWindow::getOwnPropertySlot):
2141         (WebCore::JSDOMWindow::getOwnPropertySlotByIndex):
2142         (WebCore::addCrossOriginWindowOwnPropertyNames):
2143         * bindings/js/JSDOMWindowCustom.h:
2144
2145         * bindings/js/JSRemoteDOMWindowBase.cpp: Added.
2146         (WebCore::JSRemoteDOMWindowBase::JSRemoteDOMWindowBase):
2147         (WebCore::JSRemoteDOMWindowBase::destroy):
2148         (WebCore::JSRemoteDOMWindowBase::javaScriptRuntimeFlags):
2149         (WebCore::toJS):
2150         (WebCore::toJSRemoteDOMWindow):
2151         * bindings/js/JSRemoteDOMWindowBase.h: Added.
2152         JSRemoteDOMWindow unfortunately currently needs to be a global object because of:
2153         1. a JSProxy's target needs to be a JSGlobalObject currently
2154         2. The 'structure()->setGlobalObject(vm, &window);' call in
2155            JSDOMWindowProxy::setWindow(VM&, JSDOMGlobalObject&) which requires a JSGlobalObject.
2156         Ideally, this wouldn't be the case in the future but this would require some code refactoring.
2157         Our DOM global objects normally subclass JSDOMGlobalObject so I decided to subclass JSDOMGlobalObject,
2158         which brings some things our bindings code expect. However, subclassing JSDOMGlobalObject directly is
2159         problematic because it does not hold the m_wrapped implementation pointer. To address this issue, all
2160         our our DOM global objects have a JS*Base base class which subclasses JSDOMGlobalObject and stores the
2161         m_wrapped implementation pointer. I followed the same pattern here.
2162
2163         (WebCore::toJS):
2164         * bindings/js/JSRemoteDOMWindowCustom.cpp: Added.
2165         (WebCore::JSRemoteDOMWindow::getOwnPropertySlot):
2166         (WebCore::JSRemoteDOMWindow::getOwnPropertySlotByIndex):
2167         (WebCore::JSRemoteDOMWindow::put):
2168         (WebCore::JSRemoteDOMWindow::putByIndex):
2169         (WebCore::JSRemoteDOMWindow::deleteProperty):
2170         (WebCore::JSRemoteDOMWindow::deletePropertyByIndex):
2171         (WebCore::JSRemoteDOMWindow::getOwnPropertyNames):
2172         (WebCore::JSRemoteDOMWindow::defineOwnProperty):
2173         (WebCore::JSRemoteDOMWindow::getPrototype):
2174         (WebCore::JSRemoteDOMWindow::preventExtensions):
2175         (WebCore::JSRemoteDOMWindow::toStringName):
2176         * bindings/scripts/CodeGeneratorJS.pm:
2177         (IsDOMGlobalObject):
2178         (GenerateHeader):
2179         (GenerateOverloadDispatcher):
2180         (GenerateImplementation):
2181         * page/RemoteDOMWindow.idl: Added.
2182
2183 2018-04-17  David Kilzer  <ddkilzer@apple.com>
2184
2185         Implement checked cast for DDResultRef once DDResultGetTypeID() is available
2186         <https://webkit.org/b/184554>
2187         <rdar://problem/36241894>
2188
2189         Reviewed by Brent Fulgham.
2190
2191         * editing/cocoa/DataDetection.mm:
2192         (WebCore::detectItemAtPositionWithRange): Implement checked cast
2193         for DDResultRef.
2194
2195 2018-04-17  Said Abou-Hallawa  <sabouhallawa@apple.com>
2196
2197         Animated GIF imagery with finite looping are falling one loop short
2198         https://bugs.webkit.org/show_bug.cgi?id=183153
2199
2200         Reviewed by Simon Fraser.
2201
2202         The Netscape Looping Application Extension is a block which may be added
2203         to a GIF file to tell the viewer to loop through the entire GIF frames.
2204         This is communicated through two bytes designated for the "loopCount" in
2205         this block.
2206
2207         The entire block may not be found in the GIF, in which case the GIF is 
2208         supposed to animate its entire frames only once.
2209
2210         If the block exists and loopCount = 0, this means the image has to loop
2211         through its frames indefinitely.
2212
2213         If the block exist and loopCount > 0, this should mean the image has to
2214         loop through its frames loopCount + 1 times. The extra loop seems to be
2215         the consensus among most of the GIF generators and viewers. For example,
2216         if the image designer wants the image to loop through its frames n times:
2217         -- The GIF generator (e.g. Adobe Photoshop and https://ezgif.com/maker) 
2218            will write n - 1 for loopCount. However http://gifmaker.me and 
2219            http://gifmaker.org write n for loopCount.
2220         -- The browser (e.g. Chrome 65.0.3325 181 and FireFox Quantum 59.0.2) will
2221            translate loopCount = n - 1 to: animate GIF once + loop n - 1, which 
2222            means loop the GIF n times.
2223
2224         Because the specs are not really clear about this, we are going to consider
2225         the agreed-upon behavior among most of the web browsers the specs here.
2226
2227         * platform/graphics/cg/ImageDecoderCG.cpp:
2228         (WebCore::ImageDecoderCG::repetitionCount const):
2229         * platform/image-decoders/gif/GIFImageDecoder.cpp:
2230         (WebCore::GIFImageDecoder::repetitionCount const):
2231
2232 2018-04-17  Saam Barati  <sbarati@apple.com>
2233
2234         Add system trace points for process launch and for initializeWebProcess
2235         https://bugs.webkit.org/show_bug.cgi?id=184669
2236
2237         Reviewed by Simon Fraser.
2238
2239         No testing needed because there is no new functionality here.
2240
2241         * loader/FrameLoader.cpp:
2242         (WebCore::FrameLoader::provisionalLoadStarted):
2243         (WebCore::FrameLoader::checkLoadCompleteForThisFrame):
2244         * loader/SubresourceLoader.cpp:
2245         (WebCore::SubresourceLoader::willSendRequestInternal):
2246         (WebCore::SubresourceLoader::didFinishLoading):
2247         (WebCore::SubresourceLoader::didFail):
2248         (WebCore::SubresourceLoader::didCancel):
2249
2250 2018-04-17  Eric Carlson  <eric.carlson@apple.com>
2251
2252         [iOS] AirPlay device name is sometimes wrong
2253         https://bugs.webkit.org/show_bug.cgi?id=184543
2254         <rdar://problem/39105498>
2255
2256         Reviewed by Jer Noble.
2257
2258         No new tests, this can only be tested with a specific hardware setup.
2259
2260         * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
2261         (WebCore::exernalDeviceDisplayNameForPlayer): Get the device name from the AVOutputContext
2262         when possible.
2263
2264 2018-04-17  Carlos Alberto Lopez Perez  <clopez@igalia.com>
2265
2266         [GTK] Build fix after r230529 (WaylandCompositorDisplay leaks its wl_display)
2267         https://bugs.webkit.org/show_bug.cgi?id=184406
2268
2269         Rubber-stamped by Michael Catanzaro.
2270
2271         Fix build with clang 3.8
2272
2273         No new tests, it is a build fix.
2274
2275         * platform/graphics/wayland/PlatformDisplayWayland.cpp:
2276         (WebCore::PlatformDisplayWayland::create):
2277
2278 2018-04-16  Antoine Quint  <graouts@apple.com>
2279
2280         Layout Test animations/needs-layout.html is a flaky Image Failure.
2281         https://bugs.webkit.org/show_bug.cgi?id=172397
2282
2283         Reviewed by Dean Jackson.
2284
2285         Animations that animate a transform and uses a relative value for either the x or y components
2286         require a layout before starting, which CSSAnimationController would perform in the call to
2287         CSSAnimationControllerPrivate::animationTimerFired() made immediately after a CSS animation was
2288         created.
2289
2290         We now perform a similar task where upon setting new blending keyframes we compute a flag indicating
2291         if the keyframe effect is animating a transform with relative x or y components. Then, when we perform
2292         the first invalidation task, which runs in the next run loop after a change to the timing model has
2293         been made, such as a call to play() on a CSSAnimation made in the TreeResolver::createAnimatedElementUpdate()
2294         where the CSSAnimation was created, we call forceLayout() on this element's FrameView. We also ensure
2295         we commit animations on the compositor immediately after that too, instead of waiting until the next
2296         DisplayRefreshMonitor callback.
2297
2298         * animation/DocumentTimeline.cpp:
2299         (WebCore::DocumentTimeline::performInvalidationTask):
2300         (WebCore::DocumentTimeline::updateAnimations):
2301         * animation/KeyframeEffectReadOnly.cpp:
2302         (WebCore::KeyframeEffectReadOnly::forceLayoutIfNeeded):
2303         (WebCore::KeyframeEffectReadOnly::setBlendingKeyframes):
2304         (WebCore::KeyframeEffectReadOnly::computedNeedsForcedLayout):
2305         (WebCore::KeyframeEffectReadOnly::applyPendingAcceleratedActions):
2306         * animation/KeyframeEffectReadOnly.h:
2307
2308 2018-04-16  Pablo Saavedra  <psaavedra@igalia.com>
2309
2310         Inconsistent EGL defines in ImageBufferCairo
2311         https://bugs.webkit.org/show_bug.cgi?id=184661
2312
2313         Reviewed by Žan Doberšek.
2314
2315         On revision r219391 libepoxy is added. The headers in
2316         ImageBufferCairo.cpp become inconsistent when 2D canvas is enabled
2317         (-DENABLE_ACCELERATED_2D_CANVAS=ON) due to a redefinition error during
2318         the Webkit build:
2319
2320             ...
2321             /usr/include/GLES2/gl2.h:503:82: error: 'voi
2322             epoxy_glAttachShader(GLuint, GLuint)' redeclared as different kind
2323             of symbol
2324             GL_APICALL void         GL_APIENTRY glAttachShader (GLuint
2325             program, GLuint shader);
2326
2327         No new tests.
2328
2329         * platform/graphics/cairo/ImageBufferCairo.cpp:
2330
2331 2018-04-16  Filip Pizlo  <fpizlo@apple.com>
2332
2333         MutationObserver should be in an IsoHeap
2334         https://bugs.webkit.org/show_bug.cgi?id=184671
2335         <rdar://problem/36081981>
2336
2337         Reviewed by Sam Weinig.
2338
2339         No new tests because no new behavior.
2340
2341         * dom/MutationObserver.cpp:
2342         * dom/MutationObserver.h:
2343
2344 2018-04-16  Youenn Fablet  <youenn@apple.com>
2345
2346         Use NetworkLoadChecker to handle synchronous HTTP loads
2347         https://bugs.webkit.org/show_bug.cgi?id=184240
2348
2349         Reviewed by Chris Dumez.
2350
2351         Update LoaderStrategy::loadResourceSynchronously to pass FetchOptions directly.
2352         Update various call sites accordingly. This allows NetworkProcess to do all necessary checks.
2353         Add an option to disable security checks if NetworkProcess does it for WebProcess.
2354         This option will be also used for regular asynchronous loads in future patches.
2355
2356         Update DocumentThreadableLoader to bypass preflighting and response validation checks in case they are done in NetworkProcess.
2357
2358         Covered by existing and rebased tests.
2359
2360         * loader/CrossOriginPreflightChecker.cpp:
2361         (WebCore::CrossOriginPreflightChecker::doPreflight):
2362         * loader/DocumentThreadableLoader.cpp:
2363         (WebCore::DocumentThreadableLoader::DocumentThreadableLoader):
2364         (WebCore::DocumentThreadableLoader::loadRequest):
2365         * loader/FrameLoader.cpp:
2366         (WebCore::FrameLoader::loadResourceSynchronously):
2367         * loader/FrameLoader.h:
2368         * loader/LoaderStrategy.h:
2369         * xml/XSLTProcessorLibxslt.cpp:
2370         (WebCore::docLoaderFunc):
2371         * xml/parser/XMLDocumentParserLibxml2.cpp:
2372         (WebCore::openFunc):
2373
2374 2018-04-16  Christopher Reid  <chris.reid@sony.com>
2375
2376         [WinCairo] Media elements should be enabled by default
2377         https://bugs.webkit.org/show_bug.cgi?id=184597
2378
2379         Reviewed by Per Arne Vollan.
2380
2381         Enabling media elements by default with media foundation.
2382
2383         * page/SettingsDefaultValues.h:
2384
2385 2018-04-16  Christopher Reid  <chris.reid@sony.com>
2386
2387         [Curl] Add the Accept-Language field to curl request headers
2388         https://bugs.webkit.org/show_bug.cgi?id=184605
2389
2390         Reviewed by Alex Christensen.
2391
2392         Add Accept-Language field to curl request headers
2393
2394         * platform/network/curl/CurlRequest.cpp:
2395         * platform/network/curl/CurlRequest.h:
2396
2397 2018-04-16  Chris Dumez  <cdumez@apple.com>
2398
2399         Move more WindowProxy-related logic from ScriptController to WindowProxyController
2400         https://bugs.webkit.org/show_bug.cgi?id=184640
2401
2402         Reviewed by Ryosuke Niwa.
2403
2404         Move more WindowProxy-related logic from ScriptController to WindowProxyController,
2405         for clarity.
2406
2407         * bindings/js/JSDOMWindowProxy.cpp:
2408         (WebCore::JSDOMWindowProxy::attachDebugger):
2409         * bindings/js/JSDOMWindowProxy.h:
2410         * bindings/js/ScriptCachedFrameData.cpp:
2411         (WebCore::ScriptCachedFrameData::ScriptCachedFrameData):
2412         (WebCore::ScriptCachedFrameData::restore):
2413         * bindings/js/ScriptController.cpp:
2414         (WebCore::ScriptController::~ScriptController):
2415         (WebCore::ScriptController::initScriptForWindowProxy):
2416         * bindings/js/ScriptController.h:
2417         (WebCore::ScriptController::existingCacheableBindingRootObject const):
2418         * bindings/js/WindowProxyController.cpp:
2419         (WebCore::collectGarbageAfterWindowProxyDestruction):
2420         (WebCore::WindowProxyController::~WindowProxyController):
2421         (WebCore::WindowProxyController::clearWindowProxiesNotMatchingDOMWindow):
2422         (WebCore::WindowProxyController::setDOMWindowForWindowProxy):
2423         (WebCore::WindowProxyController::attachDebugger):
2424         * bindings/js/WindowProxyController.h:
2425         * loader/FrameLoader.cpp:
2426         (WebCore::FrameLoader::clear):
2427         * page/Page.cpp:
2428         (WebCore::Page::setDebugger):
2429
2430 2018-04-16  Thibault Saunier  <tsaunier@igalia.com>
2431
2432         [GStreamer] Set *TrackPrivateGStreamer::active based on GstStream default select in constructor
2433         https://bugs.webkit.org/show_bug.cgi?id=184652
2434
2435         Reviewed by Philippe Normand.
2436
2437         In the constructor we should mark selected streams based on the default values from GstStream,
2438         if the user changes them, they will be updated as required later on.
2439
2440         No new tests are added as we already have a few ones that are currently disabled in
2441         the mediastream testsuite. This patch is part of the work to enable them.
2442
2443         * platform/graphics/gstreamer/AudioTrackPrivateGStreamer.cpp:
2444         (WebCore::AudioTrackPrivateGStreamer::AudioTrackPrivateGStreamer):
2445         * platform/graphics/gstreamer/VideoTrackPrivateGStreamer.cpp:
2446         (WebCore::VideoTrackPrivateGStreamer::VideoTrackPrivateGStreamer):
2447
2448 2018-04-16  Thibault Saunier  <tsaunier@igalia.com>
2449
2450         [GStreamer] Set TrackPrivateBaseGStreamer metadata information even if no client is avalaible
2451         https://bugs.webkit.org/show_bug.cgi?id=184651
2452
2453         Reviewed by Philippe Normand.
2454
2455         We can't notify the client if none is connected, but still we need to fill our metadatas from
2456         the provided GstTagList, especially in the case of playbin3 where the client is not set yet
2457         at construct time but the metadata might already be preset (and won't be updated later on).
2458
2459         No new tests are added as we already have a few ones that are currently disabled in
2460         the mediastream testsuite. This patch is part of the work to enable them.
2461
2462         * platform/graphics/gstreamer/TrackPrivateBaseGStreamer.cpp:
2463         (WebCore::TrackPrivateBaseGStreamer::notifyTrackOfTagsChanged):
2464
2465 2018-04-16  Antoine Quint  <graouts@apple.com>
2466
2467         [Web Animations] Ensure we never return -0 through the API
2468         https://bugs.webkit.org/show_bug.cgi?id=184644
2469
2470         Reviewed by Dean Jackson.
2471
2472         We could sometimes return -0 instead of 0, which is surprising and leads to an error in WPT tests.
2473         This would happen when playbackRate < 0.
2474
2475         * animation/WebAnimationUtilities.h:
2476         (WebCore::secondsToWebAnimationsAPITime):
2477
2478 2018-04-15  Antoine Quint  <graouts@apple.com>
2479
2480         [Web Animations] Animations do not naturally get a finish event
2481         https://bugs.webkit.org/show_bug.cgi?id=184639
2482         <rdar://problem/39397649>
2483
2484         Reviewed by Jon Lee.
2485
2486         We must call updateFinishedState() when an animation gets sampled as it means its timeline's time has progressed
2487         and it may have crossed to a finished state. Calling updateFinishedState() when sampling means that we'll correctly
2488         set the animation's hold time to its end value, which means that currentTime() will now always be clamped to return
2489         the end time once its has reached it, so we must not schedule animations to resolve immediately anymore since otherwise
2490         they will keep being scheduled in a loop.
2491
2492         * animation/WebAnimation.cpp:
2493         (WebCore::WebAnimation::timeToNextRequiredTick const):
2494         (WebCore::WebAnimation::resolve):
2495
2496 2018-04-15  Chris Dumez  <cdumez@apple.com>
2497
2498         Change Event's returnValue so it doesn't expose a new primitive
2499         https://bugs.webkit.org/show_bug.cgi?id=184415
2500
2501         Reviewed by Darin Adler.
2502
2503         Update Event.returnValue setter to match the latest DOM specification after:
2504         - https://github.com/whatwg/dom/pull/626
2505
2506         In particular, the returnValue setter is now a no-op if the new flag value
2507         is true. If the input flag value is false, it only sets the 'canceled' flag
2508         if the event is cancelable and the event’s in passive listener flag is unset.
2509
2510         Test: imported/w3c/web-platform-tests/dom/events/Event-returnValue.html
2511
2512         * dom/Event.cpp:
2513         (WebCore::Event::setLegacyReturnValue):
2514         (WebCore::Event::setCanceledFlagIfPossible):
2515         (WebCore::Event::preventDefault):
2516         * dom/Event.h:
2517
2518 2018-04-14  Thibault Saunier  <tsaunier@igalia.com>
2519
2520         [GStreamer] Expose a method to retrieve the GstStream from a TrackPrivateBaseGStreamer
2521         https://bugs.webkit.org/show_bug.cgi?id=184620
2522
2523         Reviewed by Philippe Normand.
2524
2525         This is a minor change, a dedicated test doesn't really make sense here.
2526
2527         * platform/graphics/gstreamer/TrackPrivateBaseGStreamer.h:
2528         (WebCore::TrackPrivateBaseGStreamer::stream):
2529
2530 2018-04-13  Ryosuke Niwa  <rniwa@webkit.org>
2531
2532         WebKit crashes when libwebrtc.dylib is missing
2533         https://bugs.webkit.org/show_bug.cgi?id=184607
2534
2535         Rubber-stamped by Jer Noble.
2536
2537         Don't call LibWebRTC related code when libwebrtc is not available.
2538
2539         * dom/Document.cpp:
2540         (WebCore::Document::prepareForDestruction):
2541         (WebCore::Document::suspend):
2542
2543 2018-04-13  Chris Dumez  <cdumez@apple.com>
2544
2545         Split WindowProxy handling out of ScriptController and into a new class owned by AbstractFrame
2546         https://bugs.webkit.org/show_bug.cgi?id=184591
2547
2548         Reviewed by Sam Weinig.
2549
2550         Split WindowProxy handling out of ScriptController and into a new class owned by AbstractFrame.
2551         RemoteFrames do not need a ScriptController but do need to maintain WindowProxies.
2552         This is work towards fixing Bug 184515.
2553
2554         * Sources.txt:
2555         * WebCore.xcodeproj/project.pbxproj:
2556         * bindings/js/DOMWrapperWorld.cpp:
2557         (WebCore::DOMWrapperWorld::~DOMWrapperWorld):
2558         (WebCore::DOMWrapperWorld::clearWrappers):
2559         * bindings/js/DOMWrapperWorld.h:
2560         (WebCore::DOMWrapperWorld::didCreateWindowProxy):
2561         (WebCore::DOMWrapperWorld::didDestroyWindowProxy):
2562         * bindings/js/JSBindingsAllInOne.cpp:
2563         * bindings/js/JSDOMWindowBase.cpp:
2564         (WebCore::toJSDOMWindow):
2565         * bindings/js/JSDOMWindowProxy.cpp:
2566         (WebCore::toJS):
2567         (WebCore::toJSDOMWindowProxy):
2568         * bindings/js/ScriptCachedFrameData.cpp:
2569         (WebCore::ScriptCachedFrameData::ScriptCachedFrameData):
2570         (WebCore::ScriptCachedFrameData::restore):
2571         * bindings/js/ScriptController.cpp:
2572         (WebCore::ScriptController::~ScriptController):
2573         (WebCore::ScriptController::evaluateInWorld):
2574         (WebCore::ScriptController::loadModuleScriptInWorld):
2575         (WebCore::ScriptController::linkAndEvaluateModuleScriptInWorld):
2576         (WebCore::ScriptController::evaluateModule):
2577         (WebCore::ScriptController::clearWindowProxiesNotMatchingDOMWindow):
2578         (WebCore::ScriptController::setDOMWindowForWindowProxy):
2579         (WebCore::ScriptController::initScriptForWindowProxy):
2580         (WebCore::ScriptController::setupModuleScriptHandlers):
2581         (WebCore::ScriptController::windowProxyController):
2582         (WebCore::ScriptController::enableEval):
2583         (WebCore::ScriptController::enableWebAssembly):
2584         (WebCore::ScriptController::disableEval):
2585         (WebCore::ScriptController::disableWebAssembly):
2586         (WebCore::ScriptController::attachDebugger):
2587         (WebCore::ScriptController::updateDocument):
2588         (WebCore::ScriptController::collectIsolatedContexts):
2589         (WebCore::ScriptController::windowScriptNPObject):
2590         (WebCore::ScriptController::executeIfJavaScriptURL):
2591         * bindings/js/ScriptController.h:
2592         (WebCore::ScriptController::globalObject):
2593         * bindings/js/ScriptControllerMac.mm:
2594         (WebCore::ScriptController::windowScriptObject):
2595         * bindings/js/ScriptState.cpp:
2596         (WebCore::mainWorldExecState):
2597         * bindings/js/WindowProxyController.cpp: Added.
2598         (WebCore::WindowProxyController::WindowProxyController):
2599         (WebCore::WindowProxyController::destroyWindowProxy):
2600         (WebCore::WindowProxyController::createWindowProxy):
2601         (WebCore::WindowProxyController::windowProxies):
2602         (WebCore::WindowProxyController::createWindowProxyWithInitializedScript):
2603         * bindings/js/WindowProxyController.h: Added.
2604         (WebCore::WindowProxyController::releaseWindowProxies):
2605         (WebCore::WindowProxyController::setWindowProxies):
2606         (WebCore::WindowProxyController::windowProxy):
2607         (WebCore::WindowProxyController::existingWindowProxy const):
2608         (WebCore::WindowProxyController::globalObject):
2609         * loader/FrameLoader.cpp:
2610         (WebCore::FrameLoader::dispatchDidClearWindowObjectInWorld):
2611         * page/AbstractFrame.cpp:
2612         (WebCore::AbstractFrame::AbstractFrame):
2613         * page/AbstractFrame.h:
2614         (WebCore::AbstractFrame::windowProxyController):
2615         (WebCore::AbstractFrame::windowProxyController const):
2616
2617 2018-04-13  Brady Eidson  <beidson@apple.com>
2618
2619         Introduce SuspendedPageProxy to keep old web processes around after their WebPageProxy has been swapped to a new one.
2620         https://bugs.webkit.org/show_bug.cgi?id=184559
2621
2622         Reviewed by Alex Christensen.
2623
2624         Covered by new API test.
2625
2626         WebCore changes rework the meaning of a "ForSuspension" policy to simply navigate the page to about:blank.
2627
2628         * loader/DocumentLoader.cpp:
2629         (WebCore::DocumentLoader::redirectReceived):
2630         (WebCore::DocumentLoader::willSendRequest):
2631         (WebCore::DocumentLoader::startLoadingMainResource):
2632         * loader/DocumentLoader.h:
2633
2634         * loader/FrameLoader.cpp:
2635         (WebCore::FrameLoader::init):
2636         (WebCore::FrameLoader::continueLoadAfterNavigationPolicy):
2637
2638 2018-04-13  Chris Dumez  <cdumez@apple.com>
2639
2640         input.webkitEntries does not work as expected when folder contains accented chars
2641         https://bugs.webkit.org/show_bug.cgi?id=184517
2642         <rdar://problem/39265537>
2643
2644         Reviewed by Alex Christensen.
2645
2646         Use String::fromUTF8() to construct a WTF String from the char* returned by
2647         dirname() in FileSystem::directoryName(). Previously, we were just calling
2648         the String constructor, which would treat the input as latin 1 instead of
2649         UTF-8.
2650
2651         Change is covered by an API test rather than a layout test due to file versioning
2652         limitations.
2653
2654         * platform/posix/FileSystemPOSIX.cpp:
2655         (WebCore::FileSystem::directoryName):
2656
2657 2018-04-13  Yusuke Suzuki  <utatane.tea@gmail.com>
2658
2659         [WebCore] Use @getByIdDirectPrivate / @putByIdDirectPrivate in WebCore JS
2660         https://bugs.webkit.org/show_bug.cgi?id=184401
2661
2662         Rubber stamped by Saam Barati.
2663
2664         Apply bug 183970 changes to WebCore JS too. This offers solid type checking
2665         with @getByIdDirectPrivate().
2666
2667         * Modules/mediastream/RTCPeerConnection.js:
2668         (initializeRTCPeerConnection):
2669         (getLocalStreams):
2670         (getStreamById):
2671         (addStream):
2672         * Modules/mediastream/RTCPeerConnectionInternals.js:
2673         (isRTCPeerConnection):
2674         * Modules/streams/ReadableByteStreamController.js:
2675         (enqueue):
2676         (error):
2677         (close):
2678         (getter.byobRequest):
2679         * Modules/streams/ReadableByteStreamInternals.js:
2680         (privateInitializeReadableStreamBYOBReader):
2681         (privateInitializeReadableByteStreamController):
2682         (privateInitializeReadableStreamBYOBRequest):
2683         (isReadableByteStreamController):
2684         (isReadableStreamBYOBRequest):
2685         (isReadableStreamBYOBReader):
2686         (readableByteStreamControllerCancel):
2687         (readableByteStreamControllerError):
2688         (readableByteStreamControllerClose):
2689         (readableByteStreamControllerClearPendingPullIntos):
2690         (readableByteStreamControllerGetDesiredSize):
2691         (readableStreamHasBYOBReader):
2692         (readableStreamHasDefaultReader):
2693         (readableByteStreamControllerHandleQueueDrain):
2694         (readableByteStreamControllerPull):
2695         (readableByteStreamControllerShouldCallPull):
2696         (readableByteStreamControllerCallPullIfNeeded):
2697         (readableByteStreamControllerEnqueue):
2698         (readableByteStreamControllerEnqueueChunk):
2699         (readableByteStreamControllerRespondWithNewView):
2700         (readableByteStreamControllerRespond):
2701         (readableByteStreamControllerRespondInternal):
2702         (readableByteStreamControllerRespondInReadableState):
2703         (readableByteStreamControllerRespondInClosedState):
2704         (readableByteStreamControllerProcessPullDescriptors):
2705         (readableByteStreamControllerFillDescriptorFromQueue):
2706         (readableByteStreamControllerShiftPendingDescriptor):
2707         (readableByteStreamControllerInvalidateBYOBRequest):
2708         (readableByteStreamControllerCommitDescriptor):
2709         (readableStreamFulfillReadIntoRequest):
2710         (readableByteStreamControllerPullInto):
2711         (readableStreamAddReadIntoRequest):
2712         * Modules/streams/ReadableStream.js:
2713         (initializeReadableStream):
2714         (pipeThrough):
2715         * Modules/streams/ReadableStreamBYOBReader.js:
2716         (cancel):
2717         (read):
2718         (releaseLock):
2719         (getter.closed):
2720         * Modules/streams/ReadableStreamBYOBRequest.js:
2721         (respond):
2722         (respondWithNewView):
2723         (getter.view):
2724         * Modules/streams/ReadableStreamDefaultController.js:
2725         (error):
2726         * Modules/streams/ReadableStreamDefaultReader.js:
2727         (cancel):
2728         (read):
2729         (releaseLock):
2730         (getter.closed):
2731         * Modules/streams/ReadableStreamInternals.js:
2732         (privateInitializeReadableStreamDefaultReader):
2733         (readableStreamReaderGenericInitialize):
2734         (readableStreamDefaultControllerError):
2735         (readableStreamPipeTo):
2736         (readableStreamTee):
2737         (isReadableStream):
2738         (isReadableStreamDefaultReader):
2739         (isReadableStreamDefaultController):
2740         (readableStreamError):
2741         (readableStreamDefaultControllerCallPullIfNeeded):
2742         (readableStreamDefaultControllerGetDesiredSize):
2743         (readableStreamReaderGenericCancel):
2744         (readableStreamCancel):
2745         (readableStreamDefaultControllerCancel):
2746         (readableStreamDefaultControllerPull):
2747         (readableStreamDefaultControllerClose):
2748         (readableStreamClose):
2749         (readableStreamFulfillReadRequest):
2750         (readableStreamDefaultReaderRead):
2751         (readableStreamAddReadRequest):
2752         (isReadableStreamDisturbed):
2753         (readableStreamReaderGenericRelease):
2754         (readableStreamDefaultControllerCanCloseOrEnqueue):
2755         (privateInitializeReadableStreamDefaultController): Deleted.
2756         * Modules/streams/StreamInternals.js:
2757         (validateAndNormalizeQueuingStrategy):
2758         * Modules/streams/WritableStream.js:
2759         (initializeWritableStream):
2760         (abort):
2761         (close):
2762         (write):
2763         (getter.closed):
2764         (getter.ready):
2765         (getter.state):
2766         * Modules/streams/WritableStreamInternals.js:
2767         (isWritableStream):
2768         (syncWritableStreamStateWithQueue):
2769         (errorWritableStream):
2770         (callOrScheduleWritableStreamAdvanceQueue):
2771         * bindings/js/JSDOMBindingInternals.js:
2772         (mapLikeForEach):
2773
2774 2018-04-12  Antoine Quint  <graouts@apple.com>
2775
2776         [Web Animations] Turn CSS Animations and CSS Transitions as Web Animations on by default
2777         https://bugs.webkit.org/show_bug.cgi?id=184569
2778         <rdar://problem/38671301>
2779
2780         Reviewed by Jon Lee.
2781
2782         We now set the CSS Animations and CSS Transitions as Web Animations flag on by default. To ensure that some remaining
2783         tests pass with this flag on, we expose a way to get to a PseudoElement via a new internals.pseudoElement() method. This
2784         allows tests that used internals.pauseAnimationAtTimeOnPseudoElement() and internals.pauseTransitionAtTimeOnPseudoElement()
2785         to now work with the Web Animations API.
2786
2787         * page/RuntimeEnabledFeatures.h:
2788         * testing/Internals.cpp:
2789         (WebCore::Internals::pseudoElement):
2790         * testing/Internals.h:
2791         * testing/Internals.idl:
2792
2793 2018-04-13  Sergio Villar Senin  <svillar@igalia.com>
2794
2795         [WebVR][OpenVR] Implement requestPresent()/exitPresent() and getLayers()
2796         https://bugs.webkit.org/show_bug.cgi?id=184530
2797
2798         Reviewed by Žan Doberšek.
2799
2800         WebVR apps should invoke requestPresent() to start presenting contents of a VRLayerInit
2801         (right now a HTML canvas with a WebGL context) on the VRDisplay. This request might fail for
2802         a variety of reasons and can be eventually cancelled with exitPresent(). Once we are
2803         presenting we could access the presenting layers (right now just one) with getLayers().
2804
2805         Note that we are not presenting anything to the HMD yet, that will be done later in a follow
2806         up patch.
2807
2808         I took the chance to correct a mistak in the VRDisplayCapabilities object which has a method
2809         that should be called maxLayers instead of maxLayer.
2810
2811         * Modules/webvr/VRDisplay.cpp:
2812         (WebCore::VRDisplay::requestPresent):
2813         (WebCore::VRDisplay::stopPresenting):
2814         (WebCore::VRDisplay::exitPresent):
2815         (WebCore::VRDisplay::getLayers const):
2816         (WebCore::VRDisplay::isPresenting const): Deleted. Implemented in the header file.
2817         * Modules/webvr/VRDisplay.h:
2818         (WebCore::VRDisplay::isPresenting const):
2819         * Modules/webvr/VRDisplayCapabilities.h:
2820         (WebCore::VRDisplayCapabilities::maxLayers const): Renamed from maxLayer().
2821         (WebCore::VRDisplayCapabilities::maxLayer const): Deleted.
2822         * Modules/webvr/VRDisplayCapabilities.idl:
2823
2824 2018-04-13  Miguel Gomez  <magomez@igalia.com>
2825
2826         REGRESSION(r230627): [GTK][WPE] Possible deadlock when destroying the player in non AC mode
2827         https://bugs.webkit.org/show_bug.cgi?id=184583
2828
2829         Reviewed by Carlos Garcia Campos.
2830
2831         In non AC mode, ensure that a deadlock can't happen when destroying MediaPlayerPrivateGStreamerBase.
2832
2833         Covered by existent tests.
2834
2835         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp:
2836         (WebCore::MediaPlayerPrivateGStreamerBase::~MediaPlayerPrivateGStreamerBase):
2837         (WebCore::MediaPlayerPrivateGStreamerBase::triggerRepaint):
2838         (WebCore::MediaPlayerPrivateGStreamerBase::cancelRepaint):
2839         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.h:
2840
2841 2018-04-13  Miguel Gomez  <magomez@igalia.com>
2842
2843         [GTK] [gstreamer] video won't unpause when built with -DUSE_GSTREAMER_GL=OFF
2844         https://bugs.webkit.org/show_bug.cgi?id=183362
2845
2846         Reviewed by Carlos Garcia Campos.
2847
2848         Remove the drawCancelled flag and use a new one to indicate that the player is being destroyed.
2849         That new flag is only enabled on destruction and it's not modified by cancelRepaint(), which
2850         can be used to handle the pause event without avoiding future renderings. Also cancelRepaint()
2851         has only effect when not in AC mode.
2852
2853         Covered by existent tests.
2854
2855         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp:
2856         (WebCore::MediaPlayerPrivateGStreamerBase::~MediaPlayerPrivateGStreamerBase):
2857         (WebCore::MediaPlayerPrivateGStreamerBase::triggerRepaint):
2858         (WebCore::MediaPlayerPrivateGStreamerBase::cancelRepaint):
2859         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.h:
2860
2861 2018-04-13  Xabier Rodriguez Calvar  <calvaris@igalia.com>
2862
2863         [GStreamer] Convert GStreamerUtilities in GStreamerCommon and include the GStreamer smart pointer traits
2864         https://bugs.webkit.org/show_bug.cgi?id=184533
2865
2866         Reviewed by Philippe Normand.
2867
2868         Renamed GStreamerUtilities* files into GStreamerCommon* and
2869         modified files including them accordingly. Include
2870         GRefPtrGStreamer.h and GUniquePtrGStreamer.h in GStreamerCommon.h
2871         to avoid problems destroying objects when those files are
2872         forgotten to be included.
2873
2874         * Modules/webaudio/AudioContext.cpp:
2875         * platform/GStreamer.cmake:
2876         * platform/audio/gstreamer/WebKitWebAudioSourceGStreamer.cpp:
2877         * platform/graphics/gstreamer/AudioTrackPrivateGStreamer.h:
2878         * platform/graphics/gstreamer/GStreamerCommon.cpp: Renamed from Source/WebCore/platform/graphics/gstreamer/GStreamerUtilities.cpp.
2879         * platform/graphics/gstreamer/GStreamerCommon.h: Renamed from Source/WebCore/platform/graphics/gstreamer/GStreamerUtilities.h.
2880         * platform/graphics/gstreamer/ImageGStreamer.h:
2881         * platform/graphics/gstreamer/ImageGStreamerCairo.cpp:
2882         * platform/graphics/gstreamer/InbandTextTrackPrivateGStreamer.cpp:
2883         * platform/graphics/gstreamer/InbandTextTrackPrivateGStreamer.h:
2884         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:
2885         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.h:
2886         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp:
2887         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.h:
2888         * platform/graphics/gstreamer/MediaSampleGStreamer.cpp:
2889         * platform/graphics/gstreamer/MediaSampleGStreamer.h:
2890         * platform/graphics/gstreamer/TextCombinerGStreamer.cpp:
2891         * platform/graphics/gstreamer/TrackPrivateBaseGStreamer.cpp:
2892         * platform/graphics/gstreamer/TrackPrivateBaseGStreamer.h:
2893         * platform/graphics/gstreamer/VideoSinkGStreamer.cpp:
2894         * platform/graphics/gstreamer/VideoTrackPrivateGStreamer.h:
2895         * platform/graphics/gstreamer/WebKitWebSourceGStreamer.cpp:
2896         * platform/graphics/gstreamer/eme/GStreamerEMEUtilities.cpp:
2897         * platform/graphics/gstreamer/eme/GStreamerEMEUtilities.h:
2898         * platform/graphics/gstreamer/eme/WebKitClearKeyDecryptorGStreamer.cpp:
2899         * platform/graphics/gstreamer/eme/WebKitCommonEncryptionDecryptorGStreamer.cpp:
2900         * platform/graphics/gstreamer/mse/AppendPipeline.cpp:
2901         * platform/graphics/gstreamer/mse/AppendPipeline.h:
2902         * platform/graphics/gstreamer/mse/GStreamerMediaDescription.cpp:
2903         * platform/graphics/gstreamer/mse/GStreamerMediaDescription.h:
2904         * platform/graphics/gstreamer/mse/MediaPlayerPrivateGStreamerMSE.cpp:
2905         * platform/graphics/gstreamer/mse/MediaPlayerPrivateGStreamerMSE.h:
2906         * platform/graphics/gstreamer/mse/MediaSourceClientGStreamerMSE.h:
2907         * platform/graphics/gstreamer/mse/PlaybackPipeline.cpp:
2908         * platform/graphics/gstreamer/mse/SourceBufferPrivateGStreamer.cpp:
2909         * platform/graphics/gstreamer/mse/WebKitMediaSourceGStreamer.cpp:
2910         * platform/graphics/gstreamer/mse/WebKitMediaSourceGStreamer.h:
2911
2912 2018-04-12  Christopher Reid  <chris.reid@sony.com>
2913
2914         [Curl] Fix clang build error in CurlContext.cpp
2915         https://bugs.webkit.org/show_bug.cgi?id=184561
2916
2917         Reviewed by Darin Adler.
2918
2919         MSVC allows explicit template specialization in classes but gcc/clang do not.
2920
2921         * platform/network/curl/CurlContext.cpp:
2922
2923 2018-04-12  Christopher Reid  <chris.reid@sony.com>
2924
2925         [Curl] Cookie Database on memory path should be :memory:
2926         https://bugs.webkit.org/show_bug.cgi?id=184572
2927
2928         Reviewed by Alex Christensen.
2929
2930         CookieJarDB::isOnMemory is comparing the database path with :onmemory: but it should be using :memory:
2931         For reference, see: https://www.sqlite.org/inmemorydb.html
2932
2933         * platform/network/curl/CookieJarDB.h:
2934
2935 2018-04-12  Daniel Bates  <dabates@apple.com>
2936
2937         Attmept to fix the Windows build following <https://trac.webkit.org/changeset/230602/>
2938         (https://bugs.webkit.org/show_bug.cgi?id=184386)
2939
2940         Visual Studio cannot prove that all cases in the switch are covered :(
2941         So, add an ASSERT_NOT_REACHED() and a return a value outside of the switch block. 
2942
2943         * loader/cache/CachedResourceLoader.cpp:
2944         (WebCore::destinationForType):
2945
2946 2018-04-12  Chris Dumez  <cdumez@apple.com>
2947
2948         Introduce remote variants of Frame / DOMWindow classes
2949         https://bugs.webkit.org/show_bug.cgi?id=184467
2950         <rdar://problem/39011267>
2951
2952         Reviewed by Ryosuke Niwa.
2953
2954         Introduce remote variants of Frame / DOMWindow classes, for when these frames / windows
2955         are hosted on another WebProcess. Those will be used in a follow-up patch.
2956
2957         The hierarchy is as follows (class naming will be improved in a follow-up patch to minimise
2958         patch size):
2959         - AbstractFrame: A frame that can be either local or remote (hosted on another WebProcess)
2960             - Frame: A local frame
2961             - RemoteFrame: A frame hosted on another WebProcess. A RemoteFrame's window is also remote.
2962         - AbstractDOMWindow: A window that be either local or remote (hosted on another WebProcess)
2963             - DOMWindow: A local DOMWindow
2964             - RemoteDOMWindow: A window hosted on another WebProcess. A RemoteDOMWindow's frame is also
2965               remote. A RemoteDOMWindow is always cross-origin.
2966
2967         This patch introduces global identifiers (unique across all WebProcesses) for both Frames and
2968         Windows. This is useful as we need to know which Frame / DOMWindow a particular RemoteFrame /
2969         RemoteDOMWindow is pointing to.
2970
2971         Follow-up patch will add support for converting a local DOMWindow / Frame into a remote ones,
2972         when a newly opened window (via window.open) is navigated cross-origin (Bug 184515).
2973
2974         Other things we'll need to implement in follow-ups:
2975         - RemoteDOMWindow will need to know about its opener in order to support the window.opener
2976           API. Internally, the opener will be stored as a RemoteFrame so that window.opener always
2977           returns the current window in the opener frame (which changes upon navigation).
2978         - Nullify a RemoteDOMWindow's frame whenever the window it is pointing to becomes frameless.
2979           A frameless window behaves very differently (e.g. very little API is exposed to the Web).
2980           This happens when either the newly opened window is either closed or navigated.
2981
2982         * Sources.txt:
2983         * WebCore.xcodeproj/project.pbxproj:
2984         * loader/ContentFilter.cpp:
2985         (WebCore::ContentFilter::didDecide):
2986         * page/AbstractDOMWindow.cpp: Added.
2987         (WebCore::AbstractDOMWindow::AbstractDOMWindow):
2988         (WebCore::AbstractDOMWindow::~AbstractDOMWindow):
2989         * page/AbstractDOMWindow.h: Added.
2990         (WebCore::AbstractDOMWindow::identifier const):
2991         * page/AbstractFrame.cpp: Added.
2992         (WebCore::AbstractFrame::AbstractFrame):
2993         (WebCore::AbstractFrame::~AbstractFrame):
2994         * page/AbstractFrame.h: Added.
2995         (WebCore::AbstractFrame::window const):
2996         * page/DOMWindow.cpp:
2997         (WebCore::DOMWindow::DOMWindow):
2998         * page/DOMWindow.h:
2999         (isType):
3000         * page/Frame.cpp:
3001         (WebCore::Frame::window const):
3002         (WebCore::Frame::virtualWindow const):
3003         * page/Frame.h:
3004         (isType):
3005         * page/GlobalFrameIdentifier.h: Added.
3006         (WebCore::GlobalFrameIdentifier::encode const):
3007         (WebCore::GlobalFrameIdentifier::decode):
3008         * page/GlobalWindowIdentifier.h: Added.
3009         (WebCore::operator==):
3010         (WebCore::GlobalWindowIdentifier::hash const):
3011         (WebCore::GlobalWindowIdentifier::encode const):
3012         (WebCore::GlobalWindowIdentifier::decode):
3013         (WTF::GlobalWindowIdentifierHash::hash):
3014         (WTF::GlobalWindowIdentifierHash::equal):
3015         (WTF::HashTraits<WebCore::GlobalWindowIdentifier>::emptyValue):
3016         (WTF::HashTraits<WebCore::GlobalWindowIdentifier>::constructDeletedValue):
3017         (WTF::HashTraits<WebCore::GlobalWindowIdentifier>::isDeletedValue):
3018
3019         * page/RemoteDOMWindow.cpp: Added.
3020         (WebCore::RemoteDOMWindow::RemoteDOMWindow):
3021         (WebCore::RemoteDOMWindow::~RemoteDOMWindow):
3022         (WebCore::RemoteDOMWindow::self const):
3023         (WebCore::RemoteDOMWindow::location const):
3024         (WebCore::RemoteDOMWindow::close):
3025         (WebCore::RemoteDOMWindow::closed const):
3026         (WebCore::RemoteDOMWindow::focus):
3027         (WebCore::RemoteDOMWindow::blur):
3028         (WebCore::RemoteDOMWindow::length const):
3029         (WebCore::RemoteDOMWindow::top const):
3030         (WebCore::RemoteDOMWindow::opener const):
3031         (WebCore::RemoteDOMWindow::parent const):
3032         (WebCore::RemoteDOMWindow::postMessage):
3033         The DOM API exposed on RemoteDOMWindow is only the subset of the DOMWindow API that is exposed cross origin,
3034         since remote DOMWindow are always from a different origin. The short-term plan is to implement these in a
3035         follow-up by relying on IPC (synchronous when necessary) to fetch the information from the real window in
3036         the WebProcess where it lives. Longer term, we should probably keep RemoteDOMWindow members in sync with the
3037         DOMWindow they're pointing to, so we do not have to rely on synchronous IPC.
3038
3039         * page/RemoteDOMWindow.h: Added.
3040         (isType):
3041         * page/RemoteFrame.cpp: Added.
3042         (WebCore::RemoteFrame::RemoteFrame):
3043         (WebCore::RemoteFrame::~RemoteFrame):
3044         (WebCore::RemoteFrame::virtualWindow const):
3045         * page/RemoteFrame.h: Added.
3046         (isType):
3047
3048 2018-04-12  Daniel Bates  <dabates@apple.com>
3049
3050         Content-Type not enforced for <script> allows for XSS
3051         https://bugs.webkit.org/show_bug.cgi?id=184386
3052         <rdar://problem/39112268>
3053
3054         Reviewed by Brady Eidson.
3055
3056         As per the Fetch standard, <https://fetch.spec.whatwg.org/#should-response-to-request-be-blocked-due-to-mime-type?> (16 March 2018),
3057         we should block JavaScript scripts that are served with MIME type text/csv, or a MIME type
3058         that begins with "audio/", "image/" or "video/".
3059
3060         As a side benefit of this change we now set the destination property [1] on preload requests.
3061
3062         [1] <https://fetch.spec.whatwg.org/#concept-request-destination>
3063
3064         Tests: http/tests/security/script-with-banned-mimetype.html
3065                http/tests/workers/worker-importScripts-banned-mimetype.html
3066
3067         * Sources.txt: Add file FetchIdioms.cpp.
3068         * WebCore.xcodeproj/project.pbxproj: Add files FetchIdioms.{cpp, h}.
3069         * dom/LoadableClassicScript.cpp:
3070         (WebCore::LoadableClassicScript::notifyFinished): Check the MIME type of the response and
3071         block the script if applicable.
3072         * dom/LoadableScript.h: Add error type MIMEType.
3073         * loader/FetchIdioms.cpp: Added.
3074         (WebCore::shouldBlockResponseDueToMIMEType): Implements the "Should response to request be blocked
3075         due to its MIME type?" algorithm from the Fetch standard.
3076         * loader/FetchIdioms.h: Added.
3077         * loader/FetchOptions.h:
3078         (WebCore::isScriptLikeDestination): Implements the definition of "script like" as per <https://fetch.spec.whatwg.org/#request-destination-script-like>.
3079         * loader/cache/CachedResourceLoader.cpp:
3080         (WebCore::CachedResourceLoader::requestImage): Removed logic to set the destination property as
3081         CachedResourceLoader::requestResource() is now responsible for doing this.
3082         (WebCore::CachedResourceLoader::requestFont): Ditto.
3083         (WebCore::CachedResourceLoader::requestTextTrack): Ditto.
3084         (WebCore::CachedResourceLoader::requestCSSStyleSheet): Ditto.
3085         (WebCore::CachedResourceLoader::requestScript): Ditto.
3086         (WebCore::CachedResourceLoader::requestXSLStyleSheet): Ditto.
3087         (WebCore::CachedResourceLoader::requestMedia): Update comment to express that we should assert
3088         that the destination property is either video or audio.
3089         (WebCore::CachedResourceLoader::requestIcon): Remove logic to set the destination property as
3090         CachedResourceLoader::requestResource() is now responsible for doing this.
3091         (WebCore::CachedResourceLoader::requestRawResource): Removed assertion as this function is used to
3092         load many kinds of requests that have different destination properties. The caller is responsible
3093         for setting the appropriate destintion property.
3094         (WebCore::CachedResourceLoader::requestMainResource): Remove logic to set the destination property
3095         as CachedResourceLoader::requestResource() is now responsible for doing this.
3096         (WebCore::destinationForType): Helper function that maps CachedResource::Type to FetchOptions::Destination.
3097         (WebCore::CachedResourceLoader::requestResource): Set the destination property on the request if not
3098         already set.
3099         * loader/cache/CachedResourceLoader.h: Segregate requestRawResource() from the other request functions
3100         and add a comment to explain what it is used for.
3101         * workers/Worker.cpp:
3102         (WebCore::Worker::create):
3103         * workers/WorkerScriptLoader.cpp:
3104         (WebCore::WorkerScriptLoader::loadSynchronously): Set the destination property to FetchOptions::Destination::Script
3105         and store it in an instance variable as we will need to reference it once we receive the HTTP response.
3106         Note that this function is only used to support the Web API importScripts().
3107         (WebCore::WorkerScriptLoader::loadAsynchronously): Store the passed destination property in an
3108         instance as we will need to reference it once we receive the HTTP response.
3109         (WebCore::WorkerScriptLoader::didReceiveResponse): Check the MIME type of the response and
3110         block the script if applicable.
3111         * workers/WorkerScriptLoader.h:
3112         * workers/service/ServiceWorkerJob.cpp:
3113         (WebCore::ServiceWorkerJob::fetchScriptWithContext): Set the destination property to FetchOptions::Destination::Serviceworker.
3114
3115 2018-04-12  Antoine Quint  <graouts@apple.com>
3116
3117         [Web Animations] Fix a host of small CSS Animations and CSS Transitions issues
3118         https://bugs.webkit.org/show_bug.cgi?id=184555
3119
3120         Reviewed by Dean Jackson.
3121
3122         A series of small and intertwined issues were preventing a number of CSS Animations and CSS Trantions
3123         tests to fail when expressed as Web Animations.
3124
3125         * animation/AnimationTimeline.cpp:
3126         (WebCore::AnimationTimeline::updateCSSAnimationsForElement): Pass the old and new RenderStyles to CSSAnimation::create()
3127         since we're refactoring DeclarativeAnimation to create blending keyframes in initialize(), no longer requiring each subclass
3128         to create them.
3129         (WebCore::AnimationTimeline::cssAnimationForElementAndProperty): Return the animation, if any, for a property animated by
3130         a CSS animation, so that we can determine if a property is already being animated when running a CSS Transition.
3131         (WebCore::AnimationTimeline::updateCSSTransitionsForElement): Since a property can be specified twice in a "transition" property,
3132         once via "all" and once explicitly, ensure we look at all currently running transitions for the currently-processed property to
3133         see if we need to cancel this transition. Previously, we used to only see if it had been transitioned in the old style. We also
3134         start transitions even if the duration is 0 provided the delay is a positive, non-zero value. Then, if there is a CSS Animation
3135         for this property already running, use that animation's original unanimated style as the from value.
3136         * animation/AnimationTimeline.h:
3137         * animation/CSSAnimation.cpp:
3138         (WebCore::CSSAnimation::create): The animation name is now set in the CSSAnimation constructor.
3139         (WebCore::CSSAnimation::CSSAnimation): Set the animation name and keep a copy of the unanimated style such that we can
3140         get it when a CSS Transition is created and takes precedence over this CSS Animation.
3141         (WebCore::CSSAnimation::initialize): Deleted.
3142         * animation/CSSAnimation.h:
3143         * animation/CSSTransition.cpp:
3144         (WebCore::CSSTransition::create):
3145         (WebCore::CSSTransition::initialize):
3146         * animation/CSSTransition.h:
3147         * animation/DeclarativeAnimation.cpp:
3148         (WebCore::DeclarativeAnimation::initialize): Call the new computeDeclarativeAnimationBlendingKeyframes() on the KeyframeEffect
3149         directly in this method so that subclasses don't need to create it manually, but most important so that keyframes are created
3150         before timing properties are set based on the backing animation.
3151         * animation/DeclarativeAnimation.h:
3152         * animation/KeyframeEffectReadOnly.cpp:
3153         (WebCore::KeyframeEffectReadOnly::getKeyframes): Ensure we have a CSSValue before trying to serialize it.
3154         (WebCore::KeyframeEffectReadOnly::computeDeclarativeAnimationBlendingKeyframes):
3155         (WebCore::KeyframeEffectReadOnly::computeCSSAnimationBlendingKeyframes): Use the animation's unanimated style to compute keyframes,
3156         instead of a default RenderStyle which would not use the right values for implicit keyframes.
3157         (WebCore::KeyframeEffectReadOnly::stylesWouldYieldNewCSSTransitionsBlendingKeyframes const): Look at the property used to create
3158         the transition rather than that specified on the backing Animation object since it can be CSSPropertyInvalid in the case of
3159         "transition: all".
3160         (WebCore::KeyframeEffectReadOnly::setAnimatedPropertiesInStyle): If we're dealing with a CSS animation, we consider the first and
3161         last keyframes to always have the property listed since the underlying style was provided and should be captured.
3162         * animation/KeyframeEffectReadOnly.h:
3163         * style/StyleTreeResolver.cpp:
3164         (WebCore::Style::TreeResolver::createAnimatedElementUpdate): Apply CSS Animations after CSS Trasitions since they take precedence.
3165
3166 2018-04-12  Antoine Quint  <graouts@apple.com>
3167
3168         [Web Animations] Only cancel declarative animations upon element removal
3169         https://bugs.webkit.org/show_bug.cgi?id=184553
3170
3171         Reviewed by Dean Jackson.
3172
3173         Ensure we only call cancel() on CSSAnimation and CSSTransition objects as we might otherwise reject
3174         the ready promise and produce spurious logging from WPT tests.
3175
3176         * animation/AnimationTimeline.cpp:
3177         (WebCore::AnimationTimeline::cancelDeclarativeAnimationsForElement):
3178         (WebCore::AnimationTimeline::cancelAnimationsForElement): Deleted.
3179         * animation/AnimationTimeline.h:
3180         * dom/Element.cpp:
3181         (WebCore::Element::removedFromAncestor):
3182         * dom/PseudoElement.cpp:
3183         (WebCore::PseudoElement::clearHostElement):
3184         * rendering/updating/RenderTreeUpdater.cpp:
3185         (WebCore::RenderTreeUpdater::tearDownRenderers):
3186
3187 2018-04-12  Ryan Haddad  <ryanhaddad@apple.com>
3188
3189         Unreviewed, rolling out r230554.
3190
3191         The non-ASCII character in the filename causes issues with SVN
3192
3193         Reverted changeset:
3194
3195         "input.webkitEntries does not work as expected when folder
3196         contains accented chars"
3197         https://bugs.webkit.org/show_bug.cgi?id=184517
3198         https://trac.webkit.org/changeset/230554
3199
3200 2018-04-12  Alicia Boya García  <aboya@igalia.com>
3201
3202         [MSE] Add isValid() assertions on PlatformTimeRanges::add() range ends
3203         https://bugs.webkit.org/show_bug.cgi?id=180253
3204
3205         Right now it's checked that start <= end but it's not checked that
3206         neither of them is undefined.
3207
3208         When this happens, the bug can be hard to track down.
3209
3210         The assertion is not enabled for Mac because there is currently a test
3211         that is hitting it.
3212
3213         Reviewed by Jer Noble.
3214
3215         * platform/graphics/PlatformTimeRanges.cpp:
3216         (WebCore::PlatformTimeRanges::add):
3217
3218 2018-04-12  Chris Dumez  <cdumez@apple.com>
3219
3220         Process::setIdentifier() / Process::identifier() do not need a lock
3221         https://bugs.webkit.org/show_bug.cgi?id=184544
3222
3223         Reviewed by Brady Eidson.
3224
3225         Process::setIdentifier() / Process::identifier() do not need a lock.
3226         Process::setIdentifier() gets called in ChildProcess::initialize(),
3227         before we start any background threads. It is then safe to query
3228         this process identifier later on from background threads without
3229         locks.
3230
3231         * platform/Process.cpp:
3232         (WebCore::Process::setIdentifier):
3233         (WebCore::Process::identifier):
3234
3235 2018-04-12  Antoine Quint  <graouts@apple.com>
3236
3237         Unreviewed, fix the Windows build.
3238
3239         * animation/DocumentTimeline.cpp:
3240         (WebCore::DocumentTimeline::computeExtentOfAnimation const):
3241
3242 2018-04-12  Antoine Quint  <graouts@apple.com>
3243
3244         [Web Animations] Suspend animations when required
3245         https://bugs.webkit.org/show_bug.cgi?id=184541
3246
3247         Reviewed by Jon Lee.
3248
3249         Animations managed by CSSAnimationController get suspended under a number of scenarios, we now add the possibility
3250         to suspend animations on a DocumentTimeline as well such that Web Animations and CSS Animations and CSS Transitions
3251         implemented as Web Animations get suspended under the same conditions as well. We also update the implementation for
3252         Internals::numberOfActiveAnimations() such that tests checking that animations get suspended pass.
3253
3254         * animation/DocumentTimeline.cpp:
3255         (WebCore::DocumentTimeline::suspendAnimations): When asked to be suspended, the DocumentTimeline cancels pending
3256         invalidation tasks and updates all of the animations it manages, including those running on the compositor.
3257         (WebCore::DocumentTimeline::resumeAnimations): When asked to be resumed, the DocumentTimeline resumes animations
3258         it manages and rewinds its invalidation timer.
3259         (WebCore::DocumentTimeline::animationsAreSuspended):
3260         (WebCore::DocumentTimeline::numberOfActiveAnimationsForTesting const): Called by Internals::numberOfActiveAnimations(),
3261         this returns the number of animations managed by this timeline that are not suspended.
3262         (WebCore::DocumentTimeline::currentTime):
3263         (WebCore::DocumentTimeline::timingModelDidChange): Ensure the invalidation timer is not rewound if the timeline
3264         is suspended.
3265         * animation/DocumentTimeline.h:
3266         * animation/WebAnimation.cpp:
3267         (WebCore::WebAnimation::setTimeline): When moving to a new timeline, ensure we match the new timeline's animation state.
3268         (WebCore::WebAnimation::setSuspended): Toggle the accelerated running state of any backing hardware animations when
3269         the suspension state of an animation changes.
3270         * animation/WebAnimation.h:
3271         (WebCore::WebAnimation::isSuspended const):
3272         * dom/Document.cpp:
3273         (WebCore::Document::didBecomeCurrentDocumentInFrame):
3274         (WebCore::Document::resume):
3275         * dom/Document.h:
3276         * history/CachedFrame.cpp:
3277         (WebCore::CachedFrameBase::restore):
3278         * page/Frame.cpp:
3279         (WebCore::Frame::clearTimers):
3280         * page/Page.cpp:
3281         (WebCore::Page::setIsVisibleInternal):
3282         (WebCore::Page::hiddenPageCSSAnimationSuspensionStateChanged):
3283         * testing/Internals.cpp:
3284         (WebCore::Internals::numberOfActiveAnimations const):
3285         (WebCore::Internals::animationsAreSuspended const):
3286         (WebCore::Internals::suspendAnimations const):
3287         (WebCore::Internals::resumeAnimations const):
3288
3289 2018-04-12  Antoine Quint  <graouts@apple.com>
3290
3291         [Web Animations] Throttle animations when lowPowerMode is on
3292         https://bugs.webkit.org/show_bug.cgi?id=184540
3293
3294         Reviewed by Jon Lee.
3295
3296         Ensure animations are sampled at a lower frequency when lowPowerMode is on.
3297
3298         * animation/DocumentTimeline.cpp:
3299         (WebCore::DocumentTimeline::updateThrottlingState):
3300         (WebCore::DocumentTimeline::animationInterval const):
3301         (WebCore::DocumentTimeline::updateAnimationSchedule):
3302         (WebCore::DocumentTimeline::scheduleAnimationResolution):
3303         * animation/DocumentTimeline.h:
3304         * page/Page.cpp:
3305         (WebCore::Page::handleLowModePowerChange):
3306         * testing/Internals.cpp:
3307         (WebCore::Internals::animationsInterval const):
3308
3309 2018-04-12  Antoine Quint  <graouts@apple.com>
3310
3311         [Web Animations] Ensure elements overlapping with elements animating also get composited
3312         https://bugs.webkit.org/show_bug.cgi?id=184539
3313
3314         Reviewed by Jon Lee.
3315
3316         A number of compositing tests failed because we didn't call into the Web Animations engine while various calls
3317         on RenderLayer and RenderLayerBacking were made. We bring the functionality over from CSSAnimationController to
3318         DocumentTimeline and KeyframeAnimation to KeyframeEffectReadOnly.
3319
3320         * animation/AnimationTimeline.cpp:
3321         (WebCore::AnimationTimeline::animationsForElement const): Update this method's signature to be const since it
3322         should be callable by other const method.
3323         (WebCore::AnimationTimeline::animationsForElement): Deleted.
3324         * animation/AnimationTimeline.h:
3325         * animation/DocumentTimeline.cpp:
3326         (WebCore::DocumentTimeline::computeExtentOfAnimation const): Adapt this method from CSSAnimationController.
3327         (WebCore::DocumentTimeline::isRunningAnimationOnRenderer const): Adapt this method from CSSAnimationController.
3328         (WebCore::DocumentTimeline::isRunningAcceleratedAnimationOnRenderer const): Adapt this method from CSSAnimationController.
3329         * animation/DocumentTimeline.h:
3330         * animation/KeyframeEffectReadOnly.cpp:
3331         (WebCore::KeyframeEffectReadOnly::computeExtentOfTransformAnimation const): Bring this method over from KeyframeAnimation.
3332         (WebCore::containsRotation): Bring this method over from KeyframeAnimation.
3333         (WebCore::KeyframeEffectReadOnly::computeTransformedExtentViaTransformList const): Bring this method over from KeyframeAnimation.
3334         (WebCore::KeyframeEffectReadOnly::computeTransformedExtentViaMatrix const): Bring this method over from KeyframeAnimation.
3335         * animation/KeyframeEffectReadOnly.h:
3336         (WebCore::KeyframeEffectReadOnly::animatedProperties const): DocumentTimeline::computeExtentOfAnimation() needs to get a list
3337         of all animated properties to see if a transform is animated, so we now expose such a list.
3338         * rendering/RenderLayer.cpp:
3339         (WebCore::RenderLayer::currentTransform const): Update this method to call into DocumentTimeline if the CSS Animations
3340         and CSS Transitions as Web Animations flag is on.
3341         (WebCore::RenderLayer::calculateClipRects const): Update this method to call into DocumentTimeline if the CSS Animations
3342         and CSS Transitions as Web Animations flag is on.
3343         * rendering/RenderLayerBacking.cpp:
3344         (WebCore::RenderLayerBacking::updateGeometry): Update this method to call into DocumentTimeline if the CSS Animations
3345         and CSS Transitions as Web Animations flag is on.
3346         * rendering/RenderLayerCompositor.cpp:
3347         (WebCore::RenderLayerCompositor::isRunningTransformAnimation const): Update this method to call into DocumentTimeline
3348         if the CSS Animations and CSS Transitions as Web Animations flag is on.
3349         * rendering/RenderObject.h:
3350         (WebCore::RenderObject::documentTimeline const):
3351
3352 2018-04-11  Antoine Quint  <graouts@apple.com>
3353
3354         [Web Animations] Enable seeking for hardware animations
3355         https://bugs.webkit.org/show_bug.cgi?id=184518
3356
3357         Reviewed by Dean Jackson.
3358
3359         Hardware animations had lagged behind software animations in support and this patch bring their respective level
3360         of support closer to one another. Importantly, we add the ability to seek an animation added to a GraphicsLayerCA
3361         since many tests pause and seek animations to test their state. Animations may also have their playback state changed
3362         along with their current time in the same run loop, so we now maintain a list of pending processing actions for
3363         hardware animations.
3364
3365         * animation/DocumentTimeline.cpp:
3366         (WebCore::DocumentTimeline::updateAnimationSchedule): If we have animations queued up for updates to their accelerated
3367         state we can schedule animation resolution immediately since we've already established we'll have work to do.
3368         (WebCore::DocumentTimeline::updateAnimations): Factor the updates of pending accelerated animations out in a dedicated
3369         method.
3370         (WebCore::DocumentTimeline::applyPendingAcceleratedAnimations): Go through all pending accelerated animations and update
3371         their state.
3372         * animation/KeyframeEffectReadOnly.cpp:
3373         (WebCore::KeyframeEffectReadOnly::setBlendingKeyframes): Update the m_shouldRunAccelerated flag when setting blending keyframes.
3374         (WebCore::KeyframeEffectReadOnly::apply): Ensure we finish accelerated animations if the progress is 1 or null (no longer active).
3375         start accelerated animations if the animation is starting and always resolve styles in software as well to ensure that
3376         hit testing will work as expected.
3377         (WebCore::KeyframeEffectReadOnly::computeShouldRunAccelerated):
3378         (WebCore::KeyframeEffectReadOnly::animationPlayStateDidChange): Called by WebAnimation when play() or pause() is called
3379         with the appropriate flag.
3380         (WebCore::KeyframeEffectReadOnly::animationDidSeek): Called by WebAnimation when the currentTime property is set.
3381         (WebCore::KeyframeEffectReadOnly::addPendingAcceleratedAction): Add the provided action to the list of pending accelerated
3382         actions and notify the animation that the accelerated state needs changing.
3383         (WebCore::KeyframeEffectReadOnly::applyPendingAcceleratedActions): Called by DocumentTimeline, through WebAnimation, to apply
3384         all pending accelerated actions.
3385         (WebCore::KeyframeEffectReadOnly::backingAnimationForCompositedRenderer const): If we're dealing with a declarative animation,
3386         we already have a backing Animation object, so use it directly. Otherwise, create one and ensure it reflects all timing properties
3387         for the animation.
3388         (WebCore::KeyframeEffectReadOnly::shouldRunAccelerated): Deleted.
3389         (WebCore::KeyframeEffectReadOnly::startOrStopAccelerated): Deleted.
3390         * animation/WebAnimation.cpp:
3391         (WebCore::WebAnimation::setCurrentTime): Call animationDidSeek() on the effect to ensure its accelerated animation gets seeked.
3392         (WebCore::WebAnimation::play): Call animationPlayStateDidChange() on the effect to ensure its accelerated animation is started or resumed.
3393         (WebCore::WebAnimation::pause): Call animationPlayStateDidChange() on the effect to ensure its accelerated animation gets paused.
3394         (WebCore::WebAnimation::acceleratedStateDidChange): 
3395         (WebCore::WebAnimation::applyPendingAcceleratedActions):
3396         (WebCore::WebAnimation::acceleratedRunningStateDidChange): Deleted.
3397         (WebCore::WebAnimation::startOrStopAccelerated): Deleted.
3398         * platform/graphics/GraphicsLayer.h:
3399         (WebCore::GraphicsLayer::seekAnimation):
3400         * platform/graphics/ca/GraphicsLayerCA.cpp:
3401         (WebCore::GraphicsLayerCA::addProcessingActionForAnimation): Add an AnimationProcessingAction to the list of such actions for a
3402         given animation name. In case we already have a Remove action, we ignore the action since the hardware animation will have been
3403         removed by the time we try to apply this processing action.
3404         (WebCore::GraphicsLayerCA::pauseAnimation): Add a Pause processing action.
3405         (WebCore::GraphicsLayerCA::seekAnimation): Add a Seek processing action.
3406         (WebCore::GraphicsLayerCA::removeAnimation): Add a Remove processing action.
3407         (WebCore::GraphicsLayerCA::updateAnimations): First ensure that all animations pending commit are committed and then update
3408         all animations based on the actions added through addProcessingActionForAnimation().
3409         (WebCore::GraphicsLayerCA::seekCAAnimationOnLayer): Generate a new animation based on the new seek time provided.
3410         * platform/graphics/ca/GraphicsLayerCA.h:
3411         (WebCore::GraphicsLayerCA::AnimationProcessingAction::AnimationProcessingAction):
3412         * rendering/RenderBoxModelObject.cpp:
3413         (WebCore::RenderBoxModelObject::animationSeeked):
3414         * rendering/RenderLayerBacking.cpp:
3415         (WebCore::RenderLayerBacking::animationSeeked):
3416         * rendering/RenderLayerCompositor.cpp:
3417         (WebCore::RenderLayerCompositor::requiresCompositingForAnimation const): Fix an issue where we would run the CSSAnimationController
3418         logic even when the legacy animation engine was disabled.
3419
3420 2018-04-12  Xabier Rodriguez Calvar  <calvaris@igalia.com>
3421
3422         Unreviewed, fix GStreamer builds
3423
3424         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:
3425         (WebCore::MediaPlayerPrivateGStreamer::handleMessage): We were
3426         passing a String to a GST_WARNING call.
3427
3428 2018-04-11  Chris Dumez  <cdumez@apple.com>
3429
3430         input.webkitEntries does not work as expected when folder contains accented chars
3431         https://bugs.webkit.org/show_bug.cgi?id=184517
3432         <rdar://problem/39265537>
3433
3434         Reviewed by Ryosuke Niwa.
3435
3436         Use String::fromUTF8() to construct a WTF String from the char* returned by
3437         dirname() in FileSystem::directoryName(). Previously, we were just calling
3438         the String constructor, which would treat the input as latin 1 instead of
3439         UTF-8.
3440
3441         Test: fast/forms/file/entries-api/webkitEntries-nonascii-folder-name.html
3442
3443         * platform/posix/FileSystemPOSIX.cpp:
3444         (WebCore::FileSystem::directoryName):
3445
3446 2018-04-11  Youenn Fablet  <youenn@apple.com>
3447
3448         Preventively expect UTF8 strings from libwebrtc SDP and error messages
3449         https://bugs.webkit.org/show_bug.cgi?id=184509
3450
3451         Reviewed by Eric Carlson.
3452
3453         Make WebCore code expect any libwebrtc string to contain UTF-8.
3454         Currently SDPs do not contain any UTF-8 specific character
3455         but https://tools.ietf.org/html/rfc4566 allows it.
3456
3457         Add Internals API to set track id so that we can inject UTF-8 inside some WebRTC tests.
3458         Test: webrtc/utf8-sdp.html
3459
3460         * Modules/mediastream/MediaStreamTrack.h:
3461         (WebCore::MediaStreamTrack::setIdForTesting):
3462         * Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.cpp:
3463         (WebCore::fromStdString):
3464         (WebCore::fromSessionDescription):
3465         (WebCore::LibWebRTCMediaEndpoint::doSetLocalDescription):
3466         (WebCore::LibWebRTCMediaEndpoint::doSetRemoteDescription):
3467         (WebCore::LibWebRTCMediaEndpoint::mediaStreamFromRTCStream):
3468         (WebCore::LibWebRTCMediaEndpoint::addRemoteTrack):
3469         (WebCore::LibWebRTCMediaEndpoint::addDataChannel):
3470         (WebCore::LibWebRTCMediaEndpoint::OnIceCandidate):
3471         (WebCore::LibWebRTCMediaEndpoint::createSessionDescriptionSucceeded):
3472         (WebCore::LibWebRTCMediaEndpoint::createSessionDescriptionFailed):
3473         (WebCore::LibWebRTCMediaEndpoint::setLocalSessionDescriptionFailed):
3474         (WebCore::LibWebRTCMediaEndpoint::setRemoteSessionDescriptionFailed):
3475         (WebCore::trackId): Deleted.
3476         * Modules/mediastream/libwebrtc/LibWebRTCPeerConnectionBackend.cpp:
3477         (WebCore::fromStdString):
3478         (WebCore::LibWebRTCPeerConnectionBackend::doAddIceCandidate):
3479         (WebCore::createReceiverForSource):
3480         * platform/mediastream/MediaStreamTrackPrivate.h:
3481         (WebCore::MediaStreamTrackPrivate::setIdForTesting):
3482         * testing/Internals.cpp:
3483         (WebCore::Internals::setMediaStreamTrackIdentifier):
3484         * testing/Internals.h:
3485         * testing/Internals.idl:
3486
3487 2018-04-11  Said Abou-Hallawa  <sabouhallawa@apple.com>
3488
3489         Cache glyphs (using display lists) when painting at high frequency
3490         https://bugs.webkit.org/show_bug.cgi?id=178750
3491         <rdar://problem/35201729>
3492
3493         Reviewed by Antti Koivisto.
3494
3495         This patch adds support for caching of glyph drawing commands when painting
3496         at high frequency. Caching the glyph drawing will be done using DisplayLists.
3497
3498         GlyphDisplayListCache is basically a hash map which maps InlineTextBox
3499         or SimpleLineLayout::Run to DisplayList. Before adding a new entry to it
3500         we have to check whether the conditions for caching the glyph DisplayList
3501         are met or not. If no entry is found for a given run, a new DisplayList
3502         is created and a new entry is add to the cache.
3503
3504         * WebCore.xcodeproj/project.pbxproj:
3505         * page/MemoryRelease.cpp:
3506         (WebCore::releaseNoncriticalMemory): Make GlyphDisplayListCache respond
3507         to memory pressure.
3508
3509         * platform/graphics/FontCascade.cpp:
3510         (WebCore::FontCascade::displayListForTextRun const):
3511         * platform/graphics/FontCascade.h:
3512         (WebCore::FontCascade::displayListForTextRun):
3513         Record the drawing of a glyph run into a DisplayList.
3514
3515         * rendering/GlyphDisplayListCache.h: Added.
3516         (WebCore::GlyphDisplayListCache::singleton):
3517         (WebCore::GlyphDisplayListCache::get):
3518         (WebCore::GlyphDisplayListCache::remove):
3519         (WebCore::GlyphDisplayListCache::clear):
3520         (WebCore::GlyphDisplayListCache::size const):
3521         (WebCore::GlyphDisplayListCache::sizeInBytes const):
3522         A simple cache for the TextRun DisplayList. Adding a new entry in the
3523         cache happens under restricted conditions. So this cache is not expected
3524         to grow much.
3525
3526         * rendering/InlineTextBox.cpp:
3527         (WebCore::InlineTextBox::~InlineTextBox):
3528         (WebCore::InlineTextBox::paint):
3529         (WebCore::InlineTextBox::paintMarkedTexts):
3530         (WebCore::InlineTextBox::paintMarkedTextBackground):
3531         (WebCore::InlineTextBox::paintMarkedTextForeground):
3532         (WebCore::InlineTextBox::paintMarkedTextDecoration):
3533         (WebCore::InlineTextBox::paintCompositionBackground):
3534         (WebCore::InlineTextBox::paintCompositionUnderlines const):
3535         (WebCore::InlineTextBox::paintCompositionUnderline const):
3536         * rendering/InlineTextBox.h:
3537         (WebCore::InlineTextBox::paintMarkedTexts):
3538         InlineTextBox::paintMarkedTextForeground() now requires PaintInfo to know
3539         whether the entry in the GlyphDisplayListCache should be removed or not.
3540         Change all the GraphicsContext arguments to be PaintInfo.
3541
3542         * rendering/SimpleLineLayout.cpp:
3543         (WebCore::SimpleLineLayout::Layout::~Layout):
3544         * rendering/SimpleLineLayout.h:
3545         * rendering/SimpleLineLayoutFunctions.cpp:
3546         (WebCore::SimpleLineLayout::paintFlow):
3547         (WebCore::SimpleLineLayout::simpleLineLayoutWillBeDeleted):
3548         * rendering/SimpleLineLayoutFunctions.h:
3549         * rendering/SimpleLineLayoutResolver.h:
3550         (WebCore::SimpleLineLayout::RunResolver::Run::simpleRun const):
3551         Implement the glyph caching for SimpleLineLayout::Run.
3552
3553         * rendering/TextPainter.cpp:
3554         (WebCore::TextPainter::paintTextOrEmphasisMarks): If the DisplayList is
3555         available, replay it back into the GraphicsContext. Make sure to reset to
3556         the DisplayList pointer to nullptr after painting.
3557
3558         (WebCore::TextPainter::clearGlyphDisplayLists):
3559         (WebCore::TextPainter::shouldUseGlyphDisplayList): Check whether we should
3560         use DisplayList to the draw glyph run.
3561
3562         * rendering/TextPainter.h:
3563         (WebCore::TextPainter::setGlyphDisplayListIfNeeded): Check whether we should
3564         should use DisplayList to the draw glyph run and if we should, ensure first
3565         the DisplayList is cached and set it in the TextPainter so it uses it when
3566         the run is painted.
3567
3568         (WebCore::TextPainter::removeGlyphDisplayList): Remove the cached DisplayList
3569         entry for a glyph layout run.
3570
3571 2018-04-11  Brent Fulgham  <bfulgham@apple.com>
3572
3573         GraphicsLayerCA::createPlatformCALayer always disables extended color in its backing store
3574         https://bugs.webkit.org/show_bug.cgi?id=184367
3575         <rdar://problem/39249074>
3576
3577         Reviewed by Simon Fraser.
3578
3579         'createPlatformCALayer' always passes a nil widget, which early returns from 'screenSupportsExtendedColor'
3580         with false. Instead, we should just pass the widget (nil or not) to the screen properties methods,
3581         which will use the primary screen if no screen is specified. I.e., we shouldn't do an early return
3582         here if the passed widget is nil.
3583
3584         * platform/mac/PlatformScreenMac.mm:
3585         (WebCore::screenSupportsExtendedColor):
3586
3587 2018-04-11  Youenn Fablet  <youenn@apple.com>
3588
3589         Pass FetchOptions and SecurityOrigin as load parameters from WebProcess to NetworkProcess
3590         https://bugs.webkit.org/show_bug.cgi?id=184374
3591
3592         Reviewed by Chris Dumez.
3593
3594         Add support for SecurityOrigin encode/decode routines.
3595
3596         * page/SecurityOrigin.h:
3597
3598 2018-04-11  Thibault Saunier  <tsaunier@igalia.com>
3599
3600         [GStreamer] Use of playbin3 when USE_PLAYBIN3 environment variable is set
3601         https://bugs.webkit.org/show_bug.cgi?id=184498
3602
3603         Reviewed by Philippe Normand.
3604
3605         [GStreamer] Use of playbin3 when USE_PLAYBIN3 environment variable is set
3606
3607         This is the same behaviour as with playbin itself.
3608
3609         Make sure to keep using "playbin" for MediaSource.
3610
3611         No test added as this is basically a small rework of the way we expose a feature.
3612
3613         * platform/graphics/gstreamer/AudioTrackPrivateGStreamer.cpp:
3614         * platform/graphics/gstreamer/AudioTrackPrivateGStreamer.h:
3615         * platform/graphics/gstreamer/GRefPtrGStreamer.cpp:
3616         * platform/graphics/gstreamer/GRefPtrGStreamer.h:
3617         * platform/graphics/gstreamer/InbandTextTrackPrivateGStreamer.cpp:
3618         * platform/graphics/gstreamer/InbandTextTrackPrivateGStreamer.h:
3619         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:
3620         (WebCore::MediaPlayerPrivateGStreamer::load):
3621         (WebCore::MediaPlayerPrivateGStreamer::enableTrack):
3622         (WebCore::MediaPlayerPrivateGStreamer::handleMessage):
3623         (WebCore::MediaPlayerPrivateGStreamer::createGSTPlayBin):
3624         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.h:
3625         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.h:
3626         * platform/graphics/gstreamer/TrackPrivateBaseGStreamer.cpp:
3627         (WebCore::TrackPrivateBaseGStreamer::disconnect):
3628         (WebCore::TrackPrivateBaseGStreamer::tagsChanged):
3629         * platform/graphics/gstreamer/TrackPrivateBaseGStreamer.h:
3630         * platform/graphics/gstreamer/VideoTrackPrivateGStreamer.cpp:
3631         * platform/graphics/gstreamer/VideoTrackPrivateGStreamer.h:
3632
3633 2018-04-10  Alex Christensen  <achristensen@webkit.org>
3634
3635         IDN spoofing with Hebrew combining characters
3636         https://bugs.webkit.org/show_bug.cgi?id=184472
3637         <rdar://problem/39148687>
3638
3639         Reviewed by Brent Fulgham.
3640
3641         Covered by new API tests.
3642
3643         * platform/mac/WebCoreNSURLExtras.mm:
3644         (WebCore::isLookalikeCharacter):
3645         Punycode-encode hosts with Hebrew combining marks that look like dots
3646         and Vav with a combining dot above like we do with dotless i and j.
3647
3648 2018-04-11  Brent Fulgham  <bfulgham@apple.com>
3649
3650         Show punycode if URL contains Latin dum character
3651         https://bugs.webkit.org/show_bug.cgi?id=184477
3652         <rdar://problem/39121999>
3653
3654         Reviewed by David Kilzer.
3655
3656         Revise our "lookalike character" logic to include the small
3657         Latin dum character.
3658
3659         Test: fast/url/host.html
3660
3661         * platform/mac/WebCoreNSURLExtras.mm:
3662         (WebCore::isLookalikeCharacter):
3663
3664 2018-04-11  Michael Catanzaro  <mcatanzaro@igalia.com>
3665
3666         [GTK] WaylandCompositorDisplay leaks its wl_display
3667         https://bugs.webkit.org/show_bug.cgi?id=184406
3668
3669         Reviewed by Carlos Garcia Campos.
3670
3671         Well, this was harder than expected. We really just want to fix a small leak in the WebKit
3672         layer, but that requires a change in how WaylandCompositorDisplay calls the
3673         PlatformDisplayWayland constructor, to pass NativeDisplayOwned::Yes. That means
3674         WaylandCompositorDisplay can no longer use PlatformDisplayWayland's protected default
3675         constructor. Problem is that the normal PlatformDisplayWayland constructor calls
3676         PlatformDisplayWayland::initialize, which calls PlatformDisplayWayland::registryGlobal,
3677         which is a virtual function. The WaylandCompositorDisplay portion of the object is not
3678         constructed yet at this point, so WaylandCompositorDisplay::registryGlobal will never be
3679         called if we do that. I had to revert the previous version of this fix due to this problem.
3680         It had broken accelerated compositing.
3681
3682         I'm reminded of Effective C++ item #9: Never call virtual functions during construction or
3683         destruction ("because such calls will never go to a more derived class than that of the
3684         currently executing constructor or destructor"). This code is fragile and likely to break
3685         again in the future, so let's refactor it a bit. Instead of calling initialize in the
3686         constructor, we'll call it from create functions. We'll have to add a couple create
3687         functions, and make the constructor protected to ensure it's not possible to create a
3688         PlatformDisplayWayland without initializing it. For good parallelism, do the same for the
3689         other PlatformDisplay classes.
3690
3691         This commit additionally removes PlatformDisplayWayland's protected default constructor,
3692         since it's not needed anymore.
3693
3694         The NativeDisplayOwned arguments to the PlatformDisplay constructors are now mandatory,
3695         instead of using NativeDisplayOwned::No as the default value, since that was dangerously
3696         close to being the cause of this leak, and the constructors are now accessed from private
3697         create functions anyway. Some more caution when using default parameter values is warranted
3698         in the future.
3699
3700         Lastly, since we have to change PlatformDisplay::createPlatformDisplay to use the new create
3701         functions, take the opportunity to move things around a bit for clarity. There should be no
3702         change in behavior. I was just disappointed that the PlatformDisplayWPE creation was at the
3703         bottom of the function, after a comment indicating that normal display creation has failed,
3704         which is not the case for WPE.
3705
3706         This all might have been a bit overkill, since the leak could probably have been fixed by
3707         passing nullptr to the PlatformDisplayWayland constructor for the wl_display and not
3708         removing WaylandCompositorDisplay's call to PlatformDisplayWayland::initialize. But the
3709         correctness of that code would then rely on implementation details of initialize, so this
3710         refactor seems better.
3711
3712         No new tests since there *should* be no behavior change. Then again, I'm touching
3713         PlatformDisplay, and history shows we don't have the greatest track record of touching this
3714         code without introducing problems.
3715
3716         * platform/graphics/PlatformDisplay.cpp:
3717         (WebCore::PlatformDisplay::createPlatformDisplay):
3718         * platform/graphics/PlatformDisplay.h:
3719         * platform/graphics/wayland/PlatformDisplayWayland.cpp:
3720         (WebCore::PlatformDisplayWayland::create):
3721         (WebCore::PlatformDisplayWayland::create):
3722         (WebCore::PlatformDisplayWayland::createHeadless):
3723         (WebCore::PlatformDisplayWayland::PlatformDisplayWayland):
3724         (WebCore::PlatformDisplayWayland::initialize):
3725         * platform/graphics/wayland/PlatformDisplayWayland.h:
3726         * platform/graphics/win/PlatformDisplayWin.h:
3727         * platform/graphics/wpe/PlatformDisplayWPE.cpp:
3728         (WebCore::create):
3729         * platform/graphics/wpe/PlatformDisplayWPE.h:
3730         * platform/graphics/x11/PlatformDisplayX11.cpp:
3731         (WebCore::PlatformDisplayX11::create):
3732         (WebCore::PlatformDisplayX11::create):
3733         (WebCore::PlatformDisplayX11::createHeadless):
3734         * platform/graphics/x11/PlatformDisplayX11.h:
3735
3736 2018-04-11  Jianjun Zhu  <jianjun.zhu@intel.com>
3737
3738         Fix a WebRTC data channel issue for non-ASCII characters.
3739
3740         At the sender side, buffer size are calulcated after UTF8 encoding. At the
3741         receiver side, strings are constructed with UTF8 data.
3742
3743         https://bugs.webkit.org/show_bug.cgi?id=184481
3744
3745         Reviewed by Youenn Fablet.
3746
3747         Updated test:
3748         LayoutTests/imported/w3c/web-platform-tests/webrtc/RTCDataChannel-send-expected.txt
3749
3750         * Modules/mediastream/libwebrtc/LibWebRTCDataChannelHandler.cpp:
3751         (WebCore::LibWebRTCDataChannelHandler::sendStringData):
3752         (WebCore::LibWebRTCDataChannelHandler::OnMessage):
3753
3754 2018-04-11  Antti Koivisto  <antti@apple.com>
3755
3756         ImageFrame type used by non-Cocoa image decoder should not be the same as that used by ImageSource
3757         https://bugs.webkit.org/show_bug.cgi?id=184418
3758
3759         Reviewed by Said Abou-Hallawa.
3760
3761         ScalableImageDecoder uses ImageFrame class which is meant to be an implementation detail of ImageSource.
3762         There are bunch of fields and methods in the type that are only used by one or the other client. For hackability
3763         there should be an unrelated frame type for ScalableImageDecoder.
3764
3765         This patch adds ScalableImageDecoderFrame type used in ScalableImageDecoder only. It then cleans up
3766         unneeded things from both ImageFrame and ScalableImageDecoderFrame.
3767
3768         * platform/ImageDecoders.cmake:
3769         * platform/graphics/ImageFrame.cpp:
3770         (WebCore::ImageFrame::operator=):
3771         (WebCore::ImageFrame::clearImage):
3772         (WebCore::ImageFrame::size const):
3773         (WebCore::ImageFrame::initialize): Deleted.
3774         * platform/graphics/ImageFrame.h:
3775         (WebCore::ImageFrame::setDisposalMethod): Deleted.
3776         (WebCore::ImageFrame::disposalMethod const): Deleted.
3777         (WebCore::ImageFrame::backingStore const): Deleted.
3778         (WebCore::ImageFrame::hasBackingStore const): Deleted.
3779         * platform/image-decoders/ScalableImageDecoder.cpp:
3780         (WebCore::ScalableImageDecoder::frameIsCompleteAtIndex const):
3781         (WebCore::ScalableImageDecoder::frameDurationAtIndex const):
3782         (WebCore::ScalableImageDecoder::createFrameImageAtIndex):
3783         * platform/image-decoders/ScalableImageDecoder.h:
3784         * platform/image-decoders/ScalableImageDecoderFrame.cpp: Copied from Source/WebCore/platform/graphics/ImageFrame.cpp.
3785         (WebCore::ScalableImageDecoderFrame::ScalableImageDecoderFrame):
3786         (WebCore::ScalableImageDecoderFrame::~ScalableImageDecoderFrame):
3787         (WebCore::ScalableImageDecoderFrame::operator=):
3788         (WebCore::ScalableImageDecoderFrame::setDecodingStatus):
3789         (WebCore::ScalableImageDecoderFrame::decodingStatus const):
3790         (WebCore::ScalableImageDecoderFrame::clearImage):
3791         (WebCore::ScalableImageDecoderFrame::clear):
3792         (WebCore::ScalableImageDecoderFrame::initialize):
3793         (WebCore::ScalableImageDecoderFrame::size const):
3794         (WebCore::ImageFrame::ImageFrame): Deleted.
3795         (WebCore::ImageFrame::~ImageFrame): Deleted.
3796         (WebCore::ImageFrame::defaultFrame): Deleted.
3797         (WebCore::ImageFrame::operator=): Deleted.
3798         (WebCore::ImageFrame::setDecodingStatus): Deleted.
3799         (WebCore::ImageFrame::decodingStatus const): Deleted.
3800         (WebCore::ImageFrame::clearImage): Deleted.
3801         (WebCore::ImageFrame::clear): Deleted.
3802         (WebCore::ImageFrame::initialize): Deleted.
3803         (WebCore::ImageFrame::size const): Deleted.
3804         (WebCore::ImageFrame::hasNativeImage const): Deleted.
3805         (WebCore::ImageFrame::hasFullSizeNativeImage const): Deleted.
3806         (WebCore::ImageFrame::hasDecodedNativeImageCompatibleWithOptions const): Deleted.
3807         (WebCore::ImageFrame::singlePixelSolidColor const): Deleted.
3808         * platform/image-decoders/ScalableImageDecoderFrame.h: Copied from Source/WebCore/platform/graphics/ImageFrame.h.
3809         (WebCore::ScalableImageDecoderFrame::ScalableImageDecoderFrame):
3810         (WebCore::ScalableImageDecoderFrame::disposalMethod const):
3811         (WebCore::ScalableImageDecoderFrame::hasAlpha const):
3812         (WebCore::ScalableImageDecoderFrame::hasBackingStore const):
3813         (WebCore::ImageFrame::ImageFrame): Deleted.
3814         (WebCore::ImageFrame::isInvalid const): Deleted.
3815         (WebCore::ImageFrame::isPartial const): Deleted.
3816         (WebCore::ImageFrame::isComplete const): Deleted.
3817         (WebCore::ImageFrame::sizeRespectingOrientation const): Deleted.
3818         (WebCore::ImageFrame::frameBytes const): Deleted.
3819         (WebCore::ImageFrame::subsamplingLevel const): Deleted.
3820         (WebCore::ImageFrame::setDisposalMethod): Deleted.
3821         (WebCore::ImageFrame::disposalMethod const): Deleted.
3822         (WebCore::ImageFrame::nativeImage const): Deleted.
3823         (WebCore::ImageFrame::setOrientation): Deleted.
3824         (WebCore::ImageFrame::orientation const): Deleted.
3825         (WebCore::ImageFrame::setDuration): Deleted.
3826         (WebCore::ImageFrame::duration const): Deleted.
3827         (WebCore::ImageFrame::setHasAlpha): Deleted.
3828         (WebCore::ImageFrame::hasAlpha const): Deleted.
3829         (WebCore::ImageFrame::hasNativeImage): Deleted.
3830         (WebCore::ImageFrame::hasFullSizeNativeImage): Deleted.
3831         (WebCore::ImageFrame::hasMetadata const): Deleted.
3832         (WebCore::ImageFrame::backingStore const): Deleted.
3833         (WebCore::ImageFrame::hasBackingStore const): Deleted.
3834         * platform/image-decoders/bmp/BMPImageDecoder.cpp:
3835         (WebCore::BMPImageDecoder::frameBufferAtIndex):
3836         * platform/image-decoders/bmp/BMPImageDecoder.h:
3837         * platform/image-decoders/bmp/BMPImageReader.h:
3838         (WebCore::BMPImageReader::setBuffer):
3839         * platform/image-decoders/gif/GIFImageDecoder.cpp:
3840         (WebCore::GIFImageDecoder::findFirstRequiredFrameToDecode):
3841         (WebCore::GIFImageDecoder::frameBufferAtIndex):
3842         (WebCore::GIFImageDecoder::clearFrameBufferCache):
3843         (WebCore::GIFImageDecoder::haveDecodedRow):
3844         (WebCore::GIFImageDecoder::frameComplete):
3845         (WebCore::GIFImageDecoder::initFrameBuffer):
3846         * platform/image-decoders/gif/GIFImageDecoder.h:
3847         * platform/image-decoders/gif/GIFImageReader.cpp:
3848         (GIFImageReader::parse):
3849         * platform/image-decoders/gif/GIFImageReader.h:
3850         (GIFFrameContext::GIFFrameContext):
3851         * platform/image-decoders/ico/ICOImageDecoder.cpp:
3852         (WebCore::ICOImageDecoder::frameBufferAtIndex):
3853         * platform/image-decoders/ico/ICOImageDecoder.h:
3854         * platform/image-decoders/jpeg/JPEGImageDecoder.cpp:
3855         (WebCore::JPEGImageDecoder::frameBufferAtIndex):
3856         (WebCore::setPixel):
3857         (WebCore::JPEGImageDecoder::outputScanlines):
3858         (WebCore::JPEGImageDecoder::jpegComplete):
3859         * platform/image-decoders/jpeg/JPEGImageDecoder.h:
3860         * platform/image-decoders/png/PNGImageDecoder.cpp:
3861         (WebCore::PNGImageDecoder::frameBufferAtIndex):
3862         (WebCore::PNGImageDecoder::rowAvailable):
3863         (WebCore::PNGImageDecoder::readChunks):
3864         (WebCore::PNGImageDecoder::clearFrameBufferCache):
3865         (WebCore::PNGImageDecoder::initFrameBuffer):
3866         (WebCore::PNGImageDecoder::frameComplete):
3867         * platform/image-decoders/png/PNGImageDecoder.h:
3868         * platform/image-decoders/webp/WEBPImageDecoder.cpp:
3869         (WebCore::WEBPImageDecoder::frameBufferAtIndex):
3870         (WebCore::WEBPImageDecoder::findFirstRequiredFrameToDecode):
3871         (WebCore::WEBPImageDecoder::decodeFrame):
3872         (WebCore::WEBPImageDecoder::initFrameBuffer):
3873         (WebCore::WEBPImageDecoder::applyPostProcessing):
3874         (WebCore::WEBPImageDecoder::clearFrameBufferCache):
3875         * platform/image-decoders/webp/WEBPImageDecoder.h:
3876
3877 2018-04-11  Antoine Quint  <graouts@apple.com>
3878
3879         [Web Animations] Turn Web Animations on by default
3880         https://bugs.webkit.org/show_bug.cgi?id=184491
3881
3882         Reviewed by Simon Fraser.
3883
3884         * page/RuntimeEnabledFeatures.h:
3885
3886 2018-04-11  Ryosuke Niwa  <rniwa@webkit.org>
3887
3888         Fix warning in HashTools.h for newer versions of clang
3889         https://bugs.webkit.org/show_bug.cgi?id=184489
3890
3891         Reviewed by Alexey Proskuryakov.
3892
3893         Removed "register" storage class specififer as it has been deprecated in C++11.
3894
3895         * platform/HashTools.h:
3896
3897 2018-04-10  Wenson Hsieh  <wenson_hsieh@apple.com>
3898
3899         FrameSelection::appearanceUpdateTimerFired should be robust against layout passes underneath it
3900         https://bugs.webkit.org/show_bug.cgi?id=183395
3901         <rdar://problem/38055732>
3902
3903         Reviewed by Zalan Bujtas.
3904
3905         In the case where a FrameSelection updates its appearance when m_appearanceUpdateTimer is fired, the
3906         FrameSelection's Frame is unprotected, and can be removed by arbitrary script. This patch applies a simple
3907         mitigation by wrapping the Frame in a Ref when firing the appearance update timer.
3908
3909         Test: editing/selection/iframe-update-selection-appearance.html
3910
3911         * editing/FrameSelection.cpp:
3912         (WebCore::FrameSelection::appearanceUpdateTimerFired):
3913
3914 2018-04-10  Brent Fulgham  <bfulgham@apple.com>
3915
3916         Unreviewed follow-up to r230468.
3917
3918         Switch some RELEASE_ASSERTs in hot codepaths to normal DEBUG asserts.
3919
3920         * page/mac/EventHandlerMac.mm:
3921         (WebCore::lastEventIsMouseUp):
3922         (WebCore::EventHandler::sendFakeEventsAfterWidgetTracking):
3923         * platform/mac/EventLoopMac.mm:
3924         (WebCore::EventLoop::cycle):
3925
3926 2018-04-10  Wenson Hsieh  <wenson_hsieh@apple.com>
3927
3928         Unreviewed, fix the iOS build
3929
3930         I accidentally exported an inline function in r230506.
3931
3932         * page/ViewportConfiguration.h:
3933         (WebCore::ViewportConfiguration::viewSize const):
3934
3935 2018-04-10  Nan Wang  <n_wang@apple.com>
3936
3937         AX: Expose strong password fields on iOS