HTMLElement factory doesn't need to call MediaPlayer::isAvailable
[WebKit-https.git] / Source / WebCore / ChangeLog
1 2018-03-23  Eric Carlson  <eric.carlson@apple.com>
2
3         HTMLElement factory doesn't need to call MediaPlayer::isAvailable
4         https://bugs.webkit.org/show_bug.cgi?id=183946
5         <rdar://problem/38802687>
6
7         Reviewed by Youenn Fablet.
8
9         Test: media/media-disabled.html
10
11         * dom/make_names.pl:
12         (printConstructorInterior):
13         * page/Settings.yaml:
14         * page/SettingsDefaultValues.h:
15
16 2018-03-23  David Kilzer  <ddkilzer@apple.com>
17
18         Stop using dispatch_set_target_queue()
19         <https://webkit.org/b/183908>
20         <rdar://problem/33553533>
21
22         Reviewed by Daniel Bates.
23
24         No new tests since no change in behavior.
25
26         * platform/mediastream/mac/AVMediaCaptureSource.mm:
27         (WebCore::globaVideoCaptureSerialQueue): Remove use of
28         dispatch_set_target_queue() by changing dispatch_queue_create()
29         to dispatch_queue_create_with_target().
30
31 2018-03-23  Youenn Fablet  <youenn@apple.com>
32
33         Use libwebrtc ObjectiveC H264 encoder and decoder
34         https://bugs.webkit.org/show_bug.cgi?id=183912
35
36         Reviewed by Eric Carlson.
37
38         No observable change of behavior.
39         Made use of libwebrtc WebKit utilities.
40         Updated RealtimeINcomingVideoSourceCocoa as it now receives ObjcVideoFrame.
41
42         * Configurations/WebCore.xcconfig:
43         * SourcesCocoa.txt:
44         * WebCore.xcodeproj/project.pbxproj:
45         * platform/mediastream/libwebrtc/LibWebRTCProviderCocoa.cpp:
46         (WebCore::LibWebRTCProviderCocoa::~LibWebRTCProviderCocoa):
47         (WebCore::LibWebRTCProviderCocoa::setH264HardwareEncoderAllowed):
48         (WebCore::LibWebRTCProviderCocoa::createDecoderFactory):
49         (WebCore::LibWebRTCProviderCocoa::createEncoderFactory):
50         (WebCore::LibWebRTCProviderCocoa::setActive):
51         * platform/mediastream/libwebrtc/LibWebRTCProviderCocoa.h:
52         * platform/mediastream/mac/RealtimeIncomingVideoSourceCocoa.mm: Renamed from Source/WebCore/platform/mediastream/mac/RealtimeIncomingVideoSourceCocoa.cpp.
53         (WebCore::RealtimeIncomingVideoSourceCocoa::pixelBufferFromVideoFrame):
54         (WebCore::RealtimeIncomingVideoSourceCocoa::OnFrame):
55         * testing/Internals.cpp: Removed commented out include.
56
57 2018-03-23  Youenn Fablet  <youenn@apple.com>
58
59         DocumentThreadableLoader should send credentials after redirections and preflight if fetch option credentials is include
60         https://bugs.webkit.org/show_bug.cgi?id=183928
61
62         Reviewed by Chris Dumez.
63
64         Tests: imported/w3c/web-platform-tests/fetch/api/cors/cors-cookies-redirect.any.html
65                imported/w3c/web-platform-tests/fetch/api/cors/cors-cookies-redirect.any.worker.html
66
67         In case mode is include, keep sending credentials even after redirection with preflight.
68
69         * loader/DocumentThreadableLoader.cpp:
70         (WebCore::DocumentThreadableLoader::redirectReceived):
71
72 2018-03-23  Tim Horton  <timothy_horton@apple.com>
73
74         Fix the build after r229858
75
76         * platform/graphics/cocoa/GraphicsContext3DCocoa.mm:
77
78 2018-03-23  Youenn Fablet  <youenn@apple.com>
79
80         Allow fully whitelisted plug-ins to match non HTTP URLs
81         https://bugs.webkit.org/show_bug.cgi?id=183938
82         rdar://problem/38534312
83
84         Reviewed by Chris Dumez.
85
86         Covered by manual testing and unit testing.
87
88         * platform/URL.cpp:
89         (WebCore::URL::isMatchingDomain const):
90
91 2018-03-23  Youenn Fablet  <youenn@apple.com>
92
93         ActiveDOMObject should assert that they are destroyed in the thread they are created
94         https://bugs.webkit.org/show_bug.cgi?id=183671
95
96         Reviewed by Chris Dumez.
97
98         No change of behavior.
99         Moved MessagePort assertion to ActiveDOMObject.
100
101         * dom/ActiveDOMObject.cpp:
102         (WebCore::ActiveDOMObject::~ActiveDOMObject):
103         * dom/ActiveDOMObject.h:
104         * dom/MessagePort.cpp:
105         (WebCore::MessagePort::~MessagePort):
106         * dom/MessagePort.h:
107
108 2018-03-23  Youenn Fablet  <youenn@apple.com>
109
110         Safari WebKitWebRTCAudioModule crash during <video> tag update when audio track present in MediaStream
111         https://bugs.webkit.org/show_bug.cgi?id=181180
112         <rdar://problem/36302375>
113
114         Reviewed by Eric Carlson.
115
116         Test: webrtc/video-update-often.html
117
118         AudioTrackPrivateMediaStreamCocoa needs to be destroyed in the main thread since it owns a Ref to its MediaStreamTrackPrivate.
119         We can still ref it on a background thread but we always deref it on the main thread.
120
121         * platform/mediastream/mac/AudioTrackPrivateMediaStreamCocoa.cpp:
122         (WebCore::AudioTrackPrivateMediaStreamCocoa::audioSamplesAvailable):
123         (WebCore::AudioTrackPrivateMediaStreamCocoa::render):
124
125 2018-03-23  Sergio Villar Senin  <svillar@igalia.com>
126
127         [css-grid] Fix auto repeat tracks computation with definite min sizes
128         https://bugs.webkit.org/show_bug.cgi?id=183933
129
130         Reviewed by Javier Fernandez.
131
132         Indefinitely sized containers use the specified definite min-size (if any) as available
133         space in order to compute the number of auto repeat tracks to create. A bug in that code was
134         causing the grid to be one track larger than expected. That was only happening in the case
135         of the free space being a multiple of the total size of the autorepeat tracks.
136
137         Test: imported/w3c/web-platform-tests/css/css-grid/grid-definition/grid-inline-auto-repeat-001.html
138
139         * rendering/RenderGrid.cpp:
140         (WebCore::RenderGrid::computeAutoRepeatTracksCount const):
141
142 2018-03-23  Miguel Gomez  <magomez@igalia.com>
143
144         [GTK][WPE] Avoid software color conversion inside BitmapTextureGL
145         https://bugs.webkit.org/show_bug.cgi?id=183892
146
147         Reviewed by Žan Doberšek.
148
149         Always use RGBA format on BitmapTextureGL (when no other format is specifically requested). When
150         the texture is updated from BGRA content, use a flag to indicate the shader to perform a color
151         conversion during the painting. This way we don't need to swap the R and B components on the CPU.
152         Also, remove one of the lists in BitmapTexturePool as now all of them have the same format, and
153         remove the UpdateContentsFlag as we never need to modify the original image data.
154
155         Covered by existent tests.
156
157         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp:
158         (WebCore::MediaPlayerPrivateGStreamerBase::updateTexture):
159         * platform/graphics/texmap/BitmapTexture.cpp:
160         (WebCore::BitmapTexture::updateContents):
161         * platform/graphics/texmap/BitmapTexture.h:
162         * platform/graphics/texmap/BitmapTextureGL.cpp:
163         (WebCore::BitmapTextureGL::BitmapTextureGL):
164         (WebCore::BitmapTextureGL::didReset):
165         (WebCore::BitmapTextureGL::updateContents):
166         (WebCore::BitmapTextureGL::applyFilters):
167         (WebCore::swizzleBGRAToRGBA): Deleted.
168         (WebCore::BitmapTextureGL::updateContentsNoSwizzle): Deleted.
169         * platform/graphics/texmap/BitmapTextureGL.h:
170         (WebCore::BitmapTextureGL::colorConvertFlags const):
171         * platform/graphics/texmap/BitmapTexturePool.cpp:
172         (WebCore::BitmapTexturePool::acquireTexture):
173         (WebCore::BitmapTexturePool::releaseUnusedTexturesTimerFired):
174         * platform/graphics/texmap/BitmapTexturePool.h:
175         * platform/graphics/texmap/GraphicsLayerTextureMapper.cpp:
176         (WebCore::GraphicsLayerTextureMapper::updateBackingStoreIfNeeded):
177         * platform/graphics/texmap/TextureMapperContextAttributes.cpp:
178         (WebCore::TextureMapperContextAttributes::get):
179         * platform/graphics/texmap/TextureMapperContextAttributes.h:
180         * platform/graphics/texmap/TextureMapperGL.cpp:
181         (WebCore::TextureMapperGL::drawNumber):
182         (WebCore::TextureMapperGL::drawTexture):
183         * platform/graphics/texmap/TextureMapperGL.h:
184         * platform/graphics/texmap/TextureMapperLayer.cpp:
185         (WebCore::TextureMapperLayer::paintIntoSurface):
186         * platform/graphics/texmap/TextureMapperPlatformLayerBuffer.cpp:
187         (WebCore::TextureMapperPlatformLayerBuffer::paintToTextureMapper):
188         * platform/graphics/texmap/TextureMapperTile.cpp:
189         (WebCore::TextureMapperTile::updateContents):
190         * platform/graphics/texmap/TextureMapperTile.h:
191         * platform/graphics/texmap/TextureMapperTiledBackingStore.cpp:
192         (WebCore::TextureMapperTiledBackingStore::updateContentsFromImageIfNeeded):
193         (WebCore::TextureMapperTiledBackingStore::updateContents):
194         * platform/graphics/texmap/TextureMapperTiledBackingStore.h:
195
196 2018-03-23  Yusuke Suzuki  <utatane.tea@gmail.com>
197
198         [WTF] Add standard containers with FastAllocator specialization
199         https://bugs.webkit.org/show_bug.cgi?id=183789
200
201         Reviewed by Darin Adler.
202
203         * Modules/indexeddb/IDBKeyData.h:
204         * Modules/mediasource/SampleMap.h:
205         * Modules/mediasource/SourceBuffer.cpp:
206         * Modules/webauthn/cbor/CBORValue.h:
207         It did not use FastAllocator for its container.
208
209         * page/WheelEventTestTrigger.h:
210         * platform/audio/PlatformMediaSessionManager.h:
211         * platform/graphics/avfoundation/objc/ImageDecoderAVFObjC.h:
212         * platform/graphics/avfoundation/objc/ImageDecoderAVFObjC.mm:
213         * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
214         * platform/graphics/avfoundation/objc/SourceBufferPrivateAVFObjC.mm:
215         * platform/graphics/cv/VideoTextureCopierCV.cpp:
216         (WebCore::YCbCrToRGBMatrixForRangeAndTransferFunction):
217         * platform/mock/mediasource/MockSourceBufferPrivate.cpp:
218         * platform/wpe/PlatformPasteboardWPE.cpp:
219         * rendering/OrderIterator.h:
220
221 2018-03-23  Antoine Quint  <graouts@apple.com>
222
223         [Web Animations] infinite repeat counts aren't reflected for CSS Animations
224         https://bugs.webkit.org/show_bug.cgi?id=183932
225
226         Reviewed by Dean Jackson.
227
228         The "infinite" value for animation-repeat-count is reflected as a special value which resolves to -1. We need to check
229         for this special value before setting the iterations count on the AnimationEffectTimingReadOnly object.
230
231         * animation/CSSAnimation.cpp:
232         (WebCore::CSSAnimation::syncPropertiesWithBackingAnimation):
233
234 2018-03-22  Antoine Quint  <graouts@apple.com>
235
236         [Web Animations] Correctly cancel animations when a parent gets a "display: none" style or when an element is removed
237         https://bugs.webkit.org/show_bug.cgi?id=183919
238
239         Reviewed by Dean Jackson.
240
241         The old CSSAnimationController provided a cancelAnimations(Element&) method that allowed for animations for a given element
242         to be canceled when a parent element in the hierarchy gets a "display: none" style or if an element with animations is removed.
243         We add a similar cancelAnimationsForElement(Element&) method on AnimationTimeline and update CSSAnimationController::cancelAnimations()
244         call sites to use AnimationTimeline::cancelAnimationsForElement() when the flag to use Web Animations is on.
245
246         * animation/AnimationTimeline.cpp:
247         (WebCore::AnimationTimeline::cancelAnimationsForElement): Iterate over all animations for the provided element and call cancel() on them.
248         * animation/AnimationTimeline.h:
249         * animation/DocumentTimeline.cpp:
250         (WebCore::DocumentTimeline::animatedStyleForRenderer): Drive-by fix while I was reviewed call sites to animationsForElement() to make
251         sure we don't create extra RefPtr<> objects.
252         * dom/Element.cpp:
253         (WebCore::Element::removedFromAncestor): Call AnimationTimeline::cancelAnimationsForElement() if the Web Animations flag is on when an
254         element is removed.
255         * dom/PseudoElement.cpp:
256         (WebCore::PseudoElement::clearHostElement): Call AnimationTimeline::cancelAnimationsForElement() if the Web Animations flag is on when
257         a pseudo-element is removed.
258         * rendering/updating/RenderTreeUpdater.cpp:
259         (WebCore::RenderTreeUpdater::tearDownRenderers): Call AnimationTimeline::cancelAnimationsForElement() if the Web Animations flag is on
260         for all children elements when an element gets a "display: none" style.
261
262 2018-03-23  Antoine Quint  <graouts@apple.com>
263
264         [Web Animations] Animated transform styles are ignored when calling getComputedStyle()
265         https://bugs.webkit.org/show_bug.cgi?id=183918
266
267         Reviewed by Dean Jackson.
268
269         Strictly looking at whether the renderer has a transform is a bad idea when determining whether a
270         transform is applied for an element. Looking at the RenderStyle is preferable because in the case
271         of animations running on the compositor, such as a transform-only animation or transition, the
272         renderer doesn't necessarily have a transform style on it, since we don't blend properties in
273         software as the animation progresses. Instead, all of the blending is performed by the compositor,
274         and only the computed style object has the software-blended transform style on it.
275
276         We do need to account for inline renderers though as these do not support transforms.
277
278         * css/CSSComputedStyleDeclaration.cpp:
279         (WebCore::computedTransform):
280
281 2018-03-22  Antoine Quint  <graouts@apple.com>
282
283         [Web Animations] Support "transition: all" for CSS Transitions as Web Animations
284         https://bugs.webkit.org/show_bug.cgi?id=183917
285
286         Reviewed by Dean Jackson.
287
288         We now support "transition: all" CSS Transitions by iterating over all known CSS properties should the mode
289         of the backing animation be AnimateAll. Any property that we find to have a different value in the previous
290         and current style will have a backing CSSTransition object created for it. To support this, we now explicitly
291         provide a CSSPropertyID when creating a CSSTransition since we can no longer infer the transition property
292         from the backing animation, as Animation objects with mode AnimateAll report CSSPropertyInvalid as their
293         property.
294
295         * animation/AnimationTimeline.cpp:
296         (WebCore::shouldBackingAnimationBeConsideredForCSSTransition): New method that checks whether a given backing
297         Animation object is suitable for consideration as a CSSTransition, where the mode must not be either AnimateNone
298         or AnimateUnknownProperty, and should the mode be AnimateSingleProperty, the property must not be CSSPropertyInvalid.
299         (WebCore::AnimationTimeline::updateCSSTransitionsForElement): We now assemble the list of previously animated
300         properties by looking at the m_elementToCSSTransitionByCSSPropertyID map and getting its keys. Then we compile
301         all backing Animation objects found in the old style that match the conditions enforced by the new method
302         shouldBackingAnimationBeConsideredForCSSTransition(). Then as we iterate over backing Animation objects found
303         in the new style, we iterate over all known CSS properties if the mode is AnimateAll, indicating that we're dealing
304         with a "transition: all" style. If we're dealing with a single property, we only process that single property.
305         * animation/CSSTransition.cpp:
306         (WebCore::CSSTransition::create): Expect a new CSSPropertyID parameter when creating a new CSSTransition since
307         we can no longer infer it from the backing Animation object.
308         (WebCore::CSSTransition::CSSTransition): Expect a new CSSPropertyID parameter when creating a new CSSTransition
309         since we can no longer infer it from the backing Animation object.
310         (WebCore::CSSTransition::matchesBackingAnimationAndStyles const): We can no longer use the == overloaded operator
311         for backing Animation objects to determine whether their respective properties match since this would compare the
312         "property" member of both Animation objects and when going from a "transition: all" style to one targeting a single
313         property, we would falsely identify mis-matching Animation objects. Instead, we pass a false flag to animationsMatch()
314         which indicates that we don't care about matching the transition property itself.
315         * animation/CSSTransition.h: Expose a new property() accessor which returns the CSSPropertyID passed at construction.
316         * animation/KeyframeEffectReadOnly.cpp:
317         (WebCore::KeyframeEffectReadOnly::computeCSSTransitionBlendingKeyframes): Use the new property() accessor on
318         CSSTransition to get at the transition property.
319         * platform/animation/Animation.cpp:
320         (WebCore::Animation::animationsMatch const): Replace the boolean parameter, which was not in use in WebCore, to indicate
321         whether we should match the property-related fields. We need this in CSSTransition::matchesBackingAnimationAndStyles().
322         * platform/animation/Animation.h:
323
324 2018-03-22  Tim Horton  <timothy_horton@apple.com>
325
326         Adopt WK_ALTERNATE_FRAMEWORKS_DIR in WebCore
327         https://bugs.webkit.org/show_bug.cgi?id=183930
328         <rdar://problem/38782249>
329
330         Reviewed by Dan Bernstein.
331
332         * Configurations/Base.xcconfig:
333         * Configurations/WebCore.xcconfig:
334         * Configurations/WebCoreTestSupport.xcconfig:
335
336 2018-03-22  Commit Queue  <commit-queue@webkit.org>
337
338         Unreviewed, rolling out r229876.
339         https://bugs.webkit.org/show_bug.cgi?id=183929
340
341         Some webrtc tests are timing out on iOS simulator (Requested
342         by youenn on #webkit).
343
344         Reverted changeset:
345
346         "Use libwebrtc ObjectiveC H264 encoder and decoder"
347         https://bugs.webkit.org/show_bug.cgi?id=183912
348         https://trac.webkit.org/changeset/229876
349
350 2018-03-22  Megan Gardner  <megan_gardner@apple.com>
351
352         Expose more system colors via CSS
353         https://bugs.webkit.org/show_bug.cgi?id=183764
354         <rdar://problem/36975898>
355
356         Reviewed by Tim Horton.
357
358         Test: fast/css/apple-system-control-colors.html
359
360         Expose Apple specific system colors via CSS.
361
362         * rendering/RenderThemeMac.mm:
363         (WebCore::RenderThemeMac::systemColor const):
364
365 2018-03-22  Nan Wang  <n_wang@apple.com>
366
367         AX: Web table row count is incorrect when role row is added to <tr> in DOM
368         https://bugs.webkit.org/show_bug.cgi?id=183922
369
370         Reviewed by Chris Fleizach.
371
372         Although the parent table for an ARIA grid row should be an ARIA table, we
373         should return the native table if the row is native <tr>.
374
375         Test: accessibility/row-with-aria-role-in-native-table.html
376
377         * accessibility/AccessibilityARIAGridRow.cpp:
378         (WebCore::AccessibilityARIAGridRow::parentTable const):
379
380 2018-03-22  Chris Dumez  <cdumez@apple.com>
381
382         Include security origin in the service worker process name
383         https://bugs.webkit.org/show_bug.cgi?id=183913
384
385         Reviewed by Youenn Fablet.
386
387         Updated localizable strings.
388
389         * English.lproj/Localizable.strings:
390
391 2018-03-22  Youenn Fablet  <youenn@apple.com>
392
393         Use libwebrtc ObjectiveC H264 encoder and decoder
394         https://bugs.webkit.org/show_bug.cgi?id=183912
395
396         Reviewed by Eric Carlson.
397
398         No observable change of behavior.
399         Made use of libwebrtc WebKit utilities.
400         Updated RealtimeINcomingVideoSourceCocoa as it now receives ObjcVideoFrame.
401
402         * Configurations/WebCore.xcconfig:
403         * SourcesCocoa.txt:
404         * WebCore.xcodeproj/project.pbxproj:
405         * platform/mediastream/libwebrtc/LibWebRTCProviderCocoa.cpp:
406         (WebCore::LibWebRTCProviderCocoa::~LibWebRTCProviderCocoa):
407         (WebCore::LibWebRTCProviderCocoa::setH264HardwareEncoderAllowed):
408         (WebCore::LibWebRTCProviderCocoa::createDecoderFactory):
409         (WebCore::LibWebRTCProviderCocoa::createEncoderFactory):
410         (WebCore::LibWebRTCProviderCocoa::setActive):
411         * platform/mediastream/libwebrtc/LibWebRTCProviderCocoa.h:
412         * platform/mediastream/mac/RealtimeIncomingVideoSourceCocoa.mm: Renamed from Source/WebCore/platform/mediastream/mac/RealtimeIncomingVideoSourceCocoa.cpp.
413         (WebCore::RealtimeIncomingVideoSourceCocoa::pixelBufferFromVideoFrame):
414         (WebCore::RealtimeIncomingVideoSourceCocoa::OnFrame):
415         * testing/Internals.cpp: Removed commented out include.
416
417 2018-03-22  Michael Catanzaro  <mcatanzaro@gnome.org>
418
419         Unreviewed, fix format string warnings in service worker code
420
421         On Linux x86_64, uint64_t is unsigned long, not unsigned long long.
422
423         * workers/service/ServiceWorkerContainer.cpp:
424         (WebCore::ServiceWorkerContainer::addRegistration):
425         (WebCore::ServiceWorkerContainer::removeRegistration):
426         (WebCore::ServiceWorkerContainer::updateRegistration):
427         (WebCore::ServiceWorkerContainer::jobFailedWithException):
428         (WebCore::ServiceWorkerContainer::jobResolvedWithRegistration):
429         (WebCore::ServiceWorkerContainer::jobResolvedWithUnregistrationResult):
430         (WebCore::ServiceWorkerContainer::startScriptFetchForJob):
431         (WebCore::ServiceWorkerContainer::jobFinishedLoadingScript):
432         (WebCore::ServiceWorkerContainer::jobFailedLoadingScript):
433
434 2018-03-22  Daniel Bates  <dabates@apple.com>
435
436         Expose SchemeRegistry::registerAsCanDisplayOnlyIfCanRequest() as WebKit SPI
437         https://bugs.webkit.org/show_bug.cgi?id=183907
438         <rdar://problem/38759127>
439
440         Reviewed by Alex Christensen.
441
442         Exports SchemeRegistry::registerAsCanDisplayOnlyIfCanRequest() so that we can use it from WebKit.
443
444         * platform/SchemeRegistry.h:
445
446 2018-03-22  Daniel Bates  <dabates@apple.com>
447
448         CSS mask images should be retrieved using potentially CORS-enabled fetch
449         https://bugs.webkit.org/show_bug.cgi?id=179983
450         <rdar://problem/35678149>
451
452         Reviewed by Brent Fulgham.
453
454         As per <https://drafts.fxtf.org/css-masking-1/#priv-sec> (Editor's Draft, 23 December 2017)
455         we should fetch CSS mask images using a potentially CORS-enabled fetch.
456
457         Both cross-origin CSS shape-outside images and CSS mask images may be sensitive to timing
458         attacks that can be used to reveal their pixel data when retrieved without regard to CORS.
459         For the same reason that we fetch CSS shape-outside images using a potentially CORS-enabled
460         fetch we should fetch CSS mask the same way. This also makes the behavior of WebKit more
461         closely align with the behavior in the spec.
462
463         Test: http/tests/security/css-mask-image.html
464
465         * style/StylePendingResources.cpp: Substitute LoadPolicy::NoCORS and LoadPolicy::Anonymous for
466         LoadPolicy::Normal and LoadPolicy::ShapeOutside, respectively, to match the terminology used
467         in the HTML, CSS Shapes Module Level 1, and CSS Masking Module Level 1 specs.
468         (WebCore::Style::loadPendingImage): Ditto.
469         (WebCore::Style::loadPendingResources): Use load policy LoadPolicy::Anonymous when fetching
470         a mask image or shape-outside image.
471
472 2018-03-22  Zalan Bujtas  <zalan@apple.com>
473
474         [Simple line layout] Text with letter spacing is not positioned properly.
475         https://bugs.webkit.org/show_bug.cgi?id=183079
476         <rdar://problem/38762569>
477
478         Reviewed by Antti Koivisto.
479
480         We need to recompute RenderText::m_canUseSimplifiedTextMeasuring when the font cascade changes
481         since we might not be able to use the fast path anymore.
482
483         Test: fast/text/simple-line-layout-dynamic-letter-word-spacing.html
484
485         * rendering/RenderText.cpp:
486         (WebCore::RenderText::styleDidChange):
487
488 2018-03-21  Antoine Quint  <graouts@apple.com>
489
490         [Web Animations] Make imported/mozilla/css-animations/test_event-dispatch.html pass reliably
491         https://bugs.webkit.org/show_bug.cgi?id=183845
492
493         Reviewed by Dean Jackson.
494
495         Finish the work to get DOM events for CSS Animations and CSS Transitions dispatching as specified.
496
497         * animation/AnimationEffectReadOnly.cpp: Move timeEpsilon to be shared as part of WebAnimationUtilities.h since we now need it in
498         WebAnimation::timeToNextRequiredTick().
499         * animation/AnimationTimeline.cpp:
500         (WebCore::AnimationTimeline::updateCSSAnimationsForElement): We add a pre-emptive return clause when we know that the AnimationList
501         for previous and current styles are a match.
502         * animation/CSSTransition.cpp:
503         (WebCore::CSSTransition::matchesBackingAnimationAndStyles const): Ensure we have a valid effect before downcasting it.
504         * animation/DeclarativeAnimation.cpp:
505         (WebCore::DeclarativeAnimation::initialize): We need to call pause() for declarative animations that aren't playing so that the animation's
506         playState is set correctly and the animation is not idle.
507         * animation/DocumentTimeline.cpp:
508         (WebCore::DocumentTimeline::updateAnimationSchedule): We no longer need to pass the current time to timeToNextRequiredTick() since the method has
509         been reworked to use the animation's current time, which is based on the timeline's current time.
510         (WebCore::DocumentTimeline::updateAnimations): Avoid creating a copy when iterating over pending hardware animations.
511         * animation/KeyframeEffectReadOnly.cpp:
512         (WebCore::KeyframeEffectReadOnly::stylesWouldYieldNewCSSTransitionsBlendingKeyframes const): We should never generate new blending keyframes if the
513         old and new styles contain the same value, since there would be no transition between two equal values, and we should only look at whether the new
514         style value and the recorded target value differ to determine if new blending keyframes are necessary.
515         * animation/WebAnimation.cpp:
516         (WebCore::WebAnimation::timeToNextRequiredTick const): We correct our scheduling code which was shown to be broken in several of the newly-imported
517         Mozilla tests. Any running animation is now scheduled to invalidate again on the next tick, and we use timeEpsilon from WebAnimationUtilities.h to
518         correctly check if we're right at the active threshold, when we also invalidate on the next tick. If our current time is negative, in other words
519         when the animation has not yet started, we schedule this animation's next tick to be the negative of that value. In all other cases, no invalidation
520         needs to be scheduled.
521         * animation/WebAnimation.h: We move updateFinishedState() to private since this method is not actually used outside of WebAnimation.cpp.
522         * animation/WebAnimationUtilities.h: Move timeEpsilon to be shared as part of WebAnimationUtilities.h.
523
524 2018-03-22  Tim Horton  <timothy_horton@apple.com>
525
526         Improve readability of WebCore's OTHER_LDFLAGS
527         https://bugs.webkit.org/show_bug.cgi?id=183909
528         <rdar://problem/38760992>
529
530         Reviewed by Dan Bernstein.
531
532         * Configurations/Base.xcconfig:
533         * Configurations/FeatureDefines.xcconfig:
534         * Configurations/WebCore.xcconfig:
535
536 2018-03-22  Tim Horton  <timothy_horton@apple.com>
537
538         Adopt USE(OPENGL[_ES]) in more places
539         https://bugs.webkit.org/show_bug.cgi?id=183882
540         <rdar://problem/37912195>
541
542         Reviewed by Dan Bernstein.
543
544         * platform/graphics/GraphicsContext3D.h:
545         * platform/graphics/cocoa/GraphicsContext3DCocoa.mm:
546         (WebCore::hasMuxableGPU):
547         (WebCore::GraphicsContext3DManager::updateHighPerformanceState):
548         (WebCore::GraphicsContext3D::GraphicsContext3D):
549         (WebCore::GraphicsContext3D::~GraphicsContext3D):
550         (WebCore::GraphicsContext3D::makeContextCurrent):
551         (WebCore::GraphicsContext3D::checkGPUStatus):
552         (WebCore::GraphicsContext3D::texImageIOSurface2D):
553         * platform/graphics/cocoa/WebGLLayer.h:
554         * platform/graphics/cocoa/WebGLLayer.mm:
555         (-[WebGLLayer initWithGraphicsContext3D:]):
556         (-[WebGLLayer copyImageSnapshotWithColorSpace:]):
557         (-[WebGLLayer display]):
558         * platform/graphics/ios/GraphicsContext3DIOS.h:
559         * platform/graphics/opengl/Extensions3DOpenGL.cpp:
560         (WebCore::Extensions3DOpenGL::blitFramebuffer):
561         (WebCore::Extensions3DOpenGL::createVertexArrayOES):
562         (WebCore::Extensions3DOpenGL::deleteVertexArrayOES):
563         (WebCore::Extensions3DOpenGL::isVertexArrayOES):
564         (WebCore::Extensions3DOpenGL::bindVertexArrayOES):
565         * platform/graphics/opengl/Extensions3DOpenGL.h:
566         * platform/graphics/opengl/GraphicsContext3DOpenGL.cpp:
567         (WebCore::GraphicsContext3D::reshapeFBOs):
568         (WebCore::GraphicsContext3D::resolveMultisamplingIfNecessary):
569         (WebCore::GraphicsContext3D::renderbufferStorage):
570         (WebCore::GraphicsContext3D::getIntegerv):
571         (WebCore::GraphicsContext3D::texImage2D):
572         (WebCore::GraphicsContext3D::depthRange):
573         (WebCore::GraphicsContext3D::clearDepth):
574         * platform/graphics/opengl/GraphicsContext3DOpenGLCommon.cpp:
575         (WebCore::GraphicsContext3D::paintRenderingResultsToCanvas):
576         Make it a bit more clear which code is platform-dependent and which code is GL/GLES-dependent.
577
578 2018-03-22  Zan Dobersek  <zdobersek@igalia.com>
579
580         [TexMap] Make TextureMapperContextAttributes thread-specific
581         https://bugs.webkit.org/show_bug.cgi?id=183895
582
583         Reviewed by Carlos Garcia Campos.
584
585         Store the TextureMapperContextAttributes in a thread-specific manner.
586         The TextureMapperContextAttributes::get() method is now used to retrieve
587         a reference to that thread-specific object. If it's not been initialized
588         yet, then the current GL context is used for the initialization, as it
589         used to be done in the now-removed initialize() method.
590
591         TextureMapperPlatformLayerBuffer::clone() method now doesn't need to
592         be passed a TextureMapperGL object, since the texture can be created
593         directly by calling BitmapTextureGL::create(), passing the
594         TextureMapperContextAttributes object that's retrieved from the
595         thread-specific storage. This further simplifies the
596         TextureMapperPlatformLayerProxy::Compositor interface, removing the
597         texmapGL() getter from it.
598
599         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp:
600         (WebCore::MediaPlayerPrivateGStreamerBase::pushTextureToCompositor):
601         * platform/graphics/texmap/TextureMapperContextAttributes.cpp:
602         (WebCore::threadSpecificAttributes):
603         (WebCore::TextureMapperContextAttributes::get):
604         (WebCore::TextureMapperContextAttributes::initialize): Deleted.
605         * platform/graphics/texmap/TextureMapperContextAttributes.h:
606         * platform/graphics/texmap/TextureMapperGL.cpp:
607         (WebCore::TextureMapperGL::TextureMapperGL):
608         * platform/graphics/texmap/TextureMapperPlatformLayerBuffer.cpp:
609         (WebCore::TextureMapperPlatformLayerBuffer::clone):
610         * platform/graphics/texmap/TextureMapperPlatformLayerBuffer.h:
611         * platform/graphics/texmap/TextureMapperPlatformLayerProxy.cpp:
612         (WebCore::TextureMapperPlatformLayerProxy::dropCurrentBufferWhilePreservingTexture):
613         * platform/graphics/texmap/TextureMapperPlatformLayerProxy.h:
614
615 2018-03-22  Zalan Bujtas  <zalan@apple.com>
616
617         SVG root is skipped while marking percentage height descendants dirty.
618         https://bugs.webkit.org/show_bug.cgi?id=183877
619
620         Reviewed by Antti Koivisto.
621
622         Calling continingBlock() to get to the correct container works as long as the ancestor inline element
623         renderers are wrapped in anonymous blocks (continuation for example).
624
625         While the SVG root renderer is an inline renderer, it is not wrapped or normalized in any way,
626         so containingBlock() will elegantly skip it and return an SVG root ancestor.
627         dirtyForLayoutFromPercentageHeightDescendants calls containingBlock() to walk up
628         on the ancestor chain to mark elements dirty. This fails when there's an SVG subtree in the block chain.
629         This patch marks the SVG subtree chain dirty to ensure that layout will get to all the dirty leaf renderers 
630         (note that the SVG subtree is supposed to have only statically positioned elements so parent == containing block).
631
632         Covered by existing tests.
633
634         * rendering/RenderBlock.cpp:
635         (WebCore::RenderBlock::dirtyForLayoutFromPercentageHeightDescendants):
636
637 2018-03-22  Adrian Perez de Castro  <aperez@igalia.com>
638
639         [WPE][GTK] Build failure when ENABLE_VIDEO, ENABLE_WEB_AUDIO and ENABLE_XSLT are disabled
640         https://bugs.webkit.org/show_bug.cgi?id=183896
641
642         Reviewed by Yusuke Suzuki.
643
644         No new tests needed.
645
646         * bindings/js/JSWebAnimationCustom.cpp: Add missing #include of Document.h
647
648 2018-03-21  Chris Dumez  <cdumez@apple.com>
649
650         Regression(r229828): WebKit.NoHistoryItemScrollToFragment API test is failing on iOS
651         https://bugs.webkit.org/show_bug.cgi?id=183886
652
653         Reviewed by Wenson Hsieh.
654
655         Since r229828, the FrameLoader needs to call FrameLoaderClient::didDecidePolicyForNavigationAction()
656         whenever a navigation policy decision is made. I added such a call r229828 to
657         FrameLoader::continueLoadAfterNavigationPolicy() but forgot to add one to
658         FrameLoader::continueFragmentScrollAfterNavigationPolicy(), which is the equivalent
659         for fragment navigations.
660
661         * loader/FrameLoader.cpp:
662         (WebCore::FrameLoader::continueFragmentScrollAfterNavigationPolicy):
663
664 2018-03-21  Said Abou-Hallawa  <sabouhallawa@apple.com>
665
666         Disconnect the SVGPathSegList items from their SVGPathElement before rebuilding a new list
667         https://bugs.webkit.org/show_bug.cgi?id=183723
668         <rdar://problem/38517871>
669
670         Reviewed by Daniel Bates.
671
672         When setting the "d" attribute directly on a path, we rebuild the list
673         of path segments held for creating the property tear off. The old path
674         segments need to get disconnected from the path element. We already do 
675         that when a path segment is replaced or removed.
676
677         Test: svg/dom/reuse-pathseg-after-changing-d.html
678
679         * svg/SVGPathElement.cpp:
680         (WebCore::SVGPathElement::svgAttributeChanged):
681         * svg/SVGPathSegList.cpp:
682         (WebCore::SVGPathSegList::clear): SVGPathSegListValues::clearContextAndRoles()
683         will now be called from SVGPathSegListValues::clear() via SVGListProperty::clearValues().
684         (WebCore::SVGPathSegList::replaceItem):
685         (WebCore::SVGPathSegList::removeItem):
686         (WebCore::SVGPathSegList::clearContextAndRoles): Deleted.
687         * svg/SVGPathSegList.h: SVGPathSegListValues::clearContextAndRoles() will
688         now be called from SVGPathSegListValues::clear() via SVGListProperty::initializeValues().
689         * svg/SVGPathSegListValues.cpp:
690         (WebCore::SVGPathSegListValues::clearItemContextAndRole):
691         (WebCore::SVGPathSegListValues::clearContextAndRoles):
692         * svg/SVGPathSegListValues.h:
693         (WebCore::SVGPathSegListValues::operator=):
694         (WebCore::SVGPathSegListValues::clear):
695
696 2018-03-21  Antoine Quint  <graouts@apple.com>
697
698         [Web Animations] Ensure animationcancel and transitioncancel events are dispatched
699         https://bugs.webkit.org/show_bug.cgi?id=183864
700
701         Reviewed by Dean Jackson.
702
703         In order to correctly dispatch animationcancel and transitioncancel events, we must call cancel() on CSSAnimation and CSSTransitions
704         objects that are removed while in a play or pause phase. Additionally, we cancel declarative animations that are moving from a valid
705         to a null timeline. Finally, when cancel() is called on a declarative animation, we record the timestamp and manually call
706         invalidateDOMEvents() passing that timestamp in to ensure that the right phase change is recorded and results in the queuing of
707         animationcancel and transitioncancel events.
708
709         * animation/AnimationTimeline.cpp:
710         (WebCore::AnimationTimeline::updateCSSAnimationsForElement): Make sure we cancel all recorded CSS Animations when we newly get a
711         "display: none" style. We also call the new cancelOrRemoveDeclarativeAnimation() method, instead of removing animations outright,
712         for all animations that previously existed but are no longer listed in the current style.
713         (WebCore::AnimationTimeline::updateCSSTransitionsForElement): Like in updateCSSAnimationsForElement(), we cancel all recorded CSS
714         Transitions when we newly get a "display: none" style. We now use the refactored removeDeclarativeAnimation() method to remove an
715         a transition for a property that was already transitioned in the previous style but has a new backing Animation object. Finally,
716         like in updateCSSAnimationsForElement(), we call the new cancelOrRemoveDeclarativeAnimation() method, instead of removing transitions
717         outright, for all transitions that previously existed but are no longer listed in the current style.
718         (WebCore::AnimationTimeline::removeDeclarativeAnimation): Refactor code into this new method to remove a declarative animation.
719         (WebCore::AnimationTimeline::cancelOrRemoveDeclarativeAnimation): Cancels a DeclarativeAnimation if it's active or removes it right away.
720         * animation/AnimationTimeline.h:
721         * animation/DeclarativeAnimation.cpp:
722         (WebCore::DeclarativeAnimation::setTimeline): If we're moving from a valid timeline to a null timeline, call cancel() on this animation
723         such that an animationcancel or transitioncancel event can be dispatched.
724         (WebCore::DeclarativeAnimation::cancel): Cancelations require the computation of the time at which a declarative animation was canceled,
725         so we record the animation's active time as it's canceled and manually call invalidateDOMEvents() with that time after the general cancel()
726         code has run.
727         (WebCore::DeclarativeAnimation::invalidateDOMEvents): Accept an explicit timestamp for cancel events.
728         * animation/DeclarativeAnimation.h:
729         * animation/WebAnimation.h:
730
731 2018-03-21  Chris Dumez  <cdumez@apple.com>
732
733         ScrollViewInsetTests.RestoreInitialContentOffsetAfterCrash API test is failing with async delegates
734         https://bugs.webkit.org/show_bug.cgi?id=183787
735
736         Reviewed by Wenson Hsieh.
737
738         * loader/FrameLoader.cpp:
739         (WebCore::FrameLoader::continueLoadAfterNavigationPolicy):
740         * loader/FrameLoaderClient.h:
741
742 2018-03-21  Eric Carlson  <eric.carlson@apple.com>
743
744         Clean up platform VideoFullscreenLayerManager
745         https://bugs.webkit.org/show_bug.cgi?id=183859
746         <rdar://problem/38715419>
747
748         Reviewed by Jer Noble.
749
750         No new tests, no functional change.
751
752         * WebCore.xcodeproj/project.pbxproj:
753         * platform/graphics/VideoFullscreenLayerManager.h: Copied from Source/WebCore/platform/graphics/avfoundation/objc/VideoFullscreenLayerManager.h.
754         (WebCore::VideoFullscreenLayerManager::~VideoFullscreenLayerManager):
755         * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.h:
756         * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
757         (WebCore::MediaPlayerPrivateAVFoundationObjC::MediaPlayerPrivateAVFoundationObjC):
758         (WebCore::MediaPlayerPrivateAVFoundationObjC::createAVPlayerLayer):
759         (WebCore::MediaPlayerPrivateAVFoundationObjC::destroyVideoLayer):
760         (WebCore::MediaPlayerPrivateAVFoundationObjC::platformLayer const):
761         (WebCore::MediaPlayerPrivateAVFoundationObjC::setVideoFullscreenLayer):
762         (WebCore::MediaPlayerPrivateAVFoundationObjC::setVideoFullscreenFrame):
763         (WebCore::MediaPlayerPrivateAVFoundationObjC::updateVideoLayerGravity):
764         (WebCore::MediaPlayerPrivateAVFoundationObjC::requiresTextTrackRepresentation const):
765         (WebCore::MediaPlayerPrivateAVFoundationObjC::syncTextTrackBounds):
766         (WebCore::MediaPlayerPrivateAVFoundationObjC::setTextTrackRepresentation):
767         * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.h:
768         * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.mm:
769         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::MediaPlayerPrivateMediaSourceAVFObjC):
770         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::platformLayer const):
771         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::ensureLayer):
772         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::destroyLayer):
773         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::setVideoFullscreenLayer):
774         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::setVideoFullscreenFrame):
775         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::requiresTextTrackRepresentation const):
776         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::syncTextTrackBounds):
777         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::setTextTrackRepresentation):
778         * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.h:
779         * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.mm:
780         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::MediaPlayerPrivateMediaStreamAVFObjC):
781         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::ensureLayers):
782         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::destroyLayers):
783         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::platformLayer const):
784         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::setVideoFullscreenLayer):
785         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::setVideoFullscreenFrame):
786         * platform/graphics/avfoundation/objc/VideoFullscreenLayerManagerObjC.h: Renamed from Source/WebCore/platform/graphics/avfoundation/objc/VideoFullscreenLayerManager.h.
787         * platform/graphics/avfoundation/objc/VideoFullscreenLayerManagerObjC.mm: Renamed from Source/WebCore/platform/graphics/avfoundation/objc/VideoFullscreenLayerManager.mm.
788         (-[WebVideoContainerLayer setBounds:]):
789         (-[WebVideoContainerLayer setPosition:]):
790         (WebCore::VideoFullscreenLayerManagerObjC::VideoFullscreenLayerManagerObjC):
791         (WebCore::VideoFullscreenLayerManagerObjC::setVideoLayer):
792         (WebCore::VideoFullscreenLayerManagerObjC::setVideoFullscreenLayer):
793         (WebCore::VideoFullscreenLayerManagerObjC::setVideoFullscreenFrame):
794         (WebCore::VideoFullscreenLayerManagerObjC::didDestroyVideoLayer):
795         (WebCore::VideoFullscreenLayerManagerObjC::requiresTextTrackRepresentation const):
796         (WebCore::VideoFullscreenLayerManagerObjC::syncTextTrackBounds):
797         (WebCore::VideoFullscreenLayerManagerObjC::setTextTrackRepresentation):
798
799 2018-03-21  Antoine Quint  <graouts@apple.com>
800
801         [Web Animations] Dispatch DOM events for CSS Transitions and CSS Animations implemented as Web Animations
802         https://bugs.webkit.org/show_bug.cgi?id=183781
803
804         Reviewed by Dean Jackson.
805
806         Now that we've implemented CSS Animations and CSS Transitions as Web Animations (webkit.org/b/183504) we can dispatch DOM events
807         for targets of DeclarativeAnimation objects. To do that, we add a new invalidateDOMEvents() method on DeclarativeAnimations which
808         is called when the timer scheduled after the timing model has been invalidated fires in DocumentTimeline::performInvalidationTask().
809         When we check for DOM events to dispatch, we look at the last recorded phase and iteration and determine whether the state of the
810         animation has changed. We use a GenericEventQueue to enqueue the events such that they are dispatched asynchronously at a moment
811         when it is safe to evaluate script.
812
813         * animation/AnimationEffectReadOnly.h: Make currentIteration() public since we now need it in DeclarativeAnimation::invalidateDOMEvents().
814         * animation/CSSAnimation.cpp:
815         (WebCore::CSSAnimation::create): Pass the animation target to the constructor instead of its document.
816         (WebCore::CSSAnimation::CSSAnimation): Pass the animation target to the superclass instead of its document.
817         * animation/CSSAnimation.h:
818         * animation/CSSTransition.cpp:
819         (WebCore::CSSTransition::create): Pass the animation target to the constructor instead of its document.
820         (WebCore::CSSTransition::CSSTransition): Pass the animation target to the superclass instead of its document.
821         * animation/CSSTransition.h:
822         * animation/DeclarativeAnimation.cpp:
823         (WebCore::DeclarativeAnimation::DeclarativeAnimation): Expect an Element instead of a Document and use that element as the target of the
824         GenericEventQueue that we initialize. We also register this element as our m_target.
825         (WebCore::DeclarativeAnimation::~DeclarativeAnimation): Close the GenericEventQueue member upon destruction.
826         (WebCore::DeclarativeAnimation::initialize): We need to call pause() for declarative animations that aren't playing so that the animation's
827         playState is set correctly and the animation is not idle.
828         (WebCore::DeclarativeAnimation::phaseWithoutEffect const): Because we may need to get an animation's current phase in invalidateDOMEvents()
829         after an animation's effect has been removed, we provide an alternate way to compute the phase just by looking at the animation's current time.
830         (WebCore::DeclarativeAnimation::invalidateDOMEvents): Based on the previous and current pending state, iteration and phase, we enqueue animation
831         and transition DOM events as specified by the CSS Animations Level 2 and CSS Transitions Level 2 specifications.
832         (WebCore::DeclarativeAnimation::enqueueDOMEvent): Enqueue an event on the GenericEventQueue based on the animation type.
833         * animation/DeclarativeAnimation.h:
834         * animation/DocumentTimeline.cpp:
835         (WebCore::DocumentTimeline::performInvalidationTask): We call invalidateDOMEvents() on all declarative animations registered with this timeline
836         now that the timing model has been invalidated.
837         * dom/EventNames.h: Add the names of newly-implemented events (animationcancel, transitioncancel, transitionrun and transitionstart).
838         * dom/GlobalEventHandlers.idl: Add new attribute-based event handlers for the newly-implemented events.
839         * html/HTMLAttributeNames.in: Add new attribute-based event handlers for the newly-implemented events.
840         * html/HTMLElement.cpp:
841         (WebCore::HTMLElement::createEventHandlerNameMap): Add new attribute-based event handlers for the newly-implemented events.
842
843 2018-03-21  Per Arne Vollan  <pvollan@apple.com>
844
845         Compile error when not using IOSurface canvas backing store.
846         https://bugs.webkit.org/show_bug.cgi?id=183855
847
848         Reviewed by Brent Fulgham.
849
850         The method IOSurface::createFromImageBuffer is only referenced when IOSurface
851         is used as canvas backing store.
852
853         * platform/graphics/cocoa/IOSurface.h:
854         * platform/graphics/cocoa/IOSurface.mm:
855
856 2018-03-21  Zan Dobersek  <zdobersek@igalia.com>
857
858         [CoordGraphics] Track dirty rects that need update in CoordinatedGraphicsLayer
859         https://bugs.webkit.org/show_bug.cgi?id=175376
860
861         Reviewed by Carlos Garcia Campos.
862
863         Follow the GraphicsLayerCA class and track rectangles in need of display
864         in a Vector object. In case the whole layer needs updating, it's marked
865         separately, and further rects are ignored.
866
867         During layer flush, all the rects are used to invalidate the backing
868         store, or a single layer-sized rect is used in case the whole layer has
869         to be updated. We can also bail early from updateContentBuffers() if
870         there are no dirty rects recorded and there's no pending visible rect
871         adjustment.
872
873         At the end of updateContentBuffers() we now test for an existing
874         previous backing store before inquiring the backing store if the visible
875         area is already covered, enabling deletion of this backing store.
876
877         * platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.cpp:
878         (WebCore::CoordinatedGraphicsLayer::setNeedsDisplay):
879         (WebCore::CoordinatedGraphicsLayer::setNeedsDisplayInRect):
880         (WebCore::CoordinatedGraphicsLayer::updateContentBuffers):
881         * platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.h:
882
883 2018-03-21  Carlos Alberto Lopez Perez  <clopez@igalia.com>
884
885         [WPE] Build failure with ENABLE_VIDEO=OFF when GStreamer is not available
886         https://bugs.webkit.org/show_bug.cgi?id=183811
887
888         Reviewed by Philippe Normand.
889
890         Add build guards for USE_GSTREAMER.
891
892         No new tests, it is a build fix.
893
894         * platform/graphics/gstreamer/GStreamerUtilities.h:
895
896 2018-03-21  Zan Dobersek  <zdobersek@igalia.com>
897
898         [Cairo] Draw Cairo patterns with cairo_paint_with_alpha()
899         https://bugs.webkit.org/show_bug.cgi?id=183774
900
901         Reviewed by Carlos Garcia Campos.
902
903         In the drawPatternToCairoContext() helper in CairoOperations.cpp source
904         file, always clip the painting region to the specified rectangle and
905         then use cairo_paint_with_alpha() to paint the passed-in pattern object,
906         not relaying rasterization to cairo_fill() when using opaque alpha. We
907         still clamp the alpha value to the 0.0 - 1.0 range.
908
909         No new tests -- no change in behavior.
910
911         * platform/graphics/cairo/CairoOperations.cpp:
912         (WebCore::Cairo::drawPatternToCairoContext):
913
914 2018-03-21  Zan Dobersek  <zdobersek@igalia.com>
915
916         [TexMap] Have TextureMapperLayer::applyAnimationsRecursively() return running animation status
917         https://bugs.webkit.org/show_bug.cgi?id=183771
918
919         Reviewed by Carlos Garcia Campos.
920
921         TextureMapperLayer::applyAnimationsRecursively() should return true when
922         the TextureMapperLayer tree has currently-running animations that
923         require continuous scene update.
924
925         TextureMapperAnimation::ApplicationResult gains the hasRunningAnimation
926         member that's set to true if any of the applied animations are still in
927         playing state. That information is then returned in syncAnimations(),
928         and the result is accumulated in the top applyAnimationsRecursively()
929         call and returned there to the caller.
930
931         No new tests -- no change in behavior.
932
933         * platform/graphics/texmap/TextureMapperAnimation.cpp:
934         (WebCore::TextureMapperAnimation::apply):
935         * platform/graphics/texmap/TextureMapperAnimation.h:
936         * platform/graphics/texmap/TextureMapperLayer.cpp:
937         (WebCore::TextureMapperLayer::applyAnimationsRecursively):
938         (WebCore::TextureMapperLayer::syncAnimations):
939         * platform/graphics/texmap/TextureMapperLayer.h:
940
941 2018-03-21  Zan Dobersek  <zdobersek@igalia.com>
942
943         Use-after-move in SWContextManager::terminateWorker() with Linux x86_64 calling convention
944         https://bugs.webkit.org/show_bug.cgi?id=183783
945
946         Reviewed by Chris Dumez.
947
948         In SWContextManager::terminateWorker(), some calling conventions can
949         end up moving the ServiceWorkerThreadProxy RefPtr into the lambda struct
950         before that proxy's thread (on which the lambda is bound to execute) is
951         retrieved.
952
953         Avoid this by taking a reference to the thread in a separate earlier
954         expression, before the RefPtr is moved into the lambda in the following
955         one.
956
957         * workers/service/context/SWContextManager.cpp:
958         (WebCore::SWContextManager::terminateWorker):
959
960 2018-03-21  Timothy Horton  <timothy_horton@apple.com>
961
962         Fix the build
963
964         * platform/network/cf/FormDataStreamCFNet.cpp:
965
966 2018-03-20  Tim Horton  <timothy_horton@apple.com>
967
968         Introduce HAVE_MEDIA_PLAYER and HAVE_CORE_VIDEO
969         https://bugs.webkit.org/show_bug.cgi?id=183803
970         <rdar://problem/38690487>
971
972         Reviewed by Sam Weinig.
973
974         * platform/audio/ios/MediaSessionManagerIOS.mm:
975         (WebCore::MediaSessionManageriOS::configureWireLessTargetMonitoring):
976         (WebCore::MediaSessionManageriOS::updateNowPlayingInfo):
977         (-[WebMediaSessionHelper initWithCallback:]):
978         (-[WebMediaSessionHelper dealloc]):
979         (-[WebMediaSessionHelper hasWirelessTargetsAvailable]):
980         * platform/cocoa/CoreVideoSoftLink.cpp:
981         * platform/cocoa/CoreVideoSoftLink.h:
982         * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.h:
983         * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
984         (WebCore::MediaPlayerPrivateAVFoundationObjC::createVideoLayer):
985         (WebCore::MediaPlayerPrivateAVFoundationObjC::hasAvailableVideoFrame const):
986         (WebCore::MediaPlayerPrivateAVFoundationObjC::updateLastImage):
987         * platform/graphics/avfoundation/objc/MediaSampleAVFObjC.mm:
988         (WebCore::MediaSampleAVFObjC::getRGBAImageData const):
989         * platform/graphics/cv/PixelBufferConformerCV.cpp:
990         * platform/graphics/cv/PixelBufferConformerCV.h:
991         * platform/graphics/cv/TextureCacheCV.h:
992         * platform/graphics/cv/TextureCacheCV.mm:
993         * platform/graphics/cv/VideoTextureCopierCV.cpp:
994         * platform/graphics/cv/VideoTextureCopierCV.h:
995         Make it possible to disable our dependency on MediaPlayer and CoreVideo.
996
997 2018-03-20  Tim Horton  <timothy_horton@apple.com>
998
999         Enable the minimal simulator feature flag when appropriate
1000         https://bugs.webkit.org/show_bug.cgi?id=183807
1001
1002         Reviewed by Dan Bernstein.
1003
1004         * Configurations/FeatureDefines.xcconfig:
1005
1006 2018-03-19  Ryosuke Niwa  <rniwa@webkit.org>
1007
1008         Expose content attributes on _WKLinkIconParameters
1009         https://bugs.webkit.org/show_bug.cgi?id=183768
1010
1011         Reviewed by Alex Christensen.
1012
1013         Collect a vector of content attributes upon finding touch and fav-icons in order to expose it in a WebKit API.
1014
1015         Tests: IconLoading.DefaultFavicon
1016
1017         * html/LinkIconCollector.cpp:
1018         (WebCore::LinkIconCollector::iconsOfTypes): Collect attributes.
1019         * loader/DocumentLoader.cpp:
1020         (WebCore::DocumentLoader::startIconLoading): Use an empty vector for /favicon.ico.
1021         * platform/LinkIcon.h:
1022         (WebCore::LinkIcon::encode const): Encode the vector of content attributes.
1023         (WebCore::LinkIcon::decode): Ditto for decoding.
1024
1025 2018-03-20  Zalan Bujtas  <zalan@apple.com>
1026
1027         RenderTreeNeedsLayoutChecker fails with absolutely positioned svg and <use>
1028         https://bugs.webkit.org/show_bug.cgi?id=183718
1029
1030         Reviewed by Antti Koivisto.
1031
1032         This patch ensures after resolving the style for an SVG element with a corresponding element (<use>),
1033         we adjust this style for the cloned SVG element too.
1034
1035         Test: svg/in-html/path-with-absolute-positioned-svg-and-use-crash.html
1036
1037         * css/StyleResolver.cpp:
1038         (WebCore::StyleResolver::adjustSVGElementStyle):
1039         (WebCore::StyleResolver::adjustRenderStyle):
1040         * css/StyleResolver.h:
1041         * svg/SVGElement.cpp:
1042         (WebCore::SVGElement::resolveCustomStyle):
1043
1044 2018-03-20  Brady Eidson  <beidson@apple.com>
1045
1046         First piece of process swapping on navigation.
1047         https://bugs.webkit.org/show_bug.cgi?id=183665
1048
1049         Reviewed by Andy Estes.
1050
1051         Covered by API test(s)
1052
1053         This patch:
1054         - A new PolicyAction::Suspend for future use in this feature
1055         - Makes sure that loads triggered as part of a process swap do *not* re-consult the policy delegate
1056
1057         * loader/DocumentLoader.cpp:
1058         (WebCore::DocumentLoader::continueAfterContentPolicy):
1059
1060         * loader/FrameLoadRequest.h:
1061         (WebCore::FrameLoadRequest::setShouldCheckNavigationPolicy):
1062         (WebCore::FrameLoadRequest::shouldCheckNavigationPolicy const):
1063
1064         * loader/FrameLoader.cpp:
1065         (WebCore::FrameLoader::load):
1066         (WebCore::FrameLoader::loadWithDocumentLoader):
1067         * loader/FrameLoader.h:
1068
1069         * loader/FrameLoaderTypes.h: Add a new Policy type "Suspend" to be used in the future
1070           by the process-swap-on-navigation mechanism.
1071
1072         * loader/PolicyChecker.cpp:
1073         (WebCore::PolicyChecker::checkNavigationPolicy):
1074         (WebCore::PolicyChecker::checkNewWindowPolicy):
1075
1076 2018-03-20  Chris Dumez  <cdumez@apple.com>
1077
1078         QuickLook.NavigationDelegate API test is failing on iOS with async policy delegates
1079         https://bugs.webkit.org/show_bug.cgi?id=183791
1080
1081         Reviewed by Alex Christensen.
1082
1083         Update PreviewLoader to not send data (or call finishFinishLoading) until
1084         the resource response has been processed.
1085
1086         * loader/ios/PreviewLoader.mm:
1087         (-[WebPreviewLoader _sendDidReceiveResponseIfNecessary]):
1088         (-[WebPreviewLoader connection:didReceiveData:lengthReceived:]):
1089         (-[WebPreviewLoader connectionDidFinishLoading:]):
1090
1091 2018-03-20  Antoine Quint  <graouts@apple.com>
1092
1093         [Web Animations] Update the timing model when pending tasks schedule changes
1094         https://bugs.webkit.org/show_bug.cgi?id=183785
1095
1096         Reviewed by Dean Jackson.
1097
1098         Changing the time at which a pending play or pause task is scheduled changes the pending
1099         state of the animation and thus should notify that the timing model has changed and invalidate
1100         the effect.
1101
1102         * animation/WebAnimation.cpp:
1103         (WebCore::WebAnimation::setTimeToRunPendingPlayTask):
1104         (WebCore::WebAnimation::setTimeToRunPendingPauseTask):
1105         (WebCore::WebAnimation::updatePendingTasks):
1106
1107 2018-03-20  Tim Horton  <timothy_horton@apple.com>
1108
1109         Add and adopt WK_PLATFORM_NAME and adjust default feature defines
1110         https://bugs.webkit.org/show_bug.cgi?id=183758
1111         <rdar://problem/38017644>
1112
1113         Reviewed by Dan Bernstein.
1114
1115         * Configurations/Base.xcconfig:
1116         * Configurations/FeatureDefines.xcconfig:
1117         * WebCore.xcodeproj/project.pbxproj:
1118
1119 2018-03-19  Tim Horton  <timothy_horton@apple.com>
1120
1121         Apply some SDK checks in LocalDefaultSystemAppearance
1122         https://bugs.webkit.org/show_bug.cgi?id=183767
1123         <rdar://problem/38649611>
1124
1125         Reviewed by Zalan Bujtas.
1126
1127         * platform/mac/LocalDefaultSystemAppearance.h:
1128         * platform/mac/LocalDefaultSystemAppearance.mm:
1129         (WebCore::LocalDefaultSystemAppearance::LocalDefaultSystemAppearance):
1130         (WebCore::LocalDefaultSystemAppearance::~LocalDefaultSystemAppearance):
1131
1132 2018-03-19  Chris Dumez  <cdumez@apple.com>
1133
1134         Have one service worker process per security origin
1135         https://bugs.webkit.org/show_bug.cgi?id=183600
1136         <rdar://problem/35280128>
1137
1138         Reviewed by Brady Eidson.
1139
1140         Split service workers from different origins into their own processes
1141         for security reasons.
1142
1143         * workers/service/server/SWServer.cpp:
1144         (WebCore::SWServer::addRegistrationFromStore):
1145         (WebCore::SWServer::clear):
1146         (WebCore::SWServer::tryInstallContextData):
1147         (WebCore::SWServer::serverToContextConnectionCreated):
1148         (WebCore::SWServer::installContextData):
1149         (WebCore::SWServer::runServiceWorkerIfNecessary):
1150         (WebCore::SWServer::markAllWorkersAsTerminated):
1151         * workers/service/server/SWServer.h:
1152         * workers/service/server/SWServerToContextConnection.cpp:
1153         (WebCore::SWServerToContextConnection::SWServerToContextConnection):
1154         (WebCore::SWServerToContextConnection::~SWServerToContextConnection):
1155         (WebCore::SWServerToContextConnection::connectionForOrigin):
1156         * workers/service/server/SWServerToContextConnection.h:
1157         (WebCore::SWServerToContextConnection::origin):
1158         * workers/service/server/SWServerWorker.cpp:
1159         (WebCore::SWServerWorker::SWServerWorker):
1160         (WebCore::SWServerWorker::securityOrigin const):
1161         (WebCore::SWServerWorker::contextConnection):
1162         * workers/service/server/SWServerWorker.h:
1163
1164 2018-03-19  Megan Gardner  <megan_gardner@apple.com>
1165
1166         Have select element respect current appearance
1167         https://bugs.webkit.org/show_bug.cgi?id=183753
1168
1169         Reviewed by Tim Horton.
1170
1171         Not currently testable, will add tests in a later patch.
1172
1173         Have the menu lists/select elements follow the system colors.
1174
1175         * rendering/RenderThemeMac.mm:
1176         (WebCore::RenderThemeMac::adjustMenuListStyle const):
1177
1178 2018-03-19  Nan Wang  <n_wang@apple.com>
1179
1180         AX: embedded attachments do not work correctly with text marker APIs on macOS
1181         https://bugs.webkit.org/show_bug.cgi?id=183751
1182
1183         Reviewed by Chris Fleizach.
1184
1185         In WebKit1, embedded attachments are not working well with text marker APIs.
1186         We should use the corresponding attachment view in the following cases:
1187         1. Hit testing on an attachment object.
1188         2. Getting the attachment object at a text marker position.
1189         3. Asking for the associated element with NSAccessibilityAttachmentTextAttribute. 
1190
1191         Not able to construct a layout test because it relies on embedded attachments.
1192
1193         * accessibility/mac/WebAccessibilityObjectWrapperMac.mm:
1194         (AXAttributeStringSetElement):
1195         (-[WebAccessibilityObjectWrapper accessibilityHitTest:]):
1196         (-[WebAccessibilityObjectWrapper accessibilityAttributeValue:forParameter:]):
1197
1198 2018-03-19  Jiewen Tan  <jiewen_tan@apple.com>
1199
1200         Unreviewed, another quick fix for r229699
1201
1202         Restricts ENABLE_WEB_AUTHN to only macOS and iOS.
1203
1204         * Configurations/FeatureDefines.xcconfig:
1205
1206 2018-03-19  Daniel Bates  <dabates@apple.com>
1207
1208         Fix case of Strong Password localized string
1209
1210         * English.lproj/Localizable.strings:
1211         * platform/LocalizedStrings.cpp:
1212         (WebCore::autoFillStrongPasswordLabel):
1213
1214 2018-03-19  Chris Dumez  <cdumez@apple.com>
1215
1216         WebKit.WebsitePoliciesAutoplayQuirks API test times out with async policy delegates
1217         https://bugs.webkit.org/show_bug.cgi?id=183702
1218         <rdar://problem/38566060>
1219
1220         Reviewed by Alex Christensen.
1221
1222         The issue is that the test calls loadHTMLString then loadRequest right after, without
1223         waiting for the first load to complete first. loadHTMLString is special as it relies
1224         on substitute data and which schedules a timer to commit the data. When doing the
1225         navigation policy check for the following loadRequest(), the substitute data timer
1226         would fire and commit its data and load. This would in turn cancel the pending
1227         navigation policy check for the loadRequest().
1228
1229         With sync policy delegates, this is not an issue because we take care of stopping
1230         all loaders when receiving the policy decision, which happens synchronously. However,
1231         when the policy decision happens asynchronously, the pending substitute data load
1232         does not get cancelled in time and it gets committed.
1233
1234         To address the issue, we now cancel any pending provisional load before doing the
1235         navigation policy check.
1236
1237         Test: fast/loader/inner-iframe-loads-data-url-into-parent-on-unload-crash-async-delegate.html
1238
1239         * loader/FrameLoader.cpp:
1240         (WebCore::FrameLoader::clearProvisionalLoadForPolicyCheck):
1241         * loader/FrameLoader.h:
1242         * loader/PolicyChecker.cpp:
1243         (WebCore::PolicyChecker::checkNavigationPolicy):
1244         Cancel any pending provisional load before starting the navigation policy check. This call
1245         needs to be here rather than in the call site of policyChecker().checkNavigationPolicy()
1246         because there is code in PolicyChecker::checkNavigationPolicy() which relies on
1247         FrameLoader::activeDocumentLoader().
1248         Also, we only cancel the provisional load if there is a policy document loader. In some
1249         rare cases (when we receive a redirect after navigation policy has been decided for the
1250         initial request), the provisional document loader needs to receive navigation policy
1251         decisions so we cannot clear the provisional document loader in such case.
1252
1253 2018-03-19  Eric Carlson  <eric.carlson@apple.com>
1254
1255         [Extra zoom mode] Require fullscreen for video playback
1256         https://bugs.webkit.org/show_bug.cgi?id=183742
1257         <rdar://problem/38235862>
1258
1259         Reviewed by Jer Noble.
1260
1261         * Modules/modern-media-controls/media/playback-support.js:
1262         (PlaybackSupport.prototype.syncControl): Always show the play button.
1263         * html/HTMLMediaElement.cpp:
1264         (WebCore::HTMLMediaElement::updatePlayState): Return immediately if playback requires fullscreen
1265         (WebCore::HTMLMediaElement::didBecomeFullscreenElement): Call updatePlayState in case 
1266         playback is pending.
1267         * html/HTMLMediaElement.h:
1268         * platform/cocoa/VideoFullscreenModel.h:
1269         (WebCore::VideoFullscreenModel::presentingViewController): New.
1270         (WebCore::VideoFullscreenModel::createVideoFullscreenViewController): New.
1271         * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
1272         (WebCore::MediaPlayerPrivateAVFoundationObjC::createAVPlayerLayer):
1273         (WebCore::MediaPlayerPrivateAVFoundationObjC::setVideoFullscreenMode):
1274         * platform/ios/PlaybackSessionInterfaceAVKit.mm:
1275         (WebCore::PlaybackSessionInterfaceAVKit::seekableRangesChanged):
1276
1277         * platform/ios/VideoFullscreenInterfaceAVKit.h:
1278         * platform/ios/VideoFullscreenInterfaceAVKit.mm: Wrap AVPlayerLayerView so we can change its
1279         behavior.
1280         (WebAVPlayerLayerView_playerLayer):
1281         (WebAVPlayerLayerView_videoView):
1282         (allocWebAVPlayerLayerViewInstance):
1283         (-[WebAVPlayerViewController initWithFullscreenInterface:]):
1284         (-[WebAVPlayerViewController playerViewControllerShouldHandleDoneButtonTap:]):
1285         (-[WebAVPlayerViewController enterFullScreenAnimated:completionHandler:]):
1286         (-[WebAVPlayerViewController exitFullScreenAnimated:completionHandler:]):
1287         (-[WebAVPlayerViewController NO_RETURN_DUE_TO_ASSERT]):
1288         (-[WebAVPlayerViewController isPictureInPicturePossible]):
1289         (-[WebAVPlayerViewController isPictureInPictureActive]):
1290         (-[WebAVPlayerViewController isPictureInPictureSuspended]):
1291         (-[WebAVPlayerViewController pictureInPictureActive]):
1292         (-[WebAVPlayerViewController pictureInPictureWasStartedWhenEnteringBackground]):
1293         (-[WebAVPlayerViewController view]):
1294         (-[WebAVPlayerViewController showsPlaybackControls]):
1295         (-[WebAVPlayerViewController setShowsPlaybackControls:]):
1296         (-[WebAVPlayerViewController setAllowsPictureInPicturePlayback:]):
1297         (-[WebAVPlayerViewController setDelegate:]):
1298         (-[WebAVPlayerViewController setPlayerController:]):
1299         (-[WebAVPlayerViewController avPlayerViewController]):
1300         (-[WebAVPlayerViewController removeFromParentViewController]):
1301         (VideoFullscreenInterfaceAVKit::setupFullscreen):
1302         (fallbackViewController):
1303         (VideoFullscreenInterfaceAVKit::presentingViewController):
1304         (VideoFullscreenInterfaceAVKit::shouldExitFullscreenWithReason):
1305         (VideoFullscreenInterfaceAVKit::doSetup):
1306         (WebCore::supportsPictureInPicture):
1307
1308 2018-03-19  Per Arne Vollan  <pvollan@apple.com>
1309
1310         When the WebContent process is blocked from accessing the WindowServer, the call CVDisplayLinkCreateWithCGDisplay will fail.
1311         https://bugs.webkit.org/show_bug.cgi?id=183604
1312         <rdar://problem/38305109>
1313
1314         Reviewed by Brent Fulgham.
1315
1316         The call to CVDisplayLinkCreateWithCGDisplay can instead be made in the UIProcess. Notify the WebContent process
1317         about display updates by sending a message from the UIProcess on each screen update. This patch adds an extra
1318         IPC step when notifying the WebContent process about display updates. However, the MotionMark benchmark shows no
1319         performance regression when running it with this patch. A possible explanation for this is that the high priority
1320         display link thread is now running in the UIProcess instead of the WebContent process, which means there will be
1321         more available CPU resources for the WebContent process. A run loop observer is added to make sure that only one
1322         display callback (for each display observer) is executed in a single iteration of the run loop. This will make
1323         sure we are not filling the IPC message queue with unhandled display link messages.
1324
1325         No new tests, covered by existing tests. 
1326
1327         * platform/graphics/DisplayRefreshMonitor.h:
1328         (WebCore::DisplayRefreshMonitor::displayLinkFired):
1329         * platform/graphics/DisplayRefreshMonitorManager.cpp:
1330         (WebCore::DisplayRefreshMonitorManager::displayWasUpdated):
1331         * platform/graphics/DisplayRefreshMonitorManager.h:
1332         * platform/graphics/mac/DisplayRefreshMonitorMac.h:
1333
1334 2018-03-19  Megan Gardner  <megan_gardner@apple.com>
1335
1336         Ensure local appearance actually mirrors the app's appearance
1337         https://bugs.webkit.org/show_bug.cgi?id=183743
1338
1339         Reviewed by Tim Horton.
1340
1341         Not currently testable, will add tests in a later patch.
1342
1343         Current appearance isn't always accurate by default and needs to be set manually.
1344
1345         * platform/mac/LocalDefaultSystemAppearance.mm:
1346         (WebCore::LocalDefaultSystemAppearance::LocalDefaultSystemAppearance):
1347
1348 2018-03-19  Zan Dobersek  <zdobersek@igalia.com>
1349
1350         Unreviewed GCC 4.9 build-fix after r229672.
1351
1352         * platform/graphics/nicosia/cairo/NicosiaCairoOperationRecorder.cpp:
1353         (Nicosia::createCommand): Don't depend on implicit conversion of the
1354         returning std::unique_ptr<> object, and instead only wrap the
1355         heap-allocated PaintingOperation-derived in a std::unique_ptr<> at the
1356         point of return.
1357
1358 2018-03-18  Commit Queue  <commit-queue@webkit.org>
1359
1360         Unreviewed, rolling out r229689.
1361         https://bugs.webkit.org/show_bug.cgi?id=183735
1362
1363         Causes fast/loader/inner-iframe-loads-data-url-into-parent-on-
1364         unload-crash.html to fail with async delegates (Requested by
1365         cdumez_ on #webkit).
1366
1367         Reverted changeset:
1368
1369         "WebKit.WebsitePoliciesAutoplayQuirks API test times out with
1370         async policy delegates"
1371         https://bugs.webkit.org/show_bug.cgi?id=183702
1372         https://trac.webkit.org/changeset/229689
1373
1374 2018-03-17  Tim Horton  <timothy_horton@apple.com>
1375
1376         Correct redefined fnfErr type
1377         https://bugs.webkit.org/show_bug.cgi?id=183728
1378         <rdar://problem/38590063>
1379
1380         Reviewed by Dan Bernstein.
1381
1382         * platform/network/cf/FormDataStreamCFNet.cpp:
1383         CFStreamError's error parameter takes a SInt32, not an int.
1384         Make sure our redefinition has a compatible type.
1385
1386 2018-03-17  Jiewen Tan  <jiewen_tan@apple.com>
1387
1388         [WebAuthN] Implement authenticatorMakeCredential
1389         https://bugs.webkit.org/show_bug.cgi?id=183527
1390         <rdar://problem/35275886>
1391
1392         Reviewed by Brent Fulgham.
1393
1394         This patch does the following few things:
1395         1) It implements the authenticatorMakeCredential logic from the spec: https://www.w3.org/TR/webauthn/#op-make-cred.
1396         2) It tweaks enocding and deocding of PublicKeyCredentialCreationOptions between UIProccess and WebProcess.
1397         3) It soft links LocalAuthentication.Framework to WebCore, which was linked to WebKit.
1398         4) It creates SPI header for DeviceIdentity.Framework, and provides stubs to link it to WebCore.
1399
1400         Here is a detailed explanantion of 1):
1401         1. A helper class called LocalAuthenticator is crafted to represent Apple platform attached authenticator, i.e.
1402         the devices themselves. All operations are currently restricted to iOS at this moment as macOS lacks attestation
1403         support.
1404         2. To do testing, this helper class is then moved from WebKit to WebCore even though all operations can only happens
1405         in the UIProcess. We currently lack the ability to pretend a https environment in TestWebKitAPI which is required by
1406         the WebAuthN API, and thus it is moved to WebCore to perform unit tesing flavor API tests. This is not enough as it
1407         can't test message exchange between the UI and Web processes. We will address this in a subsequent patch.
1408         3. More on testing: The attestation process is abstracted into a protected method such that the testing enviroment can
1409         override it with self attestation as network access is restricted in the WebKit testing enviroment. Also, swizzlers of
1410         LocalAuthentication API are provided to override the behavoir of LAContext.
1411         4. More on testing: The actual Apple attestation can only happen in real device and with network access, therefore
1412         it can only be covered by manual tests at this moment.
1413         5. Back to LocalAuthenticator, it currently has two public methods:
1414                 5.1. makeCredential(): This method is the one does all the magic.
1415                 + It first checks some parameters.
1416                 + It then invokes LAContext to get user consent.
1417                 + It then talks to Apple Attestation Privacy CA to do attestations.
1418                 + It then stores necessary information into the Keychain.
1419                 + Finally it generates the attestation object.
1420                 5.2 isAvailable():
1421                 To check if a LocalAuthenticator is available or not.
1422         6. Even though files are of .mm format, they are written in a way that mixes NS, CF and C++ types. Here is the rule:
1423                 6.1 Use CF type only if it is requested by APIs.
1424                 6.2 Use NS type to manipulate all Objc objects.
1425                 6.3 Use C++ otherwise.
1426
1427         Covered by API tests.
1428
1429         * Configurations/WebCore.xcconfig:
1430         * Modules/credentialmanagement/CredentialsMessenger.cpp:
1431         (WebCore::getIdFromAttestationObject): Deleted.
1432         Decoding attestation object is tedious. UIProcess will instead return credential ID and attestation object
1433         at the same time. Therefore, this method is removed.
1434         * Modules/credentialmanagement/CredentialsMessenger.h:
1435         (WebCore::CreationReturnBundle::CreationReturnBundle): Deleted.
1436         (WebCore::AssertionReturnBundle::AssertionReturnBundle): Deleted.
1437         * Modules/webauthn/COSEConstants.h: Copied from Source/WebCore/Modules/webauthn/PublicKeyCredentialType.h.
1438         * Modules/webauthn/PublicKeyCredentialCreationOptions.h:
1439         (WebCore::PublicKeyCredentialCreationOptions::isolatedPartialCopyPtr const):
1440         (WebCore::PublicKeyCredentialCreationOptions::Parameters::encode const):
1441         (WebCore::PublicKeyCredentialCreationOptions::Parameters::decode):
1442         (WebCore::PublicKeyCredentialCreationOptions::encode const):
1443         (WebCore::PublicKeyCredentialCreationOptions::decode):
1444         * Modules/webauthn/PublicKeyCredentialDescriptor.h:
1445         (WebCore::PublicKeyCredentialDescriptor::encode const):
1446         (WebCore::PublicKeyCredentialDescriptor::decode):
1447         * Modules/webauthn/PublicKeyCredentialType.h:
1448         * Modules/webauthn/cocoa/LocalAuthenticator.h: Copied from Source/WebCore/Modules/webauthn/PublicKeyCredentialCreationOptions.h.
1449         * Modules/webauthn/cocoa/LocalAuthenticator.mm: Added.
1450         (WebCore::LocalAuthenticatorInternal::freePtrs):
1451         (WebCore::LocalAuthenticator::makeCredential const):
1452         (WebCore::LocalAuthenticator::isAvailable const):
1453         (WebCore::LocalAuthenticator::issueClientCertificate const):
1454         * SourcesCocoa.txt:
1455         * WebCore.xcodeproj/project.pbxproj:
1456         * platform/cocoa/LocalAuthenticationSoftLink.h: Copied from Source/WebCore/Modules/webauthn/PublicKeyCredentialType.h.
1457         * platform/cocoa/LocalAuthenticationSoftLink.mm: Added.
1458         * testing/MockCredentialsMessenger.cpp:
1459         (WebCore::MockCredentialsMessenger::setCreationReturnBundle):
1460         (WebCore::MockCredentialsMessenger::makeCredential):
1461         (WebCore::MockCredentialsMessenger::makeCredentialReply):
1462         (WebCore::MockCredentialsMessenger::setAttestationObject): Deleted.
1463         * testing/MockCredentialsMessenger.h:
1464         * testing/MockCredentialsMessenger.idl:
1465
1466 2018-03-16  Brent Fulgham  <bfulgham@apple.com>
1467
1468         Correct debug assertion in Range::borderAndTextRects
1469         https://bugs.webkit.org/show_bug.cgi?id=183710
1470         <rdar://problem/38466976>
1471
1472         Reviewed by Ryosuke Niwa.
1473
1474         A debug assertion will fire if Range::borderAndTextRects is asked to evaluate a set of selected elements, where one of the elements does not have a parent.
1475
1476         We should consider a nullptr parent as satisfying the condition of a parent not being present in the selection set.
1477
1478         Tests: fast/dom/range/range-selection-empty-body.html
1479
1480         * dom/Range.cpp:
1481         (WebCore::Range::borderAndTextRects const):
1482
1483 2018-03-15  Filip Pizlo  <fpizlo@apple.com>
1484
1485         Put the DOM in IsoHeaps
1486         https://bugs.webkit.org/show_bug.cgi?id=183546
1487
1488         Reviewed by Daniel Bates.
1489
1490         No new tests because no change in behavior.
1491         
1492         This puts all descendants of WebCore::Node in isoheaps, so that UAFs on the DOM cannot be
1493         used for RCE attacks. This probably also makes it harder to use UAFs for UXSS, since it means
1494         that DOM UAFs cannot be used for universal read gadgets.
1495         
1496         This looks neutral on Speedometer and membuster, though I did have one round of testing
1497         that led me to believe that membuster was regressed - I just wasn't able to reproduce that
1498         result on subsequent testing.
1499
1500         * Sources.txt:
1501         * WebCore.xcodeproj/project.pbxproj:
1502         * dom/Attr.cpp:
1503         * dom/Attr.h:
1504         * dom/CDATASection.cpp:
1505         * dom/CDATASection.h:
1506         * dom/CharacterData.cpp:
1507         * dom/CharacterData.h:
1508         * dom/Comment.cpp:
1509         * dom/Comment.h:
1510         * dom/ContainerNode.cpp:
1511         * dom/ContainerNode.h:
1512         * dom/Document.cpp:
1513         * dom/Document.h:
1514         * dom/DocumentFragment.cpp:
1515         * dom/DocumentFragment.h:
1516         * dom/DocumentType.cpp:
1517         * dom/DocumentType.h:
1518         * dom/Node.cpp:
1519         * dom/Node.h:
1520         * dom/ProcessingInstruction.cpp:
1521         * dom/ProcessingInstruction.h:
1522         * dom/PseudoElement.cpp:
1523         * dom/PseudoElement.h:
1524         * dom/ShadowRoot.cpp:
1525         * dom/ShadowRoot.h:
1526         * dom/StyledElement.cpp:
1527         * dom/StyledElement.h:
1528         * dom/TemplateContentDocumentFragment.cpp: Added.
1529         * dom/TemplateContentDocumentFragment.h:
1530         * dom/Text.cpp:
1531         * dom/Text.h:
1532         * dom/XMLDocument.cpp: Added.
1533         * dom/XMLDocument.h:
1534         * html/FTPDirectoryDocument.cpp:
1535         * html/FTPDirectoryDocument.h:
1536         * html/FileInputType.cpp:
1537         * html/HTMLAnchorElement.cpp:
1538         * html/HTMLAnchorElement.h:
1539         * html/HTMLAppletElement.cpp:
1540         * html/HTMLAppletElement.h:
1541         * html/HTMLAreaElement.cpp:
1542         * html/HTMLAreaElement.h:
1543         * html/HTMLAttachmentElement.cpp:
1544         * html/HTMLAttachmentElement.h:
1545         * html/HTMLBDIElement.cpp: Added.
1546         * html/HTMLBDIElement.h:
1547         * html/HTMLBRElement.cpp:
1548         * html/HTMLBRElement.h:
1549         * html/HTMLBaseElement.cpp:
1550         * html/HTMLBaseElement.h:
1551         * html/HTMLBodyElement.cpp:
1552         * html/HTMLBodyElement.h:
1553         * html/HTMLButtonElement.cpp:
1554         * html/HTMLButtonElement.h:
1555         * html/HTMLCanvasElement.cpp:
1556         * html/HTMLCanvasElement.h:
1557         * html/HTMLDListElement.cpp:
1558         * html/HTMLDListElement.h:
1559         * html/HTMLDataElement.cpp:
1560         * html/HTMLDataElement.h:
1561         * html/HTMLDataListElement.cpp:
1562         * html/HTMLDataListElement.h:
1563         * html/HTMLDetailsElement.cpp:
1564         * html/HTMLDetailsElement.h:
1565         * html/HTMLDirectoryElement.cpp:
1566         * html/HTMLDirectoryElement.h:
1567         * html/HTMLDivElement.cpp:
1568         * html/HTMLDivElement.h:
1569         * html/HTMLDocument.cpp:
1570         * html/HTMLDocument.h:
1571         * html/HTMLElement.cpp:
1572         * html/HTMLElement.h:
1573         * html/HTMLEmbedElement.cpp:
1574         * html/HTMLEmbedElement.h:
1575         * html/HTMLFieldSetElement.cpp:
1576         * html/HTMLFieldSetElement.h:
1577         * html/HTMLFontElement.cpp:
1578         * html/HTMLFontElement.h:
1579         * html/HTMLFormControlElement.cpp:
1580         * html/HTMLFormControlElement.h:
1581         * html/HTMLFormControlElementWithState.cpp:
1582         * html/HTMLFormControlElementWithState.h:
1583         * html/HTMLFormElement.cpp:
1584         * html/HTMLFormElement.h:
1585         * html/HTMLFrameElement.cpp:
1586         * html/HTMLFrameElement.h:
1587         * html/HTMLFrameElementBase.cpp:
1588         * html/HTMLFrameElementBase.h:
1589         * html/HTMLFrameOwnerElement.cpp:
1590         * html/HTMLFrameOwnerElement.h:
1591         * html/HTMLFrameSetElement.cpp:
1592         * html/HTMLFrameSetElement.h:
1593         * html/HTMLHRElement.cpp:
1594         * html/HTMLHRElement.h:
1595         * html/HTMLHeadElement.cpp:
1596         * html/HTMLHeadElement.h:
1597         * html/HTMLHeadingElement.cpp:
1598         * html/HTMLHeadingElement.h:
1599         * html/HTMLHtmlElement.cpp:
1600         * html/HTMLHtmlElement.h:
1601         * html/HTMLIFrameElement.cpp:
1602         * html/HTMLIFrameElement.h:
1603         * html/HTMLImageElement.cpp:
1604         * html/HTMLImageElement.h:
1605         * html/HTMLInputElement.cpp:
1606         * html/HTMLInputElement.h:
1607         * html/HTMLKeygenElement.cpp:
1608         * html/HTMLKeygenElement.h:
1609         * html/HTMLLIElement.cpp:
1610         * html/HTMLLIElement.h:
1611         * html/HTMLLabelElement.cpp:
1612         * html/HTMLLabelElement.h:
1613         * html/HTMLLegendElement.cpp:
1614         * html/HTMLLegendElement.h:
1615         * html/HTMLLinkElement.cpp:
1616         * html/HTMLLinkElement.h:
1617         * html/HTMLMapElement.cpp:
1618         * html/HTMLMapElement.h:
1619         * html/HTMLMarqueeElement.cpp:
1620         * html/HTMLMarqueeElement.h:
1621         * html/HTMLMenuElement.cpp:
1622         * html/HTMLMenuElement.h:
1623         * html/HTMLMenuItemElement.cpp:
1624         * html/HTMLMenuItemElement.h:
1625         * html/HTMLMetaElement.cpp:
1626         * html/HTMLMetaElement.h:
1627         * html/HTMLMeterElement.cpp:
1628         * html/HTMLMeterElement.h:
1629         * html/HTMLModElement.cpp:
1630         * html/HTMLModElement.h:
1631         * html/HTMLOListElement.cpp:
1632         * html/HTMLOListElement.h:
1633         * html/HTMLObjectElement.cpp:
1634         * html/HTMLObjectElement.h:
1635         * html/HTMLOptGroupElement.cpp:
1636         * html/HTMLOptGroupElement.h:
1637         * html/HTMLOptionElement.cpp:
1638         * html/HTMLOptionElement.h:
1639         * html/HTMLOutputElement.cpp:
1640         * html/HTMLOutputElement.h:
1641         * html/HTMLParagraphElement.cpp:
1642         * html/HTMLParagraphElement.h:
1643         * html/HTMLParamElement.cpp:
1644         * html/HTMLParamElement.h:
1645         * html/HTMLPictureElement.cpp:
1646         * html/HTMLPictureElement.h:
1647         * html/HTMLPlugInElement.cpp:
1648         * html/HTMLPlugInElement.h:
1649         * html/HTMLPlugInImageElement.cpp:
1650         * html/HTMLPlugInImageElement.h:
1651         * html/HTMLPreElement.cpp:
1652         * html/HTMLPreElement.h:
1653         * html/HTMLProgressElement.cpp:
1654         * html/HTMLProgressElement.h:
1655         * html/HTMLQuoteElement.cpp:
1656         * html/HTMLQuoteElement.h:
1657         * html/HTMLScriptElement.cpp:
1658         * html/HTMLScriptElement.h:
1659         * html/HTMLSelectElement.cpp:
1660         * html/HTMLSelectElement.h:
1661         * html/HTMLSlotElement.cpp:
1662         * html/HTMLSlotElement.h:
1663         * html/HTMLSourceElement.cpp:
1664         * html/HTMLSourceElement.h:
1665         * html/HTMLSpanElement.cpp:
1666         * html/HTMLSpanElement.h:
1667         * html/HTMLStyleElement.cpp:
1668         * html/HTMLStyleElement.h:
1669         * html/HTMLSummaryElement.cpp:
1670         * html/HTMLSummaryElement.h:
1671         * html/HTMLTableCaptionElement.cpp:
1672         * html/HTMLTableCaptionElement.h:
1673         * html/HTMLTableCellElement.cpp:
1674         * html/HTMLTableCellElement.h:
1675         * html/HTMLTableColElement.cpp:
1676         * html/HTMLTableColElement.h:
1677         * html/HTMLTableElement.cpp:
1678         * html/HTMLTableElement.h:
1679         * html/HTMLTablePartElement.cpp:
1680         * html/HTMLTablePartElement.h:
1681         * html/HTMLTableRowElement.cpp:
1682         * html/HTMLTableRowElement.h:
1683         * html/HTMLTableSectionElement.cpp:
1684         * html/HTMLTableSectionElement.h:
1685         * html/HTMLTemplateElement.cpp:
1686         * html/HTMLTemplateElement.h:
1687         * html/HTMLTextAreaElement.cpp:
1688         * html/HTMLTextAreaElement.h:
1689         * html/HTMLTextFormControlElement.cpp:
1690         * html/HTMLTextFormControlElement.h:
1691         * html/HTMLTimeElement.cpp:
1692         * html/HTMLTimeElement.h:
1693         * html/HTMLTitleElement.cpp:
1694         * html/HTMLTitleElement.h:
1695         * html/HTMLTrackElement.cpp:
1696         * html/HTMLTrackElement.h:
1697         * html/HTMLUListElement.cpp:
1698         * html/HTMLUListElement.h:
1699         * html/HTMLUnknownElement.cpp: Added.
1700         * html/HTMLUnknownElement.h:
1701         * html/HTMLWBRElement.cpp:
1702         * html/HTMLWBRElement.h:
1703         * html/ImageDocument.cpp:
1704         * html/ImageDocument.h:
1705         * html/LabelableElement.cpp:
1706         * html/LabelableElement.h:
1707         * html/MediaController.cpp:
1708         (MediaController::create): Deleted.
1709         (MediaController::MediaController): Deleted.
1710         (MediaController::addMediaElement): Deleted.
1711         (MediaController::removeMediaElement): Deleted.
1712         (MediaController::containsMediaElement const): Deleted.
1713         (MediaController::buffered const): Deleted.
1714         (MediaController::seekable const): Deleted.
1715         (MediaController::played): Deleted.
1716         (MediaController::duration const): Deleted.
1717         (MediaController::currentTime const): Deleted.
1718         (MediaController::setCurrentTime): Deleted.
1719         (MediaController::unpause): Deleted.
1720         (MediaController::play): Deleted.
1721         (MediaController::pause): Deleted.
1722         (MediaController::setDefaultPlaybackRate): Deleted.
1723         (MediaController::playbackRate const): Deleted.
1724         (MediaController::setPlaybackRate): Deleted.
1725         (MediaController::setVolume): Deleted.
1726         (MediaController::setMuted): Deleted.
1727         (playbackStateWaiting): Deleted.
1728         (playbackStatePlaying): Deleted.
1729         (playbackStateEnded): Deleted.
1730         (MediaController::playbackState const): Deleted.
1731         (MediaController::reportControllerState): Deleted.
1732         (eventNameForReadyState): Deleted.
1733         (MediaController::updateReadyState): Deleted.
1734         (MediaController::updatePlaybackState): Deleted.
1735         (MediaController::updateMediaElements): Deleted.
1736         (MediaController::bringElementUpToSpeed): Deleted.
1737         (MediaController::isBlocked const): Deleted.
1738         (MediaController::hasEnded const): Deleted.
1739         (MediaController::scheduleEvent): Deleted.
1740         (MediaController::asyncEventTimerFired): Deleted.
1741         (MediaController::clearPositionTimerFired): Deleted.
1742         (MediaController::hasAudio const): Deleted.
1743         (MediaController::hasVideo const): Deleted.
1744         (MediaController::hasClosedCaptions const): Deleted.
1745         (MediaController::setClosedCaptionsVisible): Deleted.
1746         (MediaController::supportsScanning const): Deleted.
1747         (MediaController::beginScrubbing): Deleted.
1748         (MediaController::endScrubbing): Deleted.
1749         (MediaController::beginScanning): Deleted.
1750         (MediaController::endScanning): Deleted.
1751         (MediaController::canPlay const): Deleted.
1752         (MediaController::isLiveStream const): Deleted.
1753         (MediaController::hasCurrentSrc const): Deleted.
1754         (MediaController::returnToRealtime): Deleted.
1755         (MediaController::startTimeupdateTimer): Deleted.
1756         (MediaController::scheduleTimeupdateEvent): Deleted.
1757         * html/MediaDocument.cpp:
1758         * html/MediaDocument.h:
1759         * html/PluginDocument.cpp:
1760         * html/PluginDocument.h:
1761         * html/RubyElement.cpp:
1762         * html/RubyElement.h:
1763         * html/RubyTextElement.cpp:
1764         * html/RubyTextElement.h:
1765         * html/TextDocument.cpp:
1766         * html/TextDocument.h:
1767         * html/shadow/AutoFillButtonElement.cpp:
1768         * html/shadow/AutoFillButtonElement.h:
1769         * html/shadow/DetailsMarkerControl.cpp:
1770         * html/shadow/DetailsMarkerControl.h:
1771         * html/shadow/ImageControlsRootElement.cpp:
1772         * html/shadow/ImageControlsRootElement.h:
1773         * html/shadow/MediaControlElementTypes.cpp:
1774         * html/shadow/MediaControlElementTypes.h:
1775         * html/shadow/MediaControlElements.cpp:
1776         * html/shadow/MediaControlElements.h:
1777         * html/shadow/MediaControls.cpp:
1778         * html/shadow/MediaControls.h:
1779         * html/shadow/ProgressShadowElement.cpp:
1780         * html/shadow/ProgressShadowElement.h:
1781         * html/shadow/SliderThumbElement.cpp:
1782         * html/shadow/SliderThumbElement.h:
1783         * html/shadow/SpinButtonElement.cpp:
1784         * html/shadow/SpinButtonElement.h:
1785         * html/shadow/TextControlInnerElements.cpp:
1786         * html/shadow/TextControlInnerElements.h:
1787         * html/shadow/YouTubeEmbedShadowElement.cpp:
1788         * html/shadow/YouTubeEmbedShadowElement.h:
1789         * html/shadow/mac/ImageControlsButtonElementMac.cpp:
1790         * html/shadow/mac/ImageControlsButtonElementMac.h:
1791         * html/shadow/mac/ImageControlsRootElementMac.cpp:
1792         * html/shadow/mac/ImageControlsRootElementMac.h:
1793         * html/track/TextTrackCueGeneric.cpp:
1794         * html/track/VTTCue.cpp:
1795         * html/track/VTTCue.h:
1796         * html/track/WebVTTElement.cpp:
1797         * html/track/WebVTTElement.h:
1798         * loader/SinkDocument.cpp:
1799         * loader/SinkDocument.h:
1800         * mathml/MathMLAnnotationElement.cpp:
1801         * mathml/MathMLAnnotationElement.h:
1802         * mathml/MathMLElement.cpp:
1803         * mathml/MathMLElement.h:
1804         * mathml/MathMLFractionElement.cpp:
1805         * mathml/MathMLFractionElement.h:
1806         * mathml/MathMLMathElement.cpp:
1807         * mathml/MathMLMathElement.h:
1808         * mathml/MathMLMencloseElement.cpp:
1809         * mathml/MathMLMencloseElement.h:
1810         * mathml/MathMLOperatorElement.cpp:
1811         * mathml/MathMLOperatorElement.h:
1812         * mathml/MathMLPaddedElement.cpp:
1813         * mathml/MathMLPaddedElement.h:
1814         * mathml/MathMLPresentationElement.cpp:
1815         * mathml/MathMLPresentationElement.h:
1816         * mathml/MathMLRootElement.cpp:
1817         * mathml/MathMLRootElement.h:
1818         * mathml/MathMLRowElement.cpp:
1819         * mathml/MathMLRowElement.h:
1820         * mathml/MathMLScriptsElement.cpp:
1821         * mathml/MathMLScriptsElement.h:
1822         * mathml/MathMLSelectElement.cpp:
1823         * mathml/MathMLSelectElement.h:
1824         * mathml/MathMLSpaceElement.cpp:
1825         * mathml/MathMLSpaceElement.h:
1826         * mathml/MathMLTokenElement.cpp:
1827         * mathml/MathMLTokenElement.h:
1828         * mathml/MathMLUnderOverElement.cpp:
1829         * mathml/MathMLUnderOverElement.h:
1830         * mathml/MathMLUnknownElement.cpp: Added.
1831         * mathml/MathMLUnknownElement.h:
1832         * svg/SVGAElement.cpp:
1833         * svg/SVGAElement.h:
1834         * svg/SVGAltGlyphDefElement.cpp:
1835         * svg/SVGAltGlyphDefElement.h:
1836         * svg/SVGAltGlyphElement.cpp:
1837         * svg/SVGAltGlyphElement.h:
1838         * svg/SVGAltGlyphItemElement.cpp:
1839         * svg/SVGAltGlyphItemElement.h:
1840         * svg/SVGAnimateColorElement.cpp:
1841         * svg/SVGAnimateColorElement.h:
1842         * svg/SVGAnimateElement.cpp:
1843         * svg/SVGAnimateElement.h:
1844         * svg/SVGAnimateElementBase.cpp:
1845         * svg/SVGAnimateElementBase.h:
1846         * svg/SVGAnimateMotionElement.cpp:
1847         * svg/SVGAnimateMotionElement.h:
1848         * svg/SVGAnimateTransformElement.cpp:
1849         * svg/SVGAnimateTransformElement.h:
1850         * svg/SVGAnimationElement.cpp:
1851         * svg/SVGAnimationElement.h:
1852         * svg/SVGCircleElement.cpp:
1853         * svg/SVGCircleElement.h:
1854         * svg/SVGClipPathElement.cpp:
1855         * svg/SVGClipPathElement.h:
1856         * svg/SVGComponentTransferFunctionElement.cpp:
1857         * svg/SVGComponentTransferFunctionElement.h:
1858         * svg/SVGCursorElement.cpp:
1859         * svg/SVGCursorElement.h:
1860         * svg/SVGDefsElement.cpp:
1861         * svg/SVGDefsElement.h:
1862         * svg/SVGDescElement.cpp:
1863         * svg/SVGDescElement.h:
1864         * svg/SVGDocument.cpp:
1865         * svg/SVGDocument.h:
1866         * svg/SVGElement.cpp:
1867         * svg/SVGElement.h:
1868         * svg/SVGEllipseElement.cpp:
1869         * svg/SVGEllipseElement.h:
1870         * svg/SVGFEBlendElement.cpp:
1871         * svg/SVGFEBlendElement.h:
1872         * svg/SVGFEColorMatrixElement.cpp:
1873         * svg/SVGFEColorMatrixElement.h:
1874         * svg/SVGFEComponentTransferElement.cpp:
1875         * svg/SVGFEComponentTransferElement.h:
1876         * svg/SVGFECompositeElement.cpp:
1877         * svg/SVGFECompositeElement.h:
1878         * svg/SVGFEConvolveMatrixElement.cpp:
1879         * svg/SVGFEConvolveMatrixElement.h:
1880         * svg/SVGFEDiffuseLightingElement.cpp:
1881         * svg/SVGFEDiffuseLightingElement.h:
1882         * svg/SVGFEDisplacementMapElement.cpp:
1883         * svg/SVGFEDisplacementMapElement.h:
1884         * svg/SVGFEDropShadowElement.cpp:
1885         * svg/SVGFEDropShadowElement.h:
1886         * svg/SVGFEFloodElement.cpp:
1887         * svg/SVGFEFloodElement.h:
1888         * svg/SVGFEGaussianBlurElement.cpp:
1889         * svg/SVGFEGaussianBlurElement.h:
1890         * svg/SVGFEImageElement.cpp:
1891         * svg/SVGFEImageElement.h:
1892         * svg/SVGFELightElement.cpp:
1893         * svg/SVGFELightElement.h:
1894         * svg/SVGFEMergeElement.cpp:
1895         * svg/SVGFEMergeElement.h:
1896         * svg/SVGFEMergeNodeElement.cpp:
1897         * svg/SVGFEMergeNodeElement.h:
1898         * svg/SVGFEMorphologyElement.cpp:
1899         * svg/SVGFEMorphologyElement.h:
1900         * svg/SVGFEOffsetElement.cpp:
1901         * svg/SVGFEOffsetElement.h:
1902         * svg/SVGFESpecularLightingElement.cpp:
1903         * svg/SVGFESpecularLightingElement.h:
1904         * svg/SVGFETileElement.cpp:
1905         * svg/SVGFETileElement.h:
1906         * svg/SVGFETurbulenceElement.cpp:
1907         * svg/SVGFETurbulenceElement.h:
1908         * svg/SVGFilterElement.cpp:
1909         * svg/SVGFilterElement.h:
1910         * svg/SVGFilterPrimitiveStandardAttributes.cpp:
1911         * svg/SVGFilterPrimitiveStandardAttributes.h:
1912         * svg/SVGFontFaceElement.cpp:
1913         * svg/SVGFontFaceElement.h:
1914         * svg/SVGFontFaceFormatElement.cpp:
1915         * svg/SVGFontFaceFormatElement.h:
1916         * svg/SVGFontFaceNameElement.cpp:
1917         * svg/SVGFontFaceNameElement.h:
1918         * svg/SVGFontFaceSrcElement.cpp:
1919         * svg/SVGFontFaceSrcElement.h:
1920         * svg/SVGFontFaceUriElement.cpp:
1921         * svg/SVGFontFaceUriElement.h:
1922         * svg/SVGForeignObjectElement.cpp:
1923         * svg/SVGForeignObjectElement.h:
1924         * svg/SVGGElement.cpp:
1925         * svg/SVGGElement.h:
1926         * svg/SVGGlyphElement.cpp:
1927         * svg/SVGGlyphElement.h:
1928         * svg/SVGGlyphRefElement.cpp:
1929         * svg/SVGGlyphRefElement.h:
1930         * svg/SVGGradientElement.cpp:
1931         * svg/SVGGradientElement.h:
1932         * svg/SVGGraphicsElement.cpp:
1933         * svg/SVGGraphicsElement.h:
1934         * svg/SVGHKernElement.cpp:
1935         * svg/SVGHKernElement.h:
1936         * svg/SVGImageElement.cpp:
1937         * svg/SVGImageElement.h:
1938         * svg/SVGLineElement.cpp:
1939         * svg/SVGLineElement.h:
1940         * svg/SVGLinearGradientElement.cpp:
1941         * svg/SVGLinearGradientElement.h:
1942         * svg/SVGMPathElement.cpp:
1943         * svg/SVGMPathElement.h:
1944         * svg/SVGMarkerElement.cpp:
1945         * svg/SVGMarkerElement.h:
1946         * svg/SVGMaskElement.cpp:
1947         * svg/SVGMaskElement.h:
1948         * svg/SVGMetadataElement.cpp:
1949         * svg/SVGMetadataElement.h:
1950         * svg/SVGMissingGlyphElement.cpp:
1951         * svg/SVGMissingGlyphElement.h:
1952         * svg/SVGPathElement.cpp:
1953         * svg/SVGPathElement.h:
1954         * svg/SVGPatternElement.cpp:
1955         * svg/SVGPatternElement.h:
1956         * svg/SVGPolyElement.cpp:
1957         * svg/SVGPolyElement.h:
1958         * svg/SVGPolygonElement.cpp:
1959         * svg/SVGPolygonElement.h:
1960         * svg/SVGPolylineElement.cpp:
1961         * svg/SVGPolylineElement.h:
1962         * svg/SVGRadialGradientElement.cpp:
1963         * svg/SVGRadialGradientElement.h:
1964         * svg/SVGRectElement.cpp:
1965         * svg/SVGRectElement.h:
1966         * svg/SVGSVGElement.cpp:
1967         * svg/SVGSVGElement.h:
1968         * svg/SVGScriptElement.cpp:
1969         * svg/SVGScriptElement.h:
1970         * svg/SVGSetElement.cpp:
1971         * svg/SVGSetElement.h:
1972         * svg/SVGStopElement.cpp:
1973         * svg/SVGStopElement.h:
1974         * svg/SVGStyleElement.cpp:
1975         * svg/SVGStyleElement.h:
1976         * svg/SVGSwitchElement.cpp:
1977         * svg/SVGSwitchElement.h:
1978         * svg/SVGSymbolElement.cpp:
1979         * svg/SVGSymbolElement.h:
1980         * svg/SVGTRefElement.cpp:
1981         * svg/SVGTRefElement.h:
1982         * svg/SVGTSpanElement.cpp:
1983         * svg/SVGTSpanElement.h:
1984         * svg/SVGTextContentElement.cpp:
1985         * svg/SVGTextContentElement.h:
1986         * svg/SVGTextElement.cpp:
1987         * svg/SVGTextElement.h:
1988         * svg/SVGTextPathElement.cpp:
1989         * svg/SVGTextPathElement.h:
1990         * svg/SVGTextPositioningElement.cpp:
1991         * svg/SVGTextPositioningElement.h:
1992         * svg/SVGTitleElement.cpp:
1993         * svg/SVGTitleElement.h:
1994         * svg/SVGUnknownElement.cpp: Added.
1995         * svg/SVGUnknownElement.h:
1996         * svg/SVGUseElement.cpp:
1997         * svg/SVGUseElement.h:
1998         * svg/SVGVKernElement.cpp:
1999         * svg/SVGVKernElement.h:
2000         * svg/SVGViewElement.cpp:
2001         * svg/SVGViewElement.h:
2002         * svg/animation/SVGSMILElement.cpp:
2003         * svg/animation/SVGSMILElement.h:
2004
2005 2018-03-16  Youenn Fablet  <youenn@apple.com>
2006
2007         Ensure Document::responseReceived and clearResource are called on the main thread
2008         https://bugs.webkit.org/show_bug.cgi?id=183709
2009
2010         Reviewed by Chris Dumez.
2011
2012         No change of behavior.
2013
2014         * loader/DocumentLoader.cpp:
2015         (WebCore::DocumentLoader::responseReceived):
2016         (WebCore::DocumentLoader::clearMainResource):
2017
2018 2018-03-16  Chris Dumez  <cdumez@apple.com>
2019
2020         WebKit.WebsitePoliciesAutoplayQuirks API test times out with async policy delegates
2021         https://bugs.webkit.org/show_bug.cgi?id=183702
2022
2023         Reviewed by Alex Christensen.
2024
2025         The issue is that the test calls loadHTMLString then loadRequest right after, without
2026         waiting for the first load to complete first. loadHTMLString is special as it relies
2027         on substitute data and which schedules a timer to commit the data. When doing the
2028         navigation policy check for the following loadRequest(), the substitute data timer
2029         would fire and commit its data and load. This would in turn cancel the pending
2030         navigation policy check for the loadRequest().
2031
2032         With sync policy delegates, this is not an issue because we take care of stopping
2033         all loaders when receiving the policy decision, which happens synchronously. However,
2034         when the policy decision happens asynchronously, the pending substitute data load
2035         does not get cancelled in time and it gets committed.
2036
2037         To address the issue, this patch updates loadWithDocumentLoader() to cancel any
2038         provisional load when there is an asynchronous navigation policy decision pending.
2039
2040         Change covered by new API test.
2041
2042         * loader/FrameLoader.cpp:
2043         (WebCore::FrameLoader::loadWithDocumentLoader):
2044
2045 2018-03-16  Brent Fulgham  <bfulgham@apple.com>
2046
2047         Set a trap to catch an infrequent form-related nullptr crash
2048         https://bugs.webkit.org/show_bug.cgi?id=183704
2049         <rdar://problem/37579354>
2050
2051         Reviewed by Ryosuke Niwa.
2052
2053         Make FormState a FrameDestructionObserver. We expect all relevant FormState objects to have been
2054         cleaned up prior to the frame being destroyed. If we find such a case, we'd like to see the
2055         stack trace to see what's going on.
2056
2057         * loader/FormState.cpp:
2058         (WebCore::FormState::FormState):
2059         (WebCore::FormState::willDetachPage): RELEASE_ASSERT_NOT_REACHED if we ever get here.
2060         * loader/FormState.h:
2061
2062 2018-03-16  Joanmarie Diggs  <jdiggs@igalia.com>
2063
2064         AX: AccessibilityNodeObject::textForLabelElement() doesn't follow AccName calculation rules
2065         https://bugs.webkit.org/show_bug.cgi?id=183661
2066
2067         Reviewed by Chris Fleizach.
2068
2069         Have AccessibilityNodeObject::textForLabelElement() return the value from
2070         accessibleNameForNode() instead of innerText(). The former falls back on
2071         the latter if there is no author-provided accessible name.
2072
2073         Tests: accessibility/aria-label-on-label-element.html
2074                accessibility/label-with-pseudo-elements.html
2075
2076         * accessibility/AccessibilityNodeObject.cpp:
2077         (WebCore::AccessibilityNodeObject::textForLabelElement const):
2078         (WebCore::AccessibilityNodeObject::titleElementText const):
2079
2080 2018-03-16  Basuke Suzuki  <Basuke.Suzuki@sony.com>
2081
2082         [Curl] Fix crash on websocket with bad handshake message.
2083         https://bugs.webkit.org/show_bug.cgi?id=183686
2084
2085         Reviewed by Youenn Fablet.
2086
2087         The closing cleanup was called multiple times. Add flag to detect
2088         it is already closed or not.
2089
2090         No new tests because it is covered by existing test:
2091         - LayoutTests/http/tests/websocket/tests/hybi/bad-handshake-crash.html
2092
2093         * platform/network/curl/SocketStreamHandleImpl.h:
2094         * platform/network/curl/SocketStreamHandleImplCurl.cpp:
2095         (WebCore::SocketStreamHandleImpl::platformClose):
2096         (WebCore::SocketStreamHandleImpl::didReceiveData):
2097
2098 2018-03-16  Jer Noble  <jer.noble@apple.com>
2099
2100         Make Fullscreen API an Experimental Feature
2101         https://bugs.webkit.org/show_bug.cgi?id=183662
2102
2103         Reviewed by Jon Lee.
2104
2105         The Fullscreen APIs should be guarded by a Setting, so they are not present in the DOM when the
2106         Experimental Feature is disabled.
2107
2108         * dom/Document.idl:
2109         * dom/Element.idl:
2110
2111 2018-03-16  Megan Gardner  <megan_gardner@apple.com>
2112
2113         Ensure that style is updated when the effective appearance changes
2114         https://bugs.webkit.org/show_bug.cgi?id=183690
2115         <rdar://problem/38385900>
2116
2117         Reviewed by Tim Horton and Wenson Hsieh.
2118
2119         Only exposing a function to outside WebCore, no tests needed.
2120
2121         * page/Page.h:
2122
2123 2018-03-16  Chris Dumez  <cdumez@apple.com>
2124
2125         WebKit.RestoreSessionStateContainingScrollRestorationDefault API test is failing with async policy delegates
2126         https://bugs.webkit.org/show_bug.cgi?id=183679
2127
2128         Reviewed by Alex Christensen.
2129
2130         Update CachedRawResource::didAddClient() to not send data until we've received
2131         the policy decision for the response.
2132
2133         No new tests, covered by new API test.
2134
2135         * loader/DocumentLoader.cpp:
2136         (WebCore::DocumentLoader::handleSubstituteDataLoadNow):
2137         (WebCore::DocumentLoader::responseReceived):
2138         * loader/DocumentLoader.h:
2139         * loader/DocumentThreadableLoader.cpp:
2140         (WebCore::DocumentThreadableLoader::responseReceived):
2141         * loader/DocumentThreadableLoader.h:
2142         * loader/MediaResourceLoader.cpp:
2143         (WebCore::MediaResource::responseReceived):
2144         * loader/MediaResourceLoader.h:
2145         * loader/appcache/ApplicationCacheResourceLoader.cpp:
2146         (WebCore::ApplicationCacheResourceLoader::responseReceived):
2147         * loader/appcache/ApplicationCacheResourceLoader.h:
2148         * loader/cache/CachedRawResource.cpp:
2149         (WebCore::CachedRawResource::didAddClient):
2150         (WebCore::CachedRawResource::responseReceived):
2151         * loader/cache/CachedRawResourceClient.h:
2152         (WebCore::CachedRawResourceClient::responseReceived):
2153         * loader/cache/KeepaliveRequestTracker.cpp:
2154         (WebCore::KeepaliveRequestTracker::responseReceived):
2155         * loader/cache/KeepaliveRequestTracker.h:
2156         * platform/graphics/avfoundation/objc/WebCoreAVFResourceLoader.h:
2157         * platform/graphics/avfoundation/objc/WebCoreAVFResourceLoader.mm:
2158         (WebCore::WebCoreAVFResourceLoader::responseReceived):
2159
2160 2018-03-16  Youenn Fablet  <youenn@apple.com>
2161
2162         Name Service Worker threads differently from regular Worker threads
2163         https://bugs.webkit.org/show_bug.cgi?id=183698
2164
2165         Reviewed by Chris Dumez.
2166
2167         No observable change of behavior.
2168         For debugging purposes, knowing that a thread is a service worker thread might help give context.
2169         It might also identify on a crash log whether the process is a service worker process or a regular web process.
2170
2171         * workers/WorkerThread.cpp:
2172         (WebCore::WorkerThread::start):
2173         * workers/WorkerThread.h:
2174         (WebCore::WorkerThread::isServiceWorkerThread const):
2175         * workers/service/context/ServiceWorkerThread.h:
2176
2177 2018-03-16  Youenn Fablet  <youenn@apple.com>
2178
2179         IceCandidates leak on webrtc/datachannel/basic.html and other tests
2180         https://bugs.webkit.org/show_bug.cgi?id=183676
2181         <rdar://problem/36116228>
2182
2183         Reviewed by Eric Carlson.
2184
2185         Covered by manual testing using --leaks option on WK1.
2186         WebKit should not release the candidates since libwebrtc is not taking ownership.
2187
2188         * Modules/mediastream/libwebrtc/LibWebRTCPeerConnectionBackend.cpp:
2189         (WebCore::LibWebRTCPeerConnectionBackend::doSetLocalDescription):
2190         (WebCore::LibWebRTCPeerConnectionBackend::doSetRemoteDescription):
2191
2192 2018-03-16  Zan Dobersek  <zdobersek@igalia.com>
2193
2194         [Nicosia] Add Cairo-specific GraphicsContext operation recorder
2195         https://bugs.webkit.org/show_bug.cgi?id=183593
2196
2197         Reviewed by Carlos Garcia Campos.
2198
2199         Add Nicosia::CairoOperationRecorder, GraphicsContextImpl implementation
2200         that records all GraphicsContext operations for deferred replay on a
2201         different thread. Recording here mostly consists of storing all the
2202         Cairo resources in a thread-safe manner, which is eased by the atomic
2203         reference counting used in Cairo.
2204
2205         Nicosia::PaintingOperation derivatives are used for operations or state
2206         updates that require recording. Instances of these classes are appended
2207         to a Vector<> object that is then pushed into a thread pool in
2208         Nicosia::PaintingEngineThreaded , replaying all the operations against
2209         the Cairo context established from an associated target Nicosia::Buffer.
2210
2211         This GraphicsContextImpl implementation is now used in the
2212         PaintingContextCairo::ForRecording constructor to construct the
2213         GraphicsContext implementation that will be used for recording.
2214
2215         * platform/TextureMapper.cmake:
2216         * platform/graphics/nicosia/cairo/NicosiaCairoOperationRecorder.cpp: Added.
2217         (Nicosia::getContext):
2218         (Nicosia::OperationData::arg const const):
2219         (Nicosia::createCommand):
2220         (Nicosia::CairoOperationRecorder::CairoOperationRecorder):
2221         (Nicosia::m_commandList):
2222         (Nicosia::CairoOperationRecorder::updateState):
2223         (Nicosia::CairoOperationRecorder::clearShadow):
2224         (Nicosia::CairoOperationRecorder::setLineCap):
2225         (Nicosia::CairoOperationRecorder::setLineDash):
2226         (Nicosia::CairoOperationRecorder::setLineJoin):
2227         (Nicosia::CairoOperationRecorder::setMiterLimit):
2228         (Nicosia::CairoOperationRecorder::fillRect):
2229         (Nicosia::CairoOperationRecorder::fillRoundedRect):
2230         (Nicosia::CairoOperationRecorder::fillRectWithRoundedHole):
2231         (Nicosia::CairoOperationRecorder::fillPath):
2232         (Nicosia::CairoOperationRecorder::fillEllipse):
2233         (Nicosia::CairoOperationRecorder::strokeRect):
2234         (Nicosia::CairoOperationRecorder::strokePath):
2235         (Nicosia::CairoOperationRecorder::strokeEllipse):
2236         (Nicosia::CairoOperationRecorder::clearRect):
2237         (Nicosia::CairoOperationRecorder::drawGlyphs):
2238         (Nicosia::CairoOperationRecorder::drawImage):
2239         (Nicosia::CairoOperationRecorder::drawTiledImage):
2240         (Nicosia::CairoOperationRecorder::drawNativeImage):
2241         (Nicosia::CairoOperationRecorder::drawPattern):
2242         (Nicosia::CairoOperationRecorder::drawRect):
2243         (Nicosia::CairoOperationRecorder::drawLine):
2244         (Nicosia::CairoOperationRecorder::drawLinesForText):
2245         (Nicosia::CairoOperationRecorder::drawLineForDocumentMarker):
2246         (Nicosia::CairoOperationRecorder::drawEllipse):
2247         (Nicosia::CairoOperationRecorder::drawPath):
2248         (Nicosia::CairoOperationRecorder::drawFocusRing):
2249         (Nicosia::CairoOperationRecorder::save):
2250         (Nicosia::CairoOperationRecorder::restore):
2251         (Nicosia::CairoOperationRecorder::translate):
2252         (Nicosia::CairoOperationRecorder::rotate):
2253         (Nicosia::CairoOperationRecorder::scale):
2254         (Nicosia::CairoOperationRecorder::concatCTM):
2255         (Nicosia::CairoOperationRecorder::setCTM):
2256         (Nicosia::CairoOperationRecorder::getCTM):
2257         (Nicosia::CairoOperationRecorder::beginTransparencyLayer):
2258         (Nicosia::CairoOperationRecorder::endTransparencyLayer):
2259         (Nicosia::CairoOperationRecorder::clip):
2260         (Nicosia::CairoOperationRecorder::clipOut):
2261         (Nicosia::CairoOperationRecorder::clipPath):
2262         (Nicosia::CairoOperationRecorder::clipBounds):
2263         (Nicosia::CairoOperationRecorder::applyDeviceScaleFactor):
2264         (Nicosia::CairoOperationRecorder::roundToDevicePixels):
2265         (Nicosia::CairoOperationRecorder::append):
2266         * platform/graphics/nicosia/cairo/NicosiaCairoOperationRecorder.h: Added.
2267         * platform/graphics/nicosia/cairo/NicosiaPaintingContextCairo.cpp:
2268         (Nicosia::PaintingContextCairo::ForRecording::ForRecording):
2269
2270 2018-03-16  Zan Dobersek  <zdobersek@igalia.com>
2271
2272         [TexMap] Clean up TextureMapperLayer constructor
2273         https://bugs.webkit.org/show_bug.cgi?id=183634
2274
2275         Reviewed by Michael Catanzaro.
2276
2277         In the TextureMapperLayer header, only declare the constructor, and move
2278         all the previous member initialization to the point of declaration of
2279         these member variables.
2280
2281         In the TextureMapperLayer implementation file, the constructor and
2282         destructor are moved into proper order at the top of the file. The
2283         former is defaulted, and the latter remains unchanged.
2284
2285         No change in behavior.
2286
2287         * platform/graphics/texmap/TextureMapperLayer.cpp:
2288         (WebCore::TextureMapperLayer::~TextureMapperLayer):
2289         * platform/graphics/texmap/TextureMapperLayer.h:
2290
2291 2018-03-16  Miguel Gomez  <magomez@igalia.com>
2292
2293         [GTK] When using EGL, request an OpenGL core profile when possible
2294         https://bugs.webkit.org/show_bug.cgi?id=178719
2295
2296         Reviewed by Carlos Garcia Campos.
2297
2298         When using EGL and OpenGL, try to request a context with version >= 3.2 with a core profile
2299         whenever possible. In order to to this, we require EGL version 1.5 or version 1.4 with the
2300         extension EGL_KHR_create_context. If EGL requirements are not met, or we cannot get a
2301         context with version >= 3.2 then use whatever EGL gives us.
2302
2303         Covered by existent tests.
2304
2305         * platform/graphics/egl/GLContextEGL.cpp:
2306         (WebCore::GLContextEGL::createWindowContext):
2307         (WebCore::GLContextEGL::createPbufferContext):
2308         (WebCore::GLContextEGL::createSurfacelessContext):
2309         (WebCore::GLContextEGL::createContextForEGLVersion):
2310         * platform/graphics/egl/GLContextEGL.h:
2311         * platform/graphics/egl/GLContextEGLWPE.cpp:
2312         (WebCore::GLContextEGL::createWPEContext):
2313         * platform/graphics/egl/GLContextEGLWayland.cpp:
2314         (WebCore::GLContextEGL::createWaylandContext):
2315         * platform/graphics/egl/GLContextEGLX11.cpp:
2316         (WebCore::GLContextEGL::createPixmapContext):
2317
2318 2018-03-16  Zan Dobersek  <zdobersek@igalia.com>
2319
2320         [TexMap] Don't use the TextureMapperAnimation::Client interface to apply animation
2321         https://bugs.webkit.org/show_bug.cgi?id=183656
2322
2323         Reviewed by Carlos Garcia Campos.
2324
2325         Don't have the TextureMapperLayer class inherit from the
2326         TextureMapperAnimation::Client interface just for the purposes of
2327         synchronization of animation-affected attributes in syncAnimations().
2328         For that purpose it's enough to provide a struct that is passed to that
2329         method, and with the TextureMapperAnimation class filling out any of the
2330         animated attributes that need to be updated.
2331
2332         TextureMapperAnimation::ApplicationResult struct is introducted for that
2333         purpose. std::optional<> members in it are assigned values during the
2334         application process, if an appropriate animation affects them. The
2335         relevant member values in TextureMapperLayer are then updated, or value
2336         from the default state is used.
2337
2338         TextureMapperAnimation::Client is removed.
2339
2340         No new tests -- no change in behavior.
2341
2342         * platform/graphics/texmap/TextureMapperAnimation.cpp:
2343         (WebCore::TextureMapperAnimation::apply):
2344         (WebCore::TextureMapperAnimation::applyInternal):
2345         (WebCore::TextureMapperAnimations::apply):
2346         * platform/graphics/texmap/TextureMapperAnimation.h:
2347         * platform/graphics/texmap/TextureMapperLayer.cpp:
2348         (WebCore::TextureMapperLayer::syncAnimations):
2349         (WebCore::TextureMapperLayer::setAnimatedTransform): Deleted.
2350         (WebCore::TextureMapperLayer::setAnimatedOpacity): Deleted.
2351         (WebCore::TextureMapperLayer::setAnimatedFilters): Deleted.
2352         * platform/graphics/texmap/TextureMapperLayer.h:
2353
2354 2018-03-16  Devin Rousso  <webkit@devinrousso.com>
2355
2356         Web Inspector: Canvas Tab: main WebGL canvas on acko.net has no reported size
2357         https://bugs.webkit.org/show_bug.cgi?id=178798
2358         <rdar://problem/35175740>
2359
2360         Reviewed by Brian Burg.
2361
2362         When the main frame navigates, the DOMAgent would recieve two InspectorInstrumentation calls,
2363         one when the frame begins its navigation and the other when the document for that frame has
2364         loaded. Both of these would discard the DOMAgent's bindings, which included the map of
2365         `nodeId`s. This was an issue for canvases, as the frontend would be notified whenever any
2366         canvas is created, which would usually occur before the `DOMContentLoaded` event is fired.
2367         As a result, the canvases would attempt to retrieve their associated node, only to have the
2368         DOMAgent discard those bindings quickly thereafter.
2369
2370         This patch removes DOMAgent's and DOMDebuggerAgent's (parity) instrumentation hooks for the
2371         latter event, ensuring that the bindings are only discarded once.
2372
2373         * inspector/agents/InspectorDOMAgent.h:
2374         * inspector/agents/InspectorDOMAgent.cpp:
2375         (WebCore::InspectorDOMAgent::mainFrameDOMContentLoaded): Deleted.
2376
2377         * inspector/agents/InspectorDOMDebuggerAgent.h:
2378         * inspector/agents/InspectorDOMDebuggerAgent.cpp:
2379         (WebCore::InspectorDOMDebuggerAgent::frameDocumentUpdated): Added.
2380         (WebCore::InspectorDOMDebuggerAgent::mainFrameDOMContentLoaded): Deleted.
2381
2382         * inspector/InspectorInstrumentation.cpp:
2383         (WebCore::InspectorInstrumentation::domContentLoadedEventFiredImpl):
2384         (WebCore::InspectorInstrumentation::frameDocumentUpdatedImpl):
2385
2386 2018-03-15  Tim Horton  <timothy_horton@apple.com>
2387
2388         Include CADisplayLink explicitly where needed, instead of all of CA
2389         https://bugs.webkit.org/show_bug.cgi?id=183689
2390         <rdar://problem/38528719>
2391
2392         Reviewed by Wenson Hsieh.
2393
2394         * platform/graphics/ios/DisplayRefreshMonitorIOS.mm:
2395
2396 2018-03-15  Tim Horton  <timothy_horton@apple.com>
2397
2398         Include MobileCoreServices in the WebCore prefix header
2399         https://bugs.webkit.org/show_bug.cgi?id=183688
2400         <rdar://problem/38527621>
2401
2402         Reviewed by Dan Bernstein.
2403
2404         * WebCorePrefix.h:
2405
2406 2018-03-15  Megan Gardner  <megan_gardner@apple.com>
2407
2408         Create MediaQueryParserContext to provide additional context for the evaluation of media queries
2409         https://bugs.webkit.org/show_bug.cgi?id=183677
2410
2411         Reviewed by Tim Horton.
2412
2413         We need additional context for parsing media queries to make sure they are parsed correctly and valid.
2414
2415         Not currently testable, will add tests in a later patch.
2416
2417         * WebCore.xcodeproj/project.pbxproj:
2418         * css/MediaList.cpp:
2419         (WebCore::MediaQuerySet::create):
2420         (WebCore::MediaQuerySet::set):
2421         (WebCore::MediaQuerySet::add):
2422         (WebCore::MediaQuerySet::remove):
2423         * css/MediaList.h:
2424         * css/MediaQueryEvaluator.cpp:
2425         (WebCore::MediaQueryEvaluator::mediaAttributeMatches):
2426         * css/MediaQueryExpression.cpp:
2427         (WebCore::featureWithValidIdent):
2428         (WebCore::featureWithValidDensity):
2429         (WebCore::featureWithValidPositiveLength):
2430         (WebCore::featureWithPositiveInteger):
2431         (WebCore::featureWithPositiveNumber):
2432         (WebCore::featureWithZeroOrOne):
2433         (WebCore::isFeatureValidWithoutValue):
2434         (WebCore::MediaQueryExpression::MediaQueryExpression):
2435         * css/MediaQueryExpression.h:
2436         * css/MediaQueryMatcher.cpp:
2437         (WebCore::MediaQueryMatcher::matchMedia):
2438         * css/MediaQueryParserContext.cpp: Added.
2439         (WebCore::MediaQueryParserContext::MediaQueryParserContext):
2440         * css/MediaQueryParserContext.h: Added.
2441         (WebCore::MediaQueryParserContext::MediaQueryParserContext):
2442         * css/StyleMedia.cpp:
2443         (WebCore::StyleMedia::matchMedium const):
2444         * css/StyleRuleImport.cpp:
2445         (WebCore::StyleRuleImport::StyleRuleImport):
2446         (WebCore::StyleRuleImport::setCSSStyleSheet):
2447         * css/parser/CSSParser.cpp:
2448         (WebCore::CSSParserContext::CSSParserContext):
2449         (WebCore::operator==):
2450         * css/parser/CSSParserImpl.cpp:
2451         (WebCore::CSSParserImpl::consumeImportRule):
2452         (WebCore::CSSParserImpl::consumeMediaRule):
2453         * css/parser/MediaQueryParser.cpp:
2454         (WebCore::MediaQueryParser::parseMediaQuerySet):
2455         (WebCore::MediaQueryParser::parseMediaCondition):
2456         (WebCore::MediaQueryParser::MediaQueryParser):
2457         (WebCore::MediaQueryData::addExpression):
2458         * css/parser/MediaQueryParser.h:
2459         (WebCore::MediaQueryData::setMediaQueryParserContext):
2460         * css/parser/SizesAttributeParser.cpp:
2461         (WebCore::SizesAttributeParser::parse):
2462         * dom/DOMImplementation.cpp:
2463         (WebCore::DOMImplementation::createCSSStyleSheet):
2464         * dom/InlineStyleSheetOwner.cpp:
2465         (WebCore::InlineStyleSheetOwner::createSheet):
2466         * dom/ProcessingInstruction.cpp:
2467         (WebCore::ProcessingInstruction::setCSSStyleSheet):
2468         * html/HTMLImageElement.cpp:
2469         (WebCore::HTMLImageElement::bestFitSourceFromPictureElement):
2470         * html/HTMLLinkElement.cpp:
2471         (WebCore::HTMLLinkElement::process):
2472         (WebCore::HTMLLinkElement::initializeStyleSheet):
2473         (WebCore::HTMLLinkElement::setCSSStyleSheet):
2474         * html/HTMLLinkElement.h:
2475         * html/HTMLMediaElement.cpp:
2476         (WebCore::HTMLMediaElement::selectNextSourceChild):
2477         * html/HTMLSourceElement.cpp:
2478         (WebCore::HTMLSourceElement::parsedMediaAttribute const):
2479         * html/HTMLSourceElement.h:
2480         * html/HTMLStyleElement.cpp:
2481         (WebCore::HTMLStyleElement::parseAttribute):
2482         * html/parser/HTMLPreloadScanner.cpp:
2483         (WebCore::TokenPreloadScanner::StartTagScanner::processAttribute):
2484
2485 2018-03-15  Commit Queue  <commit-queue@webkit.org>
2486
2487         Unreviewed, rolling out r229639.
2488         https://bugs.webkit.org/show_bug.cgi?id=183683
2489
2490         it is causing a crash in API tests (Requested by youenn on
2491         #webkit).
2492
2493         Reverted changeset:
2494
2495         "ActiveDOMObject should assert that they are destroyed in the
2496         thread they are created"
2497         https://bugs.webkit.org/show_bug.cgi?id=183671
2498         https://trac.webkit.org/changeset/229639
2499
2500 2018-03-15  Youenn Fablet  <youenn@apple.com>
2501
2502         Bad configuration parameters should make RTCPeerConnection constructor throw
2503         https://bugs.webkit.org/show_bug.cgi?id=183615
2504
2505         Reviewed by Eric Carlson.
2506
2507         Implement more of https://w3c.github.io/webrtc-pc/#set-pc-configuration.
2508         Throw an error whenever underlying libwebrtc set configuration fails.
2509
2510         Covered by rebased test.
2511
2512         * Modules/mediastream/PeerConnectionBackend.h:
2513         * Modules/mediastream/RTCPeerConnection.cpp:
2514         (WebCore::iceServersFromConfiguration):
2515         (WebCore::RTCPeerConnection::initializeConfiguration):
2516         (WebCore::RTCPeerConnection::setConfiguration):
2517         * Modules/mediastream/RTCPeerConnection.js:
2518         (initializeRTCPeerConnection):
2519         * Modules/mediastream/libwebrtc/LibWebRTCPeerConnectionBackend.h:
2520
2521 2018-03-15  Youenn Fablet  <youenn@apple.com>
2522
2523         replaceTrack triggers negotiationneeded
2524         https://bugs.webkit.org/show_bug.cgi?id=180342
2525         <rdar://problem/35822426>
2526
2527         Reviewed by Eric Carlson.
2528
2529         Covered by updated test.
2530         Fix the case of replacing a track for which data is already flowing.
2531         We should probably do the same for null tracks when fully implementing transceivers.
2532
2533         * Modules/mediastream/RTCPeerConnection.cpp:
2534         (WebCore::RTCPeerConnection::enqueueReplaceTrackTask):
2535
2536 2018-03-15  Keith Rollin  <krollin@apple.com>
2537
2538         Telemetry for stalled webpage loads
2539         https://bugs.webkit.org/show_bug.cgi?id=183221
2540         <rdar://problem/36549013>
2541
2542         Reviewed by Chris Dumez.
2543
2544         Add telemetry for page loads, tracking the pages that succeed, fail,
2545         or are canceled. This information will be used to track the overall
2546         health of our page loading as time goes on.
2547
2548         No new tests -- no new/changed user-level functionality.
2549
2550         * page/DiagnosticLoggingKeys.cpp:
2551         (WebCore::DiagnosticLoggingKeys::telemetryPageLoadKey):
2552         (WebCore::DiagnosticLoggingKeys::timedOutKey):
2553         (WebCore::DiagnosticLoggingKeys::canceledLessThan2SecondsKey):
2554         (WebCore::DiagnosticLoggingKeys::canceledLessThan5SecondsKey):
2555         (WebCore::DiagnosticLoggingKeys::canceledLessThan20SecondsKey):
2556         (WebCore::DiagnosticLoggingKeys::canceledMoreThan20SecondsKey):
2557         (WebCore::DiagnosticLoggingKeys::failedLessThan2SecondsKey):
2558         (WebCore::DiagnosticLoggingKeys::failedLessThan5SecondsKey):
2559         (WebCore::DiagnosticLoggingKeys::failedLessThan20SecondsKey):
2560         (WebCore::DiagnosticLoggingKeys::failedMoreThan20SecondsKey):
2561         (WebCore::DiagnosticLoggingKeys::occurredKey):
2562         (WebCore::DiagnosticLoggingKeys::succeededLessThan2SecondsKey):
2563         (WebCore::DiagnosticLoggingKeys::succeededLessThan5SecondsKey):
2564         (WebCore::DiagnosticLoggingKeys::succeededLessThan20SecondsKey):
2565         (WebCore::DiagnosticLoggingKeys::succeededMoreThan20SecondsKey):
2566         * page/DiagnosticLoggingKeys.h:
2567         * platform/network/cf/ResourceError.h:
2568         (WebCore::ResourceError::ResourceError):
2569         * platform/network/mac/ResourceErrorMac.mm:
2570         (WebCore::ResourceError::ResourceError):
2571         (WebCore::ResourceError::getNSURLErrorDomain const):
2572         (WebCore::ResourceError::getCFErrorDomainCFNetwork const):
2573         (WebCore::ResourceError::mapPlatformError):
2574
2575 2018-03-15  Youenn Fablet  <youenn@apple.com>
2576
2577         ActiveDOMObject should assert that they are destroyed in the thread they are created
2578         https://bugs.webkit.org/show_bug.cgi?id=183671
2579
2580         Reviewed by Chris Dumez.
2581
2582         No change of behavior.
2583         Moved MessagePort assertion to ActiveDOMObject.
2584
2585         * dom/ActiveDOMObject.cpp:
2586         (WebCore::ActiveDOMObject::~ActiveDOMObject):
2587         * dom/ActiveDOMObject.h:
2588         * dom/MessagePort.cpp:
2589         (WebCore::MessagePort::~MessagePort):
2590         * dom/MessagePort.h:
2591
2592 2018-03-15  Youenn Fablet  <youenn@apple.com>
2593
2594         MessagePort is not always destroyed on the right thread
2595         https://bugs.webkit.org/show_bug.cgi?id=183619
2596         <rdar://problem/38204711>
2597
2598         Reviewed by Chris Dumez.
2599
2600         Add assertion to ensure MessagePort is destroyed in the right thread.
2601         Modify methods taking a ref in a lambda to rely on weak pointers and refing the WorkerThread if in a worker context.
2602         It is safe to ref the WorkerThread since it is thread safe ref counted and we are passing the ref to the main thread
2603         where the WorkerThread is expected to be destroyed.
2604
2605         Test: http/tests/workers/worker-messageport-2.html
2606
2607         * dom/MessagePort.cpp:
2608         (WebCore::MessagePort::~MessagePort):
2609         (WebCore::MessagePort::dispatchMessages):
2610         (WebCore::MessagePort::updateActivity):
2611         (WebCore::MessagePort::hasPendingActivity const):
2612         * dom/MessagePort.h:
2613
2614 2018-03-15  Jer Noble  <jer.noble@apple.com>
2615
2616         Adopt new AVURLAssetUseClientURLLoadingExclusively AVURLAsset creation option.
2617         https://bugs.webkit.org/show_bug.cgi?id=183660
2618
2619         Reviewed by Jon Lee.
2620
2621         * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
2622         (WebCore::MediaPlayerPrivateAVFoundationObjC::createAVAssetForURL):
2623
2624 2018-03-15  Chris Dumez  <cdumez@apple.com>
2625
2626         Unreviewed, fix tiny mistake in r229615 that caused API tests failures.
2627
2628         * workers/service/server/SWServer.cpp:
2629         (WebCore::SWServer::addRegistrationFromStore):
2630
2631 2018-03-15  Zan Dobersek  <zdobersek@igalia.com>
2632
2633         [TexMap] Remove TextureMapperLayer::texture()
2634         https://bugs.webkit.org/show_bug.cgi?id=183635
2635
2636         Reviewed by Michael Catanzaro.
2637
2638         Remove the unused TextureMapperLayer::texture() method. This enables
2639         removing the virtual TextureMapperBackingStore::texture() method, as
2640         well as the implementations of it in TextureMapperTiledBackingStore and
2641         CoordinatedBackingStore classes.
2642
2643         No change in behavior.
2644
2645         * platform/graphics/texmap/TextureMapperBackingStore.h:
2646         * platform/graphics/texmap/TextureMapperLayer.h:
2647         * platform/graphics/texmap/TextureMapperTiledBackingStore.cpp:
2648         (WebCore::TextureMapperTiledBackingStore::texture const): Deleted.
2649         * platform/graphics/texmap/TextureMapperTiledBackingStore.h:
2650
2651 2018-03-15  Zan Dobersek  <zdobersek@igalia.com>
2652
2653         [TexMap] Don't bother caching pattern transform matrix
2654         https://bugs.webkit.org/show_bug.cgi?id=183633
2655
2656         Reviewed by Michael Catanzaro.
2657
2658         Remove the m_patternTransform and m_patternTransformDirty member
2659         variables from the TextureMapperLayer class. These unnecessarily
2660         complicate the state update methods that need to compare the given
2661         attribute against the current state, and only update it if it has
2662         changed.
2663
2664         Instead, compute the pattern TransformationMatrix value on-the-fly in
2665         the paintSelf() method, if at all necessary.
2666
2667         No change in functionality.
2668
2669         * platform/graphics/texmap/TextureMapperLayer.cpp:
2670         (WebCore::TextureMapperLayer::paintSelf):
2671         (WebCore::TextureMapperLayer::setContentsRect):
2672         (WebCore::TextureMapperLayer::setContentsTileSize):
2673         (WebCore::TextureMapperLayer::setContentsTilePhase):
2674         (WebCore::TextureMapperLayer::computePatternTransformIfNeeded): Deleted.
2675         * platform/graphics/texmap/TextureMapperLayer.h:
2676
2677 2018-03-14  John Wilander  <wilander@apple.com>
2678
2679         Resource Load Statistics: Add clearing of storage access to WebResourceLoadStatisticsStore::clearInMemory()
2680         https://bugs.webkit.org/show_bug.cgi?id=183641
2681         <rdar://problem/38469497>
2682
2683         Reviewed by Brent Fulgham and Chris Dumez.
2684
2685         No new tests. This change is to stabilize existing layout tests.
2686         See Ryan Haddad's comment in https://bugs.webkit.org/show_bug.cgi?id=183620.
2687
2688         * platform/network/NetworkStorageSession.h:
2689         * platform/network/cf/NetworkStorageSessionCFNet.cpp:
2690         (WebCore::NetworkStorageSession::removeAllStorageAccess):
2691             New function to clear out all storage access entries.
2692
2693 2018-03-14  Youenn Fablet  <youenn@apple.com>
2694
2695         imported/w3c/web-platform-tests/WebCryptoAPI/wrapKey_unwrapKey/wrapKey_unwrapKey.worker.html is crashing
2696         https://bugs.webkit.org/show_bug.cgi?id=183602
2697
2698         Reviewed by Chris Dumez.
2699
2700         Introduce a map of ScriptExecutionContext that is read/write protected using a Lock.
2701         This allows introducing postTaskTo taking a ScriptExecutionContext identifier and callable from any thread.
2702         Use that method in Crypto instead of refing/unrefing  the context.
2703         Lock only happens if context does some postTask activity. This is governed by calling or not the new contextIdentifier() getter.
2704
2705         Covered by crypto tests no longer failing m_workerGlobalScope->hasOneRef() assertion.
2706
2707         * crypto/CryptoAlgorithm.cpp:
2708         (WebCore::dispatchAlgorithmOperation):
2709         * crypto/algorithms/CryptoAlgorithmECDH.cpp:
2710         (WebCore::CryptoAlgorithmECDH::deriveBits):
2711         * crypto/algorithms/CryptoAlgorithmSHA1.cpp:
2712         (WebCore::CryptoAlgorithmSHA1::digest):
2713         * crypto/algorithms/CryptoAlgorithmSHA224.cpp:
2714         (WebCore::CryptoAlgorithmSHA224::digest):
2715         * crypto/algorithms/CryptoAlgorithmSHA256.cpp:
2716         (WebCore::CryptoAlgorithmSHA256::digest):
2717         * crypto/algorithms/CryptoAlgorithmSHA384.cpp:
2718         (WebCore::CryptoAlgorithmSHA384::digest):
2719         * crypto/algorithms/CryptoAlgorithmSHA512.cpp:
2720         (WebCore::CryptoAlgorithmSHA512::digest):
2721         * crypto/gcrypt/CryptoKeyRSAGCrypt.cpp:
2722         (WebCore::CryptoKeyRSA::generatePair):
2723         * crypto/mac/CryptoKeyRSAMac.cpp:
2724         (WebCore::CryptoKeyRSA::generatePair):
2725         * dom/Document.cpp:
2726         (WebCore::Document::~Document):
2727         * dom/ScriptExecutionContext.cpp:
2728         (WebCore::allScriptExecutionContextsMapLock):
2729         (WebCore::ScriptExecutionContext::ScriptExecutionContext):
2730         (WebCore::ScriptExecutionContext::removeFromContextsMap):
2731         (WebCore::ScriptExecutionContext::checkConsistency const):
2732         (WebCore::ScriptExecutionContext::postTaskTo):
2733         * dom/ScriptExecutionContext.h:
2734         (WebCore::ScriptExecutionContext::contextIdentifier const):
2735         * workers/WorkerGlobalScope.cpp:
2736         (WebCore::WorkerGlobalScope::~WorkerGlobalScope):
2737
2738 2018-03-14  Chris Dumez  <cdumez@apple.com>
2739
2740         Reduce use of SWServerToContextConnection::globalServerToContextConnection()
2741         https://bugs.webkit.org/show_bug.cgi?id=183626
2742
2743         Reviewed by Youenn Fablet.
2744
2745         Reduce use of SWServerToContextConnection::globalServerToContextConnection() as we are moving towards
2746         having multiple context connections.
2747
2748         No new tests, no expected behavior change.
2749
2750         * workers/service/server/SWServer.cpp:
2751         (WebCore::SWServer::matchAll):
2752         (WebCore::SWServer::serverToContextConnectionCreated):
2753         (WebCore::SWServer::runServiceWorkerIfNecessary):
2754         (WebCore::SWServer::runServiceWorker):
2755         (WebCore::SWServer::terminateWorkerInternal):
2756         (WebCore::SWServer::markAllWorkersAsTerminated):
2757         (WebCore::SWServer::workerContextTerminated):
2758         (WebCore::SWServer::fireInstallEvent):
2759         (WebCore::SWServer::fireActivateEvent):
2760         * workers/service/server/SWServer.h:
2761         * workers/service/server/SWServerToContextConnection.cpp:
2762         (WebCore::SWServerToContextConnection::findClientByIdentifier):
2763         (WebCore::SWServerToContextConnection::matchAll):
2764         (WebCore::SWServerToContextConnection::claim):
2765         * workers/service/server/SWServerWorker.cpp:
2766         (WebCore::SWServerWorker::contextConnection):
2767         (WebCore::SWServerWorker::matchAll):
2768         * workers/service/server/SWServerWorker.h:
2769
2770 2018-03-14  Youenn Fablet  <youenn@apple.com>
2771
2772         MessagePort should remove its listeners when being closed
2773         https://bugs.webkit.org/show_bug.cgi?id=183644
2774
2775         Reviewed by Chris Dumez.
2776
2777         Test: http/tests/workers/worker-messageport.html
2778
2779         * dom/MessagePort.cpp:
2780         (WebCore::MessagePort::close):
2781         (WebCore::MessagePort::contextDestroyed):
2782
2783 2018-03-14  Chris Dumez  <cdumez@apple.com>
2784
2785         Drop unnecessary StorageToWebProcessConnection::workerContextProcessConnectionCreated()
2786         https://bugs.webkit.org/show_bug.cgi?id=183624
2787
2788         Reviewed by Youenn Fablet.
2789
2790         Pass in context connection to SWServer::serverToContextConnectionCreated() to avoid
2791         relying on the deprecated globalServerToContextConnection().
2792
2793         No new tests, no expected behavior change.
2794
2795         * workers/service/server/SWServer.cpp:
2796         (WebCore::SWServer::serverToContextConnectionCreated):
2797         * workers/service/server/SWServer.h:
2798
2799 2018-03-14  Mark Lam  <mark.lam@apple.com>
2800
2801         Enhance the MacroAssembler and LinkBuffer to support pointer profiling.
2802         https://bugs.webkit.org/show_bug.cgi?id=183623
2803         <rdar://problem/38443314>
2804
2805         Reviewed by Michael Saboff.
2806
2807         No new tests.  Just adding PtrTags required by new MacroAssembler API.
2808
2809         * cssjit/FunctionCall.h:
2810         (WebCore::FunctionCall::prepareAndCall):
2811         * cssjit/SelectorCompiler.cpp:
2812         (WebCore::SelectorCompiler::SelectorCodeGenerator::compile):
2813
2814 2018-03-14  Chris Fleizach  <cfleizach@apple.com>
2815
2816         AX: Implement accessible dismiss action on iOS
2817         https://bugs.webkit.org/show_bug.cgi?id=183352
2818         <rdar://problem/38161500>
2819
2820         Reviewed by Zalan Bujtas.
2821
2822         Test: accessibility/ios-simulator/AOM-dismiss-event.html
2823
2824         * accessibility/ios/WebAccessibilityObjectWrapperIOS.mm:
2825         (-[WebAccessibilityObjectWrapper accessibilityPerformEscape]):
2826
2827 2018-03-14  Youenn Fablet  <youenn@apple.com>
2828
2829         Update libwebrtc up to 36af4e9614f707f733eb2340fae66d6325aaac5b
2830         https://bugs.webkit.org/show_bug.cgi?id=183481
2831
2832         Reviewed by Eric Carlson.
2833
2834         Covered by existing tests.
2835         Updated libwebrtc binding code.
2836
2837         * Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.cpp:
2838         (WebCore::fillEncodingParameters):
2839         * platform/mediastream/libwebrtc/LibWebRTCAudioModule.h:
2840
2841 2018-03-14  Tim Horton  <timothy_horton@apple.com>
2842
2843         Fix the build after r229567
2844
2845         * Configurations/FeatureDefines.xcconfig:
2846
2847 2018-03-13  John Wilander  <wilander@apple.com>
2848
2849         Resource Load Statistics: Immediately forward cookie access for domains with previous user interaction when there's an opener document
2850         https://bugs.webkit.org/show_bug.cgi?id=183620
2851         <rdar://problem/38431469>
2852
2853         Reviewed by Brent Fulgham.
2854
2855         Tests: http/tests/storageAccess/deny-storage-access-under-opener.html
2856                http/tests/storageAccess/grant-storage-access-under-opener.html
2857
2858         It turns out the fix in https://bugs.webkit.org/show_bug.cgi?id=183577
2859         wasn't enough to address the compatibility issues with popups. Some of
2860         them just detect their unpartitioned cookies, auto-dismiss themselves,
2861         and expect their unpartitioned cookies to be available under the opener
2862         afterwards. We should grant them access if the popup's domain has had
2863         user interaction _previously_.
2864
2865         Note that we still need https://bugs.webkit.org/show_bug.cgi?id=183577
2866         because if the popup's domain has not received user interaction
2867         previously, we will not grant it storage access on just the window open.
2868
2869         * dom/Document.cpp:
2870         (WebCore::Document::hasRequestedPageSpecificStorageAccessWithUserInteraction):
2871         (WebCore::Document::setHasRequestedPageSpecificStorageAccessWithUserInteraction):
2872         (WebCore::Document::hasGrantedPageSpecificStorageAccess): Deleted.
2873         (WebCore::Document::setHasGrantedPageSpecificStorageAccess): Deleted.
2874             Renamed from *Granted* to *Requested* since there is now a case
2875             where access will not be granted, i.e. when the popup domain has
2876             not had user interaction previously.
2877         * dom/Document.h:
2878         * loader/ResourceLoadObserver.cpp:
2879         (WebCore::ResourceLoadObserver::setRequestStorageAccessUnderOpenerCallback):
2880             Renamed *Grant* to *Request*.
2881         (WebCore::ResourceLoadObserver::logUserInteractionWithReducedTimeResolution):
2882         (WebCore::ResourceLoadObserver::logWindowCreation):
2883             New function called from DOMWindow::createWindow().
2884         (WebCore::ResourceLoadObserver::requestStorageAccessUnderOpener):
2885             New convenience function.
2886         (WebCore::ResourceLoadObserver::setGrantStorageAccessUnderOpenerCallback): Deleted.
2887             Renamed *Grant* to *Request*.
2888         * loader/ResourceLoadObserver.h:
2889         * page/DOMWindow.cpp:
2890         (WebCore::DOMWindow::createWindow):
2891             Now calls ResourceLoadObserver::logWindowCreation() if a window
2892             was created and the opener has a document and a page ID.
2893
2894 2018-03-13  Chris Dumez  <cdumez@apple.com>
2895
2896         fast/loader/javascript-url-iframe-remove-on-navigate.html is a flaky crash on iOS with async delegates
2897         https://bugs.webkit.org/show_bug.cgi?id=183610
2898
2899         Reviewed by Youenn Fablet.
2900
2901         The issue was that in DocumentLoader::loadMainResource(), the call to requestMainResource() which
2902         return null due to the load getting cancelled synchronously. If this load is the parent frame's last
2903         pending load, then the 'load' event gets fired in the parent frame. In the test, the parent frame's
2904         load event handler does a document.write() call which blows away the iframe. As a result, when
2905         we return from the requestMainResource(), m_frame is null and we crash later on dereferencing it.
2906
2907         No new tests, covered by fast/loader/javascript-url-iframe-remove-on-navigate-async-delegate.html
2908         which was crashing flakily.
2909
2910         * loader/DocumentLoader.cpp:
2911         (WebCore::DocumentLoader::loadMainResource):
2912
2913 2018-03-13  Jer Noble  <jer.noble@apple.com>
2914
2915         [iOS] Muted media playback can interrupt out-of-process audio
2916         https://bugs.webkit.org/show_bug.cgi?id=183606
2917         <rdar://problem/37466253>
2918
2919         Reviewed by Eric Carlson.
2920
2921         Test: Updated TestWebKitAPI test to verify the correct AVAudioSession category is set.
2922
2923         A non-playing, non-muted media element will cause the AVAudioSession category to be set to
2924         "playing" when a muted media element begins playback. Ignore these non-playing elements for
2925         the purposes of determining the AVAudioSession category.
2926
2927         * platform/audio/cocoa/MediaSessionManagerCocoa.cpp:
2928         (PlatformMediaSessionManager::updateSessionState):
2929
2930 2018-03-13  Youenn Fablet  <youenn@apple.com>
2931
2932         Calling removeTrack with RTCRtpSender does not set SenderTrack to null
2933         https://bugs.webkit.org/show_bug.cgi?id=183308
2934
2935         Reviewed by Eric Carlson.
2936
2937         Covered by updated test.
2938
2939         * Modules/mediastream/RTCRtpSender.cpp:
2940         (WebCore::RTCRtpSender::stop): Set track to null when being stopped i.e. removed.
2941         * Modules/mediastream/RTCRtpSender.h:
2942
2943 2018-03-13  Youenn Fablet  <youenn@apple.com>
2944
2945         Changing link element rel attribute from preload to stylesheet should succeed loading the stylesheet
2946         https://bugs.webkit.org/show_bug.cgi?id=183601
2947         <rdar://problem/38309441>
2948
2949         Reviewed by Antti Koivisto.
2950
2951         Test: http/wpt/preload/change-link-rel-attribute.html
2952
2953         * loader/LinkPreloadResourceClients.h:
2954         (WebCore::LinkPreloadResourceClient::clearResource): Remove the call to CachedResource::cancelLoad.
2955         This call is expected to be called by ResourceLoader when cancelling the load from below CachedResource.
2956         * loader/cache/CachedResource.cpp:
2957         (WebCore::CachedResource::allClientsRemoved): In case of preload,
2958         cancel the load if not finished when there is no more client attached to it.
2959         * loader/cache/CachedResource.h:
2960
2961 2018-03-12  John Wilander  <wilander@apple.com>
2962
2963         Resource Load Statistics: Immediately forward cookie access at user interaction when there's an opener document
2964         https://bugs.webkit.org/show_bug.cgi?id=183577
2965         <rdar://problem/38266987>
2966
2967         Reviewed by Brent Fulgham.
2968
2969         Tested manually on live websites.
2970         No new automated tests because of a bug in WebKitTestRunner:
2971         https://bugs.webkit.org/show_bug.cgi?id=183578
2972         The event sender triggers gestures in the opener rather than
2973         in the popup.
2974
2975         * dom/Document.cpp:
2976         (WebCore::Document::removedLastRef):
2977             Clears the new m_primaryDomainsGrantedPageSpecificStorageAccess.
2978         (WebCore::Document::hasGrantedPageSpecificStorageAccess):
2979         (WebCore::Document::setHasGrantedPageSpecificStorageAccess):
2980         * dom/Document.h:
2981             Added member m_primaryDomainsGrantedPageSpecificStorageAccess
2982             where we store domains that have been granted access.
2983         * loader/ResourceLoadObserver.cpp:
2984         (WebCore::ResourceLoadObserver::setGrantStorageAccessUnderOpenerCallback):
2985         (WebCore::ResourceLoadObserver::logUserInteractionWithReducedTimeResolution):
2986             Now checks if there is a cross-origin opener and if so, immediately
2987             grants cookie access to the popup's domain if it is partitioned or
2988             blocked. 
2989         * loader/ResourceLoadObserver.h:
2990         * platform/network/NetworkStorageSession.h:
2991             Added member m_pagesGrantedStorageAccess.
2992         * platform/network/cf/NetworkStorageSessionCFNet.cpp:
2993         (WebCore::NetworkStorageSession::cookieStoragePartition const):
2994         (WebCore::NetworkStorageSession::hasStorageAccess const):
2995             Renamed from hasStorageAccessForFrame since the frameID now is optional.
2996         (WebCore::NetworkStorageSession::grantStorageAccess):
2997             Renamed from grantStorageAccessForFrame since the frameID now is optional.
2998         (WebCore::NetworkStorageSession::removeStorageAccessForAllFramesOnPage):
2999             Now removes the pageID entry in m_pagesGrantedStorageAccess.
3000         (WebCore::NetworkStorageSession::hasStorageAccessForFrame const): Deleted.
3001             Renamed since the frameID now is optional.
3002         (WebCore::NetworkStorageSession::grantStorageAccessForFrame): Deleted.
3003             Renamed since the frameID now is optional.
3004
3005 2018-03-12  Tim Horton  <timothy_horton@apple.com>
3006
3007         Stop using SDK conditionals to control feature definitions
3008         https://bugs.webkit.org/show_bug.cgi?id=183430
3009         <rdar://problem/38251619>
3010
3011         Reviewed by Dan Bernstein.
3012
3013         * Configurations/FeatureDefines.xcconfig:
3014         * Configurations/WebKitTargetConditionals.xcconfig: Renamed.
3015
3016 2018-03-12  Chris Dumez  <cdumez@apple.com>
3017
3018         Return boolean from DOMTokenList's replace() method
3019         https://bugs.webkit.org/show_bug.cgi?id=183567
3020
3021         Reviewed by Youenn Fablet.
3022
3023         Have DOMTokenList's replace() method return a boolean indicating if the
3024         token was replaced, as per:
3025         - https://dom.spec.whatwg.org/#dom-domtokenlist-replace
3026
3027         This is a recent addition to the DOM specification:
3028         - https://github.com/whatwg/dom/pull/582
3029
3030         No new tests, rebaselined existing test.
3031
3032         * html/DOMTokenList.cpp:
3033         (WebCore::replaceInOrderedSet):
3034         (WebCore::DOMTokenList::replace):
3035         * html/DOMTokenList.h:
3036         * html/DOMTokenList.idl:
3037
3038 2018-03-12  Brian Burg  <bburg@apple.com>
3039
3040         Ignore some deprecation warnings encountered when compiling with newer versions of ICU
3041         https://bugs.webkit.org/show_bug.cgi?id=183584
3042         <rdar://problem/38395317>
3043
3044         Reviewed by Daniel Bates.
3045
3046         Ignore new deprecation warnings. Where a function has more than one
3047         deprecation warning, mark out the entire function so it remains readable.
3048
3049         * editing/TextIterator.cpp:
3050         * platform/graphics/SurrogatePairAwareTextIterator.cpp:
3051         (WebCore::SurrogatePairAwareTextIterator::normalizeVoicingMarks):
3052         * platform/text/TextEncoding.cpp:
3053
3054 2018-03-12  Yoav Weiss  <yoav@yoav.ws>
3055
3056         Runtime flag for link prefetch and remove link subresource.
3057         https://bugs.webkit.org/show_bug.cgi?id=183540
3058
3059         Reviewed by Chris Dumez.
3060
3061         This patch removes the LINK_PREFETCH build time flag, removes
3062         link subresource, adds an off-by-default runtime flag for link
3063         prefetch and makes sure link prefetch only works when this flag is on.
3064
3065         Subresource is removed as it's not a part of any spec, nor supported by any
3066         other browser. It was replaced by link preload.
3067
3068         No new tests as this is not adding any new functionality.
3069
3070         * Configurations/FeatureDefines.xcconfig: Remove the LINK_PREFETCH flag.
3071         * html/LinkRelAttribute.cpp:
3072         (WebCore::LinkRelAttribute::LinkRelAttribute): Put prefetch support behind the runtime flag.
3073         (WebCore::LinkRelAttribute::isSupported): Add prefetch.
3074         * html/LinkRelAttribute.h: Remove the LINK_PREFETCH flag.
3075         * loader/LinkLoader.cpp:
3076         (WebCore::createLinkPreloadResourceClient): Remove the LINK_PREFETCH flag.
3077         (WebCore::LinkLoader::prefetchIfNeeded): Move the prefetch code to `prefetchIfNeeded()`. Remove subresource bits.
3078         (WebCore::LinkLoader::loadLink): Call `prefetchIfNeeded()`.
3079         * loader/LinkLoader.h:
3080         * loader/ResourceLoadInfo.cpp:
3081         (WebCore::toResourceType): Remove the LINK_PREFETCH flag as well as subresource.
3082         * loader/SubresourceLoader.cpp:
3083         (WebCore::logResourceLoaded): Remove the LINK_PREFETCH flag as well as subresource.
3084         * loader/cache/CachedResource.cpp:
3085         (WebCore::CachedResource::defaultPriorityForResourceType): Remove the LINK_PREFETCH flag as well as subresource.
3086         (WebCore::CachedResource::load): Remove the LINK_PREFETCH flag.
3087         * loader/cache/CachedResource.h:
3088         (WebCore::CachedResource::ignoreForRequestCount const): Remove the LINK_PREFETCH flag as well as subresource.
3089         * loader/cache/CachedResourceLoader.cpp:
3090         (WebCore::createResource): Remove the LINK_PREFETCH flag as well as subresource.
3091         (WebCore::CachedResourceLoader::requestLinkResource): Remove subresource.
3092         (WebCore::contentTypeFromResourceType): Remove the LINK_PREFETCH flag as well as subresource.
3093         (WebCore::CachedResourceLoader::checkInsecureContent const): Remove the LINK_PREFETCH flag as well as subresource.
3094         (WebCore::CachedResourceLoader::shouldUpdateCachedResourceWithCurrentRequest): Remove the LINK_PREFETCH flag as well as subresource.
3095         * loader/cache/CachedResourceLoader.h:
3096         * page/RuntimeEnabledFeatures.h:
3097         (WebCore::RuntimeEnabledFeatures::setLinkPrefetchEnabled): Set the prefetch flag.
3098         (WebCore::RuntimeEnabledFeatures::linkPrefetchEnabled const): Get the prefetch flag.
3099
3100 2018-03-12  Youenn Fablet  <youenn@apple.com>
3101
3102         RTCPeerConnection's close method should update signalingState
3103         https://bugs.webkit.org/show_bug.cgi?id=174314
3104         <rdar://problem/33267977>
3105
3106         Reviewed by Eric Carlson.
3107
3108         Covered by rebased test.
3109         Add closed as signalingState enum value.
3110         Set peer connection signaling state to closed once close is called.
3111
3112         * Modules/mediastream/RTCPeerConnection.cpp:
3113         (WebCore::RTCPeerConnection::doClose):
3114         * Modules/mediastream/RTCSignalingState.idl:
3115         * platform/mediastream/RTCSignalingState.h:
3116
3117 2018-03-12  Mark Lam  <mark.lam@apple.com>
3118
3119         Make a NativeFunction into a class to support pointer profiling.
3120         https://bugs.webkit.org/show_bug.cgi?id=183573
3121         <rdar://problem/38384697>
3122
3123         Reviewed by Filip Pizlo.
3124
3125         No new tests because there's no new behavior.  Only updating bindings.
3126
3127         * bindings/scripts/CodeGeneratorJS.pm:
3128         (GenerateHashTableValueArray):
3129         * bindings/scripts/test/JS/JSMapLike.cpp:
3130         * bindings/scripts/test/JS/JSReadOnlyMapLike.cpp:
3131         * bindings/scripts/test/JS/JSTestActiveDOMObject.cpp:
3132         * bindings/scripts/test/JS/JSTestCEReactions.cpp:
3133         * bindings/scripts/test/JS/JSTestCEReactionsStringifier.cpp:
3134         * bindings/scripts/test/JS/JSTestCallTracer.cpp:
3135         * bindings/scripts/test/JS/JSTestDOMJIT.cpp:
3136         * bindings/scripts/test/JS/JSTestEnabledBySetting.cpp:
3137         * bindings/scripts/test/JS/JSTestEventTarget.cpp:
3138         * bindings/scripts/test/JS/JSTestGlobalObject.cpp:
3139         * bindings/scripts/test/JS/JSTestIndexedSetterWithIdentifier.cpp:
3140         * bindings/scripts/test/JS/JSTestInterface.cpp:
3141         * bindings/scripts/test/JS/JSTestIterable.cpp:
3142         * bindings/scripts/test/JS/JSTestJSBuiltinConstructor.cpp:
3143         * bindings/scripts/test/JS/JSTestMediaQueryListListener.cpp:
3144         * bindings/scripts/test/JS/JSTestNamedAndIndexedSetterWithIdentifier.cpp:
3145         * bindings/scripts/test/JS/JSTestNamedDeleterWithIdentifier.cpp:
3146         * bindings/scripts/test/JS/JSTestNamedGetterWithIdentifier.cpp:
3147         * bindings/scripts/test/JS/JSTestNamedSetterWithIdentifier.cpp:
3148         * bindings/scripts/test/JS/JSTestNamedSetterWithIndexedGetter.cpp:
3149         * bindings/scripts/test/JS/JSTestNamedSetterWithIndexedGetterAndSetter.cpp:
3150         * bindings/scripts/test/JS/JSTestNamedSetterWithUnforgableProperties.cpp:
3151         * bindings/scripts/test/JS/JSTestNamedSetterWithUnforgablePropertiesAndOverrideBuiltins.cpp:
3152         * bindings/scripts/test/JS/JSTestNode.cpp:
3153         * bindings/scripts/test/JS/JSTestObj.cpp:
3154         * bindings/scripts/test/JS/JSTestOverrideBuiltins.cpp:
3155         * bindings/scripts/test/JS/JSTestSerialization.cpp:
3156         * bindings/scripts/test/JS/JSTestSerializationInherit.cpp:
3157         * bindings/scripts/test/JS/JSTestSerializationInheritFinal.cpp:
3158         * bindings/scripts/test/JS/JSTestSerializedScriptValueInterface.cpp:
3159         * bindings/scripts/test/JS/JSTestStringifier.cpp:
3160         * bindings/scripts/test/JS/JSTestStringifierAnonymousOperation.cpp:
3161         * bindings/scripts/test/JS/JSTestStringifierNamedOperation.cpp:
3162         * bindings/scripts/test/JS/JSTestStringifierOperationImplementedAs.cpp:
3163         * bindings/scripts/test/JS/JSTestStringifierOperationNamedToString.cpp:
3164         * bindings/scripts/test/JS/JSTestStringifierReadOnlyAttribute.cpp:
3165         * bindings/scripts/test/JS/JSTestStringifierReadWriteAttribute.cpp:
3166         * bindings/scripts/test/JS/JSTestTypedefs.cpp:
3167
3168 2018-03-12  Tim Horton  <timothy_horton@apple.com>
3169
3170         Use a different SPI header for some AudioToolbox enums
3171         https://bugs.webkit.org/show_bug.cgi?id=183574
3172         <rdar://problem/38385889>
3173
3174         Reviewed by Anders Carlsson.
3175
3176         * platform/audio/ios/AudioDestinationIOS.cpp:
3177         * platform/mediastream/mac/AudioTrackPrivateMediaStreamCocoa.cpp:
3178         Adjust SPI imports.
3179
3180 2018-03-12  Danyao Wang  <danyao@chromium.org>
3181
3182         Add a query and fragment exception to history API's unique origin restriction.
3183         https://bugs.webkit.org/show_bug.cgi?id=183028
3184
3185         Reviewed by Brent Fulgham.
3186
3187         Tests: http/tests/navigation/pushstate-at-unique-origin-denied.php
3188                Tools/TestWebKitAPI/Tests/WebCore/URL.cpp
3189
3190         * page/History.cpp:
3191         (WebCore::History::stateObjectAdded):
3192
3193 2018-03-12  Antti Koivisto  <antti@apple.com>
3194
3195         Don't invalidate descendants for nth pseudo classes unless needed
3196         https://bugs.webkit.org/show_bug.cgi?id=183566
3197
3198         Reviewed by Zalan Bujtas.
3199
3200         We currently invalidate the whole subtrees that may match :nth-child and similar. In many common
3201         cases we know that only the direct siblings may be affected.
3202
3203         * css/SelectorChecker.cpp:
3204         (WebCore::localContextForParent):
3205         (WebCore::SelectorChecker::matchRecursively const):
3206
3207             Track if the context matches the subject element if the selector or its siblings only.
3208
3209         (WebCore::SelectorChecker::checkOne const):
3210
3211             Use different bits of descendant and child invalidation cases.
3212
3213         * cssjit/SelectorCompiler.cpp:
3214         (WebCore::SelectorCompiler::fragmentMatchesRightmostOrAdjacentElement):
3215         (WebCore::SelectorCompiler::constructFragmentsInternal):
3216
3217             Track if the context matches the subject element if the selector or its siblings only.
3218
3219         (WebCore::SelectorCompiler::SelectorCodeGenerator::generateElementIsNthChild):
3220         (WebCore::SelectorCompiler::SelectorCodeGenerator::generateElementIsNthChildOf):
3221         (WebCore::SelectorCompiler::SelectorCodeGenerator::generateElementIsNthLastChild):
3222
3223             Use different bits of descendant and child invalidation cases.
3224
3225         * dom/Element.cpp:
3226         (WebCore::invalidateForForwardPositionalRules):
3227         (WebCore::invalidateForBackwardPositionalRules):
3228
3229             Invalidate more precisely based on the new bits.
3230
3231         (WebCore::checkForSiblingStyleChanges):
3232         (WebCore::Element::setDescendantsAffectedByForwardPositionalRules):
3233         (WebCore::Element::setDescendantsAffectedByBackwardPositionalRules):
3234         (WebCore::Element::hasFlagsSetDuringStylingOfChildren const):
3235         (WebCore::Element::rareDataDescendantsAffectedByForwardPositionalRules const):
3236         (WebCore::Element::rareDataDescendantsAffectedByBackwardPositionalRules const):
3237
3238             New bits.
3239
3240         * dom/Element.h:
3241         (WebCore::Element::descendantsAffectedByForwardPositionalRules const):
3242         (WebCore::Element::descendantsAffectedByBackwardPositionalRules const):
3243         * dom/ElementRareData.h:
3244         (WebCore::ElementRareData::descendantsAffectedByForwardPositionalRules const):
3245         (WebCore::ElementRareData::setDescendantsAffectedByForwardPositionalRules):
3246         (WebCore::ElementRareData::descendantsAffectedByBackwardPositionalRules const):
3247         (WebCore::ElementRareData::setDescendantsAffectedByBackwardPositionalRules):
3248         (WebCore::ElementRareData::ElementRareData):
3249         (WebCore::ElementRareData::resetStyleRelations):
3250         * style/StyleRelations.cpp:
3251         (WebCore::Style::commitRelationsToRenderStyle):
3252         (WebCore::Style::commitRelations):
3253         * style/StyleRelations.h:
3254
3255 2018-03-12  Javier Fernandez  <jfernandez@igalia.com>
3256
3257         Remove GridLayout runtime flag
3258         https://bugs.webkit.org/show_bug.cgi?id=183484
3259
3260         Reviewed by Myles C. Maxfield.
3261
3262         The Grid Layout feature has been enabled by default for almost a
3263         year, so I think it's time to remove the runtime flag and the
3264         codepath run when the feature is disabled.
3265
3266         No new tests, because there are no changes in functionality.
3267
3268         * css/CSSComputedStyleDeclaration.cpp:
3269         (WebCore::valueForContentPositionAndDistributionWithOverflowAlignment):
3270         (WebCore::ComputedStyleExtractor::valueForPropertyinStyle):
3271         * css/StyleBuilderConverter.h:
3272         (WebCore::StyleBuilderConverter::convertContentAlignmentData):
3273         * css/parser/CSSParser.cpp:
3274         (WebCore::CSSParserContext::CSSParserContext):
3275         (WebCore::operator==):
3276         * css/parser/CSSParserFastPaths.cpp:
3277         (WebCore::CSSParserFastPaths::isValidKeywordPropertyAndValue):
3278         (WebCore::CSSParserFastPaths::isKeywordPropertyID):
3279         * css/parser/CSSParserMode.h:
3280         (WebCore::CSSParserContextHash::hash):
3281         * css/parser/CSSPropertyParser.cpp:
3282         (WebCore::CSSPropertyParser::parseSingleValue):
3283         * dom/Document.cpp:
3284         * dom/Document.h:
3285         * page/RuntimeEnabledFeatures.h:
3286         * rendering/RenderFlexibleBox.cpp:
3287         (WebCore::alignmentOffset):
3288         * rendering/style/RenderStyle.cpp:
3289         * rendering/style/RenderStyle.h:
3290         (WebCore::RenderStyle::initialDefaultAlignment):
3291         * testing/InternalSettings.cpp:
3292         (WebCore::InternalSettings::Backup::Backup):
3293         (WebCore::InternalSettings::Backup::restoreTo):
3294         * testing/InternalSettings.h:
3295         * testing/InternalSettings.idl:
3296
3297 2018-03-12  Antoine Quint  <graouts@apple.com>
3298
3299         [Web Animations] Implement CSS Animations and CSS Transitions as Web Animations
3300         https://bugs.webkit.org/show_bug.cgi?id=183504
3301         <rdar://problem/38372965>
3302
3303         Reviewed by Dean Jackson and Jon Lee.
3304
3305         Tests: webanimations/css-animations.html
3306                webanimations/css-transitions.html
3307
3308         This patch implements CSS Animations and CSS Transitions as Web Animations. The main changes are:
3309
3310         * StyleTreeResolver: StyleTreeResolver now has a code path to add CSSAnimation and CSSTransition objects onto the DocumentTimeline
3311         to be picked up by the Web Animations engine. The previous CSSAnimationController code path is preserved if the runtime flag is disabled.
3312
3313         * AnimationTimeline: we add two new methods, updateCSSAnimationsForElement() and updateCSSTransitionsForElement() which are called from
3314         TreeResolver::createAnimatedElementUpdate(). These look at the AnimationList for the old and new RenderStyle objects and create, update
3315         and remove matching CSSAnimation and CSSTransition instances.
3316
3317         * DeclarativeAnimation: a new superclass to both CSSAnimation and CSSTransition which introduces the concept of a backingAnimation(),
3318         which is an Animation held by the RenderStyle objects, and two virtual methods with base implementations, initialize() which is called
3319         upon creating by create() methods in subclasses, and syncPropertiesWithBackingAnimation() which ensures that properties on the
3320         DeclarativeAnimation objects (Web Animations side) match the backing animation (CSS side).
3321
3322         * KeyframeEffectReadOnly: two new important methods to create blending keyframes (KeyframeList) based on backing Animation objects,
3323         computeCSSAnimationBlendingKeyframes() and computeCSSTransitionBlendingKeyframes().
3324
3325         * Sources.txt:
3326         * WebCore.xcodeproj/project.pbxproj:
3327         * animation/AnimationEffectReadOnly.h:
3328         (WebCore::AnimationEffectReadOnly::isKeyframeEffectReadOnly const): We fix this method such that calling it on a KeyframeEffect, which
3329         is a subclass of KeyframeEffectReadOnly, returns true.
3330         * animation/AnimationEffectTimingReadOnly.cpp: In order for DeclarativeAnimation::syncPropertiesWithBackingAnimation() to set the timing
3331         function for a declarative animation's effect, we need a public method to set an effect's timing function outside of just the "easing"
3332         property setter exposed via the JS API. So we introduce a setTimingFunction() method and call it from setEasing().
3333         (WebCore::AnimationEffectTimingReadOnly::setEasing):
3334         (WebCore::AnimationEffectTimingReadOnly::setTimingFunction):
3335         * animation/AnimationEffectTimingReadOnly.h:
3336         * animation/AnimationTimeline.cpp:
3337         (WebCore::AnimationTimeline::~AnimationTimeline): Clear all maps and sets containing WebAnimation references to ensure these get destructed
3338         when the AnimationTimeline is being destructed and should no longer hold a reference to them.
3339         (WebCore::AnimationTimeline::relevantMapForAnimation): We store various subclasses of WebAnimation in dedicated maps so we can composite
3340         animations in the correct order when animating. This function returns the correct map for a given animation such that animationWasAddedToElement()
3341         and animationWasRemovedFromElement() mutate the right map.
3342         (WebCore::AnimationTimeline::animationWasAddedToElement):
3343         (WebCore::AnimationTimeline::animationWasRemovedFromElement):
3344         (WebCore::AnimationTimeline::animationsForElement): Make sure to look for animations in the lists of CSS Animations and CSS Transitions as well
3345         as Web Animations.
3346         (WebCore::AnimationTimeline::updateCSSAnimationsForElement): This method is called by TreeResolver::createAnimatedElementUpdate() during style
3347         resolution. It compares the AnimationList of the previous style and the new style for a given element, checks that animations with a given name
3348         that were not present in the old AnimationList have a new matching CSSAnimation object for them added to the AnimationTimeline, that animations
3349         with a given name that are no longer present in the new AnimationList have their matching CSSAnimation object removed from the AnimationTimeline,
3350         and that animations with a given name that are present in both the old and new AnimationList have their matching CSSAnimation updated to match
3351         the current state of the animation in the AnimationList.
3352         (WebCore::AnimationTimeline::updateCSSTransitionsForElement): Similarly to updateCSSAnimationsForElement(), this method is called during style
3353         resolution by TreeResolver::createAnimatedElementUpdate(). Its role is to create or remove CSSTransition objects based on the AnimationList found
3354         in the old and new styles for a given element. It follows a slightly different logic than updateCSSAnimationsForElement() since for CSS Transitions,
3355         there is no need to update CSSTransition objects for a CSS property existing in both the old and new AnimationList, since when a CSS transitions
3356         property is changed, a whole new transition is initiated. However, it's important to check that different Animation objects and styles would actually
3357         result in different timing properties and blending keyframes, so check for this as well before creating new CSSTransition objects.
3358         * animation/AnimationTimeline.h:
3359         (WebCore::AnimationTimeline::animations const): Change the m_animations type from HashSet to ListHashSet to guarantee we preserve the insertion order which is
3360         required by getAnimations().
3361         (WebCore::AnimationTimeline::hasElementAnimations const): Indicates to DocumentTimeline::updateAnimations() that there are animations targeting the provided element.
3362         (WebCore::AnimationTimeline::elementToAnimationsMap):
3363         (WebCore::AnimationTimeline::elementToCSSAnimationsMap):
3364         (WebCore::AnimationTimeline::elementToCSSTransitionsMap):
3365         * animation/CSSAnimation.cpp: CSSAnimation is now a subclass of DeclarativeAnimation and subclasses initialize() and syncPropertiesWithBackingAnimation()
3366         to perform work specific to CSS Animations.
3367         (WebCore::CSSAnimation::create): Set the animationName property based on the provided backing animation.
3368         (WebCore::CSSAnimation::CSSAnimation):
3369         (WebCore::CSSAnimation::initialize): Create the blending keyframes for this CSSAnimation.
3370         (WebCore::CSSAnimation::syncPropertiesWithBackingAnimation): Reflect the animation-fill-mode, animation-direction, animation-iteration-count and
3371         animation-play-state CSS properties on the AnimationEffectTimingReadOnly object associated with this CSSAnimation.
3372         * animation/CSSAnimation.h:
3373         * animation/CSSTransition.cpp: CSSTransition is now a subclass of DeclarativeAnimation.
3374         (WebCore::CSSTransition::create): Set the transitionProperty property based on the provided backing animation.
3375         (WebCore::CSSTransition::CSSTransition):
3376         (WebCore::CSSTransition::matchesBackingAnimationAndStyles const):
3377         (WebCore::CSSTransition::canBeListed const): Subclass this method such that we also check that we have blending keyframes for a CSSTransition to be
3378         listed by calls to getAnimations().
3379         * animation/CSSTransition.h:
3380         * animation/DeclarativeAnimation.cpp: Added. This new WebAnimation subclass now is the common base class for both CSSAnimation and CSSTransition.
3381         It establishes a relationship with a&