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