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