6a3001f5c2a5f070aae58b44d6b968bfddc6e338
[WebKit-https.git] / Source / WebCore / ChangeLog
1 2018-01-16  Antoine Quint  <graouts@apple.com>
2
3         Use traits for animation timing functions
4         https://bugs.webkit.org/show_bug.cgi?id=181651
5
6         Reviewed by Dean Jackson.
7
8         Cleaning up Dean's previous patch as suggested by Darin's post-commit review comments. The
9         downcast function can match const automatically and it's a better style to put the * inside
10         the downcast call rather than outside.
11
12         * css/CSSComputedStyleDeclaration.cpp:
13         (WebCore::createTimingFunctionValue):
14         * platform/animation/TimingFunction.cpp:
15         (WebCore::operator<<):
16         (WebCore::TimingFunction::transformTime const):
17         * platform/animation/TimingFunction.h:
18         * platform/graphics/ca/cocoa/PlatformCAAnimationCocoa.mm:
19         (WebCore::toCAMediaTimingFunction):
20
21 2018-01-16  Philippe Normand  <pnormand@igalia.com>
22
23         [GStreamer] Live streaming cleanups
24         https://bugs.webkit.org/show_bug.cgi?id=181672
25
26         Reviewed by Michael Catanzaro.
27
28         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:
29         (WebCore::MediaPlayerPrivateGStreamer::handleMessage): Switch to
30         streaming code path when no content-length was reported by the
31         http source element.
32         (WebCore::MediaPlayerPrivateGStreamer::totalBytes const): Return early when streaming.
33         * platform/graphics/gstreamer/WebKitWebSourceGStreamer.cpp:
34         (CachedResourceStreamingClient::responseReceived): Emit headers as
35         an element message, like souphttpsrc.
36
37 2018-01-15  Philippe Normand  <pnormand@igalia.com>
38
39         [GStreamer] misc fixes and cleanups
40         https://bugs.webkit.org/show_bug.cgi?id=181647
41
42         Reviewed by Michael Catanzaro.
43
44         * platform/graphics/MediaPlayer.cpp:
45         (WebCore::convertEnumerationToString): New utility function to convert preload enum to string.
46         * platform/graphics/MediaPlayerEnums.h: Ditto.
47         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:
48         (WebCore::MediaPlayerPrivateGStreamer::load): Debug tweak
49         (WebCore::MediaPlayerPrivateGStreamer::prepareToPlay): Ditto
50         (WebCore::MediaPlayerPrivateGStreamer::play): Ditto
51         (WebCore::MediaPlayerPrivateGStreamer::paused const): Ditto
52         (WebCore::MediaPlayerPrivateGStreamer::processBufferingStats): Prevent useless state update.
53         (WebCore::MediaPlayerPrivateGStreamer::fillTimerFired): Ditto.
54         (WebCore::MediaPlayerPrivateGStreamer::updateStates): Debug tweak.
55         (WebCore::MediaPlayerPrivateGStreamer::setDownloadBuffering): Ditto.
56         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.h:
57         Remove useless handlesSyncMessage method.
58         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp:
59         (WebCore::MediaPlayerPrivateGStreamerBase::setMuted): Prevent useless state update.
60         (WebCore::MediaPlayerPrivateGStreamerBase::muted const): Debug tweak.
61         (WebCore::MediaPlayerPrivateGStreamerBase::setStreamVolumeElement): Ditto.
62         * platform/graphics/gstreamer/WebKitWebSourceGStreamer.cpp:
63         (webkit_web_src_init): Enable keepAlive by default like in souphttpsrc.
64         (webKitWebSrcStart): Debug tweak.
65         (webKitWebSrcQueryWithParent): Ditto.
66         (webKitWebSrcNeedData): Ditto.
67         (CachedResourceStreamingClient::responseReceived): Change appsrc
68         stream-type when we wan't seek. Also update caps like souphttpsrc
69         does.
70         * platform/graphics/gstreamer/WebKitWebSourceGStreamer.h: Add forward declaration of MediaPlayer.
71         * platform/graphics/gstreamer/mse/MediaSourceClientGStreamerMSE.cpp:
72         (WebCore::MediaSourceClientGStreamerMSE::append): Fix compilation warning.
73
74 2018-01-16  Yacine Bandou  <yacine.bandou_ext@softathome.com>
75
76         [WPE] Two clearkey tests failing since r226621
77         https://bugs.webkit.org/show_bug.cgi?id=181532
78
79         Reviewed by Xabier Rodriguez-Calvar.
80
81         Whith a fake initData, we can have a pssh size nul, thus we should check it.
82         We saw this issue in the subtest "initData longer than 64Kb characters" in
83         the clearkey-generate-request-disallowed-input layout test.
84
85         * platform/encryptedmedia/clearkey/CDMClearKey.cpp:
86         (WebCore::extractKeyidsLocationFromCencInitData):
87
88 2018-01-15  Yoav Weiss  <yoav@yoav.ws>
89
90         Support for preconnect Link headers
91         https://bugs.webkit.org/show_bug.cgi?id=181657
92
93         Reviewed by Darin Adler.
94
95         Move the preconnect functionality into its own function, and
96         also call this function when Link headers are processed.
97
98         Test: http/tests/preconnect/link-header-rel-preconnect-http.php
99
100         * loader/LinkLoader.cpp:
101         (WebCore::LinkLoader::loadLinksFromHeader): Call preconnect.
102         (WebCore::LinkLoader::preconnect): Preconnect to a host functionality moved here.
103         (WebCore::LinkLoader::preload): Renamed `preloadIfNeeded` to `preload`.
104         (WebCore::LinkLoader::loadLink): Call preconnect.
105         * loader/LinkLoader.h:
106
107 2018-01-15  Michael Catanzaro  <mcatanzaro@igalia.com>
108
109         Improve use of ExportMacros
110         https://bugs.webkit.org/show_bug.cgi?id=181652
111
112         Reviewed by Konstantin Tokarev.
113
114         Remove a comment.
115
116         * platform/PlatformExportMacros.h:
117
118 2018-01-15  Konstantin Tokarev  <annulen@yandex.ru>
119
120         image-rendering should affect scaling of border-image
121         https://bugs.webkit.org/show_bug.cgi?id=169440
122
123         Reviewed by Michael Catanzaro.
124
125         Test: fast/borders/border-image-pixelated.html
126
127         * rendering/style/NinePieceImage.cpp:
128         (WebCore::NinePieceImage::paint):
129
130 2018-01-15  Tomas Popela  <tpopela@redhat.com>
131
132         2.19.3 ACCELERATED_2D_CANVAS support is broken
133         https://bugs.webkit.org/show_bug.cgi?id=180799
134
135         Reviewed by Michael Catanzaro.
136
137         * html/canvas/CanvasRenderingContext2DBase.cpp:
138         (WebCore::CanvasRenderingContext2DBase::didDraw):
139
140 2018-01-15  Basuke Suzuki  <Basuke.Suzuki@sony.com>
141
142         [Curl] Enable HTTP/2
143         https://bugs.webkit.org/show_bug.cgi?id=181551
144
145         Reviewed by Michael Catanzaro.
146
147         Start supporting HTTP/2 protocol. The first step is just enabling the HTTP/2 on Curl backend.
148         Next step will be to enable multiplexing feature.
149
150         No new tests because we don't have HTTP/2 test backend yet.
151
152         * platform/network/curl/CurlContext.cpp:
153         (WebCore::CurlContext::isHttp2Enabled const):
154         (WebCore::CurlHandle::enableHttp):
155         (WebCore::CurlHandle::enableHttpGetRequest):
156         (WebCore::CurlHandle::enableHttpHeadRequest):
157         (WebCore::CurlHandle::enableHttpPostRequest):
158         (WebCore::CurlHandle::enableHttpPutRequest):
159         (WebCore::CurlHandle::setHttpCustomRequest):
160         * platform/network/curl/CurlContext.h:
161
162 2018-01-15  Dean Jackson  <dino@apple.com>
163
164         Use a helper function for checked arithmetic in WebGL validation
165         https://bugs.webkit.org/show_bug.cgi?id=181620
166         <rdar://problem/36485879>
167
168         Reviewed by Eric Carlson.
169
170         Eric recommended using a templated helper function to do
171         a common arithmetic check in WebGL validation.
172
173         * html/canvas/WebGL2RenderingContext.cpp:
174         (WebCore::WebGL2RenderingContext::validateIndexArrayConservative):
175         * html/canvas/WebGLRenderingContext.cpp:
176         (WebCore::WebGLRenderingContext::validateIndexArrayConservative):
177         * html/canvas/WebGLRenderingContextBase.cpp:
178         (WebCore::WebGLRenderingContextBase::validateIndexArrayPrecise):
179         (WebCore::WebGLRenderingContextBase::validateDrawArrays):
180         (WebCore::WebGLRenderingContextBase::validateSimulatedVertexAttrib0):
181         (WebCore::WebGLRenderingContextBase::simulateVertexAttrib0):
182         * html/canvas/WebGLRenderingContextBase.h:
183         (WebCore::WebGLRenderingContextBase::checkedAddAndMultiply): New helper.
184
185 2018-01-15  Dean Jackson  <dino@apple.com>
186
187         Use traits for animation timing functions
188         https://bugs.webkit.org/show_bug.cgi?id=181651
189         <rdar://problem/36525328>
190
191         Reviewed by Antoine Quint.
192
193         Use the type traits for TimingFunction classes, so
194         we can is<> and downcast<>.
195
196         * css/CSSComputedStyleDeclaration.cpp:
197         (WebCore::createTimingFunctionValue):
198         * platform/animation/TimingFunction.cpp:
199         (WebCore::TimingFunction::transformTime const):
200         * platform/animation/TimingFunction.h:
201         * platform/graphics/ca/GraphicsLayerCA.cpp:
202         (WebCore::animationHasStepsTimingFunction):
203         (WebCore::animationHasFramesTimingFunction):
204         * platform/graphics/ca/cocoa/PlatformCAAnimationCocoa.mm:
205         (WebCore::toCAMediaTimingFunction):
206
207 2018-01-15  Youenn Fablet  <youenn@apple.com>
208
209         RealtimeMediaSource should be ThreadSafeRefCounted
210         https://bugs.webkit.org/show_bug.cgi?id=181649
211
212         Reviewed by Eric Carlson.
213
214         Difficult to write a test as this is really racy.
215         RealtimeIncomingVideoSourceCocoa::OnFrame is taking a reference on a background thread
216         to send a task to the main thread.
217         This requires it to be thread safe ref counted.
218
219         * platform/mediastream/RealtimeMediaSource.h:
220
221 2018-01-15  Philippe Normand  <pnormand@igalia.com>
222
223         Prevent useless MediaPlayer mute state notifications
224         https://bugs.webkit.org/show_bug.cgi?id=181646
225
226         Reviewed by Carlos Garcia Campos.
227
228         On GTK port the mute change notification was triggering the test
229         runner to think the whole page mute state had changed and that
230         media elements were muted. The simplest solution is to propagate
231         the notification only if the state actually changed.
232
233         * platform/graphics/MediaPlayer.cpp:
234         (WebCore::MediaPlayer::muteChanged): Propagate mute notification
235         only if the mute state actually changed.
236
237 2018-01-15  Sebastian Dröge  <sebastian@centricular.com>
238
239         [GStreamer] Don't wait for draw condition variable when shutting down.
240         https://bugs.webkit.org/show_bug.cgi?id=180978
241
242         Reviewed by Carlos Garcia Campos.
243
244         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp:
245         (WebCore::MediaPlayerPrivateGStreamerBase::triggerRepaint):
246         (WebCore::MediaPlayerPrivateGStreamerBase::cancelRepaint):
247         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.h:
248         By also waiting for the draw condition variable while shutting down,
249         it is possible that the GStreamer video sink is waiting for the main
250         thread to actually render the current frame, while at the same time
251         the main thread is waiting for the GStreamer video sink to shut down,
252         resulting in a deadlock.
253
254 2018-01-13  Minsheng Liu  <lambda@liu.ms>
255
256         MathML Lengths should take zoom level into account
257         https://bugs.webkit.org/show_bug.cgi?id=180029
258
259         Reviewed by Frédéric Wang.
260
261         The patch applies the effective zoom factor to physical units in toUserUnits().
262
263         Test: mathml/presentation/mspace-units-with-zoom.html
264
265         * rendering/mathml/RenderMathMLBlock.cpp:
266         (WebCore::toUserUnits):
267
268 2018-01-12  Chris Dumez  <cdumez@apple.com>
269
270         ASSERTION FAILED: registration || isTerminating() in WebCore::SWServerWorker::skipWaiting()
271         https://bugs.webkit.org/show_bug.cgi?id=181603
272         <rdar://problem/36476050>
273
274         Reviewed by Youenn Fablet.
275
276         No new tests, covered by existing tests that crash flakily.
277
278         * workers/service/server/SWServer.cpp:
279         (WebCore::SWServer::terminateWorkerInternal):
280         If the connection to the context process is gone, make sure we make the worker as terminated
281         so that it does not stay in Running state and in SWServer::m_runningOrTerminatingWorkers.
282
283         * workers/service/server/SWServerRegistration.cpp:
284         (WebCore::SWServerRegistration::~SWServerRegistration):
285         Add assertions to make sure none of the registration's workers are still running when
286         the registration is destroyed.
287
288         (WebCore::SWServerRegistration::updateRegistrationState):
289         Make sure registration workers that are overwritten are not still running.
290
291         * workers/service/server/SWServerWorker.cpp:
292         (WebCore::SWServerWorker::setState):
293         If a worker's state is set to redundant, make sure we also terminate it.
294
295 2018-01-12  Commit Queue  <commit-queue@webkit.org>
296
297         Unreviewed, rolling out r226927.
298         https://bugs.webkit.org/show_bug.cgi?id=181621
299
300         Breaks 32-bit and iOS release for some reason that i don't
301         understand yet (Requested by dino on #webkit).
302
303         Reverted changeset:
304
305         "Use a helper function for checked arithmetic in WebGL
306         validation"
307         https://bugs.webkit.org/show_bug.cgi?id=181620
308         https://trac.webkit.org/changeset/226927
309
310 2018-01-12  Myles C. Maxfield  <mmaxfield@apple.com>
311
312         Data URL fonts split in the middle of an alphabet cause random letters to disappear
313         https://bugs.webkit.org/show_bug.cgi?id=175845
314         <rdar://problem/33996578>
315
316         Reviewed by Brent Fulgham.
317
318         It is fairly common practice for a font foundry to split a font up into two files such that a semi-random
319         half of the alphabet is present in one of the files, and the other half is present in the other file. This
320         practice involves representing the files as data URLs, so as to minimize the time it takes to load them.
321
322         Because resource loading is asynchronous (even for data URLs), it is possible today to get a paint after
323         the first file is loaded but before the second file is loaded. Indeed, because of the way font fallback
324         works, we will never start loading the second file until a layout has occurred with the first font.
325
326         Because a site usually only uses this pattern for a handful of fonts, and I've never seen this pattern
327         being used for CJK fonts, it isn't very expensive to opportunistically decode these data URLs eagerly.
328         Using this method doesn't actually guarantee that the two fonts will load in between successive paints,
329         but it at least makes this much more likely. This patch implements this strategy, along with a size
330         threshold to make sure that we won't decode any super large data URLs when it isn't necessary.
331
332         Test: fast/text/font-load-data-partitioned-alphabet.html
333
334         * css/CSSFontFace.cpp:
335         (WebCore::CSSFontFace::opportunisticallyStartFontDataURLLoading):
336         * css/CSSFontFace.h:
337         * css/CSSFontFaceSource.cpp:
338         (WebCore::CSSFontFaceSource::opportunisticallyStartFontDataURLLoading):
339         * css/CSSFontFaceSource.h:
340         * css/CSSFontSelector.cpp:
341         (WebCore::CSSFontSelector::opportunisticallyStartFontDataURLLoading):
342         * css/CSSFontSelector.h:
343         * platform/graphics/FontCascadeFonts.cpp:
344         (WebCore::opportunisticallyStartFontDataURLLoading):
345         (WebCore::FontCascadeFonts::glyphDataForVariant):
346         * platform/graphics/FontSelector.h:
347
348 2018-01-12  Alex Christensen  <achristensen@webkit.org>
349
350         History state should be updated during client redirects with asynchronous policy decisions
351         https://bugs.webkit.org/show_bug.cgi?id=181358
352         <rdar://problem/35547689>
353
354         Reviewed by Andy Estes.
355
356         When decidePolicyForNavigationAction is responded to asynchronously during a client redirect, 
357         HistoryController::updateForRedirectWithLockedBackForwardList does not update the history because
358         the document loader has not been marked as a client redirect because the FrameLoader only looks
359         at its provisional document loader to mark it as a client redirect.  When decidePolicyForNavigationAction
360         is responded to asynchronously, though, the FrameLoader's provisional document loader has moved to 
361         its policy document loader.  To get both asynchronous and synchronous cases, let's just mark the document
362         loader as a client redirect whether it's the provisional or policy document loader.
363
364         Covered by a new API test.
365
366         * loader/FrameLoader.cpp:
367         (WebCore::FrameLoader::loadURL):
368         (WebCore::FrameLoader::loadPostRequest):
369
370 2018-01-12  Dean Jackson  <dino@apple.com>
371
372         Use a helper function for checked arithmetic in WebGL validation
373         https://bugs.webkit.org/show_bug.cgi?id=181620
374         <rdar://problem/36485879>
375
376         Reviewed by Eric Carlson.
377
378         Eric recommended using a templated helper function to do
379         a common arithmetic check in WebGL validation.
380
381         * html/canvas/WebGL2RenderingContext.cpp:
382         (WebCore::WebGL2RenderingContext::validateIndexArrayConservative):
383         * html/canvas/WebGLRenderingContext.cpp:
384         (WebCore::WebGLRenderingContext::validateIndexArrayConservative):
385         * html/canvas/WebGLRenderingContextBase.cpp:
386         (WebCore::WebGLRenderingContextBase::checkedAddAndMultiply): New helper.
387         (WebCore::WebGLRenderingContextBase::validateIndexArrayPrecise):
388         (WebCore::WebGLRenderingContextBase::validateDrawArrays):
389         (WebCore::WebGLRenderingContextBase::validateSimulatedVertexAttrib0):
390         (WebCore::WebGLRenderingContextBase::simulateVertexAttrib0):
391         * html/canvas/WebGLRenderingContextBase.h:
392
393 2018-01-12  Myles C. Maxfield  <mmaxfield@apple.com>
394
395         [Cocoa] CTFontCopyDefaultCascadeListForLanguages() can return nullptr
396         https://bugs.webkit.org/show_bug.cgi?id=181615
397         <rdar://problem/36334637>
398
399         Reviewed by Jon Lee.
400
401         Speculative fix. We are getting crash reports saying that this call can return nullptr, and we
402         don't check for it.
403
404         No new tests because I couldn't find the specific input that causes it to return nullptr. (I
405         tried running this code with every 0, 1, and 2 length locale string, every weight value, and
406         every italic value, and couldn't get it to crash. I also inspected the code to figure out what
407         values would cause it to return nullptr, and I couldn't find anything other than if the system
408         has a totally busted font setup.)
409
410         * platform/graphics/cocoa/FontDescriptionCocoa.cpp:
411         (WebCore::SystemFontDatabase::computeCascadeList):
412
413 2018-01-11  Dean Jackson  <dino@apple.com>
414
415         [WebGL] Simulated vertexAttrib0 can sometimes cause OUT_OF_MEMORY errors
416         https://bugs.webkit.org/show_bug.cgi?id=181558
417         <rdar://problem/36189833>
418
419         Reviewed by Eric Carlson.
420
421         Very large element indices in the ELEMENT_ARRAY_BUFFER meant that
422         our simulated vertexAttrib0 buffer might be too large. We need
423         to check for out-of-memory, but we can also detect some of the issues
424         earlier in our validation code. Additionally, make sure that we don't
425         accidentally cast an unsigned to a signed.
426
427         Test: fast/canvas/webgl/simulated-vertexAttrib0-invalid-indicies.html
428
429         * html/canvas/WebGL2RenderingContext.cpp:
430         (WebCore::WebGL2RenderingContext::validateIndexArrayConservative): Update validation
431         code to look for overflow, rather than relying on looking for sign changes.
432         * html/canvas/WebGLRenderingContext.cpp:
433         (WebCore::WebGLRenderingContext::validateIndexArrayConservative): Ditto.
434         * html/canvas/WebGLRenderingContextBase.cpp:
435         (WebCore::WebGLRenderingContextBase::validateIndexArrayPrecise):
436         (WebCore::WebGLRenderingContextBase::drawArrays): Check that we were able to simulate.
437         (WebCore::WebGLRenderingContextBase::drawElements):
438         (WebCore::WebGLRenderingContextBase::validateSimulatedVertexAttrib0): Update validation code, and
439         use GC3Duint, since that's what the indicies are.
440         (WebCore::WebGLRenderingContextBase::simulateVertexAttrib0): Ditto.
441         (WebCore::WebGLRenderingContextBase::drawArraysInstanced): Check that we were able to simulate.
442         (WebCore::WebGLRenderingContextBase::drawElementsInstanced):
443         * html/canvas/WebGLRenderingContextBase.h:
444
445 2018-01-12  Wenson Hsieh  <wenson_hsieh@apple.com>
446
447         Large in-place attachment elements cause the document width to expand when inserted
448         https://bugs.webkit.org/show_bug.cgi?id=181614
449
450         Reviewed by Dan Bernstein.
451
452         Make in-place images and videos have a max-width of 100%, so that large attachments aren't inserted with full
453         display size, causing the document and viewport width to expand.
454
455         * html/HTMLAttachmentElement.cpp:
456         (WebCore::HTMLAttachmentElement::populateShadowRootIfNecessary):
457
458 2018-01-12  Keith Rollin  <krollin@apple.com>
459
460         Logged JSON should escape "'s and \'s in strings.
461         https://bugs.webkit.org/show_bug.cgi?id=181608
462
463         Reviewed by Brent Fulgham.
464
465         No new tests -- no new functionality, just changed logging. The
466         efficacy of the logging was verified by inspecting its output.
467
468         * loader/ResourceLoadObserver.cpp:
469         (WebCore::ResourceLoadObserver::logUserInteractionWithReducedTimeResolution):
470
471 2018-01-12  Dean Jackson  <dino@apple.com>
472
473         drawElements should be invalid if vertexAttrib0 doesn't have data
474         https://bugs.webkit.org/show_bug.cgi?id=181609
475         <rdar://problem/36392883>
476
477         Reviewed by Antoine Quint.
478
479         If a vertex attribute has been enabled, but no data provided, then
480         draw validation should fail.
481
482         Test: fast/canvas/webgl/drawElements-empty-vertex-data.html
483
484         * html/canvas/WebGLRenderingContextBase.cpp:
485         (WebCore::WebGLRenderingContextBase::validateVertexAttributes): If there were
486         never any data in the vertex buffer, then we incorrectly compared with 0.
487
488 2018-01-12  Youenn Fablet  <youenn@apple.com>
489
490         FormDataElement::lengthInBytes should use ThreadableBlobRegistry
491         https://bugs.webkit.org/show_bug.cgi?id=181554
492
493         Reviewed by Chris Dumez.
494
495         Covered by updated test.
496
497         Fix blobRegistry() use and add support for creating a response that may trigger the issue.
498
499
500         * platform/network/FormData.cpp:
501         (WebCore::FormDataElement::lengthInBytes const): Was using directly blobRegistry() while ThreadableBlobRegistry is more appropriate
502         in case this is called from workers.
503         * Modules/fetch/FetchBody.h:
504         * Modules/fetch/FetchResponse.h:
505         * fileapi/Blob.h:
506         * testing/ServiceWorkerInternals.cpp:
507         (WebCore::ServiceWorkerInternals::createOpaqueWithBlobBodyResponse):
508         * testing/ServiceWorkerInternals.h:
509         * testing/ServiceWorkerInternals.idl:
510
511 2018-01-12  Jer Noble  <jer.noble@apple.com>
512
513         Wrap CDMFairPlayStreaming and related classes in ENABLE(ENCRYPTED_MEDIA) checks
514         https://bugs.webkit.org/show_bug.cgi?id=181602
515
516         Reviewed by Maciej Stachowiak.
517
518         * platform/graphics/avfoundation/CDMFairPlayStreaming.h:
519         * platform/graphics/avfoundation/objc/CDMInstanceFairPlayStreamingAVFObjC.h:
520         * platform/graphics/avfoundation/objc/CDMInstanceFairPlayStreamingAVFObjC.mm:
521
522 2018-01-12  Youenn Fablet  <youenn@apple.com>
523
524         WebProcess should pass the registration identifier and not the worker identifier for fetch events
525         https://bugs.webkit.org/show_bug.cgi?id=181591
526
527         Reviewed by Chris Dumez.
528
529         Test: http/wpt/service-workers/update-service-worker.https.html
530
531         Store service worker registration identifier in ResourceLoaderOptions instead of service worker identifier.
532
533         * loader/DocumentThreadableLoader.cpp:
534         (WebCore::DocumentThreadableLoader::DocumentThreadableLoader):
535         (WebCore::DocumentThreadableLoader::makeCrossOriginAccessRequest):
536         * loader/ResourceLoaderOptions.h:
537         * loader/WorkerThreadableLoader.cpp:
538         (WebCore::WorkerThreadableLoader::MainThreadBridge::MainThreadBridge):
539         * loader/cache/CachedResourceLoader.cpp:
540         (WebCore::CachedResourceLoader::prepareFetch):
541         (WebCore::CachedResourceLoader::determineRevalidationPolicy const):
542         * loader/cache/CachedResourceRequest.cpp:
543         (WebCore::CachedResourceRequest::setSelectedServiceWorkerRegistrationIdentifierIfNeeded):
544         (WebCore::CachedResourceRequest::setNavigationServiceWorkerRegistrationData):
545         (WebCore::CachedResourceRequest::setSelectedServiceWorkerIdentifierIfNeeded): Deleted.
546         * loader/cache/CachedResourceRequest.h:
547         * workers/WorkerScriptLoader.cpp:
548         (WebCore::WorkerScriptLoader::loadSynchronously):
549         (WebCore::WorkerScriptLoader::loadAsynchronously):
550         * workers/service/server/SWServer.cpp:
551         (WebCore::SWServer::activeWorkerFromRegistrationID):
552         * workers/service/server/SWServer.h:
553
554 2018-01-12  Fujii Hironori  <Hironori.Fujii@sony.com>
555
556         [Win][CMake] Remove all-in-one file for WebCore DerivedSources
557         https://bugs.webkit.org/show_bug.cgi?id=181582
558
559         Reviewed by Alex Christensen.
560
561         Those source files are compiled in unified source build nowadays.
562
563         No new tests (No behavior change)
564
565         * CMakeLists.txt: Removed calling PROCESS_ALLINONE_FILE.
566         * DerivedSources.cpp: Removed.
567         * WebCoreMacros.cmake: Removed a macro PROCESS_ALLINONE_FILE.
568
569 2018-01-12  Fujii Hironori  <Hironori.Fujii@sony.com>
570
571         [WinCairo][CMake] Use ${CURL_LIBRARY} instead of specifying the library name libcurl_imp explicitly
572         https://bugs.webkit.org/show_bug.cgi?id=181578
573
574         Reviewed by Alex Christensen.
575
576         vcpkg has libcurl.lib, not libcurl_imp.lib.
577
578         No new tests because no behavior change.
579
580         * PlatformWinCairo.cmake: Link ${CURL_LIBRARY} instead of libcurl_imp.
581
582 2018-01-12  Jer Noble  <jer.noble@apple.com>
583
584         WebGL video texture black in Safari 11.0.2 and wrong colored in Safari Preview 11.1
585         https://bugs.webkit.org/show_bug.cgi?id=181445
586         <rdar://problem/36383183>
587
588         Reviewed by Dean Jackson.
589
590         Tests: added compile-time correctness tests for YCbCrMatrix values.
591
592         Perform the derivation from YCbCr coefficients into matrices in constexpr expressions
593         at compile-time. This allows us to also perform compile-time correctness checks to catch
594         regressions which may cause incorrect color conversions.
595
596         Since we now have general-purpose derivation of matrix values from coefficients,
597         adding missing specificed matrices is trivial, so add support for SMPTE 240M and BT.2020
598         matrices.
599
600         * platform/graphics/cv/VideoTextureCopierCV.cpp:
601         (WebCore::GLfloatColor::GLfloatColor):
602         (WebCore::GLfloatColor::abs):
603         (WebCore::GLfloatColor::isApproximatelyEqualTo const):
604         (WebCore::YCbCrMatrix::operator Vector<GLfloat> const):
605         (WebCore::YCbCrMatrix::YCbCrMatrix):
606         (WebCore::YCbCrMatrix::operator* const):
607         (WebCore::YCbCrToRGBMatrixForRangeAndTransferFunction):
608
609 2018-01-12  Antoine Quint  <graouts@apple.com>
610
611         Add support for the frames() timing function
612         https://bugs.webkit.org/show_bug.cgi?id=181585
613         <rdar://problem/36463317>
614
615         Reviewed by Dean.
616
617         Implement the frames() timing function as specified in the CSS Timing Functions Level 1
618         specification, specifically https://www.w3.org/TR/css-timing-1/#frames-timing-functions.
619         A frames timing function is a type of timing function that divides the input time into a
620         specified number of intervals of equal length.
621
622         Test: transitions/frames-timing-function.html
623
624         * css/CSSComputedStyleDeclaration.cpp:
625         (WebCore::createTimingFunctionValue):
626         * css/CSSTimingFunctionValue.cpp:
627         (WebCore::CSSFramesTimingFunctionValue::customCSSText const):
628         (WebCore::CSSFramesTimingFunctionValue::equals const):
629         * css/CSSTimingFunctionValue.h:
630         * css/CSSToStyleMap.cpp:
631         (WebCore::CSSToStyleMap::mapAnimationTimingFunction):
632         * css/CSSValue.cpp:
633         (WebCore::CSSValue::equals const):
634         (WebCore::CSSValue::cssText const):
635         (WebCore::CSSValue::destroy):
636         * css/CSSValue.h:
637         (WebCore::CSSValue::isFramesTimingFunctionValue const):
638         * css/CSSValueKeywords.in:
639         * css/parser/CSSPropertyParser.cpp:
640         (WebCore::consumeSteps):
641         (WebCore::consumeFrames):
642         (WebCore::consumeAnimationTimingFunction):
643         * platform/animation/TimingFunction.cpp:
644         (WebCore::operator<<):
645         (WebCore::TimingFunction::transformTime const):
646         * platform/animation/TimingFunction.h:
647         (WebCore::TimingFunction::isFramesTimingFunction const):
648         * platform/graphics/ca/GraphicsLayerCA.cpp:
649         (WebCore::animationHasFramesTimingFunction):
650         (WebCore::GraphicsLayerCA::animationCanBeAccelerated const):
651
652 2018-01-12  Commit Queue  <commit-queue@webkit.org>
653
654         Unreviewed, rolling out r226721.
655         https://bugs.webkit.org/show_bug.cgi?id=181583
656
657         Lets do a slightly different fix (Requested by anttik on
658         #webkit).
659
660         Reverted changeset:
661
662         "REGRESSION(r225650): The scores of MotionMark tests Multiply
663         and Leaves dropped by 8%"
664         https://bugs.webkit.org/show_bug.cgi?id=181460
665         https://trac.webkit.org/changeset/226721
666
667 2018-01-11  Keith Miller  <keith_miller@apple.com>
668
669         Rename ENABLE_ASYNC_ITERATION to ENABLE_JS_ASYNC_ITERATION
670         https://bugs.webkit.org/show_bug.cgi?id=181573
671
672         Reviewed by Simon Fraser.
673
674         * Configurations/FeatureDefines.xcconfig:
675
676 2018-01-11  Jiewen Tan  <jiewen_tan@apple.com>
677
678         [WebAuthN] Import a CBOR coder from Chromium
679         https://bugs.webkit.org/show_bug.cgi?id=181522
680         <rdar://problem/36055729>
681
682         Reviewed by Brent Fulgham.
683
684         This patch imports a CBOR coder including encoder and decoder from Chromium. CBOR encoder
685         is needed for WebAuthN to encode attestation object into binaries. When supporting extensions
686         in the future, CBOR encoder/decoder will be needed as well. Implementating and maintaining
687         a fully-fledged CBOR coder doesn't seem to align with WebKit's best interests. Therefore,
688         importing a most suitable third party implementation will be wise.
689
690         In this patch, it fully integrate the whole coder into our codebase. Those changes includes:
691             1. Substitute data structures that enjoy a better WTF version.
692             2. Replacing marcos.
693             3. Implementating workarounds for some functionalities that we lack fundamental types' support.
694             4. Changing the coding style to match ours.
695
696         This patch doesn't intend to improve the logic of the original codebase. Hence some of the
697         coding logic might not match what WebKit ususally has.
698
699         Here is a full list of Chromium changes that constructed this CBOR coder in chronological order:
700         6efcf495521d18d060027762f48bb292d6979136,
701         9eb43fd347890b4c6cf54c4bd7ec1bbb88e381e1,
702         31c85e74fd567772f18e0a41be468d04af721f21,
703         68672fdcad280a8ff69b91927d38d0eabf2c87f2,
704         0ca8667c0584fb21c0748ebd7468d32889759a07,
705         df763d790d7e45d70116bdefacbfd4f9faa8995e,
706         6d30c4a621c65314db63eb56e87c19ab75627b26,
707         50fe92953f4739f17a62303fedbf8db9234317c8,
708         47be22c3603424d1832d046a348ff3f982500288,
709         98a59e46948b2c71608926004fac8192b0ff2208,
710         07540c6d850ed6e0fa508d63c20a8ce96d751de6,
711         06ae32d640c8e4b86ea8914a80ee419ea16e56d8.
712
713         Covered by API tests.
714
715         * Modules/webauthn/cbor/CBORBinary.h: Added.
716         * Modules/webauthn/cbor/CBORReader.cpp: Added.
717         (cbor::CBORReader::CBORReader):
718         (cbor::CBORReader::~CBORReader):
719         (cbor::CBORReader::read):
720         (cbor::CBORReader::decodeCBOR):
721         (cbor::CBORReader::readVariadicLengthInteger):
722         (cbor::CBORReader::decodeValueToNegative):
723         (cbor::CBORReader::decodeValueToUnsigned):
724         (cbor::CBORReader::readSimpleValue):
725         (cbor::CBORReader::readString):
726         Workarounds applied.
727         (cbor::CBORReader::readBytes):
728         (cbor::CBORReader::readCBORArray):
729         (cbor::CBORReader::readCBORMap):
730         (cbor::CBORReader::canConsume):
731         (cbor::CBORReader::checkMinimalEncoding):
732         (cbor::CBORReader::checkExtraneousData):
733         (cbor::CBORReader::checkDuplicateKey):
734         (cbor::CBORReader::hasValidUTF8Format):
735         Workarounds applied.
736         (cbor::CBORReader::checkOutOfOrderKey):
737         (cbor::CBORReader::getErrorCode):
738         (cbor::CBORReader::errorCodeToString):
739         * Modules/webauthn/cbor/CBORReader.h: Added.
740         * Modules/webauthn/cbor/CBORValue.cpp: Added.
741         (cbor::CBORValue::CBORValue):
742         (cbor::CBORValue::operator=):
743         (cbor::CBORValue::~CBORValue):
744         (cbor::CBORValue::clone const):
745         (cbor::CBORValue::getInteger const):
746         (cbor::CBORValue::getUnsigned const):
747         (cbor::CBORValue::getNegative const):
748         (cbor::CBORValue::getString const):
749         (cbor::CBORValue::getByteString const):
750         (cbor::CBORValue::getArray const):
751         (cbor::CBORValue::getMap const):
752         (cbor::CBORValue::getSimpleValue const):
753         (cbor::CBORValue::internalMoveConstructFrom):
754         (cbor::CBORValue::internalCleanup):
755         * Modules/webauthn/cbor/CBORValue.h: Added.
756         * Modules/webauthn/cbor/CBORWriter.cpp: Added.
757         (cbor::CBORWriter::~CBORWriter):
758         (cbor::CBORWriter::write):
759         (cbor::CBORWriter::CBORWriter):
760         (cbor::CBORWriter::encodeCBOR):
761         Workarounds applied.
762         (cbor::CBORWriter::startItem):
763         (cbor::CBORWriter::setAdditionalInformation):
764         (cbor::CBORWriter::setUint):
765         (cbor::CBORWriter::getNumUintBytes):
766         * Modules/webauthn/cbor/CBORWriter.h: Added.
767         * Sources.txt:
768         * WebCore.xcodeproj/project.pbxproj:
769
770 2018-01-11  Chris Dumez  <cdumez@apple.com>
771
772         Setting Window.opener to null should disown its opener
773         https://bugs.webkit.org/show_bug.cgi?id=181505
774         <rdar://problem/36443151>
775
776         Reviewed by Ryosuke Niwa.
777
778         Setting Window.opener to null should disown its opener as per:
779         - https://html.spec.whatwg.org/#dom-opener
780
781         With this change, tabs opened by clicking link inside Gmail no
782         longer have the Gmail window as opener.
783
784         Tests: fast/dom/Window/window-opener-set-to-null.html
785                fast/dom/Window/window-opener-shadowing.html
786
787         * bindings/js/JSDOMWindowCustom.cpp:
788         (WebCore::JSDOMWindow::setOpener):
789         * page/DOMWindow.cpp:
790         (WebCore::DOMWindow::disownOpener):
791         * page/DOMWindow.h:
792         * page/DOMWindow.idl:
793
794 2018-01-11  Myles C. Maxfield  <mmaxfield@apple.com>
795
796         [Cocoa] Star character disappears when bolded
797         https://bugs.webkit.org/show_bug.cgi?id=181568
798         <rdar://problem/18755569>
799
800         Reviewed by Simon Fraser.
801
802         We had some code in ComplexTextController to ask the FontCache for a font, given the name
803         of a particular font CoreText used inside a CTRun. This is wrong for two reasons: fonts
804         are not identifiable by PostScript name (in the general case), and because the lookup
805         procedure requires a FontDescription, the result may yield a font that is not the one
806         looked up. The goal of this code was simply to preserve the rendering mode of the font,
807         but we removed support for these rendering modes years ago. So the solution is to skip
808         that lookup and use the CoreText font directly.
809
810         Test: fast/text/unknown-font.html
811
812         * platform/graphics/mac/ComplexTextControllerCoreText.mm:
813         (WebCore::ComplexTextController::collectComplexTextRunsForCharacters):
814
815 2018-01-11  Keith Rollin  <krollin@apple.com>
816
817         Add optional logging of ITP-related user interaction information
818         https://bugs.webkit.org/show_bug.cgi?id=181556
819
820         Reviewed by Brent Fulgham.
821
822         In order to support the tracking of the efficacy of Intelligent
823         Tracking Protection, add some logging indicating when the user
824         interacts with a page in a way that affects cookie partitioning. This
825         logging is off by default, and is enabled with `defaults write -g
826         WebKitLogCookieInformation -bool true`.
827
828         No new tests -- no changed functionality.
829
830         * loader/ResourceLoadObserver.cpp:
831         (WebCore::ResourceLoadObserver::logUserInteractionWithReducedTimeResolution):
832         * loader/ResourceLoadObserver.h:
833         (WebCore::ResourceLoadObserver::shouldLogUserInteraction const):
834         (WebCore::ResourceLoadObserver::setShouldLogUserInteraction):
835
836 2018-01-11  James Craig  <jcraig@apple.com>
837
838         AX: when invert colors is on, double-invert video elements in UserAgentStyleSheet
839         https://bugs.webkit.org/show_bug.cgi?id=168447
840         <rdar://problem/30559874>
841
842         Reviewed by Simon Fraser.
843
844         Double-invert video when platform "invert colors" setting is enabled. Behavior matches 
845         current "Smart Invert" feature of Safari Reader on macOS/iOS and other iOS native apps.
846
847         Tests: accessibility/smart-invert-reference.html
848                accessibility/smart-invert.html
849
850         * Modules/modern-media-controls/controls/media-controls.css:
851         (@media (inverted-colors)):
852         (:host):
853         (picture):
854         * css/html.css:
855         (@media (inverted-colors)):
856         (video):
857
858 2018-01-11  Wenson Hsieh  <wenson_hsieh@apple.com>
859
860         Don't load inline data when requesting info for an attachment element backed by a file path
861         https://bugs.webkit.org/show_bug.cgi?id=181550
862
863         Reviewed by Tim Horton.
864
865         When requesting data for an attachment element that is backed by a file path, we currently trigger a load in the
866         web process to fetch contents of the attachment data as inline data in the AttachmentInfo. This is unnecessary,
867         since the file path of the attachment element must have come from the UI process anyways, so it is sufficient to
868         simply send the file path to the UI process and have the UI process read the contents of the path as a memory-
869         mapped NSData.
870
871         This patch lets HTMLAttachmentElement skip over resource loading codepaths when creating an AttachmentInfo for
872         the client, and also teaches _WKAttachment to read a AttachmentInfo's filepath as memory-mapped data if a file
873         path is present, and no inline data was specified.
874
875         Covered by existing API tests.
876
877         * html/HTMLAttachmentElement.cpp:
878         (WebCore::HTMLAttachmentElement::requestInfo):
879
880 2018-01-10  Ryosuke Niwa  <rniwa@webkit.org>
881
882         Make elements of zero width or height focusable
883         https://bugs.webkit.org/show_bug.cgi?id=181516
884
885         Reviewed by Chris Dumez.
886
887         Don't check render box's size or bounding rect when deciding whether an element is focusable.
888         New behavior matches that of Firefox and Chrome.
889
890         Test: fast/events/focus-zero-size-element.html
891
892         * dom/Element.cpp:
893         (WebCore::Element::isFocusable): Only update the style.
894         * html/HTMLFormControlElement.cpp:
895         (WebCore::HTMLFormControlElement::isFocusable const): Deleted.
896         * html/HTMLFormControlElement.h:
897         * mathml/MathMLElement.cpp:
898         (WebCore::MathMLElement::isFocusable const): Deleted. As far as I can tell, no math ml element is focusable.
899         * mathml/MathMLElement.h:
900         * svg/SVGAElement.cpp:
901         (WebCore::SVGAElement::isFocusable const): Deleted.
902         * svg/SVGAElement.h:
903
904 2018-01-11  Filip Pizlo  <fpizlo@apple.com>
905
906         Rename MarkedAllocator to BlockDirectory and AllocatorAttributes to CellAttributes
907         https://bugs.webkit.org/show_bug.cgi?id=181543
908
909         Rubber stamped by Michael Saboff.
910
911         No new tests because I'm just renaming things.
912
913         * ForwardingHeaders/heap/BlockDirectoryInlines.h: Copied from Source/WebCore/ForwardingHeaders/heap/MarkedAllocatorInlines.h.
914         * ForwardingHeaders/heap/MarkedAllocatorInlines.h: Removed.
915         * bindings/js/DOMGCOutputConstraint.cpp:
916
917 2018-01-11  Alex Christensen  <achristensen@webkit.org>
918
919         REGRESSION(r225003): Loading hangs in environments where dispatch_async does not work
920         https://bugs.webkit.org/show_bug.cgi?id=181553
921         <rdar://problem/35733938>
922
923         Reviewed by Eric Carlson.
924
925         There is an environment where dispatch_async does not work, but performSelectorOnMainThread works.
926         r225003 broke loading in this environment.  This fixes it and updates the test that r225003 fixed.
927         It failed sometimes because loading was happening in a different order than html parsing, so I made
928         the test not depend on html parsing timing by updating media/video-src-remove.html.
929
930         * platform/network/mac/WebCoreResourceHandleAsOperationQueueDelegate.mm:
931         (-[WebCoreResourceHandleAsOperationQueueDelegate callFunctionOnMainThread:]):
932
933 2018-01-11  Dean Jackson  <dino@apple.com>
934
935         Rolling out 226814. It crashes on some bots.
936
937 2018-01-11  Dean Jackson  <dino@apple.com>
938
939         [WebGL] Simulated vertexAttrib0 can sometimes cause OUT_OF_MEMORY errors
940         https://bugs.webkit.org/show_bug.cgi?id=181558
941         <rdar://problem/36189833>
942
943         Reviewed by Eric Carlson.
944
945         Very large element indices in the ELEMENT_ARRAY_BUFFER meant that
946         our simulated vertexAttrib0 buffer might be too large. We need
947         to check for out-of-memory, but we can also detect some of the issues
948         earlier in our validation code. Additionally, make sure that we don't
949         accidentally cast an unsigned to a signed.
950
951         Test: fast/canvas/webgl/simulated-vertexAttrib0-invalid-indicies.html
952
953         * html/canvas/WebGL2RenderingContext.cpp:
954         (WebCore::WebGL2RenderingContext::validateIndexArrayConservative): Update validation
955         code to look for overflow, rather than relying on looking for sign changes.
956         * html/canvas/WebGLRenderingContext.cpp:
957         (WebCore::WebGLRenderingContext::validateIndexArrayConservative): Ditto.
958         * html/canvas/WebGLRenderingContextBase.cpp:
959         (WebCore::WebGLRenderingContextBase::validateIndexArrayPrecise):
960         (WebCore::WebGLRenderingContextBase::drawArrays): Check that we were able to simulate.
961         (WebCore::WebGLRenderingContextBase::drawElements):
962         (WebCore::WebGLRenderingContextBase::validateSimulatedVertexAttrib0): Update validation code, and
963         use GC3Duint, since that's what the indicies are.
964         (WebCore::WebGLRenderingContextBase::simulateVertexAttrib0): Ditto.
965         (WebCore::WebGLRenderingContextBase::drawArraysInstanced): Check that we were able to simulate.
966         (WebCore::WebGLRenderingContextBase::drawElementsInstanced):
967         * html/canvas/WebGLRenderingContextBase.h:
968
969 2018-01-11  Chris Dumez  <cdumez@apple.com>
970
971         ASSERTION FAILED: registration in WebCore::SWServerWorker::skipWaiting()
972         https://bugs.webkit.org/show_bug.cgi?id=181222
973         <rdar://problem/36332686>
974
975         Reviewed by Youenn Fablet.
976
977         Replace assertion in SWServerWorker::skipWaiting() that assumes the worker
978         has a registration. Nowadays, a SWServerWorker can stay alive for a short
979         period without having a registration, while it is terminating.
980
981         No new tests, unskipped existing test.
982
983         * workers/service/server/SWServerWorker.cpp:
984         (WebCore::SWServerWorker::skipWaiting):
985
986 2018-01-11  Antti Koivisto  <antti@apple.com>
987
988         Don't call RenderElement::setStyle when nothing changes
989         https://bugs.webkit.org/show_bug.cgi?id=181530
990
991         Reviewed by Zalan Bujtas.
992
993         * style/StyleChange.h:
994
995         Remove 'Force' value. This essentially meant 'compute style for all descendants and call setStyle unconditionally'.
996         Using this value lost information about whether anything actually changed in a particular style as it was automatically
997         inherited by all descendants. The 'compute all descendants' part of the behavior is what is actually needed.
998
999         Instead add separate DescendantsToResolve enum for communicating what else to compute.
1000
1001         * style/StyleTreeResolver.cpp:
1002         (WebCore::Style::TreeResolver::Parent::Parent):
1003         (WebCore::Style::computeDescendantsToResolve):
1004
1005             Figure out which descendants will need resolving based on how the current elements style changed.
1006
1007         (WebCore::Style::TreeResolver::resolveElement):
1008         (WebCore::Style::TreeResolver::createAnimatedElementUpdate):
1009         (WebCore::Style::TreeResolver::pushParent):
1010         (WebCore::Style::shouldResolveElement):
1011
1012             Use DescendantsToResolve as input.
1013
1014         (WebCore::Style::TreeResolver::resolveComposedTree):
1015         * style/StyleTreeResolver.h:
1016         * style/StyleUpdate.h:
1017         (WebCore::Style::ElementUpdates::ElementUpdates):
1018
1019             Add DescendantsToResolve.
1020
1021 2018-01-11  Wenson Hsieh  <wenson_hsieh@apple.com>
1022
1023         Send PromisedBlobInfo to the client through DragItem instead of DragClient::prepareToDragPromisedBlob
1024         https://bugs.webkit.org/show_bug.cgi?id=181497
1025
1026         Reviewed by Tim Horton.
1027
1028         Refactor drag initiation with DOMFile-backed attachment elements. See WebKit ChangeLog for more information. No
1029         change in behavior; promised blob dragging covered by WKAttachment API tests.
1030
1031         * loader/EmptyClients.cpp:
1032         * page/DragClient.h:
1033         (WebCore::DragClient::prepareToDragPromisedBlob): Deleted.
1034         * page/DragController.cpp:
1035         (WebCore::DragController::startDrag):
1036         (WebCore::DragController::doImageDrag):
1037         (WebCore::DragController::doSystemDrag):
1038         (WebCore::DragController::promisedBlobInfo):
1039         (WebCore::DragController::dragAttachmentElement): Deleted.
1040         * page/DragController.h:
1041         * platform/DragItem.h:
1042         (WebCore::DragItem::encode const):
1043         (WebCore::DragItem::decode):
1044
1045 2018-01-11  Youenn Fablet  <youenn@apple.com>
1046
1047         RTCController should disable ICE candidate filtering in case of getUserMedia based on the RTCPerrConnection origin
1048         https://bugs.webkit.org/show_bug.cgi?id=180851
1049
1050         Reviewed by Eric Carlson.
1051
1052         Test: http/wpt/webrtc/third-party-frame-ice-candidate-filtering.html
1053
1054         RTCController now stores all the client origins (top+frame origins) of frames that got access to camera/microphone access.
1055         For any such client origin, PeerConnection objects ICE candidate filtering is disabled.
1056         ICE candidate filtering is reset whenever navigating/reloading the page.
1057
1058         * Modules/mediastream/RTCController.cpp:
1059         (WebCore::RTCController::reset):
1060         (WebCore::matchDocumentOrigin):
1061         (WebCore::RTCController::shouldDisableICECandidateFiltering):
1062         (WebCore::RTCController::add):
1063         (WebCore::RTCController::disableICECandidateFilteringForAllOrigins):
1064         (WebCore::RTCController::disableICECandidateFiltering):
1065         (WebCore::RTCController::enableICECandidateFiltering):
1066         * Modules/mediastream/RTCController.h:
1067         * Modules/mediastream/RTCPeerConnection.cpp:
1068         (WebCore::RTCPeerConnection::create):
1069         * Modules/mediastream/UserMediaRequest.cpp:
1070         (WebCore::UserMediaRequest::allow):
1071         * page/Page.cpp:
1072         (WebCore::Page::disableICECandidateFiltering):
1073         * testing/Internals.cpp:
1074         (WebCore::Internals::setICECandidateFiltering):
1075
1076 2018-01-11  Ali Juma  <ajuma@chromium.org>
1077
1078         window.visualViewport should behave as [SameObject]
1079         https://bugs.webkit.org/show_bug.cgi?id=181548
1080
1081         Reviewed by Chris Dumez.
1082
1083         Add 'GenerateIsReachable' to VisualViewport so that window.visualViewport's
1084         JS wrapper object doesn't get garbage collected too soon.
1085
1086         Test: fast/visual-viewport/visual-viewport-same-object.html
1087
1088         * page/VisualViewport.idl:
1089
1090 2018-01-11  Basuke Suzuki  <Basuke.Suzuki@sony.com>
1091
1092         [Curl] Extract multipart handling from ResourceHandle to CurlRequest.
1093         https://bugs.webkit.org/show_bug.cgi?id=181506
1094
1095         Reviewed by Alex Christensen.
1096
1097         Rename old MultipartHandle class to CurlMultipartHandle and modernize it. Also move the responsibility 
1098         of handling multi part from ResourceHandle to CurlRequest. This is required for upcoming NetworkLoadTask.
1099
1100         No new tests because no new behavior.
1101
1102         * platform/Curl.cmake:
1103         * platform/network/curl/CurlMultipartHandle.cpp: Renamed from Source/WebCore/platform/network/curl/MultipartHandle.cpp.
1104         (WebCore::CurlMultipartHandle::createIfNeeded):
1105         (WebCore::CurlMultipartHandle::extractBoundary):
1106         (WebCore::CurlMultipartHandle::extractBoundaryFromContentType):
1107         (WebCore::CurlMultipartHandle::CurlMultipartHandle):
1108         (WebCore::CurlMultipartHandle::didReceiveData):
1109         (WebCore::CurlMultipartHandle::didComplete):
1110         (WebCore::CurlMultipartHandle::processContent):
1111         (WebCore::CurlMultipartHandle::checkForBoundary):
1112         (WebCore::CurlMultipartHandle::matchedLength):
1113         (WebCore::CurlMultipartHandle::parseHeadersIfPossible):
1114         * platform/network/curl/CurlMultipartHandle.h: Renamed from Source/WebCore/platform/network/curl/MultipartHandle.h.
1115         (WebCore::CurlMultipartHandle::~CurlMultipartHandle):
1116         * platform/network/curl/CurlMultipartHandleClient.h: Added.
1117         (WebCore::CurlMultipartHandleClient::~CurlMultipartHandleClient):
1118         * platform/network/curl/CurlRequest.cpp:
1119         (WebCore::CurlRequest::CurlRequest):
1120         (WebCore::CurlRequest::didReceiveHeader):
1121         (WebCore::CurlRequest::didReceiveData):
1122         (WebCore::CurlRequest::didReceiveHeaderFromMultipart):
1123         (WebCore::CurlRequest::didReceiveDataFromMultipart):
1124         (WebCore::CurlRequest::didCompleteTransfer):
1125         (WebCore::CurlRequest::finalizeTransfer):
1126         (WebCore::CurlRequest::invokeDidReceiveResponseForFile):
1127         (WebCore::CurlRequest::invokeDidReceiveResponse):
1128         (WebCore::CurlRequest::completeDidReceiveResponse):
1129         * platform/network/curl/CurlRequest.h:
1130         (WebCore::CurlRequest::create):
1131         * platform/network/curl/ResourceHandleCurlDelegate.cpp:
1132         (WebCore::ResourceHandleCurlDelegate::createCurlRequest):
1133         (WebCore::ResourceHandleCurlDelegate::curlDidReceiveResponse):
1134         (WebCore::ResourceHandleCurlDelegate::curlDidReceiveBuffer):
1135         (WebCore::ResourceHandleCurlDelegate::curlDidComplete):
1136         * platform/network/curl/ResourceHandleCurlDelegate.h:
1137
1138 2018-01-11  Zalan Bujtas  <zalan@apple.com>
1139
1140         RenderTreeUpdater::current() returns null_ptr when mutation is done through Document::resolveStyle.
1141         https://bugs.webkit.org/show_bug.cgi?id=181513
1142         <rdar://problem/36367085>
1143
1144         Reviewed by Antti Koivisto.
1145
1146         This patch ensures that we use a valid RenderTreeBuilder even when
1147         Document::resolveStyle (incorrectly) triggers tree mutation.
1148         It can be reverted soon after the incorrect mutations are taken care of.
1149
1150         Test: fast/forms/button-set-text-crash.html
1151
1152         * rendering/RenderButton.cpp:
1153         (WebCore::RenderButton::setText):
1154         * rendering/RenderMenuList.cpp:
1155         (RenderMenuList::setText):
1156
1157 2018-01-11  Antoine Quint  <graouts@apple.com>
1158
1159         Only listen to webkitplaybacktargetavailabilitychanged when media controls are visible to the user
1160         https://bugs.webkit.org/show_bug.cgi?id=181547
1161         <rdar://problem/35947650>
1162
1163         Reviewed by Eric Carlson.
1164
1165         Because listening to "webkitplaybacktargetavailabilitychanged" events incurs some higher power usage on iOS,
1166         we only listen to such events when controls are visible to the user. In other words, the MediaControls need to
1167         have both "visible" set to "true" and "faded" set to "false". To support this, we add a delegate method on
1168         MediaControls such that it can tell the MediaController that the "visible" property changed. With this message,
1169         MediaController can inform its MediaControllerSupport objects that user visibility of the controls changed, which
1170         lets AirplaySupport disable itself when controls are no longer visible.
1171
1172         Test: media/modern-media-controls/airplay-support/airplay-support-disable-event-listeners-with-hidden-controls.html
1173
1174         * Modules/modern-media-controls/controls/media-controls.js:
1175         (MediaControls.prototype.set visible):
1176         * Modules/modern-media-controls/media/airplay-support.js:
1177         (AirplaySupport.prototype.controlsUserVisibilityDidChange):
1178         * Modules/modern-media-controls/media/media-controller-support.js:
1179         (MediaControllerSupport.prototype.controlsUserVisibilityDidChange):
1180         * Modules/modern-media-controls/media/media-controller.js:
1181         (MediaController.prototype.mediaControlsVisibilityDidChange):
1182         (MediaController.prototype.mediaControlsFadedStateDidChange):
1183         (MediaController.prototype._controlsUserVisibilityDidChange):
1184
1185 2018-01-11  Antoine Quint  <graouts@apple.com>
1186
1187         [iOS] There should be no controls markup generated in fullscreen
1188         https://bugs.webkit.org/show_bug.cgi?id=181540
1189         <rdar://problem/35060379>
1190
1191         Reviewed by Eric Carlson.
1192
1193         We completely forgo the display of any content when fullscreen on iOS by setting the
1194         "visible" flag to "false" on the MediaControls, which will prevent any DOM content from
1195         being added.
1196
1197         * Modules/modern-media-controls/media/media-controller.js:
1198         (MediaController.prototype.handleEvent):
1199         (MediaController.prototype._updateiOSFullscreenProperties):
1200         (MediaController):
1201         (MediaController.prototype._updateSupportingObjectsEnabledState): Deleted.
1202
1203 2018-01-11  Alex Christensen  <achristensen@webkit.org>
1204
1205         Revert changes accidentally committed with r226789.
1206         https://bugs.webkit.org/show_bug.cgi?id=181423
1207
1208         I had some local changes I did not mean to commit.
1209
1210         * platform/network/mac/WebCoreResourceHandleAsOperationQueueDelegate.mm:
1211         (scheduledWithCustomRunLoopMode):
1212         (-[WebCoreResourceHandleAsOperationQueueDelegate callFunctionOnMainThread:]):
1213         (WebCore::if): Deleted.
1214         (WebCore::>::fromCallable): Deleted.
1215
1216 2018-01-10  Simon Fraser  <simon.fraser@apple.com>
1217
1218         On macOS, getBoundingClientRect gives incorrect values when pinch-zoomed
1219         https://bugs.webkit.org/show_bug.cgi?id=181511
1220         rdar://problem/33741427
1221
1222         Reviewed by Zalan Bujtas.
1223         
1224         When reverting "client coordinates are relative to layout viewport" in r219829
1225         I broke documentToClientOffset() on macOS by failing to take pinch zoom scale into
1226         account (frameScaleFactor() is always 1 on iOs, so this bug doesn't manifest there).
1227
1228         Covered by existing tests.
1229
1230         * page/FrameView.cpp:
1231         (WebCore::FrameView::documentToClientOffset const):
1232
1233 2018-01-11  Youenn Fablet  <youenn@apple.com>
1234
1235         Replace WebRTCLegacyAPIDisabled by WebRTCLegacyAPIEnabled and switch off WebRTC legacy flag by default
1236         https://bugs.webkit.org/show_bug.cgi?id=181480
1237
1238         Reviewed by Eric Carlson.
1239
1240         No change of behavior.
1241
1242         * page/RuntimeEnabledFeatures.h: Set default value to false.
1243
1244 2018-01-11  Wenson Hsieh  <wenson_hsieh@apple.com>
1245
1246         [Attachment Support] Support moving attachment elements in editable areas using drag and drop
1247         https://bugs.webkit.org/show_bug.cgi?id=181337
1248         <rdar://problem/36324813>
1249
1250         Reviewed by Tim Horton.
1251
1252         Makes slight adjustments to attachment-specific drag and drop logic to ensure that moving attachments via drag
1253         and drop behaves correctly. See per-change comments for more detail.
1254
1255         Tests:  WKAttachmentTests.DragInPlaceVideoAttachmentElement
1256                 WKAttachmentTests.MoveAttachmentElementAsIconByDragging
1257                 WKAttachmentTests.MoveInPlaceAttachmentElementByDragging
1258
1259         * editing/cocoa/EditorCocoa.mm:
1260         (WebCore::Editor::getPasteboardTypesAndDataForAttachment):
1261
1262         Stop vending the private web archive pasteboard type for attachments, for now. This works around issues where an
1263         attachment element that is dragged and dropped within the same page may lose its blob backing data if we try to
1264         remove and insert it as a fragment from the archive. Providing a web archive would allow us to avoid destroying
1265         and recreating an attachment element when dragging within the same page, but this is a nice-to-have optimization
1266         we can re-enable after investigation in a subsequent patch.
1267
1268         * html/HTMLAttachmentElement.cpp:
1269         (WebCore::HTMLAttachmentElement::populateShadowRootIfNecessary):
1270
1271         Add `draggable=false` to the image element of an in-place attachment element.
1272
1273         * page/DragController.cpp:
1274         (WebCore::enclosingAttachmentElement):
1275         (WebCore::DragController::draggableElement const):
1276
1277         Tweak single-selected-attachment handling to account for in-place attachments. Since the hit-tested node is
1278         inside the shadow subtree of the attachment element, the condition needs to check for the startElement as well
1279         as the startElement's shadow host.
1280
1281         (WebCore::DragController::startDrag):
1282
1283         Make two tweaks here. First, don't require a RenderAttachment to drag an attachment element (this is required
1284         for dragging in-place attachments). This was added in r217083 to address <rdar://problem/32282831>, but is no
1285         longer correct, since attachments may now be displayed in-place.
1286
1287         Secondly, only restore the previous selection if the attachment is in a richly contenteditable area. This was
1288         added to prevent the selection highlight from appearing in when dragging non-editable attachment elements in the
1289         Mail viewer. However, to allow drag moves to occur, we need the selection to persist after drag start.
1290
1291 2018-01-04  Filip Pizlo  <fpizlo@apple.com>
1292
1293         CodeBlocks should be in IsoSubspaces
1294         https://bugs.webkit.org/show_bug.cgi?id=180884
1295
1296         Reviewed by Saam Barati.
1297
1298         No new tests because no new behavior.
1299         
1300         Adopting new parallel constraint API, so that more of the logic of doing parallel
1301         constraint solving is shared between the DOM's output constraints and JSC's output
1302         constraints.
1303
1304         * bindings/js/DOMGCOutputConstraint.cpp:
1305         (WebCore::DOMGCOutputConstraint::executeImpl):
1306         (WebCore::DOMGCOutputConstraint::doParallelWorkImpl): Deleted.
1307         (WebCore::DOMGCOutputConstraint::finishParallelWorkImpl): Deleted.
1308         * bindings/js/DOMGCOutputConstraint.h:
1309
1310 2018-01-11  Wenson Hsieh  <wenson_hsieh@apple.com>
1311
1312         [Attachment Support] Support dragging attachment elements out as files on iOS
1313         https://bugs.webkit.org/show_bug.cgi?id=181199
1314         <rdar://problem/36299316>
1315
1316         Reviewed by Tim Horton, Andy Estes and Joseph Pecoraro.
1317
1318         Adds support for dragging "files" (i.e. creating item providers with preferred attachment presentation styles)
1319         from attachment elements on iOS for Mail. See below for more detail.
1320
1321         Tests:  WKAttachmentTestsIOS.DragAttachmentInsertedAsData
1322                 WKAttachmentTestsIOS.DragAttachmentInsertedAsFile
1323
1324         * page/DragController.cpp:
1325         (WebCore::DragController::platformContentTypeForBlobType const):
1326         (WebCore::DragController::dragAttachmentElement):
1327         * page/DragController.h:
1328         * page/mac/DragControllerMac.mm:
1329         (WebCore::DragController::platformContentTypeForBlobType const):
1330
1331         Add a private method to convert the type of a promised blob to a platform type. For Cocoa platforms, this
1332         converts the blob type (either a UTI or a MIME type) to a UTI for the platform to consume.
1333
1334         * platform/ios/WebItemProviderPasteboard.h:
1335         * platform/ios/WebItemProviderPasteboard.mm:
1336
1337         Refactor WebItemProviderRegistrationInfo. WebItemProviderRegistrationInfo currently encapsulates a single item
1338         provider registration call, and contains either a type identifier and data buffer, or an NSItemProviderWriting-
1339         conformant object. To register an item provider using a WebItemProviderRegistrationInfo, the item provider
1340         pasteboard currently checks to see whether the info contains an object or a type and data.
1341
1342         This patch removes WebItemProviderRegistrationInfo and replaces it with WebItemProviderDataRegistrar. Objects
1343         that implement this protocol know how to take an NSItemProvider and register data to it. So far, there are
1344         three implementations below.
1345
1346         (-[WebItemProviderDataRegistrar initWithData:type:]):
1347         (-[WebItemProviderDataRegistrar typeIdentifier]):
1348         (-[WebItemProviderDataRegistrar data]):
1349         (-[WebItemProviderDataRegistrar typeIdentifierForClient]):
1350         (-[WebItemProviderDataRegistrar dataForClient]):
1351         (-[WebItemProviderDataRegistrar registerItemProvider:]):
1352         (-[WebItemProviderDataRegistrar description]):
1353
1354         A data registrar takes a UTI and data buffer, and registers the UTI to the data. This replaces a
1355         WebItemProviderRegistrationInfo with both a type and data, but no representing object.
1356
1357         (-[WebItemProviderWritableObjectRegistrar initWithObject:]):
1358         (-[WebItemProviderWritableObjectRegistrar representingObjectForClient]):
1359         (-[WebItemProviderWritableObjectRegistrar registerItemProvider:]):
1360         (-[WebItemProviderWritableObjectRegistrar description]):
1361
1362         The writable object registrar writes an NSItemProviderWriting-conformant object to an item provider. This
1363         replaces a WebItemProviderRegistrationInfo with only a representing object.
1364
1365         (-[WebItemProviderPromisedFileRegistrar initWithType:callback:]):
1366         (-[WebItemProviderPromisedFileRegistrar registerItemProvider:]):
1367         (-[WebItemProviderPromisedFileRegistrar description]):
1368         (-[WebItemProviderRegistrationInfoList addData:forType:]):
1369         (-[WebItemProviderRegistrationInfoList addRepresentingObject:]):
1370         (-[WebItemProviderRegistrationInfoList addPromisedType:fileCallback:]):
1371
1372         Helper methods to add new registrars to a registration info list.
1373
1374         (-[WebItemProviderRegistrationInfoList itemAtIndex:]):
1375         (-[WebItemProviderRegistrationInfoList enumerateItems:]):
1376         (-[WebItemProviderRegistrationInfoList itemProvider]):
1377         (-[WebItemProviderRegistrationInfoList description]):
1378         (-[WebItemProviderRegistrationInfo initWithRepresentingObject:typeIdentifier:data:]): Deleted.
1379         (-[WebItemProviderRegistrationInfo representingObject]): Deleted.
1380         (-[WebItemProviderRegistrationInfo typeIdentifier]): Deleted.
1381
1382 2018-01-11  Michael Saboff  <msaboff@apple.com>
1383
1384         Add a DOM gadget for Spectre testing
1385         https://bugs.webkit.org/show_bug.cgi?id=181351
1386
1387         Reviewed by Ryosuke Niwa.
1388
1389         This change is used to test Spectre mitigations.
1390
1391         Added a new DOM class to test for Spectre issues in the DOM layer.
1392         This additional functionality is disabled by default and must be enabled
1393         through the JSC option "enableSpectreGadgets".
1394
1395         * CMakeLists.txt:
1396         * DerivedSources.make:
1397         * Sources.txt:
1398         * WebCore.xcodeproj/project.pbxproj:
1399         * bindings/js/WebCoreBuiltinNames.h:
1400         * dom/SpectreGadget.cpp: Added.
1401         (WebCore::SpectreGadget::SpectreGadget):
1402         (WebCore::SpectreGadget::create):
1403         (WebCore::SpectreGadget::setReadLength):
1404         (WebCore::SpectreGadget::charCodeAt):
1405         (WebCore::SpectreGadget::clflushReadLength):
1406         * dom/SpectreGadget.h: Added.
1407         * dom/SpectreGadget.idl: Added.
1408         * page/RuntimeEnabledFeatures.cpp:
1409         (WebCore::RuntimeEnabledFeatures::spectreGadgetsEnabled const):
1410         * page/RuntimeEnabledFeatures.h:
1411
1412 2018-01-11  Philippe Normand  <pnormand@igalia.com>
1413
1414         [GTK] media/muted-video-is-playing-audio.html is timing out
1415         https://bugs.webkit.org/show_bug.cgi?id=163781
1416
1417         Reviewed by Carlos Garcia Campos.
1418
1419         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:
1420         (WebCore::MediaPlayerPrivateGStreamer::notifyPlayerOfVideo): Sprinkle some debugging.
1421         (WebCore::MediaPlayerPrivateGStreamer::notifyPlayerOfAudio): Ditto.
1422         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp:
1423         (WebCore::MediaPlayerPrivateGStreamerBase::setMuted): Ditto.
1424
1425 2018-01-10  Andy Estes  <aestes@apple.com>
1426
1427         [Payment Request] Rename ApplePayMerchantValidationEvent to MerchantValidationEvent
1428         https://bugs.webkit.org/show_bug.cgi?id=181437
1429         <rdar://problem/36376481>
1430
1431         Reviewed by Tim Horton.
1432         
1433         Renamed ApplePayMerchantValidationEvent to MerchantValidationEvent and changed complete() to accept a Promise.
1434
1435         Test: http/tests/paymentrequest/payment-request-merchant-validation.https.html
1436
1437         * DerivedSources.make:
1438         * Modules/applepay/paymentrequest/ApplePayPaymentHandler.cpp:
1439         (WebCore::ApplePayPaymentHandler::merchantValidationCompleted):
1440         (WebCore::ApplePayPaymentHandler::validateMerchant):
1441         * Modules/applepay/paymentrequest/ApplePayPaymentHandler.h:
1442         * Modules/paymentrequest/MerchantValidationEvent.cpp: Renamed from Source/WebCore/Modules/applepay/paymentrequest/ApplePayMerchantValidationEvent.cpp.
1443         (WebCore::MerchantValidationEvent::create):
1444         (WebCore::MerchantValidationEvent::MerchantValidationEvent):
1445         (WebCore::MerchantValidationEvent::eventInterface const):
1446         (WebCore::MerchantValidationEvent::complete):
1447         * Modules/paymentrequest/MerchantValidationEvent.h: Renamed from Source/WebCore/Modules/applepay/paymentrequest/ApplePayMerchantValidationEvent.h.
1448         * Modules/paymentrequest/MerchantValidationEvent.idl: Renamed from Source/WebCore/Modules/applepay/paymentrequest/ApplePayMerchantValidationEvent.idl.
1449         * Modules/paymentrequest/PaymentHandler.h:
1450         * Modules/paymentrequest/PaymentRequest.cpp:
1451         (WebCore::PaymentRequest::completeMerchantValidation):
1452         * Modules/paymentrequest/PaymentRequest.h:
1453         * Modules/paymentrequest/PaymentRequest.idl:
1454         * WebCore.xcodeproj/project.pbxproj:
1455         * dom/EventNames.h:
1456         * dom/EventNames.in:
1457
1458 2018-01-10  Basuke Suzuki  <Basuke.Suzuki@sony.com>
1459
1460         [Curl] Cross-protocol, cross-site scripting (XPXSS) using HTML forms
1461         Nhttps://bugs.webkit.org/show_bug.cgi?id=153088
1462
1463         Reviewed by Alex Christensen.
1464
1465         No new tests because it's covered by existing tests.
1466
1467         * platform/network/curl/CurlContext.cpp:
1468         (WebCore::CurlHandle::getHttpVersion):
1469         * platform/network/curl/CurlContext.h:
1470         * platform/network/curl/CurlRequest.cpp:
1471         (WebCore::CurlRequest::didReceiveHeader):
1472         * platform/network/curl/CurlResponse.h:
1473         (WebCore::CurlResponse::isolatedCopy const):
1474         * platform/network/curl/ResourceResponseCurl.cpp:
1475         (WebCore::ResourceResponse::ResourceResponse):
1476         (WebCore::ResourceResponse::setStatusLine):
1477
1478 2018-01-10  Wenson Hsieh  <wenson_hsieh@apple.com>
1479
1480         REGRESSION(r222507): Composition highlight doesn't render when using IME
1481         https://bugs.webkit.org/show_bug.cgi?id=181485
1482         <rdar://problem/35896516>
1483
1484         Reviewed by Ryosuke Niwa.
1485
1486         Fixes the order of arguments passed to paintTextSubrangeBackground from paintCompositionBackground.
1487
1488         Test: editing/marked-text-appearance.html
1489
1490         * rendering/InlineTextBox.cpp:
1491         (WebCore::InlineTextBox::paintCompositionBackground):
1492
1493 2018-01-10  Youenn Fablet  <youenn@apple.com>
1494
1495         Use no-cache fetch mode when loading main documents with location.reload()
1496         https://bugs.webkit.org/show_bug.cgi?id=181285
1497
1498         Reviewed by Alex Christensen.
1499
1500         Covered by rebased tests.
1501
1502         Start to translate cache policy used for navigation as FetchOptions::Cache.
1503         This allows ensuring service workers receive the right cache mode when intercepting navigation loads.
1504         To not change current navigation behavior, ReturnCacheDataElseLoad and ReturnCacheDataDontLoad still trigger default fetch cache mode.
1505
1506         For Reload and ReloadExpiredOnly frame load types, using no-cache mode is more efficient than reload mode,
1507         as a conditional request will be sent if possible. This applies to location.reload which is consistent with other browsers.
1508         Keep reload mode for ReloadFromOrigin.
1509
1510         * loader/DocumentLoader.cpp:
1511         (WebCore::toFetchOptionsCache):
1512         (WebCore::DocumentLoader::loadMainResource):
1513         * loader/FrameLoader.cpp:
1514         (WebCore::FrameLoader::loadFrameRequest):
1515         (WebCore::FrameLoader::loadURL):
1516         (WebCore::FrameLoader::load):
1517         (WebCore::FrameLoader::reload):
1518         (WebCore::FrameLoader::defaultRequestCachingPolicy):
1519         (WebCore::FrameLoader::loadDifferentDocumentItem):
1520         * loader/NavigationScheduler.cpp:
1521
1522 2018-01-10  Commit Queue  <commit-queue@webkit.org>
1523
1524         Unreviewed, rolling out r226667 and r226673.
1525         https://bugs.webkit.org/show_bug.cgi?id=181488
1526
1527         This caused a flaky crash. (Requested by mlewis13 on #webkit).
1528
1529         Reverted changesets:
1530
1531         "CodeBlocks should be in IsoSubspaces"
1532         https://bugs.webkit.org/show_bug.cgi?id=180884
1533         https://trac.webkit.org/changeset/226667
1534
1535         "REGRESSION (r226667): CodeBlocks should be in IsoSubspaces"
1536         https://bugs.webkit.org/show_bug.cgi?id=180884
1537         https://trac.webkit.org/changeset/226673
1538
1539 2018-01-10  Antti Koivisto  <antti@apple.com>
1540
1541         REGRESSION(r225650): The scores of MotionMark tests Multiply and Leaves dropped by 8%
1542         https://bugs.webkit.org/show_bug.cgi?id=181460
1543         <rdar://problem/36379776>
1544
1545         Reviewed by Ryosuke Niwa.
1546
1547         * css/parser/CSSParser.cpp:
1548         (WebCore::CSSParserContext::CSSParserContext):
1549
1550         Don't do the expensive security origin test if the sheet base URL and document URL are identical.
1551         This is true for inline style and inline stylesheets.
1552
1553 2018-01-10  Antti Koivisto  <antti@apple.com>
1554
1555         Try to fix windows build.
1556
1557         * css/RuleFeature.cpp:
1558         (WebCore::RuleFeatureSet::computeNextMatchElement):
1559
1560 2018-01-10  Zalan Bujtas  <zalan@apple.com>
1561
1562         [RenderTreeBuilder] Move RenderRuby's moveChildren logic to RenderTreeBuilder
1563         https://bugs.webkit.org/show_bug.cgi?id=181470
1564         <rdar://problem/36397683>
1565
1566         Reviewed by Antti Koivisto.
1567
1568         This is about moving code, no cleanup and/or normalization (unfortunately it also means
1569         some temporary changes).  
1570
1571         No change in functionality.
1572
1573         * rendering/RenderBlockFlow.h:
1574         * rendering/RenderRubyBase.cpp:
1575         (WebCore::RenderRubyBase::moveChildren): Deleted.
1576         (WebCore::RenderRubyBase::mergeChildrenWithBase): Deleted.
1577         (WebCore::RenderRubyBase::moveInlineChildren): Deleted.
1578         (WebCore::RenderRubyBase::moveBlockChildren): Deleted.
1579         * rendering/RenderRubyBase.h:
1580         * rendering/RenderRubyRun.cpp:
1581         (WebCore::RenderRubyRun::takeChild):
1582         * rendering/updating/RenderTreeBuilder.cpp:
1583         (WebCore::RenderTreeBuilder::moveRubyChildren):
1584         * rendering/updating/RenderTreeBuilder.h:
1585         * rendering/updating/RenderTreeBuilderRuby.cpp:
1586         (WebCore::RenderTreeBuilder::Ruby::moveInlineChildren):
1587         (WebCore::RenderTreeBuilder::Ruby::moveBlockChildren):
1588         (WebCore::RenderTreeBuilder::Ruby::moveChildren):
1589         (WebCore::RenderTreeBuilder::Ruby::moveChildrenInternal):
1590         (WebCore::RenderTreeBuilder::Ruby::insertChild):
1591         * rendering/updating/RenderTreeBuilderRuby.h:
1592
1593 2018-01-10  Philippe Normand  <pnormand@igalia.com>
1594
1595         [GStreamer] fix critical GObject warning
1596
1597         Rubber-stamped by Carlos Garcia Campos.
1598
1599         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:
1600         (WebCore::MediaPlayerPrivateGStreamer::handleMessage): No need to
1601         resort to complicated things to get the element name...
1602
1603 2018-01-10  Philippe Normand  <pnormand@igalia.com>
1604
1605         [GStreamer] REGRESSION(r226629): broke media/video-interruption-with-resume-allowing-play.html
1606         https://bugs.webkit.org/show_bug.cgi?id=181471
1607         <rdar://problem/36402323>
1608
1609         Reviewed by Carlos Garcia Campos.
1610
1611         This patch mainly reduces the amount of playback state changes
1612         emitted by the GStreamer player to its client. Emitting those
1613         notifications too often has bad side effects.
1614
1615         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:
1616         (WebCore::MediaPlayerPrivateGStreamer::paused const): Add debug messages.
1617         (WebCore::MediaPlayerPrivateGStreamer::handleMessage): This debug message appears too much. Demote.
1618         (WebCore::MediaPlayerPrivateGStreamer::maxTimeLoaded const): Ditto.
1619         (WebCore::MediaPlayerPrivateGStreamer::didLoadingProgress const): Ditto.
1620         (WebCore::MediaPlayerPrivateGStreamer::updateStates): Try to emit
1621         playback state change notification only when going to PLAYING.
1622         (WebCore::MediaPlayerPrivateGStreamer::loadingFailed): Add warning message.
1623
1624 2018-01-10  Youenn Fablet  <youenn@apple.com>
1625
1626         Add Service Worker CSP persistency
1627         https://bugs.webkit.org/show_bug.cgi?id=181434
1628
1629         Reviewed by Alex Christensen.
1630
1631         Covered by manual testing.
1632         Future work on service worker test infrastructure should allow automating such tests.
1633
1634         Add support for service worker CSP data persistency.
1635         Add a version parameter to increment each time the schema is changing.
1636         This allows the same store to be used by multiple WebKits.
1637
1638         * workers/service/server/RegistrationDatabase.cpp:
1639         (WebCore::v1RecordsTableSchema):
1640         (WebCore::RegistrationDatabase::openSQLiteDatabase):
1641         (WebCore::RegistrationDatabase::doPushChanges):
1642         (WebCore::RegistrationDatabase::importRecords):
1643
1644 2018-01-10  Antti Koivisto  <antti@apple.com>
1645
1646         Invalidate current element style on class change accurately
1647         https://bugs.webkit.org/show_bug.cgi?id=181210
1648
1649         Reviewed by Zalan Bujtas.
1650
1651         * css/DocumentRuleSets.cpp:
1652         (WebCore::DocumentRuleSets::collectFeatures const):
1653         (WebCore::DocumentRuleSets::subjectClassRules const):
1654
1655             New rule set containing class rules affecting the subject element.
1656
1657         (WebCore::DocumentRuleSets::ancestorClassRules const):
1658         * css/DocumentRuleSets.h:
1659         * css/RuleFeature.cpp:
1660         (WebCore::RuleFeatureSet::recursivelyCollectFeaturesFromSelector):
1661
1662             Classify selector components into various buckets based on the elements they match relative to
1663             the subject element. There are more categories than this patch strictly needs, for future use.
1664
1665         (WebCore::RuleFeatureSet::collectFeatures):
1666         (WebCore::RuleFeatureSet::add):
1667         (WebCore::RuleFeatureSet::clear):
1668         (WebCore::RuleFeatureSet::shrinkToFit):
1669         * css/RuleFeature.h:
1670         * css/StyleResolver.h:
1671         (WebCore::StyleResolver::hasSelectorForClass const): Deleted.
1672         * style/ClassChangeInvalidation.cpp:
1673         (WebCore::Style::elementNeedsInvalidation):
1674         (WebCore::Style::ClassChangeInvalidation::computeInvalidation):
1675
1676             Don't invalidate current element unconditionally on class change. Instead find the subject rulesets
1677             that might affect it use them to perform invalidation.
1678
1679         (WebCore::Style::ClassChangeInvalidation::invalidateStyleWithRuleSets):
1680         (WebCore::Style::ClassChangeInvalidation::invalidateStyle): Deleted.
1681         (WebCore::Style::ClassChangeInvalidation::invalidateDescendantStyle): Deleted.
1682         * style/ClassChangeInvalidation.h:
1683         (WebCore::Style::ClassChangeInvalidation::ClassChangeInvalidation):
1684         (WebCore::Style::ClassChangeInvalidation::~ClassChangeInvalidation):
1685         * style/StyleSharingResolver.cpp:
1686         (WebCore::Style::SharingResolver::classNamesAffectedByRules const):
1687
1688 2018-01-09  Antoine Quint  <graouts@apple.com>
1689
1690         [Web Animations] Expose the id property on Animation
1691         https://bugs.webkit.org/show_bug.cgi?id=181450
1692         <rdar://problem/36383600>
1693
1694         Reviewed by Dean Jackson.
1695
1696         Expose the "id" property on Animation and handle the "id" property on the optional KeyframeAnimationOptions object
1697         passed to Element.animate(). All of the WPT tests related to this property are now passing.
1698
1699         * animation/WebAnimation.h:
1700         * animation/WebAnimation.idl:
1701         * dom/Element.cpp:
1702         (WebCore::Element::animate):
1703
1704 2018-01-09  Chris Dumez  <cdumez@apple.com>
1705
1706         Make service workers behave correctly with regards to Page Cache
1707         https://bugs.webkit.org/show_bug.cgi?id=181446
1708         <rdar://problem/36164291>
1709
1710         Reviewed by Youenn Fablet.
1711
1712         Make service workers behave correctly with regards to Page Cache:
1713         1. If a document has an active service worker, do not let it go into PageCache
1714         2. When a document goes into page cache, unregister it from the list of service worker clients
1715         3. When a document is restored from page cache, add it nack to the list of service worker clients
1716
1717         Tests: http/tests/workers/service/client-added-to-clients-when-restored-from-page-cache.html
1718                http/tests/workers/service/client-removed-from-clients-while-in-page-cache.html
1719                http/tests/workers/service/no-page-cache-when-controlled.html
1720                http/tests/workers/service/other_resources/test.html
1721
1722         * dom/Document.cpp:
1723         (WebCore::Document::suspend):
1724         (WebCore::Document::resume):
1725         * history/PageCache.cpp:
1726         (WebCore::canCacheFrame):
1727         * page/DiagnosticLoggingKeys.cpp:
1728         (WebCore::DiagnosticLoggingKeys::serviceWorkerKey):
1729         * page/DiagnosticLoggingKeys.h:
1730
1731 2018-01-09  Chris Dumez  <cdumez@apple.com>
1732
1733         We should not return undefined for most properties of a detached Window
1734         https://bugs.webkit.org/show_bug.cgi?id=181416
1735         <rdar://problem/36162489>
1736
1737         Reviewed by Ryosuke Niwa.
1738
1739         We should not return undefined for most properties on a detached Window. WebKit previously only exposed "closed"
1740         and "close" properties on detached / frameless windows. However, this does not match the HTML specification [1]
1741         or the behavior of Firefox and Chrome.
1742
1743         Note that Chrome does not seem to fully follow the HTML specification either, it seems to treat detached windows
1744         the same way as cross-origin ones. As a result, it only exposed properties that are visible cross-origin when
1745         a window is detached / frameless.
1746
1747         [1] https://html.spec.whatwg.org/#windowproxy-get
1748
1749         No new tests, updated existingt tests.
1750
1751         * bindings/js/JSDOMWindowCustom.cpp:
1752         (WebCore::jsDOMWindowGetOwnPropertySlotRestrictedAccess):
1753         (WebCore::JSDOMWindow::getOwnPropertySlot):
1754         (WebCore::JSDOMWindow::getOwnPropertySlotByIndex):
1755
1756 2018-01-09  Darin Adler  <darin@apple.com>
1757
1758         Further refinement to list item and counter code after "list-item" counter fix
1759         https://bugs.webkit.org/show_bug.cgi?id=181426
1760
1761         Reviewed by Zalan Bujtas.
1762
1763         * css/StyleBuilderCustom.h:
1764         (WebCore::StyleBuilderCustom::applyInheritCounter): Use auto.
1765         (WebCore::StyleBuilderCustom::applyValueCounter): Use auto, removed unneeded
1766         null checks for things that can never be null, moved the saturated addition
1767         here and got rid of the addIncrementValue function from CounterDirectives.
1768         Use the saturatedAddition function from SaturatedArithmetic.h instead of the
1769         much less efficient one that did the same thing, CounterDirectives::addClamped.
1770
1771         * rendering/RenderCounter.cpp:
1772         (WebCore::listItemCounterDirectives): Use aggregate syntax for the return
1773         statements.
1774         (WebCore::planCounter): Changed to use a struct return value instead of two
1775         out arguments. Use the saturatedAddition function from SaturatedArithmetic.h
1776         instead of the much less efficient one that did the same thing,
1777         CounterDirectives::addClamped.
1778         (WebCore::findPlaceForCounter): Changed to use a struct return value instead
1779         of two out arguments.
1780         (WebCore::makeCounterNode): Updated for the above changes. Changed code to
1781         use add instead of both get and set. Updated to keep the counter maps inside
1782         the values of the "map of maps" instead of using a unique_ptr and allocating
1783         each one on the heap.
1784         (WebCore::destroyCounterNodeWithoutMapRemoval): Changed argument to a reference
1785         instead of a pointer. Updated for changes to the map. Use RefPtr more
1786         consistently.
1787         (WebCore::RenderCounter::destroyCounterNodes): Use iterators less.
1788         (WebCore::RenderCounter::destroyCounterNode): Ditto.
1789         (WebCore::RenderCounter::rendererRemovedFromTree): Add a check of
1790         hasCounterNodeMap here before calling destroyCounterNodes, so that function
1791         can assume the flag is true (both other callers already check it).
1792         (WebCore::updateCounters): Use auto and update for changes above.
1793         (WebCore::RenderCounter::rendererStyleChanged): Use modern for loops instead
1794         of iterators.
1795         (showCounterRendererTree): Use auto and udpate for changes above.
1796
1797         * rendering/RenderListItem.cpp:
1798         (WebCore::enclosingList): Stop referring to elements as "nodes". Changed
1799         the local variable names for clarity.
1800         (WebCore::nextListItemHelper): Renamed from nextListItem since it's not
1801         intended to be called directly and we want to use a function pointer to
1802         nextListItem. Fixed the algorithm to correctly handle ad hoc "lists" that
1803         are not actually HTML list elements, using the definition in the enclosingList
1804         function as the previousListItem function already did.
1805         (WebCore::nextListItem): Updated for name changes.
1806         (WebCore::firstListItem): Renamed from nextListItem for clarity.
1807         (WebCore::previousListItem): Rewrote loop so it doesn't have to do things
1808         so strangely when we find another list.
1809         (WebCore::RenderListItem::updateItemValuesForOrderedList): Use auto and
1810         update local variable names.
1811         (WebCore::RenderListItem::itemCountForOrderedList): Ditto.
1812         (WebCore::RenderListItem::updateValueNow const): Rewrote to use an iterative
1813         algorithm instead of a recursive one. Fixes the FIXME here.
1814         (WebCore::RenderListItem::updateValue): Use m_valueWasSetExplicitly
1815         instead of m_explicitValue.
1816         (WebCore::RenderListItem::explicitValueChanged): Use auto and simplified
1817         the loop a bit.
1818         (WebCore::RenderListItem::setExplicitValue): Set m_valueWasSetExplicitly
1819         instead of m_explicitValue.
1820         (WebCore::previousOrNextItem): Deleted.
1821         (WebCore::RenderListItem::updateListMarkerNumbers): Streamlined the loop
1822         a bit and used a fucntion pointer to handle the two different directions.
1823         (WebCore::RenderListItem::isInReversedOrderedList const): Simplified by
1824         getting rid of an unneeded use of pointers and local variables.
1825
1826         * rendering/RenderListItem.h: Use a boolean, m_valueWasSetExplicitly,
1827         instead of a separate optional m_explicitValue.
1828
1829         * rendering/style/CounterDirectives.h: Since all the code in this file was
1830         rewritten, removed old copyrights. Deleted the addIncrementValue function,
1831         since it is clear enough in the one call site in the style builder.
1832         Deleted the addClamped function because it was just a much slower
1833         version of the saturatedAddition function. Made == and != into constexpr
1834         functions since they are simple enough to be.
1835
1836         * rendering/style/RenderStyle.cpp:
1837         (WebCore::RenderStyle::getCounterDirectives const): Deleted. Caller can
1838         handle this just fine without a helper function.
1839         * rendering/style/RenderStyle.h: Ditto.
1840
1841 2018-01-09  Myles C. Maxfield  <mmaxfield@apple.com>
1842
1843         font-display:fallback can cause a visual flash (which is supposed to be impossible)
1844         https://bugs.webkit.org/show_bug.cgi?id=181374
1845
1846         Reviewed by Simon Fraser.
1847
1848         A FontCascade represents an entire font-family fallback list, but sometimes we need to pull out a single
1849         representative font from the list to calculate things like line height. Previously, if the first item in
1850         the font-family list was in the middle of being downloaded, this representative font was hardcoded to be
1851         Times. However, when actually laying out and drawing the glyphs, we have logic to skip the interstitial
1852         Times if there are any installed fonts present in the font-family list (so you wouldn't ever actually
1853         see Times). This means that line height (among other things) was being calculated as if Times was used,
1854         but in reality, some other font from the font-family list was being used.
1855
1856         Alone, this isn't a huge problem, but font-display:fallback makes a font transition between "timed out"
1857         and "failed," and when the font hits the failed state, the representative font skips over the cancelled
1858         item and hits the next item in the fallback list. This means that line heights will change, which causes
1859         a visual flash, even when font-display:fallback is specified.
1860
1861         The solution is simply to educate the logic which identifies this representative font so that it
1862         understands what to do for currently-loading fonts.
1863
1864         Tests: fast/text/font-display/swap-flash.html
1865
1866         * platform/graphics/FontCascadeFonts.h:
1867         (WebCore::FontCascadeFonts::primaryFont):
1868         * rendering/line/BreakingContext.h:
1869         (WebCore::textWidth):
1870
1871 2018-01-04  Filip Pizlo  <fpizlo@apple.com>
1872
1873         CodeBlocks should be in IsoSubspaces
1874         https://bugs.webkit.org/show_bug.cgi?id=180884
1875
1876         Reviewed by Saam Barati.
1877
1878         No new tests because no new behavior.
1879         
1880         Adopting new parallel constraint API, so that more of the logic of doing parallel
1881         constraint solving is shared between the DOM's output constraints and JSC's output
1882         constraints.
1883
1884         * bindings/js/DOMGCOutputConstraint.cpp:
1885         (WebCore::DOMGCOutputConstraint::executeImpl):
1886         (WebCore::DOMGCOutputConstraint::doParallelWorkImpl): Deleted.
1887         (WebCore::DOMGCOutputConstraint::finishParallelWorkImpl): Deleted.
1888         * bindings/js/DOMGCOutputConstraint.h:
1889
1890 2018-01-08  Simon Fraser  <simon.fraser@apple.com>
1891
1892         Clean up Marquee-related enums
1893         https://bugs.webkit.org/show_bug.cgi?id=181347
1894
1895         Reviewed by Anders Carlsson.
1896
1897         Modernize EMarqueeBehavior and EMarqueeDirection enums. Stop using the weird negative
1898         values in the MarqueeDirection and do manual reverse direction mapping.
1899
1900         Make some member functions of RenderMarquee private.
1901
1902         Stop using bitfields in RenderMarquee because the memory saving is not worth it, and doing so
1903         allows us to use modern initialization.
1904
1905         No behavior change.
1906
1907         * css/CSSPrimitiveValueMappings.h:
1908         (WebCore::CSSPrimitiveValue::CSSPrimitiveValue):
1909         (WebCore::CSSPrimitiveValue::operator MarqueeBehavior const):
1910         (WebCore::CSSPrimitiveValue::operator MarqueeDirection const):
1911         (WebCore::CSSPrimitiveValue::operator EMarqueeBehavior const): Deleted.
1912         (WebCore::CSSPrimitiveValue::operator EMarqueeDirection const): Deleted.
1913         * css/StyleResolver.cpp:
1914         (WebCore::StyleResolver::adjustRenderStyle):
1915         * rendering/RenderBox.cpp:
1916         (WebCore::RenderBox::sizesLogicalWidthToFitContent const):
1917         * rendering/RenderLayer.cpp:
1918         (WebCore::RenderLayer::calculateClipRects const):
1919         * rendering/RenderMarquee.cpp:
1920         (WebCore::RenderMarquee::RenderMarquee):
1921         (WebCore::reverseDirection):
1922         (WebCore::RenderMarquee::direction const):
1923         (WebCore::RenderMarquee::isHorizontal const):
1924         (WebCore::RenderMarquee::computePosition):
1925         (WebCore::RenderMarquee::start):
1926         (WebCore::RenderMarquee::updateMarqueePosition):
1927         (WebCore::RenderMarquee::updateMarqueeStyle):
1928         (WebCore::RenderMarquee::timerFired):
1929         * rendering/RenderMarquee.h:
1930         * rendering/style/RenderStyle.h:
1931         (WebCore::RenderStyle::marqueeBehavior const):
1932         (WebCore::RenderStyle::marqueeDirection const):
1933         (WebCore::RenderStyle::setMarqueeDirection):
1934         (WebCore::RenderStyle::setMarqueeBehavior):
1935         (WebCore::RenderStyle::initialMarqueeBehavior):
1936         (WebCore::RenderStyle::initialMarqueeDirection):
1937         * rendering/style/RenderStyleConstants.h:
1938         * rendering/style/StyleMarqueeData.cpp:
1939         (WebCore::StyleMarqueeData::StyleMarqueeData):
1940         * rendering/style/StyleMarqueeData.h:
1941
1942 2018-01-09  Jer Noble  <jer.noble@apple.com>
1943
1944         Many CVDisplayLink threads created and destroyed while watching a YouTube video
1945         https://bugs.webkit.org/show_bug.cgi?id=181396
1946
1947         Reviewed by Simon Fraser.
1948
1949         When watching some YouTube videos (or any video with default controls), event handlers for
1950         the "timeupdate" event which use rAF will cause the underlying platform objects to be
1951         destroyed in between "timeupdate" events being fired, since they occur every 250ms, and rAF
1952         objects are destroyed every 166ms (or 10/60hz). Update this constant to destroy the
1953         underlying objects every 333ms (or 20/60hz) so that this common pattern doesn't lead to
1954         excessive rAF platform object turnover.
1955
1956         * platform/Logging.h:
1957         * platform/graphics/DisplayRefreshMonitor.h:
1958         (WebCore::DisplayRefreshMonitor::shouldBeTerminated const):
1959         * platform/graphics/DisplayRefreshMonitor.cpp:
1960         (WebCore::DisplayRefreshMonitor::displayDidRefresh):
1961         * platform/graphics/DisplayRefreshMonitorManager.cpp:
1962         (WebCore::DisplayRefreshMonitorManager::createMonitorForClient):
1963         (WebCore::DisplayRefreshMonitorManager::displayDidRefresh):
1964
1965 2018-01-09  Zalan Bujtas  <zalan@apple.com>
1966
1967         [RenderTreeBuilder] Move RenderElement addChild mutation logic to RenderTreeBuilder
1968         https://bugs.webkit.org/show_bug.cgi?id=181451
1969         <rdar://problem/36385562>
1970
1971         Reviewed by Antti Koivisto.
1972
1973         This is about moving code, no cleanup and/or normalization (unfortunately it also means
1974         some temporary changes).  
1975
1976         No change in functionality.
1977
1978         * rendering/RenderElement.cpp:
1979         (WebCore::RenderElement::addChild):
1980         (WebCore::RenderElement::childRequiresTable const): Deleted.
1981         * rendering/RenderElement.h:
1982         * rendering/updating/RenderTreeBuilder.cpp:
1983         (WebCore::RenderTreeBuilder::insertChildToRenderElement):
1984         (WebCore::RenderTreeBuilder::childRequiresTable):
1985         * rendering/updating/RenderTreeBuilder.h:
1986         * rendering/updating/RenderTreeBuilderInline.cpp:
1987         (WebCore::RenderTreeBuilder::Inline::insertChildToContinuation):
1988         (WebCore::RenderTreeBuilder::Inline::insertChildIgnoringContinuation):
1989         (WebCore::RenderTreeBuilder::Inline::newChildIsInline):
1990         (WebCore::newChildIsInline): Deleted.
1991         * rendering/updating/RenderTreeBuilderInline.h:
1992
1993 2018-01-09  Matt Lewis  <jlewis3@apple.com>
1994
1995         Unreviewed, rolling out r226531.
1996
1997         This caused test failures on macOS WK2.
1998
1999         Reverted changeset:
2000
2001         "Use no-cache fetch mode when loading main documents with
2002         location.reload()"
2003         https://bugs.webkit.org/show_bug.cgi?id=181285
2004         https://trac.webkit.org/changeset/226531
2005
2006 2018-01-09  Michael Saboff  <msaboff@apple.com>
2007
2008         Unreviewed, rolling out r226600 and r226603
2009         https://bugs.webkit.org/show_bug.cgi?id=181351
2010
2011         Add a DOM gadget for Spectre testing
2012
2013         * dom/Comment.cpp:
2014         (WebCore::Comment::Comment):
2015         (WebCore::Comment::setReadLength): Deleted.
2016         (WebCore::Comment::charCodeAt): Deleted.
2017         (WebCore::Comment::clflushReadLength): Deleted.
2018         * dom/Comment.h:
2019         * dom/Comment.idl:
2020         * page/RuntimeEnabledFeatures.cpp:
2021         (WebCore::RuntimeEnabledFeatures::spectreGadgetsEnabled const): Deleted.
2022         * page/RuntimeEnabledFeatures.h:
2023
2024 2018-01-09  Don Olmstead  <don.olmstead@sony.com>
2025
2026         Add additional WEBCORE_EXPORTs
2027         https://bugs.webkit.org/show_bug.cgi?id=181414
2028
2029         Reviewed by Alex Christensen.
2030
2031         No new tests. No change in behavior.
2032
2033         * dom/Document.h:
2034         * dom/ViewportArguments.h:
2035         * page/DOMWindow.h:
2036         * page/FrameView.h:
2037         * page/PageOverlayController.h:
2038         * platform/ContextMenuItem.h:
2039         * platform/Pasteboard.h:
2040         * platform/SharedBuffer.h:
2041         * platform/UserAgent.h:
2042         * platform/graphics/GLContext.h:
2043         * platform/graphics/GraphicsContext.h:
2044         * platform/graphics/GraphicsLayerTransform.h:
2045         * platform/graphics/PlatformDisplay.h:
2046         * platform/graphics/cairo/BackingStoreBackendCairoImpl.h:
2047         * platform/graphics/cairo/PlatformContextCairo.h:
2048         * platform/graphics/cairo/RefPtrCairo.h:
2049         * platform/graphics/nicosia/NicosiaBuffer.h:
2050         * platform/graphics/nicosia/NicosiaPaintingEngine.h:
2051         * platform/graphics/texmap/TextureMapper.h:
2052         * platform/graphics/texmap/TextureMapperAnimation.h:
2053         * platform/graphics/texmap/TextureMapperBackingStore.h:
2054         * platform/graphics/texmap/TextureMapperFPSCounter.h:
2055         * platform/graphics/texmap/TextureMapperLayer.h:
2056         (WebCore::TextureMapperLayer::TextureMapperLayer): Deleted.
2057         (WebCore::TextureMapperLayer::setID): Deleted.
2058         (WebCore::TextureMapperLayer::id): Deleted.
2059         (WebCore::TextureMapperLayer:: const): Deleted.
2060         (WebCore::TextureMapperLayer::setScrollClient): Deleted.
2061         (WebCore::TextureMapperLayer::setIsScrollable): Deleted.
2062         (WebCore::TextureMapperLayer::isScrollable const): Deleted.
2063         (WebCore::TextureMapperLayer::textureMapper const): Deleted.
2064         (WebCore::TextureMapperLayer::setTextureMapper): Deleted.
2065         (WebCore::TextureMapperLayer::drawsContent const): Deleted.
2066         (WebCore::TextureMapperLayer::contentsAreVisible const): Deleted.
2067         (WebCore::TextureMapperLayer::size const): Deleted.
2068         (WebCore::TextureMapperLayer::opacity const): Deleted.
2069         (WebCore::TextureMapperLayer::transform const): Deleted.
2070         (WebCore::TextureMapperLayer::hasFilters const): Deleted.
2071         (WebCore::TextureMapperLayer::isShowingRepaintCounter const): Deleted.
2072         (WebCore::TextureMapperLayer::fixedToViewport const): Deleted.
2073         (WebCore::TextureMapperLayer::rootLayer const): Deleted.
2074         (WebCore::TextureMapperLayer::texture): Deleted.
2075         (WebCore::TextureMapperLayer::adjustedPosition const): Deleted.
2076         (WebCore::TextureMapperLayer::layerRect const): Deleted.
2077         (WebCore::TextureMapperLayer::State::State): Deleted.
2078         * platform/graphics/texmap/TextureMapperPlatformLayerProxy.h:
2079         * platform/graphics/texmap/TextureMapperTile.h:
2080         * platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.h:
2081         (WebCore::CoordinatedGraphicsLayer::isScrollable const): Deleted.
2082         (WebCore::CoordinatedGraphicsLayer::id const): Deleted.
2083         (WebCore::CoordinatedGraphicsLayer::coverRect const): Deleted.
2084         (WebCore::CoordinatedGraphicsLayer::fixedToViewport const): Deleted.
2085         * platform/graphics/texmap/coordinated/CoordinatedImageBacking.h:
2086         (WebCore::CoordinatedImageBacking::id const): Deleted.
2087         * platform/graphics/texmap/coordinated/TiledBackingStore.h:
2088         * platform/graphics/texmap/coordinated/UpdateAtlas.h:
2089         * platform/network/AuthenticationChallengeBase.h:
2090         * platform/network/CredentialBase.h:
2091         * platform/network/ProtectionSpaceBase.h:
2092         * platform/network/curl/SocketStreamHandleImpl.h:
2093         * replay/UserInputBridge.h:
2094
2095 2018-01-09  Basuke Suzuki  <Basuke.Suzuki@sony.com>
2096
2097         [Curl] Move FormData related tasks into new CurlFormDataStream class.
2098         https://bugs.webkit.org/show_bug.cgi?id=181106
2099
2100         Reviewed by Alex Christensen.
2101
2102         No new tests because no behavior change.
2103
2104         * platform/Curl.cmake:
2105         * platform/network/curl/CurlFormDataStream.cpp: Added.
2106         (WebCore::CurlFormDataStream::CurlFormDataStream):
2107         (WebCore::CurlFormDataStream::~CurlFormDataStream):
2108         (WebCore::CurlFormDataStream::clean):
2109         (WebCore::CurlFormDataStream::shouldUseChunkTransfer):
2110         (WebCore::CurlFormDataStream::totalSize):
2111         (WebCore::CurlFormDataStream::computeContentLength):
2112         (WebCore::CurlFormDataStream::read):
2113         (WebCore::CurlFormDataStream::readFromFile):
2114         (WebCore::CurlFormDataStream::readFromData):
2115         * platform/network/curl/CurlFormDataStream.h: Renamed from Source/WebCore/platform/network/curl/FormDataStreamCurl.h.
2116         (WebCore::CurlFormDataStream::elementSize):
2117         (WebCore::CurlFormDataStream::totalReadSize):
2118         * platform/network/curl/CurlRequest.cpp:
2119         (WebCore::CurlRequest::CurlRequest):
2120         (WebCore::CurlRequest::willSendData):
2121         (WebCore::CurlRequest::finalizeTransfer):
2122         (WebCore::CurlRequest::setupPUT):
2123         (WebCore::CurlRequest::setupPOST):
2124         (WebCore::CurlRequest::setupSendData):
2125         (WebCore::CurlRequest::resolveBlobReferences): Deleted.
2126         (WebCore::CurlRequest::setupFormData): Deleted.
2127         * platform/network/curl/CurlRequest.h:
2128         * platform/network/curl/FormDataStreamCurl.cpp: Removed.
2129
2130 2018-01-09  Zalan Bujtas  <zalan@apple.com>
2131
2132         [RenderTreeBuilder] Move MathML addChild logic to RenderTreeBuilder
2133         https://bugs.webkit.org/show_bug.cgi?id=181443
2134         <rdar://problem/36380228>
2135
2136         Reviewed by Antti Koivisto.
2137
2138         This is about moving code, no cleanup and/or normalization (unfortunately it also means
2139         some temporary changes).  
2140
2141         No change in functionality.
2142
2143         * Sources.txt:
2144         * WebCore.xcodeproj/project.pbxproj:
2145         * rendering/mathml/RenderMathMLFenced.cpp:
2146         (WebCore::RenderMathMLFenced::addChild):
2147         (WebCore::RenderMathMLFenced::createMathMLOperator): Deleted.
2148         (WebCore::RenderMathMLFenced::makeFences): Deleted.
2149         * rendering/mathml/RenderMathMLFenced.h:
2150         * rendering/updating/RenderTreeBuilder.cpp:
2151         (WebCore::RenderTreeBuilder::RenderTreeBuilder):
2152         (WebCore::RenderTreeBuilder::insertChildToRenderMathMLFenced):
2153         * rendering/updating/RenderTreeBuilder.h:
2154         (WebCore::RenderTreeBuilder::mathMLBuilder):
2155
2156 2018-01-09  Antti Koivisto  <antti@apple.com>
2157
2158         Blank page except for inner iframes because pending stylesheets cause style.isNotFinal() to be true
2159         https://bugs.webkit.org/show_bug.cgi?id=180940
2160         <rdar://problem/36116507>
2161
2162         Reviewed by Darin Adler.
2163
2164         Test: http/tests/local/loading-stylesheet-import-remove.html
2165
2166         If a <link> referencing a stylesheet containing an @import that was still loading was removed
2167         from the document, the loading state was never cleared. For head stylesheets this blocked
2168         rendering permanently.
2169
2170         Test reduction by Justin Ridgewell.
2171
2172         * html/HTMLLinkElement.cpp:
2173         (WebCore::HTMLLinkElement::removedFromAncestor):
2174
2175         Test if the stylesheet it loading before clearing the pointer.
2176
2177 2018-01-09  Dan Bernstein  <mitz@apple.com>
2178
2179         Removed some empty directories that were left behind
2180
2181         * Modules/indieui: Removed.
2182         * Modules/vibration: Removed.
2183         * platform/graphics/ca/mac: Removed.
2184         * platform/mediastream/gstreamer: Removed.
2185
2186 2018-01-09  Antoine Quint  <graouts@apple.com>
2187
2188         Refactor timing function solving code
2189         https://bugs.webkit.org/show_bug.cgi?id=181428
2190
2191         Reviewed by Dean Jackson.
2192
2193         We have duplicated code to solve "cubic" and "steps" timing functions in AnimationBase and TextureMapperAnimation,
2194         and we will soon need similar code to deal with timing functions in Web Animations. We move this code into TimingFunction
2195         with a single transformTime() function that can be called directly on the timing function rather than having callers
2196         figure out what type timing functions are to solve them.
2197
2198         No test as there shouldn't be any behavior change.
2199
2200         * page/animation/AnimationBase.cpp:
2201         (WebCore::AnimationBase::progress const):
2202         (WebCore::solveEpsilon): Deleted.
2203         (WebCore::solveCubicBezierFunction): Deleted.
2204         (WebCore::solveStepsFunction): Deleted.
2205         (WebCore::solveSpringFunction): Deleted.
2206         * platform/animation/TimingFunction.cpp:
2207         (WebCore::TimingFunction::transformTime const):
2208         * platform/animation/TimingFunction.h:
2209         * platform/graphics/texmap/TextureMapperAnimation.cpp:
2210         (WebCore::TextureMapperAnimation::apply):
2211         (WebCore::solveEpsilon): Deleted.
2212         (WebCore::solveCubicBezierFunction): Deleted.
2213         (WebCore::solveStepsFunction): Deleted.
2214         (WebCore::applyTimingFunction): Deleted.
2215
2216 2018-01-09  Michael Catanzaro  <mcatanzaro@igalia.com>
2217
2218         Unreviewed, silence -Wunused-parameter warning
2219
2220         * testing/js/WebCoreTestSupport.cpp:
2221         (WebCoreTestSupport::setupNewlyCreatedServiceWorker):
2222
2223 2018-01-09  Said Abou-Hallawa  <sabouhallawa@apple.com>
2224
2225         Check Image::m_image is not null in ImageLoader::decode()
2226         https://bugs.webkit.org/show_bug.cgi?id=180386
2227         <rdar://problem/34634483>
2228
2229         Reviewed by Tim Horton.
2230
2231         Ensure ImageLoader::m_image is not null before referencing it.
2232
2233         * loader/ImageLoader.cpp:
2234         (WebCore::ImageLoader::decode):
2235
2236 2018-01-09  Yusuke Suzuki  <utatane.tea@gmail.com>
2237
2238         [FreeType] Use FastMalloc for FreeType
2239         https://bugs.webkit.org/show_bug.cgi?id=181387
2240
2241         Reviewed by Michael Catanzaro.
2242
2243         Add custom memory allocator for FreeType to use FastMalloc.
2244
2245         * platform/graphics/freetype/FontCustomPlatformDataFreeType.cpp:
2246         (WebCore::initializeFreeTypeLibrary):
2247         (WebCore::createFontCustomPlatformData):
2248
2249 2018-01-09  Zalan Bujtas  <zalan@apple.com>
2250
2251         [RenderTreeBuilder] Move RenderTable* addChild mutation logic to RenderTreeBuilder
2252         https://bugs.webkit.org/show_bug.cgi?id=181424
2253         <rdar://problem/36368628>
2254
2255         Reviewed by Antti Koivisto.
2256
2257         This is about moving code, no cleanup and/or normalization (unfortunately it also means
2258         some temporary changes).  
2259
2260         Covered by existing tests.
2261
2262         * rendering/RenderTable.cpp:
2263         (WebCore::RenderTable::addChild):
2264         * rendering/RenderTableRow.cpp:
2265         (WebCore::RenderTableRow::addChild):
2266         * rendering/RenderTableSection.cpp:
2267         (WebCore::RenderTableSection::addChild):
2268         * rendering/updating/RenderTreeBuilder.cpp:
2269         (WebCore::RenderTreeBuilder::insertChildToRenderTable):
2270         (WebCore::RenderTreeBuilder::insertChildToRenderTableSection):
2271         (WebCore::RenderTreeBuilder::insertChildToRenderTableRow):
2272         * rendering/updating/RenderTreeBuilder.h:
2273         * rendering/updating/RenderTreeBuilderTable.cpp:
2274         (WebCore::RenderTreeBuilder::Table::insertChild):
2275         * rendering/updating/RenderTreeBuilderTable.h:
2276
2277 2018-01-09  Zalan Bujtas  <zalan@apple.com>
2278
2279         [RenderTreeBuilder] Transition Render*::addChild() calls to RenderTreeBuilder::insertChildToRender*()
2280         https://bugs.webkit.org/show_bug.cgi?id=181407
2281         <rdar://problem/36361176>
2282
2283         Reviewed by Antti Koivisto.
2284
2285         Eventually all mutation will be going through the RenderTreeBuilder.
2286
2287         No change in functionality.
2288
2289         * rendering/RenderGrid.cpp:
2290         (WebCore::RenderGrid::addChild):
2291         * rendering/RenderMultiColumnFlow.cpp:
2292         (WebCore::RenderMultiColumnFlow::processPossibleSpannerDescendant):
2293         * rendering/RenderRubyRun.cpp:
2294         (WebCore::RenderRubyRun::rubyBaseSafe):
2295         * rendering/updating/RenderTreeBuilderBlockFlow.cpp:
2296         (WebCore::RenderTreeBuilder::BlockFlow::insertChild):
2297         * rendering/updating/RenderTreeBuilderMultiColumn.cpp:
2298         (WebCore::RenderTreeBuilder::MultiColumn::createFragmentedFlow):
2299         * rendering/updating/RenderTreeBuilderRuby.cpp:
2300         (WebCore::RenderTreeBuilder::Ruby::findOrCreateParentForChild):
2301
2302 2018-01-09  Philippe Normand  <pnormand@igalia.com>
2303
2304         [GStreamer] Ensure SleepDisabler is not held by pages in page cache
2305         https://bugs.webkit.org/show_bug.cgi?id=180197
2306
2307         Reviewed by Eric Carlson.
2308
2309         The sleep disabler is now checked again whenever the media player
2310         playback state or other characteristic has changed in the media
2311         engine.
2312
2313         * html/HTMLMediaElement.cpp:
2314         (WebCore::HTMLMediaElement::mediaPlayerPlaybackStateChanged):
2315         Check if the sleep disabler state needs to be updated or not.
2316         (WebCore::HTMLMediaElement::mediaPlayerCharacteristicChanged): Ditto.
2317         (WebCore::HTMLMediaElement::shouldDisableSleep const): Enable
2318         sleep disabler for GTK and WPE ports.
2319
2320 2018-01-09  Philippe Normand  <pnormand@igalia.com>
2321
2322         [GStreamer] Missing notifications to player client
2323         https://bugs.webkit.org/show_bug.cgi?id=181432
2324
2325         Reviewed by Carlos Garcia Campos.
2326
2327         We now properly emit playback state changes and characteristic
2328         updates to the client when the pipeline state changes and when
2329         audio/video tracks changes are detected.
2330
2331         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:
2332         (WebCore::MediaPlayerPrivateGStreamer::playbackPosition const):
2333         This debug message appears too often in logs. Demote.
2334         (WebCore::MediaPlayerPrivateGStreamer::durationMediaTime const): Ditto.
2335         (WebCore::MediaPlayerPrivateGStreamer::notifyPlayerOfVideo): Emit
2336         charasteristicChanged notification.
2337         (WebCore::MediaPlayerPrivateGStreamer::notifyPlayerOfAudio): Ditto.
2338         (WebCore::MediaPlayerPrivateGStreamer::updateStates): Keep track
2339         of old and current pipeline state.
2340         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.h:
2341
2342
2343 2018-01-09  Youenn Fablet  <youenn@apple.com>
2344
2345         Add CSP support to service workers
2346         https://bugs.webkit.org/show_bug.cgi?id=181385
2347
2348         Reviewed by Chris Dumez.
2349
2350         Covered by rebased tests.
2351
2352         Added recovery of CSP information from WorkerScriptLoader.
2353         Added plumbing to pass the CSP information to Service Workers.
2354         Did not add persistency support for the CSP information as this requires changing the SQL database schema.
2355         This will be done in a follow-up.
2356
2357         * workers/WorkerScriptLoader.cpp:
2358         (WebCore::WorkerScriptLoader::loadAsynchronously):
2359         (WebCore::WorkerScriptLoader::didReceiveResponse):
2360         * workers/WorkerScriptLoader.h:
2361         (WebCore::WorkerScriptLoader::contentSecurityPolicy const):
2362         * workers/service/SWClientConnection.cpp:
2363         (WebCore::SWClientConnection::finishedFetchingScript):
2364         (WebCore::SWClientConnection::failedFetchingScript):
2365         * workers/service/SWClientConnection.h:
2366         * workers/service/ServiceWorkerContainer.cpp:
2367         (WebCore::ServiceWorkerContainer::addRegistration):
2368         (WebCore::ServiceWorkerContainer::jobFailedWithException):
2369         (WebCore::ServiceWorkerContainer::jobResolvedWithRegistration):
2370         (WebCore::ServiceWorkerContainer::jobFinishedLoadingScript):
2371         * workers/service/ServiceWorkerContainer.h:
2372         * workers/service/ServiceWorkerContextData.cpp:
2373         (WebCore::ServiceWorkerContextData::isolatedCopy const):
2374         * workers/service/ServiceWorkerContextData.h:
2375         (WebCore::ServiceWorkerContextData::encode const):
2376         (WebCore::ServiceWorkerContextData::decode):
2377         * workers/service/ServiceWorkerFetchResult.h:
2378         (WebCore::ServiceWorkerFetchResult::encode const):
2379         (WebCore::ServiceWorkerFetchResult::decode):
2380         * workers/service/ServiceWorkerGlobalScope.cpp:
2381         (WebCore::ServiceWorkerGlobalScope::create):
2382         * workers/service/ServiceWorkerGlobalScope.h:
2383         * workers/service/ServiceWorkerJob.cpp:
2384         (WebCore::ServiceWorkerJob::notifyFinished):
2385         * workers/service/ServiceWorkerJobClient.h:
2386         * workers/service/context/ServiceWorkerThread.cpp:
2387         (WebCore::ServiceWorkerThread::ServiceWorkerThread):
2388         (WebCore::ServiceWorkerThread::createWorkerGlobalScope):
2389         * workers/service/server/RegistrationDatabase.cpp:
2390         (WebCore::v1RecordsTableSchema):
2391         (WebCore::RegistrationDatabase::importRecords):
2392         * workers/service/server/SWServer.cpp:
2393         (WebCore::SWServer::updateWorker):
2394         (WebCore::SWServer::installContextData):
2395         * workers/service/server/SWServer.h:
2396         * workers/service/server/SWServerJobQueue.cpp:
2397         (WebCore::SWServerJobQueue::scriptFetchFinished):
2398         * workers/service/server/SWServerWorker.cpp:
2399         (WebCore::SWServerWorker::SWServerWorker):
2400         (WebCore::m_contentSecurityPolicy):
2401         (WebCore::SWServerWorker::contextData const):
2402         * workers/service/server/SWServerWorker.h:
2403
2404 2018-01-09  Antoine Quint  <graouts@apple.com>
2405
2406         Provide a method to obtain a CSS value from a RenderStyle by CSSPropertyID
2407         https://bugs.webkit.org/show_bug.cgi?id=181429
2408
2409         Reviewed by Antti Koivisto.
2410
2411         The KeyframeEffect.getKeyframes() method from Web Animations requires that we return all styles applied at a given
2412         animation effect keyframe. When we parse keyframes, we create RenderStyle objects that are stored in a KeyframeList,
2413         as well as a list of CSSPropertyIDs that are animated. In order to provide the list of animated properties and their
2414         values when calling getKeyframes(), we need to be able to read back from the RenderStyle we create. As a first step
2415         towards this goal, we factor some code in ComputedStyleExtractor::propertyValue() out into a new method
2416         ComputedStyleExtractor::valueForPropertyinStyle() which takes in an explicit RenderStyle.
2417
2418         No test as this is simply refactoring that doesn't change or add behavior.
2419
2420         * css/CSSComputedStyleDeclaration.cpp:
2421         (WebCore::ComputedStyleExtractor::propertyValue):
2422         (WebCore::ComputedStyleExtractor::valueForPropertyinStyle):
2423         * css/CSSComputedStyleDeclaration.h:
2424
2425 2018-01-09  Youenn Fablet  <youenn@apple.com>
2426
2427         SWClientConnection should not keep references to service worker jobs
2428         https://bugs.webkit.org/show_bug.cgi?id=181381
2429
2430         Reviewed by Chris Dumez.
2431
2432         Difficult to test determiniscally but corresponding crash log should no longer happen in debug builds.
2433
2434         Stopped passing ServiceWorkerJob references from ServiceWorkerContainer (potentially in service worker thread) to SWClientConnection (main thread).
2435         Instead pass job identifiers and related data to the main thread.
2436
2437         Minor refactoring to use ServiceWorkerJobIdentifier instead of ServiceWorkerJobDataIdentifier which contains more data than needed.
2438
2439         * workers/service/SWClientConnection.cpp:
2440         (WebCore::SWClientConnection::scheduleJob):
2441         (WebCore::SWClientConnection::failedFetchingScript):
2442         (WebCore::SWClientConnection::postTaskForJob):
2443         (WebCore::SWClientConnection::jobRejectedInServer):
2444         (WebCore::SWClientConnection::registrationJobResolvedInServer):
2445         (WebCore::SWClientConnection::unregistrationJobResolvedInServer):
2446         (WebCore::SWClientConnection::startScriptFetchForServer):
2447         (WebCore::SWClientConnection::clearPendingJobs):
2448         (WebCore::SWClientConnection::finishedFetchingScript): Deleted.
2449         * workers/service/SWClientConnection.h:
2450         * workers/service/ServiceWorkerContainer.cpp:
2451         (WebCore::ServiceWorkerContainer::scheduleJob):
2452         (WebCore::ServiceWorkerContainer::startScriptFetchForJob):
2453         (WebCore::ServiceWorkerContainer::jobFinishedLoadingScript):
2454         (WebCore::ServiceWorkerContainer::jobFailedLoadingScript):
2455         * workers/service/ServiceWorkerContainer.h:
2456         * workers/service/server/SWServer.cpp:
2457         (WebCore::SWServer::rejectJob):
2458         (WebCore::SWServer::resolveRegistrationJob):
2459         (WebCore::SWServer::resolveUnregistrationJob):
2460         (WebCore::SWServer::startScriptFetch):
2461         * workers/service/server/SWServer.h:
2462
2463 2018-01-09  Carlos Garcia Campos  <cgarcia@igalia.com>
2464
2465         REGRESSION(r224460): Text fields sometimes get "messed up"
2466         https://bugs.webkit.org/show_bug.cgi?id=181115
2467
2468         Reviewed by Zalan Bujtas.
2469
2470         Add the scroll position to paint offset before computing the clip rectangle. Before r224460, scroll position was
2471         substracted after the clip rectangle was computed.
2472
2473         * rendering/LayoutState.cpp:
2474         (WebCore::LayoutState::computeClipRect):
2475
2476 2018-01-09  Ali Juma  <ajuma@chromium.org>
2477
2478         Implement VisualViewport API events
2479         https://bugs.webkit.org/show_bug.cgi?id=179386
2480
2481         Reviewed by Frédéric Wang.
2482
2483         Implement the events (resize and scroll) defined by the Visual Viewport API
2484         (https://wicg.github.io/visual-viewport/#events).
2485
2486         This is behind the VisualViewportAPI experimental feature flag.
2487
2488         In order to detect when events need to be fired, change the computation of
2489         Visual Viewport attributes to happen whenever the layout viewport is updated
2490         rather than only on-demand.
2491
2492         Tests: fast/visual-viewport/resize-event-fired-window-resized.html
2493                fast/visual-viewport/resize-event-fired.html
2494                fast/visual-viewport/scroll-event-fired.html
2495
2496         * dom/Document.cpp:
2497         (WebCore::Document::addListenerTypeIfNeeded):
2498         Add support for tracking resize event listeners.
2499         * dom/Document.h:
2500         * dom/DocumentEventQueue.cpp:
2501         (WebCore::DocumentEventQueue::enqueueOrDispatchScrollEvent):
2502         (WebCore::DocumentEventQueue::enqueueScrollEvent):
2503         Factored out of enqueueOrDispatchScrollEvent so that this logic can be reused
2504         for Visual Viewport scroll events.
2505         (WebCore::DocumentEventQueue::enqueueResizeEvent):
2506         (WebCore::DocumentEventQueue::pendingEventTimerFired):
2507         * dom/DocumentEventQueue.h:
2508         * page/FrameView.cpp:
2509         (WebCore::FrameView::updateLayoutViewport):
2510         * page/VisualViewport.cpp:
2511         (WebCore::VisualViewport::addEventListener):
2512         (WebCore::layoutIfNonNull):
2513         (WebCore::VisualViewport::offsetLeft const):
2514         Remove attribute computation logic since this now happens during update().
2515         (WebCore::VisualViewport::offsetTop const): Ditto.
2516         (WebCore::VisualViewport::pageLeft const): Ditto.
2517         (WebCore::VisualViewport::pageTop const): Ditto.
2518         (WebCore::VisualViewport::width const): Ditto.
2519         (WebCore::VisualViewport::height const): Ditto.
2520         (WebCore::VisualViewport::scale const):
2521         (WebCore::VisualViewport::update):
2522         Added. Computes all of the Visual Viewport attributes and determines
2523         whether events need to be fired.
2524         (WebCore::VisualViewport::enqueueResizeEvent):
2525         (WebCore::VisualViewport::enqueueScrollEvent):
2526         (WebCore::getFrameViewAndLayoutIfNonNull): Deleted.
2527         * page/VisualViewport.h:
2528
2529 2018-01-09  Yacine Bandou  <yacine.bandou_ext@softathome.com>
2530
2531         [EME] Add the CENC initData support in ClearKey CDM
2532         https://bugs.webkit.org/show_bug.cgi?id=180081
2533
2534         Reviewed by Xabier Rodriguez-Calvar.
2535
2536         Add the "cenc" initDataType support in ClearKey CDM.
2537         Parse the CENC initData and extract the KIDs by following the W3C spec
2538         https://www.w3.org/TR/eme-initdata-cenc/#common-system
2539
2540         Tests: media/encrypted-media/clearKey/clearKey-message-cenc-event.html
2541                media/encrypted-media/clearKey/clearKey-message-cenc-event-mse.html
2542
2543         * platform/encryptedmedia/clearkey/CDMClearKey.cpp:
2544         (WebCore::extractKeyidsLocationFromCencInitData):
2545         (WebCore::isCencInitData):
2546         (WebCore::extractKeyidsFromCencInitData):
2547         (WebCore::CDMPrivateClearKey::supportsInitDataType const):
2548         (WebCore::CDMPrivateClearKey::supportsInitData const):
2549         (WebCore::CDMInstanceClearKey::requestLicense):
2550
2551 2018-01-09  Zan Dobersek  <zdobersek@igalia.com>
2552
2553         [Cairo] Pass state values directly to Cairo operations
2554         https://bugs.webkit.org/show_bug.cgi?id=181389
2555
2556         Reviewed by Carlos Garcia Campos.
2557
2558         Instead of passing reference to the GraphicsContextState object to
2559         various Cairo operations, only pass the required state values. This
2560         makes it explicit what state values are used in these operations, at the
2561         expense of some long parameter lists, but this will be better addressed
2562         by future refactoring of this code into more concise functions.
2563
2564         No new tests -- no change in functionality.
2565
2566         * platform/graphics/cairo/CairoOperations.cpp:
2567         (WebCore::Cairo::drawGlyphsShadow):
2568         (WebCore::Cairo::dashedLineCornerWidthForStrokeWidth):
2569         (WebCore::Cairo::dashedLinePatternWidthForStrokeWidth):
2570         (WebCore::Cairo::drawGlyphs):
2571         (WebCore::Cairo::drawRect):
2572         (WebCore::Cairo::drawLine):
2573         (WebCore::Cairo::drawEllipse):
2574         * platform/graphics/cairo/CairoOperations.h:
2575         * platform/graphics/cairo/FontCairo.cpp:
2576         (WebCore::FontCascade::drawGlyphs):
2577         * platform/graphics/cairo/GraphicsContextCairo.cpp:
2578         (WebCore::GraphicsContext::drawRect):
2579         (WebCore::GraphicsContext::drawLine):
2580         (WebCore::GraphicsContext::drawEllipse):
2581
2582 2018-01-09  Ryosuke Niwa  <rniwa@webkit.org>
2583
2584         Release assert in addResourceTiming when a cache resource is requested during style recalc
2585         https://bugs.webkit.org/show_bug.cgi?id=181137
2586         <rdar://problem/35666574>
2587
2588         Reviewed by Simon Fraser.
2589
2590         Make the dispatching of resourcetimingbufferfull event asynchronous to avoid dispatching it
2591         synchronously during a style resolution when CachedResourceLoader::requestImage requests
2592         a previously loaded image.
2593
2594         We now schedule a timer when the resource timing buffer becomes full, and dispatch the event
2595         when the timer fires. Meanwhile, we have a backup buffer to which additional resource timing
2596         entries would be added. Once the event is dispatched, we refill the buffer exposed to author
2597         scripts. When refilling the buffer results in it becoming full again, we keep repeating the
2598         process of firing resourcetimingbufferfull and re-filling the buffer until either we stop
2599         making progress (i.e. the script didn't increase the number of empty entires in the buffer)
2600         or the backup buffer (at the time we started this process) becomes empty.
2601
2602         Also fixed a bug that we were firing resourcetimingbufferfull event when the last entry that
2603         fits within the buffer size was added instead of when an entry is being added to an already
2604         full buffer. To make this work, the patch introduces m_resourceTimingBufferFullFlag,
2605         representing the concept "resource timing buffer full" flag in the resource timing specification.
2606
2607         Test: http/tests/performance/performance-resource-timing-resourcetimingbufferfull-crash.html
2608
2609         * page/Performance.cpp:
2610         (WebCore::Performance::Performance):
2611         (WebCore::Performance::clearResourceTimings):
2612         (WebCore::Performance::setResourceTimingBufferSize):
2613         (WebCore::Performance::addResourceTiming):
2614         (WebCore::Performance::resourceTimingBufferFullTimerFired):
2615         * page/Performance.h:
2616
2617 2018-01-08  Chris Nardi  <csnardi1@gmail.com>
2618
2619         ::first-letter incorrectly selects grapheme pairs
2620         https://bugs.webkit.org/show_bug.cgi?id=181315
2621
2622         Reviewed by Darin Adler.
2623
2624         Grapheme pairs were incorrectly selected by ::first-letter. This
2625         change fixes their selection.
2626
2627         Tests: Updated fast/css/first-letter-punctuation.html and imported
2628         LayoutTests/imported/w3c/web-platform-tests/css/css-pseudo-4/first-letter-004.html
2629
2630         * rendering/updating/RenderTreeBuilderFirstLetter.cpp:
2631         (WebCore::isPunctuationForFirstLetter):
2632         (WebCore::shouldSkipForFirstLetter):
2633         (WebCore::RenderTreeBuilder::FirstLetter::createRenderers):
2634
2635 2018-01-08  Darin Adler  <darin@apple.com>
2636
2637         Special list-item counter starts from an incorrect number for ::before and ::after
2638         https://bugs.webkit.org/show_bug.cgi?id=181084
2639
2640         Reviewed by Zalan Bujtas.
2641
2642         Test: fast/css/counters/counter-list-item.html
2643
2644         * Sources.txt: Removed CounterDirectives.cpp.
2645         * WebCore.xcodeproj/project.pbxproj: Ditto.
2646
2647         * css/CSSComputedStyleDeclaration.cpp:
2648         (WebCore::counterToCSSValue): Updated for changes to the CounterDirectives struct.
2649         * css/StyleBuilderCustom.h:
2650         (WebCore::StyleBuilderCustom::applyInheritCounter): Ditto.
2651         (WebCore::StyleBuilderCustom::applyValueCounter): Ditto.
2652
2653         * html/HTMLLIElement.cpp:
2654         (WebCore::HTMLLIElement::parseValue): Call setExplicitValue(std::nullopt) instead
2655         of clearExplicitValue since we are using std::optional now.
2656
2657         * rendering/RenderCounter.cpp:
2658         (WebCore::listItemCounterDirectives): Added. Computes the counter directives that
2659         express the effects on the list-item counter from list item and list elements.
2660         Used something as close to what the CSS 3 draft says as possible. This uses a
2661         negative increment when creating a list to counteract the positive increment done
2662         by a list element, except in the case of an unordered list. This is where the bug
2663         fix actually lies. Also fixed handling of reversed ordered lists at the same time.
2664         (WebCore::planCounter): Refactored to use the function above. Also changed the
2665         code to pay attention to both the counter directives and the implicit ones from
2666         list item and list elements, getting as close as possible to what the specification
2667         seems to call for.
2668
2669         * rendering/RenderListItem.cpp:
2670         (WebCore::RenderListItem::RenderListItem): Since we are using std::optional and no
2671         longer using bit fields, simplified the constructor for each list item.
2672         (WebCore::RenderListItem::calcValue const): Deleted.
2673         (WebCore::RenderListItem::updateValueNow const): Merged in all the code from the
2674         old calcValue function, but it is also simpler now since m_value is std::optional.
2675         (WebCore::RenderListItem::updateValue): Updated to use std::optional.
2676         (WebCore::RenderListItem::setExplicitValue): Ditto.
2677         (WebCore::RenderListItem::clearExplicitValue): Deleted.
2678         (WebCore::RenderListItem::updateListMarkerNumbers): Updated to use std::optional.
2679         (WebCore::RenderListItem::isInReversedOrderedList const): Added. This is used by
2680         the counter code so it can decrement instead of incrementing.
2681
2682         * rendering/RenderListItem.h: Updated to use std::optional. Also marked functions
2683         final instead of override and initialized m_notInList after making it not be a
2684         bitfield any more.
2685
2686         * rendering/style/CounterDirectives.cpp: Removed.
2687         * rendering/style/CounterDirectives.h: Removed most of the CounterDirectives
2688         class and replaced it with a struct with two std::optional. Added an addClamped
2689         function so the counter code can share it with the addIncrementValue function.
2690         If we want to make a faster version that doesn't use double, we can come back
2691         and do that. Also moved the == function to the header since the implementation
2692         is so trivial.
2693
2694         * rendering/style/StyleAllInOne.cpp: Removed CounterDirectives.cpp.
2695
2696         * rendering/style/StyleRareNonInheritedData.cpp:
2697         (WebCore::StyleRareNonInheritedData::StyleRareNonInheritedData): Updated to
2698         use std::make_unique directly instead of using a clone function.
2699
2700 2018-01-08  Wenson Hsieh  <wenson_hsieh@apple.com>
2701
2702         [Attachment Support] Expose HTMLAttachmentElement.uniqueIdentifier to bindings
2703         https://bugs.webkit.org/show_bug.cgi?id=181420
2704         <rdar://problem/36365827>
2705
2706         Reviewed by Alex Christensen.
2707
2708         Add a new IDL definition for uniqueIdentifier on HTMLAttachmentElement. This allows clients to relate attachment
2709         elements in the DOM to _WKAttachments delivered via Objective-C SPI.
2710
2711         Adjusted existing tests in WKAttachmentTests.
2712
2713         * html/HTMLAttachmentElement.idl:
2714
2715 2018-01-08  Don Olmstead  <don.olmstead@sony.com>
2716
2717         AccessibilityARIAGrid does not compile when accessibility is disabled
2718         https://bugs.webkit.org/show_bug.cgi?id=181418
2719         <rdar://problem/36365398>
2720
2721         Reviewed by Chris Fleizach.
2722
2723         No new tests. No change in behavior.
2724
2725         * accessibility/AccessibilityARIAGrid.cpp:
2726
2727 2018-01-08  Commit Queue  <commit-queue@webkit.org>
2728
2729         Unreviewed, rolling out r226532 and r226540.
2730         https://bugs.webkit.org/show_bug.cgi?id=181422
2731
2732         jessie says basic browsing does not seem to work (Requested by
2733         alexchristensen on #webkit).
2734
2735         Reverted changesets:
2736
2737         "Add CSP support to service workers"
2738         https://bugs.webkit.org/show_bug.cgi?id=181385
2739         https://trac.webkit.org/changeset/226532
2740
2741         "SWClientConnection should not keep references to service
2742         worker jobs"
2743         https://bugs.webkit.org/show_bug.cgi?id=181381
2744         https://trac.webkit.org/changeset/226540
2745
2746 2018-01-08  Wenson Hsieh  <wenson_hsieh@apple.com>
2747
2748         [Attachment Support] Expose file name and content type of WKAttachment
2749         https://bugs.webkit.org/show_bug.cgi?id=181390
2750         <rdar://problem/36336837>
2751
2752         Reviewed by Tim Horton.
2753
2754         Add new structs in AttachmentTypes.h and refactor HTMLAttachmentElement::requestData to requestInfo. See below
2755         for more details. Augmented existing API tests in WKAttachmentTests.
2756
2757         * html/AttachmentTypes.h:
2758
2759         Add a struct to represent a snapshot of information about an attachment element.
2760
2761         * html/HTMLAttachmentElement.cpp:
2762         (WebCore::HTMLAttachmentElement::requestInfo):
2763         (WebCore::HTMLAttachmentElement::requestData): Deleted.
2764         * html/HTMLAttachmentElement.h:
2765
2766         Change requestData to requestInfo. Instead of fetching and delivering data via callback, requestInfo returns an
2767         AttachmentInfo.
2768
2769         * rendering/RenderThemeIOS.mm:
2770         (WebCore::RenderAttachmentInfo::addLine):
2771         (WebCore::RenderAttachmentInfo::buildWrappedLines):
2772         (WebCore::RenderAttachmentInfo::buildSingleLine):
2773         (WebCore::RenderAttachmentInfo::RenderAttachmentInfo):
2774         (WebCore::RenderThemeIOS::attachmentBaseline const):
2775         (WebCore::paintAttachmentIcon):
2776         (WebCore::paintAttachmentText):
2777         (WebCore::paintAttachmentProgress):
2778         (WebCore::attachmentBorderPath):
2779         (WebCore::RenderThemeIOS::paintAttachment):
2780         (WebCore::AttachmentInfo::addLine): Deleted.
2781         (WebCore::AttachmentInfo::buildWrappedLines): Deleted.
2782         (WebCore::AttachmentInfo::buildSingleLine): Deleted.
2783         (WebCore::AttachmentInfo::AttachmentInfo): Deleted.
2784
2785         Rename AttachmentInfo to RenderAttachmentInfo to resolve a name conflict with the new AttachmentInfo struct.
2786
2787 2018-01-08  Saam Barati  <sbarati@apple.com>
2788
2789         Speculative build fix after r226600. We only use clflush on x86 and the `asm volatile` syntax is not available in the Windows build.
2790
2791         No new tests because this is a build fix.
2792
2793         * dom/Comment.cpp:
2794         (WebCore::Comment::clflushReadLength):
2795
2796 2018-01-08  Michael Saboff  <msaboff@apple.com>
2797
2798         Add a DOM gadget for Spectre testing
2799         https://bugs.webkit.org/show_bug.cgi?id=181351
2800
2801         Reviewed by Saam Barati.
2802
2803         This change is used to test Spectre mitigations.
2804
2805         Added a side data array to the Comment DOM node to test for Spectre issues in
2806         the DOM layer.  This additional functionality is disabled by default and must
2807         be enabled through the JSC option "enableSpectreGadgets".
2808
2809         * dom/Comment.cpp:
2810         (WebCore::Comment::Comment):
2811         (WebCore::Comment::setReadLength):
2812         (WebCore::Comment::charCodeAt):
2813         (WebCore::Comment::clflushReadLength):
2814         * dom/Comment.h:
2815         * dom/Comment.idl:
2816         * page/RuntimeEnabledFeatures.cpp:
2817         (WebCore::RuntimeEnabledFeatures::spectreGadgetsEnabled const):
2818         * page/RuntimeEnabledFeatures.h:
2819
2820 2018-01-08  Said Abou-Hallawa  <sabouhallawa@apple.com>
2821
2822         A canvas should not be tainted if it draws a data URL SVGImage with a <foreignObject>
2823         https://bugs.webkit.org/show_bug.cgi?id=180301
2824
2825         Reviewed by Dean Jackson.
2826
2827         Don't taint the canvas if it draws a data URL SVGImage with a <foreignObject>.
2828         There should not be a cross-origin data leak in this case.
2829
2830         Tests: svg/as-image/svg-canvas-data-url-svg-with-feimage-not-tainted.html
2831                svg/as-image/svg-canvas-data-url-svg-with-foreign-object-not-tainted.html
2832                svg/as-image/svg-canvas-data-url-svg-with-image-not-tainted.html
2833
2834         * html/ImageBitmap.cpp:
2835         (WebCore::taintsOrigin):
2836         * html/canvas/CanvasRenderingContext.cpp:
2837         (WebCore::CanvasRenderingContext::wouldTaintOrigin):
2838
2839 2018-01-08  Don Olmstead  <don.olmstead@sony.com>
2840
2841         Simplify platform checks in Graphics Context
2842         https://bugs.webkit.org/show_bug.cgi?id=181344
2843
2844         Reviewed by Alex Christensen.
2845
2846         No new tests. No change in behavior.
2847
2848         * platform/graphics/ANGLEWebKitBridge.h:
2849         * platform/graphics/GLContext.h:
2850         * platform/graphics/GraphicsContext3D.h:
2851         * platform/graphics/OpenGLESShims.h:
2852         * platform/graphics/opengl/GraphicsContext3DOpenGLCommon.cpp:
2853         (WebCore::GraphicsContext3D::checkVaryingsPacking const):
2854
2855 2018-01-08  Zalan Bujtas  <zalan@apple.com>
2856
2857         [RenderTreeBuilder] Move SVG addChild logic to RenderTreeBuilder
2858         https://bugs.webkit.org/show_bug.cgi?id=181405
2859         <rdar://problem/36360476>
2860
2861         Reviewed by Antti Koivisto.
2862
2863         This is about moving the code, no cleanup and/or normalization (unfortunately it also means
2864         some temporary changes).  
2865
2866         No change in functionality.
2867
2868         * Sources.txt:
2869         * WebCore.xcodeproj/project.pbxproj:
2870         * rendering/svg/RenderSVGContainer.cpp:
2871         (WebCore::RenderSVGContainer::addChild):
2872         * rendering/svg/RenderSVGInline.cpp:
2873         (WebCore::RenderSVGInline::addChild):
2874         * rendering/svg/RenderSVGRoot.cpp:
2875         (WebCore::RenderSVGRoot::addChild):
2876         * rendering/svg/RenderSVGText.cpp:
2877         (WebCore::RenderSVGText::addChild):
2878         * rendering/updating/RenderTreeBuilder.cpp:
2879         (WebCore::RenderTreeBuilder::RenderTreeBuilder):
2880         (WebCore::RenderTreeBuilder::insertChildToSVGContainer):
2881         (WebCore::RenderTreeBuilder::insertChildToSVGInline):
2882         (WebCore::RenderTreeBuilder::insertChildToSVGRoot):
2883         (WebCore::RenderTreeBuilder::insertChildToSVGText):
2884         * rendering/updating/RenderTreeBuilder.h:
2885         (WebCore::RenderTreeBuilder::SVGBuilder):
2886         * rendering/updating/RenderTreeBuilderSVG.cpp: Added.
2887         (WebCore::RenderTreeBuilder::SVG::SVG):
2888         (WebCore::RenderTreeBuilder::SVG::insertChild):
2889         * rendering/updating/RenderTreeBuilderSVG.h: Added.
2890
2891 2018-01-08  John Wilander  <wilander@apple.com>
2892
2893         Storage Access API: Remove access for all frames under a page when the page is closed
2894         https://bugs.webkit.org/show_bug.cgi?id=181398
2895         <rdar://problem/36357879>
2896
2897         Reviewed by Alex Christensen.
2898
2899         No new tests. Discussed with Alex Christensen and we concluded that
2900         both a layout test and an API test would require a lot of work and
2901         we have existing tests for clearing out storage access for frames.
2902
2903         * platform/network/NetworkStorageSession.h:
2904         * platform/network/cf/NetworkStorageSessionCFNet.cpp:
2905         (WebCore::NetworkStorageSession::removeStorageAccessForAllFramesOnPage):
2906
2907 2018-01-08  Matt Lewis  <jlewis3@apple.com>
2908
2909         Unreviewed, rolling out r226385.
2910
2911         The test introduced with this was a flaky since being added.
2912
2913         Reverted changeset:
2914
2915         "AX: when invert colors is on, double-invert certain media
2916         elements in UserAgentStyleSheet"
2917         https://bugs.webkit.org/show_bug.cgi?id=168447
2918         https://trac.webkit.org/changeset/226385
2919
2920 2018-01-08  Youenn Fablet  <youenn@apple.com>
2921
2922         SWClientConnection should not keep references to service worker jobs
2923         https://bugs.webkit.org/show_bug.cgi?id=181381
2924
2925         Reviewed by Chris Dumez.
2926
2927         Difficult to test determiniscally but corresponding crash log should no longer happen in debug builds.
2928
2929         Stopped passing ServiceWorkerJob references from ServiceWorkerContainer (potentially in service worker thread) to SWClientConnection (main thread).
2930         Instead pass job identifiers and related data to the main thread.
2931
2932         Minor refactoring to use ServiceWorkerJobIdentifier instead of ServiceWorkerJobDataIdentifier which contains more data than needed.
2933
2934         * workers/service/SWClientConnection.cpp:
2935         (WebCore::SWClientConnection::scheduleJob):
2936         (WebCore::SWClientConnection::failedFetchingScript):
2937         (WebCore::SWClientConnection::postTaskForJob):
2938         (WebCore::SWClientConnection::jobRejectedInServer):
2939         (WebCore::SWClientConnection::registrationJobResolvedInServer):
2940         (WebCore::SWClientConnection::unregistrationJobResolvedInServer):
2941         (WebCore::SWClientConnection::startScriptFetchForServer):
2942         (WebCore::SWClientConnection::clearPendingJobs):
2943         (WebCore::SWClientConnection::finishedFetchingScript): Deleted.
2944         * workers/service/SWClientConnection.h:
2945         * workers/service/ServiceWorkerContainer.cpp:
2946         (WebCore::ServiceWorkerContainer::scheduleJob):
2947         (WebCore::ServiceWorkerContainer::startScriptFetchForJob):
2948         (WebCore::ServiceWorkerContainer::jobFinishedLoadingScript):
2949         (WebCore::ServiceWorkerContainer::jobFailedLoadingScript):
2950         * workers/service/ServiceWorkerContainer.h:
2951         * workers/service/server/SWServer.cpp:
2952         (WebCore::SWServer::rejectJob):
2953         (WebCore::SWServer::resolveRegistrationJob):
2954         (WebCore::SWServer::resolveUnregistrationJob):
2955         (WebCore::SWServer::startScriptFetch):
2956         * workers/service/server/SWServer.h:
2957
2958 2018-01-08  Wenson Hsieh  <wenson_hsieh@apple.com>
2959
2960         Copying, pasting, and then deleting an attachment element breaks attachment data requests
2961         https://bugs.webkit.org/show_bug.cgi?id=181365
2962         <rdar://problem/36340647>
2963
2964         Reviewed by Tim Horton.
2965
2966         Currently, copying and pasting an attachment element within the same document and then deleting backwards to
2967         remove the pasted attachment element causes the original attachment element to be inaccessible via SPI. This is
2968         because there are now two different attachment elements with the same unique identifier, such that Document,
2969         which keeps a map of all unique attachment identifiers to attachment elements, will lose track of the original
2970         attachment element.
2971
2972         To fix this, we ensure that attachment elements should always have unique identifiers when they are inserted
2973         into the document. We make several small adjustments to accomplish this:
2974
2975         1.  First, refactor HTMLAttachmentElement's unique identifier so that it no longer depends on the value of the
2976             "webkitattachmentid" attribute, and is instead just a member of HTMLAttachmentElement that is not exposed to
2977             DOM bindings. This means setting and querying an attachment element's uniqueIdentifier can be done without
2978             triggering any side effects, such as layout or mutation events.
2979
2980         2.  Next, make "webkitattachmentid" a temporary attribute similar to "webkitattachmentpath" and
2981             "webkitattachmentbloburl", so that it is added only when generating a markup fragment for editing, and
2982             removed upon deserialization.
2983
2984         3.  Lastly, shift the responsibility of assigning a unique identifier to an attachment away from places where we
2985             create attachment elements, and instead have Document enforce this when an attachment element is inserted.
2986
2987         Tests:  WKAttachmentTests.InsertAndRemoveDuplicateAttachment
2988                 WKAttachmentTests.InsertDuplicateAttachmentAndUpdateData
2989
2990         * dom/Document.cpp:
2991         (WebCore::Document::didInsertAttachmentElement):
2992
2993         Assign the unique identifier of an attachment element that has been inserted. If the identifier already tracks
2994         an existing attachment element in the document or is missing, reassign the identifier to a new value.
2995
2996         * editing/cocoa/WebContentReaderCocoa.mm:
2997         (WebCore::createFragmentForImageAttachment):
2998         (WebCore::replaceRichContentWithAttachments):
2999         (WebCore::WebContentReader::readFilePaths):
3000
3001         Remove calls to setUniqueIdentifier here, since Document will assign a unique identifier upon insertion.
3002
3003         * editing/markup.cpp:
3004         (WebCore::StyledMarkupAccumulator::appendCustomAttributes):
3005         (WebCore::createFragmentFromMarkup):
3006
3007         Set the attachment's unique identifier to the value of the "webkitattachmentid" attribute. When moving existing
3008         attachments around in the DOM without duplication, this ensures that the attachment will be removed and
3009         reinserted in the document without triggering removal and insertion client delegate methods.
3010
3011         When pasting an attachment element that has the same identifier as an existing attachment, we let Document
3012         realize that the attachment identifier already exists, and reassign it to a unique value.
3013
3014         * html/HTMLAttachmentElement.cpp:
3015         (WebCore::HTMLAttachmentElement::uniqueIdentifier const): Deleted.
3016         (WebCore::HTMLAttachmentElement::setUniqueIdentifier): Deleted.
3017         * html/HTMLAttachmentElement.h:
3018
3019 2018-01-08  Zalan Bujtas  <zalan@apple.com>
3020
3021         [RenderTreeBuilder] Move RenderBlockFlow addChild logic to RenderTreeBuilder
3022         https://bugs.webkit.org/show_bug.cgi?id=181348
3023         <rdar://problem/36328117>
3024
3025         Reviewed by Antti Koivisto.
3026
3027         This is about moving the code, no cleanup and/or normalization (unfortunately it also means
3028         some temporary changes).  
3029
3030         No change in functionality.
3031
3032         * Sources.txt:
3033         * WebCore.xcodeproj/project.pbxproj:
3034         * rendering/RenderBlockFlow.cpp:
3035         (WebCore::RenderBlockFlow::addChild):
3036         * rendering/updating/RenderTreeBuilder.cpp:
3037         (WebCore::RenderTreeBuilder::RenderTreeBuilder):
3038         (WebCore::RenderTreeBuilder::insertChildToRenderBlockFlow):
3039         * rendering/updating/RenderTreeBuilder.h:
3040         (WebCore::RenderTreeBuilder::blockFlowBuilder):
3041         * rendering/updating/RenderTreeBuilderBlockFlow.cpp: Added.
3042         (WebCore::RenderTreeBuilder::BlockFlow::BlockFlow):
3043         (WebCore::RenderTreeBuilder::BlockFlow::insertChild):
3044         * rendering/updating/RenderTreeBuilderBlockFlow.h: Added.
3045
3046 2018-01-08  Youenn Fablet  <youenn@apple.com>
3047
3048         Add CSP support to service workers
3049         https://bugs.webkit.org/show_bug.cgi?id=181385
3050
3051         Reviewed by Chris Dumez.
3052
3053         Covered by rebased tests.
3054
3055         Added recovery of CSP information from WorkerScriptLoader.
3056         Added plumbing to pass the CSP information to Service Workers.
3057         Added persistency support for the CSP information.
3058
3059         * workers/WorkerScriptLoader.cpp:
3060         (WebCore::WorkerScriptLoader::loadAsynchronously):
3061         (WebCore::WorkerScriptLoader::didReceiveResponse):
3062         * workers/WorkerScriptLoader.h:
3063         (WebCore::WorkerScriptLoader::contentSecurityPolicy const):
3064         * workers/service/SWClientConnection.cpp:
3065         (WebCore::SWClientConnection::finishedFetchingScript):
3066         (WebCore::SWClientConnection::failedFetchingScript):
3067         * workers/service/SWClientConnection.h:
3068         * workers/service/ServiceWorkerContainer.cpp:
3069         (WebCore::ServiceWorkerContainer::addRegistration):
3070         (WebCore::ServiceWorkerContainer::jobFailedWithException):
3071         (WebCore::ServiceWorkerContainer::jobResolvedWithRegistration):
3072         (WebCore::ServiceWorkerContainer::jobFinishedLoadingScript):
3073         * workers/service/ServiceWorkerContainer.h:
3074         * workers/service/ServiceWorkerContextData.cpp:
3075         (WebCore::ServiceWorkerContextData::isolatedCopy const):
3076         * workers/service/ServiceWorkerContextData.h:
3077         (WebCore::ServiceWorkerContextData::encode const):
3078         (WebCore::ServiceWorkerContextData::decode):
3079         * workers/service/ServiceWorkerFetchResult.h:
3080         (WebCore::ServiceWorkerFetchResult::encode const):
3081         (WebCore::ServiceWorkerFetchResult::decode):
3082         * workers/service/ServiceWorkerGlobalScope.cpp:
3083         (WebCore::ServiceWorkerGlobalScope::create):
3084         * workers/service/ServiceWorkerGlobalScope.h:
3085         * workers/service/ServiceWorkerJob.cpp:
3086         (WebCore::ServiceWorkerJob::notifyFinished):
3087         * workers/service/ServiceWorkerJobClient.h:
3088         * workers/service/context/ServiceWorkerThread.cpp:
3089         (WebCore::ServiceWorkerThread::ServiceWorkerThread):
3090         (WebCore::ServiceWorkerThread::createWorkerGlobalScope):
3091         * workers/service/server/RegistrationDatabase.cpp:
3092         (WebCore::v1RecordsTableSchema):
3093         (WebCore::RegistrationDatabase::openSQLiteDatabase):
3094         (WebCore::RegistrationDatabase::doPushChanges):
3095         (WebCore::RegistrationDatabase::importRecords):
3096         * workers/service/server/SWServer.cpp:
3097         (WebCore::SWServer::updateWorker):
3098         (WebCore::SWServer::installContextData):
3099         * workers/service/server/SWServer.h:
3100         * workers/service/server/SWServerJobQueue.cpp:
3101         (WebCore::SWServerJobQueue::scriptFetchFinished):
3102         * workers/service/server/SWServerWorker.cpp:
3103         (WebCore::SWServerWorker::SWServerWorker):
3104         (WebCore::m_contentSecurityPolicy):
3105         (WebCore::SWServerWorker::contextData const):
3106         * workers/service/server/SWServerWorker.h:
3107
3108 2018-01-08  Youenn Fablet  <youenn@apple.com>
3109
3110         Use no-cache fetch mode when loading main documents with location.reload()
3111         https://bugs.webkit.org/show_bug.cgi?id=181285
3112
3113         Reviewed by Alex Christensen.
3114
3115         Covered by rebased tests.
3116
3117         Start to translate cache policy used for navigation as FetchOptions::Cache.
3118         This allows ensuring service workers receive the right cache mode when intercepting navigation loads.
3119         To not change current navigation behavior, ReturnCacheDataElseLoad and ReturnCacheDataDontLoad still trigger default fetch cache mode.
3120
3121         For Reload and ReloadExpiredOnly frame load types, using no-cache mode is more efficient than reload mode,
3122         as a conditional request will be sent if possible. This applies to location.reload which is consistent with other browsers.
3123         Keep reload mode for ReloadFromOrigin.
3124
3125         * loader/DocumentLoader.cpp:
3126         (WebCore::toFetchOptionsCache):
3127         (WebCore::DocumentLoader::loadMainResource):
3128         * loader/FrameLoader.cpp:
3129         (WebCore::FrameLoader::loadFrameRequest):
3130         (WebCore::FrameLoader::loadURL):
3131         (WebCore::FrameLoader::load):
3132         (WebCore::FrameLoader::reload):
3133         (WebCore::FrameLoader::defaultRequestCachingPolicy):
3134         (WebCore::FrameLoader::loadDifferentDocumentItem):
3135         * loader/NavigationScheduler.cpp:
3136
3137 2018-01-08  Youenn Fablet  <youenn@apple.com>
3138
3139         Stop exposing fetch and extendable events to window
3140         https://bugs.webkit.org/show_bug.cgi?id=181325
3141
3142         Reviewed by Chris Dumez.
3143
3144         Covered by updated tests.
3145
3146         Marked FetchEvent and ExtendableEvent as visible in ServiceWorker environments only.
3147         Moved related Internals testing routines to ServiceWorkerInternals.
3148
3149         * testing/Internals.cpp:
3150         (WebCore::Internals::waitForFetchEventToFinish): Deleted.
3151         (WebCore::Internals::createBeingDispatchedFetchEvent): Deleted.
3152         * testing/Internals.h:
3153         * testing/Internals.idl:
3154         * testing/ServiceWorkerInternals.cpp:
3155         (WebCore::ServiceWorkerInternals::waitForFetchEventToFinish):
3156         (WebCore::ServiceWorkerInternals::createBeingDispatchedFetchEvent):
3157         * testing/ServiceWorkerInternals.h:
3158         * testing/ServiceWorkerInternals.idl:
3159         * workers/service/ExtendableEvent.idl:
3160         * workers/service/FetchEvent.idl:
3161
3162 2018-01-08  Antti Koivisto  <antti@apple.com>
3163
3164         REGRESSION (r219145): Toggling layer borders on a static document no longer works immediately
3165         https://bugs.webkit.org/show_bug.cgi?id=176260
3166         <rdar://problem/34219966>
3167
3168         Reviewed by Simon Fraser.
3169
3170         Optimization reveled bugs in debug indicator painting.
3171
3172         Test: compositing/debug-borders-dynamic.html
3173
3174         * platform/graphics/ca/GraphicsLayerCA.cpp:
3175         (WebCore::GraphicsLayerCA::commitLayerChangesBeforeSublayers):
3176         (WebCore::GraphicsLayerCA::updateDebugIndicators):
3177         (WebCore::GraphicsLayerCA::updateDebugBorder): Deleted.
3178
3179         - Rename to indicate this is not just about debug borders.
3180         - Trigger display so repaint counters get painted. This helper is only called when the indicators change.
3181
3182         * platform/graphics/ca/GraphicsLayerCA.h:
3183         * rendering/RenderLayerCompositor.cpp:
3184         (WebCore::RenderLayerCompositor::cacheAcceleratedCompositingFlags):
3185
3186         Ensure we do compositing update on debug border change even when there is no layout.
3187
3188 2018-01-08  Zalan Bujtas <zalan@apple.com>
3189
3190         [RenderTreeBuilder] Move RenderInline addChild logic to RenderTreeBuilder
3191         https://bugs.webkit.org/show_bug.cgi?id=181336
3192         <rdar://problem/36324693>
3193
3194         Reviewed by Antti Koivisto.
3195
3196         This is about moving the code, no cleanup and/or normalization (unfortunately it also means
3197         some temporary changes).  
3198
3199         No change in functionality.
3200
3201         * Sources.txt:
3202         * WebCore.xcodeproj/project.pbxproj:
3203         * rendering/RenderInline.cpp:
3204         (WebCore::RenderInline::addChild):
3205         (WebCore::RenderInline::addChildIgnoringContinuation):
3206         (WebCore::RenderInline::childBecameNonInline):
3207         (WebCore::nextContinuation): Deleted.
3208         (WebCore::RenderInline::continuationBefore): Deleted.
3209         (WebCore::newChildIsInline): Deleted.
3210         (WebCore::RenderInline::cloneAsContinuation const): Deleted.
3211         (WebCore::RenderInline::splitInlines): Deleted.
3212         (WebCore::RenderInline::splitFlow): Deleted.
3213         (WebCore::canUseAsParentForContinuation): Deleted.
3214         (WebCore::RenderInline::addChildToContinuation): Deleted.
3215         * rendering/RenderInline.h:
3216         * rendering/updating/RenderTreeBuilder.cpp:
3217         (WebCore::RenderTreeBuilder::RenderTreeBuilder):
3218         (WebCore::RenderTreeBuilder::insertChildToRenderInline):
3219         (WebCore::RenderTreeBuilder::insertChildToRenderInlineIgnoringContinuation):
3220         (WebCore::RenderTreeBuilder::splitFlow):
3221         * rendering/updating/RenderTreeBuilder.h:
3222         (WebCore::RenderTreeBuilder::inlineBuilder):
3223         * rendering/updating/RenderTreeBuilderInline.cpp: Added.
3224         (WebCore::canUseAsParentForContinuation):
3225         (WebCore::nextContinuation):
3226         (WebCore::continuationBefore):
3227         (WebCore::cloneAsContinuation):
3228         (WebCore::newChildIsInline):
3229         (WebCore::inFlowPositionedInlineAncestor):
3230         (WebCore::RenderTreeBuilder::Inline::Inline):
3231         (WebCore::RenderTreeBuilder::Inline::insertChild):
3232         (WebCore::RenderTreeBuilder::Inline::insertChildToContinuation):
3233         (WebCore::RenderTreeBuilder::Inline::insertChildIgnoringContinuation):
3234         (WebCore::RenderTreeBuilder::Inline::splitFlow):
3235         (WebCore::RenderTreeBuilder::Inline::splitInlines):
3236         * rendering/updating/RenderTreeBuilderInline.h: Added.
3237
3238 2018-01-08  Zalan Bujtas  <zalan@apple.com>
3239
3240         [RenderTreeBuilder] Move RenderBlock addChild logic to RenderTreeBuilder
3241         https://bugs.webkit.org/show_bug.cgi?id=181319
3242         <rdar://problem/36313464>
3243
3244         Reviewed by Antti Koivisto.
3245
3246         This is about moving the code, no cleanup and/or normalization (unfortunately it also means
3247         some temporary changes).  
3248
3249         No change in functionality.
3250
3251         * Sources.txt:
3252         * WebCore.xcodeproj/project.pbxproj:
3253         * rendering/RenderBlock.cpp:
3254         (WebCore::RenderBlock::addChild):
3255         (WebCore::RenderBlock::addChildIgnoringContinuation):
3256         (WebCore::RenderBlock::childBecameNonInline):
3257         (WebCore::RenderBlock::continuationBefore): Deleted.
3258         (WebCore::RenderBlock::addChildToContinuation): Deleted.
3259         (WebCore::getInlineRun): Deleted.
3260         (WebCore::RenderBlock::makeChildrenNonInline): Deleted.
3261         * rendering/RenderBlock.h:
3262         * rendering/RenderBox.cpp:
3263         (WebCore::markBoxForRelayoutAfterSplit): Deleted.
3264         (WebCore::RenderBox::splitAnonymousBoxesAroundChild): Deleted.
3265         * rendering/RenderBox.h:
3266         * rendering/RenderRubyBase.cpp:
3267         (WebCore::RenderRubyBase::moveChildren):
3268         (WebCore::RenderRubyBase::moveBlockChildren):
3269         * rendering/RenderTable.cpp:
3270         (WebCore::RenderTable::addChild):
3271         * rendering/RenderTableRow.cpp:
3272         (WebCore::RenderTableRow::addChild):
3273         * rendering/RenderTableSection.cpp:
3274         (WebCore::RenderTableSection::addChild):
3275         * rendering/updating/RenderTreeBuilder.cpp:
3276         (WebCore::markBoxForRelayoutAfterSplit):
3277         (WebCore::getInlineRun):
3278         (WebCore::RenderTreeBuilder::RenderTreeBuilder):
3279         (WebCore::RenderTreeBuilder::insertChildToRenderBlock):
3280         (WebCore::RenderTreeBuilder::insertChildToRenderBlockIgnoringContinuation):
3281         (WebCore::RenderTreeBuilder::makeChildrenNonInline):
3282         (WebCore::RenderTreeBuilder::splitAnonymousBoxesAroundChild):
3283         * rendering/updating/RenderTreeBuilder.h:
3284         (WebCore::RenderTreeBuilder::blockBuilder):
3285         * rendering/updating/RenderTreeBuilderBlock.cpp: Added.
3286         (WebCore::continuationBefore):
3287         (WebCore::RenderTreeBuilder::Block::Block):
3288         (WebCore::RenderTreeBuilder::Block::insertChild):
3289         (WebCore::RenderTreeBuilder::Block::insertChildToContinuation):
3290         (WebCore::RenderTreeBuilder::Block::insertChildIgnoringContinuation):
3291         * rendering/updating/RenderTreeBuilderBlock.h: Added.
3292         
3293 2018-01-08  Jeremy Jones  <jeremyj@apple.com>
3294
3295         Standard controls sometimes say video is in pip when it isnt.
3296         https://bugs.webkit.org/show_bug.cgi?id=181095
3297         rdar://problem/36182687
3298
3299         Reviewed by Eric Carlson.
3300
3301         * html/HTMLMediaElement.cpp:
3302         (WebCore::HTMLMediaElement::exitFullscreen):
3303
3304 2018-01-08  Jer Noble  <jer.noble@apple.com>
3305
3306         REGRESSION: [iOS] ASSERTION FAILED: !node.isConnected() in WebCore::notifyNodeInsertedIntoDocument
3307         https://bugs.webkit.org/show_bug.cgi?id=181091
3308
3309         Reviewed by Darin Adler.
3310
3311         Move the work previously performed in insertedIntoAncestor() into didFinishInsertingNode().
3312
3313         * html/HTMLMediaElement.cpp:
3314         (WebCore::HTMLMediaElement::prepareForLoad):
3315
3316 2018-01-08  Zan Dobersek  <zdobersek@igalia.com>
3317
3318         [Cairo] Use isolated fill and stroke source containers
3319         https://bugs.webkit.org/show_bug.cgi?id=181386
3320
3321         Reviewed by Carlos Garcia Campos.
3322
3323         Generate fill and stroke source objects upon invocation of various Cairo
3324         operations, initializing necessary data from the GraphicsContextState
3325         object.
3326
3327         Cairo::FillSource and Cairo::StrokeSource structs are introduced, both
3328         being default-constructible as well as providing a constructor that
3329         accepts a GraphicsContextState object from which the appropriate
3330         resources are created.
3331
3332         The FillSource and StrokeSource objects are then passed to
3333         PlatformContextCairo's prepareForFilling() and prepareForStroking()
3334         methods. Here the helper prepareCairoContextSource() function is now
3335         invoked with cairo_pattern_t objects as pattern or gradient sources, or
3336         the source color if neither cairo_pattern_t object is specified.
3337
3338         The FillSource and StrokeSource constructors mimic the previous behavior
3339         of prepareCairoContextSource(). In case the source is a Pattern object,
3340         a cairo_pattern_t object is created from that. In case of FillSource,
3341         we also retrieve pattern size, transform and repetition information. In
3342         case the source os a Gradient object, we create a 'base' cairo_pattern_t
3343         object for a completely opaque alpha channel. Additionally, if the alpha
3344         value on the state is not 1, we create an alpha-adjusted cairo_pattern_t
3345         that is potentially used for any filling or stroking operation that has
3346         to preserve transparency. If neither Pattern or Gradient objects are set
3347         on the GraphicsContextState, we default to the current fill or stroke
3348         color.
3349
3350         Overall, there's no change in behavior, this is simply a refactoring
3351         that enables us to construct Cairo objects for filling and stroking
3352         sources at the time of Cairo operation dispatch, instead of pulling down
3353         GraphicsContextState deeper into the Cairo-specific code.
3354
3355         No new tests -- no change in functionality.
3356
3357         * platform/graphics/cairo/CairoOperations.cpp:
3358         (WebCore::Cairo::drawPathShadow):
3359         (WebCore::Cairo::fillCurrentCairoPath):
3360         (WebCore::Cairo::FillSource::FillSource):
3361         (WebCore::Cairo::StrokeSource::StrokeSource):
3362         (WebCore::Cairo::fillRect):
3363         (WebCore::Cairo::fillRectWithRoundedHole):
3364         (WebCore::Cairo::fillPath):
3365         (WebCore::Cairo::strokeRect):
3366         (WebCore::Cairo::strokePath):
3367         (WebCore::Cairo::drawGlyphs):
3368         * platform/graphics/cairo/CairoOperations.h:
3369         * platform/graphics/cairo/FontCairo.cpp:
3370         (WebCore::FontCascade::drawGlyphs):
3371         * platform/graphics/cairo/GraphicsContextCairo.cpp:
3372         (WebCore::GraphicsContext::fillPath):
3373         (WebCore::GraphicsContext::strokePath):
3374         (WebCore::GraphicsContext::fillRect):
3375         (WebCore::GraphicsContext::strokeRect):
3376         (WebCore::GraphicsContext::fillRectWithRoundedHole):
3377         * platform/graphics/cairo/PlatformContextCairo.cpp:
3378         (WebCore::prepareCairoContextSource):
3379         (WebCore::PlatformContextCairo::prepareForFilling):
3380         (WebCore::PlatformContextCairo::prepareForStroking):
3381         (WebCore::PlatformContextCairo::clipForPatternFilling):
3382         * platform/graphics/cairo/PlatformContextCairo.h:
3383
3384 2018-01-08  Youenn Fablet  <youenn@apple.com>
3385
3386         navigator.onLine does not work inside service workers
3387         https://bugs.webkit.org/show_bug.cgi?id=181079
3388         <rdar://problem/36178606>
3389
3390         Reviewed by Darin Adler.
3391
3392         Test: http/wpt/service-workers/online.https.html
3393
3394         Added support for onLine by reusing a similar implementation as regular workers.
3395         Added ServiceWorkerInternals as an interface for an object exposed as self.internals in WTR.
3396         This object has currently one method to trigger change in the online/offline status.
3397         This allows writing a test for the onLine feature.
3398
3399         Note that self.internals is inserted asynchronously after the script was evaluated.
3400         When writing a worker script using self.internals, one must make sure to use self.internals when initialized.
3401         online-worker.js for instance makes use of self.internals in a postMessage callback.
3402
3403         * CMakeLists.txt:
3404         * DerivedSources.make:
3405         * WebCore.xcodeproj/project.pbxproj:
3406         * bindings/js/WorkerScriptController.h:
3407         * dom/ScriptExecutionContext.h:
3408         * testing/ServiceWorkerInternals.cpp: Added.
3409         (WebCore::ServiceWorkerInternals::ServiceWorkerInternals):
3410         (WebCore::ServiceWorkerInternals::setOnline):
3411         * testing/ServiceWorkerInternals.h: Added.
3412         * testing/ServiceWorkerInternals.idl: Added.
3413         * testing/js/WebCoreTestSupport.cpp:
3414         (WebCoreTestSupport::setupNewlyCreateServiceWorker):
3415         * testing/js/WebCoreTestSupport.h:
3416         * workers/service/context/SWContextManager.cpp:
3417         (WebCore::SWContextManager::registerServiceWorkerThreadForInstall):
3418         (WebCore::SWContextManager::startedServiceWorker):
3419         * workers/service/context/SWContextManager.h:
3420         (WebCore::SWContextManager::setServiceWorkerCreationCallback):
3421         (WebCore::SWContextManager::workerByID):
3422         * workers/service/context/ServiceWorkerThread.cpp:
3423         (WebCore::ServiceWorkerThread::ServiceWorkerThread):
3424         * workers/service/context/ServiceWorkerThreadProxy.cpp:
3425         (WebCore::ServiceWorkerThreadProxy::ServiceWorkerThreadProxy):
3426         (WebCore::ServiceWorkerThreadProxy::~ServiceWorkerThreadProxy):
3427         (WebCore::ServiceWorkerThreadProxy::networkStateChanged):
3428         (WebCore::ServiceWorkerThreadProxy::notifyNetworkStateChange):
3429         * workers/service/context/ServiceWorkerThreadProxy.h:
3430
3431 2018-01-08  Zan Dobersek  <zdobersek@igalia.com>
3432
3433         [Cairo] Contain shadow blur requirement state in a separate object
3434         https://bugs.webkit.org/show_bug.cgi?id=181380
3435
3436         Reviewed by Carlos Garcia Campos.
3437
3438         Instead of picking up the necessary state parameters from a
3439         GraphicsContextState object, store the necessary parameters in a helper
3440         ShadowBlurUsage struct. Mimicking the mustUseShadowBlur() function that
3441         is being removed, values of the shadow color, shadow blur, and shadow
3442         transform ignorance are stored there. Additionally, the required()
3443         method accepts a PlatformContextCairo object through which it can
3444         retrieve the current CTM and determine whether it's an identity, finally
3445         deciding whether shadow blur can or cannot be ignored.
3446
3447         Goal of this change is to limit usage of GraphicsContextState directly
3448         in operations implemented inside the Cairo namespace. Instead, the
3449         state parameters should be passed directly, or an equivalent but limited
3450         state object should be constructed for invocation of such operations.
3451
3452         This is likely only an intermediate solution. It's possible it will be
3453         replaced by a more complete shadow state struct that would be used for
3454         any operation that is required to draw shadows, if necessary.
3455
3456         No new tests -- no change in functionality.
3457
3458         * platform/graphics/cairo/CairoOperations.cpp:
3459         (WebCore::Cairo::drawGlyphsShadow):
3460         (WebCore::Cairo::ShadowBlurUsage::ShadowBlurUsage):
3461         (WebCore::Cairo::ShadowBlurUsage::required const):
3462         (WebCore::Cairo::fillRectWithRoundedHole):
3463         (WebCore::Cairo::drawGlyphs):
3464         (WebCore::Cairo::mustUseShadowBlur): Deleted.
3465         * platform/graphics/cairo/CairoOperations.h:
3466         * platform/graphics/cairo/FontCairo.cpp:
3467         (WebCore::FontCascade::drawGlyphs):
3468         * platform/graphics/cairo/GraphicsContextCairo.cpp:
3469         (WebCore::GraphicsContext::fillRectWithRoundedHole):
3470
3471 2018-01-08  Philippe Normand  <pnormand@igalia.com>
3472
3473         [GStreamer][Soup] Remove dead getCreateOrReadBuffer code path
3474         https://bugs.webkit.org/show_bug.cgi?id=181376
3475
3476         Reviewed by Carlos Garcia Campos.
3477
3478         This code path is no longer used now that the GStreamer HTTP
3479         source element uses data coming directly from the network process.
3480
3481         * SourcesGTK.txt:
3482         * SourcesWPE.txt:
3483         * loader/MediaResourceLoader.cpp:
3484         (WebCore::MediaResource::getOrCreateReadBuffer): Deleted.
3485         * loader/MediaResourceLoader.h:
3486         * loader/SubresourceLoader.h:
3487         * loader/cache/CachedRawResource.h:
3488         * loader/cache/CachedRawResourceClient.h:
3489         (WebCore::CachedRawResourceClient::finishedTimingForWorkerLoad):
3490         (WebCore::CachedRawResourceClient::getOrCreateReadBuffer): Deleted.
3491         * loader/cache/CachedResource.h:
3492         (WebCore::CachedResource::getOrCreateReadBuffer): Deleted.
3493         * loader/soup/CachedRawResourceSoup.cpp: Removed.
3494         * loader/soup/SubresourceLoaderSoup.cpp: Removed.
3495         * platform/graphics/PlatformMediaResourceLoader.h:
3496         (WebCore::PlatformMediaResourceClient::loadFinished):
3497         (WebCore::PlatformMediaResourceClient::getOrCreateReadBuffer): Deleted.
3498         * platform/graphics/gstreamer/WebKitWebSourceGStreamer.cpp:
3499         (CachedResourceStreamingClient::getOrCreateReadBuffer): Deleted.
3500         * platform/network/ResourceHandleClient.h:
3501         (WebCore::ResourceHandleClient::getOrCreateReadBuffer): Deleted.
3502         * platform/network/soup/ResourceHandleSoup.cpp:
3503         (WebCore::ResourceHandle::ensureReadBuffer):
3504
3505 2018-01-08  Zan Dobersek  <zdobersek@igalia.com> and Carlos Garcia Campos  <cgarcia@igalia.com>
3506
3507         [GStreamer] use FastMalloc-based GstAllocator
3508         https://bugs.webkit.org/show_bug.cgi?id=165793
3509
3510         Reviewed by Philippe Normand.
3511
3512         Add GstAllocatorFastMalloc, a GstAllocator implementation using fast malloc. It's only used when fast malloc is
3513         enabled and can be disabled using an environment variable for debugging purposes.
3514
3515         * platform/GStreamer.cmake:
3516         * platform/graphics/gstreamer/GStreamerUtilities.cpp:
3517         (WebCore::initializeGStreamer):
3518         * platform/graphics/gstreamer/GstAllocatorFastMalloc.cpp: Added.
3519         (gstMemoryFastMallocNew):
3520         (gstAllocatorFastMallocAlloc):
3521         (gstAllocatorFastMallocFree):
3522         (gstAllocatorFastMallocMemMap):
3523         (gstAllocatorFastMallocMemUnmap):
3524         (gstAllocatorFastMallocMemCopy):
3525         (gstAllocatorFastMallocMemShare):
3526         (gstAllocatorFastMallocMemIsSpan):
3527         (gst_allocator_fast_malloc_class_init):
3528         (gst_allocator_fast_malloc_init):
3529         * platform/graphics/gstreamer/GstAllocatorFastMalloc.h: Added.
3530
3531 2018-01-07  Ms2ger  <Ms2ger@igalia.com>
3532
3533         Implement createImageBitmap(ImageBitmap)
3534         https://bugs.webkit.org/show_bug.cgi?id=181287
3535
3536         Reviewed by Darin Adler.
3537
3538         Tests: imported/w3c/web-platform-tests/2dcontext/imagebitmap/createImageBitmap-drawImage.html
3539                imported/w3c/web-platform-tests/2dcontext/imagebitmap/createImageBitmap-invalid-args.html
3540
3541         * html/ImageBitmap.cpp:
3542         (WebCore::ImageBitmap::createPromise):
3543
3544 2018-01-07  Ryosuke Niwa  <rniwa@webkit.org>
3545
3546         Reduce the precision of "high" resolution time to 1ms
3547         https://bugs.webkit.org/show_bug.cgi?id=180910
3548         <rdar://problem/36085943>
3549
3550         Reviewed by Saam Barati.
3551
3552         Reduced the high prevision time's resolution to 1ms, the same precision as Date.now().
3553
3554         Also fixed the bug in fillRTCStats that we weren't reducing the time resolution in RTCStats dictionaries.
3555
3556         * Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.cpp:
3557         (WebCore::fillRTCStats):
3558         * page/Performance.cpp:
3559         (WebCore::Performance::reduceTimeResolution):
3560
3561 2018-01-06  Simon Fraser  <simon.fraser@apple.com>
3562
3563         Possible crash computing event regions
3564         https://bugs.webkit.org/show_bug.cgi?id=181368
3565         rdar://problem/34847081
3566
3567         Reviewed by Zalan Bujtas.
3568
3569         Don't trigger layout in Element::absoluteEventHandlerBounds(), since this can run arbirary script
3570         which might delete elements or re-enter Document::absoluteRegionForEventTargets().
3571
3572         It's OK to not trigger layout, because if layout is dirty, the next layout will update event regions again.
3573
3574         Add a LayoutDisallowedScope to check that Document::absoluteRegionForEventTargets() doesn't
3575         trigger layout, and move the check for LayoutDisallowedScope::isLayoutAllowed() from Document::updateLayout()
3576         to LayoutContext::layout(), since some layouts don't happen via the former (e.g. the one being removed here).
3577
3578         The test checks that the assertion does not fire. I was not able to get a reliable test for any crash.
3579
3580         Test: fast/events/event-handler-regions-layout.html
3581
3582         * dom/Document.cpp:
3583         (WebCore::Document::updateLayout):
3584         (WebCore::Document::absoluteRegionForEventTargets):
3585         * dom/Element.cpp:
3586         (WebCore::Element::absoluteEventHandlerBounds):
3587         * page/LayoutContext.cpp:
3588         (WebCore::LayoutContext::layout):
3589         * rendering/LayoutDisallowedScope.h: Move the #ifdefs around to avoid defining the enum twice.
3590         (WebCore::LayoutDisallowedScope::LayoutDisallowedScope):
3591         (WebCore::LayoutDisallowedScope::isLayoutAllowed):
3592
3593 2018-01-06  Simon Fraser  <simon.fraser@apple.com>
3594
3595         Crash under RenderLayer::scrollTo() with marquee
3596         https://bugs.webkit.org/show_bug.cgi?id=181349
3597         rdar://problem/36190168
3598
3599         Reviewed by Zalan Bujtas.
3600
3601         Don't call updateWidgetPositions() synchonously during RenderLayer scrolling, because it
3602         can run arbitrary script which may trigger destruction of this RenderLayer.
3603
3604         Instead, queue up updateWidgetPositions() on a zero-delay timer.
3605
3606         Under some circumstances this may allow a paint to occur before the widgets have been
3607         updated (which could be fixed with a more invasive change), but in practice I saw no
3608         painting issues with plug-ins or iframes inside overflow scroll, in WebKit or LegacyWebKit.
3609
3610         Test: fast/scrolling/marquee-scroll-crash.html
3611
3612         * page/FrameView.cpp:
3613         (WebCore::FrameView::FrameView):
3614         (WebCore::FrameView::updateWidgetPositions):
3615         (WebCore::FrameView::scheduleUpdateWidgetPositions):
3616         (WebCore::FrameView::updateWidgetPositionsTimerFired):
3617         * page/FrameView.h:
3618         * rendering/RenderLayer.cpp:
3619         (WebCore::RenderLayer::scrollTo):
3620
3621 2018-01-05  Dean Jackson  <dino@apple.com>
3622
3623         Accurately clip copyTexImage2D and copyTexSubImage2D
3624         https://bugs.webkit.org/show_bug.cgi?id=181356
3625         <rdar://problem/35083877>
3626
3627         Reviewed by Eric Carlson.
3628
3629         The code to make sure copyTexSubImage2D and copyTexImage2D will not try to read
3630         out of bounds had a bad bug introduced here:
3631         https://bugs.webkit.org/show_bug.cgi?id=51421
3632
3633         With appropriate parameters, it would produce a rectangle with
3634         negative dimensions. Most GL drivers just ignored this, but some
3635         are not happy.
3636
3637         Test: fast/canvas/webgl/copy-tex-image-and-sub-image-2d-bad-input.html
3638
3639         * html/canvas/WebGLRenderingContextBase.cpp:
3640         (WebCore::clip2D): Reimplement this in a more sane manner, and use
3641         checked arithmetic while here.
3642         * html/canvas/WebGLRenderingContextBase.h:
3643         (WebCore::clip1D): Deleted.
3644         (WebCore::clip2D): Deleted.
3645
3646 2018-01-06  Antti Koivisto  <antti@apple.com>
3647
3648         Use WeakPtr for RenderTreePosition::m_nextSibling
3649         https://bugs.webkit.org/show_bug.cgi?id=181363
3650
3651         Reviewed by Zalan Bujtas.
3652
3653         For safety. In most cases it is null and won't cause us to instantiate WeakReferences for
3654         many new objects.
3655
3656         * rendering/updating/RenderTreePosition.cpp:
3657         (WebCore::RenderTreePosition::computeNextSibling):
3658         * rendering/updating/RenderTreePosition.h:
3659         (WebCore::RenderTreePosition::RenderTreePosition):
3660         (WebCore::RenderTreePosition::nextSibling const):
3661
3662 2018-01-05  David Kilzer  <ddkilzer@apple.com>
3663
3664         Re-enable -Wcast-qual in WebCore for Apple ports
3665         <https://webkit.org/b/177895>
3666         <rdar://problem/34960830>
3667
3668         Reviewed by Joseph Pecoraro.
3669
3670         * Configurations/Base.xcconfig:
3671         (WARNING_CFLAGS): Remove FIXME and add -Wcast-qual back to
3672         arguments.
3673
3674         * crypto/mac/SerializedCryptoKeyWrapMac.mm:
3675         (WebCore::createAndStoreMasterKey):
3676         - Use checked_cf_cast<SecACLRef>().
3677
3678         * editing/cocoa/DataDetection.mm:
3679         (WebCore::detectItemAtPositionWithRange):
3680         - Manually cast CFTypeRef to DDResultRef until
3681           DDResultGetTypeID() is available as SPI.
3682
3683         * platform/gamepad/mac/HIDGamepad.cpp:
3684         (WebCore::HIDGamepad::initElementsFromArray):
3685         - Use checked_cf_cast<IOHIDElementRef>().
3686
3687         * platform/graphics/avfoundation/objc/MediaSampleAVFObjC.mm:
3688         (WebCore::MediaSampleAVFObjC::createImageSample):
3689         (WebCore::CMSampleBufferIsRandomAccess):
3690         (WebCore::CMSampleBufferIsNonDisplaying):
3691         (WebCore::MediaSampleAVFObjC::createNonDisplayingCopy const):
3692         - Use checked_cf_cast<CFMutableDictionaryRef>() and
3693           checked_cf_cast<CFDictionaryRef>().
3694
3695         * platform/graphics/cocoa/IOSurface.h:
3696         (WebCore::IOSurface::asLayerContents):
3697         - Use reinterpret_cast<id>() to cast from IOSurfaceRef to id.
3698
3699         * platform/graphics/cocoa/WebCoreDecompressionSession.mm:
3700         (WebCore::WebCoreDecompressionSession::getFirstVideoFrame):
3701         (WebCore::WebCoreDecompressionSession::automaticDequeue):
3702         (WebCore::WebCoreDecompressionSession::imageForTime):
3703         (WebCore::WebCoreDecompressionSession::getDecodeTime):
3704         (WebCore::WebCoreDecompressionSession::getPresentationTime):
3705         (WebCore::WebCoreDecompressionSession::getDuration):
3706         - Use checked_cf_cast<CMSampleBufferRef>().
3707
3708         * platform/graphics/Font.h:
3709         (WebCore::Font::m_kernedCFStringAttributes):
3710         (WebCore::Font::m_nonKernedCFStringAttributes):
3711         - Change type from RetainPtr<CFDictionaryRef> to
3712           RetainPtr<CFMutableDictionaryRef> since that's what they are.
3713         * platform/graphics/mac/SimpleFontDataCoreText.cpp:
3714         (WebCore::Font::getCFStringAttributes const):
3715         - Replace local `mutableAttributes` variable with
3716           `attributesDictionary.get()` since it returns the correct type
3717           now.
3718
3719         * platform/ios/wak/WAKView.mm:
3720         (-[WAKView _initWithViewRef:]):
3721         (_WAKCopyWrapper):
3722         * platform/ios/wak/WKView.mm:
3723         (_WKViewClearSuperview):
3724         (WKViewFirstChild):
3725         (WKViewNextSibling):
3726         - Use static_cast<WKViewRef>(const_cast<void*>()) to convert
3727           const void* variable to WKViewRef.
3728
3729         * platform/mac/PasteboardMac.mm:
3730         (WebCore::flipImageSpec):
3731         (WebCore::setDragImageImpl):
3732         - Use const_cast<> to remove 'const' modifier from
3733           unsigned char pointers.  This regressed while -Wcast-qual was
3734           disabled for WebCore.
3735
3736         * platform/mac/SSLKeyGeneratorMac.mm:
3737         (WebCore::signedPublicKeyAndChallengeString):
3738         - Use checked_cf_cast<SecACLRef>().
3739
3740         * platform/mediastream/mac/RealtimeIncomingVideoSourceCocoa.cpp:
3741         (WebCore::RealtimeIncomingVideoSourceCocoa::OnFrame):
3742         - Use checked_cf_cast<CFMutableDictionaryRef>().
3743
3744         * platform/network/cf/SocketStreamHandleImplCFNet.cpp:
3745         (WebCore::copyCONNECTProxyResponse):
3746         - Use checked_cf_cast<CFHTTPMessageRef>().
3747
3748         * platform/network/cocoa/ResourceResponseCocoa.mm:
3749         (WebCore::ResourceResponse::platformCertificateInfo const):
3750         - Use checked_cf_cast<SecTrustRef>().
3751
3752         * platform/network/mac/CertificateInfoMac.mm:
3753         (WebCore::CertificateInfo::containsNonRootSHA1SignedCertificate const):
3754         (WebCore::CertificateInfo::dump const):
3755         - Use checked_cf_cast<SecCertificateRef>().
3756
3757         * testing/cocoa/WebArchiveDumpSupport.mm:
3758         (WebCoreTestSupport::createCFURLResponseFromResponseData):
3759         - Use checked_cf_cast<>() for CFMutable* types.
3760
3761 2018-01-05  John Wilander  <wilander@apple.com>
3762
3763         Storage Access API: Refactor to make naming accurate and explicit, simplify access table, and prepare for access removal for page
3764         https://bugs.webkit.org/show_bug.cgi?id=181357
3765         <rdar://problem/36331031>
3766
3767         Reviewed by Alex Christensen.
3768
3769         No new tests. The only changed functionality that isn't covered
3770         by existing tests is cross-origin iframes in the same partition
3771         should be handled as already having access. This cannot be
3772         tested in layout tests since they don't support subdomains.
3773
3774         This change does the following:
3775         - Changes function and message names to reflect how this feature
3776           was eventually implemented, i.e. access per frame.
3777         - Makes it explicit that the UI process is only involved in
3778           granting storage access and not removing storage access.
3779           The latter is done directly by the web process.
3780         - Simplifies the network process' entry map since only needs to
3781           be able to give access to one domain in one frame at a time.
3782           Access goes away on frame navigation so there can only be one
3783           domain at a time per frame. Also, the map now uses pageIDs as
3784           main keys to prepare for efficient access removal for all
3785           frames under a page.
3786         - Fixes a bug in so that a cross-origin iframe with the same
3787           partition as the top frame correctly is handled as already
3788           having access.
3789
3790         * platform/network/NetworkStorageSession.h:
3791         * platform/network/cf/NetworkStorageSessionCFNet.cpp:
3792         (WebCore::NetworkStorageSession::cookieStoragePartition const):
3793             The only change here is the changed named of the call to
3794             NetworkStorageSession::hasStorageAccessForFrame().
3795         (WebCore::NetworkStorageSession::hasStorageAccessForFrame const):
3796         (WebCore::NetworkStorageSession::grantStorageAccessForFrame):
3797         (WebCore::NetworkStorageSession::removeStorageAccessForFrame):
3798         (WebCore::NetworkStorageSession::isStorageAccessGranted const): Deleted.
3799         (WebCore::NetworkStorageSession::setStorageAccessGranted): Deleted.
3800         (WebCore::NetworkStorageSession::removeStorageAccess): Deleted.
3801
3802 2018-01-05  Youenn Fablet  <youenn@apple.com>
3803
3804         Implement Cache API partitioning based on ClientOrigin
3805         https://bugs.webkit.org/show_bug.cgi?id=181240
3806
3807         Reviewed by Alex Christensen.
3808
3809         Covered by updated tests.
3810
3811         Previously, cache storage was partitioned according the origin of the client, represented as a String.
3812         We now partition according both client and top origins, represented as a ClientOrigin
3813
3814         Minor refactoring to use more makePendingActivity.
3815         Added support for IPC serialization of ClientOrigin.
3816         Added SecurityOriginData::toString which is used by WebKit2 Cache Storage implementation.
3817
3818         * Modules/cache/CacheStorageConnection.cpp:
3819         (WebCore::CacheStorageConnection::open):
3820         (WebCore::CacheStorageConnection::retrieveCaches):
3821         * Modules/cache/CacheStorageConnection.h:
3822         (WebCore::CacheStorageConnection::clearMemoryRepresentation):
3823         (WebCore::CacheStorageConnection::doOpen):
3824         (WebCore::CacheStorageConnection::doRetrieveCaches):
3825         * Modules/cache/DOMCacheStorage.cpp:
3826         (WebCore::DOMCacheStorage::origin const):
3827         (WebCore::DOMCacheStorage::retrieveCaches):
3828         (WebCore::DOMCacheStorage::open):
3829         (WebCore::DOMCacheStorage::remove):
3830         * Modules/cache/DOMCacheStorage.h:
3831         * Modules/cache/WorkerCacheStorageConnection.cpp:
3832         (WebCore::WorkerCacheStorageConnection::doOpen):
3833         (WebCore::WorkerCacheStorageConnection::doRetrieveCaches):
3834         * Modules/cache/WorkerCacheStorageConnection.h:
3835         * page/ClientOrigin.h:
3836         (WebCore::ClientOrigin::isolatedCopy const):
3837         (WebCore::ClientOrigin::encode const):
3838         (WebCore::ClientOrigin::decode):
3839         * page/SecurityOriginData.cpp:
3840         (WebCore::SecurityOriginData::toString const):
3841         (WebCore::SecurityOriginData::debugString const): Deleted.
3842         * page/SecurityOriginData.h:
3843         (WebCore::SecurityOriginData::debugString const):
3844         * testing/Internals.cpp:
3845         (WebCore::Internals::clearCacheStorageMemoryRepresentation):
3846
3847 2018-01-05  Wenson Hsieh  <wenson_hsieh@apple.com>
3848
3849         [Attachment Support] Add a way to write blob data to a file URL from the UI process
3850         https://bugs.webkit.org/show_bug.cgi?id=181236
3851
3852         Reviewed by Brady Eidson.
3853
3854         Add support for writing a blob to a designated file path. See comments below for more detail. No new tests, as
3855         there change in behavior yet. See part 2: https://bugs.webkit.org/show_bug.cgi?id=181199.
3856
3857         * page/DragController.cpp:
3858         (WebCore::DragController::dragAttachmentElement):
3859         * platform/PromisedBlobInfo.h:
3860
3861         Remove PromisedBlobData entirely. This was added with the premise of having the web process deliver blob data to
3862         the UI process. However, the new approach I'm taking just has the UI process tell the network process to write
3863         a blob to a given location, so a data structure to deliver blob data over IPC is no longer necessary.
3864
3865         (WebCore::PromisedBlobData::hasData const): Deleted.
3866         (WebCore::PromisedBlobData::hasFile const): Deleted.
3867         (WebCore::PromisedBlobData::operator bool const): Deleted.
3868         (WebCore::PromisedBlobData::fulfills const): Deleted.
3869         * platform/network/BlobRegistryImpl.cpp:
3870         (WebCore::BlobRegistryImpl::populateBlobsForFileWriting):
3871
3872         Introduce a new helper to build a list of blob data for file writing.
3873
3874         (WebCore::writeFilePathsOrDataBuffersToFile):
3875
3876         Introduce a new static helper to write blob data (a list of file paths and data buffers) to a given file handle.
3877         Automatically closes the given file handle upon exit.
3878
3879         (WebCore::BlobRegistryImpl::writeBlobsToTemporaryFiles):
3880         (WebCore::BlobRegistryImpl::writeBlobToFilePath):
3881
3882         Pull out common logic in writeBlobsToTemporaryFiles and writeBlobToFilePath into helper methods (see above), and
3883         refactor both methods to use the helpers.
3884
3885         * platform/network/BlobRegistryImpl.h:
3886
3887 2018-01-05  Alex Christensen  <achristensen@webkit.org>
3888
3889         Forbid < and > in URL hosts
3890         https://bugs.webkit.org/show_bug.cgi?id=181308
3891         <rdar://problem/36012757>
3892
3893         Reviewed by Tim Horton.
3894
3895         https://url.spec.whatwg.org/#forbidden-host-code-point does not include these characters yet, but I think it should.
3896         Firefox fails to parse URLs with < or > in the host.  Chrome percent encodes them.  Safari needs to do something.
3897         The web platform tests are unclear on this case, and they will need to be updated with the specification.
3898         They do show a change in behavior, though.
3899
3900         * platform/URLParser.cpp:
3901         Add < and > to the list of forbidden host code points.
3902
3903 2018-01-05  Eric Carlson  <eric.carlson@apple.com>
3904
3905         [MediaStream] Add Mac screen capture source
3906         https://bugs.webkit.org/show_bug.cgi?id=181333
3907         <rdar://problem/36323219>
3908
3909         Reviewed by Dean Jackson.
3910
3911         * SourcesCocoa.txt: Add ScreenDisplayCaptureSourceMac.mm.
3912
3913         * WebCore.xcodeproj/project.pbxproj: Ditto.
3914
3915         * platform/cocoa/CoreVideoSoftLink.cpp: Declare new constants used.
3916         * platform/cocoa/CoreVideoSoftLink.h:
3917
3918         * platform/mediastream/mac/DisplayCaptureManagerCocoa.cpp:
3919         (WebCore::displayReconfigurationCallBack): Call refreshCaptureDevices.
3920         (WebCore::DisplayCaptureManagerCocoa::~DisplayCaptureManagerCocoa): Unregister for display
3921         reconfiguration callbacks.
3922         (WebCore::DisplayCaptureManagerCocoa::captureDevices): Register for display reconfigrations.
3923         (WebCore::DisplayCaptureManagerCocoa::refreshCaptureDevices): Use CGActiveDisplayList to
3924         get list of active screens.
3925         (WebCore::DisplayCaptureManagerCocoa::screenCaptureDeviceWithPersistentID): Validate screen
3926         ID, return CaptureDevice.
3927         * platform/mediastream/mac/DisplayCaptureManagerCocoa.h:
3928
3929         * platform/mediastream/mac/RealtimeMediaSourceCenterMac.cpp:
3930         (WebCore::VideoCaptureSourceFactoryMac::createVideoCaptureSource): Deal with screen capture
3931         on macOS.
3932
3933         Implement Mac screen capture with CGDisplayStream.
3934         * platform/mediastream/mac/ScreenDisplayCaptureSourceMac.h: Added.
3935         (WebCore::ScreenDisplayCaptureSourceMac::DisplaySurface::~DisplaySurface):
3936         (WebCore::ScreenDisplayCaptureSourceMac::DisplaySurface::operator=):
3937         (WebCore::ScreenDisplayCaptureSourceMac::DisplaySurface::ioSurface const):
3938         * platform/mediastream/mac/ScreenDisplayCaptureSourceMac.mm: Added.
3939         (WebCore::roundUpToMacroblockMultiple):
3940         (WebCore::ScreenDisplayCaptureSourceMac::updateDisplayID):
3941         (WebCore::ScreenDisplayCaptureSourceMac::create):
3942         (WebCore::ScreenDisplayCaptureSourceMac::ScreenDisplayCaptureSourceMac):
3943         (WebCore::ScreenDisplayCaptureSourceMac::~ScreenDisplayCaptureSourceMac):
3944         (WebCore::ScreenDisplayCaptureSourceMac::createDisplayStream):
3945         (WebCore::ScreenDisplayCaptureSourceMac::startProducingData):
3946         (WebCore::ScreenDisplayCaptureSourceMac::stopProducingData):
3947         (WebCore::ScreenDisplayCaptureSourceMac::sampleBufferFromPixelBuffer):
3948         (WebCore::ScreenDisplayCaptureSourceMac::pixelBufferFromIOSurface):
3949         (WebCore::ScreenDisplayCaptureSourceMac::generateFrame):
3950         (WebCore::ScreenDisplayCaptureSourceMac::startDisplayStream):
3951         (WebCore::ScreenDisplayCaptureSourceMac::applySize):
3952         (WebCore::ScreenDisplayCaptureSourceMac::applyFrameRate):
3953         (WebCore::ScreenDisplayCaptureSourceMac::commitConfiguration):
3954         (WebCore::ScreenDisplayCaptureSourceMac::displayWasReconfigured):
3955         (WebCore::ScreenDisplayCaptureSourceMac::displayReconfigurationCallBack):
3956         (WebCore::ScreenDisplayCaptureSourceMac::frameAvailable):
3957
3958 2018-01-05  Don Olmstead  <don.olmstead@sony.com>
3959
3960         [curl] Can't load file:// URL with a URL fragment identifier
3961         https://bugs.webkit.org/show_bug.cgi?id=181170
3962
3963         Reviewed by Alex Christensen.
3964
3965         No new tests. No change in behavior.
3966
3967         * platform/network/curl/CurlRequest.cpp:
3968         (WebCore::CurlRequest::invokeDidReceiveResponseForFile):
3969
3970 2018-01-05  Don Olmstead  <don.olmstead@sony.com>
3971
3972         TextCodec uses std::array but does not include it
3973         https://bugs.webkit.org/show_bug.cgi?id=181340
3974
3975         Reviewed by Alex Christensen.
3976
3977         No new tests. No change in behavior.
3978
3979         * platform/text/TextCodec.h:
3980
3981 2018-01-05  Said Abou-Hallawa  <sabouhallawa@apple.com>
3982
3983         SVGAnimatedListPropertyTearOff::synchronizeWrappersIfNeeded() should do nothing if the property is not animating
3984         https://bugs.webkit.org/show_bug.cgi?id=181316
3985         <rdar://problem/36147545>
3986
3987         Reviewed by Simon Fraser.
3988
3989         This is a speculative change to fix a crash which appeared after r226065.
3990         The crash is very intermittent and sometimes very hard to reproduce. The
3991         basic code analysis did not show how this crash can even happen.
3992
3993         * svg/SVGAnimatedTypeAnimator.h:
3994         (WebCore::SVGAnimatedTypeAnimator::resetFromBaseValues): For SVG property
3995         with two values, e.g. <SVGAngleValue, SVGMarkerOrientType>,  we need to
3996         detach the wrappers of the animated property if the animated values are
3997         going to change. This is similar to what we did in resetFromBaseValue().
3998
3999         * svg/properties/SVGAnimatedListPropertyTearOff.h:
4000         (WebCore::SVGAnimatedListPropertyTearOff::synchronizeWrappersIfNeeded):
4001
4002 2018-01-05  Matt Lewis  <jlewis3@apple.com>
4003
4004         Unreviewed, rolling out r226401.
4005
4006         This caused timeouts on multiple platforms.
4007
4008         Reverted changeset:
4009