168a26ea554d6be7b21456a8d313853ae4988460
[WebKit-https.git] / Source / WebCore / ChangeLog
1 2018-02-05  Matt Lewis  <jlewis3@apple.com>
2
3         Unreviewed, rolling out r228086.
4
5         This introduced a failure with API test
6         URLTest.HostIsIPAddress.
7
8         Reverted changeset:
9
10         "Add a way to check if a host is an IP address"
11         https://bugs.webkit.org/show_bug.cgi?id=182427
12         https://trac.webkit.org/changeset/228086
13
14 2018-02-05  Matt Lewis  <jlewis3@apple.com>
15
16         Unreviewed, rolling out r228103.
17
18         This caused multiple tests to crash.
19
20         Reverted changeset:
21
22         "Use downcast in createLinkPreloadResourceClient"
23         https://bugs.webkit.org/show_bug.cgi?id=182488
24         https://trac.webkit.org/changeset/228103
25
26 2018-02-05  Eric Carlson  <eric.carlson@apple.com>
27
28         [iOS] VideoFullscreenInterfaceAVKit should not ignore errors
29         https://bugs.webkit.org/show_bug.cgi?id=182497
30         <rdar://problem/36986898>
31
32         Reviewed by Jer Noble.
33         
34         Always call layoutIfNeeded before calling -[AVPlayerViewController enterFullScreenAnimated:completionHandler]
35         or -[AVPlayerViewController exitFullScreenAnimated:completionHandler] because they both fail
36         if the view needs layout. Also don't ignore errors returned by those calls.
37
38         No new tests, the failure is non deterministic and I was not able to reproduce in a test.
39
40         * platform/ios/VideoFullscreenInterfaceAVKit.mm:
41         (VideoFullscreenInterfaceAVKit::applicationDidBecomeActive):
42         (VideoFullscreenInterfaceAVKit::enterFullscreenStandard):
43         (VideoFullscreenInterfaceAVKit::exitFullscreen):
44         (VideoFullscreenInterfaceAVKit::cleanupFullscreen):
45         (VideoFullscreenInterfaceAVKit::didStartPictureInPicture):
46         (VideoFullscreenInterfaceAVKit::prepareForPictureInPictureStopWithCompletionHandler):
47         (VideoFullscreenInterfaceAVKit::doEnterFullscreen):
48         (VideoFullscreenInterfaceAVKit::exitFullscreenHandler):
49         (VideoFullscreenInterfaceAVKit::enterFullscreenHandler):
50
51 2018-02-05  Daniel Bates  <dabates@apple.com>
52
53         REGRESSION (r222795): Nike app "Refused to set unsafe header" when adding and viewing cart
54         https://bugs.webkit.org/show_bug.cgi?id=182491
55         <rdar://problem/36533447>
56
57         Reviewed by Brent Fulgham.
58
59         Exempt Nike from the XHR header restrictions in r222795.
60
61         Following r222795 only Dashboard widgets are allowed to set arbitrary XHR headers.
62         However Nike also depends on such functionality.
63
64         * platform/RuntimeApplicationChecks.h:
65         * platform/cocoa/RuntimeApplicationChecksCocoa.mm:
66         (WebCore::IOSApplication::isNike):
67
68 2018-02-02  Brent Fulgham  <bfulgham@apple.com>
69
70         Improve NetworkResourceLoader logging so it can be used for 'setCookiesFromDOM'
71         https://bugs.webkit.org/show_bug.cgi?id=182455
72         <rdar://problem/36626601>
73
74         Reviewed by Chris Dumez.
75
76         After this refactoring, a convenience method I added in r227860 is no longer needed.
77         This patch removes this dead code.
78
79         * platform/network/NetworkStorageSession.h: Export 'cookieStoragePartition' so it can
80         be used in WebKit.
81         * platform/network/cf/NetworkStorageSessionCFNet.cpp: 
82         (WebCore::NetworkStorageSession::hasStorageAccessForFrame): Deleted unused method.
83
84 2018-02-05  Antti Koivisto  <antti@apple.com>
85
86         Make ASSERT_WITH_SECURITY_IMPLICATION in CachedResourceClientWalker::next a release assert
87         https://bugs.webkit.org/show_bug.cgi?id=182492
88
89         Reviewed by Youenn Fablet.
90
91         * loader/cache/CachedResourceClientWalker.h:
92         (WebCore::CachedResourceClientWalker::next):
93
94 2018-02-05  John Wilander  <wilander@apple.com>
95
96         Storage Access API: Add testRunner.getAllStorageAccessEntries() to make testing easier and more explicit
97         https://bugs.webkit.org/show_bug.cgi?id=181601
98         <rdar://problem/36475837>
99
100         Reviewed by Alex Christensen.
101
102         No new tests. Existing test updated.
103
104         http/tests/storageAccess/request-and-grant-access-then-detach-should-not-have-access.html
105         was found to be flaky. With the testRunner.hasStorageAccessEntry() getter
106         it's possible to check access even if a frame doesn't respond timely to
107         postMessage after detach and attach.
108
109         * platform/network/NetworkStorageSession.h:
110         * platform/network/cf/NetworkStorageSessionCFNet.cpp:
111         (WebCore::NetworkStorageSession::getAllStorageAccessEntries const):
112
113 2018-02-05  Youenn Fablet  <youenn@apple.com>
114
115         Use downcast in createLinkPreloadResourceClient
116         https://bugs.webkit.org/show_bug.cgi?id=182488
117
118         Reviewed by Antti Koivisto.
119
120         No observable change of behavior.
121
122         * loader/LinkLoader.cpp:
123         (WebCore::createLinkPreloadResourceClient):
124
125 2018-02-05  Chris Dumez  <cdumez@apple.com>
126
127         Layout Test imported/w3c/web-platform-tests/service-workers/service-worker/register-same-scope-different-script-url.https.html is flaky
128         https://bugs.webkit.org/show_bug.cgi?id=181166
129         <rdar://problem/37169508>
130
131         Reviewed by Youenn Fablet.
132
133         I found out that this test was flakily timing out because our jobQueues would sometimes get stuck
134         when their current job's connection or service worker (when scheduled by a service worker) would
135         go away before the job is complete.
136
137         This patch makes our job queues operation more robust by:
138         1. Cancelling all jobs from a given connection when a SWServerConnection goes away
139         2. Cancelling all jobs from a given service worker when a service worker gets terminated
140
141         We also make sure service workers created by a job get properly terminated when a job
142         is canceled to avoid leaving service workers in limbo.
143
144         No new tests, unskipped existing flaky test.
145
146         * workers/service/ServiceWorkerContainer.cpp:
147         (WebCore::ServiceWorkerContainer::addRegistration):
148         (WebCore::ServiceWorkerContainer::removeRegistration):
149         (WebCore::ServiceWorkerContainer::updateRegistration):
150         * workers/service/ServiceWorkerJobData.cpp:
151         (WebCore::ServiceWorkerJobData::ServiceWorkerJobData):
152         (WebCore::ServiceWorkerJobData::isolatedCopy const):
153         * workers/service/ServiceWorkerJobData.h:
154         (WebCore::ServiceWorkerJobData::encode const):
155         (WebCore::ServiceWorkerJobData::decode):
156         * workers/service/server/SWServer.cpp:
157         (WebCore::SWServer::startScriptFetch):
158         (WebCore::SWServer::scriptContextFailedToStart):
159         (WebCore::SWServer::scriptContextStarted):
160         (WebCore::SWServer::terminatePreinstallationWorker):
161         (WebCore::SWServer::installContextData):
162         (WebCore::SWServer::workerContextTerminated):
163         (WebCore::SWServer::unregisterConnection):
164         * workers/service/server/SWServer.h:
165         * workers/service/server/SWServerJobQueue.cpp:
166         (WebCore::SWServerJobQueue::removeAllJobsMatching):
167         (WebCore::SWServerJobQueue::cancelJobsFromConnection):
168         (WebCore::SWServerJobQueue::cancelJobsFromServiceWorker):
169         * workers/service/server/SWServerJobQueue.h:
170         * workers/service/server/SWServerRegistration.cpp:
171         (WebCore::SWServerRegistration::setPreInstallationWorker):
172
173 2018-02-05  Antti Koivisto  <antti@apple.com>
174
175         Crash on sfgate.com because mismatching link preload types
176         https://bugs.webkit.org/show_bug.cgi?id=182483
177         <rdar://problem/37065331>
178
179         Reviewed by Daniel Bates.
180
181         Preloading the same URL with different 'as' types causes some confusion.
182
183         Test: http/tests/preload/link-preload-type-mismatch.html
184
185         * loader/LinkLoader.cpp:
186         (WebCore::createLinkPreloadResourceClient):
187
188             Ensure we use the actual resource type when creating the client.
189
190         (WebCore::LinkLoader::preloadIfNeeded):
191
192             Don't construct client if the types don't match. This can happen if there is an existing
193             preload for the same resource with different type.
194
195 2018-02-05  Manuel Rego Casasnovas  <rego@igalia.com>
196
197         [css-grid] Rename gutter properties to remove "grid-" prefix
198         https://bugs.webkit.org/show_bug.cgi?id=180290
199
200         Reviewed by Javier Fernandez.
201
202         This patch applies the resoultion of the CSS WG to unprefix
203         the CSS Grid Layout gutter properties:
204         https://github.com/w3c/csswg-drafts/issues/1696
205
206         column-gap already existed before, as it's part of Multicol.
207         The patch adds the new properties row-gap and gap, and keep the legacy ones
208         as aliases:
209         - grid-column-gap => column-gap
210         - grid-row-gap => row-gap
211         - grid-gap => gap
212
213         As column-gap was already animatable, this change takes advantage
214         to make animatable row-gap too.
215
216         Tests: imported/w3c/web-platform-tests/css/css-align/gaps/
217
218         * css/CSSComputedStyleDeclaration.cpp:
219         (WebCore::ComputedStyleExtractor::valueForPropertyinStyle):
220         * css/CSSProperties.json:
221         * css/StyleProperties.cpp:
222         * css/parser/CSSParserFastPaths.cpp:
223         (WebCore::isSimpleLengthPropertyID):
224         * css/parser/CSSPropertyParser.cpp:
225         (WebCore::CSSPropertyParser::parseSingleValue):
226         (WebCore::CSSPropertyParser::parseShorthand):
227         * page/animation/CSSPropertyAnimation.cpp:
228         (WebCore::CSSPropertyAnimationWrapperMap::CSSPropertyAnimationWrapperMap):
229         * rendering/RenderGrid.cpp:
230         (WebCore::RenderGrid::availableSpaceForGutters const):
231         (WebCore::RenderGrid::gridGap const):
232         * rendering/style/RenderStyle.h:
233         (WebCore::RenderStyle::gridAutoRows const):
234         (WebCore::RenderStyle::columnGap const):
235         (WebCore::RenderStyle::rowGap const):
236         (WebCore::RenderStyle::setGridItemRowEnd):
237         (WebCore::RenderStyle::setColumnGap):
238         (WebCore::RenderStyle::setRowGap):
239         (WebCore::RenderStyle::initialRowGap):
240         * rendering/style/StyleGridData.cpp:
241         (WebCore::StyleGridData::StyleGridData):
242         * rendering/style/StyleGridData.h:
243         (WebCore::StyleGridData::operator== const):
244         * rendering/style/StyleMultiColData.cpp:
245         (WebCore::StyleMultiColData::StyleMultiColData):
246         (WebCore::StyleMultiColData::operator== const):
247         * rendering/style/StyleMultiColData.h:
248         * rendering/style/StyleRareNonInheritedData.cpp:
249         (WebCore::StyleRareNonInheritedData::StyleRareNonInheritedData):
250         (WebCore::StyleRareNonInheritedData::operator== const):
251         * rendering/style/StyleRareNonInheritedData.h:
252
253 2018-02-05  Ms2ger  <Ms2ger@igalia.com>
254
255         Implement createImageBitmap(HTMLVideoElement)
256         https://bugs.webkit.org/show_bug.cgi?id=182388
257
258         Reviewed by Žan Doberšek.
259
260         The implementation is inspired by CanvasRenderingContext2DBase::drawImage().
261
262         Tests:
263
264         - web-platform-tests/2dcontext/imagebitmap/createImageBitmap-drawImage.html
265         - web-platform-tests/2dcontext/imagebitmap/createImageBitmap-invalid-args.html
266
267
268         * html/ImageBitmap.cpp:
269         (WebCore::taintsOrigin): Add function to help with the implementation.
270         (WebCore::ImageBitmap::createPromise): Fill in implementation.
271
272 2018-02-05  Zan Dobersek  <zdobersek@igalia.com>
273
274         Unreviewed, rolling out r228085.
275
276         Pixel data stride is imposed by OpenGL and shouldn't be
277         adjusted for Cairo
278
279         Reverted changeset:
280
281         "[Cairo] Correctly calculate stride in
282         GraphicsContext3D::paintToCanvas()"
283         https://bugs.webkit.org/show_bug.cgi?id=182466
284         https://trac.webkit.org/changeset/228085
285
286 2018-02-05  Carlos Garcia Campos  <cgarcia@igalia.com>
287
288         [SOUP] WebSockets must use system proxy settings
289         https://bugs.webkit.org/show_bug.cgi?id=126384
290
291         Reviewed by Michael Catanzaro.
292
293         Use soup_session_connect_async() when available to create the WebSockets connection instead of GSocketClient
294         directly.
295
296         * platform/network/soup/SocketStreamHandleImpl.h:
297         * platform/network/soup/SocketStreamHandleImplSoup.cpp:
298         (WebCore::wssSocketClientEventCallback):
299         (WebCore::SocketStreamHandleImpl::create):
300         (WebCore::SocketStreamHandleImpl::connected):
301         (WebCore::SocketStreamHandleImpl::connectedCallback):
302         (WebCore::SocketStreamHandleImpl::platformClose):
303
304 2018-02-05  Carlos Garcia Campos  <cgarcia@igalia.com>
305
306         Add a way to check if a host is an IP address
307         https://bugs.webkit.org/show_bug.cgi?id=182427
308
309         Reviewed by Alex Christensen.
310
311         There are several places where this is needed. We currently just assume that any host ending in a digit is an IP
312         address, except in PublicSuffix where platform specific code is used. This patch adds URL::hostIsIPAddress()
313         platform specific implementations, falling back to current assumption if there isn't an implementation for the
314         platform.
315
316         * page/OriginAccessEntry.cpp:
317         (WebCore::OriginAccessEntry::OriginAccessEntry): Use URL::hostIsIPAddress().
318         * platform/URL.cpp:
319         (WebCore::URL::hostIsIPAddress): Fallback implementation.
320         * platform/URL.h:
321         * platform/mac/PublicSuffixMac.mm:
322         (WebCore::topPrivatelyControlledDomain): Use URL::hostIsIPAddress().
323         * platform/mac/URLMac.mm:
324         (WebCore::URL::hostIsIPAddress): Move implementation from PublicSuffixMac.mm.
325         * platform/network/curl/CookieUtil.cpp:
326         (WebCore::CookieUtil::isIPAddress): Use URL::hostIsIPAddress().
327         * platform/soup/URLSoup.cpp:
328         (WebCore::URL::hostIsIPAddress): Use g_hostname_is_ip_address().
329
330 2018-02-04  Zan Dobersek  <zdobersek@igalia.com>
331
332         [Cairo] Correctly calculate stride in GraphicsContext3D::paintToCanvas()
333         https://bugs.webkit.org/show_bug.cgi?id=182466
334
335         Reviewed by Michael Catanzaro.
336
337         * platform/graphics/cairo/GraphicsContext3DCairo.cpp:
338         (WebCore::GraphicsContext3D::paintToCanvas):
339         Use cairo_format_stride_for_width() to obtain stride that Cairo thinks
340         is appropriate for the given width, taking into account internal
341         alignment requirements.
342
343 2018-02-04  Zan Dobersek  <zdobersek@igalia.com>
344
345         [Cairo] Split TexMap functionality out of GraphicsContext3DCairo
346         https://bugs.webkit.org/show_bug.cgi?id=182465
347
348         Reviewed by Michael Catanzaro.
349
350         Take the Non-Cairo GraphicsContext3D functionality that's stashed in
351         GraphicsContext3DCairo and move it into the GraphicsContext3DTextureMapper
352         file.
353
354         In GraphicsContext3DCairo.cpp, only the Cairo-specific GraphicsContext3D
355         functionality remains, specifically ImageExtractor and paintToCanvas().
356
357         Everything else is moved into GraphicsContext3DTextureMapper.cpp. This
358         filename and its location under platform/graphics/texmap/ was chosen
359         since all the ports using this file (GTK, WPE, WinCairo) are also using
360         the TextureMapper module. Various #if-guards are simplified in the
361         moved-over code to reflect this.
362
363         GraphicsContext3DCairo.cpp now better reflects GraphicsContext3DCG.cpp,
364         with both implementing functionality specific to a 2D painting library,
365         whereas GraphicsContext3DTextureMapper.cpp reflects
366         GraphicsContext3DCocoa.cpp in covering functionality needed to integrate
367         the GraphicsContext3D output into the platform-specific composition
368         system.
369
370         No new tests -- no change in behavior.
371
372         * platform/TextureMapper.cmake:
373         * platform/graphics/cairo/GraphicsContext3DCairo.cpp:
374         (WebCore::activeContexts): Deleted.
375         (WebCore::GraphicsContext3D::create): Deleted.
376         (WebCore::GraphicsContext3D::GraphicsContext3D): Deleted.
377         (WebCore::GraphicsContext3D::~GraphicsContext3D): Deleted.
378         (WebCore::GraphicsContext3D::setContextLostCallback): Deleted.
379         (WebCore::GraphicsContext3D::setErrorMessageCallback): Deleted.
380         (WebCore::GraphicsContext3D::makeContextCurrent): Deleted.
381         (WebCore::GraphicsContext3D::checkGPUStatus): Deleted.
382         (WebCore::GraphicsContext3D::platformGraphicsContext3D): Deleted.
383         (WebCore::GraphicsContext3D::platformTexture const): Deleted.
384         (WebCore::GraphicsContext3D::isGLES2Compliant const): Deleted.
385         (WebCore::GraphicsContext3D::platformLayer const): Deleted.
386         (WebCore::GraphicsContext3D::getExtensions): Deleted.
387         * platform/graphics/texmap/GraphicsContext3DTextureMapper.cpp: Copied from Source/WebCore/platform/graphics/cairo/GraphicsContext3DCairo.cpp.
388         (WebCore::activeContexts):
389         (WebCore::GraphicsContext3D::create):
390         (WebCore::GraphicsContext3D::GraphicsContext3D):
391         (WebCore::GraphicsContext3D::~GraphicsContext3D):
392         (WebCore::GraphicsContext3D::setContextLostCallback):
393         (WebCore::GraphicsContext3D::setErrorMessageCallback):
394         (WebCore::GraphicsContext3D::makeContextCurrent):
395         (WebCore::GraphicsContext3D::checkGPUStatus):
396         (WebCore::GraphicsContext3D::platformGraphicsContext3D):
397         (WebCore::GraphicsContext3D::platformTexture const):
398         (WebCore::GraphicsContext3D::isGLES2Compliant const):
399         (WebCore::GraphicsContext3D::platformLayer const):
400         (WebCore::GraphicsContext3D::getExtensions):
401
402 2018-02-04  Zan Dobersek  <zdobersek@igalia.com>
403
404         Simplify GraphicsContext3D::paintToCanvas()
405         https://bugs.webkit.org/show_bug.cgi?id=182459
406
407         Reviewed by Michael Catanzaro.
408
409         Cairo-specific paintToCanvas() method is dropped in favor of the more
410         common one that operates on a GraphicsContext object. The platform
411         context object is then retrieved inside the Cairo-speficic
412         paintToCanvas() implementation, and not at the call site in
413         GraphicsContext3D::paintRenderingResultsToCanvas().
414
415         GraphicsContext3D::paintToCanvas() is also modified so that the image
416         and canvas sizes are passed through IntSize objects, and not through
417         a width-and-height pair of integer values.
418
419         No new tests -- no change in behavior.
420
421         * platform/graphics/GraphicsContext3D.h:
422         * platform/graphics/cairo/GraphicsContext3DCairo.cpp:
423         (WebCore::GraphicsContext3D::paintToCanvas):
424         * platform/graphics/cg/GraphicsContext3DCG.cpp:
425         (WebCore::GraphicsContext3D::paintToCanvas):
426         * platform/graphics/opengl/GraphicsContext3DOpenGLCommon.cpp:
427         (WebCore::GraphicsContext3D::paintRenderingResultsToCanvas):
428
429 2018-02-03  Alexey Proskuryakov  <ap@apple.com>
430
431         Tweak availability macros for CAN_DISALLOW_USER_INSTALLED_FONTS
432
433         Rubber-stamped by Maciej Stachowiak.
434
435         * platform/graphics/cocoa/FontCacheCoreText.cpp:
436
437 2018-02-02  Daniel Bates  <dabates@apple.com>
438
439         Clean up FrameLoader::receivedFirstData()
440         https://bugs.webkit.org/show_bug.cgi?id=182361
441
442         Reviewed by Andy Estes.
443
444         * loader/FrameLoader.cpp:
445         (WebCore::FrameLoader::receivedFirstData):
446
447 2018-02-02  Myles C. Maxfield  <mmaxfield@apple.com>
448
449         Test fix after r227995
450         https://bugs.webkit.org/show_bug.cgi?id=180951
451
452         Unreviewed.
453
454         Webfonts shouldn't be run through CTFontDescriptorCreateMatchingFontDescriptor().
455         Also, unify macOS's and iOS's implementation of FontCache::lastResortFallbackFont().
456
457         Covered by existing tests.
458
459         * platform/graphics/cocoa/FontCacheCoreText.cpp:
460         (WebCore::FontDatabase::collectionForFamily):
461         (WebCore::FontDatabase::fontForPostScriptName):
462         (WebCore::addAttributesForInstalledFonts):
463         (WebCore::addAttributesForWebFonts):
464         (WebCore::installedFontMandatoryAttributes):
465         (WebCore::FontCache::lastResortFallbackFont):
466         (WebCore::addAttributesForUserInstalledFonts): Deleted.
467         (WebCore::mandatoryAttributesForUserInstalledFonts): Deleted.
468         * platform/graphics/cocoa/FontCacheCoreText.h:
469         * platform/graphics/ios/FontCacheIOS.mm:
470         (WebCore::FontCache::lastResortFallbackFont): Deleted.
471         * platform/graphics/mac/FontCacheMac.mm:
472         (WebCore::FontCache::lastResortFallbackFont): Deleted.
473         * platform/graphics/mac/FontCustomPlatformData.cpp:
474         (WebCore::FontCustomPlatformData::fontPlatformData):
475
476 2018-02-02  Basuke Suzuki  <Basuke.Suzuki@sony.com>
477
478         Fix build error after r 227457 with VIDEO and WEB_AUDIO disabled
479         https://bugs.webkit.org/show_bug.cgi?id=182395
480
481         Reviewed by Eric Carlson
482
483         * platform/audio/PlatformMediaSessionManager.cpp:
484         (WebCore::PlatformMediaSessionManager::updateNowPlayingInfoIfNecessary):
485
486 2018-02-02  Don Olmstead  <don.olmstead@sony.com>
487
488         Remove WebCore/ForwardingHeaders directory
489         https://bugs.webkit.org/show_bug.cgi?id=182347
490
491         Reviewed by Alex Christensen.
492
493         Baseline tests updated.
494
495         * bindings/scripts/CodeGeneratorJS.pm:
496         (AddToIncludesForIDLType):
497         (GenerateEnumerationImplementationContent):
498         (GenerateDictionaryImplementationContent):
499         (GenerateHeader):
500         (GenerateOverloadDispatcher):
501         (addUnscopableProperties):
502         (GenerateImplementation):
503         (GenerateOperationDefinition):
504         (GenerateSerializerDefinition):
505         (GenerateConstructorHelperMethods):
506         * bindings/scripts/test/JS/JSInterfaceName.cpp:
507         * bindings/scripts/test/JS/JSMapLike.cpp:
508         * bindings/scripts/test/JS/JSReadOnlyMapLike.cpp:
509         * bindings/scripts/test/JS/JSTestActiveDOMObject.cpp:
510         * bindings/scripts/test/JS/JSTestCEReactions.cpp:
511         * bindings/scripts/test/JS/JSTestCEReactionsStringifier.cpp:
512         * bindings/scripts/test/JS/JSTestCallTracer.cpp:
513         * bindings/scripts/test/JS/JSTestCallbackFunctionRethrow.cpp:
514         * bindings/scripts/test/JS/JSTestCallbackFunctionWithThisObject.cpp:
515         * bindings/scripts/test/JS/JSTestCallbackFunctionWithTypedefs.cpp:
516         * bindings/scripts/test/JS/JSTestCallbackInterface.cpp:
517         * bindings/scripts/test/JS/JSTestClassWithJSBuiltinConstructor.cpp:
518         * bindings/scripts/test/JS/JSTestCustomConstructorWithNoInterfaceObject.cpp:
519         * bindings/scripts/test/JS/JSTestDOMJIT.cpp:
520         * bindings/scripts/test/JS/JSTestDOMJIT.h:
521         * bindings/scripts/test/JS/JSTestEnabledBySetting.cpp:
522         * bindings/scripts/test/JS/JSTestEventConstructor.cpp:
523         * bindings/scripts/test/JS/JSTestEventTarget.cpp:
524         * bindings/scripts/test/JS/JSTestException.cpp:
525         * bindings/scripts/test/JS/JSTestException.h:
526         * bindings/scripts/test/JS/JSTestGenerateIsReachable.cpp:
527         * bindings/scripts/test/JS/JSTestGlobalObject.cpp:
528         * bindings/scripts/test/JS/JSTestIndexedSetterNoIdentifier.cpp:
529         * bindings/scripts/test/JS/JSTestIndexedSetterThrowingException.cpp:
530         * bindings/scripts/test/JS/JSTestIndexedSetterWithIdentifier.cpp:
531         * bindings/scripts/test/JS/JSTestInterface.cpp:
532         * bindings/scripts/test/JS/JSTestInterfaceLeadingUnderscore.cpp:
533         * bindings/scripts/test/JS/JSTestIterable.cpp:
534         * bindings/scripts/test/JS/JSTestJSBuiltinConstructor.cpp:
535         * bindings/scripts/test/JS/JSTestMediaQueryListListener.cpp:
536         * bindings/scripts/test/JS/JSTestNamedAndIndexedSetterNoIdentifier.cpp:
537         * bindings/scripts/test/JS/JSTestNamedAndIndexedSetterThrowingException.cpp:
538         * bindings/scripts/test/JS/JSTestNamedAndIndexedSetterWithIdentifier.cpp:
539         * bindings/scripts/test/JS/JSTestNamedConstructor.cpp:
540         * bindings/scripts/test/JS/JSTestNamedDeleterNoIdentifier.cpp:
541         * bindings/scripts/test/JS/JSTestNamedDeleterThrowingException.cpp:
542         * bindings/scripts/test/JS/JSTestNamedDeleterWithIdentifier.cpp:
543         * bindings/scripts/test/JS/JSTestNamedDeleterWithIndexedGetter.cpp:
544         * bindings/scripts/test/JS/JSTestNamedGetterCallWith.cpp:
545         * bindings/scripts/test/JS/JSTestNamedGetterNoIdentifier.cpp:
546         * bindings/scripts/test/JS/JSTestNamedGetterWithIdentifier.cpp:
547         * bindings/scripts/test/JS/JSTestNamedSetterNoIdentifier.cpp:
548         * bindings/scripts/test/JS/JSTestNamedSetterThrowingException.cpp:
549         * bindings/scripts/test/JS/JSTestNamedSetterWithIdentifier.cpp:
550         * bindings/scripts/test/JS/JSTestNamedSetterWithIndexedGetter.cpp:
551         * bindings/scripts/test/JS/JSTestNamedSetterWithIndexedGetterAndSetter.cpp:
552         * bindings/scripts/test/JS/JSTestNamedSetterWithOverrideBuiltins.cpp:
553         * bindings/scripts/test/JS/JSTestNamedSetterWithUnforgableProperties.cpp:
554         * bindings/scripts/test/JS/JSTestNamedSetterWithUnforgablePropertiesAndOverrideBuiltins.cpp:
555         * bindings/scripts/test/JS/JSTestNode.cpp:
556         * bindings/scripts/test/JS/JSTestObj.cpp:
557         * bindings/scripts/test/JS/JSTestObj.h:
558         * bindings/scripts/test/JS/JSTestOverloadedConstructors.cpp:
559         * bindings/scripts/test/JS/JSTestOverloadedConstructorsWithSequence.cpp:
560         * bindings/scripts/test/JS/JSTestOverrideBuiltins.cpp:
561         * bindings/scripts/test/JS/JSTestPluginInterface.cpp:
562         * bindings/scripts/test/JS/JSTestPluginInterface.h:
563         * bindings/scripts/test/JS/JSTestPromiseRejectionEvent.cpp:
564         * bindings/scripts/test/JS/JSTestSerialization.cpp:
565         * bindings/scripts/test/JS/JSTestSerializationIndirectInheritance.cpp:
566         * bindings/scripts/test/JS/JSTestSerializationInherit.cpp:
567         * bindings/scripts/test/JS/JSTestSerializationInheritFinal.cpp:
568         * bindings/scripts/test/JS/JSTestSerializedScriptValueInterface.cpp:
569         * bindings/scripts/test/JS/JSTestStandaloneDictionary.cpp:
570         * bindings/scripts/test/JS/JSTestStandaloneEnumeration.cpp:
571         * bindings/scripts/test/JS/JSTestStringifier.cpp:
572         * bindings/scripts/test/JS/JSTestStringifierAnonymousOperation.cpp:
573         * bindings/scripts/test/JS/JSTestStringifierNamedOperation.cpp:
574         * bindings/scripts/test/JS/JSTestStringifierOperationImplementedAs.cpp:
575         * bindings/scripts/test/JS/JSTestStringifierOperationNamedToString.cpp:
576         * bindings/scripts/test/JS/JSTestStringifierReadOnlyAttribute.cpp:
577         * bindings/scripts/test/JS/JSTestStringifierReadWriteAttribute.cpp:
578         * bindings/scripts/test/JS/JSTestTypedefs.cpp:
579         * dom/make_event_factory.pl:
580         (generateImplementation):
581
582 2018-02-02  David Quesada  <david_quesada@apple.com>
583
584         WebAppManifest scope should default to the containing directory of start_url if 'scope' is not specified
585         https://bugs.webkit.org/show_bug.cgi?id=182363
586         rdar://problem/37093498
587
588         Reviewed by Ryosuke Niwa.
589
590         If an app manifest doesn't specify a scope, we should default to the "parent directory" of
591         the start URL, rather than leaving the app unbounded. This is more reasonable than using the
592         entire internet as the app scope.
593
594         No new tests, updates to the existing tests verify the new behavior.
595
596         * Modules/applicationmanifest/ApplicationManifestParser.cpp:
597         (WebCore::ApplicationManifestParser::parseScope):
598
599 2018-02-02  Youenn Fablet  <youenn@apple.com>
600
601         Clearing all service worker registrations should wait for importing service worker registration to finish
602         https://bugs.webkit.org/show_bug.cgi?id=182407
603         <rdar://problem/37167523>
604
605         Reviewed by Chris Dumez.
606
607         * workers/service/server/SWServer.cpp:
608         (WebCore::SWServer::clear): ensure completion handler is called on early exit case.
609
610 2018-02-02  Youenn Fablet  <youenn@apple.com>
611
612         Clearing all service worker registrations should wait for importing service worker registration to finish
613         https://bugs.webkit.org/show_bug.cgi?id=182407
614
615         Reviewed by Chris Dumez.
616
617         Covered by existing tests and the service worker API test being no longer flaky.
618
619         * workers/service/server/SWServer.cpp:
620         (WebCore::SWServer::registrationStoreImportComplete):
621         (WebCore::SWServer::clearAll):
622         (WebCore::SWServer::clear):
623         (WebCore::SWServer::getOriginsWithRegistrations):
624         * workers/service/server/SWServer.h:
625
626 2018-02-02  Chris Dumez  <cdumez@apple.com>
627
628         Clearing a registration should null out its workers before setting their state to "redundant"
629         https://bugs.webkit.org/show_bug.cgi?id=182418
630         <rdar://problem/37142874>
631
632         Reviewed by Youenn Fablet.
633
634         Clearing a registration should null out its workers before setting their state to "redundant".
635         This seems to match Firefox and Chrome.
636
637         No new tests, rebaselined existing test.
638
639         * workers/service/server/SWServerRegistration.cpp:
640         (WebCore::SWServerRegistration::clear):
641         (WebCore::clearRegistrationWorker): Deleted.
642
643 2018-02-02  Antoine Quint  <graouts@apple.com>
644
645         [Modern Media Controls] Turn media/modern-media-controls/tracks-panel and media/modern-media-controls/tracks-support back on
646         https://bugs.webkit.org/show_bug.cgi?id=182426
647
648         Reviewed by Dean Jackson.
649
650         Ensure that the tracks panel isn't dismissed by updating the layout.
651
652         * Modules/modern-media-controls/controls/inline-media-controls.js:
653         (InlineMediaControls.prototype.layout):
654
655 2018-02-02  Commit Queue  <commit-queue@webkit.org>
656
657         Unreviewed, rolling out r227964.
658         https://bugs.webkit.org/show_bug.cgi?id=182423
659
660         It broke several unit tests (Requested by KaL on #webkit).
661
662         Reverted changeset:
663
664         "[SOUP] Ensure domain is valid when converting a WebCore
665         Cookie to Soup"
666         https://bugs.webkit.org/show_bug.cgi?id=182328
667         https://trac.webkit.org/changeset/227964
668
669 2018-02-01  Chris Dumez  <cdumez@apple.com>
670
671         When SW install fails, null out registration.installing before setting worker state to "redundant"
672         https://bugs.webkit.org/show_bug.cgi?id=182416
673         <rdar://problem/37141997>
674
675         Reviewed by Youenn Fablet.
676
677         When SW install fails, null out registration.installing before setting worker state to "redundant".
678         This does not match the spec but this is what Firefox and Chrome do. This is also what the
679         web-platform-tests expect.
680
681         Test: http/tests/workers/service/install-fails.html
682
683         * workers/service/server/SWServerJobQueue.cpp:
684         (WebCore::SWServerJobQueue::didFinishInstall):
685
686 2018-02-01  Myles C. Maxfield  <mmaxfield@apple.com>
687
688         Test fix after r227848.
689         https://bugs.webkit.org/show_bug.cgi?id=180951
690
691         Unreviewed.
692
693         Using kCTFontNameAttribute on an in-memory font causes CTFontDescriptorCreateMatchingFontDescriptor()
694         to return nullptr. Luckily, we weren't using that attribute anyway.
695
696         Covered by existing tests.
697
698         * platform/graphics/cocoa/FontCacheCoreText.cpp:
699         (WebCore::mandatoryAttributesForUserInstalledFonts):
700
701 2018-02-01  Youenn Fablet  <youenn@apple.com>
702
703         Delay service worker process creation until actually needed by SWServer
704         https://bugs.webkit.org/show_bug.cgi?id=182301
705
706         Reviewed by Chris Dumez.
707
708         Rename SWServer::Connection::scheduleJobInServer to scheduleJob.
709         Add sessionID getter from an SWServer.
710
711         * workers/service/server/SWServer.h:
712         (WebCore::SWServer::sessionID const):
713
714 2018-02-01  Fujii Hironori  <Hironori.Fujii@sony.com>
715
716         REGRESSION(r227594) [WinCairo] NULL pointer crash in GraphicsContext::getWindowsContext
717         https://bugs.webkit.org/show_bug.cgi?id=182282
718
719         Reviewed by Žan Doberšek.
720
721         ImageBufferCairo has been changed to use GraphicsContextImplCairo
722         in r227594. But, GraphicsContext::getWindowsContext doesn't care
723         the case of using GraphicsContextImpl and crashes due to null
724         dereference of GraphicsContext::m_data.
725
726         GraphicsContext::getWindowsContext should create a HDC in that case.
727
728         Remove the argument mayCreateBitmap because it is always
729         true at the moment.
730
731         No new tests (Covered by the existing tests)
732
733         * platform/graphics/GraphicsContext.h:
734         Removed a argument mayCreateBitmap of getWindowsContext and releaseWindowsContext.
735         * platform/graphics/win/GraphicsContextCGWin.cpp:
736         (WebCore::GraphicsContext::releaseWindowsContext): Ditto.
737         * platform/graphics/win/GraphicsContextCairoWin.cpp:
738         (WebCore::GraphicsContext::releaseWindowsContext): Ditto.
739         * platform/graphics/win/GraphicsContextDirect2D.cpp:
740         (WebCore::GraphicsContext::releaseWindowsContext): Ditto.
741         * platform/graphics/win/GraphicsContextWin.cpp:
742         (WebCore::GraphicsContext::getWindowsContext):
743         Create a HDC if m_impl is null. Removed a argument mayCreateBitmap.
744         * platform/graphics/win/LocalWindowsContext.h:
745         (WebCore::LocalWindowsContext::LocalWindowsContext):
746         Removed m_mayCreateBitmap.
747         (WebCore::LocalWindowsContext::~LocalWindowsContext): Ditto.
748
749 2018-02-01  Christopher Reid  <chris.reid@sony.com>
750
751         [Curl] Use SQLite database in cookie jar implementation for Curl port
752         https://bugs.webkit.org/show_bug.cgi?id=174942
753
754         Reviewed by Alex Christensen.
755
756         No new tests, Set-Cookie is already tested in Layout tests.
757
758         Adding an initial SQLite CookieJar implementation to the curl network layer.
759         WebCore will now parse and handle both HTTP and DOM cookies instead of using libcurl.
760         This currently supports cookie storage and retrieval.
761         Cookie deletion is not yet implemented.
762
763         * platform/Curl.cmake:
764         * platform/network/NetworkStorageSession.h: Added cookieDB storage in curl.
765         * platform/network/curl/CookieJarCurl.cpp: Removed the old curl cookie handling.
766         * platform/network/curl/CookieJarCurl.h:
767         * platform/network/curl/CookieJarCurlDatabase.cpp: Added.
768         * platform/network/curl/CookieJarCurlDatabase.h: Added.
769         * platform/network/curl/CookieJarDB.cpp: Added.
770         * platform/network/curl/CookieJarDB.h: Added.
771         * platform/network/curl/CookieUtil.cpp: Added.
772         * platform/network/curl/CookieUtil.h: Added.
773         * platform/network/curl/CurlContext.cpp: Removed the old curl cookie handling.
774         * platform/network/curl/CurlContext.h:
775         * platform/network/curl/CurlRequest.cpp: Added handlers for HTTP response cookies.
776         * platform/network/curl/NetworkStorageSessionCurl.cpp:
777         * platform/network/curl/ResourceHandleCurlDelegate.cpp:
778
779 2018-02-01  Chris Dumez  <cdumez@apple.com>
780
781         Add missing RETURN_IF_EXCEPTION() after object->get() calls in convertDictionary<>()
782         https://bugs.webkit.org/show_bug.cgi?id=182392
783         <rdar://problem/37119215>
784
785         Reviewed by Geoffrey Garen.
786
787         Add missing RETURN_IF_EXCEPTION() after object->get() calls in convertDictionary<>(),
788         given that getting the property from the object can throw an exception.
789
790         No new tests, rebaselined existing test.
791
792         * bindings/scripts/CodeGeneratorJS.pm:
793         (GenerateDictionaryImplementationContent):
794         * bindings/scripts/test/JS/JSTestCallbackInterface.cpp:
795         (WebCore::convertDictionary<TestCallbackInterface::Dictionary>):
796         * bindings/scripts/test/JS/JSTestEventConstructor.cpp:
797         (WebCore::convertDictionary<TestEventConstructor::Init>):
798         * bindings/scripts/test/JS/JSTestObj.cpp:
799         (WebCore::convertDictionary<TestObj::Dictionary>):
800         (WebCore::convertDictionary<TestObj::DictionaryThatShouldNotTolerateNull>):
801         (WebCore::convertDictionary<TestObj::DictionaryThatShouldTolerateNull>):
802         (WebCore::convertDictionary<AlternateDictionaryName>):
803         (WebCore::convertDictionary<TestObj::ParentDictionary>):
804         (WebCore::convertDictionary<TestObj::ChildDictionary>):
805         (WebCore::convertDictionary<TestObj::ConditionalDictionaryA>):
806         (WebCore::convertDictionary<TestObj::ConditionalDictionaryB>):
807         (WebCore::convertDictionary<TestObj::ConditionalDictionaryC>):
808         * bindings/scripts/test/JS/JSTestPromiseRejectionEvent.cpp:
809         (WebCore::convertDictionary<TestPromiseRejectionEvent::Init>):
810         * bindings/scripts/test/JS/JSTestStandaloneDictionary.cpp:
811         (WebCore::convertDictionary<DictionaryImplName>):
812
813 2018-02-01  Ryosuke Niwa  <rniwa@webkit.org>
814
815         Some test cases in accessibility/mac/selection-notification-focus-change.html fail
816         https://bugs.webkit.org/show_bug.cgi?id=182212
817         <rdar://problem/36937147>
818
819         Reviewed by Antti Koivisto and Wenson Hsieh.
820
821         The failure was caused by the async update of the selection appearance not preserving selection reveal intent.
822         Fixed the bug by storing the intent in a member variable and using it later.
823
824         * dom/Element.cpp:
825         (WebCore::Element::focus): Removed an unnecessary synchronous layout update.
826         * editing/FrameSelection.cpp:
827         (WebCore::FrameSelection::setNeedsSelectionUpdate): Use the default intent to preserve the old behavior.
828         (WebCore::FrameSelection::respondToNodeModification): Ditto.
829         (WebCore::FrameSelection::setSelection): Save the selection reveal intent.
830         (WebCore::FrameSelection::updateAppearanceAfterLayoutOrStyleChange): Use the saved intent.
831         * editing/FrameSelection.h:
832         * page/FocusController.cpp:
833         (WebCore::FocusController::advanceFocusDirectionally): Always update the layout before invoking
834         nodeRectInAbsoluteCoordinates.
835
836 2018-02-01  Zalan Bujtas  <zalan@apple.com>
837
838         [RenderTreeBuilder] Move RenderRubyRun::rubyBaseSafe to RenderTreeBuilder::Ruby
839         https://bugs.webkit.org/show_bug.cgi?id=182306
840         <rdar://problem/37041440>
841
842         Reviewed by Darin Adler.
843
844         Addressing post-review comment.
845
846         * rendering/updating/RenderTreeBuilderRuby.cpp:
847         (WebCore::RenderTreeBuilder::Ruby::insertChild):
848         (WebCore::RenderTreeBuilder::Ruby::rubyBaseSafe):
849         * rendering/updating/RenderTreeBuilderRuby.h:
850
851 2018-02-01  Zalan Bujtas  <zalan@apple.com>
852
853         [RenderTreeBuilder] Introduce RenderTreeBuilder to takeChild()
854         https://bugs.webkit.org/show_bug.cgi?id=182373
855         <rdar://problem/37101484>
856
857         Reviewed by Antti Koivisto.
858         
859         This is in preparation for moving mutation code out of takeChild. 
860
861         No change in functionality.
862
863         * rendering/RenderBlock.cpp:
864         (WebCore::RenderBlock::takeChild):
865         * rendering/RenderBlock.h:
866         * rendering/RenderBlockFlow.cpp:
867         (WebCore::RenderBlockFlow::takeChild):
868         * rendering/RenderBlockFlow.h:
869         * rendering/RenderButton.cpp:
870         (WebCore::RenderButton::takeChild):
871         * rendering/RenderButton.h:
872         * rendering/RenderElement.cpp:
873         (WebCore::RenderElement::takeChild):
874         (WebCore::RenderElement::removeAndDestroyChild):
875         (WebCore::RenderElement::destroyLeftoverChildren):
876         * rendering/RenderElement.h:
877         * rendering/RenderFullScreen.cpp:
878         (WebCore::RenderFullScreen::wrapExistingRenderer):
879         (WebCore::RenderFullScreen::unwrapRenderer):
880         * rendering/RenderGrid.cpp:
881         (WebCore::RenderGrid::takeChild):
882         * rendering/RenderGrid.h:
883         * rendering/RenderMenuList.cpp:
884         (RenderMenuList::takeChild):
885         * rendering/RenderMenuList.h:
886         * rendering/RenderMultiColumnFlow.cpp:
887         (WebCore::RenderMultiColumnFlow::processPossibleSpannerDescendant):
888         * rendering/RenderObject.cpp:
889         (WebCore::RenderObject::removeFromParentAndDestroy):
890         * rendering/RenderRuby.cpp:
891         (WebCore::RenderRubyAsInline::takeChild):
892         (WebCore::RenderRubyAsBlock::takeChild):
893         * rendering/RenderRuby.h:
894         * rendering/RenderRubyRun.cpp:
895         (WebCore::RenderRubyRun::takeChild):
896         * rendering/RenderRubyRun.h:
897         * rendering/RenderTableRow.cpp:
898         (WebCore::RenderTableRow::collapseAndDestroyAnonymousSiblingRows): Deleted.
899         * rendering/RenderTableRow.h:
900         * rendering/svg/RenderSVGContainer.cpp:
901         (WebCore::RenderSVGContainer::takeChild):
902         * rendering/svg/RenderSVGContainer.h:
903         * rendering/svg/RenderSVGInline.cpp:
904         (WebCore::RenderSVGInline::takeChild):
905         * rendering/svg/RenderSVGInline.h:
906         * rendering/svg/RenderSVGRoot.cpp:
907         (WebCore::RenderSVGRoot::takeChild):
908         * rendering/svg/RenderSVGRoot.h:
909         * rendering/svg/RenderSVGText.cpp:
910         (WebCore::RenderSVGText::takeChild):
911         * rendering/svg/RenderSVGText.h:
912         * rendering/updating/RenderTreeBuilder.cpp:
913         (WebCore::RenderTreeBuilder::collapseAndDestroyAnonymousSiblingRows):
914         (WebCore::RenderTreeBuilder::removeFromParentAndDestroyCleaningUpAnonymousWrappers):
915         * rendering/updating/RenderTreeBuilder.h:
916         * rendering/updating/RenderTreeBuilderFirstLetter.cpp:
917         (WebCore::RenderTreeBuilder::FirstLetter::updateStyle):
918         (WebCore::RenderTreeBuilder::FirstLetter::createRenderers):
919         * rendering/updating/RenderTreeBuilderList.cpp:
920         (WebCore::RenderTreeBuilder::List::updateItemMarker):
921         * rendering/updating/RenderTreeBuilderMultiColumn.cpp:
922         (WebCore::RenderTreeBuilder::MultiColumn::createFragmentedFlow):
923         (WebCore::RenderTreeBuilder::MultiColumn::destroyFragmentedFlow):
924         * rendering/updating/RenderTreeBuilderRuby.cpp:
925         (WebCore::RenderTreeBuilder::Ruby::insertChild):
926
927 2018-02-01  Dean Jackson  <dino@apple.com>
928
929         REGRESSION (r219342): Scaled HTML widget is not responding to a clicks outside the body
930         https://bugs.webkit.org/show_bug.cgi?id=182394
931         <rdar://problem/34840816>
932
933         Reviewed by Simon Fraser.
934
935         If a scale < 1 is applied to the page, then the visual viewport will be bigger
936         than the layout viewport. Our hit testing code would then ignore any hits
937         that were outside the layout viewport.
938
939         The fix is to only apply a hit testing clip if the page is scaling up, not down.
940
941         Update the existing fast/dom/elementFromPoint-scaled-scrolled.html test.
942
943         * page/FrameView.cpp:
944         (WebCore::FrameView::layoutViewportToAbsoluteRect const): Deleted. This helper is
945         no longer used, and it would have probably been more confusing to have it accept
946         a flag to ignore the scale if it is less than 1.
947         * page/FrameView.h:
948         * rendering/RenderLayer.cpp:
949         (WebCore::RenderLayer::hitTest): No need to take the layout rect, remove the origin,
950         and pass it to a helper that added the origin back. The only thing the helper was
951         doing for us was applying a scale factor, which we only want to do if it was
952         scaling up.
953
954 2018-02-01  Yusuke Suzuki  <utatane.tea@gmail.com>
955
956         Structured cloning a Symbol should throw
957         https://bugs.webkit.org/show_bug.cgi?id=182380
958
959         Reviewed by Darin Adler.
960
961         Test: js/dom/post-message-symbol.html
962
963         * bindings/js/SerializedScriptValue.cpp:
964         (WebCore::CloneSerializer::dumpIfTerminal):
965         Structured cloning should throw "DataCloneError" DOMException if it finds Symbol.
966         Remove unused `isNumber()` case. It is done in dumpImmediate.
967         (WebCore::CloneSerializer::serializeUndefined): Deleted.
968         (WebCore::CloneSerializer::serializeBoolean): Deleted.
969         (WebCore::CloneSerializer::serializeNumber): Deleted.
970         Remove unused functions.
971
972 2018-02-01  Chris Dumez  <cdumez@apple.com>
973
974         We no longer need to queue service worker jobs until the connection to the service worker process has been established
975         https://bugs.webkit.org/show_bug.cgi?id=182375
976
977         Reviewed by Youenn Fablet.
978
979         We no longer need to queue service worker jobs until the connection to the service worker process
980         has been established. We initially did this to work around the fact that registrations restored
981         from disk would not have an active worker until the service worker process had been established. 
982         However, this issue has been fixed in r227696.
983
984         This is basically a revert of r227220, which is no longer needed after r227696.
985
986         No new tests, initial fix was covered by an API test that still passes.
987
988         * workers/service/server/SWServer.cpp:
989         (WebCore::SWServer::clearAll):
990         (WebCore::SWServer::clear):
991         (WebCore::SWServer::scheduleJob):
992         (WebCore::SWServer::serverToContextConnectionCreated):
993         * workers/service/server/SWServer.h:
994
995 2018-02-01  Carlos Garcia Campos  <cgarcia@igalia.com>
996
997         [GTK] Shift + mouse scroll should scroll horizontally
998         https://bugs.webkit.org/show_bug.cgi?id=181629
999
1000         Reviewed by Michael Catanzaro.
1001
1002         We currently turn vertical scroll into horizontal when scrolling over the horizontal scrollbar. When Shift key is
1003         pressed, we still want to scroll in the scrollbar direction when scrolling over a scrollbar, so we need to swap
1004         directions in both scrollbars depending on whther the Shift key is pressed or not.
1005
1006         * page/EventHandler.cpp:
1007         (WebCore::EventHandler::shouldSwapScrollDirection const): Renamed.
1008         (WebCore::EventHandler::handleWheelEvent): Use the new name.
1009         (WebCore::EventHandler::shouldTurnVerticalTicksIntoHorizontal const): Deleted.
1010         * page/EventHandler.h:
1011         * platform/PlatformWheelEvent.h:
1012         (WebCore::PlatformWheelEvent::copySwappingDirection const): Swap the direction of the event.
1013         (WebCore::PlatformWheelEvent::copyTurningVerticalTicksIntoHorizontalTicks const): Deleted.
1014         * platform/glib/EventHandlerGLib.cpp:
1015         (WebCore::EventHandler::shouldSwapScrollDirection const): Take into account whether the Shift key is present.
1016         (WebCore::EventHandler::shouldTurnVerticalTicksIntoHorizontal const): Deleted.
1017
1018 2018-02-01  Carlos Garcia Campos  <cgarcia@igalia.com>
1019
1020         [GTK] Problem with Washington Post images
1021         https://bugs.webkit.org/show_bug.cgi?id=181421
1022
1023         Reviewed by Carlos Alberto Lopez Perez.
1024
1025         This is because Washington Post is using the user agent to decide the image formats it serves. In the case of
1026         chromium the images are served as webp, for firefox jpeg is used and in our case it's assuming we are safari and
1027         it's providing jp2 images that we don't support. Add a user agent quirk to pretend to be chromium for
1028         washingtonpost.com.
1029
1030         * platform/UserAgentQuirks.cpp:
1031         (WebCore::urlRequiresChromeBrowser):
1032
1033 2018-02-01  Carlos Garcia Campos  <cgarcia@igalia.com>
1034
1035         [SOUP] Ensure domain is valid when converting a WebCore Cookie to Soup
1036         https://bugs.webkit.org/show_bug.cgi?id=182328
1037
1038         Reviewed by Michael Catanzaro.
1039
1040         soup_cookie_parse() adds the initial '.' to the domain if missing before creating the SoupCookie, but
1041         soup_cookie_new() allows for domain to be a hostname that needs to match exactly. When converting a WebCore
1042         Cookie into a SoupCookie we always want the domain to be considered as such and not as a hostname, so we need to
1043         prepend the '.' if missing.
1044
1045         Fixes: imported/w3c/webdriver/tests/cookies/add_cookie.py::test_add_domain_cookie
1046
1047         * platform/network/soup/CookieSoup.cpp:
1048         (WebCore::Cookie::toSoupCookie const):
1049
1050 2018-02-01  Zalan Bujtas  <zalan@apple.com>
1051
1052         [RenderTreeBuilder] Move RenderTableRow::collapseAndDestroyAnonymousSiblingRows to RenderTreeBuilder
1053         https://bugs.webkit.org/show_bug.cgi?id=182374
1054         <rdar://problem/37102005>
1055
1056         Reviewed by Antti Koivisto.
1057
1058         It's only called from RenderTreeBuilder.
1059
1060         No change in functionality.
1061
1062         * rendering/RenderTableRow.cpp:
1063         (WebCore::RenderTableRow::collapseAndDestroyAnonymousSiblingRows): Deleted.
1064         * rendering/RenderTableRow.h:
1065         * rendering/updating/RenderTreeBuilder.cpp:
1066         (WebCore::RenderTreeBuilder::removeFromParentAndDestroyCleaningUpAnonymousWrappers):
1067         * rendering/updating/RenderTreeBuilderTable.cpp:
1068         (WebCore::RenderTreeBuilder::Table::collapseAndDestroyAnonymousSiblingRows):
1069         * rendering/updating/RenderTreeBuilderTable.h:
1070
1071 2018-02-01  Chris Dumez  <cdumez@apple.com>
1072
1073         Queue a microtask when a waitUntil() promise is settled
1074         https://bugs.webkit.org/show_bug.cgi?id=182372
1075         <rdar://problem/37101019>
1076
1077         Reviewed by Mark Lam.
1078
1079         Queue a microtask when a waitUntil() promise is settled, as per:
1080         - https://w3c.github.io/ServiceWorker/#dom-extendableevent-waituntil (step 5)
1081
1082         Otherwise, we decrement m_pendingPromiseCount too quickly and it may cause
1083         following calls to waitUntil() to throw when they shouldn't.
1084
1085         No new tests, rebaselined existing test.
1086
1087         * workers/service/ExtendableEvent.cpp:
1088         (WebCore::ExtendableEvent::addExtendLifetimePromise):
1089
1090 2018-02-01  Antti Koivisto  <antti@apple.com>
1091
1092         Invalidate style for sibling combinators accurately on class change
1093         https://bugs.webkit.org/show_bug.cgi?id=182336
1094
1095         Reviewed by Zalan Bujtas.
1096
1097         Use Style::Invalidator to invalidate only those elements that may be affected by a class
1098         change for sibling combinators and nth pseudo classes.
1099
1100         * css/RuleFeature.cpp:
1101
1102         Add new AllSiblings MatchElement to use for nth pseudo classes with subselectors.
1103
1104         (WebCore::isSiblingOrSubject):
1105
1106         Add a helper.
1107
1108         (WebCore::RuleFeatureSet::computeNextMatchElement):
1109         (WebCore::RuleFeatureSet::computeSubSelectorMatchElement):
1110
1111         Compute and propage MatchElement::AllSiblings.
1112
1113         * css/RuleFeature.h:
1114         * dom/Node.cpp:
1115         (WebCore::Node::updateAncestorsForStyleRecalc):
1116
1117         Don't need to test for childrenAffectedByPropertyBasedBackwardPositionalRules anymore (an oddly named bit for nth pseudo classes).
1118
1119         * style/StyleInvalidator.cpp:
1120         (WebCore::Style::Invalidator::invalidateStyleWithMatchElement):
1121
1122         Invalidate only the potentially affected elements.
1123         The old code would just unconditionally invalidate the current element. This would propagate to descedants of siblings via
1124         affectedByPreviousSibling bits. That mechanism can be removed when everything has been switched to accurate invalidation.
1125
1126 2018-01-31  Simon Fraser  <simon.fraser@apple.com>
1127
1128         Use different debug red colors for different contexts
1129         https://bugs.webkit.org/show_bug.cgi?id=182362
1130
1131         Reviewed by Tim Horton.
1132
1133         Pure red is used elsehwere in the system as a debug color indicator, so use different
1134         shades of red for WebKit in the two places where we paint a reddish wash in debug builds,
1135         so they are identifiable.
1136
1137         * page/FrameView.cpp:
1138         (WebCore::FrameView::paintContents):
1139
1140 2018-01-31  Don Olmstead  <don.olmstead@sony.com>
1141
1142         [CMake] Make JavaScriptCore headers copies
1143         https://bugs.webkit.org/show_bug.cgi?id=182303
1144
1145         Reviewed by Alex Christensen.
1146
1147         No new tests. No change in behavior.
1148
1149         * CMakeLists.txt:
1150         * PlatformMac.cmake:
1151         * PlatformWPE.cmake:
1152         * PlatformWin.cmake:
1153         * PlatformWinCairo.cmake:
1154
1155 2018-01-31  Per Arne Vollan  <pvollan@apple.com>
1156
1157         Layout Test fast/events/beforeunload-dom-manipulation-crash.html is crashing
1158         https://bugs.webkit.org/show_bug.cgi?id=181204
1159         <rdar://problem/36256274>
1160
1161         Reviewed by Ryosuke Niwa.
1162
1163         When a frame element is moved in the DOM tree during the execution of a beforeunload handler,
1164         the frame will be detached when removed from its previous position in the DOM tree. When being
1165         detached, an attempt will also be made to stop the load by calling FrameLoader::stopAllLoaders().
1166         However, this method will return early when executed in a beforeunload handler, since navigation
1167         is not allowed then. The end result is a detached frame which will continue to load, and hitting
1168         asserts in DocumentLoader::dataReceived(), and DocumentLoader::notifyFinished(). It should be
1169         possible to stop a frame load, even when executing a beforeunload handler.
1170
1171         No new tests. Covered by the existing test fast/events/beforeunload-dom-manipulation-crash.html.
1172
1173         * history/PageCache.cpp:
1174         (WebCore::PageCache::addIfCacheable): Fix a failing API test by allowing scripts to be executed
1175         under the PageCache::prune method.
1176         * loader/FrameLoader.cpp:
1177         (WebCore::FrameLoader::isStopLoadingAllowed const):
1178         (WebCore::FrameLoader::stopAllLoaders):
1179         * loader/FrameLoader.h:
1180         * svg/graphics/SVGImage.cpp:
1181         (WebCore::SVGImage::~SVGImage): Disable scripts disallowed assertions in this scope, since it is
1182         safe in this context.
1183
1184 2018-01-31  Javier Fernandez  <jfernandez@igalia.com>
1185
1186         inline-block baseline not computed correctly for vertical-lr
1187         https://bugs.webkit.org/show_bug.cgi?id=170176
1188
1189         Reviewed by Manuel Rego Casasnovas.
1190
1191         When computing the baseline position of inline-block elements we use the
1192         InlineFlow logicalTop and the FontMetrics ascent. The issue comes from
1193         the fact that these units are incompatible. The logicalTop of a
1194         vertical-lr element is offset to the left edge, while the ascent is the
1195         distance from the right edge.
1196
1197         We need to either use logical value for the FontMetrics ascent so we can
1198         compute the correctly the baselines of vertical-lr elements, or just using
1199         the logicalBottom for these cases.
1200
1201         The approach based on a logicalAscent API for FontMetrics would require
1202         a lot of work because inline-block logic assumes everything is vertical-rl
1203         and at some point, flips the elements along the block-axis in case of
1204         vertical-lr mode.
1205
1206         While it'd be desirable to get rid of this flipping logic, this patch tries
1207         first the simpler approach of using logicalBottom, which aligns with the
1208         currently implemented logic.
1209
1210         Tests: fast/inline-block/baseline-vertical-01.html
1211                fast/inline-block/baseline-vertical-02.html
1212                fast/inline-block/baseline-vertical-03.html
1213                fast/inline-block/baseline-vertical-04.html
1214                fast/inline-block/baseline-vertical-05.html
1215                fast/inline-block/baseline-vertical-06.html
1216                fast/inline-block/baseline-vertical-07.html
1217                fast/inline-block/baseline-vertical-08.html
1218
1219         * rendering/InlineFlowBox.cpp:
1220         (WebCore::InlineFlowBox::placeBoxesInBlockDirection):
1221         * rendering/RenderBlockFlow.cpp:
1222         (WebCore::RenderBlockFlow::inlineBlockBaseline const):
1223
1224 2018-01-31  Said Abou-Hallawa  <sabouhallawa@apple.com>
1225
1226         BitmapImage::drawPattern() may not draw a complete frame even after all the data is received
1227         https://bugs.webkit.org/show_bug.cgi?id=182277
1228
1229         Reviewed by Simon Fraser.
1230
1231         BitmapImage::drawPattern() needs to destroy the incomplete decoded frame
1232         before trying to draw it as a pattern.
1233
1234         Test: http/tests/images/draw-pattern-slow-load-large-image.html
1235
1236         * loader/cache/CachedImage.cpp:
1237         (WebCore::CachedImage::updateBufferInternal): We need to disable CachedImage
1238         data buffering for testing. This simulates slow network where intervals
1239         between data chunks can last for seconds.
1240         * loader/cache/CachedImage.h:
1241         * platform/graphics/BitmapImage.cpp:
1242         (WebCore::BitmapImage::drawPattern): Destroy the incomplete decoded frame
1243         before drawing this frame as a pattern. We do not destroy incomplete decoded
1244         frame once new data is received because it may be drawn by async image
1245         drawing while waiting for the newer frame to finish decoding.
1246         * testing/Internals.cpp:
1247         (WebCore::Internals::setForceUpdateImageDataEnabledForTesting):
1248         * testing/Internals.h:
1249         * testing/Internals.idl:
1250
1251 2018-01-31  Ryosuke Niwa  <rniwa@webkit.org>
1252
1253         Add a release assertion to ensure timers are deleted in the right thread
1254         https://bugs.webkit.org/show_bug.cgi?id=182351
1255
1256         Reviewed by David Kilzer.
1257
1258         Added a relese assertion in ~TimerBase that the current thread is the one in which the timer was created.
1259
1260         We use canAccessThreadLocalDataForThread for this purpose since the condition is more complicated
1261         when WebThread is being used.
1262
1263         * platform/Timer.cpp:
1264         (WebCore::TimerBase::~TimerBase): Added the assertion.
1265         * platform/Timer.h:
1266         (WebCore::TimerBase::m_thread): Always store the current thread in a timer.
1267
1268 2018-01-31  Youenn Fablet  <youenn@apple.com>
1269
1270         Change SWServer::claim to set the iterator value as soon as possible
1271         https://bugs.webkit.org/show_bug.cgi?id=182337
1272
1273         Reviewed by Chris Dumez.
1274
1275         No change of behavior, this is a "let's go safe way" fix.
1276
1277         * workers/service/server/SWServer.cpp:
1278         (WebCore::SWServer::claim):
1279
1280 2018-01-31  Zalan Bujtas  <zalan@apple.com>
1281
1282         [RenderTreeBuilder] Move RenderObject::removeFromParentAndDestroyCleaningUpAnonymousWrappers to RenderTreeBuilder.
1283         https://bugs.webkit.org/show_bug.cgi?id=182348
1284         <rdar://problem/37082837>
1285
1286         Reviewed by Antti Koivisto.
1287
1288         All the callsites are in the RenderTreeUpdater by now.
1289
1290         No change in functionality.
1291
1292         * rendering/RenderObject.cpp:
1293         (WebCore::isAnonymousAndSafeToDelete): Deleted.
1294         (WebCore::findDestroyRootIncludingAnonymous): Deleted.
1295         (WebCore::RenderObject::removeFromParentAndDestroyCleaningUpAnonymousWrappers): Deleted.
1296         * rendering/RenderObject.h:
1297         * rendering/updating/RenderTreeBuilder.cpp:
1298         (WebCore::isAnonymousAndSafeToDelete):
1299         (WebCore::findDestroyRootIncludingAnonymous):
1300         (WebCore::RenderTreeBuilder::removeFromParentAndDestroyCleaningUpAnonymousWrappers):
1301         * rendering/updating/RenderTreeBuilder.h:
1302         * rendering/updating/RenderTreeUpdater.cpp:
1303         (WebCore::RenderTreeUpdater::tearDownRenderers):
1304         (WebCore::RenderTreeUpdater::tearDownTextRenderer):
1305
1306 2018-01-31  Ryosuke Niwa  <rniwa@webkit.org>
1307
1308         Release assertion in Performance::resourceTimingBufferFullTimerFired when the resource timing buffer is shrunk
1309         https://bugs.webkit.org/show_bug.cgi?id=182319
1310         <rdar://problem/36904312>
1311
1312         Reviewed by Chris Dumez.
1313
1314         The crash was caused by a wrong release assertion. Handle author scripts shrinking the resource timing buffer
1315         while resourcetimingbufferfull event is being dispatched.
1316
1317         Also fixed a bug that a superflous resourcetimingbufferfull event will be fired when new resource timing entries
1318         are queued while resourcetimingbufferfull event is being dispatched.
1319
1320         Test: http/tests/performance/performance-resource-timing-resourcetimingbufferfull-queue-resource-entry.html
1321               http/tests/performance/performance-resource-timing-resourcetimingbufferfull-shrinking-buffer-crash.html
1322
1323         * page/Performance.cpp:
1324         (WebCore::Performance::resourceTimingBufferFullTimerFired): 
1325
1326 2018-01-31  Youenn Fablet  <youenn@apple.com>
1327
1328         com.apple.WebKit.Storage crashing at com.apple.WebCore: WebCore::SWServerRegistration::removeClientUsingRegistration
1329         https://bugs.webkit.org/show_bug.cgi?id=182316
1330         <rdar://problem/37025976>
1331
1332         Reviewed by Chris Dumez.
1333
1334         SWServer.m_clientToControllingWorker and SWServerRegistration.m_clientsUsingRegistration might currently get out of sync.
1335         This is a defensive fix to ensure storage process will not crash in Release.
1336         We keep the ASSERT as this probably means there is an abnormal situation that other patches might fix.
1337
1338         * workers/service/server/SWServerRegistration.cpp:
1339         (WebCore::SWServerRegistration::removeClientUsingRegistration):
1340
1341 2018-01-31  Antoine Quint  <graouts@apple.com>
1342
1343         [Modern Media Controls] Turn media/modern-media-controls/start-support tests back on
1344         https://bugs.webkit.org/show_bug.cgi?id=182297
1345
1346         Reviewed by Jon Lee and Eric Carlson.
1347
1348         We identified one cause of flakiness when turning those tests back on and fix it in this patch. There would be
1349         cases where the play/pause button would never actually become visible because we would first set it as one of
1350         the buttons in the left container in the bottom controls bar before we would identify that we should show the
1351         prominent play/pause button, and then once we did, we would add it as a child to the InlineMediaControls. But,
1352         because the actual layout of the ButtonsContainer would happen in a rAF due to being a layout() method, we would
1353         remove the play/pause button from the InlineMediaControls and set it as a child of the left container even
1354         though it wasn't visible.
1355
1356         Performing the layout of a ButtonsContainer should really happen immediately when we set the buttons, so in this
1357         patch we remove the "buttons" property and clients of ButtonsContainer can simply add or remove children which
1358         will be laid out in a row. To support this, we've added two notification methods to LayoutNode, one that indicates
1359         when children have changed, didChangeChildren(), which we override in ButtonsContainer to perform a synchronous
1360         layout. The other method is willRemoveChild() which we also override in ButtonsContainer, this time to reset
1361         the "x" and "visible" properties which we set while performing layout.
1362         
1363         This fixes flakiness for media/modern-media-controls/start-support/start-support-click-to-start.html, and maybe
1364         other modern-media-controls tests that could have been affected by this unexpected behavior.
1365
1366         * Modules/modern-media-controls/controls/buttons-container.js:
1367         (ButtonsContainer.prototype.willRemoveChild):
1368         (ButtonsContainer.prototype.didChangeChildren):
1369         (ButtonsContainer.prototype.layout):
1370         (ButtonsContainer.prototype.get buttons): Deleted.
1371         (ButtonsContainer.prototype.set buttons): Deleted.
1372         * Modules/modern-media-controls/controls/inline-media-controls.js:
1373         (InlineMediaControls.prototype.layout):
1374         (InlineMediaControls.prototype._updateBottomControlsBarLabel):
1375         (InlineMediaControls.prototype._addTopRightBarWithMuteButtonToChildren):
1376         (InlineMediaControls):
1377         * Modules/modern-media-controls/controls/layout-node.js:
1378         (LayoutNode.prototype.set children):
1379         (LayoutNode.prototype.addChild):
1380         (LayoutNode.prototype.removeChild):
1381         (LayoutNode.prototype.willRemoveChild):
1382         (LayoutNode.prototype.didChangeChildren):
1383         * Modules/modern-media-controls/controls/macos-fullscreen-media-controls.js:
1384         (MacOSFullscreenMediaControls.prototype.layout):
1385         * Modules/modern-media-controls/media/media-controller.js: Drive-by fix to correctly set the value passed as
1386         data-auto-hide-delay on a <video> element.
1387
1388 2018-01-31  Zalan Bujtas  <zalan@apple.com>
1389
1390         [RenderTreeBuilder] Move RenderMultiColumnFlow::resolveMovedChild to RenderTreeBuilder.
1391         https://bugs.webkit.org/show_bug.cgi?id=182315
1392         <rdar://problem/37048160>
1393
1394         Reviewed by Antti Koivisto.
1395
1396         resolveMovedChild() is only called from RenderTreeBuilder.
1397
1398         No change in functionality.
1399
1400         * rendering/RenderFragmentedFlow.h:
1401         * rendering/RenderMultiColumnFlow.cpp:
1402         (WebCore::RenderMultiColumnFlow::resolveMovedChild const): Deleted.
1403         * rendering/RenderMultiColumnFlow.h:
1404         * rendering/updating/RenderTreeBuilder.cpp:
1405         (WebCore::RenderTreeBuilder::resolveMovedChildForMultiColumnFlow):
1406         * rendering/updating/RenderTreeBuilder.h:
1407         * rendering/updating/RenderTreeBuilderBlockFlow.cpp:
1408         (WebCore::RenderTreeBuilder::BlockFlow::insertChild):
1409         * rendering/updating/RenderTreeBuilderInline.cpp:
1410         (WebCore::RenderTreeBuilder::Inline::insertChild):
1411         * rendering/updating/RenderTreeBuilderMultiColumn.cpp:
1412         (WebCore::RenderTreeBuilder::MultiColumn::resolveMovedChild):
1413         * rendering/updating/RenderTreeBuilderMultiColumn.h:
1414
1415 2018-01-31  Philippe Normand  <pnormand@igalia.com>
1416
1417         [GStreamer] Silent WebAudio buffers support
1418         https://bugs.webkit.org/show_bug.cgi?id=143869
1419
1420         Reviewed by Carlos Garcia Campos.
1421
1422         * platform/audio/gstreamer/WebKitWebAudioSourceGStreamer.cpp:
1423         (webKitWebAudioSrcLoop): Flag silent buffers as GAP buffers. This
1424         enables downstream elements to optimize the buffer processing.
1425
1426 2018-01-31  Xabier Rodriguez Calvar  <calvaris@igalia.com>
1427
1428         [EME] Fix NavigatorEME::tryNextSupportedConfiguration typo
1429         https://bugs.webkit.org/show_bug.cgi?id=182324
1430
1431         Reviewed by Žan Doberšek.
1432
1433         * Modules/encryptedmedia/NavigatorEME.cpp:
1434         (WebCore::tryNextSupportedConfiguration): Fix
1435         candidateCofiguration typo.
1436
1437 2018-01-30  Fujii Hironori  <Hironori.Fujii@sony.com>
1438
1439         [WinCairo] syntheticBoldOffset makes a font with embedded bitmap fonts shown as double strike in HiDPI
1440         https://bugs.webkit.org/show_bug.cgi?id=182093
1441
1442         Reviewed by Alex Christensen.
1443
1444         WebKit draws texts doubly by shifting 1px for fonts without bold
1445         fonts but bold font is desired. This synthetic bold method draws
1446         fonts with embedded bitmap fonts look like double strike in HiDPI.
1447
1448         No new tests (Covered by the existing tests).
1449
1450         * platform/graphics/win/FontCacheWin.cpp:
1451         (WebCore::createGDIFont): Overwrite lfWeight if the desired weight
1452         is bold and matched font weight is't bold and in WinCairo port.
1453         Fix wrong indentation.
1454
1455 2018-01-30  Youenn Fablet  <youenn@apple.com> and Oleksandr Skachkov  <gskachkov@gmail.com>
1456
1457         FetchResponse should support ConsumeData callback on chunk data is received
1458         https://bugs.webkit.org/show_bug.cgi?id=181600
1459         <rdar://problem/36932547>
1460
1461         Reviewed by Alex Christensen.
1462
1463         Test: imported/w3c/web-platform-tests/service-workers/service-worker/fetch-event-respond-with-body-loaded-in-chunk.https.html
1464
1465         Apply same read-by-chunk strategy for body coming from network as for body coming from ReadableStream.
1466         Refactor to have one consumeBodyReceivedByChunk method for both cases.
1467         This allows streaming data from a service worker to WebProcess as would be done by NetworkProcess.
1468
1469         * Modules/cache/DOMCache.cpp:
1470         (WebCore::DOMCache::addAll):
1471         (WebCore::DOMCache::put):
1472         * Modules/fetch/FetchResponse.cpp:
1473         (WebCore::FetchResponse::BodyLoader::didSucceed):
1474         (WebCore::FetchResponse::BodyLoader::didReceiveData):
1475         (WebCore::FetchResponse::BodyLoader::consumeDataByChunk):
1476         (WebCore::FetchResponse::consumeBody):
1477         (WebCore::FetchResponse::consumeBodyReceivedByChunk):
1478         * Modules/fetch/FetchResponse.h:
1479         * workers/service/context/ServiceWorkerFetch.cpp:
1480         (WebCore::ServiceWorkerFetch::processResponse):
1481
1482 2018-01-30  Don Olmstead  <don.olmstead@sony.com>
1483
1484         JSExports.h should be included as <JavaScriptCore/JSExportMacros.h>
1485         https://bugs.webkit.org/show_bug.cgi?id=182312
1486
1487         Reviewed by Michael Catanzaro.
1488
1489         No new tests. No change in behavior.
1490
1491         * config.h:
1492
1493 2018-01-30  Chris Nardi  <cnardi@chromium.org>
1494
1495         Use double-quotes when serializing font-feature-settings
1496         https://bugs.webkit.org/show_bug.cgi?id=182201
1497
1498         According to the CSSOM spec, all strings should be serialized with double-quotes. The feature
1499         tag value was previously serialized with single-quotes; change this to double-quotes to match
1500         the spec and non-WebKit browsers.
1501
1502         Reviewed by Myles C. Maxfield.
1503
1504         Updated css3/font-feature-settings-parsing.html, fast/css/inherited-properties-rare-text.html,
1505         and fast/text/font-face-javascript.html.
1506
1507         * css/CSSFontFeatureValue.cpp:
1508         (WebCore::CSSFontFeatureValue::customCSSText const):
1509
1510 2018-01-30  Brent Fulgham  <bfulgham@apple.com>
1511
1512         Add telemetry to track storage access API adoption
1513         https://bugs.webkit.org/show_bug.cgi?id=182197
1514         <rdar://problem/35803309>
1515
1516         Reviewed by Chris Dumez.
1517
1518         Part 2: Add telemetry for the Storage Access API case
1519
1520         Adds a new convenience method to identify origin/page/frame combinations that
1521         have been granted access to the Storage Access API. This is used for debug
1522         logging in the NetworkProcess. It is not used in production builds.
1523
1524         * platform/network/NetworkStorageSession.h:
1525         * platform/network/cf/NetworkStorageSessionCFNet.cpp:
1526         (WebCore::NetworkStorageSession::hasStorageAccessForFrame const): Added.
1527
1528 2018-01-30  Ryosuke Niwa  <rniwa@webkit.org>
1529
1530         Release assert in updateLayout() via AXObjectCache::childrenChanged
1531         https://bugs.webkit.org/show_bug.cgi?id=182279
1532         <rdar://problem/36994456>
1533
1534         Reviewed by Antti Koivisto.
1535
1536         Disable the assertion in Document::updateLayout and Document::updateStyle* in this particular circumstance as fixing it
1537         would require a large architectural refactoring of the accessibility code.
1538
1539         Test: accessibility/accessibility-object-update-during-style-resolution-crash.html
1540
1541         * accessibility/AXObjectCache.cpp:
1542         (WebCore::AXObjectCache::childrenChanged): Disabled the release assertion here.
1543         * dom/Document.cpp:
1544         (WebCore::Document::isSafeToUpdateStyleOrLayout const): Check LayoutAssertionDisableScope::shouldDisable.
1545         * dom/ScriptDisallowedScope.h:
1546         (WebCore::ScriptDisallowedScope::LayoutAssertionDisableScope): Added.
1547         (WebCore::ScriptDisallowedScope::LayoutAssertionDisableScope::LayoutAssertionDisableScope): Added.
1548         (WebCore::ScriptDisallowedScope::LayoutAssertionDisableScope::~LayoutAssertionDisableScope): Added.
1549         (WebCore::ScriptDisallowedScope::LayoutAssertionDisableScope::shouldDisable): Added.
1550         * page/LayoutContext.cpp:
1551         (WebCore::LayoutContext::layout): Check LayoutAssertionDisableScope::shouldDisable.
1552
1553 2018-01-30  Zalan Bujtas  <zalan@apple.com>
1554
1555         [RenderTreeBuilder] Move RenderRubyRun::rubyBaseSafe to RenderTreeBuilder::Ruby
1556         https://bugs.webkit.org/show_bug.cgi?id=182306
1557         <rdar://problem/37041440>
1558
1559         Reviewed by Antti Koivisto.
1560
1561         With all the ruby mutation code moving, only RenderTreeBuilder calls RenderRubyRun::rubyBaseSafe.
1562
1563         No change in functionality.
1564
1565         * rendering/RenderRubyRun.cpp:
1566         (WebCore::RenderRubyRun::rubyText const):
1567         (WebCore::RenderRubyRun::rubyBase const):
1568         (WebCore::RenderRubyRun::firstLineBlock const):
1569         (WebCore::RenderRubyRun::takeChild):
1570         (WebCore::RenderRubyRun::rubyBaseSafe): Deleted.
1571         * rendering/RenderRubyRun.h:
1572         * rendering/updating/RenderTreeBuilderRuby.cpp:
1573         (WebCore::RenderTreeBuilder::Ruby::insertChild):
1574         (WebCore::RenderTreeBuilder::Ruby::rubyBaseSafe):
1575         * rendering/updating/RenderTreeBuilderRuby.h:
1576
1577 2018-01-30  Fujii Hironori  <Hironori.Fujii@sony.com>
1578
1579         Unified sources for FEMorphology.cpp seems to break the windows build.
1580         https://bugs.webkit.org/show_bug.cgi?id=178847
1581
1582         Reviewed by Yusuke Suzuki.
1583
1584         Fix a compilation error.
1585         platform/graphics/filters/SpotLightSource.cpp(45): error C2027: use of undefined type 'WebCore::FilterEffect'
1586
1587         No new tests (No behavior change)
1588
1589         * Sources.txt: Removed @no-unify for FEMorphology.cpp.
1590         * platform/graphics/filters/SpotLightSource.cpp: Added #include "FilterEffect.h".
1591
1592 2018-01-30  Myles C. Maxfield  <mmaxfield@apple.com>
1593
1594         Test fix after r227776
1595         https://bugs.webkit.org/show_bug.cgi?id=180951
1596
1597         Unreviewed.
1598
1599         * platform/graphics/cocoa/FontCacheCoreText.cpp:
1600         (WebCore::mandatoryAttributesForUserInstalledFonts):
1601
1602 2018-01-30  Dean Jackson  <dino@apple.com>
1603
1604         CrashTracer: com.apple.WebKit.WebContent at WebCore: WebCore::Document::updateStyleIfNeeded
1605         https://bugs.webkit.org/show_bug.cgi?id=182299
1606         <rdar://problem/36853088>
1607
1608         Removing a misleading comment based on Zalan Bujtas's feedback.
1609
1610         * rendering/RenderElement.cpp:
1611         (WebCore::RenderElement::repaintForPausedImageAnimationsIfNeeded):
1612
1613 2018-01-30  Dean Jackson  <dino@apple.com>
1614
1615         CrashTracer: com.apple.WebKit.WebContent at WebCore: WebCore::Document::updateStyleIfNeeded
1616         https://bugs.webkit.org/show_bug.cgi?id=182299
1617         <rdar://problem/36853088>
1618
1619         Reviewed by Simon Fraser.
1620
1621         Mostly speculative fix for the case where a scrollTo moves an
1622         animated SVG image into view, causing its animation to restart during
1623         a paint operation. This was causing a release ASSERT, so we now defer
1624         the resumption of the animation into a timer.
1625
1626         Test: svg/animated-svgImage-scroll.html
1627
1628         * rendering/RenderElement.cpp:
1629         (WebCore::RenderElement::repaintForPausedImageAnimationsIfNeeded): Enqueue the
1630         animation if it is an SVGImage.
1631         * svg/graphics/SVGImage.cpp: Add a timer to enqueue animation starts.
1632         (WebCore::SVGImage::SVGImage):
1633         (WebCore::SVGImage::startAnimationTimerFired):
1634         (WebCore::SVGImage::enqueueStartAnimation):
1635         (WebCore::SVGImage::stopAnimation):
1636         * svg/graphics/SVGImage.h:
1637
1638 2018-01-30  Chris Dumez  <cdumez@apple.com>
1639
1640         Service worker registration soft updates happen too frequently
1641         https://bugs.webkit.org/show_bug.cgi?id=182296
1642         <rdar://problem/37031862>
1643
1644         Reviewed by Youenn Fablet.
1645
1646         Move code that updates the registration's last update check time from after
1647         the script bytecheck to before, as per:
1648         - https://w3c.github.io/ServiceWorker/#update (step 7.19)
1649
1650         This way, the last update check time gets updated even if the newly fetched
1651         script is identical to the previous one, which is the common case.
1652
1653         * workers/service/server/SWServer.cpp:
1654         (WebCore::SWServer::updateWorker):
1655         * workers/service/server/SWServerJobQueue.cpp:
1656         (WebCore::SWServerJobQueue::scriptFetchFinished):
1657
1658 2018-01-30  Zalan Bujtas  <zalan@apple.com>
1659
1660         [RenderTreeBuilder] Move childBecameNonInline to RenderTreeBuilder
1661         https://bugs.webkit.org/show_bug.cgi?id=182265
1662         <rdar://problem/37004459>
1663
1664         Reviewed by Antti Koivisto.
1665
1666         Move the mutation code that wraps/unwraps a child element when its flow state changes
1667         from(to) in-flow to(from) floating/out-of-flow.
1668
1669         No change in functionality.
1670
1671         * rendering/RenderBlock.cpp:
1672         (WebCore::RenderBlock::childBecameNonInline): Deleted.
1673         * rendering/RenderBlock.h:
1674         * rendering/RenderBoxModelObject.h:
1675         (WebCore::RenderBoxModelObject::childBecameNonInline): Deleted.
1676         * rendering/RenderElement.cpp:
1677         (WebCore::RenderElement::styleDidChange):
1678         (WebCore::RenderElement::handleDynamicFloatPositionChange): Deleted.
1679         * rendering/RenderInline.cpp:
1680         (WebCore::RenderInline::childBecameNonInline): Deleted.
1681         * rendering/RenderInline.h:
1682         * rendering/updating/RenderTreeBuilder.cpp:
1683         (WebCore::RenderTreeBuilder::childFlowStateChangesAndAffectsParentBlock):
1684         (WebCore::RenderTreeBuilder::splitFlow): Deleted.
1685         * rendering/updating/RenderTreeBuilder.h:
1686         * rendering/updating/RenderTreeBuilderBlock.cpp:
1687         (WebCore::RenderTreeBuilder::Block::childBecameNonInline):
1688         * rendering/updating/RenderTreeBuilderBlock.h:
1689         * rendering/updating/RenderTreeBuilderInline.cpp:
1690         (WebCore::RenderTreeBuilder::Inline::childBecameNonInline):
1691         * rendering/updating/RenderTreeBuilderInline.h:
1692
1693 2018-01-30  Brent Fulgham  <bfulgham@apple.com>
1694
1695         Add telemetry to track storage access API adoption
1696         https://bugs.webkit.org/show_bug.cgi?id=182197
1697         <rdar://problem/35803309>
1698
1699         Reviewed by Chris Dumez.
1700         
1701         Partial roll-out of r227755.
1702
1703         The original patch assumed the WebContent process kept track of user interaction. This is
1704         only tracked in the UIProcess, so we can get rid of some of the logging code adding in
1705         r227755.
1706
1707         * loader/ResourceLoadObserver.cpp:
1708         (WebCore::ResourceLoadObserver::logFrameNavigation):
1709         (WebCore::ResourceLoadObserver::logSubresourceLoading):
1710         (WebCore::ResourceLoadObserver::setTimeToLivePartitionFree): Deleted.
1711         (WebCore::ResourceLoadObserver::wasAccessedWithinInteractionWindow const): Deleted.
1712         * loader/ResourceLoadObserver.h:
1713
1714 2018-01-30  Chris Dumez  <cdumez@apple.com>
1715
1716         Make sure we never create a WebSWClientConnection with an invalid sessionID
1717         https://bugs.webkit.org/show_bug.cgi?id=182276
1718         <rdar://problem/36582633>
1719
1720         Reviewed by Alex Christensen.
1721
1722         Make sure we never create a WebSWClientConnection with an invalid sessionID as this
1723         could corrupt our hash tables.
1724
1725         * dom/Document.cpp:
1726         (WebCore::Document::privateBrowsingStateDidChange):
1727         * workers/service/ServiceWorker.cpp:
1728         (WebCore::ServiceWorker::postMessage):
1729         * workers/service/ServiceWorkerContainer.cpp:
1730         (WebCore::ServiceWorkerContainer::ready):
1731         (WebCore::ServiceWorkerContainer::getRegistration):
1732         (WebCore::ServiceWorkerContainer::didFinishGetRegistrationRequest):
1733         (WebCore::ServiceWorkerContainer::getRegistrations):
1734         (WebCore::ServiceWorkerContainer::didFinishGetRegistrationsRequest):
1735         (WebCore::ServiceWorkerContainer::jobResolvedWithRegistration):
1736         (WebCore::ServiceWorkerContainer::ensureSWClientConnection):
1737
1738 2018-01-30  Antti Koivisto  <antti@apple.com>
1739
1740         Avoid traversing too much when doing class change invalidation
1741         https://bugs.webkit.org/show_bug.cgi?id=181604
1742
1743         Reviewed by Zalan Bujtas.
1744
1745         We are now collecting information about which part of the tree a change in class can potentially affect.
1746         Use the information to traverse only the required elements in Style::Invalidator.
1747
1748         The same mechanism can be later used for attribute and id change invalidation.
1749
1750         * css/DocumentRuleSets.cpp:
1751         (WebCore::DocumentRuleSets::collectFeatures const):
1752         (WebCore::DocumentRuleSets::classInvalidationRuleSets const):
1753         (WebCore::DocumentRuleSets::subjectClassRules const): Deleted.
1754         (WebCore::DocumentRuleSets::ancestorClassRules const): Deleted.
1755
1756             Remove separate subject and ancestor invalidation RuleSets. Instead collect all invalidation rulesets
1757             to a vector along with their MatchElements.
1758
1759         * css/DocumentRuleSets.h:
1760         * css/RuleFeature.cpp:
1761         (WebCore::RuleFeatureSet::computeNextMatchElement):
1762         (WebCore::RuleFeatureSet::computeSubSelectorMatchElement):
1763         (WebCore::RuleFeatureSet::collectFeatures):
1764
1765             Similarly collect all class invalidation RuleFeatures to a general HashMap along with the MatchElement.
1766
1767         (WebCore::RuleFeatureSet::add):
1768         (WebCore::RuleFeatureSet::clear):
1769         (WebCore::RuleFeatureSet::shrinkToFit):
1770         * css/RuleFeature.h:
1771         (WebCore::RuleFeature::RuleFeature):
1772         * style/ClassChangeInvalidation.cpp:
1773         (WebCore::Style::ClassChangeInvalidation::computeInvalidation):
1774
1775             Find out InvalidationRuleSets to use.
1776
1777         (WebCore::Style::ClassChangeInvalidation::invalidateStyleWithRuleSets):
1778
1779             Pass them to Style::Invalidator.
1780
1781         * style/ClassChangeInvalidation.h:
1782         * style/StyleInvalidator.cpp:
1783         (WebCore::Style::Invalidator::invalidateStyleForTree):
1784         (WebCore::Style::Invalidator::invalidateStyleForDescendants):
1785         (WebCore::Style::Invalidator::invalidateStyleWithMatchElement):
1786
1787             Traverse only the part of the tree needed by the given MatchElement.
1788
1789         * style/StyleInvalidator.h:
1790         * style/StyleSharingResolver.cpp:
1791         (WebCore::Style::SharingResolver::classNamesAffectedByRules const):
1792
1793 2018-01-30  Javier Fernandez  <jfernandez@igalia.com>
1794
1795         [css-align] The 'baseline' value must be invalid for the 'justify-content' property
1796         https://bugs.webkit.org/show_bug.cgi?id=181794
1797
1798         Reviewed by Antti Koivisto.
1799
1800         The CSS WG has resolved that it doesn't make sense to define Baseline
1801         Content-Alignment in the inline/main axis.
1802
1803         https://github.com/w3c/csswg-drafts/issues/1184
1804
1805         The spec has been updated so that <baseline-postion> is not valid for
1806         the 'justify-content' property's syntax. This CL updates our parsing
1807         logic to match the new spec, including the parsing logic of the
1808         place-content shorthand.
1809
1810         Additionally, this CL updates the computed value of the
1811         <baseline-position> values to match other browsers.
1812
1813         We don't implement support for <baseline-position> values in the
1814         Content Distribution properties (align-content and justify-content),
1815         so I don't expect this change to break content of sites using the CSS
1816         Box Alignment feature.
1817
1818         No new tests, just adapt the Web Platform Tests we already have to the new CSS syntax.
1819
1820         * css/parser/CSSPropertyParser.cpp:
1821         (WebCore::getBaselineKeyword):
1822         (WebCore::consumeBaselineKeyword):
1823         (WebCore::consumeContentDistributionOverflowPosition):
1824         (WebCore::consumeSelfPositionOverflowPosition):
1825         (WebCore::CSSPropertyParser::parseSingleValue):
1826         (WebCore::consumeSimplifiedContentPosition):
1827         (WebCore::CSSPropertyParser::consumePlaceContentShorthand):
1828         (WebCore::consumeSimplifiedItemPosition):
1829
1830 2018-01-30  Basuke Suzuki  <Basuke.Suzuki@sony.com>
1831
1832         [WinCairo] Fix forwarding header conflict of WebKit on WinCairo
1833         https://bugs.webkit.org/show_bug.cgi?id=177202
1834
1835         Reviewed by Alex Christensen.
1836
1837         * PlatformWin.cmake:
1838
1839 2018-01-30  Myles C. Maxfield  <mmaxfield@apple.com>
1840
1841         A disallowed user-installed font may be used if its PostScript name is specified
1842         https://bugs.webkit.org/show_bug.cgi?id=180951
1843
1844         Reviewed by Brent Fulgham.
1845
1846         This patch adds a new CoreText font attribute, kCTFontFallbackOptionAttribute, to the
1847         fonts which WebKit creates. It also adds this attribute to web fonts, so that font
1848         fallback will happen according to our rules about user-installed fonts. It also marks
1849         these font attributes as "mandatory" so CoreText will be guaranteed to follow the
1850         policy.
1851
1852         Test: fast/text/user-installed-fonts/disable.html
1853
1854         * platform/graphics/FontCache.h:
1855         (WebCore::FontDescriptionKey::makeFlagsKey):
1856         * platform/graphics/cocoa/FontCacheCoreText.cpp:
1857         (WebCore::FontDatabase::collectionForFamily):
1858         (WebCore::FontDatabase::fontForPostScriptName):
1859         (WebCore::addAttributesForUserInstalledFonts):
1860         (WebCore::mandatoryAttributesForUserInstalledFonts):
1861         * platform/graphics/mac/FontCustomPlatformData.cpp:
1862         (WebCore::FontCustomPlatformData::fontPlatformData):
1863
1864 2018-01-29  Youenn Fablet  <youenn@apple.com>
1865
1866         Cache API should make sure to resolve caches.open promises in the same order as called
1867         https://bugs.webkit.org/show_bug.cgi?id=182193
1868         <rdar://problem/36930363>
1869
1870         Reviewed by Chris Dumez.
1871
1872         Covered by LayoutTests/http/wpt/cache-storage/cache-open-delete-in-parallel.https.html.
1873
1874         * Modules/cache/DOMCacheStorage.cpp:
1875         (WebCore::DOMCacheStorage::doRemove): Removed optimization consisting in removing the cache from DOMCacheStorage object synchronously.
1876         This optimization prevents going to the network process to try deleting the cache.
1877
1878 2018-01-29  Jiewen Tan  <jiewen_tan@apple.com>
1879
1880         [WebAuthN] Add a compile-time feature flag
1881         https://bugs.webkit.org/show_bug.cgi?id=182211
1882         <rdar://problem/36936365>
1883
1884         Reviewed by Brent Fulgham.
1885
1886         Add a compile-time feature flag for WebAuthN as most of the functionality is platform
1887         dependent.
1888
1889         No tests.
1890
1891         * Configurations/FeatureDefines.xcconfig:
1892         * Modules/credentialmanagement/BasicCredential.cpp:
1893         * Modules/credentialmanagement/BasicCredential.h:
1894         * Modules/credentialmanagement/BasicCredential.idl:
1895         * Modules/credentialmanagement/CredentialCreationOptions.h:
1896         * Modules/credentialmanagement/CredentialCreationOptions.idl:
1897         * Modules/credentialmanagement/CredentialRequestOptions.h:
1898         * Modules/credentialmanagement/CredentialRequestOptions.idl:
1899         * Modules/credentialmanagement/CredentialsContainer.cpp:
1900         * Modules/credentialmanagement/CredentialsContainer.h:
1901         * Modules/credentialmanagement/CredentialsContainer.idl:
1902         * Modules/credentialmanagement/NavigatorCredentials.cpp:
1903         * Modules/credentialmanagement/NavigatorCredentials.h:
1904         * Modules/credentialmanagement/NavigatorCredentials.idl:
1905         * Modules/webauthn/Authenticator.cpp:
1906         * Modules/webauthn/Authenticator.h:
1907         * Modules/webauthn/AuthenticatorAssertionResponse.cpp:
1908         * Modules/webauthn/AuthenticatorAssertionResponse.h:
1909         * Modules/webauthn/AuthenticatorAssertionResponse.idl:
1910         * Modules/webauthn/AuthenticatorAttestationResponse.cpp:
1911         * Modules/webauthn/AuthenticatorAttestationResponse.h:
1912         * Modules/webauthn/AuthenticatorAttestationResponse.idl:
1913         * Modules/webauthn/AuthenticatorResponse.cpp:
1914         * Modules/webauthn/AuthenticatorResponse.h:
1915         * Modules/webauthn/AuthenticatorResponse.idl:
1916         * Modules/webauthn/PublicKeyCredential.cpp:
1917         * Modules/webauthn/PublicKeyCredential.h:
1918         * Modules/webauthn/PublicKeyCredential.idl:
1919         * Modules/webauthn/PublicKeyCredentialCreationOptions.h:
1920         * Modules/webauthn/PublicKeyCredentialCreationOptions.idl:
1921         * Modules/webauthn/PublicKeyCredentialDescriptor.h:
1922         * Modules/webauthn/PublicKeyCredentialDescriptor.idl:
1923         * Modules/webauthn/PublicKeyCredentialRequestOptions.h:
1924         * Modules/webauthn/PublicKeyCredentialRequestOptions.idl:
1925         * Modules/webauthn/PublicKeyCredentialType.h:
1926         * Modules/webauthn/PublicKeyCredentialType.idl:
1927         * bindings/js/JSAuthenticatorResponseCustom.cpp:
1928         * bindings/js/JSBasicCredentialCustom.cpp:
1929
1930 2018-01-29  John Wilander  <wilander@apple.com>
1931
1932         Resource Load Statistics: Introduce debug mode as experimental feature
1933         https://bugs.webkit.org/show_bug.cgi?id=182199
1934         <rdar://problem/36930364>
1935
1936         Reviewed by Alex Christensen.
1937
1938         No new tests. This adds an experimental feature.
1939
1940         The only changes to default behavior are:
1941         - Increased resolution on timestamps which is needed to be able to set shorter
1942           timeouts in debug mode.
1943         - Only update partitioning and blocking table when needed. This is an optimization
1944           which pays off in less XPC with shorter timeouts.
1945
1946         * loader/ResourceLoadObserver.cpp:
1947         (WebCore::reduceTimeResolution):
1948         (WebCore::ResourceLoadObserver::logFrameNavigation):
1949         (WebCore::ResourceLoadObserver::logSubresourceLoading):
1950         (WebCore::ResourceLoadObserver::logWebSocketLoading):
1951         (WebCore::ResourceLoadObserver::logUserInteractionWithReducedTimeResolution):
1952         (WebCore::reduceToHourlyTimeResolution): Deleted.
1953         * page/RuntimeEnabledFeatures.h:
1954         (WebCore::RuntimeEnabledFeatures::setResourceLoadStatisticsDebugMode):
1955         (WebCore::RuntimeEnabledFeatures::resourceLoadStatisticsDebugMode const):
1956         * page/Settings.yaml:
1957
1958 2018-01-29  Oleksandr Skachkov  <gskachkov@gmail.com>
1959
1960         FetchResponse should support ConsumeData callback on chunk data is received: handling ReadableStream bodies
1961         https://bugs.webkit.org/show_bug.cgi?id=182008
1962
1963         Reviewed by Youenn Fablet.
1964
1965         Modify FetchResponse to support ConsumeData callback with 
1966         handling of ReadableStream by chunks
1967
1968         * Modules/cache/DOMCache.cpp:
1969         (WebCore::DOMCache::put):
1970         * Modules/fetch/FetchBodyConsumer.cpp:
1971         (WebCore::FetchBodyConsumer::resolve):
1972         * Modules/fetch/FetchResponse.cpp:
1973         (WebCore::FetchResponse::consumeBodyFromReadableStream):
1974         * Modules/fetch/FetchResponse.h:
1975         * Modules/streams/ReadableStreamChunk.h: Added.
1976         * Modules/streams/ReadableStreamSink.cpp:
1977         (WebCore::ReadableStreamToSharedBufferSink::enqueue):
1978         (WebCore::ReadableStreamToSharedBufferSink::close):
1979         * Modules/streams/ReadableStreamSink.h:
1980         * WebCore.xcodeproj/project.pbxproj:
1981         * workers/service/context/ServiceWorkerFetch.cpp:
1982         (WebCore::ServiceWorkerFetch::processResponse):
1983
1984 2018-01-29  Andy Estes  <aestes@apple.com>
1985
1986         [iOS] Restrict synthetic clicks to the origin that handled the underlying touch event
1987         https://bugs.webkit.org/show_bug.cgi?id=182252
1988         <rdar://problem/21555881>
1989
1990         Reviewed by Tim Horton.
1991
1992         Test: http/tests/events/touch/ios/cross-frame-single-tap-same-origin.https.html
1993
1994         * dom/Document.h:
1995         (WebCore::Document::handlingTouchEvent const):
1996         * page/EventHandler.h:
1997         (WebCore::EventHandler::touchEventTargetSubframe const):
1998         (WebCore::EventHandler::touches const):
1999
2000         Exposed some information needed by WebPage::updatePotentialTapSecurityOrigin().
2001
2002         * page/Frame.h:
2003         * page/ios/FrameIOS.mm:
2004         (WebCore::Frame::betterApproximateNode):
2005         (WebCore::Frame::qualifyingNodeAtViewportLocation):
2006
2007         Changed NodeQualifier from a function pointer to a WTF::Function.
2008
2009         (WebCore::Frame::nodeRespondingToClickEvents):
2010
2011         Turned ancestorRespondingToClickEvents() into a lambda that captures originRestriction. In
2012         the lambda, if there is an origin restriction, return nullptr if the hit test result's inner
2013         Node is not in the restricted origin.
2014
2015         (WebCore::Frame::nodeRespondingToScrollWheelEvents):
2016
2017         Turned ancestorRespondingToScrollWheelEvents() into a lambda.
2018
2019         (WebCore::ancestorRespondingToScrollWheelEvents):
2020
2021         Moved to lambda in nodeRespondingToScrollWheelEvents().
2022
2023         (WebCore::ancestorRespondingToClickEvents):
2024
2025         Moved to lambda in nodeRespondingToClickEvents().
2026
2027 2018-01-29  Emilio Cobos Álvarez  <emilio@crisal.io>
2028
2029         Trivially cleanup std::optional usage in RenderBlockFlow.
2030         https://bugs.webkit.org/show_bug.cgi?id=182142
2031
2032         Reviewed by Antti Koivisto.
2033
2034         No new tests, no behavior change.
2035
2036         * rendering/RenderBlockFlow.cpp:
2037         (WebCore::RenderBlockFlow::firstLineBaseline const):
2038         (WebCore::RenderBlockFlow::inlineBlockBaseline const):
2039
2040 2018-01-29  Brent Fulgham  <bfulgham@apple.com>
2041
2042         Add telemetry to track storage access API adoption
2043         https://bugs.webkit.org/show_bug.cgi?id=182197
2044         <rdar://problem/35803309>
2045
2046         Reviewed by Chris Dumez.
2047         
2048         Part 1: Add telemetry for the user interaction case
2049         
2050         This patch adds telemetry to track how frequently third-party cookies are
2051         used in a first party context due to user interaction. This will help
2052         understand cases where the new Storage Access API can help, and to help
2053         us understand if we have considered relevant use cases in its design.
2054
2055         * loader/ResourceLoadObserver.cpp:
2056         (WebCore::ResourceLoadObserver::setTimeToLivePartitionFree): Let the observer
2057         know the first party interaction duration.
2058         (WebCore::ResourceLoadObserver::wasAccessedWithinInteractionWindow const): Added.
2059         (WebCore::ResourceLoadObserver::logFrameNavigation): Note when a third party 
2060         resource is accessed as a first party due to user interaction. 
2061         (WebCore::ResourceLoadObserver::logSubresourceLoading): Ditto.
2062         * loader/ResourceLoadObserver.h:
2063         * loader/ResourceLoadStatistics.cpp:
2064         (WebCore::ResourceLoadStatistics::encode const): Handle new fields.
2065         (WebCore::ResourceLoadStatistics::decode): Ditto.
2066         * loader/ResourceLoadStatistics.h:
2067
2068 2018-01-29  Antti Koivisto  <antti@apple.com>
2069
2070         CalcExpressionBlendLength::evaluate hits stack limit
2071         https://bugs.webkit.org/show_bug.cgi?id=182243
2072
2073         Reviewed by Zalan Bujtas.
2074
2075         Speculative fix to prevent nesting of CalcExpressionBlendLength.
2076
2077         No test, don't know how to make one.
2078
2079         * platform/CalculationValue.cpp:
2080         (WebCore::CalcExpressionBlendLength::CalcExpressionBlendLength):
2081
2082         CalcExpressionBlendLength is only used in Length values of animated style. Normally such styles are not used
2083         as input for further blending but there are some paths where this could in principle happen. Repeated
2084         application (for each animation frame) could construct CalcExpressionBlendLength expression that blows
2085         the stack when evaluated.
2086
2087         Speculatively fix by flattening any nesting.
2088
2089         * platform/CalculationValue.h:
2090         (WebCore::CalcExpressionBlendLength::CalcExpressionBlendLength): Deleted.
2091
2092 2018-01-29  Chris Dumez  <cdumez@apple.com>
2093
2094         Drop unnecessary "ServiceWorker Task Thread" in SWServer
2095         https://bugs.webkit.org/show_bug.cgi?id=182253
2096
2097         Reviewed by Youenn Fablet.
2098
2099         Drop unnecessary "ServiceWorker Task Thread" in SWServer. We're spinning a thread for
2100         each SWServer that is never used.
2101
2102         * workers/service/server/SWServer.cpp:
2103         (WebCore::SWServer::~SWServer):
2104         (WebCore::SWServer::SWServer):
2105         (WebCore::SWServer::taskThreadEntryPoint): Deleted.
2106         (WebCore::SWServer::postTask): Deleted.
2107         (WebCore::SWServer::postTaskReply): Deleted.
2108         (WebCore::SWServer::handleTaskRepliesOnMainThread): Deleted.
2109         * workers/service/server/SWServer.h:
2110
2111 2018-01-29  Matt Lewis  <jlewis3@apple.com>
2112
2113         Unreviewed, rolling out r227731.
2114
2115         This caused and assertion failure in API tests.
2116
2117         Reverted changeset:
2118
2119         "Layout Test fast/events/beforeunload-dom-manipulation-
2120         crash.html is crashing"
2121         https://bugs.webkit.org/show_bug.cgi?id=181204
2122         https://trac.webkit.org/changeset/227731
2123
2124 2018-01-29  Brady Eidson  <beidson@apple.com>
2125
2126         Make it possible for apps that use both WK1 and WK2 to use MessagePorts.
2127         https://bugs.webkit.org/show_bug.cgi?id=182229
2128
2129         Reviewed by Chris Dumez.
2130
2131         Covered by existing LayoutTests and a new API test.
2132
2133         * dom/messageports/MessagePortChannel.cpp:
2134         (WebCore::MessagePortChannel::checkRemotePortForActivity): Don't use the global singleton
2135           provider. Instead use the provider that belongs to the owning registry.
2136
2137         * dom/messageports/MessagePortChannelProviderImpl.cpp:
2138         (WebCore::MessagePortChannelProviderImpl::MessagePortChannelProviderImpl): Pass a reference
2139           to *this to the Registry.
2140         * dom/messageports/MessagePortChannelProviderImpl.h:
2141
2142         * dom/messageports/MessagePortChannelRegistry.cpp:
2143         (WebCore::MessagePortChannelRegistry::MessagePortChannelRegistry): Keep a Provider member so
2144           MessagePortChannels can get to it instead of relying on the global singleton provider.
2145         * dom/messageports/MessagePortChannelRegistry.h:
2146         (WebCore::MessagePortChannelRegistry::provider):
2147
2148 2018-01-29  Per Arne Vollan  <pvollan@apple.com>
2149
2150         Layout Test fast/events/beforeunload-dom-manipulation-crash.html is crashing
2151         https://bugs.webkit.org/show_bug.cgi?id=181204
2152         <rdar://problem/36256274>
2153
2154         Reviewed by Ryosuke Niwa.
2155
2156         When a frame element is moved in the DOM tree during the execution of a beforeunload handler,
2157         the frame will be detached when removed from its previous position in the DOM tree. When being
2158         detached, an attempt will also be made to stop the load by calling FrameLoader::stopAllLoaders().
2159         However, this method will return early when executed in a beforeunload handler, since navigation
2160         is not allowed then. The end result is a detached frame which will continue to load, and hitting
2161         asserts in DocumentLoader::dataReceived(), and DocumentLoader::notifyFinished(). It should be
2162         possible to stop a frame load, even when executing a beforeunload handler.
2163
2164         No new tests. Covered by the existing test fast/events/beforeunload-dom-manipulation-crash.html.
2165
2166         * loader/FrameLoader.cpp:
2167         (WebCore::FrameLoader::isStopLoadingAllowed const):
2168         (WebCore::FrameLoader::stopAllLoaders):
2169         * loader/FrameLoader.h:
2170
2171 2018-01-29  Miguel Gomez  <magomez@igalia.com>
2172
2173         [CoordnatedGraphics] A child layer of a semitransparent layer isn't clipped properly
2174         https://bugs.webkit.org/show_bug.cgi?id=181080
2175
2176         Reviewed by Žan Doberšek.
2177
2178         Check whether the applied clipping area is empty before drawing the children of a TextureMapperLayer. If
2179         the area is empty no children will be drawn, so we can avoid drawing them.
2180
2181         No new tests -- no change in behavior.
2182
2183         * platform/graphics/texmap/TextureMapperLayer.cpp:
2184         (WebCore::TextureMapperLayer::paintSelfAndChildren):
2185
2186 2018-01-29  Zan Dobersek  <zdobersek@igalia.com>
2187
2188         [Cairo] Add GraphicsContextImplCairo::createFactory() helpers
2189         https://bugs.webkit.org/show_bug.cgi?id=182238
2190
2191         Reviewed by Carlos Garcia Campos.
2192
2193         Instead of duplicating lambdas that return a newly-created
2194         GraphicsContextImplCairo object, provide static createFactory() helpers
2195         on that class that produce GraphicsContextImplFactory wrappers which are
2196         then invoked in the GraphicsContext constructor. The static functions
2197         accept either the PlatformContextCairo reference or the cairo_t pointer,
2198         invoking the proper GraphicsContextImplCairo constructor in the returned
2199         lambda wrapper.
2200
2201         No new tests -- no change in functionality.
2202
2203         * platform/graphics/cairo/GraphicsContextImplCairo.cpp:
2204         (WebCore::GraphicsContextImplCairo::createFactory):
2205         * platform/graphics/cairo/GraphicsContextImplCairo.h:
2206         * platform/graphics/cairo/ImageBufferCairo.cpp:
2207         (WebCore::ImageBuffer::ImageBuffer):
2208         * platform/graphics/cairo/PathCairo.cpp:
2209         (WebCore::Path::strokeBoundingRect const):
2210         (WebCore::Path::strokeContains const):
2211         * platform/graphics/nicosia/NicosiaPaintingContextCairo.cpp:
2212         (Nicosia::PaintingContextCairo::PaintingContextCairo):
2213         * platform/graphics/win/ImageCairoWin.cpp:
2214         (WebCore::BitmapImage::getHBITMAPOfSize):
2215
2216 2018-01-29  Zan Dobersek  <zdobersek@igalia.com>
2217
2218         Construct GraphicsContext with NonPaintingReasons::NoReason in FrameView::adjustPageHeightDeprecated()
2219         https://bugs.webkit.org/show_bug.cgi?id=182235
2220
2221         Reviewed by Carlos Garcia Campos.
2222
2223         Pass the NonPaintingReasons::NoReason value to the GraphicsContext
2224         constructor in FrameView::adjustPageHeightDeprecated(). This has the
2225         same effect as when passing a null PlatformGraphicsContext to the
2226         constructor, which effectively disables any painting through that
2227         GraphicsContext, but doesn't have a platform-specific connotation.
2228
2229         No new tests -- no change in functionality.
2230
2231         * page/FrameView.cpp:
2232         (WebCore::FrameView::adjustPageHeightDeprecated):
2233
2234 2018-01-29  Zan Dobersek  <zdobersek@igalia.com>
2235
2236         [Cairo] Remove the GraphicsContext(cairo_t*) constructor
2237         https://bugs.webkit.org/show_bug.cgi?id=182234
2238
2239         Reviewed by Carlos Garcia Campos.
2240
2241         Instead of using the GraphicsContext(cairo_t*) constructor, leverage the
2242         GraphicsContextImplCairo class and work with an existing Cairo context
2243         through that GraphicsContextImpl implementation.
2244
2245         A new GraphicsContextImplCairo constructor is added, expecting pointer
2246         to the cairo_t object. With that, a PlatformContextCairo object is
2247         created, with ownership of that object now being handled by the
2248         GraphicsContextImplCairo class.
2249
2250         Call sites of the GraphicsContext(cairo_t*) constructor are adjusted to
2251         instead provide a factory function that returns a fresh
2252         GraphicsContextImplCairo object, passing that cairo_t object to its
2253         constructor.
2254
2255         No new tests -- no change in behavior.
2256
2257         * platform/graphics/GraphicsContext.h:
2258         * platform/graphics/cairo/GraphicsContextCairo.cpp:
2259         (WebCore::GraphicsContext::GraphicsContext): Deleted.
2260         * platform/graphics/cairo/GraphicsContextImplCairo.cpp:
2261         (WebCore::GraphicsContextImplCairo::GraphicsContextImplCairo):
2262         (WebCore::m_private):
2263         * platform/graphics/cairo/GraphicsContextImplCairo.h:
2264         * platform/graphics/cairo/PathCairo.cpp:
2265         (WebCore::Path::strokeBoundingRect const):
2266         (WebCore::Path::strokeContains const):
2267         * platform/graphics/win/ImageCairoWin.cpp:
2268         (WebCore::BitmapImage::getHBITMAPOfSize):
2269
2270 2018-01-28  Minsheng Liu  <lambda@liu.ms>
2271
2272         Overflow of formulas is hidden for display mathematics
2273         https://bugs.webkit.org/show_bug.cgi?id=160547
2274
2275         Reviewed by Frédéric Wang.
2276
2277         Previously, <math> with display="block" uses its container's logical width as logical width.
2278         However, that behavior will truncate overflowed contents. The patch fixes it by setting
2279         the logical width as its content width rather than its container's logical width
2280         if the former is wider than the latter.
2281
2282         Test: mathml/presentation/display-math-horizontal-overflow.html
2283
2284         * rendering/mathml/RenderMathMLRow.cpp:
2285         (WebCore::RenderMathMLRow::layoutBlock):
2286
2287 2018-01-26  Antoine Quint  <graouts@apple.com>
2288
2289         [Web Animations] Distinguish between an omitted and a null timeline argument to the Animation constructor
2290         https://bugs.webkit.org/show_bug.cgi?id=179065
2291         <rdar://problem/36869046>
2292
2293         Reviewed by Dean Jackson.
2294
2295         The Web Animations specification requires that a missing or undefined "timeline" parameter means that the
2296         document's timeline should be used, but a null value should be supported. To support this, we need to provide
2297         a custom Animation constructor where we can check on the ExecState whether the second argument passed is
2298         undefined, which is true if an explicit "undefined" value is passed or if the argument does not exist.
2299
2300         * Sources.txt: Add the new JSWebAnimationCustom.cpp file.
2301         * WebCore.xcodeproj/project.pbxproj: Add the new JSWebAnimationCustom.cpp file.
2302         * animation/WebAnimation.cpp:
2303         (WebCore::WebAnimation::create): Add a create() variant that doesn't provide an AnimationTimeline parameter
2304         to clearly indicate that the provided Document's timeline should be used.
2305         * animation/WebAnimation.h:
2306         * animation/WebAnimation.idl:
2307         * bindings/js/JSWebAnimationCustom.cpp: Added.
2308         (WebCore::constructJSWebAnimation): Provide a custom Animation constructor where we check whether the second
2309         argument, the timeline, is undefined.
2310         * dom/Element.cpp:
2311         (WebCore::Element::animate): Use the new create() variant since passing "nullptr" now means a null timeline.
2312
2313 2018-01-26  Ricky Mondello  <rmondello@apple.com>
2314
2315         Use the standard -webkit-autofill color on iOS
2316         https://bugs.webkit.org/show_bug.cgi?id=182182
2317
2318         Reviewed by Tim Horton.
2319
2320         * css/html.css:
2321         (input:-webkit-autofill, input:-webkit-autofill-strong-password):
2322
2323 2018-01-26  Dean Jackson  <dino@apple.com>
2324
2325         REGRESSION (r222961): Clear function not clearing whole screen when antialias is set to false
2326         https://bugs.webkit.org/show_bug.cgi?id=179368
2327         <rdar://problem/36111549>
2328
2329         Reviewed by Sam Weinig.
2330
2331         When we changed from using a CAOpenGLLayer to a regular CALayer, we should
2332         have also swapped the "opaque" property to "contentsOpaque".
2333
2334         Covered by the existing test: fast/canvas/webgl/context-attributes-alpha.html
2335         (when run on some hardware!)
2336
2337         * platform/graphics/cocoa/WebGLLayer.mm:
2338         (-[WebGLLayer initWithGraphicsContext3D:]):
2339
2340 2018-01-26  Mark Lam  <mark.lam@apple.com>
2341
2342         Add infrastructure for pointer preparation.
2343         https://bugs.webkit.org/show_bug.cgi?id=182191
2344         <rdar://problem/36889194>
2345
2346         Reviewed by JF Bastien.
2347
2348         No new tests because this patch does not introduce any behavior change.
2349
2350         * bindings/scripts/CodeGeneratorJS.pm:
2351         (GenerateImplementation):
2352         * bindings/scripts/test/JS/JSInterfaceName.cpp:
2353         (WebCore::toJSNewlyCreated):
2354         * bindings/scripts/test/JS/JSMapLike.cpp:
2355         (WebCore::toJSNewlyCreated):
2356         * bindings/scripts/test/JS/JSReadOnlyMapLike.cpp:
2357         (WebCore::toJSNewlyCreated):
2358         * bindings/scripts/test/JS/JSTestActiveDOMObject.cpp:
2359         (WebCore::toJSNewlyCreated):
2360         * bindings/scripts/test/JS/JSTestCEReactions.cpp:
2361         (WebCore::toJSNewlyCreated):
2362         * bindings/scripts/test/JS/JSTestCEReactionsStringifier.cpp:
2363         (WebCore::toJSNewlyCreated):
2364         * bindings/scripts/test/JS/JSTestCallTracer.cpp:
2365         (WebCore::toJSNewlyCreated):
2366         * bindings/scripts/test/JS/JSTestClassWithJSBuiltinConstructor.cpp:
2367         (WebCore::toJSNewlyCreated):
2368         * bindings/scripts/test/JS/JSTestCustomConstructorWithNoInterfaceObject.cpp:
2369         (WebCore::toJSNewlyCreated):
2370         * bindings/scripts/test/JS/JSTestDOMJIT.cpp:
2371         * bindings/scripts/test/JS/JSTestEnabledBySetting.cpp:
2372         (WebCore::toJSNewlyCreated):
2373         * bindings/scripts/test/JS/JSTestEventConstructor.cpp:
2374         (WebCore::toJSNewlyCreated):
2375         * bindings/scripts/test/JS/JSTestEventTarget.cpp:
2376         (WebCore::toJSNewlyCreated):
2377         * bindings/scripts/test/JS/JSTestException.cpp:
2378         (WebCore::toJSNewlyCreated):
2379         * bindings/scripts/test/JS/JSTestGenerateIsReachable.cpp:
2380         (WebCore::toJSNewlyCreated):
2381         * bindings/scripts/test/JS/JSTestGlobalObject.cpp:
2382         (WebCore::toJSNewlyCreated):
2383         * bindings/scripts/test/JS/JSTestIndexedSetterNoIdentifier.cpp:
2384         (WebCore::toJSNewlyCreated):
2385         * bindings/scripts/test/JS/JSTestIndexedSetterThrowingException.cpp:
2386         (WebCore::toJSNewlyCreated):
2387         * bindings/scripts/test/JS/JSTestIndexedSetterWithIdentifier.cpp:
2388         (WebCore::toJSNewlyCreated):
2389         * bindings/scripts/test/JS/JSTestInterface.cpp:
2390         * bindings/scripts/test/JS/JSTestInterfaceLeadingUnderscore.cpp:
2391         * bindings/scripts/test/JS/JSTestIterable.cpp:
2392         (WebCore::toJSNewlyCreated):
2393         * bindings/scripts/test/JS/JSTestJSBuiltinConstructor.cpp:
2394         * bindings/scripts/test/JS/JSTestMediaQueryListListener.cpp:
2395         (WebCore::toJSNewlyCreated):
2396         * bindings/scripts/test/JS/JSTestNamedAndIndexedSetterNoIdentifier.cpp:
2397         (WebCore::toJSNewlyCreated):
2398         * bindings/scripts/test/JS/JSTestNamedAndIndexedSetterThrowingException.cpp:
2399         (WebCore::toJSNewlyCreated):
2400         * bindings/scripts/test/JS/JSTestNamedAndIndexedSetterWithIdentifier.cpp:
2401         (WebCore::toJSNewlyCreated):
2402         * bindings/scripts/test/JS/JSTestNamedConstructor.cpp:
2403         (WebCore::toJSNewlyCreated):
2404         * bindings/scripts/test/JS/JSTestNamedDeleterNoIdentifier.cpp:
2405         (WebCore::toJSNewlyCreated):
2406         * bindings/scripts/test/JS/JSTestNamedDeleterThrowingException.cpp:
2407         (WebCore::toJSNewlyCreated):
2408         * bindings/scripts/test/JS/JSTestNamedDeleterWithIdentifier.cpp:
2409         (WebCore::toJSNewlyCreated):
2410         * bindings/scripts/test/JS/JSTestNamedDeleterWithIndexedGetter.cpp:
2411         (WebCore::toJSNewlyCreated):
2412         * bindings/scripts/test/JS/JSTestNamedGetterCallWith.cpp:
2413         (WebCore::toJSNewlyCreated):
2414         * bindings/scripts/test/JS/JSTestNamedGetterNoIdentifier.cpp:
2415         (WebCore::toJSNewlyCreated):
2416         * bindings/scripts/test/JS/JSTestNamedGetterWithIdentifier.cpp:
2417         (WebCore::toJSNewlyCreated):
2418         * bindings/scripts/test/JS/JSTestNamedSetterNoIdentifier.cpp:
2419         (WebCore::toJSNewlyCreated):
2420         * bindings/scripts/test/JS/JSTestNamedSetterThrowingException.cpp:
2421         (WebCore::toJSNewlyCreated):
2422         * bindings/scripts/test/JS/JSTestNamedSetterWithIdentifier.cpp:
2423         (WebCore::toJSNewlyCreated):
2424         * bindings/scripts/test/JS/JSTestNamedSetterWithIndexedGetter.cpp:
2425         (WebCore::toJSNewlyCreated):
2426         * bindings/scripts/test/JS/JSTestNamedSetterWithIndexedGetterAndSetter.cpp:
2427         (WebCore::toJSNewlyCreated):
2428         * bindings/scripts/test/JS/JSTestNamedSetterWithOverrideBuiltins.cpp:
2429         (WebCore::toJSNewlyCreated):
2430         * bindings/scripts/test/JS/JSTestNamedSetterWithUnforgableProperties.cpp:
2431         (WebCore::toJSNewlyCreated):
2432         * bindings/scripts/test/JS/JSTestNamedSetterWithUnforgablePropertiesAndOverrideBuiltins.cpp:
2433         (WebCore::toJSNewlyCreated):
2434         * bindings/scripts/test/JS/JSTestNode.cpp:
2435         (WebCore::toJSNewlyCreated):
2436         * bindings/scripts/test/JS/JSTestObj.cpp:
2437         (WebCore::toJSNewlyCreated):
2438         * bindings/scripts/test/JS/JSTestOverloadedConstructors.cpp:
2439         (WebCore::toJSNewlyCreated):
2440         * bindings/scripts/test/JS/JSTestOverloadedConstructorsWithSequence.cpp:
2441         (WebCore::toJSNewlyCreated):
2442         * bindings/scripts/test/JS/JSTestOverrideBuiltins.cpp:
2443         (WebCore::toJSNewlyCreated):
2444         * bindings/scripts/test/JS/JSTestPluginInterface.cpp:
2445         (WebCore::toJSNewlyCreated):
2446         * bindings/scripts/test/JS/JSTestPromiseRejectionEvent.cpp:
2447         (WebCore::toJSNewlyCreated):
2448         * bindings/scripts/test/JS/JSTestSerialization.cpp:
2449         (WebCore::toJSNewlyCreated):
2450         * bindings/scripts/test/JS/JSTestSerializationIndirectInheritance.cpp:
2451         * bindings/scripts/test/JS/JSTestSerializationInherit.cpp:
2452         * bindings/scripts/test/JS/JSTestSerializationInheritFinal.cpp:
2453         * bindings/scripts/test/JS/JSTestSerializedScriptValueInterface.cpp:
2454         (WebCore::toJSNewlyCreated):
2455         * bindings/scripts/test/JS/JSTestStringifier.cpp:
2456         (WebCore::toJSNewlyCreated):
2457         * bindings/scripts/test/JS/JSTestStringifierAnonymousOperation.cpp:
2458         (WebCore::toJSNewlyCreated):
2459         * bindings/scripts/test/JS/JSTestStringifierNamedOperation.cpp:
2460         (WebCore::toJSNewlyCreated):
2461         * bindings/scripts/test/JS/JSTestStringifierOperationImplementedAs.cpp:
2462         (WebCore::toJSNewlyCreated):
2463         * bindings/scripts/test/JS/JSTestStringifierOperationNamedToString.cpp:
2464         (WebCore::toJSNewlyCreated):
2465         * bindings/scripts/test/JS/JSTestStringifierReadOnlyAttribute.cpp:
2466         (WebCore::toJSNewlyCreated):
2467         * bindings/scripts/test/JS/JSTestStringifierReadWriteAttribute.cpp:
2468         (WebCore::toJSNewlyCreated):
2469         * bindings/scripts/test/JS/JSTestTypedefs.cpp:
2470         (WebCore::toJSNewlyCreated):
2471
2472 2018-01-26  Simon Fraser  <simon.fraser@apple.com>
2473
2474         REGRESSiON (r226492): Crash under Element::absoluteEventBounds() on a SVGPathElement which has not been laid out yet
2475         https://bugs.webkit.org/show_bug.cgi?id=182185
2476         rdar://problem/36836262
2477
2478         Reviewed by Zalan Bujtas.
2479
2480         Document::absoluteRegionForEventTargets() can fire when layout is dirty, and SVGPathElement's path() can be null if it
2481         hasn't been laid out yet. So protect against a null path in getBBox().
2482
2483         Not easily testable because internals.nonFastScrollableRects() forces layout, and the crash depends on the timing of
2484         absoluteRegionForEventTargets().
2485
2486         * svg/SVGPathElement.cpp:
2487         (WebCore::SVGPathElement::getBBox):
2488
2489 2018-01-26  Chris Dumez  <cdumez@apple.com>
2490
2491         Offlined content does not work for apps on home screen
2492         https://bugs.webkit.org/show_bug.cgi?id=182070
2493         <rdar://problem/36843906>
2494
2495         Reviewed by Youenn Fablet.
2496
2497         Already registered service workers were unable to intercept the very first
2498         load because registration matching was happening after the registration
2499         was loaded from disk, but *before* its active worker was populated.
2500
2501         We now initialize the registrations' active worker as soon as we load
2502         them from disk. We do not necessarily have a SW Context process connection
2503         identifier yet at this point so I made it optional on the SWServerWorker.
2504         This identifier gets set on the SWServerWorker when the worker is actually
2505         launched and gets cleared when the SWServerWorker gets terminated.
2506
2507         Covered by new API test.
2508
2509         * workers/service/server/SWServer.cpp:
2510         (WebCore::SWServer::addRegistrationFromStore):
2511         (WebCore::SWServer::installContextData):
2512         (WebCore::SWServer::terminateWorkerInternal):
2513         (WebCore::SWServer::workerContextTerminated):
2514         (WebCore::SWServer::fireInstallEvent):
2515         (WebCore::SWServer::fireActivateEvent):
2516         * workers/service/server/SWServerWorker.cpp:
2517         (WebCore::SWServerWorker::SWServerWorker):
2518         * workers/service/server/SWServerWorker.h:
2519         (WebCore::SWServerWorker::contextConnectionIdentifier const):
2520         (WebCore::SWServerWorker::setContextConnectionIdentifier):
2521
2522 2018-01-26  Chris Nardi  <cnardi@chromium.org>
2523
2524         Addressing post-review comments after r226614
2525         https://bugs.webkit.org/show_bug.cgi?id=182151
2526
2527         Reviewed by Myles C. Maxfield.
2528
2529         * html/HTMLTextAreaElement.cpp:
2530         (WebCore::HTMLTextAreaElement::sanitizeUserInputValue):
2531         * html/TextFieldInputType.cpp:
2532         (WebCore::limitLength):
2533         * platform/LocalizedStrings.cpp:
2534         (WebCore::truncatedStringForLookupMenuItem):
2535         * rendering/updating/RenderTreeBuilderFirstLetter.cpp:
2536         (WebCore::RenderTreeBuilder::FirstLetter::createRenderers):
2537
2538 2018-01-26  Antoine Quint  <graouts@apple.com>
2539
2540         [iOS] prefers-reduced-motion media query is not working
2541         https://bugs.webkit.org/show_bug.cgi?id=182169
2542         <rdar://problem/36801631>
2543
2544         Reviewed by Dean Jackson.
2545
2546         The code that would eventually query UIKit for the system setting was not run since USE(NEW_THEME) is off on iOS.
2547         Adding a PLATFORM(IOS) flag here allows the code to run.
2548
2549         * css/MediaQueryEvaluator.cpp:
2550         (WebCore::prefersReducedMotionEvaluate):
2551
2552 2018-01-26  Youenn Fablet  <youenn@apple.com>
2553
2554         CSP post checks should be done for service worker responses
2555         https://bugs.webkit.org/show_bug.cgi?id=182160
2556
2557         Reviewed by Daniel Bates.
2558
2559         Covered by updated test.
2560
2561         Add security checks when receiving a service worker response.
2562
2563         * loader/SubresourceLoader.cpp:
2564         (WebCore::SubresourceLoader::didReceiveResponse):
2565         * loader/cache/CachedResourceLoader.h:
2566
2567 2018-01-26  Manuel Rego Casasnovas  <rego@igalia.com>
2568
2569         [css-multicol] Support percentages in column-gap
2570         https://bugs.webkit.org/show_bug.cgi?id=182004
2571
2572         Reviewed by Javier Fernandez.
2573
2574         This patch adds percentage support to column-gap property.
2575
2576         Most of the changes are related to the parsing logic,
2577         the column-gap property now accepts both length and percentages,
2578         on top of the "normal" initial value.
2579         A new utility class GapLength has been added, as it'll be useful
2580         to implement row-gap in the future.
2581
2582         Apart from that the muticolumn layout code has been modified
2583         to resolve the percentage gaps (treating them as zero while computing
2584         preferred widths) and resolving them during layout.
2585         This doesn't follow the current text on the spec, but there is an
2586         ongoing discussion that might cause the text is changed:
2587         https://github.com/w3c/csswg-drafts/issues/509#issuecomment-355242101
2588         We could update the implementation once we have a definitive answer
2589         from the CSS WG.
2590
2591         Test: web-platform-tests/css/css-multicol/multicol-gap-percentage-001.html
2592
2593         * Sources.txt:
2594         * WebCore.xcodeproj/project.pbxproj:
2595         * css/CSSComputedStyleDeclaration.cpp:
2596         (WebCore::ComputedStyleExtractor::valueForPropertyinStyle):
2597         * css/CSSProperties.json:
2598         * css/StyleBuilderConverter.h:
2599         (WebCore::StyleBuilderConverter::convertGapLength):
2600         * css/StyleBuilderCustom.h:
2601         (WebCore::forwardInheritedValue):
2602         * css/parser/CSSPropertyParser.cpp:
2603         (WebCore::consumeGapLength):
2604         (WebCore::CSSPropertyParser::parseSingleValue):
2605         * page/FrameView.cpp:
2606         (WebCore::FrameView::applyPaginationToViewport):
2607         * page/animation/CSSPropertyAnimation.cpp:
2608         (WebCore::blendFunc):
2609         (WebCore::CSSPropertyAnimationWrapperMap::CSSPropertyAnimationWrapperMap):
2610         * rendering/RenderBlockFlow.cpp:
2611         (WebCore::RenderBlockFlow::columnGap const):
2612         * rendering/RenderMultiColumnSet.cpp:
2613         (WebCore::RenderMultiColumnSet::columnGap const):
2614         * rendering/style/GapLength.cpp: Added.
2615         (WebCore::operator<<):
2616         * rendering/style/GapLength.h: Added.
2617         (WebCore::GapLength::GapLength):
2618         (WebCore::GapLength::isNormal const):
2619         (WebCore::GapLength::length const):
2620         (WebCore::GapLength::operator== const):
2621         * rendering/style/RenderStyle.h:
2622         (WebCore::RenderStyle::columnGap const):
2623         (WebCore::RenderStyle::setColumnGap):
2624         (WebCore::RenderStyle::initialColumnGap):
2625         * rendering/style/StyleMultiColData.cpp:
2626         (WebCore::StyleMultiColData::StyleMultiColData):
2627         (WebCore::StyleMultiColData::operator== const):
2628         * rendering/style/StyleMultiColData.h:
2629         * style/StyleResolveForDocument.cpp:
2630         (WebCore::Style::resolveForDocument):
2631
2632 2018-01-26  Emilio Cobos Álvarez  <emilio@crisal.io>
2633
2634         Remove unused RenderFragmentedFlow::createFragmentedFlowStyle.
2635         https://bugs.webkit.org/show_bug.cgi?id=182138
2636
2637         Reviewed by Manuel Rego Casasnovas.
2638
2639         Has no callers.
2640
2641         No new tests, just removes unused code so no behavior change.
2642
2643         * rendering/RenderFragmentedFlow.cpp:
2644         * rendering/RenderFragmentedFlow.h:
2645
2646 2018-01-26  Emilio Cobos Álvarez  <emilio@crisal.io>
2647
2648         Remove useless RenderBlockFlow overrides.
2649         https://bugs.webkit.org/show_bug.cgi?id=182139
2650
2651         Reviewed by Manuel Rego Casasnovas.
2652
2653         I think these are leftovers from the CSS regions removal, looking at
2654         blame.
2655
2656         No new tests, no behavior change.
2657
2658         * rendering/RenderBlockFlow.cpp:
2659         * rendering/RenderBlockFlow.h:
2660
2661 2018-01-25  Joseph Pecoraro  <pecoraro@apple.com>
2662
2663         Web Inspector: Add InspectorShaderProgram to Unified Sources build
2664         https://bugs.webkit.org/show_bug.cgi?id=182084
2665
2666         Reviewed by Dan Bernstein.
2667
2668         * CMakeLists.txt:
2669         * WebCore.xcodeproj/project.pbxproj:
2670         * Sources.txt:
2671         Move to Sources.txt always.
2672
2673         * inspector/InspectorShaderProgram.cpp:
2674         Add ENABLE(WEBGL) guard to contents.
2675
2676 2018-01-25  Ryosuke Niwa  <rniwa@webkit.org>
2677
2678         Make scrolling to the focused element async
2679         https://bugs.webkit.org/show_bug.cgi?id=181575
2680         <rdar://problem/36459767>
2681
2682         Reviewed by Simon Fraser.
2683
2684         Made the revealing of the focused element asynchronous in Element::focus. Like selection, schedule a timer when
2685         a new element is focused, and only scroll to the focused element when the timer fires. If any other scrolling
2686         happens meanwhile, we cancel this timer.
2687
2688         There are two Web exposed behavioral changes:
2689         1. The scrolling position doesn't change immediately when calling Element::focus.
2690         2. Only the last focused element will be revealed.
2691
2692         Both behavioral changes pose its own compatibility risks but we're making a conscious decision here since
2693         the scrolling asynchronous has a clear performance benefit.
2694
2695         There is one edge case to cosnider: when the history controller restores the scrolling position, canceling the
2696         timer results in a focused element in an overflow: hidden element to be never revealed. Expediate revealing of
2697         the focused element in this one case instead of canceling.
2698
2699         Tests: fast/scrolling/scroll-to-focused-element-asynchronously.html
2700                fast/scrolling/scroll-to-focused-element-canceled-by-fragment-navigation.html
2701
2702         * dom/Element.cpp:
2703         (WebCore::Element::focus): Call updateFocusAppearance on focusAppearanceUpdateTarget to handle HTMLAreaElement
2704         which delegates the focus appearance update to its image element.
2705         (WebCore::Element::focusAppearanceUpdateTarget): Extracted. Returns "this" element for all but HTMLAreaElement.
2706         (WebCore::Element::updateFocusAppearance): Schedule the revealing of the focused element in FrameView instead of
2707         synchronously scrolling to the focused element.
2708         * dom/Element.h:
2709         (WebCore::Element::defaultFocusTextStateChangeIntent):
2710         * html/HTMLAreaElement.cpp:
2711         (WebCore::HTMLAreaElement::focusAppearanceUpdateTarget): Extracted from updateFocusAppearance.
2712         (WebCore::HTMLAreaElement::updateFocusAppearance): Deleted.
2713         * html/HTMLAreaElement.h:
2714         * loader/HistoryController.cpp:
2715         (WebCore::HistoryController::restoreScrollPositionAndViewState): Reveal the focused element
2716         prior to restoring the scrolling location of the fragment navigation. This is needed to reveal a focused element
2717         inside overflow: hidden element which got focused.
2718         * page/FrameView.cpp:
2719         (WebCore::FrameView::FrameView): Added a boolean flag and a timer for scrolling to the focused element.
2720         (WebCore::FrameView::reset): Stop the timer and clear the flag.
2721         (WebCore::FrameView::maintainScrollPositionAtAnchor): Ditto when scrolling to an anchor.
2722         (WebCore::FrameView::setScrollPosition): Ditto when some other programatic scroll or the user scrolls the view.
2723         (WebCore::FrameView::scheduleScrollToFocusedElement): Added.
2724         (WebCore::FrameView::scrollToFocusedElementImmediatelyIfNeeded): Added.
2725         (WebCore::FrameView::scrollToFocusedElementTimerFired): Added.
2726         (WebCore::FrameView::scrollToAnchor): Stop the timer and clear the flag when scrolling to an achor.
2727         (WebCore::FrameView::setWasScrolledByUser): Ditto when the user scrolls.
2728         * page/FrameView.h:
2729
2730 2018-01-25  Said Abou-Hallawa  <sabouhallawa@apple.com>
2731
2732         REGRESSION(r217236): [iOS] PDFDocumentImage does not update its cached ImageBuffer if it has a sub-rectangle of the image
2733         https://bugs.webkit.org/show_bug.cgi?id=182083
2734
2735         Reviewed by Simon Fraser.
2736
2737         Test: fast/images/pdf-as-image-dest-rect-change.html
2738
2739         Revert the change r217236 back. Fix the issue of throwing out the cached
2740         ImageBuffer of the PDF document image when moving its rectangle.
2741
2742         * platform/graphics/cg/PDFDocumentImage.cpp:
2743         (WebCore::PDFDocumentImage::cacheParametersMatch): Return the if-statement
2744         which was deleted in r217236 back but intersect it with dstRect. The context
2745         clipping rectangle can be more than the dstRect.
2746         (WebCore::PDFDocumentImage::updateCachedImageIfNeeded):
2747         -- Remove a wrong optimization which used to work for Mac only if the context
2748            interpolation quality is not set to low or none quality. This optimization
2749            does not consider the case when srcRect or destRect change after caching
2750            the ImageBuffer. Or even if m_cachedImageRect does not include the
2751            whole clipping rectangle.
2752         -- Move back the call to cacheParametersMatch() before changing the
2753            m_cachedImageRect.
2754         -- Always intersect the clipping rectangle with the dstRect to ensure we
2755            only look at the dirty rectangle inside the image boundary.
2756         -- If cacheParametersMatch() returns true, set m_cachedDestinationRect to
2757            dstRect and move m_cachedImageRect by the difference between the new
2758            and the old dstRects since no re-caching will happen.
2759         * platform/graphics/cg/PDFDocumentImage.h:
2760         * testing/Internals.cpp:
2761         (WebCore::pdfDocumentImageFromImageElement):
2762         (WebCore::Internals::pdfDocumentCachingCount):
2763         * testing/Internals.h:
2764         * testing/Internals.idl:
2765         Add an internal API which returns the number of drawing the PDF into an
2766         ImageBuffer.
2767
2768 2018-01-25  Joseph Pecoraro  <pecoraro@apple.com>
2769
2770         Web Inspector: Remove unnecessary developerExtrasEnabled checks
2771         https://bugs.webkit.org/show_bug.cgi?id=182156
2772
2773         Reviewed by Matt Baker.
2774
2775         * inspector/InspectorInstrumentation.cpp:
2776         (WebCore::InspectorInstrumentation::didLoadResourceFromMemoryCacheImpl):
2777         (WebCore::InspectorInstrumentation::frameDocumentUpdatedImpl):
2778         (WebCore::InspectorInstrumentation::didCreateWebSocketImpl):
2779         These checks should not be needed. The step above bails if there is
2780         no inspector frontend, and there can be no inspector frontend unless
2781         developer extras enabled are enabled.
2782
2783 2018-01-25  Wenson Hsieh  <wenson_hsieh@apple.com>
2784
2785         Add localizable strings for extra-zoomed form controls
2786         https://bugs.webkit.org/show_bug.cgi?id=182080
2787
2788         Reviewed by Tim Horton.
2789
2790         Add new localizable strings. Additionally, run `update-webkit-localizable-strings` to re-sort
2791         Localizable.strings.
2792
2793         * English.lproj/Localizable.strings:
2794         * platform/LocalizedStrings.cpp:
2795         (WebCore::formControlCancelButtonTitle):
2796         (WebCore::formControlHideButtonTitle):
2797         (WebCore::formControlGoButtonTitle):
2798         (WebCore::formControlSearchButtonTitle):
2799         (WebCore::textInputModeWriteButton):
2800         (WebCore::textInputModeSpeechButton):
2801         * platform/LocalizedStrings.h:
2802
2803 2018-01-25  Chris Dumez  <cdumez@apple.com>
2804
2805         Access to service workers / Cache API should be disabled in sandboxed frames without allow-same-origin flag
2806         https://bugs.webkit.org/show_bug.cgi?id=182140
2807         <rdar://problem/36879952>
2808
2809         Reviewed by Youenn Fablet.
2810
2811         Throw a SecurityError when accessing navigator.serviceWorker or window.caches inside a sandboxed iframe
2812         without the allow-same-origin flag. This behavior is consistent with Chrome. Firefox, however, seems
2813         to return these objects but have their API reject promises with a SecurityError instead.
2814
2815         No new tests, rebaselined existing tests.
2816
2817         * Modules/cache/DOMWindowCaches.cpp:
2818         (WebCore::DOMWindowCaches::caches): Deleted.
2819         * Modules/cache/DOMWindowCaches.h:
2820         * Modules/cache/DOMWindowCaches.idl:
2821         * page/NavigatorBase.cpp:
2822         * page/NavigatorBase.h:
2823         * page/NavigatorServiceWorker.idl:
2824
2825 2018-01-25  Chris Dumez  <cdumez@apple.com>
2826
2827         Clients.get(id) should only returns clients in the service worker's origin
2828         https://bugs.webkit.org/show_bug.cgi?id=182149
2829         <rdar://problem/36882310>
2830
2831         Reviewed by Youenn Fablet.
2832
2833         When looking for SW clients with a given identifier, only look in the list of
2834         clients that have the same origin as the service worker.
2835
2836         No new tests, rebaselined existing test.
2837
2838         * workers/service/server/SWServer.cpp:
2839         (WebCore::SWServer::serviceWorkerClientWithOriginByID const):
2840         (WebCore::SWServer::serviceWorkerClientByID const): Deleted.
2841         * workers/service/server/SWServer.h:
2842         * workers/service/server/SWServerWorker.cpp:
2843         (WebCore::SWServerWorker::findClientByIdentifier const):
2844         * workers/service/server/SWServerWorker.h:
2845
2846 2018-01-25  Youenn Fablet  <youenn@apple.com>
2847
2848         WebPluginInfoProvider should handle null host queries
2849         https://bugs.webkit.org/show_bug.cgi?id=182112
2850
2851         Reviewed by Chris Dumez.
2852
2853         No change of behavior.
2854
2855         Removed assertion that is not always true, as shown by API tests.
2856
2857         * loader/DocumentLoader.cpp:
2858         (WebCore::DocumentLoader::responseReceived):
2859
2860 2018-01-25  Youenn Fablet  <youenn@apple.com>
2861
2862         ShapeOutside should use same origin credentials mode
2863         https://bugs.webkit.org/show_bug.cgi?id=182141
2864
2865         Reviewed by Chris Dumez.
2866
2867         Covered by updated test.
2868         As per https://drafts.csswg.org/css-shapes/#shape-outside-property, ShapeOutside images
2869         should be fetched with anonymous cors mode, meaning credentials should be set to same-origin.
2870
2871         * style/StylePendingResources.cpp:
2872         (WebCore::Style::loadPendingImage):
2873
2874 2018-01-25  John Wilander  <wilander@apple.com>
2875
2876         Make sure we have a frame as we iterate in ResourceLoadObserver::nonNullOwnerURL()
2877         https://bugs.webkit.org/show_bug.cgi?id=182116
2878         <rdar://problem/36210134>
2879
2880         Reviewed by Alex Christensen.
2881
2882         No new tests. No known repro case, just crash logs.
2883
2884         * loader/ResourceLoadObserver.cpp:
2885         (WebCore::ResourceLoadObserver::nonNullOwnerURL const):
2886
2887 2018-01-25  Jer Noble  <jer.noble@apple.com>
2888
2889         Move ImageDecoderAVFObjC from using AVSampleBufferGenerator to AVAssetReaderOutput for parsing
2890         https://bugs.webkit.org/show_bug.cgi?id=182091
2891
2892         Reviewed by Eric Carlson.
2893
2894         No new tests; should be covered by existing tests.
2895
2896         AVSampleBufferGenerator is not available on iOS, so in order to enable ImageDecoderAVFObjC there,
2897         we must adopt a similar API which is available both on iOS and macOS: AVAssetReaderOutput. Unlike
2898         the generator, AVAssetReaderOutput doesn't necessarily generate samples in decode order, so we'll
2899         repurpose the SampleMap from EME to hold the decoded samples as well as their generated images.
2900
2901         * Modules/mediasource/SampleMap.cpp:
2902         * Modules/mediasource/SampleMap.h:
2903         (WebCore::SampleMap::size const):
2904         * platform/MIMETypeRegistry.cpp:
2905         (WebCore::MIMETypeRegistry::isSupportedImageVideoOrSVGMIMEType):
2906         * platform/MediaSample.h:
2907         (WebCore::MediaSample::hasAlpha const):
2908         * platform/graphics/ImageDecoder.cpp:
2909         (WebCore::ImageDecoder::create):
2910         (WebCore::ImageDecoder::supportsMediaType):
2911         * platform/graphics/avfoundation/MediaSampleAVFObjC.h: Make non-final.
2912         (WebCore::MediaSampleAVFObjC::sampleBuffer const):
2913         (WebCore::MediaSampleAVFObjC::MediaSampleAVFObjC):
2914         * platform/graphics/avfoundation/objc/ImageDecoderAVFObjC.h:
2915         * platform/graphics/avfoundation/objc/ImageDecoderAVFObjC.mm:
2916         (WebCore::ImageDecoderAVFObjCSample::create):
2917         (WebCore::ImageDecoderAVFObjCSample::sampleBuffer const):
2918         (WebCore::ImageDecoderAVFObjCSample::image const):
2919         (WebCore::ImageDecoderAVFObjCSample::setImage):
2920         (WebCore::ImageDecoderAVFObjCSample::ImageDecoderAVFObjCSample):
2921         (WebCore::ImageDecoderAVFObjCSample::cacheMetadata):
2922         (WebCore::toSample):
2923         (WebCore::ImageDecoderAVFObjC::readSamples):
2924         (WebCore::ImageDecoderAVFObjC::storeSampleBuffer):
2925         (WebCore::ImageDecoderAVFObjC::advanceCursor):
2926         (WebCore::ImageDecoderAVFObjC::setTrack):
2927         (WebCore::ImageDecoderAVFObjC::encodedDataStatus const):
2928         (WebCore::ImageDecoderAVFObjC::repetitionCount const):
2929         (WebCore::ImageDecoderAVFObjC::frameIsCompleteAtIndex const):
2930         (WebCore::ImageDecoderAVFObjC::frameDurationAtIndex const):
2931         (WebCore::ImageDecoderAVFObjC::frameHasAlphaAtIndex const):
2932         (WebCore::ImageDecoderAVFObjC::createFrameImageAtIndex):
2933         (WebCore::ImageDecoderAVFObjC::setData):
2934         (WebCore::ImageDecoderAVFObjC::clearFrameBufferCache):
2935         (WebCore::ImageDecoderAVFObjC::sampleAtIndex const):
2936         (WebCore::ImageDecoderAVFObjC::readSampleMetadata): Deleted.
2937
2938 2018-01-25  Youenn Fablet  <youenn@apple.com>
2939
2940         DocumentThreadableLoader should ensure service worker is not reused if redirection comes from the network
2941         https://bugs.webkit.org/show_bug.cgi?id=182137
2942
2943         Reviewed by Chris Dumez.
2944
2945         Covered by rebased test.
2946         In case redirection does not come from memory cache or service worker, disable service worker interception when following the redirection.
2947
2948         * loader/DocumentThreadableLoader.cpp:
2949         (WebCore::DocumentThreadableLoader::redirectReceived):
2950
2951 2018-01-25  Youenn Fablet  <youenn@apple.com>
2952
2953         DocumentLoader should interrupt ongoing load when getting a redirection from network that matches a service worker
2954         https://bugs.webkit.org/show_bug.cgi?id=182115
2955
2956         Reviewed by Alex Christensen.
2957
2958         Covered by rebased test.
2959
2960         In case a navigation load is going to the network process,
2961         we need to interrupt it if having a redirection that leads to a new request going to a service worker.
2962
2963         * loader/DocumentLoader.cpp:
2964         (WebCore::DocumentLoader::redirectReceived):
2965
2966 2018-01-25  Chris Dumez  <cdumez@apple.com>
2967
2968         Registering same scope as the script directory without the last slash should fail
2969         https://bugs.webkit.org/show_bug.cgi?id=182122
2970         <rdar://problem/36877167>
2971
2972         Reviewed by Youenn Fablet.
2973
2974         This aligns our behavior with Firefox and Chrome.
2975
2976         No new tests, rebaselined existing test.
2977
2978         * workers/service/ServiceWorkerJob.cpp:
2979         (WebCore::ServiceWorkerJob::didReceiveResponse):
2980
2981 2018-01-25  Antoine Quint  <graouts@apple.com>
2982
2983         [Web Animations] Expose the reverse() method
2984         https://bugs.webkit.org/show_bug.cgi?id=182100
2985         <rdar://problem/36867117>
2986
2987         Reviewed by Dean Jackson.
2988
2989         We expose and implement the reverse() method on Animation as specified.
2990
2991         * animation/WebAnimation.cpp:
2992         (WebCore::WebAnimation::setPlaybackRate):
2993         (WebCore::WebAnimation::reverse):
2994         * animation/WebAnimation.h:
2995         * animation/WebAnimation.idl:
2996
2997 2018-01-25  Antoine Quint  <graouts@apple.com>
2998
2999         [Web Animations] Account for provided easings when computing progress and resolving keyframe effect values
3000         https://bugs.webkit.org/show_bug.cgi?id=182098
3001         <rdar://problem/36866149>
3002
3003         Reviewed by Dean Jackson.
3004
3005         We now account for the timing functions provided through the "easing" propreties on whole animation effects
3006         and individual keyframes. Exposing those exposed shortcomings of our keyframe resolution in general through
3007         WPT tests so we now implement the "effect value of a keyframe effect" procedure from the spec to correctly
3008         resolve keyframes in KeyframeEffect::setAnimatedPropertiesInStyle(). The tests also showed some shortcomings
3009         in our TimingFunction code where our step() function resolution wasn't fully compliant and our cubic-bezier()
3010         resolution not accurate enough. We now have microsecond accuracy when resolving cubic-bezier() timing functions
3011         and identify cubic-bezier(0, 0, 0, 0), cubic-bezier(0, 0, 1, 1) and cubic-bezier(1, 1, 1, 1) as linear timing
3012         functions, as called out by the WPT tests.
3013
3014         * animation/AnimationEffect.cpp:
3015         (WebCore::AnimationEffect::transformedProgress const): Account for the effect-wide timing function when computing
3016         the progress.
3017         (WebCore::AnimationEffect::iterationProgress const): Use the transformed progress now that we support this procedure.
3018         * animation/AnimationEffect.h:
3019         * animation/KeyframeEffect.cpp:
3020         (WebCore::KeyframeEffect::apply): We now use the computed progress from AnimationEffect rather than compute based
3021         on the provided time, which we've dropped as an argument.
3022         (WebCore::KeyframeEffect::getAnimatedStyle):
3023         (WebCore::KeyframeEffect::setAnimatedPropertiesInStyle): Implement the "effect value of a keyframe effect" procedure
3024         in full as specified (save for composite operations).
3025         (WebCore::KeyframeEffect::applyAtLocalTime): Deleted.
3026         * animation/KeyframeEffect.h:
3027         * animation/WebAnimation.cpp:
3028         (WebCore::WebAnimation::resolve):
3029         * css/CSSTimingFunctionValue.h: Fix a small error made in a previous patch where we used "int" instead of "unsigned".
3030         * platform/animation/TimingFunction.cpp:
3031         (WebCore::TimingFunction::transformTime const):
3032         * platform/animation/TimingFunction.h:
3033
3034 2018-01-25  Antoine Quint  <graouts@apple.com>
3035
3036         [Web Animations] Avoid querying the current time multiple time when resolving the play state
3037         https://bugs.webkit.org/show_bug.cgi?id=182099
3038
3039         Reviewed by Dean Jackson.
3040
3041         No test change since this shouldn't cause any change in behavior.
3042
3043         * animation/WebAnimation.cpp:
3044         (WebCore::WebAnimation::playState const):
3045
3046 2018-01-25  Youenn Fablet  <youenn@apple.com>
3047
3048         Set integrity fetch options for loading scripts and CSS
3049         https://bugs.webkit.org/show_bug.cgi?id=182077
3050
3051         Reviewed by Chris Dumez.
3052
3053         Covered by updated test.
3054
3055         Set integrity fetch option in script and CSS loading.
3056
3057         * bindings/js/CachedModuleScriptLoader.cpp:
3058         (WebCore::CachedModuleScriptLoader::load):
3059         * bindings/js/CachedScriptFetcher.cpp:
3060         (WebCore::CachedScriptFetcher::requestModuleScript const):
3061         (WebCore::CachedScriptFetcher::requestScriptWithCache const):
3062         * bindings/js/CachedScriptFetcher.h:
3063         * dom/LoadableClassicScript.cpp:
3064         (WebCore::LoadableClassicScript::load):
3065         * dom/ScriptElementCachedScriptFetcher.cpp:
3066         (WebCore::ScriptElementCachedScriptFetcher::requestModuleScript const):
3067         * dom/ScriptElementCachedScriptFetcher.h:
3068         * html/HTMLLinkElement.cpp:
3069         (WebCore::HTMLLinkElement::process):
3070
3071 2018-01-25  Zan Dobersek  <zdobersek@igalia.com>
3072
3073         [Cairo] Use GraphicsContextImplCairo in Nicosia::PaintingContextCairo
3074         https://bugs.webkit.org/show_bug.cgi?id=182094
3075
3076         Reviewed by Carlos Garcia Campos.
3077
3078         Have Nicosia::PaintingContextCairo create a GraphicsContext object that
3079         utilizes a factory function which returns a freshly-allocated
3080         GraphicsContextImplCairo through which all the painting is then done.
3081         This moves GraphicsLayer painting over to using the GraphicsContextImpl
3082         infrastructure.
3083
3084         No new tests -- no changes in behavior.
3085
3086         * platform/graphics/nicosia/NicosiaPaintingContextCairo.cpp:
3087         (Nicosia::PaintingContextCairo::PaintingContextCairo):
3088
3089 2018-01-24  Frederic Wang  <fwang@igalia.com>
3090
3091         ScrollingStateNode::reconcileLayerPositionForViewportRect is only called on direct children of the root
3092         https://bugs.webkit.org/show_bug.cgi?id=179946
3093
3094         Reviewed by Simon Fraser.
3095
3096         ScrollingStateNode::reconcileLayerPositionForViewportRect is currently only called on the
3097         direct children of root of the scrolling tree. Hence nodes like "position: fixed" will not
3098         update their layers after scrolling when they are deeper in the tree. This is already
3099         possible on iOS with overflow nodes and will happen with subframes when async scrolling is
3100         implemented. This commit fixes that issue by recursively calling the function
3101         ScrollingStateNode::reconcileLayerPositionForViewportRect on the scrolling tree.
3102
3103         Test: fast/scrolling/ios/reconcile-layer-position-recursive.html
3104
3105         * page/scrolling/AsyncScrollingCoordinator.cpp:
3106         (WebCore::AsyncScrollingCoordinator::reconcileViewportConstrainedLayerPositions): Just call
3107         reconcileLayerPositionForViewportRect on the root node.
3108         * page/scrolling/ScrollingStateNode.cpp:
3109         (WebCore::ScrollingStateNode::reconcileLayerPositionForViewportRect): By default, this
3110         function now recursively calls reconcileLayerPositionForViewportRect on the children.
3111         * page/scrolling/ScrollingStateNode.h:
3112         * page/scrolling/ScrollingStateFixedNode.cpp:
3113         (WebCore::ScrollingStateFixedNode::reconcileLayerPositionForViewportRect): Call the function
3114         on children.
3115         * page/scrolling/ScrollingStateStickyNode.cpp:
3116         (WebCore::ScrollingStateStickyNode::reconcileLayerPositionForViewportRect): Ditto.
3117
3118 2018-01-24  Zan Dobersek  <zdobersek@igalia.com>
3119
3120         [Cairo] Use GraphicsContextImplCairo for ImageBuffer context
3121         https://bugs.webkit.org/show_bug.cgi?id=181977
3122
3123         Reviewed by Carlos Garcia Campos.
3124
3125         Enhance the GraphicsContextImpl interface to the point of enabling the
3126         Cairo-based implementation to be used for GraphicsContext construction
3127         in ImageBufferCairo.cpp.
3128
3129         In order to enable GraphicsContextImpl implementations to properly
3130         manage PlatformGraphicsContext objects, the hasPlatformContext() and
3131         platformContext() methods are added. Cairo implementation returns true
3132         in the first method, and returns pointer to the PlatformContextCairo
3133         object in the second. The DisplayList::Recorder, due to its recording
3134         nature, doesn't manage such an object, so it returns false and nullptr,
3135         respectively.
3136
3137         GraphicsContextImpl also gains the setCTM(), getCTM(), clipBounds() and
3138         roundToDevicePixels() methods, corresponding to the GraphicsContext
3139         methods that now invoke these new methods on any existing m_impl object.
3140         GraphicsContextImplCairo implementations mimic the existing behavior in
3141         the Cairo-specific GraphicsContext methods, but DisplayList::Recorder
3142         implementations remain no-op, logging the invocation but doing nothing
3143         otherwise.
3144
3145         drawImage() and drawTiledImage() methods on the GraphicsContextImpl
3146         interface are changed to return the ImageDrawResult value, corresponding
3147         to what's been done in the method. In DisplayList::Recorder, the methods
3148         return ImageDrawResult::DidRecord, while in GraphicsContextImplCairo the
3149         methods return the return result of Image::draw() or Image::drawTiled()
3150         call.
3151
3152         To make the protected Image::draw() and Image::drawTiled() methods
3153         accessible, invocations of those are packed into static drawImageImpl()
3154         and drawTiledImageImpl() functions on the GraphicsContextImpl class.
3155         This makes it possible to simply declare GraphicsContextImpl class as a
3156         friend class of Image, and not every specific GraphicsContextImpl
3157         derivation. Implementations of these functions mirror behavior of the
3158         drawImage() and drawTiledImage() methods on the GraphicsContext class,
3159         when an m_impl object isn't present, constructing a scope-tied
3160         InterpolationQualityMaintainer object and invoking the relevant Image
3161         method.
3162
3163         To make immediate use of the new GraphicsContextImplCairo functionality,
3164         the GraphicsContext construction in Cairo-specific ImageBuffer
3165         implementation now uses a factory function that returns a new
3166         GraphicsContextImplCairo object through which the given
3167         PlatformContextCairo is used for painting.
3168
3169         No new tests -- no change in functionality.
3170
3171         * platform/graphics/GraphicsContext.cpp:
3172         (WebCore::GraphicsContext::hasPlatformContext const):
3173         (WebCore::GraphicsContext::drawImage):
3174         (WebCore::GraphicsContext::drawTiledImage):
3175         * platform/graphics/GraphicsContext.h:
3176         (WebCore::GraphicsContext::hasPlatformContext const): Deleted.
3177         * platform/graphics/GraphicsContextImpl.cpp:
3178         (WebCore::GraphicsContextImpl::drawImageImpl):
3179         (WebCore::GraphicsContextImpl::drawTiledImageImpl):
3180         * platform/graphics/GraphicsContextImpl.h:
3181         * platform/graphics/Image.h:
3182         * platform/graphics/cairo/GraphicsContextCairo.cpp:
3183         (WebCore::GraphicsContext::getCTM const):
3184         (WebCore::GraphicsContext::platformContext const):
3185         (WebCore::GraphicsContext::clipBounds const):
3186         (WebCore::GraphicsContext::roundToDevicePixels):
3187         (WebCore::GraphicsContext::setCTM):
3188         * platform/graphics/cairo/GraphicsContextImplCairo.cpp:
3189         (WebCore::m_private):
3190         (WebCore::GraphicsContextImplCairo::~GraphicsContextImplCairo):
3191         (WebCore::GraphicsContextImplCairo::hasPlatformContext const):
3192         (WebCore::GraphicsContextImplCairo::platformContext const):
3193         (WebCore::GraphicsContextImplCairo::updateState):
3194         (WebCore::GraphicsContextImplCairo::setLineCap):
3195         (WebCore::GraphicsContextImplCairo::setLineDash):
3196         (WebCore::GraphicsContextImplCairo::setLineJoin):
3197         (WebCore::GraphicsContextImplCairo::setMiterLimit):
3198         (WebCore::GraphicsContextImplCairo::fillRect):
3199         (WebCore::GraphicsContextImplCairo::fillRoundedRect):
3200         (WebCore::GraphicsContextImplCairo::fillRectWithRoundedHole):
3201         (WebCore::GraphicsContextImplCairo::fillPath):
3202         (WebCore::GraphicsContextImplCairo::fillEllipse):
3203         (WebCore::GraphicsContextImplCairo::strokeRect):
3204         (WebCore::GraphicsContextImplCairo::strokePath):
3205         (WebCore::GraphicsContextImplCairo::strokeEllipse):
3206         (WebCore::GraphicsContextImplCairo::clearRect):
3207         (WebCore::GraphicsContextImplCairo::drawGlyphs):
3208         (WebCore::GraphicsContextImplCairo::drawImage):
3209         (WebCore::GraphicsContextImplCairo::drawTiledImage):
3210         (WebCore::GraphicsContextImplCairo::drawNativeImage):
3211         (WebCore::GraphicsContextImplCairo::drawPattern):
3212         (WebCore::GraphicsContextImplCairo::drawRect):
3213         (WebCore::GraphicsContextImplCairo::drawLine):
3214         (WebCore::GraphicsContextImplCairo::drawLinesForText):
3215         (WebCore::GraphicsContextImplCairo::drawLineForDocumentMarker):
3216         (WebCore::GraphicsContextImplCairo::drawEllipse):
3217         (WebCore::GraphicsContextImplCairo::drawFocusRing):
3218         (WebCore::GraphicsContextImplCairo::save):
3219         (WebCore::GraphicsContextImplCairo::restore):
3220         (WebCore::GraphicsContextImplCairo::translate):
3221         (WebCore::GraphicsContextImplCairo::rotate):
3222         (WebCore::GraphicsContextImplCairo::scale):
3223         (WebCore::GraphicsContextImplCairo::concatCTM):
3224         (WebCore::GraphicsContextImplCairo::setCTM):
3225         (WebCore::GraphicsContextImplCairo::getCTM):
3226         (WebCore::GraphicsContextImplCairo::beginTransparencyLayer):
3227         (WebCore::GraphicsContextImplCairo::endTransparencyLayer):
3228         (WebCore::GraphicsContextImplCairo::clip):
3229         (WebCore::GraphicsContextImplCairo::clipOut):
3230         (WebCore::GraphicsContextImplCairo::clipPath):
3231         (WebCore::GraphicsContextImplCairo::clipBounds):
3232         (WebCore::GraphicsContextImplCairo::roundToDevicePixels):
3233         (WebCore::m_platformContext): Deleted.
3234         * platform/graphics/cairo/GraphicsContextImplCairo.h:
3235         * platform/graphics/cairo/ImageBufferCairo.cpp:
3236         (WebCore::ImageBuffer::ImageBuffer):
3237         * platform/graphics/cg/GraphicsContextCG.cpp:
3238         (WebCore::GraphicsContext::clipBounds const):
3239         (WebCore::GraphicsContext::setCTM):
3240         (WebCore::GraphicsContext::getCTM const):
3241         (WebCore::GraphicsContext::roundToDevicePixels):
3242         * platform/graphics/displaylists/DisplayListRecorder.cpp:
3243         (WebCore::DisplayList::Recorder::drawImage):
3244         (WebCore::DisplayList::Recorder::drawTiledImage):
3245         (WebCore::DisplayList::Recorder::drawNativeImage):
3246         (WebCore::DisplayList::Recorder::setCTM):
3247         (WebCore::DisplayList::Recorder::getCTM):
3248         (WebCore::DisplayList::Recorder::clipBounds):
3249         (WebCore::DisplayList::Recorder::roundToDevicePixels):
3250         * platform/graphics/displaylists/DisplayListRecorder.h:
3251
3252 2018-01-24  Christopher Reid  <chris.reid@sony.com>
3253
3254         Linker error in ShareableBitmapCairo.cpp  undefined reference to WebCore::Cairo::ShadowState::ShadowState
3255         https://bugs.webkit.org/show_bug.cgi?id=182060
3256
3257         Reviewed by Žan Doberšek.
3258
3259         No new tests, no change in behavior.
3260
3261         Added exports to WebCore::Cairo::ShadowState::ShadowState.
3262
3263         * platform/graphics/cairo/CairoOperations.h:
3264
3265 2018-01-24  Basuke Suzuki  <Basuke.Suzuki@sony.com>
3266
3267         [Curl] Implement didSendData client callback.
3268         https://bugs.webkit.org/show_bug.cgi?id=182063
3269
3270         Reviewed by Alex Christensen.
3271
3272         No new tests (covered by existing tests).
3273
3274         * platform/network/curl/CurlDownload.h:
3275         * platform/network/curl/CurlRequest.cpp:
3276         (WebCore::CurlRequest::willSendData):
3277         * platform/network/curl/CurlRequestClient.h:
3278         * platform/network/curl/ResourceHandleCurlDelegate.cpp:
3279         (WebCore::ResourceHandleCurlDelegate::curlDidSendData):
3280         * platform/network/curl/ResourceHandleCurlDelegate.h:
3281
3282 2018-01-24  Jiewen Tan  <jiewen_tan@apple.com>
3283
3284         [WebAuthN] Implement PublicKeyCredential’s [[DiscoverFromExternalSource]] with a dummy authenticator
3285         https://bugs.webkit.org/show_bug.cgi?id=182032
3286         <rdar://problem/36459922>
3287
3288         Reviewed by Brent Fulgham.
3289
3290         This patch implements PublicKeyCredential's [[DiscoverFromExternalSource]] from
3291         https://www.w3.org/TR/webauthn/#getAssertion as of 5 December 2017. In order to
3292         do testing, a dummy authenticator is implemented to exercise a failure and a
3293         pass path. A number of dependencies need to be resolved later in order to comply
3294         with the spec, which are marked by FIXME in the patch and tracked by proper
3295         bugs. Those dependencies will be addressed once the first prototype is finshed.
3296
3297         Tests: http/tests/webauthn/public-key-credential-get-with-invalid-parameters.https.html
3298                http/wpt/credential-management/credentialscontainer-store-basics.https.html
3299                http/wpt/webauthn/public-key-credential-get-failure.https.html
3300                http/wpt/webauthn/public-key-credential-get-success.https.html
3301
3302         * Modules/credentialmanagement/CredentialsContainer.cpp:
3303         (WebCore::CredentialsContainer::get):
3304         (WebCore::CredentialsContainer::isCreate):
3305         Fixes some minor issues.
3306         * Modules/webauthn/Authenticator.cpp:
3307         (WebCore::Authenticator::getAssertion const):
3308         * Modules/webauthn/Authenticator.h:
3309         (WebCore::Authenticator::AssertionReturnBundle::AssertionReturnBundle):
3310         * Modules/webauthn/PublicKeyCredential.cpp:
3311         (WebCore::PublicKeyCredential::collectFromCredentialStore):
3312         Changed a parameter type.
3313         (WebCore::PublicKeyCredential::discoverFromExternalSource):
3314         (WebCore::PublicKeyCredential::create):
3315         Improved some comments.
3316         * Modules/webauthn/PublicKeyCredential.h:
3317         * Modules/webauthn/PublicKeyCredentialRequestOptions.h:
3318         (): Deleted.
3319         * bindings/js/JSAuthenticatorResponseCustom.cpp:
3320         (WebCore::toJSNewlyCreated):
3321
3322 2018-01-24  Dean Jackson  <dino@apple.com>
3323
3324         Move WebGL's colorspace code into IOSurface
3325         https://bugs.webkit.org/show_bug.cgi?id=182076
3326         <rdar://problem/36846863>
3327
3328         Reviewed by Simon Fraser, with assistance from Tim Horton.
3329
3330         Rather than have WebGLLayer talk directly to an IOSurfaceRef,
3331         use a helper function on WebCore::IOSurface.
3332
3333         No behaviour change.
3334
3335         * platform/graphics/cocoa/IOSurface.h:
3336         * platform/graphics/cocoa/IOSurface.mm:
3337         (WebCore::IOSurface::migrateColorSpaceToProperties): Add new helper.
3338         * platform/graphics/cocoa/WebGLLayer.mm:
3339         (-[WebGLLayer allocateIOSurfaceBackingStoreWithSize:usingAlpha:]): The
3340         newly created IOSurfaces call the helper to set up their colorspace.
3341
3342 2018-01-24  Dean Jackson  <dino@apple.com>
3343
3344         Add a note about not implementing these functions without discussion.
3345         <rdar://problem/36666458>
3346
3347         * html/canvas/WebGL2RenderingContext.cpp:
3348         (WebCore::WebGL2RenderingContext::clientWaitSync):
3349         (WebCore::WebGL2RenderingContext::getSyncParameter):
3350
3351 2018-01-24  Youenn Fablet  <youenn@apple.com>
3352
3353         Opaque being-loaded responses should clone their body
3354         https://bugs.webkit.org/show_bug.cgi?id=182056
3355
3356         Reviewed by Brady Eidson.
3357
3358         Test: http/wpt/service-workers/clone-opaque-being-loaded-response.https.html
3359
3360         When cloning a being-loaded response, make sure we create a ReadableStream.
3361         Before the patch, the readableStream was not created in that case for opaque responses.
3362
3363         * Modules/fetch/FetchBodyOwner.cpp:
3364         (WebCore::FetchBodyOwner::readableStream):
3365         (WebCore::FetchBodyOwner::createReadableStream):
3366         * Modules/fetch/FetchBodyOwner.h:
3367         * Modules/fetch/FetchResponse.cpp:
3368         (WebCore::FetchResponse::clone):
3369
3370 2018-01-24  Chris Dumez  <cdumez@apple.com>
3371
3372         close() operation should not be exposed inside a ServiceWorkerGlobalScope
3373         https://bugs.webkit.org/show_bug.cgi?id=182057
3374
3375         Reviewed by Youenn Fablet.
3376
3377         Move close() from WorkerGlobalScope to DedicatedWorkerGlobalScope as per:
3378         - https://html.spec.whatwg.org/multipage/workers.html#dedicatedworkerglobalscope
3379
3380         This change to the specification was made to avoid exposing this deprecated
3381         features to service workers (which are new).
3382
3383         No new tests, rebaselined existing test.
3384
3385         * workers/DedicatedWorkerGlobalScope.idl:
3386         * workers/WorkerGlobalScope.idl:
3387
3388 2018-01-24  David Hyatt  <hyatt@apple.com>
3389
3390         Implement line clamp for mail.
3391         https://bugs.webkit.org/show_bug.cgi?id=180818
3392
3393         Reviewed by Dean Jackson.
3394
3395         This patch implements a form of clamping that can clamp lines at both the top
3396         and the bottom, and the interior can be replaced with a DOM element (identified
3397         by id) that replaces the middle section.
3398
3399         The implementation derives from the multicolumn classes, but ultimately the
3400         clamp should derive from the fragmentset classes instead (with most of the current
3401         multicolumn code moving into base classes).
3402
3403         The virtualization of many of the multicolumn functions is something that would happen
3404         once we move pages/printing over to this pagination model anyway.
3405
3406         * Sources.txt:
3407         * WebCore.xcodeproj/project.pbxproj:
3408         Add the new clamp classes.
3409
3410         * css/CSSComputedStyleDeclaration.cpp:
3411         (WebCore::ComputedStyleExtractor::valueForPropertyinStyle):
3412         * css/CSSProperties.json:
3413         * css/StyleBuilderCustom.h:
3414         (WebCore::StyleBuilderCustom::applyValueWebkitLinesClamp):
3415         * css/parser/CSSParser.cpp:
3416         (WebCore::CSSParserContext::CSSParserContext):
3417         * css/parser/CSSParserMode.h:
3418         (WebCore::CSSParserContextHash::hash):
3419         * css/parser/CSSPropertyParser.cpp:
3420         (WebCore::consumeLinesClamp):
3421         (WebCore::CSSPropertyParser::parseSingleValue):
3422         Implement the new CSS property, webkit-lines-clamp. This is only exposed if a preference
3423         is set, so it is not exposed to the Web.
3424
3425         * page/Settings.yaml:
3426         Add a new setting to control allowing access to the new CSS property.
3427
3428         * rendering/RenderBlockFlow.cpp:
3429         (WebCore::RenderBlockFlow::willCreateColumns const):
3430         Make sure columns are created when lines clamp is set.
3431
3432         (WebCore::getHeightForLineCount):
3433         (WebCore::RenderBlockFlow::logicalHeightForLineCount):
3434         (WebCore::RenderBlockFlow::logicalHeightExcludingLineCount):
3435         (WebCore::RenderBlockFlow::layoutExcludedChildren):
3436         (WebCore::RenderBlockFlow::heightForLineCount): Deleted.
3437         * rendering/RenderBlockFlow.h:
3438         Re-use the same clamping logic as the old line clamp code, but modernize it to work
3439         with writing modes and to be able to go backwards from the end of the block.
3440
3441         * rendering/RenderDeprecatedFlexibleBox.cpp:
3442         (WebCore::RenderDeprecatedFlexibleBox::applyLineClamp):
3443         The line count method got renamed to have the word "logical" in it, since it now
3444         works with vertical writing.
3445
3446         * rendering/RenderFragmentContainer.cpp:
3447         (WebCore::RenderFragmentContainer::pageLogicalHeightForOffset const):
3448         * rendering/RenderFragmentContainer.h:
3449         Since line clamp sets have variable page heights, this new method takes the offset
3450         as an argument so that it can return the appropriate page for the given offset.
3451         This method will eventually be used by printing/page sets as well, since pages
3452         can have variable heights.
3453
3454         * rendering/RenderFragmentedFlow.cpp:
3455         (WebCore::RenderFragmentedFlow::validateFragments):
3456         (WebCore::RenderFragmentedFlow::pageLogicalHeightForOffset const):
3457         (WebCore::RenderFragmentedFlow::pageRemainingLogicalHeightForOffset const):
3458         * rendering/RenderFragmentedFlow.h:
3459         Support for variable page heights in a fragment set.
3460
3461         * rendering/RenderLinesClampFlow.cpp: Added.
3462         (WebCore::RenderLinesClampFlow::RenderLinesClampFlow):
3463         (WebCore::RenderLinesClampFlow::renderName const):
3464         (WebCore::RenderLinesClampFlow::layout):
3465         (WebCore::RenderLinesClampFlow::createMultiColumnSet):
3466         (WebCore::RenderLinesClampFlow::isChildAllowedInFragmentedFlow const):
3467         (WebCore::RenderLinesClampFlow::layoutFlowExcludedObjects):
3468         * rendering/RenderLinesClampFlow.h: Added.
3469         * rendering/RenderLinesClampSet.cpp: Added.
3470         (WebCore::RenderLinesClampSet::RenderLinesClampSet):
3471         (WebCore::RenderLinesClampSet::recalculateColumnHeight):
3472         (WebCore::RenderLinesClampSet::computeLogicalHeight const):
3473         (WebCore::RenderLinesClampSet::columnCount const):
3474         (WebCore::RenderLinesClampSet::columnRectAt const):
3475         (WebCore::RenderLinesClampSet::columnIndexAtOffset const):
3476         (WebCore::RenderLinesClampSet::pageLogicalTopForOffset const):
3477         (WebCore::RenderLinesClampSet::pageLogicalHeightForOffset const):
3478         (WebCore::RenderLinesClampSet::fragmentedFlowPortionRectAt const):
3479         (WebCore::RenderLinesClampSet::fragmentedFlowPortionOverflowRect):
3480         (WebCore::RenderLinesClampSet::customBlockProgressionAdjustmentForColumn const):
3481         (WebCore::RenderLinesClampSet::renderName const):
3482         * rendering/RenderLinesClampSet.h: Added.
3483         The new classes. They subclass all the methods necessary to do multi-pass layout,
3484         and to determine the page heights of each section.
3485
3486         * rendering/RenderMultiColumnFlow.cpp:
3487         (WebCore::RenderMultiColumnFlow::isColumnSpanningDescendant const):
3488         (WebCore::isValidColumnSpanner):
3489         (WebCore::RenderMultiColumnFlow::processPossibleSpannerDescendant):
3490         (WebCore::RenderMultiColumnFlow::createMultiColumnSet):
3491         * rendering/RenderMultiColumnFlow.h:
3492         * rendering/RenderMultiColumnSet.cpp:
3493         (WebCore::RenderMultiColumnSet::collectLayerFragments):
3494         (WebCore::RenderMultiColumnSet::columnTranslationForOffset const):
3495         * rendering/RenderMultiColumnSet.h:
3496         (WebCore::RenderMultiColumnSet::skipLayerFragmentCollectionForColumn const):
3497         (WebCore::RenderMultiColumnSet::customBlockProgressionAdjustmentForColumn const):
3498         Virtualized methods so that lines clamp can subclass and change behavior.
3499
3500         * rendering/RenderObject.h:
3501         (WebCore::RenderObject::isRenderLinesClampFlow const):
3502         (WebCore::RenderObject::isRenderLinesClampSet const):
3503         Add new functions for type checking.
3504
3505         * rendering/RenderRubyText.cpp:
3506         Include adjustment.
3507
3508         * rendering/style/LineClampValue.h:
3509         (WebCore::LinesClampValue::LinesClampValue):
3510         (WebCore::LinesClampValue::isNone const):
3511         (WebCore::LinesClampValue::operator== const):
3512         (WebCore::LinesClampValue::operator!= const):
3513         (WebCore::LinesClampValue::start const):
3514         (WebCore::LinesClampValue::end const):
3515         (WebCore::LinesClampValue::center const):
3516         * rendering/style/RenderStyle.h:
3517         (WebCore::RenderStyle::linesClamp const):
3518         (WebCore::RenderStyle::hasLinesClamp const):
3519         (WebCore::RenderStyle::setLinesClamp):
3520         (WebCore::RenderStyle::initialLinesClamp):
3521         (WebCore::RenderStyle::hasInlineColumnAxis const):
3522         * rendering/style/StyleRareNonInheritedData.cpp:
3523         (WebCore::StyleRareNonInheritedData::StyleRareNonInheritedData):
3524         (WebCore::StyleRareNonInheritedData::operator== const):
3525         * rendering/style/StyleRareNonInheritedData.h:
3526         The front end style implementation of the new property.
3527
3528         * rendering/updating/RenderTreeBuilderMultiColumn.cpp:
3529         (WebCore::RenderTreeBuilder::MultiColumn::createFragmentedFlow):
3530         Make sure to build the correct renderer when lines clamp is set.
3531
3532 2018-01-24  Basuke Suzuki  <Basuke.Suzuki@sony.com>
3533
3534         [Curl] Allocate CurlSSLVerifier only when it is required.
3535         https://bugs.webkit.org/show_bug.cgi?id=182061
3536
3537         CurlSSLVerifier was a member function of CurlRequest. This patch do
3538         lazy initialization of it only when actually it is required.
3539         Also configuration method is not required by moving those stuff to
3540         constructor of SSLVerifier which makes much safer because there's
3541         no change to change its behavior from outside.
3542
3543         Reviewed by Alex Christensen.
3544
3545         * platform/network/curl/CurlRequest.cpp:
3546         (WebCore::CurlRequest::willSetupSslCtx):
3547         (WebCore::CurlRequest::didCompleteTransfer):
3548         (WebCore::CurlRequest::finalizeTransfer):
3549         * platform/network/curl/CurlRequest.h:
3550         * platform/network/curl/CurlSSLVerifier.cpp:
3551         (WebCore::CurlSSLVerifier::CurlSSLVerifier):
3552         (WebCore::CurlSSLVerifier::setSslCtx): Deleted.
3553         * platform/network/curl/CurlSSLVerifier.h:
3554         (WebCore::CurlSSLVerifier::setCurlHandle): Deleted.
3555         (WebCore::CurlSSLVerifier::setHostName): Deleted.
3556
3557 2018-01-24  Antti Koivisto  <antti@apple.com>
3558
3559         Assertion failure in RenderMultiColumnSet::requiresBalancing() on fast/multicol/spanner-crash-when-adding-summary.html
3560         https://bugs.webkit.org/show_bug.cgi?id=179308
3561         <rdar://problem/34592771>
3562
3563         Reviewed by Zalan Bujtas.
3564
3565         The issue here is that we fail to tear down render tree for a summary element because adding another summary element
3566         takes it out of the composed tree. This leaves behind renderers that break some multicolumn assumptions.
3567
3568         * rendering/updating/RenderTreeUpdater.cpp:
3569         (WebCore::RenderTreeUpdater::tearDownRenderers):
3570         (WebCore::RenderTreeUpdater::tearDownLeftoverShadowHostChildren):
3571
3572         When tearing down renderers go through the real children of the shadow hosts at the end and see if we left any renderers behind.
3573         If so, tear them down too.
3574
3575         * rendering/updating/RenderTreeUpdater.h:
3576
3577 2018-01-24  Daniel Bates  <dabates@apple.com>
3578
3579         [CSP] Check policy for targeted windows when navigating to a JavaScript URL
3580         https://bugs.webkit.org/show_bug.cgi?id=182018
3581         <rdar://problem/36795781>
3582
3583         Reviewed by Brent Fulgham.
3584
3585         Move the CSP check to be earlier in the function.
3586
3587         Test: http/tests/security/contentSecurityPolicy/window-open-javascript-url-with-target-blocked.html
3588
3589         * loader/FrameLoader.cpp:
3590         (WebCore::createWindow):
3591
3592 2018-01-24  Chris Dumez  <cdumez@apple.com>
3593
3594         Add a IPC::SendSyncOption indicating we should not process incoming IPC while waiting for the sync reply
3595         https://bugs.webkit.org/show_bug.cgi?id=182021
3596         <rdar://problem/21629943>
3597
3598         Reviewed by Ryosuke Niwa.
3599
3600         Add layout testing infrastructure for the new flag.
3601
3602         Test: fast/misc/testIncomingSyncIPCMessageWhileWaitingForSyncReply.html
3603
3604         * page/ChromeClient.h:
3605         * testing/Internals.cpp:
3606         (WebCore::Internals::testIncomingSyncIPCMessageWhileWaitingForSyncReply):
3607         * testing/Internals.h:
3608         * testing/Internals.idl:
3609
3610 2018-01-24  Alex Christensen  <achristensen@webkit.org>
3611
3612         Remove pre-Sierra-OS-specific code in WebCore
3613         https://bugs.webkit.org/show_bug.cgi?id=182026
3614
3615         Reviewed by Tim Horton.
3616
3617         * page/cocoa/UserAgent.mm:
3618         (WebCore::systemMarketingVersionForUserAgentString):
3619         * page/scrolling/mac/ScrollingMomentumCalculatorMac.mm:
3620         (WebCore::ScrollingMomentumCalculatorMac::retargetedScrollOffsetDidChange):
3621         * platform/cocoa/PasteboardCocoa.mm:
3622         (WebCore::bitmapPNGFileType):
3623         * platform/graphics/FontPlatformData.cpp:
3624         * platform/graphics/FontPlatformData.h:
3625         * platform/graphics/avfoundation/objc/VideoFullscreenLayerManager.mm:
3626         (WebCore::VideoFullscreenLayerManager::setVideoFullscreenLayer):
3627         * platform/graphics/ca/cocoa/PlatformCALayerCocoa.mm:
3628         (layerContentsFormat):
3629         (PlatformCALayerCocoa::updateContentsFormat):
3630         (PlatformCALayerCocoa::backingStoreBytesPerPixel const):
3631         * platform/graphics/cg/GraphicsContextCG.cpp:
3632         (WebCore::linearRGBColorSpaceRef):
3633         (WebCore::extendedSRGBColorSpaceRef):
3634         * platform/graphics/cg/PDFDocumentImage.cpp:
3635         (WebCore::PDFDocumentImage::drawPDFPage):
3636         * platform/graphics/cocoa/FontCacheCoreText.cpp:
3637         (WebCore::getCSSAttribute):
3638         (WebCore::capabilitiesForFontDescriptor):
3639         (WebCore::findClosestFont):
3640         (WebCore::platformFontLookupWithFamily):
3641         (WebCore::lookupFallbackFont):
3642         (WebCore::fontWeightFromCoreText): Deleted.
3643         * platform/graphics/cocoa/FontCocoa.mm:
3644         (WebCore::Font::variantCapsSupportsCharacterForSynthesis const):
3645         (WebCore::Font::platformWidthForGlyph const):
3646         (WebCore::advanceForColorBitmapFont): Deleted.
3647         (WebCore::canUseFastGlyphAdvanceGetter): Deleted.
3648         * platform/graphics/cocoa/FontPlatformDataCocoa.mm:
3649         (WebCore::FontPlatformData::FontPlatformData):
3650         (WebCore::FontPlatformData::hash const):
3651         (WebCore::FontPlatformData::platformIsEqual const):
3652         (WebCore::FontPlatformData::ctFont const):
3653         * platform/graphics/cocoa/GraphicsContextCocoa.mm:
3654         (WebCore::linearRGBColorSpaceRef): Deleted.
3655         * platform/graphics/cocoa/WebCoreDecompressionSession.mm:
3656         (WebCore::WebCoreDecompressionSession::setTimebase):
3657         * platform/graphics/mac/FontCustomPlatformData.cpp:
3658         (WebCore::FontCustomPlatformData::supportsFormat):
3659         * platform/mac/PlatformScreenMac.mm:
3660         (WebCore::screenSupportsExtendedColor):
3661         * platform/mac/ScrollbarThemeMac.mm:
3662         (WebCore::ScrollbarThemeMac::didCreateScrollerImp):
3663         (WebCore::ScrollbarThemeMac::isLayoutDirectionRTL):
3664         * platform/mac/ThemeMac.mm:
3665         (WebCore::ThemeMac::userPrefersReducedMotion const):
3666         * platform/network/cocoa/ResourceRequestCocoa.mm:
3667         (WebCore::ResourceRequest::doUpdatePlatformRequest):
3668         * platform/text/mac/TextBoundaries.mm:
3669         (WebCore::findNextWordFromIndex):
3670         * rendering/RenderLayerModelObject.cpp:
3671         (WebCore::RenderLayerModelObject::shouldPlaceBlockDirectionScrollbarOnLeft const):
3672         * testing/Internals.mm:
3673         (WebCore::Internals::userPrefersReducedMotion const):
3674
3675 2018-01-24  Alex Christensen  <achristensen@webkit.org>
3676
3677         Remove WebProcess authentication code
3678         https://bugs.webkit.org/show_bug.cgi?id=182020
3679
3680         Reviewed by Brady Eidson.
3681
3682         We were keeping it around for pre-NetworkSession media loading, which is gone now.
3683
3684         * html/HTMLMediaElement.cpp:
3685         (WebCore::HTMLMediaElement::mediaPlayerShouldWaitForResponseToAuthenticationChallenge): Deleted.
3686         * html/HTMLMediaElement.h:
3687         * loader/ResourceLoader.cpp:
3688         (WebCore::ResourceLoader::didReceiveAuthenticationChallenge):
3689         * loader/ResourceLoader.h:
3690         * platform/graphics/MediaPlayer.cpp:
3691         (WebCore::MediaPlayer::shouldWaitForResponseToAuthenticationChallenge): Deleted.
3692         * platform/graphics/MediaPlayer.h:
3693         (WebCore::MediaPlayerClient::mediaPlayerShouldWaitForResponseToAuthenticationChallenge): Deleted.
3694         * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.h:
3695         * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
3696         (-[WebCoreAVFLoaderDelegate resourceLoader:shouldWaitForResponseToAuthenticationChallenge:]):
3697         (WebCore::MediaPlayerPrivateAVFoundationObjC::shouldWaitForResponseToAuthenticationChallenge): Deleted.
3698
3699 2018-01-24  Joanmarie Diggs  <jdiggs@igalia.com>
3700
3701         AX: SVG AAM mapping trumps ARIA role attribute in the case of SVG root
3702         https://bugs.webkit.org/show_bug.cgi?id=181994
3703
3704         Reviewed by Chris Fleizach.
3705
3706         Only return AccessibilityRole::Group if we have no author-provided
3707         ARIA role attribute value.
3708
3709         Test: accessibility/svg-element-with-aria-role.html
3710
3711         * accessibility/AccessibilitySVGRoot.cpp:
3712         (WebCore::AccessibilitySVGRoot::roleValue const):
3713         * accessibility/AccessibilitySVGRoot.h:
3714
3715 2018-01-24  Alex Christensen  <achristensen@webkit.org>
3716
3717         Remove unused QTKit preference
3718         https://bugs.webkit.org/show_bug.cgi?id=181968
3719
3720         Reviewed by Alexey Proskuryakov.
3721
3722         They weren't used and didn't do anything.
3723
3724         * page/DeprecatedGlobalSettings.cpp:
3725         (WebCore::DeprecatedGlobalSettings::setQTKitEnabled): Deleted.
3726         * page/DeprecatedGlobalSettings.h:
3727         (WebCore::DeprecatedGlobalSettings::isQTKitEnabled): Deleted.
3728
3729 2018-01-24  Antoine Quint  <graouts@apple.com>
3730
3731         [Web Animations] Compute the progress and currentIteration properties on getComputedTiming()
3732         https://bugs.webkit.org/show_bug.cgi?id=182039
3733         <rdar://problem/36813568>
3734
3735         Reviewed by Dean Jackson.
3736
3737         Compute the "progress" and "currentIteration" properties on the dictionary returned by getComputedTiming().
3738         To support this we implement several procedures from the specification implemented separately with links
3739         and steps copied from the specification. There is one last procedure we don't implement, which is to obtain
3740         the transformed time following the application of the provided easing, which will be the next patch.
3741
3742         * animation/AnimationEffect.cpp:
3743         (WebCore::AnimationEffect::phase const):
3744         (WebCore::AnimationEffect::activeTime const):
3745         (WebCore::AnimationEffect::overallProgress const):
3746         (WebCore::AnimationEffect::simpleIterationProgress const):
3747         (WebCore::AnimationEffect::currentIteration const):
3748         (WebCore::AnimationEffect::currentDirection const):
3749         (WebCore::AnimationEffect::directedProgress const):
3750         (WebCore::AnimationEffect::iterationProgress const):
3751         (WebCore::AnimationEffect::getComputedTiming):
3752         * animation/AnimationEffect.h:
3753
3754 2018-01-24  Daniel Bates  <dabates@apple.com>
3755
3756         REGRESSION (r226138): Selecting a line that ends with zero-width joiner (ZWJ) may cause text transformation
3757         https://bugs.webkit.org/show_bug.cgi?id=181993
3758         <rdar://problem/36421080>
3759
3760         Reviewed by David Hyatt.
3761
3762         Re-implement paint optimization that was inadvertently removed in r226138. This optimization
3763         works around an issue where selecting the last printable character in a line that is followed
3764         followed by a zero-width joiner transforms the selected character.
3765
3766         We need to fix <https://bugs.webkit.org/show_bug.cgi?id=181964> to improve the interaction
3767         of selection and zero-width joiner characters. For now, re-implement a paint optimization
3768         to perform a single paint operation when the style of the non-selected text is identical
3769         to the style of the selected text.
3770
3771         Test: fast/text/mac/select-character-before-zero-width-joiner.html
3772
3773         * rendering/InlineTextBox.cpp:
3774         (WebCore::InlineTextBox::MarkerSubrangeStyle::areBackgroundMarkerSubrangeStylesEqual):
3775         (WebCore::InlineTextBox::MarkerSubrangeStyle::areForegroundMarkerSubrangeStylesEqual):
3776         (WebCore::InlineTextBox::MarkerSubrangeStyle::areDecorationMarkerSubrangeStylesEqual):
3777         Add helper functions to determine when marker styles are identical. We make use of these
3778         equality functions to coalesce adjacent subranges that have the same visual style and
3779         hence reduce the number of drawing commands to paint all the subranges in a line.
3780  
3781         (WebCore::InlineTextBox::paint): Coalesce subranges before painting.
3782
3783         (WebCore::InlineTextBox::subdivideAndResolveStyle): Split out the logic to coalesce
3784         subranges with the same style into its own function InlineTextBox::coalesceAdjacentSubranges()
3785         and kept this function focused on subdivision and style resolution. Manually compute
3786         the frontmost subranges so that we can resolve style for each subrange with respect to
3787         the correct base style. Formerly we always resolved style with respect the specified
3788         base style. Now we resolve style with respect the previous frontmost subrange to ensure
3789         styles cascade as expected. This change causes no visual difference now. Once we implement
3790         <https://bugs.webkit.org/show_bug.cgi?id=175784> we will be able to test this change
3791         with respect to selection of ::spelling-error/::grammar-error pseudo elements.
3792
3793         (WebCore::InlineTextBox::coalesceAdjacentSubranges): Extracted logic from InlineTextBox::subdivideAndResolveStyle().
3794
3795         (WebCore::InlineTextBox::MarkerSubrangeStyle::operator== const): Deleted.
3796         (WebCore::InlineTextBox::MarkerSubrangeStyle::operator!= const): Deleted.
3797         Comparing MarkerSubrangeStyle objects should be performed using the appropriate
3798         are*MarkerSubrangeStylesEqual() non-member function.
3799
3800         * rendering/InlineTextBox.h:
3801         * rendering/MarkerSubrange.cpp:
3802         (WebCore::subdivide): Remove overlap strategy FrontmostWithLongestEffectiveRange
3803         as this strategy is now implemented by InlineTextBox::subdivideAndResolveStyle() and
3804         InlineTextBox::coalesceAdjacentSubranges() that compute the set of frontmost subranges and
3805         coalesces adjacent subranges with the same style into the longest effective subrange,
3806         respectively. Unlike WebCore::subdivide(), InlineTextBox knows what the base style should
3807         be for the subranges and can more aggressively coalesce adjacent subranges of different
3808         types that have the same visual style.
3809         * rendering/MarkerSubrange.h:
3810
3811 2018-01-24  Youenn Fablet  <youenn@apple.com>
3812
3813         Fetch response should copy its url from the request if null
3814         https://bugs.webkit.org/show_bug.cgi?id=182048
3815
3816         Reviewed by Chris Dumez.
3817
3818         No change of behavior.
3819
3820         * loader/DocumentLoader.cpp:
3821         (WebCore::DocumentLoader::responseReceived): Add assertion to check that the response URL is not null.
3822
3823 2018-01-24  Youenn Fablet  <youenn@apple.com>
3824
3825         Account for memory cache in DocumentThreadableLoader::didReceiveResponse assertion
3826         https://bugs.webkit.org/show_bug.cgi?id=182049
3827
3828         Reviewed by Chris Dumez.
3829
3830         No change of behavior.
3831         A response served from Service Worker may be cached in Memory Cache and reused later on.
3832         Update DTL assertion to handle that case.
3833
3834         * loader/DocumentThreadableLoader.cpp:
3835         (WebCore::DocumentThreadableLoader::didReceiveResponse):
3836
3837 2018-01-24  Eric Carlson  <eric.carlson@apple.com>
3838
3839         REGRESSION(r227457): Release assert in updateLayout while destructing a media element
3840         https://bugs.webkit.org/show_bug.cgi?id=182038
3841         <rdar://problem/36812083>
3842
3843         Reviewed by Jer Noble.
3844
3845         * html/MediaElementSession.cpp:
3846         (WebCore::isMainContentForPurposesOfAutoplay): Early return if element.isSuspended().
3847         * platform/audio/mac/MediaSessionManagerMac.mm:
3848         (WebCore::MediaSessionManagerMac::clientCharacteristicsChanged): Call scheduleUpdateNowPlayingInfo
3849         instead of updateNowPlayingInfo.
3850
3851 2018-01-24  Chris Fleizach  <cfleizach@apple.com>
3852
3853         AX: Provide a way for VoiceOver to uniquely identify a web session
3854         https://bugs.webkit.org/show_bug.cgi?id=181894
3855
3856         Reviewed by Joanmarie Diggs.
3857
3858         Add a way for VoiceOver to uniquely track a web page session.
3859
3860         Test: accessibility/mac/session-id.html
3861
3862         * accessibility/mac/WebAccessibilityObjectWrapperMac.mm:
3863         (-[WebAccessibilityObjectWrapper accessibilityAttributeNames]):
3864         (-[WebAccessibilityObjectWrapper accessibilityAttributeValue:]):
3865
3866 2018-01-24  Antti Koivisto  <antti@apple.com>
3867
3868         RenderBlockRareData::m_enclosingFragmentedFlow should be WeakPtr
3869         https://bugs.webkit.org/show_bug.cgi?id=182045
3870         <rdar://problem/36334787>
3871
3872         Reviewed by Zalan Bujtas.
3873
3874         For safety.
3875
3876         * rendering/RenderBlock.cpp:
3877         (WebCore::RenderBlock::cachedEnclosingFragmentedFlow const):
3878         (WebCore::RenderBlock::updateCachedEnclosingFragmentedFlow const):
3879         (WebCore::RenderBlock::locateEnclosingFragmentedFlow const):
3880
3881 2018-01-23  Dean Jackson  <dino@apple.com>
3882
3883         REGRESSION (r222961?): sRGB images shown in WebGL are over-saturated on a wide gamut monitor
3884         https://bugs.webkit.org/show_bug.cgi?id=182033
3885         <rdar://problem/36377780>
3886
3887         Reviewed by Antoine Quint.
3888
3889         My fix for YouTube360 changed the way we composite WebGL on macOS. Unfortunately it dropped
3890         a flag telling the compositor the colorspace of the content should be sRGB. Reinstate this
3891         by explicitly setting the colorspace on the IOSurface we use for WebGL back buffers.
3892
3893         This *should* be covered by the test in:
3894         fast/canvas/webgl/match-page-color-space.html
3895         ... however, it shows a problem with our testing infrastructure. As long as it is not
3896         testing on a Wide Gamut display, and explicitly setting the color profile, an automated
3897         test won't pick up this regression. I could add an Internals helper to query the colorspace
3898         of the WebGL content, but that doesn't actually verify the composited result, which is
3899         all that matters.
3900
3901         * platform/graphics/cocoa/WebGLLayer.mm:
3902         (-[WebGLLayer allocateIOSurfaceBackingStoreWithSize:usingAlpha:]):
3903
3904 2018-01-24  Ms2ger  <Ms2ger@igalia.com>
3905
3906         [GTK] Fix some test failures in ATK selection handling.
3907         https://bugs.webkit.org/show_bug.cgi?id=168369
3908         <rdar://problem/30534881>
3909
3910         Reviewed by Joanmarie Diggs.
3911
3912         In r208479, selectionBelongsToObject was changed to return false if the
3913         intersectsNode call returns an exception.
3914
3915         In particular, this caused accessibility/gtk/text-at-offset-textarea.html
3916         to fail. In this test, the selection is situated in the shadow DOM of the
3917         textarea, while the node that is checked for intersection is the textarea
3918         itself. In line with the standard, intersectsNode returns an exception in
3919         this case.
3920
3921         This caused webkitAccessibleText{Word, Line, Sentence}ForBoundary to stop
3922         returning the expected text in the tested case. Removing this check fixes
3923         the test, along with some others.
3924
3925         Tests: accessibility/gtk/text-at-offset-textarea.html
3926                accessibility/gtk/text-at-offset-textinput.html
3927                accessibility/selected-text-range-aria-elements.html
3928                accessibility/textarea-selected-text-range.html
3929
3930         * accessibility/atk/WebKitAccessibleInterfaceText.cpp:
3931         (getSelectionOffsetsForObject): Remove the selectionBelongsToObject() call.
3932
3933 2018-01-18  Sergio Villar Senin  <svillar@igalia.com>
3934
3935         [WebVR] Add OpenVR to the tree and to the build
3936         https://bugs.webkit.org/show_bug.cgi?id=177298
3937
3938         Reviewed by Žan Doberšek.
3939
3940         Added build dependencies with the OpenVR library.
3941
3942         * CMakeLists.txt:
3943
3944 2018-01-23  Wenson Hsieh  <wenson_hsieh@apple.com>
3945
3946         Harden against layout passes triggered when iterating through HTMLFormElement::associatedElements
3947         https://bugs.webkit.org/show_bug.cgi?id=182037
3948         <rdar://problem/36747812>
3949
3950         Reviewed by Ryosuke Niwa.
3951
3952         Observe that HTMLFormElement::associatedElements returns a const reference to a Vector of raw
3953         FormAssociatedElement pointers. In various call sites that iterate through these associated elements using this
3954         function, some require synchronous layout updates per iteration, which can lead to a bad time when combined with
3955         the first observation.
3956
3957         To address this, we introduce HTMLFormElement::copyAssociatedElementsVector. This returns a new vector
3958         containing strong Refs to each associated element. From each call site that may trigger synchronous layout and
3959         execute arbitrary script while iterating over associated form elements, we instead use iterate over protected
3960         FormAssociatedElements.
3961
3962         From each call site that currently doesn't (and shouldn't) require a layout update, we use the old version that
3963         returns a list of raw FormAssociatedElement pointers, but add ScriptDisallowedScopes to ensure that we never
3964         execute script there in the future.
3965
3966         Test: fast/forms/form-data-associated-element-iteration.html
3967
3968         * html/DOMFormData.cpp:
3969         (WebCore::DOMFormData::DOMFormData):
3970
3971         Change to use copyAssociatedElementsVector().
3972
3973         * html/FormController.cpp:
3974         (WebCore::recordFormStructure):
3975         (WebCore::FormController::restoreControlStateIn):
3976
3977         Change to use copyAssociatedElementsVector().
3978
3979         * html/HTMLFieldSetElement.cpp:
3980         (WebCore::HTMLFieldSetElement::copyAssociatedElementsVector const):
3981         (WebCore:: const):
3982         (WebCore::HTMLFieldSetElement::length const):
3983
3984         Refactor to use unsafeAssociatedElements().
3985
3986         * html/HTMLFieldSetElement.h:
3987         * html/HTMLFormControlsCollection.cpp:
3988         (WebCore:: const):
3989         (WebCore::HTMLFormControlsCollection::copyFormControlElementsVector const):
3990         (WebCore::HTMLFormControlsCollection::customElementAfter const):
3991         (WebCore::HTMLFormControlsCollection::updateNamedElementCache const):
3992
3993         Refactor these to use unsafeAssociatedElements().
3994
3995         * html/HTMLFormControlsCollection.h:
3996         * html/HTMLFormElement.cpp:
3997         (WebCore::HTMLFormElement::unsafeAssociatedElements const):
3998         (WebCore::HTMLFormElement::copyAssociatedElementsVector const):
3999         * html/HTMLFormElement.h:
4000         * loader/FormSubmission.cpp:
4001         (WebCore::FormSubmission::create):
4002
4003         Refactor to use copyAssociatedElementsVector().
4004
4005 2018-01-23  Basuke Suzuki  <Basuke.Suzuki@sony.com>
4006
4007         [Curl] Fix wrong redirection with relative url when it happens from
4008         different host than original host.
4009         https://bugs.webkit.org/show_bug.cgi?id=181873
4010
4011         Reviewed by Alex Christensen.
4012
4013         * platform/network/curl/CurlDownload.cpp:
4014         (WebCore::CurlDownload::willSendRequest):
4015         * platform/network/curl/ResourceHandleCurlDelegate.cpp:
4016         (WebCore::ResourceHandleCurlDelegate::willSendRequest):
4017
4018 2018-01-23  Eric Carlson  <eric.carlson@apple.com>
4019
4020         Resign NowPlaying status when no media element is eligible
4021         https://bugs.webkit.org/show_bug.cgi?id=181914
4022         <rdar://problem/35294116>
4023
4024         Reviewed by Jer Noble.
4025
4026         Updated API test.
4027
4028         * html/HTMLMediaElement.cpp: