405ef1417481a567948bb2fd070cd5f2b75dddfb
[WebKit-https.git] / Source / WebCore / ChangeLog
1 2017-11-18  Simon Fraser  <simon.fraser@apple.com>
2
3         Mechanical cleanup of FE* files
4         https://bugs.webkit.org/show_bug.cgi?id=179868
5
6         Reviewed by Wenson Hsieh.
7
8         Remove unused dump() functions.
9         Make overridden member functions in derived classes private.
10         Make simple getters inline.
11         
12         Move common FESpecularLighting and FEDiffuseLighting functions into the 
13         FELighting base class.
14
15         * platform/graphics/filters/FEBlend.cpp:
16         (WebCore::FEBlend::blendMode const): Deleted.
17         (WebCore::FEBlend::dump): Deleted.
18         * platform/graphics/filters/FEBlend.h:
19         (WebCore::FEBlend::blendMode const):
20         * platform/graphics/filters/FEColorMatrix.cpp:
21         (WebCore::FEColorMatrix::type const): Deleted.
22         (WebCore::FEColorMatrix::values const): Deleted.
23         (WebCore::FEColorMatrix::dump): Deleted.
24         * platform/graphics/filters/FEColorMatrix.h:
25         (WebCore::FEColorMatrix::type const):
26         (WebCore::FEColorMatrix::values const):
27         * platform/graphics/filters/FEComponentTransfer.cpp:
28         (WebCore::FEComponentTransfer::redFunction const): Deleted.
29         (WebCore::FEComponentTransfer::greenFunction const): Deleted.
30         (WebCore::FEComponentTransfer::blueFunction const): Deleted.
31         (WebCore::FEComponentTransfer::alphaFunction const): Deleted.
32         (WebCore::FEComponentTransfer::dump): Deleted.
33         * platform/graphics/filters/FEComponentTransfer.h:
34         (WebCore::FEComponentTransfer::redFunction const):
35         (WebCore::FEComponentTransfer::greenFunction const):
36         (WebCore::FEComponentTransfer::blueFunction const):
37         (WebCore::FEComponentTransfer::alphaFunction const):
38         * platform/graphics/filters/FEComposite.cpp:
39         (WebCore::FEComposite::operation const): Deleted.
40         (WebCore::FEComposite::k1 const): Deleted.
41         (WebCore::FEComposite::k2 const): Deleted.
42         (WebCore::FEComposite::k3 const): Deleted.
43         (WebCore::FEComposite::k4 const): Deleted.
44         (WebCore::FEComposite::dump): Deleted.
45         * platform/graphics/filters/FEComposite.h:
46         (WebCore::FEComposite::operation const):
47         (WebCore::FEComposite::k1 const):
48         (WebCore::FEComposite::k2 const):
49         (WebCore::FEComposite::k3 const):
50         (WebCore::FEComposite::k4 const):
51         * platform/graphics/filters/FEConvolveMatrix.cpp:
52         (WebCore::FEConvolveMatrix::kernelSize const): Deleted.
53         (WebCore::FEConvolveMatrix::kernel const): Deleted.
54         (WebCore::FEConvolveMatrix::divisor const): Deleted.
55         (WebCore::FEConvolveMatrix::bias const): Deleted.
56         (WebCore::FEConvolveMatrix::targetOffset const): Deleted.
57         (WebCore::FEConvolveMatrix::edgeMode const): Deleted.
58         (WebCore::FEConvolveMatrix::kernelUnitLength const): Deleted.
59         (WebCore::FEConvolveMatrix::preserveAlpha const): Deleted.
60         (WebCore::FEConvolveMatrix::dump): Deleted.
61         * platform/graphics/filters/FEConvolveMatrix.h:
62         (WebCore::FEConvolveMatrix::kernelSize const):
63         (WebCore::FEConvolveMatrix::kernel const):
64         (WebCore::FEConvolveMatrix::divisor const):
65         (WebCore::FEConvolveMatrix::bias const):
66         (WebCore::FEConvolveMatrix::targetOffset const):
67         (WebCore::FEConvolveMatrix::edgeMode const):
68         (WebCore::FEConvolveMatrix::kernelUnitLength const):
69         (WebCore::FEConvolveMatrix::preserveAlpha const):
70         * platform/graphics/filters/FEDiffuseLighting.cpp:
71         (WebCore::FEDiffuseLighting::lightingColor const): Deleted.
72         (WebCore::FEDiffuseLighting::setLightingColor): Deleted.
73         (WebCore::FEDiffuseLighting::surfaceScale const): Deleted.
74         (WebCore::FEDiffuseLighting::setSurfaceScale): Deleted.
75         (WebCore::FEDiffuseLighting::diffuseConstant const): Deleted.
76         (WebCore::FEDiffuseLighting::kernelUnitLengthX const): Deleted.
77         (WebCore::FEDiffuseLighting::setKernelUnitLengthX): Deleted.
78         (WebCore::FEDiffuseLighting::kernelUnitLengthY const): Deleted.
79         (WebCore::FEDiffuseLighting::setKernelUnitLengthY): Deleted.
80         (WebCore::FEDiffuseLighting::lightSource const): Deleted.
81         (WebCore::FEDiffuseLighting::dump): Deleted.
82         * platform/graphics/filters/FEDiffuseLighting.h:
83         (WebCore::FEDiffuseLighting::diffuseConstant const):
84         * platform/graphics/filters/FEDisplacementMap.cpp:
85         (WebCore::FEDisplacementMap::xChannelSelector const): Deleted.
86         (WebCore::FEDisplacementMap::yChannelSelector const): Deleted.
87         (WebCore::FEDisplacementMap::scale const): Deleted.
88         (WebCore::FEDisplacementMap::dump): Deleted.
89         * platform/graphics/filters/FEDisplacementMap.h:
90         (WebCore::FEDisplacementMap::xChannelSelector const):
91         (WebCore::FEDisplacementMap::yChannelSelector const):
92         (WebCore::FEDisplacementMap::scale const):
93         * platform/graphics/filters/FEDropShadow.cpp:
94         (WebCore::FEDropShadow::dump): Deleted.
95         * platform/graphics/filters/FEDropShadow.h:
96         * platform/graphics/filters/FEFlood.cpp:
97         (WebCore::FEFlood::floodColor const): Deleted.
98         (WebCore::FEFlood::floodOpacity const): Deleted.
99         (WebCore::FEFlood::dump): Deleted.
100         * platform/graphics/filters/FEFlood.h:
101         (WebCore::FEFlood::floodColor const):
102         (WebCore::FEFlood::floodOpacity const):
103         * platform/graphics/filters/FEGaussianBlur.cpp:
104         (WebCore::FEGaussianBlur::stdDeviationX const): Deleted.
105         (WebCore::FEGaussianBlur::stdDeviationY const): Deleted.
106         (WebCore::FEGaussianBlur::edgeMode const): Deleted.
107         (WebCore::FEGaussianBlur::dump): Deleted.
108         * platform/graphics/filters/FEGaussianBlur.h:
109         (WebCore::FEGaussianBlur::stdDeviationX const):
110         (WebCore::FEGaussianBlur::stdDeviationY const):
111         (WebCore::FEGaussianBlur::edgeMode const):
112         * platform/graphics/filters/FELighting.cpp:
113         (WebCore::FELighting::setSurfaceScale):
114         (WebCore::FELighting::setLightingColor):
115         (WebCore::FELighting::setKernelUnitLengthX):
116         (WebCore::FELighting::setKernelUnitLengthY):
117         * platform/graphics/filters/FELighting.h:
118         (WebCore::FELighting::surfaceScale const):
119         (WebCore::FELighting::lightingColor const):
120         (WebCore::FELighting::kernelUnitLengthX const):
121         (WebCore::FELighting::kernelUnitLengthY const):
122         (WebCore::FELighting::lightSource const):
123         * platform/graphics/filters/FEMerge.cpp:
124         (WebCore::FEMerge::dump): Deleted.
125         * platform/graphics/filters/FEMerge.h:
126         * platform/graphics/filters/FEMorphology.cpp:
127         (WebCore::FEMorphology::dump): Deleted.
128         * platform/graphics/filters/FEMorphology.h:
129         * platform/graphics/filters/FEOffset.cpp:
130         (WebCore::FEOffset::dx const): Deleted.
131         (WebCore::FEOffset::dy const): Deleted.
132         (WebCore::FEOffset::dump): Deleted.
133         * platform/graphics/filters/FEOffset.h:
134         (WebCore::FEOffset::dx const):
135         (WebCore::FEOffset::dy const):
136         * platform/graphics/filters/FESpecularLighting.cpp:
137         (WebCore::FESpecularLighting::lightingColor const): Deleted.
138         (WebCore::FESpecularLighting::setLightingColor): Deleted.
139         (WebCore::FESpecularLighting::surfaceScale const): Deleted.
140         (WebCore::FESpecularLighting::setSurfaceScale): Deleted.
141         (WebCore::FESpecularLighting::specularConstant const): Deleted.
142         (WebCore::FESpecularLighting::specularExponent const): Deleted.
143         (WebCore::FESpecularLighting::kernelUnitLengthX const): Deleted.
144         (WebCore::FESpecularLighting::setKernelUnitLengthX): Deleted.
145         (WebCore::FESpecularLighting::kernelUnitLengthY const): Deleted.
146         (WebCore::FESpecularLighting::setKernelUnitLengthY): Deleted.
147         (WebCore::FESpecularLighting::lightSource const): Deleted.
148         (WebCore::FESpecularLighting::dump): Deleted.
149         * platform/graphics/filters/FESpecularLighting.h:
150         (WebCore::FESpecularLighting::specularConstant const):
151         (WebCore::FESpecularLighting::specularExponent const):
152         * platform/graphics/filters/FETile.cpp:
153         (WebCore::FETile::dump): Deleted.
154         * platform/graphics/filters/FETile.h:
155         * platform/graphics/filters/FETurbulence.cpp:
156         (WebCore::FETurbulence::dump): Deleted.
157         * platform/graphics/filters/FETurbulence.h:
158         * platform/graphics/filters/FilterEffect.h:
159         * platform/graphics/filters/SourceAlpha.cpp:
160         (WebCore::SourceAlpha::dump): Deleted.
161         * platform/graphics/filters/SourceAlpha.h:
162         * platform/graphics/filters/SourceGraphic.cpp:
163         (WebCore::SourceGraphic::dump): Deleted.
164         * platform/graphics/filters/SourceGraphic.h:
165         * svg/graphics/filters/SVGFEImage.cpp:
166         (WebCore::FEImage::dump): Deleted.
167         * svg/graphics/filters/SVGFEImage.h:
168
169 2017-11-18  Simon Fraser  <simon.fraser@apple.com>
170
171         Attempt to fix Windows build failures seen in EWS.
172         
173         Remove default constructor for ColorComponents, which was ambiguous with the
174         one that takes 4 values.
175
176         * platform/graphics/ColorUtilities.h:
177
178 2017-11-18  Simon Fraser  <simon.fraser@apple.com>
179
180         Line of garbage pixels at the bottom of an feTurbulence sometimes
181         https://bugs.webkit.org/show_bug.cgi?id=179866
182
183         Reviewed by Wenson Hsieh.
184         
185         The ParallelJobs logic was broken in that the sum of the computed job
186         heights was one too short sometimes. Fix and clean up the logic.
187
188         Test: svg/filters/feTurbulence-parallel-jobs.html
189
190         * platform/graphics/filters/FETurbulence.cpp:
191         (WebCore::FETurbulence::platformApplySoftware):
192
193 2017-11-18  Simon Fraser  <simon.fraser@apple.com>
194
195         Use #pragma once in FE* files.
196         
197         Rubber-stamped by Dan Bates.
198
199         * platform/graphics/filters/FEBlend.h:
200         * platform/graphics/filters/FEColorMatrix.h:
201         * platform/graphics/filters/FEComponentTransfer.h:
202         * platform/graphics/filters/FEComposite.h:
203         * platform/graphics/filters/FEConvolveMatrix.h:
204         * platform/graphics/filters/FEDiffuseLighting.h:
205         * platform/graphics/filters/FEDisplacementMap.h:
206         * platform/graphics/filters/FEDropShadow.h:
207         * platform/graphics/filters/FEFlood.h:
208         * platform/graphics/filters/FEGaussianBlur.h:
209         * platform/graphics/filters/FELighting.h:
210         * platform/graphics/filters/FEMerge.h:
211         * platform/graphics/filters/FEOffset.h:
212         * platform/graphics/filters/FESpecularLighting.h:
213         * platform/graphics/filters/FETile.h:
214
215 2017-11-18  Simon Fraser  <simon.fraser@apple.com>
216
217         Remove a TimingScope that I left in by mistake.
218
219         * platform/graphics/filters/FETurbulence.cpp:
220         (WebCore::FETurbulence::platformApplySoftware):
221
222 2017-11-18  Simon Fraser  <simon.fraser@apple.com>
223
224         FETurbulence: round the result according to the spec
225         https://bugs.webkit.org/show_bug.cgi?id=179865
226
227         Reviewed by Zalan Bujtas.
228
229         The spec explicitly says that the floating point results are multiplied by 255 then
230         clamped between 0 and 255, so do this instead of using lroundf().
231         
232         This is also faster (about 10%).
233
234         * platform/graphics/ColorUtilities.h:
235         (WebCore::ColorComponents::ColorComponents):
236         * platform/graphics/filters/FETurbulence.cpp:
237         (WebCore::toColorComponents):
238         (WebCore::FETurbulence::calculateTurbulenceValueForPoint const):
239
240 2017-11-18  Simon Fraser  <simon.fraser@apple.com>
241
242         More FETurbulence cleanup
243         https://bugs.webkit.org/show_bug.cgi?id=179863
244
245         Reviewed by Zalan Bujtas.
246         
247         Hoist computation of initial StitchData up to be done once per filter,
248         not once per pixel. Passing initial StitchData by value to calculateTurbulenceValueForPoint()
249         ensures that each pixel gets the initial state.
250         
251         Also, adjusted baseFrequencyX and baseFrequencyY can be computed just once at the start,
252         and passed through via PaintingData.
253         
254         Change enum TurbulenceType to be an enum class (requiring casts in a couple of places)
255         and undo the capitalization of the values.
256
257         Fix spelling of TURBULANCE -> TURBULENCE in test output.
258
259         * platform/graphics/filters/FETurbulence.cpp:
260         (WebCore::FETurbulence::computeStitching const):
261         (WebCore::FETurbulence::calculateTurbulenceValueForPoint const):
262         (WebCore::FETurbulence::fillRegion const):
263         (WebCore::FETurbulence::fillRegionWorker):
264         (WebCore::FETurbulence::platformApplySoftware):
265         (WebCore::operator<<):
266         * platform/graphics/filters/FETurbulence.h:
267         (WebCore::FETurbulence::PaintingData::PaintingData):
268         (WebCore::FETurbulence::StitchData::StitchData): Deleted.
269         * svg/SVGAnimatedEnumeration.cpp:
270         (WebCore::enumerationValueForTargetAttribute):
271         * svg/SVGFETurbulenceElement.cpp:
272         (WebCore::SVGFETurbulenceElement::SVGFETurbulenceElement):
273         (WebCore::SVGFETurbulenceElement::parseAttribute):
274         * svg/SVGFETurbulenceElement.h:
275         (WebCore::SVGPropertyTraits<TurbulenceType>::highestEnumValue):
276         (WebCore::SVGPropertyTraits<TurbulenceType>::toString):
277         (WebCore::SVGPropertyTraits<TurbulenceType>::fromString):
278
279 2017-11-18  Simon Fraser  <simon.fraser@apple.com>
280
281         feTurbulence with stitchTiles is broken
282         https://bugs.webkit.org/show_bug.cgi?id=179862
283
284         Reviewed by Zalan Bujtas.
285         
286         The "stitchTiles" logic was broken, and not equivalent to the spec sample code,
287         because it didn't compute and wrap the bx1 and by1 equivalents separately from
288         bx0 and by0.
289         
290         Annotated the code with the equivalent sample code from the spec for ease of
291         comparison.
292         
293         Also make some functions const.
294
295         Test: svg/filters/feTurbulence-stitchTiles.html
296
297         * platform/graphics/filters/FETurbulence.cpp:
298         (WebCore::FETurbulence::noise2D const):
299         (WebCore::FETurbulence::calculateTurbulenceValueForPoint const):
300         (WebCore::FETurbulence::fillRegion const):
301         (WebCore::checkNoise): Deleted.
302         (WebCore::FETurbulence::noise2D): Deleted.
303         (WebCore::FETurbulence::calculateTurbulenceValueForPoint): Deleted.
304         (WebCore::FETurbulence::fillRegion): Deleted.
305         * platform/graphics/filters/FETurbulence.h:
306         * platform/graphics/filters/FilterEffect.h:
307         (WebCore::FilterEffect::filter const):
308
309 2017-11-18  Antti Koivisto  <antti@apple.com>
310
311         REGRESSION (r220646): REGRESSION (r220646): RenderTreePosition::computeNextSibling hits assertion with certain first-letter mutations
312         https://bugs.webkit.org/show_bug.cgi?id=179855
313         <rdar://problem/35464071>
314
315         Reviewed by Zalan Bujtas.
316
317         Test: fast/css-generated-content/first-letter-update-crash.html
318
319         * style/RenderTreeUpdaterFirstLetter.cpp:
320         (WebCore::styleForFirstLetter):
321         (WebCore::updateFirstLetterStyle):
322         (WebCore::createFirstLetterRenderer):
323
324             Tighten these to take RenderBlock.
325
326         (WebCore::supportsFirstLetter):
327
328             Test exact conditions where first letter renderer is allowed for fast rejection.
329
330         (WebCore::RenderTreeUpdater::FirstLetter::update):
331
332             If update was called on a block that doesn't support first letter, getFirstLetter could in
333             some cases return an ancestor of the block and we would end up mutating a first letter renderer
334             that wasn't current block's descendant. This violates assumptions of the RenderTreeUpdater
335             and could cause cached render tree position to become invalid.
336
337             Fix by ensuring we are always updating first letter for the current block only.
338
339 2017-11-17  Chris Dumez  <cdumez@apple.com>
340
341         [Service Workers] Implement "Notify Controller Change" algorithm
342         https://bugs.webkit.org/show_bug.cgi?id=179822
343
344         Reviewed by Youenn Fablet.
345
346         Implement "Notify Controller Change" algorithm:
347         - https://w3c.github.io/ServiceWorker/#notify-controller-change
348
349         Use it to support step 7 of "Activate" algorithm:
350         - https://w3c.github.io/ServiceWorker/#activate
351
352         Test: http/tests/workers/service/controller-change.html
353
354         * workers/service/ServiceWorkerContainer.cpp:
355         (WebCore::ServiceWorkerContainer::scheduleTaskToFireControllerChangeEvent):
356         * workers/service/ServiceWorkerContainer.h:
357         * workers/service/server/SWClientConnection.cpp:
358         (WebCore::SWClientConnection::notifyClientsOfControllerChange):
359         * workers/service/server/SWClientConnection.h:
360         * workers/service/server/SWServer.h:
361         * workers/service/server/SWServerJobQueue.cpp:
362         (WebCore::SWServerJobQueue::activate):
363         * workers/service/server/SWServerRegistration.cpp:
364         (WebCore::SWServerRegistration::notifyClientsOfControllerChange):
365         * workers/service/server/SWServerRegistration.h:
366
367 2017-11-17  Chris Dumez  <cdumez@apple.com>
368
369         Unreviewed attempt to fix build after r225006.
370
371         * platform/network/cf/NetworkStorageSessionCFNet.cpp:
372         (WebCore::NetworkStorageSession::setStorageAccessGranted):
373
374 2017-11-17  Simon Fraser  <simon.fraser@apple.com>
375
376         FETurbulence: compute all 4 channels at once
377         https://bugs.webkit.org/show_bug.cgi?id=179833
378
379         Reviewed by Sam Weinig.
380
381         Introduce some new helper classes for storing float color components, and use
382         them in calculateTurbulenceValueForPoint() and noise2D() for all the channels in one
383         pass. This makes FETurbulence about twice as fast.
384
385         * Sources.txt:
386         * WebCore.xcodeproj/project.pbxproj:
387         * platform/graphics/ColorUtilities.cpp: Added.
388         (WebCore::ColorComponents::ColorComponents):
389         * platform/graphics/ColorUtilities.h: Added.
390         (WebCore::FloatComponents::FloatComponents):
391         (WebCore::FloatComponents::operator +=):
392         (WebCore::FloatComponents::operator + const):
393         (WebCore::FloatComponents::operator / const):
394         (WebCore::FloatComponents::operator * const):
395         (WebCore::FloatComponents::abs const):
396         (WebCore::clampedColorComponent):
397         * platform/graphics/filters/FETurbulence.cpp:
398         (WebCore::FETurbulence::noise2D):
399         (WebCore::FETurbulence::calculateTurbulenceValueForPoint):
400         (WebCore::FETurbulence::fillRegion):
401         (WebCore::FETurbulence::platformApplySoftware):
402         * platform/graphics/filters/FETurbulence.h:
403
404 2017-11-17  Chris Dumez  <cdumez@apple.com>
405
406         Use a strongly typed identifier for SWServer::Connection
407         https://bugs.webkit.org/show_bug.cgi?id=179848
408
409         Reviewed by Brady Eidson.
410
411         Use a strongly typed identifier for SWServer::Connection, for clarity.
412
413         * workers/service/ServiceWorker.cpp:
414         (WebCore::ServiceWorker::postMessage):
415         * workers/service/ServiceWorkerClient.cpp:
416         (WebCore::ServiceWorkerClient::ServiceWorkerClient):
417         (WebCore::ServiceWorkerClient::id const):
418         (WebCore::ServiceWorkerClient::postMessage):
419         * workers/service/ServiceWorkerClient.h:
420         (WebCore::ServiceWorkerClient::create):
421         (WebCore::ServiceWorkerClient::identifier const):
422         * workers/service/ServiceWorkerClientData.cpp:
423         (WebCore::ServiceWorkerClientData::isolatedCopy const):
424         (WebCore::ServiceWorkerClientData::from):
425         * workers/service/ServiceWorkerClientData.h:
426         (WebCore::ServiceWorkerClientData::encode const):
427         (WebCore::ServiceWorkerClientData::decode):
428         * workers/service/ServiceWorkerClientIdentifier.h:
429         (WebCore::ServiceWorkerClientIdentifier::toString const):
430         (WebCore::ServiceWorkerClientIdentifier::decode):
431         * workers/service/ServiceWorkerContainer.cpp:
432         (WebCore::ServiceWorkerContainer::addRegistration):
433         (WebCore::ServiceWorkerContainer::removeRegistration):
434         (WebCore::ServiceWorkerContainer::updateRegistration):
435         (WebCore::ServiceWorkerContainer::connectionIdentifier):
436         * workers/service/ServiceWorkerContainer.h:
437         * workers/service/ServiceWorkerFetchResult.h:
438         (WebCore::ServiceWorkerFetchResult::decode):
439         * workers/service/ServiceWorkerJobClient.h:
440         * workers/service/ServiceWorkerJobData.cpp:
441         (WebCore::ServiceWorkerJobData::ServiceWorkerJobData):
442         * workers/service/ServiceWorkerJobData.h:
443         (WebCore::ServiceWorkerJobData::connectionIdentifier const):
444         (WebCore::ServiceWorkerJobData::decode):
445         * workers/service/ServiceWorkerTypes.h:
446         * workers/service/ServiceWorkerWindowClient.cpp:
447         (WebCore::ServiceWorkerWindowClient::ServiceWorkerWindowClient):
448         * workers/service/ServiceWorkerWindowClient.h:
449         * workers/service/context/SWContextManager.cpp:
450         (WebCore::SWContextManager::postMessageToServiceWorkerGlobalScope):
451         * workers/service/context/SWContextManager.h:
452         * workers/service/context/ServiceWorkerThread.cpp:
453         (WebCore::ServiceWorkerThread::postMessageToServiceWorkerGlobalScope):
454         * workers/service/context/ServiceWorkerThread.h:
455         * workers/service/server/SWClientConnection.h:
456         * workers/service/server/SWServer.cpp:
457         (WebCore::SWServer::Connection::Connection):
458         (WebCore::SWServer::Connection::scheduleJobInServer):
459         (WebCore::SWServer::rejectJob):
460         (WebCore::SWServer::resolveRegistrationJob):
461         (WebCore::SWServer::startScriptFetch):
462         (WebCore::SWServer::scriptFetchFinished):
463         * workers/service/server/SWServer.h:
464         (WebCore::SWServer::Connection::identifier const):
465         (WebCore::SWServer::getConnection):
466         * workers/service/server/SWServerRegistration.cpp:
467         (WebCore::SWServerRegistration::forEachConnection):
468         (WebCore::SWServerRegistration::addClientServiceWorkerRegistration):
469         (WebCore::SWServerRegistration::removeClientServiceWorkerRegistration):
470         (WebCore::SWServerRegistration::unregisterServerConnection):
471         * workers/service/server/SWServerRegistration.h:
472
473 2017-11-17  John Wilander  <wilander@apple.com>
474
475         Storage Access API: UI process should update network process about granted access
476         https://bugs.webkit.org/show_bug.cgi?id=176943
477         <rdar://problem/34440612>
478
479         Reviewed by Alex Christensen.
480
481         Tests: http/tests/storageAccess/request-and-grant-storage-access-cross-origin-sandboxed-iframe-from-prevalent-domain-with-non-recent-user-interaction.html
482                http/tests/storageAccess/request-and-grant-storage-access-cross-origin-sandboxed-iframe-from-prevalent-domain-with-recent-user-interaction.html
483
484         * platform/network/NetworkStorageSession.h:
485         * platform/network/cf/NetworkStorageSessionCFNet.cpp:
486         (WebCore::NetworkStorageSession::setStorageAccessAPIEnabled):
487         (WebCore::NetworkStorageSession::cookieStoragePartition const):
488             Now also checks if the resource has been granted storage access
489             under this partition and if so, does not return a partition.
490         (WebCore::NetworkStorageSession::setPrevalentDomainsToPartitionOrBlockCookies):
491             Now clears storage access when it is told to clear first.
492         (WebCore::NetworkStorageSession::isStorageAccessGranted const):
493         (WebCore::NetworkStorageSession::setStorageAccessGranted):
494
495 2017-11-17  Simon Fraser  <simon.fraser@apple.com>
496
497         Inadvertently swapped m_baseFrequencyX and m_baseFrequencyY in the previous commit.
498
499         * platform/graphics/filters/FETurbulence.h:
500         (WebCore::FETurbulence::baseFrequencyY const):
501         (WebCore::FETurbulence::baseFrequencyX const):
502
503 2017-11-17  Alex Christensen  <achristensen@webkit.org>
504
505         REGRESSION(224348): [mac-wk1] LayoutTest media/video-src-remove.html is a flaky timeout
506         https://bugs.webkit.org/show_bug.cgi?id=179806
507
508         Reviewed by Jer Noble.
509
510         In r224348 I used callOnMainThread to fix UIWebView which uses the web thread, but Mac doesn't
511         use the web thread. Something about the timing of operations in the media stack requires that
512         dispatch_async be used instead of performSelectorOnMainThread.
513         
514         * platform/network/mac/WebCoreResourceHandleAsOperationQueueDelegate.mm:
515         (-[WebCoreResourceHandleAsOperationQueueDelegate callFunctionOnMainThread:]):
516         Use callOnMainThread on iOS, dispatch_async on Mac.
517
518 2017-11-17  Per Arne Vollan  <pvollan@apple.com>
519
520         [Win] Compile error in InbandTextTrackPrivateAVCF::readNativeSampleBuffer.
521         https://bugs.webkit.org/show_bug.cgi?id=179845
522
523         Reviewed by Jer Noble.
524
525         * platform/graphics/avfoundation/cf/InbandTextTrackPrivateAVCF.cpp:
526         (WebCore::InbandTextTrackPrivateAVCF::readNativeSampleBuffer):
527
528 2017-11-17  Chris Fleizach  <cfleizach@apple.com>
529
530         AX: VoiceOver in Safari does not read table header for first cell in first body row
531         https://bugs.webkit.org/show_bug.cgi?id=179780
532         <rdar://problem/35590551>
533
534         Reviewed by Joanmarie Diggs.
535
536         A table cell shouldn't be considered a row header if it's in a row of other headers.
537
538         Test: accessibility/table-header-calculation-for-header-rows.html
539
540         * accessibility/AccessibilityTableRow.cpp:
541         (WebCore::AccessibilityTableRow::headerObject):
542
543 2017-11-17  Simon Fraser  <simon.fraser@apple.com>
544
545         Don't invert a matrix for every channel of every pixel of an FETurbulence filter
546         https://bugs.webkit.org/show_bug.cgi?id=179829
547
548         Reviewed by Dean Jackson.
549         
550         FETurbulence::fillRegion() called filter().mapAbsolutePointToLocalPoint(point) for each
551         of the 4 channels on a point, which is stupid.
552         
553         Fix to invert the matrix once, and then map the point once for each pixel. This reduces
554         the time in fillRegion() function by about 30%.
555
556         * platform/graphics/filters/FETurbulence.cpp:
557         (WebCore::FETurbulence::fillRegion):
558         * platform/graphics/filters/Filter.h:
559         (WebCore::Filter::absoluteTransform const):
560         (WebCore::Filter::mapAbsolutePointToLocalPoint const): Deleted.
561
562 2017-11-17  Brent Fulgham  <bfulgham@apple.com>
563
564         REGRESSION(r224390): Revert unneeded Ref use.
565         https://bugs.webkit.org/show_bug.cgi?id=179844
566         <rdar://problem/35624718>
567
568         Reviewed by Chris Dumez.
569
570         A Ref was added to a simple code path used for type checking, which introduced a nullptr
571         deref. The original change was not needed, so let's revert it.
572
573         * html/HTMLFrameOwnerElement.cpp:
574         (WebCore::HTMLFrameOwnerElement::contentDocument const): Use 'nullptr' instead of 0.
575         (WebCore::HTMLFrameOwnerElement::contentWindow const): Ditto.
576         (WebCore::HTMLFrameOwnerElement::getSVGDocument const): Revert to original code here.
577
578 2017-11-17  Nan Wang  <n_wang@apple.com>
579
580         AX: AOM: Implement boolean type properties
581         https://bugs.webkit.org/show_bug.cgi?id=179496
582
583         Reviewed by Chris Fleizach.
584
585         Accessibility Object Model
586         Explainer: https://wicg.github.io/aom/explainer.html
587         Spec: https://wicg.github.io/aom/spec/
588
589         Implemented the boolean type properties for Accessibility Object Modal.
590
591         Test: accessibility/mac/AOM-bool-properties.html
592
593         * accessibility/AXObjectCache.cpp:
594         (WebCore::AXObjectCache::AXObjectCache):
595         (WebCore::AXObjectCache::~AXObjectCache):
596         (WebCore::AXObjectCache::findModalNodes):
597         (WebCore::AXObjectCache::updateCurrentModalNode):
598         (WebCore::AXObjectCache::modalNode):
599         (WebCore::AXObjectCache::remove):
600         (WebCore::AXObjectCache::handleMenuItemSelected):
601         (WebCore::AXObjectCache::focusModalNode):
602         (WebCore::AXObjectCache::focusModalNodeTimerFired):
603         (WebCore::AXObjectCache::handleAttributeChanged):
604         (WebCore::AXObjectCache::handleModalChange):
605         (WebCore::isNodeAriaVisible):
606         (WebCore::AXObjectCache::findAriaModalNodes): Deleted.
607         (WebCore::AXObjectCache::updateCurrentAriaModalNode): Deleted.
608         (WebCore::AXObjectCache::ariaModalNode): Deleted.
609         (WebCore::AXObjectCache::focusAriaModalNode): Deleted.
610         (WebCore::AXObjectCache::focusAriaModalNodeTimerFired): Deleted.
611         (WebCore::AXObjectCache::handleAriaModalChange): Deleted.
612         * accessibility/AXObjectCache.h:
613         (WebCore::AXObjectCache::AXObjectCache):
614         (WebCore::AXObjectCache::modalNode):
615         (WebCore::AXObjectCache::focusModalNodeTimerFired):
616         (WebCore::AXObjectCache::handleModalChange):
617         (WebCore::AXObjectCache::ariaModalNode): Deleted.
618         (WebCore::AXObjectCache::focusAriaModalNodeTimerFired): Deleted.
619         (WebCore::AXObjectCache::handleAriaModalChange): Deleted.
620         * accessibility/AccessibilityARIAGrid.cpp:
621         (WebCore::AccessibilityARIAGrid::isMultiSelectable const):
622         * accessibility/AccessibilityARIAGridCell.cpp:
623         (WebCore::AccessibilityARIAGridCell::readOnlyValue const):
624         (WebCore::AccessibilityARIAGridCell::ariaReadOnlyValue const): Deleted.
625         * accessibility/AccessibilityARIAGridCell.h:
626         * accessibility/AccessibilityListBoxOption.cpp:
627         (WebCore::AccessibilityListBoxOption::isEnabled const):
628         * accessibility/AccessibilityNodeObject.cpp:
629         (WebCore::AccessibilityNodeObject::isEnabled const):
630         (WebCore::AccessibilityNodeObject::isMultiSelectable const):
631         (WebCore::AccessibilityNodeObject::isRequired const):
632         (WebCore::shouldUseAccessibilityObjectInnerText):
633         (WebCore::AccessibilityNodeObject::canSetValueAttribute const):
634         * accessibility/AccessibilityObject.cpp:
635         (WebCore::AccessibilityObject::supportsReadOnly const):
636         (WebCore::AccessibilityObject::readOnlyValue const):
637         (WebCore::AccessibilityObject::ariaIsMultiline const):
638         (WebCore::AccessibilityObject::isModalDescendant const):
639         (WebCore::AccessibilityObject::isModalNode const):
640         (WebCore::AccessibilityObject::ignoredFromModalPresence const):
641         (WebCore::AccessibilityObject::boolValueForProperty const):
642         (WebCore::AccessibilityObject::supportsARIAAttributes const):
643         (WebCore::AccessibilityObject::supportsExpanded const):
644         (WebCore::AccessibilityObject::isExpanded const):
645         (WebCore::AccessibilityObject::isAXHidden const):
646         (WebCore::AccessibilityObject::defaultObjectInclusion const):
647         (WebCore::AccessibilityObject::setIsIgnoredFromParentDataForChild):
648         (WebCore::AccessibilityObject::supportsARIAReadOnly const): Deleted.
649         (WebCore::AccessibilityObject::ariaReadOnlyValue const): Deleted.
650         (WebCore::AccessibilityObject::isAriaModalDescendant const): Deleted.
651         (WebCore::AccessibilityObject::isAriaModalNode const): Deleted.
652         (WebCore::AccessibilityObject::ignoredFromARIAModalPresence const): Deleted.
653         (WebCore::AccessibilityObject::isARIAHidden const): Deleted.
654         * accessibility/AccessibilityObject.h:
655         (WebCore::AccessibilityObject::isHidden const):
656         * accessibility/AccessibilityRenderObject.cpp:
657         (WebCore::AccessibilityRenderObject::defaultObjectInclusion const):
658         (WebCore::AccessibilityRenderObject::isSelected const):
659         (WebCore::AccessibilityRenderObject::canSetExpandedAttribute const):
660         (WebCore::AccessibilityRenderObject::liveRegionAtomic const):
661         (WebCore::AccessibilityRenderObject::isBusy const):
662         * accessibility/AccessibleNode.cpp:
663         (WebCore::ariaAttributeMap):
664         (WebCore::isPropertyValueBoolean):
665         (WebCore::AccessibleNode::effectiveBoolValueForElement):
666         (WebCore::AccessibleNode::boolValueForProperty):
667         (WebCore::AccessibleNode::setBoolProperty):
668         (WebCore::AccessibleNode::atomic const):
669         (WebCore::AccessibleNode::setAtomic):
670         (WebCore::AccessibleNode::busy const):
671         (WebCore::AccessibleNode::setBusy):
672         (WebCore::AccessibleNode::disabled const):
673         (WebCore::AccessibleNode::setDisabled):
674         (WebCore::AccessibleNode::expanded const):
675         (WebCore::AccessibleNode::setExpanded):
676         (WebCore::AccessibleNode::hidden const):
677         (WebCore::AccessibleNode::setHidden):
678         (WebCore::AccessibleNode::modal const):
679         (WebCore::AccessibleNode::setModal):
680         (WebCore::AccessibleNode::multiline const):
681         (WebCore::AccessibleNode::setMultiline):
682         (WebCore::AccessibleNode::multiselectable const):
683         (WebCore::AccessibleNode::setMultiselectable):
684         (WebCore::AccessibleNode::readOnly const):
685         (WebCore::AccessibleNode::setReadOnly):
686         (WebCore::AccessibleNode::required const):
687         (WebCore::AccessibleNode::setRequired):
688         (WebCore::AccessibleNode::selected const):
689         (WebCore::AccessibleNode::setSelected):
690         * accessibility/AccessibleNode.h:
691         * accessibility/AccessibleNode.idl:
692         * accessibility/atk/WebKitAccessibleWrapperAtk.cpp:
693         (webkitAccessibleGetAttributes):
694         (setAtkStateSetFromCoreObject):
695         * accessibility/mac/WebAccessibilityObjectWrapperMac.mm:
696         (-[WebAccessibilityObjectWrapper accessibilityAttributeValue:]):
697         * inspector/agents/InspectorDOMAgent.cpp:
698         (WebCore::InspectorDOMAgent::buildObjectForAccessibilityProperties):
699
700 2017-11-17  Alex Christensen  <achristensen@webkit.org>
701
702         Clean up URL.h
703         https://bugs.webkit.org/show_bug.cgi?id=179710
704
705         Reviewed by Brady Eidson.
706
707         No change in behavior.
708
709         * Modules/fetch/FetchRequest.cpp:
710         (WebCore::FetchRequest::urlString const):
711         * Modules/fetch/FetchResponse.cpp:
712         (WebCore::FetchResponse::url const):
713         * platform/URL.cpp:
714         (WebCore::URL::serialize const): Deleted.
715         * platform/URL.h:
716         * platform/mac/URLMac.mm:
717         (WebCore::URL::createCFURL const):
718
719 2017-11-17  Alex Christensen  <achristensen@webkit.org>
720
721         Use RunLoop and Mode from NetworkingContext if they are given
722         https://bugs.webkit.org/show_bug.cgi?id=179800
723         <rdar://problem/35519421>
724
725         Reviewed by Brady Eidson.
726
727         * platform/network/mac/WebCoreResourceHandleAsOperationQueueDelegate.mm:
728         (callOnMainThreadOrSchedule):
729         (-[WebCoreResourceHandleAsOperationQueueDelegate connection:willSendRequest:redirectResponse:]):
730         (-[WebCoreResourceHandleAsOperationQueueDelegate connection:didReceiveAuthenticationChallenge:]):
731         (-[WebCoreResourceHandleAsOperationQueueDelegate connection:canAuthenticateAgainstProtectionSpace:]):
732         (-[WebCoreResourceHandleAsOperationQueueDelegate connection:didReceiveResponse:]):
733         (-[WebCoreResourceHandleAsOperationQueueDelegate connection:didReceiveData:lengthReceived:]):
734         (-[WebCoreResourceHandleAsOperationQueueDelegate connection:didSendBodyData:totalBytesWritten:totalBytesExpectedToWrite:]):
735         (-[WebCoreResourceHandleAsOperationQueueDelegate connectionDidFinishLoading:]):
736         (-[WebCoreResourceHandleAsOperationQueueDelegate connection:didFailWithError:]):
737         (-[WebCoreResourceHandleAsOperationQueueDelegate connection:willCacheResponse:]):
738
739 2017-11-17  Simon Fraser  <simon.fraser@apple.com>
740
741         FETurbulence const and inline cleanup
742         https://bugs.webkit.org/show_bug.cgi?id=179832
743
744         Reviewed by Dean Jackson.
745
746         Pass the PaintingData& around as const, and remove some 'inline', letting the compiler
747         decide. Also declare a few variables closer to first use.
748         
749         Speeds up FETurbulence by about 1%.
750
751         * platform/graphics/filters/FETurbulence.cpp:
752         (WebCore::FETurbulence::initPaint):
753         (WebCore::FETurbulence::noise2D):
754         (WebCore::FETurbulence::calculateTurbulenceValueForPoint):
755         (WebCore::FETurbulence::fillRegion):
756         * platform/graphics/filters/FETurbulence.h:
757
758 2017-11-17  Antti Koivisto  <antti@apple.com>
759
760         Move destroyLeftoverChildren call to RenderObject::destroy
761         https://bugs.webkit.org/show_bug.cgi?id=179819
762
763         Reviewed by Zalan Bujtas.
764
765         This is currently called inconsistenly from various willBeDestroyed implementations.
766         We should always call it before invoking willBeDestroyed.
767
768         * rendering/RenderBlockFlow.cpp:
769         (WebCore::RenderBlockFlow::willBeDestroyed):
770         * rendering/RenderElement.cpp:
771         (WebCore::RenderElement::willBeDestroyed):
772         * rendering/RenderElement.h:
773         (WebCore::RenderElement::setLastChild):
774         * rendering/RenderInline.cpp:
775         (WebCore::RenderInline::willBeDestroyed):
776         * rendering/RenderLayer.cpp:
777         (WebCore::RenderLayer::~RenderLayer):
778
779             Add some release asserts verifying layer has been detached before destruction.
780             This would reveal cases where destroyLeftoverChildren was called too late.
781
782         * rendering/RenderObject.cpp:
783         (WebCore::RenderObject::destroy):
784
785             Call destroyLeftoverChildren.
786
787 2017-11-17  Said Abou-Hallawa  <sabouhallawa@apple.com>
788
789         SVG scrolling anchor should be reset if the fragmentIdentifier does not exist or is not provided
790         https://bugs.webkit.org/show_bug.cgi?id=176577
791
792         Reviewed by Simon Fraser.
793
794         Because the SVGImage can be cached only once but used multiple times with
795         different fragmentIdentifiers, SVGImage has to call FrameView::scrollToFragment()
796         before the image is displayed. If the fragmentIdentifier is not provided
797         in the URL or it does not exist in the SVGImage, FrameView::scrollToFragment()
798         has to reset the scrolling anchor of the SVG as if it was not displayed before.
799         We do not want the previous scrolling anchor to be used when the FrameView
800         of SVGImage can't scroll to the current fragmentIdentifier for any reason.
801
802         Test: http/tests/svg/svg-fragment-url-special-cases.html
803
804         * page/FrameView.cpp:
805         (WebCore::FrameView::scrollToFragment):
806         (WebCore::FrameView::scrollToAnchor):
807         (WebCore::FrameView::resetScrollAnchor):
808         * page/FrameView.h:
809         * platform/URL.cpp:
810         (WebCore::URL::fragmentIdentifier const): Call hasFragmentIdentifier() 
811         instead of repeating the same condition.
812         (WebCore::decodeURLEscapeSequences):
813         * svg/SVGSVGElement.cpp:
814         (WebCore::SVGSVGElement::findViewAnchor const):
815         (WebCore::SVGSVGElement::findRootAnchor const):
816         (WebCore::SVGSVGElement::scrollToAnchor): We want to know whether the SVG 
817         root element could scroll to the fragmentIdentifier or not. If it could not,
818         FrameView::scrollToAnchor() can still try one last time to do the scrolling
819         only if anchorElement is not nullptr.
820         (WebCore::SVGSVGElement::resetScrollAnchor): Reset the FrameView scrolling
821         state to its initial value.
822         * svg/SVGSVGElement.h:
823
824 2017-11-17  Youenn Fablet  <youenn@apple.com>
825
826         ServiceWorker intercepted FetchRequest should have their referrer set appropriately.
827         https://bugs.webkit.org/show_bug.cgi?id=179803
828
829         Reviewed by Chris Dumez.
830
831         Covered by updated tests.
832
833         * workers/service/context/ServiceWorkerFetch.cpp:
834         (WebCore::ServiceWorkerFetch::dispatchFetchEvent):
835
836 2017-11-17  Joanmarie Diggs  <jdiggs@igalia.com>
837
838         AX: [GTK] Regression: accessibility/gtk/aria-keyshortcuts.html fails after r224953
839         https://bugs.webkit.org/show_bug.cgi?id=179824
840
841         Reviewed by Chris Fleizach.
842
843         The failure was due to AXPropertyName::KeyShortcuts not being included in
844         the group of properties whose value is a string. As a result, the new method
845         to get string values, AccessibleNode::effectiveStringValueForElement(), was
846         returning an empty String. This was not caught by the shared set of tests
847         because at the present time, only WebKitGtk supports aria-keyshortcuts.
848
849         No new tests needed. The regression was caught by an existing test.
850
851         * accessibility/AccessibleNode.cpp:
852         (WebCore::isPropertyValueString):
853
854 2017-11-17  Ryan Haddad  <ryanhaddad@apple.com>
855
856         Unreviewed, rolling out r224952.
857
858         This change introduced LayoutTest failures on WK1.
859
860         Reverted changeset:
861
862         "Use RunLoop and Mode from NetworkingContext if they are
863         given"
864         https://bugs.webkit.org/show_bug.cgi?id=179800
865         https://trac.webkit.org/changeset/224952
866
867 2017-11-16  Antoine Quint  <graouts@apple.com>
868
869         [Web Animations] Force a stacking context during animations that animate properties that will force a stacking context
870         https://bugs.webkit.org/show_bug.cgi?id=179811
871
872         Reviewed by Dean Jackson.
873
874         The Web Animations specification mandates in section 4.7 (w3c.github.io/web-animations/#side-effects-section) that
875         "for every property targeted by at least one animation effect that is current or in effect, the user agent must act
876         as if the will-change property ([css-will-change-1]) on the target element includes the property."
877
878         After parsing new keyframes, we check if any of the CSS properties that get animated would end up forcing a stacking
879         context, and if so, enforce a stacking context during the entire active lifetime of the animation.
880
881         Test: webanimations/animation-opacity-animation-crash.html
882
883         * animation/KeyframeEffect.cpp:
884         (WebCore::KeyframeEffect::processKeyframes):
885         (WebCore::KeyframeEffect::computeStackingContextImpact):
886         (WebCore::KeyframeEffect::applyAtLocalTime):
887         * animation/KeyframeEffect.h:
888
889 2017-11-17  Ali Juma  <ajuma@chromium.org>
890
891         Update feature status for Visual Viewport API to "In Development"
892         https://bugs.webkit.org/show_bug.cgi?id=179818
893
894         Reviewed by Frédéric Wang.
895
896         Work on this feature has started, tracked by bug 170982.
897
898         No new tests since there's no change in behavior.
899
900         * features.json:
901
902 2017-11-16  Yousuke Kimoto  <yousuke.kimoto@sony.com>
903
904         [WinCairo] Add network (curl) files for wincairo webkit
905         https://bugs.webkit.org/show_bug.cgi?id=179474
906
907         Reviewed by Alex Christensen.
908
909         No new behvaior, no new tests.
910
911         * PlatformWinCairo.cmake:
912         * platform/Curl.cmake:
913         * platform/network/curl/CookieStorageCurl.cpp: Added.
914         (WebCore::startObservingCookieChanges):
915         (WebCore::stopObservingCookieChanges):
916         * platform/network/curl/NetworkStorageSessionCurl.cpp: Added.
917         (WebCore::NetworkStorageSession::~NetworkStorageSession):
918         (WebCore::NetworkStorageSession::context const):
919         (WebCore::defaultSession):
920         (WebCore::NetworkStorageSession::ensureSession):
921         (WebCore::NetworkStorageSession::switchToNewTestingSession):
922         (WebCore::NetworkStorageSession::setCookies):
923         (WebCore::NetworkStorageSession::setCookie):
924         (WebCore::NetworkStorageSession::deleteCookie):
925         (WebCore::NetworkStorageSession::getAllCookies):
926         (WebCore::NetworkStorageSession::getCookies):
927         (WebCore::NetworkStorageSession::flushCookieStore):
928
929 2017-11-16  Alex Christensen  <achristensen@webkit.org>
930
931         Fix occasional crash when adding and removing videos
932         https://bugs.webkit.org/show_bug.cgi?id=179792
933
934         Reviewed by Geoffrey Garen.
935
936         In taskCompleted we null out session, and in resume we call _restart on the main thread.
937         If _restart is called after taskCompleted, we want to do nothing.
938         Right now we are calling a method on self.session.loader which is a PlatformMediaResourceLoader&
939         but in ObjC if session is null it will call PlatformMediaResourceLoader::requestResource with a
940         null this pointer, which crashes.  Let's not crash.
941
942         * platform/network/cocoa/WebCoreNSURLSession.mm:
943         (-[WebCoreNSURLSessionDataTask _restart]):
944         Early return if we don't have a session.
945
946 2017-11-16  Don Olmstead  <don.olmstead@sony.com>
947
948         [WinCairo] Update WinCairoRequirements
949         https://bugs.webkit.org/show_bug.cgi?id=179790
950
951         Reviewed by Alex Christensen.
952
953         No new tests. No change in behavior.
954
955         * PlatformWin.cmake:
956
957 2017-11-16  Antoine Quint  <graouts@apple.com>
958
959         [Web Animations] Allow KeyframeEffect to support CSS property animation blending
960         https://bugs.webkit.org/show_bug.cgi?id=179810
961
962         Reviewed by Tim Horton.
963
964         We used to pass nullptr instead of a valid AnimationBase when calling CSSPropertyAnimation::blendProperties()
965         in KeyframeEffect::applyAtLocalTime() when blending CSS styles during a keyframe animation. Without this
966         AnimationBase, some blending functions would crash as certain supporting calls couldn't be made.
967
968         We now add a new CSSPropertyBlendingClient virtual interface that both KeyframeEffect and AnimationBase
969         implement and that CSSPropertyAnimation::blendProperties() take as a parameter in order to support
970         blending code.
971
972         * WebCore.xcodeproj/project.pbxproj:
973         * animation/CSSPropertyBlendingClient.h: Added.
974         * animation/KeyframeEffect.cpp:
975         (WebCore::KeyframeEffect::applyAtLocalTime):
976         (WebCore::KeyframeEffect::renderer const):
977         (WebCore::KeyframeEffect::currentStyle const):
978         * animation/KeyframeEffect.h:
979         * page/animation/AnimationBase.h:
980         (WebCore::AnimationBase::isAccelerated const):
981         (WebCore::AnimationBase::transformFunctionListsMatch const):
982         (WebCore::AnimationBase::filterFunctionListsMatch const):
983         (WebCore::AnimationBase::backdropFilterFunctionListsMatch const):
984         * page/animation/CSSPropertyAnimation.cpp:
985         (WebCore::blendFunc):
986         (WebCore::blendFilterOperations):
987         (WebCore::blendFilter):
988         (WebCore::crossfadeBlend):
989         (WebCore::PropertyWrapperAcceleratedBackdropFilter::blend const):
990         (WebCore::PropertyWrapperShadow::blendSimpleOrMatchedShadowLists const):
991         (WebCore::PropertyWrapperShadow::blendMismatchedShadowLists const):
992         (WebCore::CSSPropertyAnimation::blendProperties):
993         * page/animation/CSSPropertyAnimation.h:
994
995 2017-11-16  Youenn Fablet  <youenn@apple.com>
996
997         Service Worker should get the body of intercepted requests
998         https://bugs.webkit.org/show_bug.cgi?id=179776
999
1000         Reviewed by Alex Christensen.
1001
1002         Test: http/tests/workers/service/service-worker-request-with-body.https.html
1003
1004         Make use of FetchBodyConsumer to store raw data for FetchRequest.
1005         This is used when setting FetchRequest body from a FormData.
1006         If FormData is only bytes (no blob, no file), FetchBodyConsumer will store that data.
1007         This allows Service Worker to get access to simple request bodies.
1008
1009         * Modules/fetch/FetchBody.cpp:
1010         (WebCore::FetchBody::fromFormData):
1011         (WebCore::FetchBody::consume):
1012         (WebCore::FetchBody::bodyAsFormData const): Making sure body is set appropriately when used to make fetch load.
1013         * Modules/fetch/FetchBody.h: Making some methods private.
1014         * Modules/fetch/FetchBodyConsumer.h: Adding accessors.
1015         (WebCore::FetchBodyConsumer::hasData const):
1016         (WebCore::FetchBodyConsumer::data const):
1017         * Modules/fetch/FetchRequest.h:
1018         (WebCore::FetchRequest::FetchRequest):
1019         * platform/network/FormData.cpp:
1020         (WebCore::FormData::asSharedBuffer const):
1021         * platform/network/FormData.h:
1022         * workers/service/context/ServiceWorkerFetch.cpp:
1023         (WebCore::ServiceWorkerFetch::dispatchFetchEvent): Setting FetchRequest body based on given FormData.
1024
1025 2017-11-16  Chris Dumez  <cdumez@apple.com>
1026
1027         Make sure service workers get terminated between tests
1028         https://bugs.webkit.org/show_bug.cgi?id=179774
1029
1030         Reviewed by Alex Christensen.
1031
1032         Make sure service workers get terminated between tests. Previously, we
1033         would merely clear all registrations and job queues but it would not
1034         cause the registrations' service workers to get terminated.
1035
1036         * workers/service/context/ServiceWorkerThread.cpp:
1037         (WebCore::ServiceWorkerThread::updateExtendedEventsSet):
1038         * workers/service/server/SWServer.cpp:
1039         (WebCore::SWServer::clearAll):
1040         * workers/service/server/SWServerJobQueue.cpp:
1041         (WebCore::SWServerJobQueue::scriptFetchFinished):
1042         (WebCore::SWServerJobQueue::scriptContextFailedToStart):
1043         (WebCore::SWServerJobQueue::didFinishInstall):
1044         (WebCore::SWServerJobQueue::tryClearRegistration):
1045         (WebCore::SWServerJobQueue::clearRegistration):
1046         * workers/service/server/SWServerJobQueue.h:
1047
1048 2017-11-16  Youenn Fablet  <youenn@apple.com>
1049
1050         FetchLoader should unregister its blob URL
1051         https://bugs.webkit.org/show_bug.cgi?id=179768
1052
1053         Reviewed by Alex Christensen.
1054
1055         No observable change.
1056
1057         Keep the blob URL used for reading and unregister it in destructor.
1058
1059         * Modules/fetch/FetchLoader.cpp:
1060         (WebCore::FetchLoader::~FetchLoader):
1061         (WebCore::FetchLoader::start):
1062         * Modules/fetch/FetchLoader.h:
1063
1064 2017-11-16  Nan Wang  <n_wang@apple.com>
1065
1066         AX: AOM: Implement string type properties
1067         https://bugs.webkit.org/show_bug.cgi?id=179495
1068
1069         Reviewed by Chris Fleizach.
1070
1071         Implemented the rest of the string type properties for Accessibility
1072         Object Model.
1073
1074         Test: accessibility/mac/AOM-string-properties.html
1075
1076         * accessibility/AXObjectCache.cpp:
1077         (WebCore::AXObjectCache::handleLiveRegionCreated):
1078         * accessibility/AccessibilityNodeObject.cpp:
1079         (WebCore::AccessibilityNodeObject::childrenChanged):
1080         (WebCore::AccessibilityNodeObject::isPressed const):
1081         (WebCore::AccessibilityNodeObject::isChecked const):
1082         (WebCore::AccessibilityNodeObject::valueDescription const):
1083         * accessibility/AccessibilityObject.cpp:
1084         (WebCore::AccessibilityObject::isAccessibilityObjectSearchMatchAtIndex):
1085         (WebCore::AccessibilityObject::supportsAutoComplete const):
1086         (WebCore::AccessibilityObject::autoCompleteValue const):
1087         (WebCore::AccessibilityObject::invalidStatus const):
1088         (WebCore::AccessibilityObject::supportsCurrent const):
1089         (WebCore::AccessibilityObject::currentState const):
1090         (WebCore::AccessibilityObject::currentValue const):
1091         (WebCore::AccessibilityObject::roleDescription const):
1092         (WebCore::AccessibilityObject::keyShortcutsValue const):
1093         (WebCore::AccessibilityObject::placeholderValue const):
1094         (WebCore::AccessibilityObject::isInsideLiveRegion const):
1095         (WebCore::AccessibilityObject::liveRegionAncestor const):
1096         (WebCore::AccessibilityObject::supportsARIAAttributes const):
1097         (WebCore::AccessibilityObject::supportsLiveRegion const):
1098         (WebCore::AccessibilityObject::sortDirection const):
1099         (WebCore::AccessibilityObject::supportsHasPopup const):
1100         (WebCore::AccessibilityObject::hasPopupValue const):
1101         (WebCore::AccessibilityObject::supportsPressed const):
1102         (WebCore::AccessibilityObject::checkboxOrRadioValue const):
1103         (WebCore::AccessibilityObject::pressedIsPresent const):
1104         (WebCore::AccessibilityObject::buttonRoleType const):
1105         (WebCore::AccessibilityObject::supportsARIAAutoComplete const): Deleted.
1106         (WebCore::AccessibilityObject::ariaAutoCompleteValue const): Deleted.
1107         (WebCore::AccessibilityObject::supportsARIACurrent const): Deleted.
1108         (WebCore::AccessibilityObject::ariaCurrentState const): Deleted.
1109         (WebCore::AccessibilityObject::ariaCurrentValue const): Deleted.
1110         (WebCore::AccessibilityObject::ariaKeyShortcutsValue const): Deleted.
1111         (WebCore::AccessibilityObject::isInsideARIALiveRegion const): Deleted.
1112         (WebCore::AccessibilityObject::ariaLiveRegionAncestor const): Deleted.
1113         (WebCore::AccessibilityObject::supportsARIALiveRegion const): Deleted.
1114         (WebCore::AccessibilityObject::supportsARIAHasPopup const): Deleted.
1115         (WebCore::AccessibilityObject::ariaPopupValue const): Deleted.
1116         (WebCore::AccessibilityObject::supportsARIAPressed const): Deleted.
1117         (WebCore::AccessibilityObject::ariaPressedIsPresent const): Deleted.
1118         * accessibility/AccessibilityObject.h:
1119         (WebCore::AccessibilityObject::hasPopup const):
1120         (WebCore::AccessibilityObject::liveRegionStatus const):
1121         (WebCore::AccessibilityObject::liveRegionRelevant const):
1122         (WebCore::AccessibilityObject::liveRegionAtomic const):
1123         (WebCore::AccessibilityObject::ariaHasPopup const): Deleted.
1124         (WebCore::AccessibilityObject::ariaLiveRegionStatus const): Deleted.
1125         (WebCore::AccessibilityObject::ariaLiveRegionRelevant const): Deleted.
1126         (WebCore::AccessibilityObject::ariaLiveRegionAtomic const): Deleted.
1127         * accessibility/AccessibilityRenderObject.cpp:
1128         (WebCore::AccessibilityRenderObject::hasPopup const):
1129         (WebCore::AccessibilityRenderObject::determineAccessibilityRole):
1130         (WebCore::AccessibilityRenderObject::orientation const):
1131         (WebCore::AccessibilityRenderObject::textChanged):
1132         (WebCore::AccessibilityRenderObject::liveRegionStatus const):
1133         (WebCore::AccessibilityRenderObject::liveRegionRelevant const):
1134         (WebCore::AccessibilityRenderObject::liveRegionAtomic const):
1135         (WebCore::AccessibilityRenderObject::ariaHasPopup const): Deleted.
1136         (WebCore::AccessibilityRenderObject::ariaLiveRegionStatus const): Deleted.
1137         (WebCore::AccessibilityRenderObject::ariaLiveRegionRelevant const): Deleted.
1138         (WebCore::AccessibilityRenderObject::ariaLiveRegionAtomic const): Deleted.
1139         * accessibility/AccessibilityRenderObject.h:
1140         * accessibility/AccessibleNode.cpp:
1141         (WebCore::ariaAttributeMap):
1142         (WebCore::isPropertyValueString):
1143         (WebCore::AccessibleNode::notifyAttributeChanged):
1144         (WebCore::AccessibleNode::autocomplete const):
1145         (WebCore::AccessibleNode::setAutocomplete):
1146         (WebCore::AccessibleNode::checked const):
1147         (WebCore::AccessibleNode::setChecked):
1148         (WebCore::AccessibleNode::current const):
1149         (WebCore::AccessibleNode::setCurrent):
1150         (WebCore::AccessibleNode::hasPopUp const):
1151         (WebCore::AccessibleNode::setHasPopUp):
1152         (WebCore::AccessibleNode::invalid const):
1153         (WebCore::AccessibleNode::setInvalid):
1154         (WebCore::AccessibleNode::keyShortcuts const):
1155         (WebCore::AccessibleNode::setKeyShortcuts):
1156         (WebCore::AccessibleNode::live const):
1157         (WebCore::AccessibleNode::setLive):
1158         (WebCore::AccessibleNode::setLabel):
1159         (WebCore::AccessibleNode::orientation const):
1160         (WebCore::AccessibleNode::setOrientation):
1161         (WebCore::AccessibleNode::placeholder const):
1162         (WebCore::AccessibleNode::setPlaceholder):
1163         (WebCore::AccessibleNode::pressed const):
1164         (WebCore::AccessibleNode::setPressed):
1165         (WebCore::AccessibleNode::relevant const):
1166         (WebCore::AccessibleNode::setRelevant):
1167         (WebCore::AccessibleNode::role const):
1168         (WebCore::AccessibleNode::setRole):
1169         (WebCore::AccessibleNode::roleDescription const):
1170         (WebCore::AccessibleNode::setRoleDescription):
1171         (WebCore::AccessibleNode::sort const):
1172         (WebCore::AccessibleNode::setSort):
1173         (WebCore::AccessibleNode::valueText const):
1174         (WebCore::AccessibleNode::setValueText):
1175         * accessibility/AccessibleNode.h:
1176         (WebCore::AXPropertyHashTraits::constructDeletedValue):
1177         (WebCore::AXPropertyHashTraits::isDeletedValue):
1178         * accessibility/AccessibleNode.idl:
1179         * accessibility/atk/AXObjectCacheAtk.cpp:
1180         (WebCore::AXObjectCache::postPlatformNotification):
1181         * accessibility/atk/WebKitAccessibleWrapperAtk.cpp:
1182         (webkitAccessibleGetAttributes):
1183         (atkRole):
1184         (setAtkStateSetFromCoreObject):
1185         * accessibility/ios/WebAccessibilityObjectWrapperIOS.mm:
1186         (-[WebAccessibilityObjectWrapper accessibilityHasPopup]):
1187         (-[WebAccessibilityObjectWrapper accessibilityARIALiveRegionStatus]):
1188         (-[WebAccessibilityObjectWrapper accessibilityARIARelevantStatus]):
1189         (-[WebAccessibilityObjectWrapper accessibilityARIALiveRegionIsAtomic]):
1190         (-[WebAccessibilityObjectWrapper accessibilitySupportsARIAPressed]):
1191         (-[WebAccessibilityObjectWrapper accessibilityARIACurrentStatus]):
1192         * accessibility/mac/WebAccessibilityObjectWrapperMac.mm:
1193         (-[WebAccessibilityObjectWrapper additionalAccessibilityAttributeNames]):
1194         (-[WebAccessibilityObjectWrapper accessibilityAttributeNames]):
1195         (-[WebAccessibilityObjectWrapper accessibilityAttributeValue:]):
1196         * inspector/agents/InspectorDOMAgent.cpp:
1197         (WebCore::InspectorDOMAgent::buildObjectForAccessibilityProperties):
1198
1199 2017-11-16  Alex Christensen  <achristensen@webkit.org>
1200
1201         Use RunLoop and Mode from NetworkingContext if they are given
1202         https://bugs.webkit.org/show_bug.cgi?id=179800
1203         <rdar://problem/35519421>
1204
1205         Reviewed by Brady Eidson.
1206
1207         We used to call [NSURLConnection scheduleInRunLoop:forMode:] before r224267.
1208         That change broke WebKitLegacy clients using custom run loop modes, which I partially fixed in r224687 and r224896,
1209         but that hangs if there are any non-scheduled calls to callOnMainThread and it ignores the CFRunLoop part of the SchedulePair.
1210         This is a more elegant solution that fixes all known bugs with custom run loop modes and makes the
1211         behavior as close to the pre-r224267 behavior as possible by using all parameters in a good way.
1212
1213         I verified the bug in the radar is fixed, the API test WebKitLegacy.ScheduleInRunLoop still passes,
1214         and UIWebView still works on iOS.
1215
1216         * platform/network/mac/WebCoreResourceHandleAsOperationQueueDelegate.mm:
1217         (callOnMainThreadOrSchedule):
1218         (-[WebCoreResourceHandleAsOperationQueueDelegate connection:willSendRequest:redirectResponse:]):
1219         (-[WebCoreResourceHandleAsOperationQueueDelegate connection:didReceiveAuthenticationChallenge:]):
1220         (-[WebCoreResourceHandleAsOperationQueueDelegate connection:canAuthenticateAgainstProtectionSpace:]):
1221         (-[WebCoreResourceHandleAsOperationQueueDelegate connection:didReceiveResponse:]):
1222         (-[WebCoreResourceHandleAsOperationQueueDelegate connection:didReceiveData:lengthReceived:]):
1223         (-[WebCoreResourceHandleAsOperationQueueDelegate connection:didSendBodyData:totalBytesWritten:totalBytesExpectedToWrite:]):
1224         (-[WebCoreResourceHandleAsOperationQueueDelegate connectionDidFinishLoading:]):
1225         (-[WebCoreResourceHandleAsOperationQueueDelegate connection:didFailWithError:]):
1226         (-[WebCoreResourceHandleAsOperationQueueDelegate connection:willCacheResponse:]):
1227
1228 2017-11-16  Daniel Bates  <dabates@apple.com>
1229
1230         Add feature define for alternative presentation button element
1231         https://bugs.webkit.org/show_bug.cgi?id=179692
1232         Part of <rdar://problem/34917108>
1233
1234         Reviewed by Andy Estes.
1235
1236         Only enabled on Cocoa platforms by default.
1237
1238         * Configurations/FeatureDefines.xcconfig:
1239
1240 2017-11-16  Chris Dumez  <cdumez@apple.com>
1241
1242         [Service Worker] Implement "Try Clear Registration" algorithm
1243         https://bugs.webkit.org/show_bug.cgi?id=179791
1244
1245         Reviewed by Youenn Fablet.
1246
1247         Implement "Try Clear Registration" algorithm:
1248         - https://w3c.github.io/ServiceWorker/#try-clear-registration-algorithm
1249
1250         In particular, a SWServerRegistration now knows if it is "in use" by a given
1251         service worker client (i.e. The registration's active service worker is
1252         controlling the service worker client). See:
1253         - https://w3c.github.io/ServiceWorker/#selection (last paragraph)
1254
1255         No new tests, rebaselined existing tests.
1256
1257         * dom/ScriptExecutionContext.cpp:
1258         (WebCore::ScriptExecutionContext::setActiveServiceWorker):
1259         * workers/service/server/SWClientConnection.h:
1260         * workers/service/server/SWServer.cpp:
1261         (WebCore::SWServer::Connection::serviceWorkerStartedControllingClient):
1262         (WebCore::SWServer::Connection::serviceWorkerStoppedControllingClient):
1263         (WebCore::SWServer::serviceWorkerStartedControllingClient):
1264         (WebCore::SWServer::serviceWorkerStoppedControllingClient):
1265         * workers/service/server/SWServer.h:
1266         * workers/service/server/SWServerJobQueue.cpp:
1267         (WebCore::SWServerJobQueue::tryClearRegistration):
1268         * workers/service/server/SWServerRegistration.h:
1269         (WebCore::SWServerRegistration::hasClientsUsingRegistration const):
1270         (WebCore::SWServerRegistration::addClientUsingRegistration):
1271         (WebCore::SWServerRegistration::removeClientUsingRegistration):
1272
1273 2017-11-16  Michael Catanzaro  <mcatanzaro@igalia.com>
1274
1275         REGRESSION(r224179): layer flush now requires sync IPC to compute undo/redo availability in EditorState
1276         https://bugs.webkit.org/show_bug.cgi?id=179797
1277
1278         Reviewed by Simon Fraser.
1279
1280         Editor::canUndo and Editor::CanRedo no longer need to be exported.
1281
1282         * editing/Editor.h:
1283
1284 2017-11-16  Chris Dumez  <cdumez@apple.com>
1285
1286         Dispatching an event on a ServiceWorkerRegistration may fail or crash due to GC
1287         https://bugs.webkit.org/show_bug.cgi?id=179751
1288
1289         Reviewed by Geoffrey Garen.
1290
1291         Dispatching an event on a ServiceWorkerRegistration may fail or crash due to GC. We
1292         need to make sure that a ServiceWorkerRegistration's wrapper stays alive as long as
1293         we may dispatch events on it.
1294
1295         Keep the wrapper alive by making ServiceWorker an ActiveDOMObject and making sure the
1296         implementation object keeps a PendingActivity alive while it may dispatch JS events.
1297         The only event dispatched on ServiceWorkerRegistration objects is the "updatefound"
1298         one. We may dispatch updatefound events on a ServiceWorkerRegistration until the
1299         registration gets cleared on server side, in which case the ServiceWorkerRegistration
1300         object ends up with no service worker. We therefore take a PendingActivity when the
1301         ServiceWorkerRegistration is constructed and we release it once the registration has
1302         no more associated ServiceWorker or the ActiveDOMObject is stopped (to avoid leaks on
1303         navigation).
1304
1305         Test: http/tests/workers/service/service-worker-registration-gc-event.html
1306
1307         * workers/service/ServiceWorkerContainer.cpp:
1308         (WebCore::ServiceWorkerContainer::scheduleTaskToFireUpdateFoundEvent):
1309         * workers/service/ServiceWorkerRegistration.cpp:
1310         (WebCore::ServiceWorkerRegistration::getOrCreate):
1311         (WebCore::ServiceWorkerRegistration::updateStateFromServer):
1312         (WebCore::ServiceWorkerRegistration::scheduleTaskToFireUpdateFoundEvent):
1313         (WebCore::ServiceWorkerRegistration::stop):
1314         (WebCore::ServiceWorkerRegistration::updatePendingActivityForEventDispatch):
1315         * workers/service/ServiceWorkerRegistration.h:
1316         * workers/service/ServiceWorkerRegistration.idl:
1317
1318 2017-11-16  Chris Dumez  <cdumez@apple.com>
1319
1320         Crash in WebCore::SWServerJobQueue::scriptFetchFinished(WebCore::SWServer::Connection&, WebCore::ServiceWorkerFetchResult const&) + 77
1321         https://bugs.webkit.org/show_bug.cgi?id=179394
1322         <rdar://problem/35478190>
1323
1324         Reviewed by Youenn Fablet.
1325
1326         In SWServerJobQueue::scriptFetchFinished(), make sure the job queue is still processing the
1327         job that triggered the fetch. If it is not, ignore the callback.
1328
1329         This could happen when calling SWServer::clear() while a script fetch was pending.
1330
1331         No new tests, already covered by existing tests that sometimes crash on the bots.
1332
1333         * workers/service/server/SWServerJobQueue.cpp:
1334         (WebCore::SWServerJobQueue::isCurrentlyProcessingJob const):
1335         (WebCore::SWServerJobQueue::scriptFetchFinished):
1336         * workers/service/server/SWServerJobQueue.h:
1337
1338 2017-11-16  Brady Eidson  <beidson@apple.com>
1339
1340         Crash in worker tests handling the m_stoppedCallback.
1341         <rdar://problem/35590875> and https://bugs.webkit.org/show_bug.cgi?id=179798
1342
1343         Reviewed by Chris Dumez.
1344
1345         No new tests (Covered by existing tests).
1346
1347         Protect manipulation of m_stoppedCallback with m_threadCreationAndWorkerGlobalScopeMutex.
1348
1349         * workers/WorkerThread.cpp:
1350         (WebCore::WorkerThread::workerThread):
1351         (WebCore::WorkerThread::stop):
1352
1353 2017-11-16  Antoine Quint  <graouts@apple.com>
1354
1355         [Web Animations] Express time in milliseconds through the API
1356         https://bugs.webkit.org/show_bug.cgi?id=179799
1357
1358         Reviewed by Simon Fraser.
1359
1360         While internally we use seconds to specify times and durations, the Web Animations API
1361         uses milliseconds, so we have to convert times and durations from and to milliseconds.
1362
1363         * animation/AnimationEffectTiming.h:
1364         * animation/AnimationTimeline.cpp:
1365         (WebCore::AnimationTimeline::bindingsCurrentTime):
1366         * animation/WebAnimation.cpp:
1367         (WebCore::WebAnimation::bindingsStartTime const):
1368         (WebCore::WebAnimation::setBindingsStartTime):
1369         (WebCore::WebAnimation::bindingsCurrentTime const):
1370         (WebCore::WebAnimation::setBindingsCurrentTime):
1371         * testing/Internals.cpp:
1372         (WebCore::Internals::setTimelineCurrentTime):
1373
1374 2017-11-16  Michael Catanzaro  <mcatanzaro@igalia.com>
1375
1376         REGRESSION(r224887): GCC 5 build broken
1377         https://bugs.webkit.org/show_bug.cgi?id=179750
1378
1379         Reviewed by Jer Noble.
1380
1381         Add a legacy FourCC constructor that will be used only when building with GCC 5. This is
1382         bad, but it seems acceptable for use with a fallback codepath.
1383
1384         Unfortunately, this requires adjusting some initializations to avoid ambiguity with the
1385         uint32_t constructor.
1386
1387         * platform/graphics/FourCC.h:
1388         (WebCore::FourCC::FourCC):
1389         * platform/graphics/iso/ISOBox.cpp:
1390         (WebCore::ISOBox::peekBox):
1391         * platform/graphics/iso/ISOBox.h:
1392         * platform/graphics/iso/ISOOriginalFormatBox.h:
1393         * platform/graphics/iso/ISOSchemeTypeBox.h:
1394
1395 2017-11-16  Andy Estes  <aestes@apple.com>
1396
1397         [Payment Request] Update feature status to "Supported In Preview"
1398         https://bugs.webkit.org/show_bug.cgi?id=179793
1399
1400         Reviewed by Tim Horton.
1401
1402         * features.json:
1403
1404 2017-11-16  Antoine Quint  <graouts@apple.com>
1405
1406         Clean up KeyframeEffect
1407         https://bugs.webkit.org/show_bug.cgi?id=179777
1408
1409         Reviewed by Daniel Bates.
1410
1411         A few review comments came in after https://bugs.webkit.org/show_bug.cgi?id=179707 landed,
1412         addressing them with this follow-up patch.
1413
1414         * animation/KeyframeEffect.cpp:
1415         (WebCore::KeyframeEffect::create): Use "keyframeEffect" instead of "result" for clarity.
1416         (WebCore::KeyframeEffect::processKeyframes): Use consistent index and length types while iterating
1417         over properties in PropertyNameArray and explicitly size the properties array since we already
1418         know its final size.
1419         * dom/Element.cpp:
1420         (WebCore::Element::getAnimations):
1421
1422 2017-11-16  Zalan Bujtas  <zalan@apple.com>
1423
1424         Always invoke RenderObject::insertedIntoTree/willBeRemovedFromTree
1425         https://bugs.webkit.org/show_bug.cgi?id=178007
1426
1427         Reviewed by Antti Koivisto.
1428
1429         Based on Antti Koivisto's patch:
1430         These call are currently skipped in some cases making them bug prone and difficult to reason about.
1431         This is done as an optimization that doesn't appear to be valuable anymore.
1432
1433         Covered by existing tests.
1434
1435         * rendering/RenderBlock.cpp:
1436         (WebCore::RenderBlock::makeChildrenNonInline):
1437         (WebCore::RenderBlock::dropAnonymousBoxChild):
1438         (WebCore::RenderBlock::takeChild):
1439         * rendering/RenderBlock.h:
1440         (WebCore::RenderBlock::moveAllChildrenIncludingFloatsTo):
1441         * rendering/RenderBlockFlow.cpp:
1442         (WebCore::RenderBlockFlow::styleDidChange):
1443         (WebCore::RenderBlockFlow::moveAllChildrenIncludingFloatsTo):
1444         * rendering/RenderBlockFlow.h:
1445         * rendering/RenderBox.cpp:
1446         (WebCore::RenderBox::splitAnonymousBoxesAroundChild):
1447         * rendering/RenderBoxModelObject.cpp:
1448         (WebCore::RenderBoxModelObject::moveChildTo):
1449         (WebCore::RenderBoxModelObject::moveChildrenTo):
1450         * rendering/RenderBoxModelObject.h:
1451         (WebCore::RenderBoxModelObject::moveChildTo):
1452         (WebCore::RenderBoxModelObject::moveAllChildrenTo):
1453         (WebCore::RenderBoxModelObject::moveChildrenTo):
1454         * rendering/RenderElement.cpp:
1455         (WebCore::RenderElement::addChild):
1456         (WebCore::RenderElement::takeChild):
1457         (WebCore::RenderElement::insertChildInternal):
1458         (WebCore::RenderElement::takeChildInternal):
1459         (WebCore::RenderElement::handleDynamicFloatPositionChange):
1460         * rendering/RenderElement.h:
1461         * rendering/RenderInline.cpp:
1462         (WebCore::RenderInline::splitInlines):
1463         (WebCore::RenderInline::splitFlow):
1464         (WebCore::RenderInline::childBecameNonInline):
1465         * rendering/RenderMultiColumnFlow.cpp:
1466         (WebCore::RenderMultiColumnFlow::fragmentedFlowDescendantInserted):
1467         * rendering/RenderRubyBase.cpp:
1468         (WebCore::RenderRubyBase::moveInlineChildren):
1469         (WebCore::RenderRubyBase::moveBlockChildren):
1470         * rendering/RenderRubyRun.cpp:
1471         (WebCore::RenderRubyRun::takeChild):
1472         * rendering/RenderTableRow.cpp:
1473         (WebCore::RenderTableRow::collapseAndDestroyAnonymousSiblingRows):
1474         * style/RenderTreeUpdaterMultiColumn.cpp:
1475         (WebCore::RenderTreeUpdater::MultiColumn::createFragmentedFlow):
1476         (WebCore::RenderTreeUpdater::MultiColumn::destroyFragmentedFlow):
1477
1478 2017-11-14  Dean Jackson  <dino@apple.com>
1479
1480         Add a base class for HTMLCanvasElement and OffscreenCanvas
1481         https://bugs.webkit.org/show_bug.cgi?id=179701
1482         <rdar://problem/35545195>
1483
1484         Reviewed by Sam Weinig.
1485
1486         In order for OffscreenCanvas to be able to create a WebGLRenderingContext,
1487         there needs to be a shared base class with HTMLCanvasElement. Add such a
1488         class called CanvasBase.
1489
1490         There is a lot of potential for functionality to move into the base class, but
1491         unfortunately HTMLCanvasElement is a bit messy. It implements a lot of the 2d
1492         rendering context functionality, and also many const functions that actually
1493         cause changes. Thus, things like the canvas size have to remain in the subclasses
1494         for now.
1495
1496         The existence of the new base class meant the canvas() accessor in CanvasRenderingContext
1497         had to move out into the subclasses, and do the correct casting. Eventually, at least
1498         for WebGLRenderingContext, this will have a change in behaviour, but for now we only
1499         ever use HTMLCanvasElements, so most of these changes are just for the sake of
1500         compilation.
1501
1502         No behaviour change - covered by existing tests.
1503
1504         * Sources.txt:
1505         * WebCore.xcodeproj/project.pbxproj:
1506         * html/CanvasBase.cpp: Copied from Source/WebCore/html/canvas/GPUBasedCanvasRenderingContext.h.
1507         (WebCore::CanvasBase::CanvasBase): New base class.
1508         (WebCore::CanvasBase::asHTMLCanvasElement): Casts to an HTMLCanvasElement*, which many of the
1509         rendering context code uses.
1510         * html/CanvasBase.h: Copied from Source/WebCore/html/canvas/GPUBasedCanvasRenderingContext.h.
1511         (WebCore::CanvasBase::isHTMLCanvasElement const):
1512         (WebCore::CanvasBase::isOffscreenCanvas const):
1513         (WebCore::CanvasBase::setOriginClean):
1514         (WebCore::CanvasBase::setOriginTainted):
1515         (WebCore::CanvasBase::originClean const):
1516         (WebCore::CanvasBase::securityOrigin const):
1517         (WebCore::CanvasBase::scriptExecutionContext const):
1518
1519         * html/HTMLCanvasElement.cpp: Use the base class methods where possible.
1520         (WebCore::HTMLCanvasElement::HTMLCanvasElement):
1521         (WebCore::HTMLCanvasElement::toDataURL):
1522         (WebCore::HTMLCanvasElement::toBlob):
1523         (WebCore::HTMLCanvasElement::createImageBuffer const): Be explict as to
1524         which of the derived classes scriptExecutionContext() method we are calling.
1525
1526         * html/HTMLCanvasElement.h: Use the base class, mark a few things as virtual,
1527         and remove the parts that are now in CanvasBase.
1528
1529         * html/OffscreenCanvas.cpp: Use the base class.
1530         (WebCore::OffscreenCanvas::OffscreenCanvas):
1531         (WebCore::OffscreenCanvas::size const):
1532         (WebCore::OffscreenCanvas::setSize):
1533         * html/OffscreenCanvas.h:
1534
1535         * html/canvas/CanvasRenderingContext.cpp:
1536         (WebCore::CanvasRenderingContext::CanvasRenderingContext):
1537         (WebCore::CanvasRenderingContext::ref): Call the correct ref/deref functions, depending
1538         on the base class type.
1539         (WebCore::CanvasRenderingContext::deref):
1540         (WebCore::CanvasRenderingContext::wouldTaintOrigin): We no longer have a canvas() method.
1541         (WebCore::CanvasRenderingContext::checkOrigin):
1542
1543         * html/canvas/CanvasRenderingContext.h:
1544         (WebCore::CanvasRenderingContext::canvasBase const): Add this accessor to the base canvas object
1545         to replace the canvas() call.
1546         (WebCore::CanvasRenderingContext::checkOrigin):
1547         (WebCore::CanvasRenderingContext::ref): Deleted.
1548         (WebCore::CanvasRenderingContext::deref): Deleted.
1549         (WebCore::CanvasRenderingContext::canvas const): Deleted.
1550
1551         * html/canvas/CanvasRenderingContext2D.cpp: Use the base class.
1552         (WebCore::CanvasRenderingContext2D::CanvasRenderingContext2D):
1553         * html/canvas/CanvasRenderingContext2D.h:
1554         * html/canvas/GPUBasedCanvasRenderingContext.h:
1555         (WebCore::GPUBasedCanvasRenderingContext::GPUBasedCanvasRenderingContext):
1556         * html/canvas/ImageBitmapRenderingContext.cpp:
1557         (WebCore::ImageBitmapRenderingContext::ImageBitmapRenderingContext):
1558         (WebCore::ImageBitmapRenderingContext::canvas const):
1559         (WebCore::ImageBitmapRenderingContext::setOutputBitmap):
1560         * html/canvas/ImageBitmapRenderingContext.h:
1561         * html/canvas/PlaceholderRenderingContext.cpp:
1562         (WebCore::PlaceholderRenderingContext::PlaceholderRenderingContext):
1563         * html/canvas/PlaceholderRenderingContext.h:
1564         * html/canvas/WebGL2RenderingContext.cpp:
1565         (WebCore::WebGL2RenderingContext::WebGL2RenderingContext):
1566         * html/canvas/WebGL2RenderingContext.h:
1567         * html/canvas/WebGLRenderingContext.cpp:
1568         (WebCore::WebGLRenderingContext::WebGLRenderingContext):
1569
1570         * html/canvas/WebGLRenderingContext.h:
1571         * html/canvas/WebGLRenderingContextBase.cpp:
1572         (WebCore::WebGLRenderingContextBase::create): Assume that we're still getting an HTMLCanvasElement,
1573         but protect some of the logic just in case we don't.
1574         (WebCore::WebGLRenderingContextBase::WebGLRenderingContextBase):
1575         (WebCore::WebGLRenderingContextBase::canvas):
1576         (WebCore::WebGLRenderingContextBase::checkForContextLossHandling):
1577         (WebCore::WebGLRenderingContextBase::registerWithWebGLStateTracker):
1578         (WebCore::WebGLRenderingContextBase::setupFlags):
1579         (WebCore::WebGLRenderingContextBase::addActivityStateChangeObserverIfNecessary):
1580         (WebCore::WebGLRenderingContextBase::removeActivityStateChangeObserver):
1581         (WebCore::WebGLRenderingContextBase::markContextChanged):
1582         (WebCore::WebGLRenderingContextBase::markContextChangedAndNotifyCanvasObserver):
1583         (WebCore::WebGLRenderingContextBase::paintRenderingResultsToCanvas):
1584         (WebCore::WebGLRenderingContextBase::reshape):
1585         (WebCore::WebGLRenderingContextBase::compileShader):
1586         (WebCore::WebGLRenderingContextBase::isContextLostOrPending):
1587         (WebCore::WebGLRenderingContextBase::readPixels):
1588         (WebCore::WebGLRenderingContextBase::loseContextImpl):
1589         (WebCore::WebGLRenderingContextBase::printToConsole):
1590         (WebCore::WebGLRenderingContextBase::dispatchContextLostEvent):
1591         (WebCore::WebGLRenderingContextBase::maybeRestoreContext):
1592         (WebCore::WebGLRenderingContextBase::dispatchContextChangedEvent):
1593         (WebCore::WebGLRenderingContextBase::clampedCanvasSize):
1594         * html/canvas/WebGLRenderingContextBase.h:
1595         * html/canvas/WebGLRenderingContextBase.idl:
1596         * html/canvas/WebGPURenderingContext.cpp:
1597         (WebCore::WebGPURenderingContext::create):
1598         (WebCore::WebGPURenderingContext::WebGPURenderingContext):
1599         (WebCore::WebGPURenderingContext::canvas const):
1600         (WebCore::WebGPURenderingContext::clampedCanvasSize const):
1601         * html/canvas/WebGPURenderingContext.h:
1602         * inspector/InspectorInstrumentation.h:
1603         (WebCore::InspectorInstrumentation::recordCanvasAction):
1604         (WebCore::InspectorInstrumentation::didEnableExtension):
1605         (WebCore::InspectorInstrumentation::didCreateProgram):
1606         (WebCore::InspectorInstrumentation::willDeleteProgram):
1607         (WebCore::InspectorInstrumentation::isShaderProgramDisabled):
1608         * inspector/agents/InspectorCanvasAgent.cpp:
1609         (WebCore::InspectorCanvasAgent::recordCanvasAction):
1610         (WebCore::InspectorCanvasAgent::didEnableExtension):
1611         (WebCore::InspectorCanvasAgent::didCreateProgram):
1612
1613 2017-11-16  Colin Bendell  <colin@bendell.ca>
1614
1615         Added mime type check to the picture source preloader to avoid downloading incompatible resources.
1616         https://bugs.webkit.org/show_bug.cgi?id=179231
1617
1618         Reviewed by Alex Christensen.
1619
1620         Test: http/tests/loading/preload-picture-type.html
1621
1622         * html/parser/HTMLPreloadScanner.cpp:
1623         (WebCore::TokenPreloadScanner::StartTagScanner::processAttributes): include type match state when selecting candidate imgs
1624         (WebCore::TokenPreloadScanner::StartTagScanner::processAttribute): added type attribute evaluation and matching
1625
1626 2017-11-16  Chris Dumez  <cdumez@apple.com>
1627
1628         Dispatching an event on a ServiceWorker may fail or crash due to GC
1629         https://bugs.webkit.org/show_bug.cgi?id=179745
1630
1631         Reviewed by Geoffrey Garen.
1632
1633         Dispatching an event on a ServiceWorker may fail or crash due to GC. We need to make sure
1634         that a ServiceWorker's wrapper stays alive as long as we may dispatch events on it.
1635
1636         Keep the wrapper alive by making ServiceWorker an ActiveDOMObject and making sure the
1637         implementation object keeps a PendingActivity alive while it may dispatch JS events.
1638         The only event dispatched on ServiceWorker objects is the "statechange" one. We may
1639         dispatch statechange events on a ServiceWorker until its state becomes "redundant".
1640         We therefore take a PendingActivity when the ServiceWorker's state is or becomes
1641         non-redundant (becoming non redundant can only happen when switching initially from
1642         redundant to installing, at which point the ServiceWorker object is not exposed to
1643         the JS yet). We release the PendingActivity when the ServiceWorker's state becomes
1644         redundant or the ActiveDOMObject is stopped (to avoid leaks on navigation).
1645
1646         Test: http/tests/workers/service/service-worker-gc-event.html
1647
1648         * workers/service/ServiceWorker.cpp:
1649         (WebCore::mutableAllWorkers):
1650         (WebCore::ServiceWorker::removeFromAllWorkers):
1651         (WebCore::ServiceWorker::getOrCreate):
1652         (WebCore::ServiceWorker::ServiceWorker):
1653         (WebCore::ServiceWorker::~ServiceWorker):
1654         (WebCore::ServiceWorker::scheduleTaskToUpdateState):
1655         (WebCore::ServiceWorker::activeDOMObjectName const):
1656         (WebCore::ServiceWorker::canSuspendForDocumentSuspension const):
1657         (WebCore::ServiceWorker::stop):
1658         (WebCore::ServiceWorker::updatePendingActivityForEventDispatch):
1659         * workers/service/ServiceWorker.h:
1660         * workers/service/ServiceWorker.idl:
1661
1662 2017-11-16  Frederic Wang  <fwang@igalia.com>
1663
1664         Consider non-main frames for frameViewRootLayerDidChange
1665         https://bugs.webkit.org/show_bug.cgi?id=178508
1666
1667         Reviewed by Antonio Gomes.
1668
1669         No new tests, behavior unchanged.
1670
1671         AsyncScrollingCoordinator::frameViewRootLayerDidChange assumes that frameView is always a
1672         main-frame. It calls ensureRootStateNodeForFrameView, which always attaches a frame node with
1673         null parent ID. It also has an ASSERT to check m_scrollingStateTree->rootStateNode(), instead
1674         of m_scrollingStateTree->stateNodeForID(frameView.scrollLayerID()). This patch makes the
1675         ASSERT more generic. It also adds an early return into ensureRootStateNodeForFrameView when the
1676         node already exists so that the call to attachToStateTree can be skipped. It turns out that that
1677         call is actually only necessary for main frame, so another ASSERT is added to verify it.
1678
1679         * page/scrolling/AsyncScrollingCoordinator.cpp:
1680         (WebCore::AsyncScrollingCoordinator::frameViewRootLayerDidChange): Modify the ASSERT to
1681         verify the availability of a scrolling node for the frame, not just the root node.
1682         (WebCore::AsyncScrollingCoordinator::ensureRootStateNodeForFrameView): Add an early return to
1683         skip the call to attachToStateTree when the node is actually already available. Add an ASSERT to
1684         ensure that attaching a new node is only necessary for main frames.
1685
1686 2017-11-16  Miguel Gomez  <magomez@igalia.com>
1687
1688         [TexMap] Remove use of GraphicsContext3D
1689         https://bugs.webkit.org/show_bug.cgi?id=174860
1690
1691         Reviewed by Žan Doberšek.
1692
1693         Remove remaining uses of GC3D that are not WebGL related:
1694         - Remove the option to create a GC3D to render to the curren OpenGL context.
1695         - Remove the remaining usage of GC3D inside MediaPlayerPrivateGStreamerBase.
1696         - Replace the usage inside TextureMapper with direct OpenGL calls, and use a
1697         VAO when the OpenGL version is higher than 3.2.
1698
1699         This also modifies TextureMapperContextAttributes so all the tested features are
1700         supported when using OpenGL, and we only check for the extensions when using GLES2.
1701
1702         No new tests as there's no behavior change.
1703
1704         * platform/graphics/GraphicsContext3D.h:
1705         * platform/graphics/GraphicsContext3DPrivate.cpp:
1706         (WebCore::GraphicsContext3DPrivate::GraphicsContext3DPrivate):
1707         * platform/graphics/GraphicsContext3DPrivate.h:
1708         * platform/graphics/cairo/GraphicsContext3DCairo.cpp:
1709         (WebCore::GraphicsContext3D::~GraphicsContext3D):
1710         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp:
1711         (WebCore::MediaPlayerPrivateGStreamerBase::pushTextureToCompositor):
1712         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.h:
1713         * platform/graphics/opengl/GraphicsContext3DOpenGLCommon.cpp:
1714         * platform/graphics/texmap/TextureMapper.h:
1715         * platform/graphics/texmap/TextureMapperContextAttributes.cpp:
1716         (WebCore::TextureMapperContextAttributes::initialize):
1717         * platform/graphics/texmap/TextureMapperContextAttributes.h:
1718         * platform/graphics/texmap/TextureMapperGC3DPlatformLayer.cpp:
1719         (WebCore::TextureMapperGC3DPlatformLayer::TextureMapperGC3DPlatformLayer):
1720         (WebCore::TextureMapperGC3DPlatformLayer::makeContextCurrent):
1721         (WebCore::TextureMapperGC3DPlatformLayer::platformContext):
1722         (WebCore::TextureMapperGC3DPlatformLayer::swapBuffersIfNeeded):
1723         (WebCore::TextureMapperGC3DPlatformLayer::paintToTextureMapper):
1724         * platform/graphics/texmap/TextureMapperGC3DPlatformLayer.h:
1725         * platform/graphics/texmap/TextureMapperGL.cpp:
1726         (WebCore::TextureMapperGLData::SharedGLData::currentSharedGLData):
1727         (WebCore::TextureMapperGLData::TextureMapperGLData):
1728         (WebCore::TextureMapperGLData::~TextureMapperGLData):
1729         (WebCore::TextureMapperGLData::initializeStencil):
1730         (WebCore::TextureMapperGLData::getStaticVBO):
1731         (WebCore::TextureMapperGLData::getVAO):
1732         (WebCore::TextureMapperGLData::getShaderProgram):
1733         (WebCore::TextureMapperGL::TextureMapperGL):
1734         (WebCore::TextureMapperGL::beginPainting):
1735         (WebCore::TextureMapperGL::endPainting):
1736         (WebCore::TextureMapperGL::drawBorder):
1737         (WebCore::prepareFilterProgram):
1738         (WebCore::TextureMapperGL::drawTexture):
1739         (WebCore::TextureMapperGL::drawSolidColor):
1740         (WebCore::TextureMapperGL::clearColor):
1741         (WebCore::TextureMapperGL::drawEdgeTriangles):
1742         (WebCore::TextureMapperGL::drawUnitRect):
1743         (WebCore::TextureMapperGL::draw):
1744         (WebCore::TextureMapperGL::drawTexturedQuadWithProgram):
1745         (WebCore::TextureMapperGL::drawFiltered):
1746         (WebCore::TextureMapperGL::bindDefaultSurface):
1747         (WebCore::TextureMapperGL::beginClip):
1748         (WebCore::TextureMapperGL::createTexture):
1749         * platform/graphics/texmap/TextureMapperGL.h:
1750
1751 2017-11-16  Frederic Wang  <fwang@igalia.com>
1752
1753         ASSERTION FAILED: !isAnonymous() in WebCore::RenderMathMLOperator::updateTokenContent
1754         https://bugs.webkit.org/show_bug.cgi?id=166011
1755
1756         Reviewed by Alejandro G. Castro.
1757
1758         RenderMathMLFencedOperator does not support mathvariant or displaystyle transforms. This is
1759         one of several issues of the mfenced element (see bug 160509). However,
1760         MathMLStyle::updateStyleIfNeeded() still tries to use the implementation of the parent
1761         RenderMathMLOperator class, which only works for non-anonymous operators. This patch skips
1762         the updateTokenContent() calls for anonymous mfenced operators in order to avoid ASSERTION
1763         failures.
1764
1765         Test: mathml/mfenced-displaystyle-and-mathvariant-crash.html
1766
1767         * rendering/mathml/MathMLStyle.cpp:
1768         (WebCore::MathMLStyle::updateStyleIfNeeded): Skip anonymous token elements.
1769
1770 2017-11-15  Brady Eidson  <beidson@apple.com>
1771
1772         Implement basics of "Terminate Service Worker" algorithm.
1773         https://bugs.webkit.org/show_bug.cgi?id=179551
1774
1775         Reviewed by Chris Dumez.
1776
1777         No new tests (No observable behavior change yet).
1778
1779         * workers/WorkerGlobalScope.cpp:
1780         (WebCore::WorkerGlobalScope::stopIndexedDatabase):
1781
1782         * workers/WorkerMessagingProxy.cpp:
1783         (WebCore::WorkerMessagingProxy::workerThreadCreated):
1784         (WebCore::WorkerMessagingProxy::terminateWorkerGlobalScope):
1785
1786         * workers/WorkerThread.cpp:
1787         (WebCore::WorkerThread::workerThread):
1788         (WebCore::WorkerThread::stop):
1789         * workers/WorkerThread.h:
1790
1791         * workers/service/context/SWContextManager.cpp:
1792         (WebCore::SWContextManager::terminateWorker):
1793         * workers/service/context/SWContextManager.h:
1794
1795         * workers/service/server/SWServer.cpp:
1796         (WebCore::SWServer::workerContextTerminated):
1797         (WebCore::SWServer::terminateWorker):
1798         * workers/service/server/SWServer.h:
1799
1800         * workers/service/server/SWServerToContextConnection.cpp:
1801         (WebCore::SWServerToContextConnection::workerTerminated):
1802         * workers/service/server/SWServerToContextConnection.h:
1803
1804         * workers/service/server/SWServerWorker.cpp:
1805         (WebCore::SWServerWorker::terminate):
1806         (WebCore::SWServerWorker::contextTerminated):
1807         * workers/service/server/SWServerWorker.h:
1808
1809 2017-11-15  Eric Carlson  <eric.carlson@apple.com>
1810
1811         Log media readyState and networkState as strings
1812         https://bugs.webkit.org/show_bug.cgi?id=179732
1813
1814         Reviewed by Youenn Fablet.
1815
1816         * html/HTMLMediaElement.cpp:
1817         (WebCore::convertEnumerationToString):
1818         (WebCore::HTMLMediaElement::scheduleDelayedAction): Fix logic error.
1819         (WebCore::HTMLMediaElement::pendingActionTimerFired): Fix incorrect log string.
1820         (WebCore::HTMLMediaElement::setNetworkState): Don't cast to int for logging.
1821         (WebCore::HTMLMediaElement::setReadyState): Ditto. Log when autoplay is blocked.
1822
1823         * html/HTMLMediaElementEnums.h:
1824         (PAL::LogArgument<WebCore::HTMLMediaElementEnums::ReadyState>::toString): New.
1825         (PAL::LogArgument<WebCore::HTMLMediaElementEnums::NetworkState>::toString): New.
1826
1827         * platform/graphics/MediaPlayer.cpp:
1828         (WebCore::convertEnumerationToString):
1829         * platform/graphics/MediaPlayerEnums.h:
1830         (PAL::LogArgument<WebCore::MediaPlayerEnums::ReadyState>::toString):
1831         (PAL::LogArgument<WebCore::MediaPlayerEnums::NetworkState>::toString):
1832
1833         * platform/graphics/avfoundation/MediaPlayerPrivateAVFoundation.cpp:
1834         (WebCore::MediaPlayerPrivateAVFoundation::updateStates): Log strings.
1835
1836 2017-11-15  Youenn Fablet  <youenn@apple.com>
1837
1838         Service Worker fetch should handle empty responses
1839         https://bugs.webkit.org/show_bug.cgi?id=179740
1840
1841         Reviewed by Alex Christensen.
1842
1843         Covered by updated test.
1844
1845         * Modules/streams/ReadableStreamSink.cpp:
1846         (WebCore::ReadableStreamToSharedBufferSink::enqueue): Not create a buffer until actually needed.
1847         * workers/service/context/ServiceWorkerFetch.cpp:
1848         (WebCore::ServiceWorkerFetch::processResponse): Check for null buffers.
1849
1850 2017-11-15  Youenn Fablet  <youenn@apple.com>
1851
1852         ReloadFromOrigin loads should not select any service worker
1853         https://bugs.webkit.org/show_bug.cgi?id=179736
1854
1855         Reviewed by Brady Eidson.
1856
1857         Test: http/tests/workers/service/shift-reload-navigation.html
1858
1859         In case of ReloadFromOrigin (equivalent of shift reload), do not select any service worker.
1860
1861         * loader/DocumentLoader.cpp:
1862         (WebCore::DocumentLoader::startLoadingMainResource):
1863         * loader/FrameLoader.h:
1864         (WebCore::FrameLoader::isReloadingFromOrigin const):
1865
1866 2017-11-15  Zalan Bujtas  <zalan@apple.com>
1867
1868         AX triggers sync layout while building the render tree on www.macrumors.com.
1869         https://bugs.webkit.org/show_bug.cgi?id=179741
1870         rdar://problem/35462531
1871
1872         Reviewed by Antti Koivisto.
1873
1874         It's unsafe to issue layout while mutating the render tree. If a mutation
1875         requires AX to issue a layout, it needs to be issued in a delayed manner (which the render
1876         tree mutation will trigger anyway). 
1877
1878         Unable to reproduce.
1879
1880         * accessibility/AccessibilityObject.cpp:
1881         (WebCore::AccessibilityObject::updateBackingStore):
1882
1883 2017-11-15  Antoine Quint  <graouts@apple.com>
1884
1885         [Web Animations] Implement basic to-from animations
1886         https://bugs.webkit.org/show_bug.cgi?id=179707
1887         <rdar://problem/34932456>
1888
1889         We can now actually perform an animation, in software only, when provided two keyframes on an AnimationEffect.
1890         To parse a keyframes object from JS, we use the StyleResolver to create RenderStyle objects based on the strings
1891         provided for the property names and values. Then, when the DocumentTimeline indicates that animations are ready
1892         to be updated, we invalidate the style of elements with animations, so that during style resolution we can perform
1893         blending between the RenderStyles for each keyframe.
1894
1895         Reviewed by Dean Jackson.
1896
1897         * animation/AnimationEffect.h:
1898         (WebCore::AnimationEffect::~AnimationEffect): Deleted.
1899         * animation/AnimationTimeline.h:
1900         (WebCore::AnimationTimeline::elementToAnimationsMap const):
1901         * animation/DocumentTimeline.cpp:
1902         (WebCore::DocumentTimeline::animationResolutionTimerFired):
1903         (WebCore::DocumentTimeline::updateAnimations): Renamed from resolveAnimations() since we're not
1904         actually resolving animations, merely invalidating styles in preparation for resolution.
1905         (WebCore::DocumentTimeline::resolveAnimations): Deleted.
1906         * animation/DocumentTimeline.h:
1907         * animation/KeyframeEffect.cpp:
1908         (WebCore::KeyframeEffect::create): Pass the keyframes argument to setKeyframes() and forward the
1909         exception in case one was raised in the setter.
1910         (WebCore::KeyframeEffect::setKeyframes): Pass the keyframes argument to processKeyframes() and
1911         forward the exception in case one was raised during processing.
1912         (WebCore::KeyframeEffect::processKeyframes): Deal with exactly two keyframes, set at 0 and 1 offsets,
1913         specified in array forms for the keyframes object. As we parse the content of the provided JS object,
1914         we create RenderStyle objects using the element's StyleResolver from a CSS text string we create
1915         based on the property and values as strings.
1916         (WebCore::KeyframeEffect::applyAtLocalTime): Compute the progress based on the local time and duration,
1917         using the existing CSSPropertyAnimation::blendProperties() mechanics to perform the blend between the
1918         from and to keyframes.
1919         * animation/KeyframeEffect.h:
1920         * animation/KeyframeEffect.idl:
1921         * animation/WebAnimation.cpp:
1922         (WebCore::WebAnimation::resolve):
1923         * animation/WebAnimation.h:
1924         * bindings/IDLTypes.h:
1925         (WebCore::IDLObject::nullValue): Make JSC::Strong an optional type.
1926         * dom/Document.h:
1927         (WebCore::Document::existingTimeline const): Provide an explicit method for call sites to check existence
1928         of a timeline before forcing one to be created if missing by calling timeline().
1929         * dom/Element.cpp:
1930         (WebCore::Element::getAnimations): Do not force the creation of a timeline if one isn't already created.
1931         * style/StyleTreeResolver.cpp:
1932         (WebCore::Style::TreeResolver::createAnimatedElementUpdate): When applying styles, account for any Web
1933         Animation applied to the provided element.
1934
1935 2017-11-15  Frederic Wang  <fwang@igalia.com>
1936
1937         ASSERTION FAILED: !renderer->needsLayout() in WebCore::RenderBlock::checkPositionedObjectsNeedLayout with MathML
1938         https://bugs.webkit.org/show_bug.cgi?id=178865
1939
1940         Reviewed by Manuel Rego Casasnovas.
1941
1942         MathML token elements can contain HTML elements and hence MathML elements can contain
1943         out-of-flow positioned descendants. Also all MathML elements can be containing block and hence
1944         should position their out-of-flow positioned descendants before calling clearNeedsLayout().
1945         This patch does that in all places in the MathML renderer classes, except a few of them:
1946         - RenderMathMLSpace, which can not have descendants.
1947         - RenderMathMLToken and RenderMathMLOperator, since they will use the layout implementation
1948           of RenderMathMLBlock when they contain non-text children.
1949         The patch also fixes an ASSERTION failure in WebCore::RenderBlock::checkPositionedObjectsNeedLayout
1950         due to some descendants that are not laid out.
1951
1952         Test: mathml/out-of-flow-in-token-crash.html
1953
1954         * rendering/mathml/RenderMathMLBlock.cpp:
1955         (WebCore::RenderMathMLBlock::layoutBlock): Call layoutPositionedObjects.
1956         (WebCore::RenderMathMLBlock::layoutInvalidMarkup): Ditto and pass the relayoutChildren boolean.
1957         * rendering/mathml/RenderMathMLBlock.h: Add a relayoutChildren boolean to layoutInvalidMarkup.
1958         * rendering/mathml/RenderMathMLFraction.cpp:
1959         (WebCore::RenderMathMLFraction::layoutBlock): Pass the relayoutChildren boolean to layoutInvalidMarkup
1960         and call layoutPositionedObjects.
1961         * rendering/mathml/RenderMathMLRoot.cpp:
1962         (WebCore::RenderMathMLRoot::layoutBlock): Ditto.
1963         * rendering/mathml/RenderMathMLScripts.cpp:
1964         (WebCore::RenderMathMLScripts::layoutBlock): Ditto.
1965         * rendering/mathml/RenderMathMLUnderOver.cpp:
1966         (WebCore::RenderMathMLUnderOver::layoutBlock): Ditto.
1967         * rendering/mathml/RenderMathMLMenclose.cpp:
1968         (WebCore::RenderMathMLMenclose::layoutBlock): Call layoutPositionedObjects.
1969         * rendering/mathml/RenderMathMLPadded.cpp:
1970         (WebCore::RenderMathMLPadded::layoutBlock): Ditto.
1971         * rendering/mathml/RenderMathMLRow.cpp:
1972         (WebCore::RenderMathMLRow::layoutBlock): Ditto.
1973
1974 2017-11-15  Youenn Fablet  <youenn@apple.com>
1975
1976         Add ServiceWorker to WebProcess plumbery for FormData fetch responses
1977         https://bugs.webkit.org/show_bug.cgi?id=179694
1978
1979         Reviewed by Alex Christensen.
1980
1981         No observable changes since we are not actually loading FormData right now.
1982
1983         * workers/service/context/ServiceWorkerFetch.cpp:
1984         (WebCore::ServiceWorkerFetch::processResponse):
1985         * workers/service/context/ServiceWorkerFetch.h:
1986
1987 2017-11-15  Jer Noble  <jer.noble@apple.com>
1988
1989         Add a compile-time-checked string literal initializer for FourCC.
1990         https://bugs.webkit.org/show_bug.cgi?id=179706
1991
1992         Reviewed by Alex Christensen.
1993
1994         Add a contexpr constructor for FourCC that takes a string literal and static_asserts that it
1995         is exactly 4 chars long. Use this string literal constructor everywhere instead of multi-
1996         character literals.
1997
1998         * platform/graphics/FourCC.h:
1999         (WebCore::FourCC::FourCC):
2000         * platform/graphics/iso/ISOBox.cpp:
2001         (WebCore::ISOBox::parse):
2002         * platform/graphics/iso/ISOOriginalFormatBox.h:
2003         (WebCore::ISOOriginalFormatBox::boxTypeName):
2004         * platform/graphics/iso/ISOProtectionSchemeInfoBox.h:
2005         (WebCore::ISOProtectionSchemeInfoBox::boxTypeName):
2006         * platform/graphics/iso/ISOSchemeInformationBox.h:
2007         (WebCore::ISOSchemeInformationBox::boxTypeName):
2008         * platform/graphics/iso/ISOSchemeTypeBox.h:
2009         (WebCore::ISOSchemeTypeBox::boxTypeName):
2010         * platform/graphics/iso/ISOTrackEncryptionBox.h:
2011         (WebCore::ISOTrackEncryptionBox::boxTypeName):
2012         * platform/graphics/iso/ISOVTTCue.h:
2013         (WebCore::ISOWebVTTCue::boxTypeName):
2014
2015 2017-11-15  Adrian Perez de Castro  <aperez@igalia.com>
2016
2017         [Cairo] Clang warns about mismatched declaration type tag for GraphicsContextState
2018         https://bugs.webkit.org/show_bug.cgi?id=179729
2019
2020         Reviewed by Michael Catanzaro.
2021
2022         No new tests needed.
2023
2024         * platform/graphics/cairo/CairoOperations.h: Make the forward declaration use "struct" 
2025         as the actual implementation of the type does.
2026
2027 2017-11-15  Chris Dumez  <cdumez@apple.com>
2028
2029         [Service Workers] Implement Client API
2030         https://bugs.webkit.org/show_bug.cgi?id=179709
2031
2032         Reviewed by Alex Christensen.
2033
2034         Implement Client API as per:
2035         - https://w3c.github.io/ServiceWorker/#client-interface
2036
2037         Tests:
2038         http/tests/workers/service/Client-properties.html
2039         http/tests/workers/service/Client-properties-subframe.html
2040         http/tests/workers/service/Client-properties-auxiliary.html
2041
2042         * Sources.txt:
2043         * WebCore.xcodeproj/project.pbxproj:
2044         * workers/service/ServiceWorker.cpp:
2045         (WebCore::ServiceWorker::postMessage):
2046         * workers/service/ServiceWorkerClient.cpp:
2047         (WebCore::ServiceWorkerClient::ServiceWorkerClient):
2048         (WebCore::ServiceWorkerClient::url const):
2049         (WebCore::ServiceWorkerClient::type const):
2050         (WebCore::ServiceWorkerClient::frameType const):
2051         (WebCore::ServiceWorkerClient::id const):
2052         (WebCore::ServiceWorkerClient::postMessage):
2053         * workers/service/ServiceWorkerClient.h:
2054         (WebCore::ServiceWorkerClient::create):
2055         * workers/service/ServiceWorkerClientData.cpp: Copied from Source/WebCore/workers/service/ServiceWorkerWindowClient.cpp.
2056         (WebCore::toServiceWorkerClientFrameType):
2057         (WebCore::ServiceWorkerClientData::isolatedCopy const):
2058         (WebCore::ServiceWorkerClientData::from):
2059         * workers/service/ServiceWorkerClientData.h: Copied from Source/WebCore/workers/service/ServiceWorkerClient.h.
2060         (WebCore::ServiceWorkerClientData::encode const):
2061         (WebCore::ServiceWorkerClientData::decode):
2062         * workers/service/ServiceWorkerClientIdentifier.h:
2063         (WebCore::ServiceWorkerClientIdentifier::encode const):
2064         (WebCore::ServiceWorkerClientIdentifier::decode):
2065         * workers/service/ServiceWorkerTypes.h:
2066         * workers/service/ServiceWorkerWindowClient.cpp:
2067         (WebCore::ServiceWorkerWindowClient::ServiceWorkerWindowClient):
2068         * workers/service/ServiceWorkerWindowClient.h:
2069         * workers/service/context/SWContextManager.cpp:
2070         (WebCore::SWContextManager::postMessageToServiceWorkerGlobalScope):
2071         * workers/service/context/SWContextManager.h:
2072         * workers/service/context/ServiceWorkerThread.cpp:
2073         (WebCore::ServiceWorkerThread::postMessageToServiceWorkerGlobalScope):
2074         * workers/service/context/ServiceWorkerThread.h:
2075         * workers/service/server/SWClientConnection.h:
2076
2077 2017-11-15  Ryan Haddad  <ryanhaddad@apple.com>
2078
2079         Unreviewed, rolling out r224863.
2080
2081         Introduced LayoutTest crashes on iOS Simulator.
2082
2083         Reverted changeset:
2084
2085         "Move JSONValues to WTF and convert uses of InspectorValues.h
2086         to JSONValues.h"
2087         https://bugs.webkit.org/show_bug.cgi?id=173793
2088         https://trac.webkit.org/changeset/224863
2089
2090 2017-11-15  Youenn Fablet  <youenn@apple.com>
2091
2092         Remove service worker selection based on registration
2093         https://bugs.webkit.org/show_bug.cgi?id=179705
2094
2095         Reviewed by Alex Christensen.
2096
2097         Covered by updated tests.
2098
2099         Selection is now handled at navigation time.
2100         We can remove the selection/unselection of worker based on registration.
2101
2102         * workers/service/ServiceWorkerContainer.cpp:
2103         (WebCore::ServiceWorkerContainer::jobResolvedWithUnregistrationResult):
2104         * workers/service/ServiceWorkerRegistration.cpp:
2105         (WebCore::ServiceWorkerRegistration::ServiceWorkerRegistration):
2106
2107 2017-11-15  Zan Dobersek  <zdobersek@igalia.com>
2108
2109         [Cairo] GraphicsContext::setPlatformShadow() has to update state's shadow offset when ignoring transforms
2110         https://bugs.webkit.org/show_bug.cgi?id=179725
2111
2112         Reviewed by Carlos Garcia Campos.
2113
2114         In r224753, GraphicsContext::setPlatformShadow() stopped updating the
2115         shadow offset value that's kept in GraphicsContextState. This regressed
2116         a few tests, so the adjustment of the shadow offset value in the
2117         GraphicsContext state is brought back.
2118
2119         * platform/graphics/cairo/CairoOperations.cpp:
2120         (WebCore::Cairo::State::setShadowValues):
2121         * platform/graphics/cairo/GraphicsContextCairo.cpp:
2122         (WebCore::GraphicsContext::setPlatformShadow):
2123
2124 2017-11-15  Gabriel Ivascu  <givascu@igalia.com>
2125
2126         [GTK] Automatically adjust font size when gtk-xft-dpi changes
2127         https://bugs.webkit.org/show_bug.cgi?id=142673
2128
2129         Some follow-up fixes for the previous patch.
2130
2131         Reviewed by Carlos Garcia Campos.
2132
2133         * platform/PlatformScreen.h:
2134         * platform/gtk/PlatformScreenGtk.cpp:
2135         (WebCore::screenDPIObserverHandlersMap):
2136         (WebCore::gtkXftDPIChangedCallback):
2137         (WebCore::setScreenDPIObserverHandler):
2138         * platform/wpe/PlatformScreenWPE.cpp:
2139         (WebCore::setScreenDPIObserverHandler):
2140
2141 2017-11-14  Nan Wang  <n_wang@apple.com>
2142
2143         AX: AOM: Implement AccessibleNode class and support label and role attributes
2144         https://bugs.webkit.org/show_bug.cgi?id=179494
2145
2146         Reviewed by Ryosuke Niwa.
2147
2148         Accessibility Object Model
2149         Explainer: https://wicg.github.io/aom/explainer.html
2150         Spec: https://wicg.github.io/aom/spec/
2151
2152         This change adds an accessibleNode getter on Element, and implements
2153         the role and label properties of AccessibleNode. 
2154
2155         In existing accessibility code, places where we previously retrieve an 
2156         ARIA attribute are replaced with a new function that first checks the 
2157         AOM property and then checks the equivalent ARIA attribute.
2158
2159         Test: accessibility/accessibility-object-model.html
2160
2161         * CMakeLists.txt:
2162         * DerivedSources.cpp:
2163         * DerivedSources.make:
2164         * Sources.txt:
2165         * WebCore.xcodeproj/project.pbxproj:
2166         * accessibility/AXObjectCache.cpp:
2167         (WebCore::nodeHasRole):
2168         (WebCore::AXObjectCache::handleLiveRegionCreated):
2169         * accessibility/AccessibilityAllInOne.cpp:
2170         * accessibility/AccessibilityImageMapLink.cpp:
2171         (WebCore::AccessibilityImageMapLink::roleValue const):
2172         (WebCore::AccessibilityImageMapLink::accessibilityDescription const):
2173         * accessibility/AccessibilityListBoxOption.cpp:
2174         (WebCore::AccessibilityListBoxOption::stringValue const):
2175         * accessibility/AccessibilityNodeObject.cpp:
2176         (WebCore::AccessibilityNodeObject::ariaAccessibilityDescription const):
2177         (WebCore::siblingWithAriaRole):
2178         (WebCore::AccessibilityNodeObject::textForLabelElement const):
2179         (WebCore::AccessibilityNodeObject::alternativeText const):
2180         (WebCore::AccessibilityNodeObject::alternativeTextForWebArea const):
2181         (WebCore::AccessibilityNodeObject::stringValue const):
2182         (WebCore::accessibleNameForNode):
2183         (WebCore::AccessibilityNodeObject::determineAriaRoleAttribute const):
2184         * accessibility/AccessibilityObject.cpp:
2185         (WebCore::AccessibilityObject::hasProperty const):
2186         (WebCore::AccessibilityObject::stringValueForProperty const):
2187         (WebCore::AccessibilityObject::supportsARIAAttributes const):
2188         * accessibility/AccessibilityObject.h:
2189         * accessibility/AccessibilityRenderObject.cpp:
2190         (WebCore::AccessibilityRenderObject::stringValue const):
2191         (WebCore::AccessibilityRenderObject::exposesTitleUIElement const):
2192         (WebCore::AccessibilityRenderObject::determineAccessibilityRole):
2193         * accessibility/AccessibleNode.cpp: Added.
2194         (WebCore::ariaAttributeMap):
2195         (WebCore::isPropertyValueString):
2196         (WebCore::AccessibleNode::hasProperty):
2197         (WebCore::AccessibleNode::valueForProperty):
2198         (WebCore::AccessibleNode::effectiveStringValueForElement):
2199         (WebCore::AccessibleNode::stringValueForProperty):
2200         (WebCore::AccessibleNode::setStringProperty):
2201         (WebCore::AccessibleNode::role const):
2202         (WebCore::AccessibleNode::setRole):
2203         (WebCore::AccessibleNode::label const):
2204         (WebCore::AccessibleNode::setLabel):
2205         * accessibility/AccessibleNode.h: Added.
2206         (WebCore::AXPropertyHashTraits::emptyValue):
2207         (WebCore::AXPropertyHashTraits::constructDeletedValue):
2208         (WebCore::AXPropertyHashTraits::isDeletedValue):
2209         (WebCore::AccessibleNode::AccessibleNode):
2210         (WebCore::AccessibleNode::ref):
2211         (WebCore::AccessibleNode::deref):
2212         * accessibility/AccessibleNode.idl: Added.
2213         * bindings/js/WebCoreBuiltinNames.h:
2214         * dom/Element.cpp:
2215         (WebCore::Element::canContainRangeEndPoint const):
2216         (WebCore::Element::accessibleNode):
2217         (WebCore::Element::existingAccessibleNode const):
2218         * dom/Element.h:
2219         * dom/Element.idl:
2220         * dom/ElementRareData.cpp:
2221         * dom/ElementRareData.h:
2222         (WebCore::ElementRareData::accessibleNode const):
2223         (WebCore::ElementRareData::setAccessibleNode):
2224         * editing/TextIterator.cpp:
2225         (WebCore::isRendererReplacedElement):
2226         * page/RuntimeEnabledFeatures.h:
2227         (WebCore::RuntimeEnabledFeatures::setAccessibilityObjectModelEnabled):
2228         (WebCore::RuntimeEnabledFeatures::accessibilityObjectModelEnabled const):
2229         * rendering/RenderMenuList.cpp:
2230         (RenderMenuList::itemAccessibilityText const):
2231
2232 2017-11-14  Zan Dobersek  <zdobersek@igalia.com>
2233
2234         [Cairo] Add GraphicsContextImplCairo stub
2235         https://bugs.webkit.org/show_bug.cgi?id=179658
2236
2237         Reviewed by Carlos Garcia Campos.
2238
2239         Add the GraphicsContextImplCairo class, which at this point is still
2240         an empty implementation of the GraphicsContextImpl interface. Plan for
2241         the near future is to start mapping method invocations to CairoOperation
2242         functions, essentially mirroring what the Cairo-specific GraphicsContext
2243         methods do today.
2244
2245         In the future this implementation would hopefully allow us to apply a
2246         recorded list of GraphicsContext commands against a PlatformContextCairo
2247         instance.
2248
2249         * platform/SourcesCairo.txt:
2250         * platform/graphics/cairo/GraphicsContextImplCairo.cpp: Added.
2251         (WebCore::GraphicsContextImplCairo::GraphicsContextImplCairo):
2252         (WebCore::m_platformContext):
2253         (WebCore::GraphicsContextImplCairo::updateState):
2254         (WebCore::GraphicsContextImplCairo::clearShadow):
2255         (WebCore::GraphicsContextImplCairo::setLineCap):
2256         (WebCore::GraphicsContextImplCairo::setLineDash):
2257         (WebCore::GraphicsContextImplCairo::setLineJoin):
2258         (WebCore::GraphicsContextImplCairo::setMiterLimit):
2259         (WebCore::GraphicsContextImplCairo::fillRect):
2260         (WebCore::GraphicsContextImplCairo::fillRoundedRect):
2261         (WebCore::GraphicsContextImplCairo::fillRectWithRoundedHole):
2262         (WebCore::GraphicsContextImplCairo::fillPath):
2263         (WebCore::GraphicsContextImplCairo::fillEllipse):
2264         (WebCore::GraphicsContextImplCairo::strokeRect):
2265         (WebCore::GraphicsContextImplCairo::strokePath):
2266         (WebCore::GraphicsContextImplCairo::strokeEllipse):
2267         (WebCore::GraphicsContextImplCairo::clearRect):
2268         (WebCore::GraphicsContextImplCairo::drawGlyphs):
2269         (WebCore::GraphicsContextImplCairo::drawImage):
2270         (WebCore::GraphicsContextImplCairo::drawTiledImage):
2271         (WebCore::GraphicsContextImplCairo::drawNativeImage):
2272         (WebCore::GraphicsContextImplCairo::drawPattern):
2273         (WebCore::GraphicsContextImplCairo::drawRect):
2274         (WebCore::GraphicsContextImplCairo::drawLine):
2275         (WebCore::GraphicsContextImplCairo::drawLinesForText):
2276         (WebCore::GraphicsContextImplCairo::drawLineForDocumentMarker):
2277         (WebCore::GraphicsContextImplCairo::drawEllipse):
2278         (WebCore::GraphicsContextImplCairo::drawPath):
2279         (WebCore::GraphicsContextImplCairo::drawFocusRing):
2280         (WebCore::GraphicsContextImplCairo::save):
2281         (WebCore::GraphicsContextImplCairo::restore):
2282         (WebCore::GraphicsContextImplCairo::translate):
2283         (WebCore::GraphicsContextImplCairo::rotate):
2284         (WebCore::GraphicsContextImplCairo::scale):
2285         (WebCore::GraphicsContextImplCairo::concatCTM):
2286         (WebCore::GraphicsContextImplCairo::beginTransparencyLayer):
2287         (WebCore::GraphicsContextImplCairo::endTransparencyLayer):
2288         (WebCore::GraphicsContextImplCairo::clip):
2289         (WebCore::GraphicsContextImplCairo::clipOut):
2290         (WebCore::GraphicsContextImplCairo::clipPath):
2291         (WebCore::GraphicsContextImplCairo::applyDeviceScaleFactor):
2292         * platform/graphics/cairo/GraphicsContextImplCairo.h: Added.
2293
2294 2017-11-14  Zan Dobersek  <zdobersek@igalia.com>
2295
2296         [Cairo] Clean up CairoOperations, GradientCairo, GraphicsContextCairo implementation files
2297         https://bugs.webkit.org/show_bug.cgi?id=179679
2298
2299         Reviewed by Michael Catanzaro.
2300
2301         Clean up random tidbits in the CairoOperations, GradientCairo and
2302         GraphicsContextCairo implementation files that I've been ravaging
2303         through over the last few days.
2304
2305         No new tests -- no change in behavior.
2306
2307         * platform/graphics/cairo/CairoOperations.cpp:
2308         Add a missing <algorithms> include, drop an unnecessary empty line.
2309         (WebCore::Cairo::drawLine):
2310         * platform/graphics/cairo/GradientCairo.cpp:
2311         Add a missing CairoOperations.h include.
2312         * platform/graphics/cairo/GraphicsContextCairo.cpp:
2313         Drop unnecessary includes and a bunch of redundant helper functions.
2314         (WebCore::GraphicsContext::drawLineForText):
2315         Inline the DashArray object construction into the relay call.
2316         (WebCore::GraphicsContext::drawLinesForText):
2317         size_t can't be negative, so just check for DashArray being empty.
2318         (WebCore::fillRectWithColor): Deleted.
2319         (): Deleted.
2320         (WebCore::drawPathShadow): Deleted.
2321         (WebCore::fillCurrentCairoPath): Deleted.
2322         (WebCore::shadowAndFillCurrentCairoPath): Deleted.
2323         (WebCore::shadowAndStrokeCurrentCairoPath): Deleted.
2324
2325 2017-11-14  Michael Catanzaro  <mcatanzaro@igalia.com>
2326
2327         Unreviewed, another attempt to fix builds after r224707
2328         https://bugs.webkit.org/show_bug.cgi?id=179499
2329         <rdar://problem/35445033>
2330
2331         * PlatformWin.cmake:
2332         * Sources.txt:
2333         * WebCore.xcodeproj/project.pbxproj:
2334
2335 2017-11-14  Ryan Haddad  <ryanhaddad@apple.com>
2336
2337         Unreviewed, rolling out r224860.
2338
2339         This change broke the macOS and iOS builds.
2340
2341         Reverted changeset:
2342
2343         "Unreviewed, fix CMake debug builds after r224707"
2344         https://bugs.webkit.org/show_bug.cgi?id=179499
2345         https://trac.webkit.org/changeset/224860
2346
2347 2017-11-14  Antti Koivisto  <antti@apple.com>
2348
2349         Media query with :host inside a custom elements doesn't get updated on window resize
2350         https://bugs.webkit.org/show_bug.cgi?id=176101
2351         <rdar://problem/34163850>
2352
2353         Reviewed by Simon Fraser.
2354
2355         If a media query containing :host or ::slotted stops applying we fail to update the style.
2356
2357         * style/StyleScope.cpp:
2358         (WebCore::Style::invalidateHostAndSlottedStyleIfNeeded):
2359
2360             Factor into function.
2361
2362         (WebCore::Style::Scope::updateActiveStyleSheets):
2363         (WebCore::Style::Scope::scheduleUpdate):
2364
2365             Invalidate elements that may match :host and ::slotted before clearing style resolver for full update.
2366
2367 2017-11-14  Carlos Garcia Campos  <cgarcia@igalia.com>
2368
2369         Move JSONValues to WTF and convert uses of InspectorValues.h to JSONValues.h
2370         https://bugs.webkit.org/show_bug.cgi?id=173793
2371
2372         Reviewed by Brian Burg.
2373
2374         Based on patch by Brian Burg.
2375
2376         * ForwardingHeaders/inspector/InspectorValues.h: Removed.
2377         * Modules/encryptedmedia/InitDataRegistry.cpp:
2378         (WebCore::extractKeyIDsKeyids):
2379         (WebCore::sanitizeKeyids):
2380         * html/parser/XSSAuditorDelegate.cpp:
2381         (WebCore::XSSAuditorDelegate::generateViolationReport):
2382         * inspector/CommandLineAPIHost.cpp:
2383         (WebCore::CommandLineAPIHost::inspect):
2384         * inspector/CommandLineAPIHost.h:
2385         * inspector/InspectorCanvas.cpp:
2386         (WebCore::InspectorCanvas::recordAction):
2387         (WebCore::InspectorCanvas::releaseData):
2388         (WebCore::InspectorCanvas::indexForData):
2389         (WebCore::buildArrayForVector):
2390         (WebCore::InspectorCanvas::buildInitialState):
2391         (WebCore::InspectorCanvas::buildAction):
2392         (WebCore::InspectorCanvas::buildArrayForCanvasGradient):
2393         (WebCore::InspectorCanvas::buildArrayForCanvasPattern):
2394         (WebCore::InspectorCanvas::buildArrayForImageData):
2395         (WebCore::InspectorCanvas::buildArrayForImageBitmap):
2396         * inspector/InspectorCanvas.h:
2397         * inspector/InspectorDatabaseResource.cpp:
2398         * inspector/InspectorOverlay.cpp:
2399         (WebCore::evaluateCommandInOverlay):
2400         (WebCore::InspectorOverlay::evaluateInOverlay):
2401         * inspector/InspectorOverlay.h:
2402         * inspector/InspectorShaderProgram.h:
2403         * inspector/InspectorStyleSheet.h:
2404         (WebCore::InspectorCSSId::InspectorCSSId):
2405         * inspector/TimelineRecordFactory.cpp:
2406         (WebCore::TimelineRecordFactory::createGenericRecord):
2407         (WebCore::TimelineRecordFactory::createFunctionCallData):
2408         (WebCore::TimelineRecordFactory::createConsoleProfileData):
2409         (WebCore::TimelineRecordFactory::createProbeSampleData):
2410         (WebCore::TimelineRecordFactory::createEventDispatchData):
2411         (WebCore::TimelineRecordFactory::createGenericTimerData):
2412         (WebCore::TimelineRecordFactory::createTimerInstallData):
2413         (WebCore::TimelineRecordFactory::createEvaluateScriptData):
2414         (WebCore::TimelineRecordFactory::createTimeStampData):
2415         (WebCore::TimelineRecordFactory::createAnimationFrameData):
2416         (WebCore::createQuad):
2417         (WebCore::TimelineRecordFactory::createPaintData):
2418         (WebCore::TimelineRecordFactory::appendLayoutRoot):
2419         * inspector/TimelineRecordFactory.h:
2420         * inspector/agents/InspectorApplicationCacheAgent.cpp:
2421         * inspector/agents/InspectorApplicationCacheAgent.h:
2422         * inspector/agents/InspectorCSSAgent.cpp:
2423         (WebCore::computePseudoClassMask):
2424         (WebCore::InspectorCSSAgent::setStyleText):
2425         (WebCore::InspectorCSSAgent::setRuleSelector):
2426         (WebCore::InspectorCSSAgent::forcePseudoState):
2427         * inspector/agents/InspectorCSSAgent.h:
2428         * inspector/agents/InspectorDOMAgent.cpp:
2429         (WebCore::parseColor):
2430         (WebCore::parseConfigColor):
2431         (WebCore::parseQuad):
2432         (WebCore::InspectorDOMAgent::performSearch):
2433         (WebCore::InspectorDOMAgent::setSearchingForNode):
2434         (WebCore::InspectorDOMAgent::highlightConfigFromInspectorObject):
2435         (WebCore::InspectorDOMAgent::setInspectModeEnabled):
2436         (WebCore::InspectorDOMAgent::highlightRect):
2437         (WebCore::InspectorDOMAgent::highlightQuad):
2438         (WebCore::InspectorDOMAgent::innerHighlightQuad):
2439         (WebCore::InspectorDOMAgent::highlightSelector):
2440         (WebCore::InspectorDOMAgent::highlightNode):
2441         (WebCore::InspectorDOMAgent::highlightNodeList):
2442         (WebCore::InspectorDOMAgent::highlightFrame):
2443         * inspector/agents/InspectorDOMAgent.h:
2444         * inspector/agents/InspectorDOMDebuggerAgent.cpp:
2445         (WebCore::InspectorDOMDebuggerAgent::didInvalidateStyleAttr):
2446         (WebCore::InspectorDOMDebuggerAgent::willInsertDOMNode):
2447         (WebCore::InspectorDOMDebuggerAgent::willRemoveDOMNode):
2448         (WebCore::InspectorDOMDebuggerAgent::willModifyDOMAttr):
2449         (WebCore::InspectorDOMDebuggerAgent::descriptionForDOMEvent):
2450         (WebCore::InspectorDOMDebuggerAgent::pauseOnNativeEventIfNeeded):
2451         (WebCore::InspectorDOMDebuggerAgent::willSendXMLHttpRequest):
2452         * inspector/agents/InspectorDOMDebuggerAgent.h:
2453         * inspector/agents/InspectorDOMStorageAgent.cpp:
2454         (WebCore::InspectorDOMStorageAgent::getDOMStorageItems):
2455         (WebCore::InspectorDOMStorageAgent::setDOMStorageItem):
2456         (WebCore::InspectorDOMStorageAgent::removeDOMStorageItem):
2457         (WebCore::InspectorDOMStorageAgent::findStorageArea):
2458         * inspector/agents/InspectorDOMStorageAgent.h:
2459         * inspector/agents/InspectorDatabaseAgent.cpp:
2460         * inspector/agents/InspectorIndexedDBAgent.cpp:
2461         (WebCore::Inspector::idbKeyFromInspectorObject):
2462         (WebCore::Inspector::idbKeyRangeFromKeyRange):
2463         (WebCore::InspectorIndexedDBAgent::requestData):
2464         * inspector/agents/InspectorIndexedDBAgent.h:
2465         * inspector/agents/InspectorNetworkAgent.cpp:
2466         (WebCore::buildObjectForHeaders):
2467         (WebCore::InspectorNetworkAgent::buildObjectForResourceResponse):
2468         (WebCore::InspectorNetworkAgent::setExtraHTTPHeaders):
2469         * inspector/agents/InspectorNetworkAgent.h:
2470         * inspector/agents/InspectorPageAgent.cpp:
2471         * inspector/agents/InspectorPageAgent.h:
2472         * inspector/agents/InspectorTimelineAgent.cpp:
2473         (WebCore::InspectorTimelineAgent::setInstruments):
2474         (WebCore::InspectorTimelineAgent::internalStart):
2475         (WebCore::InspectorTimelineAgent::didInvalidateLayout):
2476         (WebCore::InspectorTimelineAgent::willLayout):
2477         (WebCore::InspectorTimelineAgent::didScheduleStyleRecalculation):
2478         (WebCore::InspectorTimelineAgent::willRecalculateStyle):
2479         (WebCore::InspectorTimelineAgent::willComposite):
2480         (WebCore::InspectorTimelineAgent::willPaint):
2481         (WebCore::InspectorTimelineAgent::addRecordToTimeline):
2482         (WebCore::InspectorTimelineAgent::setFrameIdentifier):
2483         (WebCore::InspectorTimelineAgent::appendRecord):
2484         (WebCore::InspectorTimelineAgent::sendEvent):
2485         (WebCore::InspectorTimelineAgent::createRecordEntry):
2486         (WebCore::InspectorTimelineAgent::pushCurrentRecord):
2487         * inspector/agents/InspectorTimelineAgent.h:
2488         * page/csp/ContentSecurityPolicy.cpp:
2489         (WebCore::ContentSecurityPolicy::reportViolation const):
2490         * platform/encryptedmedia/clearkey/CDMClearKey.cpp:
2491         (WebCore::parseJSONObject):
2492         (WebCore::parseLicenseFormat):
2493         (WebCore::parseLicenseReleaseAcknowledgementFormat):
2494         (WebCore::CDMInstanceClearKey::updateLicense):
2495         (WebCore::CDMInstanceClearKey::removeSessionData):
2496         * platform/graphics/avfoundation/CDMFairPlayStreaming.cpp:
2497         (WebCore::extractSinfData):
2498         * testing/Internals.cpp:
2499
2500 2017-11-14  Michael Catanzaro  <mcatanzaro@igalia.com>
2501
2502         Unreviewed, fix CMake debug builds after r224707
2503         https://bugs.webkit.org/show_bug.cgi?id=179499
2504         <rdar://problem/35445033>
2505
2506         * PlatformWin.cmake:
2507         * Sources.txt:
2508
2509 2017-11-14  Michael Catanzaro  <mcatanzaro@igalia.com>
2510
2511         Another attempt to fix GTK/WPE debug builds
2512         https://bugs.webkit.org/show_bug.cgi?id=179660
2513
2514         * platform/graphics/cairo/NativeImageCairo.cpp:
2515         (WebCore::drawNativeImage):
2516
2517 2017-11-14  Alex Christensen  <achristensen@webkit.org>
2518
2519         Fix Windows build.
2520
2521         * html/canvas/WebGLRenderingContext.h:
2522
2523 2017-11-14  Chris Dumez  <cdumez@apple.com>
2524
2525         [Service Workers] Implement container.getRegistrations()
2526         https://bugs.webkit.org/show_bug.cgi?id=179672
2527
2528         Reviewed by Brady Eidson.
2529
2530         Implement container.getRegistrations():
2531         - https://w3c.github.io/ServiceWorker/#dom-serviceworkercontainer-getregistrations
2532
2533         No new tests, rebaselined existing test.
2534
2535         * workers/service/ServiceWorkerContainer.cpp:
2536         (WebCore::ServiceWorkerContainer::getRegistration):
2537         (WebCore::ServiceWorkerContainer::getRegistrations):
2538         (WebCore::ServiceWorkerContainer::jobResolvedWithRegistration):
2539         * workers/service/ServiceWorkerContainer.h:
2540         * workers/service/ServiceWorkerRegistration.cpp:
2541         (WebCore::ServiceWorkerRegistration::getOrCreate):
2542         * workers/service/ServiceWorkerRegistration.h:
2543         * workers/service/ServiceWorkerRegistrationKey.cpp:
2544         (WebCore::ServiceWorkerRegistrationKey::isMatching const):
2545         (WebCore::ServiceWorkerRegistrationKey::originIsMatching const):
2546         * workers/service/ServiceWorkerRegistrationKey.h:
2547         * workers/service/server/SWClientConnection.h:
2548         * workers/service/server/SWServer.cpp:
2549         (WebCore::SWServer::getRegistrations):
2550         * workers/service/server/SWServer.h:
2551
2552 2017-11-14  Alex Christensen  <achristensen@webkit.org>
2553
2554         Fix Windows build.
2555
2556         * html/canvas/WebGLRenderingContext.h:
2557
2558 2017-11-14  Michael Catanzaro  <mcatanzaro@igalia.com>
2559
2560         Unreviewed, fix GTK/WPE debug builds even better after r224813
2561         https://bugs.webkit.org/show_bug.cgi?id=179660
2562
2563         * platform/graphics/cairo/NativeImageCairo.cpp:
2564         (WebCore::drawNativeImage):
2565
2566 2017-11-14  Michael Catanzaro  <mcatanzaro@igalia.com>
2567
2568         Unreviewed, fix GTK/WPE debug builds after r224813
2569         https://bugs.webkit.org/show_bug.cgi?id=179660
2570
2571         * platform/graphics/cairo/NativeImageCairo.cpp:
2572         (WebCore::drawNativeImage):
2573
2574 2017-11-14  Youenn Fablet  <youenn@apple.com>
2575
2576         Implement ServiceWorker handle fetch for navigation loads
2577         https://bugs.webkit.org/show_bug.cgi?id=179404
2578
2579         Reviewed by Alex Christensen and Chris Dumez.
2580
2581         Covered by rebased tests.
2582
2583         Step 11 of https://w3c.github.io/ServiceWorker/#on-fetch-request-algorithm is implemented in DocumentLoader as it centralizes main request loading
2584         and knows about the context of it.
2585
2586         For each main resource load in document loader, we first check whether there is a matching service worker.
2587         The fetch request is updated accordingly so that there is no difference in the handling of navigation vs. subresource requests after that point.
2588
2589         Updated DocumentThreadableLoader::didReceiveResponse since it can now receive responses from service worker with various response types.
2590         A follow-up patch should properly handle cross origin responses.
2591
2592         * loader/DocumentLoader.cpp:
2593         (WebCore::DocumentLoader::commitData):
2594         (WebCore::DocumentLoader::startLoadingMainResource):
2595         (WebCore::DocumentLoader::doLoadingMainResource):
2596         * loader/DocumentLoader.h:
2597         * loader/DocumentThreadableLoader.cpp:
2598         (WebCore::DocumentThreadableLoader::didReceiveResponse):
2599         * loader/cache/CachedResourceRequest.cpp:
2600         (WebCore::CachedResourceRequest::setNavigationServiceWorkerRegistrationData):
2601         * loader/cache/CachedResourceRequest.h:
2602         * platform/MIMETypeRegistry.h:
2603         * platform/network/cocoa/WebCoreNSURLSession.mm:
2604         (-[WebCoreNSURLSessionDataTask resource:receivedResponse:]):
2605
2606 2017-11-14  Alex Christensen  <achristensen@webkit.org>
2607
2608         Log moveFile failure errors
2609         https://bugs.webkit.org/show_bug.cgi?id=179695
2610
2611         Reviewed by Brady Eidson.
2612
2613         Content extension tests are flaky. In r224790 I added logs to find out why, and they indicate that moveFile is failing.
2614         To further understand why, I'm adding logs to see what's happening sometimes on the bots.
2615
2616         * platform/cocoa/FileSystemCocoa.mm:
2617         (WebCore::FileSystem::moveFile):
2618
2619 2017-11-14  Dean Jackson  <dino@apple.com>
2620
2621         Fix Windows build.
2622
2623         * html/OffscreenCanvas.cpp:
2624         * html/OffscreenCanvas.h:
2625         * html/OffscreenCanvas.idl:
2626
2627 2017-11-14  Alex Christensen  <achristensen@webkit.org>
2628
2629         Remove Cocoa CFURLConnection loading code
2630         https://bugs.webkit.org/show_bug.cgi?id=179688
2631
2632         Reviewed by Antti Koivisto.
2633
2634         CFURLConnection is only used on the AppleWin port now.
2635
2636         * PlatformMac.cmake:
2637         * SourcesCocoa.txt:
2638         * SourcesIOS.txt:
2639         * WebCore.xcodeproj/project.pbxproj:
2640         * loader/DocumentLoader.h:
2641         * loader/EmptyFrameLoaderClient.h:
2642         * loader/FrameLoaderClient.h:
2643         * loader/ResourceLoader.cpp:
2644         * loader/ResourceLoader.h:
2645         * loader/SubresourceLoader.h:
2646         * loader/cf/ResourceLoaderCFNet.cpp:
2647         * loader/cocoa/SubresourceLoaderCocoa.mm:
2648         * loader/mac/DocumentLoaderMac.cpp:
2649         * loader/mac/ResourceLoaderMac.mm:
2650         * page/mac/PageMac.mm:
2651         (WebCore::Page::platformInitialize):
2652         (WebCore::Page::addSchedulePair):
2653         (WebCore::Page::removeSchedulePair):
2654         * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
2655         (WebCore::MediaPlayerPrivateAVFoundationObjC::shouldWaitForResponseToAuthenticationChallenge):
2656         (WebCore::WebCoreNSURLAuthenticationChallengeClient::create): Deleted.
2657         (WebCore::WebCoreNSURLAuthenticationChallengeClient::WebCoreNSURLAuthenticationChallengeClient): Deleted.
2658         (): Deleted.
2659         * platform/network/ProtectionSpaceBase.cpp:
2660         * platform/network/ResourceHandle.h:
2661         * platform/network/ResourceHandleInternal.h:
2662         * platform/network/cf/AuthenticationCF.cpp:
2663         (WebCore::AuthenticationChallenge::AuthenticationChallenge):
2664         (WebCore::createCF):
2665         (WebCore::core):
2666         (): Deleted.
2667         * platform/network/cf/AuthenticationCF.h:
2668         * platform/network/cf/CookieJarCFNet.cpp:
2669         (WebCore::copyCookiesForURLWithFirstPartyURL):
2670         (WebCore::createCookies):
2671         (WebCore::deleteAllCookiesModifiedSince):
2672         * platform/network/cf/CookieStorageCFNet.cpp:
2673         * platform/network/cf/CredentialStorageCFNet.cpp:
2674         (WebCore::CredentialStorage::getFromPersistentStorage):
2675         * platform/network/cf/ResourceErrorCF.cpp:
2676         (WebCore::ResourceError::setCertificate):
2677         (WebCore::ResourceError::platformLazyInit):
2678         (WebCore::ResourceError::doPlatformIsolatedCopy):
2679         (WebCore::ResourceError::cfError const):
2680         * platform/network/cf/ResourceHandleCFNet.cpp:
2681         * platform/network/cf/ResourceHandleCFURLConnectionDelegate.cpp:
2682         * platform/network/cf/ResourceHandleCFURLConnectionDelegateWithOperationQueue.cpp:
2683         (WebCore::ResourceHandleCFURLConnectionDelegateWithOperationQueue::setupRequest):
2684         (WebCore::installHookToRemoveCFNetworkMessageBlockingMainThread):
2685         (WebCore::ResourceHandleCFURLConnectionDelegateWithOperationQueue::setupConnectionScheduling):
2686         (WebCore::ResourceHandleCFURLConnectionDelegateWithOperationQueue::didReceiveResponse):
2687         (WebCore::ResourceHandleCFURLConnectionDelegateWithOperationQueue::willCacheResponse):
2688         (WebCore::ResourceHandleCFURLConnectionDelegateWithOperationQueue::canRespondToProtectionSpace):
2689         * platform/network/cocoa/CredentialCocoa.mm:
2690         (WebCore::Credential::cfCredential const): Deleted.
2691         * platform/network/cocoa/ProtectionSpaceCocoa.mm:
2692         (WebCore::ProtectionSpace::cfSpace const): Deleted.
2693         * platform/network/cocoa/ResourceRequestCocoa.mm:
2694         (WebCore::ResourceRequest::nsURLRequest const):
2695         (WebCore::ResourceRequest::clearOrUpdateNSURLRequest): Deleted.
2696         * platform/network/cocoa/ResourceResponseCocoa.mm:
2697         (WebCore::ResourceResponse::platformCertificateInfo const):
2698         (WebCore::ResourceResponse::ResourceResponse): Deleted.
2699         * platform/network/ios/ResourceHandleIOS.mm: Removed.
2700         * platform/network/mac/AuthenticationMac.mm:
2701         (WebCore::AuthenticationChallenge::authenticationClient const):
2702         (WebCore::mac):
2703         (-[WebCoreAuthenticationClientAsChallengeSender setCFChallenge:]): Deleted.
2704         (-[WebCoreAuthenticationClientAsChallengeSender cfChallenge]): Deleted.
2705         * platform/network/mac/ResourceHandleMac.mm:
2706         (WebCore::synchronousWillSendRequestEnabled):
2707         * platform/network/mac/ResourceRequestMac.mm: Removed.
2708
2709 2017-11-14  Daniel Bates  <dabates@apple.com>
2710
2711         Update comment in FeatureDefines.xcconfig to reflect location of Visual Studio property files
2712         for feature defines
2713
2714         Following r195498 and r201917 the Visual Studio property files for feature defines have
2715         moved from directory WebKitLibraries/win/tools/vsprops to directory Source/cmake/tools/vsprops.
2716         Update the comment in FeatureDefines.xcconfig to reflect the new location and names of these
2717         files.
2718
2719         * Configurations/FeatureDefines.xcconfig:
2720
2721 2017-11-14  Antti Koivisto  <antti@apple.com>
2722
2723         Remove StyleResolver::State::document()
2724         https://bugs.webkit.org/show_bug.cgi?id=179678
2725
2726         Reviewed by Antoine Quint.
2727
2728         We don't need both StyleResolver::document() and StyleResolver::State::document().
2729
2730         * css/StyleResolver.cpp:
2731         (WebCore::StyleResolver::State::updateConversionData):
2732         (WebCore::StyleResolver::resolvedVariableValue):
2733         (WebCore::StyleResolver::colorFromPrimitiveValue const):
2734         (WebCore::StyleResolver::createFilterOperations):
2735         * css/StyleResolver.h:
2736         (WebCore::StyleResolver::State::document const): Deleted.
2737
2738 2017-11-14  Dean Jackson  <dino@apple.com>
2739
2740         Stub implementations of OffscreenCanvas getContext and transferToImageBitmap
2741         https://bugs.webkit.org/show_bug.cgi?id=179671
2742         <rdar://problem/35534018>
2743
2744         Reviewed by Antoine Quint.
2745
2746         Empty implementations of getContext and transferToImageBitmap. At the moment
2747         only return a WebGLRenderingContext from getContext, since we don't
2748         have an Offscreen 2d context type yet.
2749
2750         Tests: http/wpt/offscreen-canvas/getContext-webgl.html
2751                http/wpt/offscreen-canvas/transferToImageBitmap.html
2752
2753         * html/OffscreenCanvas.cpp:
2754         (WebCore::OffscreenCanvas::getContext):
2755         (WebCore::OffscreenCanvas::transferToImageBitmap):
2756         * html/OffscreenCanvas.h:
2757         * html/OffscreenCanvas.idl:
2758         * html/canvas/GPUBasedCanvasRenderingContext.h: Drive-by parameter rename.
2759         (WebCore::GPUBasedCanvasRenderingContext::GPUBasedCanvasRenderingContext):
2760
2761 2017-11-14  Youenn Fablet  <youenn@apple.com>
2762
2763         WebSWClientConnection should do IPC to StorageProcess if its WebSWOriginTable is not yet initialized
2764         https://bugs.webkit.org/show_bug.cgi?id=179668
2765
2766         Reviewed by Chris Dumez.
2767
2768         Covered by existing updated tests.
2769
2770         Removing hasServiceWorkerRegisteredForOrigin and using hasServiceWorkerRegistration instead.
2771         The former is only checking the shared map which might not be initialized at the time the function is called.
2772         The latter is going to the StorageProcess if the map is not yet initialized.
2773
2774         * testing/Internals.cpp:
2775         (WebCore::Internals::hasServiceWorkerRegisteredForOrigin): Deleted.
2776         * testing/Internals.h:
2777         * testing/Internals.idl:
2778         * workers/service/server/SWClientConnection.h:
2779
2780 2017-11-14  Joseph Pecoraro  <pecoraro@apple.com>
2781
2782         Web Inspector: Add a ServiceWorker domain to get information about an inspected ServiceWorker
2783         https://bugs.webkit.org/show_bug.cgi?id=179640
2784         <rdar://problem/35517361>
2785
2786         Reviewed by Devin Rousso.
2787
2788         * Sources.txt:
2789         * WebCore.xcodeproj/project.pbxproj:
2790         * inspector/InspectorAllInOne.cpp:
2791         New files.
2792
2793         * inspector/WorkerInspectorController.cpp:
2794         (WebCore::WorkerInspectorController::createLazyAgents):
2795         Add a ServiceWorkerAgent when the Worker is a ServiceWorker.
2796
2797         * inspector/agents/worker/ServiceWorkerAgent.h: Added.
2798         * inspector/agents/worker/ServiceWorkerAgent.cpp: Added.
2799         (WebCore::ServiceWorkerAgent::ServiceWorkerAgent):
2800         (WebCore::ServiceWorkerAgent::didCreateFrontendAndBackend):
2801         (WebCore::ServiceWorkerAgent::willDestroyFrontendAndBackend):
2802         (WebCore::ServiceWorkerAgent::getInitializationInfo):
2803         Populate initialization info.
2804
2805 2017-11-14  Brady Eidson  <beidson@apple.com>
2806
2807         Remove some accidentally checked-in commented-out code.
2808
2809         Unreviewed.
2810
2811         * workers/service/server/SWServer.cpp:
2812         (WebCore::SWServer::fireInstallEvent):
2813         (WebCore::SWServer::fireActivateEvent):
2814
2815 2017-11-14  Alex Christensen  <achristensen@webkit.org>
2816
2817         Clean up old URL parser remnants
2818         https://bugs.webkit.org/show_bug.cgi?id=179573
2819
2820         Reviewed by Darin Adler.
2821
2822         When we transitioned to the new URLParser, we kept the old character tables which were less spec-conformant.
2823         Removing them and transitioning to URLParser's table makes more web platform tests pass!
2824
2825         * fileapi/BlobURL.cpp:
2826         (WebCore::BlobURL::createBlobURL):
2827         There's no need to percent-encode an origin.  It's already ascii, and if it's not, then the URLParser will escape it.
2828         * loader/appcache/ApplicationCacheHost.cpp:
2829         (WebCore::ApplicationCacheHost::createFileURL):
2830         Removed comment that no longer applies.
2831         * platform/URL.cpp:
2832         (WebCore::URL::setProtocol):
2833         (WebCore::percentEncodeCharacters):
2834         (WebCore::URL::setUser):
2835         (WebCore::URL::setPass):
2836         Percent encode the userinfo character set from the URLParser according to https://url.spec.whatwg.org/#set-the-username and https://url.spec.whatwg.org/#set-the-password
2837         (WebCore::URL::setPath):
2838         A ? or a # are the only two characters that need to be pre-encoded when setting the path because they indicate the
2839         beginning of a query or fragment.  All other characters will be encoded if necessary during parsing.
2840         (WebCore::protocolIsInternal):
2841         (): Deleted.
2842         (WebCore::isSchemeFirstChar): Deleted.
2843         (WebCore::isSchemeChar): Deleted.
2844         (WebCore::isBadChar): Deleted.
2845         (WebCore::isTabNewline): Deleted.
2846         (WebCore::appendEscapedChar): Deleted.
2847         (WebCore::encodeWithURLEscapeSequences):
2848         Encode characters needed.  I used the user info set of characters because that was most similar to the BadChar set of the old parser.
2849         This isn't standardized, and it's only used for the search context menu item which certainly isn't standardized.
2850         (WebCore::isValidProtocol): Deleted.
2851         Remove a bunch of old unused functions.
2852         * platform/URLParser.cpp:
2853         (WebCore::URLParser::isInUserInfoEncodeSet):
2854         (WebCore::URLParser::parseAuthority):
2855         * platform/URLParser.h:
2856         Expose a few functions for URL.cpp to use.
2857
2858 2017-11-14  Antti Koivisto  <antti@apple.com>
2859
2860         Enable display:contents by default
2861         https://bugs.webkit.org/show_bug.cgi?id=179655
2862
2863         Reviewed by Sam Weinig.
2864
2865         * page/RuntimeEnabledFeatures.h:
2866
2867 2017-11-14  Zan Dobersek  <zdobersek@igalia.com>
2868
2869         [Cairo] Move drawLine operation from GraphicsContextCairo to CairoOperations
2870         https://bugs.webkit.org/show_bug.cgi?id=179669
2871
2872         Reviewed by Carlos Garcia Campos.
2873
2874         Move the drawLine operation implementation into the CairoOperations
2875         implementation file, with the Cairo::drawLine() function only expecting
2876         a PlatformContextCairo object, two FloatingPoints, and a const reference
2877         to a GraphicsContextState object.
2878
2879         As with drawLinesForText(), the drawLine() implementation utilized a few
2880         private GraphicsContext methods that we for now reimplement in the
2881         Cairo namespace as static functions, providing necessary state values to
2882         perform the computations. The GraphicsContext methods should be changed
2883         to become static public functions -- after that we'll be able to remove
2884         the new duplicated helper functions.
2885
2886         No new tests -- no change in behavior.
2887
2888         * platform/graphics/cairo/CairoOperations.cpp:
2889         (WebCore::Cairo::dashedLineCornerWidthForStrokeWidth):
2890         (WebCore::Cairo::dashedLinePatternWidthForStrokeWidth):
2891         (WebCore::Cairo::dashedLinePatternOffsetForPatternAndStrokeWidth):
2892         (WebCore::Cairo::centerLineAndCutOffCorners):
2893         (WebCore::Cairo::drawLine):
2894         * platform/graphics/cairo/CairoOperations.h:
2895         * platform/graphics/cairo/GraphicsContextCairo.cpp:
2896         (WebCore::GraphicsContext::drawLine):
2897
2898 2017-11-14  Tim Horton  <timothy_horton@apple.com>
2899
2900         Long pressing a phone number with spaces in it results in a link sheet instead of a data detectors sheet
2901         https://bugs.webkit.org/show_bug.cgi?id=179646
2902         <rdar://problem/35337288>
2903
2904         Reviewed by Simon Fraser.
2905
2906         * editing/cocoa/DataDetection.h:
2907         * editing/cocoa/DataDetection.mm:
2908         (WebCore::DataDetection::canBePresentedByDataDetectors):
2909         (WebCore::DataDetection::isDataDetectorLink):
2910         Expose canBePresentedByDataDetectors, which tests if the URL's
2911         scheme is one of Data Detectors' known long-press schemes.
2912
2913 2017-11-14  Michael Catanzaro  <mcatanzaro@igalia.com>
2914
2915         [GTK][WPE] Don't require brotli
2916         https://bugs.webkit.org/show_bug.cgi?id=178122
2917
2918         Reviewed by Frédéric Wang.
2919
2920         Remove stray remaining use of brotli CMake variable.
2921
2922         * CMakeLists.txt:
2923
2924 2017-11-14  Zan Dobersek  <zdobersek@igalia.com>
2925
2926         [Cairo] Move drawLinesForText operation from GraphicsContextCairo to CairoOperations
2927         https://bugs.webkit.org/show_bug.cgi?id=179661
2928
2929         Reviewed by Carlos Garcia Campos.
2930
2931         Encapsulate the drawLinesForText() operation in the WebCore::Cairo
2932         namespace. Apart from moving gist of the code from GraphicsContextCairo
2933         to CairoOperations, we also (for the moment) have to duplicate the
2934         GraphicsContext::computeLineBoundsAndAntialiasingModeForText() code.
2935         This is necessary because the given method is private on the
2936         GraphicsContext class, and relies on an underlying GraphicsContext
2937         object to retrieve the current CTM and stroke thickness values.
2938
2939         The adjusted reimplementation uses PlatformContextCairo to retrieve
2940         the CTM (just like Cairo's GraphicsContext::getCTM() does), and
2941         requires the stroke thickness value to be passed in as an argument.
2942         Similar modifications will be proposed for the existing
2943         GraphicsContext::computeLineBoundsAndAntialiasingModeForText() code,
2944         and once that's approved the duplicated code will be eliminated.
2945
2946         No new tests -- no change in behavior.
2947
2948         * platform/graphics/cairo/CairoOperations.cpp:
2949         (WebCore::Cairo::computeLineBoundsAndAntialiasingModeForText):
2950         (WebCore::Cairo::drawLinesForText):
2951         * platform/graphics/cairo/CairoOperations.h:
2952         * platform/graphics/cairo/GraphicsContextCairo.cpp:
2953         (WebCore::GraphicsContext::drawLinesForText):
2954
2955 2017-11-14  Zan Dobersek  <zdobersek@igalia.com>
2956
2957         [Cairo] Move native image drawing operation to CairoOperations
2958         https://bugs.webkit.org/show_bug.cgi?id=179660
2959
2960         Reviewed by Carlos Garcia Campos.
2961
2962         Unify the native image drawing operation behavior between the
2963         Cairo-specific GraphicsContext and drawNativeImage() implementations and
2964         then move the code into the Cairo::drawNativeImage() function, inside
2965         the CairoOperations implementation file.
2966
2967         No new tests -- no change in behavior.
2968
2969         * platform/graphics/cairo/CairoOperations.cpp:
2970         (WebCore::Cairo::cairoSurfaceHasAlpha):
2971         (WebCore::Cairo::drawNativeImage):
2972         * platform/graphics/cairo/CairoOperations.h:
2973         * platform/graphics/cairo/GraphicsContextCairo.cpp:
2974         (WebCore::GraphicsContext::drawNativeImage):
2975         * platform/graphics/cairo/NativeImageCairo.cpp:
2976         (WebCore::drawNativeImage):
2977
2978 2017-11-14  Zan Dobersek  <zdobersek@igalia.com>
2979
2980         [Cairo] Perform GraphicsContextPlatformPrivate method calls from CairoOperations
2981         https://bugs.webkit.org/show_bug.cgi?id=179657
2982
2983         Reviewed by Carlos Garcia Campos.
2984
2985         To enable encapsulating remaining Cairo operations in static functions
2986         inside the WebCore::Cairo namespace, we have to work around the
2987         GraphicsContextPlatformPrivate methods that are invoked in the current
2988         GraphicsContext implementation for Cairo.
2989
2990         A pointer to the GraphicsContextPlatformPrivate object is now kept on
2991         the PlatformContextCairo instance, and we take care of setting it up
2992         and clearing it out appropriate to the GraphicsContextPlatformPrivate
2993         lifetime (as managed in Cairo-specific GraphicsContext implementation).
2994         The GraphicsContextPlatformPrivate method invocations are then moved
2995         to the appropriate CairoOperations functions.
2996
2997         No new tests -- no change in behavior.
2998
2999         * platform/graphics/cairo/CairoOperations.cpp:
3000         (WebCore::Cairo::State::setCTM):
3001         (WebCore::Cairo::save):
3002         (WebCore::Cairo::restore):
3003         (WebCore::Cairo::translate):
3004         (WebCore::Cairo::rotate):
3005         (WebCore::Cairo::scale):
3006         (WebCore::Cairo::concatCTM):
3007         (WebCore::Cairo::clip):
3008         (WebCore::Cairo::clipPath):
3009         * platform/graphics/cairo/GraphicsContextCairo.cpp:
3010         (WebCore::GraphicsContext::GraphicsContext):
3011         (WebCore::GraphicsContext::platformInit):
3012         (WebCore::GraphicsContext::platformDestroy):
3013         (WebCore::GraphicsContext::savePlatformState):
3014         (WebCore::GraphicsContext::restorePlatformState):
3015         (WebCore::GraphicsContext::clip):
3016         (WebCore::GraphicsContext::clipPath):
3017         (WebCore::GraphicsContext::translate):
3018         (WebCore::GraphicsContext::concatCTM):
3019         (WebCore::GraphicsContext::setCTM):
3020         (WebCore::GraphicsContext::rotate):
3021         (WebCore::GraphicsContext::scale):
3022         * platform/graphics/cairo/PlatformContextCairo.h:
3023         (WebCore::PlatformContextCairo::graphicsContextPrivate):
3024         (WebCore::PlatformContextCairo::setGraphicsContextPrivate):
3025
3026 2017-11-14  Zan Dobersek  <zdobersek@igalia.com>
3027
3028         [Cairo] Move simpler draw operations from GraphicsContextCairo to CairoOperations
3029         https://bugs.webkit.org/show_bug.cgi?id=179614
3030
3031         Reviewed by Carlos Garcia Campos.
3032
3033         Move operations that perform simpler drawing to the CairoOperations
3034         file. This isolates the Cairo code and encapsulates operation work
3035         into a limited scope. This patch only covers drawing patterns,
3036         rectangles, document marker lines and ellipses. A missing forward
3037         declaration for the drawGlyphs() function is also added in the
3038         CairoOperations header.
3039
3040         No new tests -- no change in behavior.
3041
3042         * platform/graphics/cairo/CairoOperations.cpp:
3043         (WebCore::Cairo::drawPattern):
3044         (WebCore::Cairo::drawRect):
3045         (WebCore::Cairo::drawLineForDocumentMarker):
3046         (WebCore::Cairo::drawEllipse):
3047         * platform/graphics/cairo/CairoOperations.h:
3048         * platform/graphics/cairo/GraphicsContextCairo.cpp:
3049         (WebCore::GraphicsContext::drawRect):
3050         (WebCore::GraphicsContext::drawEllipse):
3051         (WebCore::GraphicsContext::drawLineForDocumentMarker):
3052         (WebCore::GraphicsContext::drawPattern):
3053
3054 2017-11-13  Joseph Pecoraro  <pecoraro@apple.com>
3055
3056         Give a ServiceWorker WebContentProcess a different display name
3057         https://bugs.webkit.org/show_bug.cgi?id=179653
3058
3059         Reviewed by Brady Eidson.
3060
3061         * English.lproj/Localizable.strings:
3062
3063 2017-11-13  Chris Dumez  <cdumez@apple.com>
3064
3065         Send ServiceWorkerData structs to the WebProcesses instead of ServiceWorkerIdentifiers
3066         https://bugs.webkit.org/show_bug.cgi?id=179649
3067
3068         Reviewed by Brady Eidson.
3069
3070         Send ServiceWorkerData structs to the WebProcesses instead of ServiceWorkerIdentifiers so that the
3071         WebProcesses can correctly construct ServiceWorker objects, with the right attributes / state.
3072
3073         No new tests, rebaselined existing tests.
3074
3075         * Sources.txt:
3076         * WebCore.xcodeproj/project.pbxproj:
3077         * workers/service/ServiceWorker.cpp:
3078         (WebCore::ServiceWorker::getOrCreate):
3079         (WebCore::ServiceWorker::ServiceWorker):
3080         (WebCore::ServiceWorker::~ServiceWorker):
3081         (WebCore::ServiceWorker::scheduleTaskToUpdateState):
3082         (WebCore::ServiceWorker::postMessage):
3083         * workers/service/ServiceWorker.h:
3084         * workers/service/ServiceWorkerContainer.cpp:
3085         (WebCore::ServiceWorkerContainer::scheduleTaskToUpdateRegistrationState):
3086         * workers/service/ServiceWorkerContainer.h:
3087         * workers/service/ServiceWorkerData.cpp: Copied from Source/WebCore/workers/service/ServiceWorkerRegistrationData.cpp.
3088         (WebCore::ServiceWorkerData::isolatedCopy const):
3089         * workers/service/ServiceWorkerData.h: Copied from Source/WebCore/workers/service/server/SWServerWorker.cpp.
3090         (WebCore::ServiceWorkerData::encode const):
3091         (WebCore::ServiceWorkerData::decode):
3092         * workers/service/ServiceWorkerRegistration.cpp:
3093         (WebCore::ServiceWorkerRegistration::ServiceWorkerRegistration):
3094         (WebCore::ServiceWorkerRegistration::updateStateFromServer):
3095         * workers/service/ServiceWorkerRegistration.h:
3096         * workers/service/ServiceWorkerRegistrationData.cpp:
3097         (WebCore::ServiceWorkerRegistrationData::isolatedCopy const):
3098         * workers/service/ServiceWorkerRegistrationData.h:
3099         (WebCore::ServiceWorkerRegistrationData::encode const):
3100         (WebCore::ServiceWorkerRegistrationData::decode):
3101         * workers/service/server/SWClientConnection.cpp:
3102         (WebCore::SWClientConnection::postMessageToServiceWorkerClient):
3103         (WebCore::SWClientConnection::updateRegistrationState):
3104         * workers/service/server/SWClientConnection.h:
3105         * workers/service/server/SWServer.h:
3106         * workers/service/server/SWServerRegistration.cpp:
3107         (WebCore::SWServerRegistration::updateRegistrationState):
3108         (WebCore::SWServerRegistration::data const):
3109         * workers/service/server/SWServerWorker.cpp:
3110         (WebCore::SWServerWorker::SWServerWorker):
3111         (WebCore::m_script):
3112         * workers/service/server/SWServerWorker.h:
3113         (WebCore::SWServerWorker::scriptURL const):
3114         (WebCore::SWServerWorker::type const):
3115         (WebCore::SWServerWorker::identifier const):
3116         (WebCore::SWServerWorker::state const):
3117         (WebCore::SWServerWorker::setState):
3118         (WebCore::SWServerWorker::data const):
3119
3120 2017-11-13  Ryosuke Niwa  <rniwa@webkit.org>
3121
3122         iOS: Enable release asserts in updateStyleIfNeeded() and updateLayout() for WebKit2
3123         https://bugs.webkit.org/show_bug.cgi?id=179651
3124
3125         Reviewed by Antti Koivisto.
3126
3127         r224604 disabled the release assertions on iOS entirely even though the underlying bug only affected iOS WebKit1 port
3128         due to various time constraints. Enable them back on iOS WebKit2 port.
3129
3130         * dom/Document.cpp:
3131         (WebCore::isSafeToUpdateStyleOrLayout):
3132         (WebCore::Document::updateStyleIfNeeded):
3133         (WebCore::Document::updateLayout):
3134
3135 2017-11-13  Brady Eidson  <beidson@apple.com>
3136
3137         Massive "Server-process-to-context-process" connection overhaul.
3138         https://bugs.webkit.org/show_bug.cgi?id=179554
3139
3140         Reviewed by Chris Dumez.
3141
3142         No new tests (Refactor, no behavior change).
3143
3144         Having the SWServer::Connection object be overloaded to mean both client->server and server->context 
3145         was the wrong design and was starting to crumble under its own weight.
3146
3147         So this patch introduces a SWServerToContextConnection to manage the StorageProcess-side of connections
3148         to context processes.
3149
3150         Any message that is specifically about the connection between the StorageProcess and context process
3151         should use this connection going forward.
3152
3153         Right now there is only one context process, but this design keeps us ready for that to change.
3154
3155         This patch also gets rid of a lot of "server connection identifier" integers being passed amongst processes
3156         that were actually pointless.
3157
3158         This patch is also a prerequisite for many things that are coming up soon, such as termination.
3159
3160         * Sources.txt:
3161         * WebCore.xcodeproj/project.pbxproj:
3162
3163         * workers/service/ServiceWorkerContextData.cpp:
3164         (WebCore::ServiceWorkerContextData::isolatedCopy const):
3165         * workers/service/ServiceWorkerContextData.h:
3166         (WebCore::ServiceWorkerContextData::encode const):
3167         (WebCore::ServiceWorkerContextData::decode):
3168
3169         * workers/service/ServiceWorkerGlobalScope.cpp:
3170         (WebCore::ServiceWorkerGlobalScope::ServiceWorkerGlobalScope):
3171         * workers/service/ServiceWorkerGlobalScope.h:
3172         (WebCore::ServiceWorkerGlobalScope::serverConnectionIdentifier const): Deleted.
3173
3174         * workers/service/ServiceWorkerTypes.h:
3175
3176         * workers/service/context/ServiceWorkerThread.cpp:
3177         (WebCore::ServiceWorkerThread::ServiceWorkerThread):
3178         (WebCore::ServiceWorkerThread::createWorkerGlobalScope):
3179         * workers/service/context/ServiceWorkerThread.h:
3180         (WebCore::ServiceWorkerThread::serverConnectionIdentifier const): Deleted.
3181
3182         * workers/service/context/ServiceWorkerThreadProxy.cpp:
3183         (WebCore::ServiceWorkerThreadProxy::ServiceWorkerThreadProxy):
3184         (WebCore::ServiceWorkerThreadProxy::create): Deleted.
3185         * workers/service/context/ServiceWorkerThreadProxy.h:
3186
3187         * workers/service/server/SWServer.cpp:
3188         (WebCore::generateServiceWorkerIdentifier):
3189         (WebCore::SWServer::~SWServer):
3190         (WebCore::SWServer::SWServer):
3191         (WebCore::SWServer::scriptContextFailedToStart):
3192         (WebCore::SWServer::scriptContextStarted):
3193         (WebCore::SWServer::didFinishInstall):
3194         (WebCore::SWServer::didFinishActivation):
3195         (WebCore::SWServer::didResolveRegistrationPromise):
3196         (WebCore::SWServer::updateWorker):
3197         (WebCore::SWServer::serverToContextConnectionCreated):
3198         (WebCore::SWServer::installContextData):
3199         (WebCore::SWServer::fireInstallEvent):
3200         (WebCore::SWServer::fireActivateEvent):
3201         (WebCore::SWServer::Connection::didFinishInstall): Deleted.
3202         (WebCore::SWServer::Connection::didFinishActivation): Deleted.
3203         (WebCore::SWServer::Connection::setServiceWorkerHasPendingEvents): Deleted.
3204         (WebCore::SWServer::Connection::scriptContextFailedToStart): Deleted.
3205         (WebCore::SWServer::Connection::scriptContextStarted): Deleted.
3206         (WebCore::SWServer::setServiceWorkerHasPendingEvents): Deleted.
3207         * workers/service/server/SWServer.h:
3208
3209         * workers/service/server/SWServerJobQueue.cpp:
3210         (WebCore::SWServerJobQueue::scriptContextFailedToStart):
3211         (WebCore::SWServerJobQueue::scriptContextStarted):
3212         (WebCore::SWServerJobQueue::install):
3213         (WebCore::SWServerJobQueue::didResolveRegistrationPromise):
3214         (WebCore::SWServerJobQueue::didFinishInstall):
3215         (WebCore::SWServerJobQueue::tryActivate):
3216         (WebCore::SWServerJobQueue::activate):
3217         * workers/service/server/SWServerJobQueue.h:
3218
3219         * workers/service/server/SWServerRegistration.cpp:
3220         (WebCore::generateServiceWorkerRegistrationIdentifier):
3221
3222         * workers/service/server/SWServerToContextConnection.cpp: Added.
3223         (WebCore::generateServerToContextConnectionIdentifier):
3224         (WebCore::SWServerToContextConnection::SWServerToContextConnection):
3225         (WebCore::SWServerToContextConnection::~SWServerToContextConnection):
3226         (WebCore::SWServerToContextConnection::connectionForIdentifier):
3227         (WebCore::SWServerToContextConnection::globalServerToContextConnection):
3228         (WebCore::SWServerToContextConnection::scriptContextFailedToStart):
3229         (WebCore::SWServerToContextConnection::scriptContextStarted):
3230         (WebCore::SWServerToContextConnection::didFinishInstall):
3231         (WebCore::SWServerToContextConnection::didFinishActivation):
3232         (WebCore::SWServerToContextConnection::setServiceWorkerHasPendingEvents):
3233         * workers/service/server/SWServerToContextConnection.h: Copied from Source/WebCore/workers/service/server/SWServerWorker.h.
3234         (WebCore::SWServerToContextConnection::identifier const):
3235
3236         * workers/service/server/SWServerWorker.cpp:
3237         (WebCore::SWServerWorker::existingWorkerForIdentifier):
3238         (WebCore::SWServerWorker::SWServerWorker):
3239         (WebCore::SWServerWorker::~SWServerWorker):
3240         (WebCore::SWServerWorker::scriptContextFailedToStart):
3241         (WebCore::SWServerWorker::scriptContextStarted):
3242         (WebCore::SWServerWorker::didFinishInstall):
3243         (WebCore::SWServerWorker::didFinishActivation):
3244         * workers/service/server/SWServerWorker.h:
3245         (WebCore::SWServerWorker::create):
3246         (WebCore::SWServerWorker::registrationKey const):
3247         (WebCore::SWServerWorker::contextConnectionIdentifier const):
3248
3249 2017-11-13  Don Olmstead  <don.olmstead@sony.com>
3250
3251         Unreviewed build fix after r224791.
3252
3253         * platform/network/NetworkStorageSessionStub.cpp:
3254         (WebCore::NetworkStorageSession::ensurePrivateBrowsingSession): Deleted.
3255
3256 2017-11-13  Simon Fraser  <simon.fraser@apple.com>
3257
3258         Minor DisplayRefreshMonitor-related cleanup
3259         https://bugs.webkit.org/show_bug.cgi?id=179648
3260
3261         Reviewed by Alex Christensen.
3262
3263         Use more "#pragma once" and C++ initializers.
3264
3265         Make more member functions of DisplayRefreshMonitor protected.
3266
3267         Improve the ordering of member variables.
3268
3269         Don't mix member variables and member functions in the declaration of ScriptedAnimationController.
3270
3271         * dom/ScriptedAnimationController.h:
3272         * platform/graphics/DisplayRefreshMonitor.cpp:
3273         (WebCore::DisplayRefreshMonitor::DisplayRefreshMonitor):
3274         (WebCore::DisplayRefreshMonitor::displayDidRefresh):
3275         * platform/graphics/DisplayRefreshMonitor.h:
3276         (WebCore::DisplayRefreshMonitor::mutex):
3277         * platform/graphics/DisplayRefreshMonitorManager.h:
3278         * platform/graphics/mac/DisplayRefreshMonitorMac.cpp:
3279         (WebCore::DisplayRefreshMonitorMac::DisplayRefreshMonitorMac):
3280         * platform/graphics/mac/DisplayRefreshMonitorMac.h:
3281
3282 2017-11-13  Simon Fraser  <simon.fraser@apple.com>
3283
3284         When navigating back to a page, compositing layers may not use accelerated drawing
3285         https://bugs.webkit.org/show_bug.cgi?id=178749
3286         rdar://problem/35158946
3287
3288         Reviewed by Dean Jackson.
3289
3290         There were two issues with setting GraphicsLayerCA's "acceleratesDrawing" state which
3291         occurred on back navigation, related to the ordering of style recalcs and layout.
3292
3293         First, at style recalc time, we created a RenderLayerCompositor but hadn't yet called
3294         its cacheAcceleratedCompositingFlags(), so any layers created during style update
3295         didn't get accelerated drawing. Fix by making cacheAcceleratedCompositingFlags() internal
3296         to RenderLayerCompositor and calling it from willRecalcStyle() and updateCompositingLayers().
3297
3298         We have to be careful to avoid m_forceCompositingMode flip-flopping between cacheAcceleratedCompositingFlags()
3299         and cacheAcceleratedCompositingFlagsAfterLayout(), since, for subframes, it depends on layout.
3300
3301         Secondly, GraphicsLayerCA::commitLayerChangesBeforeSublayers() needs to updateAcceleratesDrawing()
3302         before updating tiles, so that new tiles fetch the right acceleratesDrawing state from
3303         the TileController.
3304
3305         Test: compositing/accelerated-layers-after-back.html
3306
3307         * page/FrameView.cpp:
3308         (WebCore::FrameView::updateCompositingLayersAfterLayout):
3309         * platform/graphics/ca/GraphicsLayerCA.cpp:
3310         (WebCore::GraphicsLayerCA::commitLayerChangesBeforeSublayers):
3311         * rendering/RenderLayerCompositor.cpp:
3312         (WebCore::RenderLayerCompositor::willRecalcStyle):
3313         (WebCore::RenderLayerCompositor::didRecalcStyleWithNoPendingLayout):
3314         (WebCore::RenderLayerCompositor::updateCompositingLayers):
3315         * rendering/RenderLayerCompositor.h:
3316
3317 2017-11-13  Youenn Fablet  <youenn@apple.com>
3318
3319         matchRegistration does not need to go to StorageProcess if no service worker is registered
3320         https://bugs.webkit.org/show_bug.cgi?id=179480
3321
3322         Reviewed by Chris Dumez.
3323
3324         Covered by existing tests.
3325
3326         Moving the origin store in SWServer since they share the same session ID.
3327         This allows updating the origin store based on each registration map update.
3328         This also allows clearing the origin store when clearing the SWServer.
3329
3330         * Sources.txt:
3331         * WebCore.xcodeproj/project.pbxproj:
3332         * workers/service/server/SWOriginStore.cpp: Added.
3333         (WebCore::SWOriginStore::add):
3334         (WebCore::SWOriginStore::remove):
3335         (WebCore::SWOriginStore::clear):
3336         (WebCore::SWOriginStore::clearAll):
3337         * workers/service/server/SWOriginStore.h: Added.
3338         * workers/service/server/SWServer.cpp:
3339         (WebCore::SWServer::addRegistration):
3340         (WebCore::SWServer::removeRegistration):
3341         (WebCore::SWServer::OriginStore::add):
3342         (WebCore::SWServer::OriginStore::remove):
3343         (WebCore::SWServer::OriginStore::clear):
3344         (WebCore::SWServer::OriginStore::clearAll):
3345         (WebCore::SWServer::clearAll):
3346         (WebCore::SWServer::clear):
3347         (WebCore::SWServer::SWServer):
3348         * workers/service/server/SWServer.h:
3349         (WebCore::SWServer::originStore):
3350
3351 2017-11-13  Alex Christensen  <achristensen@webkit.org>
3352
3353         Merge NetworkProcess::EnsurePrivateBrowsingSession and NetworkProcess::AddWebsiteDataStore into one message type
3354         https://bugs.webkit.org/show_bug.cgi?id=178751
3355
3356         Reviewed by Brady Eidson.
3357
3358         The creation of private browsing sessions and persistent browsing sessions has evolved to be the same thing
3359         with differences in parameters, like no sandbox extensions or paths to persistent storage locations for private browsing.
3360         These should be united to simplify future development of WebsiteDataStore construction.
3361
3362         * platform/network/NetworkStorageSession.h:
3363         * platform/network/cf/NetworkStorageSessionCFNet.cpp:
3364         (WebCore::NetworkStorageSession::ensurePrivateBrowsingSession): Deleted.
3365         * platform/network/soup/NetworkStorageSessionSoup.cpp:
3366         (WebCore::NetworkStorageSession::ensureSession):
3367         (WebCore::NetworkStorageSession::ensurePrivateBrowsingSession): Deleted.
3368
3369 2017-11-07  Brian Burg  <bburg@apple.com>
3370
3371         Web Automation: inViewCenterPoint should not include topContentInset when computed in viewport coordinates
3372         https://bugs.webkit.org/show_bug.cgi?id=179129
3373         <rdar://problem/35297038>
3374
3375         Reviewed by Simon Fraser.
3376
3377         Add or export some helpers needed to compute element layout for WebDriver.
3378
3379         * dom/Element.h: Export the non-DOM version of getClientBounds().
3380         * page/FrameView.h:
3381         * page/FrameView.cpp:
3382         (WebCore::FrameView::clientToDocumentRect const):
3383         Added. This does the same thing as clientToDocumentPoint. Export it, too.
3384
3385 2017-11-13  Joseph Pecoraro  <pecoraro@apple.com>
3386
3387         Web Inspector: Include a NetworkAgent in ServiceWorkers for network debugging
3388         https://bugs.webkit.org/show_bug.cgi?id=179513
3389         <rdar://problem/35456402>
3390
3391         Reviewed by Brian Burg.
3392
3393         In order to show Network requests for a ServiceWorker, we need to add
3394         inspector networking hooks for Worker loads. While we show Network
3395         requests for DedicatedWorkers, we do that through the Page during Page
3396         inspection. In ServiceWorker inspection, the remote connection is
3397         connected to the ServiceWorkerThreadProxy, and interacts with the
3398         WorkerGlobalScope without making any assumptions about a Page existing.
3399         We don't want to make any assumptions about a Page/Document being needed
3400         for Network hooks, so we should add new hooks that will work in the
3401         WorkerGlobalScope's context.
3402
3403         This patch adds InspectorInstrumentation networking hooks for workers inside
3404         of the WorkerThreadableLoader bridge. This is where the majority of Worker
3405         initiated network requests happen (Fetch/XHR, but not WebSockets). The hooks
3406         are simpler versions of the existing network hooks for a Page, and allow for
3407         complete inspector networking information (will send, did receive response,
3408         did receive data, success, failure, and timing metrics).
3409
3410         This patch generalizes InspectorNetworkAgent to work for a Page and Worker.
3411         Some of the existing functionality was specific to a Page (frameId/loaderId)
3412         but did not make sense for a Worker. In order to handle these cases, all
3413         of the unique logic was extracted out into virtual methods that subclasses
3414         PageNetworkAgent and WorkerNetworkAgent provide as appropriate. The majority
3415         of NetworkAgent remains unchanged and algorithms are shared.
3416
3417         We needed to change the existing InspectorInstrumentation networking hooks
3418         to allow for an optional DocumentLoader. This way we can keep all of the
3419         same hooks leading inside of NetworkAgent, but loads for a Page will have a
3420         DocumentLoader, and loads for a ServiceWorker will not.
3421
3422         While the WorkerNetworkAgent would work for a DedicatedWorker, we still
3423         only create it for a ServiceWorker. The existing behavior of showing Network
3424         loads for a DedicatedWorker will continue to go through the Page inspector
3425         so we can avoid creating a NetworkAgent for DedicatedWorkers. If we created
3426         a way to directly inspect a DedicatedWorker we could look at making this
3427         always available, but it would require extra work to function perfectly.
3428
3429         * Sources.txt:
3430         * WebCore.xcodeproj/project.pbxproj:
3431         * inspector/InspectorAllInOne.cpp:
3432         Add new files.
3433
3434         * inspector/InspectorController.cpp:
3435         (WebCore::InspectorController::InspectorController):
3436         (WebCore::InspectorController::createLazyAgents):
3437         Switch from InspectorNetworkAgent to PageNetworkAgent.
3438
3439         * inspector/WorkerInspectorController.h:
3440         * inspector/WorkerInspectorController.cpp:
3441         (WebCore::WorkerInspectorController::WorkerInspectorController):
3442         (WebCore::WorkerInspectorController::workerAgentContext):
3443         (WebCore::WorkerInspectorController::createLazyAgents):
3444         Create a WorkerNetworkAgent when inside of a ServiceWorker.
3445         Also start the lazy agent pattern for agents that can defer
3446         creation until a frontend attached.
3447
3448         (WebCore::WorkerInspectorController::connectFrontend):
3449         (WebCore::WorkerInspectorController::disconnectFrontend):
3450         When frontends connect/disconnect toggle the necessary states.
3451         Also start the execution stopwatch, otherwise it will always be at 0.
3452
3453         * inspector/InspectorInstrumentation.cpp:
3454         (WebCore::InspectorInstrumentation::willSendRequestImpl):
3455         (WebCore::InspectorInstrumentation::willSendRequestOfTypeImpl):
3456         (WebCore::InspectorInstrumentation::didLoadResourceFromMemoryCacheImpl):
3457         (WebCore::InspectorInstrumentation::didReceiveResourceResponseImpl):
3458         (WebCore::InspectorInstrumentation::didFinishLoadingImpl):
3459         (WebCore::InspectorInstrumentation::didFailLoadingImpl):
3460         (WebCore::InspectorInstrumentation::frameDetachedFromParentImpl):
3461         * inspector/InspectorInstrumentation.h:
3462         (WebCore::InspectorInstrumentation::willSendRequest):
3463         (WebCore::InspectorInstrumentation::didReceiveResourceResponse):
3464         (WebCore::InspectorInstrumentation::didReceiveData):
3465         (WebCore::InspectorInstrumentation::didFinishLoading):
3466         (WebCore::InspectorInstrumentation::didFailLoading):
3467         Add Worker networking hooks that pass through to the same general hooks.
3468
3469         * loader/WorkerThreadableLoader.cpp:
3470         (WebCore::WorkerThreadableLoader::MainThreadBridge::MainThreadBridge):
3471         (WebCore::WorkerThreadableLoader::MainThreadBridge::didReceiveResponse):
3472         (WebCore::WorkerThreadableLoader::MainThreadBridge::didReceiveData):
3473         (WebCore::WorkerThreadableLoader::MainThreadBridge::didFinishLoading):
3474         (WebCore::WorkerThreadableLoader::MainThreadBridge::didFail):
3475         (WebCore::WorkerThreadableLoader::MainThreadBridge::didFinishTiming):
3476         * loader/WorkerThreadableLoader.h:
3477         Use the new worker networking instrumentation hooks.
3478
3479         * loader/ThreadableLoader.cpp:
3480         (WebCore::ThreadableLoader::create):
3481         Drive-by: use a move.
3482
3483         * inspector/agents/InspectorNetworkAgent.h:
3484         * inspector/agents/InspectorNetworkAgent.cpp:
3485         (WebCore::InspectorNetworkAgent::InspectorNetworkAgent):
3486         (WebCore::InspectorNetworkAgent::willSendRequest):
3487         (WebCore::InspectorNetworkAgent::willSendRequestOfType):
3488         (WebCore::InspectorNetworkAgent::didReceiveResponse):
3489         (WebCore::InspectorNetworkAgent::didFinishLoading):
3490         (WebCore::InspectorNetworkAgent::didFailLoading):
3491         (WebCore::InspectorNetworkAgent::didLoadResourceFromMemoryCache):
3492         (WebCore::InspectorNetworkAgent::buildInitiatorObject):
3493         (WebCore::InspectorNetworkAgent::enable):
3494         (WebCore::InspectorNetworkAgent::disable):
3495         (WebCore::InspectorNetworkAgent::setResourceCachingDisabled):
3496         (WebCore::InspectorNetworkAgent::loadResource):
3497         (WebCore::InspectorNetworkAgent::webSocketForRequestId):
3498         (WebCore::InspectorNetworkAgent::resolveWebSocket):
3499         (WebCore::InspectorNetworkAgent::mainFrameNavigated):
3500         Extract logic for subclasses. Transition to DocumentLoader being null.
3501
3502         * inspector/agents/page/PageNetworkAgent.h:
3503         * inspector/agents/page/PageNetworkAgent.cpp: Added.
3504         (WebCore::PageNetworkAgent::PageNetworkAgent):
3505         (WebCore::PageNetworkAgent::loaderIdentifier):
3506         (WebCore::PageNetworkAgent::frameIdentifier):
3507         (WebCore::PageNetworkAgent::setResourceCachingDisabled):
3508         (WebCore::PageNetworkAgent::scriptExecutionContext):
3509         Extracted Page implementation. This is just moving from the original.
3510
3511         * inspector/agents/worker/WorkerNetworkAgent.h:
3512         * inspector/agents/worker/WorkerNetworkAgent.cpp:
3513         (WebCore::WorkerNetworkAgent::WorkerNetworkAgent):
3514         (WebCore::WorkerNetworkAgent::loaderIdentifier):
3515         (WebCore::WorkerNetworkAgent::frameIdentifier):
3516         (WebCore::WorkerNetworkAgent::setResourceCachingDisabled):
3517         (WebCore::WorkerNetworkAgent::scriptExecutionContext):
3518         Implement for a worker.
3519         
3520         * inspector/agents/worker/WorkerDebuggerAgent.cpp:
3521         (WebCore::WorkerDebuggerAgent::WorkerDebuggerAgent):
3522         * inspector/agents/worker/WorkerConsoleAgent.cpp:
3523         (WebCore::WorkerConsoleAgent::WorkerConsoleAgent):
3524         * inspector/agents/worker/WorkerRuntimeAgent.cpp:
3525         (WebCore::WorkerRuntimeAgent::WorkerRuntimeAgent):
3526         Add some assertions for all Worker agents for clarify.
3527
3528         * workers/WorkerDebuggerProxy.h:
3529         * workers/WorkerGlobalScope.h:
3530         (WebCore::WorkerGlobalScope::identifier const):
3531         (WebCore::WorkerGlobalScope::createUniqueIdentifier):
3532         Provide a way to get unique identifiers in a worker. For the Page
3533         this is done through the Page's ProgressTracker. For a Worker we just
3534         put this on the WorkerGlobalScope. This is used for request ids.
3535
3536         * workers/WorkerMessagingProxy.h:
3537         * workers/WorkerMessagingProxy.cpp:
3538         (WebCore::WorkerMessagingProxy::setResourceCachingDisabled):
3539         * workers/service/context/ServiceWorkerThreadProxy.h:
3540         * workers/service/context/ServiceWorkerThreadProxy.cpp:
3541         (WebCore::ServiceWorkerThreadProxy::setResourceCachingDisabled):
3542         Add a debug method for disabling the resource cache from a worker.
3543         In service workers this sets the override flag on the hidden page.
3544
3545 2017-11-08  Keith Miller  <keith_miller@apple.com>
3546
3547         Async iteration should only fetch the next method once and add feature flag
3548         https://bugs.webkit.org/show_bug.cgi?id=179451
3549
3550         Reviewed by Geoffrey Garen.
3551
3552         Add feature flag for Async iteration.
3553
3554         * Configurations/FeatureDefines.xcconfig:
3555
3556 2017-11-13  Alex Christensen  <achristensen@webkit.org>
3557
3558         Call willPerformHTTPRedirection on WebCoreNSURLSession's delegate
3559         https://bugs.webkit.org/show_bug.cgi?id=179539
3560
3561         Reviewed by Jer Noble.
3562
3563         This is now possible!
3564         This will allow AVFoundation to fix redirect-related bugs.
3565
3566         * platform/network/cocoa/WebCoreNSURLSession.mm:
3567         (-[WebCoreNSURLSession addDelegateOperation:]):
3568         (-[WebCoreNSURLSession resetWithCompletionHandler:]):
3569         (-[WebCoreNSURLSession flushWithCompletionHandler:]):
3570         (WebCore::WebCoreNSURLSessionDataTaskClient::redirectReceived):
3571         (-[WebCoreNSURLSessionDataTask resource:shouldCacheResponse:]):
3572         (-[WebCoreNSURLSessionDataTask resource:receivedData:length:]):
3573         (-[WebCoreNSURLSessionDataTask resource:receivedRedirect:request:completionHandler:]):
3574         (-[WebCoreNSURLSessionDataTask resource:receivedRedirect:request:]): Deleted.
3575
3576 2017-11-13  Chris Dumez  <cdumez@apple.com>
3577
3578         Add some more assertions in SWServerJobQueue
3579         https://bugs.webkit.org/show_bug.cgi?id=179626
3580
3581         Reviewed by Alex Christensen.
3582
3583         Add some more assertions in SWServerJobQueue for extra safety.
3584
3585         * workers/service/server/SWServerJobQueue.cpp:
3586         (WebCore::SWServerJobQueue::didResolveRegistrationPromise):
3587         (WebCore::SWServerJobQueue::didFinishInstall):
3588
3589 2017-11-13  Per Arne Vollan  <pvollan@apple.com>
3590
3591         The css properties stroke-width/stroke-color and -webkit-text-stroke-width/-webkit-text-stroke-color should not be mixed.
3592         https://bugs.webkit.org/show_bug.cgi?id=174737
3593
3594         Reviewed by Antti Koivisto.
3595
3596         Previously, the stroke width and stroke color would independently fall back to the -webkit-text-stroke-width and
3597         -webkit-text-stroke-color values if stroke-width and/or stroke-color were not explicitly specified. This is
3598         problematic, since we might end up mixing the new stroke properties with the legacy Webkit stroke properties.
3599         The new strategy is to use the stroke-width and stroke-color value combination only if stroke-color has been
3600         explicitly specified. This should work well, since there will be no visible stroke when specifying only
3601         stroke-width (because stroke-color by default is transparent). We can then safely fall back to the legacy Webkit
3602         stroke value combination. In the case where only stroke-color is specified, we should use the stroke-width/
3603         stroke-color combination, since stroke-width by default is 1, and we will then have a visible stroke. 
3604
3605         No new tests, existing tests have been updated to reflect behavior changes.
3606
3607         * rendering/TextDecorationPainter.cpp:
3608         (WebCore::decorationColor):
3609         * rendering/TextPaintStyle.cpp:
3610         (WebCore::computeTextPaintStyle):
3611         (WebCore::computeTextSelectionPaintStyle):
3612         * rendering/style/RenderStyle.cpp:
3613         (WebCore::RenderStyle::computedStrokeWidth const):
3614         (WebCore::RenderStyle::hasPositiveStrokeWidth const):
3615         (WebCore::RenderStyle::computedStrokeColor const):
3616         * rendering/style/RenderStyle.h:
3617
3618 2017-11-13  Gabriel Ivascu  <givascu@igalia.com>
3619
3620         [GTK] Automatically adjust font size when gtk-xft-dpi changes
3621         https://bugs.webkit.org/show_bug.cgi?id=142673
3622
3623         Reviewed by Michael Catanzaro.
3624
3625         * platform/PlatformScreen.h:
3626         * platform/gtk/PlatformScreenGtk.cpp:
3627         (WebCore::gtkXftDPIChangedCallback):
3628         (WebCore::setScreenDPIObserverHandler):
3629         * platform/wpe/PlatformScreenWPE.cpp:
3630         (WebCore::setScreenDPIObserverHandler):
3631
3632 2017-11-13  Commit Queue  <commit-queue@webkit.org>
3633
3634         Unreviewed, rolling out r224763.
3635         https://bugs.webkit.org/show_bug.cgi?id=179632
3636
3637         test fails on iOS (Requested by alexchristensen on #webkit).
3638
3639         Reverted changeset:
3640
3641         "Add tests to ensure that <source> tags are only preloaded
3642         when the `type`"
3643         https://bugs.webkit.org/show_bug.cgi?id=179231
3644         https://trac.webkit.org/changeset/224763
3645
3646 2017-11-13  Antti Koivisto  <antti@apple.com>
3647
3648         Don't eliminate whitespace renderer if the previous sibling is a text renderer
3649         https://bugs.webkit.org/show_bug.cgi?id=179620
3650
3651         Reviewed by Zalan Bujtas.
3652
3653         Currently whitespace elimination code doesn't consider runs of text renderers. We should always make whitespace
3654         renderer if the previous renderer is a text renderer. The behavior should be the same as if those were a single
3655         renderer with merged text. This situation can happen easily with display:contents.
3656
3657         This fixes the remaining flexbox failures in display:contents tests.
3658
3659         * style/RenderTreeUpdater.cpp:
3660         (WebCore::RenderTreeUpdater::textRendererIsNeeded):
3661
3662         We need a renderer if the previous rendere is RenderText.
3663
3664 2017-11-13  Chris Dumez  <cdumez@apple.com>
3665
3666         Implement "Service Worker Has No Pending Events" / "Update Service Worker Extended Events Set" algorithms
3667         https://bugs.webkit.org/show_bug.cgi?id=179618
3668
3669         Reviewed by Brady Eidson.
3670
3671         Implement "Service Worker Has No Pending Events" / "Update Service Worker Extended Events Set" algorithms:
3672         - https://w3c.github.io/ServiceWorker/#service-worker-has-no-pending-events-algorithm
3673         - https://w3c.github.io/ServiceWorker/#update-service-worker-extended-events-set-algorithm
3674
3675         Test: http/tests/workers/service/basic-unregister-then-register-again-reuse.html
3676
3677         * workers/service/context/SWContextManager.h:
3678         * workers/service/context/ServiceWorkerFetch.cpp:
3679         (WebCore::ServiceWorkerFetch::dispatchFetchEvent):
3680         * workers/service/context/ServiceWorkerFetch.h:
3681         * workers/service/context/ServiceWorkerThread.cpp:
3682         (WebCore::ServiceWorkerThread::postFetchTask):
3683         (WebCore::ServiceWorkerThread::postMessageToServiceWorkerGlobalScope):
3684         (WebCore::ServiceWorkerThread::updateExtendedEventsSet):
3685         * workers/service/context/ServiceWorkerThread.h:
3686         * workers/service/server/SWServer.cpp:
3687         (WebCore::SWServer::Connection::setServiceWorkerHasPendingEvents):
3688         (WebCore::SWServer::setServiceWorkerHasPendingEvents):
3689         * workers/service/server/SWServer.h:
3690         * workers/service/server/SWServerJobQueue.cpp:
3691         (WebCore::SWServerJobQueue::tryActivate):
3692         (WebCore::SWServerJobQueue::tryClearRegistration):
3693         * workers/service/server/SWServerWorker.h:
3694         (WebCore::SWServerWorker::hasPendingEvents const):
3695         (WebCore::SWServerWorker::setHasPendingEvents):
3696
3697 2017-11-13  Colin Bendell  <colin@bendell.ca>
3698
3699         Added mime type check to the picture source preloader to avoid downloading incompatible resources.
3700         https://bugs.webkit.org/show_bug.cgi?id=179231
3701
3702         Reviewed by Alex Christensen.
3703
3704         Test: http/tests/loading/preload-picture-type.html
3705
3706         * html/parser/HTMLPreloadScanner.cpp:
3707         (WebCore::TokenPreloadScanner::StartTagScanner::processAttributes): include type match state when selecting candidate imgs
3708         (WebCore::TokenPreloadScanner::StartTagScanner::processAttribute): added type attribute evaluation and matching
3709
3710 2017-11-13  Antoine Quint  <graouts@apple.com>
3711
3712         [Web Animations] Implement getAnimations()
3713         https://bugs.webkit.org/show_bug.cgi?id=179535
3714         <rdar://problem/34932475>
3715
3716         Reviewed by Simon Fraser.
3717
3718         We now allow a list of animations for a document, with Document.getAnimations(), or for an
3719         element, with Animatable.getAnimations(), to be returned. In order to support this, we maintain
3720         a map on AnimationTimeline of all animations for a given element. This map is invalidated
3721         when an animation's timeline changes and when an animation's effect changes. Note that the
3722         Web Animations spec mandates that an AnimationEffect can only be a single animation's effect.
3723
3724         Tests: http/wpt/wk-web-animations/interfaces/document-get-animations.html
3725                http/wpt/wk-web-animations/interfaces/element-get-animations.html
3726                http/wpt/wk-web-animations/timing-model/animation-effect-unique-relationship.html
3727
3728         * CMakeLists.txt: Add Animatable.idl.
3729         * DerivedSources.make: Add Animatable.idl.
3730         * WebCore.xcodeproj/project.pbxproj: Add Animatable.idl.
3731         * animation/Animatable.idl: A new interface that Element implements and which currently only exposes
3732         getAnimations(), the animate() method will be added later.
3733         * animation/AnimationEffect.h: Add a new m_animation member to reference the animation using this
3734         effect. This relationship is required so we guarantee that an effect is associated with a single
3735         animation at most.
3736         (WebCore::AnimationEffect::animation const):
3737         (WebCore::AnimationEffect::setAnimation):
3738         * animation/AnimationTimeline.cpp:
3739         (WebCore::AnimationTimeline::animationWasAddedToElement): New method to notify the timeline that an
3740         animation registered with this timeline has been associated with a new element through its effect.
3741         (WebCore::AnimationTimeline::animationWasRemovedFromElement): New method to notify the timeline that an
3742         animation registered with this timeline has been disassociated with an element through its effect.
3743         (WebCore::AnimationTimeline::animationsForElement): New method returning all animations registered with
3744         this timeline for a given element.
3745         * animation/AnimationTimeline.h:
3746         (WebCore::AnimationTimeline::animations const): All animations registered with this timeline.
3747         * animation/DocumentTimeline.cpp:
3748         (WebCore::DocumentTimeline::DocumentTimeline):
3749         (WebCore::DocumentTimeline::detachFromDocument): Clear the reference between this timeline and its document.
3750         (WebCore::DocumentTimeline::currentTime): Protect against a null Document reference.
3751         (WebCore::DocumentTimeline::createDisplayRefreshMonitor const): Protect against a null Document reference.
3752         * animation/DocumentTimeline.h:
3753         * animation/WebAnimation.cpp:
3754         (WebCore::WebAnimation::create):
3755         (WebCore::WebAnimation::setEffect): As an animation's effect changes, we need to ensure that the old
3756         effect no longer has an associated animation, and that the new effect is associated with this animation.
3757         Additionally, we update the element-to-animations map on the animation's timeline.
3758         (WebCore::WebAnimation::setTimeline): Update the element-to-animations map on the former and new timeline.
3759         * dom/Document.cpp:
3760         (WebCore::Document::prepareForDestruction): Clear the relationship between this document and its timeline.
3761         (WebCore::Document::getAnimations): Obtain all animations associated with this document's timeline.
3762         * dom/Document.h:
3763         * dom/Document.idl:
3764         * dom/Element.cpp:
3765         (WebCore::Element::getAnimations): Obtain all animations associated with this element.
3766         * dom/Element.h:
3767         * dom/Element.idl:
3768         * testing/Internals.cpp:
3769
3770         * CMakeLists.txt:
3771         * DerivedSources.make:
3772         * WebCore.xcodeproj/project.pbxproj:
3773         * animation/Animatable.idl: 
3774         * animation/AnimationEffect.h:
3775         (WebCore::AnimationEffect::animation const):
3776         (WebCore::AnimationEffect::setAnimation):
3777         * animation/AnimationTimeline.cpp:
3778         (WebCore::AnimationTimeline::animationWasAddedToElement):
3779         (WebCore::AnimationTimeline::animationWasRemovedFromElement):
3780         (WebCore::AnimationTimeline::animationsForElement):
3781         * animation/AnimationTimeline.h:
3782         (WebCore::AnimationTimeline::animations const):
3783         * animation/DocumentTimeline.cpp:
3784         (WebCore::DocumentTimeline::DocumentTimeline):
3785         (WebCore::DocumentTimeline::detachFromDocument):
3786         (WebCore::DocumentTimeline::currentTime):
3787         (WebCore::DocumentTimeline::createDisplayRefreshMonitor const):
3788         * animation/DocumentTimeline.h:
3789         * animation/WebAnimation.cpp:
3790         (WebCore::WebAnimation::create):
3791         (WebCore::WebAnimation::setEffect):
3792         (WebCore::WebAnimation::setTimeline):
3793         * dom/Document.cpp:
3794         (WebCore::Document::prepareForDestruction):
3795         (WebCore::Document::getAnimations):
3796         * dom/Document.h:
3797         * dom/Document.idl:
3798         * dom/Element.cpp:
3799         (WebCore::Element::getAnimations):
3800         * dom/Element.h:
3801         * dom/Element.idl:
3802         * testing/Internals.cpp:
3803
3804 2017-11-13  Alex Christensen  <achristensen@webkit.org>
3805
3806         Make DocumentLoader::willSendRequest asynchronous
3807         https://bugs.webkit.org/show_bug.cgi?id=179549
3808
3809         Reviewed by Tim Horton.
3810
3811         No change in behavior, except now redirects will wait for PolicyChecker::checkNavigationPolicy's completion handler.
3812         Before, they would just continue in DocumentLoader::redirectReceived hoping the client had responded to 
3813         decidePolicyForNavigationAction synchronously or that the client would have been ok with continuing.
3814
3815         * loader/DocumentLoader.cpp:
3816         (WebCore::DocumentLoader::redirectReceived):
3817         (WebCore::DocumentLoader::willSendRequest):
3818         (WebCore::DocumentLoader::startLoadingMainResource):
3819         * loader/DocumentLoader.h:
3820         * loader/FrameLoader.cpp:
3821         (WebCore::FrameLoader::loadURL):
3822         (WebCore::FrameLoader::loadWithDocumentLoader):
3823         * loader/PolicyChecker.cpp:
3824         (WebCore::PolicyChecker::checkNavigationPolicy):
3825         * loader/PolicyChecker.h:
3826
3827 2017-11-13  Wenson Hsieh  <wenson_hsieh@apple.com>
3828
3829         [Attachment Support] Implement SPI for clients to request data for a given attachment
3830         https://bugs.webkit.org/show_bug.cgi?id=179586
3831         <rdar://problem/35355720>
3832
3833         Reviewed by Darin Adler.
3834
3835         Adds support in WebCore for fetching data for a given attachment element. See per-method comments below for
3836         more detail.
3837
3838         Test coverage by augmenting existing API tests in WKAttachmentTests, and adding 3 new tests.
3839
3840         * dom/Document.cpp:
3841         (WebCore::Document::didInsertAttachmentElement):
3842         (WebCore::Document::didRemoveAttachmentElement):
3843         (WebCore::Document::attachmentForIdentifier const):
3844
3845         Fetches an attachment element matching the given identifier. Using the identifier => attachment element map here
3846         allows us to avoid the cost of walking the DOM in search for HTMLAttachmentElements every time data is
3847         requested.
3848
3849         * dom/Document.h:
3850
3851         Add a map of attachment identifier => HTMLAttachmentElement in Document. This map is updated when attachment
3852         elements are connected to or disconnected from the document. Additionally, delegate attachment insertion and
3853         removal out to the Editor if possible.
3854
3855         * editing/Editor.cpp:
3856         (WebCore::Editor::insertAttachmentFromFile):
3857         * editing/mac/WebContentReaderMac.mm:
3858         (WebCore::WebContentReader::readFilenames):
3859         * editing/markup.cpp:
3860         (WebCore::createFragmentFromMarkup):
3861
3862         Tweak existing logic that transfers file-backed File objects when deserializing HTMLAttachmentElements from
3863         markup to handle the case where the attachment element is not file-backed. In this case, we construct a new
3864         File object using the deserializing constructor. To do this, we use the attachment element's blob URL to make
3865         sure that the new File references an existing blob matching that URL.
3866
3867         * html/HTMLAttachmentElement.cpp:
3868         (WebCore::AttachmentDataReader::create):
3869         (WebCore::AttachmentDataReader::AttachmentDataReader):
3870
3871         Introduce AttachmentDataReader, a helper class local to HTMLAttachmentElement that is responsible for loading
3872         an attachment element's file and invoking a given callback when loading has succeeded or failed.
3873         Each AttachmentDataReader is retained exclusively by its HTMLAttachmentElement, through the
3874         HTMLAttachmentElement's vector of unique_ptrs to AttachmentDataReaders.
3875
3876         (WebCore::HTMLAttachmentElement::~HTMLAttachmentElement):
3877         (WebCore::HTMLAttachmentElement::blobURL const):
3878
3879         Add a convenience getter for the blob URL of the attachment's backing File object.
3880
3881         (WebCore::HTMLAttachmentElement::setFile):
3882
3883         When setting an attachment element's file, set the blob URL attribute as well to the blob URL. Also, tweak this
3884         to take a RefPtr<File>&& instead of a raw File*.
3885
3886         (WebCore::HTMLAttachmentElement::insertedIntoAncestor):
3887         (WebCore::HTMLAttachmentElement::removedFromAncestor):
3888
3889         Instead of delegating attachment insertion and removal to the Editor, just call out to the Document, which will
3890         now call out to the Editor.
3891
3892         (WebCore::HTMLAttachmentElement::attachmentPath const):
3893
3894         Add a convenience getter for the attachment path attribute.
3895
3896         (WebCore::HTMLAttachmentElement::requestData):
3897         (WebCore::HTMLAttachmentElement::destroyReader):
3898
3899         Called when a AttachmentDataReader has completed (either with success or failure), and is ready to be removed
3900         from the attachment element's list of active data readers.
3901
3902         (WebCore::AttachmentDataReader::~AttachmentDataReader):
3903         (WebCore::AttachmentDataReader::didFinishLoading):
3904         (WebCore::AttachmentDataReader::didFail):
3905         (WebCore::AttachmentDataReader::invokeCallbackAndFinishReading):
3906
3907         When the reader is done loading, or has failed, or is about to be destroyed, fire the callback with loaded data
3908         (if any) and cancel the FileReaderLoader.
3909
3910         * html/HTMLAttachmentElement.h:
3911         * html/HTMLAttributeNames.in:
3912
3913         Adds a new "webkitattachmentbloburl" attribute that keeps track of an attachment element's file's blob URL. This
3914         is used to ensure that information about an attachment element's file is not lost between certain editing
3915         operations (for instance, deleting a line break) that involve serializing and then deserializing markup into
3916         DocumentFragments to then insert.
3917
3918 2017-11-13  Zan Dobersek  <zdobersek@igalia.com>
3919
3920         [Cairo] Remove GraphicsContext::mustUseShadowBlur()
3921         https://bugs.webkit.org/show_bug.cgi?id=179612
3922
3923         Reviewed by Michael Catanzaro.
3924
3925         Remove the Cairo-specific mustUseShadowBlur() method on the
3926         GraphicsContext class. It can now be implemented as a static function
3927         in CairoOperations, using only a PlatformContextCairo object and a
3928         const reference to the relevant GraphicsContextState.
3929
3930         No new tests -- no change in behavior.
3931
3932         * platform/graphics/GraphicsContext.cpp:
3933         (WebCore::GraphicsContext::mustUseShadowBlur const): Deleted.
3934         * platform/graphics/GraphicsContext.h:
3935         * platform/graphics/cairo/CairoOperations.cpp:
3936         (WebCore::Cairo::mustUseShadowBlur):
3937         (WebCore::Cairo::drawGlyphsShadow):
3938         (WebCore::Cairo::fillRectWithRoundedHole):
3939         (WebCore::Cairo::drawGlyphs):
3940         * platform/graphics/cairo/CairoOperations.h:
3941         * platform/graphics/cairo/FontCairo.cpp:
3942         (WebCore::FontCascade::drawGlyphs):
3943         * platform/graphics/cairo/GraphicsContextCairo.cpp:
3944         (WebCore::GraphicsContext::fillRectWithRoundedHole):
3945
3946 2017-11-13  Zan Dobersek  <zdobersek@igalia.com>
3947
3948         [Cairo] Move state change operations from GraphicsContextCairo to CairoOperations
3949         https://bugs.webkit.org/show_bug.cgi?id=179610
3950
3951         Reviewed by Carlos Garcia Campos.
3952
3953         Move operations that perform Cairo state changes to the CairoOperations
3954         file. This enforces only using the PlatformContextCairo object to
3955         achieve the state change, leveraging the cairo_t and ShadowBlur objects
3956         that are owned by PlatformContextCairo.
3957
3958         Along with state modification operations, various state query operations
3959         are also placed under the Cairo::State namespace, again limited to the
3960         PlatformContextCairo object.
3961
3962         No new tests -- no change in behavior.
3963
3964         * platform/graphics/cairo/CairoOperations.cpp:
3965         (WebCore::Cairo::State::setStrokeThickness):
3966         (WebCore::Cairo::State::setGlobalAlpha):
3967         (WebCore::Cairo::State::setCompositeOperation):
3968         (WebCore::Cairo::State::setShouldAntialias):
3969         (WebCore::Cairo::State::setImageInterpolationQuality):
3970         (WebCore::Cairo::State::setCTM):
3971         (WebCore::Cairo::State::getCTM):
3972         (WebCore::Cairo::State::setShadowValues):
3973         (WebCore::Cairo::State::clearShadow):
3974         (WebCore::Cairo::State::getClipBounds):
3975         (WebCore::Cairo::State::roundToDevicePixels):
3976         (WebCore::Cairo::State::isAcceleratedContext):
3977         * platform/graphics/cairo/CairoOperations.h:
3978         * platform/graphics/cairo/GraphicsContextCairo.cpp:
3979         (WebCore::GraphicsContext::getCTM const):
3980         (WebCore::GraphicsContext::restorePlatformState):
3981         (WebCore::GraphicsContext::clipBounds const):
3982         (WebCore::GraphicsContext::roundToDevicePixels):
3983         (WebCore::GraphicsContext::setPlatformStrokeThickness):
3984         (WebCore::GraphicsContext::setCTM):
3985         (WebCore::GraphicsContext::setPlatformShadow):