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