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