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