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