Unreviewed, rolling out r226600 and r226603
[WebKit-https.git] / Source / WebCore / ChangeLog
1 2018-01-09  Michael Saboff  <msaboff@apple.com>
2
3         Unreviewed, rolling out r226600 and r226603
4         https://bugs.webkit.org/show_bug.cgi?id=181351
5
6         Add a DOM gadget for Spectre testing
7
8         * dom/Comment.cpp:
9         (WebCore::Comment::Comment):
10         (WebCore::Comment::setReadLength): Deleted.
11         (WebCore::Comment::charCodeAt): Deleted.
12         (WebCore::Comment::clflushReadLength): Deleted.
13         * dom/Comment.h:
14         * dom/Comment.idl:
15         * page/RuntimeEnabledFeatures.cpp:
16         (WebCore::RuntimeEnabledFeatures::spectreGadgetsEnabled const): Deleted.
17         * page/RuntimeEnabledFeatures.h:
18
19 2018-01-09  Don Olmstead  <don.olmstead@sony.com>
20
21         Add additional WEBCORE_EXPORTs
22         https://bugs.webkit.org/show_bug.cgi?id=181414
23
24         Reviewed by Alex Christensen.
25
26         No new tests. No change in behavior.
27
28         * dom/Document.h:
29         * dom/ViewportArguments.h:
30         * page/DOMWindow.h:
31         * page/FrameView.h:
32         * page/PageOverlayController.h:
33         * platform/ContextMenuItem.h:
34         * platform/Pasteboard.h:
35         * platform/SharedBuffer.h:
36         * platform/UserAgent.h:
37         * platform/graphics/GLContext.h:
38         * platform/graphics/GraphicsContext.h:
39         * platform/graphics/GraphicsLayerTransform.h:
40         * platform/graphics/PlatformDisplay.h:
41         * platform/graphics/cairo/BackingStoreBackendCairoImpl.h:
42         * platform/graphics/cairo/PlatformContextCairo.h:
43         * platform/graphics/cairo/RefPtrCairo.h:
44         * platform/graphics/nicosia/NicosiaBuffer.h:
45         * platform/graphics/nicosia/NicosiaPaintingEngine.h:
46         * platform/graphics/texmap/TextureMapper.h:
47         * platform/graphics/texmap/TextureMapperAnimation.h:
48         * platform/graphics/texmap/TextureMapperBackingStore.h:
49         * platform/graphics/texmap/TextureMapperFPSCounter.h:
50         * platform/graphics/texmap/TextureMapperLayer.h:
51         (WebCore::TextureMapperLayer::TextureMapperLayer): Deleted.
52         (WebCore::TextureMapperLayer::setID): Deleted.
53         (WebCore::TextureMapperLayer::id): Deleted.
54         (WebCore::TextureMapperLayer:: const): Deleted.
55         (WebCore::TextureMapperLayer::setScrollClient): Deleted.
56         (WebCore::TextureMapperLayer::setIsScrollable): Deleted.
57         (WebCore::TextureMapperLayer::isScrollable const): Deleted.
58         (WebCore::TextureMapperLayer::textureMapper const): Deleted.
59         (WebCore::TextureMapperLayer::setTextureMapper): Deleted.
60         (WebCore::TextureMapperLayer::drawsContent const): Deleted.
61         (WebCore::TextureMapperLayer::contentsAreVisible const): Deleted.
62         (WebCore::TextureMapperLayer::size const): Deleted.
63         (WebCore::TextureMapperLayer::opacity const): Deleted.
64         (WebCore::TextureMapperLayer::transform const): Deleted.
65         (WebCore::TextureMapperLayer::hasFilters const): Deleted.
66         (WebCore::TextureMapperLayer::isShowingRepaintCounter const): Deleted.
67         (WebCore::TextureMapperLayer::fixedToViewport const): Deleted.
68         (WebCore::TextureMapperLayer::rootLayer const): Deleted.
69         (WebCore::TextureMapperLayer::texture): Deleted.
70         (WebCore::TextureMapperLayer::adjustedPosition const): Deleted.
71         (WebCore::TextureMapperLayer::layerRect const): Deleted.
72         (WebCore::TextureMapperLayer::State::State): Deleted.
73         * platform/graphics/texmap/TextureMapperPlatformLayerProxy.h:
74         * platform/graphics/texmap/TextureMapperTile.h:
75         * platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.h:
76         (WebCore::CoordinatedGraphicsLayer::isScrollable const): Deleted.
77         (WebCore::CoordinatedGraphicsLayer::id const): Deleted.
78         (WebCore::CoordinatedGraphicsLayer::coverRect const): Deleted.
79         (WebCore::CoordinatedGraphicsLayer::fixedToViewport const): Deleted.
80         * platform/graphics/texmap/coordinated/CoordinatedImageBacking.h:
81         (WebCore::CoordinatedImageBacking::id const): Deleted.
82         * platform/graphics/texmap/coordinated/TiledBackingStore.h:
83         * platform/graphics/texmap/coordinated/UpdateAtlas.h:
84         * platform/network/AuthenticationChallengeBase.h:
85         * platform/network/CredentialBase.h:
86         * platform/network/ProtectionSpaceBase.h:
87         * platform/network/curl/SocketStreamHandleImpl.h:
88         * replay/UserInputBridge.h:
89
90 2018-01-09  Basuke Suzuki  <Basuke.Suzuki@sony.com>
91
92         [Curl] Move FormData related tasks into new CurlFormDataStream class.
93         https://bugs.webkit.org/show_bug.cgi?id=181106
94
95         Reviewed by Alex Christensen.
96
97         No new tests because no behavior change.
98
99         * platform/Curl.cmake:
100         * platform/network/curl/CurlFormDataStream.cpp: Added.
101         (WebCore::CurlFormDataStream::CurlFormDataStream):
102         (WebCore::CurlFormDataStream::~CurlFormDataStream):
103         (WebCore::CurlFormDataStream::clean):
104         (WebCore::CurlFormDataStream::shouldUseChunkTransfer):
105         (WebCore::CurlFormDataStream::totalSize):
106         (WebCore::CurlFormDataStream::computeContentLength):
107         (WebCore::CurlFormDataStream::read):
108         (WebCore::CurlFormDataStream::readFromFile):
109         (WebCore::CurlFormDataStream::readFromData):
110         * platform/network/curl/CurlFormDataStream.h: Renamed from Source/WebCore/platform/network/curl/FormDataStreamCurl.h.
111         (WebCore::CurlFormDataStream::elementSize):
112         (WebCore::CurlFormDataStream::totalReadSize):
113         * platform/network/curl/CurlRequest.cpp:
114         (WebCore::CurlRequest::CurlRequest):
115         (WebCore::CurlRequest::willSendData):
116         (WebCore::CurlRequest::finalizeTransfer):
117         (WebCore::CurlRequest::setupPUT):
118         (WebCore::CurlRequest::setupPOST):
119         (WebCore::CurlRequest::setupSendData):
120         (WebCore::CurlRequest::resolveBlobReferences): Deleted.
121         (WebCore::CurlRequest::setupFormData): Deleted.
122         * platform/network/curl/CurlRequest.h:
123         * platform/network/curl/FormDataStreamCurl.cpp: Removed.
124
125 2018-01-09  Zalan Bujtas  <zalan@apple.com>
126
127         [RenderTreeBuilder] Move MathML addChild logic to RenderTreeBuilder
128         https://bugs.webkit.org/show_bug.cgi?id=181443
129         <rdar://problem/36380228>
130
131         Reviewed by Antti Koivisto.
132
133         This is about moving code, no cleanup and/or normalization (unfortunately it also means
134         some temporary changes).  
135
136         No change in functionality.
137
138         * Sources.txt:
139         * WebCore.xcodeproj/project.pbxproj:
140         * rendering/mathml/RenderMathMLFenced.cpp:
141         (WebCore::RenderMathMLFenced::addChild):
142         (WebCore::RenderMathMLFenced::createMathMLOperator): Deleted.
143         (WebCore::RenderMathMLFenced::makeFences): Deleted.
144         * rendering/mathml/RenderMathMLFenced.h:
145         * rendering/updating/RenderTreeBuilder.cpp:
146         (WebCore::RenderTreeBuilder::RenderTreeBuilder):
147         (WebCore::RenderTreeBuilder::insertChildToRenderMathMLFenced):
148         * rendering/updating/RenderTreeBuilder.h:
149         (WebCore::RenderTreeBuilder::mathMLBuilder):
150
151 2018-01-09  Antti Koivisto  <antti@apple.com>
152
153         Blank page except for inner iframes because pending stylesheets cause style.isNotFinal() to be true
154         https://bugs.webkit.org/show_bug.cgi?id=180940
155         <rdar://problem/36116507>
156
157         Reviewed by Darin Adler.
158
159         Test: http/tests/local/loading-stylesheet-import-remove.html
160
161         If a <link> referencing a stylesheet containing an @import that was still loading was removed
162         from the document, the loading state was never cleared. For head stylesheets this blocked
163         rendering permanently.
164
165         Test reduction by Justin Ridgewell.
166
167         * html/HTMLLinkElement.cpp:
168         (WebCore::HTMLLinkElement::removedFromAncestor):
169
170         Test if the stylesheet it loading before clearing the pointer.
171
172 2018-01-09  Dan Bernstein  <mitz@apple.com>
173
174         Removed some empty directories that were left behind
175
176         * Modules/indieui: Removed.
177         * Modules/vibration: Removed.
178         * platform/graphics/ca/mac: Removed.
179         * platform/mediastream/gstreamer: Removed.
180
181 2018-01-09  Antoine Quint  <graouts@apple.com>
182
183         Refactor timing function solving code
184         https://bugs.webkit.org/show_bug.cgi?id=181428
185
186         Reviewed by Dean Jackson.
187
188         We have duplicated code to solve "cubic" and "steps" timing functions in AnimationBase and TextureMapperAnimation,
189         and we will soon need similar code to deal with timing functions in Web Animations. We move this code into TimingFunction
190         with a single transformTime() function that can be called directly on the timing function rather than having callers
191         figure out what type timing functions are to solve them.
192
193         No test as there shouldn't be any behavior change.
194
195         * page/animation/AnimationBase.cpp:
196         (WebCore::AnimationBase::progress const):
197         (WebCore::solveEpsilon): Deleted.
198         (WebCore::solveCubicBezierFunction): Deleted.
199         (WebCore::solveStepsFunction): Deleted.
200         (WebCore::solveSpringFunction): Deleted.
201         * platform/animation/TimingFunction.cpp:
202         (WebCore::TimingFunction::transformTime const):
203         * platform/animation/TimingFunction.h:
204         * platform/graphics/texmap/TextureMapperAnimation.cpp:
205         (WebCore::TextureMapperAnimation::apply):
206         (WebCore::solveEpsilon): Deleted.
207         (WebCore::solveCubicBezierFunction): Deleted.
208         (WebCore::solveStepsFunction): Deleted.
209         (WebCore::applyTimingFunction): Deleted.
210
211 2018-01-09  Michael Catanzaro  <mcatanzaro@igalia.com>
212
213         Unreviewed, silence -Wunused-parameter warning
214
215         * testing/js/WebCoreTestSupport.cpp:
216         (WebCoreTestSupport::setupNewlyCreatedServiceWorker):
217
218 2018-01-09  Said Abou-Hallawa  <sabouhallawa@apple.com>
219
220         Check Image::m_image is not null in ImageLoader::decode()
221         https://bugs.webkit.org/show_bug.cgi?id=180386
222         <rdar://problem/34634483>
223
224         Reviewed by Tim Horton.
225
226         Ensure ImageLoader::m_image is not null before referencing it.
227
228         * loader/ImageLoader.cpp:
229         (WebCore::ImageLoader::decode):
230
231 2018-01-09  Yusuke Suzuki  <utatane.tea@gmail.com>
232
233         [FreeType] Use FastMalloc for FreeType
234         https://bugs.webkit.org/show_bug.cgi?id=181387
235
236         Reviewed by Michael Catanzaro.
237
238         Add custom memory allocator for FreeType to use FastMalloc.
239
240         * platform/graphics/freetype/FontCustomPlatformDataFreeType.cpp:
241         (WebCore::initializeFreeTypeLibrary):
242         (WebCore::createFontCustomPlatformData):
243
244 2018-01-09  Zalan Bujtas  <zalan@apple.com>
245
246         [RenderTreeBuilder] Move RenderTable* addChild mutation logic to RenderTreeBuilder
247         https://bugs.webkit.org/show_bug.cgi?id=181424
248         <rdar://problem/36368628>
249
250         Reviewed by Antti Koivisto.
251
252         This is about moving code, no cleanup and/or normalization (unfortunately it also means
253         some temporary changes).  
254
255         Covered by existing tests.
256
257         * rendering/RenderTable.cpp:
258         (WebCore::RenderTable::addChild):
259         * rendering/RenderTableRow.cpp:
260         (WebCore::RenderTableRow::addChild):
261         * rendering/RenderTableSection.cpp:
262         (WebCore::RenderTableSection::addChild):
263         * rendering/updating/RenderTreeBuilder.cpp:
264         (WebCore::RenderTreeBuilder::insertChildToRenderTable):
265         (WebCore::RenderTreeBuilder::insertChildToRenderTableSection):
266         (WebCore::RenderTreeBuilder::insertChildToRenderTableRow):
267         * rendering/updating/RenderTreeBuilder.h:
268         * rendering/updating/RenderTreeBuilderTable.cpp:
269         (WebCore::RenderTreeBuilder::Table::insertChild):
270         * rendering/updating/RenderTreeBuilderTable.h:
271
272 2018-01-09  Zalan Bujtas  <zalan@apple.com>
273
274         [RenderTreeBuilder] Transition Render*::addChild() calls to RenderTreeBuilder::insertChildToRender*()
275         https://bugs.webkit.org/show_bug.cgi?id=181407
276         <rdar://problem/36361176>
277
278         Reviewed by Antti Koivisto.
279
280         Eventually all mutation will be going through the RenderTreeBuilder.
281
282         No change in functionality.
283
284         * rendering/RenderGrid.cpp:
285         (WebCore::RenderGrid::addChild):
286         * rendering/RenderMultiColumnFlow.cpp:
287         (WebCore::RenderMultiColumnFlow::processPossibleSpannerDescendant):
288         * rendering/RenderRubyRun.cpp:
289         (WebCore::RenderRubyRun::rubyBaseSafe):
290         * rendering/updating/RenderTreeBuilderBlockFlow.cpp:
291         (WebCore::RenderTreeBuilder::BlockFlow::insertChild):
292         * rendering/updating/RenderTreeBuilderMultiColumn.cpp:
293         (WebCore::RenderTreeBuilder::MultiColumn::createFragmentedFlow):
294         * rendering/updating/RenderTreeBuilderRuby.cpp:
295         (WebCore::RenderTreeBuilder::Ruby::findOrCreateParentForChild):
296
297 2018-01-09  Philippe Normand  <pnormand@igalia.com>
298
299         [GStreamer] Ensure SleepDisabler is not held by pages in page cache
300         https://bugs.webkit.org/show_bug.cgi?id=180197
301
302         Reviewed by Eric Carlson.
303
304         The sleep disabler is now checked again whenever the media player
305         playback state or other characteristic has changed in the media
306         engine.
307
308         * html/HTMLMediaElement.cpp:
309         (WebCore::HTMLMediaElement::mediaPlayerPlaybackStateChanged):
310         Check if the sleep disabler state needs to be updated or not.
311         (WebCore::HTMLMediaElement::mediaPlayerCharacteristicChanged): Ditto.
312         (WebCore::HTMLMediaElement::shouldDisableSleep const): Enable
313         sleep disabler for GTK and WPE ports.
314
315 2018-01-09  Philippe Normand  <pnormand@igalia.com>
316
317         [GStreamer] Missing notifications to player client
318         https://bugs.webkit.org/show_bug.cgi?id=181432
319
320         Reviewed by Carlos Garcia Campos.
321
322         We now properly emit playback state changes and characteristic
323         updates to the client when the pipeline state changes and when
324         audio/video tracks changes are detected.
325
326         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:
327         (WebCore::MediaPlayerPrivateGStreamer::playbackPosition const):
328         This debug message appears too often in logs. Demote.
329         (WebCore::MediaPlayerPrivateGStreamer::durationMediaTime const): Ditto.
330         (WebCore::MediaPlayerPrivateGStreamer::notifyPlayerOfVideo): Emit
331         charasteristicChanged notification.
332         (WebCore::MediaPlayerPrivateGStreamer::notifyPlayerOfAudio): Ditto.
333         (WebCore::MediaPlayerPrivateGStreamer::updateStates): Keep track
334         of old and current pipeline state.
335         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.h:
336
337
338 2018-01-09  Youenn Fablet  <youenn@apple.com>
339
340         Add CSP support to service workers
341         https://bugs.webkit.org/show_bug.cgi?id=181385
342
343         Reviewed by Chris Dumez.
344
345         Covered by rebased tests.
346
347         Added recovery of CSP information from WorkerScriptLoader.
348         Added plumbing to pass the CSP information to Service Workers.
349         Did not add persistency support for the CSP information as this requires changing the SQL database schema.
350         This will be done in a follow-up.
351
352         * workers/WorkerScriptLoader.cpp:
353         (WebCore::WorkerScriptLoader::loadAsynchronously):
354         (WebCore::WorkerScriptLoader::didReceiveResponse):
355         * workers/WorkerScriptLoader.h:
356         (WebCore::WorkerScriptLoader::contentSecurityPolicy const):
357         * workers/service/SWClientConnection.cpp:
358         (WebCore::SWClientConnection::finishedFetchingScript):
359         (WebCore::SWClientConnection::failedFetchingScript):
360         * workers/service/SWClientConnection.h:
361         * workers/service/ServiceWorkerContainer.cpp:
362         (WebCore::ServiceWorkerContainer::addRegistration):
363         (WebCore::ServiceWorkerContainer::jobFailedWithException):
364         (WebCore::ServiceWorkerContainer::jobResolvedWithRegistration):
365         (WebCore::ServiceWorkerContainer::jobFinishedLoadingScript):
366         * workers/service/ServiceWorkerContainer.h:
367         * workers/service/ServiceWorkerContextData.cpp:
368         (WebCore::ServiceWorkerContextData::isolatedCopy const):
369         * workers/service/ServiceWorkerContextData.h:
370         (WebCore::ServiceWorkerContextData::encode const):
371         (WebCore::ServiceWorkerContextData::decode):
372         * workers/service/ServiceWorkerFetchResult.h:
373         (WebCore::ServiceWorkerFetchResult::encode const):
374         (WebCore::ServiceWorkerFetchResult::decode):
375         * workers/service/ServiceWorkerGlobalScope.cpp:
376         (WebCore::ServiceWorkerGlobalScope::create):
377         * workers/service/ServiceWorkerGlobalScope.h:
378         * workers/service/ServiceWorkerJob.cpp:
379         (WebCore::ServiceWorkerJob::notifyFinished):
380         * workers/service/ServiceWorkerJobClient.h:
381         * workers/service/context/ServiceWorkerThread.cpp:
382         (WebCore::ServiceWorkerThread::ServiceWorkerThread):
383         (WebCore::ServiceWorkerThread::createWorkerGlobalScope):
384         * workers/service/server/RegistrationDatabase.cpp:
385         (WebCore::v1RecordsTableSchema):
386         (WebCore::RegistrationDatabase::importRecords):
387         * workers/service/server/SWServer.cpp:
388         (WebCore::SWServer::updateWorker):
389         (WebCore::SWServer::installContextData):
390         * workers/service/server/SWServer.h:
391         * workers/service/server/SWServerJobQueue.cpp:
392         (WebCore::SWServerJobQueue::scriptFetchFinished):
393         * workers/service/server/SWServerWorker.cpp:
394         (WebCore::SWServerWorker::SWServerWorker):
395         (WebCore::m_contentSecurityPolicy):
396         (WebCore::SWServerWorker::contextData const):
397         * workers/service/server/SWServerWorker.h:
398
399 2018-01-09  Antoine Quint  <graouts@apple.com>
400
401         Provide a method to obtain a CSS value from a RenderStyle by CSSPropertyID
402         https://bugs.webkit.org/show_bug.cgi?id=181429
403
404         Reviewed by Antti Koivisto.
405
406         The KeyframeEffect.getKeyframes() method from Web Animations requires that we return all styles applied at a given
407         animation effect keyframe. When we parse keyframes, we create RenderStyle objects that are stored in a KeyframeList,
408         as well as a list of CSSPropertyIDs that are animated. In order to provide the list of animated properties and their
409         values when calling getKeyframes(), we need to be able to read back from the RenderStyle we create. As a first step
410         towards this goal, we factor some code in ComputedStyleExtractor::propertyValue() out into a new method
411         ComputedStyleExtractor::valueForPropertyinStyle() which takes in an explicit RenderStyle.
412
413         No test as this is simply refactoring that doesn't change or add behavior.
414
415         * css/CSSComputedStyleDeclaration.cpp:
416         (WebCore::ComputedStyleExtractor::propertyValue):
417         (WebCore::ComputedStyleExtractor::valueForPropertyinStyle):
418         * css/CSSComputedStyleDeclaration.h:
419
420 2018-01-09  Youenn Fablet  <youenn@apple.com>
421
422         SWClientConnection should not keep references to service worker jobs
423         https://bugs.webkit.org/show_bug.cgi?id=181381
424
425         Reviewed by Chris Dumez.
426
427         Difficult to test determiniscally but corresponding crash log should no longer happen in debug builds.
428
429         Stopped passing ServiceWorkerJob references from ServiceWorkerContainer (potentially in service worker thread) to SWClientConnection (main thread).
430         Instead pass job identifiers and related data to the main thread.
431
432         Minor refactoring to use ServiceWorkerJobIdentifier instead of ServiceWorkerJobDataIdentifier which contains more data than needed.
433
434         * workers/service/SWClientConnection.cpp:
435         (WebCore::SWClientConnection::scheduleJob):
436         (WebCore::SWClientConnection::failedFetchingScript):
437         (WebCore::SWClientConnection::postTaskForJob):
438         (WebCore::SWClientConnection::jobRejectedInServer):
439         (WebCore::SWClientConnection::registrationJobResolvedInServer):
440         (WebCore::SWClientConnection::unregistrationJobResolvedInServer):
441         (WebCore::SWClientConnection::startScriptFetchForServer):
442         (WebCore::SWClientConnection::clearPendingJobs):
443         (WebCore::SWClientConnection::finishedFetchingScript): Deleted.
444         * workers/service/SWClientConnection.h:
445         * workers/service/ServiceWorkerContainer.cpp:
446         (WebCore::ServiceWorkerContainer::scheduleJob):
447         (WebCore::ServiceWorkerContainer::startScriptFetchForJob):
448         (WebCore::ServiceWorkerContainer::jobFinishedLoadingScript):
449         (WebCore::ServiceWorkerContainer::jobFailedLoadingScript):
450         * workers/service/ServiceWorkerContainer.h:
451         * workers/service/server/SWServer.cpp:
452         (WebCore::SWServer::rejectJob):
453         (WebCore::SWServer::resolveRegistrationJob):
454         (WebCore::SWServer::resolveUnregistrationJob):
455         (WebCore::SWServer::startScriptFetch):
456         * workers/service/server/SWServer.h:
457
458 2018-01-09  Carlos Garcia Campos  <cgarcia@igalia.com>
459
460         REGRESSION(r224460): Text fields sometimes get "messed up"
461         https://bugs.webkit.org/show_bug.cgi?id=181115
462
463         Reviewed by Zalan Bujtas.
464
465         Add the scroll position to paint offset before computing the clip rectangle. Before r224460, scroll position was
466         substracted after the clip rectangle was computed.
467
468         * rendering/LayoutState.cpp:
469         (WebCore::LayoutState::computeClipRect):
470
471 2018-01-09  Ali Juma  <ajuma@chromium.org>
472
473         Implement VisualViewport API events
474         https://bugs.webkit.org/show_bug.cgi?id=179386
475
476         Reviewed by Frédéric Wang.
477
478         Implement the events (resize and scroll) defined by the Visual Viewport API
479         (https://wicg.github.io/visual-viewport/#events).
480
481         This is behind the VisualViewportAPI experimental feature flag.
482
483         In order to detect when events need to be fired, change the computation of
484         Visual Viewport attributes to happen whenever the layout viewport is updated
485         rather than only on-demand.
486
487         Tests: fast/visual-viewport/resize-event-fired-window-resized.html
488                fast/visual-viewport/resize-event-fired.html
489                fast/visual-viewport/scroll-event-fired.html
490
491         * dom/Document.cpp:
492         (WebCore::Document::addListenerTypeIfNeeded):
493         Add support for tracking resize event listeners.
494         * dom/Document.h:
495         * dom/DocumentEventQueue.cpp:
496         (WebCore::DocumentEventQueue::enqueueOrDispatchScrollEvent):
497         (WebCore::DocumentEventQueue::enqueueScrollEvent):
498         Factored out of enqueueOrDispatchScrollEvent so that this logic can be reused
499         for Visual Viewport scroll events.
500         (WebCore::DocumentEventQueue::enqueueResizeEvent):
501         (WebCore::DocumentEventQueue::pendingEventTimerFired):
502         * dom/DocumentEventQueue.h:
503         * page/FrameView.cpp:
504         (WebCore::FrameView::updateLayoutViewport):
505         * page/VisualViewport.cpp:
506         (WebCore::VisualViewport::addEventListener):
507         (WebCore::layoutIfNonNull):
508         (WebCore::VisualViewport::offsetLeft const):
509         Remove attribute computation logic since this now happens during update().
510         (WebCore::VisualViewport::offsetTop const): Ditto.
511         (WebCore::VisualViewport::pageLeft const): Ditto.
512         (WebCore::VisualViewport::pageTop const): Ditto.
513         (WebCore::VisualViewport::width const): Ditto.
514         (WebCore::VisualViewport::height const): Ditto.
515         (WebCore::VisualViewport::scale const):
516         (WebCore::VisualViewport::update):
517         Added. Computes all of the Visual Viewport attributes and determines
518         whether events need to be fired.
519         (WebCore::VisualViewport::enqueueResizeEvent):
520         (WebCore::VisualViewport::enqueueScrollEvent):
521         (WebCore::getFrameViewAndLayoutIfNonNull): Deleted.
522         * page/VisualViewport.h:
523
524 2018-01-09  Yacine Bandou  <yacine.bandou_ext@softathome.com>
525
526         [EME] Add the CENC initData support in ClearKey CDM
527         https://bugs.webkit.org/show_bug.cgi?id=180081
528
529         Reviewed by Xabier Rodriguez-Calvar.
530
531         Add the "cenc" initDataType support in ClearKey CDM.
532         Parse the CENC initData and extract the KIDs by following the W3C spec
533         https://www.w3.org/TR/eme-initdata-cenc/#common-system
534
535         Tests: media/encrypted-media/clearKey/clearKey-message-cenc-event.html
536                media/encrypted-media/clearKey/clearKey-message-cenc-event-mse.html
537
538         * platform/encryptedmedia/clearkey/CDMClearKey.cpp:
539         (WebCore::extractKeyidsLocationFromCencInitData):
540         (WebCore::isCencInitData):
541         (WebCore::extractKeyidsFromCencInitData):
542         (WebCore::CDMPrivateClearKey::supportsInitDataType const):
543         (WebCore::CDMPrivateClearKey::supportsInitData const):
544         (WebCore::CDMInstanceClearKey::requestLicense):
545
546 2018-01-09  Zan Dobersek  <zdobersek@igalia.com>
547
548         [Cairo] Pass state values directly to Cairo operations
549         https://bugs.webkit.org/show_bug.cgi?id=181389
550
551         Reviewed by Carlos Garcia Campos.
552
553         Instead of passing reference to the GraphicsContextState object to
554         various Cairo operations, only pass the required state values. This
555         makes it explicit what state values are used in these operations, at the
556         expense of some long parameter lists, but this will be better addressed
557         by future refactoring of this code into more concise functions.
558
559         No new tests -- no change in functionality.
560
561         * platform/graphics/cairo/CairoOperations.cpp:
562         (WebCore::Cairo::drawGlyphsShadow):
563         (WebCore::Cairo::dashedLineCornerWidthForStrokeWidth):
564         (WebCore::Cairo::dashedLinePatternWidthForStrokeWidth):
565         (WebCore::Cairo::drawGlyphs):
566         (WebCore::Cairo::drawRect):
567         (WebCore::Cairo::drawLine):
568         (WebCore::Cairo::drawEllipse):
569         * platform/graphics/cairo/CairoOperations.h:
570         * platform/graphics/cairo/FontCairo.cpp:
571         (WebCore::FontCascade::drawGlyphs):
572         * platform/graphics/cairo/GraphicsContextCairo.cpp:
573         (WebCore::GraphicsContext::drawRect):
574         (WebCore::GraphicsContext::drawLine):
575         (WebCore::GraphicsContext::drawEllipse):
576
577 2018-01-09  Ryosuke Niwa  <rniwa@webkit.org>
578
579         Release assert in addResourceTiming when a cache resource is requested during style recalc
580         https://bugs.webkit.org/show_bug.cgi?id=181137
581         <rdar://problem/35666574>
582
583         Reviewed by Simon Fraser.
584
585         Make the dispatching of resourcetimingbufferfull event asynchronous to avoid dispatching it
586         synchronously during a style resolution when CachedResourceLoader::requestImage requests
587         a previously loaded image.
588
589         We now schedule a timer when the resource timing buffer becomes full, and dispatch the event
590         when the timer fires. Meanwhile, we have a backup buffer to which additional resource timing
591         entries would be added. Once the event is dispatched, we refill the buffer exposed to author
592         scripts. When refilling the buffer results in it becoming full again, we keep repeating the
593         process of firing resourcetimingbufferfull and re-filling the buffer until either we stop
594         making progress (i.e. the script didn't increase the number of empty entires in the buffer)
595         or the backup buffer (at the time we started this process) becomes empty.
596
597         Also fixed a bug that we were firing resourcetimingbufferfull event when the last entry that
598         fits within the buffer size was added instead of when an entry is being added to an already
599         full buffer. To make this work, the patch introduces m_resourceTimingBufferFullFlag,
600         representing the concept "resource timing buffer full" flag in the resource timing specification.
601
602         Test: http/tests/performance/performance-resource-timing-resourcetimingbufferfull-crash.html
603
604         * page/Performance.cpp:
605         (WebCore::Performance::Performance):
606         (WebCore::Performance::clearResourceTimings):
607         (WebCore::Performance::setResourceTimingBufferSize):
608         (WebCore::Performance::addResourceTiming):
609         (WebCore::Performance::resourceTimingBufferFullTimerFired):
610         * page/Performance.h:
611
612 2018-01-08  Chris Nardi  <csnardi1@gmail.com>
613
614         ::first-letter incorrectly selects grapheme pairs
615         https://bugs.webkit.org/show_bug.cgi?id=181315
616
617         Reviewed by Darin Adler.
618
619         Grapheme pairs were incorrectly selected by ::first-letter. This
620         change fixes their selection.
621
622         Tests: Updated fast/css/first-letter-punctuation.html and imported
623         LayoutTests/imported/w3c/web-platform-tests/css/css-pseudo-4/first-letter-004.html
624
625         * rendering/updating/RenderTreeBuilderFirstLetter.cpp:
626         (WebCore::isPunctuationForFirstLetter):
627         (WebCore::shouldSkipForFirstLetter):
628         (WebCore::RenderTreeBuilder::FirstLetter::createRenderers):
629
630 2018-01-08  Darin Adler  <darin@apple.com>
631
632         Special list-item counter starts from an incorrect number for ::before and ::after
633         https://bugs.webkit.org/show_bug.cgi?id=181084
634
635         Reviewed by Zalan Bujtas.
636
637         Test: fast/css/counters/counter-list-item.html
638
639         * Sources.txt: Removed CounterDirectives.cpp.
640         * WebCore.xcodeproj/project.pbxproj: Ditto.
641
642         * css/CSSComputedStyleDeclaration.cpp:
643         (WebCore::counterToCSSValue): Updated for changes to the CounterDirectives struct.
644         * css/StyleBuilderCustom.h:
645         (WebCore::StyleBuilderCustom::applyInheritCounter): Ditto.
646         (WebCore::StyleBuilderCustom::applyValueCounter): Ditto.
647
648         * html/HTMLLIElement.cpp:
649         (WebCore::HTMLLIElement::parseValue): Call setExplicitValue(std::nullopt) instead
650         of clearExplicitValue since we are using std::optional now.
651
652         * rendering/RenderCounter.cpp:
653         (WebCore::listItemCounterDirectives): Added. Computes the counter directives that
654         express the effects on the list-item counter from list item and list elements.
655         Used something as close to what the CSS 3 draft says as possible. This uses a
656         negative increment when creating a list to counteract the positive increment done
657         by a list element, except in the case of an unordered list. This is where the bug
658         fix actually lies. Also fixed handling of reversed ordered lists at the same time.
659         (WebCore::planCounter): Refactored to use the function above. Also changed the
660         code to pay attention to both the counter directives and the implicit ones from
661         list item and list elements, getting as close as possible to what the specification
662         seems to call for.
663
664         * rendering/RenderListItem.cpp:
665         (WebCore::RenderListItem::RenderListItem): Since we are using std::optional and no
666         longer using bit fields, simplified the constructor for each list item.
667         (WebCore::RenderListItem::calcValue const): Deleted.
668         (WebCore::RenderListItem::updateValueNow const): Merged in all the code from the
669         old calcValue function, but it is also simpler now since m_value is std::optional.
670         (WebCore::RenderListItem::updateValue): Updated to use std::optional.
671         (WebCore::RenderListItem::setExplicitValue): Ditto.
672         (WebCore::RenderListItem::clearExplicitValue): Deleted.
673         (WebCore::RenderListItem::updateListMarkerNumbers): Updated to use std::optional.
674         (WebCore::RenderListItem::isInReversedOrderedList const): Added. This is used by
675         the counter code so it can decrement instead of incrementing.
676
677         * rendering/RenderListItem.h: Updated to use std::optional. Also marked functions
678         final instead of override and initialized m_notInList after making it not be a
679         bitfield any more.
680
681         * rendering/style/CounterDirectives.cpp: Removed.
682         * rendering/style/CounterDirectives.h: Removed most of the CounterDirectives
683         class and replaced it with a struct with two std::optional. Added an addClamped
684         function so the counter code can share it with the addIncrementValue function.
685         If we want to make a faster version that doesn't use double, we can come back
686         and do that. Also moved the == function to the header since the implementation
687         is so trivial.
688
689         * rendering/style/StyleAllInOne.cpp: Removed CounterDirectives.cpp.
690
691         * rendering/style/StyleRareNonInheritedData.cpp:
692         (WebCore::StyleRareNonInheritedData::StyleRareNonInheritedData): Updated to
693         use std::make_unique directly instead of using a clone function.
694
695 2018-01-08  Wenson Hsieh  <wenson_hsieh@apple.com>
696
697         [Attachment Support] Expose HTMLAttachmentElement.uniqueIdentifier to bindings
698         https://bugs.webkit.org/show_bug.cgi?id=181420
699         <rdar://problem/36365827>
700
701         Reviewed by Alex Christensen.
702
703         Add a new IDL definition for uniqueIdentifier on HTMLAttachmentElement. This allows clients to relate attachment
704         elements in the DOM to _WKAttachments delivered via Objective-C SPI.
705
706         Adjusted existing tests in WKAttachmentTests.
707
708         * html/HTMLAttachmentElement.idl:
709
710 2018-01-08  Don Olmstead  <don.olmstead@sony.com>
711
712         AccessibilityARIAGrid does not compile when accessibility is disabled
713         https://bugs.webkit.org/show_bug.cgi?id=181418
714         <rdar://problem/36365398>
715
716         Reviewed by Chris Fleizach.
717
718         No new tests. No change in behavior.
719
720         * accessibility/AccessibilityARIAGrid.cpp:
721
722 2018-01-08  Commit Queue  <commit-queue@webkit.org>
723
724         Unreviewed, rolling out r226532 and r226540.
725         https://bugs.webkit.org/show_bug.cgi?id=181422
726
727         jessie says basic browsing does not seem to work (Requested by
728         alexchristensen on #webkit).
729
730         Reverted changesets:
731
732         "Add CSP support to service workers"
733         https://bugs.webkit.org/show_bug.cgi?id=181385
734         https://trac.webkit.org/changeset/226532
735
736         "SWClientConnection should not keep references to service
737         worker jobs"
738         https://bugs.webkit.org/show_bug.cgi?id=181381
739         https://trac.webkit.org/changeset/226540
740
741 2018-01-08  Wenson Hsieh  <wenson_hsieh@apple.com>
742
743         [Attachment Support] Expose file name and content type of WKAttachment
744         https://bugs.webkit.org/show_bug.cgi?id=181390
745         <rdar://problem/36336837>
746
747         Reviewed by Tim Horton.
748
749         Add new structs in AttachmentTypes.h and refactor HTMLAttachmentElement::requestData to requestInfo. See below
750         for more details. Augmented existing API tests in WKAttachmentTests.
751
752         * html/AttachmentTypes.h:
753
754         Add a struct to represent a snapshot of information about an attachment element.
755
756         * html/HTMLAttachmentElement.cpp:
757         (WebCore::HTMLAttachmentElement::requestInfo):
758         (WebCore::HTMLAttachmentElement::requestData): Deleted.
759         * html/HTMLAttachmentElement.h:
760
761         Change requestData to requestInfo. Instead of fetching and delivering data via callback, requestInfo returns an
762         AttachmentInfo.
763
764         * rendering/RenderThemeIOS.mm:
765         (WebCore::RenderAttachmentInfo::addLine):
766         (WebCore::RenderAttachmentInfo::buildWrappedLines):
767         (WebCore::RenderAttachmentInfo::buildSingleLine):
768         (WebCore::RenderAttachmentInfo::RenderAttachmentInfo):
769         (WebCore::RenderThemeIOS::attachmentBaseline const):
770         (WebCore::paintAttachmentIcon):
771         (WebCore::paintAttachmentText):
772         (WebCore::paintAttachmentProgress):
773         (WebCore::attachmentBorderPath):
774         (WebCore::RenderThemeIOS::paintAttachment):
775         (WebCore::AttachmentInfo::addLine): Deleted.
776         (WebCore::AttachmentInfo::buildWrappedLines): Deleted.
777         (WebCore::AttachmentInfo::buildSingleLine): Deleted.
778         (WebCore::AttachmentInfo::AttachmentInfo): Deleted.
779
780         Rename AttachmentInfo to RenderAttachmentInfo to resolve a name conflict with the new AttachmentInfo struct.
781
782 2018-01-08  Saam Barati  <sbarati@apple.com>
783
784         Speculative build fix after r226600. We only use clflush on x86 and the `asm volatile` syntax is not available in the Windows build.
785
786         No new tests because this is a build fix.
787
788         * dom/Comment.cpp:
789         (WebCore::Comment::clflushReadLength):
790
791 2018-01-08  Michael Saboff  <msaboff@apple.com>
792
793         Add a DOM gadget for Spectre testing
794         https://bugs.webkit.org/show_bug.cgi?id=181351
795
796         Reviewed by Saam Barati.
797
798         This change is used to test Spectre mitigations.
799
800         Added a side data array to the Comment DOM node to test for Spectre issues in
801         the DOM layer.  This additional functionality is disabled by default and must
802         be enabled through the JSC option "enableSpectreGadgets".
803
804         * dom/Comment.cpp:
805         (WebCore::Comment::Comment):
806         (WebCore::Comment::setReadLength):
807         (WebCore::Comment::charCodeAt):
808         (WebCore::Comment::clflushReadLength):
809         * dom/Comment.h:
810         * dom/Comment.idl:
811         * page/RuntimeEnabledFeatures.cpp:
812         (WebCore::RuntimeEnabledFeatures::spectreGadgetsEnabled const):
813         * page/RuntimeEnabledFeatures.h:
814
815 2018-01-08  Said Abou-Hallawa  <sabouhallawa@apple.com>
816
817         A canvas should not be tainted if it draws a data URL SVGImage with a <foreignObject>
818         https://bugs.webkit.org/show_bug.cgi?id=180301
819
820         Reviewed by Dean Jackson.
821
822         Don't taint the canvas if it draws a data URL SVGImage with a <foreignObject>.
823         There should not be a cross-origin data leak in this case.
824
825         Tests: svg/as-image/svg-canvas-data-url-svg-with-feimage-not-tainted.html
826                svg/as-image/svg-canvas-data-url-svg-with-foreign-object-not-tainted.html
827                svg/as-image/svg-canvas-data-url-svg-with-image-not-tainted.html
828
829         * html/ImageBitmap.cpp:
830         (WebCore::taintsOrigin):
831         * html/canvas/CanvasRenderingContext.cpp:
832         (WebCore::CanvasRenderingContext::wouldTaintOrigin):
833
834 2018-01-08  Don Olmstead  <don.olmstead@sony.com>
835
836         Simplify platform checks in Graphics Context
837         https://bugs.webkit.org/show_bug.cgi?id=181344
838
839         Reviewed by Alex Christensen.
840
841         No new tests. No change in behavior.
842
843         * platform/graphics/ANGLEWebKitBridge.h:
844         * platform/graphics/GLContext.h:
845         * platform/graphics/GraphicsContext3D.h:
846         * platform/graphics/OpenGLESShims.h:
847         * platform/graphics/opengl/GraphicsContext3DOpenGLCommon.cpp:
848         (WebCore::GraphicsContext3D::checkVaryingsPacking const):
849
850 2018-01-08  Zalan Bujtas  <zalan@apple.com>
851
852         [RenderTreeBuilder] Move SVG addChild logic to RenderTreeBuilder
853         https://bugs.webkit.org/show_bug.cgi?id=181405
854         <rdar://problem/36360476>
855
856         Reviewed by Antti Koivisto.
857
858         This is about moving the code, no cleanup and/or normalization (unfortunately it also means
859         some temporary changes).  
860
861         No change in functionality.
862
863         * Sources.txt:
864         * WebCore.xcodeproj/project.pbxproj:
865         * rendering/svg/RenderSVGContainer.cpp:
866         (WebCore::RenderSVGContainer::addChild):
867         * rendering/svg/RenderSVGInline.cpp:
868         (WebCore::RenderSVGInline::addChild):
869         * rendering/svg/RenderSVGRoot.cpp:
870         (WebCore::RenderSVGRoot::addChild):
871         * rendering/svg/RenderSVGText.cpp:
872         (WebCore::RenderSVGText::addChild):
873         * rendering/updating/RenderTreeBuilder.cpp:
874         (WebCore::RenderTreeBuilder::RenderTreeBuilder):
875         (WebCore::RenderTreeBuilder::insertChildToSVGContainer):
876         (WebCore::RenderTreeBuilder::insertChildToSVGInline):
877         (WebCore::RenderTreeBuilder::insertChildToSVGRoot):
878         (WebCore::RenderTreeBuilder::insertChildToSVGText):
879         * rendering/updating/RenderTreeBuilder.h:
880         (WebCore::RenderTreeBuilder::SVGBuilder):
881         * rendering/updating/RenderTreeBuilderSVG.cpp: Added.
882         (WebCore::RenderTreeBuilder::SVG::SVG):
883         (WebCore::RenderTreeBuilder::SVG::insertChild):
884         * rendering/updating/RenderTreeBuilderSVG.h: Added.
885
886 2018-01-08  John Wilander  <wilander@apple.com>
887
888         Storage Access API: Remove access for all frames under a page when the page is closed
889         https://bugs.webkit.org/show_bug.cgi?id=181398
890         <rdar://problem/36357879>
891
892         Reviewed by Alex Christensen.
893
894         No new tests. Discussed with Alex Christensen and we concluded that
895         both a layout test and an API test would require a lot of work and
896         we have existing tests for clearing out storage access for frames.
897
898         * platform/network/NetworkStorageSession.h:
899         * platform/network/cf/NetworkStorageSessionCFNet.cpp:
900         (WebCore::NetworkStorageSession::removeStorageAccessForAllFramesOnPage):
901
902 2018-01-08  Matt Lewis  <jlewis3@apple.com>
903
904         Unreviewed, rolling out r226385.
905
906         The test introduced with this was a flaky since being added.
907
908         Reverted changeset:
909
910         "AX: when invert colors is on, double-invert certain media
911         elements in UserAgentStyleSheet"
912         https://bugs.webkit.org/show_bug.cgi?id=168447
913         https://trac.webkit.org/changeset/226385
914
915 2018-01-08  Youenn Fablet  <youenn@apple.com>
916
917         SWClientConnection should not keep references to service worker jobs
918         https://bugs.webkit.org/show_bug.cgi?id=181381
919
920         Reviewed by Chris Dumez.
921
922         Difficult to test determiniscally but corresponding crash log should no longer happen in debug builds.
923
924         Stopped passing ServiceWorkerJob references from ServiceWorkerContainer (potentially in service worker thread) to SWClientConnection (main thread).
925         Instead pass job identifiers and related data to the main thread.
926
927         Minor refactoring to use ServiceWorkerJobIdentifier instead of ServiceWorkerJobDataIdentifier which contains more data than needed.
928
929         * workers/service/SWClientConnection.cpp:
930         (WebCore::SWClientConnection::scheduleJob):
931         (WebCore::SWClientConnection::failedFetchingScript):
932         (WebCore::SWClientConnection::postTaskForJob):
933         (WebCore::SWClientConnection::jobRejectedInServer):
934         (WebCore::SWClientConnection::registrationJobResolvedInServer):
935         (WebCore::SWClientConnection::unregistrationJobResolvedInServer):
936         (WebCore::SWClientConnection::startScriptFetchForServer):
937         (WebCore::SWClientConnection::clearPendingJobs):
938         (WebCore::SWClientConnection::finishedFetchingScript): Deleted.
939         * workers/service/SWClientConnection.h:
940         * workers/service/ServiceWorkerContainer.cpp:
941         (WebCore::ServiceWorkerContainer::scheduleJob):
942         (WebCore::ServiceWorkerContainer::startScriptFetchForJob):
943         (WebCore::ServiceWorkerContainer::jobFinishedLoadingScript):
944         (WebCore::ServiceWorkerContainer::jobFailedLoadingScript):
945         * workers/service/ServiceWorkerContainer.h:
946         * workers/service/server/SWServer.cpp:
947         (WebCore::SWServer::rejectJob):
948         (WebCore::SWServer::resolveRegistrationJob):
949         (WebCore::SWServer::resolveUnregistrationJob):
950         (WebCore::SWServer::startScriptFetch):
951         * workers/service/server/SWServer.h:
952
953 2018-01-08  Wenson Hsieh  <wenson_hsieh@apple.com>
954
955         Copying, pasting, and then deleting an attachment element breaks attachment data requests
956         https://bugs.webkit.org/show_bug.cgi?id=181365
957         <rdar://problem/36340647>
958
959         Reviewed by Tim Horton.
960
961         Currently, copying and pasting an attachment element within the same document and then deleting backwards to
962         remove the pasted attachment element causes the original attachment element to be inaccessible via SPI. This is
963         because there are now two different attachment elements with the same unique identifier, such that Document,
964         which keeps a map of all unique attachment identifiers to attachment elements, will lose track of the original
965         attachment element.
966
967         To fix this, we ensure that attachment elements should always have unique identifiers when they are inserted
968         into the document. We make several small adjustments to accomplish this:
969
970         1.  First, refactor HTMLAttachmentElement's unique identifier so that it no longer depends on the value of the
971             "webkitattachmentid" attribute, and is instead just a member of HTMLAttachmentElement that is not exposed to
972             DOM bindings. This means setting and querying an attachment element's uniqueIdentifier can be done without
973             triggering any side effects, such as layout or mutation events.
974
975         2.  Next, make "webkitattachmentid" a temporary attribute similar to "webkitattachmentpath" and
976             "webkitattachmentbloburl", so that it is added only when generating a markup fragment for editing, and
977             removed upon deserialization.
978
979         3.  Lastly, shift the responsibility of assigning a unique identifier to an attachment away from places where we
980             create attachment elements, and instead have Document enforce this when an attachment element is inserted.
981
982         Tests:  WKAttachmentTests.InsertAndRemoveDuplicateAttachment
983                 WKAttachmentTests.InsertDuplicateAttachmentAndUpdateData
984
985         * dom/Document.cpp:
986         (WebCore::Document::didInsertAttachmentElement):
987
988         Assign the unique identifier of an attachment element that has been inserted. If the identifier already tracks
989         an existing attachment element in the document or is missing, reassign the identifier to a new value.
990
991         * editing/cocoa/WebContentReaderCocoa.mm:
992         (WebCore::createFragmentForImageAttachment):
993         (WebCore::replaceRichContentWithAttachments):
994         (WebCore::WebContentReader::readFilePaths):
995
996         Remove calls to setUniqueIdentifier here, since Document will assign a unique identifier upon insertion.
997
998         * editing/markup.cpp:
999         (WebCore::StyledMarkupAccumulator::appendCustomAttributes):
1000         (WebCore::createFragmentFromMarkup):
1001
1002         Set the attachment's unique identifier to the value of the "webkitattachmentid" attribute. When moving existing
1003         attachments around in the DOM without duplication, this ensures that the attachment will be removed and
1004         reinserted in the document without triggering removal and insertion client delegate methods.
1005
1006         When pasting an attachment element that has the same identifier as an existing attachment, we let Document
1007         realize that the attachment identifier already exists, and reassign it to a unique value.
1008
1009         * html/HTMLAttachmentElement.cpp:
1010         (WebCore::HTMLAttachmentElement::uniqueIdentifier const): Deleted.
1011         (WebCore::HTMLAttachmentElement::setUniqueIdentifier): Deleted.
1012         * html/HTMLAttachmentElement.h:
1013
1014 2018-01-08  Zalan Bujtas  <zalan@apple.com>
1015
1016         [RenderTreeBuilder] Move RenderBlockFlow addChild logic to RenderTreeBuilder
1017         https://bugs.webkit.org/show_bug.cgi?id=181348
1018         <rdar://problem/36328117>
1019
1020         Reviewed by Antti Koivisto.
1021
1022         This is about moving the code, no cleanup and/or normalization (unfortunately it also means
1023         some temporary changes).  
1024
1025         No change in functionality.
1026
1027         * Sources.txt:
1028         * WebCore.xcodeproj/project.pbxproj:
1029         * rendering/RenderBlockFlow.cpp:
1030         (WebCore::RenderBlockFlow::addChild):
1031         * rendering/updating/RenderTreeBuilder.cpp:
1032         (WebCore::RenderTreeBuilder::RenderTreeBuilder):
1033         (WebCore::RenderTreeBuilder::insertChildToRenderBlockFlow):
1034         * rendering/updating/RenderTreeBuilder.h:
1035         (WebCore::RenderTreeBuilder::blockFlowBuilder):
1036         * rendering/updating/RenderTreeBuilderBlockFlow.cpp: Added.
1037         (WebCore::RenderTreeBuilder::BlockFlow::BlockFlow):
1038         (WebCore::RenderTreeBuilder::BlockFlow::insertChild):
1039         * rendering/updating/RenderTreeBuilderBlockFlow.h: Added.
1040
1041 2018-01-08  Youenn Fablet  <youenn@apple.com>
1042
1043         Add CSP support to service workers
1044         https://bugs.webkit.org/show_bug.cgi?id=181385
1045
1046         Reviewed by Chris Dumez.
1047
1048         Covered by rebased tests.
1049
1050         Added recovery of CSP information from WorkerScriptLoader.
1051         Added plumbing to pass the CSP information to Service Workers.
1052         Added persistency support for the CSP information.
1053
1054         * workers/WorkerScriptLoader.cpp:
1055         (WebCore::WorkerScriptLoader::loadAsynchronously):
1056         (WebCore::WorkerScriptLoader::didReceiveResponse):
1057         * workers/WorkerScriptLoader.h:
1058         (WebCore::WorkerScriptLoader::contentSecurityPolicy const):
1059         * workers/service/SWClientConnection.cpp:
1060         (WebCore::SWClientConnection::finishedFetchingScript):
1061         (WebCore::SWClientConnection::failedFetchingScript):
1062         * workers/service/SWClientConnection.h:
1063         * workers/service/ServiceWorkerContainer.cpp:
1064         (WebCore::ServiceWorkerContainer::addRegistration):
1065         (WebCore::ServiceWorkerContainer::jobFailedWithException):
1066         (WebCore::ServiceWorkerContainer::jobResolvedWithRegistration):
1067         (WebCore::ServiceWorkerContainer::jobFinishedLoadingScript):
1068         * workers/service/ServiceWorkerContainer.h:
1069         * workers/service/ServiceWorkerContextData.cpp:
1070         (WebCore::ServiceWorkerContextData::isolatedCopy const):
1071         * workers/service/ServiceWorkerContextData.h:
1072         (WebCore::ServiceWorkerContextData::encode const):
1073         (WebCore::ServiceWorkerContextData::decode):
1074         * workers/service/ServiceWorkerFetchResult.h:
1075         (WebCore::ServiceWorkerFetchResult::encode const):
1076         (WebCore::ServiceWorkerFetchResult::decode):
1077         * workers/service/ServiceWorkerGlobalScope.cpp:
1078         (WebCore::ServiceWorkerGlobalScope::create):
1079         * workers/service/ServiceWorkerGlobalScope.h:
1080         * workers/service/ServiceWorkerJob.cpp:
1081         (WebCore::ServiceWorkerJob::notifyFinished):
1082         * workers/service/ServiceWorkerJobClient.h:
1083         * workers/service/context/ServiceWorkerThread.cpp:
1084         (WebCore::ServiceWorkerThread::ServiceWorkerThread):
1085         (WebCore::ServiceWorkerThread::createWorkerGlobalScope):
1086         * workers/service/server/RegistrationDatabase.cpp:
1087         (WebCore::v1RecordsTableSchema):
1088         (WebCore::RegistrationDatabase::openSQLiteDatabase):
1089         (WebCore::RegistrationDatabase::doPushChanges):
1090         (WebCore::RegistrationDatabase::importRecords):
1091         * workers/service/server/SWServer.cpp:
1092         (WebCore::SWServer::updateWorker):
1093         (WebCore::SWServer::installContextData):
1094         * workers/service/server/SWServer.h:
1095         * workers/service/server/SWServerJobQueue.cpp:
1096         (WebCore::SWServerJobQueue::scriptFetchFinished):
1097         * workers/service/server/SWServerWorker.cpp:
1098         (WebCore::SWServerWorker::SWServerWorker):
1099         (WebCore::m_contentSecurityPolicy):
1100         (WebCore::SWServerWorker::contextData const):
1101         * workers/service/server/SWServerWorker.h:
1102
1103 2018-01-08  Youenn Fablet  <youenn@apple.com>
1104
1105         Use no-cache fetch mode when loading main documents with location.reload()
1106         https://bugs.webkit.org/show_bug.cgi?id=181285
1107
1108         Reviewed by Alex Christensen.
1109
1110         Covered by rebased tests.
1111
1112         Start to translate cache policy used for navigation as FetchOptions::Cache.
1113         This allows ensuring service workers receive the right cache mode when intercepting navigation loads.
1114         To not change current navigation behavior, ReturnCacheDataElseLoad and ReturnCacheDataDontLoad still trigger default fetch cache mode.
1115
1116         For Reload and ReloadExpiredOnly frame load types, using no-cache mode is more efficient than reload mode,
1117         as a conditional request will be sent if possible. This applies to location.reload which is consistent with other browsers.
1118         Keep reload mode for ReloadFromOrigin.
1119
1120         * loader/DocumentLoader.cpp:
1121         (WebCore::toFetchOptionsCache):
1122         (WebCore::DocumentLoader::loadMainResource):
1123         * loader/FrameLoader.cpp:
1124         (WebCore::FrameLoader::loadFrameRequest):
1125         (WebCore::FrameLoader::loadURL):
1126         (WebCore::FrameLoader::load):
1127         (WebCore::FrameLoader::reload):
1128         (WebCore::FrameLoader::defaultRequestCachingPolicy):
1129         (WebCore::FrameLoader::loadDifferentDocumentItem):
1130         * loader/NavigationScheduler.cpp:
1131
1132 2018-01-08  Youenn Fablet  <youenn@apple.com>
1133
1134         Stop exposing fetch and extendable events to window
1135         https://bugs.webkit.org/show_bug.cgi?id=181325
1136
1137         Reviewed by Chris Dumez.
1138
1139         Covered by updated tests.
1140
1141         Marked FetchEvent and ExtendableEvent as visible in ServiceWorker environments only.
1142         Moved related Internals testing routines to ServiceWorkerInternals.
1143
1144         * testing/Internals.cpp:
1145         (WebCore::Internals::waitForFetchEventToFinish): Deleted.
1146         (WebCore::Internals::createBeingDispatchedFetchEvent): Deleted.
1147         * testing/Internals.h:
1148         * testing/Internals.idl:
1149         * testing/ServiceWorkerInternals.cpp:
1150         (WebCore::ServiceWorkerInternals::waitForFetchEventToFinish):
1151         (WebCore::ServiceWorkerInternals::createBeingDispatchedFetchEvent):
1152         * testing/ServiceWorkerInternals.h:
1153         * testing/ServiceWorkerInternals.idl:
1154         * workers/service/ExtendableEvent.idl:
1155         * workers/service/FetchEvent.idl:
1156
1157 2018-01-08  Antti Koivisto  <antti@apple.com>
1158
1159         REGRESSION (r219145): Toggling layer borders on a static document no longer works immediately
1160         https://bugs.webkit.org/show_bug.cgi?id=176260
1161         <rdar://problem/34219966>
1162
1163         Reviewed by Simon Fraser.
1164
1165         Optimization reveled bugs in debug indicator painting.
1166
1167         Test: compositing/debug-borders-dynamic.html
1168
1169         * platform/graphics/ca/GraphicsLayerCA.cpp:
1170         (WebCore::GraphicsLayerCA::commitLayerChangesBeforeSublayers):
1171         (WebCore::GraphicsLayerCA::updateDebugIndicators):
1172         (WebCore::GraphicsLayerCA::updateDebugBorder): Deleted.
1173
1174         - Rename to indicate this is not just about debug borders.
1175         - Trigger display so repaint counters get painted. This helper is only called when the indicators change.
1176
1177         * platform/graphics/ca/GraphicsLayerCA.h:
1178         * rendering/RenderLayerCompositor.cpp:
1179         (WebCore::RenderLayerCompositor::cacheAcceleratedCompositingFlags):
1180
1181         Ensure we do compositing update on debug border change even when there is no layout.
1182
1183 2018-01-08  Zalan Bujtas <zalan@apple.com>
1184
1185         [RenderTreeBuilder] Move RenderInline addChild logic to RenderTreeBuilder
1186         https://bugs.webkit.org/show_bug.cgi?id=181336
1187         <rdar://problem/36324693>
1188
1189         Reviewed by Antti Koivisto.
1190
1191         This is about moving the code, no cleanup and/or normalization (unfortunately it also means
1192         some temporary changes).  
1193
1194         No change in functionality.
1195
1196         * Sources.txt:
1197         * WebCore.xcodeproj/project.pbxproj:
1198         * rendering/RenderInline.cpp:
1199         (WebCore::RenderInline::addChild):
1200         (WebCore::RenderInline::addChildIgnoringContinuation):
1201         (WebCore::RenderInline::childBecameNonInline):
1202         (WebCore::nextContinuation): Deleted.
1203         (WebCore::RenderInline::continuationBefore): Deleted.
1204         (WebCore::newChildIsInline): Deleted.
1205         (WebCore::RenderInline::cloneAsContinuation const): Deleted.
1206         (WebCore::RenderInline::splitInlines): Deleted.
1207         (WebCore::RenderInline::splitFlow): Deleted.
1208         (WebCore::canUseAsParentForContinuation): Deleted.
1209         (WebCore::RenderInline::addChildToContinuation): Deleted.
1210         * rendering/RenderInline.h:
1211         * rendering/updating/RenderTreeBuilder.cpp:
1212         (WebCore::RenderTreeBuilder::RenderTreeBuilder):
1213         (WebCore::RenderTreeBuilder::insertChildToRenderInline):
1214         (WebCore::RenderTreeBuilder::insertChildToRenderInlineIgnoringContinuation):
1215         (WebCore::RenderTreeBuilder::splitFlow):
1216         * rendering/updating/RenderTreeBuilder.h:
1217         (WebCore::RenderTreeBuilder::inlineBuilder):
1218         * rendering/updating/RenderTreeBuilderInline.cpp: Added.
1219         (WebCore::canUseAsParentForContinuation):
1220         (WebCore::nextContinuation):
1221         (WebCore::continuationBefore):
1222         (WebCore::cloneAsContinuation):
1223         (WebCore::newChildIsInline):
1224         (WebCore::inFlowPositionedInlineAncestor):
1225         (WebCore::RenderTreeBuilder::Inline::Inline):
1226         (WebCore::RenderTreeBuilder::Inline::insertChild):
1227         (WebCore::RenderTreeBuilder::Inline::insertChildToContinuation):
1228         (WebCore::RenderTreeBuilder::Inline::insertChildIgnoringContinuation):
1229         (WebCore::RenderTreeBuilder::Inline::splitFlow):
1230         (WebCore::RenderTreeBuilder::Inline::splitInlines):
1231         * rendering/updating/RenderTreeBuilderInline.h: Added.
1232
1233 2018-01-08  Zalan Bujtas  <zalan@apple.com>
1234
1235         [RenderTreeBuilder] Move RenderBlock addChild logic to RenderTreeBuilder
1236         https://bugs.webkit.org/show_bug.cgi?id=181319
1237         <rdar://problem/36313464>
1238
1239         Reviewed by Antti Koivisto.
1240
1241         This is about moving the code, no cleanup and/or normalization (unfortunately it also means
1242         some temporary changes).  
1243
1244         No change in functionality.
1245
1246         * Sources.txt:
1247         * WebCore.xcodeproj/project.pbxproj:
1248         * rendering/RenderBlock.cpp:
1249         (WebCore::RenderBlock::addChild):
1250         (WebCore::RenderBlock::addChildIgnoringContinuation):
1251         (WebCore::RenderBlock::childBecameNonInline):
1252         (WebCore::RenderBlock::continuationBefore): Deleted.
1253         (WebCore::RenderBlock::addChildToContinuation): Deleted.
1254         (WebCore::getInlineRun): Deleted.
1255         (WebCore::RenderBlock::makeChildrenNonInline): Deleted.
1256         * rendering/RenderBlock.h:
1257         * rendering/RenderBox.cpp:
1258         (WebCore::markBoxForRelayoutAfterSplit): Deleted.
1259         (WebCore::RenderBox::splitAnonymousBoxesAroundChild): Deleted.
1260         * rendering/RenderBox.h:
1261         * rendering/RenderRubyBase.cpp:
1262         (WebCore::RenderRubyBase::moveChildren):
1263         (WebCore::RenderRubyBase::moveBlockChildren):
1264         * rendering/RenderTable.cpp:
1265         (WebCore::RenderTable::addChild):
1266         * rendering/RenderTableRow.cpp:
1267         (WebCore::RenderTableRow::addChild):
1268         * rendering/RenderTableSection.cpp:
1269         (WebCore::RenderTableSection::addChild):
1270         * rendering/updating/RenderTreeBuilder.cpp:
1271         (WebCore::markBoxForRelayoutAfterSplit):
1272         (WebCore::getInlineRun):
1273         (WebCore::RenderTreeBuilder::RenderTreeBuilder):
1274         (WebCore::RenderTreeBuilder::insertChildToRenderBlock):
1275         (WebCore::RenderTreeBuilder::insertChildToRenderBlockIgnoringContinuation):
1276         (WebCore::RenderTreeBuilder::makeChildrenNonInline):
1277         (WebCore::RenderTreeBuilder::splitAnonymousBoxesAroundChild):
1278         * rendering/updating/RenderTreeBuilder.h:
1279         (WebCore::RenderTreeBuilder::blockBuilder):
1280         * rendering/updating/RenderTreeBuilderBlock.cpp: Added.
1281         (WebCore::continuationBefore):
1282         (WebCore::RenderTreeBuilder::Block::Block):
1283         (WebCore::RenderTreeBuilder::Block::insertChild):
1284         (WebCore::RenderTreeBuilder::Block::insertChildToContinuation):
1285         (WebCore::RenderTreeBuilder::Block::insertChildIgnoringContinuation):
1286         * rendering/updating/RenderTreeBuilderBlock.h: Added.
1287         
1288 2018-01-08  Jeremy Jones  <jeremyj@apple.com>
1289
1290         Standard controls sometimes say video is in pip when it isnt.
1291         https://bugs.webkit.org/show_bug.cgi?id=181095
1292         rdar://problem/36182687
1293
1294         Reviewed by Eric Carlson.
1295
1296         * html/HTMLMediaElement.cpp:
1297         (WebCore::HTMLMediaElement::exitFullscreen):
1298
1299 2018-01-08  Jer Noble  <jer.noble@apple.com>
1300
1301         REGRESSION: [iOS] ASSERTION FAILED: !node.isConnected() in WebCore::notifyNodeInsertedIntoDocument
1302         https://bugs.webkit.org/show_bug.cgi?id=181091
1303
1304         Reviewed by Darin Adler.
1305
1306         Move the work previously performed in insertedIntoAncestor() into didFinishInsertingNode().
1307
1308         * html/HTMLMediaElement.cpp:
1309         (WebCore::HTMLMediaElement::prepareForLoad):
1310
1311 2018-01-08  Zan Dobersek  <zdobersek@igalia.com>
1312
1313         [Cairo] Use isolated fill and stroke source containers
1314         https://bugs.webkit.org/show_bug.cgi?id=181386
1315
1316         Reviewed by Carlos Garcia Campos.
1317
1318         Generate fill and stroke source objects upon invocation of various Cairo
1319         operations, initializing necessary data from the GraphicsContextState
1320         object.
1321
1322         Cairo::FillSource and Cairo::StrokeSource structs are introduced, both
1323         being default-constructible as well as providing a constructor that
1324         accepts a GraphicsContextState object from which the appropriate
1325         resources are created.
1326
1327         The FillSource and StrokeSource objects are then passed to
1328         PlatformContextCairo's prepareForFilling() and prepareForStroking()
1329         methods. Here the helper prepareCairoContextSource() function is now
1330         invoked with cairo_pattern_t objects as pattern or gradient sources, or
1331         the source color if neither cairo_pattern_t object is specified.
1332
1333         The FillSource and StrokeSource constructors mimic the previous behavior
1334         of prepareCairoContextSource(). In case the source is a Pattern object,
1335         a cairo_pattern_t object is created from that. In case of FillSource,
1336         we also retrieve pattern size, transform and repetition information. In
1337         case the source os a Gradient object, we create a 'base' cairo_pattern_t
1338         object for a completely opaque alpha channel. Additionally, if the alpha
1339         value on the state is not 1, we create an alpha-adjusted cairo_pattern_t
1340         that is potentially used for any filling or stroking operation that has
1341         to preserve transparency. If neither Pattern or Gradient objects are set
1342         on the GraphicsContextState, we default to the current fill or stroke
1343         color.
1344
1345         Overall, there's no change in behavior, this is simply a refactoring
1346         that enables us to construct Cairo objects for filling and stroking
1347         sources at the time of Cairo operation dispatch, instead of pulling down
1348         GraphicsContextState deeper into the Cairo-specific code.
1349
1350         No new tests -- no change in functionality.
1351
1352         * platform/graphics/cairo/CairoOperations.cpp:
1353         (WebCore::Cairo::drawPathShadow):
1354         (WebCore::Cairo::fillCurrentCairoPath):
1355         (WebCore::Cairo::FillSource::FillSource):
1356         (WebCore::Cairo::StrokeSource::StrokeSource):
1357         (WebCore::Cairo::fillRect):
1358         (WebCore::Cairo::fillRectWithRoundedHole):
1359         (WebCore::Cairo::fillPath):
1360         (WebCore::Cairo::strokeRect):
1361         (WebCore::Cairo::strokePath):
1362         (WebCore::Cairo::drawGlyphs):
1363         * platform/graphics/cairo/CairoOperations.h:
1364         * platform/graphics/cairo/FontCairo.cpp:
1365         (WebCore::FontCascade::drawGlyphs):
1366         * platform/graphics/cairo/GraphicsContextCairo.cpp:
1367         (WebCore::GraphicsContext::fillPath):
1368         (WebCore::GraphicsContext::strokePath):
1369         (WebCore::GraphicsContext::fillRect):
1370         (WebCore::GraphicsContext::strokeRect):
1371         (WebCore::GraphicsContext::fillRectWithRoundedHole):
1372         * platform/graphics/cairo/PlatformContextCairo.cpp:
1373         (WebCore::prepareCairoContextSource):
1374         (WebCore::PlatformContextCairo::prepareForFilling):
1375         (WebCore::PlatformContextCairo::prepareForStroking):
1376         (WebCore::PlatformContextCairo::clipForPatternFilling):
1377         * platform/graphics/cairo/PlatformContextCairo.h:
1378
1379 2018-01-08  Youenn Fablet  <youenn@apple.com>
1380
1381         navigator.onLine does not work inside service workers
1382         https://bugs.webkit.org/show_bug.cgi?id=181079
1383         <rdar://problem/36178606>
1384
1385         Reviewed by Darin Adler.
1386
1387         Test: http/wpt/service-workers/online.https.html
1388
1389         Added support for onLine by reusing a similar implementation as regular workers.
1390         Added ServiceWorkerInternals as an interface for an object exposed as self.internals in WTR.
1391         This object has currently one method to trigger change in the online/offline status.
1392         This allows writing a test for the onLine feature.
1393
1394         Note that self.internals is inserted asynchronously after the script was evaluated.
1395         When writing a worker script using self.internals, one must make sure to use self.internals when initialized.
1396         online-worker.js for instance makes use of self.internals in a postMessage callback.
1397
1398         * CMakeLists.txt:
1399         * DerivedSources.make:
1400         * WebCore.xcodeproj/project.pbxproj:
1401         * bindings/js/WorkerScriptController.h:
1402         * dom/ScriptExecutionContext.h:
1403         * testing/ServiceWorkerInternals.cpp: Added.
1404         (WebCore::ServiceWorkerInternals::ServiceWorkerInternals):
1405         (WebCore::ServiceWorkerInternals::setOnline):
1406         * testing/ServiceWorkerInternals.h: Added.
1407         * testing/ServiceWorkerInternals.idl: Added.
1408         * testing/js/WebCoreTestSupport.cpp:
1409         (WebCoreTestSupport::setupNewlyCreateServiceWorker):
1410         * testing/js/WebCoreTestSupport.h:
1411         * workers/service/context/SWContextManager.cpp:
1412         (WebCore::SWContextManager::registerServiceWorkerThreadForInstall):
1413         (WebCore::SWContextManager::startedServiceWorker):
1414         * workers/service/context/SWContextManager.h:
1415         (WebCore::SWContextManager::setServiceWorkerCreationCallback):
1416         (WebCore::SWContextManager::workerByID):
1417         * workers/service/context/ServiceWorkerThread.cpp:
1418         (WebCore::ServiceWorkerThread::ServiceWorkerThread):
1419         * workers/service/context/ServiceWorkerThreadProxy.cpp:
1420         (WebCore::ServiceWorkerThreadProxy::ServiceWorkerThreadProxy):
1421         (WebCore::ServiceWorkerThreadProxy::~ServiceWorkerThreadProxy):
1422         (WebCore::ServiceWorkerThreadProxy::networkStateChanged):
1423         (WebCore::ServiceWorkerThreadProxy::notifyNetworkStateChange):
1424         * workers/service/context/ServiceWorkerThreadProxy.h:
1425
1426 2018-01-08  Zan Dobersek  <zdobersek@igalia.com>
1427
1428         [Cairo] Contain shadow blur requirement state in a separate object
1429         https://bugs.webkit.org/show_bug.cgi?id=181380
1430
1431         Reviewed by Carlos Garcia Campos.
1432
1433         Instead of picking up the necessary state parameters from a
1434         GraphicsContextState object, store the necessary parameters in a helper
1435         ShadowBlurUsage struct. Mimicking the mustUseShadowBlur() function that
1436         is being removed, values of the shadow color, shadow blur, and shadow
1437         transform ignorance are stored there. Additionally, the required()
1438         method accepts a PlatformContextCairo object through which it can
1439         retrieve the current CTM and determine whether it's an identity, finally
1440         deciding whether shadow blur can or cannot be ignored.
1441
1442         Goal of this change is to limit usage of GraphicsContextState directly
1443         in operations implemented inside the Cairo namespace. Instead, the
1444         state parameters should be passed directly, or an equivalent but limited
1445         state object should be constructed for invocation of such operations.
1446
1447         This is likely only an intermediate solution. It's possible it will be
1448         replaced by a more complete shadow state struct that would be used for
1449         any operation that is required to draw shadows, if necessary.
1450
1451         No new tests -- no change in functionality.
1452
1453         * platform/graphics/cairo/CairoOperations.cpp:
1454         (WebCore::Cairo::drawGlyphsShadow):
1455         (WebCore::Cairo::ShadowBlurUsage::ShadowBlurUsage):
1456         (WebCore::Cairo::ShadowBlurUsage::required const):
1457         (WebCore::Cairo::fillRectWithRoundedHole):
1458         (WebCore::Cairo::drawGlyphs):
1459         (WebCore::Cairo::mustUseShadowBlur): Deleted.
1460         * platform/graphics/cairo/CairoOperations.h:
1461         * platform/graphics/cairo/FontCairo.cpp:
1462         (WebCore::FontCascade::drawGlyphs):
1463         * platform/graphics/cairo/GraphicsContextCairo.cpp:
1464         (WebCore::GraphicsContext::fillRectWithRoundedHole):
1465
1466 2018-01-08  Philippe Normand  <pnormand@igalia.com>
1467
1468         [GStreamer][Soup] Remove dead getCreateOrReadBuffer code path
1469         https://bugs.webkit.org/show_bug.cgi?id=181376
1470
1471         Reviewed by Carlos Garcia Campos.
1472
1473         This code path is no longer used now that the GStreamer HTTP
1474         source element uses data coming directly from the network process.
1475
1476         * SourcesGTK.txt:
1477         * SourcesWPE.txt:
1478         * loader/MediaResourceLoader.cpp:
1479         (WebCore::MediaResource::getOrCreateReadBuffer): Deleted.
1480         * loader/MediaResourceLoader.h:
1481         * loader/SubresourceLoader.h:
1482         * loader/cache/CachedRawResource.h:
1483         * loader/cache/CachedRawResourceClient.h:
1484         (WebCore::CachedRawResourceClient::finishedTimingForWorkerLoad):
1485         (WebCore::CachedRawResourceClient::getOrCreateReadBuffer): Deleted.
1486         * loader/cache/CachedResource.h:
1487         (WebCore::CachedResource::getOrCreateReadBuffer): Deleted.
1488         * loader/soup/CachedRawResourceSoup.cpp: Removed.
1489         * loader/soup/SubresourceLoaderSoup.cpp: Removed.
1490         * platform/graphics/PlatformMediaResourceLoader.h:
1491         (WebCore::PlatformMediaResourceClient::loadFinished):
1492         (WebCore::PlatformMediaResourceClient::getOrCreateReadBuffer): Deleted.
1493         * platform/graphics/gstreamer/WebKitWebSourceGStreamer.cpp:
1494         (CachedResourceStreamingClient::getOrCreateReadBuffer): Deleted.
1495         * platform/network/ResourceHandleClient.h:
1496         (WebCore::ResourceHandleClient::getOrCreateReadBuffer): Deleted.
1497         * platform/network/soup/ResourceHandleSoup.cpp:
1498         (WebCore::ResourceHandle::ensureReadBuffer):
1499
1500 2018-01-08  Zan Dobersek  <zdobersek@igalia.com> and Carlos Garcia Campos  <cgarcia@igalia.com>
1501
1502         [GStreamer] use FastMalloc-based GstAllocator
1503         https://bugs.webkit.org/show_bug.cgi?id=165793
1504
1505         Reviewed by Philippe Normand.
1506
1507         Add GstAllocatorFastMalloc, a GstAllocator implementation using fast malloc. It's only used when fast malloc is
1508         enabled and can be disabled using an environment variable for debugging purposes.
1509
1510         * platform/GStreamer.cmake:
1511         * platform/graphics/gstreamer/GStreamerUtilities.cpp:
1512         (WebCore::initializeGStreamer):
1513         * platform/graphics/gstreamer/GstAllocatorFastMalloc.cpp: Added.
1514         (gstMemoryFastMallocNew):
1515         (gstAllocatorFastMallocAlloc):
1516         (gstAllocatorFastMallocFree):
1517         (gstAllocatorFastMallocMemMap):
1518         (gstAllocatorFastMallocMemUnmap):
1519         (gstAllocatorFastMallocMemCopy):
1520         (gstAllocatorFastMallocMemShare):
1521         (gstAllocatorFastMallocMemIsSpan):
1522         (gst_allocator_fast_malloc_class_init):
1523         (gst_allocator_fast_malloc_init):
1524         * platform/graphics/gstreamer/GstAllocatorFastMalloc.h: Added.
1525
1526 2018-01-07  Ms2ger  <Ms2ger@igalia.com>
1527
1528         Implement createImageBitmap(ImageBitmap)
1529         https://bugs.webkit.org/show_bug.cgi?id=181287
1530
1531         Reviewed by Darin Adler.
1532
1533         Tests: imported/w3c/web-platform-tests/2dcontext/imagebitmap/createImageBitmap-drawImage.html
1534                imported/w3c/web-platform-tests/2dcontext/imagebitmap/createImageBitmap-invalid-args.html
1535
1536         * html/ImageBitmap.cpp:
1537         (WebCore::ImageBitmap::createPromise):
1538
1539 2018-01-07  Ryosuke Niwa  <rniwa@webkit.org>
1540
1541         Reduce the precision of "high" resolution time to 1ms
1542         https://bugs.webkit.org/show_bug.cgi?id=180910
1543         <rdar://problem/36085943>
1544
1545         Reviewed by Saam Barati.
1546
1547         Reduced the high prevision time's resolution to 1ms, the same precision as Date.now().
1548
1549         Also fixed the bug in fillRTCStats that we weren't reducing the time resolution in RTCStats dictionaries.
1550
1551         * Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.cpp:
1552         (WebCore::fillRTCStats):
1553         * page/Performance.cpp:
1554         (WebCore::Performance::reduceTimeResolution):
1555
1556 2018-01-06  Simon Fraser  <simon.fraser@apple.com>
1557
1558         Possible crash computing event regions
1559         https://bugs.webkit.org/show_bug.cgi?id=181368
1560         rdar://problem/34847081
1561
1562         Reviewed by Zalan Bujtas.
1563
1564         Don't trigger layout in Element::absoluteEventHandlerBounds(), since this can run arbirary script
1565         which might delete elements or re-enter Document::absoluteRegionForEventTargets().
1566
1567         It's OK to not trigger layout, because if layout is dirty, the next layout will update event regions again.
1568
1569         Add a LayoutDisallowedScope to check that Document::absoluteRegionForEventTargets() doesn't
1570         trigger layout, and move the check for LayoutDisallowedScope::isLayoutAllowed() from Document::updateLayout()
1571         to LayoutContext::layout(), since some layouts don't happen via the former (e.g. the one being removed here).
1572
1573         The test checks that the assertion does not fire. I was not able to get a reliable test for any crash.
1574
1575         Test: fast/events/event-handler-regions-layout.html
1576
1577         * dom/Document.cpp:
1578         (WebCore::Document::updateLayout):
1579         (WebCore::Document::absoluteRegionForEventTargets):
1580         * dom/Element.cpp:
1581         (WebCore::Element::absoluteEventHandlerBounds):
1582         * page/LayoutContext.cpp:
1583         (WebCore::LayoutContext::layout):
1584         * rendering/LayoutDisallowedScope.h: Move the #ifdefs around to avoid defining the enum twice.
1585         (WebCore::LayoutDisallowedScope::LayoutDisallowedScope):
1586         (WebCore::LayoutDisallowedScope::isLayoutAllowed):
1587
1588 2018-01-06  Simon Fraser  <simon.fraser@apple.com>
1589
1590         Crash under RenderLayer::scrollTo() with marquee
1591         https://bugs.webkit.org/show_bug.cgi?id=181349
1592         rdar://problem/36190168
1593
1594         Reviewed by Zalan Bujtas.
1595
1596         Don't call updateWidgetPositions() synchonously during RenderLayer scrolling, because it
1597         can run arbitrary script which may trigger destruction of this RenderLayer.
1598
1599         Instead, queue up updateWidgetPositions() on a zero-delay timer.
1600
1601         Under some circumstances this may allow a paint to occur before the widgets have been
1602         updated (which could be fixed with a more invasive change), but in practice I saw no
1603         painting issues with plug-ins or iframes inside overflow scroll, in WebKit or LegacyWebKit.
1604
1605         Test: fast/scrolling/marquee-scroll-crash.html
1606
1607         * page/FrameView.cpp:
1608         (WebCore::FrameView::FrameView):
1609         (WebCore::FrameView::updateWidgetPositions):
1610         (WebCore::FrameView::scheduleUpdateWidgetPositions):
1611         (WebCore::FrameView::updateWidgetPositionsTimerFired):
1612         * page/FrameView.h:
1613         * rendering/RenderLayer.cpp:
1614         (WebCore::RenderLayer::scrollTo):
1615
1616 2018-01-05  Dean Jackson  <dino@apple.com>
1617
1618         Accurately clip copyTexImage2D and copyTexSubImage2D
1619         https://bugs.webkit.org/show_bug.cgi?id=181356
1620         <rdar://problem/35083877>
1621
1622         Reviewed by Eric Carlson.
1623
1624         The code to make sure copyTexSubImage2D and copyTexImage2D will not try to read
1625         out of bounds had a bad bug introduced here:
1626         https://bugs.webkit.org/show_bug.cgi?id=51421
1627
1628         With appropriate parameters, it would produce a rectangle with
1629         negative dimensions. Most GL drivers just ignored this, but some
1630         are not happy.
1631
1632         Test: fast/canvas/webgl/copy-tex-image-and-sub-image-2d-bad-input.html
1633
1634         * html/canvas/WebGLRenderingContextBase.cpp:
1635         (WebCore::clip2D): Reimplement this in a more sane manner, and use
1636         checked arithmetic while here.
1637         * html/canvas/WebGLRenderingContextBase.h:
1638         (WebCore::clip1D): Deleted.
1639         (WebCore::clip2D): Deleted.
1640
1641 2018-01-06  Antti Koivisto  <antti@apple.com>
1642
1643         Use WeakPtr for RenderTreePosition::m_nextSibling
1644         https://bugs.webkit.org/show_bug.cgi?id=181363
1645
1646         Reviewed by Zalan Bujtas.
1647
1648         For safety. In most cases it is null and won't cause us to instantiate WeakReferences for
1649         many new objects.
1650
1651         * rendering/updating/RenderTreePosition.cpp:
1652         (WebCore::RenderTreePosition::computeNextSibling):
1653         * rendering/updating/RenderTreePosition.h:
1654         (WebCore::RenderTreePosition::RenderTreePosition):
1655         (WebCore::RenderTreePosition::nextSibling const):
1656
1657 2018-01-05  David Kilzer  <ddkilzer@apple.com>
1658
1659         Re-enable -Wcast-qual in WebCore for Apple ports
1660         <https://webkit.org/b/177895>
1661         <rdar://problem/34960830>
1662
1663         Reviewed by Joseph Pecoraro.
1664
1665         * Configurations/Base.xcconfig:
1666         (WARNING_CFLAGS): Remove FIXME and add -Wcast-qual back to
1667         arguments.
1668
1669         * crypto/mac/SerializedCryptoKeyWrapMac.mm:
1670         (WebCore::createAndStoreMasterKey):
1671         - Use checked_cf_cast<SecACLRef>().
1672
1673         * editing/cocoa/DataDetection.mm:
1674         (WebCore::detectItemAtPositionWithRange):
1675         - Manually cast CFTypeRef to DDResultRef until
1676           DDResultGetTypeID() is available as SPI.
1677
1678         * platform/gamepad/mac/HIDGamepad.cpp:
1679         (WebCore::HIDGamepad::initElementsFromArray):
1680         - Use checked_cf_cast<IOHIDElementRef>().
1681
1682         * platform/graphics/avfoundation/objc/MediaSampleAVFObjC.mm:
1683         (WebCore::MediaSampleAVFObjC::createImageSample):
1684         (WebCore::CMSampleBufferIsRandomAccess):
1685         (WebCore::CMSampleBufferIsNonDisplaying):
1686         (WebCore::MediaSampleAVFObjC::createNonDisplayingCopy const):
1687         - Use checked_cf_cast<CFMutableDictionaryRef>() and
1688           checked_cf_cast<CFDictionaryRef>().
1689
1690         * platform/graphics/cocoa/IOSurface.h:
1691         (WebCore::IOSurface::asLayerContents):
1692         - Use reinterpret_cast<id>() to cast from IOSurfaceRef to id.
1693
1694         * platform/graphics/cocoa/WebCoreDecompressionSession.mm:
1695         (WebCore::WebCoreDecompressionSession::getFirstVideoFrame):
1696         (WebCore::WebCoreDecompressionSession::automaticDequeue):
1697         (WebCore::WebCoreDecompressionSession::imageForTime):
1698         (WebCore::WebCoreDecompressionSession::getDecodeTime):
1699         (WebCore::WebCoreDecompressionSession::getPresentationTime):
1700         (WebCore::WebCoreDecompressionSession::getDuration):
1701         - Use checked_cf_cast<CMSampleBufferRef>().
1702
1703         * platform/graphics/Font.h:
1704         (WebCore::Font::m_kernedCFStringAttributes):
1705         (WebCore::Font::m_nonKernedCFStringAttributes):
1706         - Change type from RetainPtr<CFDictionaryRef> to
1707           RetainPtr<CFMutableDictionaryRef> since that's what they are.
1708         * platform/graphics/mac/SimpleFontDataCoreText.cpp:
1709         (WebCore::Font::getCFStringAttributes const):
1710         - Replace local `mutableAttributes` variable with
1711           `attributesDictionary.get()` since it returns the correct type
1712           now.
1713
1714         * platform/ios/wak/WAKView.mm:
1715         (-[WAKView _initWithViewRef:]):
1716         (_WAKCopyWrapper):
1717         * platform/ios/wak/WKView.mm:
1718         (_WKViewClearSuperview):
1719         (WKViewFirstChild):
1720         (WKViewNextSibling):
1721         - Use static_cast<WKViewRef>(const_cast<void*>()) to convert
1722           const void* variable to WKViewRef.
1723
1724         * platform/mac/PasteboardMac.mm:
1725         (WebCore::flipImageSpec):
1726         (WebCore::setDragImageImpl):
1727         - Use const_cast<> to remove 'const' modifier from
1728           unsigned char pointers.  This regressed while -Wcast-qual was
1729           disabled for WebCore.
1730
1731         * platform/mac/SSLKeyGeneratorMac.mm:
1732         (WebCore::signedPublicKeyAndChallengeString):
1733         - Use checked_cf_cast<SecACLRef>().
1734
1735         * platform/mediastream/mac/RealtimeIncomingVideoSourceCocoa.cpp:
1736         (WebCore::RealtimeIncomingVideoSourceCocoa::OnFrame):
1737         - Use checked_cf_cast<CFMutableDictionaryRef>().
1738
1739         * platform/network/cf/SocketStreamHandleImplCFNet.cpp:
1740         (WebCore::copyCONNECTProxyResponse):
1741         - Use checked_cf_cast<CFHTTPMessageRef>().
1742
1743         * platform/network/cocoa/ResourceResponseCocoa.mm:
1744         (WebCore::ResourceResponse::platformCertificateInfo const):
1745         - Use checked_cf_cast<SecTrustRef>().
1746
1747         * platform/network/mac/CertificateInfoMac.mm:
1748         (WebCore::CertificateInfo::containsNonRootSHA1SignedCertificate const):
1749         (WebCore::CertificateInfo::dump const):
1750         - Use checked_cf_cast<SecCertificateRef>().
1751
1752         * testing/cocoa/WebArchiveDumpSupport.mm:
1753         (WebCoreTestSupport::createCFURLResponseFromResponseData):
1754         - Use checked_cf_cast<>() for CFMutable* types.
1755
1756 2018-01-05  John Wilander  <wilander@apple.com>
1757
1758         Storage Access API: Refactor to make naming accurate and explicit, simplify access table, and prepare for access removal for page
1759         https://bugs.webkit.org/show_bug.cgi?id=181357
1760         <rdar://problem/36331031>
1761
1762         Reviewed by Alex Christensen.
1763
1764         No new tests. The only changed functionality that isn't covered
1765         by existing tests is cross-origin iframes in the same partition
1766         should be handled as already having access. This cannot be
1767         tested in layout tests since they don't support subdomains.
1768
1769         This change does the following:
1770         - Changes function and message names to reflect how this feature
1771           was eventually implemented, i.e. access per frame.
1772         - Makes it explicit that the UI process is only involved in
1773           granting storage access and not removing storage access.
1774           The latter is done directly by the web process.
1775         - Simplifies the network process' entry map since only needs to
1776           be able to give access to one domain in one frame at a time.
1777           Access goes away on frame navigation so there can only be one
1778           domain at a time per frame. Also, the map now uses pageIDs as
1779           main keys to prepare for efficient access removal for all
1780           frames under a page.
1781         - Fixes a bug in so that a cross-origin iframe with the same
1782           partition as the top frame correctly is handled as already
1783           having access.
1784
1785         * platform/network/NetworkStorageSession.h:
1786         * platform/network/cf/NetworkStorageSessionCFNet.cpp:
1787         (WebCore::NetworkStorageSession::cookieStoragePartition const):
1788             The only change here is the changed named of the call to
1789             NetworkStorageSession::hasStorageAccessForFrame().
1790         (WebCore::NetworkStorageSession::hasStorageAccessForFrame const):
1791         (WebCore::NetworkStorageSession::grantStorageAccessForFrame):
1792         (WebCore::NetworkStorageSession::removeStorageAccessForFrame):
1793         (WebCore::NetworkStorageSession::isStorageAccessGranted const): Deleted.
1794         (WebCore::NetworkStorageSession::setStorageAccessGranted): Deleted.
1795         (WebCore::NetworkStorageSession::removeStorageAccess): Deleted.
1796
1797 2018-01-05  Youenn Fablet  <youenn@apple.com>
1798
1799         Implement Cache API partitioning based on ClientOrigin
1800         https://bugs.webkit.org/show_bug.cgi?id=181240
1801
1802         Reviewed by Alex Christensen.
1803
1804         Covered by updated tests.
1805
1806         Previously, cache storage was partitioned according the origin of the client, represented as a String.
1807         We now partition according both client and top origins, represented as a ClientOrigin
1808
1809         Minor refactoring to use more makePendingActivity.
1810         Added support for IPC serialization of ClientOrigin.
1811         Added SecurityOriginData::toString which is used by WebKit2 Cache Storage implementation.
1812
1813         * Modules/cache/CacheStorageConnection.cpp:
1814         (WebCore::CacheStorageConnection::open):
1815         (WebCore::CacheStorageConnection::retrieveCaches):
1816         * Modules/cache/CacheStorageConnection.h:
1817         (WebCore::CacheStorageConnection::clearMemoryRepresentation):
1818         (WebCore::CacheStorageConnection::doOpen):
1819         (WebCore::CacheStorageConnection::doRetrieveCaches):
1820         * Modules/cache/DOMCacheStorage.cpp:
1821         (WebCore::DOMCacheStorage::origin const):
1822         (WebCore::DOMCacheStorage::retrieveCaches):
1823         (WebCore::DOMCacheStorage::open):
1824         (WebCore::DOMCacheStorage::remove):
1825         * Modules/cache/DOMCacheStorage.h:
1826         * Modules/cache/WorkerCacheStorageConnection.cpp:
1827         (WebCore::WorkerCacheStorageConnection::doOpen):
1828         (WebCore::WorkerCacheStorageConnection::doRetrieveCaches):
1829         * Modules/cache/WorkerCacheStorageConnection.h:
1830         * page/ClientOrigin.h:
1831         (WebCore::ClientOrigin::isolatedCopy const):
1832         (WebCore::ClientOrigin::encode const):
1833         (WebCore::ClientOrigin::decode):
1834         * page/SecurityOriginData.cpp:
1835         (WebCore::SecurityOriginData::toString const):
1836         (WebCore::SecurityOriginData::debugString const): Deleted.
1837         * page/SecurityOriginData.h:
1838         (WebCore::SecurityOriginData::debugString const):
1839         * testing/Internals.cpp:
1840         (WebCore::Internals::clearCacheStorageMemoryRepresentation):
1841
1842 2018-01-05  Wenson Hsieh  <wenson_hsieh@apple.com>
1843
1844         [Attachment Support] Add a way to write blob data to a file URL from the UI process
1845         https://bugs.webkit.org/show_bug.cgi?id=181236
1846
1847         Reviewed by Brady Eidson.
1848
1849         Add support for writing a blob to a designated file path. See comments below for more detail. No new tests, as
1850         there change in behavior yet. See part 2: https://bugs.webkit.org/show_bug.cgi?id=181199.
1851
1852         * page/DragController.cpp:
1853         (WebCore::DragController::dragAttachmentElement):
1854         * platform/PromisedBlobInfo.h:
1855
1856         Remove PromisedBlobData entirely. This was added with the premise of having the web process deliver blob data to
1857         the UI process. However, the new approach I'm taking just has the UI process tell the network process to write
1858         a blob to a given location, so a data structure to deliver blob data over IPC is no longer necessary.
1859
1860         (WebCore::PromisedBlobData::hasData const): Deleted.
1861         (WebCore::PromisedBlobData::hasFile const): Deleted.
1862         (WebCore::PromisedBlobData::operator bool const): Deleted.
1863         (WebCore::PromisedBlobData::fulfills const): Deleted.
1864         * platform/network/BlobRegistryImpl.cpp:
1865         (WebCore::BlobRegistryImpl::populateBlobsForFileWriting):
1866
1867         Introduce a new helper to build a list of blob data for file writing.
1868
1869         (WebCore::writeFilePathsOrDataBuffersToFile):
1870
1871         Introduce a new static helper to write blob data (a list of file paths and data buffers) to a given file handle.
1872         Automatically closes the given file handle upon exit.
1873
1874         (WebCore::BlobRegistryImpl::writeBlobsToTemporaryFiles):
1875         (WebCore::BlobRegistryImpl::writeBlobToFilePath):
1876
1877         Pull out common logic in writeBlobsToTemporaryFiles and writeBlobToFilePath into helper methods (see above), and
1878         refactor both methods to use the helpers.
1879
1880         * platform/network/BlobRegistryImpl.h:
1881
1882 2018-01-05  Alex Christensen  <achristensen@webkit.org>
1883
1884         Forbid < and > in URL hosts
1885         https://bugs.webkit.org/show_bug.cgi?id=181308
1886         <rdar://problem/36012757>
1887
1888         Reviewed by Tim Horton.
1889
1890         https://url.spec.whatwg.org/#forbidden-host-code-point does not include these characters yet, but I think it should.
1891         Firefox fails to parse URLs with < or > in the host.  Chrome percent encodes them.  Safari needs to do something.
1892         The web platform tests are unclear on this case, and they will need to be updated with the specification.
1893         They do show a change in behavior, though.
1894
1895         * platform/URLParser.cpp:
1896         Add < and > to the list of forbidden host code points.
1897
1898 2018-01-05  Eric Carlson  <eric.carlson@apple.com>
1899
1900         [MediaStream] Add Mac screen capture source
1901         https://bugs.webkit.org/show_bug.cgi?id=181333
1902         <rdar://problem/36323219>
1903
1904         Reviewed by Dean Jackson.
1905
1906         * SourcesCocoa.txt: Add ScreenDisplayCaptureSourceMac.mm.
1907
1908         * WebCore.xcodeproj/project.pbxproj: Ditto.
1909
1910         * platform/cocoa/CoreVideoSoftLink.cpp: Declare new constants used.
1911         * platform/cocoa/CoreVideoSoftLink.h:
1912
1913         * platform/mediastream/mac/DisplayCaptureManagerCocoa.cpp:
1914         (WebCore::displayReconfigurationCallBack): Call refreshCaptureDevices.
1915         (WebCore::DisplayCaptureManagerCocoa::~DisplayCaptureManagerCocoa): Unregister for display
1916         reconfiguration callbacks.
1917         (WebCore::DisplayCaptureManagerCocoa::captureDevices): Register for display reconfigrations.
1918         (WebCore::DisplayCaptureManagerCocoa::refreshCaptureDevices): Use CGActiveDisplayList to
1919         get list of active screens.
1920         (WebCore::DisplayCaptureManagerCocoa::screenCaptureDeviceWithPersistentID): Validate screen
1921         ID, return CaptureDevice.
1922         * platform/mediastream/mac/DisplayCaptureManagerCocoa.h:
1923
1924         * platform/mediastream/mac/RealtimeMediaSourceCenterMac.cpp:
1925         (WebCore::VideoCaptureSourceFactoryMac::createVideoCaptureSource): Deal with screen capture
1926         on macOS.
1927
1928         Implement Mac screen capture with CGDisplayStream.
1929         * platform/mediastream/mac/ScreenDisplayCaptureSourceMac.h: Added.
1930         (WebCore::ScreenDisplayCaptureSourceMac::DisplaySurface::~DisplaySurface):
1931         (WebCore::ScreenDisplayCaptureSourceMac::DisplaySurface::operator=):
1932         (WebCore::ScreenDisplayCaptureSourceMac::DisplaySurface::ioSurface const):
1933         * platform/mediastream/mac/ScreenDisplayCaptureSourceMac.mm: Added.
1934         (WebCore::roundUpToMacroblockMultiple):
1935         (WebCore::ScreenDisplayCaptureSourceMac::updateDisplayID):
1936         (WebCore::ScreenDisplayCaptureSourceMac::create):
1937         (WebCore::ScreenDisplayCaptureSourceMac::ScreenDisplayCaptureSourceMac):
1938         (WebCore::ScreenDisplayCaptureSourceMac::~ScreenDisplayCaptureSourceMac):
1939         (WebCore::ScreenDisplayCaptureSourceMac::createDisplayStream):
1940         (WebCore::ScreenDisplayCaptureSourceMac::startProducingData):
1941         (WebCore::ScreenDisplayCaptureSourceMac::stopProducingData):
1942         (WebCore::ScreenDisplayCaptureSourceMac::sampleBufferFromPixelBuffer):
1943         (WebCore::ScreenDisplayCaptureSourceMac::pixelBufferFromIOSurface):
1944         (WebCore::ScreenDisplayCaptureSourceMac::generateFrame):
1945         (WebCore::ScreenDisplayCaptureSourceMac::startDisplayStream):
1946         (WebCore::ScreenDisplayCaptureSourceMac::applySize):
1947         (WebCore::ScreenDisplayCaptureSourceMac::applyFrameRate):
1948         (WebCore::ScreenDisplayCaptureSourceMac::commitConfiguration):
1949         (WebCore::ScreenDisplayCaptureSourceMac::displayWasReconfigured):
1950         (WebCore::ScreenDisplayCaptureSourceMac::displayReconfigurationCallBack):
1951         (WebCore::ScreenDisplayCaptureSourceMac::frameAvailable):
1952
1953 2018-01-05  Don Olmstead  <don.olmstead@sony.com>
1954
1955         [curl] Can't load file:// URL with a URL fragment identifier
1956         https://bugs.webkit.org/show_bug.cgi?id=181170
1957
1958         Reviewed by Alex Christensen.
1959
1960         No new tests. No change in behavior.
1961
1962         * platform/network/curl/CurlRequest.cpp:
1963         (WebCore::CurlRequest::invokeDidReceiveResponseForFile):
1964
1965 2018-01-05  Don Olmstead  <don.olmstead@sony.com>
1966
1967         TextCodec uses std::array but does not include it
1968         https://bugs.webkit.org/show_bug.cgi?id=181340
1969
1970         Reviewed by Alex Christensen.
1971
1972         No new tests. No change in behavior.
1973
1974         * platform/text/TextCodec.h:
1975
1976 2018-01-05  Said Abou-Hallawa  <sabouhallawa@apple.com>
1977
1978         SVGAnimatedListPropertyTearOff::synchronizeWrappersIfNeeded() should do nothing if the property is not animating
1979         https://bugs.webkit.org/show_bug.cgi?id=181316
1980         <rdar://problem/36147545>
1981
1982         Reviewed by Simon Fraser.
1983
1984         This is a speculative change to fix a crash which appeared after r226065.
1985         The crash is very intermittent and sometimes very hard to reproduce. The
1986         basic code analysis did not show how this crash can even happen.
1987
1988         * svg/SVGAnimatedTypeAnimator.h:
1989         (WebCore::SVGAnimatedTypeAnimator::resetFromBaseValues): For SVG property
1990         with two values, e.g. <SVGAngleValue, SVGMarkerOrientType>,  we need to
1991         detach the wrappers of the animated property if the animated values are
1992         going to change. This is similar to what we did in resetFromBaseValue().
1993
1994         * svg/properties/SVGAnimatedListPropertyTearOff.h:
1995         (WebCore::SVGAnimatedListPropertyTearOff::synchronizeWrappersIfNeeded):
1996
1997 2018-01-05  Matt Lewis  <jlewis3@apple.com>
1998
1999         Unreviewed, rolling out r226401.
2000
2001         This caused timeouts on multiple platforms.
2002
2003         Reverted changeset:
2004
2005         "Implement Cache API partitioning based on ClientOrigin"
2006         https://bugs.webkit.org/show_bug.cgi?id=181240
2007         https://trac.webkit.org/changeset/226401
2008
2009 2018-01-05  Dan Bernstein  <mitz@apple.com>
2010
2011         Fixed the build following AppKit API deprecations in a recent SDKs
2012
2013         * platform/mac/PasteboardMac.mm:
2014         (WebCore::setDragImageImpl): Suppressed deprecation warnings.
2015         * platform/mac/WidgetMac.mm:
2016         (WebCore::Widget::paint): Ditto.
2017
2018 2018-01-05  Joseph Pecoraro  <pecoraro@apple.com>
2019
2020         ServiceWorkers: Enable UserTiming / ResourceTiming
2021         https://bugs.webkit.org/show_bug.cgi?id=181297
2022         <rdar://problem/36307306>
2023
2024         Reviewed by Youenn Fablet.
2025
2026         Tests: http/tests/workers/service/service-worker-resource-timing.https.html
2027                http/tests/workers/service/service-worker-user-timing.https.html
2028
2029         * loader/ResourceTiming.cpp:
2030         (WebCore::ResourceTiming::ResourceTiming):
2031         We used to clear extra NetworkLoadMetrics data early on. However,
2032         for Workers we want to pass the complete NetworkLoadMetrics to
2033         the Worker so that a Worker inspector has access to it.
2034
2035         * page/PerformanceResourceTiming.cpp:
2036         (WebCore::PerformanceResourceTiming::PerformanceResourceTiming):
2037         Instead move the clearing of extra data to here, when the NetworkLoadMetrics
2038         have finally settled into being used only for a performance entry.
2039
2040 2018-01-04  Philippe Normand  <pnormand@igalia.com>
2041
2042         [EME][GStreamer] Fix wrong ifdef
2043         https://bugs.webkit.org/show_bug.cgi?id=181289
2044
2045         Reviewed by Alex Christensen.
2046
2047         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:
2048         (WebCore::MediaPlayerPrivateGStreamer::handleMessage): Remove the
2049         ENCRYPTED_MEDIA ifdef from the VIDEO_TRACK ifdef block. Both have
2050         nothing to do together.
2051
2052 2018-01-05  Fujii Hironori  <Hironori.Fujii@sony.com>
2053
2054         [Cairo] Canvas: Path::clear should clear its transform
2055         https://bugs.webkit.org/show_bug.cgi?id=181320
2056
2057         Reviewed by Carlos Garcia Campos.
2058
2059         Path of Cairo port has its cairo context. Path::clear() didn't
2060         clear the transform matrix of the context.
2061
2062         Test: fast/canvas/reset-scaling-by-height-change.html
2063
2064         * platform/graphics/cairo/PathCairo.cpp:
2065         (WebCore::Path::clear): Reset the transform matrix of Path.
2066
2067 2018-01-04  Devin Rousso  <webkit@devinrousso.com>
2068
2069         Web Inspector: replace HTMLCanvasElement with CanvasRenderingContext for instrumentation logic
2070         https://bugs.webkit.org/show_bug.cgi?id=180770
2071
2072         Reviewed by Joseph Pecoraro.
2073
2074         No change in functionality.
2075
2076         * html/HTMLCanvasElement.h:
2077         * html/HTMLCanvasElement.cpp:
2078         (WebCore::HTMLCanvasElement::createContext2d):
2079         (WebCore::HTMLCanvasElement::createContextWebGL):
2080         (WebCore::HTMLCanvasElement::createContextWebGPU):
2081         (WebCore::HTMLCanvasElement::createContextBitmapRenderer):
2082         (WebCore::HTMLCanvasElement::reset):
2083         (WebCore::HTMLCanvasElement::paint):
2084         (WebCore::HTMLCanvasElement::setImageBuffer const):
2085         (WebCore::HTMLCanvasElement::addObserver): Deleted.
2086         (WebCore::HTMLCanvasElement::removeObserver): Deleted.
2087         (WebCore::HTMLCanvasElement::cssCanvasClients): Deleted.
2088         (WebCore::HTMLCanvasElement::notifyObserversCanvasChanged): Deleted.
2089         * html/OffscreenCanvas.h:
2090         * html/canvas/CanvasRenderingContext.h:
2091         * html/canvas/CanvasRenderingContext.cpp:
2092         * html/canvas/CanvasRenderingContext2D.h:
2093         * html/canvas/CanvasRenderingContext2D.cpp:
2094         (WebCore::CanvasRenderingContext2D::create):
2095         * html/canvas/CanvasRenderingContext2DBase.h:
2096         * html/canvas/ImageBitmapRenderingContext.h:
2097         * html/canvas/ImageBitmapRenderingContext.cpp:
2098         (WebCore::ImageBitmapRenderingContext::create):
2099         * html/canvas/WebGL2RenderingContext.h:
2100         * html/canvas/WebGL2RenderingContext.cpp:
2101         (WebCore::WebGL2RenderingContext::create):
2102         * html/canvas/WebGLRenderingContext.h:
2103         * html/canvas/WebGLRenderingContext.cpp:
2104         (WebCore::WebGLRenderingContext::create):
2105         * html/canvas/WebGLRenderingContextBase.h:
2106         * html/canvas/WebGLRenderingContextBase.cpp:
2107         (WebCore::WebGLRenderingContextBase::create):
2108         * html/canvas/WebGPURenderingContext.cpp:
2109         (WebCore::WebGPURenderingContext::create):
2110         Instead of adding didCreateCanvasRenderingContext calls at the construction sites of each
2111         context, we can make the constructors private and force the usage of static `create` functions.
2112         This way, we have access to the fully constructed object and have a guaranteed path for creation.
2113
2114         * html/CanvasBase.h:
2115         * html/CanvasBase.cpp:
2116         (WebCore::CanvasBase::~CanvasBase):
2117         (WebCore::CanvasBase::renderingContext const):
2118         (WebCore::CanvasBase::addObserver):
2119         (WebCore::CanvasBase::removeObserver):
2120         (WebCore::CanvasBase::notifyObserversCanvasChanged):
2121         (WebCore::CanvasBase::notifyObserversCanvasResized):
2122         (WebCore::CanvasBase::notifyObserversCanvasDestroyed):
2123         (WebCore::CanvasBase::cssCanvasClients const):
2124         * Modules/mediastream/CanvasCaptureMediaStreamTrack.h:
2125         * Modules/mediastream/CanvasCaptureMediaStreamTrack.cpp:
2126         (WebCore::CanvasCaptureMediaStreamTrack::Source::canvasDestroyed):
2127         (WebCore::CanvasCaptureMediaStreamTrack::Source::canvasResized):
2128         (WebCore::CanvasCaptureMediaStreamTrack::Source::canvasChanged):
2129         * css/CSSCanvasValue.h:
2130         Move the CanvasObserver class to CanvasBase so that it can also be used for OffscreenCanvas.
2131
2132         * inspector/InspectorInstrumentation.h:
2133         (WebCore::InspectorInstrumentation::didChangeCSSCanvasClientNodes):
2134         (WebCore::InspectorInstrumentation::didCreateCanvasRenderingContext):
2135         (WebCore::InspectorInstrumentation::didChangeCanvasMemory):
2136         (WebCore::InspectorInstrumentation::recordCanvasAction):
2137         (WebCore::InspectorInstrumentation::didFinishRecordingCanvasFrame):
2138         (WebCore::InspectorInstrumentation::didEnableExtension):
2139         (WebCore::InspectorInstrumentation::didCreateProgram):
2140         (WebCore::InspectorInstrumentation::willDeleteProgram):
2141         (WebCore::InspectorInstrumentation::isShaderProgramDisabled):
2142         (WebCore::InspectorInstrumentation::consoleStartRecordingCanvas):
2143         (WebCore::InspectorInstrumentation::didCreateCSSCanvas): Deleted.
2144         * inspector/InspectorInstrumentation.cpp:
2145         (WebCore::InspectorInstrumentation::consoleStartRecordingCanvasImpl):
2146         (WebCore::InspectorInstrumentation::didChangeCSSCanvasClientNodesImpl):
2147         (WebCore::InspectorInstrumentation::didCreateCanvasRenderingContextImpl):
2148         (WebCore::InspectorInstrumentation::didChangeCanvasMemoryImpl):
2149         (WebCore::InspectorInstrumentation::didFinishRecordingCanvasFrameImpl):
2150         (WebCore::InspectorInstrumentation::didEnableExtensionImpl):
2151         (WebCore::InspectorInstrumentation::didCreateProgramImpl):
2152         (WebCore::InspectorInstrumentation::didCreateCSSCanvasImpl): Deleted.
2153
2154         * inspector/agents/InspectorCanvasAgent.h:
2155         * inspector/agents/InspectorCanvasAgent.cpp:
2156         (WebCore::InspectorCanvasAgent::enable):
2157         (WebCore::InspectorCanvasAgent::requestNode):
2158         (WebCore::InspectorCanvasAgent::requestContent):
2159         (WebCore::InspectorCanvasAgent::requestCSSCanvasClientNodes):
2160         (WebCore::contextAsScriptValue):
2161         (WebCore::InspectorCanvasAgent::resolveCanvasContext):
2162         (WebCore::InspectorCanvasAgent::startRecording):
2163         (WebCore::InspectorCanvasAgent::stopRecording):
2164         (WebCore::InspectorCanvasAgent::updateShader):
2165         (WebCore::InspectorCanvasAgent::frameNavigated):
2166         (WebCore::InspectorCanvasAgent::didChangeCSSCanvasClientNodes):
2167         (WebCore::InspectorCanvasAgent::didCreateCanvasRenderingContext):
2168         (WebCore::InspectorCanvasAgent::didChangeCanvasMemory):
2169         (WebCore::InspectorCanvasAgent::recordCanvasAction):
2170         (WebCore::InspectorCanvasAgent::canvasDestroyed):
2171         (WebCore::InspectorCanvasAgent::didFinishRecordingCanvasFrame):
2172         (WebCore::InspectorCanvasAgent::consoleStartRecordingCanvas):
2173         (WebCore::InspectorCanvasAgent::didEnableExtension):
2174         (WebCore::InspectorCanvasAgent::didCreateProgram):
2175         (WebCore::InspectorCanvasAgent::canvasRecordingTimerFired):
2176         (WebCore::InspectorCanvasAgent::clearCanvasData):
2177         (WebCore::InspectorCanvasAgent::unbindCanvas):
2178         (WebCore::InspectorCanvasAgent::findInspectorCanvas):
2179         (WebCore::InspectorCanvasAgent::unbindProgram):
2180         (WebCore::InspectorCanvasAgent::didCreateCSSCanvas): Deleted.
2181
2182         * inspector/InspectorCanvas.h:
2183         * inspector/InspectorCanvas.cpp:
2184         (WebCore::InspectorCanvas::create):
2185         (WebCore::InspectorCanvas::InspectorCanvas):
2186         (WebCore::InspectorCanvas::canvasElement):
2187         (WebCore::InspectorCanvas::resetRecordingData):
2188         (WebCore::InspectorCanvas::recordAction):
2189         (WebCore::InspectorCanvas::buildObjectForCanvas):
2190         (WebCore::InspectorCanvas::getCanvasContentAsDataURL):
2191         (WebCore::InspectorCanvas::buildInitialState):
2192         (WebCore::InspectorCanvas::~InspectorCanvas): Deleted.
2193
2194         * inspector/InspectorShaderProgram.h:
2195         * inspector/InspectorShaderProgram.cpp:
2196         (WebCore::InspectorShaderProgram::context const):
2197
2198         * page/PageConsoleClient.cpp:
2199         (WebCore::PageConsoleClient::record):
2200         (WebCore::PageConsoleClient::recordEnd):
2201
2202         * dom/Document.h:
2203         * dom/Document.cpp:
2204         (WebCore::Document::getCSSCanvasElement):
2205         (WebCore::Document::nameForCSSCanvasElement const):
2206         We have no reason to save the CSS canvas name for each InspectorCanvas object, so instead we
2207         can just query for the name based on the CanvasRenderingContext's HTMLCanvasElement (assuming
2208         it is not an OffscreenCanvas) when we need it.
2209
2210 2018-01-04  Chris Fleizach  <cfleizach@apple.com>
2211
2212         AX: Implement updated CSS3 Speech for 'speak' and 'speak-as' properties
2213         https://bugs.webkit.org/show_bug.cgi?id=180361
2214
2215         Reviewed by Zalan Bujtas.
2216
2217         Change speak -> speakAs, and allow a combination of properties.
2218
2219         Tests: Updated accessibility/mac/css-speech-speak.html
2220
2221         * accessibility/AccessibilityObject.h:
2222         (WebCore::AccessibilityObject::speakAsProperty const):
2223         (WebCore::AccessibilityObject::speakProperty const): Deleted.
2224         * accessibility/AccessibilityRenderObject.cpp:
2225         (WebCore::AccessibilityRenderObject::speakAsProperty const):
2226         (WebCore::AccessibilityRenderObject::speakProperty const): Deleted.
2227         * accessibility/AccessibilityRenderObject.h:
2228         * accessibility/ios/WebAccessibilityObjectWrapperIOS.mm:
2229         (-[WebAccessibilityObjectWrapper accessibilitySpeechHint]):
2230         * accessibility/mac/WebAccessibilityObjectWrapperBase.h:
2231         * accessibility/mac/WebAccessibilityObjectWrapperBase.mm:
2232         (-[WebAccessibilityObjectWrapperBase baseAccessibilitySpeechHint]):
2233         * accessibility/mac/WebAccessibilityObjectWrapperMac.mm:
2234         (-[WebAccessibilityObjectWrapper accessibilityAttributeValue:]):
2235         * css/CSSComputedStyleDeclaration.cpp:
2236         (WebCore::speakAsToCSSValue):
2237         (WebCore::ComputedStyleExtractor::propertyValue):
2238         * css/CSSPrimitiveValueMappings.h:
2239         (WebCore::CSSPrimitiveValue::CSSPrimitiveValue):
2240         (WebCore::CSSPrimitiveValue::operator ESpeakAs const):
2241         (WebCore::CSSPrimitiveValue::operator ESpeak const): Deleted.
2242         * css/CSSProperties.json:
2243         * css/StyleBuilderConverter.h:
2244         (WebCore::StyleBuilderConverter::convertSpeakAs):
2245         * css/parser/CSSParserFastPaths.cpp:
2246         (WebCore::CSSParserFastPaths::isValidKeywordPropertyAndValue):
2247         (WebCore::CSSParserFastPaths::isKeywordPropertyID):
2248         * css/parser/CSSPropertyParser.cpp:
2249         (WebCore::consumeSpeakAs):
2250         (WebCore::CSSPropertyParser::parseSingleValue):
2251         * rendering/style/RenderStyle.h:
2252         (WebCore::RenderStyle::speakAs const):
2253         (WebCore::RenderStyle::setSpeakAs):
2254         (WebCore::RenderStyle::initialSpeakAs):
2255         (WebCore::RenderStyle::speak const): Deleted.
2256         (WebCore::RenderStyle::setSpeak): Deleted.
2257         (WebCore::RenderStyle::initialSpeak): Deleted.
2258         * rendering/style/RenderStyleConstants.h:
2259         (WebCore::operator| ):
2260         (WebCore::operator|= ):
2261         * rendering/style/StyleRareInheritedData.cpp:
2262         (WebCore::StyleRareInheritedData::StyleRareInheritedData):
2263         (WebCore::StyleRareInheritedData::operator== const):
2264         * rendering/style/StyleRareInheritedData.h:
2265
2266 2018-01-04  Brian Burg  <bburg@apple.com>
2267
2268         Web Inspector: Capture Element Screenshot looks fuzzy
2269         https://bugs.webkit.org/show_bug.cgi?id=175734
2270         <rdar://problem/33803377>
2271
2272         Reviewed by Joseph Pecoraro and Simon Fraser.
2273
2274         Screenshots taken by Web Inspector were being downscaled from the
2275         internal size to the logical size, causing them to be blurry when
2276         later upscaled to the internal size.
2277
2278         Replace ScaleBehavior { Scaled, Unscaled } with PreserveResolution { No, Yes }.
2279         This is a lot less confusing to read both inside ImageBuffer and at its use sites.
2280
2281         Remove unused CoordinateSystem argument for ImageBuffer::toDataURL,
2282         and replace it with PreserveResolution. Plumb PreserveResolution into toCFData
2283         so that PreserveResolution::Yes will preserve the internal size of
2284         the image buffer, just as it does in other methods that take PreserveResolution.
2285
2286         At the use site in InspectorPageAgent, always request PreserveResolution::Yes snapshots
2287         when taking an element screenshot. For now, keep using downscaled (smaller)
2288         snapshots when capturing canvas previews, as the previews are not full-size.
2289
2290         Test: inspector/page/hidpi-snapshot-size.html
2291
2292         * html/HTMLCanvasElement.cpp:
2293         (WebCore::HTMLCanvasElement::makePresentationCopy):
2294         (WebCore::HTMLCanvasElement::copiedImage const):
2295         * html/canvas/CanvasRenderingContext2DBase.cpp:
2296         (WebCore::CanvasRenderingContext2DBase::createPattern):
2297         * inspector/agents/InspectorPageAgent.cpp:
2298         (WebCore::InspectorPageAgent::snapshotNode):
2299         (WebCore::InspectorPageAgent::snapshotRect):
2300         * page/TextIndicator.cpp:
2301         (WebCore::takeSnapshot):
2302         * platform/DragImage.cpp:
2303         (WebCore::createDragImageFromSnapshot):
2304         * platform/graphics/BitmapImage.cpp:
2305         (WebCore::BitmapImage::drawPattern):
2306         * platform/graphics/ImageBuffer.h:
2307         * platform/graphics/cairo/ImageBufferCairo.cpp:
2308         (WebCore::ImageBuffer::sinkIntoImage):
2309         (WebCore::ImageBuffer::copyImage const):
2310         (WebCore::ImageBuffer::toDataURL const):
2311         * platform/graphics/cg/ImageBufferCG.cpp:
2312         (WebCore::createBitmapImageAfterScalingIfNeeded):
2313         (WebCore::ImageBuffer::copyImage const):
2314         (WebCore::ImageBuffer::sinkIntoImage):
2315         (WebCore::ImageBuffer::toDataURL const):
2316         (WebCore::ImageBuffer::toData const):
2317         (WebCore::ImageBuffer::toCFData const):
2318         * platform/graphics/gtk/ImageBufferGtk.cpp:
2319         (WebCore::ImageBuffer::toDataURL const):
2320         * platform/graphics/win/ImageBufferDirect2D.cpp:
2321         (WebCore::ImageBuffer::copyImage const):
2322         (WebCore::ImageBuffer::sinkIntoImage):
2323         (WebCore::ImageBuffer::toDataURL const):
2324         * svg/graphics/SVGImage.cpp:
2325         (WebCore::SVGImage::drawPatternForContainer):
2326
2327 2018-01-04  John Wilander  <wilander@apple.com>
2328
2329         Storage Access API: Turn feature on by default in Settings.yaml
2330         https://bugs.webkit.org/show_bug.cgi?id=181298
2331         <rdar://problem/36302506>
2332
2333         Reviewed by Brent Fulgham.
2334
2335         No new tests. This is just a feature settings change.
2336
2337         * page/Settings.yaml:
2338
2339 2018-01-04  Zalan Bujtas  <zalan@apple.com>
2340
2341         WebContent process crashes while loading https://www.classicspecs.com
2342         https://bugs.webkit.org/show_bug.cgi?id=181290
2343         <rdar://problem/36225906>
2344
2345         Reviewed by Simon Fraser.
2346
2347         Floats can overhang multiple blocks (they are called intruding floats).
2348         Each block keeps track of such intruding floats. When an overhanging float box is destroyed,
2349         we need to deregister it from all those blocks. We do it by walking up the ancestor block chain
2350         and check if the parent (grandparent etc) block still contains this float. Once we find the topmost block, 
2351         we start deregistering it by traversing back on the descendant blocks.
2352         Normally we do it in RenderElement::takeChildInternal right before the box is getting detached.
2353         However in certain cases (like when the float's parent happens to be an anonymous wrapper)
2354         by the time we get to ::takeChildInternal the subtree is already detached and we can't access all the
2355         ancestors.
2356         This patch ensure that the floating box is still attached during de-registration. 
2357
2358         Test: fast/block/float/crash-when-intruding-float-has-anonymous-parent-and-detach.html
2359
2360         * rendering/RenderObject.cpp:
2361         (WebCore::RenderObject::removeFromParentAndDestroyCleaningUpAnonymousWrappers):
2362
2363 2018-01-04  Eric Carlson  <eric.carlson@apple.com>
2364
2365         [MediaStream] Add Mock screen capture source
2366         https://bugs.webkit.org/show_bug.cgi?id=181291
2367         <rdar://problem/36298164>
2368
2369         Reviewed by Dean Jackson.
2370
2371         Tests:  http/tests/media/media-stream/get-display-media-prompt.html
2372                 GetDisplayMediaTest.BasicPrompt
2373                 GetDisplayMediaTest.Constraints
2374
2375         * Modules/mediastream/MediaDevices.cpp:
2376         (WebCore::MediaDevices::MediaDevices): Add static_assert to ensure MediaDevices::DisplayCaptureSurfaceType
2377         and RealtimeMediaSourceSettings::DisplaySurfaceType values are equivalent.
2378         (WebCore::MediaDevices::getSupportedConstraints): Remove bogus code.
2379         * Modules/mediastream/MediaDevices.h: Add DisplayCaptureSurfaceType.
2380         * Modules/mediastream/MediaDevices.idl: Ditto.
2381
2382         * Modules/mediastream/MediaStreamTrack.cpp:
2383         (WebCore::MediaStreamTrack::getSettings const): Add a FIXME.
2384         * Modules/mediastream/MediaStreamTrack.h: Add displaySurface and logicalSurface.
2385
2386         * Modules/mediastream/MediaTrackSupportedConstraints.h: Remove displaySurface and logicalSurface.
2387         * Modules/mediastream/MediaTrackSupportedConstraints.idl:
2388
2389         * SourcesCocoa.txt: Add DisplayCaptureManagerCocoa.cpp and DisplayCaptureSourceCocoa.cpp.
2390
2391         * WebCore.xcodeproj/project.pbxproj: Ditto.
2392
2393         * platform/mediastream/CaptureDevice.h:
2394         (WebCore::CaptureDevice::encode const): Add.
2395         (WebCore::CaptureDevice::decode):
2396
2397         * platform/mediastream/RealtimeMediaSourceCenter.cpp:
2398         (WebCore::RealtimeMediaSourceCenter::getMediaStreamDevices): Include display capture "devices".
2399         (WebCore::RealtimeMediaSourceCenter::validateRequestConstraints): Deal with display capture devices.
2400         (WebCore::RealtimeMediaSourceCenter::captureDeviceWithPersistentID): Ditto.
2401         * platform/mediastream/RealtimeMediaSourceCenter.h:
2402
2403         * platform/mediastream/RealtimeMediaSourceSettings.h:
2404         (WebCore::RealtimeMediaSourceSettings::displaySurface const): Return a DisplaySurfaceType.
2405         (WebCore::RealtimeMediaSourceSettings::setDisplaySurface): Take a DisplaySurfaceType.
2406
2407         * platform/mediastream/mac/DisplayCaptureManagerCocoa.cpp:
2408         (WebCore::DisplayCaptureManagerCocoa::singleton):
2409         (WebCore::DisplayCaptureManagerCocoa::~DisplayCaptureManagerCocoa):
2410         (WebCore::DisplayCaptureManagerCocoa::captureDevices):
2411         (WebCore::DisplayCaptureManagerCocoa::screenCaptureDeviceWithPersistentID):
2412         (WebCore::DisplayCaptureManagerCocoa::captureDeviceWithPersistentID):
2413         * platform/mediastream/mac/DisplayCaptureManagerCocoa.h:
2414
2415         * platform/mediastream/mac/DisplayCaptureSourceCocoa.cpp: Added.
2416         (WebCore::DisplayCaptureSourceCocoa::DisplayCaptureSourceCocoa):
2417         (WebCore::DisplayCaptureSourceCocoa::~DisplayCaptureSourceCocoa):
2418         (WebCore::DisplayCaptureSourceCocoa::capabilities const):
2419         (WebCore::DisplayCaptureSourceCocoa::settings const):
2420         (WebCore::DisplayCaptureSourceCocoa::settingsDidChange):
2421         (WebCore::DisplayCaptureSourceCocoa::startProducingData):
2422         (WebCore::DisplayCaptureSourceCocoa::stopProducingData):
2423         (WebCore::DisplayCaptureSourceCocoa::elapsedTime):
2424         (WebCore::DisplayCaptureSourceCocoa::applyFrameRate):
2425         (WebCore::DisplayCaptureSourceCocoa::emitFrame):
2426         * platform/mediastream/mac/DisplayCaptureSourceCocoa.h:
2427
2428         * platform/mediastream/mac/RealtimeMediaSourceCenterMac.cpp:
2429         (WebCore::RealtimeMediaSourceCenterMac::displayCaptureDeviceManager): New.
2430         * platform/mediastream/mac/RealtimeMediaSourceCenterMac.h:
2431
2432         * platform/mock/MockRealtimeMediaSource.cpp:
2433         (WebCore::deviceMap): Add screen capture "devices".
2434         (WebCore::MockRealtimeMediaSource::displayDevices): New.
2435         * platform/mock/MockRealtimeMediaSource.h:
2436
2437         * platform/mock/MockRealtimeMediaSourceCenter.cpp: Clean up includes.
2438         * platform/mock/MockRealtimeMediaSourceCenter.h:
2439
2440         * platform/mock/MockRealtimeVideoSource.cpp:
2441         (WebCore::MockRealtimeVideoSource::MockRealtimeVideoSource): Mock two screen devices.
2442         (WebCore::MockRealtimeVideoSource::updateSettings): Deal with mock screens.
2443         (WebCore::MockRealtimeVideoSource::initializeCapabilities): Ditto.
2444         (WebCore::MockRealtimeVideoSource::initializeSupportedConstraints): Ditto.
2445         (WebCore::MockRealtimeVideoSource::drawText): Ditto.
2446         (WebCore::MockRealtimeVideoSource::generateFrame): Ditto.
2447         * platform/mock/MockRealtimeVideoSource.h:
2448         (WebCore::MockRealtimeVideoSource::mockCamera const):
2449         (WebCore::MockRealtimeVideoSource::mockScreen const):
2450
2451 2018-01-04  Youenn Fablet  <youenn@apple.com>
2452
2453         FetchResponse should set its internal response text encoding name
2454         https://bugs.webkit.org/show_bug.cgi?id=181284
2455
2456         Reviewed by Alex Christensen.
2457
2458         Covered by rebased test.
2459
2460         * Modules/fetch/FetchResponse.cpp:
2461         (WebCore::FetchResponse::create): Set response text encoding based on content type charset.
2462
2463 2018-01-04  John Wilander  <wilander@apple.com>
2464
2465         Storage Access API: Remove JavaScript confirm() prompt from Document::requestStorageAccess()
2466         https://bugs.webkit.org/show_bug.cgi?id=181276
2467         <rdar://problem/36290463>
2468
2469         Reviewed by Alex Christensen.
2470
2471         No new tests. Existing test expectations updated.
2472
2473         * dom/Document.cpp:
2474         (WebCore::Document::requestStorageAccess):
2475
2476 2018-01-04  Carlos Garcia Campos  <cgarcia@igalia.com>
2477
2478         [GTK] Issues with Ahem's ex / x-height
2479         https://bugs.webkit.org/show_bug.cgi?id=180581
2480
2481         Reviewed by Michael Catanzaro.
2482
2483         Get the x-height value from the TT_OS2 table if available.
2484
2485         Fixes: fast/text/break-word-pre-wrap.html
2486                imported/w3c/web-platform-tests/css/css-shapes-1/shape-outside/values/shape-outside-shape-arguments-000.html
2487
2488         * platform/graphics/freetype/SimpleFontDataFreeType.cpp:
2489         (WebCore::Font::platformInit):
2490
2491 2018-01-04  Philippe Normand  <pnormand@igalia.com>
2492
2493         Unreviewed, GTK build fix attempt after r226357
2494
2495         * platform/graphics/gstreamer/GStreamerUtilities.h: The
2496         GST_BUFFER_DTS_OR_PTS macro was added in GStreamer 1.8 but old
2497         versions of Debian might not have this release yet.
2498
2499 2018-01-04  Youenn Fablet  <youenn@apple.com>
2500
2501         Implement Cache API partitioning based on ClientOrigin
2502         https://bugs.webkit.org/show_bug.cgi?id=181240
2503
2504         Reviewed by Alex Christensen.
2505
2506         Covered by updated tests.
2507
2508         Previously, cache storage was partitioned according the origin of the client, represented as a String.
2509         We now partition according both client and top origins, represented as a ClientOrigin
2510
2511         Minor refactoring to use more makePendingActivity.
2512         Added support for IPC serialization of ClientOrigin.
2513         Added SecurityOriginData::toString which is used by WebKit2 Cache Storage implementation.
2514
2515         * Modules/cache/CacheStorageConnection.cpp:
2516         (WebCore::CacheStorageConnection::open):
2517         (WebCore::CacheStorageConnection::retrieveCaches):
2518         * Modules/cache/CacheStorageConnection.h:
2519         (WebCore::CacheStorageConnection::clearMemoryRepresentation):
2520         (WebCore::CacheStorageConnection::doOpen):
2521         (WebCore::CacheStorageConnection::doRetrieveCaches):
2522         * Modules/cache/DOMCacheStorage.cpp:
2523         (WebCore::DOMCacheStorage::origin const):
2524         (WebCore::DOMCacheStorage::retrieveCaches):
2525         (WebCore::DOMCacheStorage::open):
2526         (WebCore::DOMCacheStorage::remove):
2527         * Modules/cache/DOMCacheStorage.h:
2528         * Modules/cache/WorkerCacheStorageConnection.cpp:
2529         (WebCore::WorkerCacheStorageConnection::doOpen):
2530         (WebCore::WorkerCacheStorageConnection::doRetrieveCaches):
2531         * Modules/cache/WorkerCacheStorageConnection.h:
2532         * page/ClientOrigin.h:
2533         (WebCore::ClientOrigin::isolatedCopy const):
2534         (WebCore::ClientOrigin::encode const):
2535         (WebCore::ClientOrigin::decode):
2536         * page/SecurityOriginData.cpp:
2537         (WebCore::SecurityOriginData::toString const):
2538         (WebCore::SecurityOriginData::debugString const): Deleted.
2539         * page/SecurityOriginData.h:
2540         (WebCore::SecurityOriginData::debugString const):
2541         * testing/Internals.cpp:
2542         (WebCore::Internals::clearCacheStorageMemoryRepresentation):
2543
2544 2018-01-04  Youenn Fablet  <youenn@apple.com>
2545
2546         Service Worker should expose redirect mode for navigation loads as manual
2547         https://bugs.webkit.org/show_bug.cgi?id=181067
2548
2549         Reviewed by Alex Christensen.
2550
2551         Covered by rebased tests.
2552
2553         * loader/CrossOriginAccessControl.cpp: Removing ContentType header only if affecting CORS checks.
2554         This allows extending header filtering in service worker to all modes, including Navigate.
2555         * workers/service/context/ServiceWorkerFetch.cpp:
2556         (WebCore::ServiceWorkerFetch::dispatchFetchEvent): Ideally, document loading code should set redirect to manual.
2557         Since it is not the case yet and that would require changes to various places, manual is set before exposing the corresponding fetch event.
2558
2559 2018-01-04  Youenn Fablet  <youenn@apple.com>
2560
2561         ServiceWorkerThreadProxy::postTaskForModeToWorkerGlobalScope should be a no-op if worker is being terminated
2562         https://bugs.webkit.org/show_bug.cgi?id=181245
2563
2564         Reviewed by Alex Christensen.
2565
2566         Stop appending tasks to a terminating worker and returning false in that case.
2567         This mirrors what is done for regular workers.
2568
2569         * workers/service/context/SWContextManager.cpp:
2570         (WebCore::SWContextManager::terminateWorker):
2571         * workers/service/context/ServiceWorkerThreadProxy.cpp:
2572         (WebCore::ServiceWorkerThreadProxy::postTaskForModeToWorkerGlobalScope):
2573         * workers/service/context/ServiceWorkerThreadProxy.h:
2574
2575 2018-01-04  Youenn Fablet  <youenn@apple.com>
2576
2577         Cancel pending script loads when service worker is being terminated
2578         https://bugs.webkit.org/show_bug.cgi?id=181250
2579
2580         Reviewed by Alex Christensen.
2581
2582         Covered by service worker tests no longer crashing in ASAN builds.
2583
2584         * workers/WorkerScriptLoader.cpp:
2585         (WebCore::WorkerScriptLoader::notifyFinished): Clearing loader when finished.
2586         (WebCore::WorkerScriptLoader::cancel): Implementing cancel of a script loader by cancelling the underlying threadable loader.
2587         * workers/WorkerScriptLoader.h:
2588         * workers/service/ServiceWorkerContainer.cpp: Canceling loads of all pending jobs.
2589         (WebCore::ServiceWorkerContainer::stop):
2590         * workers/service/ServiceWorkerJob.cpp:
2591         (WebCore::ServiceWorkerJob::cancelPendingLoad):
2592         * workers/service/ServiceWorkerJob.h:
2593
2594 2018-01-04  Youenn Fablet  <youenn@apple.com>
2595
2596         Implement  https://fetch.spec.whatwg.org/#main-fetch default referrer policy setting
2597         https://bugs.webkit.org/show_bug.cgi?id=181239
2598
2599         Reviewed by Alex Christensen.
2600
2601         Covered by updated and rebased test.
2602
2603         Setting the request referrer policy to the Document referrer policy if no one is set.
2604         If Document has no referrer policy, use no-referrer-when-downgrade as per the spec.
2605
2606         * loader/cache/CachedResourceLoader.cpp:
2607         (WebCore::CachedResourceLoader::updateHTTPRequestHeaders):
2608         (WebCore::CachedResourceLoader::requestResource):
2609         * loader/cache/CachedResourceLoader.h:
2610         * loader/cache/CachedResourceRequest.cpp:
2611         (WebCore::CachedResourceRequest::updateReferrerPolicy):
2612         (WebCore::CachedResourceRequest::updateReferrerOriginAndUserAgentHeaders):
2613         * loader/cache/CachedResourceRequest.h:
2614
2615 2018-01-03  Wenson Hsieh  <wenson_hsieh@apple.com>
2616
2617         [Attachment Support] Create attachment elements when dropping files on iOS
2618         https://bugs.webkit.org/show_bug.cgi?id=181192
2619         <rdar://problem/36280945>
2620
2621         Reviewed by Tim Horton.
2622
2623         Implements support for dropping data as attachment elements on iOS. See comments below for more detail.
2624
2625         Tests:  WKAttachmentTests.InsertDroppedRichAndPlainTextFilesAsAttachments
2626                 WKAttachmentTests.InsertDroppedZipArchiveAsAttachment
2627                 WKAttachmentTests.InsertDroppedItemProvidersInOrder
2628
2629         * WebCore.xcodeproj/project.pbxproj:
2630         * editing/WebContentReader.cpp:
2631         (WebCore::WebContentReader::ensureFragment):
2632
2633         Add a new helper to create the WebContentReader's fragment, if it hasn't already been created.
2634
2635         * editing/WebContentReader.h:
2636         * editing/cocoa/WebContentReaderCocoa.mm:
2637         (WebCore::WebContentReader::readFilePaths):
2638
2639         Rename readFilenames to readFilePaths (which better reflects its parameters, which are file paths). Also, move
2640         the implementation of readFilePaths to shared iOS/macOS code in WebContentReaderCocoa, and remove the stub
2641         implementation on iOS.
2642
2643         There's a bit of code here that I kept macOS-only which deals with inserting file paths as plain text in
2644         editable areas, but it's unclear to me why and if WebKit clients currently find this useful, so I left a FIXME
2645         to investigate removing this altogether. Code for handling this plain text insertion of file paths on Mac was
2646         introduced in r67403.
2647
2648         * editing/ios/WebContentReaderIOS.mm:
2649         (WebCore::WebContentReader::readFilenames): Deleted.
2650         * editing/mac/WebContentReaderMac.mm:
2651         (WebCore::WebContentReader::readFilenames): Deleted.
2652         * page/mac/DragControllerMac.mm:
2653         (WebCore::DragController::updateSupportedTypeIdentifiersForDragHandlingMethod const):
2654
2655         Teach DragController to accept all types conforming to "public.item" and "public.content" on iOS, only when
2656         attachment elements are enabled. This allows us to load content from item providers that we otherwise would not
2657         have loaded, since we now have the ability to fall back to attachment element insertion if the type is not have
2658         a default representation using standard web content.
2659
2660         * platform/Pasteboard.h:
2661         * platform/PasteboardItemInfo.h: Added.
2662         (WebCore::PasteboardItemInfo::encode const):
2663         (WebCore::PasteboardItemInfo::decode):
2664
2665         Add PasteboardItemInfo, a struct that describes an item on the pasteboard. Also, implement encoding and decoding
2666         support for PasteboardItemInfo. So far, the item info only describes file information about the pasteboard item,
2667         and flags indicating whether the item prefers attachment or inline presentation.
2668
2669         * platform/PasteboardStrategy.h:
2670
2671         Replace getFilenamesForDataInteraction with informationForItemAtIndex. Instead of returning all of the file
2672         paths associated with any item on the pasteboard, fetch a PasteboardItemInfo at a given item index, which
2673         includes information about the file path as well as some other metadata we'll need when deciding how to read
2674         pasteboard contents as a document fragment.
2675
2676         * platform/PlatformPasteboard.h:
2677         * platform/cocoa/PasteboardCocoa.mm:
2678         (WebCore::Pasteboard::read):
2679         * platform/ios/AbstractPasteboard.h:
2680         * platform/ios/PasteboardIOS.mm:
2681         (WebCore::Pasteboard::read):
2682         (WebCore::Pasteboard::readRespectingUTIFidelities):
2683
2684         Teach the iOS Pasteboard to read web content using attachment elements, if enabled. There are two scenarios in
2685         which we would want to insert an attachment element:
2686         (1) The item provider uses a preferred presentation style of attachment, in which case we bail out of trying to
2687             handle the drop using the default mechanisms, and simply insert it as an attachment. We need this to deal
2688             with the case where we drop text or HTML files from the Files app, so that we don't try and insert the
2689             contents of the text or HTML as inline web content.
2690         (2) The item provider doesn't have a preferred attachment presentation style, but there's nothing WebKit would
2691             otherwise do with the dropped content, so insert an attachment element as a fallback. Examples where this is
2692             relevant are dropping a PDF or ZIP archive without attachment presentation style explicitly set.
2693         We first check if we fall into case (1). If so, we can bail early by inserting an attachment; otherwise, we
2694         proceed normally and see if we can read the contents of the drop as web content. If, at the end of default drop
2695         handling, we don't still have a way to represent the dropped content, enter case (2).
2696
2697         (WebCore::Pasteboard::readFilePaths):
2698         (WebCore::Pasteboard::readFilenames): Deleted.
2699
2700         Rename readFilenames to readFilePaths, and reimplement it using informationForItemAtIndex.
2701
2702         * platform/ios/PlatformPasteboardIOS.mm:
2703         (WebCore::pasteboardItemPresentationStyle):
2704         (WebCore::PlatformPasteboard::informationForItemAtIndex):
2705         (WebCore::PlatformPasteboard::filenamesForDataInteraction): Deleted.
2706
2707         Implement informationForItemAtIndex and remove filenamesForDataInteraction. As before, we ask the pasteboard
2708         (i.e. WebItemProviderPasteboard) for information about dropped file URLs. This time, we limit this to a single
2709         file, so we don't end up creating multiple attachment elements for each representation of a single item
2710         provider. See below for -preferredFileUploadURLAtIndex:fileType: for more detail.
2711
2712         * platform/ios/WebItemProviderPasteboard.h:
2713         * platform/ios/WebItemProviderPasteboard.mm:
2714         (-[WebItemProviderLoadResult initWithItemProvider:typesToLoad:]):
2715         (-[WebItemProviderLoadResult canBeRepresentedAsFileUpload]):
2716
2717         Remove this synthesized instance variable and instead just check the item provider's preferredPresentationStyle.
2718
2719         (-[WebItemProviderLoadResult description]):
2720
2721         Add a verbose -description to the load result object. Useful for debugging what was content was loaded from an
2722         item provider on drop.
2723
2724         (-[WebItemProviderPasteboard preferredFileUploadURLAtIndex:fileType:]):
2725
2726         Return the highest fidelity loaded type identifier for a given item.
2727
2728         (-[WebItemProviderPasteboard allDroppedFileURLs]):
2729         (-[WebItemProviderPasteboard typeIdentifiersToLoadForRegisteredTypeIdentfiers:]):
2730
2731         Prefer flat RTFD to RTFD. In the case where attachments are enabled and we're accepting all types of content
2732         using attachment elements as a fallback representation, if the source writes attributed strings to the
2733         pasteboard with com.apple.rtfd at a higher fidelity than com.apple.flat-rtfd, we'll end up loading only
2734         com.apple.rtfd and dropping the text as an attachment element because we cannot convert the dropped content to
2735         markup. Instead, if flat RTFD is present in the item provider, always prefer that over RTFD so that dropping as
2736         regular web content isn't overridden when attachment elements are enabled.
2737
2738         (-[WebItemProviderPasteboard doAfterLoadingProvidedContentIntoFileURLs:synchronousTimeout:]):
2739         (-[WebItemProviderPasteboard droppedFileURLs]): Deleted.
2740         * platform/mac/DragDataMac.mm:
2741         (WebCore::DragData::containsCompatibleContent const):
2742
2743         DragData::containsCompatibleContent should be true when attachment elements are enabled, and there are files we
2744         can drop as attachment elements.
2745
2746         * platform/mac/PasteboardMac.mm:
2747         (WebCore::Pasteboard::read):
2748         (WebCore::Pasteboard::readFilePaths):
2749         (WebCore::Pasteboard::readFilenames): Deleted.
2750
2751 2018-01-03  Ting-Wei Lan  <lantw44@gmail.com>
2752
2753         Replace hard-coded paths in shebangs with #!/usr/bin/env
2754         https://bugs.webkit.org/show_bug.cgi?id=181040
2755
2756         Reviewed by Alex Christensen.
2757
2758         * bindings/scripts/InFilesCompiler.pm:
2759         * bindings/scripts/InFilesParser.pm:
2760         * bindings/scripts/generate-bindings-all.pl:
2761         * bindings/scripts/generate-bindings.pl:
2762         * bindings/scripts/preprocess-idls.pl:
2763         * css/make-css-file-arrays.pl:
2764         * css/makeprop.pl:
2765         * css/makevalues.pl:
2766         * dom/make_event_factory.pl:
2767         * dom/make_names.pl:
2768         * extract-localizable-strings.pl:
2769         * make-hash-tools.pl:
2770
2771 2018-01-03  Wenson Hsieh  <wenson_hsieh@apple.com>
2772
2773         [Attachment Support] Add plumbing for starting a drag with promised blob data
2774         https://bugs.webkit.org/show_bug.cgi?id=181201
2775
2776         Reviewed by Tim Horton.
2777
2778         Adds logic to allow dragging an attachment element as a file by sending promised blob information to the UI
2779         process. See comments below for more detail.
2780
2781         The only change in behavior is that dragging an attachment element will no longer write web content and injected
2782         bundle data to the pasteboard if the attachment element's file attribute is nonnull. This will cause one
2783         existing WK1 layout test to fail, but will otherwise not affect any attachment editing clients. On iOS,
2784         attachment elements in the Mail viewer can be dragged, but each attachment's file is null, so we fall back to
2785         current behavior; on macOS, Mail currently overrides the drag completely, beginning at -mouseDown:, so this
2786         doesn't make a difference to macOS Mail either.
2787
2788         * editing/Editor.h:
2789         * editing/cocoa/EditorCocoa.mm:
2790         (WebCore::Editor::getPasteboardTypesAndDataForAttachment):
2791
2792         Add a helper method to retrieve an attachment element as web archive data, for moving attachments within the
2793         same document. Also gives the injected editor bundle a chance to supply custom pasteboard types.
2794
2795         * loader/EmptyClients.cpp:
2796         * page/DragClient.h:
2797         (WebCore::DragClient::prepareToDragPromisedBlob):
2798
2799         Add new DragClient methods to send information about a promised blob to the UI process.
2800
2801         * page/DragController.cpp:
2802         (WebCore::DragController::startDrag):
2803
2804         Call dragAttachmentElement when starting a drag on an attachment element.
2805
2806         (WebCore::DragController::dragAttachmentElement):
2807
2808         Try to begin dragging a given attachment element, propagating promised blob information to the client layers.
2809         Returns true iff the attachment is backed by blob data (i.e. the file is nonnull).
2810
2811         * platform/PromisedBlobInfo.h:
2812
2813         Add a list of additional types and data to PromisedBlobInfo. In addition to the promised blob info, this would
2814         allow injected bundle data and other private types alongside the main attachment data on the pasteboard.
2815
2816 2018-01-03  Simon Fraser  <simon.fraser@apple.com>
2817
2818         Remove the 'resolutionScale' parameter from ImageBufferDataCG get/putBytes
2819         https://bugs.webkit.org/show_bug.cgi?id=181268
2820
2821         Reviewed by Alex Christensen.
2822
2823         These functions were always called with resolutionScale=1.
2824
2825         * platform/graphics/cg/ImageBufferCG.cpp:
2826         (WebCore::ImageBuffer::getUnmultipliedImageData const):
2827         (WebCore::ImageBuffer::getPremultipliedImageData const):
2828         (WebCore::ImageBuffer::putByteArray):
2829         * platform/graphics/cg/ImageBufferDataCG.cpp:
2830         (WebCore::ImageBufferData::getData const):
2831         (WebCore::ImageBufferData::putData):
2832         (WebCore::affineWarpBufferData): Deleted.
2833         * platform/graphics/cg/ImageBufferDataCG.h:
2834
2835 2018-01-03  John Wilander  <wilander@apple.com>
2836
2837         Storage Access API: Refactor XPC for access removal to go straight from the web process to the network process
2838         https://bugs.webkit.org/show_bug.cgi?id=181270
2839         <rdar://problem/36289544>
2840
2841         Reviewed by Alex Christensen.
2842
2843         No new tests. Existing test re-enabled.
2844
2845         This change refactors how the web process tells the network process
2846         to remove storage access. Previously, this was done over the UI process
2847         just like requests for storage access. But since no further reasoning
2848         is needed, the message should go straight from the web process to the
2849         network process for performance reasons and to minimize the risk of a
2850         race.
2851
2852         As a consequence, the XPC code for storage access removal in the UI
2853         process is deleted.
2854
2855         * platform/network/cf/NetworkStorageSessionCFNet.cpp:
2856         (WebCore::NetworkStorageSession::cookieStoragePartition const):
2857             Removes the storageAccessAPIEnabled check since the flag
2858             doesn't get propagated when the network process is created.
2859             Figuring this out will take some work which is unnecessary
2860             when we already gate access to the feature in Document.idl.
2861
2862 2018-01-03  James Craig  <jcraig@apple.com>
2863
2864         AX: when invert colors is on, double-invert certain media elements in UserAgentStyleSheet
2865         https://bugs.webkit.org/show_bug.cgi?id=168447
2866         <rdar://problem/30559874>
2867
2868         Reviewed by Simon Fraser.
2869
2870         Double-invert video when platform 'invert colors' setting is enabled. Behavior matches 
2871         current 'Smart Invert' feature of Safari Reader on macOS/iOS and other iOS native apps.
2872
2873         Tests: accessibility/smart-invert-reference.html
2874                accessibility/smart-invert.html
2875
2876         * Modules/modern-media-controls/controls/media-controls.css:
2877         (@media (inverted-colors)):
2878         (:host):
2879         (picture):
2880         * css/html.css:
2881         (@media (inverted-colors)):
2882         (video):
2883
2884 2018-01-03  Youenn Fablet  <youenn@apple.com>
2885
2886         LayoutTest http/tests/media/media-stream/disconnected-frame.html to consistently fail an assertion: !m_adoptionIsRequired
2887         https://bugs.webkit.org/show_bug.cgi?id=181264
2888
2889         Reviewed by Eric Carlson.
2890
2891         Covered by http/tests/media/media-stream/disconnected-frame.html not crashing anymore in Debug builds.
2892         Calling suspendIfNeeded in create method instead of constructor.
2893
2894         * Modules/mediastream/UserMediaRequest.cpp:
2895         (WebCore::UserMediaRequest::create):
2896         (WebCore::UserMediaRequest::UserMediaRequest):
2897
2898 2018-01-03  Antti Koivisto  <antti@apple.com>
2899
2900         Remove DeprecatedCSSOMValue::equals
2901         https://bugs.webkit.org/show_bug.cgi?id=181241
2902
2903         Reviewed by Zalan Bujtas.
2904
2905         This is dead code.
2906
2907         * css/DeprecatedCSSOMValue.cpp:
2908         (WebCore::compareCSSOMValues): Deleted.
2909         (WebCore::DeprecatedCSSOMValue::equals const): Deleted.
2910         * css/DeprecatedCSSOMValue.h:
2911         (WebCore::DeprecatedCSSOMValue::operator== const): Deleted.
2912         (WebCore::DeprecatedCSSOMComplexValue::equals const): Deleted.
2913         * css/DeprecatedCSSOMValueList.cpp:
2914         (WebCore::DeprecatedCSSOMValueList::equals const): Deleted.
2915         * css/DeprecatedCSSOMValueList.h:
2916
2917 2018-01-03  Simon Fraser  <simon.fraser@apple.com>
2918
2919         feLighting is broken with primitiveUnits="objectBoundingBox"
2920         https://bugs.webkit.org/show_bug.cgi?id=181197
2921
2922         Reviewed by Tim Horton.
2923
2924         With <filter primitiveUnits="objectBoundingBox"> we need to convert the coordinates
2925         of fePointLights and feSpotLights into user space coordinates. Following
2926         https://www.w3.org/TR/SVG/filters.html#FilterElementPrimitiveUnitsAttribute
2927         this is done by treating them as fractions of the bounding box on the referencing
2928         element, with treatment for z following https://www.w3.org/TR/SVG/coords.html#Units_viewport_percentage
2929         
2930         To do this, store the bounds of the referencing elemenet on SVGFilterBuilder as
2931         targetBoundingBox, and store the primitiveUnits type. Then do the conversion of lighting
2932         coordinates in SVGFESpecularLightingElement::build() and SVGFEDiffuseLightingElement::build().
2933
2934         Remove SVGFELightElement::findLightSource(), since we need to be able to pass the SVGFilterBuilder
2935         to the lightSource() function so hoist the code up.
2936
2937         Tests: svg/filters/feDiffuseLighting-fePointLight-primitiveUnits-objectBoundingBox-expected.svg
2938                svg/filters/feDiffuseLighting-fePointLight-primitiveUnits-objectBoundingBox.svg
2939                svg/filters/feDiffuseLighting-feSpotLight-primitiveUnits-objectBoundingBox-expected.svg
2940                svg/filters/feDiffuseLighting-feSpotLight-primitiveUnits-objectBoundingBox.svg
2941                svg/filters/feSpecularLighting-fePointLight-primitiveUnits-objectBoundingBox-expected.svg
2942                svg/filters/feSpecularLighting-fePointLight-primitiveUnits-objectBoundingBox.svg
2943
2944         * rendering/svg/RenderSVGResourceFilter.cpp:
2945         (WebCore::RenderSVGResourceFilter::buildPrimitives const):
2946         * svg/SVGFEDiffuseLightingElement.cpp:
2947         (WebCore::SVGFEDiffuseLightingElement::build):
2948         * svg/SVGFEDistantLightElement.cpp:
2949         (WebCore::SVGFEDistantLightElement::lightSource const):
2950         * svg/SVGFEDistantLightElement.h:
2951         * svg/SVGFELightElement.cpp:
2952         (WebCore::SVGFELightElement::findLightSource): Deleted.
2953         * svg/SVGFELightElement.h:
2954         * svg/SVGFEPointLightElement.cpp:
2955         (WebCore::SVGFEPointLightElement::lightSource const):
2956         * svg/SVGFEPointLightElement.h:
2957         * svg/SVGFESpecularLightingElement.cpp:
2958         (WebCore::SVGFESpecularLightingElement::build):
2959         * svg/SVGFESpotLightElement.cpp:
2960         (WebCore::SVGFESpotLightElement::lightSource const):
2961         * svg/SVGFESpotLightElement.h:
2962         * svg/graphics/filters/SVGFilterBuilder.h:
2963         (WebCore::SVGFilterBuilder::setTargetBoundingBox):
2964         (WebCore::SVGFilterBuilder::targetBoundingBox const):
2965         (WebCore::SVGFilterBuilder::primitiveUnits const):
2966         (WebCore::SVGFilterBuilder::setPrimitiveUnits):
2967
2968 2018-01-03  Antti Koivisto  <antti@apple.com>
2969
2970         Crash beneath CSSValue::equals @ csas.cz
2971         https://bugs.webkit.org/show_bug.cgi?id=181243
2972         <rdar://problem/35990826>
2973
2974         Reviewed by Alex Christensen.
2975
2976         Test: fast/text/oblique-degree-equals-crash.html
2977
2978         * css/CSSFontStyleValue.cpp:
2979         (WebCore::CSSFontStyleValue::equals const):
2980
2981         Null check both oblique pointers.
2982
2983 2018-01-03  Joseph Pecoraro  <pecoraro@apple.com>
2984
2985         Web Inspector: Slow open time enumerating system fonts (FontCache::systemFontFamilies)
2986         https://bugs.webkit.org/show_bug.cgi?id=180979
2987         <rdar://problem/36146670>
2988
2989         Reviewed by Matt Baker.
2990
2991         * platform/graphics/cocoa/FontCacheCoreText.cpp:
2992         (fontNameIsSystemFont):
2993         (WebCore::FontCache::systemFontFamilies):
2994         Switch to the original Mac algorithm before r180979 that uses
2995         CTFontManagerCopyAvailableFontFamilyNames. Previously this wasn't
2996         available on iOS but now it is. This is a performance improvement on
2997         both platforms, but significantly so on macOS. It also finds more,
2998         valid, family names.
2999
3000 2018-01-03  Michael Catanzaro  <mcatanzaro@igalia.com>
3001
3002         ASSERTION FAILED: !source || is<Target>(*source) in CoordinatedGraphicsLayer::removeFromParent
3003         https://bugs.webkit.org/show_bug.cgi?id=166568
3004
3005         Reviewed by Simon Fraser.
3006
3007         When a GraphicsLayer has a mask layer, it fails to properly unparent the mask layer before
3008         it is destroyed. This leaves the mask layer with a dangling parent pointer. Fix it, while
3009         taking care not to introduce yet another virtual function call during the execution of the
3010         destructor.
3011
3012         * platform/graphics/GraphicsLayer.cpp:
3013         (WebCore::GraphicsLayer::willBeDestroyed):
3014
3015 2018-01-03  Simon Fraser  <simon.fraser@apple.com>
3016
3017         SVG lighting filter lights are in the wrong coordinate system
3018         https://bugs.webkit.org/show_bug.cgi?id=181147
3019
3020         Reviewed by Zalan Bujtas.
3021
3022         Point and spot light coordinates weren't being converted into buffer-relative
3023         coordinates before being fed into the lighting math, resulting in incorrect light
3024         rendering on Retina devices, and when the filter primitive region was clipped.
3025
3026         Fix by storing absoluteUnclippedSubregion on FilterEffect, which allows us to map
3027         lighting points from user space coordinates into the coordinates of the buffer being
3028         used for rendering. Also scale the light z coordinate by doing a dummy point mapping in x.
3029
3030         Rename members of PointLightSource and SpotLightSource to make it clear which coordinate
3031         system they are in.
3032
3033         Tests include HiDPI tests.
3034
3035         Tests: svg/filters/fePointLight-coordinates-expected.svg
3036                svg/filters/fePointLight-coordinates.svg
3037                svg/filters/feSpotLight-coordinates-expected.svg
3038                svg/filters/feSpotLight-coordinates.svg
3039                svg/filters/hidpi/fePointLight-coordinates-expected.svg
3040                svg/filters/hidpi/fePointLight-coordinates.svg
3041                svg/filters/hidpi/feSpotLight-coordinates-expected.svg
3042                svg/filters/hidpi/feSpotLight-coordinates.svg
3043
3044         * platform/graphics/FloatPoint3D.h: Make it easy to get and set the X and Y coords as a FloatPoint.
3045         (WebCore::FloatPoint3D::xy const):
3046         (WebCore::FloatPoint3D::setXY):
3047         * platform/graphics/GeometryUtilities.cpp:
3048         (WebCore::mapPoint):
3049         (WebCore::mapRect):
3050         * platform/graphics/GeometryUtilities.h: Helper to make a point between rects.
3051         * platform/graphics/filters/DistantLightSource.cpp:
3052         (WebCore::DistantLightSource::initPaintingData):
3053         * platform/graphics/filters/DistantLightSource.h:
3054         * platform/graphics/filters/FELighting.cpp:
3055         (WebCore::FELighting::drawLighting):
3056         * platform/graphics/filters/FilterEffect.cpp:
3057         (WebCore::FilterEffect::mapPointFromUserSpaceToBuffer const):
3058         * platform/graphics/filters/FilterEffect.h:
3059         (WebCore::FilterEffect::setUnclippedAbsoluteSubregion):
3060         * platform/graphics/filters/LightSource.h:
3061         * platform/graphics/filters/PointLightSource.cpp:
3062         (WebCore::PointLightSource::initPaintingData):
3063         (WebCore::PointLightSource::computePixelLightingData const):
3064         (WebCore::PointLightSource::setX):
3065         (WebCore::PointLightSource::setY):
3066         (WebCore::PointLightSource::setZ):
3067         * platform/graphics/filters/PointLightSource.h:
3068         (WebCore::PointLightSource::position const):
3069         (WebCore::PointLightSource::PointLightSource):
3070         * platform/graphics/filters/SpotLightSource.cpp:
3071         (WebCore::SpotLightSource::initPaintingData):
3072         (WebCore::SpotLightSource::computePixelLightingData const):
3073         (WebCore::SpotLightSource::setX):
3074         (WebCore::SpotLightSource::setY):
3075         (WebCore::SpotLightSource::setZ):
3076         (WebCore::SpotLightSource::setPointsAtX):
3077         (WebCore::SpotLightSource::setPointsAtY):
3078         (WebCore::SpotLightSource::setPointsAtZ):
3079         * platform/graphics/filters/SpotLightSource.h:
3080         (WebCore::SpotLightSource::position const):
3081         (WebCore::SpotLightSource::direction const):
3082         (WebCore::SpotLightSource::SpotLightSource):
3083         * rendering/svg/RenderSVGResourceFilter.cpp:
3084         (WebCore::RenderSVGResourceFilter::buildPrimitives const):
3085         * rendering/svg/RenderSVGResourceFilterPrimitive.cpp:
3086         (WebCore::RenderSVGResourceFilterPrimitive::determineFilterPrimitiveSubregion):
3087
3088 2018-01-03  Youenn Fablet  <youenn@apple.com>
3089
3090         Select service worker for documents with data/blob URLS
3091         https://bugs.webkit.org/show_bug.cgi?id=181213
3092
3093         Reviewed by Alex Christensen.
3094
3095         Covered by updated test.
3096
3097         Reusing the service worker of the parent for blob/data URL documents.
3098
3099         * loader/DocumentLoader.cpp:
3100         (WebCore::isLocalURL):
3101         (WebCore::DocumentLoader::commitData):
3102
3103 2018-01-03  Ryan Haddad  <ryanhaddad@apple.com>
3104
3105         Unreviewed, rolling out r226352.
3106
3107         Breaks Sierra and El Capitan builds.
3108
3109         Reverted changeset:
3110
3111         "Web Inspector: Slow open time enumerating system fonts
3112         (FontCache::systemFontFamilies)"
3113         https://bugs.webkit.org/show_bug.cgi?id=180979
3114         https://trac.webkit.org/changeset/226352
3115
3116 2018-01-03  Philippe Normand  <pnormand@igalia.com>
3117
3118         [GStreamer] The bus synchronous handler should be in the base player class
3119         https://bugs.webkit.org/show_bug.cgi?id=181237
3120
3121         Reviewed by Carlos Garcia Campos.
3122
3123         Because this is where video rendering is handled.
3124
3125         No new tests, this is only a refactoring.
3126
3127         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:
3128         (WebCore::MediaPlayerPrivateGStreamer::createGSTPlayBin):
3129         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp:
3130         (WebCore::MediaPlayerPrivateGStreamerBase::setPipeline):
3131
3132 2018-01-03  Philippe Normand  <pnormand@igalia.com>
3133
3134         [GStreamer] move MediaSample implementation out of mse/
3135         https://bugs.webkit.org/show_bug.cgi?id=179165
3136
3137         Reviewed by Carlos Garcia Campos.
3138
3139         This module isn't specific to MSE and can potentially be reused
3140         elsewhere, for WebRTC for instance. Additionally the
3141         ::platformSample() method was implemented and the code was cleaned up.
3142
3143         * platform/GStreamer.cmake:
3144         * platform/MediaSample.h:
3145         * platform/graphics/gstreamer/GStreamerMediaSample.cpp: Renamed from Source/WebCore/platform/graphics/gstreamer/mse/GStreamerMediaSample.cpp.
3146         (WebCore::GStreamerMediaSample::platformSample):
3147         * platform/graphics/gstreamer/GStreamerMediaSample.h: Renamed from Source/WebCore/platform/graphics/gstreamer/mse/GStreamerMediaSample.h.
3148         * platform/graphics/gstreamer/mse/PlaybackPipeline.cpp:
3149         (WebCore::PlaybackPipeline::enqueueSample):
3150
3151 2018-01-03  Carlos Garcia Campos  <cgarcia@igalia.com>
3152
3153         Unreviewed. Fix resource load stats tests on GLib based ports after r226355.
3154
3155         The monitor can be created in the work queue thread too.
3156
3157         * platform/glib/FileMonitorGLib.cpp:
3158         (WebCore::FileMonitor::FileMonitor):
3159
3160 2018-01-03  Carlos Garcia Campos  <cgarcia@igalia.com>
3161
3162         [GTK] Crash destroying WebCore::FileMonitor
3163         https://bugs.webkit.org/show_bug.cgi?id=181138
3164
3165         Reviewed by Michael Catanzaro.
3166
3167         Ensure that platform file monitor is always created and destroyed in the work queue thread synchronously.
3168
3169         * platform/FileMonitor.h:
3170         * platform/glib/FileMonitorGLib.cpp:
3171         (WebCore::FileMonitor::FileMonitor):
3172         (WebCore::FileMonitor::~FileMonitor):
3173         (WebCore::FileMonitor::didChange):
3174
3175 2018-01-02  Joseph Pecoraro  <pecoraro@apple.com>
3176
3177         Web Inspector: Slow open time enumerating system fonts (FontCache::systemFontFamilies)
3178         https://bugs.webkit.org/show_bug.cgi?id=180979
3179         <rdar://problem/36146670>
3180
3181         Reviewed by Matt Baker.
3182
3183         * platform/graphics/cocoa/FontCacheCoreText.cpp:
3184         (WebCore::FontCache::systemFontFamilies):
3185         Switch to the original Mac algorithm before r180979 that uses
3186         CTFontManagerCopyAvailableFontFamilyNames. Previously this wasn't
3187         available on iOS but now it is. This is a performance improvement on
3188         both platforms, but significantly so on macOS. It also finds more,
3189         valid, family names.
3190
3191 2018-01-02  Yusuke Suzuki  <utatane.tea@gmail.com>
3192
3193         Unreviewed, fix GCC warning by using #include
3194         https://bugs.webkit.org/show_bug.cgi?id=181189
3195
3196         This file is included in C++ files. Use #include instead of #import to suppress warning in GCC.
3197
3198         * platform/PromisedBlobInfo.h:
3199
3200 2017-12-28  Yusuke Suzuki  <utatane.tea@gmail.com>
3201
3202         Remove std::chrono completely
3203         https://bugs.webkit.org/show_bug.cgi?id=181186
3204
3205         Reviewed by Alex Christensen.
3206
3207         Use MonotonicTime, WallTime, and Seconds instead.
3208         Changes are mechanical ones. But persistent network cache data is changed.
3209         So we bump the version number of the cache storage.
3210
3211         * Modules/indexeddb/server/IDBServer.cpp:
3212         (WebCore::IDBServer::IDBServer::closeAndDeleteDatabasesModifiedSince):
3213         (WebCore::IDBServer::removeAllDatabasesForOriginPath):
3214         (WebCore::IDBServer::IDBServer::performCloseAndDeleteDatabasesModifiedSince):
3215         (WebCore::IDBServer::IDBServer::performCloseAndDeleteDatabasesForOrigins):
3216         * Modules/indexeddb/server/IDBServer.h:
3217         * Modules/webdatabase/DatabaseTracker.cpp:
3218         (WebCore::DatabaseTracker::deleteDatabasesModifiedSince):
3219         * Modules/webdatabase/DatabaseTracker.h:
3220         * dom/Document.cpp:
3221         (WebCore::Document::lastModified):
3222         * html/HTMLMediaElement.cpp:
3223         (WebCore::HTMLMediaElement::clearMediaCache):
3224         * html/HTMLMediaElement.h:
3225         (WebCore::HTMLMediaElement::clearMediaCache):
3226         * loader/CrossOriginPreflightResultCache.cpp:
3227         (WebCore::parseAccessControlMaxAge):
3228         (WebCore::CrossOriginPreflightResultCacheItem::parse):
3229         (WebCore::CrossOriginPreflightResultCacheItem::allowsRequest const):
3230         * loader/CrossOriginPreflightResultCache.h:
3231         * loader/cache/CachedResource.cpp:
3232         (WebCore::CachedResource::CachedResource):
3233         (WebCore::CachedResource::freshnessLifetime const):
3234         (WebCore::CachedResource::responseReceived):
3235         (WebCore::CachedResource::updateResponseAfterRevalidation):
3236         * loader/cache/CachedResource.h:
3237         * platform/FileSystem.cpp:
3238         (WebCore::FileSystem::getFileModificationTime):
3239         * platform/FileSystem.h:
3240         * platform/SearchPopupMenu.h:
3241         * platform/cocoa/SearchPopupMenuCocoa.h:
3242         * platform/cocoa/SearchPopupMenuCocoa.mm:
3243         (WebCore::toSystemClockTime):
3244         (WebCore::toNSDateFromSystemClock):
3245         (WebCore::removeRecentlyModifiedRecentSearches):
3246         * platform/graphics/MediaPlayer.cpp:
3247         (WebCore::MediaPlayer::clearMediaCache):
3248         * platform/graphics/MediaPlayer.h:
3249         * platform/graphics/MediaPlayerPrivate.h:
3250         (WebCore::MediaPlayerPrivateInterface::clearMediaCache):
3251         * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.h:
3252         * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
3253         (WebCore::toSystemClockTime):
3254         (WebCore::MediaPlayerPrivateAVFoundationObjC::clearMediaCache):
3255         * platform/graphics/mac/MediaPlayerPrivateQTKit.h:
3256         * platform/graphics/mac/MediaPlayerPrivateQTKit.mm:
3257         (WebCore::MediaPlayerPrivateQTKit::clearMediaCache):
3258         * platform/network/CacheValidation.cpp:
3259         (WebCore::computeCurrentAge):
3260         (WebCore::computeFreshnessLifetimeForHTTPFamily):
3261         (WebCore::updateRedirectChainStatus):
3262         (WebCore::redirectChainAllowsReuse):
3263         (WebCore::parseCacheControlDirectives):
3264         * platform/network/CacheValidation.h:
3265         (WebCore::RedirectChainCacheStatus::RedirectChainCacheStatus):
3266         * platform/network/HTTPParsers.cpp:
3267         (WebCore::parseHTTPDate):
3268         * platform/network/HTTPParsers.h:
3269         * platform/network/PlatformCookieJar.h:
3270         * platform/network/ResourceResponseBase.cpp:
3271         (WebCore::ResourceResponseBase::cacheControlMaxAge const):
3272         (WebCore::parseDateValueInHeader):
3273         (WebCore::ResourceResponseBase::date const):
3274         (WebCore::ResourceResponseBase::age const):
3275         (WebCore::ResourceResponseBase::expires const):
3276         (WebCore::ResourceResponseBase::lastModified const):
3277         * platform/network/ResourceResponseBase.h:
3278         * platform/network/cf/CookieJarCFNet.cpp:
3279         (WebCore::deleteAllCookiesModifiedSince):
3280         * platform/network/curl/CookieJarCurl.cpp:
3281         (WebCore::CookieJarCurlFileSystem::deleteAllCookiesModifiedSince):
3282         (WebCore::deleteAllCookiesModifiedSince):
3283         * platform/network/curl/CookieJarCurl.h:
3284         * platform/network/curl/CurlCacheEntry.cpp:
3285         (WebCore::CurlCacheEntry::CurlCacheEntry):
3286         (WebCore::CurlCacheEntry::isCached):
3287         (WebCore::CurlCacheEntry::parseResponseHeaders):
3288         * platform/network/curl/CurlCacheEntry.h:
3289         * platform/network/mac/CookieJarMac.mm:
3290         (WebCore::deleteAllCookiesModifiedSince):
3291         * platform/network/soup/CookieJarSoup.cpp:
3292         (WebCore::deleteAllCookiesModifiedSince):
3293         * platform/win/SearchPopupMenuWin.cpp:
3294         (WebCore::SearchPopupMenuWin::loadRecentSearches):
3295         * rendering/RenderSearchField.cpp:
3296         (WebCore::RenderSearchField::addSearchResult):
3297
3298 2018-01-02  Wenson Hsieh  <wenson_hsieh@apple.com>
3299
3300         [Attachment Support] Introduce data structures and IPC support for writing promised blobs
3301         https://bugs.webkit.org/show_bug.cgi?id=181189
3302
3303         Reviewed by Tim Horton.
3304
3305         Introduces a new header containing structs to be used for writing blob data when dragging. PromisedBlobInfo
3306         represents information needed to declare data on the pasteboard that will eventually be provided via a Blob.
3307         This includes the type and filename of the Blob-backed content. PromisedBlobData represents information needed
3308         to actually deliver the Blob's content to the platform, and is sent some time after its corresponding
3309         PromisedBlobInfo. The content may either be in the form of a file path (as is the case using the previous
3310         declareAndWriteAttachment codepath) or a data buffer (which we would use if the Blob is not already backed by a
3311         file on disk).
3312
3313         No new tests, since there is no observable change in functionality yet.
3314
3315         * WebCore.xcodeproj/project.pbxproj:
3316         * platform/PromisedBlobInfo.h: Added.
3317         (WebCore::PromisedBlobInfo::operator bool const):
3318         (WebCore::PromisedBlobData::hasData const):
3319         (WebCore::PromisedBlobData::hasFile const):
3320         (WebCore::PromisedBlobData::operator bool const):
3321         (WebCore::PromisedBlobData::fulfills const):
3322
3323 2018-01-02  Brady Eidson  <beidson@apple.com>
3324
3325         Make MessagePortChannel::takeAllMessagesFromRemote asynchronous.
3326         https://bugs.webkit.org/show_bug.cgi?id=181205
3327
3328         Reviewed by Alex Christensen.
3329
3330         No new tests (No behavior change)
3331
3332         This is needed for the ongoing WK2 MessagePort work.
3333
3334         For WK1 in-process MessagePorts it is still synchronous; no behavior change.
3335
3336         * dom/InProcessMessagePortChannel.cpp:
3337         (WebCore::InProcessMessagePortChannel::takeAllMessagesFromRemote):
3338         * dom/InProcessMessagePortChannel.h:
3339
3340         * dom/MessagePort.cpp:
3341         (WebCore::MessagePort::dispatchMessages):
3342         * dom/MessagePortChannel.h:
3343
3344 2018-01-02  Jiewen Tan  <jiewen_tan@apple.com>
3345
3346         Add a WebAuthentication runtime feature flag
3347         https://bugs.webkit.org/show_bug.cgi?id=181220
3348         <rdar://problem/36055305>
3349
3350         Reviewed by Brent Fulgham.
3351
3352         This patch basically renames the CredentialManagement runtime feature flag into
3353         WebAuthentication runtime feature flag.
3354
3355         No tests.
3356
3357         * Modules/credentialmanagement/BasicCredential.idl:
3358         * Modules/credentialmanagement/CredentialsContainer.idl:
3359         * Modules/credentialmanagement/NavigatorCredentials.idl:
3360         * Modules/webauthn/PublicKeyCredential.idl:
3361         * page/RuntimeEnabledFeatures.h:
3362         (WebCore::RuntimeEnabledFeatures::setWebAuthenticationEnabled):
3363         (WebCore::RuntimeEnabledFeatures::webAuthenticationEnabled const):
3364         (WebCore::RuntimeEnabledFeatures::setCredentialManagementEnabled): Deleted.
3365         (WebCore::RuntimeEnabledFeatures::credentialManagementEnabled const): Deleted.
3366
3367 2018-01-02  Wenson Hsieh  <wenson_hsieh@apple.com>
3368
3369         [Attachment Support] Don't Blob-convert images and attachments with https:, http: or data: urls
3370         https://bugs.webkit.org/show_bug.cgi?id=181143
3371         <rdar://problem/36200381>
3372
3373         Reviewed by Tim Horton.
3374
3375         Clients such as Mail would expect pasting or dropping an image with src="https://..." to result in the source
3376         URL being preserved (i.e. staying as remote images) instead of creating image attachments out of them. This
3377         patch hooks into the shouldConvertToBlob() check added in r226272 so that it applies to attachment element
3378         replacement as well.
3379
3380         Test: WKAttachmentTests.DoNotInsertDataURLImagesAsAttachments
3381
3382         * editing/cocoa/WebContentReaderCocoa.mm:
3383         (WebCore::shouldConvertToBlob):
3384         (WebCore::replaceRichContentWithAttachments):
3385
3386 2018-01-02  Brady Eidson  <beidson@apple.com>
3387
3388         Identify MessagePorts by a globally unique MessagePortIdentifier.
3389         https://bugs.webkit.org/show_bug.cgi?id=181172
3390
3391         Reviewed by Alex Christensen.
3392
3393         No new tests (Behavior change covered by all existing tests).
3394
3395         This cleans up the abstract MessagePortChannel interface to be in terms of identifiers
3396         instead of actual MessagePort objects.
3397         
3398         The identifiers are compounded with the current ProcessIdentifier meaning they are global
3399         across all processes for the running UI process, enabling easy cross-process communication.
3400         
3401         (Actual cross-process communication comes in a followup)
3402         
3403         * WebCore.xcodeproj/project.pbxproj:
3404         
3405         * dom/InProcessMessagePortChannel.cpp:
3406         (WebCore::InProcessMessagePortChannel::createChannelBetweenPorts):
3407         (WebCore::InProcessMessagePortChannel::isConnectedTo):
3408         (WebCore::InProcessMessagePortChannel::entangleWithRemoteIfOpen):
3409         (WebCore::InProcessMessagePortChannel::entangleIfOpen): Deleted.
3410         * dom/InProcessMessagePortChannel.h:
3411         
3412         * dom/MessageChannel.cpp:
3413         (WebCore::MessageChannel::MessageChannel):
3414         (WebCore::m_port2):
3415         
3416         * dom/MessagePort.cpp:
3417         (WebCore::allMessagePortsLock):
3418         (WebCore::MessagePort::ref const):
3419