color-gamut media query shouldn't ASSERT on invalid values
[WebKit-https.git] / Source / WebCore / ChangeLog
1 2016-10-11  Dean Jackson  <dino@apple.com>
2
3         color-gamut media query shouldn't ASSERT on invalid values
4         https://bugs.webkit.org/show_bug.cgi?id=163303
5         <rdar://problem/28724566>
6
7         Reviewed by Simon Fraser.
8
9         Remove the ASSERT_NOT_REACHED in the evaluation, since it
10         can be hit when there is a valid CSS keyword that is not
11         expected in the query.
12
13         Updated fast/media/mq-color-gamut.html
14
15         * css/MediaQueryEvaluator.cpp:
16         (WebCore::colorGamutEvaluate):
17
18 2016-10-11  Chris Dumez  <cdumez@apple.com>
19
20         Update MediaStream events to stop using legacy [ConstructorTemplate=Event]
21         https://bugs.webkit.org/show_bug.cgi?id=163289
22
23         Reviewed by Sam Weinig.
24
25         Update MediaStream events to stop using legacy [ConstructorTemplate=Event]
26         and use regular constructors instead.
27
28         * Modules/mediastream/MediaStreamEvent.cpp:
29         (WebCore::MediaStreamEvent::create):
30         (WebCore::MediaStreamEvent::MediaStreamEvent):
31         * Modules/mediastream/MediaStreamEvent.h:
32         * Modules/mediastream/MediaStreamEvent.idl:
33         * Modules/mediastream/MediaStreamTrackEvent.cpp:
34         (WebCore::MediaStreamTrackEvent::create):
35         (WebCore::MediaStreamTrackEvent::MediaStreamTrackEvent):
36         * Modules/mediastream/MediaStreamTrackEvent.h:
37         * Modules/mediastream/MediaStreamTrackEvent.idl:
38         * Modules/mediastream/OverconstrainedErrorEvent.h:
39         (WebCore::OverconstrainedErrorEvent::create):
40         (WebCore::OverconstrainedErrorEvent::OverconstrainedErrorEvent):
41         (WebCore::OverconstrainedErrorEvent::~OverconstrainedErrorEvent): Deleted.
42         * Modules/mediastream/OverconstrainedErrorEvent.idl:
43         * Modules/mediastream/RTCDTMFToneChangeEvent.cpp:
44         (WebCore::RTCDTMFToneChangeEvent::create):
45         (WebCore::RTCDTMFToneChangeEvent::RTCDTMFToneChangeEvent):
46         * Modules/mediastream/RTCDTMFToneChangeEvent.h:
47         * Modules/mediastream/RTCDTMFToneChangeEvent.idl:
48         * Modules/mediastream/RTCTrackEvent.cpp:
49         (WebCore::RTCTrackEvent::create):
50         (WebCore::RTCTrackEvent::RTCTrackEvent):
51         * Modules/mediastream/RTCTrackEvent.h:
52         * Modules/mediastream/RTCTrackEvent.idl:
53
54 2016-10-11  Chris Dumez  <cdumez@apple.com>
55
56         Update UIRequestEvent to stop using legacy [ConstructorTemplate=Event]
57         https://bugs.webkit.org/show_bug.cgi?id=163288
58
59         Reviewed by Darin Adler.
60
61         Update UIRequestEvent to stop using legacy [ConstructorTemplate=Event]
62         and use a constructor as in the specification:
63         - https://dvcs.w3.org/hg/IndieUI/raw-file/default/src/indie-ui-events.html#UIRequestEvent
64
65         * Modules/indieui/UIRequestEvent.cpp:
66         (WebCore::UIRequestEvent::create):
67         (WebCore::UIRequestEvent::UIRequestEvent):
68         (WebCore::UIRequestEvent::createForBindings): Deleted.
69         * Modules/indieui/UIRequestEvent.h:
70         * Modules/indieui/UIRequestEvent.idl:
71
72 2016-10-11  Dean Jackson  <dino@apple.com>
73
74         Implement prefers-reduced-motion media query
75         https://bugs.webkit.org/show_bug.cgi?id=163250
76         <rdar://problem/28704129>
77
78         Reviewed by Simon Fraser.
79
80         Implement the prefers-reduced-motion media query, as
81         described in https://github.com/w3c/csswg-drafts/issues/442.
82
83         Tests: fast/media/mq-prefers-reduced-motion-forced-value.html
84                fast/media/mq-prefers-reduced-motion.html
85
86         * Configurations/WebCoreTestSupport.xcconfig: Link against AppKit and UIKit.
87
88         * css/CSSValueKeywords.in: New keyword for "reduce".
89
90         * css/MediaFeatureNames.h: Add prefers-reduced-motion.
91         * css/MediaQueryEvaluator.cpp:
92         (WebCore::prefersReducedMotionEvaluate):
93         * css/MediaQueryExp.cpp:
94         (WebCore::featureWithValidIdent):
95         (WebCore::isFeatureValidWithoutValue):
96
97         * platform/Theme.h: New API to detect the system accessibility settings.
98         (WebCore::Theme::userPrefersReducedMotion):
99         * platform/ios/ThemeIOS.h:
100         * platform/ios/ThemeIOS.mm:
101         (WebCore::ThemeIOS::userPrefersReducedMotion):
102         * platform/mac/ThemeMac.h:
103         * platform/mac/ThemeMac.mm:
104         (WebCore::ThemeMac::userPrefersReducedMotion):
105
106         * testing/Internals.cpp: Expose the same API to internals, so that
107         a test can examine the value too.
108         (WebCore::Internals::userPrefersReducedMotion):
109         * testing/Internals.h:
110         * testing/Internals.idl:
111         * testing/Internals.mm:
112         (WebCore::Internals::userPrefersReducedMotion):
113
114         * page/Settings.h: New setting to override the system value...
115         * page/Settings.in:
116
117         * testing/InternalSettings.cpp: ... plumbed through internals.
118         (WebCore::InternalSettings::Backup::Backup):
119         (WebCore::InternalSettings::Backup::restoreTo):
120         (WebCore::InternalSettings::forcedPrefersReducedMotionValue):
121         (WebCore::InternalSettings::setForcedPrefersReducedMotionValue):
122         * testing/InternalSettings.h:
123         * testing/InternalSettings.idl:
124         * testing/Internals.cpp:
125         (WebCore::Internals::userPrefersReducedMotion):
126         * testing/Internals.h:
127         * testing/Internals.idl:
128         * testing/Internals.mm:
129         (WebCore::Internals::userPrefersReducedMotion):
130
131
132 2016-10-10  Ryosuke Niwa  <rniwa@webkit.org>
133
134         Annotate DOM API with CEReactions
135         https://bugs.webkit.org/show_bug.cgi?id=163268
136
137         Reviewed by Darin Adler.
138
139         Added CEReactions IDL attribute to APIs defined in https://dom.spec.whatwg.org.
140
141         No new tests since existing tests cover the code change.
142         Added a dedicated code generation test: JSTestCEReactions.idl and TestCEReactionsStringifier.idl.
143
144         * bindings/scripts/CodeGeneratorJS.pm:
145         (GenerateImplementation): Generate CustomElementReactionStack in attribute setters. In the case of PutForwards,
146         check the extended attributes of the target attribute's stringifier.
147         * bindings/scripts/test/JS/JSTestCEReactions.cpp: Added.
148         * bindings/scripts/test/JS/JSTestCEReactions.h: Added.
149         * bindings/scripts/test/JS/JSTestCEReactionsStringifier.cpp: Added.
150         * bindings/scripts/test/JS/JSTestCEReactionsStringifier.h: Added.
151         * bindings/scripts/test/JS/JSTestObj.cpp:
152         (WebCore::jsTestObjPrototypeFunctionMethodWithNeedsCustomElementReactionStack): Deleted.
153         * bindings/scripts/test/TestCEReactions.idl: Added.
154         * bindings/scripts/test/TestCEReactionsStringifier.idl: Added.
155         * bindings/scripts/test/TestObj.idl:
156         * dom/Attr.idl:
157         * dom/ChildNode.idl:
158         * dom/Document.idl:
159         * dom/Element.idl:
160         * dom/NamedNodeMap.idl:
161         * dom/Node.idl:
162         * dom/ParentNode.idl:
163         * dom/Range.idl:
164         * html/DOMTokenList.idl:
165
166 2016-10-11  Chris Dumez  <cdumez@apple.com>
167
168         Update CloseEvent to stop using legacy [ConstructorTemplate=Event]
169         https://bugs.webkit.org/show_bug.cgi?id=163293
170
171         Reviewed by Darin Adler.
172
173         Update CloseEvent to stop using legacy [ConstructorTemplate=Event] and
174         use a regular constructor as in the specification:
175         - https://html.spec.whatwg.org/multipage/comms.html#the-closeevent-interfaces
176
177         No new tests, updated existing test.
178
179         * Modules/websockets/CloseEvent.h:
180         (WebCore::CloseEvent::create):
181         (WebCore::CloseEvent::CloseEvent):
182         * Modules/websockets/CloseEvent.idl:
183
184 2016-10-11  Yusuke Suzuki  <utatane.tea@gmail.com>
185
186         [DOMJIT] DOMJIT::Patchpoint should have a way to receive constant folded arguments
187         https://bugs.webkit.org/show_bug.cgi?id=163224
188
189         Reviewed by Filip Pizlo.
190
191         * domjit/DOMJITHelpers.h:
192         (WebCore::DOMJITHelpers::toWrapper):
193         * domjit/JSNodeDOMJIT.cpp:
194         (WebCore::createCallDOMForOffsetAccess):
195
196 2016-10-11  Alex Christensen  <achristensen@webkit.org>
197
198         Enable URLParser by default
199         https://bugs.webkit.org/show_bug.cgi?id=162660
200         <rdar://28601706>
201
202         Reviewed by Sam Weinig.
203
204         Covered by updates to many LayoutTests.
205
206         * platform/URLParser.cpp:
207         Make the default value true for URLParser::enabled.
208         This is the most impactful and well-documented one-line change I've ever written.
209
210 2016-10-11  Daniel Bates  <dabates@apple.com>
211
212         [iOS] REGRESSION (r197953): User gesture required to load video in iOS 9-built apps
213         https://bugs.webkit.org/show_bug.cgi?id=163244
214         <rdar://problem/27250015>
215
216         Reviewed by Jer Noble.
217
218         Adds a new setting to toggle requiring a user gesture to load a video (enabled by default).
219         Disable this setting for apps built against iOS 9 or earlier.
220
221         Tests: media/loadedmetadata-fires-without-user-gesture-when-setRequiresUserGestureToLoadVideo-false.html
222                media/require-user-gesture-to-load-video.html
223
224         * html/HTMLMediaElement.cpp:
225         (WebCore::HTMLMediaElement::HTMLMediaElement): Only require a user gesture to load a video
226         when Settings::requiresUserGestureToLoadVideo() is true.
227         * page/Settings.cpp: Enable setting requiresUserGestureToLoadVideo by default.
228         * page/Settings.in: Add setting, requiresUserGestureToLoadVideo.
229
230 2016-10-11  Sam Weinig  <sam@webkit.org>
231
232         Fix the iOS build.
233
234         * bindings/js/JSDOMConvert.h:
235
236 2016-10-11  Daniel Bates  <dabates@apple.com>
237
238         [iOS] Sandbox QuickLook previews
239         https://bugs.webkit.org/show_bug.cgi?id=163240
240         <rdar://problem/25961633>
241
242         Fix bad merge following r207151.
243
244         * platform/network/cf/ResourceResponse.h: Define m_isQuickLook.
245
246 2016-10-11  Daniel Bates  <dabates@apple.com>
247
248         [iOS] Sandbox QuickLook previews
249         https://bugs.webkit.org/show_bug.cgi?id=163240
250         <rdar://problem/25961633>
251
252         Reviewed by Brent Fulgham.
253
254         Use a unique origin for- and limit the capabilities of- QuickLook previews.
255
256         Tests: http/tests/quicklook/at-import-stylesheet-blocked.html
257                http/tests/quicklook/base-url-blocked.html
258                http/tests/quicklook/cross-origin-iframe-blocked.html
259                http/tests/quicklook/csp-header-ignored.html
260                http/tests/quicklook/document-domain-is-empty-string.html
261                http/tests/quicklook/external-stylesheet-blocked.html
262                http/tests/quicklook/hide-referer-on-navigation.html
263                http/tests/quicklook/submit-form-blocked.html
264                http/tests/quicklook/top-navigation-blocked.html
265
266         * dom/Document.cpp:
267         (WebCore::Document::processHttpEquiv): Call ContentSecurityPolicy::didReceiveHeader().
268         (WebCore::Document::processReferrerPolicy): Do not process referrer policy for QuickLook previews.
269         (WebCore::Document::initSecurityContext): Apply sandbox for QuickLook previews.
270         (WebCore::Document::shouldEnforceQuickLookSandbox): Added.
271         (WebCore::Document::applyQuickLookSandbox): Added.
272         * dom/Document.h:
273         * page/csp/ContentSecurityPolicy.h: Change accessibility of didReceiveHeader() from private to public.
274         (WebCore::ContentSecurityPolicy::processHTTPEquiv): Deleted.
275         * platform/network/cf/ResourceResponse.h:
276         (WebCore::ResourceResponse::isQuickLook): Added.
277         (WebCore::ResourceResponse::setIsQuickLook): Added.
278         * platform/network/cf/SynchronousResourceHandleCFURLConnectionDelegate.cpp:
279         (WebCore::SynchronousResourceHandleCFURLConnectionDelegate::didReceiveResponse): Modified to mark
280         resource response as a QuickLook preview, if appropriate. Also remove the name of the first argument
281         and the need to use UNUSED_PARAM(connection) as we no longer make use of the first argument
282         following r207151.
283         * platform/network/ios/QuickLook.mm:
284         (-[WebResourceLoaderQuickLookDelegate _sendDidReceiveResponseIfNecessary]): Ditto.
285         * platform/network/mac/WebCoreResourceHandleAsDelegate.mm:
286         (-[WebCoreResourceHandleAsDelegate connection:didReceiveResponse:]): Ditto. Fix style nits,
287         including renaming the function argument "r" to "resource" to better describe its purpose.
288
289 2016-10-11  Alex Christensen  <achristensen@webkit.org>
290
291         Fix bindings tests after r207150.
292
293         * bindings/scripts/test/JS/JSTestObj.cpp:
294         (WebCore::convertDictionary<TestObj::Dictionary>):
295
296 2016-10-11  Alex Christensen  <achristensen@webkit.org>
297
298         URLParser should percent-encode non-ASCII and non-printable characters in fragment
299         https://bugs.webkit.org/show_bug.cgi?id=163287
300
301         Reviewed by Brady Eidson.
302
303         Based on discussion in https://github.com/whatwg/url/issues/150
304         If that discussion decides to keep the spec as-is (which keeps non-ASCII characters in the fragment
305         to match IE and Edge's behavior, which Chrome has followed for special schemes) then we can revert
306         this change later after enabling the URL parser.  Making this change keeps behavior matching Safari
307         and Firefox, as well as Chrome's handling of non-special schemes, such as data URLs.
308
309         Covered by updated API tests.
310
311         * platform/URLParser.cpp:
312         (WebCore::URLParser::appendToASCIIBuffer):
313         (WebCore::URLParser::copyURLPartsUntil):
314         (WebCore::URLParser::syntaxViolation):
315         (WebCore::URLParser::currentPosition):
316         (WebCore::URLParser::parse):
317         (WebCore::URLParser::fragmentSyntaxViolation): Deleted.
318         * platform/URLParser.h:
319         No more non-ASCII characters in canonicalized URLs.
320
321 2016-10-11  Alex Christensen  <achristensen@webkit.org>
322
323         Remove dead networking code
324         https://bugs.webkit.org/show_bug.cgi?id=163263
325
326         Reviewed by Daniel Bates.
327
328         There are no more Cocoa platforms using CFURLConnection.
329         USE(CFNETWORK) is being replaced by USE(CFURLCONNECTION) and it is only used on the AppleWin port.
330
331         No change in behavior.
332
333         * WebCore.xcodeproj/project.pbxproj:
334         * WebCorePrefix.h:
335         * loader/DocumentLoader.h:
336         * loader/EmptyClients.h:
337         * loader/FrameLoaderClient.h:
338         * loader/ResourceLoader.cpp:
339         (WebCore::ResourceLoader::didReceiveAuthenticationChallenge):
340         * loader/ResourceLoader.h:
341         * loader/SubresourceLoader.h:
342         * loader/cf/ResourceLoaderCFNet.cpp:
343         * loader/cocoa/SubresourceLoaderCocoa.mm:
344         (WebCore::SubresourceLoader::willCacheResponse): Deleted.
345         * loader/mac/DocumentLoaderMac.cpp:
346         * loader/mac/ResourceLoaderMac.mm:
347         (WebCore::ResourceLoader::willCacheResponse): Deleted.
348         * page/mac/PageMac.mm:
349         (WebCore::Page::platformInitialize):
350         (WebCore::Page::addSchedulePair):
351         (WebCore::Page::removeSchedulePair):
352         * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
353         (WebCore::MediaPlayerPrivateAVFoundationObjC::shouldWaitForResponseToAuthenticationChallenge):
354         (WebCore::WebCoreNSURLAuthenticationChallengeClient::create): Deleted.
355         (WebCore::WebCoreNSURLAuthenticationChallengeClient::WebCoreNSURLAuthenticationChallengeClient): Deleted.
356         * platform/mac/WebCoreSystemInterface.h:
357         * platform/network/NetworkStorageSession.h:
358         * platform/network/ProtectionSpace.h:
359         * platform/network/ProtectionSpaceBase.cpp:
360         * platform/network/ResourceHandle.cpp:
361         * platform/network/ResourceHandle.h:
362         * platform/network/ResourceHandleClient.cpp:
363         * platform/network/ResourceHandleClient.h:
364         (WebCore::ResourceHandleClient::willCacheResponse):
365         (WebCore::ResourceHandleClient::shouldCacheResponse):
366         * platform/network/ResourceHandleInternal.h:
367         (WebCore::ResourceHandleInternal::ResourceHandleInternal):
368         * platform/network/ResourceRequestBase.cpp:
369         * platform/network/cf/AuthenticationCF.cpp:
370         (WebCore::AuthenticationChallenge::AuthenticationChallenge):
371         (WebCore::createCF):
372         (WebCore::core):
373         * platform/network/cf/AuthenticationCF.h:
374         * platform/network/cf/AuthenticationChallenge.h:
375         * platform/network/cf/CookieJarCFNet.cpp:
376         * platform/network/cf/CredentialStorageCFNet.cpp:
377         (WebCore::CredentialStorage::getFromPersistentStorage):
378         (WebCore::CredentialStorage::saveToPersistentStorage): Deleted.
379         * platform/network/cf/LoaderRunLoopCF.cpp:
380         * platform/network/cf/LoaderRunLoopCF.h:
381         * platform/network/cf/NetworkStorageSessionCFNet.cpp:
382         (WebCore::NetworkStorageSession::cookieStorage):
383         * platform/network/cf/ProtectionSpaceCFNet.cpp:
384         * platform/network/cf/ProtectionSpaceCFNet.h:
385         * platform/network/cf/ResourceError.h:
386         * platform/network/cf/ResourceErrorCF.cpp:
387         * platform/network/cf/ResourceHandleCFNet.cpp:
388         (WebCore::shouldSniffConnectionProperty):
389         (WebCore::ResourceHandle::createCFURLConnection):
390         (WebCore::ResourceHandle::start):
391         (WebCore::ResourceHandle::didReceiveAuthenticationChallenge):
392         (WebCore::ResourceHandle::tryHandlePasswordBasedAuthentication):
393         (WebCore::ResourceHandle::receivedCredential):
394         (WebCore::ResourceHandle::schedule): Deleted.
395         (WebCore::ResourceHandle::unschedule): Deleted.
396         * platform/network/cf/ResourceHandleCFURLConnectionDelegate.cpp:
397         * platform/network/cf/ResourceHandleCFURLConnectionDelegate.h:
398         * platform/network/cf/ResourceHandleCFURLConnectionDelegateWithOperationQueue.cpp:
399         (WebCore::ResourceHandleCFURLConnectionDelegateWithOperationQueue::setupRequest):
400         (WebCore::ResourceHandleCFURLConnectionDelegateWithOperationQueue::didReceiveResponse):
401         (WebCore::ResourceHandleCFURLConnectionDelegateWithOperationQueue::canRespondToProtectionSpace):
402         * platform/network/cf/ResourceHandleCFURLConnectionDelegateWithOperationQueue.h:
403         * platform/network/cf/ResourceRequest.h:
404         (WebCore::ResourceRequest::encodingRequiresPlatformData):
405         * platform/network/cf/ResourceRequestCFNet.cpp:
406         (WebCore::findCFURLRequestCopyContentDispositionEncodingFallbackArrayFunction):
407         (WebCore::ResourceRequest::doUpdatePlatformRequest):
408         (WebCore::ResourceRequest::doUpdatePlatformHTTPBody):
409         (WebCore::ResourceRequest::doUpdateResourceRequest):
410         (WebCore::ResourceRequest::setStorageSession):
411         (WebCore::findCFURLRequestSetContentDispositionEncodingFallbackArrayFunction): Deleted.
412         * platform/network/cf/ResourceRequestCFNet.h:
413         * platform/network/cf/ResourceResponse.h:
414         (WebCore::ResourceResponse::ResourceResponse):
415         * platform/network/cf/ResourceResponseCFNet.cpp:
416         (WebCore::ResourceResponse::cfURLResponse):
417         (WebCore::ResourceResponse::platformCertificateInfo):
418         * platform/network/cf/SynchronousLoaderClientCFNet.cpp:
419         * platform/network/cf/SynchronousResourceHandleCFURLConnectionDelegate.cpp:
420         (WebCore::SynchronousResourceHandleCFURLConnectionDelegate::setupRequest):
421         (WebCore::SynchronousResourceHandleCFURLConnectionDelegate::setupConnectionScheduling):
422         (WebCore::adjustMIMETypeIfNecessary):
423         (WebCore::SynchronousResourceHandleCFURLConnectionDelegate::didReceiveResponse):
424         (WebCore::SynchronousResourceHandleCFURLConnectionDelegate::willCacheResponse):
425         (WebCore::SynchronousResourceHandleCFURLConnectionDelegate::canRespondToProtectionSpace):
426         * platform/network/cf/SynchronousResourceHandleCFURLConnectionDelegate.h:
427         * platform/network/cocoa/CredentialCocoa.h:
428         * platform/network/cocoa/CredentialCocoa.mm:
429         (WebCore::Credential::Credential): Deleted.
430         (WebCore::Credential::cfCredential): Deleted.
431         * platform/network/cocoa/ProtectionSpaceCocoa.h:
432         * platform/network/cocoa/ProtectionSpaceCocoa.mm:
433         (WebCore::ProtectionSpace::ProtectionSpace): Deleted.
434         (WebCore::ProtectionSpace::cfSpace): Deleted.
435         * platform/network/cocoa/ResourceRequestCocoa.mm:
436         (WebCore::ResourceRequest::nsURLRequest):
437         * platform/network/cocoa/ResourceResponseCocoa.mm:
438         (WebCore::ResourceResponse::platformCertificateInfo):
439         (WebCore::ResourceResponse::nsURLResponse): Deleted.
440         (WebCore::ResourceResponse::ResourceResponse): Deleted.
441         * platform/network/ios/QuickLook.h:
442         * platform/network/ios/QuickLook.mm:
443         (-[WebQuickLookHandleAsDelegate initWithConnectionDelegate:]): Deleted.
444         (-[WebQuickLookHandleAsDelegate connection:didReceiveDataArray:]): Deleted.
445         (-[WebQuickLookHandleAsDelegate connection:didReceiveData:lengthReceived:]): Deleted.
446         (-[WebQuickLookHandleAsDelegate connectionDidFinishLoading:]): Deleted.
447         (-[WebQuickLookHandleAsDelegate connection:didFailWithError:]): Deleted.
448         (-[WebQuickLookHandleAsDelegate detachHandle]): Deleted.
449         (WebCore::QuickLookHandle::create): Deleted.
450         (WebCore::QuickLookHandle::cfResponse): Deleted.
451         * platform/network/ios/ResourceHandleIOS.mm: Removed.
452         * platform/network/ios/ResourceRequestIOS.mm: Removed.
453         * platform/network/mac/AuthenticationMac.mm:
454         (-[WebCoreAuthenticationClientAsChallengeSender setCFChallenge:]): Deleted.
455         (-[WebCoreAuthenticationClientAsChallengeSender cfChallenge]): Deleted.
456         (WebCore::core): Deleted.
457         (WebCore::mac): Deleted.
458         * platform/network/mac/CookieJarMac.mm:
459         (WebCore::setCookiesFromDOM):
460         (WebCore::cookieStorage):
461         (WebCore::addCookie):
462         * platform/network/mac/CredentialStorageMac.mm:
463         * platform/network/mac/FormDataStreamMac.h:
464         * platform/network/mac/FormDataStreamMac.mm:
465         * platform/network/mac/ResourceErrorMac.mm:
466         (NSErrorFromCFError): Deleted.
467         (WebCore::ResourceError::ResourceError): Deleted.
468         (WebCore::ResourceError::nsError): Deleted.
469         (WebCore::ResourceError::operator NSError *): Deleted.
470         * platform/network/mac/ResourceHandleMac.mm:
471         (WebCore::ResourceHandle::continueWillCacheResponse):
472         (WebCore::ResourceHandle::getConnectionTimingData): Deleted.
473         * platform/network/mac/ResourceRequestMac.mm: Removed.
474         * platform/network/mac/SynchronousLoaderClient.mm:
475         (WebCore::SynchronousLoaderClient::platformBadResponseError):
476         * platform/network/mac/WebCoreResourceHandleAsDelegate.h:
477         * platform/network/mac/WebCoreResourceHandleAsDelegate.mm:
478         * platform/network/mac/WebCoreResourceHandleAsOperationQueueDelegate.h:
479         * platform/network/mac/WebCoreResourceHandleAsOperationQueueDelegate.mm:
480         * platform/network/mac/WebCoreURLResponse.mm:
481         (WebCore::synthesizeRedirectResponseIfNecessary):
482         * platform/win/TemporaryLinkStubs.cpp:
483         * testing/js/WebCoreTestSupportPrefix.h:
484
485 2016-10-10  Sam Weinig  <sam@webkit.org>
486
487         Use IDLTypes in more places
488         https://bugs.webkit.org/show_bug.cgi?id=163247
489
490         Reviewed by Darin Adler.
491
492         Switch JS -> Native type conversions to use convert<IDLType>(...) rather
493         than convert<NativeType>(...). This allows us to differentiate things like
494         conversion from JSValue to DOMString vs. JSValue to USVString which have different
495         rules.
496
497         * bindings/generic/IDLTypes.h:
498         Add predicate for integer types.
499
500         * bindings/js/IDBBindingUtilities.cpp:
501         (WebCore::idbKeyPathFromValue):
502         * bindings/js/JSApplePaySessionCustom.cpp:
503         (WebCore::JSApplePaySession::completeShippingMethodSelection):
504         (WebCore::JSApplePaySession::completeShippingContactSelection):
505         * bindings/js/JSCryptoAlgorithmDictionary.cpp:
506         (WebCore::createAesKeyGenParams):
507         (WebCore::createRsaKeyGenParams):
508         * bindings/js/JSCustomElementRegistryCustom.cpp:
509         (WebCore::JSCustomElementRegistry::define):
510         * bindings/js/JSDocumentCustom.cpp:
511         (WebCore::JSDocument::getCSSCanvasContext):
512         * bindings/js/JSMockContentFilterSettingsCustom.cpp:
513         (WebCore::JSMockContentFilterSettings::setDecisionPoint):
514         (WebCore::toDecision):
515         * bindings/js/JSNodeFilterCustom.cpp:
516         (WebCore::JSNodeFilter::acceptNode):
517         Switch to new convert<IDLType> style.
518
519         * bindings/js/JSDOMBinding.h:
520         (WebCore::toRefPtrNativeArray): Deleted.
521         (WebCore::toNativeArray): Deleted.
522         These can now be called as convert<IDLSequence<IDLInterface<T>>> and convert<IDLType> respectively.
523
524         * bindings/js/JSDOMConvert.h:
525         (WebCore::Converter<IDLNullable<T>>::convert):
526         (WebCore::Converter<IDLBoolean>::convert):
527         (WebCore::Converter<IDLInterface<T>>::convert):
528         (WebCore::Converter<IDLByte>::convert):
529         (WebCore::Converter<IDLOctet>::convert):
530         (WebCore::Converter<IDLShort>::convert):
531         (WebCore::Converter<IDLUnsignedShort>::convert):
532         (WebCore::Converter<IDLLong>::convert):
533         (WebCore::Converter<IDLUnsignedLong>::convert):
534         (WebCore::Converter<IDLLongLong>::convert):
535         (WebCore::Converter<IDLUnsignedLongLong>::convert):
536         (WebCore::Converter<IDLFloat>::convert):
537         (WebCore::Converter<IDLUnrestrictedFloat>::convert):
538         (WebCore::Converter<IDLDouble>::convert):
539         (WebCore::Converter<IDLUnrestrictedDouble>::convert):
540         (WebCore::Converter<IDLDOMString>::convert):
541         (WebCore::Converter<IDLUSVString>::convert):
542         (WebCore::Detail::ArrayConverter::convert):
543         (WebCore::Converter<IDLSequence<T>>::convert):
544         (WebCore::Converter<IDLFrozenArray<T>>::convert):
545         (WebCore::Converter<IDLDictionary<T>>::convert):
546         (WebCore::Converter<IDLEnumeration<T>>::convert):
547         (WebCore::Detail::VariadicConverterBase::convert):
548         (WebCore::Detail::VariadicConverterBase<IDLInterface<T>>::convert):
549         (WebCore::convertVariadicArguments):
550         (WebCore::convertWrapperType): Deleted.
551         (WebCore::convertWrapperTypeSequence): Deleted.
552         (WebCore::Converter<bool>::convert): Deleted.
553         (WebCore::Converter<String>::convert): Deleted.
554         (WebCore::Converter<Vector<T>>::convert): Deleted.
555         (WebCore::Converter<int8_t>::convert): Deleted.
556         (WebCore::Converter<uint8_t>::convert): Deleted.
557         (WebCore::Converter<int16_t>::convert): Deleted.
558         (WebCore::Converter<uint16_t>::convert): Deleted.
559         (WebCore::Converter<int32_t>::convert): Deleted.
560         (WebCore::Converter<uint32_t>::convert): Deleted.
561         (WebCore::Converter<int64_t>::convert): Deleted.
562         (WebCore::Converter<uint64_t>::convert): Deleted.
563         Switch Converter to be specialized on IDLTypes. Add support for IDLNullable, IDLSequence, and IDLFrozenArray.
564
565         * bindings/scripts/CodeGenerator.pm:
566         (GetFlattenedMemberTypes): Deleted.
567         (GetNumberOfNullableMemberTypes): Deleted.
568         (GetIDLUnionMemberTypes): Deleted.
569         (GetBaseIDLType): Deleted.
570         (GetIDLType): Deleted.
571         Move IDLType conversion logic to CodeGeneratorJS so it can use GetEnumerationClassName and GetDictionaryClassName.
572
573         * bindings/scripts/CodeGeneratorJS.pm:
574         (AddToImplIncludesForIDLType):
575         Add support for sequences, FrozenArrays and external dictionaries.
576
577         (GenerateEnumerationsImplementationContent):
578         (GenerateEnumerationsHeaderContent):
579         Change the name of parse<enum> and convert<enum> to parseEnumeration<enum> and convertEnumeration<enum>
580         to make them more consistent with dictionary conversion specialization and not interfere with the convert
581         function specialization.
582
583         (GenerateDictionaryImplementationContent):
584         Simplify by using convert<IDLType>.
585
586         (GetFlattenedMemberTypes):
587         (GetNumberOfNullableMemberTypes):
588         (GetIDLUnionMemberTypes):
589         (GetBaseIDLType):
590         (GetIDLType):
591         Moved from CodeGenerator.pm
592
593         (IsHandledByDOMConvert):
594         (JSValueToNative):
595         Start switching JSValueToNative over to using convert<IDLType>. Use IsHandledByDOMConvert as a predicate
596         for what is supported.
597
598         * bindings/scripts/IDLParser.pm:
599         (applyTypedefs):
600         (cloneType):
601         (applyTypedefsForSignature):
602         (parseTypedef):
603         (parseOperationOrIterator):
604         (parseSpecialOperation):
605         Make typedefs work with aggregate types (unions, sequences and FrozenArrays).
606
607         * bindings/scripts/test/JS/JSTestEventTarget.cpp:
608         * bindings/scripts/test/JS/JSTestGlobalObject.cpp:
609         * bindings/scripts/test/JS/JSTestObj.cpp:
610         * bindings/scripts/test/JS/JSTestObj.h:
611         * bindings/scripts/test/JS/JSTestOverloadedConstructorsWithSequence.cpp:
612         * bindings/scripts/test/JS/JSTestStandaloneDictionary.cpp:
613         * bindings/scripts/test/JS/JSTestTypedefs.cpp:
614         Update test results.
615
616         * bindings/scripts/test/TestTypedefs.idl:
617         Add additional tests for typedefs that use unions and sequences.
618
619         * testing/InternalSettings.idl:
620         Change the name of a parameter to avoid a name collision.
621
622 2016-10-11  Konstantin Tokarev  <annulen@yandex.ru>
623
624         Fixed compilation with !ENABLE(SVG_FONTS)
625         https://bugs.webkit.org/show_bug.cgi?id=163281
626
627         Reviewed by Csaba Osztrogonác.
628
629         No new tests needed.
630
631         * loader/cache/CachedResourceLoader.cpp:
632         (WebCore::CachedResourceLoader::shouldUpdateCachedResourceWithCurrentRequest):
633
634 2016-10-11  Brent Fulgham  <bfulgham@apple.com>
635
636         Unreviewed build fix after r207140.
637
638         * PlatformAppleWin.cmake: Add missing compile file.
639
640 2016-10-10  Brent Fulgham  <bfulgham@apple.com>
641
642         [Win][Direct2D] Add initial Pattern handling implementation
643         https://bugs.webkit.org/show_bug.cgi?id=163270
644
645         Reviewed by Simon Fraser.
646
647         Provide an implemenation of Patterns for Direct2D.
648
649         No new tests. Covered by fast/borders/border-image-01.html and others.
650
651         * platform/graphics/GraphicsContext.h:
652         * platform/graphics/Pattern.h: Add D2D definitions.
653         * platform/graphics/win/GraphicsContextDirect2D.cpp:
654         (WebCore::GraphicsContext::solidStrokeBrush): Use a more generic return type.
655         (WebCore::GraphicsContext::solidFillBrush): Ditto.
656         (WebCore::GraphicsContext::patternStrokeBrush): Added.
657         (WebCore::GraphicsContext::patternFillBrush): Added.
658         (WebCore::GraphicsContext::drawPattern): Provide D2D implementation.
659         (WebCore::GraphicsContext::applyStrokePattern): Ditto.
660         (WebCore::GraphicsContext::applyFillPattern): Ditto.
661         (WebCore::GraphicsContext::drawPath): Use stroke pattern if available.
662         (WebCore::GraphicsContext::fillPath): Use fill pattern if available.
663         (WebCore::GraphicsContext::strokePath): Use stroke pattern if available.
664         (WebCore::GraphicsContext::fillRect): Use fill pattern if available.
665         * platform/graphics/win/GraphicsContextPlatformPrivateDirect2D.h:
666         * platform/graphics/win/PatternDirect2D.cpp: Added.
667
668 2016-10-11  Per Arne Vollan  <pvollan@apple.com>
669
670         [Win] Compile fix.
671         https://bugs.webkit.org/show_bug.cgi?id=163272
672
673         Reviewed by Brent Fulgham.
674
675         When compiling with older SDKs, some CoreText symbols are redefined.
676         This patch checks if the relevant CoreText header file has been
677         included before defining the symbol.
678
679         * platform/spi/win/CoreTextSPIWin.h:
680
681 2016-10-11  Antoine Quint  <graouts@apple.com>
682
683         [Modern Media Controls] Buttons container
684         https://bugs.webkit.org/show_bug.cgi?id=163238
685         <rdar://problem/28701864>
686
687         Reviewed by Dean Jackson.
688
689         We add a new ButtonsContainer class which contains a group of Button objects
690         and positions them based on the provided padding and margin between buttons.
691         Buttons that aren't enabled or marked as dropped are not added to the tree of
692         LayoutNodes, and thus the DOM.
693
694         Additionally, we fix a few issues we found while working on tests for ButtonsContainer
695         where LayoutNodes would schedule layout callbacks even when they would not do any work
696         during the layout callback due to not resetting the `needsLayout` flag to false and
697         removing any scheduled tasks when a layout was completed.
698
699         Finally, we fix a few style issues that had not been caught so far and an unused
700         `size` property on IconButton.
701
702         Tests: media/modern-media-controls/buttons-container/buttons-container-buttons-property.html
703                media/modern-media-controls/buttons-container/buttons-container-constructor.html
704                media/modern-media-controls/buttons-container/buttons-container-layout.html
705
706         * Modules/modern-media-controls/controls/airplay-button.js:
707         (AirplayButton.prototype.set on):
708         (AirplayButton):
709         * Modules/modern-media-controls/controls/buttons-container.css:
710         (.buttons-container):
711         * Modules/modern-media-controls/controls/buttons-container.js:
712         (ButtonsContainer.prototype.get buttons):
713         (ButtonsContainer.prototype.set buttons):
714         (ButtonsContainer.prototype.layout):
715         * Modules/modern-media-controls/controls/icon-button.js:
716         * Modules/modern-media-controls/controls/layout-node.js:
717         (LayoutNode.prototype.set needsLayout):
718         (LayoutNode.prototype.markDirtyProperty):
719         (LayoutNode.prototype._markNodeManipulation):
720         (LayoutNode.prototype._updateDirtyState):
721         (performScheduledLayout):
722         (elementFromString):
723         * Modules/modern-media-controls/controls/scheduler.js:
724         (const.scheduler.new.prototype.unscheduleLayout):
725
726 2016-10-11  Youenn Fablet  <youenn@apple.com>
727
728         [Fetch API] Support Request cache mode
729         https://bugs.webkit.org/show_bug.cgi?id=162281
730
731         Reviewed by Alex Christensen.
732
733         Covered by updated test.
734
735         Added support for only-if-cached mode at Request level.
736
737         Added support for cache mode at CachedResourceLoader, by setting HTTP headers and ResourceRequest cache policy
738         based on https://fetch.spec.whatwg.org/#concept-request-cache-mode and https://fetch.spec.whatwg.org/#http-network-or-cache-fetch.
739
740         Disabled default cache policy computation (done in FrameLoader) when cache mode is different from the default.
741         Activated no-store cache mode for EventSource as per https://html.spec.whatwg.org/#the-eventsource-interface.
742
743         * Modules/fetch/FetchRequest.cpp:
744         (WebCore::setCache): Adding support for only-if-cached.
745         (WebCore::buildOptions): Throw if only-if-cached and fetch mode is not same-origin.
746         * loader/FetchOptions.h: Adding support for only-if-cached.
747         * loader/FrameLoader.cpp:
748         (WebCore::FrameLoader::defaultRequestCachingPolicy): Introduced to ease readability.
749         (WebCore::FrameLoader::addExtraFieldsToRequest): Updating cache policy only if request has the default cache policy.
750         This allows bypassing the default behavior for fetch cache mode different from "default".
751         * loader/FrameLoader.h:
752         * loader/cache/CachedResourceLoader.cpp:
753         (WebCore::updateRequestAccordingCacheMode): Introduced to set headers and request cache policy according fetch cache mode.
754         (WebCore::CachedResourceLoader::requestResource):
755         (WebCore::CachedResourceLoader::loadResource):
756         (WebCore::CachedResourceLoader::determineRevalidationPolicy): Ensure bypassing the memory cache in no-store and reload cases.
757         We reload in case of cache mode=reload to refresh the meory cache entry.
758         * loader/cache/CachedResourceRequest.h:
759         (WebCore::CachedResourceRequest::setCacheModeToNoStore):
760         * page/EventSource.cpp:
761         (WebCore::EventSource::connect): Use no-store cache mode as per https://html.spec.whatwg.org/#the-eventsource-interface.
762         * platform/network/HTTPHeaderMap.cpp:
763         (WebCore::HTTPHeaderMap::addIfNotPresent): Helper routine.
764         * platform/network/HTTPHeaderMap.h:
765         * platform/network/HTTPHeaderValues.cpp:
766         * platform/network/HTTPHeaderValues.h:
767         * platform/network/ResourceRequestBase.cpp:
768         (WebCore::ResourceRequestBase::addHTTPHeaderFieldIfNotPresent):
769         (WebCore::ResourceRequestBase::addHTTPHeaderField):
770         (WebCore::ResourceRequestBase::hasHTTPHeaderField):
771         * platform/network/ResourceRequestBase.h:
772
773 2016-10-10  Antti Koivisto  <antti@apple.com>
774
775         Stop copying author shadow pseudo rules into shadow tree style resolver
776         https://bugs.webkit.org/show_bug.cgi?id=163232
777
778         Reviewed by Darin Adler.
779
780         * css/ElementRuleCollector.cpp:
781         (WebCore::ElementRuleCollector::collectMatchingRules):
782         (WebCore::ElementRuleCollector::matchAuthorRules):
783         (WebCore::ElementRuleCollector::matchAuthorShadowPseudoElementRules):
784
785             If we are resolving a user agent shadow tree also look up pseudo element rules from the host scope author sheet.
786             This is needed to keep web exposed ::-webkit-foo pseudo elements working.
787
788         (WebCore::ElementRuleCollector::collectMatchingShadowPseudoElementRules):
789
790             Factor to a function.
791
792         * css/ElementRuleCollector.h:
793         * css/RuleSet.cpp:
794         (WebCore::RuleSet::copyShadowPseudoElementRulesFrom): Deleted.
795         * css/RuleSet.h:
796         * dom/Document.cpp:
797         (WebCore::Document::userAgentShadowTreeStyleResolver):
798         * style/StyleScope.cpp:
799         (WebCore::Style::Scope::updateStyleResolver):
800
801             No need to awkwardly copy these rules anymore.
802
803 2016-10-11  Chris Dumez  <cdumez@apple.com>
804
805         Update IDBVersionChangeEvent to stop using legacy [ConstructorTemplate=Event]
806         https://bugs.webkit.org/show_bug.cgi?id=163266
807
808         Reviewed by Darin Adler.
809
810         Update IDBVersionChangeEvent to stop using legacy [ConstructorTemplate=Event]
811         and use a regular constructor instead, as in the specification:
812         - http://w3c.github.io/IndexedDB/#request-idbversionchangeevent
813
814         This patch also fixes a bug where the IDBVersionChangeEvent was ignoring the
815         EventInit dictionary members passed by the JavaScript (e.g. bubbles).
816
817         No new tests, updated existing test.
818
819         * Modules/indexeddb/IDBVersionChangeEvent.cpp:
820         (WebCore::IDBVersionChangeEvent::IDBVersionChangeEvent):
821         * Modules/indexeddb/IDBVersionChangeEvent.h:
822         * Modules/indexeddb/IDBVersionChangeEvent.idl:
823         * bindings/js/JSDOMConvert.h:
824         (WebCore::convertNullable):
825         (WebCore::convert): Deleted.
826         * bindings/scripts/CodeGeneratorJS.pm:
827         (GenerateDefaultValue):
828         (GenerateDictionaryImplementationContent):
829         * bindings/scripts/test/JS/JSTestObj.cpp:
830         (WebCore::convertDictionary<TestObj::Dictionary>):
831         * bindings/scripts/test/TestObj.idl:
832
833 2016-10-11  Chris Dumez  <cdumez@apple.com>
834
835         Update WebKitPlaybackTargetAvailabilityEvent to stop using legacy [ConstructorTemplate=Event]
836         https://bugs.webkit.org/show_bug.cgi?id=163265
837
838         Reviewed by Darin Adler.
839
840         Update WebKitPlaybackTargetAvailabilityEvent to stop using legacy
841         [ConstructorTemplate=Event] and use a regular constructor instead.
842
843         * Modules/airplay/WebKitPlaybackTargetAvailabilityEvent.cpp:
844         (WebCore::WebKitPlaybackTargetAvailabilityEvent::WebKitPlaybackTargetAvailabilityEvent):
845         * Modules/airplay/WebKitPlaybackTargetAvailabilityEvent.h:
846         (WebCore::WebKitPlaybackTargetAvailabilityEvent::createForBindings):
847         (WebCore::WebKitPlaybackTargetAvailabilityEvent::~WebKitPlaybackTargetAvailabilityEvent): Deleted.
848         * Modules/airplay/WebKitPlaybackTargetAvailabilityEvent.idl:
849
850 2016-10-10  Zan Dobersek  <zdobersek@igalia.com>
851
852         Add ENABLE_ENCRYPTED_MEDIA configuration option
853         https://bugs.webkit.org/show_bug.cgi?id=163219
854
855         Reviewed by Darin Adler.
856
857         * Configurations/FeatureDefines.xcconfig:
858         Add the ENABLE_ENCRYPTED_MEDIA configuration option. It will be used
859         to enable or disable the new EME implementation at build-time.
860         * DerivedSources.make: Group the legacy option and the new option together.
861
862 2016-10-10  Youenn Fablet  <youenn@apple.com>
863
864         CachedResourceRequest constructor should be made more efficient
865         https://bugs.webkit.org/show_bug.cgi?id=163210
866
867         Reviewed by Alex Christensen.
868
869         No change of behavior.
870
871         Refactoring to use one CachedResourceRequest constructor that will move its request and charset to improve efficiency.
872
873         * css/StyleRuleImport.cpp:
874         (WebCore::StyleRuleImport::requestStyleSheet):
875         * dom/ProcessingInstruction.cpp:
876         (WebCore::ProcessingInstruction::checkStyleSheet):
877         * html/HTMLLinkElement.cpp:
878         (WebCore::HTMLLinkElement::process):
879         * html/parser/HTMLResourcePreloader.cpp:
880         (WebCore::PreloadRequest::resourceRequest):
881         * loader/cache/CachedResourceRequest.cpp:
882         (WebCore::CachedResourceRequest::CachedResourceRequest):
883         * loader/cache/CachedResourceRequest.h:
884
885 2016-10-10  Adam Bergkvist  <adam.bergkvist@ericsson.com> and Alejandro G. Castro <alex@igalia.com>
886
887         WebRTC: Make MediaEndpointPeerConnection handle remotely assigned mids correctly
888         https://bugs.webkit.org/show_bug.cgi?id=163202
889
890         Reviewed by Eric Carlson.
891
892         An RTCRtpTransceiver has a null mid until it's been associated with a
893         media description (with a mid) [1]. During that time, it's identified by
894         a provisional mid that might become its real mid, but the transceiver
895         can also get its mid assigned by a remote media description. In the
896         second case, the mid value is initially unknown. A transceiver's
897         RTCRtpSender must directly (synchronously in the script) provide a muted
898         remote source that is playable by, for example, a media element. This
899         source is initially registered in the MediaEndpoint (WebRTC backend)
900         with the transceiver's provisional mid. So, if the real mid is set by a
901         remote description, the registered mid must be updated to preserve the
902         association between the registered source and the transceiver.
903
904         [1] https://w3c.github.io/webrtc-pc/archives/20160913/webrtc.html#dom-rtcrtptransceiver-mid
905
906         Test: fast/mediastream/RTCPeerConnection-remotely-assigned-transceiver-mid.html
907
908         * Modules/mediastream/MediaEndpointPeerConnection.cpp:
909         Don't break after finding the first transceiver in the loop that builds the send source map.
910         Update the mid used to register the muted remote source if the a transceiver's mid gets
911         assigned by a remote media description.
912         (WebCore::createSourceMap):
913         (WebCore::MediaEndpointPeerConnection::setRemoteDescriptionTask):
914         * platform/mediastream/MediaEndpoint.cpp:
915         * platform/mediastream/MediaEndpoint.h:
916         * platform/mock/MockMediaEndpoint.cpp:
917         (WebCore::MockMediaEndpoint::MockMediaEndpoint):
918         (WebCore::MockMediaEndpoint::updateReceiveConfiguration):
919         (WebCore::MockMediaEndpoint::updateSendConfiguration):
920         (WebCore::MockMediaEndpoint::createMutedRemoteSource):
921         (WebCore::MockMediaEndpoint::replaceMutedRemoteSourceMid):
922         (WebCore::MockMediaEndpoint::emulatePlatformEvent):
923         Add "unmute-remote-sources-by-mid" action that emulates data arriving on media descriptions
924         which unmutes the remote sources.
925         (WebCore::MockMediaEndpoint::updateConfigurationMids):
926         (WebCore::MockMediaEndpoint::unmuteRemoteSourcesByMid):
927         (WebCore::MockMediaEndpoint::unmuteTimerFired):
928         * platform/mock/MockMediaEndpoint.h:
929
930 2016-10-10  Darin Adler  <darin@apple.com>
931
932         Move audio module off of legacy exceptions
933         https://bugs.webkit.org/show_bug.cgi?id=163269
934
935         Reviewed by Alex Christensen.
936
937         * Modules/webaudio/AnalyserNode.cpp:
938         (WebCore::AnalyserNode::setFftSize): Use ExceptionOr.
939         (WebCore::AnalyserNode::setMinDecibels): Ditto.
940         (WebCore::AnalyserNode::setMaxDecibels): Ditto.
941         (WebCore::AnalyserNode::setSmoothingTimeConstant): Ditto.
942         * Modules/webaudio/AnalyserNode.h: Update for above.
943         * Modules/webaudio/AnalyserNode.idl: Ditto.
944
945         * Modules/webaudio/AudioBasicInspectorNode.cpp:
946         (WebCore::AudioBasicInspectorNode::AudioBasicInspectorNode):
947         Initialize m_needAutomaticPull in class definition.
948         (WebCore::AudioBasicInspectorNode::connect): Use ExceptionOr.
949         (WebCore::AudioBasicInspectorNode::disconnect): Ditto.
950         * Modules/webaudio/AudioBasicInspectorNode.h: Updated for above.
951
952         * Modules/webaudio/AudioBuffer.cpp:
953         (WebCore::AudioBuffer::createFromAudioFileData): Use reference.
954         (WebCore::AudioBuffer::AudioBuffer): Initialize m_gain in class definition.
955         (WebCore::AudioBuffer::getChannelData): Use ExceptionOr.
956         (WebCore::AudioBuffer::channelData): Rename to disambiguate with getChannelData.
957         (WebCore::AudioBuffer::zero): Use modern for loop.
958         * Modules/webaudio/AudioBuffer.h: Update for above.
959         * Modules/webaudio/AudioBuffer.idl: Ditto.
960
961         * Modules/webaudio/AudioBufferSourceNode.cpp:
962         (WebCore::AudioBufferSourceNode::process): Use reference.
963         (WebCore::AudioBufferSourceNode::setBuffer): Use channelData.
964         (WebCore::AudioBufferSourceNode::start): Use ExceptionOr.
965         (WebCore::AudioBufferSourceNode::startPlaying): Ditto.
966         * Modules/webaudio/AudioBufferSourceNode.h: Update for above.
967         * Modules/webaudio/AudioBufferSourceNode.idl: Ditto.
968
969         * Modules/webaudio/AudioContext.cpp:
970         (WebCore::AudioContext::createBuffer): Use ExceptionOr.
971         (WebCore::AudioContext::createMediaElementSource): Ditto.
972         (WebCore::AudioContext::createMediaStreamSource): Ditto.
973         (WebCore::AudioContext::createScriptProcessor): Ditto.
974         (WebCore::AudioContext::createDelay): Ditto.
975         (WebCore::AudioContext::createChannelSplitter): Ditto.
976         (WebCore::AudioContext::createChannelMerger): Ditto.
977         (WebCore::AudioContext::createPeriodicWave): Ditto.
978         * Modules/webaudio/AudioContext.h: Update for above.
979         * Modules/webaudio/AudioContext.idl: Ditto.
980
981         * Modules/webaudio/AudioDestinationNode.h: Use unsigned instead
982         of unsigned long for maxChannelCount.
983
984         * Modules/webaudio/AudioNode.cpp:
985         (WebCore::AudioNode::connect): Use ExceptionOr.
986         (WebCore::AudioNode::disconnect): Ditto.
987         (WebCore::AudioNode::channelCount): Use unsigned.
988         (WebCore::AudioNode::setChannelCount): Use ExceptionOr and unsigned.
989         (WebCore::AudioNode::setChannelCountMode): Ditto.
990         (WebCore::AudioNode::setChannelInterpretation): Ditto.
991         * Modules/webaudio/AudioNode.h: Update for above.
992         * Modules/webaudio/AudioNode.idl: Ditto.
993
994         * Modules/webaudio/AudioScheduledSourceNode.cpp:
995         (WebCore::AudioScheduledSourceNode::AudioScheduledSourceNode):
996         Initialize data members in class definition.
997         (WebCore::AudioScheduledSourceNode::updateSchedulingInfo): Take
998         a reference instead of a pointer to the audio bus.
999         (WebCore::AudioScheduledSourceNode::start): Use ExceptionOr.
1000         (WebCore::AudioScheduledSourceNode::stop): Ditto.
1001         * Modules/webaudio/AudioScheduledSourceNode.h: Update for above.
1002
1003         * Modules/webaudio/ConvolverNode.cpp:
1004         (WebCore::ConvolverNode::ConvolverNode): Initialize m_normalize
1005         in class definition.
1006         (WebCore::ConvolverNode::setBuffer): Use ExceptionOr.
1007         * Modules/webaudio/ConvolverNode.h: Update for above.
1008         * Modules/webaudio/ConvolverNode.idl: Ditto.
1009
1010         * Modules/webaudio/DefaultAudioDestinationNode.cpp:
1011         (WebCore::DefaultAudioDestinationNode::DefaultAudioDestinationNode):
1012         Initialize m_numberOfInputChannels in class definition.
1013         (WebCore::DefaultAudioDestinationNode::maxChannelCount): Use unsigned.
1014         (WebCore::DefaultAudioDestinationNode::setChannelCount): Use ExceptionOr.
1015         * Modules/webaudio/DefaultAudioDestinationNode.h: Update for changes above.
1016
1017         * Modules/webaudio/DelayNode.cpp:
1018         (WebCore::DelayNode::DelayNode): Moved exception logic out of constructor.
1019         (WebCore::DelayNode::create): Added. Moved exception logic in here.
1020         (WebCore::DelayNode::delayTime): Moved typecast here from header.
1021         * Modules/webaudio/DelayNode.h: Update for above.
1022
1023         * Modules/webaudio/OfflineAudioContext.cpp:
1024         (WebCore::OfflineAudioContext::OfflineAudioContext): Marked inline.
1025         (WebCore::OfflineAudioContext::create): Use ExceptionOr.
1026         (WebCore::OfflineAudioContext::~OfflineAudioContext): Deleted. Unneeded.
1027         * Modules/webaudio/OfflineAudioContext.h: Update for above.
1028         * Modules/webaudio/OfflineAudioContext.idl: Ditto.
1029
1030         * Modules/webaudio/OfflineAudioDestinationNode.cpp:
1031         (WebCore::OfflineAudioDestinationNode::offlineRender): Use channelData.
1032
1033         * Modules/webaudio/OscillatorNode.cpp:
1034         (WebCore::OscillatorNode::OscillatorNode): Updated for change to setType.
1035         (WebCore::OscillatorNode::setType): Use ExceptionOr.
1036         (WebCore::OscillatorNode::process): Use a reference.
1037         * Modules/webaudio/OscillatorNode.h: Update for above.
1038         * Modules/webaudio/OscillatorNode.idl: Ditto.
1039
1040         * Modules/webaudio/ScriptProcessorNode.cpp:
1041         (WebCore::ScriptProcessorNode::process): Use channelData.
1042
1043         * bindings/js/JSDOMBinding.h: Added overloads of toJS to it can be used on
1044         references to array buffers and array buffer views, not just pointers.
1045
1046 2016-10-10  Youenn Fablet  <youenn@apple.com>
1047
1048         Change HTTPHeaderValues from a struct to a namespace
1049         https://bugs.webkit.org/show_bug.cgi?id=163203
1050
1051         Reviewed by Alex Christensen.
1052
1053         No change of behavior.
1054
1055         * Modules/fetch/FetchBody.cpp:
1056         (WebCore::FetchBody::extract):
1057         * platform/network/HTTPHeaderValues.cpp:
1058         (WebCore::HTTPHeaderValues::textPlainContentType):
1059         (WebCore::HTTPHeaderValues::formURLEncodedContentType):
1060         (WebCore::HTTPHeaderValues::TextPlainContentType): Deleted.
1061         (WebCore::HTTPHeaderValues::FormURLEncodedContentType): Deleted.
1062         * platform/network/HTTPHeaderValues.h:
1063         * xml/XMLHttpRequest.cpp:
1064         (WebCore::XMLHttpRequest::send):
1065
1066 2016-10-10  Chris Dumez  <cdumez@apple.com>
1067
1068         Update WheelEvent / MouseEvent to stop using legacy [ConstructorTemplate=Event]
1069         https://bugs.webkit.org/show_bug.cgi?id=163254
1070
1071         Reviewed by Darin Adler.
1072
1073         Update WheelEvent / MouseEvent to stop using legacy [ConstructorTemplate=Event]
1074         and use a regular constructor instead, as in the specification:
1075         - https://www.w3.org/TR/uievents/#interface-mouseevent
1076         - https://www.w3.org/TR/uievents/#interface-wheelevent
1077
1078         * CMakeLists.txt:
1079         * DerivedSources.cpp:
1080         * DerivedSources.make:
1081         * WebCore.xcodeproj/project.pbxproj:
1082
1083         * bindings/scripts/CodeGeneratorJS.pm:
1084         (GenerateHeader):
1085         (GenerateDictionaryHeader):
1086         Fix our broken dependency tracking when it comes to dictionaries.
1087
1088         * dom/MouseEvent.cpp:
1089         (WebCore::MouseEvent::create):
1090         (WebCore::MouseEvent::MouseEvent):
1091         * dom/MouseEvent.h:
1092         * dom/MouseEvent.idl:
1093         * dom/MouseEventInit.h: Added.
1094         * dom/MouseEventInit.idl: Added.
1095         * dom/MouseRelatedEvent.cpp:
1096         (WebCore::MouseRelatedEvent::MouseRelatedEvent):
1097         * dom/MouseRelatedEvent.h:
1098         * dom/UIEventWithKeyState.h:
1099         (WebCore::UIEventWithKeyState::UIEventWithKeyState):
1100         * dom/WheelEvent.cpp:
1101         (WebCore::WheelEvent::WheelEvent):
1102         * dom/WheelEvent.h:
1103         * dom/WheelEvent.idl:
1104
1105 2016-10-10  Chris Dumez  <cdumez@apple.com>
1106
1107         Add support for languagechange event
1108         https://bugs.webkit.org/show_bug.cgi?id=163222
1109
1110         Reviewed by Ryosuke Niwa.
1111
1112         Add support for languagechange event:
1113         - https://html.spec.whatwg.org/#dom-navigator-languages
1114
1115         Firefox and Chrome already support this.
1116
1117         Test: fast/dom/window-languagechange-event.html
1118
1119         * dom/EventNames.h:
1120         * html/HTMLAttributeNames.in:
1121         * html/HTMLBodyElement.cpp:
1122         (WebCore::HTMLBodyElement::createWindowEventHandlerNameMap):
1123         * page/DOMWindow.cpp:
1124         (WebCore::languagesChangedCallback):
1125         (WebCore::DOMWindow::DOMWindow):
1126         (WebCore::DOMWindow::~DOMWindow):
1127         (WebCore::DOMWindow::languagesChanged):
1128         (WebCore::DOMWindow::canShowModalDialog): Deleted.
1129         (WebCore::DOMWindow::removeEventListener): Deleted.
1130         * page/DOMWindow.h:
1131         * page/WindowEventHandlers.idl:
1132
1133 2016-10-10  Chris Dumez  <cdumez@apple.com>
1134
1135         Update GamepadEvent to stop using legacy [ConstructorTemplate=Event]
1136         https://bugs.webkit.org/show_bug.cgi?id=163243
1137
1138         Reviewed by Darin Adler.
1139
1140         Update GamepadEvent to stop using legacy [ConstructorTemplate=Event]
1141         and use a proper constructor as in the specification:
1142         - https://w3c.github.io/gamepad/#gamepadevent-interface
1143
1144         * Modules/gamepad/GamepadEvent.cpp:
1145         (WebCore::GamepadEvent::GamepadEvent):
1146         * Modules/gamepad/GamepadEvent.h:
1147         (WebCore::GamepadEvent::create):
1148         (WebCore::GamepadEvent::~GamepadEvent): Deleted.
1149         * Modules/gamepad/GamepadEvent.idl:
1150
1151 2016-10-10  Darin Adler  <darin@apple.com>
1152
1153         Move Fetch from legacy to new DOM exceptions
1154         https://bugs.webkit.org/show_bug.cgi?id=163195
1155
1156         Reviewed by Chris Dumez.
1157
1158         * Modules/fetch/FetchHeaders.cpp:
1159         (WebCore::canWriteHeader): Use ExceptionOr.
1160         (WebCore::FetchHeaders::append): Ditto.
1161         (WebCore::FetchHeaders::remove): Ditto.
1162         (WebCore::FetchHeaders::get): Ditto.
1163         (WebCore::FetchHeaders::has): Ditto.
1164         (WebCore::FetchHeaders::set): Ditto.
1165         (WebCore::FetchHeaders::filterAndFill): Ditto.
1166         (WebCore::FetchHeaders::Iterator::next): Got rid of unneeded code to
1167         clear out m_keys after the last call to next, since it will be deleted
1168         as soon as the iterator is deleted.
1169
1170         * Modules/fetch/FetchHeaders.h: Use pragma once. Use ExceptionOr.
1171
1172         * Modules/fetch/FetchHeaders.idl: Move to non-legacy exceptions.
1173
1174         * Modules/fetch/FetchRequest.cpp:
1175         (WebCore::FetchRequest::setBody): Use ExceptionOr.
1176         (WebCore::FetchRequest::clone): Ditto.
1177
1178         * Modules/fetch/FetchRequest.h: Use pragma once. Use ExceptionOr.
1179
1180         * Modules/fetch/FetchRequest.idl: Move to non-legacy exceptions.
1181
1182         * Modules/fetch/FetchResponse.cpp:
1183         (WebCore::FetchResponse::redirect): Use ExceptionOr.
1184         (WebCore::FetchResponse::setStatus): Ditto.
1185
1186         * Modules/fetch/FetchResponse.h: Use ExceptionOr.
1187
1188         * Modules/fetch/FetchResponse.idl: Move to non-legacy exceptions.
1189
1190         * bindings/js/JSDOMBinding.h: Added implementation of toJSNullableString.
1191
1192         * bindings/scripts/CodeGeneratorJS.pm:
1193         (NativeToJSValue): Call toJSNullableString and toJSString for
1194         functions that return ExceptionOr<String>.
1195
1196 2016-10-10  Nan Wang  <n_wang@apple.com>
1197
1198         AX: Expose invalid status for input types with that information
1199         https://bugs.webkit.org/show_bug.cgi?id=163252
1200         <rdar://problem/28704409>
1201
1202         Reviewed by Chris Fleizach.
1203
1204         For input types with invalid input value, we should expose the invalid 
1205         status to the assitive technology.
1206
1207         Test: accessibility/mac/invalid-status-for-input-types.html
1208
1209         * accessibility/AccessibilityObject.cpp:
1210         (WebCore::AccessibilityObject::invalidStatus):
1211
1212 2016-10-10  Konstantin Tokarev  <annulen@yandex.ru>
1213
1214         Added override specifier to PluginViewBase::isPluginViewBase()
1215         https://bugs.webkit.org/show_bug.cgi?id=163218
1216
1217         Reviewed by Alex Christensen.
1218
1219         No new tests needed.
1220
1221         * plugins/PluginViewBase.h:
1222
1223 2016-10-10  Alex Christensen  <achristensen@webkit.org>
1224
1225         Don't run SecurityOrigin's port through URLParser
1226         https://bugs.webkit.org/show_bug.cgi?id=163253
1227
1228         Reviewed by Brady Eidson.
1229
1230         No change in behavior.
1231
1232         * page/SecurityOrigin.cpp:
1233         (WebCore::SecurityOrigin::maybeCreateFromDatabaseIdentifier):
1234         (WebCore::SecurityOrigin::create):
1235         We used to parse URLs like "file://:0/" which are valid when using URL::parse
1236         but aren't valid when we start using the URLParser, which matches other browsers' failure
1237         to parse URLs with a port but no host. There is no reason to write and parse the port.
1238         Setting m_port directly accomplishes the same thing.
1239  
1240 2016-10-10  Said Abou-Hallawa  <sabouhallawa@apple.com>
1241
1242         <Error>: CGContextSetLineDash: invalid dash array: at least one element must be non-zero
1243         https://bugs.webkit.org/show_bug.cgi?id=138555
1244
1245         Reviewed by Simon Fraser.
1246
1247         Ensure the dashArray has at least one non-zero element before calling
1248         GraphicsContext::setLineDash(). Call GraphicsContext::setStrokeStyle()
1249         instead, if the dashArray does not have one.
1250
1251         * rendering/svg/SVGRenderSupport.cpp:
1252         (WebCore::SVGRenderSupport::applyStrokeStyleToContext):
1253
1254 2016-10-10  Brent Fulgham  <bfulgham@apple.com>
1255
1256         [Win][Direct2D] Correct Radial Graident Bug
1257         https://bugs.webkit.org/show_bug.cgi?id=163241
1258
1259         Reviewed by Darin Adler.
1260
1261         Radial gradients were not working correctly under Direct2D because the
1262         points and radius values used were incorrect. D2D wants a center point and
1263         an offset, not a start and end point. It wants an X and Y radius (for an
1264         ellipse), not a radius at the start point, and a radius at the end point.
1265
1266         Covered by existing fast/gradients/css-radial-gradients.html (and others).
1267
1268         * platform/graphics/Image.cpp:
1269         (WebCore::Image::drawTiled): Remove 'notImplemented' code path.
1270         * platform/graphics/win/GradientDirect2D.cpp:
1271         (WebCore::Gradient::generateGradient): Use correct input values to
1272         the Radial Gradient constructor.
1273         (WebCore::Gradient::fill): Generate a gradient if we have no active
1274         one to use.
1275
1276 2016-10-10  Jiewen Tan  <jiewen_tan@apple.com>
1277
1278         Rename CryptoAlgorithmParameters to CryptoAlgorithmParametersDeprecated
1279         https://bugs.webkit.org/show_bug.cgi?id=163163
1280         <rdar://problem/28681544>
1281
1282         Reviewed by Brent Fulgham.
1283
1284         Replace all uses of 'CryptoAlgorithmParameters' with 'CryptoAlgorithmParametersDeprecated' in preparation for a new CryptoAlgorithmParameters type.
1285
1286         No changes of behaviors. No new tests.
1287
1288         * Modules/encryptedmedia/CDMSessionClearKey.cpp:
1289         * WebCore.xcodeproj/project.pbxproj:
1290         * bindings/js/JSCryptoAlgorithmDictionary.cpp:
1291         * bindings/js/JSCryptoAlgorithmDictionary.h:
1292         * bindings/js/JSCryptoKeySerializationJWK.cpp:
1293         * bindings/js/JSCryptoKeySerializationJWK.h:
1294         * bindings/js/JSWebKitSubtleCryptoCustom.cpp:
1295         * crypto/CryptoAlgorithm.cpp:
1296         * crypto/CryptoAlgorithm.h:
1297         * crypto/CryptoAlgorithmParametersDeprecated.h: Renamed from Source/WebCore/crypto/CryptoAlgorithmParameters.h.
1298         * crypto/CryptoKeySerialization.h:
1299         * crypto/algorithms/CryptoAlgorithmAES_CBC.cpp:
1300         * crypto/algorithms/CryptoAlgorithmAES_CBC.h:
1301         * crypto/algorithms/CryptoAlgorithmAES_KW.cpp:
1302         * crypto/algorithms/CryptoAlgorithmAES_KW.h:
1303         * crypto/algorithms/CryptoAlgorithmHMAC.cpp:
1304         * crypto/algorithms/CryptoAlgorithmHMAC.h:
1305         * crypto/algorithms/CryptoAlgorithmRSAES_PKCS1_v1_5.cpp:
1306         * crypto/algorithms/CryptoAlgorithmRSAES_PKCS1_v1_5.h:
1307         * crypto/algorithms/CryptoAlgorithmRSASSA_PKCS1_v1_5.cpp:
1308         * crypto/algorithms/CryptoAlgorithmRSASSA_PKCS1_v1_5.h:
1309         * crypto/algorithms/CryptoAlgorithmRSA_OAEP.cpp:
1310         * crypto/algorithms/CryptoAlgorithmRSA_OAEP.h:
1311         * crypto/algorithms/CryptoAlgorithmSHA1.cpp:
1312         * crypto/algorithms/CryptoAlgorithmSHA1.h:
1313         * crypto/algorithms/CryptoAlgorithmSHA224.cpp:
1314         * crypto/algorithms/CryptoAlgorithmSHA224.h:
1315         * crypto/algorithms/CryptoAlgorithmSHA256.cpp:
1316         * crypto/algorithms/CryptoAlgorithmSHA256.h:
1317         * crypto/algorithms/CryptoAlgorithmSHA384.cpp:
1318         * crypto/algorithms/CryptoAlgorithmSHA384.h:
1319         * crypto/algorithms/CryptoAlgorithmSHA512.cpp:
1320         * crypto/algorithms/CryptoAlgorithmSHA512.h:
1321         * crypto/keys/CryptoKeySerializationRaw.cpp:
1322         * crypto/gnutls/CryptoAlgorithmAES_CBCGnuTLS.cpp:
1323         * crypto/gnutls/CryptoAlgorithmHMACGnuTLS.cpp:
1324         * crypto/gnutls/CryptoAlgorithmRSA_OAEPGnuTLS.cpp:
1325         * crypto/gnutls/CryptoAlgorithmRSASSA_PKCS1_v1_5GnuTLS.cpp:
1326         * crypto/keys/CryptoKeySerializationRaw.h:
1327         * crypto/mac/CryptoAlgorithmAES_CBCMac.cpp:
1328         * crypto/mac/CryptoAlgorithmHMACMac.cpp:
1329         * crypto/mac/CryptoAlgorithmRSASSA_PKCS1_v1_5Mac.cpp:
1330         * crypto/mac/CryptoAlgorithmRSA_OAEPMac.cpp:
1331         * crypto/parameters/CryptoAlgorithmAesCbcParamsDeprecated.h: Renamed from Source/WebCore/crypto/parameters/CryptoAlgorithmAesCbcParams.h.
1332         * crypto/parameters/CryptoAlgorithmAesKeyGenParamsDeprecated.h: Renamed from Source/WebCore/crypto/parameters/CryptoAlgorithmAesKeyGenParams.h.
1333         * crypto/parameters/CryptoAlgorithmHmacKeyParamsDeprecated.h: Renamed from Source/WebCore/crypto/parameters/CryptoAlgorithmHmacKeyParams.h.
1334         * crypto/parameters/CryptoAlgorithmHmacParamsDeprecated.h: Renamed from Source/WebCore/crypto/parameters/CryptoAlgorithmHmacParams.h.
1335         * crypto/parameters/CryptoAlgorithmRsaKeyGenParamsDeprecated.h: Renamed from Source/WebCore/crypto/parameters/CryptoAlgorithmRsaKeyGenParams.h.
1336         * crypto/parameters/CryptoAlgorithmRsaKeyParamsWithHashDeprecated.h: Renamed from Source/WebCore/crypto/parameters/CryptoAlgorithmRsaKeyParamsWithHash.h.
1337         * crypto/parameters/CryptoAlgorithmRsaOaepParamsDeprecated.h: Renamed from Source/WebCore/crypto/parameters/CryptoAlgorithmRsaOaepParams.h.
1338         * crypto/parameters/CryptoAlgorithmRsaSsaParamsDeprecated.h: Renamed from Source/WebCore/crypto/parameters/CryptoAlgorithmRsaSsaParams.h.
1339
1340 2016-10-10  Darin Adler  <darin@apple.com>
1341
1342         Move NotificationCenter from legacy to new DOM exceptions
1343         https://bugs.webkit.org/show_bug.cgi?id=163217
1344
1345         Reviewed by Chris Dumez.
1346
1347         * Modules/notifications/DOMWindowNotifications.cpp:
1348         (WebCore::DOMWindowNotifications::webkitNotifications): Pass reference to
1349         document instead of pointer. Also use auto and early return.
1350
1351         * Modules/notifications/Notification.cpp:
1352         (WebCore::Notification::Notification): Move checks that can lead to
1353         throwing an exception out of the constructor into the create function.
1354         (WebCore::Notification::create): Changed to use ExceptionOr. Also moved
1355         checks that can lead to throwing an exception here.
1356         (WebCore::Notification::show): Update since NotificationController::client
1357         now returns a reference.
1358         (WebCore::Notification::permission): Ditto.
1359         (WebCore::Notification::requestPermission): Ditto.
1360
1361         * Modules/notifications/Notification.h: Updated for above changes.
1362
1363         * Modules/notifications/NotificationCenter.cpp:
1364         (WebCore::NotificationCenter::create): Take a reference to the script execution
1365         context instead of a pointer.
1366         (WebCore::NotificationCenter::NotificationCenter): Ditto.
1367         (WebCore::NotificationCenter::createNotification): Use ExceptionOr.
1368         (WebCore::NotificationCenter::requestPermission): Take an rvalue reference.
1369
1370         * Modules/notifications/NotificationCenter.h: Use pragma once.
1371         Marked the class final. Updated for changes above.
1372
1373         * Modules/notifications/NotificationCenter.idl: Use non-legacy exceptions.
1374
1375         * Modules/notifications/NotificationController.cpp:
1376         (WebCore::NotificationController::NotificationController): Use a reference rather
1377         than a pointer for m_client, since it is never null.
1378         (WebCore::NotificationController::~NotificationController): Ditto.
1379         (WebCore::NotificationController::clientFrom): Updated for the change above.
1380
1381         * Modules/notifications/NotificationController.h: Updated for the change above.
1382
1383         * Modules/notifications/WorkerGlobalScopeNotifications.cpp:
1384         (WebCore::WorkerGlobalScopeNotifications::webkitNotifications): Updated to
1385         pass a reference for the script execution context. Also added FIXME about the
1386         fact that the client is always null.
1387
1388 2016-10-10  Antoine Quint  <graouts@apple.com>
1389
1390         [Modern Media Controls] Placards
1391         https://bugs.webkit.org/show_bug.cgi?id=163110
1392         <rdar://problem/28669342>
1393
1394         Reviewed by Dean Jackson.
1395
1396         Inline media controls need to display placards when the video is no longer playing inline,
1397         such as when the video is playing fullscreen or via AirPlay. To that end, we introduce a
1398         new Placard class and two subclasses for display during fullscreen or AirPlay playback.
1399         Note that localization will be done in a later patch.
1400
1401         Tests: media/modern-media-controls/airplay-placard/airplay-placard.html
1402                media/modern-media-controls/pip-placard/pip-placard.html
1403                media/modern-media-controls/placard/placard.html
1404
1405         * Modules/modern-media-controls/controls/airplay-placard.js:
1406         (AirplayPlacard):
1407         * Modules/modern-media-controls/controls/icon-service.js:
1408         * Modules/modern-media-controls/controls/pip-placard.js:
1409         (PiPPlacard):
1410         * Modules/modern-media-controls/controls/placard.css:
1411         (.placard):
1412         (.placard .container):
1413         (.placard .icon):
1414         (.placard .title,):
1415         (.placard .title):
1416         (.placard .description):
1417         * Modules/modern-media-controls/controls/placard.js:
1418         (Placard.):
1419         * Modules/modern-media-controls/images/iOS/airplay-placard@1x.png: Added.
1420         * Modules/modern-media-controls/images/iOS/airplay-placard@2x.png: Added.
1421         * Modules/modern-media-controls/images/iOS/airplay-placard@3x.png: Added.
1422         * Modules/modern-media-controls/images/iOS/pip-placard@1x.png: Added.
1423         * Modules/modern-media-controls/images/iOS/pip-placard@2x.png: Added.
1424         * Modules/modern-media-controls/images/iOS/pip-placard@3x.png: Added.
1425         * Modules/modern-media-controls/images/macOS/airplay-placard@1x.png: Added.
1426         * Modules/modern-media-controls/images/macOS/airplay-placard@2x.png: Added.
1427         * Modules/modern-media-controls/images/macOS/pip-placard@1x.png: Added.
1428         * Modules/modern-media-controls/images/macOS/pip-placard@2x.png: Added.
1429
1430 2016-10-10  Chris Dumez  <cdumez@apple.com>
1431
1432         Add support for Navigator.languages attribute
1433         https://bugs.webkit.org/show_bug.cgi?id=163220
1434
1435         Reviewed by Darin Adler.
1436
1437         Add support for Navigator.languages attribute:
1438         - https://html.spec.whatwg.org/#navigatorlanguage
1439
1440         Firefox and Chrome already support this.
1441
1442         Currently, we always return a single language for privacy reasons so
1443         this API does not actually bring anything new besides interoperability
1444         with other browsers and compliance with the HTML specification.
1445
1446         No new tests, rebaselined existing tests.
1447
1448         * page/NavigatorBase.cpp:
1449         (WebCore::NavigatorBase::languages):
1450         * page/NavigatorBase.h:
1451         * page/NavigatorLanguage.idl:
1452
1453 2016-10-10  Brent Fulgham  <bfulgham@apple.com>
1454
1455         [Win][Direct2D] Implement dashed and dotted border line drawing
1456         https://bugs.webkit.org/show_bug.cgi?id=163235
1457
1458         Reviewed by Alex Christensen.
1459
1460         Covered by existing fast/border tests.
1461
1462         * platform/graphics/GraphicsContext.cpp: Use custom 'setPlatformStrokeStyle' for D2D.
1463         * platform/graphics/Path.cpp:
1464         (WebCore::Path::length): Don't use default implementation for Direct2D.
1465         * platform/graphics/win/GraphicsContextDirect2D.cpp:
1466         (WebCore::GraphicsContextPlatformPrivate::brushWithColor): Initialize pointer to nullptr.
1467         (WebCore::GraphicsContext::drawRect): Use proper stroke style.
1468         (WebCore::GraphicsContextPlatformPrivate::setLineCap): Added.
1469         (WebCore::GraphicsContextPlatformPrivate::setLineJoin): Added.
1470         (WebCore::GraphicsContextPlatformPrivate::setStrokeStyle): Added.
1471         (WebCore::GraphicsContextPlatformPrivate::setMiterLimit): Added.
1472         (WebCore::GraphicsContextPlatformPrivate::setDashOffset): Added.
1473         (WebCore::GraphicsContextPlatformPrivate::setPatternWidth): Added.
1474         (WebCore::GraphicsContextPlatformPrivate::setPatternOffset): Added.
1475         (WebCore::GraphicsContextPlatformPrivate::setStrokeThickness): Added.
1476         (WebCore::GraphicsContextPlatformPrivate::setDashes): Added.
1477         (WebCore::GraphicsContextPlatformPrivate::recomputeStrokeStyle): Added.
1478         (WebCore::GraphicsContextPlatformPrivate::strokeStyle): Added.
1479         (WebCore::GraphicsContext::drawLine): Use proper stroke style.
1480         (WebCore::GraphicsContext::drawEllipse): Ditto.
1481         (WebCore::GraphicsContext::drawPath): Ditto.
1482         (WebCore::GraphicsContext::strokePath): Ditto.
1483         (WebCore::GraphicsContext::setPlatformStrokeStyle): Added.
1484         (WebCore::GraphicsContext::setMiterLimit): Tell D2D context about miter limit.
1485         (WebCore::GraphicsContext::setLineCap): Ditto for line cap.
1486         (WebCore::GraphicsContext::setLineDash): Ditto for dashes.
1487         (WebCore::GraphicsContext::setLineJoin): Ditto for join style.
1488         (WebCore::GraphicsContext::setPlatformStrokeThickness): Ditto for stroke thickness.
1489         (WebCore::GraphicsContext::platformStrokeEllipse): Use proper stroke style.
1490         * platform/graphics/win/GraphicsContextPlatformPrivateDirect2D.h:
1491         * platform/graphics/win/PathDirect2D.cpp:
1492         (WebCore::Path::currentPoint): Zero-initialize a value.
1493         (WebCore::Path::length): Added.
1494
1495 2016-10-10  Chris Dumez  <cdumez@apple.com>
1496
1497         Update ProgressEvent to stop using legacy [ConstructorTemplate=Event]
1498         https://bugs.webkit.org/show_bug.cgi?id=163221
1499
1500         Reviewed by Darin Adler.
1501
1502         Update ProgressEvent to stop using legacy [ConstructorTemplate=Event]
1503         and use a regular constructor as in the specification:
1504         - https://xhr.spec.whatwg.org/#firing-events-using-the-progressevent-interface
1505
1506         * dom/ProgressEvent.cpp:
1507         (WebCore::ProgressEvent::ProgressEvent):
1508         * dom/ProgressEvent.h:
1509         (WebCore::ProgressEvent::create):
1510         * dom/ProgressEvent.idl:
1511
1512 2016-10-10  Wenson Hsieh  <wenson_hsieh@apple.com>
1513
1514         Address some review feedback from r206979 and r207010
1515         https://bugs.webkit.org/show_bug.cgi?id=163236
1516
1517         Reviewed by Tim Horton.
1518
1519         In TypingCommand.h, some methods on TypingCommand should be marked as final to reflect the fact that they
1520         override methods in CompositeEditCommand. Also, HTMLFormControlElement::dispatchFormControlInputEvent does not
1521         need to specify HTMLElement::dispatchInputEvent() when calling dispatchInputEvent().
1522
1523         No new tests, since there is no behavior change.
1524
1525         * editing/TypingCommand.h:
1526         * html/HTMLFormControlElement.cpp:
1527         (WebCore::HTMLFormControlElement::dispatchFormControlInputEvent):
1528
1529 2016-10-10  Chris Dumez  <cdumez@apple.com>
1530
1531         Update MessageEvent to stop using legacy [ConstructorTemplate=Event]
1532         https://bugs.webkit.org/show_bug.cgi?id=163187
1533
1534         Reviewed by Darin Adler.
1535
1536         Update MessageEvent to stop using legacy [ConstructorTemplate=Event] and
1537         use a regular constructor as in the specification:
1538         - https://html.spec.whatwg.org/multipage/comms.html#the-messageevent-interfaces
1539
1540         No new tests, updated existing test.
1541
1542         * bindings/js/JSDOMBinding.h:
1543         (WebCore::toRefPtrNativeArray):
1544         * bindings/js/JSDOMConvert.h:
1545         (WebCore::convertWrapperTypeSequence):
1546         (WebCore::convertWrapperType): Deleted.
1547         * bindings/scripts/CodeGeneratorJS.pm:
1548         (GenerateDefaultValue):
1549         (GenerateDictionaryImplementationContent):
1550         (GetNativeType):
1551         * dom/MessageEvent.cpp:
1552         (WebCore::MessageEvent::MessageEvent):
1553         (WebCore::MessageEvent::create):
1554         (WebCore::MessageEvent::trySerializeData):
1555         (WebCore::MessageEvent::createForBindings): Deleted.
1556         (WebCore::MessageEvent::initMessageEvent): Deleted.
1557         * dom/MessageEvent.h:
1558         * dom/MessageEvent.idl:
1559
1560 2016-10-10  Antoine Quint  <graouts@apple.com>
1561
1562         [Modern Media Controls] Buttons
1563         https://bugs.webkit.org/show_bug.cgi?id=163109
1564         <rdar://problem/28668954>
1565
1566         Reviewed by Dean Jackson.
1567
1568         We introduce specific IconButton subclasses for the various buttons we will be using
1569         in media controls on macOS (inline and fullscreen) and iOS. One class, StartButton, is
1570         a subclass of Button and not IconButton because we're only interested in having it display
1571         an <img> element rather than use a mask and requires additional DOM structure.
1572
1573         Tests: media/modern-media-controls/airplay-button/airplay-button-on.html
1574                media/modern-media-controls/airplay-button/airplay-button.html
1575                media/modern-media-controls/aspect-ratio-button/aspect-ratio-button.html
1576                media/modern-media-controls/forward-button/forward-button.html
1577                media/modern-media-controls/fullscreen-button/fullscreen-button.html
1578                media/modern-media-controls/mute-button/mute-button.html
1579                media/modern-media-controls/pip-button/pip-button.html
1580                media/modern-media-controls/play-pause-button/play-pause-button.html
1581                media/modern-media-controls/rewind-button/rewind-button.html
1582                media/modern-media-controls/skip-back-button/skip-back-button.html
1583                media/modern-media-controls/start-button/start-button.html
1584                media/modern-media-controls/tracks-button/tracks-button.html
1585
1586         * Modules/modern-media-controls/controls/airplay-button.css:
1587         (button.airplay.on):
1588         * Modules/modern-media-controls/controls/airplay-button.js:
1589         (AirplayButton):
1590         (AirplayButton.prototype.set on):
1591         * Modules/modern-media-controls/controls/aspect-ratio-button.js:
1592         (AspectRatioButton):
1593         (AspectRatioButton.prototype.get scalesToFill):
1594         (AspectRatioButton.prototype.set scalesToFill):
1595         * Modules/modern-media-controls/controls/forward-button.js:
1596         (ForwardButton):
1597         * Modules/modern-media-controls/controls/fullscreen-button.js:
1598         (FullscreenButton):
1599         * Modules/modern-media-controls/controls/icon-button.js:
1600         * Modules/modern-media-controls/controls/icon-service.js:
1601         * Modules/modern-media-controls/controls/mute-button.js:
1602         (MuteButton):
1603         (MuteButton.prototype.get muted):
1604         (MuteButton.prototype.set muted):
1605         * Modules/modern-media-controls/controls/pip-button.js:
1606         (PiPButton):
1607         * Modules/modern-media-controls/controls/play-pause-button.js:
1608         (PlayPauseButton):
1609         (PlayPauseButton.prototype.get playing):
1610         (PlayPauseButton.prototype.set playing):
1611         * Modules/modern-media-controls/controls/rewind-button.js:
1612         (RewindButton):
1613         * Modules/modern-media-controls/controls/skip-back-button.js:
1614         (SkipBackButton):
1615         * Modules/modern-media-controls/controls/start-button.js:
1616         (StartButton):
1617         * Modules/modern-media-controls/controls/tracks-button.js:
1618         (TracksButton):
1619         * Modules/modern-media-controls/images/iOS/airplay@1x.png: Added.
1620         * Modules/modern-media-controls/images/iOS/airplay@2x.png: Added.
1621         * Modules/modern-media-controls/images/iOS/enter-fullscreen@1x.png: Added.
1622         * Modules/modern-media-controls/images/iOS/enter-fullscreen@2x.png: Added.
1623         * Modules/modern-media-controls/images/iOS/enter-fullscreen@3x.png: Added.
1624         * Modules/modern-media-controls/images/iOS/interval-skip-back@1x.png: Added.
1625         * Modules/modern-media-controls/images/iOS/interval-skip-back@2x.png: Added.
1626         * Modules/modern-media-controls/images/iOS/interval-skip-back@3x.png: Added.
1627         * Modules/modern-media-controls/images/iOS/pause@1x.png: Added.
1628         * Modules/modern-media-controls/images/iOS/pip-in@1x.png: Added.
1629         * Modules/modern-media-controls/images/iOS/pip-in@2x.png: Added.
1630         * Modules/modern-media-controls/images/iOS/pip-in@3x.png: Added.
1631         * Modules/modern-media-controls/images/iOS/play@1x.png: Added.
1632         * Modules/modern-media-controls/images/iOS/play@2x.png: Added.
1633         * Modules/modern-media-controls/images/iOS/play@3x.png: Added.
1634         * Modules/modern-media-controls/images/iOS/start@1x.png: Added.
1635         * Modules/modern-media-controls/images/macOS/airplay-fullscreen@1x.png: Added.
1636         * Modules/modern-media-controls/images/macOS/airplay-fullscreen@2x.png: Added.
1637         * Modules/modern-media-controls/images/macOS/airplay@1x.png: Added.
1638         * Modules/modern-media-controls/images/macOS/airplay@2x.png: Added.
1639         * Modules/modern-media-controls/images/macOS/enter-fullscreen@1x.png: Added.
1640         * Modules/modern-media-controls/images/macOS/enter-fullscreen@2x.png: Added.
1641         * Modules/modern-media-controls/images/macOS/exit-fullscreen@1x.png: Added.
1642         * Modules/modern-media-controls/images/macOS/exit-fullscreen@2x.png: Added.
1643         * Modules/modern-media-controls/images/macOS/forward@1x.png: Added.
1644         * Modules/modern-media-controls/images/macOS/forward@2x.png: Added.
1645         * Modules/modern-media-controls/images/macOS/interval-skip-back@1x.png: Added.
1646         * Modules/modern-media-controls/images/macOS/interval-skip-back@2x.png: Added.
1647         * Modules/modern-media-controls/images/macOS/media-selection-fullscreen@1x.png: Added.
1648         * Modules/modern-media-controls/images/macOS/media-selection-fullscreen@2x.png: Added.
1649         * Modules/modern-media-controls/images/macOS/media-selection@1x.png: Added.
1650         * Modules/modern-media-controls/images/macOS/media-selection@2x.png: Added.
1651         * Modules/modern-media-controls/images/macOS/pip-in@1x.png: Added.
1652         * Modules/modern-media-controls/images/macOS/pip-in@2x.png: Added.
1653         * Modules/modern-media-controls/images/macOS/play-fullscreen@1x.png: Added.
1654         * Modules/modern-media-controls/images/macOS/play-fullscreen@2x.png: Added.
1655         * Modules/modern-media-controls/images/macOS/play@1x.png: Added.
1656         * Modules/modern-media-controls/images/macOS/play@2x.png: Added.
1657         * Modules/modern-media-controls/images/macOS/rewind@1x.png: Added.
1658         * Modules/modern-media-controls/images/macOS/rewind@2x.png: Added.
1659         * Modules/modern-media-controls/images/macOS/scale-to-fill@1x.png: Added.
1660         * Modules/modern-media-controls/images/macOS/scale-to-fill@2x.png: Added.
1661         * Modules/modern-media-controls/images/macOS/scale-to-fit@1x.png: Added.
1662         * Modules/modern-media-controls/images/macOS/scale-to-fit@2x.png: Added.
1663         * Modules/modern-media-controls/images/macOS/volume-mute@1x.png: Added.
1664         * Modules/modern-media-controls/images/macOS/volume-mute@2x.png: Added.
1665         * Modules/modern-media-controls/images/macOS/volume@1x.png: Added.
1666         * Modules/modern-media-controls/images/macOS/volume@2x.png: Added.
1667
1668 2016-10-10  Nan Wang  <n_wang@apple.com>
1669
1670         AX: Update AXPlaceHolder algorithm
1671         https://bugs.webkit.org/show_bug.cgi?id=163229
1672
1673         Reviewed by Chris Fleizach.
1674
1675         From https://w3c.github.io/html-aam/
1676         When the placeholder and aria-placeholder attributes are both present, we
1677         should expose the value of the placeholder attribute. Updated the algorithm
1678         for that.
1679
1680         Changes are covered in the modified test.
1681
1682         * accessibility/AccessibilityObject.cpp:
1683         (WebCore::AccessibilityObject::placeholderValue):
1684
1685 2016-10-10  Yusuke Suzuki  <utatane.tea@gmail.com>
1686
1687         [DOMJIT] Implement Node accessors in DOMJIT
1688         https://bugs.webkit.org/show_bug.cgi?id=163005
1689
1690         Reviewed by Filip Pizlo.
1691
1692         This patch implements DOMJIT accessors in WebCore. We plan to offer 2 things in DOMJIT.
1693
1694             1. Hand written DOM inlining.
1695
1696             We inject DOMJIT::Patchpoint compiler into JSC. And JSC uses this to inline DOM operation,
1697             and drop type checks. Since the operation is fully inlined, potentially it has large
1698             performance boost. Note that CSS Selector JIT compiler already does the similar things:
1699             accessing parentNode etc. directly by using offsets.
1700
1701             2. Exposing signature information.
1702
1703             We will offer function type signature by some representation and pass it to JSC.
1704             JSC will use to drop type checks. Since IDL code generator already knows this,
1705             we can automatically generate such a information. Since we don't perform any inlining,
1706             the performance boost may be limited. But it's worth doing.
1707
1708         This patch implements the first one, hand written DOM inlining facility. We add a new IDL attribute,
1709         "DOMJIT". This means that "This readonly attribute have a DOMJIT patchpoint compiler".
1710         We annotate several accessors at first. "firstChild", "lastChild", "nextSibling", "previousSibling",
1711         and "parentNode". And we implement DOMJIT::Patchpoint for that in JSNodeDOMJIT.cpp.
1712
1713         This patchpoint will be integrated into JSC's DFG and FTL. And these tiers can drop type checks and
1714         inline the entire code of these accessors. JSC compiler still does not know much about DOM. And WebCore
1715         does not know much about each tier of JSC. WebCore just offers the generic patchpoints and they are
1716         used in both DFG and FTL tiers. The layer separation is still kept.
1717
1718         While very small microbenchmark[1] shows performance benefit, still we cannot improve DOM
1719         benchmarks due to the lack of following implementations. Once the following implementations
1720         are implemented, we will get performance boost.
1721
1722         1. Super polymorphic sites.
1723
1724             This inlining is super effective if we run some microbenchmarks. However, Dromaeo does not
1725             show so much performance benefit. This is because Dromaeo's dom-traverse.html is super
1726             polymorphic call site where JSC gives up optimization. For example, in the following
1727             dromaeo's benchmark, we can see so various DOM nodes at the `cur.firstChild` site, like,
1728             HTMLDivElement, HTMLAnchorElement, Text, Comment etc. JSC gives up optimization since we
1729             encounter so many Structures. This should be optimized since they share the large part of
1730             prototype-chain and they hit the exactly same CustomGetter, Node.prototype.firstChild.
1731             We will handle this and when we optimize it, this DOMJIT works well on Dromaeo.
1732
1733                 test( "firstChild", function(){
1734                     var nodes = document.body.childNodes, nl = nodes.length;
1735
1736                     for ( var i = 0; i < num; i++ ) {
1737                         for ( var j = 0; j < nl; j++ ) {
1738                             var cur = nodes[j];
1739                             while ( cur )
1740                                 cur = cur.firstChild;
1741                             ret = cur;
1742                         }
1743                     }
1744                 });
1745
1746         2. Emit code in IC.
1747
1748             Currently, we only optimize DOMJIT accessors in DFG and FTL. However, we should leverage
1749             this DOMJIT::Patchpoint to emit inlined code even in Inline Caching (IC). We will emit
1750             CheckDOM's code for IC's guard phase, and emit CallDOM's code for IC's get phase. This
1751             offers performance benefit even if we live in baseline JIT code. And this should be easy.
1752
1753         [1]: With the following one, we can see 3x improvement (26ms v.s. 80ms).
1754
1755             var element = document.getElementsByTagName('div')[3];
1756             var before = Date.now();
1757             for (var i = 0; i < 1e7; ++i)
1758                 element.firstChild;
1759             console.log(Date.now() - before);
1760
1761         * CMakeLists.txt:
1762         * ForwardingHeaders/domjit/DOMJITGetterSetter.h:
1763         * ForwardingHeaders/domjit/DOMJITPatchpoint.h: Copied from Source/JavaScriptCore/domjit/DOMJITSlowPathCalls.h.
1764         * ForwardingHeaders/domjit/DOMJITPatchpointParams.h: Copied from Source/JavaScriptCore/domjit/DOMJITSlowPathCalls.h.
1765         * WebCore.xcodeproj/project.pbxproj:
1766         * bindings/js/JSDOMGlobalObject.h:
1767         * bindings/js/JSDOMWrapper.h:
1768         (WebCore::JSDOMWrapper::offsetOfWrapped):
1769         (WebCore::JSDOMWrapper::wrapped): Deleted.
1770         * bindings/js/ScriptWrappable.h:
1771         (WebCore::ScriptWrappable::offsetOfWrapper):
1772         * bindings/scripts/CodeGeneratorJS.pm:
1773         (GetJSCAttributesForAttribute):
1774         (GenerateHeader):
1775         (GeneratePropertiesHashTable):
1776         (GenerateImplementation):
1777         (GenerateHashTableValueArray):
1778         * bindings/scripts/IDLAttributes.txt:
1779         * dom/ContainerNode.h:
1780         (WebCore::ContainerNode::lastChildMemoryOffset):
1781         (WebCore::ContainerNode::lastChild): Deleted.
1782         * dom/Node.h:
1783         (WebCore::Node::flagIsContainer):
1784         (WebCore::Node::flagIsText): Deleted.
1785         * dom/Node.idl:
1786         * domjit/DOMJITHelpers.h: Added.
1787         (WebCore::DOMJITHelpers::branchIfNotWorldIsNormal):
1788         (WebCore::DOMJITHelpers::branchIfNotWeakIsLive):
1789         (WebCore::DOMJITHelpers::tryLookUpWrapperCache):
1790         (WebCore::DOMJITHelpers::toWrapper):
1791         (WebCore::DOMJITHelpers::branchIfDOMWrapper):
1792         (WebCore::DOMJITHelpers::branchIfNotDOMWrapper):
1793         (WebCore::DOMJITHelpers::branchIfNode):
1794         (WebCore::DOMJITHelpers::branchIfNotNode):
1795         (WebCore::DOMJITHelpers::branchIfElement):
1796         (WebCore::DOMJITHelpers::branchIfNotElement):
1797         (WebCore::DOMJITHelpers::branchIfDocumentWrapper):
1798         (WebCore::DOMJITHelpers::branchIfNotDocumentWrapper):
1799         * domjit/JSNodeDOMJIT.cpp: Added.
1800         (WebCore::toWrapperSlow):
1801         (WebCore::createCallDOMForOffsetAccess):
1802         (WebCore::checkNode):
1803         (WebCore::NodeFirstChildDOMJIT::checkDOM):
1804         (WebCore::NodeFirstChildDOMJIT::callDOM):
1805         (WebCore::NodeLastChildDOMJIT::checkDOM):
1806         (WebCore::NodeLastChildDOMJIT::callDOM):
1807         (WebCore::NodeNextSiblingDOMJIT::checkDOM):
1808         (WebCore::NodeNextSiblingDOMJIT::callDOM):
1809         (WebCore::NodePreviousSiblingDOMJIT::checkDOM):
1810         (WebCore::NodePreviousSiblingDOMJIT::callDOM):
1811         (WebCore::NodeParentNodeDOMJIT::checkDOM):
1812         (WebCore::NodeParentNodeDOMJIT::callDOM):
1813
1814 2016-10-10  Wenson Hsieh  <wenson_hsieh@apple.com>
1815
1816         Support InputEvent.data for the new InputEvent spec
1817         https://bugs.webkit.org/show_bug.cgi?id=163113
1818         <rdar://problem/28681935>
1819
1820         Reviewed by Darin Adler.
1821
1822         Introduces InputEvent.data, a string attribute that, if non-null, indicates the text to be inserted by an input
1823         event. For text areas and text inputs, the 'insertText', 'insertFromPaste', 'insertFromDrop', and
1824         'insertReplacementText' input types should cause subsequent `input` and `beforeinput` events to have non-null
1825         data. However, for contenteditable areas, only 'insertText' leads to having data in resulting InputEvents.
1826
1827         To implement this, we introduce a new virtual method, CompositeEditCommand::inputEventData, which gives
1828         composite editing commands the chance to vend a data string for input events they might fire (by default, this
1829         is null).
1830
1831         Tests: fast/events/input-events-paste-data.html
1832                fast/events/input-events-typing-data.html
1833
1834         * dom/InputEvent.cpp:
1835         (WebCore::InputEvent::InputEvent):
1836         * dom/InputEvent.h:
1837         * dom/InputEvent.idl:
1838
1839         Currently, our InputEventInit struct is wrong. According to the UI-Events spec at www.w3.org/TR/uievents/, the
1840         init struct for an InputEvent should contain a data string (added in this patch) as well as an isComposing flag
1841         (to be added in a future patch along with composition support). While adding support for the data attribute, we
1842         tweak the InputEvent IDL and headers slightly to adjust for this.
1843
1844         * dom/Node.cpp:
1845         (WebCore::Node::dispatchInputEvent):
1846         * dom/Node.h:
1847         * editing/CompositeEditCommand.h:
1848         (WebCore::CompositeEditCommand::inputEventData):
1849         * editing/EditCommand.cpp:
1850         (WebCore::EditCommand::isEditingTextAreaOrTextInput):
1851         * editing/EditCommand.h:
1852         * editing/Editor.cpp:
1853         (WebCore::dispatchBeforeInputEvent):
1854         (WebCore::dispatchInputEvent):
1855         (WebCore::dispatchBeforeInputEvents):
1856         (WebCore::dispatchInputEvents):
1857         (WebCore::Editor::willApplyEditing):
1858         (WebCore::Editor::appliedEditing):
1859         (WebCore::Editor::setBaseWritingDirection):
1860         (WebCore::Editor::computeAndSetTypingStyle):
1861         * editing/ReplaceRangeWithTextCommand.cpp:
1862         (WebCore::ReplaceRangeWithTextCommand::inputEventData):
1863         * editing/ReplaceRangeWithTextCommand.h:
1864         * editing/ReplaceSelectionCommand.cpp:
1865         (WebCore::ReplaceSelectionCommand::inputEventData):
1866         * editing/ReplaceSelectionCommand.h:
1867         * editing/SpellingCorrectionCommand.cpp:
1868         (WebCore::SpellingCorrectionCommand::inputEventData):
1869         * editing/SpellingCorrectionCommand.h:
1870         * editing/TypingCommand.cpp:
1871         (WebCore::TypingCommand::TypingCommand):
1872         (WebCore::TypingCommand::inputEventData):
1873         (WebCore::TypingCommand::willAddTypingToOpenCommand):
1874         (WebCore::TypingCommand::insertTextRunWithoutNewlines):
1875         * editing/TypingCommand.h:
1876         * html/HTMLFormControlElement.cpp:
1877         (WebCore::HTMLFormControlElement::dispatchFormControlInputEvent):
1878         * html/HTMLInputElement.cpp:
1879         (WebCore::HTMLInputElement::setEditingValue):
1880         (WebCore::HTMLInputElement::setValueFromRenderer):
1881         * html/HTMLSelectElement.cpp:
1882         (WebCore::HTMLSelectElement::listBoxOnChange):
1883         (WebCore::HTMLSelectElement::dispatchChangeEventForMenuList):
1884
1885 2016-10-10  Commit Queue  <commit-queue@webkit.org>
1886
1887         Unreviewed, rolling out r206972.
1888         https://bugs.webkit.org/show_bug.cgi?id=163227
1889
1890         Making EWS flaky (Requested by bfulgham_ on #webkit).
1891
1892         Reverted changeset:
1893
1894         "[CMake] CMake does not support the dep files for implicit
1895         dependency"
1896         https://bugs.webkit.org/show_bug.cgi?id=161433
1897         http://trac.webkit.org/changeset/206972
1898
1899 2016-10-10  Darin Adler  <darin@apple.com>
1900
1901         Move media source from legacy to new DOM exceptions
1902         https://bugs.webkit.org/show_bug.cgi?id=163201
1903
1904         Reviewed by Chris Dumez.
1905
1906         * Modules/mediasource/MediaSource.cpp: Removed unneeded includes.
1907         (WebCore::MediaSource::create): Use auto.
1908         (WebCore::MediaSource::MediaSource): Initialize m_mediaElement in class definition.
1909         (WebCore::MediaSource::setLiveSeekableRange): Use ExceptionOr.
1910         (WebCore::MediaSource::clearLiveSeekableRange): Ditto.
1911         (WebCore::MediaSource::setDuration): Ditto.
1912         (WebCore::MediaSource::setDurationInternal): Ditto.
1913         (WebCore::MediaSource::endOfStream): Ditto.
1914         (WebCore::MediaSource::streamEndedWithError): Use bufferedInternal.
1915         (WebCore::MediaSource::addSourceBuffer): Use ExceptionOr.
1916         (WebCore::MediaSource::removeSourceBuffer): Ditto.
1917         (WebCore::MediaSource::detachFromElement): Use removeSourceBuffer
1918         without IGNORE_EXCEPTION since that is now the default behavior.
1919         (WebCore::MediaSource::activeRanges): Use bufferedInternal.
1920         (WebCore::MediaSource::createSourceBufferPrivate): Use ExceptionOr.
1921
1922         * Modules/mediasource/MediaSource.h: Removed unneeded includes.
1923         Made more things private and also private rather than protected.
1924
1925         * Modules/mediasource/MediaSource.idl: Use non-legacy exceptions.
1926
1927         * Modules/mediasource/SourceBuffer.cpp:
1928         (WebCore::SourceBuffer::buffered): Use ExceptionOr.
1929         (WebCore::SourceBuffer::setTimestampOffset): Ditto.
1930         (WebCore::SourceBuffer::setAppendWindowStart): Ditto.
1931         (WebCore::SourceBuffer::setAppendWindowEnd): Ditto.
1932         (WebCore::SourceBuffer::appendBuffer): Ditto.
1933         (WebCore::SourceBuffer::abort): Ditto.
1934         (WebCore::SourceBuffer::remove): Ditto.
1935         (WebCore::SourceBuffer::appendBufferInternal): Ditto.
1936         (WebCore::SourceBuffer::setMode): Ditto.
1937
1938         * Modules/mediasource/SourceBuffer.h: Removed unneeded includes.
1939         Updated for above changes. Made more things private.
1940
1941         * Modules/mediasource/SourceBuffer.idl: Use non-legacy exceptions.
1942
1943         * platform/graphics/gstreamer/WebKitMediaSourceGStreamer.h:
1944         Added now-needed include of MediaSourcePrivate.h.
1945
1946 2016-10-10  Jer Noble  <jer.noble@apple.com>
1947
1948         Address flaky airplay-* LayouTests
1949         https://bugs.webkit.org/show_bug.cgi?id=163044
1950
1951         Reviewed by Brent Fulgham.
1952
1953         Two separate problems conspired to make airplay tests a bit flaky:
1954
1955         For one, when the HTMLMediaElement clears its MediaPlayer, it won't necessarily notify
1956         clients that it has stopped playing to a wireless target. The WebMediaSessionManager may
1957         eventually cause this value to reset, but it's asynchronous, and may fire after the next
1958         test starts. Reset this state explicitly.
1959
1960         For two, the state of the mock playback target picker was not being reset between test
1961         invocations.
1962
1963         * html/HTMLMediaElement.cpp:
1964         (WebCore::HTMLMediaElement::clearMediaPlayer):
1965         * testing/Internals.cpp:
1966         (WebCore::Internals::resetToConsistentState):
1967
1968 2016-10-10  Brent Fulgham  <bfulgham@apple.com>
1969
1970         Correct typo in comment (patining -> painting).
1971
1972         * platform/graphics/GraphicsContext.cpp:
1973         (WebCore::GraphicsContext::centerLineAndCutOffCorners):
1974
1975 2016-10-10  Brent Fulgham  <bfulgham@apple.com>
1976
1977         Reduce code duplication between CG, Cairo, and Direct2D
1978         https://bugs.webkit.org/show_bug.cgi?id=163157
1979
1980         Reviewed by Darin Adler.
1981
1982         Move a number of routines that have been copied-and-pasted to different
1983         platform files into the main GraphicsContext.cpp file.
1984
1985         No new tests because there is no change in behavior.
1986
1987         * platform/graphics/GraphicsContext.cpp:
1988         (WebCore::GraphicsContext::dashedLineCornerWidthForStrokeWidth): Added.
1989         (WebCore::GraphicsContext::dashedLinePatternWidthForStrokeWidth): Added.
1990         (WebCore::GraphicsContext::dashedLinePatternOffsetForPatternAndStrokeWidth): Added.
1991         (WebCore::GraphicsContext::centerLineAndCutOffCorners): Added.
1992         * platform/graphics/GraphicsContext.h:
1993         * platform/graphics/cairo/GraphicsContextCairo.cpp:
1994         (WebCore::GraphicsContext::drawLine): Call new helper function.
1995         * platform/graphics/cg/GraphicsContextCG.cpp:
1996         (WebCore::GraphicsContext::drawLine): Ditto.
1997         * platform/graphics/win/GraphicsContextDirect2D.cpp:
1998         (WebCore::GraphicsContext::drawLine): Ditto.
1999
2000 2016-10-10  Carlos Garcia Campos  <cgarcia@igalia.com>
2001
2002         REGRESSION(r206731): [SOUP] Network process crash in gotHeadersCallback
2003         https://bugs.webkit.org/show_bug.cgi?id=163170
2004
2005         Reviewed by Michael Catanzaro.
2006
2007         Do not assume NetworkingContext is non-null and valid before using it.
2008
2009         * platform/network/soup/ResourceHandleSoup.cpp:
2010         (WebCore::gotHeadersCallback):
2011         (WebCore::ResourceHandle::didReceiveAuthenticationChallenge):
2012
2013 2016-10-10  Youenn Fablet  <youenn@apple.com>
2014
2015         Images and scripts should be said as clean based on CachedResource::isCORSSameOrigin
2016         https://bugs.webkit.org/show_bug.cgi?id=162390
2017
2018         Reviewed by Darin Adler.
2019
2020         No observable change of behavior.
2021
2022         Renaming CachedResource::isClean to isCORSSameOrigin to match html spec terminology.
2023         Making use of it to check whether images taint canvas and whether script errors should be sanitized.
2024
2025         Some asserts are added to ensure that a resource fetched using one origin is not reused for another origin.
2026
2027         * dom/ScriptExecutionContext.cpp:
2028         (WebCore::ScriptExecutionContext::sanitizeScriptError):
2029         * html/HTMLLinkElement.cpp:
2030         (WebCore::HTMLLinkElement::initializeStyleSheet):
2031         * html/canvas/CanvasRenderingContext.cpp:
2032         (WebCore::CanvasRenderingContext::wouldTaintOrigin):
2033         * loader/cache/CachedImage.cpp:
2034         (WebCore::CachedImage::isOriginClean):
2035         * loader/cache/CachedResource.cpp:
2036         (WebCore::CachedResource::isCORSSameOrigin):
2037         * loader/cache/CachedResource.h:
2038
2039 2016-10-10  Youenn Fablet  <youenn@apple.com>
2040
2041         [Fetch API] Memory cache should not bypass redirect mode
2042         https://bugs.webkit.org/show_bug.cgi?id=162959
2043
2044         Reviewed by Darin Adler.
2045
2046         Test: http/tests/fetch/redirectmode-and-preload.html
2047
2048         Ensure reloading of resources if the redirect modes are different between request and cached resource, and
2049         cached resource has redirections.
2050
2051         As a temporary workaround, we activate resource update for raw resources in
2052         shouldUpdateCachedResourceWithCurrentRequest but disable it in canUpdateFromResource.
2053         This allows handling reloading of resources with different redirection mode in canUpdateFromResource.
2054
2055         A future patch should allow loading cached raw resources from other cached raw resources.
2056
2057         * loader/cache/CachedResource.h:
2058         (WebCore::CachedResource::hasRedirections):
2059         * loader/cache/CachedResourceLoader.cpp:
2060         (WebCore::CachedResourceLoader::shouldUpdateCachedResourceWithCurrentRequest):
2061         (WebCore::canUpdateFromResource):
2062         (WebCore::CachedResourceLoader::updateCachedResourceWithCurrentRequest):
2063
2064 2016-10-10  Youenn Fablet  <youenn@apple.com>
2065
2066         Attribute getter binding generated code should use more references
2067         https://bugs.webkit.org/show_bug.cgi?id=163179
2068
2069         Reviewed by Darin Adler.
2070
2071         No change of behavior.
2072
2073         Using more references in attribute getter generated code since BindingCaller::attribute can do the
2074         pointer-to-references checks once for all.
2075
2076         Needed to update GenerateCallWith and NativeToJSValue to handle the case where references (attribute getters) or
2077         pointers (methods and attribute setters) are to be used.
2078         Future refactoring should allign methods/attribute setters to attribute getters.
2079
2080         * bindings/js/JSDOMBinding.h:
2081         (WebCore::BindingCaller::attribute):
2082         * bindings/scripts/CodeGeneratorJS.pm:
2083         (GenerateImplementation):
2084         (GenerateCallWith):
2085         (NativeToJSValue):
2086         (JSValueToNative):
2087         * bindings/scripts/test/JS/JSTestActiveDOMObject.cpp:
2088         * bindings/scripts/test/JS/JSTestEventConstructor.cpp:
2089         * bindings/scripts/test/JS/JSTestException.cpp:
2090         * bindings/scripts/test/JS/JSTestGlobalObject.cpp:
2091         * bindings/scripts/test/JS/JSTestInterface.cpp:
2092         * bindings/scripts/test/JS/JSTestJSBuiltinConstructor.cpp:
2093         * bindings/scripts/test/JS/JSTestNode.cpp:
2094         * bindings/scripts/test/JS/JSTestNondeterministic.cpp:
2095         * bindings/scripts/test/JS/JSTestObj.cpp:
2096         * bindings/scripts/test/JS/JSattribute.cpp:
2097
2098 2016-10-10  Youenn Fablet  <youenn@apple.com>
2099
2100         Fix Mac Win build after https://trac.webkit.org/changeset/206966
2101         https://bugs.webkit.org/show_bug.cgi?id=163199
2102
2103         Unreviewed.
2104
2105         * bindings/js/JSDOMBinding.h: Marking rejectPromiseWithGetterTypeError as WEBCORE_EXPORT.
2106
2107 2016-10-09  Antti Koivisto  <antti@apple.com>
2108
2109         Enable optimized stylesheet updates in shadow trees
2110         https://bugs.webkit.org/show_bug.cgi?id=163180
2111
2112         Reviewed by Darin Adler.
2113
2114         When we get a new stylesheet (for example when load completes) we invalidate only
2115         those elements in DOM that are affected by the new sheet. This patch makes the
2116         optimization also work in shadow trees.
2117
2118         Test: fast/shadow-dom/scoped-style-invalidation.html
2119
2120         * css/StyleInvalidationAnalysis.cpp:
2121         (WebCore::StyleInvalidationAnalysis::invalidateStyle):
2122         * css/StyleInvalidationAnalysis.h:
2123         * dom/Document.cpp:
2124         (WebCore::Document::didRemoveAllPendingStylesheet):
2125         * style/StyleScope.cpp:
2126         (WebCore::Style::Scope::removePendingSheet):
2127         (WebCore::Style::Scope::analyzeStyleSheetChange):
2128         (WebCore::Style::Scope::updateActiveStyleSheets):
2129
2130 2016-10-10  Youenn Fablet  <youenn@apple.com>
2131
2132         Refactor binding generated casted-this checks for attribute setters
2133         https://bugs.webkit.org/show_bug.cgi?id=163181
2134
2135         Reviewed by Darin Adler.
2136
2137         No change of behavior.
2138         Covered by existing tests and binding expectations.
2139
2140         Adding support for attribute setter in BindingCaller.
2141         Updating binding generator to make use of it.
2142         Future refactoring should use more reference and rename castedThis to thisObject, like for getters.
2143
2144         * bindings/js/JSDOMBinding.h:
2145         (WebCore::BindingCaller::setAttribute):
2146         * bindings/scripts/CodeGeneratorJS.pm:
2147         (GenerateImplementation):
2148         * bindings/scripts/test/JS/JSTestInterface.cpp:
2149         * bindings/scripts/test/JS/JSTestJSBuiltinConstructor.cpp:
2150         * bindings/scripts/test/JS/JSTestNode.cpp:
2151         * bindings/scripts/test/JS/JSTestNondeterministic.cpp:
2152         * bindings/scripts/test/JS/JSTestObj.cpp:
2153         * bindings/scripts/test/JS/JSTestSerializedScriptValueInterface.cpp:
2154         * bindings/scripts/test/JS/JSTestTypedefs.cpp:
2155
2156 2016-10-09  Darin Adler  <darin@apple.com>
2157
2158         Move encrypted media from legacy to new DOM exceptions
2159         https://bugs.webkit.org/show_bug.cgi?id=163194
2160
2161         Reviewed by Youenn Fablet.
2162
2163         * Modules/encryptedmedia/CDM.cpp:
2164         (WebCore::CDM::createSession): Take a reference instead of a pointer.
2165         * Modules/encryptedmedia/CDM.h: Updated for above change.
2166
2167         * Modules/encryptedmedia/legacy/WebKitMediaKeySession.cpp:
2168         (WebCore::WebKitMediaKeySession::create): Take a reference instead of a pointer.
2169         (WebCore::WebKitMediaKeySession::MediaKeySession): Ditto.
2170         (WebCore::WebKitMediaKeySession::~MediaKeySession): Removed unneeded code that
2171         sets m_session to null.
2172         (WebCore::WebKitMediaKeySession::keyRequestTimerFired): Use auto.
2173         (WebCore::WebKitMediaKeySession::update): Use ExceptionOr.
2174         (WebCore::WebKitMediaKeySession::addKeyTimerFired): Use m_keys directly instead
2175         of calling the keys function.
2176         (WebCore::WebKitMediaKeySession::sendError): Set m_error directly instead of
2177         calling the setError function.
2178         (WebCore::WebKitMediaKeySession::mediaKeysStorageDirectory): Use auto.
2179         (WebCore::WebKitMediaKeySession::hasPendingActivity): Check m_session directly
2180         instead of writing !isClosed.
2181         (WebCore::WebKitMediaKeySession::setError): Deleted.
2182
2183         * Modules/encryptedmedia/legacy/WebKitMediaKeySession.h: Use pragma once. Removed
2184         unneeded includes. Changed create to take a reference instead of a pointer.
2185         Made most members and base classes private instead of public. Also removed
2186         a few now-unneeded functions. Made everything that was formerly protected
2187         private instead, since the two are the same in a final class.
2188
2189         * Modules/encryptedmedia/legacy/WebKitMediaKeySession.idl: Removed unneeded comments.
2190         Moved from MayThrowLegacyException to MayThrowException.
2191
2192         * Modules/encryptedmedia/legacy/WebKitMediaKeys.cpp:
2193         (WebCore::WebKitMediaKeys::create): Use ExceptionOr.
2194         (WebCore::WebKitMediaKeys::MediaKeys): Made argument be an rvalue reference.
2195         Also initialize m_mediaElement in the class definition.
2196         (WebCore::WebKitMediaKeys::~MediaKeys): Call detachKeys instead of setKeys(nullptr).
2197         (WebCore::WebKitMediaKeys::createSession): Use ExceptionOr. Also pass reference
2198         insteead of pointer to create. Also removed unneeded separate checks for null
2199         strings in code that already calls isEmpty.
2200         (WebCore::WebKitMediaKeys::isTypeSupported): Removed unneeded checks for null strings
2201         in code that already calls isEmpty.
2202         (WebCore::WebKitMediaKeys::cdmMediaPlayer): Tweaked a bit.
2203         (WebCore::WebKitMediaKeys::cachedKeyForKeyId): Use auto.
2204
2205         * Modules/encryptedmedia/legacy/WebKitMediaKeys.h: Use pragma once. Removed unneeded includes.
2206         Changed cdm() function to return a reference. Initialize m_mediaElement.
2207         Use private instead of protected.
2208
2209         * Modules/encryptedmedia/legacy/WebKitMediaKeys.idl: Use ConstructorMayThrowException
2210         and MayThrowException instead of the legacy versions.
2211
2212 2016-10-09  Zan Dobersek  <zdobersek@igalia.com>
2213
2214         ENABLE_LEGACY_ENCRYPTED_MEDIA interfaces should have a hard-coded WebKit prefix
2215         https://bugs.webkit.org/show_bug.cgi?id=162982
2216
2217         Reviewed by Jer Noble.
2218
2219         Have the Web-exposed interfaces guarded by ENABLE_LEGACY_ENCRYPTED_MEDIA also use
2220         the WebKit prefix in the implementations. This will prevent conflicts between
2221         interfaces with same names in both the legacy API and the future EME API.
2222
2223         Most of the interfaces in this legacy API already used the WebKit prefix when
2224         exposed via JS bindings. The only exception is MediaKeyNeededEvent, which gets
2225         prefixed in this patch.
2226
2227         The interface implementations for this legacy API are also moved under the
2228         Modules/encryptedmedia/legacy/ directory.
2229
2230         No new tests -- covered by existing tests (with the relevant changes reflected
2231         in the updated baselines).
2232
2233         * CMakeLists.txt:
2234         * DerivedSources.cpp:
2235         * DerivedSources.make:
2236         * Modules/encryptedmedia/CDM.cpp:
2237         * Modules/encryptedmedia/CDMSessionClearKey.cpp:
2238         (WebCore::CDMSessionClearKey::generateKeyRequest):
2239         (WebCore::CDMSessionClearKey::update):
2240         * Modules/encryptedmedia/legacy/WebKitMediaKeyMessageEvent.cpp: Renamed from Source/WebCore/Modules/encryptedmedia/MediaKeyMessageEvent.cpp.
2241         (WebCore::WebKitMediaKeyMessageEvent::WebKitMediaKeyMessageEvent):
2242         (WebCore::WebKitMediaKeyMessageEvent::~WebKitMediaKeyMessageEvent):
2243         (WebCore::WebKitMediaKeyMessageEvent::eventInterface):
2244         * Modules/encryptedmedia/legacy/WebKitMediaKeyMessageEvent.h: Renamed from Source/WebCore/Modules/encryptedmedia/MediaKeyMessageEvent.h.
2245         (WebCore::WebKitMediaKeyMessageEvent::create):
2246         (WebCore::WebKitMediaKeyMessageEvent::createForBindings):
2247         * Modules/encryptedmedia/legacy/WebKitMediaKeyMessageEvent.idl: Renamed from Source/WebCore/Modules/encryptedmedia/MediaKeyMessageEvent.idl.
2248         * Modules/encryptedmedia/legacy/WebKitMediaKeyNeededEvent.cpp: Renamed from Source/WebCore/Modules/encryptedmedia/MediaKeyNeededEvent.cpp.
2249         (WebCore::WebKitMediaKeyNeededEvent::WebKitMediaKeyNeededEvent):
2250         (WebCore::WebKitMediaKeyNeededEvent::~WebKitMediaKeyNeededEvent):
2251         (WebCore::WebKitMediaKeyNeededEvent::eventInterface):
2252         * Modules/encryptedmedia/legacy/WebKitMediaKeyNeededEvent.h: Renamed from Source/WebCore/Modules/encryptedmedia/MediaKeyNeededEvent.h.
2253         (WebCore::WebKitMediaKeyNeededEvent::create):
2254         (WebCore::WebKitMediaKeyNeededEvent::createForBindings):
2255         * Modules/encryptedmedia/legacy/WebKitMediaKeyNeededEvent.idl: Renamed from Source/WebCore/Modules/encryptedmedia/MediaKeyNeededEvent.idl.
2256         * Modules/encryptedmedia/legacy/WebKitMediaKeySession.cpp: Renamed from Source/WebCore/Modules/encryptedmedia/MediaKeySession.cpp.
2257         (WebCore::WebKitMediaKeySession::create):
2258         (WebCore::WebKitMediaKeySession::WebKitMediaKeySession):
2259         (WebCore::WebKitMediaKeySession::~WebKitMediaKeySession):
2260         (WebCore::WebKitMediaKeySession::setError):
2261         (WebCore::WebKitMediaKeySession::close):
2262         (WebCore::WebKitMediaKeySession::cachedKeyForKeyId):
2263         (WebCore::WebKitMediaKeySession::sessionId):
2264         (WebCore::WebKitMediaKeySession::generateKeyRequest):
2265         (WebCore::WebKitMediaKeySession::keyRequestTimerFired):
2266         (WebCore::WebKitMediaKeySession::update):
2267         (WebCore::WebKitMediaKeySession::addKeyTimerFired):
2268         (WebCore::WebKitMediaKeySession::sendMessage):
2269         (WebCore::WebKitMediaKeySession::sendError):
2270         (WebCore::WebKitMediaKeySession::mediaKeysStorageDirectory):
2271         (WebCore::WebKitMediaKeySession::hasPendingActivity):
2272         (WebCore::WebKitMediaKeySession::stop):
2273         (WebCore::WebKitMediaKeySession::activeDOMObjectName):
2274         (WebCore::WebKitMediaKeySession::canSuspendForDocumentSuspension):
2275         * Modules/encryptedmedia/legacy/WebKitMediaKeySession.h: Renamed from Source/WebCore/Modules/encryptedmedia/MediaKeySession.h.
2276         * Modules/encryptedmedia/legacy/WebKitMediaKeySession.idl: Renamed from Source/WebCore/Modules/encryptedmedia/MediaKeySession.idl.
2277         * Modules/encryptedmedia/legacy/WebKitMediaKeys.cpp: Renamed from Source/WebCore/Modules/encryptedmedia/MediaKeys.cpp.
2278         (WebCore::WebKitMediaKeys::create):
2279         (WebCore::WebKitMediaKeys::WebKitMediaKeys):
2280         (WebCore::WebKitMediaKeys::~WebKitMediaKeys):
2281         (WebCore::WebKitMediaKeys::createSession):
2282         (WebCore::WebKitMediaKeys::isTypeSupported):
2283         (WebCore::WebKitMediaKeys::setMediaElement):
2284         (WebCore::WebKitMediaKeys::cdmMediaPlayer):
2285         (WebCore::WebKitMediaKeys::keyAdded):
2286         (WebCore::WebKitMediaKeys::cachedKeyForKeyId):
2287         * Modules/encryptedmedia/legacy/WebKitMediaKeys.h: Renamed from Source/WebCore/Modules/encryptedmedia/MediaKeys.h.
2288         * Modules/encryptedmedia/legacy/WebKitMediaKeys.idl: Renamed from Source/WebCore/Modules/encryptedmedia/MediaKeys.idl.
2289         * bindings/js/JSDictionary.cpp:
2290         (WebCore::JSDictionary::convertValue):
2291         * bindings/js/JSDictionary.h:
2292         * dom/EventNames.in:
2293         * dom/EventTargetFactory.in:
2294         * html/HTMLMediaElement.cpp:
2295         (WebCore::HTMLMediaElement::mediaPlayerKeyNeeded):
2296         (WebCore::HTMLMediaElement::setMediaKeys):
2297         * html/HTMLMediaElement.h:
2298         (WebCore::HTMLMediaElement::keys):
2299         * html/HTMLMediaElement.idl:
2300         * html/WebKitMediaKeyError.h: Renamed from Source/WebCore/html/MediaKeyError.h.
2301         (WebCore::WebKitMediaKeyError::create):
2302         (WebCore::WebKitMediaKeyError::WebKitMediaKeyError):
2303         * html/WebKitMediaKeyError.idl: Renamed from Source/WebCore/html/MediaKeyError.idl.
2304         * testing/MockCDM.cpp:
2305         (WebCore::MockCDMSession::generateKeyRequest):
2306         (WebCore::MockCDMSession::update):
2307
2308 2016-10-09  Zan Dobersek  <zdobersek@igalia.com>
2309
2310         Remove stale ENABLE(ENCRYPTED_MEDIA) code in HTMLMediaElement
2311         https://bugs.webkit.org/show_bug.cgi?id=163111
2312
2313         Reviewed by Alex Christensen.
2314
2315         Remove three method implementations in HTMLMediaElement which had their
2316         declarations and the related WebIDL entries removed in the first ENCRYPTED_MEDIA
2317         purge in r206440.
2318
2319         No new tests -- no changes in behavior.
2320
2321         * html/HTMLMediaElement.cpp:
2322         (WebCore::HTMLMediaElement::webkitGenerateKeyRequest): Deleted.
2323         (WebCore::HTMLMediaElement::webkitAddKey): Deleted.
2324         (WebCore::HTMLMediaElement::webkitCancelKeyRequest): Deleted.
2325
2326 2016-10-09  Wenson Hsieh  <wenson_hsieh@apple.com>
2327
2328         Support InputEvent.inputType for the new InputEvent spec
2329         https://bugs.webkit.org/show_bug.cgi?id=163025
2330         <rdar://problem/28658092>
2331
2332         Reviewed by Darin Adler.
2333
2334         Adds support for the inputType attribute of InputEvent. To do this, we introduce a helper to
2335         map EditActions to inputType names, and also split out ambiguous EditActions (such as
2336         EditActionTyping) into more specific subtypes (such as EditActionTypingDeleteBackward,
2337         EditActionTypingInsertParagraph, etc.), each of which corresponds to an inputType.
2338
2339         In places where we create CompositeEditCommands, we now pass in these specific EditActions
2340         where appropriate, and when dispatching `beforeinput` and `input` events, we ask the
2341         CompositeEditCommand for its input type name, which it derives from its editingAction.
2342
2343         Tests: fast/events/before-input-prevent-biu.html
2344                fast/events/before-input-prevent-cut.html
2345                fast/events/before-input-prevent-paste.html
2346                fast/events/before-input-prevent-typing.html
2347                fast/events/before-input-prevent-undo.html
2348
2349         * dom/InputEvent.h:
2350         * dom/Node.cpp:
2351         (WebCore::Node::dispatchInputEvent):
2352         * dom/Node.h:
2353         * editing/CompositeEditCommand.cpp:
2354         (WebCore::CompositeEditCommand::apply):
2355         (WebCore::CompositeEditCommand::inputEventTypeName):
2356
2357         Allows a CompositeEditCommand to specify the inputType its corresponding `beforeinput` and `input` events
2358         should have.
2359
2360         * editing/CompositeEditCommand.h:
2361         (WebCore::CompositeEditCommand::shouldStopCaretBlinking): Deleted.
2362         * editing/EditAction.h:
2363         * editing/EditCommand.cpp:
2364         (WebCore::inputTypeNameForEditingAction):
2365         * editing/EditCommand.h:
2366         * editing/Editor.cpp:
2367         (WebCore::Editor::willApplyEditing):
2368         (WebCore::Editor::appliedEditing):
2369         (WebCore::Editor::willUnapplyEditing):
2370         (WebCore::Editor::unappliedEditing):
2371         (WebCore::Editor::willReapplyEditing):
2372         (WebCore::Editor::reappliedEditing):
2373         (WebCore::Editor::computeAndSetTypingStyle):
2374         * editing/InsertListCommand.cpp:
2375         (WebCore::InsertListCommand::editingAction):
2376         * editing/InsertListCommand.h:
2377         (WebCore::InsertListCommand::preservesTypingStyle): Deleted.
2378         (WebCore::InsertListCommand::editingAction): Deleted.
2379         * editing/ReplaceRangeWithTextCommand.cpp:
2380         (WebCore::ReplaceRangeWithTextCommand::ReplaceRangeWithTextCommand):
2381         * editing/SpellingCorrectionCommand.cpp:
2382         (WebCore::SpellingCorrectionCommand::SpellingCorrectionCommand):
2383         * editing/TypingCommand.cpp:
2384         (WebCore::editActionForTypingCommand):
2385         (WebCore::TypingCommand::TypingCommand):
2386         (WebCore::TypingCommand::inputEventTypeName):
2387
2388         The editingAction() of a TypingCommand is the first editing action the TypingCommand was initialized using.
2389         Since subsequent typing commands update the last open typing command, we override inputEventTypeName here to
2390         use the last updated editing action rather than the default (initial) editing action.
2391
2392         (WebCore::TypingCommand::willAddTypingToOpenCommand):
2393         (WebCore::TypingCommand::insertTextRunWithoutNewlines):
2394         (WebCore::TypingCommand::insertParagraphSeparator):
2395         * editing/TypingCommand.h:
2396
2397 2016-10-09  Darin Adler  <darin@apple.com>
2398
2399         Move ApplePaySession from legacy to new DOM exceptions
2400         https://bugs.webkit.org/show_bug.cgi?id=163191
2401
2402         Reviewed by Sam Weinig.
2403
2404         * Modules/applepay/ApplePaySession.cpp:
2405         (WebCore::ApplePaySession::create): Use ExceptionOr.
2406         (WebCore::ApplePaySession::ApplePaySession): Moved initialization
2407         of two of the data members to class definition.
2408         (WebCore::ApplePaySession::supportsVersion): Use ExceptionOr.
2409         (WebCore::ApplePaySession::canMakePayments): Ditto.
2410         (WebCore::ApplePaySession::canMakePaymentsWithActiveCard): Ditto.
2411         (WebCore::ApplePaySession::openPaymentSetup): Ditto.
2412         (WebCore::ApplePaySession::begin): Ditto.
2413         (WebCore::ApplePaySession::abort): Ditto.
2414         (WebCore::ApplePaySession::completeMerchantValidation): Ditto.
2415         (WebCore::ApplePaySession::completeShippingMethodSelection): Ditto.
2416         (WebCore::ApplePaySession::completeShippingContactSelection): Ditto.
2417         (WebCore::ApplePaySession::completePaymentMethodSelection): Ditto.
2418         (WebCore::ApplePaySession::completePayment): Ditto.
2419         (WebCore::ApplePaySession::validateMerchant): Use auto and get instead of
2420         using a RefPtr type and * for event dispatching.
2421         (WebCore::ApplePaySession::didAuthorizePayment): Ditto.
2422         (WebCore::ApplePaySession::didSelectShippingMethod): Ditto.
2423         (WebCore::ApplePaySession::didSelectShippingContact): Ditto.
2424         (WebCore::ApplePaySession::didSelectPaymentMethod): Ditto.
2425         (WebCore::ApplePaySession::didCancelPayment): Ditto.
2426         (WebCore::ApplePaySession::paymentCoordinator): Moved dereferencing
2427         inside the downcast.
2428
2429         * Modules/applepay/ApplePaySession.h: Updated for changes above.
2430
2431         * Modules/applepay/ApplePaySession.idl: Use MayThrowException.
2432
2433         * bindings/js/JSApplePaySessionCustom.cpp:
2434         (WebCore::JSApplePaySession::completeShippingMethodSelection):
2435         Use propagateException.
2436         (WebCore::JSApplePaySession::completeShippingContactSelection): Ditto.
2437         (WebCore::JSApplePaySession::completePaymentMethodSelection): Ditto.
2438
2439         * bindings/js/JSDOMBinding.h: Added implementation of toJSBoolean.
2440
2441         * bindings/scripts/CodeGeneratorJS.pm:
2442         (GenerateConstructorDefinition): Generate the different arguments for
2443         toJSNewlyCreated when ConstructorMayThrowException is specified that
2444         activate the version of that function that handles exceptions.
2445
2446         * bindings/scripts/IDLAttributes.txt: Added ConstructorMayThrowException.
2447
2448 2016-10-09  Darin Adler  <darin@apple.com>
2449
2450         Replace all uses of ExceptionCodeWithMessage with WebCore::Exception
2451         https://bugs.webkit.org/show_bug.cgi?id=163178
2452
2453         Reviewed by Sam Weinig.
2454
2455         * Modules/indexeddb/IDBCursor.cpp:
2456         (WebCore::IDBCursor::stringToDirection): Return an Optional instead of
2457         using an ExceptionCode out argument, since this function just needs to
2458         indicate failure, not actually throw an exception.
2459         (WebCore::IDBCursor::update): Return ExceptionOr instead of using an
2460         ExceptionCodeWithMessage out argument.
2461         (WebCore::IDBCursor::advance): Ditto.
2462         (WebCore::IDBCursor::continueFunction): Ditto.
2463         (WebCore::IDBCursor::deleteFunction): Ditto.
2464         * Modules/indexeddb/IDBCursor.h: Updated for above changes.
2465
2466         * Modules/indexeddb/IDBCursor.idl: Sorted extended attributes alphabetically.
2467         Use MayThrowException instead of MayThrowLegacyExceptionWithMessage.
2468
2469         * Modules/indexeddb/IDBDatabase.cpp:
2470         (WebCore::IDBDatabase::createObjectStore): Return ExceptionOr instead of
2471         using an ExceptionCodeWithMessage out argument.
2472         (WebCore::IDBDatabase::transaction): Ditto.
2473         (WebCore::IDBDatabase::deleteObjectStore): Ditto.
2474         * Modules/indexeddb/IDBDatabase.h: Updated for above changes.
2475
2476         * Modules/indexeddb/IDBDatabase.idl: Use MayThrowException instead of
2477         MayThrowLegacyExceptionWithMessage.
2478
2479         * Modules/indexeddb/IDBFactory.cpp:
2480         (WebCore::IDBFactory::open): Return ExceptionOr instead of
2481         using an ExceptionCodeWithMessage out argument.
2482         (WebCore::IDBFactory::openInternal): Ditto.
2483         (WebCore::IDBFactory::deleteDatabase): Ditto.
2484         (WebCore::IDBFactory::cmp): Ditto.
2485         * Modules/indexeddb/IDBFactory.h: Updated for above changes.
2486
2487         * Modules/indexeddb/IDBFactory.idl: Use MayThrowException instead of
2488         MayThrowLegacyExceptionWithMessage.
2489
2490         * Modules/indexeddb/IDBIndex.cpp:
2491         (WebCore::IDBIndex::openCursor): Return ExceptionOr instead of
2492         using an ExceptionCodeWithMessage out argument.
2493         (WebCore::IDBIndex::count): Ditto.
2494         (WebCore::IDBIndex::doCount): Ditto.
2495         (WebCore::IDBIndex::openKeyCursor): Ditto.
2496         (WebCore::IDBIndex::get): Ditto.
2497         (WebCore::IDBIndex::doGet): Ditto.
2498         (WebCore::IDBIndex::getKey): Ditto.
2499         (WebCore::IDBIndex::doGetKey): Ditto.
2500         * Modules/indexeddb/IDBIndex.h: Updated for above changes.
2501
2502         * Modules/indexeddb/IDBIndex.idl: Use MayThrowException instead of
2503         MayThrowLegacyExceptionWithMessage.
2504
2505         * Modules/indexeddb/IDBKeyRange.cpp:
2506         (WebCore::IDBKeyRange::only): Return ExceptionOr instead of
2507         using an ExceptionCode out argument.
2508         (WebCore::IDBKeyRange::lowerBound): Ditto.
2509         (WebCore::IDBKeyRange::upperBound): Ditto.
2510         (WebCore::IDBKeyRange::bound): Ditto.
2511         * Modules/indexeddb/IDBKeyRange.h: Updated for above changes.
2512         * Modules/indexeddb/IDBKeyRange.idl: Use MayThrowException instead of
2513         MayThrowLegacyException.
2514
2515         * Modules/indexeddb/IDBObjectStore.cpp:
2516         (WebCore::IDBObjectStore::openCursor): Return ExceptionOr instead of
2517         using an ExceptionCodeWithMessage out argument.
2518         (WebCore::IDBObjectStore::get): Ditto.
2519         (WebCore::IDBObjectStore::add): Ditto.
2520         (WebCore::IDBObjectStore::put): Ditto.
2521         (WebCore::IDBObjectStore::putForCursorUpdate): Ditto.
2522         (WebCore::IDBObjectStore::putOrAdd): Ditto.
2523         (WebCore::IDBObjectStore::deleteFunction): Ditto.
2524         (WebCore::IDBObjectStore::doDelete): Ditto.
2525         (WebCore::IDBObjectStore::clear): Ditto.
2526         (WebCore::IDBObjectStore::createIndex): Ditto.
2527         (WebCore::IDBObjectStore::index): Ditto.
2528         (WebCore::IDBObjectStore::deleteIndex): Ditto.
2529         (WebCore::IDBObjectStore::count): Ditto.
2530         (WebCore::IDBObjectStore::doCount): Ditto.
2531         * Modules/indexeddb/IDBObjectStore.h: Updated for above changes.
2532
2533         * Modules/indexeddb/IDBObjectStore.idl: Use MayThrowException instead of
2534         MayThrowLegacyExceptionWithMessage.
2535
2536         * Modules/indexeddb/IDBRequest.cpp:
2537         (WebCore::IDBRequest::errorCode): Deleted. Was dead code.
2538         (WebCore::IDBRequest::error): Return ExceptionOr instead of
2539         using an ExceptionCodeWithMessage out argument.
2540         * Modules/indexeddb/IDBRequest.h: Updated for above changes.
2541
2542         * Modules/indexeddb/IDBRequest.idl: Use GetterMayThrowException instead of
2543         GetterMayThrowLegacyExceptionWithMessage.
2544
2545         * Modules/indexeddb/IDBTransaction.cpp:
2546         (WebCore::IDBTransaction::stringToMode): Return an Optional instead of
2547         using an ExceptionCode out argument, since this function just needs to
2548         indicate failure, not actually throw an exception.
2549         (WebCore::IDBTransaction::db): Tweaked code a bit.
2550         (WebCore::IDBTransaction::error): Return a pointer instead of a RefPtr.
2551         (WebCore::IDBTransaction::objectStore): Return ExceptionOr instead of
2552         using an ExceptionCodeWithMessage out argument.
2553         (WebCore::IDBTransaction::abortDueToFailedRequest): Call internalAbort.
2554         (WebCore::IDBTransaction::abort): Return ExceptionOr instead of
2555         using an ExceptionCodeWithMessage out argument.
2556         (WebCore::IDBTransaction::internalAbort): Added a version that asserts
2557         instead of throwing an exception for internal use.
2558         (WebCore::IDBTransaction::stop): Call internalAbort.
2559         * Modules/indexeddb/IDBTransaction.h: Updated for above changes.
2560
2561         * Modules/indexeddb/IDBTransaction.idl: Use MayThrowException instead of
2562         MayThrowLegacyExceptionWithMessage.
2563
2564         * Modules/indexeddb/client/IDBConnectionProxy.cpp:
2565         (WebCore::IDBClient::IDBConnectionProxy::openDatabase): Updated to return
2566         a Ref instead of a RefPtr, since the function can never return null.
2567         (WebCore::IDBClient::IDBConnectionProxy::deleteDatabase): Ditto.
2568         * Modules/indexeddb/client/IDBConnectionProxy.h: Updated for above changes.
2569
2570         * Modules/mediastream/MediaEndpointPeerConnection.cpp:
2571         (WebCore::MediaEndpointPeerConnection::setLocalDescriptionTask): Updated
2572         exception handling to use ExceptionOr instead of ExceptionCodeWithMessage.
2573         (WebCore::MediaEndpointPeerConnection::setRemoteDescriptionTask): Ditto.
2574         * Modules/mediastream/MediaEndpointSessionDescription.cpp:
2575         (WebCore::MediaEndpointSessionDescription::create): Ditto.
2576         * Modules/mediastream/MediaEndpointSessionDescription.h: Updated for above change.
2577
2578         * bindings/js/JSDOMBinding.cpp:
2579         (WebCore::createDOMException): Added overload for Exception.
2580         (WebCore::throwDOMException): Deleted overload for ExceptionCodeWithMessage.
2581         Updated code to call the new createDOMException function.
2582         (WebCore::setDOMExceptionSlow): Ditto.
2583         (WebCore::setDOMException): Ditto.
2584
2585         * bindings/js/JSDOMBinding.h: Added overload of createDOMException that takes
2586         an Exception. Deleted functions dealing with ExceptionCodeWithMessage. Fixed
2587         interface of toJSNumber and toJSNullableNumber and implemented toJSNumber.
2588
2589         * bindings/js/JSDOMPromise.cpp:
2590         (WebCore::DeferredPromise::reject): Added overload that takes an Exception.
2591         * bindings/js/JSDOMPromise.h: Updated for above change.
2592
2593         * bindings/js/JSHistoryCustom.cpp:
2594         (WebCore::JSHistory::pushState): Use propagateException to deal with
2595         ExceptionOr instead of ExceptionCodeWithMessage.
2596         (WebCore::JSHistory::replaceState): Ditto.
2597
2598         * bindings/js/JSIDBDatabaseCustom.cpp:
2599         (WebCore::JSIDBDatabase::createObjectStore): Use toJS and
2600         to deal with ExceptionOr rather than setDOMException to deal
2601         with ExceptionCodeWithMessage.
2602
2603         * bindings/js/JSIDBRequestCustom.cpp:
2604         (WebCore::JSIDBRequest::result): Use propagateException and
2605         Exception rather than setDOMException and ExceptionCodeWithMessage.
2606
2607         * bindings/scripts/CodeGeneratorJS.pm:
2608         (GenerateImplementation): Removed support for GetterMayThrowLegacyExceptionWithMessage,
2609         SetterMayThrowLegacyExceptionWithMessage, and MayThrowLegacyExceptionWithMessage.
2610         (GenerateReturnParameters): Ditto.
2611         (GenerateImplementationFunctionCall): Ditto.
2612         (GenerateConstructorDefinition): Ditto.
2613
2614         * bindings/scripts/IDLAttributes.txt: Removed GetterMayThrowLegacyExceptionWithMessage,
2615         SetterMayThrowLegacyExceptionWithMessage, and MayThrowLegacyExceptionWithMessage.
2616
2617         * bindings/scripts/test/JS/JSTestObj.cpp: Regenerated.
2618         * bindings/scripts/test/TestObj.idl: Removed tests cases for now-removed attributes.
2619
2620         * dom/CustomElementRegistry.idl: Use MayThrowException instead of
2621         MayThrowLegacyExceptionWithMessage.
2622
2623         * dom/ExceptionCode.h: Removed ExceptionCodeWithMessage. Also updated to use pragma
2624         once, removed include of WTFString.h and switched to using instead of typedef.
2625
2626         * history/HistoryItem.h: Return a pointer instead of a RefPtr from stateObject
2627         to cut down a little on unnecessary reference count churn.
2628
2629         * inspector/InspectorIndexedDBAgent.cpp: Updated all the code that uses IDB
2630         classes to use the new versions rather than the old ExceptionCodeWithMessage versions.
2631
2632         * page/DOMWindow.cpp:
2633         (WebCore::DOMWindow::history): Pass a reference instead of a pointer.
2634
2635         * page/History.cpp:
2636         (WebCore::History::History): Take a reference instead of a pointer.
2637         (WebCore::History::length): Tweaked to use a local variable.
2638         (WebCore::History::state): Return a pointer instead of a PassRefPtr.
2639         (WebCore::History::stateInternal): Ditto. Also use early return consistently.
2640         (WebCore::History::isSameAsCurrentState): Updated for above change.
2641         (WebCore::History::stateObjectAdded): Return ExceptionOr rather than taking an
2642         ExceptionCodeWithMessage out argument.
2643
2644         * page/History.h: Use pragma once. Removed some unneeded includes. Marked class final.
2645         Updated for changes above.
2646
2647         * page/History.idl: Use MayThrowException instead of MayThrowLegacyException.
2648
2649 2016-10-07  Ryosuke Niwa  <rniwa@webkit.org>
2650
2651         REGRESSION(r165103): labels list doesn't get invalidated when other lists are invalidated at document level
2652         https://bugs.webkit.org/show_bug.cgi?id=163145
2653
2654         Reviewed by Darin Adler.
2655
2656         The bug was caused by Document::invalidateNodeListAndCollectionCaches removing all node lists regardless
2657         of whether they have been invalidated or not.
2658
2659         Fixed the bug by removing only those node lists that got invalidated via LiveNodeList::invalidateCache.
2660
2661         Test: fast/dom/NodeList/form-labels-length.html
2662
2663         * dom/Document.cpp:
2664         (WebCore::Document::Document):
2665         (WebCore::Document::unregisterNodeListForInvalidation): Removed the conditional which allowed removal to
2666         happen while m_listsInvalidatedAtDocument is empty inside invalidateNodeListAndCollectionCaches.
2667         * dom/Document.h:
2668         * dom/Node.cpp:
2669         (WebCore::Document::invalidateNodeListAndCollectionCaches): Just remove the node lists being invalidated via
2670         LiveNodeList's invalidateCache, which calls unregisterNodeListForInvalidation, instead of removing them all.
2671         We make a copy of the list of node lists into a local vector because mutating HashMap while iterating over it
2672         is not a safe operation.
2673
2674 2016-10-09  Chris Dumez  <cdumez@apple.com>
2675
2676         Update generated bindings code so that dictionary structures no longer need explicit constructors
2677         https://bugs.webkit.org/show_bug.cgi?id=163188
2678
2679         Reviewed by Darin Adler.
2680
2681         Update generated bindings code so that dictionary structures no longer
2682         need explicit constructors. We now call the default constructor and
2683         then initialize the members one by one.
2684
2685         * bindings/scripts/CodeGeneratorJS.pm:
2686         (GenerateDictionaryImplementationContent):
2687         * bindings/scripts/test/JS/JSTestObj.cpp:
2688         (WebCore::convertDictionary<TestObj::Dictionary>):
2689         (WebCore::convertDictionary<TestObj::DictionaryThatShouldNotTolerateNull>):
2690         (WebCore::convertDictionary<TestObj::DictionaryThatShouldTolerateNull>):
2691         (WebCore::convertDictionary<AlternateDictionaryName>):
2692         (WebCore::convertDictionary<TestObj::ParentDictionary>):
2693         (WebCore::convertDictionary<TestObj::ChildDictionary>):
2694         * bindings/scripts/test/JS/JSTestStandaloneDictionary.cpp:
2695         (WebCore::convertDictionary<TestStandaloneDictionary>):
2696         * dom/ClipboardEvent.h:
2697         * dom/CustomEvent.h:
2698         * dom/EventInit.h:
2699         (WebCore::EventInit::EventInit): Deleted.
2700         * dom/EventModifierInit.h:
2701         (WebCore::EventModifierInit::EventModifierInit): Deleted.
2702         * dom/KeyboardEvent.cpp:
2703         (WebCore::KeyboardEvent::KeyboardEvent):
2704         * dom/KeyboardEvent.h:
2705         * dom/KeyboardEvent.idl:
2706         * dom/UIEventInit.h:
2707         (WebCore::UIEventInit::UIEventInit): Deleted.
2708         * editing/Editor.cpp:
2709         (WebCore::Editor::dispatchCPPEvent):
2710
2711 2016-10-09  Fujii Hironori  <Hironori.Fujii@sony.com>
2712
2713         [CMake] CMake does not support the dep files for implicit dependency
2714         https://bugs.webkit.org/show_bug.cgi?id=161433
2715
2716         Reviewed by Brent Fulgham.
2717
2718         Created a Perl script to generate all IDL bindings for CMake.
2719         This script can regenerate outdated bindings by based on the
2720         supplemental dependency and dep files created by
2721         '--write-dependencies' switch of generate-bindings.pl.
2722
2723         add_custom_target is used to invoke the script instead of
2724         add_custom_command because Ninja deletes all output files before
2725         executing the command in case of add_custom_command.
2726
2727         USES_TERMINAL option of add_custom_target has two effects:
2728         1) Not buffering output of the command
2729         2) Invoking the command in the special Ninja pool which inhibits parallel build
2730         One needs to use CMake 3.2 or later to enable this feature.
2731
2732         * CMakeLists.txt: Specified target names for
2733         GENERATE_BINDINGS. Added dependency for the targets.
2734         * bindings/scripts/generate-bindings-all.pl: Added.
2735
2736 2016-10-09  Chris Dumez  <cdumez@apple.com>
2737
2738         Update KeyboardEvent to stop using legacy [ConstructorTemplate=Event]
2739         https://bugs.webkit.org/show_bug.cgi?id=163176
2740
2741         Reviewed by Darin Adler.
2742
2743         Update KeyboardEvent to stop using legacy [ConstructorTemplate=Event]
2744         and use a proper constructor instead, like in the specification:
2745         - https://www.w3.org/TR/uievents/#interface-keyboardevent
2746
2747         Also add support for passing modifierAltGraph / modifierCapsLock
2748         in the inialization dictionary as we support those modifiers via
2749         getModifierState().
2750
2751         No new tests, extended existing test.
2752
2753         * CMakeLists.txt:
2754         * DerivedSources.cpp:
2755         * DerivedSources.make:
2756         * WebCore.xcodeproj/project.pbxproj:
2757         * dom/EventModifierInit.h: Added.
2758         (WebCore::EventModifierInit::EventModifierInit):
2759         * dom/EventModifierInit.idl: Added.
2760         * dom/KeyboardEvent.cpp:
2761         (WebCore::KeyboardEvent::KeyboardEvent):
2762         (WebCore::KeyboardEvent::getModifierState):
2763         * dom/KeyboardEvent.h:
2764         * dom/KeyboardEvent.idl:
2765         * dom/MouseRelatedEvent.cpp:
2766         (WebCore::MouseRelatedEvent::MouseRelatedEvent):
2767         * dom/MouseRelatedEvent.h:
2768         * dom/UIEvent.cpp:
2769         (WebCore::UIEvent::UIEvent):
2770         * dom/UIEvent.h:
2771         (WebCore::UIEvent::create): Deleted.
2772         * dom/UIEventInit.h: Added.
2773         (WebCore::UIEventInit::UIEventInit):
2774         * dom/UIEventInit.idl: Added.
2775         * dom/UIEventWithKeyState.h:
2776         (WebCore::UIEventWithKeyState::altGraphKey):
2777         (WebCore::UIEventWithKeyState::capsLockKey):
2778         (WebCore::UIEventWithKeyState::UIEventWithKeyState):
2779         (WebCore::UIEventWithKeyState::ctrlKey): Deleted.
2780         (WebCore::UIEventWithKeyState::shiftKey): Deleted.
2781         (WebCore::UIEventWithKeyState::altKey): Deleted.
2782         (WebCore::UIEventWithKeyState::metaKey): Deleted.
2783
2784 2016-10-09  Youenn Fablet  <youenn@apple.com>
2785
2786         Promise attribute getters should reject promises in case of casted-this errors
2787         https://bugs.webkit.org/show_bug.cgi?id=163167
2788
2789         Reviewed by Darin Adler.
2790
2791         Covered by updated test and binding test.
2792
2793         * bindings/js/JSDOMBinding.cpp:
2794         (WebCore::throwGetterTypeError):
2795         (WebCore::rejectPromiseWithGetterTypeError): Added to reject promises for attribute getters
2796         * bindings/js/JSDOMBinding.h:
2797         (WebCore::BindingCaller::attribute): Introducing promise rejection for type cast errors.
2798         * bindings/scripts/CodeGeneratorJS.pm:
2799         (GenerateImplementation):
2800         * bindings/scripts/test/JS/JSTestObj.cpp: Rebased test. As can be seen, only custom promise attributes are supported.
2801         (WebCore::jsTestObjTestReadOnlyPromiseAttribute):
2802         (WebCore::jsTestObjTestReadOnlyPromiseAttributeGetter):
2803         * bindings/scripts/test/TestObj.idl:
2804
2805 2016-10-08  Chris Dumez  <cdumez@apple.com>
2806
2807         [Mac] Write WebArchive to the pasteboard when copying image in WebKit
2808         https://bugs.webkit.org/show_bug.cgi?id=163100
2809
2810         Reviewed by Darin Adler.
2811
2812         Write WebArchive to the pasteboard when copying image in WebKit. This
2813         fixes pasting such images to a content editable field in WebKit because
2814         Web archives take priority over RTFD when reading from the pasteboard
2815         in WebKit.
2816
2817         Using RTFD when pasting the image in WebKit was causing issues because:
2818         1. The pasted image would not be displayed because our RTFD import code
2819            is buggy.
2820         2. The pasted image URL was a webkit-fake-url://
2821         3. Formatting associated to the image (e.g. inline style) would be lost
2822
2823         No new tests, unskipped existing test on WebKit2.
2824
2825         * editing/Editor.h:
2826         * editing/mac/EditorMac.mm:
2827         (WebCore::Editor::imageInWebArchiveFormat):
2828         (WebCore::Editor::writeImageToPasteboard):
2829         * platform/Pasteboard.h:
2830         * platform/mac/PasteboardMac.mm:
2831         (WebCore::writableTypesForImage):
2832         (WebCore::Pasteboard::write):
2833         (WebCore::Pasteboard::Pasteboard): Deleted.
2834         (WebCore::Pasteboard::createForCopyAndPaste): Deleted.
2835
2836 2016-10-08  Chris Dumez  <cdumez@apple.com>
2837
2838         Update CustomEvent to stop using legacy [ConstructorTemplate=Event]
2839         https://bugs.webkit.org/show_bug.cgi?id=163174
2840
2841         Reviewed by Darin Adler.
2842
2843         Update CustomEvent to stop using legacy [ConstructorTemplate=Event] and
2844         use an actual constructor instead, like in the specification:
2845         - https://dom.spec.whatwg.org/#interface-customevent
2846
2847         There is a very minor behavior change when explictly passing undefined
2848         as detail value in CustomEventInit. We used to initialize detail to
2849         undefined but we now initialize it to null instead, which is its default
2850         value. The new behavior matches the one of Chrome and Firefox.
2851
2852         * bindings/scripts/CodeGeneratorJS.pm:
2853         (GenerateDefaultValue):
2854         (GenerateDictionaryImplementationContent):
2855         * bindings/scripts/test/JS/JSTestObj.cpp:
2856         (WebCore::convertDictionary<TestObj::Dictionary>):
2857         * bindings/scripts/test/TestObj.idl:
2858         * dom/CustomEvent.cpp:
2859         (WebCore::CustomEvent::CustomEvent):
2860         * dom/CustomEvent.h:
2861         * dom/CustomEvent.idl:
2862         * dom/Document.cpp:
2863         (WebCore::Document::createEvent):
2864         * dom/Event.cpp:
2865         (WebCore::Event::Event):
2866         * dom/Event.h:
2867
2868 2016-10-08  Chris Dumez  <cdumez@apple.com>
2869
2870         Add support for ClipboardEvent
2871         https://bugs.webkit.org/show_bug.cgi?id=163164
2872
2873         Reviewed by Darin Adler.
2874
2875         Add support for ClipboardEvent:
2876         - https://www.w3.org/TR/clipboard-apis/#clipboard-event-interfaces
2877
2878         Firefox and Chrome both already support this.
2879
2880         This gives us 5 more points on html5test.com.
2881
2882         Tests: editing/pasteboard/clipboard-event.html
2883                fast/events/clipboard-event-constructor.html
2884
2885         * CMakeLists.txt:
2886         * DerivedSources.cpp:
2887         * DerivedSources.make:
2888         * WebCore.xcodeproj/project.pbxproj:
2889         * bindings/js/JSEventCustom.cpp:
2890         (WebCore::toJSNewlyCreated): Deleted.
2891
2892         * bindings/scripts/CodeGeneratorJS.pm:
2893         (WillConvertUndefinedToDefaultParameterValue):
2894         We use [] as implicit default value for dictionary parameters. This change
2895         is so we call convertDictionary<>() even if the parameter is undefined
2896         because we want to pass a struct to the implementation initialized with
2897         the default member values defined in the IDL.
2898
2899         * dom/ClipboardEvent.cpp:
2900         (WebCore::ClipboardEvent::ClipboardEvent):
2901         (WebCore::ClipboardEvent::eventInterface):
2902         * dom/ClipboardEvent.h:
2903         * dom/ClipboardEvent.idl: Added.
2904         * dom/Event.cpp:
2905         (WebCore::Event::Event):
2906         * dom/Event.h:
2907         * dom/Event.idl:
2908         * dom/EventInit.h: Added.
2909         * dom/EventInit.idl: Added.
2910         * dom/EventNames.in:
2911         * dom/MouseEvent.h:
2912         (WebCore::MouseEvent::dataTransfer):
2913         * editing/Editor.cpp:
2914         (WebCore::Editor::dispatchCPPEvent):
2915
2916 2016-10-06  Darin Adler  <darin@apple.com>
2917
2918         Next step on moving to modern way to return DOM exceptions
2919         https://bugs.webkit.org/show_bug.cgi?id=163016
2920
2921         Reviewed by Ryosuke Niwa.
2922
2923         * Modules/fetch/FetchRequest.idl:
2924         Added MayThrowException to initializeWith since it throws an exception.
2925
2926         * bindings/js/JSCallbackData.cpp:
2927         (WebCore::JSCallbackData::invokeCallback):
2928         * bindings/js/JSCustomElementInterface.cpp:
2929         (WebCore::JSCustomElementInterface::invokeCallback):
2930         * bindings/js/JSCustomSQLStatementErrorCallback.cpp:
2931         (WebCore::JSSQLStatementErrorCallback::handleEvent):
2932         * bindings/js/JSCustomXPathNSResolver.cpp:
2933         (WebCore::JSCustomXPathNSResolver::lookupNamespaceURI):
2934         * bindings/js/JSDOMBinding.cpp:
2935         (WebCore::reportException):
2936         (WebCore::reportCurrentException):
2937         * bindings/js/JSErrorHandler.cpp:
2938         (WebCore::JSErrorHandler::handleEvent):
2939         * bindings/js/JSEventListener.cpp:
2940         (WebCore::JSEventListener::handleEvent):
2941         * bindings/js/JSMutationCallback.cpp:
2942         (WebCore::JSMutationCallback::call):
2943         * bindings/js/JSNodeFilterCustom.cpp:
2944         (WebCore::JSNodeFilter::acceptNode):
2945         * bindings/js/ScheduledAction.cpp:
2946         (WebCore::ScheduledAction::executeFunctionInContext):
2947         * bindings/js/ScriptController.cpp:
2948         (WebCore::ScriptController::evaluateInWorld):
2949         * bindings/js/WorkerScriptController.cpp:
2950         (WebCore::WorkerScriptController::evaluate):
2951         * inspector/PageScriptDebugServer.cpp:
2952         (WebCore::PageScriptDebugServer::reportException):
2953         Use JSC::Exception explicitly to avoid ambiguity with WebCore::Exception,
2954         or in some cases use auto instead.
2955
2956         * bindings/js/JSDOMBinding.cpp:
2957         (WebCore::hasUnpairedSurrogate): Factored this inline function out of valueToUSVString
2958         for clarity.
2959         (WebCore::createDOMException): Removed unused TRY_TO_CREATE_EXCEPTION macro.
2960         (WebCore::propagateExceptionSlowPath): Added.
2961         (WebCore::propagateException): Added.
2962         (WebCore::setDOMException): Removed overload that takes an exception code and message
2963         string separately; no longer needed.
2964
2965         * bindings/js/JSDOMBinding.h: Include the ExceptionOr header
2966         rather than forward declaring. Added more of the ExceptionOr handling
2967         functions; some just declared and not yet defined. Updated for changes
2968         to ExceptionOr interface. Removed the createDOMException function that takes
2969         only an exception code; not needed outside JSDOMBinding.cpp.
2970
2971         * bindings/js/JSXMLHttpRequestCustom.cpp:
2972         (WebCore::JSXMLHttpRequest::send): Rewrote this to use ExceptionOr instead
2973         of ExceptionCode. Added some FIXMEs as well.
2974         (WebCore::JSXMLHttpRequest::responseText): Ditto.
2975         (WebCore::JSXMLHttpRequest::retrieveResponse): Ditto.
2976
2977         * bindings/scripts/CodeGeneratorJS.pm:
2978         (GenerateImplementation): Fixed if statements to follow WebKit coding style
2979         rather than using extra braces. Added call to propagateException for SetterMayThrowException.
2980         (GenerateSerializerFunction): Fixed if statements as above.
2981         (GenerateParametersCheck): Ditto. Also added call to propagateException for functions with
2982         void return type and MayThrowException.
2983         (GenerateReturnParameters): Tweaked coding style a bit.
2984         (addIterableProperties): Fixed if statements as above.
2985         (NativeToJSValue): Added code to handle various cases of GetterMayThrowException
2986         and MayThrowException.
2987         (GenerateConstructorDefinition): Used encodedJSValue() instead of
2988         JSValue::encode(JSValue()), a longer way to say the same thing.
2989
2990         * bindings/scripts/IDLAttributes.txt: Added GetterMayThrowException,
2991         MayThrowException, and SetterMayThrowException.
2992
2993         * bindings/scripts/test/JS/JSTestActiveDOMObject.cpp:
2994         * bindings/scripts/test/JS/JSTestEventConstructor.cpp:
2995         * bindings/scripts/test/JS/JSTestException.cpp:
2996         * bindings/scripts/test/JS/JSTestGlobalObject.cpp:
2997         * bindings/scripts/test/JS/JSTestInterface.cpp:
2998         * bindings/scripts/test/JS/JSTestJSBuiltinConstructor.cpp:
2999         * bindings/scripts/test/JS/JSTestNamedConstructor.cpp:
3000         * bindings/scripts/test/JS/JSTestNode.cpp:
3001         * bindings/scripts/test/JS/JSTestNondeterministic.cpp:
3002         * bindings/scripts/test/JS/JSTestObj.cpp:
3003         * bindings/scripts/test/JS/JSTestSerializedScriptValueInterface.cpp:
3004         * bindings/scripts/test/JS/JSTestTypedefs.cpp:
3005         * bindings/scripts/test/JS/JSattribute.cpp:
3006         Regenerated results.
3007
3008         * bindings/scripts/test/TestObj.idl: Added some test cases.
3009
3010         * dom/DOMImplementation.cpp:
3011         (WebCore::DOMImplementation::createDocumentType): Tweaked formatting.
3012         (WebCore::DOMImplementation::createDocument): Ditto.
3013
3014         * dom/DOMImplementation.idl: Added MayThrowException to two functions since
3015         I am abandoning, for now, the ability to throw exceptions without any extended
3016         attribute in the IDL file. This feature may return at some point if we figure
3017         out a way to do it for functions without return values as well as functions with.
3018
3019         * dom/Document.cpp:
3020         (WebCore::Document::exitPointerLock): Rewrote to streamline logic.
3021         (WebCore::Document::pointerLockElement): Ditto.
3022         (WebCore::Document::inputCursor): Added. No need for this to be inlined.
3023         (WebCore::Document::setInputCursor): Changed to take Ref&&.
3024         (WebCore::Document::getSelection): Added. Moved here from TreeScope.
3025
3026         * dom/Document.h: Updated for above changes.
3027
3028         * dom/Document.idl: Tweaked formatting.
3029
3030         * dom/Exception.h: Merged the two constructors into one with a default
3031         argument value, which should be equally efficient. Added releaseMessage function.
3032         Added assertion that this is only created for actual exceptions with non-zero
3033         ExceptionCode. Unlike ExceptionCode, which has a value of 0 which means no
3034         exception, we do not create an Exception if there is no exception.
3035
3036         * dom/ExceptionOr.h: Renamed takeReturnValue to releaseReturnValue. Replaced
3037         exceptionCode and exceptionMessage with releaseException. Added ExceptionOr<void>
3038         specialization.
3039
3040         * dom/TreeScope.cpp:
3041         (WebCore::TreeScope::~TreeScope): Removed code dealing with
3042         m_selection, which is now in Document.
3043         (WebCore::TreeScope::getSelection): Deleted.
3044
3045         * dom/TreeScope.h: Removed DOMSelection.
3046
3047         * page/DOMSelection.cpp:
3048         (WebCore::selectionShadowAncestor): Changed to take a reference rather than
3049         a guaranteed-non-null pointer.
3050         (WebCore::DOMSelection::DOMSelection): Changed to take a Frame& instead of
3051         of a TreeScope*.
3052         (WebCore::DOMSelection::clearTreeScope): Deleted.
3053         (WebCore::DOMSelection::isCollapsed): Updated call to selectionShadowAncestor.
3054         (WebCore::DOMSelection::type): Took out obsolete uneeeded comment. Got rid
3055         of case where this returns a null string. Use ASCIILiteral.
3056         (WebCore::DOMSelection::rangeCount): Streamlined code.
3057         (WebCore::DOMSelection::collapse): Removed redundant check of m_frame for
3058         null which is already handled by the isValidForPosition function.
3059         Removed non-helpful FIXME.
3060         (WebCore::DOMSelection::collapseToEnd): Changed to use ExceptionOr instead of
3061         ExceptionCode.
3062         (WebCore::DOMSelection::collapseToStart): Ditto.
3063         (WebCore::DOMSelection::setBaseAndExtent): Removed redundant check of m_frame
3064         for null which is already handled by the isValidForPosition function. Removed
3065         non-helpful FIXME.
3066         (WebCore::DOMSelection::setPosition): Ditto.
3067         (WebCore::DOMSelection::extend): Changed to use ExceptionOr instead of
3068         ExceptionCode.
3069         (WebCore::DOMSelection::getRangeAt): Ditto.
3070         (WebCore::DOMSelection::isValidForPosition): Changed to return false when
3071         m_frame is null rather than asserting is is non-null and having every caller
3072         check m_frame before calling this.
3073
3074         * page/DOMSelection.h: Use #pragma once. Fix indentation. Removed unneeded
3075         comments. Use ExceptionOr rather than ExceptionCode.
3076
3077         * page/DOMSelection.idl: Move from MayThrowLegacyException to MayThrowException.
3078
3079         * page/DOMWindow.cpp:
3080         (WebCore::DOMWindow::resetDOMWindowProperties): Sorted properties alphabetically
3081         to make it more obvious if any are accidentally omitted or listed twice.
3082         (WebCore::DOMWindow::getSelection): Changed ownership so that the window owns
3083         the selection like all the other objects, rather than having it be owned by the
3084         document instead.
3085
3086         * page/DOMWindow.h: Added m_selection, sorted all the other related properties
3087         alphabetically so it's easy to compare the list here with elsewhere.
3088
3089         * replay/ReplayController.cpp:
3090         (WebCore::ReplayController::frameNavigated): Updated to call setInputCursor
3091         with a reference rather than a pointer.
3092
3093         * xml/XMLHttpRequest.cpp:
3094         (WebCore::XMLHttpRequest::responseText): Use ExceptionOr rather than ExceptionCode.
3095         (WebCore::XMLHttpRequest::responseXML): Ditto.
3096         (WebCore::XMLHttpRequest::setTimeout): Ditto.
3097         (WebCore::XMLHttpRequest::setResponseType): Ditto.
3098         (WebCore::XMLHttpRequest::setWithCredentials): Ditto.
3099         (WebCore::XMLHttpRequest::open): Ditto.
3100         (WebCore::XMLHttpRequest::prepareToSend): Changed to return an
3101         Optional<ExceptionOr> to reflect the three different states: an exception,
3102         a value to return without sending, or "continue with the send algorithm".
3103         The old code did this with a boolean plus an exception code. This sounds
3104         confusing but is easy to read at the call sites, so probably OK to keep.
3105         (WebCore::XMLHttpRequest::send): Use ExceptionOr rather than ExceptionCode.
3106         (WebCore::XMLHttpRequest::sendBytesData): Ditto.
3107         (WebCore::XMLHttpRequest::createRequest): Ditto.
3108         (WebCore::XMLHttpRequest::overrideMimeType): Ditto.
3109         (WebCore::XMLHttpRequest::setRequestHeader): Ditto.
3110
3111         * xml/XMLHttpRequest.h: Updated for changes above.
3112
3113         * xml/XMLHttpRequest.idl: Sorted interface extended attributes alphabetically.
3114         Changed from MayThrowLegacyException to MayThrowException.
3115
3116 2016-10-06  Sam Weinig  <sam@webkit.org>
3117
3118         Autogenerate passing union types as part of a functions variadic arguments
3119         https://bugs.webkit.org/show_bug.cgi?id=162919
3120
3121         Reviewed by Darin Adler.
3122
3123         * CMakeLists.txt:
3124         * WebCore.xcodeproj/project.pbxproj:
3125         * bindings/js/JSBindingsAllInOne.cpp:
3126         Remove deleted files.
3127
3128         * bindings/generic/IDLTypes.h:
3129         Switch to use std::reference_wrapper as it's implementation type. We may need more
3130         granularity here in the future, but this will work for now.
3131
3132         * bindings/js/JSCharacterDataCustom.cpp: Removed.
3133         * bindings/js/JSDocumentTypeCustom.cpp: Removed.
3134         * bindings/js/JSNodeOrString.cpp: Removed.
3135         * bindings/js/JSNodeOrString.h: Removed.
3136
3137         * bindings/js/JSDOMBinding.h:
3138         (WebCore::VariadicHelperBase::convert): Deleted.
3139         (WebCore::toArguments): Deleted.
3140         Moved to JSDOMConvert.h and renamed to convertVariadicArguments and make
3141         it work in terms of IDLTypes.
3142
3143         * bindings/js/JSDOMConvert.h:
3144         (WebCore::Converter<IDLInterface<T>>::convert):
3145         (WebCore::VariadicConverterBase::convert):
3146         (WebCore::VariadicConverterBase<IDLInterface<T>>::convert):
3147         (WebCore::convertVariadicArguments):
3148
3149         * bindings/js/JSDocumentCustom.cpp:
3150         (WebCore::JSDocument::prepend): Deleted.
3151         (WebCore::JSDocument::append): Deleted.
3152         * bindings/js/JSDocumentFragmentCustom.cpp:
3153         (WebCore::JSDocumentFragment::prepend): Deleted.
3154         (WebCore::JSDocumentFragment::append): Deleted.
3155         * bindings/js/JSElementCustom.cpp:
3156         (WebCore::JSElement::before): Deleted.
3157         (WebCore::JSElement::after): Deleted.
3158         (WebCore::JSElement::replaceWith): Deleted.
3159         (WebCore::JSElement::prepend): Deleted.
3160         (WebCore::JSElement::append): Deleted.
3161         Remove now generated functions.
3162
3163         * bindings/scripts/CodeGenerator.pm:
3164         (assert):
3165         Add assert to help debugging.
3166
3167         (ParseInterface):
3168         Don't treat union types as interfaces.
3169
3170         (GetFlattenedMemberTypes):
3171         (GetNumberOfNullableMemberTypes):
3172         (GetIDLUnionMemberTypes):
3173         Implement WebIDL algorithms for getting the flattened member list of union, and use it
3174         to construct the c++ IDLType.
3175
3176         (GetBaseIDLType):
3177         (GetIDLType):
3178         Add helper to convert an parsed idlType to a c++ IDLType.
3179
3180         (IsWrapperType):
3181         Don't treat union types as wrappers.
3182         
3183         * bindings/scripts/CodeGeneratorJS.pm:
3184         (AddToImplIncludesForIDLType):
3185         Add helper for adding #includes based on a parsed idlType. It recursively handles union types.
3186
3187         (GenerateParametersCheck):
3188         Use the new convertVariadicArguments function to handle all variadic arguments, including
3189         union types.
3190
3191         * bindings/scripts/IDLParser.pm:
3192         (parseDictionaryMember):
3193         (parseAttributeRest):
3194         (parseOptionalOrRequiredArgument):
3195         (parseExceptionField):
3196         Add an idlType to domSignature and populate it.
3197
3198         * bindings/scripts/test/JS/JSTestObj.cpp:
3199         (WebCore::jsTestObjPrototypeFunctionOverloadedMethod13):
3200         (WebCore::jsTestObjPrototypeFunctionVariadicStringMethod):
3201         (WebCore::jsTestObjPrototypeFunctionVariadicDoubleMethod):
3202         (WebCore::jsTestObjPrototypeFunctionVariadicNodeMethod):
3203         (WebCore::jsTestObjPrototypeFunctionVariadicUnionMethod):
3204         * bindings/scripts/test/JS/JSTestOverloadedConstructors.cpp:
3205         (WebCore::constructJSTestOverloadedConstructors5):
3206         * bindings/scripts/test/TestObj.idl:
3207         Add and update tests.
3208
3209         * dom/ChildNode.idl:
3210         * dom/ParentNode.idl:
3211         Remove Custom extended attribute.
3212
3213         * dom/ContainerNode.cpp:
3214         * dom/ContainerNode.h:
3215         * dom/Node.cpp:
3216         * dom/Node.h:
3217         Switch to using std::reference_wrapper instead of Ref<> for passed in parameters.
3218
3219 2016-10-08  Youenn Fablet  <youenn@apple.com>
3220
3221         [Fetch API] Request constructor should provide exception messages
3222         https://bugs.webkit.org/show_bug.cgi?id=162382
3223
3224         Reviewed by Darin Adler.
3225
3226         No change of behavior, except that exceptions now have error messages.
3227
3228         Added support of exception messages to ExceptionOr.
3229         Making use of ExceptionOr for Request constructor parameter checking.
3230
3231         * Modules/fetch/FetchRequest.cpp:
3232         (WebCore::setReferrerPolicy):
3233         (WebCore::setMode):
3234         (WebCore::setCredentials):
3235         (WebCore::setCache):
3236         (WebCore::setRedirect):
3237         (WebCore::setMethod):
3238         (WebCore::setReferrer):
3239         (WebCore::buildOptions):
3240         (WebCore::FetchRequest::initializeOptions):
3241         (WebCore::FetchRequest::initializeWith):
3242         * Modules/fetch/FetchRequest.h:
3243         * Modules/fetch/FetchRequest.idl:
3244         * bindings/js/JSDOMBinding.cpp:
3245         (WebCore::setDOMException):
3246         * bindings/js/JSDOMBinding.h:
3247         (WebCore::toJS):
3248         (WebCore::toJSNewlyCreated):
3249         * dom/Exception.h:
3250         (WebCore::Exception::code):
3251         (WebCore::Exception::message):
3252         (WebCore::Exception::Exception):
3253         * dom/ExceptionOr.h:
3254         (WebCore::ExceptionOr<ReturnType>::exceptionMessage):
3255
3256 2016-10-08  Youenn Fablet  <youenn@apple.com>
3257
3258         Refactor binding generated casted-this checks
3259         https://bugs.webkit.org/show_bug.cgi?id=162677
3260
3261         Reviewed by Darin Adler.
3262
3263         No change of behavior.
3264
3265         Split the attribute getter function in two, one with the signature expected by JSCore and one used after casted-this checks.
3266
3267         The second function takes directly a JSXX object and returns a JSValue instead of an EncodedJSValue.
3268         In the future, the second function should only take references.
3269
3270         Introducing BindingCaller as a way to templatize binding code used to cast thisValue with the desired JSXX value.
3271         This allows implementing the first function using the second function as template parameter.
3272
3273         Introducing JSClass::castForAttribute as a way to encapsulate differences in the way to handle thisValue access.
3274
3275         * bindings/js/JSDOMBinding.h:
3276         (WebCore::BindingCaller::attribute):
3277         * bindings/scripts/CodeGeneratorJS.pm:
3278         (GenerateHeader):
3279         (GenerateImplementation):
3280         * bindings/scripts/test/JS/JSTestActiveDOMObject.cpp:
3281         * bindings/scripts/test/JS/JSTestActiveDOMObject.h:
3282         * bindings/scripts/test/JS/JSTestEventConstructor.cpp:
3283         * bindings/scripts/test/JS/JSTestEventConstructor.h:
3284         * bindings/scripts/test/JS/JSTestException.cpp:
3285         * bindings/scripts/test/JS/JSTestException.h:
3286         * bindings/scripts/test/JS/JSTestGlobalObject.cpp:
3287         * bindings/scripts/test/JS/JSTestInterface.cpp:
3288         * bindings/scripts/test/JS/JSTestInterface.h:
3289         * bindings/scripts/test/JS/JSTestJSBuiltinConstructor.cpp:
3290         * bindings/scripts/test/JS/JSTestJSBuiltinConstructor.h:
3291         * bindings/scripts/test/JS/JSTestNode.cpp:
3292         * bindings/scripts/test/JS/JSTestNode.h:
3293         * bindings/scripts/test/JS/JSTestNondeterministic.cpp:
3294         * bindings/scripts/test/JS/JSTestNondeterministic.h:
3295         * bindings/scripts/test/JS/JSTestObj.cpp:
3296         * bindings/scripts/test/JS/JSTestObj.h:
3297         * bindings/scripts/test/JS/JSTestSerializedScriptValueInterface.cpp:
3298         * bindings/scripts/test/JS/JSTestSerializedScriptValueInterface.h:
3299         * bindings/scripts/test/JS/JSTestTypedefs.cpp:
3300         * bindings/scripts/test/JS/JSTestTypedefs.h:
3301         * bindings/scripts/test/JS/JSattribute.cpp:
3302         * bindings/scripts/test/JS/JSattribute.h:
3303
3304 2016-10-08  Enrique Ocaña González  <eocanha@igalia.com>
3305
3306         Missing include in MediaDescription
3307         https://bugs.webkit.org/show_bug.cgi?id=162873
3308
3309         Reviewed by Xabier Rodriguez-Calvar.
3310
3311         Added missing header.
3312
3313         * platform/MediaDescription.h:
3314
3315 2016-10-08  Antti Koivisto  <antti@apple.com>
3316
3317         Move StyleResolver ownership from Document/ShadowRoot to Style::Scope
3318         https://bugs.webkit.org/show_bug.cgi?id=163148
3319
3320         Reviewed by Andreas Kling.
3321
3322         Reduce duplication between Document and ShadowRoot.
3323
3324         * css/CSSComputedStyleDeclaration.cpp:
3325         (WebCore::ComputedStyleExtractor::propertyValue):
3326         * css/CSSStyleSheet.cpp:
3327         (WebCore::CSSStyleSheet::didMutateRules):
3328         * css/ElementRuleCollector.cpp:
3329         (WebCore::ElementRuleCollector::matchHostPseudoClassRules):
3330         (WebCore::ElementRuleCollector::matchSlottedPseudoElementRules):
3331         * css/MediaQueryMatcher.cpp:
3332         (WebCore::MediaQueryMatcher::documentElementUserAgentStyle):
3333         * css/StyleMedia.cpp:
3334         (WebCore::StyleMedia::matchMedium):
3335         * css/parser/SizesAttributeParser.cpp:
3336         (WebCore::SizesAttributeParser::mediaConditionMatches):
3337         * dom/Document.cpp:
3338         (WebCore::Document::~Document):
3339         (WebCore::Document::childrenChanged):
3340         (WebCore::Document::isPageBoxVisible):
3341         (WebCore::Document::pageSizeAndMarginsInPixels):
3342         (WebCore::Document::userAgentShadowTreeStyleResolver):
3343         (WebCore::Document::fontsNeedUpdate):
3344         (WebCore::Document::didClearStyleResolver):
3345         (WebCore::Document::updateViewportUnitsOnResize):
3346         (WebCore::Document::createStyleResolver): Deleted.
3347         (WebCore::Document::clearStyleResolver): Deleted.
3348         * dom/Document.h:
3349         (WebCore::Document::styleResolverIfExists): Deleted.
3350         (WebCore::Document::ensureStyleResolver): Deleted.
3351         * dom/Element.cpp:
3352         (WebCore::Element::styleResolver):
3353         * dom/ShadowRoot.cpp:
3354         (WebCore::ShadowRoot::styleResolver): Deleted.
3355         (WebCore::ShadowRoot::styleResolverIfExists): Deleted.
3356         (WebCore::ShadowRoot::resetStyleResolver): Deleted.
3357         * dom/ShadowRoot.h:
3358         * page/DOMWindow.cpp:
3359         (WebCore::DOMWindow::getMatchedCSSRules):
3360         * page/FrameView.cpp:
3361         (WebCore::FrameView::layout):
3362         * page/Page.cpp:
3363         (WebCore::Page::updateStyleForAllPagesAfterGlobalChangeInEnvironment):
3364         * page/PrintContext.cpp:
3365         (WebCore::PrintContext::pageProperty):
3366         * platform/MemoryPressureHandler.cpp:
3367         (WebCore::MemoryPressureHandler::releaseCriticalMemory):
3368         * style/AttributeChangeInvalidation.cpp:
3369         (WebCore::Style::mayBeAffectedByHostStyle):
3370         * style/ClassChangeInvalidation.cpp:
3371         (WebCore::Style::mayBeAffectedByHostStyle):
3372         * style/IdChangeInvalidation.cpp:
3373         (WebCore::Style::mayBeAffectedByHostStyle):
3374         * style/StyleScope.cpp:
3375         (WebCore::Style::Scope::resolver):
3376         (WebCore::Style::Scope::resolverIfExists):
3377         (WebCore::Style::Scope::clearResolver):
3378         (WebCore::Style::Scope::analyzeStyleSheetChange):
3379         (WebCore::Style::Scope::updateActiveStyleSheets):
3380         (WebCore::Style::Scope::updateStyleResolver):
3381         (WebCore::Style::Scope::styleResolver): Deleted.
3382         (WebCore::Style::Scope::styleResolverIfExists): Deleted.
3383         * style/StyleScope.h:
3384         * style/StyleSharingResolver.cpp:
3385         (WebCore::Style::SharingResolver::resolve):
3386         (WebCore::Style::SharingResolver::canShareStyleWithElement):
3387         * style/StyleTreeResolver.cpp:
3388         (WebCore::Style::TreeResolver::Scope::Scope):
3389         (WebCore::Style::TreeResolver::resolve):
3390
3391 2016-10-07  Chris Dumez  <cdumez@apple.com>
3392
3393         window.navigator.language incorrectly returns all lowercase string
3394         https://bugs.webkit.org/show_bug.cgi?id=163096
3395
3396         Reviewed by Darin Adler.