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