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