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