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