Storage Access API: Remove access for all frames under a page when the page is closed
[WebKit-https.git] / Source / WebCore / ChangeLog
1 2018-01-08  John Wilander  <wilander@apple.com>
2
3         Storage Access API: Remove access for all frames under a page when the page is closed
4         https://bugs.webkit.org/show_bug.cgi?id=181398
5         <rdar://problem/36357879>
6
7         Reviewed by Alex Christensen.
8
9         No new tests. Discussed with Alex Christensen and we concluded that
10         both a layout test and an API test would require a lot of work and
11         we have existing tests for clearing out storage access for frames.
12
13         * platform/network/NetworkStorageSession.h:
14         * platform/network/cf/NetworkStorageSessionCFNet.cpp:
15         (WebCore::NetworkStorageSession::removeStorageAccessForAllFramesOnPage):
16
17 2018-01-08  Matt Lewis  <jlewis3@apple.com>
18
19         Unreviewed, rolling out r226385.
20
21         The test introduced with this was a flaky since being added.
22
23         Reverted changeset:
24
25         "AX: when invert colors is on, double-invert certain media
26         elements in UserAgentStyleSheet"
27         https://bugs.webkit.org/show_bug.cgi?id=168447
28         https://trac.webkit.org/changeset/226385
29
30 2018-01-08  Youenn Fablet  <youenn@apple.com>
31
32         SWClientConnection should not keep references to service worker jobs
33         https://bugs.webkit.org/show_bug.cgi?id=181381
34
35         Reviewed by Chris Dumez.
36
37         Difficult to test determiniscally but corresponding crash log should no longer happen in debug builds.
38
39         Stopped passing ServiceWorkerJob references from ServiceWorkerContainer (potentially in service worker thread) to SWClientConnection (main thread).
40         Instead pass job identifiers and related data to the main thread.
41
42         Minor refactoring to use ServiceWorkerJobIdentifier instead of ServiceWorkerJobDataIdentifier which contains more data than needed.
43
44         * workers/service/SWClientConnection.cpp:
45         (WebCore::SWClientConnection::scheduleJob):
46         (WebCore::SWClientConnection::failedFetchingScript):
47         (WebCore::SWClientConnection::postTaskForJob):
48         (WebCore::SWClientConnection::jobRejectedInServer):
49         (WebCore::SWClientConnection::registrationJobResolvedInServer):
50         (WebCore::SWClientConnection::unregistrationJobResolvedInServer):
51         (WebCore::SWClientConnection::startScriptFetchForServer):
52         (WebCore::SWClientConnection::clearPendingJobs):
53         (WebCore::SWClientConnection::finishedFetchingScript): Deleted.
54         * workers/service/SWClientConnection.h:
55         * workers/service/ServiceWorkerContainer.cpp:
56         (WebCore::ServiceWorkerContainer::scheduleJob):
57         (WebCore::ServiceWorkerContainer::startScriptFetchForJob):
58         (WebCore::ServiceWorkerContainer::jobFinishedLoadingScript):
59         (WebCore::ServiceWorkerContainer::jobFailedLoadingScript):
60         * workers/service/ServiceWorkerContainer.h:
61         * workers/service/server/SWServer.cpp:
62         (WebCore::SWServer::rejectJob):
63         (WebCore::SWServer::resolveRegistrationJob):
64         (WebCore::SWServer::resolveUnregistrationJob):
65         (WebCore::SWServer::startScriptFetch):
66         * workers/service/server/SWServer.h:
67
68 2018-01-08  Wenson Hsieh  <wenson_hsieh@apple.com>
69
70         Copying, pasting, and then deleting an attachment element breaks attachment data requests
71         https://bugs.webkit.org/show_bug.cgi?id=181365
72         <rdar://problem/36340647>
73
74         Reviewed by Tim Horton.
75
76         Currently, copying and pasting an attachment element within the same document and then deleting backwards to
77         remove the pasted attachment element causes the original attachment element to be inaccessible via SPI. This is
78         because there are now two different attachment elements with the same unique identifier, such that Document,
79         which keeps a map of all unique attachment identifiers to attachment elements, will lose track of the original
80         attachment element.
81
82         To fix this, we ensure that attachment elements should always have unique identifiers when they are inserted
83         into the document. We make several small adjustments to accomplish this:
84
85         1.  First, refactor HTMLAttachmentElement's unique identifier so that it no longer depends on the value of the
86             "webkitattachmentid" attribute, and is instead just a member of HTMLAttachmentElement that is not exposed to
87             DOM bindings. This means setting and querying an attachment element's uniqueIdentifier can be done without
88             triggering any side effects, such as layout or mutation events.
89
90         2.  Next, make "webkitattachmentid" a temporary attribute similar to "webkitattachmentpath" and
91             "webkitattachmentbloburl", so that it is added only when generating a markup fragment for editing, and
92             removed upon deserialization.
93
94         3.  Lastly, shift the responsibility of assigning a unique identifier to an attachment away from places where we
95             create attachment elements, and instead have Document enforce this when an attachment element is inserted.
96
97         Tests:  WKAttachmentTests.InsertAndRemoveDuplicateAttachment
98                 WKAttachmentTests.InsertDuplicateAttachmentAndUpdateData
99
100         * dom/Document.cpp:
101         (WebCore::Document::didInsertAttachmentElement):
102
103         Assign the unique identifier of an attachment element that has been inserted. If the identifier already tracks
104         an existing attachment element in the document or is missing, reassign the identifier to a new value.
105
106         * editing/cocoa/WebContentReaderCocoa.mm:
107         (WebCore::createFragmentForImageAttachment):
108         (WebCore::replaceRichContentWithAttachments):
109         (WebCore::WebContentReader::readFilePaths):
110
111         Remove calls to setUniqueIdentifier here, since Document will assign a unique identifier upon insertion.
112
113         * editing/markup.cpp:
114         (WebCore::StyledMarkupAccumulator::appendCustomAttributes):
115         (WebCore::createFragmentFromMarkup):
116
117         Set the attachment's unique identifier to the value of the "webkitattachmentid" attribute. When moving existing
118         attachments around in the DOM without duplication, this ensures that the attachment will be removed and
119         reinserted in the document without triggering removal and insertion client delegate methods.
120
121         When pasting an attachment element that has the same identifier as an existing attachment, we let Document
122         realize that the attachment identifier already exists, and reassign it to a unique value.
123
124         * html/HTMLAttachmentElement.cpp:
125         (WebCore::HTMLAttachmentElement::uniqueIdentifier const): Deleted.
126         (WebCore::HTMLAttachmentElement::setUniqueIdentifier): Deleted.
127         * html/HTMLAttachmentElement.h:
128
129 2018-01-08  Zalan Bujtas  <zalan@apple.com>
130
131         [RenderTreeBuilder] Move RenderBlockFlow addChild logic to RenderTreeBuilder
132         https://bugs.webkit.org/show_bug.cgi?id=181348
133         <rdar://problem/36328117>
134
135         Reviewed by Antti Koivisto.
136
137         This is about moving the code, no cleanup and/or normalization (unfortunately it also means
138         some temporary changes).  
139
140         No change in functionality.
141
142         * Sources.txt:
143         * WebCore.xcodeproj/project.pbxproj:
144         * rendering/RenderBlockFlow.cpp:
145         (WebCore::RenderBlockFlow::addChild):
146         * rendering/updating/RenderTreeBuilder.cpp:
147         (WebCore::RenderTreeBuilder::RenderTreeBuilder):
148         (WebCore::RenderTreeBuilder::insertChildToRenderBlockFlow):
149         * rendering/updating/RenderTreeBuilder.h:
150         (WebCore::RenderTreeBuilder::blockFlowBuilder):
151         * rendering/updating/RenderTreeBuilderBlockFlow.cpp: Added.
152         (WebCore::RenderTreeBuilder::BlockFlow::BlockFlow):
153         (WebCore::RenderTreeBuilder::BlockFlow::insertChild):
154         * rendering/updating/RenderTreeBuilderBlockFlow.h: Added.
155
156 2018-01-08  Youenn Fablet  <youenn@apple.com>
157
158         Add CSP support to service workers
159         https://bugs.webkit.org/show_bug.cgi?id=181385
160
161         Reviewed by Chris Dumez.
162
163         Covered by rebased tests.
164
165         Added recovery of CSP information from WorkerScriptLoader.
166         Added plumbing to pass the CSP information to Service Workers.
167         Added persistency support for the CSP information.
168
169         * workers/WorkerScriptLoader.cpp:
170         (WebCore::WorkerScriptLoader::loadAsynchronously):
171         (WebCore::WorkerScriptLoader::didReceiveResponse):
172         * workers/WorkerScriptLoader.h:
173         (WebCore::WorkerScriptLoader::contentSecurityPolicy const):
174         * workers/service/SWClientConnection.cpp:
175         (WebCore::SWClientConnection::finishedFetchingScript):
176         (WebCore::SWClientConnection::failedFetchingScript):
177         * workers/service/SWClientConnection.h:
178         * workers/service/ServiceWorkerContainer.cpp:
179         (WebCore::ServiceWorkerContainer::addRegistration):
180         (WebCore::ServiceWorkerContainer::jobFailedWithException):
181         (WebCore::ServiceWorkerContainer::jobResolvedWithRegistration):
182         (WebCore::ServiceWorkerContainer::jobFinishedLoadingScript):
183         * workers/service/ServiceWorkerContainer.h:
184         * workers/service/ServiceWorkerContextData.cpp:
185         (WebCore::ServiceWorkerContextData::isolatedCopy const):
186         * workers/service/ServiceWorkerContextData.h:
187         (WebCore::ServiceWorkerContextData::encode const):
188         (WebCore::ServiceWorkerContextData::decode):
189         * workers/service/ServiceWorkerFetchResult.h:
190         (WebCore::ServiceWorkerFetchResult::encode const):
191         (WebCore::ServiceWorkerFetchResult::decode):
192         * workers/service/ServiceWorkerGlobalScope.cpp:
193         (WebCore::ServiceWorkerGlobalScope::create):
194         * workers/service/ServiceWorkerGlobalScope.h:
195         * workers/service/ServiceWorkerJob.cpp:
196         (WebCore::ServiceWorkerJob::notifyFinished):
197         * workers/service/ServiceWorkerJobClient.h:
198         * workers/service/context/ServiceWorkerThread.cpp:
199         (WebCore::ServiceWorkerThread::ServiceWorkerThread):
200         (WebCore::ServiceWorkerThread::createWorkerGlobalScope):
201         * workers/service/server/RegistrationDatabase.cpp:
202         (WebCore::v1RecordsTableSchema):
203         (WebCore::RegistrationDatabase::openSQLiteDatabase):
204         (WebCore::RegistrationDatabase::doPushChanges):
205         (WebCore::RegistrationDatabase::importRecords):
206         * workers/service/server/SWServer.cpp:
207         (WebCore::SWServer::updateWorker):
208         (WebCore::SWServer::installContextData):
209         * workers/service/server/SWServer.h:
210         * workers/service/server/SWServerJobQueue.cpp:
211         (WebCore::SWServerJobQueue::scriptFetchFinished):
212         * workers/service/server/SWServerWorker.cpp:
213         (WebCore::SWServerWorker::SWServerWorker):
214         (WebCore::m_contentSecurityPolicy):
215         (WebCore::SWServerWorker::contextData const):
216         * workers/service/server/SWServerWorker.h:
217
218 2018-01-08  Youenn Fablet  <youenn@apple.com>
219
220         Use no-cache fetch mode when loading main documents with location.reload()
221         https://bugs.webkit.org/show_bug.cgi?id=181285
222
223         Reviewed by Alex Christensen.
224
225         Covered by rebased tests.
226
227         Start to translate cache policy used for navigation as FetchOptions::Cache.
228         This allows ensuring service workers receive the right cache mode when intercepting navigation loads.
229         To not change current navigation behavior, ReturnCacheDataElseLoad and ReturnCacheDataDontLoad still trigger default fetch cache mode.
230
231         For Reload and ReloadExpiredOnly frame load types, using no-cache mode is more efficient than reload mode,
232         as a conditional request will be sent if possible. This applies to location.reload which is consistent with other browsers.
233         Keep reload mode for ReloadFromOrigin.
234
235         * loader/DocumentLoader.cpp:
236         (WebCore::toFetchOptionsCache):
237         (WebCore::DocumentLoader::loadMainResource):
238         * loader/FrameLoader.cpp:
239         (WebCore::FrameLoader::loadFrameRequest):
240         (WebCore::FrameLoader::loadURL):
241         (WebCore::FrameLoader::load):
242         (WebCore::FrameLoader::reload):
243         (WebCore::FrameLoader::defaultRequestCachingPolicy):
244         (WebCore::FrameLoader::loadDifferentDocumentItem):
245         * loader/NavigationScheduler.cpp:
246
247 2018-01-08  Youenn Fablet  <youenn@apple.com>
248
249         Stop exposing fetch and extendable events to window
250         https://bugs.webkit.org/show_bug.cgi?id=181325
251
252         Reviewed by Chris Dumez.
253
254         Covered by updated tests.
255
256         Marked FetchEvent and ExtendableEvent as visible in ServiceWorker environments only.
257         Moved related Internals testing routines to ServiceWorkerInternals.
258
259         * testing/Internals.cpp:
260         (WebCore::Internals::waitForFetchEventToFinish): Deleted.
261         (WebCore::Internals::createBeingDispatchedFetchEvent): Deleted.
262         * testing/Internals.h:
263         * testing/Internals.idl:
264         * testing/ServiceWorkerInternals.cpp:
265         (WebCore::ServiceWorkerInternals::waitForFetchEventToFinish):
266         (WebCore::ServiceWorkerInternals::createBeingDispatchedFetchEvent):
267         * testing/ServiceWorkerInternals.h:
268         * testing/ServiceWorkerInternals.idl:
269         * workers/service/ExtendableEvent.idl:
270         * workers/service/FetchEvent.idl:
271
272 2018-01-08  Antti Koivisto  <antti@apple.com>
273
274         REGRESSION (r219145): Toggling layer borders on a static document no longer works immediately
275         https://bugs.webkit.org/show_bug.cgi?id=176260
276         <rdar://problem/34219966>
277
278         Reviewed by Simon Fraser.
279
280         Optimization reveled bugs in debug indicator painting.
281
282         Test: compositing/debug-borders-dynamic.html
283
284         * platform/graphics/ca/GraphicsLayerCA.cpp:
285         (WebCore::GraphicsLayerCA::commitLayerChangesBeforeSublayers):
286         (WebCore::GraphicsLayerCA::updateDebugIndicators):
287         (WebCore::GraphicsLayerCA::updateDebugBorder): Deleted.
288
289         - Rename to indicate this is not just about debug borders.
290         - Trigger display so repaint counters get painted. This helper is only called when the indicators change.
291
292         * platform/graphics/ca/GraphicsLayerCA.h:
293         * rendering/RenderLayerCompositor.cpp:
294         (WebCore::RenderLayerCompositor::cacheAcceleratedCompositingFlags):
295
296         Ensure we do compositing update on debug border change even when there is no layout.
297
298 2018-01-08  Zalan Bujtas <zalan@apple.com>
299
300         [RenderTreeBuilder] Move RenderInline addChild logic to RenderTreeBuilder
301         https://bugs.webkit.org/show_bug.cgi?id=181336
302         <rdar://problem/36324693>
303
304         Reviewed by Antti Koivisto.
305
306         This is about moving the code, no cleanup and/or normalization (unfortunately it also means
307         some temporary changes).  
308
309         No change in functionality.
310
311         * Sources.txt:
312         * WebCore.xcodeproj/project.pbxproj:
313         * rendering/RenderInline.cpp:
314         (WebCore::RenderInline::addChild):
315         (WebCore::RenderInline::addChildIgnoringContinuation):
316         (WebCore::RenderInline::childBecameNonInline):
317         (WebCore::nextContinuation): Deleted.
318         (WebCore::RenderInline::continuationBefore): Deleted.
319         (WebCore::newChildIsInline): Deleted.
320         (WebCore::RenderInline::cloneAsContinuation const): Deleted.
321         (WebCore::RenderInline::splitInlines): Deleted.
322         (WebCore::RenderInline::splitFlow): Deleted.
323         (WebCore::canUseAsParentForContinuation): Deleted.
324         (WebCore::RenderInline::addChildToContinuation): Deleted.
325         * rendering/RenderInline.h:
326         * rendering/updating/RenderTreeBuilder.cpp:
327         (WebCore::RenderTreeBuilder::RenderTreeBuilder):
328         (WebCore::RenderTreeBuilder::insertChildToRenderInline):
329         (WebCore::RenderTreeBuilder::insertChildToRenderInlineIgnoringContinuation):
330         (WebCore::RenderTreeBuilder::splitFlow):
331         * rendering/updating/RenderTreeBuilder.h:
332         (WebCore::RenderTreeBuilder::inlineBuilder):
333         * rendering/updating/RenderTreeBuilderInline.cpp: Added.
334         (WebCore::canUseAsParentForContinuation):
335         (WebCore::nextContinuation):
336         (WebCore::continuationBefore):
337         (WebCore::cloneAsContinuation):
338         (WebCore::newChildIsInline):
339         (WebCore::inFlowPositionedInlineAncestor):
340         (WebCore::RenderTreeBuilder::Inline::Inline):
341         (WebCore::RenderTreeBuilder::Inline::insertChild):
342         (WebCore::RenderTreeBuilder::Inline::insertChildToContinuation):
343         (WebCore::RenderTreeBuilder::Inline::insertChildIgnoringContinuation):
344         (WebCore::RenderTreeBuilder::Inline::splitFlow):
345         (WebCore::RenderTreeBuilder::Inline::splitInlines):
346         * rendering/updating/RenderTreeBuilderInline.h: Added.
347
348 2018-01-08  Zalan Bujtas  <zalan@apple.com>
349
350         [RenderTreeBuilder] Move RenderBlock addChild logic to RenderTreeBuilder
351         https://bugs.webkit.org/show_bug.cgi?id=181319
352         <rdar://problem/36313464>
353
354         Reviewed by Antti Koivisto.
355
356         This is about moving the code, no cleanup and/or normalization (unfortunately it also means
357         some temporary changes).  
358
359         No change in functionality.
360
361         * Sources.txt:
362         * WebCore.xcodeproj/project.pbxproj:
363         * rendering/RenderBlock.cpp:
364         (WebCore::RenderBlock::addChild):
365         (WebCore::RenderBlock::addChildIgnoringContinuation):
366         (WebCore::RenderBlock::childBecameNonInline):
367         (WebCore::RenderBlock::continuationBefore): Deleted.
368         (WebCore::RenderBlock::addChildToContinuation): Deleted.
369         (WebCore::getInlineRun): Deleted.
370         (WebCore::RenderBlock::makeChildrenNonInline): Deleted.
371         * rendering/RenderBlock.h:
372         * rendering/RenderBox.cpp:
373         (WebCore::markBoxForRelayoutAfterSplit): Deleted.
374         (WebCore::RenderBox::splitAnonymousBoxesAroundChild): Deleted.
375         * rendering/RenderBox.h:
376         * rendering/RenderRubyBase.cpp:
377         (WebCore::RenderRubyBase::moveChildren):
378         (WebCore::RenderRubyBase::moveBlockChildren):
379         * rendering/RenderTable.cpp:
380         (WebCore::RenderTable::addChild):
381         * rendering/RenderTableRow.cpp:
382         (WebCore::RenderTableRow::addChild):
383         * rendering/RenderTableSection.cpp:
384         (WebCore::RenderTableSection::addChild):
385         * rendering/updating/RenderTreeBuilder.cpp:
386         (WebCore::markBoxForRelayoutAfterSplit):
387         (WebCore::getInlineRun):
388         (WebCore::RenderTreeBuilder::RenderTreeBuilder):
389         (WebCore::RenderTreeBuilder::insertChildToRenderBlock):
390         (WebCore::RenderTreeBuilder::insertChildToRenderBlockIgnoringContinuation):
391         (WebCore::RenderTreeBuilder::makeChildrenNonInline):
392         (WebCore::RenderTreeBuilder::splitAnonymousBoxesAroundChild):
393         * rendering/updating/RenderTreeBuilder.h:
394         (WebCore::RenderTreeBuilder::blockBuilder):
395         * rendering/updating/RenderTreeBuilderBlock.cpp: Added.
396         (WebCore::continuationBefore):
397         (WebCore::RenderTreeBuilder::Block::Block):
398         (WebCore::RenderTreeBuilder::Block::insertChild):
399         (WebCore::RenderTreeBuilder::Block::insertChildToContinuation):
400         (WebCore::RenderTreeBuilder::Block::insertChildIgnoringContinuation):
401         * rendering/updating/RenderTreeBuilderBlock.h: Added.
402         
403 2018-01-08  Jeremy Jones  <jeremyj@apple.com>
404
405         Standard controls sometimes say video is in pip when it isnt.
406         https://bugs.webkit.org/show_bug.cgi?id=181095
407         rdar://problem/36182687
408
409         Reviewed by Eric Carlson.
410
411         * html/HTMLMediaElement.cpp:
412         (WebCore::HTMLMediaElement::exitFullscreen):
413
414 2018-01-08  Jer Noble  <jer.noble@apple.com>
415
416         REGRESSION: [iOS] ASSERTION FAILED: !node.isConnected() in WebCore::notifyNodeInsertedIntoDocument
417         https://bugs.webkit.org/show_bug.cgi?id=181091
418
419         Reviewed by Darin Adler.
420
421         Move the work previously performed in insertedIntoAncestor() into didFinishInsertingNode().
422
423         * html/HTMLMediaElement.cpp:
424         (WebCore::HTMLMediaElement::prepareForLoad):
425
426 2018-01-08  Zan Dobersek  <zdobersek@igalia.com>
427
428         [Cairo] Use isolated fill and stroke source containers
429         https://bugs.webkit.org/show_bug.cgi?id=181386
430
431         Reviewed by Carlos Garcia Campos.
432
433         Generate fill and stroke source objects upon invocation of various Cairo
434         operations, initializing necessary data from the GraphicsContextState
435         object.
436
437         Cairo::FillSource and Cairo::StrokeSource structs are introduced, both
438         being default-constructible as well as providing a constructor that
439         accepts a GraphicsContextState object from which the appropriate
440         resources are created.
441
442         The FillSource and StrokeSource objects are then passed to
443         PlatformContextCairo's prepareForFilling() and prepareForStroking()
444         methods. Here the helper prepareCairoContextSource() function is now
445         invoked with cairo_pattern_t objects as pattern or gradient sources, or
446         the source color if neither cairo_pattern_t object is specified.
447
448         The FillSource and StrokeSource constructors mimic the previous behavior
449         of prepareCairoContextSource(). In case the source is a Pattern object,
450         a cairo_pattern_t object is created from that. In case of FillSource,
451         we also retrieve pattern size, transform and repetition information. In
452         case the source os a Gradient object, we create a 'base' cairo_pattern_t
453         object for a completely opaque alpha channel. Additionally, if the alpha
454         value on the state is not 1, we create an alpha-adjusted cairo_pattern_t
455         that is potentially used for any filling or stroking operation that has
456         to preserve transparency. If neither Pattern or Gradient objects are set
457         on the GraphicsContextState, we default to the current fill or stroke
458         color.
459
460         Overall, there's no change in behavior, this is simply a refactoring
461         that enables us to construct Cairo objects for filling and stroking
462         sources at the time of Cairo operation dispatch, instead of pulling down
463         GraphicsContextState deeper into the Cairo-specific code.
464
465         No new tests -- no change in functionality.
466
467         * platform/graphics/cairo/CairoOperations.cpp:
468         (WebCore::Cairo::drawPathShadow):
469         (WebCore::Cairo::fillCurrentCairoPath):
470         (WebCore::Cairo::FillSource::FillSource):
471         (WebCore::Cairo::StrokeSource::StrokeSource):
472         (WebCore::Cairo::fillRect):
473         (WebCore::Cairo::fillRectWithRoundedHole):
474         (WebCore::Cairo::fillPath):
475         (WebCore::Cairo::strokeRect):
476         (WebCore::Cairo::strokePath):
477         (WebCore::Cairo::drawGlyphs):
478         * platform/graphics/cairo/CairoOperations.h:
479         * platform/graphics/cairo/FontCairo.cpp:
480         (WebCore::FontCascade::drawGlyphs):
481         * platform/graphics/cairo/GraphicsContextCairo.cpp:
482         (WebCore::GraphicsContext::fillPath):
483         (WebCore::GraphicsContext::strokePath):
484         (WebCore::GraphicsContext::fillRect):
485         (WebCore::GraphicsContext::strokeRect):
486         (WebCore::GraphicsContext::fillRectWithRoundedHole):
487         * platform/graphics/cairo/PlatformContextCairo.cpp:
488         (WebCore::prepareCairoContextSource):
489         (WebCore::PlatformContextCairo::prepareForFilling):
490         (WebCore::PlatformContextCairo::prepareForStroking):
491         (WebCore::PlatformContextCairo::clipForPatternFilling):
492         * platform/graphics/cairo/PlatformContextCairo.h:
493
494 2018-01-08  Youenn Fablet  <youenn@apple.com>
495
496         navigator.onLine does not work inside service workers
497         https://bugs.webkit.org/show_bug.cgi?id=181079
498         <rdar://problem/36178606>
499
500         Reviewed by Darin Adler.
501
502         Test: http/wpt/service-workers/online.https.html
503
504         Added support for onLine by reusing a similar implementation as regular workers.
505         Added ServiceWorkerInternals as an interface for an object exposed as self.internals in WTR.
506         This object has currently one method to trigger change in the online/offline status.
507         This allows writing a test for the onLine feature.
508
509         Note that self.internals is inserted asynchronously after the script was evaluated.
510         When writing a worker script using self.internals, one must make sure to use self.internals when initialized.
511         online-worker.js for instance makes use of self.internals in a postMessage callback.
512
513         * CMakeLists.txt:
514         * DerivedSources.make:
515         * WebCore.xcodeproj/project.pbxproj:
516         * bindings/js/WorkerScriptController.h:
517         * dom/ScriptExecutionContext.h:
518         * testing/ServiceWorkerInternals.cpp: Added.
519         (WebCore::ServiceWorkerInternals::ServiceWorkerInternals):
520         (WebCore::ServiceWorkerInternals::setOnline):
521         * testing/ServiceWorkerInternals.h: Added.
522         * testing/ServiceWorkerInternals.idl: Added.
523         * testing/js/WebCoreTestSupport.cpp:
524         (WebCoreTestSupport::setupNewlyCreateServiceWorker):
525         * testing/js/WebCoreTestSupport.h:
526         * workers/service/context/SWContextManager.cpp:
527         (WebCore::SWContextManager::registerServiceWorkerThreadForInstall):
528         (WebCore::SWContextManager::startedServiceWorker):
529         * workers/service/context/SWContextManager.h:
530         (WebCore::SWContextManager::setServiceWorkerCreationCallback):
531         (WebCore::SWContextManager::workerByID):
532         * workers/service/context/ServiceWorkerThread.cpp:
533         (WebCore::ServiceWorkerThread::ServiceWorkerThread):
534         * workers/service/context/ServiceWorkerThreadProxy.cpp:
535         (WebCore::ServiceWorkerThreadProxy::ServiceWorkerThreadProxy):
536         (WebCore::ServiceWorkerThreadProxy::~ServiceWorkerThreadProxy):
537         (WebCore::ServiceWorkerThreadProxy::networkStateChanged):
538         (WebCore::ServiceWorkerThreadProxy::notifyNetworkStateChange):
539         * workers/service/context/ServiceWorkerThreadProxy.h:
540
541 2018-01-08  Zan Dobersek  <zdobersek@igalia.com>
542
543         [Cairo] Contain shadow blur requirement state in a separate object
544         https://bugs.webkit.org/show_bug.cgi?id=181380
545
546         Reviewed by Carlos Garcia Campos.
547
548         Instead of picking up the necessary state parameters from a
549         GraphicsContextState object, store the necessary parameters in a helper
550         ShadowBlurUsage struct. Mimicking the mustUseShadowBlur() function that
551         is being removed, values of the shadow color, shadow blur, and shadow
552         transform ignorance are stored there. Additionally, the required()
553         method accepts a PlatformContextCairo object through which it can
554         retrieve the current CTM and determine whether it's an identity, finally
555         deciding whether shadow blur can or cannot be ignored.
556
557         Goal of this change is to limit usage of GraphicsContextState directly
558         in operations implemented inside the Cairo namespace. Instead, the
559         state parameters should be passed directly, or an equivalent but limited
560         state object should be constructed for invocation of such operations.
561
562         This is likely only an intermediate solution. It's possible it will be
563         replaced by a more complete shadow state struct that would be used for
564         any operation that is required to draw shadows, if necessary.
565
566         No new tests -- no change in functionality.
567
568         * platform/graphics/cairo/CairoOperations.cpp:
569         (WebCore::Cairo::drawGlyphsShadow):
570         (WebCore::Cairo::ShadowBlurUsage::ShadowBlurUsage):
571         (WebCore::Cairo::ShadowBlurUsage::required const):
572         (WebCore::Cairo::fillRectWithRoundedHole):
573         (WebCore::Cairo::drawGlyphs):
574         (WebCore::Cairo::mustUseShadowBlur): Deleted.
575         * platform/graphics/cairo/CairoOperations.h:
576         * platform/graphics/cairo/FontCairo.cpp:
577         (WebCore::FontCascade::drawGlyphs):
578         * platform/graphics/cairo/GraphicsContextCairo.cpp:
579         (WebCore::GraphicsContext::fillRectWithRoundedHole):
580
581 2018-01-08  Philippe Normand  <pnormand@igalia.com>
582
583         [GStreamer][Soup] Remove dead getCreateOrReadBuffer code path
584         https://bugs.webkit.org/show_bug.cgi?id=181376
585
586         Reviewed by Carlos Garcia Campos.
587
588         This code path is no longer used now that the GStreamer HTTP
589         source element uses data coming directly from the network process.
590
591         * SourcesGTK.txt:
592         * SourcesWPE.txt:
593         * loader/MediaResourceLoader.cpp:
594         (WebCore::MediaResource::getOrCreateReadBuffer): Deleted.
595         * loader/MediaResourceLoader.h:
596         * loader/SubresourceLoader.h:
597         * loader/cache/CachedRawResource.h:
598         * loader/cache/CachedRawResourceClient.h:
599         (WebCore::CachedRawResourceClient::finishedTimingForWorkerLoad):
600         (WebCore::CachedRawResourceClient::getOrCreateReadBuffer): Deleted.
601         * loader/cache/CachedResource.h:
602         (WebCore::CachedResource::getOrCreateReadBuffer): Deleted.
603         * loader/soup/CachedRawResourceSoup.cpp: Removed.
604         * loader/soup/SubresourceLoaderSoup.cpp: Removed.
605         * platform/graphics/PlatformMediaResourceLoader.h:
606         (WebCore::PlatformMediaResourceClient::loadFinished):
607         (WebCore::PlatformMediaResourceClient::getOrCreateReadBuffer): Deleted.
608         * platform/graphics/gstreamer/WebKitWebSourceGStreamer.cpp:
609         (CachedResourceStreamingClient::getOrCreateReadBuffer): Deleted.
610         * platform/network/ResourceHandleClient.h:
611         (WebCore::ResourceHandleClient::getOrCreateReadBuffer): Deleted.
612         * platform/network/soup/ResourceHandleSoup.cpp:
613         (WebCore::ResourceHandle::ensureReadBuffer):
614
615 2018-01-08  Zan Dobersek  <zdobersek@igalia.com> and Carlos Garcia Campos  <cgarcia@igalia.com>
616
617         [GStreamer] use FastMalloc-based GstAllocator
618         https://bugs.webkit.org/show_bug.cgi?id=165793
619
620         Reviewed by Philippe Normand.
621
622         Add GstAllocatorFastMalloc, a GstAllocator implementation using fast malloc. It's only used when fast malloc is
623         enabled and can be disabled using an environment variable for debugging purposes.
624
625         * platform/GStreamer.cmake:
626         * platform/graphics/gstreamer/GStreamerUtilities.cpp:
627         (WebCore::initializeGStreamer):
628         * platform/graphics/gstreamer/GstAllocatorFastMalloc.cpp: Added.
629         (gstMemoryFastMallocNew):
630         (gstAllocatorFastMallocAlloc):
631         (gstAllocatorFastMallocFree):
632         (gstAllocatorFastMallocMemMap):
633         (gstAllocatorFastMallocMemUnmap):
634         (gstAllocatorFastMallocMemCopy):
635         (gstAllocatorFastMallocMemShare):
636         (gstAllocatorFastMallocMemIsSpan):
637         (gst_allocator_fast_malloc_class_init):
638         (gst_allocator_fast_malloc_init):
639         * platform/graphics/gstreamer/GstAllocatorFastMalloc.h: Added.
640
641 2018-01-07  Ms2ger  <Ms2ger@igalia.com>
642
643         Implement createImageBitmap(ImageBitmap)
644         https://bugs.webkit.org/show_bug.cgi?id=181287
645
646         Reviewed by Darin Adler.
647
648         Tests: imported/w3c/web-platform-tests/2dcontext/imagebitmap/createImageBitmap-drawImage.html
649                imported/w3c/web-platform-tests/2dcontext/imagebitmap/createImageBitmap-invalid-args.html
650
651         * html/ImageBitmap.cpp:
652         (WebCore::ImageBitmap::createPromise):
653
654 2018-01-07  Ryosuke Niwa  <rniwa@webkit.org>
655
656         Reduce the precision of "high" resolution time to 1ms
657         https://bugs.webkit.org/show_bug.cgi?id=180910
658         <rdar://problem/36085943>
659
660         Reviewed by Saam Barati.
661
662         Reduced the high prevision time's resolution to 1ms, the same precision as Date.now().
663
664         Also fixed the bug in fillRTCStats that we weren't reducing the time resolution in RTCStats dictionaries.
665
666         * Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.cpp:
667         (WebCore::fillRTCStats):
668         * page/Performance.cpp:
669         (WebCore::Performance::reduceTimeResolution):
670
671 2018-01-06  Simon Fraser  <simon.fraser@apple.com>
672
673         Possible crash computing event regions
674         https://bugs.webkit.org/show_bug.cgi?id=181368
675         rdar://problem/34847081
676
677         Reviewed by Zalan Bujtas.
678
679         Don't trigger layout in Element::absoluteEventHandlerBounds(), since this can run arbirary script
680         which might delete elements or re-enter Document::absoluteRegionForEventTargets().
681
682         It's OK to not trigger layout, because if layout is dirty, the next layout will update event regions again.
683
684         Add a LayoutDisallowedScope to check that Document::absoluteRegionForEventTargets() doesn't
685         trigger layout, and move the check for LayoutDisallowedScope::isLayoutAllowed() from Document::updateLayout()
686         to LayoutContext::layout(), since some layouts don't happen via the former (e.g. the one being removed here).
687
688         The test checks that the assertion does not fire. I was not able to get a reliable test for any crash.
689
690         Test: fast/events/event-handler-regions-layout.html
691
692         * dom/Document.cpp:
693         (WebCore::Document::updateLayout):
694         (WebCore::Document::absoluteRegionForEventTargets):
695         * dom/Element.cpp:
696         (WebCore::Element::absoluteEventHandlerBounds):
697         * page/LayoutContext.cpp:
698         (WebCore::LayoutContext::layout):
699         * rendering/LayoutDisallowedScope.h: Move the #ifdefs around to avoid defining the enum twice.
700         (WebCore::LayoutDisallowedScope::LayoutDisallowedScope):
701         (WebCore::LayoutDisallowedScope::isLayoutAllowed):
702
703 2018-01-06  Simon Fraser  <simon.fraser@apple.com>
704
705         Crash under RenderLayer::scrollTo() with marquee
706         https://bugs.webkit.org/show_bug.cgi?id=181349
707         rdar://problem/36190168
708
709         Reviewed by Zalan Bujtas.
710
711         Don't call updateWidgetPositions() synchonously during RenderLayer scrolling, because it
712         can run arbitrary script which may trigger destruction of this RenderLayer.
713
714         Instead, queue up updateWidgetPositions() on a zero-delay timer.
715
716         Under some circumstances this may allow a paint to occur before the widgets have been
717         updated (which could be fixed with a more invasive change), but in practice I saw no
718         painting issues with plug-ins or iframes inside overflow scroll, in WebKit or LegacyWebKit.
719
720         Test: fast/scrolling/marquee-scroll-crash.html
721
722         * page/FrameView.cpp:
723         (WebCore::FrameView::FrameView):
724         (WebCore::FrameView::updateWidgetPositions):
725         (WebCore::FrameView::scheduleUpdateWidgetPositions):
726         (WebCore::FrameView::updateWidgetPositionsTimerFired):
727         * page/FrameView.h:
728         * rendering/RenderLayer.cpp:
729         (WebCore::RenderLayer::scrollTo):
730
731 2018-01-05  Dean Jackson  <dino@apple.com>
732
733         Accurately clip copyTexImage2D and copyTexSubImage2D
734         https://bugs.webkit.org/show_bug.cgi?id=181356
735         <rdar://problem/35083877>
736
737         Reviewed by Eric Carlson.
738
739         The code to make sure copyTexSubImage2D and copyTexImage2D will not try to read
740         out of bounds had a bad bug introduced here:
741         https://bugs.webkit.org/show_bug.cgi?id=51421
742
743         With appropriate parameters, it would produce a rectangle with
744         negative dimensions. Most GL drivers just ignored this, but some
745         are not happy.
746
747         Test: fast/canvas/webgl/copy-tex-image-and-sub-image-2d-bad-input.html
748
749         * html/canvas/WebGLRenderingContextBase.cpp:
750         (WebCore::clip2D): Reimplement this in a more sane manner, and use
751         checked arithmetic while here.
752         * html/canvas/WebGLRenderingContextBase.h:
753         (WebCore::clip1D): Deleted.
754         (WebCore::clip2D): Deleted.
755
756 2018-01-06  Antti Koivisto  <antti@apple.com>
757
758         Use WeakPtr for RenderTreePosition::m_nextSibling
759         https://bugs.webkit.org/show_bug.cgi?id=181363
760
761         Reviewed by Zalan Bujtas.
762
763         For safety. In most cases it is null and won't cause us to instantiate WeakReferences for
764         many new objects.
765
766         * rendering/updating/RenderTreePosition.cpp:
767         (WebCore::RenderTreePosition::computeNextSibling):
768         * rendering/updating/RenderTreePosition.h:
769         (WebCore::RenderTreePosition::RenderTreePosition):
770         (WebCore::RenderTreePosition::nextSibling const):
771
772 2018-01-05  David Kilzer  <ddkilzer@apple.com>
773
774         Re-enable -Wcast-qual in WebCore for Apple ports
775         <https://webkit.org/b/177895>
776         <rdar://problem/34960830>
777
778         Reviewed by Joseph Pecoraro.
779
780         * Configurations/Base.xcconfig:
781         (WARNING_CFLAGS): Remove FIXME and add -Wcast-qual back to
782         arguments.
783
784         * crypto/mac/SerializedCryptoKeyWrapMac.mm:
785         (WebCore::createAndStoreMasterKey):
786         - Use checked_cf_cast<SecACLRef>().
787
788         * editing/cocoa/DataDetection.mm:
789         (WebCore::detectItemAtPositionWithRange):
790         - Manually cast CFTypeRef to DDResultRef until
791           DDResultGetTypeID() is available as SPI.
792
793         * platform/gamepad/mac/HIDGamepad.cpp:
794         (WebCore::HIDGamepad::initElementsFromArray):
795         - Use checked_cf_cast<IOHIDElementRef>().
796
797         * platform/graphics/avfoundation/objc/MediaSampleAVFObjC.mm:
798         (WebCore::MediaSampleAVFObjC::createImageSample):
799         (WebCore::CMSampleBufferIsRandomAccess):
800         (WebCore::CMSampleBufferIsNonDisplaying):
801         (WebCore::MediaSampleAVFObjC::createNonDisplayingCopy const):
802         - Use checked_cf_cast<CFMutableDictionaryRef>() and
803           checked_cf_cast<CFDictionaryRef>().
804
805         * platform/graphics/cocoa/IOSurface.h:
806         (WebCore::IOSurface::asLayerContents):
807         - Use reinterpret_cast<id>() to cast from IOSurfaceRef to id.
808
809         * platform/graphics/cocoa/WebCoreDecompressionSession.mm:
810         (WebCore::WebCoreDecompressionSession::getFirstVideoFrame):
811         (WebCore::WebCoreDecompressionSession::automaticDequeue):
812         (WebCore::WebCoreDecompressionSession::imageForTime):
813         (WebCore::WebCoreDecompressionSession::getDecodeTime):
814         (WebCore::WebCoreDecompressionSession::getPresentationTime):
815         (WebCore::WebCoreDecompressionSession::getDuration):
816         - Use checked_cf_cast<CMSampleBufferRef>().
817
818         * platform/graphics/Font.h:
819         (WebCore::Font::m_kernedCFStringAttributes):
820         (WebCore::Font::m_nonKernedCFStringAttributes):
821         - Change type from RetainPtr<CFDictionaryRef> to
822           RetainPtr<CFMutableDictionaryRef> since that's what they are.
823         * platform/graphics/mac/SimpleFontDataCoreText.cpp:
824         (WebCore::Font::getCFStringAttributes const):
825         - Replace local `mutableAttributes` variable with
826           `attributesDictionary.get()` since it returns the correct type
827           now.
828
829         * platform/ios/wak/WAKView.mm:
830         (-[WAKView _initWithViewRef:]):
831         (_WAKCopyWrapper):
832         * platform/ios/wak/WKView.mm:
833         (_WKViewClearSuperview):
834         (WKViewFirstChild):
835         (WKViewNextSibling):
836         - Use static_cast<WKViewRef>(const_cast<void*>()) to convert
837           const void* variable to WKViewRef.
838
839         * platform/mac/PasteboardMac.mm:
840         (WebCore::flipImageSpec):
841         (WebCore::setDragImageImpl):
842         - Use const_cast<> to remove 'const' modifier from
843           unsigned char pointers.  This regressed while -Wcast-qual was
844           disabled for WebCore.
845
846         * platform/mac/SSLKeyGeneratorMac.mm:
847         (WebCore::signedPublicKeyAndChallengeString):
848         - Use checked_cf_cast<SecACLRef>().
849
850         * platform/mediastream/mac/RealtimeIncomingVideoSourceCocoa.cpp:
851         (WebCore::RealtimeIncomingVideoSourceCocoa::OnFrame):
852         - Use checked_cf_cast<CFMutableDictionaryRef>().
853
854         * platform/network/cf/SocketStreamHandleImplCFNet.cpp:
855         (WebCore::copyCONNECTProxyResponse):
856         - Use checked_cf_cast<CFHTTPMessageRef>().
857
858         * platform/network/cocoa/ResourceResponseCocoa.mm:
859         (WebCore::ResourceResponse::platformCertificateInfo const):
860         - Use checked_cf_cast<SecTrustRef>().
861
862         * platform/network/mac/CertificateInfoMac.mm:
863         (WebCore::CertificateInfo::containsNonRootSHA1SignedCertificate const):
864         (WebCore::CertificateInfo::dump const):
865         - Use checked_cf_cast<SecCertificateRef>().
866
867         * testing/cocoa/WebArchiveDumpSupport.mm:
868         (WebCoreTestSupport::createCFURLResponseFromResponseData):
869         - Use checked_cf_cast<>() for CFMutable* types.
870
871 2018-01-05  John Wilander  <wilander@apple.com>
872
873         Storage Access API: Refactor to make naming accurate and explicit, simplify access table, and prepare for access removal for page
874         https://bugs.webkit.org/show_bug.cgi?id=181357
875         <rdar://problem/36331031>
876
877         Reviewed by Alex Christensen.
878
879         No new tests. The only changed functionality that isn't covered
880         by existing tests is cross-origin iframes in the same partition
881         should be handled as already having access. This cannot be
882         tested in layout tests since they don't support subdomains.
883
884         This change does the following:
885         - Changes function and message names to reflect how this feature
886           was eventually implemented, i.e. access per frame.
887         - Makes it explicit that the UI process is only involved in
888           granting storage access and not removing storage access.
889           The latter is done directly by the web process.
890         - Simplifies the network process' entry map since only needs to
891           be able to give access to one domain in one frame at a time.
892           Access goes away on frame navigation so there can only be one
893           domain at a time per frame. Also, the map now uses pageIDs as
894           main keys to prepare for efficient access removal for all
895           frames under a page.
896         - Fixes a bug in so that a cross-origin iframe with the same
897           partition as the top frame correctly is handled as already
898           having access.
899
900         * platform/network/NetworkStorageSession.h:
901         * platform/network/cf/NetworkStorageSessionCFNet.cpp:
902         (WebCore::NetworkStorageSession::cookieStoragePartition const):
903             The only change here is the changed named of the call to
904             NetworkStorageSession::hasStorageAccessForFrame().
905         (WebCore::NetworkStorageSession::hasStorageAccessForFrame const):
906         (WebCore::NetworkStorageSession::grantStorageAccessForFrame):
907         (WebCore::NetworkStorageSession::removeStorageAccessForFrame):
908         (WebCore::NetworkStorageSession::isStorageAccessGranted const): Deleted.
909         (WebCore::NetworkStorageSession::setStorageAccessGranted): Deleted.
910         (WebCore::NetworkStorageSession::removeStorageAccess): Deleted.
911
912 2018-01-05  Youenn Fablet  <youenn@apple.com>
913
914         Implement Cache API partitioning based on ClientOrigin
915         https://bugs.webkit.org/show_bug.cgi?id=181240
916
917         Reviewed by Alex Christensen.
918
919         Covered by updated tests.
920
921         Previously, cache storage was partitioned according the origin of the client, represented as a String.
922         We now partition according both client and top origins, represented as a ClientOrigin
923
924         Minor refactoring to use more makePendingActivity.
925         Added support for IPC serialization of ClientOrigin.
926         Added SecurityOriginData::toString which is used by WebKit2 Cache Storage implementation.
927
928         * Modules/cache/CacheStorageConnection.cpp:
929         (WebCore::CacheStorageConnection::open):
930         (WebCore::CacheStorageConnection::retrieveCaches):
931         * Modules/cache/CacheStorageConnection.h:
932         (WebCore::CacheStorageConnection::clearMemoryRepresentation):
933         (WebCore::CacheStorageConnection::doOpen):
934         (WebCore::CacheStorageConnection::doRetrieveCaches):
935         * Modules/cache/DOMCacheStorage.cpp:
936         (WebCore::DOMCacheStorage::origin const):
937         (WebCore::DOMCacheStorage::retrieveCaches):
938         (WebCore::DOMCacheStorage::open):
939         (WebCore::DOMCacheStorage::remove):
940         * Modules/cache/DOMCacheStorage.h:
941         * Modules/cache/WorkerCacheStorageConnection.cpp:
942         (WebCore::WorkerCacheStorageConnection::doOpen):
943         (WebCore::WorkerCacheStorageConnection::doRetrieveCaches):
944         * Modules/cache/WorkerCacheStorageConnection.h:
945         * page/ClientOrigin.h:
946         (WebCore::ClientOrigin::isolatedCopy const):
947         (WebCore::ClientOrigin::encode const):
948         (WebCore::ClientOrigin::decode):
949         * page/SecurityOriginData.cpp:
950         (WebCore::SecurityOriginData::toString const):
951         (WebCore::SecurityOriginData::debugString const): Deleted.
952         * page/SecurityOriginData.h:
953         (WebCore::SecurityOriginData::debugString const):
954         * testing/Internals.cpp:
955         (WebCore::Internals::clearCacheStorageMemoryRepresentation):
956
957 2018-01-05  Wenson Hsieh  <wenson_hsieh@apple.com>
958
959         [Attachment Support] Add a way to write blob data to a file URL from the UI process
960         https://bugs.webkit.org/show_bug.cgi?id=181236
961
962         Reviewed by Brady Eidson.
963
964         Add support for writing a blob to a designated file path. See comments below for more detail. No new tests, as
965         there change in behavior yet. See part 2: https://bugs.webkit.org/show_bug.cgi?id=181199.
966
967         * page/DragController.cpp:
968         (WebCore::DragController::dragAttachmentElement):
969         * platform/PromisedBlobInfo.h:
970
971         Remove PromisedBlobData entirely. This was added with the premise of having the web process deliver blob data to
972         the UI process. However, the new approach I'm taking just has the UI process tell the network process to write
973         a blob to a given location, so a data structure to deliver blob data over IPC is no longer necessary.
974
975         (WebCore::PromisedBlobData::hasData const): Deleted.
976         (WebCore::PromisedBlobData::hasFile const): Deleted.
977         (WebCore::PromisedBlobData::operator bool const): Deleted.
978         (WebCore::PromisedBlobData::fulfills const): Deleted.
979         * platform/network/BlobRegistryImpl.cpp:
980         (WebCore::BlobRegistryImpl::populateBlobsForFileWriting):
981
982         Introduce a new helper to build a list of blob data for file writing.
983
984         (WebCore::writeFilePathsOrDataBuffersToFile):
985
986         Introduce a new static helper to write blob data (a list of file paths and data buffers) to a given file handle.
987         Automatically closes the given file handle upon exit.
988
989         (WebCore::BlobRegistryImpl::writeBlobsToTemporaryFiles):
990         (WebCore::BlobRegistryImpl::writeBlobToFilePath):
991
992         Pull out common logic in writeBlobsToTemporaryFiles and writeBlobToFilePath into helper methods (see above), and
993         refactor both methods to use the helpers.
994
995         * platform/network/BlobRegistryImpl.h:
996
997 2018-01-05  Alex Christensen  <achristensen@webkit.org>
998
999         Forbid < and > in URL hosts
1000         https://bugs.webkit.org/show_bug.cgi?id=181308
1001         <rdar://problem/36012757>
1002
1003         Reviewed by Tim Horton.
1004
1005         https://url.spec.whatwg.org/#forbidden-host-code-point does not include these characters yet, but I think it should.
1006         Firefox fails to parse URLs with < or > in the host.  Chrome percent encodes them.  Safari needs to do something.
1007         The web platform tests are unclear on this case, and they will need to be updated with the specification.
1008         They do show a change in behavior, though.
1009
1010         * platform/URLParser.cpp:
1011         Add < and > to the list of forbidden host code points.
1012
1013 2018-01-05  Eric Carlson  <eric.carlson@apple.com>
1014
1015         [MediaStream] Add Mac screen capture source
1016         https://bugs.webkit.org/show_bug.cgi?id=181333
1017         <rdar://problem/36323219>
1018
1019         Reviewed by Dean Jackson.
1020
1021         * SourcesCocoa.txt: Add ScreenDisplayCaptureSourceMac.mm.
1022
1023         * WebCore.xcodeproj/project.pbxproj: Ditto.
1024
1025         * platform/cocoa/CoreVideoSoftLink.cpp: Declare new constants used.
1026         * platform/cocoa/CoreVideoSoftLink.h:
1027
1028         * platform/mediastream/mac/DisplayCaptureManagerCocoa.cpp:
1029         (WebCore::displayReconfigurationCallBack): Call refreshCaptureDevices.
1030         (WebCore::DisplayCaptureManagerCocoa::~DisplayCaptureManagerCocoa): Unregister for display
1031         reconfiguration callbacks.
1032         (WebCore::DisplayCaptureManagerCocoa::captureDevices): Register for display reconfigrations.
1033         (WebCore::DisplayCaptureManagerCocoa::refreshCaptureDevices): Use CGActiveDisplayList to
1034         get list of active screens.
1035         (WebCore::DisplayCaptureManagerCocoa::screenCaptureDeviceWithPersistentID): Validate screen
1036         ID, return CaptureDevice.
1037         * platform/mediastream/mac/DisplayCaptureManagerCocoa.h:
1038
1039         * platform/mediastream/mac/RealtimeMediaSourceCenterMac.cpp:
1040         (WebCore::VideoCaptureSourceFactoryMac::createVideoCaptureSource): Deal with screen capture
1041         on macOS.
1042
1043         Implement Mac screen capture with CGDisplayStream.
1044         * platform/mediastream/mac/ScreenDisplayCaptureSourceMac.h: Added.
1045         (WebCore::ScreenDisplayCaptureSourceMac::DisplaySurface::~DisplaySurface):
1046         (WebCore::ScreenDisplayCaptureSourceMac::DisplaySurface::operator=):
1047         (WebCore::ScreenDisplayCaptureSourceMac::DisplaySurface::ioSurface const):
1048         * platform/mediastream/mac/ScreenDisplayCaptureSourceMac.mm: Added.
1049         (WebCore::roundUpToMacroblockMultiple):
1050         (WebCore::ScreenDisplayCaptureSourceMac::updateDisplayID):
1051         (WebCore::ScreenDisplayCaptureSourceMac::create):
1052         (WebCore::ScreenDisplayCaptureSourceMac::ScreenDisplayCaptureSourceMac):
1053         (WebCore::ScreenDisplayCaptureSourceMac::~ScreenDisplayCaptureSourceMac):
1054         (WebCore::ScreenDisplayCaptureSourceMac::createDisplayStream):
1055         (WebCore::ScreenDisplayCaptureSourceMac::startProducingData):
1056         (WebCore::ScreenDisplayCaptureSourceMac::stopProducingData):
1057         (WebCore::ScreenDisplayCaptureSourceMac::sampleBufferFromPixelBuffer):
1058         (WebCore::ScreenDisplayCaptureSourceMac::pixelBufferFromIOSurface):
1059         (WebCore::ScreenDisplayCaptureSourceMac::generateFrame):
1060         (WebCore::ScreenDisplayCaptureSourceMac::startDisplayStream):
1061         (WebCore::ScreenDisplayCaptureSourceMac::applySize):
1062         (WebCore::ScreenDisplayCaptureSourceMac::applyFrameRate):
1063         (WebCore::ScreenDisplayCaptureSourceMac::commitConfiguration):
1064         (WebCore::ScreenDisplayCaptureSourceMac::displayWasReconfigured):
1065         (WebCore::ScreenDisplayCaptureSourceMac::displayReconfigurationCallBack):
1066         (WebCore::ScreenDisplayCaptureSourceMac::frameAvailable):
1067
1068 2018-01-05  Don Olmstead  <don.olmstead@sony.com>
1069
1070         [curl] Can't load file:// URL with a URL fragment identifier
1071         https://bugs.webkit.org/show_bug.cgi?id=181170
1072
1073         Reviewed by Alex Christensen.
1074
1075         No new tests. No change in behavior.
1076
1077         * platform/network/curl/CurlRequest.cpp:
1078         (WebCore::CurlRequest::invokeDidReceiveResponseForFile):
1079
1080 2018-01-05  Don Olmstead  <don.olmstead@sony.com>
1081
1082         TextCodec uses std::array but does not include it
1083         https://bugs.webkit.org/show_bug.cgi?id=181340
1084
1085         Reviewed by Alex Christensen.
1086
1087         No new tests. No change in behavior.
1088
1089         * platform/text/TextCodec.h:
1090
1091 2018-01-05  Said Abou-Hallawa  <sabouhallawa@apple.com>
1092
1093         SVGAnimatedListPropertyTearOff::synchronizeWrappersIfNeeded() should do nothing if the property is not animating
1094         https://bugs.webkit.org/show_bug.cgi?id=181316
1095         <rdar://problem/36147545>
1096
1097         Reviewed by Simon Fraser.
1098
1099         This is a speculative change to fix a crash which appeared after r226065.
1100         The crash is very intermittent and sometimes very hard to reproduce. The
1101         basic code analysis did not show how this crash can even happen.
1102
1103         * svg/SVGAnimatedTypeAnimator.h:
1104         (WebCore::SVGAnimatedTypeAnimator::resetFromBaseValues): For SVG property
1105         with two values, e.g. <SVGAngleValue, SVGMarkerOrientType>,  we need to
1106         detach the wrappers of the animated property if the animated values are
1107         going to change. This is similar to what we did in resetFromBaseValue().
1108
1109         * svg/properties/SVGAnimatedListPropertyTearOff.h:
1110         (WebCore::SVGAnimatedListPropertyTearOff::synchronizeWrappersIfNeeded):
1111
1112 2018-01-05  Matt Lewis  <jlewis3@apple.com>
1113
1114         Unreviewed, rolling out r226401.
1115
1116         This caused timeouts on multiple platforms.
1117
1118         Reverted changeset:
1119
1120         "Implement Cache API partitioning based on ClientOrigin"
1121         https://bugs.webkit.org/show_bug.cgi?id=181240
1122         https://trac.webkit.org/changeset/226401
1123
1124 2018-01-05  Dan Bernstein  <mitz@apple.com>
1125
1126         Fixed the build following AppKit API deprecations in a recent SDKs
1127
1128         * platform/mac/PasteboardMac.mm:
1129         (WebCore::setDragImageImpl): Suppressed deprecation warnings.
1130         * platform/mac/WidgetMac.mm:
1131         (WebCore::Widget::paint): Ditto.
1132
1133 2018-01-05  Joseph Pecoraro  <pecoraro@apple.com>
1134
1135         ServiceWorkers: Enable UserTiming / ResourceTiming
1136         https://bugs.webkit.org/show_bug.cgi?id=181297
1137         <rdar://problem/36307306>
1138
1139         Reviewed by Youenn Fablet.
1140
1141         Tests: http/tests/workers/service/service-worker-resource-timing.https.html
1142                http/tests/workers/service/service-worker-user-timing.https.html
1143
1144         * loader/ResourceTiming.cpp:
1145         (WebCore::ResourceTiming::ResourceTiming):
1146         We used to clear extra NetworkLoadMetrics data early on. However,
1147         for Workers we want to pass the complete NetworkLoadMetrics to
1148         the Worker so that a Worker inspector has access to it.
1149
1150         * page/PerformanceResourceTiming.cpp:
1151         (WebCore::PerformanceResourceTiming::PerformanceResourceTiming):
1152         Instead move the clearing of extra data to here, when the NetworkLoadMetrics
1153         have finally settled into being used only for a performance entry.
1154
1155 2018-01-04  Philippe Normand  <pnormand@igalia.com>
1156
1157         [EME][GStreamer] Fix wrong ifdef
1158         https://bugs.webkit.org/show_bug.cgi?id=181289
1159
1160         Reviewed by Alex Christensen.
1161
1162         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:
1163         (WebCore::MediaPlayerPrivateGStreamer::handleMessage): Remove the
1164         ENCRYPTED_MEDIA ifdef from the VIDEO_TRACK ifdef block. Both have
1165         nothing to do together.
1166
1167 2018-01-05  Fujii Hironori  <Hironori.Fujii@sony.com>
1168
1169         [Cairo] Canvas: Path::clear should clear its transform
1170         https://bugs.webkit.org/show_bug.cgi?id=181320
1171
1172         Reviewed by Carlos Garcia Campos.
1173
1174         Path of Cairo port has its cairo context. Path::clear() didn't
1175         clear the transform matrix of the context.
1176
1177         Test: fast/canvas/reset-scaling-by-height-change.html
1178
1179         * platform/graphics/cairo/PathCairo.cpp:
1180         (WebCore::Path::clear): Reset the transform matrix of Path.
1181
1182 2018-01-04  Devin Rousso  <webkit@devinrousso.com>
1183
1184         Web Inspector: replace HTMLCanvasElement with CanvasRenderingContext for instrumentation logic
1185         https://bugs.webkit.org/show_bug.cgi?id=180770
1186
1187         Reviewed by Joseph Pecoraro.
1188
1189         No change in functionality.
1190
1191         * html/HTMLCanvasElement.h:
1192         * html/HTMLCanvasElement.cpp:
1193         (WebCore::HTMLCanvasElement::createContext2d):
1194         (WebCore::HTMLCanvasElement::createContextWebGL):
1195         (WebCore::HTMLCanvasElement::createContextWebGPU):
1196         (WebCore::HTMLCanvasElement::createContextBitmapRenderer):
1197         (WebCore::HTMLCanvasElement::reset):
1198         (WebCore::HTMLCanvasElement::paint):
1199         (WebCore::HTMLCanvasElement::setImageBuffer const):
1200         (WebCore::HTMLCanvasElement::addObserver): Deleted.
1201         (WebCore::HTMLCanvasElement::removeObserver): Deleted.
1202         (WebCore::HTMLCanvasElement::cssCanvasClients): Deleted.
1203         (WebCore::HTMLCanvasElement::notifyObserversCanvasChanged): Deleted.
1204         * html/OffscreenCanvas.h:
1205         * html/canvas/CanvasRenderingContext.h:
1206         * html/canvas/CanvasRenderingContext.cpp:
1207         * html/canvas/CanvasRenderingContext2D.h:
1208         * html/canvas/CanvasRenderingContext2D.cpp:
1209         (WebCore::CanvasRenderingContext2D::create):
1210         * html/canvas/CanvasRenderingContext2DBase.h:
1211         * html/canvas/ImageBitmapRenderingContext.h:
1212         * html/canvas/ImageBitmapRenderingContext.cpp:
1213         (WebCore::ImageBitmapRenderingContext::create):
1214         * html/canvas/WebGL2RenderingContext.h:
1215         * html/canvas/WebGL2RenderingContext.cpp:
1216         (WebCore::WebGL2RenderingContext::create):
1217         * html/canvas/WebGLRenderingContext.h:
1218         * html/canvas/WebGLRenderingContext.cpp:
1219         (WebCore::WebGLRenderingContext::create):
1220         * html/canvas/WebGLRenderingContextBase.h:
1221         * html/canvas/WebGLRenderingContextBase.cpp:
1222         (WebCore::WebGLRenderingContextBase::create):
1223         * html/canvas/WebGPURenderingContext.cpp:
1224         (WebCore::WebGPURenderingContext::create):
1225         Instead of adding didCreateCanvasRenderingContext calls at the construction sites of each
1226         context, we can make the constructors private and force the usage of static `create` functions.
1227         This way, we have access to the fully constructed object and have a guaranteed path for creation.
1228
1229         * html/CanvasBase.h:
1230         * html/CanvasBase.cpp:
1231         (WebCore::CanvasBase::~CanvasBase):
1232         (WebCore::CanvasBase::renderingContext const):
1233         (WebCore::CanvasBase::addObserver):
1234         (WebCore::CanvasBase::removeObserver):
1235         (WebCore::CanvasBase::notifyObserversCanvasChanged):
1236         (WebCore::CanvasBase::notifyObserversCanvasResized):
1237         (WebCore::CanvasBase::notifyObserversCanvasDestroyed):
1238         (WebCore::CanvasBase::cssCanvasClients const):
1239         * Modules/mediastream/CanvasCaptureMediaStreamTrack.h:
1240         * Modules/mediastream/CanvasCaptureMediaStreamTrack.cpp:
1241         (WebCore::CanvasCaptureMediaStreamTrack::Source::canvasDestroyed):
1242         (WebCore::CanvasCaptureMediaStreamTrack::Source::canvasResized):
1243         (WebCore::CanvasCaptureMediaStreamTrack::Source::canvasChanged):
1244         * css/CSSCanvasValue.h:
1245         Move the CanvasObserver class to CanvasBase so that it can also be used for OffscreenCanvas.
1246
1247         * inspector/InspectorInstrumentation.h:
1248         (WebCore::InspectorInstrumentation::didChangeCSSCanvasClientNodes):
1249         (WebCore::InspectorInstrumentation::didCreateCanvasRenderingContext):
1250         (WebCore::InspectorInstrumentation::didChangeCanvasMemory):
1251         (WebCore::InspectorInstrumentation::recordCanvasAction):
1252         (WebCore::InspectorInstrumentation::didFinishRecordingCanvasFrame):
1253         (WebCore::InspectorInstrumentation::didEnableExtension):
1254         (WebCore::InspectorInstrumentation::didCreateProgram):
1255         (WebCore::InspectorInstrumentation::willDeleteProgram):
1256         (WebCore::InspectorInstrumentation::isShaderProgramDisabled):
1257         (WebCore::InspectorInstrumentation::consoleStartRecordingCanvas):
1258         (WebCore::InspectorInstrumentation::didCreateCSSCanvas): Deleted.
1259         * inspector/InspectorInstrumentation.cpp:
1260         (WebCore::InspectorInstrumentation::consoleStartRecordingCanvasImpl):
1261         (WebCore::InspectorInstrumentation::didChangeCSSCanvasClientNodesImpl):
1262         (WebCore::InspectorInstrumentation::didCreateCanvasRenderingContextImpl):
1263         (WebCore::InspectorInstrumentation::didChangeCanvasMemoryImpl):
1264         (WebCore::InspectorInstrumentation::didFinishRecordingCanvasFrameImpl):
1265         (WebCore::InspectorInstrumentation::didEnableExtensionImpl):
1266         (WebCore::InspectorInstrumentation::didCreateProgramImpl):
1267         (WebCore::InspectorInstrumentation::didCreateCSSCanvasImpl): Deleted.
1268
1269         * inspector/agents/InspectorCanvasAgent.h:
1270         * inspector/agents/InspectorCanvasAgent.cpp:
1271         (WebCore::InspectorCanvasAgent::enable):
1272         (WebCore::InspectorCanvasAgent::requestNode):
1273         (WebCore::InspectorCanvasAgent::requestContent):
1274         (WebCore::InspectorCanvasAgent::requestCSSCanvasClientNodes):
1275         (WebCore::contextAsScriptValue):
1276         (WebCore::InspectorCanvasAgent::resolveCanvasContext):
1277         (WebCore::InspectorCanvasAgent::startRecording):
1278         (WebCore::InspectorCanvasAgent::stopRecording):
1279         (WebCore::InspectorCanvasAgent::updateShader):
1280         (WebCore::InspectorCanvasAgent::frameNavigated):
1281         (WebCore::InspectorCanvasAgent::didChangeCSSCanvasClientNodes):
1282         (WebCore::InspectorCanvasAgent::didCreateCanvasRenderingContext):
1283         (WebCore::InspectorCanvasAgent::didChangeCanvasMemory):
1284         (WebCore::InspectorCanvasAgent::recordCanvasAction):
1285         (WebCore::InspectorCanvasAgent::canvasDestroyed):
1286         (WebCore::InspectorCanvasAgent::didFinishRecordingCanvasFrame):
1287         (WebCore::InspectorCanvasAgent::consoleStartRecordingCanvas):
1288         (WebCore::InspectorCanvasAgent::didEnableExtension):
1289         (WebCore::InspectorCanvasAgent::didCreateProgram):
1290         (WebCore::InspectorCanvasAgent::canvasRecordingTimerFired):
1291         (WebCore::InspectorCanvasAgent::clearCanvasData):
1292         (WebCore::InspectorCanvasAgent::unbindCanvas):
1293         (WebCore::InspectorCanvasAgent::findInspectorCanvas):
1294         (WebCore::InspectorCanvasAgent::unbindProgram):
1295         (WebCore::InspectorCanvasAgent::didCreateCSSCanvas): Deleted.
1296
1297         * inspector/InspectorCanvas.h:
1298         * inspector/InspectorCanvas.cpp:
1299         (WebCore::InspectorCanvas::create):
1300         (WebCore::InspectorCanvas::InspectorCanvas):
1301         (WebCore::InspectorCanvas::canvasElement):
1302         (WebCore::InspectorCanvas::resetRecordingData):
1303         (WebCore::InspectorCanvas::recordAction):
1304         (WebCore::InspectorCanvas::buildObjectForCanvas):
1305         (WebCore::InspectorCanvas::getCanvasContentAsDataURL):
1306         (WebCore::InspectorCanvas::buildInitialState):
1307         (WebCore::InspectorCanvas::~InspectorCanvas): Deleted.
1308
1309         * inspector/InspectorShaderProgram.h:
1310         * inspector/InspectorShaderProgram.cpp:
1311         (WebCore::InspectorShaderProgram::context const):
1312
1313         * page/PageConsoleClient.cpp:
1314         (WebCore::PageConsoleClient::record):
1315         (WebCore::PageConsoleClient::recordEnd):
1316
1317         * dom/Document.h:
1318         * dom/Document.cpp:
1319         (WebCore::Document::getCSSCanvasElement):
1320         (WebCore::Document::nameForCSSCanvasElement const):
1321         We have no reason to save the CSS canvas name for each InspectorCanvas object, so instead we
1322         can just query for the name based on the CanvasRenderingContext's HTMLCanvasElement (assuming
1323         it is not an OffscreenCanvas) when we need it.
1324
1325 2018-01-04  Chris Fleizach  <cfleizach@apple.com>
1326
1327         AX: Implement updated CSS3 Speech for 'speak' and 'speak-as' properties
1328         https://bugs.webkit.org/show_bug.cgi?id=180361
1329
1330         Reviewed by Zalan Bujtas.
1331
1332         Change speak -> speakAs, and allow a combination of properties.
1333
1334         Tests: Updated accessibility/mac/css-speech-speak.html
1335
1336         * accessibility/AccessibilityObject.h:
1337         (WebCore::AccessibilityObject::speakAsProperty const):
1338         (WebCore::AccessibilityObject::speakProperty const): Deleted.
1339         * accessibility/AccessibilityRenderObject.cpp:
1340         (WebCore::AccessibilityRenderObject::speakAsProperty const):
1341         (WebCore::AccessibilityRenderObject::speakProperty const): Deleted.
1342         * accessibility/AccessibilityRenderObject.h:
1343         * accessibility/ios/WebAccessibilityObjectWrapperIOS.mm:
1344         (-[WebAccessibilityObjectWrapper accessibilitySpeechHint]):
1345         * accessibility/mac/WebAccessibilityObjectWrapperBase.h:
1346         * accessibility/mac/WebAccessibilityObjectWrapperBase.mm:
1347         (-[WebAccessibilityObjectWrapperBase baseAccessibilitySpeechHint]):
1348         * accessibility/mac/WebAccessibilityObjectWrapperMac.mm:
1349         (-[WebAccessibilityObjectWrapper accessibilityAttributeValue:]):
1350         * css/CSSComputedStyleDeclaration.cpp:
1351         (WebCore::speakAsToCSSValue):
1352         (WebCore::ComputedStyleExtractor::propertyValue):
1353         * css/CSSPrimitiveValueMappings.h:
1354         (WebCore::CSSPrimitiveValue::CSSPrimitiveValue):
1355         (WebCore::CSSPrimitiveValue::operator ESpeakAs const):
1356         (WebCore::CSSPrimitiveValue::operator ESpeak const): Deleted.
1357         * css/CSSProperties.json:
1358         * css/StyleBuilderConverter.h:
1359         (WebCore::StyleBuilderConverter::convertSpeakAs):
1360         * css/parser/CSSParserFastPaths.cpp:
1361         (WebCore::CSSParserFastPaths::isValidKeywordPropertyAndValue):
1362         (WebCore::CSSParserFastPaths::isKeywordPropertyID):
1363         * css/parser/CSSPropertyParser.cpp:
1364         (WebCore::consumeSpeakAs):
1365         (WebCore::CSSPropertyParser::parseSingleValue):
1366         * rendering/style/RenderStyle.h:
1367         (WebCore::RenderStyle::speakAs const):
1368         (WebCore::RenderStyle::setSpeakAs):
1369         (WebCore::RenderStyle::initialSpeakAs):
1370         (WebCore::RenderStyle::speak const): Deleted.
1371         (WebCore::RenderStyle::setSpeak): Deleted.
1372         (WebCore::RenderStyle::initialSpeak): Deleted.
1373         * rendering/style/RenderStyleConstants.h:
1374         (WebCore::operator| ):
1375         (WebCore::operator|= ):
1376         * rendering/style/StyleRareInheritedData.cpp:
1377         (WebCore::StyleRareInheritedData::StyleRareInheritedData):
1378         (WebCore::StyleRareInheritedData::operator== const):
1379         * rendering/style/StyleRareInheritedData.h:
1380
1381 2018-01-04  Brian Burg  <bburg@apple.com>
1382
1383         Web Inspector: Capture Element Screenshot looks fuzzy
1384         https://bugs.webkit.org/show_bug.cgi?id=175734
1385         <rdar://problem/33803377>
1386
1387         Reviewed by Joseph Pecoraro and Simon Fraser.
1388
1389         Screenshots taken by Web Inspector were being downscaled from the
1390         internal size to the logical size, causing them to be blurry when
1391         later upscaled to the internal size.
1392
1393         Replace ScaleBehavior { Scaled, Unscaled } with PreserveResolution { No, Yes }.
1394         This is a lot less confusing to read both inside ImageBuffer and at its use sites.
1395
1396         Remove unused CoordinateSystem argument for ImageBuffer::toDataURL,
1397         and replace it with PreserveResolution. Plumb PreserveResolution into toCFData
1398         so that PreserveResolution::Yes will preserve the internal size of
1399         the image buffer, just as it does in other methods that take PreserveResolution.
1400
1401         At the use site in InspectorPageAgent, always request PreserveResolution::Yes snapshots
1402         when taking an element screenshot. For now, keep using downscaled (smaller)
1403         snapshots when capturing canvas previews, as the previews are not full-size.
1404
1405         Test: inspector/page/hidpi-snapshot-size.html
1406
1407         * html/HTMLCanvasElement.cpp:
1408         (WebCore::HTMLCanvasElement::makePresentationCopy):
1409         (WebCore::HTMLCanvasElement::copiedImage const):
1410         * html/canvas/CanvasRenderingContext2DBase.cpp:
1411         (WebCore::CanvasRenderingContext2DBase::createPattern):
1412         * inspector/agents/InspectorPageAgent.cpp:
1413         (WebCore::InspectorPageAgent::snapshotNode):
1414         (WebCore::InspectorPageAgent::snapshotRect):
1415         * page/TextIndicator.cpp:
1416         (WebCore::takeSnapshot):
1417         * platform/DragImage.cpp:
1418         (WebCore::createDragImageFromSnapshot):
1419         * platform/graphics/BitmapImage.cpp:
1420         (WebCore::BitmapImage::drawPattern):
1421         * platform/graphics/ImageBuffer.h:
1422         * platform/graphics/cairo/ImageBufferCairo.cpp:
1423         (WebCore::ImageBuffer::sinkIntoImage):
1424         (WebCore::ImageBuffer::copyImage const):
1425         (WebCore::ImageBuffer::toDataURL const):
1426         * platform/graphics/cg/ImageBufferCG.cpp:
1427         (WebCore::createBitmapImageAfterScalingIfNeeded):
1428         (WebCore::ImageBuffer::copyImage const):
1429         (WebCore::ImageBuffer::sinkIntoImage):
1430         (WebCore::ImageBuffer::toDataURL const):
1431         (WebCore::ImageBuffer::toData const):
1432         (WebCore::ImageBuffer::toCFData const):
1433         * platform/graphics/gtk/ImageBufferGtk.cpp:
1434         (WebCore::ImageBuffer::toDataURL const):
1435         * platform/graphics/win/ImageBufferDirect2D.cpp:
1436         (WebCore::ImageBuffer::copyImage const):
1437         (WebCore::ImageBuffer::sinkIntoImage):
1438         (WebCore::ImageBuffer::toDataURL const):
1439         * svg/graphics/SVGImage.cpp:
1440         (WebCore::SVGImage::drawPatternForContainer):
1441
1442 2018-01-04  John Wilander  <wilander@apple.com>
1443
1444         Storage Access API: Turn feature on by default in Settings.yaml
1445         https://bugs.webkit.org/show_bug.cgi?id=181298
1446         <rdar://problem/36302506>
1447
1448         Reviewed by Brent Fulgham.
1449
1450         No new tests. This is just a feature settings change.
1451
1452         * page/Settings.yaml:
1453
1454 2018-01-04  Zalan Bujtas  <zalan@apple.com>
1455
1456         WebContent process crashes while loading https://www.classicspecs.com
1457         https://bugs.webkit.org/show_bug.cgi?id=181290
1458         <rdar://problem/36225906>
1459
1460         Reviewed by Simon Fraser.
1461
1462         Floats can overhang multiple blocks (they are called intruding floats).
1463         Each block keeps track of such intruding floats. When an overhanging float box is destroyed,
1464         we need to deregister it from all those blocks. We do it by walking up the ancestor block chain
1465         and check if the parent (grandparent etc) block still contains this float. Once we find the topmost block, 
1466         we start deregistering it by traversing back on the descendant blocks.
1467         Normally we do it in RenderElement::takeChildInternal right before the box is getting detached.
1468         However in certain cases (like when the float's parent happens to be an anonymous wrapper)
1469         by the time we get to ::takeChildInternal the subtree is already detached and we can't access all the
1470         ancestors.
1471         This patch ensure that the floating box is still attached during de-registration. 
1472
1473         Test: fast/block/float/crash-when-intruding-float-has-anonymous-parent-and-detach.html
1474
1475         * rendering/RenderObject.cpp:
1476         (WebCore::RenderObject::removeFromParentAndDestroyCleaningUpAnonymousWrappers):
1477
1478 2018-01-04  Eric Carlson  <eric.carlson@apple.com>
1479
1480         [MediaStream] Add Mock screen capture source
1481         https://bugs.webkit.org/show_bug.cgi?id=181291
1482         <rdar://problem/36298164>
1483
1484         Reviewed by Dean Jackson.
1485
1486         Tests:  http/tests/media/media-stream/get-display-media-prompt.html
1487                 GetDisplayMediaTest.BasicPrompt
1488                 GetDisplayMediaTest.Constraints
1489
1490         * Modules/mediastream/MediaDevices.cpp:
1491         (WebCore::MediaDevices::MediaDevices): Add static_assert to ensure MediaDevices::DisplayCaptureSurfaceType
1492         and RealtimeMediaSourceSettings::DisplaySurfaceType values are equivalent.
1493         (WebCore::MediaDevices::getSupportedConstraints): Remove bogus code.
1494         * Modules/mediastream/MediaDevices.h: Add DisplayCaptureSurfaceType.
1495         * Modules/mediastream/MediaDevices.idl: Ditto.
1496
1497         * Modules/mediastream/MediaStreamTrack.cpp:
1498         (WebCore::MediaStreamTrack::getSettings const): Add a FIXME.
1499         * Modules/mediastream/MediaStreamTrack.h: Add displaySurface and logicalSurface.
1500
1501         * Modules/mediastream/MediaTrackSupportedConstraints.h: Remove displaySurface and logicalSurface.
1502         * Modules/mediastream/MediaTrackSupportedConstraints.idl:
1503
1504         * SourcesCocoa.txt: Add DisplayCaptureManagerCocoa.cpp and DisplayCaptureSourceCocoa.cpp.
1505
1506         * WebCore.xcodeproj/project.pbxproj: Ditto.
1507
1508         * platform/mediastream/CaptureDevice.h:
1509         (WebCore::CaptureDevice::encode const): Add.
1510         (WebCore::CaptureDevice::decode):
1511
1512         * platform/mediastream/RealtimeMediaSourceCenter.cpp:
1513         (WebCore::RealtimeMediaSourceCenter::getMediaStreamDevices): Include display capture "devices".
1514         (WebCore::RealtimeMediaSourceCenter::validateRequestConstraints): Deal with display capture devices.
1515         (WebCore::RealtimeMediaSourceCenter::captureDeviceWithPersistentID): Ditto.
1516         * platform/mediastream/RealtimeMediaSourceCenter.h:
1517
1518         * platform/mediastream/RealtimeMediaSourceSettings.h:
1519         (WebCore::RealtimeMediaSourceSettings::displaySurface const): Return a DisplaySurfaceType.
1520         (WebCore::RealtimeMediaSourceSettings::setDisplaySurface): Take a DisplaySurfaceType.
1521
1522         * platform/mediastream/mac/DisplayCaptureManagerCocoa.cpp:
1523         (WebCore::DisplayCaptureManagerCocoa::singleton):
1524         (WebCore::DisplayCaptureManagerCocoa::~DisplayCaptureManagerCocoa):
1525         (WebCore::DisplayCaptureManagerCocoa::captureDevices):
1526         (WebCore::DisplayCaptureManagerCocoa::screenCaptureDeviceWithPersistentID):
1527         (WebCore::DisplayCaptureManagerCocoa::captureDeviceWithPersistentID):
1528         * platform/mediastream/mac/DisplayCaptureManagerCocoa.h:
1529
1530         * platform/mediastream/mac/DisplayCaptureSourceCocoa.cpp: Added.
1531         (WebCore::DisplayCaptureSourceCocoa::DisplayCaptureSourceCocoa):
1532         (WebCore::DisplayCaptureSourceCocoa::~DisplayCaptureSourceCocoa):
1533         (WebCore::DisplayCaptureSourceCocoa::capabilities const):
1534         (WebCore::DisplayCaptureSourceCocoa::settings const):
1535         (WebCore::DisplayCaptureSourceCocoa::settingsDidChange):
1536         (WebCore::DisplayCaptureSourceCocoa::startProducingData):
1537         (WebCore::DisplayCaptureSourceCocoa::stopProducingData):
1538         (WebCore::DisplayCaptureSourceCocoa::elapsedTime):
1539         (WebCore::DisplayCaptureSourceCocoa::applyFrameRate):
1540         (WebCore::DisplayCaptureSourceCocoa::emitFrame):
1541         * platform/mediastream/mac/DisplayCaptureSourceCocoa.h:
1542
1543         * platform/mediastream/mac/RealtimeMediaSourceCenterMac.cpp:
1544         (WebCore::RealtimeMediaSourceCenterMac::displayCaptureDeviceManager): New.
1545         * platform/mediastream/mac/RealtimeMediaSourceCenterMac.h:
1546
1547         * platform/mock/MockRealtimeMediaSource.cpp:
1548         (WebCore::deviceMap): Add screen capture "devices".
1549         (WebCore::MockRealtimeMediaSource::displayDevices): New.
1550         * platform/mock/MockRealtimeMediaSource.h:
1551
1552         * platform/mock/MockRealtimeMediaSourceCenter.cpp: Clean up includes.
1553         * platform/mock/MockRealtimeMediaSourceCenter.h:
1554
1555         * platform/mock/MockRealtimeVideoSource.cpp:
1556         (WebCore::MockRealtimeVideoSource::MockRealtimeVideoSource): Mock two screen devices.
1557         (WebCore::MockRealtimeVideoSource::updateSettings): Deal with mock screens.
1558         (WebCore::MockRealtimeVideoSource::initializeCapabilities): Ditto.
1559         (WebCore::MockRealtimeVideoSource::initializeSupportedConstraints): Ditto.
1560         (WebCore::MockRealtimeVideoSource::drawText): Ditto.
1561         (WebCore::MockRealtimeVideoSource::generateFrame): Ditto.
1562         * platform/mock/MockRealtimeVideoSource.h:
1563         (WebCore::MockRealtimeVideoSource::mockCamera const):
1564         (WebCore::MockRealtimeVideoSource::mockScreen const):
1565
1566 2018-01-04  Youenn Fablet  <youenn@apple.com>
1567
1568         FetchResponse should set its internal response text encoding name
1569         https://bugs.webkit.org/show_bug.cgi?id=181284
1570
1571         Reviewed by Alex Christensen.
1572
1573         Covered by rebased test.
1574
1575         * Modules/fetch/FetchResponse.cpp:
1576         (WebCore::FetchResponse::create): Set response text encoding based on content type charset.
1577
1578 2018-01-04  John Wilander  <wilander@apple.com>
1579
1580         Storage Access API: Remove JavaScript confirm() prompt from Document::requestStorageAccess()
1581         https://bugs.webkit.org/show_bug.cgi?id=181276
1582         <rdar://problem/36290463>
1583
1584         Reviewed by Alex Christensen.
1585
1586         No new tests. Existing test expectations updated.
1587
1588         * dom/Document.cpp:
1589         (WebCore::Document::requestStorageAccess):
1590
1591 2018-01-04  Carlos Garcia Campos  <cgarcia@igalia.com>
1592
1593         [GTK] Issues with Ahem's ex / x-height
1594         https://bugs.webkit.org/show_bug.cgi?id=180581
1595
1596         Reviewed by Michael Catanzaro.
1597
1598         Get the x-height value from the TT_OS2 table if available.
1599
1600         Fixes: fast/text/break-word-pre-wrap.html
1601                imported/w3c/web-platform-tests/css/css-shapes-1/shape-outside/values/shape-outside-shape-arguments-000.html
1602
1603         * platform/graphics/freetype/SimpleFontDataFreeType.cpp:
1604         (WebCore::Font::platformInit):
1605
1606 2018-01-04  Philippe Normand  <pnormand@igalia.com>
1607
1608         Unreviewed, GTK build fix attempt after r226357
1609
1610         * platform/graphics/gstreamer/GStreamerUtilities.h: The
1611         GST_BUFFER_DTS_OR_PTS macro was added in GStreamer 1.8 but old
1612         versions of Debian might not have this release yet.
1613
1614 2018-01-04  Youenn Fablet  <youenn@apple.com>
1615
1616         Implement Cache API partitioning based on ClientOrigin
1617         https://bugs.webkit.org/show_bug.cgi?id=181240
1618
1619         Reviewed by Alex Christensen.
1620
1621         Covered by updated tests.
1622
1623         Previously, cache storage was partitioned according the origin of the client, represented as a String.
1624         We now partition according both client and top origins, represented as a ClientOrigin
1625
1626         Minor refactoring to use more makePendingActivity.
1627         Added support for IPC serialization of ClientOrigin.
1628         Added SecurityOriginData::toString which is used by WebKit2 Cache Storage implementation.
1629
1630         * Modules/cache/CacheStorageConnection.cpp:
1631         (WebCore::CacheStorageConnection::open):
1632         (WebCore::CacheStorageConnection::retrieveCaches):
1633         * Modules/cache/CacheStorageConnection.h:
1634         (WebCore::CacheStorageConnection::clearMemoryRepresentation):
1635         (WebCore::CacheStorageConnection::doOpen):
1636         (WebCore::CacheStorageConnection::doRetrieveCaches):
1637         * Modules/cache/DOMCacheStorage.cpp:
1638         (WebCore::DOMCacheStorage::origin const):
1639         (WebCore::DOMCacheStorage::retrieveCaches):
1640         (WebCore::DOMCacheStorage::open):
1641         (WebCore::DOMCacheStorage::remove):
1642         * Modules/cache/DOMCacheStorage.h:
1643         * Modules/cache/WorkerCacheStorageConnection.cpp:
1644         (WebCore::WorkerCacheStorageConnection::doOpen):
1645         (WebCore::WorkerCacheStorageConnection::doRetrieveCaches):
1646         * Modules/cache/WorkerCacheStorageConnection.h:
1647         * page/ClientOrigin.h:
1648         (WebCore::ClientOrigin::isolatedCopy const):
1649         (WebCore::ClientOrigin::encode const):
1650         (WebCore::ClientOrigin::decode):
1651         * page/SecurityOriginData.cpp:
1652         (WebCore::SecurityOriginData::toString const):
1653         (WebCore::SecurityOriginData::debugString const): Deleted.
1654         * page/SecurityOriginData.h:
1655         (WebCore::SecurityOriginData::debugString const):
1656         * testing/Internals.cpp:
1657         (WebCore::Internals::clearCacheStorageMemoryRepresentation):
1658
1659 2018-01-04  Youenn Fablet  <youenn@apple.com>
1660
1661         Service Worker should expose redirect mode for navigation loads as manual
1662         https://bugs.webkit.org/show_bug.cgi?id=181067
1663
1664         Reviewed by Alex Christensen.
1665
1666         Covered by rebased tests.
1667
1668         * loader/CrossOriginAccessControl.cpp: Removing ContentType header only if affecting CORS checks.
1669         This allows extending header filtering in service worker to all modes, including Navigate.
1670         * workers/service/context/ServiceWorkerFetch.cpp:
1671         (WebCore::ServiceWorkerFetch::dispatchFetchEvent): Ideally, document loading code should set redirect to manual.
1672         Since it is not the case yet and that would require changes to various places, manual is set before exposing the corresponding fetch event.
1673
1674 2018-01-04  Youenn Fablet  <youenn@apple.com>
1675
1676         ServiceWorkerThreadProxy::postTaskForModeToWorkerGlobalScope should be a no-op if worker is being terminated
1677         https://bugs.webkit.org/show_bug.cgi?id=181245
1678
1679         Reviewed by Alex Christensen.
1680
1681         Stop appending tasks to a terminating worker and returning false in that case.
1682         This mirrors what is done for regular workers.
1683
1684         * workers/service/context/SWContextManager.cpp:
1685         (WebCore::SWContextManager::terminateWorker):
1686         * workers/service/context/ServiceWorkerThreadProxy.cpp:
1687         (WebCore::ServiceWorkerThreadProxy::postTaskForModeToWorkerGlobalScope):
1688         * workers/service/context/ServiceWorkerThreadProxy.h:
1689
1690 2018-01-04  Youenn Fablet  <youenn@apple.com>
1691
1692         Cancel pending script loads when service worker is being terminated
1693         https://bugs.webkit.org/show_bug.cgi?id=181250
1694
1695         Reviewed by Alex Christensen.
1696
1697         Covered by service worker tests no longer crashing in ASAN builds.
1698
1699         * workers/WorkerScriptLoader.cpp:
1700         (WebCore::WorkerScriptLoader::notifyFinished): Clearing loader when finished.
1701         (WebCore::WorkerScriptLoader::cancel): Implementing cancel of a script loader by cancelling the underlying threadable loader.
1702         * workers/WorkerScriptLoader.h:
1703         * workers/service/ServiceWorkerContainer.cpp: Canceling loads of all pending jobs.
1704         (WebCore::ServiceWorkerContainer::stop):
1705         * workers/service/ServiceWorkerJob.cpp:
1706         (WebCore::ServiceWorkerJob::cancelPendingLoad):
1707         * workers/service/ServiceWorkerJob.h:
1708
1709 2018-01-04  Youenn Fablet  <youenn@apple.com>
1710
1711         Implement  https://fetch.spec.whatwg.org/#main-fetch default referrer policy setting
1712         https://bugs.webkit.org/show_bug.cgi?id=181239
1713
1714         Reviewed by Alex Christensen.
1715
1716         Covered by updated and rebased test.
1717
1718         Setting the request referrer policy to the Document referrer policy if no one is set.
1719         If Document has no referrer policy, use no-referrer-when-downgrade as per the spec.
1720
1721         * loader/cache/CachedResourceLoader.cpp:
1722         (WebCore::CachedResourceLoader::updateHTTPRequestHeaders):
1723         (WebCore::CachedResourceLoader::requestResource):
1724         * loader/cache/CachedResourceLoader.h:
1725         * loader/cache/CachedResourceRequest.cpp:
1726         (WebCore::CachedResourceRequest::updateReferrerPolicy):
1727         (WebCore::CachedResourceRequest::updateReferrerOriginAndUserAgentHeaders):
1728         * loader/cache/CachedResourceRequest.h:
1729
1730 2018-01-03  Wenson Hsieh  <wenson_hsieh@apple.com>
1731
1732         [Attachment Support] Create attachment elements when dropping files on iOS
1733         https://bugs.webkit.org/show_bug.cgi?id=181192
1734         <rdar://problem/36280945>
1735
1736         Reviewed by Tim Horton.
1737
1738         Implements support for dropping data as attachment elements on iOS. See comments below for more detail.
1739
1740         Tests:  WKAttachmentTests.InsertDroppedRichAndPlainTextFilesAsAttachments
1741                 WKAttachmentTests.InsertDroppedZipArchiveAsAttachment
1742                 WKAttachmentTests.InsertDroppedItemProvidersInOrder
1743
1744         * WebCore.xcodeproj/project.pbxproj:
1745         * editing/WebContentReader.cpp:
1746         (WebCore::WebContentReader::ensureFragment):
1747
1748         Add a new helper to create the WebContentReader's fragment, if it hasn't already been created.
1749
1750         * editing/WebContentReader.h:
1751         * editing/cocoa/WebContentReaderCocoa.mm:
1752         (WebCore::WebContentReader::readFilePaths):
1753
1754         Rename readFilenames to readFilePaths (which better reflects its parameters, which are file paths). Also, move
1755         the implementation of readFilePaths to shared iOS/macOS code in WebContentReaderCocoa, and remove the stub
1756         implementation on iOS.
1757
1758         There's a bit of code here that I kept macOS-only which deals with inserting file paths as plain text in
1759         editable areas, but it's unclear to me why and if WebKit clients currently find this useful, so I left a FIXME
1760         to investigate removing this altogether. Code for handling this plain text insertion of file paths on Mac was
1761         introduced in r67403.
1762
1763         * editing/ios/WebContentReaderIOS.mm:
1764         (WebCore::WebContentReader::readFilenames): Deleted.
1765         * editing/mac/WebContentReaderMac.mm:
1766         (WebCore::WebContentReader::readFilenames): Deleted.
1767         * page/mac/DragControllerMac.mm:
1768         (WebCore::DragController::updateSupportedTypeIdentifiersForDragHandlingMethod const):
1769
1770         Teach DragController to accept all types conforming to "public.item" and "public.content" on iOS, only when
1771         attachment elements are enabled. This allows us to load content from item providers that we otherwise would not
1772         have loaded, since we now have the ability to fall back to attachment element insertion if the type is not have
1773         a default representation using standard web content.
1774
1775         * platform/Pasteboard.h:
1776         * platform/PasteboardItemInfo.h: Added.
1777         (WebCore::PasteboardItemInfo::encode const):
1778         (WebCore::PasteboardItemInfo::decode):
1779
1780         Add PasteboardItemInfo, a struct that describes an item on the pasteboard. Also, implement encoding and decoding
1781         support for PasteboardItemInfo. So far, the item info only describes file information about the pasteboard item,
1782         and flags indicating whether the item prefers attachment or inline presentation.
1783
1784         * platform/PasteboardStrategy.h:
1785
1786         Replace getFilenamesForDataInteraction with informationForItemAtIndex. Instead of returning all of the file
1787         paths associated with any item on the pasteboard, fetch a PasteboardItemInfo at a given item index, which
1788         includes information about the file path as well as some other metadata we'll need when deciding how to read
1789         pasteboard contents as a document fragment.
1790
1791         * platform/PlatformPasteboard.h:
1792         * platform/cocoa/PasteboardCocoa.mm:
1793         (WebCore::Pasteboard::read):
1794         * platform/ios/AbstractPasteboard.h:
1795         * platform/ios/PasteboardIOS.mm:
1796         (WebCore::Pasteboard::read):
1797         (WebCore::Pasteboard::readRespectingUTIFidelities):
1798
1799         Teach the iOS Pasteboard to read web content using attachment elements, if enabled. There are two scenarios in
1800         which we would want to insert an attachment element:
1801         (1) The item provider uses a preferred presentation style of attachment, in which case we bail out of trying to
1802             handle the drop using the default mechanisms, and simply insert it as an attachment. We need this to deal
1803             with the case where we drop text or HTML files from the Files app, so that we don't try and insert the
1804             contents of the text or HTML as inline web content.
1805         (2) The item provider doesn't have a preferred attachment presentation style, but there's nothing WebKit would
1806             otherwise do with the dropped content, so insert an attachment element as a fallback. Examples where this is
1807             relevant are dropping a PDF or ZIP archive without attachment presentation style explicitly set.
1808         We first check if we fall into case (1). If so, we can bail early by inserting an attachment; otherwise, we
1809         proceed normally and see if we can read the contents of the drop as web content. If, at the end of default drop
1810         handling, we don't still have a way to represent the dropped content, enter case (2).
1811
1812         (WebCore::Pasteboard::readFilePaths):
1813         (WebCore::Pasteboard::readFilenames): Deleted.
1814
1815         Rename readFilenames to readFilePaths, and reimplement it using informationForItemAtIndex.
1816
1817         * platform/ios/PlatformPasteboardIOS.mm:
1818         (WebCore::pasteboardItemPresentationStyle):
1819         (WebCore::PlatformPasteboard::informationForItemAtIndex):
1820         (WebCore::PlatformPasteboard::filenamesForDataInteraction): Deleted.
1821
1822         Implement informationForItemAtIndex and remove filenamesForDataInteraction. As before, we ask the pasteboard
1823         (i.e. WebItemProviderPasteboard) for information about dropped file URLs. This time, we limit this to a single
1824         file, so we don't end up creating multiple attachment elements for each representation of a single item
1825         provider. See below for -preferredFileUploadURLAtIndex:fileType: for more detail.
1826
1827         * platform/ios/WebItemProviderPasteboard.h:
1828         * platform/ios/WebItemProviderPasteboard.mm:
1829         (-[WebItemProviderLoadResult initWithItemProvider:typesToLoad:]):
1830         (-[WebItemProviderLoadResult canBeRepresentedAsFileUpload]):
1831
1832         Remove this synthesized instance variable and instead just check the item provider's preferredPresentationStyle.
1833
1834         (-[WebItemProviderLoadResult description]):
1835
1836         Add a verbose -description to the load result object. Useful for debugging what was content was loaded from an
1837         item provider on drop.
1838
1839         (-[WebItemProviderPasteboard preferredFileUploadURLAtIndex:fileType:]):
1840
1841         Return the highest fidelity loaded type identifier for a given item.
1842
1843         (-[WebItemProviderPasteboard allDroppedFileURLs]):
1844         (-[WebItemProviderPasteboard typeIdentifiersToLoadForRegisteredTypeIdentfiers:]):
1845
1846         Prefer flat RTFD to RTFD. In the case where attachments are enabled and we're accepting all types of content
1847         using attachment elements as a fallback representation, if the source writes attributed strings to the
1848         pasteboard with com.apple.rtfd at a higher fidelity than com.apple.flat-rtfd, we'll end up loading only
1849         com.apple.rtfd and dropping the text as an attachment element because we cannot convert the dropped content to
1850         markup. Instead, if flat RTFD is present in the item provider, always prefer that over RTFD so that dropping as
1851         regular web content isn't overridden when attachment elements are enabled.
1852
1853         (-[WebItemProviderPasteboard doAfterLoadingProvidedContentIntoFileURLs:synchronousTimeout:]):
1854         (-[WebItemProviderPasteboard droppedFileURLs]): Deleted.
1855         * platform/mac/DragDataMac.mm:
1856         (WebCore::DragData::containsCompatibleContent const):
1857
1858         DragData::containsCompatibleContent should be true when attachment elements are enabled, and there are files we
1859         can drop as attachment elements.
1860
1861         * platform/mac/PasteboardMac.mm:
1862         (WebCore::Pasteboard::read):
1863         (WebCore::Pasteboard::readFilePaths):
1864         (WebCore::Pasteboard::readFilenames): Deleted.
1865
1866 2018-01-03  Ting-Wei Lan  <lantw44@gmail.com>
1867
1868         Replace hard-coded paths in shebangs with #!/usr/bin/env
1869         https://bugs.webkit.org/show_bug.cgi?id=181040
1870
1871         Reviewed by Alex Christensen.
1872
1873         * bindings/scripts/InFilesCompiler.pm:
1874         * bindings/scripts/InFilesParser.pm:
1875         * bindings/scripts/generate-bindings-all.pl:
1876         * bindings/scripts/generate-bindings.pl:
1877         * bindings/scripts/preprocess-idls.pl:
1878         * css/make-css-file-arrays.pl:
1879         * css/makeprop.pl:
1880         * css/makevalues.pl:
1881         * dom/make_event_factory.pl:
1882         * dom/make_names.pl:
1883         * extract-localizable-strings.pl:
1884         * make-hash-tools.pl:
1885
1886 2018-01-03  Wenson Hsieh  <wenson_hsieh@apple.com>
1887
1888         [Attachment Support] Add plumbing for starting a drag with promised blob data
1889         https://bugs.webkit.org/show_bug.cgi?id=181201
1890
1891         Reviewed by Tim Horton.
1892
1893         Adds logic to allow dragging an attachment element as a file by sending promised blob information to the UI
1894         process. See comments below for more detail.
1895
1896         The only change in behavior is that dragging an attachment element will no longer write web content and injected
1897         bundle data to the pasteboard if the attachment element's file attribute is nonnull. This will cause one
1898         existing WK1 layout test to fail, but will otherwise not affect any attachment editing clients. On iOS,
1899         attachment elements in the Mail viewer can be dragged, but each attachment's file is null, so we fall back to
1900         current behavior; on macOS, Mail currently overrides the drag completely, beginning at -mouseDown:, so this
1901         doesn't make a difference to macOS Mail either.
1902
1903         * editing/Editor.h:
1904         * editing/cocoa/EditorCocoa.mm:
1905         (WebCore::Editor::getPasteboardTypesAndDataForAttachment):
1906
1907         Add a helper method to retrieve an attachment element as web archive data, for moving attachments within the
1908         same document. Also gives the injected editor bundle a chance to supply custom pasteboard types.
1909
1910         * loader/EmptyClients.cpp:
1911         * page/DragClient.h:
1912         (WebCore::DragClient::prepareToDragPromisedBlob):
1913
1914         Add new DragClient methods to send information about a promised blob to the UI process.
1915
1916         * page/DragController.cpp:
1917         (WebCore::DragController::startDrag):
1918
1919         Call dragAttachmentElement when starting a drag on an attachment element.
1920
1921         (WebCore::DragController::dragAttachmentElement):
1922
1923         Try to begin dragging a given attachment element, propagating promised blob information to the client layers.
1924         Returns true iff the attachment is backed by blob data (i.e. the file is nonnull).
1925
1926         * platform/PromisedBlobInfo.h:
1927
1928         Add a list of additional types and data to PromisedBlobInfo. In addition to the promised blob info, this would
1929         allow injected bundle data and other private types alongside the main attachment data on the pasteboard.
1930
1931 2018-01-03  Simon Fraser  <simon.fraser@apple.com>
1932
1933         Remove the 'resolutionScale' parameter from ImageBufferDataCG get/putBytes
1934         https://bugs.webkit.org/show_bug.cgi?id=181268
1935
1936         Reviewed by Alex Christensen.
1937
1938         These functions were always called with resolutionScale=1.
1939
1940         * platform/graphics/cg/ImageBufferCG.cpp:
1941         (WebCore::ImageBuffer::getUnmultipliedImageData const):
1942         (WebCore::ImageBuffer::getPremultipliedImageData const):
1943         (WebCore::ImageBuffer::putByteArray):
1944         * platform/graphics/cg/ImageBufferDataCG.cpp:
1945         (WebCore::ImageBufferData::getData const):
1946         (WebCore::ImageBufferData::putData):
1947         (WebCore::affineWarpBufferData): Deleted.
1948         * platform/graphics/cg/ImageBufferDataCG.h:
1949
1950 2018-01-03  John Wilander  <wilander@apple.com>
1951
1952         Storage Access API: Refactor XPC for access removal to go straight from the web process to the network process
1953         https://bugs.webkit.org/show_bug.cgi?id=181270
1954         <rdar://problem/36289544>
1955
1956         Reviewed by Alex Christensen.
1957
1958         No new tests. Existing test re-enabled.
1959
1960         This change refactors how the web process tells the network process
1961         to remove storage access. Previously, this was done over the UI process
1962         just like requests for storage access. But since no further reasoning
1963         is needed, the message should go straight from the web process to the
1964         network process for performance reasons and to minimize the risk of a
1965         race.
1966
1967         As a consequence, the XPC code for storage access removal in the UI
1968         process is deleted.
1969
1970         * platform/network/cf/NetworkStorageSessionCFNet.cpp:
1971         (WebCore::NetworkStorageSession::cookieStoragePartition const):
1972             Removes the storageAccessAPIEnabled check since the flag
1973             doesn't get propagated when the network process is created.
1974             Figuring this out will take some work which is unnecessary
1975             when we already gate access to the feature in Document.idl.
1976
1977 2018-01-03  James Craig  <jcraig@apple.com>
1978
1979         AX: when invert colors is on, double-invert certain media elements in UserAgentStyleSheet
1980         https://bugs.webkit.org/show_bug.cgi?id=168447
1981         <rdar://problem/30559874>
1982
1983         Reviewed by Simon Fraser.
1984
1985         Double-invert video when platform 'invert colors' setting is enabled. Behavior matches 
1986         current 'Smart Invert' feature of Safari Reader on macOS/iOS and other iOS native apps.
1987
1988         Tests: accessibility/smart-invert-reference.html
1989                accessibility/smart-invert.html
1990
1991         * Modules/modern-media-controls/controls/media-controls.css:
1992         (@media (inverted-colors)):
1993         (:host):
1994         (picture):
1995         * css/html.css:
1996         (@media (inverted-colors)):
1997         (video):
1998
1999 2018-01-03  Youenn Fablet  <youenn@apple.com>
2000
2001         LayoutTest http/tests/media/media-stream/disconnected-frame.html to consistently fail an assertion: !m_adoptionIsRequired
2002         https://bugs.webkit.org/show_bug.cgi?id=181264
2003
2004         Reviewed by Eric Carlson.
2005
2006         Covered by http/tests/media/media-stream/disconnected-frame.html not crashing anymore in Debug builds.
2007         Calling suspendIfNeeded in create method instead of constructor.
2008
2009         * Modules/mediastream/UserMediaRequest.cpp:
2010         (WebCore::UserMediaRequest::create):
2011         (WebCore::UserMediaRequest::UserMediaRequest):
2012
2013 2018-01-03  Antti Koivisto  <antti@apple.com>
2014
2015         Remove DeprecatedCSSOMValue::equals
2016         https://bugs.webkit.org/show_bug.cgi?id=181241
2017
2018         Reviewed by Zalan Bujtas.
2019
2020         This is dead code.
2021
2022         * css/DeprecatedCSSOMValue.cpp:
2023         (WebCore::compareCSSOMValues): Deleted.
2024         (WebCore::DeprecatedCSSOMValue::equals const): Deleted.
2025         * css/DeprecatedCSSOMValue.h:
2026         (WebCore::DeprecatedCSSOMValue::operator== const): Deleted.
2027         (WebCore::DeprecatedCSSOMComplexValue::equals const): Deleted.
2028         * css/DeprecatedCSSOMValueList.cpp:
2029         (WebCore::DeprecatedCSSOMValueList::equals const): Deleted.
2030         * css/DeprecatedCSSOMValueList.h:
2031
2032 2018-01-03  Simon Fraser  <simon.fraser@apple.com>
2033
2034         feLighting is broken with primitiveUnits="objectBoundingBox"
2035         https://bugs.webkit.org/show_bug.cgi?id=181197
2036
2037         Reviewed by Tim Horton.
2038
2039         With <filter primitiveUnits="objectBoundingBox"> we need to convert the coordinates
2040         of fePointLights and feSpotLights into user space coordinates. Following
2041         https://www.w3.org/TR/SVG/filters.html#FilterElementPrimitiveUnitsAttribute
2042         this is done by treating them as fractions of the bounding box on the referencing
2043         element, with treatment for z following https://www.w3.org/TR/SVG/coords.html#Units_viewport_percentage
2044         
2045         To do this, store the bounds of the referencing elemenet on SVGFilterBuilder as
2046         targetBoundingBox, and store the primitiveUnits type. Then do the conversion of lighting
2047         coordinates in SVGFESpecularLightingElement::build() and SVGFEDiffuseLightingElement::build().
2048
2049         Remove SVGFELightElement::findLightSource(), since we need to be able to pass the SVGFilterBuilder
2050         to the lightSource() function so hoist the code up.
2051
2052         Tests: svg/filters/feDiffuseLighting-fePointLight-primitiveUnits-objectBoundingBox-expected.svg
2053                svg/filters/feDiffuseLighting-fePointLight-primitiveUnits-objectBoundingBox.svg
2054                svg/filters/feDiffuseLighting-feSpotLight-primitiveUnits-objectBoundingBox-expected.svg
2055                svg/filters/feDiffuseLighting-feSpotLight-primitiveUnits-objectBoundingBox.svg
2056                svg/filters/feSpecularLighting-fePointLight-primitiveUnits-objectBoundingBox-expected.svg
2057                svg/filters/feSpecularLighting-fePointLight-primitiveUnits-objectBoundingBox.svg
2058
2059         * rendering/svg/RenderSVGResourceFilter.cpp:
2060         (WebCore::RenderSVGResourceFilter::buildPrimitives const):
2061         * svg/SVGFEDiffuseLightingElement.cpp:
2062         (WebCore::SVGFEDiffuseLightingElement::build):
2063         * svg/SVGFEDistantLightElement.cpp:
2064         (WebCore::SVGFEDistantLightElement::lightSource const):
2065         * svg/SVGFEDistantLightElement.h:
2066         * svg/SVGFELightElement.cpp:
2067         (WebCore::SVGFELightElement::findLightSource): Deleted.
2068         * svg/SVGFELightElement.h:
2069         * svg/SVGFEPointLightElement.cpp:
2070         (WebCore::SVGFEPointLightElement::lightSource const):
2071         * svg/SVGFEPointLightElement.h:
2072         * svg/SVGFESpecularLightingElement.cpp:
2073         (WebCore::SVGFESpecularLightingElement::build):
2074         * svg/SVGFESpotLightElement.cpp:
2075         (WebCore::SVGFESpotLightElement::lightSource const):
2076         * svg/SVGFESpotLightElement.h:
2077         * svg/graphics/filters/SVGFilterBuilder.h:
2078         (WebCore::SVGFilterBuilder::setTargetBoundingBox):
2079         (WebCore::SVGFilterBuilder::targetBoundingBox const):
2080         (WebCore::SVGFilterBuilder::primitiveUnits const):
2081         (WebCore::SVGFilterBuilder::setPrimitiveUnits):
2082
2083 2018-01-03  Antti Koivisto  <antti@apple.com>
2084
2085         Crash beneath CSSValue::equals @ csas.cz
2086         https://bugs.webkit.org/show_bug.cgi?id=181243
2087         <rdar://problem/35990826>
2088
2089         Reviewed by Alex Christensen.
2090
2091         Test: fast/text/oblique-degree-equals-crash.html
2092
2093         * css/CSSFontStyleValue.cpp:
2094         (WebCore::CSSFontStyleValue::equals const):
2095
2096         Null check both oblique pointers.
2097
2098 2018-01-03  Joseph Pecoraro  <pecoraro@apple.com>
2099
2100         Web Inspector: Slow open time enumerating system fonts (FontCache::systemFontFamilies)
2101         https://bugs.webkit.org/show_bug.cgi?id=180979
2102         <rdar://problem/36146670>
2103
2104         Reviewed by Matt Baker.
2105
2106         * platform/graphics/cocoa/FontCacheCoreText.cpp:
2107         (fontNameIsSystemFont):
2108         (WebCore::FontCache::systemFontFamilies):
2109         Switch to the original Mac algorithm before r180979 that uses
2110         CTFontManagerCopyAvailableFontFamilyNames. Previously this wasn't
2111         available on iOS but now it is. This is a performance improvement on
2112         both platforms, but significantly so on macOS. It also finds more,
2113         valid, family names.
2114
2115 2018-01-03  Michael Catanzaro  <mcatanzaro@igalia.com>
2116
2117         ASSERTION FAILED: !source || is<Target>(*source) in CoordinatedGraphicsLayer::removeFromParent
2118         https://bugs.webkit.org/show_bug.cgi?id=166568
2119
2120         Reviewed by Simon Fraser.
2121
2122         When a GraphicsLayer has a mask layer, it fails to properly unparent the mask layer before
2123         it is destroyed. This leaves the mask layer with a dangling parent pointer. Fix it, while
2124         taking care not to introduce yet another virtual function call during the execution of the
2125         destructor.
2126
2127         * platform/graphics/GraphicsLayer.cpp:
2128         (WebCore::GraphicsLayer::willBeDestroyed):
2129
2130 2018-01-03  Simon Fraser  <simon.fraser@apple.com>
2131
2132         SVG lighting filter lights are in the wrong coordinate system
2133         https://bugs.webkit.org/show_bug.cgi?id=181147
2134
2135         Reviewed by Zalan Bujtas.
2136
2137         Point and spot light coordinates weren't being converted into buffer-relative
2138         coordinates before being fed into the lighting math, resulting in incorrect light
2139         rendering on Retina devices, and when the filter primitive region was clipped.
2140
2141         Fix by storing absoluteUnclippedSubregion on FilterEffect, which allows us to map
2142         lighting points from user space coordinates into the coordinates of the buffer being
2143         used for rendering. Also scale the light z coordinate by doing a dummy point mapping in x.
2144
2145         Rename members of PointLightSource and SpotLightSource to make it clear which coordinate
2146         system they are in.
2147
2148         Tests include HiDPI tests.
2149
2150         Tests: svg/filters/fePointLight-coordinates-expected.svg
2151                svg/filters/fePointLight-coordinates.svg
2152                svg/filters/feSpotLight-coordinates-expected.svg
2153                svg/filters/feSpotLight-coordinates.svg
2154                svg/filters/hidpi/fePointLight-coordinates-expected.svg
2155                svg/filters/hidpi/fePointLight-coordinates.svg
2156                svg/filters/hidpi/feSpotLight-coordinates-expected.svg
2157                svg/filters/hidpi/feSpotLight-coordinates.svg
2158
2159         * platform/graphics/FloatPoint3D.h: Make it easy to get and set the X and Y coords as a FloatPoint.
2160         (WebCore::FloatPoint3D::xy const):
2161         (WebCore::FloatPoint3D::setXY):
2162         * platform/graphics/GeometryUtilities.cpp:
2163         (WebCore::mapPoint):
2164         (WebCore::mapRect):
2165         * platform/graphics/GeometryUtilities.h: Helper to make a point between rects.
2166         * platform/graphics/filters/DistantLightSource.cpp:
2167         (WebCore::DistantLightSource::initPaintingData):
2168         * platform/graphics/filters/DistantLightSource.h:
2169         * platform/graphics/filters/FELighting.cpp:
2170         (WebCore::FELighting::drawLighting):
2171         * platform/graphics/filters/FilterEffect.cpp:
2172         (WebCore::FilterEffect::mapPointFromUserSpaceToBuffer const):
2173         * platform/graphics/filters/FilterEffect.h:
2174         (WebCore::FilterEffect::setUnclippedAbsoluteSubregion):
2175         * platform/graphics/filters/LightSource.h:
2176         * platform/graphics/filters/PointLightSource.cpp:
2177         (WebCore::PointLightSource::initPaintingData):
2178         (WebCore::PointLightSource::computePixelLightingData const):
2179         (WebCore::PointLightSource::setX):
2180         (WebCore::PointLightSource::setY):
2181         (WebCore::PointLightSource::setZ):
2182         * platform/graphics/filters/PointLightSource.h:
2183         (WebCore::PointLightSource::position const):
2184         (WebCore::PointLightSource::PointLightSource):
2185         * platform/graphics/filters/SpotLightSource.cpp:
2186         (WebCore::SpotLightSource::initPaintingData):
2187         (WebCore::SpotLightSource::computePixelLightingData const):
2188         (WebCore::SpotLightSource::setX):
2189         (WebCore::SpotLightSource::setY):
2190         (WebCore::SpotLightSource::setZ):
2191         (WebCore::SpotLightSource::setPointsAtX):
2192         (WebCore::SpotLightSource::setPointsAtY):
2193         (WebCore::SpotLightSource::setPointsAtZ):
2194         * platform/graphics/filters/SpotLightSource.h:
2195         (WebCore::SpotLightSource::position const):
2196         (WebCore::SpotLightSource::direction const):
2197         (WebCore::SpotLightSource::SpotLightSource):
2198         * rendering/svg/RenderSVGResourceFilter.cpp:
2199         (WebCore::RenderSVGResourceFilter::buildPrimitives const):
2200         * rendering/svg/RenderSVGResourceFilterPrimitive.cpp:
2201         (WebCore::RenderSVGResourceFilterPrimitive::determineFilterPrimitiveSubregion):
2202
2203 2018-01-03  Youenn Fablet  <youenn@apple.com>
2204
2205         Select service worker for documents with data/blob URLS
2206         https://bugs.webkit.org/show_bug.cgi?id=181213
2207
2208         Reviewed by Alex Christensen.
2209
2210         Covered by updated test.
2211
2212         Reusing the service worker of the parent for blob/data URL documents.
2213
2214         * loader/DocumentLoader.cpp:
2215         (WebCore::isLocalURL):
2216         (WebCore::DocumentLoader::commitData):
2217
2218 2018-01-03  Ryan Haddad  <ryanhaddad@apple.com>
2219
2220         Unreviewed, rolling out r226352.
2221
2222         Breaks Sierra and El Capitan builds.
2223
2224         Reverted changeset:
2225
2226         "Web Inspector: Slow open time enumerating system fonts
2227         (FontCache::systemFontFamilies)"
2228         https://bugs.webkit.org/show_bug.cgi?id=180979
2229         https://trac.webkit.org/changeset/226352
2230
2231 2018-01-03  Philippe Normand  <pnormand@igalia.com>
2232
2233         [GStreamer] The bus synchronous handler should be in the base player class
2234         https://bugs.webkit.org/show_bug.cgi?id=181237
2235
2236         Reviewed by Carlos Garcia Campos.
2237
2238         Because this is where video rendering is handled.
2239
2240         No new tests, this is only a refactoring.
2241
2242         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:
2243         (WebCore::MediaPlayerPrivateGStreamer::createGSTPlayBin):
2244         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp:
2245         (WebCore::MediaPlayerPrivateGStreamerBase::setPipeline):
2246
2247 2018-01-03  Philippe Normand  <pnormand@igalia.com>
2248
2249         [GStreamer] move MediaSample implementation out of mse/
2250         https://bugs.webkit.org/show_bug.cgi?id=179165
2251
2252         Reviewed by Carlos Garcia Campos.
2253
2254         This module isn't specific to MSE and can potentially be reused
2255         elsewhere, for WebRTC for instance. Additionally the
2256         ::platformSample() method was implemented and the code was cleaned up.
2257
2258         * platform/GStreamer.cmake:
2259         * platform/MediaSample.h:
2260         * platform/graphics/gstreamer/GStreamerMediaSample.cpp: Renamed from Source/WebCore/platform/graphics/gstreamer/mse/GStreamerMediaSample.cpp.
2261         (WebCore::GStreamerMediaSample::platformSample):
2262         * platform/graphics/gstreamer/GStreamerMediaSample.h: Renamed from Source/WebCore/platform/graphics/gstreamer/mse/GStreamerMediaSample.h.
2263         * platform/graphics/gstreamer/mse/PlaybackPipeline.cpp:
2264         (WebCore::PlaybackPipeline::enqueueSample):
2265
2266 2018-01-03  Carlos Garcia Campos  <cgarcia@igalia.com>
2267
2268         Unreviewed. Fix resource load stats tests on GLib based ports after r226355.
2269
2270         The monitor can be created in the work queue thread too.
2271
2272         * platform/glib/FileMonitorGLib.cpp:
2273         (WebCore::FileMonitor::FileMonitor):
2274
2275 2018-01-03  Carlos Garcia Campos  <cgarcia@igalia.com>
2276
2277         [GTK] Crash destroying WebCore::FileMonitor
2278         https://bugs.webkit.org/show_bug.cgi?id=181138
2279
2280         Reviewed by Michael Catanzaro.
2281
2282         Ensure that platform file monitor is always created and destroyed in the work queue thread synchronously.
2283
2284         * platform/FileMonitor.h:
2285         * platform/glib/FileMonitorGLib.cpp:
2286         (WebCore::FileMonitor::FileMonitor):
2287         (WebCore::FileMonitor::~FileMonitor):
2288         (WebCore::FileMonitor::didChange):
2289
2290 2018-01-02  Joseph Pecoraro  <pecoraro@apple.com>
2291
2292         Web Inspector: Slow open time enumerating system fonts (FontCache::systemFontFamilies)
2293         https://bugs.webkit.org/show_bug.cgi?id=180979
2294         <rdar://problem/36146670>
2295
2296         Reviewed by Matt Baker.
2297
2298         * platform/graphics/cocoa/FontCacheCoreText.cpp:
2299         (WebCore::FontCache::systemFontFamilies):
2300         Switch to the original Mac algorithm before r180979 that uses
2301         CTFontManagerCopyAvailableFontFamilyNames. Previously this wasn't
2302         available on iOS but now it is. This is a performance improvement on
2303         both platforms, but significantly so on macOS. It also finds more,
2304         valid, family names.
2305
2306 2018-01-02  Yusuke Suzuki  <utatane.tea@gmail.com>
2307
2308         Unreviewed, fix GCC warning by using #include
2309         https://bugs.webkit.org/show_bug.cgi?id=181189
2310
2311         This file is included in C++ files. Use #include instead of #import to suppress warning in GCC.
2312
2313         * platform/PromisedBlobInfo.h:
2314
2315 2017-12-28  Yusuke Suzuki  <utatane.tea@gmail.com>
2316
2317         Remove std::chrono completely
2318         https://bugs.webkit.org/show_bug.cgi?id=181186
2319
2320         Reviewed by Alex Christensen.
2321
2322         Use MonotonicTime, WallTime, and Seconds instead.
2323         Changes are mechanical ones. But persistent network cache data is changed.
2324         So we bump the version number of the cache storage.
2325
2326         * Modules/indexeddb/server/IDBServer.cpp:
2327         (WebCore::IDBServer::IDBServer::closeAndDeleteDatabasesModifiedSince):
2328         (WebCore::IDBServer::removeAllDatabasesForOriginPath):
2329         (WebCore::IDBServer::IDBServer::performCloseAndDeleteDatabasesModifiedSince):
2330         (WebCore::IDBServer::IDBServer::performCloseAndDeleteDatabasesForOrigins):
2331         * Modules/indexeddb/server/IDBServer.h:
2332         * Modules/webdatabase/DatabaseTracker.cpp:
2333         (WebCore::DatabaseTracker::deleteDatabasesModifiedSince):
2334         * Modules/webdatabase/DatabaseTracker.h:
2335         * dom/Document.cpp:
2336         (WebCore::Document::lastModified):
2337         * html/HTMLMediaElement.cpp:
2338         (WebCore::HTMLMediaElement::clearMediaCache):
2339         * html/HTMLMediaElement.h:
2340         (WebCore::HTMLMediaElement::clearMediaCache):
2341         * loader/CrossOriginPreflightResultCache.cpp:
2342         (WebCore::parseAccessControlMaxAge):
2343         (WebCore::CrossOriginPreflightResultCacheItem::parse):
2344         (WebCore::CrossOriginPreflightResultCacheItem::allowsRequest const):
2345         * loader/CrossOriginPreflightResultCache.h:
2346         * loader/cache/CachedResource.cpp:
2347         (WebCore::CachedResource::CachedResource):
2348         (WebCore::CachedResource::freshnessLifetime const):
2349         (WebCore::CachedResource::responseReceived):
2350         (WebCore::CachedResource::updateResponseAfterRevalidation):
2351         * loader/cache/CachedResource.h:
2352         * platform/FileSystem.cpp:
2353         (WebCore::FileSystem::getFileModificationTime):
2354         * platform/FileSystem.h:
2355         * platform/SearchPopupMenu.h:
2356         * platform/cocoa/SearchPopupMenuCocoa.h:
2357         * platform/cocoa/SearchPopupMenuCocoa.mm:
2358         (WebCore::toSystemClockTime):
2359         (WebCore::toNSDateFromSystemClock):
2360         (WebCore::removeRecentlyModifiedRecentSearches):
2361         * platform/graphics/MediaPlayer.cpp:
2362         (WebCore::MediaPlayer::clearMediaCache):
2363         * platform/graphics/MediaPlayer.h:
2364         * platform/graphics/MediaPlayerPrivate.h:
2365         (WebCore::MediaPlayerPrivateInterface::clearMediaCache):
2366         * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.h:
2367         * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
2368         (WebCore::toSystemClockTime):
2369         (WebCore::MediaPlayerPrivateAVFoundationObjC::clearMediaCache):
2370         * platform/graphics/mac/MediaPlayerPrivateQTKit.h:
2371         * platform/graphics/mac/MediaPlayerPrivateQTKit.mm:
2372         (WebCore::MediaPlayerPrivateQTKit::clearMediaCache):
2373         * platform/network/CacheValidation.cpp:
2374         (WebCore::computeCurrentAge):
2375         (WebCore::computeFreshnessLifetimeForHTTPFamily):
2376         (WebCore::updateRedirectChainStatus):
2377         (WebCore::redirectChainAllowsReuse):
2378         (WebCore::parseCacheControlDirectives):
2379         * platform/network/CacheValidation.h:
2380         (WebCore::RedirectChainCacheStatus::RedirectChainCacheStatus):
2381         * platform/network/HTTPParsers.cpp:
2382         (WebCore::parseHTTPDate):
2383         * platform/network/HTTPParsers.h:
2384         * platform/network/PlatformCookieJar.h:
2385         * platform/network/ResourceResponseBase.cpp:
2386         (WebCore::ResourceResponseBase::cacheControlMaxAge const):
2387         (WebCore::parseDateValueInHeader):
2388         (WebCore::ResourceResponseBase::date const):
2389         (WebCore::ResourceResponseBase::age const):
2390         (WebCore::ResourceResponseBase::expires const):
2391         (WebCore::ResourceResponseBase::lastModified const):
2392         * platform/network/ResourceResponseBase.h:
2393         * platform/network/cf/CookieJarCFNet.cpp:
2394         (WebCore::deleteAllCookiesModifiedSince):
2395         * platform/network/curl/CookieJarCurl.cpp:
2396         (WebCore::CookieJarCurlFileSystem::deleteAllCookiesModifiedSince):
2397         (WebCore::deleteAllCookiesModifiedSince):
2398         * platform/network/curl/CookieJarCurl.h:
2399         * platform/network/curl/CurlCacheEntry.cpp:
2400         (WebCore::CurlCacheEntry::CurlCacheEntry):
2401         (WebCore::CurlCacheEntry::isCached):
2402         (WebCore::CurlCacheEntry::parseResponseHeaders):
2403         * platform/network/curl/CurlCacheEntry.h:
2404         * platform/network/mac/CookieJarMac.mm:
2405         (WebCore::deleteAllCookiesModifiedSince):
2406         * platform/network/soup/CookieJarSoup.cpp:
2407         (WebCore::deleteAllCookiesModifiedSince):
2408         * platform/win/SearchPopupMenuWin.cpp:
2409         (WebCore::SearchPopupMenuWin::loadRecentSearches):
2410         * rendering/RenderSearchField.cpp:
2411         (WebCore::RenderSearchField::addSearchResult):
2412
2413 2018-01-02  Wenson Hsieh  <wenson_hsieh@apple.com>
2414
2415         [Attachment Support] Introduce data structures and IPC support for writing promised blobs
2416         https://bugs.webkit.org/show_bug.cgi?id=181189
2417
2418         Reviewed by Tim Horton.
2419
2420         Introduces a new header containing structs to be used for writing blob data when dragging. PromisedBlobInfo
2421         represents information needed to declare data on the pasteboard that will eventually be provided via a Blob.
2422         This includes the type and filename of the Blob-backed content. PromisedBlobData represents information needed
2423         to actually deliver the Blob's content to the platform, and is sent some time after its corresponding
2424         PromisedBlobInfo. The content may either be in the form of a file path (as is the case using the previous
2425         declareAndWriteAttachment codepath) or a data buffer (which we would use if the Blob is not already backed by a
2426         file on disk).
2427
2428         No new tests, since there is no observable change in functionality yet.
2429
2430         * WebCore.xcodeproj/project.pbxproj:
2431         * platform/PromisedBlobInfo.h: Added.
2432         (WebCore::PromisedBlobInfo::operator bool const):
2433         (WebCore::PromisedBlobData::hasData const):
2434         (WebCore::PromisedBlobData::hasFile const):
2435         (WebCore::PromisedBlobData::operator bool const):
2436         (WebCore::PromisedBlobData::fulfills const):
2437
2438 2018-01-02  Brady Eidson  <beidson@apple.com>
2439
2440         Make MessagePortChannel::takeAllMessagesFromRemote asynchronous.
2441         https://bugs.webkit.org/show_bug.cgi?id=181205
2442
2443         Reviewed by Alex Christensen.
2444
2445         No new tests (No behavior change)
2446
2447         This is needed for the ongoing WK2 MessagePort work.
2448
2449         For WK1 in-process MessagePorts it is still synchronous; no behavior change.
2450
2451         * dom/InProcessMessagePortChannel.cpp:
2452         (WebCore::InProcessMessagePortChannel::takeAllMessagesFromRemote):
2453         * dom/InProcessMessagePortChannel.h:
2454
2455         * dom/MessagePort.cpp:
2456         (WebCore::MessagePort::dispatchMessages):
2457         * dom/MessagePortChannel.h:
2458
2459 2018-01-02  Jiewen Tan  <jiewen_tan@apple.com>
2460
2461         Add a WebAuthentication runtime feature flag
2462         https://bugs.webkit.org/show_bug.cgi?id=181220
2463         <rdar://problem/36055305>
2464
2465         Reviewed by Brent Fulgham.
2466
2467         This patch basically renames the CredentialManagement runtime feature flag into
2468         WebAuthentication runtime feature flag.
2469
2470         No tests.
2471
2472         * Modules/credentialmanagement/BasicCredential.idl:
2473         * Modules/credentialmanagement/CredentialsContainer.idl:
2474         * Modules/credentialmanagement/NavigatorCredentials.idl:
2475         * Modules/webauthn/PublicKeyCredential.idl:
2476         * page/RuntimeEnabledFeatures.h:
2477         (WebCore::RuntimeEnabledFeatures::setWebAuthenticationEnabled):
2478         (WebCore::RuntimeEnabledFeatures::webAuthenticationEnabled const):
2479         (WebCore::RuntimeEnabledFeatures::setCredentialManagementEnabled): Deleted.
2480         (WebCore::RuntimeEnabledFeatures::credentialManagementEnabled const): Deleted.
2481
2482 2018-01-02  Wenson Hsieh  <wenson_hsieh@apple.com>
2483
2484         [Attachment Support] Don't Blob-convert images and attachments with https:, http: or data: urls
2485         https://bugs.webkit.org/show_bug.cgi?id=181143
2486         <rdar://problem/36200381>
2487
2488         Reviewed by Tim Horton.
2489
2490         Clients such as Mail would expect pasting or dropping an image with src="https://..." to result in the source
2491         URL being preserved (i.e. staying as remote images) instead of creating image attachments out of them. This
2492         patch hooks into the shouldConvertToBlob() check added in r226272 so that it applies to attachment element
2493         replacement as well.
2494
2495         Test: WKAttachmentTests.DoNotInsertDataURLImagesAsAttachments
2496
2497         * editing/cocoa/WebContentReaderCocoa.mm:
2498         (WebCore::shouldConvertToBlob):
2499         (WebCore::replaceRichContentWithAttachments):
2500
2501 2018-01-02  Brady Eidson  <beidson@apple.com>
2502
2503         Identify MessagePorts by a globally unique MessagePortIdentifier.
2504         https://bugs.webkit.org/show_bug.cgi?id=181172
2505
2506         Reviewed by Alex Christensen.
2507
2508         No new tests (Behavior change covered by all existing tests).
2509
2510         This cleans up the abstract MessagePortChannel interface to be in terms of identifiers
2511         instead of actual MessagePort objects.
2512         
2513         The identifiers are compounded with the current ProcessIdentifier meaning they are global
2514         across all processes for the running UI process, enabling easy cross-process communication.
2515         
2516         (Actual cross-process communication comes in a followup)
2517         
2518         * WebCore.xcodeproj/project.pbxproj:
2519         
2520         * dom/InProcessMessagePortChannel.cpp:
2521         (WebCore::InProcessMessagePortChannel::createChannelBetweenPorts):
2522         (WebCore::InProcessMessagePortChannel::isConnectedTo):
2523         (WebCore::InProcessMessagePortChannel::entangleWithRemoteIfOpen):
2524         (WebCore::InProcessMessagePortChannel::entangleIfOpen): Deleted.
2525         * dom/InProcessMessagePortChannel.h:
2526         
2527         * dom/MessageChannel.cpp:
2528         (WebCore::MessageChannel::MessageChannel):
2529         (WebCore::m_port2):
2530         
2531         * dom/MessagePort.cpp:
2532         (WebCore::allMessagePortsLock):
2533         (WebCore::MessagePort::ref const):
2534         (WebCore::MessagePort::deref const):
2535         (WebCore::MessagePort::existingMessagePortForIdentifier):
2536         (WebCore::MessagePort::MessagePort):
2537         (WebCore::MessagePort::~MessagePort):
2538         (WebCore::MessagePort::postMessage):
2539         (WebCore::MessagePort::entangleWithRemote):
2540         (WebCore::MessagePort::entanglePorts):
2541         (WebCore::MessagePort::entangle): Deleted.
2542         * dom/MessagePort.h:
2543         
2544         * dom/MessagePortChannel.h:
2545         
2546         * dom/MessagePortIdentifier.h: Added.
2547         (WebCore::operator==):
2548         (WebCore::MessagePortIdentifier::encode const):
2549         (WebCore::MessagePortIdentifier::decode):
2550         (WebCore::MessagePortIdentifier::hash const):
2551         (WTF::MessagePortIdentifierHash::hash):
2552         (WTF::MessagePortIdentifierHash::equal):
2553         (WTF::HashTraits<WebCore::MessagePortIdentifier>::emptyValue):
2554         (WTF::HashTraits<WebCore::MessagePortIdentifier>::constructDeletedValue):
2555         (WTF::HashTraits<WebCore::MessagePortIdentifier>::isDeletedValue):
2556
2557 2018-01-02  Youenn Fablet  <youenn@apple.com>
2558
2559         Memory cache should not reuse resources with different credential fetch option
2560         https://bugs.webkit.org/show_bug.cgi?id=181212
2561
2562         Reviewed by Alex Christensen.
2563
2564         Covered by rebased test.
2565
2566         * loader/cache/CachedResourceLoader.cpp:
2567         (WebCore::CachedResourceLoader::determineRevalidationPolicy const):
2568
2569 2018-01-02  Jiewen Tan  <jiewen_tan@apple.com>
2570
2571         Update Credential Management API for WebAuthentication
2572         https://bugs.webkit.org/show_bug.cgi?id=181082
2573         <rdar://problem/36055239>
2574
2575         Reviewed by Brent Fulgham.
2576
2577         Part 2/2
2578
2579         This patch implements Core API from Credential Management API: https://www.w3.org/TR/credential-management-1/#core.
2580         which is required by WebAuthN. It also sets the CredentialManagement runtime flag to enable testing. Note that it
2581         introduces a dummy PublicKeyCredential interface for testing functionalities of the Credential interface, which
2582         cannot be instantiated.
2583
2584         Tests: http/wpt/credential-management/credentialscontainer-create-basics.https.html
2585                http/wpt/credential-management/credentialscontainer-get-basics.https.html
2586                http/wpt/credential-management/credentialscontainer-preventSilentAccess-basics.https.html
2587                http/wpt/credential-management/idl.https.html
2588
2589         * CMakeLists.txt:
2590         * DerivedSources.make:
2591         * Modules/credentialmanagement/BasicCredential.cpp:
2592         (WebCore::BasicCredential::BasicCredential):
2593         (WebCore::BasicCredential::type const):
2594         * Modules/credentialmanagement/BasicCredential.h:
2595         (WebCore::BasicCredential::discovery const):
2596         * Modules/credentialmanagement/BasicCredential.idl:
2597         * Modules/credentialmanagement/CredentialCreationOptions.h:
2598         * Modules/credentialmanagement/CredentialCreationOptions.idl:
2599         * Modules/credentialmanagement/CredentialRequestOptions.h:
2600         * Modules/credentialmanagement/CredentialRequestOptions.idl:
2601         * Modules/credentialmanagement/CredentialsContainer.cpp:
2602         (WebCore::CredentialsContainer::CredentialsContainer):
2603         (WebCore::CredentialsContainer::isSameOriginWithItsAncestors):
2604         (WebCore::CredentialsContainer::dispatchTask):
2605         (WebCore::CredentialsContainer::get):
2606         (WebCore::CredentialsContainer::store):
2607         (WebCore::CredentialsContainer::isCreate):
2608         (WebCore::CredentialsContainer::preventSilentAccess):
2609         * Modules/credentialmanagement/CredentialsContainer.h:
2610         (WebCore::CredentialsContainer::create):
2611         (WebCore::CredentialsContainer::CredentialsContainer): Deleted.
2612         * Modules/credentialmanagement/CredentialsContainer.idl:
2613         * Modules/credentialmanagement/NavigatorCredentials.cpp:
2614         (WebCore::NavigatorCredentials::credentials):
2615         * Modules/credentialmanagement/NavigatorCredentials.h:
2616         * Modules/credentialmanagement/NavigatorCredentials.idl:
2617         * Modules/webauthn/PublicKeyCredential.cpp: Copied from Source/WebCore/Modules/credentialmanagement/BasicCredential.cpp.
2618         (WebCore::PublicKeyCredential::PublicKeyCredential):
2619         (WebCore::PublicKeyCredential::collectFromCredentialStore):
2620         (WebCore::PublicKeyCredential::discoverFromExternalSource):
2621         (WebCore::PublicKeyCredential::store):
2622         (WebCore::PublicKeyCredential::create):
2623         * Modules/webauthn/PublicKeyCredential.h: Copied from Source/WebCore/Modules/credentialmanagement/BasicCredential.cpp.
2624         * Modules/webauthn/PublicKeyCredential.idl: Copied from Source/WebCore/Modules/credentialmanagement/BasicCredential.idl.
2625         * Sources.txt:
2626         * WebCore.xcodeproj/project.pbxproj:
2627         * bindings/js/WebCoreBuiltinNames.h:
2628         * page/RuntimeEnabledFeatures.h:
2629
2630 2018-01-02  Oleksandr Skachkov  <gskachkov@gmail.com>
2631
2632         WebAssembly: sending module to iframe fails
2633         https://bugs.webkit.org/show_bug.cgi?id=179263
2634
2635         Reviewed by JF Bastien.
2636
2637         Allow use WebAssembly.Module as input parameters for postMessage 
2638         in window and iframe object. To prevent sending message to iframe
2639         that is not ready, in iframe-* test we are waiting message from
2640         iframe only after that we send message to it.   
2641
2642         Tests: wasm/iframe-parent-postmessage.html
2643                wasm/iframe-postmessage.html
2644                wasm/window-postmessage.html
2645
2646         * bindings/js/SerializedScriptValue.cpp:
2647         (WebCore::CloneSerializer::dumpIfTerminal):
2648         * bindings/js/SerializedScriptValue.h:
2649         * page/DOMWindow.cpp:
2650         (WebCore::DOMWindow::postMessage):
2651
2652 == Rolled over to ChangeLog-2018-01-01 ==