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