[iOS] Muted media playback can interrupt out-of-process audio
[WebKit-https.git] / Source / WebCore / ChangeLog
1 2018-03-13  Jer Noble  <jer.noble@apple.com>
2
3         [iOS] Muted media playback can interrupt out-of-process audio
4         https://bugs.webkit.org/show_bug.cgi?id=183606
5         <rdar://problem/37466253>
6
7         Reviewed by Eric Carlson.
8
9         Test: Updated TestWebKitAPI test to verify the correct AVAudioSession category is set.
10
11         A non-playing, non-muted media element will cause the AVAudioSession category to be set to
12         "playing" when a muted media element begins playback. Ignore these non-playing elements for
13         the purposes of determining the AVAudioSession category.
14
15         * platform/audio/cocoa/MediaSessionManagerCocoa.cpp:
16         (PlatformMediaSessionManager::updateSessionState):
17
18 2018-03-13  Youenn Fablet  <youenn@apple.com>
19
20         Calling removeTrack with RTCRtpSender does not set SenderTrack to null
21         https://bugs.webkit.org/show_bug.cgi?id=183308
22
23         Reviewed by Eric Carlson.
24
25         Covered by updated test.
26
27         * Modules/mediastream/RTCRtpSender.cpp:
28         (WebCore::RTCRtpSender::stop): Set track to null when being stopped i.e. removed.
29         * Modules/mediastream/RTCRtpSender.h:
30
31 2018-03-13  Youenn Fablet  <youenn@apple.com>
32
33         Changing link element rel attribute from preload to stylesheet should succeed loading the stylesheet
34         https://bugs.webkit.org/show_bug.cgi?id=183601
35         <rdar://problem/38309441>
36
37         Reviewed by Antti Koivisto.
38
39         Test: http/wpt/preload/change-link-rel-attribute.html
40
41         * loader/LinkPreloadResourceClients.h:
42         (WebCore::LinkPreloadResourceClient::clearResource): Remove the call to CachedResource::cancelLoad.
43         This call is expected to be called by ResourceLoader when cancelling the load from below CachedResource.
44         * loader/cache/CachedResource.cpp:
45         (WebCore::CachedResource::allClientsRemoved): In case of preload,
46         cancel the load if not finished when there is no more client attached to it.
47         * loader/cache/CachedResource.h:
48
49 2018-03-12  John Wilander  <wilander@apple.com>
50
51         Resource Load Statistics: Immediately forward cookie access at user interaction when there's an opener document
52         https://bugs.webkit.org/show_bug.cgi?id=183577
53         <rdar://problem/38266987>
54
55         Reviewed by Brent Fulgham.
56
57         Tested manually on live websites.
58         No new automated tests because of a bug in WebKitTestRunner:
59         https://bugs.webkit.org/show_bug.cgi?id=183578
60         The event sender triggers gestures in the opener rather than
61         in the popup.
62
63         * dom/Document.cpp:
64         (WebCore::Document::removedLastRef):
65             Clears the new m_primaryDomainsGrantedPageSpecificStorageAccess.
66         (WebCore::Document::hasGrantedPageSpecificStorageAccess):
67         (WebCore::Document::setHasGrantedPageSpecificStorageAccess):
68         * dom/Document.h:
69             Added member m_primaryDomainsGrantedPageSpecificStorageAccess
70             where we store domains that have been granted access.
71         * loader/ResourceLoadObserver.cpp:
72         (WebCore::ResourceLoadObserver::setGrantStorageAccessUnderOpenerCallback):
73         (WebCore::ResourceLoadObserver::logUserInteractionWithReducedTimeResolution):
74             Now checks if there is a cross-origin opener and if so, immediately
75             grants cookie access to the popup's domain if it is partitioned or
76             blocked. 
77         * loader/ResourceLoadObserver.h:
78         * platform/network/NetworkStorageSession.h:
79             Added member m_pagesGrantedStorageAccess.
80         * platform/network/cf/NetworkStorageSessionCFNet.cpp:
81         (WebCore::NetworkStorageSession::cookieStoragePartition const):
82         (WebCore::NetworkStorageSession::hasStorageAccess const):
83             Renamed from hasStorageAccessForFrame since the frameID now is optional.
84         (WebCore::NetworkStorageSession::grantStorageAccess):
85             Renamed from grantStorageAccessForFrame since the frameID now is optional.
86         (WebCore::NetworkStorageSession::removeStorageAccessForAllFramesOnPage):
87             Now removes the pageID entry in m_pagesGrantedStorageAccess.
88         (WebCore::NetworkStorageSession::hasStorageAccessForFrame const): Deleted.
89             Renamed since the frameID now is optional.
90         (WebCore::NetworkStorageSession::grantStorageAccessForFrame): Deleted.
91             Renamed since the frameID now is optional.
92
93 2018-03-12  Tim Horton  <timothy_horton@apple.com>
94
95         Stop using SDK conditionals to control feature definitions
96         https://bugs.webkit.org/show_bug.cgi?id=183430
97         <rdar://problem/38251619>
98
99         Reviewed by Dan Bernstein.
100
101         * Configurations/FeatureDefines.xcconfig:
102         * Configurations/WebKitTargetConditionals.xcconfig: Renamed.
103
104 2018-03-12  Chris Dumez  <cdumez@apple.com>
105
106         Return boolean from DOMTokenList's replace() method
107         https://bugs.webkit.org/show_bug.cgi?id=183567
108
109         Reviewed by Youenn Fablet.
110
111         Have DOMTokenList's replace() method return a boolean indicating if the
112         token was replaced, as per:
113         - https://dom.spec.whatwg.org/#dom-domtokenlist-replace
114
115         This is a recent addition to the DOM specification:
116         - https://github.com/whatwg/dom/pull/582
117
118         No new tests, rebaselined existing test.
119
120         * html/DOMTokenList.cpp:
121         (WebCore::replaceInOrderedSet):
122         (WebCore::DOMTokenList::replace):
123         * html/DOMTokenList.h:
124         * html/DOMTokenList.idl:
125
126 2018-03-12  Brian Burg  <bburg@apple.com>
127
128         Ignore some deprecation warnings encountered when compiling with newer versions of ICU
129         https://bugs.webkit.org/show_bug.cgi?id=183584
130         <rdar://problem/38395317>
131
132         Reviewed by Daniel Bates.
133
134         Ignore new deprecation warnings. Where a function has more than one
135         deprecation warning, mark out the entire function so it remains readable.
136
137         * editing/TextIterator.cpp:
138         * platform/graphics/SurrogatePairAwareTextIterator.cpp:
139         (WebCore::SurrogatePairAwareTextIterator::normalizeVoicingMarks):
140         * platform/text/TextEncoding.cpp:
141
142 2018-03-12  Yoav Weiss  <yoav@yoav.ws>
143
144         Runtime flag for link prefetch and remove link subresource.
145         https://bugs.webkit.org/show_bug.cgi?id=183540
146
147         Reviewed by Chris Dumez.
148
149         This patch removes the LINK_PREFETCH build time flag, removes
150         link subresource, adds an off-by-default runtime flag for link
151         prefetch and makes sure link prefetch only works when this flag is on.
152
153         Subresource is removed as it's not a part of any spec, nor supported by any
154         other browser. It was replaced by link preload.
155
156         No new tests as this is not adding any new functionality.
157
158         * Configurations/FeatureDefines.xcconfig: Remove the LINK_PREFETCH flag.
159         * html/LinkRelAttribute.cpp:
160         (WebCore::LinkRelAttribute::LinkRelAttribute): Put prefetch support behind the runtime flag.
161         (WebCore::LinkRelAttribute::isSupported): Add prefetch.
162         * html/LinkRelAttribute.h: Remove the LINK_PREFETCH flag.
163         * loader/LinkLoader.cpp:
164         (WebCore::createLinkPreloadResourceClient): Remove the LINK_PREFETCH flag.
165         (WebCore::LinkLoader::prefetchIfNeeded): Move the prefetch code to `prefetchIfNeeded()`. Remove subresource bits.
166         (WebCore::LinkLoader::loadLink): Call `prefetchIfNeeded()`.
167         * loader/LinkLoader.h:
168         * loader/ResourceLoadInfo.cpp:
169         (WebCore::toResourceType): Remove the LINK_PREFETCH flag as well as subresource.
170         * loader/SubresourceLoader.cpp:
171         (WebCore::logResourceLoaded): Remove the LINK_PREFETCH flag as well as subresource.
172         * loader/cache/CachedResource.cpp:
173         (WebCore::CachedResource::defaultPriorityForResourceType): Remove the LINK_PREFETCH flag as well as subresource.
174         (WebCore::CachedResource::load): Remove the LINK_PREFETCH flag.
175         * loader/cache/CachedResource.h:
176         (WebCore::CachedResource::ignoreForRequestCount const): Remove the LINK_PREFETCH flag as well as subresource.
177         * loader/cache/CachedResourceLoader.cpp:
178         (WebCore::createResource): Remove the LINK_PREFETCH flag as well as subresource.
179         (WebCore::CachedResourceLoader::requestLinkResource): Remove subresource.
180         (WebCore::contentTypeFromResourceType): Remove the LINK_PREFETCH flag as well as subresource.
181         (WebCore::CachedResourceLoader::checkInsecureContent const): Remove the LINK_PREFETCH flag as well as subresource.
182         (WebCore::CachedResourceLoader::shouldUpdateCachedResourceWithCurrentRequest): Remove the LINK_PREFETCH flag as well as subresource.
183         * loader/cache/CachedResourceLoader.h:
184         * page/RuntimeEnabledFeatures.h:
185         (WebCore::RuntimeEnabledFeatures::setLinkPrefetchEnabled): Set the prefetch flag.
186         (WebCore::RuntimeEnabledFeatures::linkPrefetchEnabled const): Get the prefetch flag.
187
188 2018-03-12  Youenn Fablet  <youenn@apple.com>
189
190         RTCPeerConnection's close method should update signalingState
191         https://bugs.webkit.org/show_bug.cgi?id=174314
192         <rdar://problem/33267977>
193
194         Reviewed by Eric Carlson.
195
196         Covered by rebased test.
197         Add closed as signalingState enum value.
198         Set peer connection signaling state to closed once close is called.
199
200         * Modules/mediastream/RTCPeerConnection.cpp:
201         (WebCore::RTCPeerConnection::doClose):
202         * Modules/mediastream/RTCSignalingState.idl:
203         * platform/mediastream/RTCSignalingState.h:
204
205 2018-03-12  Mark Lam  <mark.lam@apple.com>
206
207         Make a NativeFunction into a class to support pointer profiling.
208         https://bugs.webkit.org/show_bug.cgi?id=183573
209         <rdar://problem/38384697>
210
211         Reviewed by Filip Pizlo.
212
213         No new tests because there's no new behavior.  Only updating bindings.
214
215         * bindings/scripts/CodeGeneratorJS.pm:
216         (GenerateHashTableValueArray):
217         * bindings/scripts/test/JS/JSMapLike.cpp:
218         * bindings/scripts/test/JS/JSReadOnlyMapLike.cpp:
219         * bindings/scripts/test/JS/JSTestActiveDOMObject.cpp:
220         * bindings/scripts/test/JS/JSTestCEReactions.cpp:
221         * bindings/scripts/test/JS/JSTestCEReactionsStringifier.cpp:
222         * bindings/scripts/test/JS/JSTestCallTracer.cpp:
223         * bindings/scripts/test/JS/JSTestDOMJIT.cpp:
224         * bindings/scripts/test/JS/JSTestEnabledBySetting.cpp:
225         * bindings/scripts/test/JS/JSTestEventTarget.cpp:
226         * bindings/scripts/test/JS/JSTestGlobalObject.cpp:
227         * bindings/scripts/test/JS/JSTestIndexedSetterWithIdentifier.cpp:
228         * bindings/scripts/test/JS/JSTestInterface.cpp:
229         * bindings/scripts/test/JS/JSTestIterable.cpp:
230         * bindings/scripts/test/JS/JSTestJSBuiltinConstructor.cpp:
231         * bindings/scripts/test/JS/JSTestMediaQueryListListener.cpp:
232         * bindings/scripts/test/JS/JSTestNamedAndIndexedSetterWithIdentifier.cpp:
233         * bindings/scripts/test/JS/JSTestNamedDeleterWithIdentifier.cpp:
234         * bindings/scripts/test/JS/JSTestNamedGetterWithIdentifier.cpp:
235         * bindings/scripts/test/JS/JSTestNamedSetterWithIdentifier.cpp:
236         * bindings/scripts/test/JS/JSTestNamedSetterWithIndexedGetter.cpp:
237         * bindings/scripts/test/JS/JSTestNamedSetterWithIndexedGetterAndSetter.cpp:
238         * bindings/scripts/test/JS/JSTestNamedSetterWithUnforgableProperties.cpp:
239         * bindings/scripts/test/JS/JSTestNamedSetterWithUnforgablePropertiesAndOverrideBuiltins.cpp:
240         * bindings/scripts/test/JS/JSTestNode.cpp:
241         * bindings/scripts/test/JS/JSTestObj.cpp:
242         * bindings/scripts/test/JS/JSTestOverrideBuiltins.cpp:
243         * bindings/scripts/test/JS/JSTestSerialization.cpp:
244         * bindings/scripts/test/JS/JSTestSerializationInherit.cpp:
245         * bindings/scripts/test/JS/JSTestSerializationInheritFinal.cpp:
246         * bindings/scripts/test/JS/JSTestSerializedScriptValueInterface.cpp:
247         * bindings/scripts/test/JS/JSTestStringifier.cpp:
248         * bindings/scripts/test/JS/JSTestStringifierAnonymousOperation.cpp:
249         * bindings/scripts/test/JS/JSTestStringifierNamedOperation.cpp:
250         * bindings/scripts/test/JS/JSTestStringifierOperationImplementedAs.cpp:
251         * bindings/scripts/test/JS/JSTestStringifierOperationNamedToString.cpp:
252         * bindings/scripts/test/JS/JSTestStringifierReadOnlyAttribute.cpp:
253         * bindings/scripts/test/JS/JSTestStringifierReadWriteAttribute.cpp:
254         * bindings/scripts/test/JS/JSTestTypedefs.cpp:
255
256 2018-03-12  Tim Horton  <timothy_horton@apple.com>
257
258         Use a different SPI header for some AudioToolbox enums
259         https://bugs.webkit.org/show_bug.cgi?id=183574
260         <rdar://problem/38385889>
261
262         Reviewed by Anders Carlsson.
263
264         * platform/audio/ios/AudioDestinationIOS.cpp:
265         * platform/mediastream/mac/AudioTrackPrivateMediaStreamCocoa.cpp:
266         Adjust SPI imports.
267
268 2018-03-12  Danyao Wang  <danyao@chromium.org>
269
270         Add a query and fragment exception to history API's unique origin restriction.
271         https://bugs.webkit.org/show_bug.cgi?id=183028
272
273         Reviewed by Brent Fulgham.
274
275         Tests: http/tests/navigation/pushstate-at-unique-origin-denied.php
276                Tools/TestWebKitAPI/Tests/WebCore/URL.cpp
277
278         * page/History.cpp:
279         (WebCore::History::stateObjectAdded):
280
281 2018-03-12  Antti Koivisto  <antti@apple.com>
282
283         Don't invalidate descendants for nth pseudo classes unless needed
284         https://bugs.webkit.org/show_bug.cgi?id=183566
285
286         Reviewed by Zalan Bujtas.
287
288         We currently invalidate the whole subtrees that may match :nth-child and similar. In many common
289         cases we know that only the direct siblings may be affected.
290
291         * css/SelectorChecker.cpp:
292         (WebCore::localContextForParent):
293         (WebCore::SelectorChecker::matchRecursively const):
294
295             Track if the context matches the subject element if the selector or its siblings only.
296
297         (WebCore::SelectorChecker::checkOne const):
298
299             Use different bits of descendant and child invalidation cases.
300
301         * cssjit/SelectorCompiler.cpp:
302         (WebCore::SelectorCompiler::fragmentMatchesRightmostOrAdjacentElement):
303         (WebCore::SelectorCompiler::constructFragmentsInternal):
304
305             Track if the context matches the subject element if the selector or its siblings only.
306
307         (WebCore::SelectorCompiler::SelectorCodeGenerator::generateElementIsNthChild):
308         (WebCore::SelectorCompiler::SelectorCodeGenerator::generateElementIsNthChildOf):
309         (WebCore::SelectorCompiler::SelectorCodeGenerator::generateElementIsNthLastChild):
310
311             Use different bits of descendant and child invalidation cases.
312
313         * dom/Element.cpp:
314         (WebCore::invalidateForForwardPositionalRules):
315         (WebCore::invalidateForBackwardPositionalRules):
316
317             Invalidate more precisely based on the new bits.
318
319         (WebCore::checkForSiblingStyleChanges):
320         (WebCore::Element::setDescendantsAffectedByForwardPositionalRules):
321         (WebCore::Element::setDescendantsAffectedByBackwardPositionalRules):
322         (WebCore::Element::hasFlagsSetDuringStylingOfChildren const):
323         (WebCore::Element::rareDataDescendantsAffectedByForwardPositionalRules const):
324         (WebCore::Element::rareDataDescendantsAffectedByBackwardPositionalRules const):
325
326             New bits.
327
328         * dom/Element.h:
329         (WebCore::Element::descendantsAffectedByForwardPositionalRules const):
330         (WebCore::Element::descendantsAffectedByBackwardPositionalRules const):
331         * dom/ElementRareData.h:
332         (WebCore::ElementRareData::descendantsAffectedByForwardPositionalRules const):
333         (WebCore::ElementRareData::setDescendantsAffectedByForwardPositionalRules):
334         (WebCore::ElementRareData::descendantsAffectedByBackwardPositionalRules const):
335         (WebCore::ElementRareData::setDescendantsAffectedByBackwardPositionalRules):
336         (WebCore::ElementRareData::ElementRareData):
337         (WebCore::ElementRareData::resetStyleRelations):
338         * style/StyleRelations.cpp:
339         (WebCore::Style::commitRelationsToRenderStyle):
340         (WebCore::Style::commitRelations):
341         * style/StyleRelations.h:
342
343 2018-03-12  Javier Fernandez  <jfernandez@igalia.com>
344
345         Remove GridLayout runtime flag
346         https://bugs.webkit.org/show_bug.cgi?id=183484
347
348         Reviewed by Myles C. Maxfield.
349
350         The Grid Layout feature has been enabled by default for almost a
351         year, so I think it's time to remove the runtime flag and the
352         codepath run when the feature is disabled.
353
354         No new tests, because there are no changes in functionality.
355
356         * css/CSSComputedStyleDeclaration.cpp:
357         (WebCore::valueForContentPositionAndDistributionWithOverflowAlignment):
358         (WebCore::ComputedStyleExtractor::valueForPropertyinStyle):
359         * css/StyleBuilderConverter.h:
360         (WebCore::StyleBuilderConverter::convertContentAlignmentData):
361         * css/parser/CSSParser.cpp:
362         (WebCore::CSSParserContext::CSSParserContext):
363         (WebCore::operator==):
364         * css/parser/CSSParserFastPaths.cpp:
365         (WebCore::CSSParserFastPaths::isValidKeywordPropertyAndValue):
366         (WebCore::CSSParserFastPaths::isKeywordPropertyID):
367         * css/parser/CSSParserMode.h:
368         (WebCore::CSSParserContextHash::hash):
369         * css/parser/CSSPropertyParser.cpp:
370         (WebCore::CSSPropertyParser::parseSingleValue):
371         * dom/Document.cpp:
372         * dom/Document.h:
373         * page/RuntimeEnabledFeatures.h:
374         * rendering/RenderFlexibleBox.cpp:
375         (WebCore::alignmentOffset):
376         * rendering/style/RenderStyle.cpp:
377         * rendering/style/RenderStyle.h:
378         (WebCore::RenderStyle::initialDefaultAlignment):
379         * testing/InternalSettings.cpp:
380         (WebCore::InternalSettings::Backup::Backup):
381         (WebCore::InternalSettings::Backup::restoreTo):
382         * testing/InternalSettings.h:
383         * testing/InternalSettings.idl:
384
385 2018-03-12  Antoine Quint  <graouts@apple.com>
386
387         [Web Animations] Implement CSS Animations and CSS Transitions as Web Animations
388         https://bugs.webkit.org/show_bug.cgi?id=183504
389         <rdar://problem/38372965>
390
391         Reviewed by Dean Jackson and Jon Lee.
392
393         Tests: webanimations/css-animations.html
394                webanimations/css-transitions.html
395
396         This patch implements CSS Animations and CSS Transitions as Web Animations. The main changes are:
397
398         * StyleTreeResolver: StyleTreeResolver now has a code path to add CSSAnimation and CSSTransition objects onto the DocumentTimeline
399         to be picked up by the Web Animations engine. The previous CSSAnimationController code path is preserved if the runtime flag is disabled.
400
401         * AnimationTimeline: we add two new methods, updateCSSAnimationsForElement() and updateCSSTransitionsForElement() which are called from
402         TreeResolver::createAnimatedElementUpdate(). These look at the AnimationList for the old and new RenderStyle objects and create, update
403         and remove matching CSSAnimation and CSSTransition instances.
404
405         * DeclarativeAnimation: a new superclass to both CSSAnimation and CSSTransition which introduces the concept of a backingAnimation(),
406         which is an Animation held by the RenderStyle objects, and two virtual methods with base implementations, initialize() which is called
407         upon creating by create() methods in subclasses, and syncPropertiesWithBackingAnimation() which ensures that properties on the
408         DeclarativeAnimation objects (Web Animations side) match the backing animation (CSS side).
409
410         * KeyframeEffectReadOnly: two new important methods to create blending keyframes (KeyframeList) based on backing Animation objects,
411         computeCSSAnimationBlendingKeyframes() and computeCSSTransitionBlendingKeyframes().
412
413         * Sources.txt:
414         * WebCore.xcodeproj/project.pbxproj:
415         * animation/AnimationEffectReadOnly.h:
416         (WebCore::AnimationEffectReadOnly::isKeyframeEffectReadOnly const): We fix this method such that calling it on a KeyframeEffect, which
417         is a subclass of KeyframeEffectReadOnly, returns true.
418         * animation/AnimationEffectTimingReadOnly.cpp: In order for DeclarativeAnimation::syncPropertiesWithBackingAnimation() to set the timing
419         function for a declarative animation's effect, we need a public method to set an effect's timing function outside of just the "easing"
420         property setter exposed via the JS API. So we introduce a setTimingFunction() method and call it from setEasing().
421         (WebCore::AnimationEffectTimingReadOnly::setEasing):
422         (WebCore::AnimationEffectTimingReadOnly::setTimingFunction):
423         * animation/AnimationEffectTimingReadOnly.h:
424         * animation/AnimationTimeline.cpp:
425         (WebCore::AnimationTimeline::~AnimationTimeline): Clear all maps and sets containing WebAnimation references to ensure these get destructed
426         when the AnimationTimeline is being destructed and should no longer hold a reference to them.
427         (WebCore::AnimationTimeline::relevantMapForAnimation): We store various subclasses of WebAnimation in dedicated maps so we can composite
428         animations in the correct order when animating. This function returns the correct map for a given animation such that animationWasAddedToElement()
429         and animationWasRemovedFromElement() mutate the right map.
430         (WebCore::AnimationTimeline::animationWasAddedToElement):
431         (WebCore::AnimationTimeline::animationWasRemovedFromElement):
432         (WebCore::AnimationTimeline::animationsForElement): Make sure to look for animations in the lists of CSS Animations and CSS Transitions as well
433         as Web Animations.
434         (WebCore::AnimationTimeline::updateCSSAnimationsForElement): This method is called by TreeResolver::createAnimatedElementUpdate() during style
435         resolution. It compares the AnimationList of the previous style and the new style for a given element, checks that animations with a given name
436         that were not present in the old AnimationList have a new matching CSSAnimation object for them added to the AnimationTimeline, that animations
437         with a given name that are no longer present in the new AnimationList have their matching CSSAnimation object removed from the AnimationTimeline,
438         and that animations with a given name that are present in both the old and new AnimationList have their matching CSSAnimation updated to match
439         the current state of the animation in the AnimationList.
440         (WebCore::AnimationTimeline::updateCSSTransitionsForElement): Similarly to updateCSSAnimationsForElement(), this method is called during style
441         resolution by TreeResolver::createAnimatedElementUpdate(). Its role is to create or remove CSSTransition objects based on the AnimationList found
442         in the old and new styles for a given element. It follows a slightly different logic than updateCSSAnimationsForElement() since for CSS Transitions,
443         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
444         property is changed, a whole new transition is initiated. However, it's important to check that different Animation objects and styles would actually
445         result in different timing properties and blending keyframes, so check for this as well before creating new CSSTransition objects.
446         * animation/AnimationTimeline.h:
447         (WebCore::AnimationTimeline::animations const): Change the m_animations type from HashSet to ListHashSet to guarantee we preserve the insertion order which is
448         required by getAnimations().
449         (WebCore::AnimationTimeline::hasElementAnimations const): Indicates to DocumentTimeline::updateAnimations() that there are animations targeting the provided element.
450         (WebCore::AnimationTimeline::elementToAnimationsMap):
451         (WebCore::AnimationTimeline::elementToCSSAnimationsMap):
452         (WebCore::AnimationTimeline::elementToCSSTransitionsMap):
453         * animation/CSSAnimation.cpp: CSSAnimation is now a subclass of DeclarativeAnimation and subclasses initialize() and syncPropertiesWithBackingAnimation()
454         to perform work specific to CSS Animations.
455         (WebCore::CSSAnimation::create): Set the animationName property based on the provided backing animation.
456         (WebCore::CSSAnimation::CSSAnimation):
457         (WebCore::CSSAnimation::initialize): Create the blending keyframes for this CSSAnimation.
458         (WebCore::CSSAnimation::syncPropertiesWithBackingAnimation): Reflect the animation-fill-mode, animation-direction, animation-iteration-count and
459         animation-play-state CSS properties on the AnimationEffectTimingReadOnly object associated with this CSSAnimation.
460         * animation/CSSAnimation.h:
461         * animation/CSSTransition.cpp: CSSTransition is now a subclass of DeclarativeAnimation.
462         (WebCore::CSSTransition::create): Set the transitionProperty property based on the provided backing animation.
463         (WebCore::CSSTransition::CSSTransition):
464         (WebCore::CSSTransition::matchesBackingAnimationAndStyles const):
465         (WebCore::CSSTransition::canBeListed const): Subclass this method such that we also check that we have blending keyframes for a CSSTransition to be
466         listed by calls to getAnimations().
467         * animation/CSSTransition.h:
468         * animation/DeclarativeAnimation.cpp: Added. This new WebAnimation subclass now is the common base class for both CSSAnimation and CSSTransition.
469         It establishes a relationship with a "backing animation", which is an Animation obtained from a style's AnimationList while resolving styles.
470         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
471         of the Web Animations timing model in the new syncPropertiesWithBackingAnimation() virtual method, which subclasses can override to perform further
472         work that is specific to a given declarative animation type. The initialize() method is called during create() methods to perform common animation
473         setup work. Note that while both initialize() and syncPropertiesWithBackingAnimation() are called, we suspend invalidation to that animation's effect
474         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
475         updateStyleIfNeeded() on the target's document during invalidation.
476         (WebCore::DeclarativeAnimation::DeclarativeAnimation):
477         (WebCore::DeclarativeAnimation::setBackingAnimation):
478         (WebCore::DeclarativeAnimation::initialize): Create a KeyframeEffectReadOnly for this animation and set the provided element as its target, set that
479         element's document's timeline and play the animation if the backing animation's play state is playing.
480         (WebCore::DeclarativeAnimation::syncPropertiesWithBackingAnimation): Reflect the {animation|transition}-delay, {animation|transition}-duration and
481         {animation|transition}-timing-function properties as set on the backing animation.
482         * animation/DeclarativeAnimation.h: Added.
483         (WebCore::DeclarativeAnimation::backingAnimation const):
484         * animation/DocumentTimeline.cpp:
485         (WebCore::DocumentTimeline::updateAnimations): Trigger style invalidation for elements targeted not just by WebAnimation instances, but also by any
486         of the DeclarativeAnimation subclasses. We also remove the call to updateFinishedState() which should have been removed when we implemented correct
487         support for asynchronous WebAnimation operations.
488         (WebCore::DocumentTimeline::animatedStyleForRenderer): Declarative animations are backed by KeyframeEffectReadOnly effects, so make sure we check
489         for KeyframeEffectReadOnly or one of its subclasses and not just KeyframeEffect since there now are animation types that use the ReadOnly variant.
490         (WebCore::DocumentTimeline::runningAnimationsForElementAreAllAccelerated): Same as for animatedStyleForRenderer, check for KeyframeEffectReadOnly
491         and not simply KeyframeEffect.
492         * animation/KeyframeEffectReadOnly.cpp:
493         (WebCore::invalidateElement): Stop forcing a style resolution as we invalidate element, marking them as dirty is sufficient. Calls to getAnimations()
494         already force a style resolution as needed.
495         (WebCore::KeyframeEffectReadOnly::create): Add a new create() method that only provides a target and which is used by DeclarativeAnimation::initialize().
496         (WebCore::KeyframeEffectReadOnly::getKeyframes): The previous implementation of getKeyframes() used the ParsedKeyframe list held as m_parsedKeyframes
497         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
498         to look for keyframe data.
499         (WebCore::KeyframeEffectReadOnly::computeCSSAnimationBlendingKeyframes): Called by CSSAnimation::initialize(), this function creates blending keyframes by
500         looking up the keyframes date obtained from the @keyframes rule with this backing animation's name.
501         (WebCore::KeyframeEffectReadOnly::computeCSSTransitionBlendingKeyframes): Called by CSSTransition::create(), this function creates blending keyframes by
502         creating a 0-offset keyframe with the old style and a 1-offset keyframe with the new style as provided during TreeResolver::createAnimatedElementUpdate().
503         (WebCore::KeyframeEffectReadOnly::stylesWouldYieldNewCSSTransitionsBlendingKeyframes const): Called by AnimationTimeline::updateCSSTransitionsForElement()
504         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
505         properties and keyframe CSS values for a given CSS transition to avoid the deletion and creation of CSSTransition objects.
506         (WebCore::KeyframeEffectReadOnly::shouldRunAccelerated): We mistakenly assumed we always had blending keyframes, which is not always the case with a
507         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
508         keyframes at least, the function already returning false if it finds a blending keyframe animating a non-accelerated CSS property.
509         (WebCore::KeyframeEffectReadOnly::setAnimatedPropertiesInStyle): Check that there actually is a matching ParsedKeyframe to read the timing function from.
510         * animation/KeyframeEffectReadOnly.h:
511         (WebCore::KeyframeEffectReadOnly::hasBlendingKeyframes const):
512         * animation/WebAnimation.cpp:
513         (WebCore::WebAnimation::~WebAnimation): We used to do something very wrong when a WebAnimation was destroyed which uncovered crashes when dealing with
514         declarative animations. In AnimationTimeline's updateCSSAnimationsForElement() and updateCSSTransitionsForElement(), when we identify that a DeclarativeAnimation
515         no longer matches an Animation from the current style's AnimationList, we set that DeclarativeAnimation's effect to null and call removeAnimation() on
516         the timeline. This removes all references from AnimationTimeline to this DeclarativeAnimation and leads to ~WebAnimation being called. Calling removeAnimation()
517         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
518         the WebAnimation destructor since an animation could never be destroyed if it were still registered on a timeline.
519         (WebCore::WebAnimation::suspendEffectInvalidation): DeclarativeAnimation instances have their timing model properties set during style invalidation, so we need
520         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
521         calls to this method and unsuspendEffectInvalidation() and a isEffectInvalidationSuspended() method returning true whenever that count is positive.
522         (WebCore::WebAnimation::unsuspendEffectInvalidation):
523         (WebCore::WebAnimation::timingModelDidChange): Check that effect invalidation is not suspended before proceeding with invalidating the effect.
524         (WebCore::WebAnimation::setEffect): Check for KeyframeEffectReadOnly and not just KeyframeEffect since declarative animations have ReadOnly effects.
525         (WebCore::WebAnimation::setTimeline): Check for KeyframeEffectReadOnly and not just KeyframeEffect since declarative animations have ReadOnly effects.
526         (WebCore::WebAnimation::scheduleMicrotaskIfNeeded): Ensure that the WebAnimation's lifecycle is extended at least to the completion of the scheduled microtask.
527         This would otherwise cause crashes after declarative animations were destroyed when they were no longer applied.
528         (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()
529         are made as a result of updating the animation play state in CSSAnimation::syncPropertiesWithBackingAnimation().
530         (WebCore::WebAnimation::runPendingPauseTask): Same as above but with multiple pause() calls.
531         (WebCore::WebAnimation::startOrStopAccelerated): Check for KeyframeEffectReadOnly and not just KeyframeEffect since declarative animations have ReadOnly effects.
532         (WebCore::WebAnimation::canBeListed const): This new method is called by {Document|Element}::getAnimations() to check that an animation is in the correct state to
533         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
534         this behavior as specified.
535         * animation/WebAnimation.h:
536         (WebCore::WebAnimation::isDeclarativeAnimation const):
537         (WebCore::WebAnimation::isEffectInvalidationSuspended):
538         * dom/Document.cpp:
539         (WebCore::Document::getAnimations): Ensure that the document's pending styles are resolved before returning animations to ensure that any pending declarative
540         animations are created. Additionally, we ensure that we only list qualifying animations that have effects targeting elements that are children of thi document.
541         * dom/Element.cpp:
542         (WebCore::Element::getAnimations): Same as Document::getAnimations().
543         * style/StyleTreeResolver.cpp:
544         (WebCore::Style::TreeResolver::createAnimatedElementUpdate): When resolving styles, call into the AnimationTimeline if the runtime flag to enable CSS Animations and
545         CSS Transitions as Web Animations is on. Otherwise, use CSSAnimationController.
546
547 2018-03-12  Michael Catanzaro  <mcatanzaro@igalia.com>
548
549         [GTK] Crash in WebCore::PlatformDisplayWayland::~PlatformDisplayWayland
550         https://bugs.webkit.org/show_bug.cgi?id=176490
551
552         Reviewed by Žan Doberšek.
553
554         Destroy the wl_display with wl_display_disconnect() (client process API), not
555         wl_display_destroy() (server process API). It has to be destroyed last, so explicitly
556         destroy the wl_registry and wl_compositor first.
557
558         * platform/graphics/wayland/PlatformDisplayWayland.cpp:
559         (WebCore::PlatformDisplayWayland::~PlatformDisplayWayland):
560
561 2018-03-10  Megan Gardner  <megan_gardner@apple.com>
562
563         Media query for default appearance
564         https://bugs.webkit.org/show_bug.cgi?id=183539
565         <rdar://problem/38326388>
566
567         Reviewed by Tim Horton.
568
569         Not currently testable, will add tests in a later patch.
570
571         Write a media query to evaluate appearance.
572
573         * css/CSSValueKeywords.in:
574         * css/MediaFeatureNames.h:
575         * css/MediaQueryEvaluator.cpp:
576         (WebCore::defaultAppearanceEvaluate):
577         * css/MediaQueryExpression.cpp:
578         (WebCore::featureWithValidIdent):
579         (WebCore::isFeatureValidWithoutValue):
580         * page/Page.h:
581         (WebCore::Page::defaultAppearance const):
582         (WebCore::Page::setDefaultAppearance):
583
584 2018-03-10  Daniel Bates  <dabates@apple.com>
585
586         InlineTextBox should own shadow data
587         https://bugs.webkit.org/show_bug.cgi?id=183359
588         <rdar://problem/38171343>
589
590         Reviewed by Darin Adler.
591
592         Following r229147 we recompute the selection style, including any shadow data, whenever we
593         paint the inline text box. Therefore, InlineTextBox needs to take ownership of the shadow
594         data or it may be deallocated before it can be used.
595
596         Covered by existing tests.
597
598         * rendering/InlineTextBox.cpp: Changed data type of InlineTextBox::MarkedTextStyle::textShadow
599         from const ShadowData* to std::optional<ShadowData>. Also removed explicitly deleted equality
600         and inequality operators as they are unnecessary. Layout tests should catch if these are ever
601         implemented and used when painting because the painted results will be wrong.
602         (WebCore::InlineTextBox::computeStyleForUnmarkedMarkedText const): Clone ShadowData.
603         (WebCore::InlineTextBox::resolveStyleForMarkedText): Simplified logic.
604         (WebCore::InlineTextBox::paintMarkedTextForeground): Modified code now that MarkedTextStyle
605         holds a std::optional<ShadowData>.
606         (WebCore::InlineTextBox::paintMarkedTextDecoration): Ditto.
607         * rendering/TextPaintStyle.cpp:
608         (WebCore::computeTextSelectionPaintStyle): Changed the out parameter type from const ShadowData*
609         to std::optional<ShadowData>& and modified code as needed.
610         * rendering/TextPaintStyle.h:
611         * rendering/style/ShadowData.cpp: Removed unncessary #include of header LayoutRect.h.
612         This header will be included via ShadowData.h.
613         (WebCore::ShadowData::clone): Convenience method that returns an std::optional to a
614         cloned ShadowData object.
615         * rendering/style/ShadowData.h:
616
617 2018-03-09  Zalan Bujtas  <zalan@apple.com>
618
619         Turn off offset*/scroll* optimization for input elements with shadow content
620         https://bugs.webkit.org/show_bug.cgi?id=182383
621         <rdar://problem/37114190>
622
623         Reviewed by Antti Koivisto.
624
625         We normally ensure clean tree before calling offsetHeight/Width, scrollHeight/Width.
626         In certain cases (see updateLayoutIfDimensionsOutOfDate() for details), it's okay to return
627         the previously computed values even when some part of the tree is dirty.
628         In case of shadow content, updateLayoutIfDimensionsOutOfDate() might return false (no need to layout)
629         for the root, while true (needs layout) for the shadow content.
630         This could confuse the caller (Element::scrollWidth/Height etc) and lead to incorrect result.
631
632         Test: fast/forms/scrollheight-with-mutation-crash.html
633
634         * dom/Document.cpp:
635         (WebCore::Document::updateLayoutIfDimensionsOutOfDate):
636
637 2018-03-10  Wenson Hsieh  <wenson_hsieh@apple.com>
638
639         [macOS] Copying a table from the Numbers app and pasting into iCloud Numbers fails
640         https://bugs.webkit.org/show_bug.cgi?id=183485
641         <rdar://problem/38041984>
642
643         Reviewed by Ryosuke Niwa.
644
645         After r222656, WebKit now treats raw image data on the pasteboard as files for the purposes of computing
646         DataTransfer.files and DataTransfer.types. However, this is combined with existing policies that suppress
647         DataTransfer.getData and DataTransfer.setData when the pasteboard contains files (generalized to copy/paste in
648         r222688). This means we now don't allow web pages to access "text/plain" in the case where the user copies part
649         of a table from the native Numbers app since Numbers additionally writes a snapshot of the table to the platform
650         pasteboard.
651
652         This restriction on getData/setData was intended to prevent web pages from extracting users' file paths when
653         pasting or dropping, so it doesn't make sense to enforce this restriction even when there is only in-memory
654         image data on the pasteboard. To fix this bug, we make Pasteboard::fileContentState() differentiate between
655         cases where there are (real) files on the pasteboard, and cases where we've fallen back to treating image data
656         as files.
657
658         Rebaselined existing LayoutTests to match new behavior.
659         Also covered by 4 new API tests:
660             - PasteMixedContent.ImageDataAndPlainText
661             - PasteMixedContent.ImageDataAndPlainTextAndURL
662             - PasteMixedContent.ImageDataAndPlainTextAndURLAndHTML
663             - UIPasteboardTests.DataTransferGetDataWhenPastingImageAndText
664
665         * dom/DataTransfer.cpp:
666         (WebCore::DataTransfer::shouldSuppressGetAndSetDataToAvoidExposingFilePaths const):
667
668         If custom pasteboard data is enabled, suppress getData and setData if and only if we might actually expose file
669         paths (see Pasteboard::fileContentState).
670
671         (WebCore::DataTransfer::types const):
672
673         Only allow "text/html" or "text/uri-list" in the case where there are actual files in the pasteboard. If there's
674         only image data, add all of the DOM-safe types back into the list of types.
675
676         * platform/Pasteboard.h:
677         * platform/StaticPasteboard.h:
678
679         Add an enum type to represent the result of Pasteboard::fileContentState.
680         -   NoFileOrImageData indicates that there was nothing on the pasteboard that could be considered a file
681             from the point of view of the page.
682         -   InMemoryImage indicates that there are no files on the pasteboard, but there is image data that we consider
683             to be files, exposed via DataTransfer API.
684         -   MayContainFilePaths indicates that there might be file paths on the pasteboard. This means that the source
685             has either written file paths to the pasteboard (for example, through NSFilenamesPboardType) or the source
686             has written image data along with a URL type of some sort that does not match one of the allowed URL schemes
687             that are safe to expose (currently, these are http-family, data, or blob).
688
689         * platform/cocoa/PasteboardCocoa.mm:
690         (WebCore::Pasteboard::fileContentState):
691
692         Refactor to return one of the three enum types described above.
693
694         (WebCore::Pasteboard::containsFiles): Deleted.
695         * platform/gtk/PasteboardGtk.cpp:
696         (WebCore::Pasteboard::fileContentState):
697         (WebCore::Pasteboard::containsFiles): Deleted.
698         * platform/win/PasteboardWin.cpp:
699         (WebCore::Pasteboard::fileContentState):
700         (WebCore::Pasteboard::containsFiles): Deleted.
701         * platform/wpe/PasteboardWPE.cpp:
702         (WebCore::Pasteboard::fileContentState):
703         (WebCore::Pasteboard::containsFiles): Deleted.
704
705         Adjust for Pasteboard::fileContentState() tweaks.
706
707 2018-03-09  Chris Fleizach  <cfleizach@apple.com>
708
709         AX: WebKit seems to be running spell checker even on non-editable content text
710         https://bugs.webkit.org/show_bug.cgi?id=183456
711         <rdar://problem/38076042>
712
713         Reviewed by Joanmarie Diggs.
714
715         Test: accessibility/mac/attributed-string/attributed-string-does-not-includes-misspelled-for-non-editable.html
716
717         Only apply misspelled attributes if it's for editable text. It's not useful or performant to do this for static text.
718
719         * accessibility/mac/WebAccessibilityObjectWrapperMac.mm:
720         (AXAttributeStringSetSpelling):
721
722 2018-03-09  Nan Wang  <n_wang@apple.com>
723
724         AX: AOM: More accessibility events support
725         https://bugs.webkit.org/show_bug.cgi?id=183023
726         <rdar://problem/37764380>
727
728         Reviewed by Chris Fleizach.
729
730         The test is crashing when we call updateBackingStore when 
731         the AXObjectCache object is gone. Added a check to fix that.
732
733         Modified the test by using the right format of setTimeout and extended the delay.
734
735         * accessibility/AccessibilityObject.cpp:
736         (WebCore::AccessibilityObject::updateBackingStore):
737
738 2018-03-09  Ross Kirsling  <ross.kirsling@sony.com>
739
740         Unreviewed. Fix WinCairo build after r229497.
741
742         * platform/MIMETypeRegistry.cpp:
743         (WebCore::MIMETypeRegistry::getNormalizedMIMEType):
744
745 2018-03-09  Ross Kirsling  <ross.kirsling@sony.com>
746
747         Clean up MIMETypeRegistry::mimeTypeAssociationMap for Curl
748         https://bugs.webkit.org/show_bug.cgi?id=170529
749
750         Reviewed by Alex Christensen.
751
752         * platform/MIMETypeRegistry.cpp:
753         (WebCore::MIMETypeRegistry::getNormalizedMIMEType):
754         (WebCore::mimeTypeAssociationMap): Deleted.
755         Create map with makeNeverDestroyed and a loop instead.
756
757 2018-03-09  Brian Burg  <bburg@apple.com>
758
759         Web Inspector: there should only be one way for async backend commands to send failure
760         https://bugs.webkit.org/show_bug.cgi?id=183524
761
762         Reviewed by Timothy Hatcher.
763
764         Remove some useless ErrorString arguments. Fix some bugs where we
765         may never call the callback in an early exit situation.
766
767         Covered by existing Inspector and protocol generator tests.
768
769         * inspector/agents/InspectorDatabaseAgent.cpp:
770         (WebCore::InspectorDatabaseAgent::executeSQL):
771         * inspector/agents/InspectorDatabaseAgent.h:
772         * inspector/agents/InspectorIndexedDBAgent.h:
773         * inspector/agents/InspectorIndexedDBAgent.cpp:
774         (WebCore::getDocumentAndIDBFactoryFromFrameOrSendFailure):
775         (WebCore::InspectorIndexedDBAgent::requestDatabaseNames):
776         (WebCore::InspectorIndexedDBAgent::requestDatabase):
777         (WebCore::InspectorIndexedDBAgent::requestData):
778         (WebCore::InspectorIndexedDBAgent::clearObjectStore):
779         (WebCore::assertDocument): Deleted.
780         (WebCore::assertIDBFactory): Deleted.
781         Modernize this code a little bit to share the document/idbFactory extraction code.
782
783         * inspector/agents/InspectorNetworkAgent.cpp:
784         (WebCore::InspectorNetworkAgent::loadResource):
785         * inspector/agents/InspectorNetworkAgent.h:
786
787 2018-03-09  Youenn Fablet  <youenn@apple.com>
788
789         Crash in ServiceWorkerContainer::ready
790         https://bugs.webkit.org/show_bug.cgi?id=183380
791
792         Reviewed by Chris Dumez.
793
794         Not using 'this' through lambdas.
795         Instead rely on the last lambda that is passed a ScriptExecutionContext& to get back 'this' which is a ServiceWorkerContainer.
796
797         Should be covered by imported/w3c/web-platform-tests/service-workers/service-worker/register-default-scope.https.html no longer crashing.
798         Although it should probably be LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/ready.https.html that should crash
799         since this is the main test using ready.
800
801         * workers/service/ServiceWorkerContainer.cpp:
802         (WebCore::ServiceWorkerContainer::ready):
803
804 2018-03-09  Youenn Fablet  <youenn@apple.com>
805
806         RealtimeOutgoingAudioSource and RealtimeOutgoingVideoSource should be destroyed on the main thread
807         https://bugs.webkit.org/show_bug.cgi?id=183483
808         <rdar://problem/38214152>
809
810         Reviewed by Eric Carlson.
811
812         When dereferencing from libwebrtc code path, schedule a call to deref on main thread.
813         WebCore dereferencing is happening in the main thread so this guarantees destruction on the main thread.
814
815         Covered by updated mock libwebrtc peer connection backend.
816         We make mock senders to keep a reference to their source which are RealtimeOutgoingXXSource.
817         We then make mock peer connection backend to free the mock senders in a background thread.
818
819         * Modules/mediastream/libwebrtc/LibWebRTCPeerConnectionBackend.cpp:
820         (WebCore::LibWebRTCPeerConnectionBackend::doStop):
821         * platform/mediastream/RealtimeOutgoingAudioSource.cpp:
822         (WebCore::RealtimeOutgoingAudioSource::stop):
823         * platform/mediastream/RealtimeOutgoingAudioSource.h:
824         * platform/mediastream/RealtimeOutgoingVideoSource.cpp:
825         (WebCore::RealtimeOutgoingVideoSource::stop):
826         * platform/mediastream/RealtimeOutgoingVideoSource.h:
827         * testing/MockLibWebRTCPeerConnection.cpp:
828         (WebCore::ThreadKeeper::create):
829         (WebCore::ThreadKeeper::setThread):
830         (WebCore::MockLibWebRTCPeerConnection::~MockLibWebRTCPeerConnection):
831         * testing/MockLibWebRTCPeerConnection.h:
832
833 2018-03-09  Jer Noble  <jer.noble@apple.com>
834
835         Unconditionalize more methods in VideoFullscreenInterface (and related classes)
836         https://bugs.webkit.org/show_bug.cgi?id=183501
837
838         Reviewed by Eric Carlson.
839
840         No need for these methods to be PLATFORM(MAC) only.
841
842         * platform/cocoa/PlaybackSessionModel.h:
843         (WebCore::PlaybackSessionModelClient::ensureControlsManager):
844         * platform/ios/VideoFullscreenInterfaceAVKit.h:
845         * platform/ios/VideoFullscreenInterfaceAVKit.mm:
846         (VideoFullscreenInterfaceAVKit::isPlayingVideoInEnhancedFullscreen const):
847         * platform/mac/VideoFullscreenInterfaceMac.h:
848
849 2018-03-09  Youenn Fablet  <youenn@apple.com>
850
851         ServiceWorker should respect IDB and DOMCache partitioning
852         https://bugs.webkit.org/show_bug.cgi?id=183496
853
854         Reviewed by Brady Eidson.
855
856         Test: http/wpt/service-workers/third-party-registration.html
857
858         Set the correct top origin of service worker ScriptExecutionContext.
859
860         * workers/service/context/ServiceWorkerThread.cpp:
861         (WebCore::ServiceWorkerThread::ServiceWorkerThread):
862
863 2018-03-09  Youenn Fablet  <youenn@apple.com>
864
865         Cannot change audio input source device
866         https://bugs.webkit.org/show_bug.cgi?id=175975
867         <rdar://problem/34073589>
868
869         Reviewed by Eric Carlson.
870
871         Covered by manually testing https://webrtc.github.io/samples/src/content/devices/input-output/ with a USB web cam.
872
873         * platform/mediastream/mac/CoreAudioCaptureSource.cpp:
874         (WebCore::CoreAudioSharedUnit::setCaptureDeviceID):
875         (WebCore::CoreAudioCaptureSource::CoreAudioCaptureSource):
876
877 2018-03-09  Jer Noble  <jer.noble@apple.com>
878
879         Add new CSS env constants for use with fullscreen
880         https://bugs.webkit.org/show_bug.cgi?id=183498
881
882         Reviewed by Dean Jackson.
883
884         Tests: fullscreen/fullscreen-auto-hide-delay.html
885                fullscreen/fullscreen-inset-top.html
886
887         * dom/ConstantPropertyMap.cpp:
888         (WebCore::ConstantPropertyMap::nameForProperty const):
889         (WebCore::variableDataForPositiveDuration):
890         (WebCore::ConstantPropertyMap::setFullscreenInsetTop):
891         (WebCore::ConstantPropertyMap::setFullscreenAutoHideDelay):
892         * dom/ConstantPropertyMap.h:
893         * page/Page.cpp:
894         (WebCore::Page::setFullscreenInsetTop):
895         (WebCore::Page::setFullscreenAutoHideDelay):
896         * page/Page.h:
897         * testing/Internals.cpp:
898         (WebCore::Internals::resetToConsistentState):
899         (WebCore::Internals::setFullscreenInsetTop):
900         (WebCore::Internals::setFullscreenAutoHideDelay):
901         * testing/Internals.h:
902         * testing/Internals.idl:
903
904 2018-03-09  Zalan Bujtas  <zalan@apple.com>
905
906         RenderTreeBuilder::splitAnonymousBoxesAroundChild should take multicolumn spanners into account.
907         https://bugs.webkit.org/show_bug.cgi?id=183493
908         <rdar://problem/38030461>
909
910         Reviewed by Antti Koivisto.
911
912         Multicolumn spanners are taken out of their original position and placed next
913         to a RenderMultiColumnSet. splitAnonymousBoxesAroundChild needs to know the original parent (in the render tree context).
914
915         Test: fast/multicol/adjust-beforeChild-for-spanner-crash.html
916
917         * rendering/updating/RenderTreeBuilder.cpp:
918         (WebCore::RenderTreeBuilder::splitAnonymousBoxesAroundChild):
919         * rendering/updating/RenderTreeBuilder.h:
920         * rendering/updating/RenderTreeBuilderBlock.cpp:
921         (WebCore::RenderTreeBuilder::Block::attachIgnoringContinuation):
922         * rendering/updating/RenderTreeBuilderMultiColumn.cpp:
923         (WebCore::RenderTreeBuilder::MultiColumn::adjustBeforeChildForMultiColumnSpannerIfNeeded):
924         * rendering/updating/RenderTreeBuilderMultiColumn.h:
925         * rendering/updating/RenderTreeBuilderRuby.cpp:
926         (WebCore::RenderTreeBuilder::Ruby::moveChildrenInternal):
927         * rendering/updating/RenderTreeBuilderTable.cpp:
928         (WebCore::RenderTreeBuilder::Table::attach):
929
930 2018-03-09  Jer Noble  <jer.noble@apple.com>
931
932         Add isPictureInPictureActive messaging across WebKit process boundary
933         https://bugs.webkit.org/show_bug.cgi?id=183499
934
935         Reviewed by Eric Carlson.
936
937         * platform/cocoa/PlaybackSessionModel.h:
938         (WebCore::PlaybackSessionModelClient::pictureInPictureActiveChanged):
939         * platform/cocoa/PlaybackSessionModelMediaElement.h:
940         * platform/cocoa/PlaybackSessionModelMediaElement.mm:
941         (WebCore::PlaybackSessionModelMediaElement::updateForEventName):
942         (WebCore::PlaybackSessionModelMediaElement::isPictureInPictureActive const):
943         * platform/ios/WebVideoFullscreenControllerAVKit.mm:
944         (VideoFullscreenControllerContext::isPictureInPictureActive const):
945
946 2018-03-09  Basuke Suzuki  <Basuke.Suzuki@sony.com>
947
948         [Curl] Implement connection limit.
949         https://bugs.webkit.org/show_bug.cgi?id=183016
950
951         Implement both connection limit per host and total
952         connection limit on curl network layer.
953
954         Reviewed by Youenn Fablet.
955
956         No new tests because there's no behavior change.
957
958         * platform/network/curl/CurlContext.cpp:
959         (WebCore::EnvironmentVariableReader::sscanTemplate<signed>):
960         (WebCore::CurlContext::CurlContext):
961         (WebCore::CurlMultiHandle::setMaxConnects):
962         (WebCore::CurlMultiHandle::setMaxTotalConnections):
963         (WebCore::CurlMultiHandle::setMaxHostConnections):
964         * platform/network/curl/CurlContext.h:
965         (WebCore::CurlContext::scheduler):
966         * platform/network/curl/CurlRequest.cpp:
967         (WebCore::CurlRequest::startWithJobManager):
968         (WebCore::CurlRequest::cancel):
969         (WebCore::CurlRequest::invokeDidReceiveResponseForFile):
970         (WebCore::CurlRequest::completeDidReceiveResponse):
971         (WebCore::CurlRequest::pausedStatusChanged):
972         * platform/network/curl/CurlRequestScheduler.cpp:
973         (WebCore::CurlRequestScheduler::CurlRequestScheduler):
974         (WebCore::CurlRequestScheduler::workerThread):
975         (WebCore::CurlRequestScheduler::singleton): Deleted.
976         * platform/network/curl/CurlRequestScheduler.h:
977
978 2018-03-09  Jer Noble  <jer.noble@apple.com>
979
980         webkitfullscreenchange event not fired at the same time as :-webkit-full-screen pseudo selector changes; causes glitchiness
981         https://bugs.webkit.org/show_bug.cgi?id=183383
982
983         Reviewed by Eric Carlson.
984
985         Fire the webkitfullscreenchange event at the same time as the pseudo class selector changes, during the handling
986         of webkitDidEnterFullScreenForElement. For WebKit2 clients, this is guaranteed to be asynchronous, since the
987         calling method originates in the UIProcess. For WebKit1 clients (and WKTR and DRT), there's the possibility that
988         webkitWillEnterFullScreenForElement will be called synchronously from within
989         Document::requestFullScreenForElement(), so break that synchronousness by starting the
990         ChromeClient::enterFullScreenForElement(...) process in a async task.
991
992         Previously, the firing of the fullscreenchange event was done through a zero-length timer. Use a
993         GenericTaskQueue instead.
994
995         A number of layout tests depend on the behavior that the element will be in fullscreen when the 'playing' event
996         fires. This was true for DRT (but not WKTR), since its fullscreen implementations were deliberately synchronous, but
997         won't necessarily be true for all ports. Fix this in a subsequent patch.
998
999         * dom/Document.cpp:
1000         (WebCore::Document::requestFullScreenForElement):
1001         (WebCore::Document::webkitExitFullscreen):
1002         (WebCore::Document::webkitWillEnterFullScreenForElement):
1003         (WebCore::Document::webkitDidEnterFullScreenForElement):
1004         (WebCore::Document::webkitDidExitFullScreenForElement):
1005         (WebCore::Document::dispatchFullScreenChangeEvents):
1006         * dom/Document.h:
1007         * html/HTMLMediaElement.cpp:
1008         (WebCore::HTMLMediaElement::setReadyState):
1009         (WebCore::HTMLMediaElement::playInternal):
1010         (WebCore::HTMLMediaElement::mediaPlayerTimeChanged):
1011         (WebCore::HTMLMediaElement::updatePlayState):
1012         (WebCore::HTMLMediaElement::setPlaying):
1013
1014 2018-03-09  Zan Dobersek  <zdobersek@igalia.com>
1015
1016         [Nicosia] Add threaded PaintingEngine implementation
1017         https://bugs.webkit.org/show_bug.cgi?id=183511
1018
1019         Reviewed by Carlos Garcia Campos.
1020
1021         Add Nicosia::PaintingEngineThreaded, class that internally uses a thread
1022         pool in which painting tasks are executed.
1023
1024         Implementation for now defaults to using GLib's GThreadPool, defaulting
1025         to 4 threads that are exclusive to this pool. These parameters should be
1026         fine-tuned in the future, or even made configurable, but are a solid
1027         basis for testing.
1028
1029         In PaintingEngineThreaded::paint(), PaintingContext implementation is
1030         used to record all the operations, and the gathered Vector is combined
1031         with the Buffer object and dispatched into the thread pool. In the
1032         thread function, the provided buffer and painting operations are run
1033         through the PaintingContext implementation, replaying all the operations
1034         on a painting context that draws into the given buffer.
1035
1036         The recorded operation objects implement the PaintingOperation interface
1037         contain all the data necessary to replay a given operation. They can be
1038         executed against a PaintingOperationReplay object, as is the case during
1039         PaintingContext::replay(), or they can be dumped into a TextStream
1040         object for debugging purposes.
1041
1042         PaintingContext now also provides the record() and replay() static
1043         functions. PaintingContext objects now differ per purpose, which can be
1044         either for painting or for recording. paint() and replay() use a
1045         for-painting PaintingContext, and record() uses a for-recording one.
1046         The for-painting PaintingContext receives a Buffer object, i.e. a memory
1047         area on which it can draw, while the for-recording PaintingContext uses
1048         the passed-in PaintingOperations Vector that should store all the
1049         recorded operations.
1050
1051         The current Cairo implementation of PaintingContext is moved into
1052         PaintingContextCairo::ForPainting. PaintingContextCairo::ForRecording is
1053         added but is currently no-op until a Cairo-specific GraphicsContextImpl
1054         with recording capabilities is added, allowing any call on the
1055         GraphicsContext object used in PaintingContext::record() to be recorded
1056         for later replay. PaintingOperationReplayCairo, inheriting from
1057         PaintingOperationReplay, will be used for replay purposes, providing
1058         only reference to the PlatformContextCairo object that is constructed in
1059         PaintingContextCairo::ForPainting.
1060
1061         The Cairo-specific GraphicsContextImpl implementation will be added in
1062         a separate patch. After that, PaintingEngine::create() will be modified
1063         so that the Nicosia::PaintingEngineThreaded implementation can be used
1064         for testing purposes, probably by setting an environment variable.
1065
1066         * platform/TextureMapper.cmake:
1067         * platform/graphics/nicosia/NicosiaPaintingContext.cpp:
1068         (Nicosia::PaintingContext::createForPainting):
1069         (Nicosia::PaintingContext::createForRecording):
1070         (Nicosia::PaintingContext::create): Deleted.
1071         * platform/graphics/nicosia/NicosiaPaintingContext.h:
1072         (Nicosia::PaintingContext::paint):
1073         (Nicosia::PaintingContext::record):
1074         (Nicosia::PaintingContext::replay):
1075         * platform/graphics/nicosia/NicosiaPaintingEngineThreaded.cpp: Added.
1076         (Nicosia::s_threadFunc):
1077         (Nicosia::paintLayer):
1078         (Nicosia::PaintingEngineThreaded::PaintingEngineThreaded):
1079         (Nicosia::PaintingEngineThreaded::~PaintingEngineThreaded):
1080         (Nicosia::PaintingEngineThreaded::paint):
1081         * platform/graphics/nicosia/NicosiaPaintingEngineThreaded.h: Copied from Source/WebCore/platform/graphics/nicosia/NicosiaPaintingContext.cpp.
1082         * platform/graphics/nicosia/NicosiaPaintingOperation.h: Copied from Source/WebCore/platform/graphics/nicosia/NicosiaPaintingContext.cpp.
1083         * platform/graphics/nicosia/cairo/NicosiaPaintingContextCairo.cpp:
1084         (Nicosia::PaintingContextCairo::ForPainting::ForPainting):
1085         (Nicosia::PaintingContextCairo::ForPainting::~ForPainting):
1086         (Nicosia::PaintingContextCairo::ForPainting::graphicsContext):
1087         (Nicosia::PaintingContextCairo::ForPainting::replay):
1088         (Nicosia::PaintingContextCairo::ForRecording::ForRecording):
1089         (Nicosia::PaintingContextCairo::ForRecording::graphicsContext):
1090         (Nicosia::PaintingContextCairo::ForRecording::replay):
1091         (Nicosia::PaintingContextCairo::PaintingContextCairo): Deleted.
1092         (Nicosia::PaintingContextCairo::~PaintingContextCairo): Deleted.
1093         (Nicosia::PaintingContextCairo::graphicsContext): Deleted.
1094         * platform/graphics/nicosia/cairo/NicosiaPaintingContextCairo.h:
1095         * platform/graphics/nicosia/cairo/NicosiaPaintingOperationReplayCairo.h: Copied from Source/WebCore/platform/graphics/nicosia/NicosiaPaintingContext.cpp.
1096         (Nicosia::PaintingOperationReplayCairo::PaintingOperationReplayCairo):
1097
1098 2018-03-09  Zan Dobersek  <zdobersek@igalia.com>
1099
1100         Remove some unused cruft in TextureMapperLayer.
1101
1102         The ScrollingClient class is not used anymore since r229318.
1103         findScrollableContentsLayerAt() is similarly unused, but also lacking
1104         an actual definition. ContentsLayerCount enum can also be purged.
1105
1106         Rubber-stamped by Carlos Garcia Campos.
1107
1108         * platform/graphics/texmap/TextureMapperLayer.h:
1109
1110 2018-03-08  Zan Dobersek  <zdobersek@igalia.com>
1111
1112         Add basic synchronization capability to Nicosia::Buffer
1113         https://bugs.webkit.org/show_bug.cgi?id=183500
1114
1115         Reviewed by Carlos Garcia Campos.
1116
1117         Have Nicosia::Buffer track a painting state, and allow that state to be
1118         modified and accessed from different threads. The PaintingState enum
1119         value is protected by a Lock object, and can be modified via the
1120         beginPainting() and completePainting() methods. Additionally, the
1121         waitUntilPaintingComplete() method allows the caller to wait until the
1122         painting is complete for the given Nicosia::Buffer object.
1123
1124         This added state doesn't affect a Nicosia::Buffer object internally, and
1125         doesn't have any effect on  existing usages of Nicosia::Buffer (which
1126         are not multi-threaded).
1127
1128         * platform/graphics/nicosia/NicosiaBuffer.cpp:
1129         (Nicosia::Buffer::beginPainting):
1130         (Nicosia::Buffer::completePainting):
1131         (Nicosia::Buffer::waitUntilPaintingComplete):
1132         * platform/graphics/nicosia/NicosiaBuffer.h:
1133
1134 2018-03-08  Zan Dobersek  <zdobersek@igalia.com>
1135
1136         Move NicosiaPaintingContextCairo files under Cairo-specific directory
1137         https://bugs.webkit.org/show_bug.cgi?id=183497
1138
1139         Reviewed by Carlos Garcia Campos.
1140
1141         Pack Cairo-specific files in the Nicosia subsystem under cairo/.
1142
1143         * platform/TextureMapper.cmake:
1144         * platform/graphics/nicosia/cairo/NicosiaPaintingContextCairo.cpp: Renamed from Source/WebCore/platform/graphics/nicosia/NicosiaPaintingContextCairo.cpp.
1145         * platform/graphics/nicosia/cairo/NicosiaPaintingContextCairo.h: Renamed from Source/WebCore/platform/graphics/nicosia/NicosiaPaintingContextCairo.h.
1146
1147 2018-03-08  Nan Wang  <n_wang@apple.com>
1148
1149         AX: AOM: More accessibility events support
1150         https://bugs.webkit.org/show_bug.cgi?id=183023
1151         <rdar://problem/37764380>
1152
1153         Reviewed by Chris Fleizach.
1154
1155         Fixed the crash that we shouldn't dispatch the accessibility events if the
1156         event path is empty.
1157
1158         Also added a check to not dispatch events if the runtime flag is not enabled.
1159
1160         Test: accessibility/mac/AOM-events-webarea-crash.html
1161
1162         * accessibility/AccessibilityObject.cpp:
1163         (WebCore::AccessibilityObject::shouldDispatchAccessibilityEvent const):
1164         (WebCore::AccessibilityObject::dispatchAccessibilityEvent const):
1165         * accessibility/AccessibilityObject.h:
1166
1167 2018-03-08  Megan Gardner  <megan_gardner@apple.com>
1168
1169         Allow WebViews to disable system appearance
1170         https://bugs.webkit.org/show_bug.cgi?id=183418
1171         <rdar://problem/36975642>
1172
1173         Reviewed by Tim Horton.
1174
1175         Not currently testable, tests will be added in a later patch.
1176
1177         Allow webviews to choose whether or not to follow the default system appearance.
1178
1179         * css/StyleColor.cpp:
1180         (WebCore::StyleColor::colorFromKeyword):
1181         * css/StyleColor.h:
1182         * css/StyleResolver.cpp:
1183         (WebCore::StyleResolver::colorFromPrimitiveValue const):
1184         * css/parser/CSSParser.cpp:
1185         (WebCore::CSSParser::parseSystemColor):
1186         * css/parser/CSSParser.h:
1187         * css/parser/CSSParserMode.h:
1188         * html/canvas/CanvasRenderingContext2D.cpp:
1189         (WebCore::CanvasRenderingContext2D::drawFocusIfNeededInternal):
1190         * html/canvas/CanvasRenderingContext2DBase.cpp:
1191         (WebCore::CanvasRenderingContext2DBase::setStrokeColor):
1192         (WebCore::CanvasRenderingContext2DBase::setFillColor):
1193         * html/canvas/CanvasStyle.cpp:
1194         (WebCore::parseColor):
1195         (WebCore::parseColorOrCurrentColor):
1196         (WebCore::CanvasStyle::createFromString):
1197         (WebCore::CanvasStyle::createFromStringWithOverrideAlpha):
1198         * html/canvas/CanvasStyle.h:
1199         * page/Page.h:
1200         (WebCore::Page::useSystemAppearance const):
1201         (WebCore::Page::setUseSystemAppearance):
1202         * platform/Theme.cpp:
1203         (WebCore::Theme::paint):
1204         * platform/Theme.h:
1205         * platform/mac/LocalDefaultSystemAppearance.h:
1206         * platform/mac/LocalDefaultSystemAppearance.mm:
1207         (WebCore::LocalDefaultSystemAppearance::LocalDefaultSystemAppearance):
1208         (WebCore::LocalDefaultSystemAppearance::~LocalDefaultSystemAppearance):
1209         * platform/mac/ThemeMac.h:
1210         * platform/mac/ThemeMac.mm:
1211         (-[WebCoreThemeView initWithUseSystemAppearance:]):
1212         (WebCore::paintToggleButton):
1213         (WebCore::paintButton):
1214         (WebCore::ThemeMac::ensuredView):
1215         (WebCore::ThemeMac::drawCellOrFocusRingWithViewIntoContext):
1216         (WebCore::ThemeMac::paint):
1217         (-[WebCoreThemeView init]): Deleted.
1218         * rendering/RenderTheme.cpp:
1219         (WebCore::RenderTheme::paint):
1220         (WebCore::RenderTheme::systemColor const):
1221         (WebCore::RenderTheme::focusRingColor):
1222         * rendering/RenderTheme.h:
1223         (WebCore::RenderTheme::platformFocusRingColor const):
1224         * rendering/RenderThemeIOS.mm:
1225         (WebCore::RenderThemeIOS::systemColor const):
1226         * rendering/RenderThemeMac.h:
1227         * rendering/RenderThemeMac.mm:
1228         (WebCore::RenderThemeMac::documentViewFor const):
1229         (WebCore::RenderThemeMac::platformFocusRingColor const):
1230         (WebCore::RenderThemeMac::systemColor const):
1231         (WebCore::RenderThemeMac::paintCellAndSetFocusedElementNeedsRepaintIfNecessary):
1232         (WebCore::RenderThemeMac::paintSliderThumb):
1233         * rendering/TextPaintStyle.cpp:
1234         (WebCore::computeTextPaintStyle):
1235
1236 2018-03-08  Megan Gardner  <megan_gardner@apple.com>
1237
1238         Ensure default appearance for selection form control
1239         https://bugs.webkit.org/show_bug.cgi?id=183482
1240         <rdar://problem/38274894>
1241
1242         Reviewed by Tim Horton.
1243   
1244         The appearance for selection form controls was not set to default.
1245
1246         Not currently testable, will add tests in a later patch.
1247
1248         * rendering/RenderThemeMac.mm:
1249         (WebCore::RenderThemeMac::platformInactiveListBoxSelectionBackgroundColor const):
1250
1251 2018-03-08  Per Arne Vollan  <pvollan@apple.com>
1252
1253         [Win] Compile error: pal/ExportMacros.h not found.
1254         https://bugs.webkit.org/show_bug.cgi?id=183467
1255
1256         Reviewed by Brent Fulgham.
1257
1258         PAL header files are no longer located under the WebCore folder in forwarding headers. An additional
1259         build step is required to copy the PAL header files to the internal include folder.
1260
1261         No new tests, no change in functionality. 
1262
1263         * PlatformWin.cmake:
1264         * WebCore.vcxproj/WebCore.proj:
1265
1266 2018-03-08  Megan Gardner  <megan_gardner@apple.com>
1267
1268         Ensure system appearance is default for legacy webkit
1269         https://bugs.webkit.org/show_bug.cgi?id=183473
1270         <rdar://problem/38210306>
1271
1272         Reviewed by Tim Horton.
1273
1274         Need to set the appearance on the window for legacy webkit due to differences in drawing.
1275
1276         Not currently testable, will add tests in a later patch.
1277
1278         * platform/mac/ThemeMac.mm:
1279         (WebCore::paintButton):
1280
1281 2018-03-08  Youenn Fablet  <youenn@apple.com>
1282
1283         libwebrtc update broke internal builds
1284         https://bugs.webkit.org/show_bug.cgi?id=183454
1285
1286         Reviewed by Eric Carlson.
1287
1288         No change of behavior.
1289         Fixed header search paths.
1290         Removed deleted file from XCode project as an additional clean-up.
1291
1292         * Configurations/WebCore.xcconfig:
1293         * WebCore.xcodeproj/project.pbxproj:
1294
1295 2018-03-08  Per Arne Vollan  <pvollan@apple.com>
1296
1297         NSAnimation is not working in the WebContent process when WindowServer access is blocked.
1298         https://bugs.webkit.org/show_bug.cgi?id=183291
1299
1300         Reviewed by Dean Jackson.
1301
1302         The animation can be implemented by using an NSTimer instead. Use the existing Bezier timing
1303         function to create a smooth animation.
1304
1305         No new tests. This code is used to fade scrollbars in and out by animating the alpha value.
1306         This scrollbar setting is not the default in macOS, which makes it non trivial to create
1307         layout tests for this.
1308
1309         * platform/mac/ScrollAnimatorMac.mm:
1310         (-[WebScrollbarPartAnimation initWithScrollbar:featureToAnimate:animateFrom:animateTo:duration:]):
1311         (-[WebScrollbarPartAnimation startAnimation]):
1312         (-[WebScrollbarPartAnimation setCurrentProgress:setCurrentProgress:]):
1313         (-[WebScrollbarPartAnimation invalidate]):
1314         (-[WebScrollbarPartAnimation setDuration:]):
1315         (-[WebScrollbarPartAnimation stopAnimation]):
1316         (-[WebScrollbarPartAnimation setCurrentProgress:]): Deleted.
1317
1318 2018-03-08  Said Abou-Hallawa  <sabouhallawa@apple.com>
1319
1320         Templatize SVGAnimatedType
1321         https://bugs.webkit.org/show_bug.cgi?id=183017
1322
1323         Reviewed by Dean Jackson.
1324
1325         This is a work toward https://bugs.webkit.org/show_bug.cgi?id=168586. The
1326         goal to have SVGAnimatedType be type independent. The appropriate method
1327         of this template will be implicitly instantiated based to the type of the
1328         animated attribute(s).
1329
1330         * Sources.txt: Delete SVGAnimatedType.cpp since its function became template
1331         functions or short enough to be inline functions.
1332         * WebCore.xcodeproj/project.pbxproj:
1333         * svg/SVGAnimatedAngle.cpp:
1334         (WebCore::SVGAnimatedAngleAnimator::constructFromString):
1335         (WebCore::SVGAnimatedAngleAnimator::startAnimValAnimation):
1336         (WebCore::SVGAnimatedAngleAnimator::resetAnimValToBaseVal):
1337         (WebCore::SVGAnimatedAngleAnimator::addAnimatedTypes):
1338         (WebCore::SVGAnimatedAngleAnimator::calculateAnimatedValue):
1339         Use the template functions SVGAnimatedType::create<>() and SVGAnimatedType::as<>().
1340
1341         * svg/SVGAnimatedBoolean.cpp:
1342         (WebCore::SVGAnimatedBooleanAnimator::constructFromString):
1343         (WebCore::SVGAnimatedBooleanAnimator::startAnimValAnimation):
1344         (WebCore::SVGAnimatedBooleanAnimator::resetAnimValToBaseVal):
1345         (WebCore::SVGAnimatedBooleanAnimator::calculateAnimatedValue):
1346         Ditto.
1347
1348         * svg/SVGAnimatedColor.cpp:
1349         (WebCore::SVGAnimatedColorAnimator::constructFromString):
1350         (WebCore::SVGAnimatedColorAnimator::addAnimatedTypes):
1351         (WebCore::SVGAnimatedColorAnimator::calculateAnimatedValue):
1352         Ditto.
1353
1354         * svg/SVGAnimatedEnumeration.cpp:
1355         (WebCore::SVGAnimatedEnumerationAnimator::constructFromString):
1356         (WebCore::SVGAnimatedEnumerationAnimator::startAnimValAnimation):
1357         (WebCore::SVGAnimatedEnumerationAnimator::resetAnimValToBaseVal):
1358         (WebCore::SVGAnimatedEnumerationAnimator::calculateAnimatedValue):
1359         Ditto.
1360
1361         * svg/SVGAnimatedInteger.cpp:
1362         (WebCore::SVGAnimatedIntegerAnimator::constructFromString):
1363         (WebCore::SVGAnimatedIntegerAnimator::startAnimValAnimation):
1364         (WebCore::SVGAnimatedIntegerAnimator::resetAnimValToBaseVal):
1365         (WebCore::SVGAnimatedIntegerAnimator::addAnimatedTypes):
1366         (WebCore::SVGAnimatedIntegerAnimator::calculateAnimatedValue):
1367         Ditto.
1368
1369         * svg/SVGAnimatedIntegerOptionalInteger.cpp:
1370         (WebCore::SVGAnimatedIntegerOptionalIntegerAnimator::constructFromString):
1371         (WebCore::SVGAnimatedIntegerOptionalIntegerAnimator::startAnimValAnimation):
1372         (WebCore::SVGAnimatedIntegerOptionalIntegerAnimator::resetAnimValToBaseVal):
1373         (WebCore::SVGAnimatedIntegerOptionalIntegerAnimator::addAnimatedTypes):
1374         (WebCore::SVGAnimatedIntegerOptionalIntegerAnimator::calculateAnimatedValue):
1375         Ditto.
1376
1377         * svg/SVGAnimatedLength.cpp:
1378         (WebCore::SVGAnimatedLengthAnimator::constructFromString):
1379         (WebCore::SVGAnimatedLengthAnimator::startAnimValAnimation):
1380         (WebCore::SVGAnimatedLengthAnimator::resetAnimValToBaseVal):
1381         (WebCore::SVGAnimatedLengthAnimator::addAnimatedTypes):
1382         (WebCore::SVGAnimatedLengthAnimator::calculateAnimatedValue):
1383         Ditto.
1384
1385         * svg/SVGAnimatedLengthList.cpp:
1386         (WebCore::SVGAnimatedLengthListAnimator::constructFromString):
1387         (WebCore::SVGAnimatedLengthListAnimator::startAnimValAnimation):
1388         (WebCore::SVGAnimatedLengthListAnimator::resetAnimValToBaseVal):
1389         (WebCore::SVGAnimatedLengthListAnimator::addAnimatedTypes):
1390         (WebCore::SVGAnimatedLengthListAnimator::calculateAnimatedValue):
1391         Ditto.
1392
1393         * svg/SVGAnimatedNumber.cpp:
1394         (WebCore::SVGAnimatedNumberAnimator::constructFromString):
1395         (WebCore::SVGAnimatedNumberAnimator::startAnimValAnimation):
1396         (WebCore::SVGAnimatedNumberAnimator::resetAnimValToBaseVal):
1397         (WebCore::SVGAnimatedNumberAnimator::addAnimatedTypes):
1398         (WebCore::SVGAnimatedNumberAnimator::calculateAnimatedValue):
1399         Ditto.
1400
1401         * svg/SVGAnimatedNumberList.cpp:
1402         (WebCore::SVGAnimatedNumberListAnimator::constructFromString):
1403         (WebCore::SVGAnimatedNumberListAnimator::startAnimValAnimation):
1404         (WebCore::SVGAnimatedNumberListAnimator::resetAnimValToBaseVal):
1405         (WebCore::SVGAnimatedNumberListAnimator::addAnimatedTypes):
1406         (WebCore::SVGAnimatedNumberListAnimator::calculateAnimatedValue):
1407         Ditto.
1408
1409         * svg/SVGAnimatedNumberOptionalNumber.cpp:
1410         (WebCore::SVGAnimatedNumberOptionalNumberAnimator::constructFromString):
1411         (WebCore::SVGAnimatedNumberOptionalNumberAnimator::startAnimValAnimation):
1412         (WebCore::SVGAnimatedNumberOptionalNumberAnimator::resetAnimValToBaseVal):
1413         (WebCore::SVGAnimatedNumberOptionalNumberAnimator::addAnimatedTypes):
1414         (WebCore::SVGAnimatedNumberOptionalNumberAnimator::calculateAnimatedValue):
1415         Ditto.
1416
1417         * svg/SVGAnimatedPath.cpp:
1418         (WebCore::SVGAnimatedPathAnimator::constructFromString):
1419         (WebCore::SVGAnimatedPathAnimator::startAnimValAnimation):
1420         (WebCore::SVGAnimatedPathAnimator::resetAnimValToBaseVal):
1421         (WebCore::SVGAnimatedPathAnimator::addAnimatedTypes):
1422         (WebCore::SVGAnimatedPathAnimator::calculateAnimatedValue):
1423         Ditto.
1424
1425         * svg/SVGAnimatedPointList.cpp:
1426         (WebCore::SVGAnimatedPointListAnimator::constructFromString):
1427         (WebCore::SVGAnimatedPointListAnimator::startAnimValAnimation):
1428         (WebCore::SVGAnimatedPointListAnimator::resetAnimValToBaseVal):
1429         (WebCore::SVGAnimatedPointListAnimator::addAnimatedTypes):
1430         (WebCore::SVGAnimatedPointListAnimator::calculateAnimatedValue):
1431         Ditto.
1432
1433         * svg/SVGAnimatedPreserveAspectRatio.cpp:
1434         (WebCore::SVGAnimatedPreserveAspectRatioAnimator::constructFromString):
1435         (WebCore::SVGAnimatedPreserveAspectRatioAnimator::startAnimValAnimation):
1436         (WebCore::SVGAnimatedPreserveAspectRatioAnimator::resetAnimValToBaseVal):
1437         (WebCore::SVGAnimatedPreserveAspectRatioAnimator::calculateAnimatedValue):
1438         Ditto.
1439
1440         * svg/SVGAnimatedRect.cpp:
1441         (WebCore::SVGAnimatedRectAnimator::constructFromString):
1442         (WebCore::SVGAnimatedRectAnimator::startAnimValAnimation):
1443         (WebCore::SVGAnimatedRectAnimator::resetAnimValToBaseVal):
1444         (WebCore::SVGAnimatedRectAnimator::addAnimatedTypes):
1445         (WebCore::SVGAnimatedRectAnimator::calculateAnimatedValue):
1446         Ditto.
1447
1448         * svg/SVGAnimatedString.cpp:
1449         (WebCore::SVGAnimatedStringAnimator::constructFromString):
1450         (WebCore::SVGAnimatedStringAnimator::startAnimValAnimation):
1451         (WebCore::SVGAnimatedStringAnimator::resetAnimValToBaseVal):
1452         (WebCore::SVGAnimatedStringAnimator::calculateAnimatedValue):
1453         Ditto.
1454
1455         * svg/SVGAnimatedTransformList.cpp:
1456         (WebCore::SVGAnimatedTransformListAnimator::constructFromString):
1457         (WebCore::SVGAnimatedTransformListAnimator::startAnimValAnimation):
1458         (WebCore::SVGAnimatedTransformListAnimator::resetAnimValToBaseVal):
1459         (WebCore::SVGAnimatedTransformListAnimator::addAnimatedTypes):
1460         (WebCore::SVGAnimatedTransformListAnimator::calculateAnimatedValue):
1461         (WebCore::SVGAnimatedTransformListAnimator::calculateDistance):
1462         Ditto.
1463
1464         * svg/SVGAnimatedType.cpp: Removed.
1465         * svg/SVGAnimatedType.h:
1466         (WebCore::SVGAnimatedType::create):
1467         (WebCore::SVGAnimatedType::SVGAnimatedType):
1468         (WebCore::SVGAnimatedType::~SVGAnimatedType):
1469         (WebCore::SVGAnimatedType::as const):
1470         (WebCore::SVGAnimatedType::as):
1471         (WebCore::SVGAnimatedType::type const):
1472         (WebCore::SVGAnimatedType::valueAsString const):
1473         (WebCore::SVGAnimatedType::setValueAsString):
1474         (WebCore::SVGAnimatedType::supportsAnimVal):
1475         (WebCore::SVGAnimatedType::angleAndEnumeration const): Deleted.
1476         (WebCore::SVGAnimatedType::boolean const): Deleted.
1477         (WebCore::SVGAnimatedType::color const): Deleted.
1478         (WebCore::SVGAnimatedType::enumeration const): Deleted.
1479         (WebCore::SVGAnimatedType::integer const): Deleted.
1480         (WebCore::SVGAnimatedType::integerOptionalInteger const): Deleted.
1481         (WebCore::SVGAnimatedType::length const): Deleted.
1482         (WebCore::SVGAnimatedType::lengthList const): Deleted.
1483         (WebCore::SVGAnimatedType::number const): Deleted.
1484         (WebCore::SVGAnimatedType::numberList const): Deleted.
1485         (WebCore::SVGAnimatedType::numberOptionalNumber const): Deleted.
1486         (WebCore::SVGAnimatedType::path const): Deleted.
1487         (WebCore::SVGAnimatedType::pointList const): Deleted.
1488         (WebCore::SVGAnimatedType::preserveAspectRatio const): Deleted.
1489         (WebCore::SVGAnimatedType::rect const): Deleted.
1490         (WebCore::SVGAnimatedType::string const): Deleted.
1491         (WebCore::SVGAnimatedType::transformList const): Deleted.
1492         (WebCore::SVGAnimatedType::angleAndEnumeration): Deleted.
1493         (WebCore::SVGAnimatedType::boolean): Deleted.
1494         (WebCore::SVGAnimatedType::color): Deleted.
1495         (WebCore::SVGAnimatedType::enumeration): Deleted.
1496         (WebCore::SVGAnimatedType::integer): Deleted.
1497         (WebCore::SVGAnimatedType::integerOptionalInteger): Deleted.
1498         (WebCore::SVGAnimatedType::length): Deleted.
1499         (WebCore::SVGAnimatedType::lengthList): Deleted.
1500         (WebCore::SVGAnimatedType::number): Deleted.
1501         (WebCore::SVGAnimatedType::numberList): Deleted.
1502         (WebCore::SVGAnimatedType::numberOptionalNumber): Deleted.
1503         (WebCore::SVGAnimatedType::path): Deleted.
1504         (WebCore::SVGAnimatedType::pointList): Deleted.
1505         (WebCore::SVGAnimatedType::preserveAspectRatio): Deleted.
1506         (WebCore::SVGAnimatedType::rect): Deleted.
1507         (WebCore::SVGAnimatedType::string): Deleted.
1508         (WebCore::SVGAnimatedType::transformList): Deleted.
1509         Replace the union by a Variant. Replace all the type specific functions
1510         by the template functions create() and as(). Use WTF::visit to get the
1511         value stored in the variant. Use the SVGPropertyTraits to perform the
1512         required operation.
1513
1514         * svg/SVGAnimatedTypeAnimator.h:
1515         (WebCore::SVGAnimatedTypeAnimator::constructFromBaseValue):
1516         (WebCore::SVGAnimatedTypeAnimator::resetFromBaseValue):
1517         (WebCore::SVGAnimatedTypeAnimator::stopAnimValAnimationForType):
1518         (WebCore::SVGAnimatedTypeAnimator::animValDidChangeForType):
1519         (WebCore::SVGAnimatedTypeAnimator::animValWillChangeForType):
1520         (WebCore::SVGAnimatedTypeAnimator::constructFromBaseValues):
1521         (WebCore::SVGAnimatedTypeAnimator::resetFromBaseValues):
1522         (WebCore::SVGAnimatedTypeAnimator::stopAnimValAnimationForTypes):
1523         (WebCore::SVGAnimatedTypeAnimator::animValDidChangeForTypes):
1524         (WebCore::SVGAnimatedTypeAnimator::animValWillChangeForTypes):
1525         (WebCore::SVGAnimatedTypeAnimator::executeAction):
1526         Rename the parameters and the local variables to match their types. Use
1527         the SVGAnimatedType template functions create() and as().
1528
1529         * svg/SVGLengthValue.h:
1530         (WebCore::SVGPropertyTraits<SVGLengthValue>::parse): This was moved from
1531         SVGAnimatedType::setValueAsString()
1532         (WebCore::SVGPropertyTraits<SVGLengthValue>::toString): This was moved from
1533         SVGAnimatedType::valueAsString().
1534
1535         * svg/SVGMarkerTypes.h: Add placeholders for parse() and toString() so
1536         SVGAnimatedType::valueAsString() and setValueAsString() can compile for 
1537         all types.
1538
1539         * svg/SVGNumberListValues.h:
1540         (WebCore::SVGPropertyTraits<SVGNumberListValues>::parse):
1541         * svg/SVGPathByteStream.h:
1542         (WebCore::SVGPropertyTraits<SVGPathByteStream>::parse):
1543         (WebCore::SVGPropertyTraits<SVGPathByteStream>::toString):
1544         * svg/SVGPointListValues.h:
1545         (WebCore::SVGPropertyTraits<SVGPointListValues>::parse):
1546         (WebCore::SVGPropertyTraits<SVGPointListValues>::toString):
1547         * svg/SVGPreserveAspectRatioValue.h:
1548         (WebCore::SVGPropertyTraits<SVGPreserveAspectRatioValue>::fromString):
1549         (WebCore::SVGPropertyTraits<SVGPreserveAspectRatioValue>::parse):
1550         (WebCore::SVGPropertyTraits<SVGPreserveAspectRatioValue>::toString):
1551         Ditto.
1552
1553         * svg/SVGTransformListValues.h:
1554         (WebCore::SVGPropertyTraits<SVGTransformListValues>::parse):
1555         Ditto.
1556
1557         * svg/SVGValue.h: Added. SVGValueVariant is the replacement of the union
1558         SVGAnimatedType::DataUnion.
1559
1560         * svg/properties/SVGPropertyInfo.h:
1561         Add a minimum and maximum AnimatedPropertyType so, SVGAnimatedType::type()
1562         can assert that the index of the variant is in the range of this enum.
1563
1564         * svg/properties/SVGPropertyTraits.h:
1565         (WebCore::SVGPropertyTraits<bool>::parse):
1566         (WebCore::SVGPropertyTraits<unsigned>::parse):
1567         (WebCore::SVGPropertyTraits<int>::parse):
1568         Ditto.
1569
1570 2018-03-08  Yusuke Suzuki  <utatane.tea@gmail.com>
1571
1572         [JSC][WebCore] Extend jsDynamicCast for WebCore types in WebCore and remove jsDynamicDowncast
1573         https://bugs.webkit.org/show_bug.cgi?id=183449
1574
1575         Reviewed by Mark Lam.
1576
1577         This patch removes jsDynamicDowncast. Our JSC::jsDynamicCast can have a way to inject a fast
1578         path that is similar to jsDynamicDowncast. WebCore can leverage this functionality to add
1579         a fast path for WebCore's extended JS object types (JSEvent, JSElement, JSNode, and JSDocument).
1580
1581         No behavior change.
1582
1583         * WebCore.xcodeproj/project.pbxproj:
1584         * bindings/js/CommonVM.cpp:
1585         (WebCore::lexicalFrameFromCommonVM):
1586         * bindings/js/JSDOMConvertBufferSource.h:
1587         (WebCore::toPossiblySharedArrayBufferView):
1588         * bindings/js/JSDOMConvertPromise.h:
1589         (WebCore::Converter<IDLPromise<T>>::convert):
1590         * bindings/js/JSDOMExceptionHandling.cpp:
1591         (WebCore::reportException):
1592         (WebCore::retrieveErrorMessage):
1593         * bindings/js/JSDOMIterator.h:
1594         (WebCore::IteratorTraits>::next):
1595         * bindings/js/JSDOMWindowProxy.cpp:
1596         (WebCore::JSDOMWindowProxy::toWrapped):
1597         * bindings/js/JSDOMWrapperCache.h:
1598         * bindings/js/JSDocumentCustom.h:
1599         (JSC::JSCastingHelpers::InheritsTraits<WebCore::JSDocument>::inherits):
1600         (WebCore::jsDocumentCast): Deleted.
1601         * bindings/js/JSDynamicDowncast.h: Removed.
1602         * bindings/js/JSElementCustom.h:
1603         (JSC::JSCastingHelpers::InheritsTraits<WebCore::JSElement>::inherits):
1604         (WebCore::jsElementCast): Deleted.
1605         * bindings/js/JSEventCustom.h:
1606         (JSC::JSCastingHelpers::InheritsTraits<WebCore::JSEvent>::inherits):
1607         (WebCore::jsEventCast): Deleted.
1608         * bindings/js/JSEventTargetCustom.cpp:
1609         (WebCore::jsEventTargetCast):
1610         * bindings/js/JSNodeCustom.h:
1611         (JSC::JSCastingHelpers::InheritsTraits<WebCore::JSNode>::inherits):
1612         (WebCore::jsNodeCast): Deleted.
1613         * bindings/js/JSPluginElementFunctions.cpp:
1614         (WebCore::pluginElementPropertyGetter):
1615         * bindings/js/JSReadableStreamSourceCustom.cpp:
1616         (WebCore::JSReadableStreamSource::start):
1617         * bindings/js/JSWorkerGlobalScopeBase.cpp:
1618         (WebCore::toJSDedicatedWorkerGlobalScope):
1619         (WebCore::toJSWorkerGlobalScope):
1620         (WebCore::toJSServiceWorkerGlobalScope):
1621         * bindings/js/ReadableStream.cpp:
1622         (WebCore::ReadableStream::create):
1623         (WebCore::ReadableStream::isDisturbed):
1624         * bindings/js/ReadableStream.h:
1625         (WebCore::JSReadableStreamWrapperConverter::toWrapped):
1626         * bindings/js/ScriptModuleLoader.cpp:
1627         (WebCore::ScriptModuleLoader::evaluate):
1628         * bindings/js/SerializedScriptValue.cpp:
1629         (WebCore::CloneSerializer::dumpIfTerminal):
1630         (WebCore::CloneSerializer::serialize):
1631         * bindings/js/StructuredClone.cpp:
1632         (WebCore::structuredCloneArrayBufferView):
1633         * bindings/scripts/CodeGeneratorJS.pm:
1634         (GetCastingHelperForThisObject):
1635         (GenerateImplementation):
1636         * bindings/scripts/test/JS/JSInterfaceName.cpp:
1637         (WebCore::jsInterfaceNameConstructor):
1638         (WebCore::setJSInterfaceNameConstructor):
1639         (WebCore::JSInterfaceName::toWrapped):
1640         * bindings/scripts/test/JS/JSMapLike.cpp:
1641         (WebCore::IDLAttribute<JSMapLike>::cast):
1642         (WebCore::IDLOperation<JSMapLike>::cast):
1643         (WebCore::jsMapLikeConstructor):
1644         (WebCore::setJSMapLikeConstructor):
1645         (WebCore::JSMapLike::toWrapped):
1646         * bindings/scripts/test/JS/JSReadOnlyMapLike.cpp:
1647         (WebCore::IDLAttribute<JSReadOnlyMapLike>::cast):
1648         (WebCore::IDLOperation<JSReadOnlyMapLike>::cast):
1649         (WebCore::jsReadOnlyMapLikeConstructor):
1650         (WebCore::setJSReadOnlyMapLikeConstructor):
1651         (WebCore::JSReadOnlyMapLike::toWrapped):
1652         * bindings/scripts/test/JS/JSTestActiveDOMObject.cpp:
1653         (WebCore::IDLAttribute<JSTestActiveDOMObject>::cast):
1654         (WebCore::IDLOperation<JSTestActiveDOMObject>::cast):
1655         (WebCore::jsTestActiveDOMObjectConstructor):
1656         (WebCore::setJSTestActiveDOMObjectConstructor):
1657         (WebCore::JSTestActiveDOMObject::toWrapped):
1658         * bindings/scripts/test/JS/JSTestCEReactions.cpp:
1659         (WebCore::IDLAttribute<JSTestCEReactions>::cast):
1660         (WebCore::IDLOperation<JSTestCEReactions>::cast):
1661         (WebCore::jsTestCEReactionsConstructor):
1662         (WebCore::setJSTestCEReactionsConstructor):
1663         (WebCore::JSTestCEReactions::toWrapped):
1664         * bindings/scripts/test/JS/JSTestCEReactionsStringifier.cpp:
1665         (WebCore::IDLAttribute<JSTestCEReactionsStringifier>::cast):
1666         (WebCore::IDLOperation<JSTestCEReactionsStringifier>::cast):
1667         (WebCore::jsTestCEReactionsStringifierConstructor):
1668         (WebCore::setJSTestCEReactionsStringifierConstructor):
1669         (WebCore::JSTestCEReactionsStringifier::toWrapped):
1670         * bindings/scripts/test/JS/JSTestCallTracer.cpp:
1671         (WebCore::IDLAttribute<JSTestCallTracer>::cast):
1672         (WebCore::IDLOperation<JSTestCallTracer>::cast):
1673         (WebCore::jsTestCallTracerConstructor):
1674         (WebCore::setJSTestCallTracerConstructor):
1675         (WebCore::JSTestCallTracer::toWrapped):
1676         * bindings/scripts/test/JS/JSTestClassWithJSBuiltinConstructor.cpp:
1677         (WebCore::jsTestClassWithJSBuiltinConstructorConstructor):
1678         (WebCore::setJSTestClassWithJSBuiltinConstructorConstructor):
1679         (WebCore::JSTestClassWithJSBuiltinConstructor::toWrapped):
1680         * bindings/scripts/test/JS/JSTestCustomConstructorWithNoInterfaceObject.cpp:
1681         (WebCore::jsTestCustomConstructorWithNoInterfaceObjectConstructor):
1682         (WebCore::setJSTestCustomConstructorWithNoInterfaceObjectConstructor):
1683         (WebCore::JSTestCustomConstructorWithNoInterfaceObject::toWrapped):
1684         * bindings/scripts/test/JS/JSTestDOMJIT.cpp:
1685         (WebCore::IDLAttribute<JSTestDOMJIT>::cast):
1686         (WebCore::IDLOperation<JSTestDOMJIT>::cast):
1687         (WebCore::jsTestDOMJITConstructor):
1688         (WebCore::setJSTestDOMJITConstructor):
1689         * bindings/scripts/test/JS/JSTestEnabledBySetting.cpp:
1690         (WebCore::IDLAttribute<JSTestEnabledBySetting>::cast):
1691         (WebCore::IDLOperation<JSTestEnabledBySetting>::cast):
1692         (WebCore::jsTestEnabledBySettingConstructor):
1693         (WebCore::setJSTestEnabledBySettingConstructor):
1694         (WebCore::JSTestEnabledBySetting::toWrapped):
1695         * bindings/scripts/test/JS/JSTestEventConstructor.cpp:
1696         (WebCore::IDLAttribute<JSTestEventConstructor>::cast):
1697         (WebCore::jsTestEventConstructorConstructor):
1698         (WebCore::setJSTestEventConstructorConstructor):
1699         * bindings/scripts/test/JS/JSTestEventTarget.cpp:
1700         (WebCore::IDLOperation<JSTestEventTarget>::cast):
1701         (WebCore::jsTestEventTargetConstructor):
1702         (WebCore::setJSTestEventTargetConstructor):
1703         (WebCore::JSTestEventTarget::toWrapped):
1704         * bindings/scripts/test/JS/JSTestException.cpp:
1705         (WebCore::IDLAttribute<JSTestException>::cast):
1706         (WebCore::jsTestExceptionConstructor):
1707         (WebCore::setJSTestExceptionConstructor):
1708         (WebCore::JSTestException::toWrapped):
1709         * bindings/scripts/test/JS/JSTestGenerateIsReachable.cpp:
1710         (WebCore::IDLAttribute<JSTestGenerateIsReachable>::cast):
1711         (WebCore::jsTestGenerateIsReachableConstructor):
1712         (WebCore::setJSTestGenerateIsReachableConstructor):
1713         (WebCore::JSTestGenerateIsReachable::toWrapped):
1714         * bindings/scripts/test/JS/JSTestGlobalObject.cpp:
1715         (WebCore::IDLAttribute<JSTestGlobalObject>::cast):
1716         (WebCore::IDLOperation<JSTestGlobalObject>::cast):
1717         (WebCore::jsTestGlobalObjectConstructor):
1718         (WebCore::setJSTestGlobalObjectConstructor):
1719         (WebCore::JSTestGlobalObject::toWrapped):
1720         * bindings/scripts/test/JS/JSTestIndexedSetterNoIdentifier.cpp:
1721         (WebCore::jsTestIndexedSetterNoIdentifierConstructor):
1722         (WebCore::setJSTestIndexedSetterNoIdentifierConstructor):
1723         (WebCore::JSTestIndexedSetterNoIdentifier::toWrapped):
1724         * bindings/scripts/test/JS/JSTestIndexedSetterThrowingException.cpp:
1725         (WebCore::jsTestIndexedSetterThrowingExceptionConstructor):
1726         (WebCore::setJSTestIndexedSetterThrowingExceptionConstructor):
1727         (WebCore::JSTestIndexedSetterThrowingException::toWrapped):
1728         * bindings/scripts/test/JS/JSTestIndexedSetterWithIdentifier.cpp:
1729         (WebCore::IDLOperation<JSTestIndexedSetterWithIdentifier>::cast):
1730         (WebCore::jsTestIndexedSetterWithIdentifierConstructor):
1731         (WebCore::setJSTestIndexedSetterWithIdentifierConstructor):
1732         (WebCore::JSTestIndexedSetterWithIdentifier::toWrapped):
1733         * bindings/scripts/test/JS/JSTestInterface.cpp:
1734         (WebCore::IDLAttribute<JSTestInterface>::cast):
1735         (WebCore::IDLOperation<JSTestInterface>::cast):
1736         (WebCore::jsTestInterfaceConstructor):
1737         (WebCore::setJSTestInterfaceConstructor):
1738         (WebCore::JSTestInterface::toWrapped):
1739         * bindings/scripts/test/JS/JSTestInterfaceLeadingUnderscore.cpp:
1740         (WebCore::IDLAttribute<JSTestInterfaceLeadingUnderscore>::cast):
1741         (WebCore::jsTestInterfaceLeadingUnderscoreConstructor):
1742         (WebCore::setJSTestInterfaceLeadingUnderscoreConstructor):
1743         (WebCore::JSTestInterfaceLeadingUnderscore::toWrapped):
1744         * bindings/scripts/test/JS/JSTestIterable.cpp:
1745         (WebCore::IDLOperation<JSTestIterable>::cast):
1746         (WebCore::jsTestIterableConstructor):
1747         (WebCore::setJSTestIterableConstructor):
1748         (WebCore::JSTestIterable::toWrapped):
1749         * bindings/scripts/test/JS/JSTestJSBuiltinConstructor.cpp:
1750         (WebCore::IDLAttribute<JSTestJSBuiltinConstructor>::cast):
1751         (WebCore::IDLOperation<JSTestJSBuiltinConstructor>::cast):
1752         (WebCore::jsTestJSBuiltinConstructorConstructor):
1753         (WebCore::setJSTestJSBuiltinConstructorConstructor):
1754         * bindings/scripts/test/JS/JSTestMediaQueryListListener.cpp:
1755         (WebCore::IDLOperation<JSTestMediaQueryListListener>::cast):
1756         (WebCore::jsTestMediaQueryListListenerConstructor):
1757         (WebCore::setJSTestMediaQueryListListenerConstructor):
1758         (WebCore::JSTestMediaQueryListListener::toWrapped):
1759         * bindings/scripts/test/JS/JSTestNamedAndIndexedSetterNoIdentifier.cpp:
1760         (WebCore::jsTestNamedAndIndexedSetterNoIdentifierConstructor):
1761         (WebCore::setJSTestNamedAndIndexedSetterNoIdentifierConstructor):
1762         (WebCore::JSTestNamedAndIndexedSetterNoIdentifier::toWrapped):
1763         * bindings/scripts/test/JS/JSTestNamedAndIndexedSetterThrowingException.cpp:
1764         (WebCore::jsTestNamedAndIndexedSetterThrowingExceptionConstructor):
1765         (WebCore::setJSTestNamedAndIndexedSetterThrowingExceptionConstructor):
1766         (WebCore::JSTestNamedAndIndexedSetterThrowingException::toWrapped):
1767         * bindings/scripts/test/JS/JSTestNamedAndIndexedSetterWithIdentifier.cpp:
1768         (WebCore::IDLOperation<JSTestNamedAndIndexedSetterWithIdentifier>::cast):
1769         (WebCore::jsTestNamedAndIndexedSetterWithIdentifierConstructor):
1770         (WebCore::setJSTestNamedAndIndexedSetterWithIdentifierConstructor):
1771         (WebCore::JSTestNamedAndIndexedSetterWithIdentifier::toWrapped):
1772         * bindings/scripts/test/JS/JSTestNamedConstructor.cpp:
1773         (WebCore::jsTestNamedConstructorConstructor):
1774         (WebCore::setJSTestNamedConstructorConstructor):
1775         (WebCore::JSTestNamedConstructor::toWrapped):
1776         * bindings/scripts/test/JS/JSTestNamedDeleterNoIdentifier.cpp:
1777         (WebCore::jsTestNamedDeleterNoIdentifierConstructor):
1778         (WebCore::setJSTestNamedDeleterNoIdentifierConstructor):
1779         (WebCore::JSTestNamedDeleterNoIdentifier::toWrapped):
1780         * bindings/scripts/test/JS/JSTestNamedDeleterThrowingException.cpp:
1781         (WebCore::jsTestNamedDeleterThrowingExceptionConstructor):
1782         (WebCore::setJSTestNamedDeleterThrowingExceptionConstructor):
1783         (WebCore::JSTestNamedDeleterThrowingException::toWrapped):
1784         * bindings/scripts/test/JS/JSTestNamedDeleterWithIdentifier.cpp:
1785         (WebCore::IDLOperation<JSTestNamedDeleterWithIdentifier>::cast):
1786         (WebCore::jsTestNamedDeleterWithIdentifierConstructor):
1787         (WebCore::setJSTestNamedDeleterWithIdentifierConstructor):
1788         (WebCore::JSTestNamedDeleterWithIdentifier::toWrapped):
1789         * bindings/scripts/test/JS/JSTestNamedDeleterWithIndexedGetter.cpp:
1790         (WebCore::jsTestNamedDeleterWithIndexedGetterConstructor):
1791         (WebCore::setJSTestNamedDeleterWithIndexedGetterConstructor):
1792         (WebCore::JSTestNamedDeleterWithIndexedGetter::toWrapped):
1793         * bindings/scripts/test/JS/JSTestNamedGetterCallWith.cpp:
1794         (WebCore::jsTestNamedGetterCallWithConstructor):
1795         (WebCore::setJSTestNamedGetterCallWithConstructor):
1796         (WebCore::JSTestNamedGetterCallWith::toWrapped):
1797         * bindings/scripts/test/JS/JSTestNamedGetterNoIdentifier.cpp:
1798         (WebCore::jsTestNamedGetterNoIdentifierConstructor):
1799         (WebCore::setJSTestNamedGetterNoIdentifierConstructor):
1800         (WebCore::JSTestNamedGetterNoIdentifier::toWrapped):
1801         * bindings/scripts/test/JS/JSTestNamedGetterWithIdentifier.cpp:
1802         (WebCore::IDLOperation<JSTestNamedGetterWithIdentifier>::cast):
1803         (WebCore::jsTestNamedGetterWithIdentifierConstructor):
1804         (WebCore::setJSTestNamedGetterWithIdentifierConstructor):
1805         (WebCore::JSTestNamedGetterWithIdentifier::toWrapped):
1806         * bindings/scripts/test/JS/JSTestNamedSetterNoIdentifier.cpp:
1807         (WebCore::jsTestNamedSetterNoIdentifierConstructor):
1808         (WebCore::setJSTestNamedSetterNoIdentifierConstructor):
1809         (WebCore::JSTestNamedSetterNoIdentifier::toWrapped):
1810         * bindings/scripts/test/JS/JSTestNamedSetterThrowingException.cpp:
1811         (WebCore::jsTestNamedSetterThrowingExceptionConstructor):
1812         (WebCore::setJSTestNamedSetterThrowingExceptionConstructor):
1813         (WebCore::JSTestNamedSetterThrowingException::toWrapped):
1814         * bindings/scripts/test/JS/JSTestNamedSetterWithIdentifier.cpp:
1815         (WebCore::IDLOperation<JSTestNamedSetterWithIdentifier>::cast):
1816         (WebCore::jsTestNamedSetterWithIdentifierConstructor):
1817         (WebCore::setJSTestNamedSetterWithIdentifierConstructor):
1818         (WebCore::JSTestNamedSetterWithIdentifier::toWrapped):
1819         * bindings/scripts/test/JS/JSTestNamedSetterWithIndexedGetter.cpp:
1820         (WebCore::IDLOperation<JSTestNamedSetterWithIndexedGetter>::cast):
1821         (WebCore::jsTestNamedSetterWithIndexedGetterConstructor):
1822         (WebCore::setJSTestNamedSetterWithIndexedGetterConstructor):
1823         (WebCore::JSTestNamedSetterWithIndexedGetter::toWrapped):
1824         * bindings/scripts/test/JS/JSTestNamedSetterWithIndexedGetterAndSetter.cpp:
1825         (WebCore::IDLOperation<JSTestNamedSetterWithIndexedGetterAndSetter>::cast):
1826         (WebCore::jsTestNamedSetterWithIndexedGetterAndSetterConstructor):
1827         (WebCore::setJSTestNamedSetterWithIndexedGetterAndSetterConstructor):
1828         (WebCore::JSTestNamedSetterWithIndexedGetterAndSetter::toWrapped):
1829         * bindings/scripts/test/JS/JSTestNamedSetterWithOverrideBuiltins.cpp:
1830         (WebCore::jsTestNamedSetterWithOverrideBuiltinsConstructor):
1831         (WebCore::setJSTestNamedSetterWithOverrideBuiltinsConstructor):
1832         (WebCore::JSTestNamedSetterWithOverrideBuiltins::toWrapped):
1833         * bindings/scripts/test/JS/JSTestNamedSetterWithUnforgableProperties.cpp:
1834         (WebCore::IDLAttribute<JSTestNamedSetterWithUnforgableProperties>::cast):
1835         (WebCore::IDLOperation<JSTestNamedSetterWithUnforgableProperties>::cast):
1836         (WebCore::jsTestNamedSetterWithUnforgablePropertiesConstructor):
1837         (WebCore::setJSTestNamedSetterWithUnforgablePropertiesConstructor):
1838         (WebCore::JSTestNamedSetterWithUnforgableProperties::toWrapped):
1839         * bindings/scripts/test/JS/JSTestNamedSetterWithUnforgablePropertiesAndOverrideBuiltins.cpp:
1840         (WebCore::IDLAttribute<JSTestNamedSetterWithUnforgablePropertiesAndOverrideBuiltins>::cast):
1841         (WebCore::IDLOperation<JSTestNamedSetterWithUnforgablePropertiesAndOverrideBuiltins>::cast):
1842         (WebCore::jsTestNamedSetterWithUnforgablePropertiesAndOverrideBuiltinsConstructor):
1843         (WebCore::setJSTestNamedSetterWithUnforgablePropertiesAndOverrideBuiltinsConstructor):
1844         (WebCore::JSTestNamedSetterWithUnforgablePropertiesAndOverrideBuiltins::toWrapped):
1845         * bindings/scripts/test/JS/JSTestNode.cpp:
1846         (WebCore::IDLAttribute<JSTestNode>::cast):
1847         (WebCore::IDLOperation<JSTestNode>::cast):
1848         (WebCore::jsTestNodeConstructor):
1849         (WebCore::setJSTestNodeConstructor):
1850         * bindings/scripts/test/JS/JSTestObj.cpp:
1851         (WebCore::IDLAttribute<JSTestObj>::cast):
1852         (WebCore::IDLOperation<JSTestObj>::cast):
1853         (WebCore::jsTestObjConstructor):
1854         (WebCore::setJSTestObjConstructor):
1855         (WebCore::JSTestObj::toWrapped):
1856         * bindings/scripts/test/JS/JSTestOverloadedConstructors.cpp:
1857         (WebCore::jsTestOverloadedConstructorsConstructor):
1858         (WebCore::setJSTestOverloadedConstructorsConstructor):
1859         (WebCore::JSTestOverloadedConstructors::toWrapped):
1860         * bindings/scripts/test/JS/JSTestOverloadedConstructorsWithSequence.cpp:
1861         (WebCore::jsTestOverloadedConstructorsWithSequenceConstructor):
1862         (WebCore::setJSTestOverloadedConstructorsWithSequenceConstructor):
1863         (WebCore::JSTestOverloadedConstructorsWithSequence::toWrapped):
1864         * bindings/scripts/test/JS/JSTestOverrideBuiltins.cpp:
1865         (WebCore::IDLOperation<JSTestOverrideBuiltins>::cast):
1866         (WebCore::jsTestOverrideBuiltinsConstructor):
1867         (WebCore::setJSTestOverrideBuiltinsConstructor):
1868         (WebCore::JSTestOverrideBuiltins::toWrapped):
1869         * bindings/scripts/test/JS/JSTestPluginInterface.cpp:
1870         (WebCore::jsTestPluginInterfaceConstructor):
1871         (WebCore::setJSTestPluginInterfaceConstructor):
1872         (WebCore::JSTestPluginInterface::toWrapped):
1873         * bindings/scripts/test/JS/JSTestPromiseRejectionEvent.cpp:
1874         (WebCore::IDLAttribute<JSTestPromiseRejectionEvent>::cast):
1875         (WebCore::jsTestPromiseRejectionEventConstructor):
1876         (WebCore::setJSTestPromiseRejectionEventConstructor):
1877         * bindings/scripts/test/JS/JSTestSerialization.cpp:
1878         (WebCore::IDLAttribute<JSTestSerialization>::cast):
1879         (WebCore::IDLOperation<JSTestSerialization>::cast):
1880         (WebCore::jsTestSerializationConstructor):
1881         (WebCore::setJSTestSerializationConstructor):
1882         (WebCore::JSTestSerialization::toWrapped):
1883         * bindings/scripts/test/JS/JSTestSerializationIndirectInheritance.cpp:
1884         (WebCore::jsTestSerializationIndirectInheritanceConstructor):
1885         (WebCore::setJSTestSerializationIndirectInheritanceConstructor):
1886         * bindings/scripts/test/JS/JSTestSerializationInherit.cpp:
1887         (WebCore::IDLAttribute<JSTestSerializationInherit>::cast):
1888         (WebCore::IDLOperation<JSTestSerializationInherit>::cast):
1889         (WebCore::jsTestSerializationInheritConstructor):
1890         (WebCore::setJSTestSerializationInheritConstructor):
1891         * bindings/scripts/test/JS/JSTestSerializationInheritFinal.cpp:
1892         (WebCore::IDLAttribute<JSTestSerializationInheritFinal>::cast):
1893         (WebCore::IDLOperation<JSTestSerializationInheritFinal>::cast):
1894         (WebCore::jsTestSerializationInheritFinalConstructor):
1895         (WebCore::setJSTestSerializationInheritFinalConstructor):
1896         * bindings/scripts/test/JS/JSTestSerializedScriptValueInterface.cpp:
1897         (WebCore::IDLAttribute<JSTestSerializedScriptValueInterface>::cast):
1898         (WebCore::IDLOperation<JSTestSerializedScriptValueInterface>::cast):
1899         (WebCore::jsTestSerializedScriptValueInterfaceConstructor):
1900         (WebCore::setJSTestSerializedScriptValueInterfaceConstructor):
1901         (WebCore::JSTestSerializedScriptValueInterface::toWrapped):
1902         * bindings/scripts/test/JS/JSTestStringifier.cpp:
1903         (WebCore::IDLOperation<JSTestStringifier>::cast):
1904         (WebCore::jsTestStringifierConstructor):
1905         (WebCore::setJSTestStringifierConstructor):
1906         (WebCore::JSTestStringifier::toWrapped):
1907         * bindings/scripts/test/JS/JSTestStringifierAnonymousOperation.cpp:
1908         (WebCore::IDLOperation<JSTestStringifierAnonymousOperation>::cast):
1909         (WebCore::jsTestStringifierAnonymousOperationConstructor):
1910         (WebCore::setJSTestStringifierAnonymousOperationConstructor):
1911         (WebCore::JSTestStringifierAnonymousOperation::toWrapped):
1912         * bindings/scripts/test/JS/JSTestStringifierNamedOperation.cpp:
1913         (WebCore::IDLOperation<JSTestStringifierNamedOperation>::cast):
1914         (WebCore::jsTestStringifierNamedOperationConstructor):
1915         (WebCore::setJSTestStringifierNamedOperationConstructor):
1916         (WebCore::JSTestStringifierNamedOperation::toWrapped):
1917         * bindings/scripts/test/JS/JSTestStringifierOperationImplementedAs.cpp:
1918         (WebCore::IDLOperation<JSTestStringifierOperationImplementedAs>::cast):
1919         (WebCore::jsTestStringifierOperationImplementedAsConstructor):
1920         (WebCore::setJSTestStringifierOperationImplementedAsConstructor):
1921         (WebCore::JSTestStringifierOperationImplementedAs::toWrapped):
1922         * bindings/scripts/test/JS/JSTestStringifierOperationNamedToString.cpp:
1923         (WebCore::IDLOperation<JSTestStringifierOperationNamedToString>::cast):
1924         (WebCore::jsTestStringifierOperationNamedToStringConstructor):
1925         (WebCore::setJSTestStringifierOperationNamedToStringConstructor):
1926         (WebCore::JSTestStringifierOperationNamedToString::toWrapped):
1927         * bindings/scripts/test/JS/JSTestStringifierReadOnlyAttribute.cpp:
1928         (WebCore::IDLAttribute<JSTestStringifierReadOnlyAttribute>::cast):
1929         (WebCore::IDLOperation<JSTestStringifierReadOnlyAttribute>::cast):
1930         (WebCore::jsTestStringifierReadOnlyAttributeConstructor):
1931         (WebCore::setJSTestStringifierReadOnlyAttributeConstructor):
1932         (WebCore::JSTestStringifierReadOnlyAttribute::toWrapped):
1933         * bindings/scripts/test/JS/JSTestStringifierReadWriteAttribute.cpp:
1934         (WebCore::IDLAttribute<JSTestStringifierReadWriteAttribute>::cast):
1935         (WebCore::IDLOperation<JSTestStringifierReadWriteAttribute>::cast):
1936         (WebCore::jsTestStringifierReadWriteAttributeConstructor):
1937         (WebCore::setJSTestStringifierReadWriteAttributeConstructor):
1938         (WebCore::JSTestStringifierReadWriteAttribute::toWrapped):
1939         * bindings/scripts/test/JS/JSTestTypedefs.cpp:
1940         (WebCore::IDLAttribute<JSTestTypedefs>::cast):
1941         (WebCore::IDLOperation<JSTestTypedefs>::cast):
1942         (WebCore::jsTestTypedefsConstructor):
1943         (WebCore::setJSTestTypedefsConstructor):
1944         (WebCore::JSTestTypedefs::toWrapped):
1945         * bridge/objc/WebScriptObject.mm:
1946         (-[WebScriptObject setValue:forKey:]):
1947         * bridge/runtime_array.cpp:
1948         (JSC::RuntimeArray::lengthGetter):
1949         * bridge/runtime_method.cpp:
1950         (JSC::RuntimeMethod::lengthGetter):
1951         * html/HTMLMediaElement.cpp:
1952         (WebCore::controllerJSValue):
1953         (WebCore::HTMLMediaElement::updateCaptionContainer):
1954         (WebCore::HTMLMediaElement::didAddUserAgentShadowRoot):
1955         * inspector/agents/InspectorDOMAgent.cpp:
1956         (WebCore::InspectorDOMAgent::buildObjectForEventListener):
1957
1958 2018-03-08  Yusuke Suzuki  <utatane.tea@gmail.com>
1959
1960         [JSC] Add inherits<T>(VM&) leveraging JSCast fast path
1961         https://bugs.webkit.org/show_bug.cgi?id=183429
1962
1963         Reviewed by Mark Lam.
1964
1965         * bindings/js/IDBBindingUtilities.cpp:
1966         (WebCore::createIDBKeyFromValue):
1967         * bindings/js/JSDOMConvertDate.cpp:
1968         (WebCore::valueToDate):
1969         * bindings/js/JSDOMGlobalObject.cpp:
1970         (WebCore::JSDOMGlobalObject::scriptExecutionContext const):
1971         * bindings/js/JSDOMWindowCustom.cpp:
1972         (WebCore::JSDOMWindow::toWrapped):
1973         * bindings/js/JSEventTargetCustom.cpp:
1974         * bindings/js/JSNodeCustom.cpp:
1975         (WebCore::JSNode::pushEventHandlerScope const):
1976         * bindings/js/JSXPathNSResolverCustom.cpp:
1977         (WebCore::JSXPathNSResolver::toWrapped):
1978         * bindings/js/ScriptState.cpp:
1979         (WebCore::domWindowFromExecState):
1980         (WebCore::scriptExecutionContextFromExecState):
1981         * bindings/js/SerializedScriptValue.cpp:
1982         (WebCore::CloneSerializer::isArray):
1983         (WebCore::CloneSerializer::isMap):
1984         (WebCore::CloneSerializer::isSet):
1985         (WebCore::CloneSerializer::dumpArrayBufferView):
1986         (WebCore::CloneSerializer::dumpDOMPoint):
1987         (WebCore::CloneSerializer::dumpDOMRect):
1988         (WebCore::CloneSerializer::dumpDOMMatrix):
1989         (WebCore::CloneSerializer::dumpIfTerminal):
1990         (WebCore::CloneDeserializer::CloneDeserializer):
1991         (WebCore::CloneDeserializer::readArrayBufferView):
1992         * bindings/scripts/CodeGeneratorJS.pm:
1993         (GenerateOverloadDispatcher):
1994         * bindings/scripts/test/JS/JSTestObj.cpp:
1995         (WebCore::jsTestObjPrototypeFunctionOverloadedMethodOverloadDispatcher):
1996         (WebCore::jsTestObjPrototypeFunctionOverloadedMethodWithOptionalParameterOverloadDispatcher):
1997         (WebCore::jsTestObjPrototypeFunctionOverloadedMethodWithDistinguishingUnionOverloadDispatcher):
1998         (WebCore::jsTestObjPrototypeFunctionOverloadedMethodWith2DistinguishingUnionsOverloadDispatcher):
1999         (WebCore::jsTestObjPrototypeFunctionOverloadedMethodWithNonDistinguishingUnionOverloadDispatcher):
2000         (WebCore::jsTestObjPrototypeFunctionOverloadWithNullableUnionOverloadDispatcher):
2001         (WebCore::jsTestObjPrototypeFunctionOverloadWithNullableNonDistinguishingParameterOverloadDispatcher):
2002         (WebCore::jsTestObjPrototypeFunctionTestPromiseOverloadedFunctionOverloadDispatcher):
2003         * bindings/scripts/test/JS/JSTestOverloadedConstructors.cpp:
2004         (WebCore::JSTestOverloadedConstructorsConstructor::construct):
2005         * bridge/c/c_instance.cpp:
2006         (JSC::Bindings::CInstance::invokeMethod):
2007         * bridge/objc/WebScriptObject.mm:
2008         (+[WebScriptObject _convertValueToObjcValue:originRootObject:rootObject:]):
2009         * bridge/objc/objc_instance.mm:
2010         (ObjcInstance::invokeMethod):
2011         * bridge/objc/objc_runtime.mm:
2012         (JSC::Bindings::callObjCFallbackObject):
2013         * bridge/runtime_method.cpp:
2014         (JSC::callRuntimeMethod):
2015         * bridge/runtime_object.cpp:
2016         (JSC::Bindings::callRuntimeObject):
2017         (JSC::Bindings::callRuntimeConstructor):
2018         * inspector/WebInjectedScriptHost.cpp:
2019         (WebCore::WebInjectedScriptHost::subtype):
2020         (WebCore::WebInjectedScriptHost::isHTMLAllCollection):
2021
2022 2018-03-08  Tim Horton  <timothy_horton@apple.com>
2023
2024         Stop linking ApplicationServices directly
2025         https://bugs.webkit.org/show_bug.cgi?id=182867
2026         <rdar://problem/38252142>
2027
2028         Reviewed by Alex Christensen.
2029
2030         The frameworks that we use that live inside ApplicationServices
2031         have mostly moved out, so import them directly.
2032
2033         * Configurations/WebCore.xcconfig:
2034         * html/canvas/CanvasRenderingContext2D.cpp:
2035         * html/canvas/CanvasRenderingContext2DBase.cpp:
2036         * platform/MIMETypeRegistry.cpp:
2037         * platform/graphics/ComplexTextController.cpp:
2038         * platform/graphics/cg/ColorCG.cpp:
2039         * platform/graphics/cg/ImageDecoderCG.cpp:
2040         * platform/graphics/cg/UTIRegistry.cpp:
2041         * platform/graphics/cocoa/FontCocoa.mm:
2042         * platform/graphics/mac/ComplexTextControllerCoreText.mm:
2043         * platform/graphics/mac/GlyphPageMac.cpp:
2044         * platform/graphics/mac/PDFDocumentImageMac.mm:
2045         * platform/graphics/mac/SimpleFontDataCoreText.cpp:
2046         * platform/graphics/win/FontCGWin.cpp:
2047         * platform/graphics/win/FontCacheWin.cpp:
2048         * platform/graphics/win/FontCustomPlatformData.cpp:
2049         * platform/graphics/win/FontPlatformDataCGWin.cpp:
2050         * platform/graphics/win/ImageCGWin.cpp:
2051         * platform/graphics/win/SimpleFontDataCGWin.cpp:
2052
2053 2018-03-07  Tim Horton  <timothy_horton@apple.com>
2054
2055         Sort and separate FeatureDefines.xcconfig
2056         https://bugs.webkit.org/show_bug.cgi?id=183427
2057
2058         Reviewed by Dan Bernstein.
2059
2060         * Configurations/FeatureDefines.xcconfig:
2061         Sort and split FeatureDefines into paragraphs
2062         (to make it easier to sort later).
2063
2064 2018-03-07  Zalan Bujtas  <zalan@apple.com>
2065
2066         Invalid innerTextRenderer in RenderTextControlSingleLine::styleDidChange()
2067         https://bugs.webkit.org/show_bug.cgi?id=183385
2068         <rdar://problem/38085397>
2069
2070         Reviewed by Antti Koivisto.
2071
2072         When HTMLInputElement::updateType() is called with a dirty value, we eagerly change the m_inputType first
2073         and then we take care of the dirty value by calling setAttributeWithoutSynchronization().
2074         With a DOMSubtreeModified event listener attached, setAttributeWithoutSynchronization() can end up running some
2075         layout code (offsetHeight) with a renderer - m_inputType mismatch.
2076
2077         This patch ensures that we don't change the m_inputType until after we finished setting the new value.
2078
2079         Test: fast/DOM/HTMLInputElement/input-value-and-type-change-crash.html
2080
2081         * html/HTMLInputElement.cpp:
2082         (WebCore::HTMLInputElement::updateType):
2083
2084 2018-03-07  Chris Dumez  <cdumez@apple.com>
2085
2086         Get rid of custom bindings for History's replaceState() / pushState()
2087         https://bugs.webkit.org/show_bug.cgi?id=183372
2088
2089         Reviewed by Youenn Fablet.
2090
2091         Get rid of custom bindings for History's replaceState() / pushState() by
2092         moving the cached state from the wrapper to the History implementation
2093         object.
2094
2095         No new tests, no web-facing behavior change.
2096
2097         * bindings/js/JSHistoryCustom.cpp:
2098         (WebCore::JSHistory::state const):
2099         (WebCore::JSHistory::visitAdditionalChildren):
2100         * page/History.cpp:
2101         (WebCore::History::cachedState):
2102         (WebCore::History::stateObjectAdded):
2103         * page/History.h:
2104         (WebCore::History::pushState):
2105         (WebCore::History::replaceState):
2106         * page/History.idl:
2107
2108 2018-03-07  Youenn Fablet  <youenn@apple.com>
2109
2110         Match unsupported plugins based on domains and not origin
2111         https://bugs.webkit.org/show_bug.cgi?id=183384
2112
2113         Reviewed by Chris Dumez.
2114
2115         Move from an origin-keyed map to a vector of plugins.
2116         We iterate through the vector and a match happens if the page host name ends with the provided matching domain.
2117         This allows supporting rules for *.mydomain.com by passing 'mydomain.com'.
2118         Covered by existing tests.
2119         We are not testing subdomains like www.localhost since there is no support in our CI but this is tested through Unit tests.
2120
2121         * loader/EmptyClients.cpp:
2122         * platform/URL.cpp:
2123         (WebCore::URL::isMatchingDomain const):
2124         * platform/URL.h:
2125         * plugins/PluginData.h:
2126         (WebCore::isSupportedPlugin):
2127         (WebCore::SupportedPluginName::decode):
2128         (WebCore::SupportedPluginName::encode const):
2129         * plugins/PluginInfoProvider.h:
2130
2131 2017-12-18  Youenn Fablet  <youenn@apple.com>
2132
2133         Update to libwebrtc revision 4e70a72571dd26b85c2385e9c618e343428df5d3
2134         https://bugs.webkit.org/show_bug.cgi?id=180843
2135
2136         Reviewed by Eric Carlson.
2137
2138         Covered by existing tests.
2139
2140         Moving H264 codecs and factories to libwebrtc.
2141         Updating LibWebRTCProvider according new libwebrtc API.
2142         Updating ref counting according new libwebrtc API.
2143
2144         * Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.cpp:
2145         * Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.h:
2146         (WebCore::LibWebRTCMediaEndpoint::AddRef const):
2147         (WebCore::LibWebRTCMediaEndpoint::Release const):
2148         (WTF::LogArgument<webrtc::RTCStats>::toString):
2149         * WebCore.xcodeproj/project.pbxproj:
2150         * platform/mediastream/RealtimeOutgoingAudioSource.h:
2151         * platform/mediastream/RealtimeOutgoingVideoSource.h:
2152         * platform/mediastream/libwebrtc/LibWebRTCAudioModule.h:
2153         * platform/mediastream/libwebrtc/LibWebRTCProvider.cpp:
2154         (WebCore::LibWebRTCProvider::createPeerConnectionFactory):
2155         * platform/mediastream/libwebrtc/LibWebRTCProvider.h:
2156         * platform/mediastream/libwebrtc/LibWebRTCProviderCocoa.cpp:
2157         (WebCore::LibWebRTCProviderCocoa::~LibWebRTCProviderCocoa):
2158         (WebCore::LibWebRTCProviderCocoa::createDecoderFactory):
2159         (WebCore::LibWebRTCProviderCocoa::createEncoderFactory):
2160         (WebCore::LibWebRTCProviderCocoa::setActive):
2161         * platform/mediastream/libwebrtc/LibWebRTCProviderCocoa.h:
2162         * platform/mediastream/libwebrtc/VideoToolBoxDecoderFactory.cpp: Removed.
2163         * platform/mediastream/libwebrtc/VideoToolBoxEncoderFactory.cpp: Removed.
2164         * platform/mediastream/mac/RealtimeOutgoingVideoSourceCocoa.cpp:
2165         (WebCore::ConvertToI420):
2166         (WebCore::RealtimeOutgoingVideoSourceCocoa::sampleBufferUpdated):
2167         * testing/Internals.cpp:
2168         (WebCore::Internals::setH264HardwareEncoderAllowed):
2169         * testing/MockLibWebRTCPeerConnection.h:
2170
2171 2018-03-07  Sihui Liu  <sihui_liu@apple.com>
2172
2173         replaceState cause back/forward malfunction on html page with <base href="/"> tag
2174         https://bugs.webkit.org/show_bug.cgi?id=182678
2175         <rdar://problem/37517821>
2176
2177         Reviewed by Chris Dumez.
2178
2179         replaceState should not change URL when the URL argument is NULL, but should change URL when the URL argument is an empty string.
2180
2181         Test: http/tests/history/replacestate-no-url.html
2182
2183         * page/History.cpp:
2184         (WebCore::History::urlForState):
2185
2186 2018-03-07  Antti Koivisto  <antti@apple.com>
2187
2188         Don't invalidate descendants for sibling combinators unless needed
2189         https://bugs.webkit.org/show_bug.cgi?id=183410
2190         <rdar://problem/38227297>
2191
2192         Reviewed by Zalan Bujtas.
2193
2194         If we know the matched sibling combinator doesn't affect descendants we shouldn't invalidate them.
2195
2196         * css/SelectorChecker.cpp:
2197         (WebCore::SelectorChecker::matchRecursively const):
2198
2199             Use different bit for the descendant case.
2200
2201         * cssjit/SelectorCompiler.cpp:
2202         (WebCore::SelectorCompiler::fragmentMatchesTheRightmostElement):
2203
2204             Remove unneeded context assert.
2205
2206         (WebCore::SelectorCompiler::SelectorCodeGenerator::generateSelectorChecker):
2207
2208             Use different bit for the descendant case.
2209
2210         (WebCore::SelectorCompiler::SelectorCodeGenerator::generateSelectorCheckerExcludingPseudoElements):
2211         (WebCore::SelectorCompiler::SelectorCodeGenerator::generateElementHasPseudoElement):
2212         (WebCore::SelectorCompiler::SelectorCodeGenerator::generateRequestedPseudoElementEqualsToSelectorPseudoElement):
2213         * dom/Element.cpp:
2214         (WebCore::invalidateForSiblingCombinators):
2215
2216             Invalidate the target sibling or all descendants based on the bits.
2217
2218         * dom/Element.h:
2219         (WebCore::Element::descendantsAffectedByPreviousSibling const):
2220         (WebCore::Element::setDescendantsAffectedByPreviousSibling const):
2221         * dom/Node.h:
2222         * style/StyleRelations.cpp:
2223         (WebCore::Style::commitRelationsToRenderStyle):
2224         (WebCore::Style::commitRelations):
2225         * style/StyleRelations.h:
2226
2227             Add DescendantsAffectedByPreviousSibling bit. AffectedByPreviousSibling is now just about the target element.
2228
2229 2018-03-07  Antti Koivisto  <antti@apple.com>
2230
2231         checkForSiblingStyleChanges should use internal versions of the invalidation functions
2232         https://bugs.webkit.org/show_bug.cgi?id=183405
2233         <rdar://problem/38218310>
2234
2235         Reviewed by Zalan Bujtas.
2236
2237         Non-internal invalidateStyleForElement/Subtree() implement sibling combinator invalidation. Checking this
2238         is only needed if the element in question changed somehow. In checkForSiblingStyleChanges we know that
2239         another element changed and we really just want to invalidate.
2240
2241         * css/SelectorChecker.cpp:
2242         (WebCore::isFirstOfType):
2243         (WebCore::SelectorChecker::checkOne const):
2244
2245         Also make :first-of-type use ChildrenAffectedByForwardPositionalRules for invalidation similar to :last-of-type
2246         for more correct invalidation.
2247
2248         * dom/Element.cpp:
2249         (WebCore::checkForSiblingStyleChanges):
2250
2251 2018-03-07  Yusuke Suzuki  <utatane.tea@gmail.com>
2252
2253         HTML `pattern` attribute should set `u` flag for regular expressions
2254         https://bugs.webkit.org/show_bug.cgi?id=151598
2255
2256         Reviewed by Chris Dumez.
2257
2258         This patch attaches "u" flag to the RegExp compiled for HTML "pattern" attribute[1].
2259
2260         [1]: https://html.spec.whatwg.org/multipage/forms.html#the-pattern-attribute
2261
2262         * html/BaseTextInputType.cpp:
2263         (WebCore::BaseTextInputType::patternMismatch const):
2264
2265 2018-03-07  Frederic Wang  <fwang@igalia.com>
2266
2267         Relayout frames after AsyncFrameScrolling or FrameFlattening option is changed
2268         https://bugs.webkit.org/show_bug.cgi?id=183081
2269
2270         Reviewed by Antonio Gomes.
2271
2272         The frames may be resized when the FrameFlattening option is modified and hence this patch
2273         forces a relayout. It also does that when AsyncFrameScrolling is modified too, since that
2274         may imply changes in frame flattening after bug 173704. Forcing a relayout will also be
2275         enough to trigger other updates for async frame scrolling in the future (see bug 149264 and
2276         bug 171667).
2277
2278         Test: platform/ios/fast/frames/flattening/iframe-flattening-async-frame-scrolling-dynamic.html
2279
2280         * page/Settings.yaml: Call setNeedsRelayoutAllFrames when one of the AsyncFrameScrolling or
2281         FrameFlattening options is changed.
2282         * page/SettingsBase.cpp: Include RenderWidget to make call on frame->ownerRenderer().
2283         (WebCore::SettingsBase::setNeedsRelayoutAllFrames):  Make layout and preferred widths dirty
2284         on all frames in the page and schedule a relayout.
2285         * page/SettingsBase.h: Declare setNeedsRelayoutAllFrames().
2286
2287 2018-03-07  Alejandro G. Castro  <alex@igalia.com>
2288
2289         Make NetworkRTCResolver port agnostic
2290         https://bugs.webkit.org/show_bug.cgi?id=178855
2291
2292         Reviewed by Youenn Fablet.
2293
2294         Add new API in the DNSResolveQueue allowing to revolve hostnames and get the result. Add platform
2295         specific code for soup platform and refactor the other platforms. Added new API to the DNS API header
2296         and move the general code to the DNS.cpp file, that way we can reuse that code in all the platforms
2297         and leave the ResolveQueue class of the platforms in a file.
2298
2299         No new tests because this is a refactor.
2300
2301         * PlatformAppleWin.cmake: Move the DNSCFNet class to DNSResolveQueueCFNet.
2302         * PlatformMac.cmake: Ditto.
2303         * Sources.txt: Add the DNS.cpp for compilation.
2304         * SourcesCocoa.txt: Move the DNSCFNet class to DNSResolveQueueCFNet.
2305         * WebCore.xcodeproj/project.pbxproj: Move the DNSCFNet class to DNSResolveQueueCFNet, add the DNS.cpp
2306         for compilation. Add the new DNSResolveQueueCFNet class.
2307         * platform/Curl.cmake: Move the DNSCFNet class to DNSResolveQueueCurl.
2308         * platform/network/DNS.cpp: Add this file with the default implementation of the DNS functions for
2309         all the platforms.
2310         (WebCore::prefetchDNS): Copied from every platform implementation.
2311         (WebCore::resolveDNS): Add the function, resolves a hostname, receives the identifier of the operation
2312         and the completion handler.
2313         (WebCore::stopResolveDNS): Add the function, stops a resolution operation, receives the identifier
2314         of the operation.
2315         * platform/network/DNS.h: Add the new APIs resolveDNS and stopResolveDNS with the classes used for the
2316         implementation.
2317         (WebCore::IPAddress::IPAddress): Add this class used to send the resolved address information, it does
2318         not depend on libwebrtc rtc classes.
2319         (WebCore::IPAddress::get): Get a reference to the struct sockaddr_in in the IPAddress class.
2320         (WebCore::DNSCompletionHandler): Add this CompletionHandler type to be used when resolving the DNS
2321         address.
2322         * platform/network/DNSResolveQueue.cpp: Add the DNSResolveQueue platform instantiation in the singleton.
2323         (WebCore::DNSResolveQueue::singleton): Use DNSResolveQueue platform classes when creating the singleton..
2324         (WebCore::DNSResolveQueue::resolve): Add this method to get the address of a hostname, it sends the
2325         identifier and the completion handler to use when returning the result.
2326         (WebCore::DNSResolveQueue::stopResolve): Add this method to stop the resolve operation when required.
2327         * platform/network/DNSResolveQueue.h: Add the new methods and make the class abstract, so that every
2328         platform can implement the functions.
2329         * platform/network/cf/DNSResolveQueueCFNet.cpp: Renamed from Source/WebCore/platform/network/cf/DNSCFNet.cpp.
2330         Add the methods to the new class DNSResolveQueueCFNet, move the prefetchDNS to the DNS.cpp general
2331         implementation.
2332         * platform/network/cf/DNSResolveQueueCFNet.h: Add the new class inheriting from the DNSResolveQueue. Add the
2333         new methods, we have to implement these methods and move the NetworkRTCResolver for COCOA code here.
2334         (WebCore::DNSResolveQueueCF::resolve): Dummy method, not implemented.
2335         (WebCore::DNSResolveQueueCF::stopResolve): Ditto.
2336         * platform/network/curl/DNSResolveQueueCurl.cpp: Renamed from Source/WebCore/platform/network/curl/DNSCurl.cpp.
2337         * platform/network/curl/DNSResolveQueueCurl.h: Add the new class inheriting from the DNSResolveQueue.
2338         (WebCore::DNSResolveQueueCurl::resolve): Ditto.
2339         (WebCore::DNSResolveQueueCurl::stopResolve): Ditto.
2340         * platform/network/soup/DNSResolveQueueSoup.h: New class inheriting from the DNSResolveQueue class, adding
2341         a HasMap with the active operations, it allows stopping them.
2342         * platform/network/soup/DNSResolveQueueSoup.cpp: Renamed from Source/WebCore/platform/network/curl/DNSSoup.cpp.
2343         (WebCore::resolvedWithObserverCallback): Called when the result address from the soup platform is ready,
2344         sends the address to the completion handler.
2345         (WebCore::DNSResolveQueueSoup::resolve): Launch the resolve operation with the soup library.
2346         (WebCore::DNSResolveQueueSoup::stopResolve): Stop the resolve operation on process with a GCancellable.
2347
2348 2018-03-06  Brian Burg  <bburg@apple.com>
2349
2350         [Cocoa] Stop copying ForwardingHeaders directory that no longer exists
2351         https://bugs.webkit.org/show_bug.cgi?id=183396
2352
2353         Reviewed by Dan Bernstein.
2354
2355         * WebCore.xcodeproj/project.pbxproj:
2356         Rename the phase to "Copy ICU Headers". ForwardingHeaders are no longer a thing.
2357
2358 2018-03-06  Youenn Fablet  <youenn@apple.com>
2359
2360         didReceiveServerRedirectForProvisionalNavigation is not called in case of document redirection with service worker registration change
2361         https://bugs.webkit.org/show_bug.cgi?id=183299
2362         <rdar://problem/37547029>
2363
2364         Reviewed by Alex Christensen.
2365
2366         In case of redirection with service worker registration change, we cancel the load and create a new one.
2367         This prevent ResourceLoader::willSendRequestInternal to call the didReceiveServerRedirectForProvisionalNavigation
2368         callback. We thus explictly call this callback after restarting the load with the new service worker step.
2369         We only call this callback if the main resource is there as we do not want to call it if it was blocked by content extension.
2370
2371         Test: http/wpt/service-workers/navigation-redirect-main-frame.https.html
2372
2373         * loader/DocumentLoader.cpp:
2374         (WebCore::DocumentLoader::restartLoadingDueToServiceWorkerRegistrationChange):
2375
2376 2018-03-06  Basuke Suzuki  <Basuke.Suzuki@sony.com>
2377
2378         [Curl] Remove unnecessary copied ResourceRequest member variable.
2379         https://bugs.webkit.org/show_bug.cgi?id=183010
2380
2381         Reviewed by Youenn Fablet.
2382
2383         * platform/network/ResourceHandle.h:
2384         * platform/network/ResourceHandleInternal.h:
2385         (WebCore::ResourceHandleInternal::ResourceHandleInternal):
2386         * platform/network/curl/CurlRequest.h:
2387         (WebCore::CurlRequest::resourceRequest const):
2388         * platform/network/curl/ResourceHandleCurl.cpp:
2389         (WebCore::ResourceHandle::start):
2390         (WebCore::ResourceHandle::addCacheValidationHeaders):
2391         (WebCore::ResourceHandle::createCurlRequest):
2392         (WebCore::ResourceHandle::restartRequestWithCredential):
2393         (WebCore::ResourceHandle::continueAfterWillSendRequest):
2394
2395 2018-03-06  Nan Wang  <n_wang@apple.com>
2396
2397         AX: Flaky test after r229310
2398         https://bugs.webkit.org/show_bug.cgi?id=183376
2399         <rdar://problem/38188685>
2400
2401         Reviewed by Chris Fleizach.
2402
2403         The test that forces the context menu to show sometimes locks up 
2404         the test runner. Also, we missed a case where calling AXShowMenu
2405         action on a combobox is not dispatching the accessibility event.
2406
2407         Using the combobox example to test the event dispatching in order to
2408         avoid the test hang.
2409
2410         * accessibility/mac/WebAccessibilityObjectWrapperMac.mm:
2411         (-[WebAccessibilityObjectWrapper accessibilityPerformShowMenuAction]):
2412         (-[WebAccessibilityObjectWrapper accessibilityShowContextMenu]):
2413
2414 2018-03-06  Chris Dumez  <cdumez@apple.com>
2415
2416         fast/loader/redirect-to-invalid-url-using-meta-refresh-disallowed.html fails with async policy delegates
2417         https://bugs.webkit.org/show_bug.cgi?id=183345
2418
2419         Reviewed by Alex Christensen.
2420
2421         FrameLoader::loadURL() was calling loadWithNavigationAction() and then resetting the
2422         m_quickRedirectComing flag right after. This works if the navigation policy decision
2423         triggered by loadWithNavigationAction() is made synchronously. However, when it is
2424         made asynchronously, the flag gets reset too early, before the policy decision
2425         handler has been called. This is an issue because the policy decision handler
2426         relies on the m_quickRedirectComing flag.
2427
2428         Similarly, FrameLoader::loadFrameRequest() was calling loadPostRequest() / loadURL()
2429         and then focusing a frame right after. This does not work as intended when the navigation
2430         policy decision is made asynchronously.
2431
2432         To address the issue, we now pass a completion handler that gets called when the operation
2433         has actually completion, after the policy decision has been made. This maintains the
2434         behavior in place with synchronous policy delegates.
2435
2436         Test: fast/loader/redirect-to-invalid-url-using-meta-refresh-disallowed-async-delegates.html
2437
2438         * loader/FrameLoader.cpp:
2439         (WebCore::FrameLoader::loadURLIntoChildFrame):
2440         (WebCore::FrameLoader::loadFrameRequest):
2441         (WebCore::FrameLoader::loadURL):
2442         (WebCore::FrameLoader::loadWithNavigationAction):
2443         (WebCore::FrameLoader::load):
2444         (WebCore::FrameLoader::loadWithDocumentLoader):
2445         (WebCore::FrameLoader::reloadWithOverrideEncoding):
2446         (WebCore::FrameLoader::reload):
2447         (WebCore::FrameLoader::loadPostRequest):
2448         (WebCore::FrameLoader::continueLoadAfterNewWindowPolicy):
2449         (WebCore::FrameLoader::loadDifferentDocumentItem):
2450         * loader/FrameLoader.h:
2451
2452 2018-03-06  Antoine Quint  <graouts@apple.com>
2453
2454         [Web Animations] Add a new CSSTransition subclass of WebAnimation
2455         https://bugs.webkit.org/show_bug.cgi?id=183373
2456         <rdar://problem/38181985>
2457
2458         Reviewed by Dean Jackson.
2459
2460         Adding a new CSSAnimation subclass which we will create in a later patch while resolving styles
2461         upon identifying that a new CSS Animation has been added to an element.
2462
2463         * CMakeLists.txt:
2464         * DerivedSources.make:
2465         * Sources.txt:
2466         * WebCore.xcodeproj/project.pbxproj:
2467         * animation/CSSTransition.cpp: Added.
2468         (WebCore::CSSTransition::create):
2469         (WebCore::CSSTransition::CSSTransition):
2470         * animation/CSSTransition.h: Added.
2471         * animation/CSSTransition.idl: Added.
2472         * animation/KeyframeEffect.cpp:
2473         * animation/WebAnimation.h:
2474         (WebCore::WebAnimation::isCSSTransition const):
2475         * bindings/js/JSWebAnimationCustom.cpp:
2476         (WebCore::toJSNewlyCreated):
2477         * bindings/js/WebCoreBuiltinNames.h:
2478
2479 2018-03-06  Megan Gardner  <megan_gardner@apple.com>
2480
2481         Ensure system appearance is default for web content
2482         https://bugs.webkit.org/show_bug.cgi?id=183354
2483         <rdar://problem/36975571>
2484         <rdar://problem/38162381>
2485
2486         Make sure the the system appearance for web content is default, and
2487         consolidate that code to a single class.
2488
2489         Reviewed by Tim Horton.
2490
2491         Not currently testable, will add tests in a future patch.
2492
2493         * WebCore.xcodeproj/project.pbxproj:
2494         * platform/mac/LocalDefaultSystemAppearance.h: Added.
2495         * platform/mac/LocalDefaultSystemAppearance.mm: Added.
2496         (WebCore::LocalDefaultSystemAppearance::LocalDefaultSystemAppearance):
2497         (WebCore::LocalDefaultSystemAppearance::~LocalDefaultSystemAppearance):
2498         * platform/mac/ThemeMac.mm:
2499         (-[WebCoreThemeView init]):
2500         (WebCore::ThemeMac::drawCellOrFocusRingWithViewIntoContext):
2501         * rendering/RenderThemeMac.mm:
2502         (WebCore::RenderThemeMac::systemColor const):
2503
2504 2018-03-06  Antoine Quint  <graouts@apple.com>
2505
2506         [Web Animations] Add a new runtime flag to control whether CSS Animations and CSS Transitions should run using the Web Animations timeline
2507         https://bugs.webkit.org/show_bug.cgi?id=183370
2508         <rdar://problem/38180729>
2509
2510         Reviewed by Dean Jackson.
2511
2512         Before we start creating WebAnimation objects to perform CSS Animations and CSS Transitions, which will replace the existing codepath
2513         involving CSSAnimationController and CompositeAnimation, we need a runtime flag that will allow all the new code to be turned off by
2514         default while we bring this feature up.
2515
2516         * page/RuntimeEnabledFeatures.h:
2517         (WebCore::RuntimeEnabledFeatures::setCSSAnimationsAndCSSTransitionsBackedByWebAnimationsEnabled):
2518         (WebCore::RuntimeEnabledFeatures::cssAnimationsAndCSSTransitionsBackedByWebAnimationsEnabled const):
2519
2520 2018-03-06  Daniel Bates  <dabates@apple.com>
2521
2522         Make more use of USE(OPENGL_ES) and replace typedefs with C++11 using statements
2523         in TextureCacheCV.h
2524
2525         Rubber-stamped by Tim Horton.
2526
2527         * platform/graphics/cv/TextureCacheCV.h:
2528
2529 2018-03-06  Antti Koivisto  <antti@apple.com>
2530
2531         Cache hasComplexSelectorsForStyleAttribute bit
2532         https://bugs.webkit.org/show_bug.cgi?id=183363
2533
2534         Reviewed by Andreas Kling.
2535
2536         * css/DocumentRuleSets.cpp:
2537         (WebCore::DocumentRuleSets::collectFeatures const):
2538         (WebCore::DocumentRuleSets::hasComplexSelectorsForStyleAttribute const):
2539
2540         Cache the bit to avoid hash lookups.
2541
2542         * css/DocumentRuleSets.h:
2543         * dom/StyledElement.cpp:
2544         (WebCore::StyledElement::invalidateStyleAttribute):
2545         (WebCore::shouldSynchronizeStyleAttributeImmediatelyForInvalidation): Deleted.
2546
2547         Move code to DocumentRuleSets.
2548
2549 2018-03-06  Myles C. Maxfield  <mmaxfield@apple.com>
2550
2551         Change the type of SVGToOTFFontConverter::m_weight to be not a char
2552         https://bugs.webkit.org/show_bug.cgi?id=183339
2553
2554         Reviewed by Alex Christensen.
2555
2556         No new tests because there is no behavior change.
2557
2558         * svg/SVGToOTFFontConversion.cpp:
2559         (WebCore::SVGToOTFFontConverter::appendOS2Table):
2560         (WebCore::SVGToOTFFontConverter::SVGToOTFFontConverter):
2561
2562 2018-03-06  Antoine Quint  <graouts@apple.com>
2563
2564         [Web Animations] Add a new CSSAnimation subclass of WebAnimation
2565         https://bugs.webkit.org/show_bug.cgi?id=183371
2566         <rdar://problem/38181724>
2567
2568         Reviewed by Dean Jackson.
2569
2570         Adding a new CSSAnimation subclass which we will create in a later patch while resolving styles
2571         upon identifying that a new CSS Animation has been added to an element.
2572
2573         * CMakeLists.txt:
2574         * DerivedSources.make:
2575         * Sources.txt:
2576         * WebCore.xcodeproj/project.pbxproj:
2577         * animation/CSSAnimation.cpp: Added.
2578         (WebCore::CSSAnimation::create):
2579         (WebCore::CSSAnimation::CSSAnimation):
2580         * animation/CSSAnimation.h: Added.
2581         * animation/CSSAnimation.idl: Added.
2582         * animation/KeyframeEffectReadOnly.cpp
2583         * animation/WebAnimation.h:
2584         (WebCore::WebAnimation::isCSSAnimation const):
2585         * animation/WebAnimation.idl:
2586         * bindings/js/JSWebAnimationCustom.cpp:
2587         (WebCore::toJSNewlyCreated):
2588         (WebCore::toJS):
2589         * bindings/js/WebCoreBuiltinNames.h:
2590
2591 2018-03-06  Ms2ger  <Ms2ger@igalia.com>
2592
2593         Explicitly qualify some method calls on this in lambdas in Service Worker code.
2594         https://bugs.webkit.org/show_bug.cgi?id=183367
2595
2596         Reviewed by Chris Dumez.
2597
2598         No new tests -- no change in behavior.
2599
2600         * loader/DocumentLoader.cpp:
2601         (WebCore::DocumentLoader::startLoadingMainResource):
2602         * workers/service/server/SWServer.cpp:
2603         (WebCore::SWServer::matchAll):
2604
2605 2018-03-06  Zan Dobersek  <zdobersek@igalia.com>
2606
2607         [CoordGraphics] Remove unused scrolling-related code in TextureMapperLayer, CoordinatedGraphics stack
2608         https://bugs.webkit.org/show_bug.cgi?id=183340
2609
2610         Reviewed by Michael Catanzaro.
2611
2612         TextureMapperLayer::scrollBy() method is completely unused and can be
2613         removed. This opens the gates on removing majority of scrolling-related
2614         code in TextureMapperLayer, CoordinatedGraphicsLayer and
2615         CoordinatedGraphicsScene classes, along with smaller bits in other
2616         closely-associated classes.
2617
2618         We're able to remove two virtual method overrides in the
2619         ScrollingCoordinatorCoordinatedGraphics class.
2620
2621         TextureMapperLayer can drop the ScrollingClient member variable, along
2622         with multiple others. Various unused methods in that class are removed
2623         as well.
2624
2625         CoordinatedGraphicsLayer and GraphicsLayerTextureMapper can both remove
2626         the custom scrolling state tracking.
2627
2628         No new tests -- no change in behavior.
2629
2630         * page/scrolling/coordinatedgraphics/ScrollingCoordinatorCoordinatedGraphics.cpp:
2631         (WebCore::ScrollingCoordinatorCoordinatedGraphics::scrollableAreaScrollLayerDidChange): Deleted.
2632         (WebCore::ScrollingCoordinatorCoordinatedGraphics::willDestroyScrollableArea): Deleted.
2633         * page/scrolling/coordinatedgraphics/ScrollingCoordinatorCoordinatedGraphics.h:
2634         * platform/graphics/texmap/GraphicsLayerTextureMapper.cpp:
2635         (WebCore::GraphicsLayerTextureMapper::GraphicsLayerTextureMapper):
2636         (WebCore::GraphicsLayerTextureMapper::commitLayerChanges):
2637         (WebCore::GraphicsLayerTextureMapper::didCommitScrollOffset): Deleted.
2638         (WebCore::GraphicsLayerTextureMapper::setIsScrollable): Deleted.
2639         * platform/graphics/texmap/GraphicsLayerTextureMapper.h:
2640         * platform/graphics/texmap/TextureMapperLayer.cpp:
2641         (WebCore::TextureMapperLayer::hitTest): Deleted.
2642         (WebCore::TextureMapperLayer::scrollableLayerHitTestCondition): Deleted.
2643         (WebCore::TextureMapperLayer::findScrollableContentsLayerAt): Deleted.
2644         (WebCore::TextureMapperLayer::mapScrollOffset): Deleted.
2645         (WebCore::TextureMapperLayer::commitScrollOffset): Deleted.
2646         (WebCore::TextureMapperLayer::scrollBy): Deleted.
2647         (WebCore::TextureMapperLayer::didCommitScrollOffset): Deleted.
2648         * platform/graphics/texmap/TextureMapperLayer.h:
2649         * platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.cpp:
2650         (WebCore::CoordinatedGraphicsLayer::CoordinatedGraphicsLayer):
2651         (WebCore::CoordinatedGraphicsLayer::syncLayerState):
2652         (WebCore::CoordinatedGraphicsLayer::resetLayerState):
2653         (WebCore::CoordinatedGraphicsLayer::setScrollableArea): Deleted.
2654         (WebCore::CoordinatedGraphicsLayer::commitScrollOffset): Deleted.
2655         * platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.h:
2656         * platform/graphics/texmap/coordinated/CoordinatedGraphicsState.h:
2657
2658 2018-03-06  Zan Dobersek  <zdobersek@igalia.com>
2659
2660         [CoordGraphics] Apply TextureMapperLayer animations with a single MonotonicTime value
2661         https://bugs.webkit.org/show_bug.cgi?id=183360
2662
2663         Reviewed by Sergio Villar Senin.
2664
2665         When animations are being applied on the TextureMapperLayer tree, the
2666         monotonic time value is retrieved repeatedly in TextureMapperAnimation
2667         class. Instead of spawning repeated syscalls that are required to obtain
2668         the time value, TextureMapperLayer::applyAnimationsRecursively() now
2669         accepts a MonotonicTime value that should be used for all animation
2670         updates.
2671
2672         No new tests -- no change in behavior.
2673
2674         * platform/graphics/texmap/GraphicsLayerTextureMapper.cpp:
2675         (WebCore::GraphicsLayerTextureMapper::flushCompositingStateForThisLayerOnly):
2676         * platform/graphics/texmap/TextureMapperAnimation.cpp:
2677         (WebCore::TextureMapperAnimation::apply):
2678         (WebCore::TextureMapperAnimation::computeTotalRunningTime):
2679         (WebCore::TextureMapperAnimations::apply):
2680         * platform/graphics/texmap/TextureMapperAnimation.h:
2681         (WebCore::TextureMapperAnimation::keyframes const):
2682         (WebCore::TextureMapperAnimation::animation const):
2683         (WebCore::TextureMapperAnimation::boxSize const): Deleted.
2684         (WebCore::TextureMapperAnimation::listsMatch const): Deleted.
2685         (WebCore::TextureMapperAnimation::startTime const): Deleted.
2686         (WebCore::TextureMapperAnimation::pauseTime const): Deleted.
2687         * platform/graphics/texmap/TextureMapperLayer.cpp:
2688         (WebCore::TextureMapperLayer::applyAnimationsRecursively):
2689         (WebCore::TextureMapperLayer::syncAnimations):
2690         * platform/graphics/texmap/TextureMapperLayer.h:
2691
2692 2018-03-06  Zan Dobersek  <zdobersek@igalia.com>
2693
2694         [CoordGraphics] Clean up CoordinatedImageBacking
2695         https://bugs.webkit.org/show_bug.cgi?id=183332
2696
2697         Reviewed by Carlos Garcia Campos.
2698
2699         Clean up the CoordinatedImageBacking class. Prefer reference values in
2700         class functions, methods and member variables, where possible. Move
2701         member variables into a more sensible order. Initialize a few member
2702         variables at the place of declaration.
2703
2704         Drop releaseSurfaceIfNeeded() and updateVisibilityIfNeeded() methods,
2705         integrating them into the update() method, which was the only place
2706         where they were called from.
2707
2708         We don't have to keep a reference to the buffer object, since we're
2709         not using it internally after it's been passed to the client's
2710         updateImageBacking() implementation.
2711
2712         No new tests -- no change in behavior.
2713
2714         * platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.cpp:
2715         (WebCore::CoordinatedGraphicsLayer::syncImageBacking):
2716         (WebCore::CoordinatedGraphicsLayer::releaseImageBackingIfNeeded):
2717         * platform/graphics/texmap/coordinated/CoordinatedImageBacking.cpp:
2718         (WebCore::CoordinatedImageBacking::getCoordinatedImageBackingID):
2719         (WebCore::CoordinatedImageBacking::CoordinatedImageBacking):
2720         (WebCore::CoordinatedImageBacking::addHost):
2721         (WebCore::CoordinatedImageBacking::removeHost):
2722         (WebCore::CoordinatedImageBacking::update):
2723         (WebCore::CoordinatedImageBacking::clearContentsTimerFired):
2724         (WebCore::CoordinatedImageBacking::create): Deleted.
2725         (WebCore::CoordinatedImageBacking::markDirty): Deleted.
2726         (WebCore::CoordinatedImageBacking::releaseSurfaceIfNeeded): Deleted.
2727         (WebCore::CoordinatedImageBacking::updateVisibilityIfNeeded): Deleted.
2728         * platform/graphics/texmap/coordinated/CoordinatedImageBacking.h:
2729
2730 2018-03-06  Zan Dobersek  <zdobersek@igalia.com>
2731
2732         GraphicsLayerTextureMapper: remove the setAnimations() method
2733         https://bugs.webkit.org/show_bug.cgi?id=183358
2734
2735         Reviewed by Carlos Garcia Campos.
2736
2737         Remove the GraphicsLayerTextureMapper::setAnimations() method. This was
2738         not called from anywhere, and is not the way animations are generated
2739         for a given GraphicsLayer object (that would be addAnimation() method).
2740
2741         * platform/graphics/texmap/GraphicsLayerTextureMapper.cpp:
2742         (WebCore::GraphicsLayerTextureMapper::setAnimations): Deleted.
2743         * platform/graphics/texmap/GraphicsLayerTextureMapper.h:
2744
2745 2018-03-06  Nan Wang  <n_wang@apple.com>
2746
2747         AX: AOM: More accessibility events support
2748         https://bugs.webkit.org/show_bug.cgi?id=183023
2749         <rdar://problem/37764380>
2750
2751         Reviewed by Chris Fleizach.
2752
2753         Accessibility events.
2754         Spec: https://wicg.github.io/aom/spec/phase2.html
2755
2756         This change adds support for these new events:
2757           accessiblecontextmenu
2758           accessibledecrement
2759           accessibledismiss
2760           accessiblefocus
2761           accessibleincrement
2762           accessiblescrollintoview
2763           accessibleselect
2764
2765         Note: The show context menu action is only supported on macOS now.
2766         The dismiss action is not implemented for all the platforms yet.
2767
2768         Test: accessibility/mac/AOM-events-all.html
2769
2770         * accessibility/AccessibilityListBoxOption.cpp:
2771         (WebCore::AccessibilityListBoxOption::setSelected):
2772         * accessibility/AccessibilityMediaObject.cpp:
2773         (WebCore::AccessibilityMediaObject::increment):
2774         (WebCore::AccessibilityMediaObject::decrement):
2775         * accessibility/AccessibilityMenuListOption.cpp:
2776         (WebCore::AccessibilityMenuListOption::setSelected):
2777         * accessibility/AccessibilityNodeObject.cpp:
2778         (WebCore::AccessibilityNodeObject::increment):
2779         (WebCore::AccessibilityNodeObject::decrement):
2780         * accessibility/AccessibilityObject.cpp:
2781         (WebCore::AccessibilityObject::press):
2782         (WebCore::AccessibilityObject::dispatchAccessibilityEvent const):
2783         (WebCore::AccessibilityObject::dispatchAccessibilityEventWithType const):
2784         (WebCore::AccessibilityObject::dispatchAccessibleSetValueEvent const):
2785         (WebCore::AccessibilityObject::scrollToMakeVisible const):
2786         (WebCore::AccessibilityObject::dispatchAccessibilityEvent): Deleted.
2787         (WebCore::AccessibilityObject::dispatchAccessibleSetValueEvent): Deleted.
2788         * accessibility/AccessibilityObject.h:
2789         * accessibility/AccessibilityRenderObject.cpp:
2790         (WebCore::AccessibilityRenderObject::setFocused):
2791         * accessibility/mac/WebAccessibilityObjectWrapperMac.mm:
2792         (-[WebAccessibilityObjectWrapper accessibilityShowContextMenu]):
2793         * dom/Element.idl:
2794         * dom/EventNames.h:
2795
2796 2018-03-05  Yusuke Suzuki  <utatane.tea@gmail.com>
2797
2798         Fix std::make_unique / new[] using system malloc
2799         https://bugs.webkit.org/show_bug.cgi?id=182975
2800
2801         Reviewed by JF Bastien.
2802
2803         Use Vector, FAST_ALLOCATED, or UniqueArray instead.
2804
2805         * Modules/webaudio/AudioBufferSourceNode.cpp:
2806         (WebCore::AudioBufferSourceNode::setBuffer):
2807         * Modules/webaudio/AudioBufferSourceNode.h:
2808         * css/StyleRule.h:
2809         * cssjit/CompiledSelector.h:
2810         * html/HTMLFrameSetElement.h:
2811         * html/canvas/WebGLRenderingContextBase.cpp:
2812         (WebCore::WebGLRenderingContextBase::copyTexSubImage2D):
2813         (WebCore::WebGLRenderingContextBase::simulateVertexAttrib0):
2814         (WebCore::WebGLRenderingContextBase::LRUImageBufferCache::LRUImageBufferCache):
2815         (WebCore::WebGLRenderingContextBase::LRUImageBufferCache::imageBuffer):
2816         (WebCore::WebGLRenderingContextBase::LRUImageBufferCache::bubbleToFront):
2817         * html/canvas/WebGLRenderingContextBase.h:
2818         * platform/Length.cpp:
2819         (WebCore::newCoordsArray):
2820         (WebCore::newLengthArray):
2821         (): Deleted.
2822         * platform/Length.h:
2823         * platform/audio/DynamicsCompressor.cpp:
2824         (WebCore::DynamicsCompressor::setNumberOfChannels):
2825         * platform/audio/DynamicsCompressor.h:
2826         * platform/audio/FFTFrame.h:
2827         * platform/audio/gstreamer/FFTFrameGStreamer.cpp:
2828         (WebCore::FFTFrame::FFTFrame):
2829         * platform/graphics/FormatConverter.h:
2830         (WebCore::FormatConverter::FormatConverter):
2831         * platform/graphics/GraphicsContext3D.cpp:
2832         (WebCore::GraphicsContext3D::texImage2DResourceSafe):
2833         * platform/graphics/GraphicsContext3D.h:
2834         * platform/graphics/ca/win/CACFLayerTreeHost.cpp:
2835         (WebCore::getDirtyRects):
2836         * platform/graphics/cairo/CairoUtilities.cpp:
2837         (WebCore::flipImageSurfaceVertically):
2838         * platform/graphics/cg/GraphicsContext3DCG.cpp:
2839         (WebCore::GraphicsContext3D::ImageExtractor::extractImage):
2840         * platform/graphics/gpu/Texture.cpp:
2841         (WebCore::Texture::updateSubRect):
2842         * platform/graphics/opengl/GraphicsContext3DOpenGLCommon.cpp:
2843         (WebCore::GraphicsContext3D::paintRenderingResultsToCanvas):
2844         (WebCore::GraphicsContext3D::compileShader):
2845         (WebCore::GraphicsContext3D::getActiveAttribImpl):
2846         (WebCore::GraphicsContext3D::getActiveUniformImpl):
2847         (WebCore::GraphicsContext3D::getProgramInfoLog):
2848         (WebCore::GraphicsContext3D::getShaderInfoLog):
2849         * platform/graphics/texmap/TextureMapperShaderProgram.cpp:
2850         (WebCore::getShaderLog):
2851         (WebCore::getProgramLog):
2852         * platform/graphics/win/ImageBufferDataDirect2D.cpp:
2853         (WebCore::ImageBufferData::putData):
2854         * platform/image-decoders/png/PNGImageDecoder.cpp:
2855         (WebCore::PNGImageReader::PNGImageReader):
2856         (WebCore::PNGImageReader::close):
2857         (WebCore::PNGImageReader::interlaceBuffer const):
2858         (WebCore::PNGImageReader::createInterlaceBuffer):
2859         * platform/image-decoders/webp/WEBPImageDecoder.cpp:
2860         (WebCore::WEBPImageDecoder::decodeFrame):
2861         * platform/network/curl/SocketStreamHandleImpl.h:
2862         (WebCore::SocketStreamHandleImpl::SocketData::SocketData):
2863         * platform/network/curl/SocketStreamHandleImplCurl.cpp:
2864         (WebCore::createCopy):
2865         (WebCore::SocketStreamHandleImpl::readData):
2866         (): Deleted.
2867         * platform/network/soup/SocketStreamHandleImpl.h:
2868         * platform/network/soup/SocketStreamHandleImplSoup.cpp:
2869         (WebCore::SocketStreamHandleImpl::connected):
2870         * platform/win/LoggingWin.cpp:
2871         (WebCore::logLevelString):
2872
2873 2018-03-05  Yoav Weiss  <yoav@yoav.ws>
2874
2875         Support for preconnect Link headers
2876         https://bugs.webkit.org/show_bug.cgi?id=181657
2877
2878         Reviewed by Darin Adler.
2879
2880         Move the preconnect functionality into its own function, and
2881         also call this function when Link headers are processed.
2882
2883         Test: http/tests/preconnect/link-header-rel-preconnect-http.php
2884
2885         * loader/LinkLoader.cpp:
2886         (WebCore::LinkLoader::loadLinksFromHeader): Call preconnectIfNeeded.
2887         (WebCore::LinkLoader::preconnectIfNeeded): Preconnect to a host functionality moved here.
2888         (WebCore::LinkLoader::loadLink): Call preconnectIfNeeded.
2889         * loader/LinkLoader.h:
2890
2891 2018-03-05  Antti Koivisto  <antti@apple.com>
2892
2893         Add ChildrenAffectedByForwardPositionalRules bit for nth-child pseudo class marking
2894         https://bugs.webkit.org/show_bug.cgi?id=183341
2895         <rdar://problem/38151470>
2896
2897         Reviewed by Zalan Bujtas.
2898
2899         Use it instead of AffectsNextSibling/AffectedByPreviousSibling bits, similar to ChildrenAffectedByBackwardPositionalRules bit.
2900         This is more efficient and requires way less marking.
2901
2902         * css/SelectorChecker.cpp:
2903         (WebCore::countElementsBefore):
2904         (WebCore::countElementsOfTypeBefore):
2905         (WebCore::SelectorChecker::checkOne const):
2906
2907             Mark with ChildrenAffectedByForwardPositionalRules.
2908
2909         * cssjit/SelectorCompiler.cpp:
2910         (WebCore::SelectorCompiler::SelectorCodeGenerator::generateElementIsNthChild):
2911         (WebCore::SelectorCompiler::SelectorCodeGenerator::generateElementIsNthChildOf):
2912
2913              Mark with ChildrenAffectedByForwardPositionalRules.
2914
2915         * dom/Element.cpp:
2916         (WebCore::checkForSiblingStyleChanges):
2917
2918             Invalidate siblings after added/removed element.
2919
2920         (WebCore::Element::setChildrenAffectedByForwardPositionalRules):
2921         (WebCore::Element::hasFlagsSetDuringStylingOfChildren const):
2922         (WebCore::Element::rareDataChildrenAffectedByForwardPositionalRules const):
2923
2924             Add the new marking bit.
2925
2926         * dom/Element.h:
2927         (WebCore::Element::childrenAffectedByForwardPositionalRules const):
2928         (WebCore::Element::attributeWithoutSynchronization const):
2929
2930             Remove assert so we can use this to get the current unresolved lazy value of style attrbute.
2931
2932         * dom/ElementRareData.h:
2933         (WebCore::ElementRareData::childrenAffectedByForwardPositionalRules const):
2934         (WebCore::ElementRareData::setChildrenAffectedByForwardPositionalRules):
2935         (WebCore::ElementRareData::ElementRareData):
2936         (WebCore::ElementRareData::resetStyleRelations):
2937
2938              Add the new marking bit.
2939
2940         * dom/StyledElement.cpp:
2941         (WebCore::StyledElement::invalidateStyleAttribute):
2942
2943             In special case where we have attribute selectors for style attribute, synchronize the attribute immediately so we get invalidation right.
2944             Tested by fast/css/style-attribute-invalidation-propagates-to-counted-siblings.html    
2945
2946         * style/StyleRelations.cpp:
2947         (WebCore::Style::commitRelationsToRenderStyle):
2948         (WebCore::Style::commitRelations):
2949
2950             Commit the new bit.
2951
2952         * style/StyleRelations.h:
2953
2954 2018-03-05  Ryan Haddad  <ryanhaddad@apple.com>
2955
2956         Unreviewed build fix, remove unused variables.
2957
2958         * css/parser/CSSPropertyParser.cpp:
2959         (WebCore::consumeSpeakAs):
2960         (WebCore::consumeHangingPunctuation):
2961
2962 2018-03-05  Chris Dumez  <cdumez@apple.com>
2963
2964         fast/loader/onload-policy-ignore-for-frame.html is timing out with async policy delegates
2965         https://bugs.webkit.org/show_bug.cgi?id=183337
2966
2967         Reviewed by Ryosuke Niwa.
2968
2969         Make sure we call checkCompleted() before calling checkLoadComplete() in
2970         FrameLoader::continueLoadAfterNavigationPolicy() when the client tells us
2971         to ignore the navigation, so that we properly recognize that the load is
2972         done. This matches what is already done in FrameLoader::receivedMainResourceError().
2973
2974         Test: fast/loader/onload-policy-ignore-for-frame-async-delegates.html
2975
2976         * loader/FrameLoader.cpp:
2977         (WebCore::FrameLoader::continueLoadAfterNavigationPolicy):
2978
2979 2018-03-05  Myles C. Maxfield  <mmaxfield@apple.com>
2980
2981         [Cocoa] Allow user-installed fonts to be disabled
2982         https://bugs.webkit.org/show_bug.cgi?id=183349
2983
2984         Rubber stamped by Brent Fulgham.
2985
2986         Tests: fast/text/user-installed-font.html
2987                fast/text/user-installed-fonts/disable.html
2988                fast/text/user-installed-fonts/shadow-disable.html
2989                fast/text/user-installed-fonts/shadow-family-disable.html
2990                fast/text/user-installed-fonts/shadow-family.html
2991                fast/text/user-installed-fonts/shadow-postscript-disable.html
2992                fast/text/user-installed-fonts/shadow-postscript-family-disable.html
2993                fast/text/user-installed-fonts/shadow-postscript-family.html
2994                fast/text/user-installed-fonts/shadow-postscript.html
2995                fast/text/user-installed-fonts/shadow.html
2996                fast/text/user-installed-fonts/system-ui.html
2997
2998         * platform/graphics/cocoa/FontCacheCoreText.cpp:
2999
3000 2018-03-05  Myles C. Maxfield  <mmaxfield@apple.com>
3001
3002         Silence OpenGL and OpenGL ES deprecation warnings in newer SDKs
3003         https://bugs.webkit.org/show_bug.cgi?id=183350
3004
3005         Unreviewed.
3006
3007         * Configurations/WebCore.xcconfig:
3008
3009 2018-03-05  Andy Estes  <aestes@apple.com>
3010
3011         [Mac] Teach WebCore::Pasteboard about file promise drags
3012         https://bugs.webkit.org/show_bug.cgi?id=183314
3013         <rdar://problem/38105493>
3014
3015         Reviewed by Darin Adler.
3016
3017         While WebKit does support receiving file promise drags (since r210360), WebCore::Pasteboard
3018         has not been instructed on how to read their file paths. When the various pasteboard readers
3019         ask for file paths after a file promise drop, they receive an empty vector. This impacts
3020         various features, most notably the DataTransfer API.
3021
3022         Pasteboard actually cannot learn about promised file paths from the pasteboard itself, as
3023         the pasteboard only contains the dragged files' UTIs. Promised file paths aren't known until
3024         the WebKits call -[NSFilePromiseReceiver receivePromisedFilesAtDestination:...], at which
3025         point the file paths are passed to WebCore as part of WebCore::DragData.
3026
3027         When we construct new Pasteboards for drag and drop, we need to store any promised file
3028         paths from the DragData. Then, when the various pasteboard readers ask for file paths and
3029         NSFilesPromisePboardType is on the pasteboard, we can return these promised file paths.
3030
3031         Tests: editing/pasteboard/data-transfer-items-drag-drop-file-promise.html
3032                editing/pasteboard/data-transfer-items-drop-file-promise.html
3033                editing/pasteboard/datatransfer-items-drop-plaintext-file-promise.html
3034                editing/pasteboard/datatransfer-types-dropping-text-file-promise.html
3035                editing/pasteboard/drag-file-promises-to-editable-element-as-URLs.html
3036                editing/pasteboard/drag-file-promises-to-editable-element-as-attachment.html
3037                editing/pasteboard/file-input-files-access-promise.html
3038
3039         * platform/FileSystem.h:
3040         * platform/Pasteboard.h:
3041         (WebCore::Pasteboard::Pasteboard):
3042         * platform/mac/DragDataMac.mm:
3043         (WebCore::DragData::containsPromise const):
3044         * platform/mac/PasteboardMac.mm:
3045         (WebCore::Pasteboard::Pasteboard):
3046         (WebCore::Pasteboard::createForDragAndDrop):
3047         (WebCore::toString):
3048         (WebCore::Pasteboard::read):
3049         (WebCore::Pasteboard::readFilePaths):
3050         (WebCore::absoluteURLsFromPasteboardFilenames): Deleted.
3051         * platform/mac/PlatformPasteboardMac.mm:
3052         (WebCore::PlatformPasteboard::numberOfFiles const):
3053
3054 2018-03-05  Andy Estes  <aestes@apple.com>
3055
3056         [Mac] Fix the build
3057
3058         * Modules/applepay/ApplePaySession.cpp:
3059         (WebCore::convertAndValidate): Removed unused variables.
3060
3061 2018-03-05  Antti Koivisto  <antti@apple.com>
3062
3063         Don't invalidate all children when doing insertion/deletion in presence of backward positional selectors
3064         https://bugs.webkit.org/show_bug.cgi?id=183325
3065         <rdar://problem/38134480>
3066
3067         Reviewed by Zalan Bujtas.
3068
3069         It is sufficient to invalidate siblings before the mutation point.
3070
3071         * dom/Element.cpp:
3072         (WebCore::checkForSiblingStyleChanges):
3073
3074         We already do sibling walk in the case of forwards positional rules and sibling combinators. The work
3075         done here is insignifant compared to cost of overinvalidating.
3076
3077 2018-03-05  Ali Juma  <ajuma@chromium.org>
3078
3079         imported/w3c/web-platform-tests/html/semantics/text-level-semantics/the-a-element/a-download-click-404.html times out with async policy delegates
3080         https://bugs.webkit.org/show_bug.cgi?id=183297
3081
3082         Reviewed by Chris Dumez.
3083
3084         When a FrameLoader's policy document loader is cleared after receiving a navigation policy decision
3085         to not continue loading, we still need to trigger a check for load completion, since this loader or
3086         an ancestor loader may have been in state isLoadingInAPISense only because of the existence of
3087         the just-cleared policy document loader. Without triggering this check, these loaders may never
3088         call WebFrameLoaderClient::dispatchDidFinishLoad.
3089
3090         Test: http/wpt/html/semantics/text-level-semantics/the-a-element/a-download-click-404.html
3091
3092         * loader/FrameLoader.cpp:
3093         (WebCore::FrameLoader::continueLoadAfterNavigationPolicy):
3094
3095 2018-03-04  Yusuke Suzuki  <utatane.tea@gmail.com>
3096
3097         [WTF] Move currentCPUTime and sleep(Seconds) to CPUTime.h and Seconds.h respectively
3098         https://bugs.webkit.org/show_bug.cgi?id=183312
3099
3100         Reviewed by Mark Lam.
3101
3102         Remove wtf/CurrentTime.h include pragma.
3103
3104         * Modules/geolocation/Geolocation.cpp:
3105         * Modules/mediasource/SourceBuffer.cpp:
3106         * Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.cpp:
3107         * Modules/speech/SpeechSynthesis.cpp:
3108         * contentextensions/ContentExtensionCompiler.cpp:
3109         * contentextensions/ContentExtensionParser.cpp:
3110         * dom/Document.cpp:
3111         * dom/Element.cpp:
3112         * dom/Event.cpp:
3113         * dom/ScriptedAnimationController.cpp:
3114         * dom/SimulatedClick.cpp:
3115         * fileapi/File.cpp:
3116         * fileapi/FileReader.cpp:
3117         * history/CachedPage.cpp:
3118         * html/BaseDateAndTimeInputType.cpp:
3119         * html/DateTimeInputType.cpp:
3120         * html/HTMLMediaElement.cpp:
3121         * html/MediaController.cpp:
3122         * html/MediaElementSession.cpp:
3123         * html/MonthInputType.cpp:
3124         * html/TimeInputType.cpp:
3125         * html/parser/HTMLParserScheduler.h:
3126         * inspector/InspectorCanvas.cpp:
3127         * loader/FrameLoader.cpp:
3128         * loader/LoadTiming.cpp:
3129         * loader/NavigationScheduler.cpp:
3130         * loader/ProgressTracker.cpp:
3131         * loader/cache/CachedCSSStyleSheet.cpp:
3132         * loader/cache/CachedImage.cpp:
3133         * loader/cache/CachedResource.cpp:
3134         * loader/cache/MemoryCache.cpp:
3135         * page/DOMTimer.cpp:
3136         * page/DOMWindow.cpp:
3137         * page/DragController.cpp:
3138         * page/EventHandler.cpp:
3139         * page/FocusController.cpp:
3140         * page/FrameView.cpp:
3141         * page/Page.cpp:
3142         * page/Performance.cpp:
3143         * page/PerformanceTiming.cpp:
3144         * page/animation/AnimationBase.cpp:
3145         * page/animation/CSSAnimationController.cpp:
3146         * page/mac/WheelEventDeltaFilterMac.mm:
3147         * page/scrolling/mac/ScrollingTreeFrameScrollingNodeMac.mm:
3148         * platform/ScrollAnimationKinetic.cpp:
3149         * platform/ScrollAnimationSmooth.cpp:
3150         * platform/ThreadTimers.cpp:
3151         * platform/Timer.cpp:
3152         * platform/audio/mac/AudioSampleDataSource.mm:
3153         * platform/cocoa/ScrollController.mm:
3154         * platform/gamepad/cocoa/GameControllerGamepad.mm:
3155         * platform/gamepad/mac/HIDGamepad.cpp:
3156         * platform/graphics/BitmapImage.cpp:
3157         * platform/graphics/DisplayRefreshMonitorManager.cpp:
3158         * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
3159         * platform/graphics/ca/GraphicsLayerCA.cpp:
3160         * platform/graphics/ca/LayerPool.cpp:
3161         * platform/graphics/ca/PlatformCALayer.h:
3162         * platform/graphics/ca/cocoa/PlatformCALayerCocoa.mm:
3163         * platform/graphics/ca/win/CACFLayerTreeHost.cpp:
3164         * platform/graphics/ca/win/PlatformCALayerWin.cpp:
3165         * platform/graphics/ca/win/WKCACFViewLayerTreeHost.cpp:
3166         * platform/graphics/cg/GraphicsContextCG.cpp:
3167         * platform/graphics/cocoa/WebCoreDecompressionSession.mm:
3168         * platform/graphics/ios/DisplayRefreshMonitorIOS.mm:
3169         * platform/graphics/mac/DisplayRefreshMonitorMac.cpp:
3170         * platform/graphics/texmap/BitmapTexturePool.h:
3171         * platform/graphics/texmap/GraphicsLayerTextureMapper.cpp:
3172         * platform/graphics/texmap/TextureMapper.cpp:
3173         * platform/graphics/texmap/TextureMapperAnimation.cpp:
3174         * platform/graphics/texmap/TextureMapperFPSCounter.cpp:
3175         * platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.cpp:
3176         * platform/graphics/win/GraphicsContextDirect2D.cpp:
3177         * platform/graphics/win/GraphicsLayerDirect2D.cpp:
3178         * platform/gtk/PlatformKeyboardEventGtk.cpp:
3179         * platform/gtk/ScrollAnimatorGtk.cpp:
3180         * platform/ios/LegacyTileCache.mm:
3181         * platform/ios/LegacyTileLayerPool.mm:
3182         * platform/ios/ScrollViewIOS.mm:
3183         * platform/mediastream/RealtimeOutgoingVideoSource.cpp:
3184         * platform/mediastream/mac/DisplayCaptureSourceCocoa.cpp:
3185         * platform/mediastream/mac/ScreenDisplayCaptureSourceMac.mm:
3186         * platform/mock/MockRealtimeMediaSource.cpp:
3187         * platform/mock/MockRealtimeVideoSource.cpp:
3188         * platform/network/CacheValidation.cpp:
3189         * platform/network/DNSResolveQueue.cpp:
3190         * platform/network/ResourceResponseBase.cpp:
3191         * platform/network/curl/CurlCacheEntry.cpp:
3192         * platform/network/soup/ResourceHandleSoup.cpp:
3193         * platform/text/TextEncodingRegistry.cpp:
3194         * platform/text/win/LocaleWin.cpp:
3195         * platform/win/MainThreadSharedTimerWin.cpp:
3196         * platform/win/PlatformMouseEventWin.cpp:
3197         * rendering/RenderLayerCompositor.cpp:
3198         * rendering/RenderProgress.cpp:
3199         * svg/animation/SMILTimeContainer.cpp:
3200         * testing/MockGamepad.cpp:
3201         * workers/WorkerRunLoop.cpp:
3202
3203 2018-03-04  Tim Horton  <timothy_horton@apple.com>
3204
3205         Make !ENABLE(DATA_DETECTION) iOS build actually succeed
3206         https://bugs.webkit.org/show_bug.cgi?id=183283
3207         <rdar://problem/38062148>
3208
3209         Reviewed by Sam Weinig.
3210
3211         * Configurations/FeatureDefines.xcconfig:
3212
3213 2018-03-03  Said Abou-Hallawa  <sabouhallawa@apple.com>
3214
3215         Delete incorrect version of clampTo() function from SVGToOTFFontConversion.cpp
3216         https://bugs.webkit.org/show_bug.cgi?id=183165
3217
3218         Reviewed by Darin Adler.
3219
3220         Some of the calls in SVGToOTFFontConversion.cpp were directed to the function
3221         in MathExtras.h while the rest were directed to this local static function.
3222         There should not be two versions with the same name while they are supposed
3223         to do the same thing. Besides, the local version does not work correctly
3224         if the type of the argument's max limit is less the max limit of the returned
3225         type, e.g. char -> uint16_t.
3226
3227         * svg/SVGToOTFFontConversion.cpp:
3228         (WebCore::clampTo): Deleted.
3229
3230 2018-03-03  Zalan Bujtas  <zalan@apple.com>
3231
3232         [RenderTreeBuilder] Move styleDidChange mutation logic to RenderTreeUpdater
3233         https://bugs.webkit.org/show_bug.cgi?id=183273
3234         <rdar://problem/38054892>
3235
3236         Reviewed by Antti Koivisto.
3237
3238         Covered by existing tests.
3239
3240         * rendering/RenderBlockFlow.cpp:
3241         (WebCore::RenderBlockFlow::styleDidChange):
3242         * rendering/RenderElement.cpp:
3243         (WebCore::RenderElement::styleDidChange):
3244         (WebCore::RenderElement::noLongerAffectsParentBlock const): Deleted.
3245         * rendering/RenderElement.h:
3246         * rendering/updating/RenderTreeUpdater.cpp:
3247         (WebCore::RenderTreeUpdater::updateElementRenderer):
3248
3249 2018-03-03  Yoav Weiss  <yoav@yoav.ws>
3250
3251         Link headers for subresources are not being processes
3252         https://bugs.webkit.org/show_bug.cgi?id=181789
3253
3254         Reviewed by Youenn Fablet.
3255
3256         Triggers Link header processing when the Link headers arrive on a subresource.
3257
3258         Test: http/tests/preload/link-header-on-subresource.html
3259
3260         * loader/LinkLoader.cpp:
3261         (WebCore::LinkLoader::loadLinksFromHeader): Change the media check conditions.
3262         * loader/LinkLoader.h: Add a third state for media checks.
3263         * loader/SubresourceLoader.cpp:
3264         (WebCore::SubresourceLoader::didReceiveResponse): Preload links from headers for subresources.
3265
3266 2018-03-02  Yusuke Suzuki  <utatane.tea@gmail.com>
3267
3268         [WTF] Remove RunLoop and RunLoop::Timer's interface using double as seconds
3269         https://bugs.webkit.org/show_bug.cgi?id=183293
3270
3271         Reviewed by Alex Christensen.
3272
3273         * platform/graphics/texmap/TextureMapperPlatformLayerProxy.cpp:
3274         (WebCore::TextureMapperPlatformLayerProxy::dropCurrentBufferWhilePreservingTexture):
3275
3276 2018-03-02  Dean Jackson  <dino@apple.com>
3277
3278         Remove NP_GLContext since it is unsupported
3279         https://bugs.webkit.org/show_bug.cgi?id=183305
3280         <rdar://problem/36875555>
3281
3282         Reviewed by Simon Fraser.
3283
3284         * plugins/npapi.h: Remove NP_GLContext and mention that
3285         it is not supported.
3286
3287 2018-03-02  Chris Dumez  <cdumez@apple.com>
3288
3289         imported/w3c/web-platform-tests/html/browsers/history/the-location-interface/location-protocol-setter-non-broken.html crashes with async policy delegates
3290         https://bugs.webkit.org/show_bug.cgi?id=183294
3291         <rdar://problem/38073596>
3292
3293         Reviewed by Youenn Fablet.
3294
3295         Drop code that was added to SubresourceLoader::willCancel() in r228852. The purpose of this code
3296         was to make sure that SubresourceLoader::m_policyForResponseCompletionHandler always gets called,
3297         even when the load is cancelled. However, this code is not needed (since m_policyForResponseCompletionHandler
3298         is a CompletionHandler, an assertion will be hit if we fail to call it and we'll know). Calling
3299         the completionHandler inside SubresourceLoader::willCancel() is too early and leads to crashes.
3300
3301         The completionHandler currently gets called DocumentLoader::responseReceived() via a call to
3302         mainResourceLoader->didReceiveResponsePolicy(). Note that in r229177, we made sure that the
3303         call to didReceiveResponsePolicy() happens *after* the call to continueAfterContentPolicy()
3304         to maintain our non-async policy delegate behavior. However, continueAfterContentPolicy()
3305         would end up calling willCancel() and call the completionHandler when shouldContinue was
3306         false.
3307
3308         Test: http/wpt/html/browsers/history/the-location-interface/location-protocol-setter-non-broken-async-delegate.html
3309
3310         * loader/SubresourceLoader.cpp:
3311         (WebCore::SubresourceLoader::willCancel):
3312
3313 2018-03-02  Tim Horton  <timothy_horton@apple.com>
3314
3315         Fix the build after r229185 and r229184
3316
3317         * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
3318         (WebCore::exernalDeviceDisplayNameForPlayer):
3319         * platform/ios/DeviceOrientationClientIOS.h:
3320         * platform/ios/DeviceOrientationClientIOS.mm:
3321
3322 2018-03-02  Tim Horton  <timothy_horton@apple.com>
3323
3324         Make the !ENABLE(DEVICE_ORIENTATION) iOS build succeed
3325         https://bugs.webkit.org/show_bug.cgi?id=183296
3326
3327         Reviewed by Dan Bernstein.
3328
3329         * platform/ios/DeviceMotionClientIOS.h:
3330         * platform/ios/DeviceMotionClientIOS.mm:
3331         * platform/ios/WebCoreMotionManager.h:
3332         * platform/ios/WebCoreMotionManager.mm:
3333
3334 2018-03-02  Tim Horton  <timothy_horton@apple.com>
3335
3336         Make it possible to build for iOS without Celestial
3337         https://bugs.webkit.org/show_bug.cgi?id=183295
3338         <rdar://problem/38074468>
3339
3340         Reviewed by Dan Bernstein.
3341
3342         * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
3343         (WebCore::exernalDeviceDisplayNameForPlayer):
3344
3345 2018-03-02  Youenn Fablet  <youenn@apple.com>
3346
3347         Clients should register to StorageProcess with their service worker registration identifier
3348         https://bugs.webkit.org/show_bug.cgi?id=182313
3349         <rdar://problem/38044403>
3350
3351         Reviewed by Chris Dumez.
3352
3353         Relanding with fixing matchAll for uncontrolled clients.
3354
3355         No observable change of behavior in regular conditions.