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