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