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