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