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