Unreviewed, rolling out r207783.
[WebKit-https.git] / Source / WebCore / ChangeLog
1 2016-10-24  Ryan Haddad  <ryanhaddad@apple.com>
2
3         Unreviewed, rolling out r207783.
4
5         This change appears to have caused fast/selectors/invalid-
6         functional-pseudo-class.html to crash on iOS and macOS
7
8         Reverted changeset:
9
10         "[CSS Parser] Fix :lang argument parsing"
11         https://bugs.webkit.org/show_bug.cgi?id=163913
12         http://trac.webkit.org/changeset/207783
13
14 2016-10-24  Brady Eidson  <beidson@apple.com>
15
16         IndexedDB 2.0: Support new IDBKeyRange interfaces.
17         <rdar://problem/28806929> and https://bugs.webkit.org/show_bug.cgi?id=163910
18
19         Reviewed by Andy Estes.
20
21         No new tests (Covered by additions to existing test)
22
23         The "new IDBKeyRanges interfaces" really just means adding the instance method IDBKeyRange.contains.
24
25         * Modules/indexeddb/IDBKeyRange.cpp:
26         (WebCore::IDBKeyRange::contains):
27         * Modules/indexeddb/IDBKeyRange.h:
28         * Modules/indexeddb/IDBKeyRange.idl:
29
30 2016-10-23  Yusuke Suzuki  <utatane.tea@gmail.com>
31
32         [DOMJIT] Add a way for DOMJIT::Patchpoint to express effects
33         https://bugs.webkit.org/show_bug.cgi?id=163657
34
35         Reviewed by Saam Barati.
36
37         CallDOMPatchpoint now has the way to tell its effects to DFG and FTL compilers.
38         WebCore DOMJIT::AbstractHeapRepository will construct the hierarchy of the abstract
39         heap. And then it encodes these information into the pairs of the integers.
40
41         And this patch also changes the DOMJIT::PatchpointParams' parameter order.
42         So we change them in all the DOMJIT::CallDOMPatchpoint sites.
43
44         * CMakeLists.txt:
45         * ForwardingHeaders/domjit/DOMJITAbstractHeap.h: Copied from Source/JavaScriptCore/domjit/DOMJITCallDOMPatchpoint.h.
46         * ForwardingHeaders/domjit/DOMJITEffect.h: Copied from Source/JavaScriptCore/domjit/DOMJITCallDOMPatchpoint.h.
47         * ForwardingHeaders/domjit/DOMJITHeapRange.h: Copied from Source/JavaScriptCore/domjit/DOMJITCallDOMPatchpoint.h.
48         * WebCore.xcodeproj/project.pbxproj:
49         * domjit/DOMJITAbstractHeapRepository.cpp: Copied from Source/JavaScriptCore/domjit/DOMJITCallDOMPatchpoint.h.
50         (WebCore::DOMJIT::AbstractHeapRepository::AbstractHeapRepository):
51         (WebCore::DOMJIT::AbstractHeapRepository::instance):
52         * domjit/DOMJITAbstractHeapRepository.h: Copied from Source/JavaScriptCore/domjit/DOMJITCallDOMPatchpoint.h.
53         * domjit/DOMJITHelpers.h:
54         (WebCore::DOMJITHelpers::branchIfNotWorldIsNormal): Deleted.
55         (WebCore::DOMJITHelpers::branchIfNotWeakIsLive): Deleted.
56         (WebCore::DOMJITHelpers::tryLookUpWrapperCache): Deleted.
57         (WebCore::DOMJITHelpers::toWrapper): Deleted.
58         (WebCore::DOMJITHelpers::branchIfDOMWrapper): Deleted.
59         (WebCore::DOMJITHelpers::branchIfNotDOMWrapper): Deleted.
60         (WebCore::DOMJITHelpers::branchIfNode): Deleted.
61         (WebCore::DOMJITHelpers::branchIfNotNode): Deleted.
62         (WebCore::DOMJITHelpers::branchIfElement): Deleted.
63         (WebCore::DOMJITHelpers::branchIfNotElement): Deleted.
64         (WebCore::DOMJITHelpers::branchIfDocumentWrapper): Deleted.
65         (WebCore::DOMJITHelpers::branchIfNotDocumentWrapper): Deleted.
66         * domjit/JSNodeDOMJIT.cpp:
67         (WebCore::createCallDOMForOffsetAccess):
68         (WebCore::checkNode):
69         (WebCore::NodeFirstChildDOMJIT::checkDOM):
70         (WebCore::NodeFirstChildDOMJIT::callDOM):
71         (WebCore::NodeLastChildDOMJIT::checkDOM):
72         (WebCore::NodeLastChildDOMJIT::callDOM):
73         (WebCore::NodeNextSiblingDOMJIT::checkDOM):
74         (WebCore::NodeNextSiblingDOMJIT::callDOM):
75         (WebCore::NodePreviousSiblingDOMJIT::checkDOM):
76         (WebCore::NodePreviousSiblingDOMJIT::callDOM):
77         (WebCore::NodeParentNodeDOMJIT::checkDOM):
78         (WebCore::NodeParentNodeDOMJIT::callDOM):
79         (WebCore::NodeNodeTypeDOMJIT::checkDOM):
80         (WebCore::NodeNodeTypeDOMJIT::callDOM):
81
82 2016-10-24  Dave Hyatt  <hyatt@apple.com>
83
84         [CSS Parser] Fix :lang argument parsing
85         https://bugs.webkit.org/show_bug.cgi?id=163913
86
87         Reviewed by Zalan Bujtas.
88
89         * css/SelectorPseudoClassAndCompatibilityElementMap.in:
90         Modify the map to support versions of the function pseudos
91         without the left paren included.
92
93         * css/parser/CSSParserValues.cpp:
94         (WebCore::CSSParserSelector::setLangArgumentList):
95         * css/parser/CSSParserValues.h:
96         Add a helper to just directly pass an AtomicString Vector through.
97
98         * css/parser/CSSSelectorParser.cpp:
99         (WebCore::consumeLangArgumentList):
100         (WebCore::CSSSelectorParser::consumePseudo):
101         Add a new consumeLangArgumentList to collect the languages into
102         an AtomicString Vector.
103
104 2016-10-24  Alex Christensen  <achristensen@webkit.org>
105
106         Fix AppleWin build after r207720.
107
108         * html/canvas/OESVertexArrayObject.cpp:
109
110 2016-10-24  Alex Christensen  <achristensen@webkit.org>
111
112         Fix AppleWin build after r207720.
113
114         * bindings/js/JSWebGLRenderingContextBaseCustom.cpp:
115
116 2016-10-24  Alex Christensen  <achristensen@webkit.org>
117
118         Fix Windows build after r207767 and r207769
119
120         * css/CSSAllInOne.cpp:
121         * platform/network/curl/ResourceHandleManager.cpp:
122         (WebCore::getProtectionSpace):
123
124 2016-10-24  Per Arne Vollan  <pvollan@apple.com>
125
126         [Win] AVCF based media engine does not block cross-site/cross-domain loads.
127         https://bugs.webkit.org/show_bug.cgi?id=163783
128
129         Reviewed by Brent Fulgham.
130
131         Prevent cross-site/cross-domain loads by setting appropriate AVCF options.
132
133         No new tests; covered by media/video-canvas-source.html. Media tests are
134         currently skipped on Windows.
135
136         * platform/graphics/avfoundation/cf/AVFoundationCFSoftLinking.h:
137         * platform/graphics/avfoundation/cf/MediaPlayerPrivateAVFoundationCF.cpp:
138         (WebCore::MediaPlayerPrivateAVFoundationCF::resolvedURL):
139         (WebCore::MediaPlayerPrivateAVFoundationCF::hasSingleSecurityOrigin):
140         (WebCore::AVFWrapper::createAssetForURL):
141         * platform/graphics/avfoundation/cf/MediaPlayerPrivateAVFoundationCF.h:
142
143 2016-10-24  Anders Carlsson  <andersca@apple.com>
144
145         Fix build with newer versions of clang
146         https://bugs.webkit.org/show_bug.cgi?id=163908
147         rdar://problem/28852016
148
149         Reviewed by Tim Horton.
150
151         Use the macros that names the soft-linked functions in such a way that they won't conflict with actual functions.
152
153         * platform/ios/PlatformScreenIOS.mm:
154         (WebCore::screenIsMonochrome):
155         (WebCore::screenHasInvertedColors):
156         (WebCore::screenSize):
157         (WebCore::availableScreenSize):
158         (WebCore::screenScaleFactor):
159
160 2016-10-24  Joseph Pecoraro  <pecoraro@apple.com>
161
162         Remove unnecessary unused variable stubs
163         https://bugs.webkit.org/show_bug.cgi?id=163688
164
165         Reviewed by Simon Fraser.
166
167         * Modules/applepay/cocoa/PaymentCocoa.mm:
168         (WebCore::toDictionary):
169         * Modules/applepay/cocoa/PaymentContactCocoa.mm:
170         (WebCore::toDictionary):
171
172 2016-10-24  Alex Christensen  <achristensen@webkit.org>
173
174         Try to fix Windows build after r207767
175         https://bugs.webkit.org/show_bug.cgi?id=163891
176
177         * DerivedSources.cpp:
178
179 2016-10-24  Zan Dobersek  <zdobersek@igalia.com>
180
181         [CodeGenerator] Only allow a single interface or standalone dictionary per WebIDL file
182         https://bugs.webkit.org/show_bug.cgi?id=163889
183
184         Reviewed by Chris Dumez.
185
186         Assert that there's only one interface or standalone dictionary
187         per WebIDL input file, and exit from the generator otherwise.
188
189         This avoids potential linking issues where multiple enumeration
190         and dictionary bindings code can be generated if the source
191         WebIDL for them is specified in a file that contains multiple
192         interfaces or standalone dictionaries.
193
194         Additionally, the generator now also exits if it fails to
195         generate code for any interface of standalone dictionary. This
196         should avoid processing WebIDL files that are empty in
197         substance.
198
199         TestException.idl and TestInterface.idl files have their second
200         interfaces removed. In place of those a new testing IDL file is
201         added, TestInterfaceLeadingUnderscore.idl. Like the two removed
202         interfaces, it tests that the leading underscode in the
203         identifier is removed by the generator.
204
205         * bindings/scripts/CodeGenerator.pm:
206         (ProcessDocument):
207         * bindings/scripts/test/JS/JSTestInterfaceLeadingUnderscore.cpp: Added.
208         (WebCore::JSTestInterfaceLeadingUnderscorePrototype::create):
209         (WebCore::JSTestInterfaceLeadingUnderscorePrototype::createStructure):
210         (WebCore::JSTestInterfaceLeadingUnderscorePrototype::JSTestInterfaceLeadingUnderscorePrototype):
211         (WebCore::JSTestInterfaceLeadingUnderscoreConstructor::prototypeForStructure):
212         (WebCore::JSTestInterfaceLeadingUnderscoreConstructor::initializeProperties):
213         (WebCore::JSTestInterfaceLeadingUnderscorePrototype::finishCreation):
214         (WebCore::JSTestInterfaceLeadingUnderscore::JSTestInterfaceLeadingUnderscore):
215         (WebCore::JSTestInterfaceLeadingUnderscore::createPrototype):
216         (WebCore::JSTestInterfaceLeadingUnderscore::prototype):
217         (WebCore::JSTestInterfaceLeadingUnderscore::destroy):
218         (WebCore::BindingCaller<JSTestInterfaceLeadingUnderscore>::castForAttribute):
219         (WebCore::jsTestInterfaceLeadingUnderscoreReadonly):
220         (WebCore::jsTestInterfaceLeadingUnderscoreReadonlyGetter):
221         (WebCore::jsTestInterfaceLeadingUnderscoreConstructor):
222         (WebCore::setJSTestInterfaceLeadingUnderscoreConstructor):
223         (WebCore::JSTestInterfaceLeadingUnderscore::getConstructor):
224         (WebCore::JSTestInterfaceLeadingUnderscoreOwner::isReachableFromOpaqueRoots):
225         (WebCore::JSTestInterfaceLeadingUnderscoreOwner::finalize):
226         (WebCore::toJSNewlyCreated):
227         (WebCore::toJS):
228         (WebCore::JSTestInterfaceLeadingUnderscore::toWrapped):
229         * bindings/scripts/test/JS/JSTestInterfaceLeadingUnderscore.h: Renamed from Source/WebCore/bindings/scripts/test/JS/JSreadonly.h.
230         (WebCore::JSTestInterfaceLeadingUnderscore::create):
231         (WebCore::JSTestInterfaceLeadingUnderscore::createStructure):
232         (WebCore::JSTestInterfaceLeadingUnderscore::finishCreation):
233         (WebCore::wrapperOwner):
234         (WebCore::wrapperKey):
235         (WebCore::toJS):
236         (WebCore::toJSNewlyCreated):
237         * bindings/scripts/test/JS/JSattribute.cpp: Removed.
238         * bindings/scripts/test/JS/JSattribute.h: Removed.
239         * bindings/scripts/test/JS/JSreadonly.cpp: Removed.
240         * bindings/scripts/test/TestException.idl:
241         * bindings/scripts/test/TestInterface.idl:
242         * bindings/scripts/test/TestInterfaceLeadingUnderscore.idl: Copied from Source/WebCore/bindings/scripts/test/TestException.idl.
243
244 2016-10-21  Alex Christensen  <achristensen@webkit.org>
245
246         URL::port should return Optional<uint16_t>
247         https://bugs.webkit.org/show_bug.cgi?id=163806
248
249         Reviewed by Darin Adler.
250
251         A URL without a port is different than a URL with port 0.
252         This matches the spec, Chrome, and Firefox.
253
254         Covered by newly-passing web platform tests.
255
256         * Modules/indexeddb/IDBDatabaseIdentifier.h:
257         (WebCore::IDBDatabaseIdentifier::IDBDatabaseIdentifier):
258         (WebCore::IDBDatabaseIdentifier::isHashTableDeletedValue):
259         (WebCore::IDBDatabaseIdentifier::hash):
260         (WebCore::IDBDatabaseIdentifier::isValid):
261         (WebCore::IDBDatabaseIdentifier::isEmpty):
262         * Modules/websockets/WebSocket.cpp:
263         (WebCore::WebSocket::connect):
264         * Modules/websockets/WebSocketHandshake.cpp:
265         (WebCore::hostName):
266         * contentextensions/ContentExtensionsBackend.cpp:
267         (WebCore::ContentExtensions::ContentExtensionsBackend::processContentExtensionRulesForLoad):
268         (WebCore::ContentExtensions::applyBlockedStatusToRequest):
269         * html/HTMLPlugInImageElement.cpp:
270         (WebCore::HTMLPlugInImageElement::userDidClickSnapshot):
271         (WebCore::HTMLPlugInImageElement::subframeLoaderWillCreatePlugIn):
272         * html/URLUtils.h:
273         (WebCore::URLUtils<T>::protocol):
274         (WebCore::URLUtils<T>::host):
275         (WebCore::URLUtils<T>::port):
276         * loader/CrossOriginAccessControl.cpp:
277         (WebCore::isValidCrossOriginRedirectionURL):
278         * loader/DocumentLoader.cpp:
279         (WebCore::DocumentLoader::responseReceived):
280         (WebCore::isRemoteWebArchive):
281         (WebCore::DocumentLoader::maybeLoadEmpty):
282         * loader/DocumentThreadableLoader.cpp:
283         (WebCore::DocumentThreadableLoader::makeSimpleCrossOriginAccessRequest):
284         * loader/ResourceLoader.cpp:
285         (WebCore::ResourceLoader::didReceiveResponse):
286         * loader/cache/CachedResource.cpp:
287         (WebCore::shouldCacheSchemeIndefinitely):
288         (WebCore::CachedResource::freshnessLifetime):
289         * page/Location.cpp:
290         (WebCore::Location::protocol):
291         (WebCore::Location::host):
292         (WebCore::Location::port):
293         * page/Page.cpp:
294         (WebCore::Page::userStyleSheetLocationChanged):
295         * page/SecurityOrigin.cpp:
296         (WebCore::shouldTreatAsUniqueOrigin):
297         (WebCore::SecurityOrigin::SecurityOrigin):
298         (WebCore::SecurityOrigin::isSecure):
299         (WebCore::SecurityOrigin::canDisplay):
300         (WebCore::SecurityOrigin::toRawString):
301         (WebCore::SecurityOrigin::create):
302         (WebCore::SecurityOrigin::databaseIdentifier):
303         * page/SecurityOrigin.h:
304         (WebCore::SecurityOrigin::port):
305         * page/SecurityOriginData.cpp:
306         (WebCore::SecurityOriginData::debugString):
307         * page/SecurityOriginData.h:
308         (): Deleted.
309         * page/SecurityOriginHash.h:
310         (WebCore::SecurityOriginHash::hash):
311         * page/csp/ContentSecurityPolicy.cpp:
312         (WebCore::ContentSecurityPolicy::allowObjectFromSource):
313         (WebCore::ContentSecurityPolicy::allowChildFrameFromSource):
314         (WebCore::ContentSecurityPolicy::allowResourceFromSource):
315         (WebCore::ContentSecurityPolicy::allowConnectToSource):
316         (WebCore::ContentSecurityPolicy::allowBaseURI):
317         (WebCore::stripURLForUseInReport):
318         (WebCore::ContentSecurityPolicy::upgradeInsecureRequestIfNeeded):
319         * page/csp/ContentSecurityPolicySource.cpp:
320         (WebCore::ContentSecurityPolicySource::ContentSecurityPolicySource):
321         (WebCore::ContentSecurityPolicySource::portMatches):
322         * page/csp/ContentSecurityPolicySource.h:
323         * page/csp/ContentSecurityPolicySourceList.cpp:
324         (WebCore::ContentSecurityPolicySourceList::parse):
325         (WebCore::ContentSecurityPolicySourceList::parseSource):
326         (WebCore::ContentSecurityPolicySourceList::parsePort):
327         * page/csp/ContentSecurityPolicySourceList.h:
328         * platform/SchemeRegistry.h:
329         * platform/URL.cpp:
330         (WebCore::URL::protocol):
331         (WebCore::URL::port):
332         (WebCore::URL::serialize):
333         (WebCore::portAllowed):
334         (WebCore::defaultPortsMap): Deleted.
335         (WebCore::defaultPortForProtocol): Deleted.
336         (WebCore::isDefaultPortForProtocol): Deleted.
337         * platform/URL.h:
338         (WebCore::URL::hasPort): Deleted.
339         * platform/URLParser.cpp:
340         (WebCore::defaultPortForProtocol):
341         (WebCore::isDefaultPortForProtocol):
342         (WebCore::URLParser::parsePort):
343         (WebCore::isDefaultPort): Deleted.
344         * platform/network/CredentialStorage.cpp:
345         (WebCore::originStringFromURL):
346         * platform/network/ResourceHandle.cpp:
347         (WebCore::ResourceHandle::create):
348         (WebCore::ResourceHandle::loadResourceSynchronously):
349         * platform/network/cf/SocketStreamHandleImplCFNet.cpp:
350         (WebCore::SocketStreamHandleImpl::platformClose):
351         (WebCore::SocketStreamHandleImpl::port):
352         * workers/WorkerLocation.cpp:
353         (WebCore::WorkerLocation::protocol):
354         (WebCore::WorkerLocation::host):
355         (WebCore::WorkerLocation::port):
356
357 2016-10-24  Zan Dobersek  <zdobersek@igalia.com>
358
359         [CodeGeneratorJS] Support enums for standalone dictionaries
360         https://bugs.webkit.org/show_bug.cgi?id=163885
361
362         Reviewed by Youenn Fablet.
363
364         Add support for enumerations in WebIDL files that specify
365         standalone dictionaries. Implementation of this is pretty
366         straight-forward and mirrors interface and callback generators
367         by calling GenerateEnumerations{Header,Implementation}Content()
368         functions in GenerateDictionary{Header,Implementation}().
369
370         In GenerateEnumerationsImplementationContent(), the
371         NeverDestroyed.h header is added to the implementation includes
372         since that class is used to hold an array of possible enum
373         values.
374
375         A test enum is added to the TestStandaloneDictionary.idl file
376         and the baselines are updated to reflect the new capability.
377
378         * bindings/scripts/CodeGenerator.pm:
379         (ProcessDocument):
380         * bindings/scripts/CodeGeneratorJS.pm:
381         (GenerateDictionary):
382         (GenerateEnumerationsImplementationContent):
383         (GenerateDictionaryHeader):
384         (GenerateDictionaryImplementation):
385         * bindings/scripts/test/JS/JSTestStandaloneDictionary.cpp:
386         (WebCore::convertEnumerationToJS):
387         (WebCore::parseEnumeration<TestStandaloneDictionary::EnumInStandaloneDictionaryFile>):
388         (WebCore::convertEnumeration<TestStandaloneDictionary::EnumInStandaloneDictionaryFile>):
389         (WebCore::expectedEnumerationValues<TestStandaloneDictionary::EnumInStandaloneDictionaryFile>):
390         (WebCore::convertDictionary<DictionaryImplName>):
391         * bindings/scripts/test/JS/JSTestStandaloneDictionary.h:
392         * bindings/scripts/test/TestStandaloneDictionary.idl:
393
394 2016-10-24  Dave Hyatt  <hyatt@apple.com>
395
396         Remove CSSCharsetRule from the CSS OM
397         https://bugs.webkit.org/show_bug.cgi?id=163891
398
399         Reviewed by Darin Adler.
400
401         Remove CSSCharsetRule from the CSS OM. All other browser engines have made this
402         change. This eliminates the weird overloading of isCharsetRule to match both
403         CSSCharsetRule and StyleRuleCharset (only used by the new parser).
404
405         Fix the destroy() method in StyleRuleBase to clean up StyleRuleCharsets created
406         by the new parser properly.
407
408         * CMakeLists.txt:
409         * DerivedSources.make:
410         * WebCore.xcodeproj/project.pbxproj:
411         * bindings/js/JSCSSRuleCustom.cpp:
412         (WebCore::toJSNewlyCreated):
413         * css/CSSCharsetRule.cpp: Removed.
414         * css/CSSCharsetRule.h: Removed.
415         * css/CSSCharsetRule.idl: Removed.
416         * css/CSSPropertySourceData.h:
417         * css/CSSStyleSheet.cpp:
418         (WebCore::CSSStyleSheet::item):
419         (WebCore::CSSStyleSheet::rules):
420         * css/CSSStyleSheet.h:
421         * css/StyleRule.cpp:
422         (WebCore::StyleRuleBase::destroy):
423         * inspector/InspectorStyleSheet.cpp:
424         (WebCore::asCSSRuleList):
425
426 2016-10-24  Zan Dobersek  <zdobersek@igalia.com>
427
428         [CodeGeneratorJS] Standalone dictionaries have misplaced build guards
429         https://bugs.webkit.org/show_bug.cgi?id=163881
430
431         Reviewed by Chris Dumez.
432
433         Build guards that are generated from the Conditional attribute
434         on WebIDL dictionary declarations properly guard the relevant
435         convertDictionary() functions for WebIDL files that also specify
436         interfaces. But for standalone dictionaries these build guards
437         should guard the complete header and implementation files, much
438         like this is done for files that originate from interfaces or
439         callbacks.
440
441         Before this patch, guarding a standalone dictionary resulted in
442         malformed output because GenerateHeaderContentHeader() and
443         GenerateImplementationContentHeader() functions both generated
444         the #if macro that would guard the whole file, but
445         GenerateDictionary{Header,Implementation}() didn't generate the
446         closing #endif.
447
448         CodeGeneratorJS.pm now passes the conditional string, if any,
449         to GenerateDictionary{Header,Implementation}Content() functions
450         in case of a non-standalone dictionary. Otherwise, the
451         conditional string, if any, is used to guard the complete
452         header and implementation files.
453
454         Generator tests are updated to cover various build guard
455         combinations on dictionaries in TestObj.idl, and the standalone
456         dictionary WebIDL file now has a Conditional attribute to check
457         that the build guards cover complete generated header and
458         implementation files.
459
460         * bindings/scripts/CodeGeneratorJS.pm:
461         (GenerateDictionaryHeaderContent):
462         (GenerateDictionariesHeaderContent):
463         (GenerateDictionaryImplementationContent):
464         (GenerateDictionariesImplementationContent):
465         (GenerateDictionaryHeader):
466         (GenerateDictionaryImplementation):
467         * bindings/scripts/test/JS/JSTestObj.cpp:
468         (WebCore::convertDictionary<TestObj::ConditionalDictionaryA>):
469         (WebCore::convertDictionary<TestObj::ConditionalDictionaryB>):
470         (WebCore::convertDictionary<TestObj::ConditionalDictionaryC>):
471         * bindings/scripts/test/JS/JSTestObj.h:
472         * bindings/scripts/test/JS/JSTestStandaloneDictionary.cpp:
473         * bindings/scripts/test/JS/JSTestStandaloneDictionary.h:
474         * bindings/scripts/test/TestObj.idl:
475         * bindings/scripts/test/TestStandaloneDictionary.idl:
476
477 2016-10-24  Eric Carlson  <eric.carlson@apple.com>
478
479         [MediaStream] Separate media capture and audio playback muting
480         https://bugs.webkit.org/show_bug.cgi?id=163855
481         <rdar://problem/28827186>
482
483         Reviewed by Darin Adler.
484
485         Test: fast/mediastream/MediaStream-page-muted.html
486
487         Change page.muted from a bool to a bitfield so audio and media capture muted are independent.
488         Fix a couple of bugs in the mock media capture device uncovered by new test case.
489         
490         * Modules/mediastream/MediaStream.cpp:
491         (WebCore::MediaStream::pageMutedStateDidChange): page.isMuted -> page.mutedState.
492
493         * Modules/webaudio/AudioContext.cpp:
494         (WebCore::AudioContext::pageMutedStateDidChange): Ditto.
495
496         * html/HTMLMediaElement.cpp:
497         (WebCore::HTMLMediaElement::updateVolume): Ditto.
498         (WebCore::HTMLMediaElement::effectiveMuted): Ditto.
499
500         * page/MediaProducer.h: Add MutedState enum.
501
502         * page/Page.cpp:
503         (WebCore::Page::Page):
504         (WebCore::Page::setMuted): Take MutedStateFlags instead of bool. m_muted -> m_mutedState.
505         * page/Page.h:
506
507         * platform/mock/MockRealtimeMediaSource.cpp:
508         (WebCore::MockRealtimeMediaSource::startProducingData): Call setMuted.
509         (WebCore::MockRealtimeMediaSource::stopProducingData): Ditto.
510         * platform/mock/MockRealtimeMediaSource.h:
511
512         * platform/mock/MockRealtimeVideoSource.cpp:
513         (WebCore::MockRealtimeVideoSource::stopProducingData): Call correct base class method.
514
515         * testing/Internals.cpp:
516         (WebCore::Internals::setPageMuted): Change parameter from a bool to a string.
517         * testing/Internals.h:
518
519         * testing/Internals.idl:
520
521 2016-10-24  Darin Adler  <darin@apple.com>
522
523         Try to fix Windows build.
524
525         * bindings/js/JSWebGL2RenderingContextCustom.cpp: Rearranged includes
526         so they are inside the conditional as they should be.
527
528 2016-10-24  Youenn Fablet  <youenn@apple.com>
529
530         Activate WEB_RTC compilation flags for Mac bots
531         https://bugs.webkit.org/show_bug.cgi?id=163886
532
533         Reviewed by Eric Carlson.
534
535         Covered by existing tests.
536
537         Fixing compilation errors due to missing WEBCORE_EXPORT, missing method and missing override keywords.
538
539         * Configurations/FeatureDefines.xcconfig:
540         * DerivedSources.make:
541         * Modules/mediastream/MediaEndpointPeerConnection.h:
542         * Modules/mediastream/RTCPeerConnection.h:
543         * Modules/mediastream/RTCPeerConnection.idl:
544         * Modules/mediastream/SDPProcessor.cpp:
545         (WebCore::SDPProcessor::generate):
546         (WebCore::SDPProcessor::parse):
547         * WebCore.xcodeproj/project.pbxproj:
548         * platform/mediastream/mac/MockRealtimeVideoSourceMac.mm:
549         (WebCore::MockRealtimeVideoSource::createMuted):
550
551 2016-10-24  Brady Eidson  <beidson@apple.com>
552
553         IndexedDB 2.0: Support IDBIndex name assignment.
554         <rdar://problem/28806932> and https://bugs.webkit.org/show_bug.cgi?id=163805
555
556         Reviewed by Alex Christensen.
557
558         Tests: storage/indexeddb/modern/index-rename-1-private.html
559                storage/indexeddb/modern/index-rename-1.html
560
561         Touches a *lot* of code sites, but none of them are particularly interesting.
562         They are all just getting the new name spread out to all of the various objects that need it.
563
564         * Modules/indexeddb/IDBDatabase.cpp:
565         (WebCore::IDBDatabase::renameIndex):
566         * Modules/indexeddb/IDBDatabase.h:
567
568         * Modules/indexeddb/IDBIndex.cpp:
569         (WebCore::IDBIndex::IDBIndex):
570         (WebCore::IDBIndex::setName):
571         (WebCore::IDBIndex::rollbackInfoForVersionChangeAbort):
572         * Modules/indexeddb/IDBIndex.h:
573         * Modules/indexeddb/IDBIndex.idl:
574
575         * Modules/indexeddb/IDBObjectStore.cpp:
576         (WebCore::IDBObjectStore::rollbackForVersionChangeAbort):
577         (WebCore::IDBObjectStore::renameReferencedIndex):
578         (WebCore::IDBObjectStore::rollbackInfoForVersionChangeAbort): Deleted.
579         * Modules/indexeddb/IDBObjectStore.h:
580
581         * Modules/indexeddb/IDBTransaction.cpp:
582         (WebCore::IDBTransaction::internalAbort):
583         (WebCore::IDBTransaction::renameIndex):
584         (WebCore::IDBTransaction::renameIndexOnServer):
585         (WebCore::IDBTransaction::didRenameIndexOnServer):
586         * Modules/indexeddb/IDBTransaction.h:
587
588         * Modules/indexeddb/client/IDBConnectionProxy.cpp:
589         (WebCore::IDBClient::IDBConnectionProxy::renameIndex):
590         * Modules/indexeddb/client/IDBConnectionProxy.h:
591
592         * Modules/indexeddb/client/IDBConnectionToServer.cpp:
593         (WebCore::IDBClient::IDBConnectionToServer::renameIndex):
594         (WebCore::IDBClient::IDBConnectionToServer::didRenameIndex):
595         * Modules/indexeddb/client/IDBConnectionToServer.h:
596         * Modules/indexeddb/client/IDBConnectionToServerDelegate.h:
597
598         * Modules/indexeddb/client/TransactionOperation.h:
599         (WebCore::IDBClient::createTransactionOperation):
600
601         * Modules/indexeddb/server/IDBBackingStore.h:
602
603         * Modules/indexeddb/server/IDBConnectionToClient.cpp:
604         (WebCore::IDBServer::IDBConnectionToClient::didRenameIndex):
605         * Modules/indexeddb/server/IDBConnectionToClient.h:
606         * Modules/indexeddb/server/IDBConnectionToClientDelegate.h:
607
608         * Modules/indexeddb/server/IDBServer.cpp:
609         (WebCore::IDBServer::IDBServer::renameIndex):
610         * Modules/indexeddb/server/IDBServer.h:
611
612         * Modules/indexeddb/server/MemoryBackingStoreTransaction.cpp:
613         (WebCore::IDBServer::MemoryBackingStoreTransaction::indexRenamed):
614         (WebCore::IDBServer::MemoryBackingStoreTransaction::abort):
615         * Modules/indexeddb/server/MemoryBackingStoreTransaction.h:
616
617         * Modules/indexeddb/server/MemoryIDBBackingStore.cpp:
618         (WebCore::IDBServer::MemoryIDBBackingStore::renameIndex):
619         * Modules/indexeddb/server/MemoryIDBBackingStore.h:
620
621         * Modules/indexeddb/server/MemoryIndex.h:
622         (WebCore::IDBServer::MemoryIndex::rename):
623
624         * Modules/indexeddb/server/MemoryObjectStore.cpp:
625         (WebCore::IDBServer::MemoryObjectStore::renameIndex):
626         * Modules/indexeddb/server/MemoryObjectStore.h:
627
628         * Modules/indexeddb/server/SQLiteIDBBackingStore.cpp:
629         (WebCore::IDBServer::SQLiteIDBBackingStore::renameIndex):
630         * Modules/indexeddb/server/SQLiteIDBBackingStore.h:
631
632         * Modules/indexeddb/server/UniqueIDBDatabase.cpp:
633         (WebCore::IDBServer::UniqueIDBDatabase::renameIndex):
634         (WebCore::IDBServer::UniqueIDBDatabase::performRenameIndex):
635         (WebCore::IDBServer::UniqueIDBDatabase::didPerformRenameIndex):
636         * Modules/indexeddb/server/UniqueIDBDatabase.h:
637
638         * Modules/indexeddb/server/UniqueIDBDatabaseConnection.cpp:
639         (WebCore::IDBServer::UniqueIDBDatabaseConnection::didRenameIndex):
640         * Modules/indexeddb/server/UniqueIDBDatabaseConnection.h:
641
642         * Modules/indexeddb/server/UniqueIDBDatabaseTransaction.cpp:
643         (WebCore::IDBServer::UniqueIDBDatabaseTransaction::renameIndex):
644         * Modules/indexeddb/server/UniqueIDBDatabaseTransaction.h:
645
646         * Modules/indexeddb/shared/IDBIndexInfo.h:
647         (WebCore::IDBIndexInfo::rename):
648
649         * Modules/indexeddb/shared/IDBObjectStoreInfo.cpp:
650         (WebCore::IDBObjectStoreInfo::infoForExistingIndex):
651         * Modules/indexeddb/shared/IDBObjectStoreInfo.h:
652
653         * Modules/indexeddb/shared/IDBResultData.cpp:
654         (WebCore::IDBResultData::renameIndexSuccess):
655         * Modules/indexeddb/shared/IDBResultData.h:
656
657         * Modules/indexeddb/shared/InProcessIDBServer.cpp:
658         (WebCore::InProcessIDBServer::didRenameIndex):
659         (WebCore::InProcessIDBServer::renameIndex):
660         * Modules/indexeddb/shared/InProcessIDBServer.h:
661
662 2016-10-24  Dave Hyatt  <hyatt@apple.com>
663
664         [CSS Parser] Fix -webkit-box-reflect parsing
665         https://bugs.webkit.org/show_bug.cgi?id=163890
666
667         Reviewed by Zalan Bujtas.
668
669         * css/parser/CSSPropertyParser.cpp:
670         (WebCore::consumeReflect):
671         Do a WTFMove on the mask instead of a .releaseNonNull(), since mask can be a nullptr.
672         Exactly matches the old parser.
673
674         * css/parser/CSSPropertyParserHelpers.cpp:
675         (WebCore::CSSPropertyParserHelpers::CalcParser::consumeValue):
676         (WebCore::CSSPropertyParserHelpers::CalcParser::consumeNumber):
677         (WebCore::CSSPropertyParserHelpers::consumeInteger):
678         (WebCore::CSSPropertyParserHelpers::consumeNumber):
679         (WebCore::CSSPropertyParserHelpers::consumeLength):
680         (WebCore::CSSPropertyParserHelpers::consumePercent):
681         (WebCore::CSSPropertyParserHelpers::consumeAngle):
682         (WebCore::CSSPropertyParserHelpers::consumeTime):
683         (WebCore::CSSPropertyParserHelpers::consumeUrl):
684         (WebCore::CSSPropertyParserHelpers::consumeColor):
685         (WebCore::CSSPropertyParserHelpers::consumeDeprecatedGradientPoint):
686         (WebCore::CSSPropertyParserHelpers::consumeDeprecatedGradientColorStop):
687         (WebCore::CSSPropertyParserHelpers::consumeCrossFade):
688         (WebCore::CSSPropertyParserHelpers::consumeImageSet):
689         Clean up all instances of CSSPrimitiveValue::create to use the CSSValuePool.
690
691 2016-10-21  Antoine Quint  <graouts@apple.com>
692
693         [Modern Media Controls] Concatenate JS and CSS files into a single JS and CSS resources
694         https://bugs.webkit.org/show_bug.cgi?id=163785
695         <rdar://problem/28890058>
696
697         Reviewed by Darin Adler.
698
699         Concatenate CSS and JS resources for modern media controls into single JS and CSS files
700         during build and load these single resources alone at runtime.
701
702         * Modules/modern-media-controls/js-files: Added.
703         * WebCore.xcodeproj/project.pbxproj:
704         * rendering/RenderThemeMac.mm:
705         (WebCore::RenderThemeMac::mediaControlsStyleSheet):
706         (WebCore::RenderThemeMac::mediaControlsScript):
707
708 2016-10-24  Dave Hyatt  <hyatt@apple.com>
709
710         [CSS Parser] Unprefix -webkit-writing-mode
711         https://bugs.webkit.org/show_bug.cgi?id=163870
712
713         Reviewed by Zalan Bujtas.
714
715         * css/CSSComputedStyleDeclaration.cpp:
716         (WebCore::ComputedStyleExtractor::propertyValue):
717         Change -webkit-writing mode to writing-mode.
718
719         * css/CSSPrimitiveValueMappings.h:
720         (WebCore::CSSPrimitiveValue::operator WritingMode):
721         (WebCore::CSSPrimitiveValue::operator SVGWritingMode): Deleted.
722         Eliminate the SVGWritingMode converters. Add support for the unique SVG-specific
723         values to the WritingMode converters.
724
725         * css/CSSPropertyNames.in:
726         Alias -webkit-writing-mode to writing-mode. Move writing-mode up to be
727         high priority like -webkit-writing mode was. Alias -epub-writing-mode to writing-mode
728         instead of to -webkit-writing-mode.
729
730         * css/SVGCSSComputedStyleDeclaration.cpp:
731         (WebCore::ComputedStyleExtractor::svgPropertyValue):
732         Remove writing-mode from SVG computed style, since the base CSSComputedStyleDeclaration handles it.
733
734         * css/StyleBuilderCustom.h:
735         (WebCore::StyleBuilderCustom::applyValueWritingMode):
736         (WebCore::StyleBuilderCustom::applyValueWebkitWritingMode): Deleted.
737         Renamed applyValueWebkitWritingMode to applyValueWritingMode. Removed the SVG code, since
738         the underlying converter for WritingMode now handles those values.
739
740         * css/StyleResolver.cpp:
741         (WebCore::extractDirectionAndWritingMode):
742         Rename -webkit-writing-mode to writing-mode.
743
744         * css/parser/CSSParser.cpp:
745         (WebCore::isValidKeywordPropertyAndValue):
746         Eliminate -webkit-writing-mode and make sure writing-mode handles both the SVG values
747         and the normal values.
748
749         * css/parser/CSSParserFastPaths.cpp:
750         (WebCore::CSSParserFastPaths::isValidKeywordPropertyAndValue):
751         (WebCore::CSSParserFastPaths::isKeywordPropertyID):
752         Same deal here.
753
754         * html/track/TextTrackCueGeneric.cpp:
755         (WebCore::TextTrackCueGenericBoxElement::applyCSSProperties):
756         * html/track/VTTCue.cpp:
757         (WebCore::VTTCueBox::applyCSSProperties):
758         Cue stuff was setting -webkit-writing-mode, so make it set writing-mode instead now.
759
760         * rendering/RenderLineBreak.cpp:
761         (WebCore::RenderLineBreak::collectSelectionRects):
762         * rendering/RenderText.cpp:
763         (WebCore::RenderText::collectSelectionRects):
764         Switch the SVG-specific code here over to accessing the RenderStyle writing-mode and not
765         the SVG-specific one.
766
767         * rendering/style/RenderStyle.h:
768         (WebCore::RenderStyle::isVerticalWritingMode):
769         Add a helper function for asking if something is vertical writing mode.
770
771         * rendering/style/SVGRenderStyle.cpp:
772         * rendering/style/SVGRenderStyle.h:
773         * rendering/style/SVGRenderStyleDefs.h:
774         (WebCore::SVGRenderStyle::diff):
775         Remove the SVG writing mode code.
776
777         * rendering/svg/RenderSVGInlineText.cpp:
778         (WebCore::RenderSVGInlineText::computeNewScaledFontForStyle):
779         Make sure to force SVG font descriptions to be horizontal, since SVG controls
780         its own glyph orientation.
781
782         * rendering/svg/SVGRenderTreeAsText.cpp:
783         (WebCore::writeSVGInlineTextBox):
784         * rendering/svg/SVGTextChunk.cpp:
785         (WebCore::SVGTextChunk::SVGTextChunk):
786         * rendering/svg/SVGTextLayoutEngine.cpp:
787         (WebCore::SVGTextLayoutEngine::layoutInlineTextBox):
788         * rendering/svg/SVGTextQuery.cpp:
789         (WebCore::SVGTextQuery::executeQuery):
790         Changed to access the RenderStyle writing mode instead of the SVG-specific one.
791
792 2016-10-23  Antti Koivisto  <antti@apple.com>
793
794         Avoid unnecessary full style resolution in getComputedStyle for non-inherited properties
795         https://bugs.webkit.org/show_bug.cgi?id=163875
796
797         Reviewed by Andreas Kling.
798
799         Test: fast/css/getComputedStyle/getComputedStyle-style-resolution.html
800
801         * css/CSSComputedStyleDeclaration.cpp:
802         (WebCore::hasValidStyleForProperty):
803
804             For non-inherited properties we don't need to update style even if some ancestor style is invalid
805             as long as explicit 'inherit' is not being used.
806             We still need to update if we find out that the whole subtree we are in is invalid.
807
808         (WebCore::updateStyleIfNeededForProperty):
809
810             Pass the property.
811
812         (WebCore::ComputedStyleExtractor::customPropertyValue):
813         (WebCore::ComputedStyleExtractor::propertyValue):
814         (WebCore::CSSComputedStyleDeclaration::length):
815         (WebCore::elementOrItsAncestorNeedsStyleRecalc): Deleted.
816         (WebCore::updateStyleIfNeededForElement): Deleted.
817         * css/StyleResolver.cpp:
818         (WebCore::StyleResolver::colorFromPrimitiveValue):
819
820             Mark style as using explicit inheritance if 'currentcolor' value is used.
821
822 2016-10-24  Youenn Fablet  <youenn@apple.com>
823
824         ASSERTION FAILED: canvas()->securityOrigin()->toString() == cachedImage.origin()->toString()
825         https://bugs.webkit.org/show_bug.cgi?id=163242
826
827         Reviewed by Darin Adler.
828
829         Test: http/tests/security/cross-origin-cached-images-canvas.html
830
831         We were previously on Origin HTTP header to check whether requests were made from different origins.
832         This is fine for CORS enabled requests but not for GET no CORS requests since they will not have any Origin header.
833
834         Now that CachedResource and CachedResourceRequest own their origin, it is best to use these directly.
835
836         * loader/cache/CachedResourceLoader.cpp:
837         (WebCore::isRequestMatchingResourceOrigin):
838         (WebCore::CachedResourceLoader::shouldUpdateCachedResourceWithCurrentRequest):
839
840 2016-10-24  Youenn Fablet  <youenn@apple.com>
841
842         Remove CachedResource::passesSameOriginPolicyCheck
843         https://bugs.webkit.org/show_bug.cgi?id=163593
844
845         Reviewed by Andreas Kling.
846
847         No change of behavior.
848
849         Removing no-longer used code.
850
851         * loader/cache/CachedResource.cpp:
852         (WebCore::CachedResource::redirectReceived):
853         (WebCore::CachedResource::passesAccessControlCheck): Deleted.
854         (WebCore::CachedResource::passesSameOriginPolicyCheck): Deleted.
855         (WebCore::CachedResource::responseForSameOriginPolicyChecks): Deleted.
856         * loader/cache/CachedResource.h:
857         (WebCore::CachedResource::response):
858
859 2016-10-24  Youenn Fablet  <youenn@apple.com>
860
861         Redirections should be upgraded if CSP policy says so
862         https://bugs.webkit.org/show_bug.cgi?id=163544
863
864         Reviewed by Darin Adler.
865
866         Test: http/tests/security/contentSecurityPolicy/upgrade-insecure-requests/basic-upgrade-after-redirect.https.html
867
868         Introducing CachedResourceLoader::updateRequestAfterRedirection to do the checks that CachedResourceLoader is doing
869         to the initial request, but for redirection requests.
870
871         Implemented URL upgrade according CSP policy, as specified by fetch algorithm.
872         Minor refactoring in CachedResourceRequest to share some code.
873         Fixing some constness issues.
874
875         * loader/SubresourceLoader.cpp:
876         (WebCore::SubresourceLoader::willSendRequestInternal):
877         * loader/cache/CachedResourceLoader.cpp:
878         (WebCore::CachedResourceLoader::allowedByContentSecurityPolicy):
879         (WebCore::CachedResourceLoader::canRequestAfterRedirection):
880         (WebCore::CachedResourceLoader::updateRequestAfterRedirection):
881         * loader/cache/CachedResourceLoader.h:
882         * loader/cache/CachedResourceRequest.cpp:
883         (WebCore::upgradeInsecureResourceRequestIfNeeded):
884         (WebCore::CachedResourceRequest::upgradeInsecureRequestIfNeeded):
885         * loader/cache/CachedResourceRequest.h:
886
887 2016-10-22  Sam Weinig  <sam@webkit.org>
888
889         [WebIDL] Add IDLType based toJS conversion
890         https://bugs.webkit.org/show_bug.cgi?id=163861
891
892         Reviewed by Darin Adler.
893
894         Adds toJS<IDLType>() functions to be the new way of converting
895         from implementation types to JS types. These are implemented via
896         a similar mechanism to the convert<IDL>() functions, though specializations
897         of a JSConverter struct (rather than the Converter structs). This allows
898         us to support arbitrarily complex aggregate types easily (e.g. sequence<(Node or DOMString?)>).
899
900         * Modules/geolocation/Geoposition.idl:
901         * dom/Event.idl:
902         Add typedef for DOMTimeStamp. Eventually, our IDLParser should do this for us, but
903         for now it allows us to simplify the type system.
904
905         * bindings/js/JSDOMBinding.h:
906         (WebCore::JSValueTraits::arrayJSValue): Deleted.
907         (WebCore::JSValueTraits<String>::arrayJSValue): Deleted.
908         (WebCore::JSValueTraits<double>::arrayJSValue): Deleted.
909         (WebCore::JSValueTraits<float>::arrayJSValue): Deleted.
910         (WebCore::jsArray): Deleted.
911         (WebCore::jsFrozenArray): Deleted.
912         (WebCore::NativeValueTraits<String>::nativeValue): Deleted.
913         (WebCore::NativeValueTraits<unsigned>::nativeValue): Deleted.
914         (WebCore::NativeValueTraits<float>::nativeValue): Deleted.
915         (WebCore::NativeValueTraits<double>::nativeValue): Deleted.
916         (WebCore::toNullableJSNumber): Deleted.
917         (WebCore::toJSArray): Deleted.
918         (WebCore::toJSBoolean): Deleted.
919         (WebCore::toJSNumber): Deleted.
920         (WebCore::toJSString): Deleted.
921         Remove many now-unneeded conversion functions.
922
923         * bindings/js/JSDOMConvert.h:
924         (WebCore::toJS):
925         Add 5 primary toJS functions which take combinations of the following
926         arguments: ExecState, JSDOMGlobalObject, ThrowScope.  All take the value 
927         to be converted as well, except in the case of the throwScope ones, where
928         they take the value in an ExceptionOr<>.
929
930         To simplify the implementations of the JSConverter specializations, avoiding
931         the need for each one to implement their conversion up to 3 times (one for just
932         the value, one for the value and the ExecState, and one for the value, the ExecState
933         and the global object), each JSConverter instead specifies whether it's converter
934         needs an ExecState or global object via a static constexpr. We then use the 
935         JSConverterOverloader template, to call the correct function. This can probably be
936         improved in the future, by inferring the number of arguments needed via SFINAE, but
937         this seemed like a more straightforward first cut.
938
939         (WebCore::JSConverter<IDLNullable<T>>::convert):
940         (WebCore::JSConverter<IDLBoolean>::convert):
941         (WebCore::JSConverter<IDLInterface<T>>::convert):
942         (WebCore::JSConverter<IDLAny>::convert):
943         (WebCore::JSConverter<IDLByte>::convert):
944         (WebCore::JSConverter<IDLOctet>::convert):
945         (WebCore::JSConverter<IDLShort>::convert):
946         (WebCore::JSConverter<IDLUnsignedShort>::convert):
947         (WebCore::JSConverter<IDLLong>::convert):
948         (WebCore::JSConverter<IDLUnsignedLong>::convert):
949         (WebCore::JSConverter<IDLLongLong>::convert):
950         (WebCore::JSConverter<IDLUnsignedLongLong>::convert):
951         (WebCore::JSConverter<IDLFloat>::convert):
952         (WebCore::JSConverter<IDLUnrestrictedFloat>::convert):
953         (WebCore::JSConverter<IDLDouble>::convert):
954         (WebCore::JSConverter<IDLUnrestrictedDouble>::convert):
955         (WebCore::JSConverter<IDLDOMString>::convert):
956         (WebCore::JSConverter<IDLUSVString>::convert):
957         (WebCore::JSConverter<IDLSequence<T>>::convert):
958         (WebCore::JSConverter<IDLFrozenArray<T>>::convert):
959         (WebCore::JSConverter<IDLEnumeration<T>>::convert):
960         (WebCore::JSConverter<IDLUnion<T...>>::convert):
961         There is slightly more duplication than I would have liked, for instance we have a
962         specialization for each numeric type, even though they are all the same, but that is
963         something that can be improved going forward.
964
965         (WebCore::Converter<IDLUnion<T...>>::convert)
966         Fix the normal IDLUnion converter to work with boolean types. This was caught by the
967         test case I added via TypeConversions.idl.
968         
969         * bindings/js/JSDOMStringMapCustom.cpp:
970         (WebCore::JSDOMStringMap::getOwnPropertySlotDelegate):
971         * bindings/js/JSDOMWindowCustom.cpp:
972         (WebCore::JSDOMWindow::setTimeout):
973         (WebCore::JSDOMWindow::setInterval):
974         * bindings/js/JSDataTransferCustom.cpp:
975         (WebCore::JSDataTransfer::types):
976         * bindings/js/JSMediaStreamTrackCustom.cpp:
977         (WebCore::JSMediaStreamTrack::getCapabilities):
978         * bindings/js/JSMutationCallback.cpp:
979         (WebCore::JSMutationCallback::call):
980         * bindings/js/JSSVGLengthCustom.cpp:
981         (WebCore::JSSVGLength::value):
982         Switch to use new toJS<> functions.
983
984         * bindings/scripts/CodeGeneratorJS.pm:
985         (AddStringifierOperationIfNeeded):
986         Fix stringifier function signature to contain an idlType.
987
988         (GenerateEnumerationsHeaderContent):
989         Remove now unnecessary JSValueTraits specializations.
990
991         (JSValueToNativeIsHandledByDOMConvert):
992         Renamed from IsHandledByDOMConvert, since that name is now ambiguous.
993
994         (JSValueToNative):
995         Update for new name of IsHandledByDOMConvert.
996
997         (NativeToJSValueIsHandledByDOMConvert):
998         Predicate guarding what types currently work with the new conversion system.
999
1000         (NativeToJSValueDOMConvertNeedsState):
1001         Predicate for determining if the ExecState is needed in the conversion function.
1002
1003         (NativeToJSValueDOMConvertNeedsGlobalObject):
1004         Predicate for determining if the global object is needed in the conversion function.
1005
1006         (NativeToJSValue):
1007         Move things around a little bit and start converting use the new toJS<> when possible.
1008
1009         * bindings/scripts/IDLParser.pm:
1010         (parseAttributeOrOperationRest):
1011         Fix a missing place where were not setting the idlType.
1012  
1013         * bindings/scripts/test/JS/JSTestActiveDOMObject.cpp:
1014         * bindings/scripts/test/JS/JSTestCEReactions.cpp:
1015         * bindings/scripts/test/JS/JSTestCEReactionsStringifier.cpp:
1016         * bindings/scripts/test/JS/JSTestCallback.cpp:
1017         * bindings/scripts/test/JS/JSTestCallbackFunction.cpp:
1018         * bindings/scripts/test/JS/JSTestEventConstructor.cpp:
1019         * bindings/scripts/test/JS/JSTestException.cpp:
1020         * bindings/scripts/test/JS/JSTestGlobalObject.cpp:
1021         * bindings/scripts/test/JS/JSTestInterface.cpp:
1022         * bindings/scripts/test/JS/JSTestNode.cpp:
1023         * bindings/scripts/test/JS/JSTestNondeterministic.cpp:
1024         * bindings/scripts/test/JS/JSTestObj.cpp:
1025         * bindings/scripts/test/JS/JSTestObj.h:
1026         * bindings/scripts/test/JS/JSTestSerialization.cpp:
1027         * bindings/scripts/test/JS/JSTestSerializedScriptValueInterface.cpp:
1028         * bindings/scripts/test/JS/JSTestTypedefs.cpp:
1029         * bindings/scripts/test/JS/JSattribute.cpp:
1030         Update test results.
1031
1032         * testing/TypeConversions.h:
1033         (WebCore::TypeConversions::testUnion):
1034         (WebCore::TypeConversions::setTestUnion):
1035         (WebCore::TypeConversions::typeConversionsDictionarySequenceValue):
1036         (WebCore::TypeConversions::typeConversionsDictionaryUnionValue):
1037         * testing/TypeConversions.idl:
1038         Add a testUnion attribute, now that we can return unions to JS.
1039
1040 2016-10-23  Zalan Bujtas  <zalan@apple.com>
1041
1042         Unreviewed, rolling out r207727.
1043
1044         broke 15 selection test cases.
1045
1046         Reverted changeset:
1047
1048         "Do not update selection rect on dirty lineboxes."
1049         https://bugs.webkit.org/show_bug.cgi?id=163862
1050         http://trac.webkit.org/changeset/207727
1051
1052 2016-10-23  Chris Dumez  <cdumez@apple.com>
1053
1054         addEventListener() / removeEventListener() should use a union for last parameter
1055         https://bugs.webkit.org/show_bug.cgi?id=163863
1056
1057         Reviewed by Darin Adler.
1058
1059         addEventListener() / removeEventListener() should use a union for last parameter:
1060         - https://dom.spec.whatwg.org/#eventtarget
1061
1062         No new tests, no Web-exposed behavior change.
1063
1064         * bindings/js/JSDOMConvert.h:
1065         * dom/EventTarget.cpp:
1066         (WebCore::EventTarget::addEventListenerForBindings):
1067         (WebCore::EventTarget::removeEventListenerForBindings):
1068         * dom/EventTarget.h:
1069         * dom/EventTarget.idl:
1070
1071 2016-10-23  Zalan Bujtas  <zalan@apple.com>
1072
1073         Do not update selection rect on dirty lineboxes.
1074         https://bugs.webkit.org/show_bug.cgi?id=163862
1075         <rdar://problem/28813156>
1076
1077         Reviewed by Simon Fraser.
1078
1079         In addition to checking whether the renderer needs layout, we also need to check if its preferred
1080         width is clean and stop computing the selection rects, if needed (while adding a renderer to the tree,
1081         there's a transition phase where the parent's preferred width dirty bit is already set, but it does
1082         not yet need layout).
1083
1084         Tests: fast/css-generated-content/dynamic-first-letter-selection-clear-crash.html
1085
1086         * rendering/RenderObject.cpp:
1087         (WebCore::RenderObject::canUpdateSelectionOnRootLineBoxes):
1088
1089 2016-10-22  Myles C. Maxfield  <mmaxfield@apple.com>
1090
1091         ASSERTION FAILED: m_fonts in &WebCore::FontCascade::primaryFont
1092         https://bugs.webkit.org/show_bug.cgi?id=163459
1093
1094         Reviewed by Darin Adler.
1095
1096         The CSS Units and Values spec states that font-relative units, when used
1097         in the font-size property, are resolved against the parent element. When
1098         calc() is specified, we were trying to resolve them against the current
1099         element, which is impossible because of the circular dependency. Instead,
1100         we should resolve against the parent style the same way as when calc() 
1101         isn't specified.
1102
1103         Test: fast/text/font-size-calc.html
1104
1105         * css/StyleBuilderCustom.h:
1106         (WebCore::StyleBuilderCustom::applyValueFontSize):
1107
1108 2016-10-22  Chris Dumez  <cdumez@apple.com>
1109
1110         [Web IDL] Two types are distinguishable for overload resolution if at most one of the two includes a nullable type
1111         https://bugs.webkit.org/show_bug.cgi?id=163791
1112
1113         Reviewed by Sam Weinig.
1114
1115         Update overload resolution in the bindings generator so that 2 nullable types
1116         are no longer considered as distinguishable, as per Web IDL:
1117         - https://heycam.github.io/webidl/#dfn-distinguishable
1118
1119         * bindings/scripts/CodeGeneratorJS.pm:
1120         (AreTypesDistinguishableForOverloadResolution):
1121         * bindings/scripts/test/JS/JSTestObj.cpp:
1122         (WebCore::jsTestObjPrototypeFunctionOverloadWithNullableNonDistinguishingParameter1):
1123         (WebCore::jsTestObjPrototypeFunctionOverloadWithNullableNonDistinguishingParameter1Caller):
1124         (WebCore::jsTestObjPrototypeFunctionOverloadWithNullableNonDistinguishingParameter2):
1125         (WebCore::jsTestObjPrototypeFunctionOverloadWithNullableNonDistinguishingParameter2Caller):
1126         (WebCore::jsTestObjPrototypeFunctionOverloadWithNullableNonDistinguishingParameter):
1127         * bindings/scripts/test/TestObj.idl:
1128
1129 2016-10-22  Chris Dumez  <cdumez@apple.com>
1130
1131         WebGLRenderingContextBase.texSubImage2D() should use a union instead of overloading
1132         https://bugs.webkit.org/show_bug.cgi?id=163859
1133
1134         Reviewed by Darin Adler.
1135
1136         WebGLRenderingContextBase.texSubImage2D() should use a union instead of overloading:
1137         - https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14
1138
1139         No new tests, no Web-exposed behavior change.
1140
1141         * html/canvas/WebGL2RenderingContext.cpp:
1142         (WebCore::WebGL2RenderingContext::texSubImage2D):
1143         * html/canvas/WebGL2RenderingContext.h:
1144         * html/canvas/WebGLRenderingContext.cpp:
1145         (WebCore::WebGLRenderingContext::texSubImage2D):
1146         * html/canvas/WebGLRenderingContext.h:
1147         * html/canvas/WebGLRenderingContextBase.h:
1148         * html/canvas/WebGLRenderingContextBase.idl:
1149
1150 2016-10-22  Dan Bernstein  <mitz@apple.com>
1151
1152         Dynamically-added backdrop filter to clip-path'd element with 3D transform renders incorrectly (without clip)
1153         https://bugs.webkit.org/show_bug.cgi?id=163497
1154
1155         Reviewed by Simon Fraser.
1156
1157         Test: css3/filters/backdrop/dynamic-with-clip-path.html
1158
1159         * platform/graphics/ca/GraphicsLayerCA.cpp:
1160         (WebCore::GraphicsLayerCA::ensureStructuralLayer): Added MaskLayerChanged to
1161           structuralLayerChangeFlags to ensure that the mask layer is updated.
1162
1163 2016-10-22  Simon Fraser  <simon.fraser@apple.com>
1164
1165         Backdrop filter doesn't show if removed then re-added
1166         https://bugs.webkit.org/show_bug.cgi?id=163860
1167
1168         Reviewed by Dan Bernstein.
1169
1170         When a backdrop filter is removed the re-added, updateBackdropFiltersRect() never
1171         runs the second time because m_backdropFiltersRect doesn't change. However, we need
1172         to run that code to size and position the newly re-created backdrop layer, so run
1173         it explicitly if we just created the backdrop layer. This is similar to how
1174         updateContentsImage() calls updateContentsRects().
1175
1176         Test: css3/filters/backdrop/add-remove-add-backdrop-filter.html
1177
1178         * platform/graphics/ca/GraphicsLayerCA.cpp:
1179         (WebCore::GraphicsLayerCA::setBackdropFilters):
1180         (WebCore::GraphicsLayerCA::updateBackdropFilters):
1181
1182 2016-10-22  Simon Fraser  <simon.fraser@apple.com>
1183
1184         Fix repainting of slow repaint objects in WK1 when page scale is applied
1185         https://bugs.webkit.org/show_bug.cgi?id=163854
1186
1187         Reviewed by Zalan Bujtas.
1188         
1189         RenderObject::repaintSlowRepaintObject() always set the repaint container to the RenderView
1190         if it was null. This is before the call to clippedOverflowRectForRepaint(). If that function
1191         is called with a null repaintContainer, it maps the rect up through the RenderView's transform
1192         (which represents page scale), which is what we want here. Passing the RenderView itself
1193         stops the transform from being applied, which led to the bug.
1194         
1195         WebKit2 doesn't suffer from this bug because containerForRepaint() always returns the
1196         composited RenderView.
1197
1198         Test: fast/repaint/zoomed-fixed-background.html
1199
1200         * rendering/RenderObject.cpp:
1201         (WebCore::RenderObject::repaintSlowRepaintObject):
1202
1203 2016-10-22  Darin Adler  <darin@apple.com>
1204
1205         Move HTML canvas and tracks from ExceptionCode to Exception
1206         https://bugs.webkit.org/show_bug.cgi?id=163853
1207
1208         Reviewed by Chris Dumez.
1209
1210         * WebCore.xcodeproj/project.pbxproj: Added CanvasPath.idl.
1211
1212         * bindings/js/JSWebGL2RenderingContextCustom.cpp: Tweaked a bit.
1213
1214         * bindings/js/JSWebGLRenderingContextBaseCustom.cpp:
1215         (WebCore::JSWebGLRenderingContextBase::getExtension): Tweaked a bit.
1216         (WebCore::JSWebGLRenderingContextBase::getFramebufferAttachmentParameter):
1217         Removed unneeded exception handling.
1218         (WebCore::JSWebGLRenderingContextBase::getParameter): Ditto.
1219         (WebCore::JSWebGLRenderingContextBase::getProgramParameter): Ditto.
1220         (WebCore::JSWebGLRenderingContextBase::getShaderParameter): Ditto.
1221         (WebCore::JSWebGLRenderingContextBase::getSupportedExtensions): Use a
1222         modern for loop.
1223         (WebCore::JSWebGLRenderingContextBase::getUniform): Removed unneeded
1224         exception handling.
1225
1226         * html/HTMLCanvasElement.cpp:
1227         (WebCore::HTMLCanvasElement::getContext): Pass a reference.
1228         (WebCore::HTMLCanvasElement::reset): Use is<CanvasRenderingContext2D>.
1229         (WebCore::HTMLCanvasElement::setUsesDisplayListDrawing): Ditto.
1230         (WebCore::HTMLCanvasElement::setTracksDisplayListReplay) Ditto.:
1231         (WebCore::HTMLCanvasElement::displayListAsText): Ditto.
1232         (WebCore::HTMLCanvasElement::replayDisplayListAsText): Ditto.
1233         (WebCore::HTMLCanvasElement::clearImageBuffer): Ditto.
1234
1235         * html/canvas/CanvasGradient.cpp:
1236         (WebCore::CanvasGradient::CanvasGradient): Streamlined.
1237         (WebCore::CanvasGradient::addColorStop): Use ExceptionOr.
1238         * html/canvas/CanvasGradient.h: Updated for above changes.
1239         * html/canvas/CanvasGradient.idl: Use non-legacy exception.
1240
1241         * html/canvas/CanvasPath.cpp:
1242         (WebCore::CanvasPath::arcTo): Use ExceptionOr.
1243         (WebCore::CanvasPath::arc): Ditto.
1244         (WebCore::CanvasPath::ellipse): Ditto.
1245         * html/canvas/CanvasPath.h: Updated for above changes.
1246         * html/canvas/CanvasPath.idl: Use non-legacy exceptions.
1247
1248         * html/canvas/CanvasPattern.cpp:
1249         (WebCore::CanvasPattern::create): Use Ref&&.
1250         (WebCore::CanvasPattern::CanvasPattern): Ditto.
1251         (WebCore::CanvasPattern::parseRepetitionType): Return a boolean
1252         instead of using an ExceptionCode.
1253         * html/canvas/CanvasPattern.h: Updated for above changes.
1254
1255         * html/canvas/CanvasRenderingContext.cpp:
1256         (CanvasRenderingContext::wouldTaintOrigin): Reordered function so
1257         that it's safe to call it on an image element without a cached
1258         image, or a cached image without an underlying image.
1259
1260         * html/canvas/CanvasRenderingContext2D.cpp:
1261         (WebCore::CanvasRenderingContext2D::CanvasRenderingContext2D):
1262         Take a reference.
1263         (WebCore::CanvasRenderingContext2D::drawImage): Use ExceptionOr.
1264         (WebCore::CanvasRenderingContext2D::drawImageFromRect): Ditto.
1265         (WebCore::CanvasRenderingContext2D::createLinearGradient): Ditto.
1266         (WebCore::CanvasRenderingContext2D::createRadialGradient): Ditto.
1267         (WebCore::CanvasRenderingContext2D::createPattern): Ditto.
1268         (WebCore::CanvasRenderingContext2D::createImageData): Ditto.
1269         (WebCore::CanvasRenderingContext2D::getImageData): Ditto.
1270         (WebCore::CanvasRenderingContext2D::webkitGetImageDataHD): Ditto.
1271         (WebCore::CanvasRenderingContext2D::putImageData): Removed unneeded
1272         ExceptionCode because this does not throw exceptions; the only one
1273         was for non-finite numeric values but this is now handled by bindings.
1274         (WebCore::CanvasRenderingContext2D::webkitPutImageDataHD): Ditto.
1275         * html/canvas/CanvasRenderingContext2D.h: Updated for above.
1276         * html/canvas/CanvasRenderingContext2D.idl: Use non-legacy exceptions
1277         and removed exceptions entirely in other cases.
1278
1279         * html/canvas/OESVertexArrayObject.cpp:
1280         (WebCore::OESVertexArrayObject::OESVertexArrayObject): Take a reference.
1281         (WebCore::OESVertexArrayObject::~OESVertexArrayObject): Deleted.
1282         (WebCore::OESVertexArrayObject::isVertexArrayOES): Use && instead of
1283         multiple return statements.
1284         (WebCore::OESVertexArrayObject::bindVertexArrayOES): Removed unneeded
1285         ExceptionCode since this does not throw an exception.
1286         * html/canvas/OESVertexArrayObject.h: Updated for above.
1287         * html/canvas/OESVertexArrayObject.idl: Removed unneeded exception.
1288
1289         * html/canvas/WebGL2RenderingContext.cpp:
1290         (WebCore::WebGL2RenderingContext::getFramebufferAttachmentParameter):
1291         Removed unneeded ExceptionCode since this does not throw an exception.
1292         (WebCore::WebGL2RenderingContext::texSubImage2DBase): Ditto.
1293         (WebCore::WebGL2RenderingContext::texSubImage2DImpl): Ditto.
1294         (WebCore::WebGL2RenderingContext::texSubImage2D): Removed unneeded
1295         ExceptionCode for some overloads, for the others, use ExceptionOr
1296         for the security exception. Moved security exception code here from
1297         the validate functions.
1298         (WebCore::WebGL2RenderingContext::validateTexFuncParameters): Removed
1299         unneeded ExceptionCode.
1300         (WebCore::WebGL2RenderingContext::getParameter): Ditto.
1301         * html/canvas/WebGL2RenderingContext.h: Updated for above.
1302
1303         * html/canvas/WebGLRenderingContext.cpp:
1304         (WebCore::WebGLRenderingContext::getExtension): Pass a reference.
1305         (WebCore::WebGLRenderingContext::getFramebufferAttachmentParameter):
1306         Remvoed unneeded ExceptionCode since this does not throw an exception.
1307         (WebCore::WebGLRenderingContext::texSubImage2DBase): Ditto.
1308         (WebCore::WebGLRenderingContext::texSubImage2DImpl): Ditto.
1309         (WebCore::WebGLRenderingContext::texSubImage2D): Removed unneeded
1310         ExceptionCode for some overloads, for the others, use ExceptionOr
1311         for the security exception. Moved security exception code here from
1312         the validate functions.
1313         (WebCore::WebGLRenderingContext::getParameter): Removed unneeded
1314         ExceptionCode.
1315         * html/canvas/WebGLRenderingContext.h: Updated for above changes.
1316
1317         * html/canvas/WebGLRenderingContextBase.cpp:
1318         (WebCore::WebGLRenderingContextBase::texImage2DBase):
1319         Remvoed unneeded ExceptionCode since this does not throw an exception.
1320         (WebCore::WebGLRenderingContextBase::texImage2DImpl): Ditto.
1321         (WebCore::WebGLRenderingContextBase::texImage2D): Removed unneeded
1322         ExceptionCode for some overloads, for the others, use ExceptionOr
1323         for the security exception. Moved security exception code here from
1324         the validate functions.
1325         (WebCore::WebGLRenderingContextBase::validateHTMLImageElement):
1326         Moved the security exception out of here to the call sites.
1327         (WebCore::WebGLRenderingContextBase::validateHTMLCanvasElement): Ditto.
1328         (WebCore::WebGLRenderingContextBase::validateHTMLVideoElement): Ditto.
1329         * html/canvas/WebGLRenderingContextBase.h: Updated for above changes.
1330         * html/canvas/WebGLRenderingContextBase.idl: Use non-legacy exceptions
1331         in some cases and no exceptions at all in many others.
1332
1333         * html/shadow/MediaControlElements.cpp:
1334         (WebCore::MediaControlTextTrackContainerElement::updateDisplay):
1335         Use a reference instead of a pointer.
1336
1337         * html/track/DataCue.h: Use pragma once.
1338         * html/track/DataCue.idl: Use non-legacy exception for constructor
1339         attribute, even though it is custom and so it has no effect.
1340
1341         * html/track/InbandDataTextTrack.cpp:
1342         (WebCore::InbandDataTextTrack::create): Use RefPtr&&.
1343         (WebCore::InbandDataTextTrack::InbandDataTextTrack): Ditto.
1344         (WebCore::InbandDataTextTrack::addDataCue): Stop using
1345         ASSERT_NO_EXCEPTION.
1346         (WebCore::InbandDataTextTrack::removeDataCue): Stop using
1347         IGNORE_EXCEPTION.
1348         (WebCore::InbandDataTextTrack::removeCue): Use ExceptionOr.
1349         Also use remove instead of find/remove.
1350         * html/track/InbandDataTextTrack.h: Updated for above changes.
1351
1352         * html/track/InbandGenericTextTrack.cpp:
1353         (WebCore::GenericTextTrackCueMap::GenericTextTrackCueMap): Deleted.
1354         (WebCore::GenericTextTrackCueMap::~GenericTextTrackCueMap): Deleted.
1355         (WebCore::GenericTextTrackCueMap::add): Take references intead of
1356         pointers.
1357         (WebCore::GenericTextTrackCueMap::find): Ditto. Also use get
1358         instead of find.
1359         (WebCore::GenericTextTrackCueMap::remove): Ditto. Also use take
1360         instead of double hashing to both find and remove.
1361         (WebCore::InbandGenericTextTrack::updateCueFromCueData): Stop using
1362         IGNORE_EXCEPTION. Also got rid of code that is converting a double
1363         to a long and then back to a double by using lround. Instead just
1364         use std::round, which keeps it a double. But also, why does this need
1365         to round?!
1366         (WebCore::InbandGenericTextTrack::addGenericCue): Updated to use
1367         reference to work with m_cueMap.
1368         (WebCore::InbandGenericTextTrack::updateGenericCue): Ditto.
1369         (WebCore::InbandGenericTextTrack::removeGenericCue): Ditto.
1370         (WebCore::InbandGenericTextTrack::removeCue): Use ExceptionOr.
1371         (WebCore::InbandGenericTextTrack::newCuesParsed): Removed
1372         ASSERT_NO_EXCEPTION.
1373         * html/track/InbandGenericTextTrack.h: Updated for above changes.
1374
1375         * html/track/InbandWebVTTTextTrack.cpp:
1376         (WebCore::InbandWebVTTTextTrack::newCuesParsed): Removed
1377         ASSERT_NO_EXCEPTION.
1378
1379         * html/track/TextTrack.cpp:
1380         (WebCore::TextTrack::addCue): Use ExcepctionOr.
1381         (WebCore::TextTrack::removeCue): Ditto.
1382         (WebCore::TextTrack::addRegion): Ditto.
1383         (WebCore::TextTrack::removeRegion): Ditto.
1384         * html/track/TextTrack.h: Updated for above changes.
1385         * html/track/TextTrack.idl: Ditto.
1386
1387         * html/track/TextTrackCue.cpp:
1388         (WebCore::TextTrackCue::cueShadowPseudoId): Moved this here
1389         since it does not need to be inlined in the header.
1390         (WebCore::TextTrackCue::~TextTrackCue): Deleted.
1391         (WebCore::TextTrackCue::setStartTime): Removed ExceptionCode&
1392         since the exceptions were for non-finite values, but this is
1393         now handled by the bindings.
1394         (WebCore::TextTrackCue::setEndTime): Ditto.
1395         * html/track/TextTrackCue.h: Updated for the above.
1396         * html/track/TextTrackCue.idl: Removed SetterMayThrowLegacyException
1397         and made startTime and endTime be double rather than unrestricted double.
1398
1399         * html/track/TextTrackCueGeneric.cpp:
1400         (WebCore::TextTrackCueGenericBoxElement::applyCSSProperties):
1401         Use a reference instead of a pointer.
1402         (WebCore::TextTrackCueGeneric::TextTrackCueGeneric): Initialize
1403         m_defaultPosition in the class definition instead of here.
1404         (WebCore::TextTrackCueGeneric::createDisplayTree): Return a Ref.
1405         (WebCore::TextTrackCueGeneric::setLine): Use ExceptionOr.
1406         (WebCore::TextTrackCueGeneric::setPosition): Ditto.
1407         (WebCore::TextTrackCueGeneric::setFontSize): Updated since
1408         displayTreeInternal() now returns a reference.
1409         * html/track/TextTrackCueGeneric.h: Updated for above changes.
1410         Also fixed some arguument types and made some more things private.
1411
1412         * html/track/VTTCue.cpp:
1413         (WebCore::VTTCue::createDisplayTree): Return a Ref.
1414         (WebCore::VTTCue::displayTreeInternal): Return a reference.
1415         (WebCore::VTTCue::setVertical): Use ExceptionOr.
1416         (WebCore::VTTCue::setLine): Ditto.
1417         (WebCore::VTTCue::setPosition): Ditto.
1418         (WebCore::VTTCue::setSize): Ditto.
1419         (WebCore::VTTCue::setAlign): Ditto.
1420         (WebCore::VTTCue::getDisplayTree): Return a reference.
1421         (WebCore::VTTCue::removeDisplayTree): Updated since
1422         displayTreeInternal returns a reference.
1423         (WebCore::VTTCue::setFontSize): Ditto.
1424         * html/track/VTTCue.h: Updated for the above.
1425         * html/track/VTTCue.idl: Use non-legacy exceptions and also
1426         restricted doubles.
1427
1428         * html/track/VTTRegion.cpp:
1429         (WebCore::VTTRegion::VTTRegion): Moved default values all into
1430         the class definition.
1431         (WebCore::VTTRegion::setWidth): Removed the check for non-finite
1432         since the bindings now handle that. Use ExcpetionOr.
1433         (WebCore::VTTRegion::setHeight): Ditto.
1434         (WebCore::VTTRegion::setRegionAnchorX): Ditto.
1435         (WebCore::VTTRegion::setRegionAnchorY): Ditto.
1436         (WebCore::VTTRegion::setViewportAnchorX): Ditto.
1437         (WebCore::VTTRegion::setViewportAnchorY): Ditto.
1438         (WebCore::upKeyword): Added. Shared by the code below.
1439         (WebCore::VTTRegion::scroll): Rewrote to be simpler.
1440         (WebCore::VTTRegion::setScroll): Rewrote to be simpler.
1441         (WebCore::VTTRegion::updateParametersFromRegion): Read and
1442         write data members directly to avoid awkward code that is otherwise
1443         required just to copy from one object to the other. Also take a
1444         const& instead of a pointer for the thing to update from.
1445         (WebCore::VTTRegion::parseSettingValue): Use upKeyword.
1446         (WebCore::VTTRegion::appendTextTrackCueBox): Take a Ref&&.
1447         (WebCore::VTTRegion::getDisplayTree): Do the downcast to Document
1448         here instead of using the helper function.
1449         (WebCore::VTTRegion::prepareRegionDisplayTree): Ditto.
1450         * html/track/VTTRegion.h: Updated for the above.
1451         * html/track/VTTRegion.idl: Use non-legacy exceptions and also
1452         use restricted dobules, not unrestricted.
1453
1454 2016-10-22  Chris Dumez  <cdumez@apple.com>
1455
1456         WebGLRenderingContextBase.texImage2D() should use a union instead of overloading
1457         https://bugs.webkit.org/show_bug.cgi?id=163856
1458
1459         Reviewed by Darin Adler.
1460
1461         WebGLRenderingContextBase.texImage2D() should use a union instead of overloading:
1462         - https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14
1463
1464         * html/canvas/WebGLRenderingContextBase.cpp:
1465         (WebCore::WebGLRenderingContextBase::texImage2D):
1466         * html/canvas/WebGLRenderingContextBase.h:
1467         * html/canvas/WebGLRenderingContextBase.idl:
1468
1469 2016-10-22  Antti Koivisto  <antti@apple.com>
1470
1471         REGRESSION(r207669): Dromaeo/jslib-style-jquery.html regressed >20%
1472         https://bugs.webkit.org/show_bug.cgi?id=163851
1473
1474         Reviewed by Darin Adler.
1475
1476         The test calls Scope::flushPendingUpdate a lot and nothing ever happens there.
1477
1478         Add a separate invalidity bit for descendant scopes and inline the fast path.
1479
1480         * style/StyleScope.cpp:
1481         (WebCore::Style::Scope::flushPendingSelfUpdate):
1482         (WebCore::Style::Scope::flushPendingDescendantUpdates):
1483         (WebCore::Style::Scope::scheduleUpdate):
1484         (WebCore::Style::Scope::flushPendingUpdate): Deleted.
1485         * style/StyleScope.h:
1486         (WebCore::Style::Scope::hasPendingUpdate):
1487         (WebCore::Style::Scope::flushPendingUpdate):
1488
1489 2016-10-22  Darin Adler  <darin@apple.com>
1490
1491         Move SVG from ExceptionCode to Exception
1492         https://bugs.webkit.org/show_bug.cgi?id=163837
1493
1494         Reviewed by Chris Dumez.
1495
1496         * WebCore.xcodeproj/project.pbxproj: Added SVGGraphicsElement.idl.
1497
1498         * bindings/js/JSSVGLengthCustom.cpp:
1499         (WebCore::JSSVGLength::value): Use toJSNumber.
1500         (WebCore::JSSVGLength::setValue): Use propagateException.
1501         (WebCore::JSSVGLength::convertToSpecifiedUnits): Ditto.
1502
1503         * bindings/scripts/CodeGeneratorJS.pm:
1504         (GenerateImplementation): Properly handle SetterMayThrowException
1505         in the special case for SVG setters.
1506
1507         * rendering/style/SVGRenderStyle.h:
1508         (WebCore::SVGRenderStyle::initialBaselineShiftValue): Removed
1509         ASSERT_NO_EXCEPTION, no longer needed.
1510         (WebCore::SVGRenderStyle::initialKerning): Ditto.
1511
1512         * svg/SVGAltGlyphElement.cpp:
1513         (WebCore::SVGAltGlyphElement::setGlyphRef): Use ExceptionOr.
1514         (WebCore::SVGAltGlyphElement::setFormat): Ditto.
1515         (WebCore::SVGAltGlyphElement::hasValidGlyphElements): Tweaked a bit.
1516         * svg/SVGAltGlyphElement.h: Updated for above changes.
1517         * svg/SVGAltGlyphElement.idl: Use non-legacy exceptions.
1518
1519         * svg/SVGAngle.cpp:
1520         (WebCore::SVGAngle::valueAsString): Removed unneeded String globals.
1521         (WebCore::parseAngleType): Rewrote to be simpler and more direct.
1522         (WebCore::SVGAngle::setValueAsString): Use ExceptionOr.
1523         (WebCore::SVGAngle::newValueSpecifiedUnits): Ditto.
1524         (WebCore::SVGAngle::convertToSpecifiedUnits): Ditto.
1525         * svg/SVGAngle.h: Updated for above changes. Initialized data members
1526         here in the class definite and removed constructor; default now works.
1527         * svg/SVGAngle.idl: Use non-legacy exceptions.
1528
1529         * svg/SVGAnimateElementBase.cpp:
1530         (WebCore::SVGAnimateElementBase::calculateAnimatedValue): Update since
1531         CalcMode is now an enum class.
1532         * svg/SVGAnimateMotionElement.cpp:
1533         (WebCore::SVGAnimateMotionElement::SVGAnimateMotionElement): Ditto.
1534
1535         * svg/SVGAnimateTransformElement.cpp:
1536         (WebCore::SVGAnimateTransformElement::hasValidAttributeType): Update
1537         since AttributeType is now an enum class.
1538
1539         * svg/SVGAnimatedAngle.cpp:
1540         (WebCore::SVGAnimatedAngleAnimator::calculateDistance): Removed
1541         ASSERT_NO_EXCEPTION, no longer needed.
1542
1543         * svg/SVGAnimatedBoolean.idl: Use non-legacy exception.
1544         * svg/SVGAnimatedEnumeration.idl: Ditto.
1545         * svg/SVGAnimatedInteger.idl: Ditto.
1546
1547         * svg/SVGAnimatedLength.cpp:
1548         (WebCore::sharedSVGLength): Deleted.
1549         (WebCore::SVGAnimatedLengthAnimator::addAnimatedTypes): Removed
1550         ASSERT_NO_EXCEPTION, no longer needed.
1551         (WebCore::parseLengthFromString): Ditto. Also rewrote to not use
1552         a shared SVGLength; no benefit to doing that.
1553         (WebCore::SVGAnimatedLengthAnimator::calculateAnimatedValue): Ditto.
1554         * svg/SVGAnimatedLengthList.cpp:
1555         (WebCore::SVGAnimatedLengthListAnimator::addAnimatedTypes): Ditto.
1556         (WebCore::SVGAnimatedLengthListAnimator::calculateAnimatedValue): Ditto.
1557
1558         * svg/SVGAnimatedNumber.idl: Use non-legacy exception.
1559         * svg/SVGAnimatedString.idl: Ditto.
1560
1561         * svg/SVGAnimatedType.cpp:
1562         (WebCore::SVGAnimatedType::setValueAsString): Updated since
1563         setValueAsString now uses ExceptionOr.
1564
1565         * svg/SVGAnimationElement.cpp:
1566         (WebCore::SVGAnimationElement::SVGAnimationElement): Initialized scalars
1567         in the class definition instead of here.
1568         (WebCore::SVGAnimationElement::getSimpleDuration): Removed uneeded ExceptionCode&.
1569         (WebCore::SVGAnimationElement::setCalcMode): Updated since CalcMode is now an enum class.
1570         (WebCore::SVGAnimationElement::setAttributeType): Updated since AttributeType
1571         is now an enum class.
1572         (WebCore::SVGAnimationElement::shouldApplyAnimation): Ditto.
1573         (WebCore::SVGAnimationElement::calculateKeyTimesForCalcModePaced): Ditto.
1574         (WebCore::SVGAnimationElement::calculatePercentForSpline): Ditto.
1575         (WebCore::SVGAnimationElement::calculatePercentFromKeyPoints): Ditto.
1576         (WebCore::SVGAnimationElement::calculatePercentForFromTo): Ditto.
1577         (WebCore::SVGAnimationElement::currentValuesFromKeyPoints): Ditto.
1578         (WebCore::SVGAnimationElement::currentValuesForValuesAnimation): Ditto.
1579         (WebCore::SVGAnimationElement::startedActiveInterval): Ditto.
1580         (WebCore::SVGAnimationElement::updateAnimation): Ditto.
1581         (WebCore::SVGAnimationElement::checkInvalidCSSAttributeType): Ditto.
1582
1583         * svg/SVGAnimationElement.h: Changed CalcMode into an enum class.
1584         Updated for above changes.
1585
1586         * svg/SVGAnimationElement.idl: Removed MayThrowLegacyException from
1587         getSimpleDuration.
1588
1589         * svg/SVGColor.cpp:
1590         (WebCore::SVGColor::SVGColor): Updated to take scalar in the straightforward
1591         manner instead of constt SVGColorType&.
1592         (WebCore::SVGColor::setRGBColor): Use ExceptionOr.
1593         (WebCore::SVGColor::setRGBColorICCColor): Ditto.
1594         (WebCore::SVGColor::setColor): Ditto.
1595         * svg/SVGColor.h: Updated for above changes. Removed unneeded destructor.
1596         * svg/SVGColor.idl: Use non-legacy exceptions.
1597
1598         * svg/SVGGlyphRefElement.cpp:
1599         (WebCore::SVGGlyphRefElement::SVGGlyphRefElement): Initialize data members
1600         in class definition, not here.
1601         (WebCore::parseFloat): Added helper. Used in parseAttribute.
1602         (WebCore::SVGGlyphRefElement::parseAttribute): Updated to use parseFloat helper.
1603         (WebCore::SVGGlyphRefElement::glyphRef): Deleted.
1604         (WebCore::SVGGlyphRefElement::setGlyphRef): Deleted.
1605         (WebCore::SVGGlyphRefElement::setX): Removed unused Exception& argument.
1606         (WebCore::SVGGlyphRefElement::setY): Ditto.
1607         (WebCore::SVGGlyphRefElement::setDx): Ditto.
1608         (WebCore::SVGGlyphRefElement::setDy): Ditto.
1609         * svg/SVGGlyphRefElement.h: Updated for above changes.
1610         * svg/SVGGlyphRefElement.idl: Use Reflect on glyphRef. Removed incorrect
1611         SetterMayThrowLegacyException attributes for x, y, dx, and dy. Longer term
1612         it might be nice to use [Reflect] on these too.
1613
1614         * svg/SVGGraphicsElement.idl: Use non-legacy exception.
1615
1616         * svg/SVGLength.cpp:
1617         (WebCore::parseLengthType): Changed argument type since caller does not
1618         need to know how many characters are consumed.
1619         (WebCore::SVGLength::SVGLength): Removed IGNORE_EXCEPTION and ASSERT_NO_EXCEPTION.
1620         Also removed the copy constructor, letting the compiler generate the default.
1621         (WebCore::SVGLength::setValueAsString): Use ExceptionOr.
1622         (WebCore::SVGLength::construct): Updated since setValueAsString uses ExceptionOr.
1623         (WebCore::SVGLength::value): Ditto.
1624         (WebCore::SVGLength::valueForBindings): Use ExceptionOr. Also renamed to
1625         disambiguate with the version used outside of bindings.
1626         (WebCore::SVGLength::setValue): Use ExceptionOr.
1627         (WebCore::SVGLength::newValueSpecifiedUnits): Ditto.
1628         (WebCore::SVGLength::convertToSpecifiedUnits): Ditto.
1629         (WebCore::SVGLength::fromCSSPrimitiveValue): Updated since newValueSpecifiedUnits
1630         uses ExceptionOr.
1631         (WebCore::SVGLength::lengthModeForAnimatedLengthAttribute): Rewrote map generation
1632         code to be more efficient and not unrolled. Only do one hash table lookup.
1633         * svg/SVGLength.h: Updated for above changes.
1634         * svg/SVGLength.idl: Use non-legacy exceptions.
1635
1636         * svg/SVGLengthContext.cpp:
1637         (WebCore::SVGLengthContext::valueForLength): Update since function
1638         uses ExceptionOr.
1639         (WebCore::SVGLengthContext::convertValueToUserUnits): Use ExceptionOr.
1640         (WebCore::SVGLengthContext::convertValueFromUserUnits): Ditto.
1641         (WebCore::SVGLengthContext::convertValueFromUserUnitsToPercentage): Ditto.
1642         (WebCore::SVGLengthContext::convertValueFromPercentageToUserUnits): Ditto.
1643         (WebCore::SVGLengthContext::convertValueFromUserUnitsToEMS): Ditto.
1644         (WebCore::SVGLengthContext::convertValueFromEMSToUserUnits): Ditto.
1645         (WebCore::SVGLengthContext::convertValueFromUserUnitsToEXS): Ditto.
1646         (WebCore::SVGLengthContext::convertValueFromEXSToUserUnits): Ditto.
1647         * svg/SVGLengthContext.h: Updatedfor above changes.
1648
1649         * svg/SVGLengthList.cpp:
1650         (WebCore::SVGLengthList::parse): Updated since setValueAsString uses
1651         ExceptionOr now.
1652         * svg/SVGLengthList.h: Removed unneeded constructor.
1653         * svg/SVGLengthList.idl: Use non-legacy exceptions.
1654
1655         * svg/SVGLocatable.cpp:
1656         (WebCore::SVGLocatable::getTransformToElement): Use ExceptionOr.
1657         * svg/SVGLocatable.h: Updated for above change.
1658
1659         * svg/SVGMarkerElement.h:
1660         (WebCore::SVGPropertyTraits<SVGMarkerOrientType>::fromString):
1661         Updated since setValueAsString uses ExceptionOr now.
1662
1663         * svg/SVGMatrix.h: Use ExceptionOr.
1664         * svg/SVGMatrix.idl: Use non-legacy exceptions.
1665
1666         * svg/SVGNumberList.h: Removed unneeded constructor.
1667         * svg/SVGNumberList.idl: Use non-legacy exceptions.
1668
1669         * svg/SVGPaint.cpp:
1670         (WebCore::SVGPaint::setPaint): Use ExceptionOr.
1671         * svg/SVGPaint.h: Updated for above chagne.
1672         * svg/SVGPaint.idl: Use non-legacy exception.
1673
1674         * svg/SVGPathSegList.h: Tweaked a bit.
1675         * svg/SVGPathSegList.idl: Use non-legacy exceptions.
1676
1677         * svg/SVGPointList.h: Removed unneeded constructor.
1678         * svg/SVGPointList.idl: Use non-legacy exceptions.
1679
1680         * svg/SVGPreserveAspectRatio.cpp:
1681         (WebCore::SVGPreserveAspectRatio::setAlign): Use ExceptionOr.
1682         (WebCore::SVGPreserveAspectRatio::setMeetOrSlice): Ditto.
1683         * svg/SVGPreserveAspectRatio.h: Updated for above changes.
1684         * svg/SVGPreserveAspectRatio.idl: Use non-legacy exceptions.
1685
1686         * svg/SVGSVGElement.cpp:
1687         (WebCore::SVGSVGElement::currentView): Pass a reference.
1688
1689         * svg/SVGStringList.h: Tweaked a bit.
1690         * svg/SVGStringList.idl: Use non-legacy exceptions.
1691
1692         * svg/SVGStyleElement.cpp:
1693         (WebCore::SVGStyleElement::setType): Removed unneeded ExceptionCode&.
1694         (WebCore::SVGStyleElement::setMedia): Ditto.
1695         (WebCore::SVGStyleElement::setTitle): Deleted.
1696         * svg/SVGStyleElement.h: Updated for above changes, and made the title
1697         function override be private.
1698         * svg/SVGStyleElement.idl: Use Reflect for title. Removed unneeded
1699         SetterMayThrowLegacyException on all attributes.
1700
1701         * svg/SVGTextContentElement.cpp:
1702         (WebCore::SVGTextContentElement::textLengthAnimated): Removed
1703         ASSERT_NO_EXCEPTION, won't work any more.
1704         (WebCore::SVGTextContentElement::getSubStringLength): Use ExceptionOr.
1705         Also remove redundant call to updateLayoutIgnorePendingStylesheets,
1706         called by getNumberOfChars.
1707         (WebCore::SVGTextContentElement::getStartPositionOfChar): Ditto.
1708         (WebCore::SVGTextContentElement::getEndPositionOfChar): Ditto.
1709         (WebCore::SVGTextContentElement::getExtentOfChar): Ditto.
1710         (WebCore::SVGTextContentElement::getRotationOfChar): Ditto.
1711         (WebCore::SVGTextContentElement::selectSubString): Ditto.
1712         * svg/SVGTextContentElement.h: Updated for above changes.
1713         * svg/SVGTextContentElement.idl: Use non-legacy exceptions.
1714
1715         * svg/SVGTransformList.h: Removed unneeded constructor.
1716         * svg/SVGTransformList.idl: Use non-legacy exceptions.
1717
1718         * svg/SVGViewSpec.cpp:
1719         (WebCore::SVGViewSpec::SVGViewSpec): Updated to take a reference.
1720         (WebCore::SVGViewSpec::setZoomAndPan): Use ExceptionOr.
1721         (WebCore::SVGViewSpec::setTransformString): Deleted.
1722         (WebCore::SVGViewSpec::viewBoxString): Use m_viewBox directly.
1723         (WebCore::SVGViewSpec::preserveAspectRatioString): Use
1724         m_preserveAspectRatio directly.
1725         (WebCore::SVGViewSpec::viewTarget): Use is<SVGElement>.
1726         (WebCore::SVGViewSpec::lookupOrCreateViewBoxWrapper): Use
1727         m_contextElement directly.
1728         (WebCore::SVGViewSpec::lookupOrCreatePreserveAspectRatioWrapper):
1729         Ditto.
1730         (WebCore::SVGViewSpec::lookupOrCreateTransformWrapper): Ditto.
1731         (WebCore::SVGViewSpec::parseViewSpec): Set m_viewTargetString directly.
1732         * svg/SVGViewSpec.h: Updated for above changes. Removed unneeded virtual
1733         destructor, unneeded using for ref/deref, unused functions including
1734         setTransformString, setViewTargetString, non-exception setZoomAndPan,
1735         contextElement, viewBoxBaseValue, and preserveAspectRatioBaseValue.
1736         * svg/SVGViewSpec.idl: Use non-legacy exceptions. Also specify
1737         ImplementationLacksVTable.
1738
1739         * svg/properties/SVGAnimatedEnumerationPropertyTearOff.h:
1740         Use ExceptionOr.
1741         * svg/properties/SVGAnimatedStaticPropertyTearOff.h: Ditto.
1742         * svg/properties/SVGListProperty.h: Ditto.
1743         * svg/properties/SVGListPropertyTearOff.h: Ditto.
1744          * svg/properties/SVGPathSegListPropertyTearOff.cpp:
1745         (WebCore::SVGPathSegListPropertyTearOff::clear): Ditto.
1746         (WebCore::SVGPathSegListPropertyTearOff::getItem): Ditto.
1747         (WebCore::SVGPathSegListPropertyTearOff::replaceItem): Ditto.
1748         (WebCore::SVGPathSegListPropertyTearOff::removeItem): Ditto.
1749         * svg/properties/SVGPathSegListPropertyTearOff.h: Ditto.
1750         * svg/properties/SVGPropertyTearOff.h: Ditto. Also added an overload
1751         of create that knows how to deal with exceptions.
1752         * svg/properties/SVGStaticListPropertyTearOff.h: Ditto.
1753         * svg/properties/SVGTransformListPropertyTearOff.h: Ditto.
1754
1755 2016-10-22  Chris Dumez  <cdumez@apple.com>
1756
1757         WebGLRenderingContextBase.bufferData() should use a union instead of overloading
1758         https://bugs.webkit.org/show_bug.cgi?id=163795
1759
1760         Reviewed by Darin Adler.
1761
1762         WebGLRenderingContextBase.bufferData() / bufferSubData() should use a union
1763         instead of overloading:
1764         - https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14
1765
1766         No new tests, no web-exposed behavior change.
1767
1768         * bindings/js/JSDOMConvert.h:
1769         (WebCore::Converter<IDLInterface<T>>::convert):
1770         * bindings/scripts/CodeGeneratorJS.pm:
1771         (GenerateHeader):
1772         * bindings/scripts/test/JS/JSInterfaceName.h:
1773         * bindings/scripts/test/JS/JSTestActiveDOMObject.h:
1774         * bindings/scripts/test/JS/JSTestCEReactions.h:
1775         * bindings/scripts/test/JS/JSTestCEReactionsStringifier.h:
1776         * bindings/scripts/test/JS/JSTestClassWithJSBuiltinConstructor.h:
1777         * bindings/scripts/test/JS/JSTestCustomConstructorWithNoInterfaceObject.h:
1778         * bindings/scripts/test/JS/JSTestCustomNamedGetter.h:
1779         * bindings/scripts/test/JS/JSTestEventConstructor.h:
1780         * bindings/scripts/test/JS/JSTestEventTarget.h:
1781         * bindings/scripts/test/JS/JSTestException.h:
1782         * bindings/scripts/test/JS/JSTestGenerateIsReachable.h:
1783         * bindings/scripts/test/JS/JSTestGlobalObject.h:
1784         * bindings/scripts/test/JS/JSTestInterface.h:
1785         * bindings/scripts/test/JS/JSTestIterable.h:
1786         * bindings/scripts/test/JS/JSTestMediaQueryListListener.h:
1787         * bindings/scripts/test/JS/JSTestNamedConstructor.h:
1788         * bindings/scripts/test/JS/JSTestNode.h:
1789         * bindings/scripts/test/JS/JSTestNondeterministic.h:
1790         * bindings/scripts/test/JS/JSTestObj.h:
1791         * bindings/scripts/test/JS/JSTestOverloadedConstructors.h:
1792         * bindings/scripts/test/JS/JSTestOverloadedConstructorsWithSequence.h:
1793         * bindings/scripts/test/JS/JSTestOverrideBuiltins.h:
1794         * bindings/scripts/test/JS/JSTestSerialization.h:
1795         * bindings/scripts/test/JS/JSTestSerializedScriptValueInterface.h:
1796         * bindings/scripts/test/JS/JSTestTypedefs.h:
1797         * bindings/scripts/test/JS/JSattribute.h:
1798         * bindings/scripts/test/JS/JSreadonly.h:
1799         * html/canvas/WebGL2RenderingContext.cpp:
1800         (WebCore::WebGL2RenderingContext::bufferData):
1801         (WebCore::WebGL2RenderingContext::bufferSubData):
1802         * html/canvas/WebGLRenderingContextBase.cpp:
1803         (WebCore::WebGLRenderingContextBase::bufferData):
1804         (WebCore::WebGLRenderingContextBase::bufferSubData):
1805         * html/canvas/WebGLRenderingContextBase.h:
1806         * html/canvas/WebGLRenderingContextBase.idl:
1807
1808 2016-10-22  Darin Adler  <darin@apple.com>
1809
1810         [Cocoa] REGRESSION (r204508): Crash in init_WebCreateFragment when pasting (seen in multiple apps using legacy WebKit)
1811         https://bugs.webkit.org/show_bug.cgi?id=163839
1812
1813         Reviewed by Dan Bernstein.
1814
1815         * editing/cocoa/EditorCocoa.mm: Use the appropriate SOFT_LINK macros to find
1816         the WebKitLegacy platform in the correct location for iOS and macOS.
1817
1818 2016-10-22  Nael Ouedraogo  <nael.ouedraogo@crf.canon.fr>
1819
1820         Bindings error message for missing required dictionary member should be more explicit
1821         https://bugs.webkit.org/show_bug.cgi?id=163665
1822
1823         Reviewed by Darin Adler.
1824
1825         Add throwRequiredMemberTypeError function to throw a TypeError exception with an error
1826         message indicating the missing required member.
1827
1828         No new test required, rebase existing tests.
1829
1830         * bindings/js/JSDOMBinding.cpp:
1831         (WebCore::throwRequiredMemberTypeError):
1832         * bindings/js/JSDOMBinding.h:
1833         * bindings/scripts/CodeGeneratorJS.pm:
1834         (GenerateDictionaryImplementationContent):
1835         * bindings/scripts/test/JS/JSTestObj.cpp:
1836         (WebCore::convertDictionary<TestObj::DictionaryThatShouldNotTolerateNull>):
1837
1838 2016-10-22  Ryosuke Niwa  <rniwa@webkit.org>
1839
1840         Upgrading custom element should enqueue attributeChanged and connected callbacks
1841         https://bugs.webkit.org/show_bug.cgi?id=163840
1842
1843         Reviewed by Darin Adler.
1844
1845         When upgrading a custom element, enqueue attributeChanged and connectedCallbacks as needed as specified
1846         in step 3 and 4 of: https://html.spec.whatwg.org/multipage/scripting.html#concept-upgrade-an-element
1847
1848         Test: fast/custom-elements/upgrading-enqueue-reactions.html
1849
1850         * bindings/js/JSCustomElementInterface.cpp:
1851         (WebCore::JSCustomElementInterface::upgradeElement): Enqueue 
1852         * dom/CustomElementReactionQueue.cpp:
1853         (WebCore::CustomElementReactionQueueItem::invoke): Don't invoke callbacks when the custom element had
1854         failed to upgrade.
1855         (WebCore::CustomElementReactionQueue::enqueuePostUpgradeReactions): Added.
1856         (WebCore::CustomElementReactionQueue::invokeAll): Upgrading a custom element may enqueue more reactions.
1857         Keep invoking reactions until the queue becomes empty.
1858         * dom/CustomElementReactionQueue.h:
1859         * dom/Range.idl: Added a forgotten CEReactions here.
1860
1861 2016-10-21  David Kilzer  <ddkilzer@apple.com>
1862
1863         Bug 163762: IntSize::area() should used checked arithmetic
1864         <https://webkit.org/b/163762>
1865
1866         Reviewed by Darin Adler.
1867
1868         No new tests since no change in nominal behavior.
1869
1870         * platform/graphics/IntSize.h:
1871         (WebCore::IntSize::area): Change to return a
1872         Checked<unsigned, T> value. Use WTF:: namespace to avoid
1873         including another header.
1874
1875         * platform/graphics/IntRect.h:
1876         (WebCore::IntRect::area): Ditto.
1877
1878         The remaining changes are to use the Checked<unsigned> return
1879         value of IntSize::area() and IntRect::area() correctly in
1880         context, in addition to items noted below.
1881
1882         * html/HTMLPlugInImageElement.cpp:
1883         (WebCore::HTMLPlugInImageElement::isTopLevelFullPagePlugin):
1884         Declare contentWidth and contentHeight as float values to
1885         prevent overflow when computing the area, and to make the
1886         inequality comparison in the return statement uses the same type
1887         for both sides.
1888         * html/ImageData.cpp:
1889         (WebCore::ImageData::ImageData):
1890         * html/MediaElementSession.cpp:
1891         (WebCore::isElementRectMostlyInMainFrame):
1892         * platform/graphics/ImageBackingStore.h:
1893         (WebCore::ImageBackingStore::setSize): Restructure logic to
1894         compute area only once.
1895         (WebCore::ImageBackingStore::clear):
1896         * platform/graphics/ImageFrame.h:
1897         (WebCore::ImageFrame::frameBytes):
1898         * platform/graphics/ImageSource.cpp:
1899         (WebCore::ImageSource::maximumSubsamplingLevel):
1900         * platform/graphics/ca/LayerPool.cpp:
1901         (WebCore::LayerPool::backingStoreBytesForSize):
1902         * platform/graphics/cg/ImageDecoderCG.cpp:
1903         (WebCore::ImageDecoder::frameBytesAtIndex):
1904         * platform/graphics/filters/FEGaussianBlur.cpp:
1905         (WebCore::FEGaussianBlur::platformApplySoftware):
1906         * platform/graphics/filters/FilterEffect.cpp:
1907         (WebCore::FilterEffect::asUnmultipliedImage):
1908         (WebCore::FilterEffect::asPremultipliedImage):
1909         (WebCore::FilterEffect::copyUnmultipliedImage):
1910         (WebCore::FilterEffect::copyPremultipliedImage):
1911         (WebCore::FilterEffect::createUnmultipliedImageResult):
1912         (WebCore::FilterEffect::createPremultipliedImageResult):
1913         * platform/graphics/win/ImageBufferDataDirect2D.cpp:
1914         (WebCore::ImageBufferData::getData): Update overflow check,
1915         rename local variable to numBytes, and compute numBytes once.
1916         * platform/graphics/win/ImageDecoderDirect2D.cpp:
1917         (WebCore::ImageDecoder::frameBytesAtIndex):
1918         * platform/image-decoders/ImageDecoder.cpp:
1919         (WebCore::ImageDecoder::frameBytesAtIndex):
1920         * platform/ios/LegacyTileLayerPool.mm:
1921         (WebCore::LegacyTileLayerPool::bytesBackingLayerWithPixelSize):
1922         * rendering/RenderLayerCompositor.cpp:
1923         (WebCore::RenderLayerCompositor::requiresCompositingForCanvas):
1924         * rendering/shapes/Shape.cpp:
1925         (WebCore::Shape::createRasterShape):
1926
1927 2016-10-21  Gavin Barraclough  <barraclough@apple.com>
1928
1929         WebPageProxy should not need PageActivityState
1930         https://bugs.webkit.org/show_bug.cgi?id=163821
1931
1932         Reviewed by Geoff Garen.
1933
1934         The PageActivityState is currently plumbed back from WebCore up to the UI process, to
1935         determine whether to enabled process suppression. However the information it contains
1936         (whether a page load is ongoing, whether audio is playing) is already available via
1937         other means. Remove this use of PageActivityState.
1938
1939         * html/HTMLMediaElement.cpp:
1940         (WebCore::HTMLMediaElement::mediaState):
1941             - Fix a bug in how we compute IsPlayingAudio - if the volume of the MediaElement is
1942               set to zero, then audio is not playing (we were already checking muted).
1943         * page/ChromeClient.h:
1944             - removed setPageActivityState
1945         * page/Page.cpp:
1946         (WebCore::Page::setPageActivityState): Deleted.
1947             - setPageActivityState -> pageActivityStateChanged, remove call to ChromeClient
1948         * page/Page.h:
1949         (WebCore::Page::pageActivityStateChanged):
1950             - setPageActivityState -> pageActivityStateChanged
1951         * page/PageThrottler.cpp:
1952         (WebCore::PageThrottler::setActivityFlag):
1953             - setPageActivityState -> pageActivityStateChanged
1954
1955 2016-10-21  Chris Dumez  <cdumez@apple.com>
1956
1957         [Web ID] Overload resolution is wrong if one of the types is a nullable union
1958         https://bugs.webkit.org/show_bug.cgi?id=163816
1959
1960         Reviewed by Alex Christensen.
1961
1962         Overload resolution was wrong if one of the types was a nullable union. This
1963         is because we never considered the union type itself, only its subtypes.
1964         Therefore, we checked if any of the union's subtypes were nullable but we
1965         failed to check if the union itself was nullable.
1966
1967         See:
1968         - https://heycam.github.io/webidl/#es-overloads (Step 11.3.)
1969
1970         No new tests, extended bindings tests.
1971
1972         * bindings/scripts/CodeGeneratorJS.pm:
1973         (GetOverloadThatMatchesIgnoringUnionSubtypes):
1974         (GenerateOverloadedFunctionOrConstructor):
1975         * bindings/scripts/test/JS/JSTestObj.cpp:
1976         (WebCore::jsTestObjPrototypeFunctionOverloadWithNullableUnion1):
1977         (WebCore::jsTestObjPrototypeFunctionOverloadWithNullableUnion1Caller):
1978         (WebCore::jsTestObjPrototypeFunctionOverloadWithNullableUnion2):
1979         (WebCore::jsTestObjPrototypeFunctionOverloadWithNullableUnion2Caller):
1980         (WebCore::jsTestObjPrototypeFunctionOverloadWithNullableUnion):
1981         (WebCore::jsTestObjPrototypeFunctionOverloadWithOptionalUnion1):
1982         (WebCore::jsTestObjPrototypeFunctionOverloadWithOptionalUnion1Caller):
1983         (WebCore::jsTestObjPrototypeFunctionOverloadWithOptionalUnion2):
1984         (WebCore::jsTestObjPrototypeFunctionOverloadWithOptionalUnion2Caller):
1985         (WebCore::jsTestObjPrototypeFunctionOverloadWithOptionalUnion):
1986         * bindings/scripts/test/TestObj.idl:
1987
1988 2016-10-21  Eric Carlson  <eric.carlson@apple.com>
1989
1990         [MediaStream] Dynamically generate media capture sandbox extensions
1991         https://bugs.webkit.org/show_bug.cgi?id=154861
1992         <rdar://problem/24909411>
1993
1994         Reviewed by Tim Horton.
1995
1996         No new tests, some of these changes are covered by existing tests and some can only be tested
1997         with physical capture devices.
1998
1999         * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.mm: AVSampleBufferAudioRenderer
2000           and AVSampleBufferRenderSynchronizer are now declared in AVFoundationSPI.h.
2001
2002         * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.h:
2003         * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.mm:
2004         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::MediaPlayerPrivateMediaStreamAVFObjC): Initialize 
2005           AVSampleBufferRenderSynchronizer.
2006         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::isAvailable): Fail if AVSampleBufferRenderSynchronizer
2007           isn't available.
2008         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::enqueueAudioSampleBufferFromTrack): Take a MediaSample&
2009           instead of a PlatformSample&.
2010         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::enqueueVideoSampleBufferFromTrack): Ditto.
2011         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::ensureLayer): Add the sample buffer display 
2012           later to the synchronizer.
2013         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::destroyLayer): Remove the sample buffer display 
2014           later from the synchronizer.
2015         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::play): Start the synchronizer.
2016         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::pause): Stash the current clock time in 
2017           m_pausedTime, but leave the clock running. Pause the synchronizer.
2018         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::currentMediaTime): Return the clock time
2019           when playing, m_pausedTime time when paused because we leave the clock running forever.
2020         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::sampleBufferUpdated):
2021
2022         * platform/graphics/avfoundation/objc/SourceBufferPrivateAVFObjC.mm: AVSampleBufferAudioRenderer
2023           is now declared in AVFoundationSPI.h.
2024
2025         * platform/spi/mac/AVFoundationSPI.h: Add AVSampleBufferAudioRenderer and AVSampleBufferRenderSynchronizer.
2026
2027 2016-10-21  Commit Queue  <commit-queue@webkit.org>
2028
2029         Unreviewed, rolling out r207582.
2030         https://bugs.webkit.org/show_bug.cgi?id=163819
2031
2032         Not quite ready rdar://problem/28897179 (Requested by
2033         alexchristensen on #webkit).
2034
2035         Reverted changeset:
2036
2037         "Re-enable URLParser for non-Safari Cocoa apps after r207321"
2038         https://bugs.webkit.org/show_bug.cgi?id=163690
2039         http://trac.webkit.org/changeset/207582
2040
2041 2016-10-21  Gavin Barraclough  <barraclough@apple.com>
2042
2043         WebPage should take UserActivity directly for user input
2044         https://bugs.webkit.org/show_bug.cgi?id=163813
2045
2046         Reviewed by Anders Carlsson.
2047
2048         When we receive mouse/keyboard events in a page, we want to prevent AppNap. We currently do so
2049         via the PageThrottler. This patch is to just make the WebPage drive the UserActivity directly.
2050
2051         Two reasons to do so: (1) to cleanup & simplify for further refactoring. (2) The current code
2052         isn't really achieving the desired effect. The page setting the flag in the throttler to get
2053         the activity to be set is now a less effective way of achieving this goal, since the
2054         PageActivityState bounces back across to the UI process & then messages back to the WebContent
2055         process to take the UserActivity. These extra hops defeat the purpose of making sure the boost
2056         from the initial message isn't lost.
2057
2058         * page/PageThrottler.cpp:
2059         (WebCore::PageThrottler::PageThrottler):
2060         (WebCore::m_userInputHysteresis): Deleted.
2061         * page/PageThrottler.h:
2062         (WebCore::PageThrottler::didReceiveUserInput): Deleted.
2063             - removed PageActivityState::UserInputActivity, didReceiveUserInput, m_userInputHysteresis.
2064
2065 2016-10-21  Wenson Hsieh  <wenson_hsieh@apple.com>
2066
2067         Support (insertFrom|deleteBy)Composition and (insert|delete)CompositionText inputTypes for InputEvents
2068         https://bugs.webkit.org/show_bug.cgi?id=163460
2069         <rdar://problem/28784142>
2070
2071         Reviewed by Darin Adler.
2072
2073         Adds basic support for the composition inputTypes in the InputEvent spec. See w3.org/TR/input-events,
2074         github.com/w3c/input-events/issues/41 and github.com/w3c/input-events/issues/42 for more details. While input
2075         events are fired in the correct order with respect to each other, additional work will be required to ensure
2076         that input events are fired in the correct order with respect to composition(start|update|end) events and
2077         textInput events. This is held off until the expected ordering of events is officially defined in the spec.
2078
2079         Tests: fast/events/before-input-events-prevent-insert-composition.html
2080                fast/events/before-input-events-prevent-recomposition.html
2081                fast/events/input-events-ime-composition.html
2082                fast/events/input-events-ime-recomposition.html
2083
2084         * editing/CompositeEditCommand.cpp:
2085         (WebCore::CompositeEditCommand::apply):
2086         * editing/CompositeEditCommand.h:
2087         (WebCore::CompositeEditCommand::isBeforeInputEventCancelable):
2088
2089         Adds a new virtual method hook for subclasses to mark their `beforeinput` events as non-cancelable (see
2090         TypingCommand::isBeforeInputEventCancelable). By default, `beforeinput` events are cancelable.
2091
2092         * editing/EditAction.h:
2093
2094         Adds 4 new EditActions corresponding to the 4 composition-related inputTypes. These are:
2095         EditActionTypingDeletePendingComposition    => "deleteCompositionText"
2096         EditActionTypingDeleteFinalComposition      => "deleteByComposition"
2097         EditActionTypingInsertPendingComposition    => "insertCompositionText"
2098         EditActionTypingInsertFinalComposition      => "insertFromComposition"
2099
2100         * editing/EditCommand.cpp:
2101         (WebCore::inputTypeNameForEditingAction):
2102         * editing/Editor.cpp:
2103         (WebCore::dispatchBeforeInputEvent):
2104         (WebCore::dispatchBeforeInputEvents):
2105         (WebCore::Editor::willApplyEditing):
2106         (WebCore::Editor::insertTextWithoutSendingTextEvent):
2107         (WebCore::Editor::setComposition):
2108
2109         In setComposition(text, mode), tweak the logic for committing a composition to always delete the selection
2110         before inserting the final composition text. In setComposition(text, underlines, start, end), catch the case
2111         where we're beginning to recompose an existing range in the DOM and delete the recomposed text first.
2112
2113         * editing/TypingCommand.cpp:
2114         (WebCore::editActionForTypingCommand):
2115         (WebCore::TypingCommand::TypingCommand):
2116         (WebCore::TypingCommand::deleteSelection):
2117
2118         Adds a TextCompositionType parameter so that call sites (see Editor::setComposition) can indicate what state the
2119         edited composition is in. This allows us to differentiate between deletion of finalized composition text in
2120         preparation of recomposing a range in the DOM, and deletion of composition text that has not yet been committed
2121         in preparation for inserting a finalized composition into the DOM.
2122
2123         (WebCore::TypingCommand::deleteKeyPressed):
2124         (WebCore::TypingCommand::forwardDeleteKeyPressed):
2125         (WebCore::TypingCommand::insertText):
2126         (WebCore::TypingCommand::insertLineBreak):
2127         (WebCore::TypingCommand::insertParagraphSeparatorInQuotedContent):
2128         (WebCore::TypingCommand::insertParagraphSeparator):
2129         (WebCore::TypingCommand::isBeforeInputEventCancelable):
2130         (WebCore::TypingCommand::inputEventData):
2131         (WebCore::TypingCommand::willAddTypingToOpenCommand):
2132         * editing/TypingCommand.h:
2133
2134 2016-10-21  Dave Hyatt  <hyatt@apple.com>
2135
2136         [CSS Parser] Make sure shadow user agent sheets parse in UASheetMode
2137         https://bugs.webkit.org/show_bug.cgi?id=163810
2138
2139         Reviewed by Dean Jackson.
2140
2141         * dom/InlineStyleSheetOwner.cpp:
2142         (WebCore::parserContextForElement):
2143         (WebCore::makeInlineStyleSheetCacheKey):
2144         (WebCore::InlineStyleSheetOwner::createSheet):
2145         (WebCore::parserContextForForElement): Deleted.
2146
2147 2016-10-21  Jer Noble  <jer.noble@apple.com>
2148
2149         YouTube stalls when seeking beyond buffered range
2150         https://bugs.webkit.org/show_bug.cgi?id=162813
2151
2152         Reviewed by Eric Carlson.
2153
2154         When seeking a MediaPlayerPrivateMediaSourceAVFObjC, we will first seek the AVSampleBufferRenderSynchronizer,
2155         flush and enqueue non-displaying frames, enqueue regular frames, then begin playback. The above stall will occur
2156         when we enqueue so many non- displaying frames that the display layer is not ready for normal ones before
2157         playback begins. Then, when the synchronizer attempts to synchronize the enqueued audio and video renderers, the
2158         only available samples are back at the original media time, and so it "seeks" by updating the CMTimebase back to
2159         the original media time, causing playback to appear "stalled".  The overall solution is to "flush" the contents
2160         of the renderers before the seek, so that the synchronizer doesn't reset the currentTime, and to only restart
2161         the synchronizer when there are visible (or audible) samples available for display.
2162
2163         Breaking the fix down into sections:
2164
2165         = Don't enqueue too many non-displaying samples at once:
2166         - Rename SourceBufferPrivate::flushAndEnqueueNonDisplayingSamples() to SourceBufferPrivate::flush(), and no longer
2167           pass in an array of non-displaying samples.
2168         - Add a new virtual method to MediaSample, createNonDisplayingCopy(), used by SourceBuffer to enqueue non-displaying
2169           samples.
2170         - in SourceBuffer::reenqueueMediaForTime(), use that new createNonDisplayingCopy() method to enqueue non-displaying
2171           samples in the same queue as regular samples.
2172
2173         * Modules/mediasource/SourceBuffer.cpp:
2174         (WebCore::SourceBuffer::provideMediaData):
2175         (WebCore::SourceBuffer::reenqueueMediaForTime):
2176         * platform/MediaSample.h:
2177         (WebCore::MediaSample::isNonDisplaying):
2178         * platform/graphics/SourceBufferPrivate.h:
2179         (WebCore::SourceBufferPrivate::flush):
2180         (WebCore::SourceBufferPrivate::flushAndEnqueueNonDisplayingSamples): Renamed -> flush().
2181         * platform/graphics/avfoundation/MediaSampleAVFObjC.h:
2182         * platform/graphics/avfoundation/objc/MediaSampleAVFObjC.mm:
2183         (WebCore::CMSampleBufferIsNonDisplaying):
2184         (WebCore::MediaSampleAVFObjC::flags):
2185         (WebCore::MediaSampleAVFObjC::createNonDisplayingCopy):
2186         * platform/graphics/avfoundation/objc/SourceBufferPrivateAVFObjC.mm:
2187         (WebCore::SourceBufferPrivateAVFObjC::trackDidChangeEnabled):
2188         (WebCore::SourceBufferPrivateAVFObjC::willSeek):
2189         (WebCore::createNonDisplayingCopy): Moved to MediaSampleAVFObjC.
2190         (WebCore::SourceBufferPrivateAVFObjC::flushAndEnqueueNonDisplayingSamples): Renamed -> flush().
2191         * platform/mock/mediasource/MockBox.h:
2192         * platform/mock/mediasource/MockSourceBufferPrivate.cpp:
2193         (WebCore::MockMediaSample::flags):
2194         (WebCore::MockMediaSample::createNonDisplayingCopy):
2195         * platform/mock/mediasource/MockSourceBufferPrivate.h:
2196
2197         = Don't start playing until all renderers have visible/audible samples:
2198         - SourceBufferPrivateAVFObjC will notify its associated MediaPlayerPrivateMediaSourceAVFObjC when
2199           it flushes and receives visible/audible samples.
2200         - The MediaPlayer will store audio renderers as keys to a HashMap which allows it to track which
2201           have available samples.
2202         - This requires changing all the places where we loop over the available renderers.
2203
2204         * platform/graphics/avfoundation/objc/SourceBufferPrivateAVFObjC.mm:
2205         (WebCore::SourceBufferPrivateAVFObjC::trackDidChangeEnabled):
2206         (WebCore::SourceBufferPrivateAVFObjC::enqueueSample):
2207         (WebCore::SourceBufferPrivateAVFObjC::flush):
2208         (WebCore::SourceBufferPrivateAVFObjC::willSeek):
2209         * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.h:
2210         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::allRenderersHaveAvailableSamples):
2211         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::setHasAvailableVideoFrame): Deleted.
2212         * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.mm:
2213         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::MediaPlayerPrivateMediaSourceAVFObjC):
2214         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::setVolume):
2215         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::setMuted):
2216         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::setHasAvailableVideoFrame):
2217         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::setHasAvailableAudioSample):
2218         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::updateAllRenderersHaveAvailableSamples):
2219         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::addAudioRenderer):
2220         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::removeAudioRenderer):
2221         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::setPreservesPitch):
2222         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::seeking):
2223         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::shouldBePlaying):
2224         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::seekInternal):
2225         * platform/graphics/avfoundation/objc/MediaSourcePrivateAVFObjC.h:
2226         * platform/graphics/avfoundation/objc/MediaSourcePrivateAVFObjC.mm:
2227         (WebCore::MediaSourcePrivateAVFObjC::willSeek):
2228         * platform/graphics/avfoundation/objc/SourceBufferPrivateAVFObjC.h:
2229
2230         = Don't display new samples mid-seek.
2231         - MediaSource should clear its m_pendingSeekTime ivar, which is used whyn SourceBuffer queries whether or not a
2232           seek is pending, when instructing its SourceBuffers to seekToTime().
2233         - This allows SourceBuffer to decline to enqueue new samples during a MediaSource seek operation.
2234
2235         * Modules/mediasource/MediaSource.cpp:
2236         (WebCore::MediaSource::completeSeek):
2237
2238 2016-10-20  Dean Jackson  <dino@apple.com>
2239
2240         SVG should not paint selection within a mask
2241         https://bugs.webkit.org/show_bug.cgi?id=163772
2242         <rdar://problem/28705129>
2243
2244         Reviewed by Simon Fraser.
2245
2246         When masking content, we shouldn't paint the text
2247         selection as we are rendering into the masking
2248         offscreen buffer.
2249
2250         Test: svg/masking/mask-should-not-paint-selection.html
2251
2252         * rendering/PaintPhase.h: Add a new behavior - PaintBehaviorSkipSelectionHighlight.
2253         * rendering/svg/SVGInlineTextBox.cpp:
2254         (WebCore::SVGInlineTextBox::paint): Don't update the selectionStyle if
2255         PaintBehaviorSkipSelectionHighlight is true.
2256         * rendering/svg/SVGRenderingContext.cpp:
2257         (WebCore::SVGRenderingContext::renderSubtreeToImageBuffer): Add PaintBehaviorSkipSelectionHighlight
2258         to the PaintInfo.
2259
2260 2016-10-21  Chris Dumez  <cdumez@apple.com>
2261
2262         [Web IDL] MediaControlsHost has invalid operation overloads
2263         https://bugs.webkit.org/show_bug.cgi?id=163793
2264
2265         Reviewed by Darin Adler.
2266
2267         MediaControlsHost has invalid operation overloads:
2268         - sortedTrackListForMenu()
2269         - displayNameForTrack()
2270
2271         The parameter is nullable for both overloads which is not valid IDL.
2272
2273         - sortedTrackListForMenu(): The parameter is no longer nullable. This is a minor
2274           behavior change and it should be safe since this is Apple-specific and only
2275           called from mediaControlsApple.js which uses HTMLMediaElement.videoTracks and
2276           HTMLMediaElement.audioTracks as input, both of which are not nullable.
2277           Note that we could have also kept one of the parameters as nullable to not
2278           change behavior but allowing null does not seem useful here.
2279         - displayNameForTrack(): Use a union instead of overloading, no behavior change.
2280
2281         * Modules/mediacontrols/MediaControlsHost.cpp:
2282         (WebCore::MediaControlsHost::sortedTrackListForMenu):
2283         (WebCore::MediaControlsHost::displayNameForTrack):
2284         * Modules/mediacontrols/MediaControlsHost.h:
2285         * Modules/mediacontrols/MediaControlsHost.idl:
2286
2287 2016-10-21  Jeremy Jones  <jeremyj@apple.com>
2288
2289         Implement basic pointer lock behavior for WebKit and WebKit2.
2290         https://bugs.webkit.org/show_bug.cgi?id=162745
2291
2292         Reviewed by Simon Fraser.
2293
2294         When ENABLE_POINTER_LOCK is enabled, these tests now pass with DumpRenderTree.
2295         LayoutTests/pointer-lock/lock-already-locked.html
2296         LayoutTests/pointer-lock/lock-element-not-in-dom.html
2297         LayoutTests/pointer-lock/locked-element-iframe-removed-from-dom.html
2298         LayoutTests/pointer-lock/mouse-event-api.html
2299
2300         Export pointer lock symbols and cancel pointer lock on "escape".
2301
2302         * dom/Document.h: Export symbols.
2303         * dom/Element.h: Export symbols.
2304         * page/EventHandler.cpp:
2305         (WebCore::EventHandler::keyEvent): Cancel pointer lock on "escape".
2306         * page/PointerLockController.cpp: Add missing include.
2307         * page/PointerLockController.h: Export symbols.
2308
2309 2016-10-21  Jer Noble  <jer.noble@apple.com>
2310
2311         WebCore::PlatformMediaSession::stopSession + 13
2312         https://bugs.webkit.org/show_bug.cgi?id=163799
2313
2314         Reviewed by Eric Carlson.
2315
2316         Because m_sessions can be mutated by removeSession() while iterating over m_sessions, and because
2317         PlatformMediaSessions are not refcounted, it is not enough to copy m_sessions into a copied Vector
2318         before iterating. Instead, wrap iteration of m_sessions in a convenience function, which sets an
2319         iteration counter which, when cleared, removes all null entries from m_session. In parallel, modify
2320         removeSession() to check this iteration counter, and replace the session with a null value rather
2321         than mutating the m_sessions vector itself.
2322
2323         * platform/audio/PlatformMediaSessionManager.cpp:
2324         (WebCore::PlatformMediaSessionManager::has):
2325         (WebCore::PlatformMediaSessionManager::activeAudioSessionRequired):
2326         (WebCore::PlatformMediaSessionManager::canProduceAudio):
2327         (WebCore::PlatformMediaSessionManager::removeSession):
2328         (WebCore::PlatformMediaSessionManager::sessionWillBeginPlayback):
2329         (WebCore::PlatformMediaSessionManager::sessionWillEndPlayback):
2330         (WebCore::PlatformMediaSessionManager::currentSessionsMatching):
2331         (WebCore::PlatformMediaSessionManager::applicationWillEnterBackground):
2332         (WebCore::PlatformMediaSessionManager::applicationDidEnterForeground):
2333         (WebCore::PlatformMediaSessionManager::systemWillSleep):
2334         (WebCore::PlatformMediaSessionManager::systemDidWake):
2335         (WebCore::PlatformMediaSessionManager::stopAllMediaPlaybackForDocument):
2336         (WebCore::PlatformMediaSessionManager::stopAllMediaPlaybackForProcess):
2337         (WebCore::PlatformMediaSessionManager::forEachSession):
2338         (WebCore::PlatformMediaSessionManager::anyOfSessions):
2339         * platform/audio/PlatformMediaSessionManager.h:
2340
2341 2016-10-21  Darin Adler  <darin@apple.com>
2342
2343         Move some more assorted classes from ExceptionCode to Exception
2344         https://bugs.webkit.org/show_bug.cgi?id=163775
2345
2346         Reviewed by Chris Dumez.
2347
2348         * Modules/fetch/WorkerGlobalScopeFetch.cpp:
2349         (WebCore::WorkerGlobalScopeFetch::fetch): Remove unnecessary calls to
2350         WorkerGlobalScope::scriptExcutionObject, which just returns the scope itself.
2351
2352         * Modules/notifications/Notification.cpp: Added now-needed include.
2353         * Modules/webdatabase/DOMWindowWebDatabase.cpp: Ditto.
2354
2355         * WebCore.xcodeproj/project.pbxproj: Added WindowOrWorkerGlobalScope.idl.
2356
2357         * bindings/js/JSDedicatedWorkerGlobalScopeCustom.cpp:
2358         (WebCore::JSDedicatedWorkerGlobalScope::postMessage): Pass a reference instead
2359         of a pointer to handlePostMessage.
2360         * bindings/js/JSMessagePortCustom.cpp:
2361         (WebCore::JSMessagePort::postMessage): Ditto.
2362
2363         * bindings/js/JSMessagePortCustom.h: Use pragma once. Change handlePostMessage
2364         to take a reference to the object instead of a pointer, and also to use
2365         propagateException since postMessage now uses ExceptionOr.
2366
2367         * bindings/js/JSWorkerCustom.cpp:
2368         (WebCore::JSWorker::postMessage): Pass a reference instead of a pointer to
2369         handlePostMessage.
2370         (WebCore::constructJSWorker): Use the version of toJSNewlyCreated that handles
2371         propagating an exception from ExceptionOr.
2372
2373         * bindings/js/JSWorkerGlobalScopeCustom.cpp:
2374         (WebCore::JSWorkerGlobalScope::visitAdditionalChildren): Use auto.
2375         Remove unnecessary round trip through the scriptExecutionContext function.
2376         (WebCore::JSWorkerGlobalScope::importScripts): Use reserveInitialCapacity and
2377         uncheckedAppend to build up the vector of strings. Use propagateException
2378         to deal with ExceptionOr result.
2379
2380         * dom/MessagePort.cpp:
2381         (WebCore::MessagePort::MessagePort): Initialize boolean data members in the
2382         class definition instead of here.
2383         (WebCore::MessagePort::postMessage): Use ExceptionOr.
2384         (WebCore::MessagePort::entangle): Use an rvalue reference.
2385         (WebCore::MessagePort::dispatchMessages): Use ExceptionOr.
2386         (WebCore::MessagePort::disentanglePorts): Ditto. Also use a more efficient
2387         idiom that does half as much hashing as the old algorithm, and got rid an
2388         unneeded local variable.
2389         (WebCore::MessagePort::entanglePorts): Use an rvalue reference.
2390         * dom/MessagePort.h: Updated for above changes.
2391
2392         * fileapi/FileReader.cpp:
2393         (WebCore::FileReader::create): Use auto.
2394         (WebCore::FileReader::FileReader): Initialize scalars in the class definition.
2395         (WebCore::FileReader::~FileReader): Call cancel on the loader directly
2396         instead of sharing code with the stop function.
2397         (WebCore::FileReader::stop): Moved the body of the terminate function here.
2398         (WebCore::FileReader::readAsArrayBuffer): Use ExceptionOr.
2399         (WebCore::FileReader::readAsBinaryString): Ditto.
2400         (WebCore::FileReader::readAsText): Ditto.
2401         (WebCore::FileReader::readAsDataURL): Ditto.
2402         (WebCore::FileReader::readInternal): Ditto. Also add a cast now that
2403         we derive privately from FileReaderLoaderClient.
2404         (WebCore::FileReader::abort): Call stop instead of terminate.
2405         (WebCore::FileReader::terminate): Deleted. Moved code into stop.
2406         (WebCore::FileReader::didReceiveData): Moved comment to where the constant is.
2407         * fileapi/FileReader.h: Updated for above changes. Made more functions private
2408         and used final instead of override.
2409         * fileapi/FileReader.idl: Use non-legacy exceptions.
2410
2411         * fileapi/FileReaderSync.cpp:
2412         (WebCore::FileReaderSync::readAsArrayBuffer): Use ExceptionOr.
2413         (WebCore::FileReaderSync::readAsBinaryString): Ditto.
2414         (WebCore::FileReaderSync::readAsText): Ditto.
2415         (WebCore::FileReaderSync::readAsDataURL): Ditto.
2416         (WebCore::FileReaderSync::startLoading): Ditto.
2417         (WebCore::FileReaderSync::startLoadingString): Added. Helper to cut down on
2418         repeated code in functions above.
2419         * fileapi/FileReaderSync.h: Updated for above changes.
2420         * fileapi/FileReaderSync.idl: Use non-legacy exceptions.
2421
2422         * page/Base64Utilities.cpp:
2423         (WebCore::Base64Utilities::btoa): Use ExceptionOr.
2424         (WebCore::Base64Utilities::atob): Ditto.
2425         * page/Base64Utilities.h: Updated for above changes.
2426
2427         * page/DOMWindow.cpp:
2428         (WebCore::DOMWindow::navigator): Pass a reference to the frame.
2429         (WebCore::DOMWindow::postMessage): Use ExceptionOr when calling
2430         MessagePort::disentanglePorts. Also udpated for changes to the
2431         PostMessageTimer.
2432
2433         * page/Navigator.cpp:
2434         (WebCore::Navigator::Navigator): Take a reference.
2435         (WebCore::shouldHideFourDot): Ditto
2436         (WebCore::Navigator::appVersion): Pass a reference.
2437         (WebCore::Navigator::plugins): Return a reference.
2438         (WebCore::Navigator::mimeTypes): Ditto.
2439         * page/Navigator.h: Updated for above changes. Also marked the
2440         class final and moved derivation from RefCounted to NavigatorBase.
2441
2442         * page/NavigatorBase.h: Addded derivation from RefCounted since
2443         both derived classes want that, and the destructor is already virtual.
2444
2445         * page/WindowOrWorkerGlobalScope.idl: Use non-legacy exceptions.
2446
2447         * page/WorkerNavigator.cpp:
2448         (WebCore::WorkerNavigator::~WorkerNavigator): Deleted.
2449
2450         * page/WorkerNavigator.h: Moved derivation from RefCounted to
2451         NavigatorBase. Also marked class final.
2452
2453         * workers/AbstractWorker.cpp:
2454         (WebCore::AbstractWorker::resolveURL): Use ExceptionOr.
2455         * workers/AbstractWorker.h: Updated for above changes.
2456
2457         * workers/DedicatedWorkerGlobalScope.cpp:
2458         (WebCore::DedicatedWorkerGlobalScope::create): Use RefPtr&&
2459         instead of PassRefPtr.
2460         (WebCore::DedicatedWorkerGlobalScope::DedicatedWorkerGlobalScope):
2461         Ditto.
2462         (WebCore::DedicatedWorkerGlobalScope::postMessage): Use ExceptionOr.
2463         (WebCore::DedicatedWorkerGlobalScope::importScripts): Ditto.
2464         * workers/DedicatedWorkerGlobalScope.h: Updated for above changes.
2465         * workers/DedicatedWorkerGlobalScope.idl: Use non-legacy exceptions.
2466
2467         * workers/Worker.cpp:
2468         (WebCore::Worker::create): Use ExceptionOr.
2469         (WebCore::Worker::postMessage): Ditto.
2470         * workers/Worker.h: Updated for above changes.
2471         * workers/Worker.idl: Use non-legacy exception.
2472
2473         * workers/WorkerGlobalScope.cpp:
2474         (WebCore::WorkerGlobalScope::WorkerGlobalScope): Moved initialization
2475         of m_closing to class definition.
2476         (WebCore::WorkerGlobalScope::~WorkerGlobalScope): Removed call to
2477         deleted notifyObserversOfStop function.
2478         (WebCore::WorkerGlobalScope::importScripts): Use ExceptionOr. Also use
2479         reserveInitialCapacity and uncheckedAppend to build a vector.
2480         (WebCore::WorkerGlobalScope::addConsoleMessage): Use an rvalue reference.
2481         Also moved the body of one of the addMessageToWorkerConsole overloads into
2482         one of the overloads of this function, and changed the other to call addMessage.
2483         (WebCore::WorkerGlobalScope::addMessage): Moved the body of the other
2484         addMessageToWorkerConsole here.
2485         (WebCore::WorkerGlobalScope::addMessageToWorkerConsole): Deleted.
2486         (WebCore::WorkerGlobalScope::Observer::Observer): Deleted.
2487         (WebCore::WorkerGlobalScope::Observer::~Observer): Deleted.
2488         (WebCore::WorkerGlobalScope::Observer::stopObserving): Deleted.
2489         (WebCore::WorkerGlobalScope::registerObserver): Deleted.
2490         (WebCore::WorkerGlobalScope::unregisterObserver): Deleted.
2491         (WebCore::WorkerGlobalScope::notifyObserversOfStop): Deleted.
2492         * workers/WorkerGlobalScope.h: Removed unneeded includes. Moved many virtual
2493         function overrides into the private section. Marked many functions final instead
2494         of just override. Removed unused Observer class and m_workerObservers set.
2495
2496         * workers/WorkerThread.cpp:
2497         (WebCore::WorkerThread::stop): Removed call to deleted
2498         WorkerGlobalScope::notifyObserversOfStop function.
2499
2500 2016-10-21  Antti Koivisto  <antti@apple.com>
2501
2502         Tighten ComputedStyleExtractor to use Element instead of Node
2503         https://bugs.webkit.org/show_bug.cgi?id=163798
2504
2505         Reviewed by Andreas Kling.
2506
2507         Also make its functions non-const as they may compute style.
2508
2509         * css/CSSComputedStyleDeclaration.cpp:
2510         (WebCore::styleElementForNode):
2511         (WebCore::ComputedStyleExtractor::ComputedStyleExtractor):
2512
2513             If we are called with a Node figure out the style Element in constructor.
2514
2515         (WebCore::ComputedStyleExtractor::getFontSizeCSSValuePreferringKeyword):
2516         (WebCore::ComputedStyleExtractor::useFixedFontDefaultSize):
2517         (WebCore::ComputedStyleExtractor::styledElement):
2518         (WebCore::CSSComputedStyleDeclaration::getPropertyCSSValue):
2519         (WebCore::CSSComputedStyleDeclaration::copyProperties):
2520         (WebCore::elementOrItsAncestorNeedsStyleRecalc):
2521
2522             Use composed tree iterator for increased correctness in shadow trees.
2523
2524         (WebCore::updateStyleIfNeededForElement):
2525         (WebCore::computeRenderStyleForProperty):
2526         (WebCore::ComputedStyleExtractor::customPropertyValue):
2527         (WebCore::ComputedStyleExtractor::customPropertyText):
2528         (WebCore::ComputedStyleExtractor::propertyValue):
2529         (WebCore::CSSComputedStyleDeclaration::length):
2530         (WebCore::CSSComputedStyleDeclaration::item):
2531         (WebCore::ComputedStyleExtractor::propertyMatches):
2532         (WebCore::ComputedStyleExtractor::copyProperties):
2533         (WebCore::ComputedStyleExtractor::getCSSPropertyValuesForShorthandProperties):
2534         (WebCore::ComputedStyleExtractor::getCSSPropertyValuesForSidesShorthand):
2535         (WebCore::ComputedStyleExtractor::getCSSPropertyValuesForGridShorthand):
2536         (WebCore::ComputedStyleExtractor::copyPropertiesInSet):
2537         (WebCore::CSSComputedStyleDeclaration::getPropertyValue):
2538         (WebCore::ComputedStyleExtractor::getBackgroundShorthandValue):
2539         (WebCore::ComputedStyleExtractor::styledNode): Deleted.
2540         (WebCore::nodeOrItsAncestorNeedsStyleRecalc): Deleted.
2541         (WebCore::updateStyleIfNeededForNode): Deleted.
2542         * css/CSSComputedStyleDeclaration.h:
2543         * css/SVGCSSComputedStyleDeclaration.cpp:
2544         (WebCore::ComputedStyleExtractor::svgPropertyValue):
2545         * editing/EditingStyle.cpp:
2546         (WebCore::EditingStyle::removeEquivalentProperties):
2547         * editing/EditingStyle.h:
2548
2549 2016-10-21  Chris Dumez  <cdumez@apple.com>
2550
2551         WebGL2RenderingContext.texSubImage3D() should use a union instead of overloading
2552         https://bugs.webkit.org/show_bug.cgi?id=163792
2553
2554         Reviewed by Darin Adler.
2555
2556         WebGL2RenderingContext.texSubImage3D() should use a union instead of overloading for 
2557         - https://www.khronos.org/registry/webgl/specs/latest/2.0/#3.7 (for texSubImage3D)
2558         - https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14 (for TexImageSource)
2559
2560         * html/canvas/WebGL2RenderingContext.cpp:
2561         (WebCore::WebGL2RenderingContext::texSubImage3D):
2562         * html/canvas/WebGL2RenderingContext.h:
2563         * html/canvas/WebGL2RenderingContext.idl:
2564
2565 2016-10-21  Zalan Bujtas  <zalan@apple.com>
2566
2567         Do not mutate the render tree while collecting selection repaint rects.
2568         https://bugs.webkit.org/show_bug.cgi?id=163800
2569         <rdar://problem/28806886>
2570
2571         Reviewed by David Hyatt.
2572
2573         RenderListItem not only mutates the tree while in layout but it also uses
2574         the old descendant context to find the insertion point.
2575         This patch strictly ensures that we only do it while in layout and never
2576         in other cases such as collecting repaint rects.
2577         This gets redundant when webkit.org/b/163789 is fixed.
2578
2579         Test: fast/lists/crash-when-list-marker-is-moved-during-selection.html
2580
2581         * rendering/RenderListItem.cpp:
2582         (WebCore::RenderListItem::insertOrMoveMarkerRendererIfNeeded):
2583
2584 2016-10-21  Dave Hyatt  <hyatt@apple.com>
2585
2586         [CSS Parser] Support horizontal-bt writing mode
2587         https://bugs.webkit.org/show_bug.cgi?id=163797
2588
2589         Reviewed by Zalan Bujtas.
2590
2591         * css/parser/CSSParserFastPaths.cpp:
2592         (WebCore::CSSParserFastPaths::isValidKeywordPropertyAndValue):
2593
2594 2016-10-20  Brent Fulgham  <bfulgham@apple.com>
2595
2596         [Win][Direct2D] Correct some memory leaks and other minor bugs
2597         https://bugs.webkit.org/show_bug.cgi?id=163769
2598
2599         Reviewed by Alex Christensen.
2600
2601         Several D2D handles were being leaked.
2602  
2603         Direct2D sometimes returns an infinite rect containing { -inf, -inf, FloatMax, FloatMax },
2604         sometimes { -FloatMax, -FloatMax, inf, inf }, and various combinations thereof. This caused
2605         most SVG drawing to decide no screen rect was contained in the "infinite rect" so nothing
2606         would be drawn.
2607         
2608         Tested by existing layout tests. 
2609
2610         * platform/graphics/GraphicsContext.h:
2611         * platform/graphics/win/FloatRectDirect2D.cpp:
2612         (WebCore::isInfiniteRect): Recognize various infinite rects in Windows.
2613         (WebCore::FloatRect::FloatRect): Convert a Windows infinite rect to the style
2614         we use inside WebKit.
2615         * platform/graphics/win/FontCascadeDirect2D.cpp:
2616         (WebCore::FontCascade::drawGlyphs): Use cached brushes if possible.
2617         * platform/graphics/win/GlyphPageTreeNodeDirect2D.cpp:
2618         (WebCore::GlyphPage::fill): Don't terminate on this error case.
2619         * platform/graphics/win/GradientDirect2D.cpp:
2620         (WebCore::Gradient::generateGradient): Don't leak gradients.
2621         * platform/graphics/win/GraphicsContextDirect2D.cpp:
2622         (WebCore::GraphicsContextPlatformPrivate::brushWithColor): Added.
2623         (WebCore::GraphicsContext::brushWithColor): Added.
2624         (WebCore::GraphicsContextPlatformPrivate::concatCTM): Perform transform multiplication
2625         in the right order (hint: it's not distributive).
2626         (WebCore::GraphicsContext::drawWithShadow): Use convenience method.
2627         (WebCore::GraphicsContext::fillRect): Ditto.
2628         (WebCore::GraphicsContext::platformFillRoundedRect): Ditto.
2629         (WebCore::GraphicsContext::clearRect): Ditto.
2630         (WebCore::GraphicsContext::setPlatformStrokeColor): Ditto.
2631         (WebCore::GraphicsContext::setPlatformFillColor): Ditto.
2632         * platform/graphics/win/PathDirect2D.cpp:
2633         (WebCore::Path::polygonPathFromPoints): No need to convert manually.
2634         (WebCore::Path::~Path): Don't leak ID2D1Geometry entities.
2635         (WebCore::Path::appendGeometry): Ditto.
2636         (WebCore::Path::createGeometryWithFillMode): Ditto.
2637         (WebCore::Path::Path): Ditto.
2638         (WebCore::Path::operator=): Ditto.
2639         (WebCore::Path::strokeBoundingRect): Provide an implementation.
2640         (WebCore::Path::addRect): No need for manual casting here.
2641
2642 2016-10-21  Wenson Hsieh  <wenson_hsieh@apple.com>
2643
2644         Fix minor style issue in the signature of StaticRange::create
2645         https://bugs.webkit.org/show_bug.cgi?id=163786
2646         <rdar://problem/28853079>
2647
2648         Reviewed by Alex Christensen.
2649
2650         Change `Ref<WebCore::Node> &&` to `Ref<Node>&&`.
2651
2652         * dom/StaticRange.cpp:
2653         (WebCore::StaticRange::create):
2654
2655 2016-10-21  Dave Hyatt  <hyatt@apple.com>
2656
2657         [CSS Parser] Add support for -webkit-line-box-contain
2658         https://bugs.webkit.org/show_bug.cgi?id=163794
2659
2660         Reviewed by Zalan Bujtas.
2661
2662         * css/parser/CSSPropertyParser.cpp:
2663         (WebCore::consumeLineBoxContain):
2664         (WebCore::CSSPropertyParser::parseSingleValue):
2665
2666 2016-10-21  Dave Hyatt  <hyatt@apple.com>
2667
2668         [CSS Parser] Add support for @-webkit-region rules
2669         https://bugs.webkit.org/show_bug.cgi?id=163787
2670
2671         Reviewed by Zalan Bujtas.
2672
2673         * css/StyleRule.cpp:
2674         (WebCore::StyleRuleRegion::StyleRuleRegion):
2675         * css/StyleRule.h:
2676         * css/parser/CSSAtRuleID.cpp:
2677         (WebCore::cssAtRuleID):
2678         * css/parser/CSSAtRuleID.h:
2679         * css/parser/CSSParserImpl.cpp:
2680         (WebCore::CSSParserImpl::consumeAtRule):
2681         (WebCore::CSSParserImpl::consumePageRule):
2682         (WebCore::CSSParserImpl::consumeRegionRule):
2683         * css/parser/CSSParserImpl.h:
2684
2685 2016-10-21  David Kilzer  <ddkilzer@apple.com>
2686
2687         Bug 163757: Use IntSize::unclampedArea() in PDFDocumentImage::updateCachedImageIfNeeded()
2688         <https://webkit.org/b/163757>
2689
2690         Reviewed by Brent Fulgham.
2691
2692         No new tests since there is no change in nominal behavior.
2693
2694         * platform/graphics/cg/PDFDocumentImage.cpp:
2695         (WebCore::PDFDocumentImage::updateCachedImageIfNeeded): Use
2696         IntSize::unclampedArea() where manual calculations were used
2697         previously.  Also gets rid of more safeCast<size_t>() use.
2698
2699 2016-10-21  Chris Dumez  <cdumez@apple.com>
2700
2701         [Web IDL] Support unions in our overload resolution algorithm
2702         https://bugs.webkit.org/show_bug.cgi?id=163764
2703
2704         Reviewed by Darin Adler.
2705
2706         Support unions in our overload resolution algorithm as per:
2707         - https://heycam.github.io/webidl/#es-overloads
2708         - https://heycam.github.io/webidl/#dfn-distinguishable
2709
2710         * bindings/scripts/CodeGeneratorJS.pm:
2711         (IsIDLTypeDistinguishableWithUnionForOverloadResolution):
2712         (AreTypesDistinguishableForOverloadResolution):
2713         (GetOverloadThatMatches):
2714         (GenerateOverloadedFunctionOrConstructor):
2715         * bindings/scripts/test/JS/JSTestObj.cpp:
2716         * bindings/scripts/test/TestObj.idl:
2717
2718 2016-10-21  Chris Dumez  <cdumez@apple.com>
2719
2720         AudioNode.connect(): First parameter should not be nullable
2721         https://bugs.webkit.org/show_bug.cgi?id=163773
2722
2723         Reviewed by Darin Adler.
2724
2725         AudioNode.connect()'s first parameter should not be nullable:
2726         - https://webaudio.github.io/web-audio-api/#idl-def-AudioNode.
2727
2728         We were throwing a SYNTAX_ERR when passing null, we now throw
2729         a TypeError instead.
2730
2731         No new tests, updated existing test.
2732
2733         * Modules/webaudio/AudioBasicInspectorNode.cpp:
2734         (WebCore::AudioBasicInspectorNode::connect):
2735         * Modules/webaudio/AudioBasicInspectorNode.h:
2736         * Modules/webaudio/AudioNode.cpp:
2737         (WebCore::AudioNode::connect):
2738         * Modules/webaudio/AudioNode.h:
2739         * Modules/webaudio/AudioNode.idl:
2740
2741 2016-10-21  Wenson Hsieh  <wenson_hsieh@apple.com>
2742
2743         Implement InputEvent.getTargetRanges() for the input events spec
2744         https://bugs.webkit.org/show_bug.cgi?id=162947
2745         <rdar://problem/28853079>
2746
2747         Reviewed by Darin Adler.
2748
2749         Implements InputEvent.getTargetRanges(). See individual method changes below for more details. Adds a new hook
2750         for subclasses of CompositeEditCommand to vend a list of target StaticRanges when retrieving target ranges for
2751         an editing command on a contenteditable area.
2752
2753         Tests: fast/events/before-input-delete-empty-list-target-ranges.html
2754                fast/events/before-input-delete-text-target-ranges.html
2755                fast/events/before-input-replace-text-target-ranges.html
2756
2757         * CMakeLists.txt:
2758         * DerivedSources.make:
2759         * WebCore.xcodeproj/project.pbxproj:
2760
2761         Add StaticRange.idl, StaticRange.cpp and StaticRange.h.
2762
2763         * bindings/generic/RuntimeEnabledFeatures.h:
2764         (WebCore::RuntimeEnabledFeatures::setInputEventsEnabled):
2765         (WebCore::RuntimeEnabledFeatures::inputEventsEnabled):
2766
2767         Add a new runtime bindings flag for InputEvents and guard both InputEvent and StaticRange behind it.
2768
2769         * dom/DOMAllInOne.cpp:
2770         * dom/InputEvent.cpp:
2771         (WebCore::InputEvent::InputEvent):
2772         * dom/InputEvent.h:
2773         * dom/InputEvent.idl:
2774         * dom/StaticRange.cpp: Copied from Source/WebCore/dom/InputEvent.cpp.
2775         (WebCore::StaticRange::StaticRange):
2776         (WebCore::StaticRange::create):
2777         (WebCore::StaticRange::createFromRange):
2778
2779         Convenience method for creating a StaticRange from a Range's start/end container and offset.
2780
2781         (WebCore::StaticRange::startContainer):
2782         (WebCore::StaticRange::endContainer):
2783         (WebCore::StaticRange::collapsed):
2784         * dom/StaticRange.h: Copied from Source/WebCore/dom/InputEvent.cpp.
2785         (WebCore::StaticRange::startOffset):
2786         (WebCore::StaticRange::endOffset):
2787         * dom/StaticRange.idl: Copied from Source/WebCore/editing/ReplaceRangeWithTextCommand.h.
2788         * editing/CompositeEditCommand.cpp:
2789         (WebCore::CompositeEditCommand::willApplyCommand):
2790         (WebCore::CompositeEditCommand::targetRanges):
2791
2792         Virtual method that returns a list of target ranges which are associated with this command.
2793
2794         (WebCore::CompositeEditCommand::targetRangesForBindings):
2795
2796         Non-virtual method that calls the above targetRanges(). Takes whether or not the CompositeEditCommand is editing
2797         a textarea or plain text input into account.
2798
2799         (WebCore::CompositeEditCommand::moveParagraphs):
2800         * editing/CompositeEditCommand.h:
2801         * editing/EditCommand.cpp:
2802         (WebCore::EditCommand::frame):
2803         * editing/EditCommand.h:
2804         (WebCore::EditCommand::document):
2805         * editing/Editor.cpp:
2806         (WebCore::dispatchBeforeInputEvent):
2807         (WebCore::dispatchInputEvent):
2808         (WebCore::dispatchBeforeInputEvents):
2809
2810         Changed the `beforeinput` event dispatch to use the regular Node::dispatchEvent instead of dispatchScopedEvent.
2811         This is because if the page prevents the `beforeinput` event, we need to know immediately in order to bail from
2812         the default action.
2813
2814         (WebCore::dispatchInputEvents):
2815         (WebCore::Editor::willApplyEditing):
2816
2817         Added a list of static ranges as a parameter when calling on the Editor to dispatch `beforeinput` events.
2818         By default, this uses the composite edit command's targetRangesForBindings(), though it may be special cased
2819         by subclasses of CompositeEditCommand (see ReplaceRangeWithTextCommand, SpellingCorrectionCommand, and
2820         TypingCommand).
2821
2822         * editing/Editor.h:
2823         * editing/ReplaceRangeWithTextCommand.cpp:
2824         (WebCore::ReplaceRangeWithTextCommand::targetRanges):
2825         * editing/ReplaceRangeWithTextCommand.h:
2826         * editing/SpellingCorrectionCommand.cpp:
2827         (WebCore::SpellingCorrectionCommand::targetRanges):
2828         * editing/SpellingCorrectionCommand.h:
2829         * editing/TypingCommand.cpp:
2830         (WebCore::editActionIsDeleteByTyping):
2831         (WebCore::TypingCommand::shouldDeferWillApplyCommandUntilAddingTypingCommand):
2832         (WebCore::TypingCommand::willApplyCommand):
2833         (WebCore::TypingCommand::willAddTypingToOpenCommand):
2834         (WebCore::TypingCommand::deleteKeyPressed):
2835         (WebCore::TypingCommand::forwardDeleteKeyPressed):
2836
2837         Moves the firing of the `beforeinput` until after the selection range to delete has been computed.
2838
2839         * editing/TypingCommand.h:
2840
2841 2016-10-21  Antti Koivisto  <antti@apple.com>
2842
2843         Style resolver should be updated lazily
2844         https://bugs.webkit.org/show_bug.cgi?id=163721
2845
2846         Reviewed by Andreas Kling.
2847
2848         Currently when stylesheets change in some way we generally update style resolvers and
2849         invalidate style immediately. We should do this lazily to avoid unnecessary work.
2850
2851         Also improve naming of the stylesheet invalidation functions and use more optimal functions in some places.
2852
2853         * css/CSSComputedStyleDeclaration.cpp:
2854         (WebCore::updateStyleIfNeededForNode):
2855         * css/CSSStyleSheet.cpp:
2856         (WebCore::CSSStyleSheet::didMutateRules):
2857         (WebCore::CSSStyleSheet::didMutate):
2858         (WebCore::CSSStyleSheet::setDisabled):
2859         * css/StyleResolver.cpp:
2860         (WebCore::StyleResolver::StyleResolver):
2861
2862             Initialize root style font with null font selector.
2863             This avoids hitting a CSSFontSelector assert in fast/media/mq-relative-constraints-08.html where
2864             media query evaluation requires font information before it is ready.
2865             Exposed by increased laziness in this patch.
2866
2867         * dom/Document.cpp:
2868         (WebCore::Document::setContentLanguage):
2869         (WebCore::Document::updateLayoutIgnorePendingStylesheets):
2870         (WebCore::Document::isPageBoxVisible):
2871         (WebCore::Document::pageSizeAndMarginsInPixels):
2872         (WebCore::Document::processHttpEquiv):
2873         (WebCore::Document::setSelectedStylesheetSet):
2874         (WebCore::Document::didInsertInDocumentShadowRoot):
2875         (WebCore::Document::didRemoveInDocumentShadowRoot):
2876         * dom/Document.h:
2877         (WebCore::Document::inDocumentShadowRoots):
2878
2879             Track all shadow roots in the document. This allows us to find and flush style scopes cheaply.
2880
2881         * dom/Element.cpp:
2882         (WebCore::Element::computedStyle):
2883         * dom/ExtensionStyleSheets.cpp:
2884         (WebCore::ExtensionStyleSheets::ExtensionStyleSheets):
2885         (WebCore::ExtensionStyleSheets::clearPageUserSheet):
2886         (WebCore::ExtensionStyleSheets::updatePageUserSheet):
2887         (WebCore::ExtensionStyleSheets::invalidateInjectedStyleSheetCache):
2888         (WebCore::ExtensionStyleSheets::addUserStyleSheet):
2889         (WebCore::ExtensionStyleSheets::addAuthorStyleSheetForTesting):
2890         (WebCore::ExtensionStyleSheets::addDisplayNoneSelector):
2891         (WebCore::ExtensionStyleSheets::maybeAddContentExtensionSheet):
2892         (WebCore::ExtensionStyleSheets::styleResolverChangedTimerFired): Deleted.
2893
2894             Since updates are now done lazily we don't need a special timer for extension stylesheets.
2895
2896         * dom/ExtensionStyleSheets.h:
2897         * dom/ProcessingInstruction.cpp:
2898         (WebCore::ProcessingInstruction::checkStyleSheet):
2899         (WebCore::ProcessingInstruction::sheetLoaded):
2900         (WebCore::ProcessingInstruction::removedFrom):
2901         * dom/ShadowRoot.cpp:
2902         (WebCore::ShadowRoot::ShadowRoot):
2903         (WebCore::ShadowRoot::insertedInto):
2904         (WebCore::ShadowRoot::removedFrom):
2905         (WebCore::ShadowRoot::styleScope):
2906         * dom/ShadowRoot.h:
2907         * html/HTMLLinkElement.cpp:
2908         (WebCore::HTMLLinkElement::setDisabledState):
2909         (WebCore::HTMLLinkElement::parseAttribute):
2910         (WebCore::HTMLLinkElement::process):
2911         (WebCore::HTMLLinkElement::removePendingSheet):
2912         * html/HTMLStyleElement.cpp:
2913         (WebCore::HTMLStyleElement::parseAttribute):
2914         * inspector/InspectorCSSAgent.cpp:
2915         (WebCore::InspectorCSSAgent::createInspectorStyleSheetForDocument):
2916         (WebCore::InspectorCSSAgent::forcePseudoState):
2917         (WebCore::InspectorCSSAgent::resetPseudoStates):
2918         * inspector/InspectorPageAgent.cpp:
2919         (WebCore::InspectorPageAgent::setEmulatedMedia):
2920         * page/Frame.cpp:
2921         (WebCore::Frame::setPrinting):
2922         * page/FrameView.cpp:
2923         (WebCore::FrameView::layout):
2924         (WebCore::FrameView::setPagination):
2925         (WebCore::FrameView::setViewportSizeForCSSViewportUnits):
2926         * page/Page.cpp:
2927         (WebCore::Page::setViewMode):
2928         (WebCore::Page::setNeedsRecalcStyleInAllFrames):
2929         (WebCore::Page::invalidateInjectedStyleSheetCacheInAllFrames):
2930         * style/StyleScope.cpp:
2931         (WebCore::Style::Scope::setPreferredStylesheetSetName):
2932         (WebCore::Style::Scope::setSelectedStylesheetSetName):
2933         (WebCore::Style::Scope::removePendingSheet):
2934         (WebCore::Style::Scope::removeStyleSheetCandidateNode):
2935         (WebCore::Style::Scope::activeStyleSheetsForInspector):
2936         (WebCore::Style::Scope::flushPendingUpdate):
2937
2938             Also flush descendant shadow roots.
2939
2940         (WebCore::Style::Scope::scheduleUpdate):
2941         (WebCore::Style::Scope::didChangeActiveStyleSheetCandidates):
2942
2943             Make lazy.
2944
2945         (WebCore::Style::Scope::didChangeStyleSheetContents):
2946
2947             Make lazy.
2948
2949         (WebCore::Style::Scope::didChangeStyleSheetEnvironment):
2950
2951             Environment changes also affect author shadow roots.
2952
2953         (WebCore::Style::Scope::styleSheetsForStyleSheetList):
2954         (WebCore::Style::Scope::scheduleActiveSetUpdate): Deleted.
2955         (WebCore::Style::Scope::didChangeCandidatesForActiveSet): Deleted.
2956         (WebCore::Style::Scope::didChangeContentsOrInterpretation): Deleted.
2957
2958             Improved naming of these and split didChangeContentsOrInterpretation into two separate functions.
2959
2960         * style/StyleScope.h:
2961         (WebCore::Style::Scope::styleSheetsForStyleSheetList): Deleted.
2962         (WebCore::Style::Scope::setPreferredStylesheetSetName): Deleted.
2963         (WebCore::Style::Scope::setSelectedStylesheetSetName): Deleted.
2964         * svg/SVGFontFaceElement.cpp:
2965         (WebCore::SVGFontFaceElement::rebuildFontFace):
2966         (WebCore::SVGFontFaceElement::removedFrom):
2967         * testing/Internals.cpp:
2968         (WebCore::Internals::resetToConsistentState):
2969
2970             Ensure that cationsStyleSheetOverride really becomes empty. Some tests rely on not having suprise
2971             inserted stylesheets. Previously this was racy and the patch affected order of things.
2972
2973         (WebCore::Internals::styleChangeType):
2974         * xml/XMLTreeViewer.cpp:
2975         (WebCore::XMLTreeViewer::transformDocumentToTreeView):
2976         * xml/parser/XMLDocumentParser.cpp:
2977         (WebCore::XMLDocumentParser::end):
2978         * xml/parser/XMLDocumentParserLibxml2.cpp:
2979         (WebCore::XMLDocumentParser::doEnd):
2980
2981 2016-10-21  Xabier Rodriguez Calvar  <calvaris@igalia.com> and Adam Bergkvist  <adam.bergkvist@ericsson.com>
2982
2983         WebRTC: [OpenWebRTC] Move SDPProcessorScriptResource(Gtk) to openwebrtc directory
2984         https://bugs.webkit.org/show_bug.cgi?id=163778
2985
2986         Reviewed by Philippe Normand.
2987
2988         Move SDPProcessorScriptResourceGtk from the platform gtk directory to the port generic
2989         openwebrtc directory to make it usable by other ports. Also drop the Gtk-suffix.
2990
2991         No change of behavior.
2992
2993         * PlatformGTK.cmake:
2994         * platform/mediastream/gtk/SDPProcessorScriptResourceGtk.cpp:
2995         (WebCore::SDPProcessorScriptResource::scriptString): Deleted.
2996         * platform/mediastream/openwebrtc/SDPProcessorScriptResource.cpp: Renamed from Source/WebCore/platform/mediastream/gtk/SDPProcessorScriptResourceGtk.cpp.
2997         (WebCore::SDPProcessorScriptResource::scriptString):
2998
2999 2016-10-21  Miguel Gomez  <magomez@igalia.com>
3000
3001         [GTK] Several tests crashing on debug bot in (anonymous namespace)::MediaPlayerPrivateGStreamerBase::repaint
3002         https://bugs.webkit.org/show_bug.cgi?id=163511
3003
3004         Reviewed by Carlos Garcia Campos.
3005
3006         Perform the video repaint in the main thread when accelerated compositing is disabled. Added a new method to
3007         MediaPlayerClient to get whether accelerated compositing is enabled from the MediaPlayer. This is needed
3008         because mediaPlayerAcceleratedCompositingEnabled() will return false while HTMLMediaElement doesn't have a
3009         RenderVideo, even when accelerated compositing is enabled.
3010
3011         Covered by existent tests.
3012
3013         * html/HTMLMediaElement.cpp:
3014         (WebCore::HTMLMediaElement::mediaPlayerAcceleratedCompositingEnabled):
3015         * html/HTMLMediaElement.h:
3016         * platform/graphics/MediaPlayer.h:
3017         (WebCore::MediaPlayerClient::mediaPlayerAcceleratedCompositingEnabled):
3018         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp:
3019         (WebCore::MediaPlayerPrivateGStreamerBase::MediaPlayerPrivateGStreamerBase):
3020         (WebCore::MediaPlayerPrivateGStreamerBase::repaint):
3021         (WebCore::MediaPlayerPrivateGStreamerBase::triggerRepaint):
3022         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.h:
3023
3024 2016-10-21  Adam Bergkvist  <adam.bergkvist@ericsson.com>
3025
3026         WebRTC: [GTK] Add MediaEndpointOwr - an OpenWebRTC WebRTC backend
3027         https://bugs.webkit.org/show_bug.cgi?id=163327
3028
3029         Reviewed by Philippe Normand.
3030
3031         Add MediaEndpointOwr which is a MediaEndpoint implementation (WebRTC backend) based on
3032         OpenWebRTC [1]. The WebRTC backend can be tested with a manual test. Automatic testing
3033         is still done with MockMediaEndpoint.
3034
3035         [1] http://www.openwebrtc.org/
3036
3037         Testing: Added manual test (webrtc-one-tab-p2p.html)
3038
3039         * CMakeLists.txt:
3040         * platform/GStreamer.cmake:
3041         * platform/mediastream/openwebrtc/MediaEndpointOwr.cpp: Added.
3042         (WebCore::createMediaEndpointOwr):
3043         (WebCore::MediaEndpointOwr::MediaEndpointOwr):
3044         (WebCore::MediaEndpointOwr::~MediaEndpointOwr):
3045         (WebCore::MediaEndpointOwr::setConfiguration):
3046         (WebCore::cryptoDataCallback):
3047         (WebCore::MediaEndpointOwr::generateDtlsInfo):
3048         (WebCore::MediaEndpointOwr::getDefaultAudioPayloads):
3049         (WebCore::MediaEndpointOwr::getDefaultVideoPayloads):
3050         (WebCore::payloadsContainType):
3051         (WebCore::MediaEndpointOwr::filterPayloads):
3052         (WebCore::MediaEndpointOwr::updateReceiveConfiguration):
3053         (WebCore::findRtxPayload):
3054         (WebCore::MediaEndpointOwr::updateSendConfiguration):
3055         (WebCore::MediaEndpointOwr::addRemoteCandidate):
3056         (WebCore::MediaEndpointOwr::replaceMutedRemoteSourceMid):
3057         (WebCore::MediaEndpointOwr::createMutedRemoteSource):
3058         (WebCore::MediaEndpointOwr::replaceSendSource):
3059         (WebCore::MediaEndpointOwr::stop):
3060         (WebCore::MediaEndpointOwr::transceiverIndexForSession):
3061         (WebCore::MediaEndpointOwr::sessionMid):
3062         (WebCore::MediaEndpointOwr::matchTransceiverByMid):
3063         (WebCore::MediaEndpointOwr::dispatchNewIceCandidate):
3064         (WebCore::MediaEndpointOwr::dispatchGatheringDone):
3065         (WebCore::MediaEndpointOwr::processIceTransportStateChange):
3066         (WebCore::MediaEndpointOwr::dispatchDtlsFingerprint):
3067         (WebCore::MediaEndpointOwr::unmuteRemoteSource):
3068         (WebCore::MediaEndpointOwr::prepareSession):
3069         (WebCore::MediaEndpointOwr::prepareMediaSession):
3070         (WebCore::parseHelperServerUrl):
3071         (WebCore::MediaEndpointOwr::ensureTransportAgentAndTransceivers):
3072         (WebCore::MediaEndpointOwr::internalAddRemoteCandidate):
3073         (WebCore::gotCandidate):
3074         (WebCore::candidateGatheringDone):
3075         (WebCore::iceConnectionStateChange):
3076         (WebCore::gotIncomingSource):
3077         * platform/mediastream/openwebrtc/MediaEndpointOwr.h: Added.
3078         (WebCore::OwrTransceiver::create):
3079         (WebCore::OwrTransceiver::~OwrTransceiver):
3080         (WebCore::OwrTransceiver::mid):
3081         (WebCore::OwrTransceiver::session):
3082         (WebCore::OwrTransceiver::owrIceState):
3083         (WebCore::OwrTransceiver::setOwrIceState):
3084         (WebCore::OwrTransceiver::gotEndOfRemoteCandidates):
3085         (WebCore::OwrTransceiver::markGotEndOfRemoteCandidates):
3086         (WebCore::OwrTransceiver::OwrTransceiver):
3087         * platform/mediastream/openwebrtc/RealtimeMediaSourceOwr.h:
3088         (WebCore::RealtimeMediaSourceOwr::RealtimeMediaSourceOwr):
3089         (WebCore::RealtimeMediaSourceOwr::swapOutShallowSource):
3090         Add support for an initially muted source. This is used for early
3091         creation of remote sources.
3092
3093 2016-10-21  Javier Fernandez  <jfernandez@igalia.com>
3094
3095         [css-grid] Content Alignment broken with indefinite sized grid container
3096         https://bugs.webkit.org/show_bug.cgi?id=163724
3097
3098         Reviewed by Manuel Rego Casasnovas.
3099
3100         The Grid Tracks sizing algorithm receives as parameter the
3101         available space to be used as space for tracks. We hold a variable
3102         to store the remaining free space for each dimension.
3103
3104         When the grid container size is indefinite we can't compute the
3105         available free space after computing track sizes until such
3106         indefinite size is resolved.
3107
3108         No new tests, just added some additional test cases.
3109
3110         * rendering/RenderGrid.cpp:
3111         (WebCore::RenderGrid::layoutBlock): Compute freeSpace for Rows
3112         after doing layout and resolving the indefinite height.
3113
3114 2016-10-21  Jer Noble  <jer.noble@apple.com>
3115
3116         CRASH in SourceBuffer::sourceBufferPrivateDidReceiveSample + 2169
3117         https://bugs.webkit.org/show_bug.cgi?id=163735
3118
3119         Reviewed by Eric Carlson.
3120
3121         Test: media/media-source/media-source-sample-wrong-track-id.html
3122
3123         When SourceBuffer receives a sample in sourceBufferPrivateDidReceiveSample() containing
3124         a trackID not previously seen in an initialization segment, it creates a default TrackBuffer
3125         object to contain that track's samples. One of the fields in TrackBuffer, description, is
3126         normally filled out when an initialization segment is received, but with this default
3127         TrackBuffer, it's still null when it's checked later in sourceBufferPrivateDidReceiveSample().
3128
3129         Rather than adding a null-check on trackBuffer.description, drop any sample that has a 
3130         trackID which was not present during a previous initialization segment.
3131
3132         * Modules/mediasource/SourceBuffer.cpp:
3133         (WebCore::SourceBuffer::sourceBufferPrivateDidReceiveSample):
3134
3135 2016-10-20  Carlos Garcia Campos  <cgarcia@igalia.com>
3136
3137         [GTK] Configures but fails to link with ENABLE_OPENGL=OFF
3138         https://bugs.webkit.org/show_bug.cgi?id=163449
3139
3140         Reviewed by Michael Catanzaro.
3141
3142         Only define sharingGLContext in PlatformDisplay if EGL or GLX are enabled.
3143
3144         * platform/graphics/PlatformDisplay.cpp:
3145         * platform/graphics/PlatformDisplay.h:
3146         * platform/graphics/wayland/PlatformDisplayWayland.cpp:
3147         (WebCore::PlatformDisplayWayland::initialize):
3148         * platform/graphics/x11/PlatformDisplayX11.cpp:
3149         (WebCore::PlatformDisplayX11::~PlatformDisplayX11):
3150
3151 2016-10-20  Filip Pizlo  <fpizlo@apple.com>
3152
3153         The tracking of the coarse-grain Heap state (allocating or not, collector or not, eden vs full) should respect the orthogonality between allocating and collecting
3154         https://bugs.webkit.org/show_bug.cgi?id=163738
3155
3156         Reviewed by Geoffrey Garen.
3157
3158         No new tests because no change in behavior.
3159
3160         * bindings/js/GCController.cpp:
3161         (WebCore::GCController::garbageCollectNow):
3162
3163 2016-10-20  Chris Dumez  <cdumez@apple.com>
3164
3165         [Bindings] Start using signature->idlType instead of signature->type in the overload resolution code
3166         https://bugs.webkit.org/show_bug.cgi?id=163767
3167
3168         Reviewed by Darin Adler.
3169
3170         Start using signature->idlType instead of signature->type in the overload resolution code
3171         to prepare for union type support.
3172
3173         * bindings/scripts/CodeGeneratorJS.pm:
3174         (ComputeEffectiveOverloadSet):
3175         (AreTypesDistinguishableForOverloadResolution):
3176         (GetDistinguishingArgumentIndex):
3177         (GetOverloadThatMatches):
3178         (GenerateOverloadedFunctionOrConstructor):
3179
3180 2016-10-20  Myles C. Maxfield  <mmaxfield@apple.com>
3181
3182         Implement WebGL2 bufferData() and bufferSubData() methods
3183         https://bugs.webkit.org/show_bug.cgi?id=163759
3184
3185         Reviewed by Dean Jackson.
3186
3187         These new overloads simply clip the input array buffer.
3188
3189         Test: fast/canvas/webgl/bufferData-offset-length.html
3190
3191         * html/canvas/WebGL2RenderingContext.cpp:
3192         (WebCore::WebGL2RenderingContext::bufferData):
3193         (WebCore::WebGL2RenderingContext::bufferSubData):
3194         * html/canvas/WebGL2RenderingContext.h:
3195         * html/canvas/WebGL2RenderingContext.idl:
3196
3197 2016-10-20  Chris Dumez  <cdumez@apple.com>
3198
3199         "Download Linked File" context menu action should use 'download' attribute as suggested filename
3200         https://bugs.webkit.org/show_bug.cgi?id=163742
3201         <rdar://problem/28840734>
3202
3203         Reviewed by Darin Adler.
3204
3205         Add convenience method to HitTestResult to return the URL element's
3206         download attribute.
3207
3208         * rendering/HitTestResult.cpp:
3209         (WebCore::HitTestResult::URLElementDownloadAttribute):
3210         * rendering/HitTestResult.h:
3211
3212 2016-10-20  Nan Wang  <n_wang@apple.com>
3213
3214         AX: VoiceOver is not detecting ARIA treeview if it contains role="presentation"
3215         https://bugs.webkit.org/show_bug.cgi?id=163763
3216
3217         Reviewed by Chris Fleizach.
3218
3219         Test: accessibility/mac/aria-tree-with-presentation-role.html
3220
3221         Web authors sometimes use presentation role in the aria tree to hide elements. We should
3222         consider this a valid case if they specify tree items and groups correctly.
3223
3224         * accessibility/AccessibilityNodeObject.cpp:
3225         (WebCore::AccessibilityNodeObject::hierarchicalLevel):
3226         * accessibility/AccessibilityTree.cpp:
3227         (WebCore::AccessibilityTree::nodeHasTreeItemChild):
3228         (WebCore::AccessibilityTree::isTreeValid):
3229         * accessibility/AccessibilityTree.h:
3230
3231 2016-10-20  Myles C. Maxfield  <mmaxfield@apple.com>
3232
3233         Many WebGL functions which don't throw are marked as possibly throwing
3234         https://bugs.webkit.org/show_bug.cgi?id=163747
3235
3236         Reviewed by Dean Jackson.
3237
3238         Mechanically remove the exception code.
3239
3240         No new tests because there is no behavior change.
3241
3242         * bindings/js/JSWebGLRenderingContextBaseCustom.cpp:
3243         (WebCore::getObjectParameter):
3244         (WebCore::JSWebGLRenderingContextBase::getAttachedShaders):
3245         (WebCore::JSWebGLRenderingContextBase::getProgramParameter):
3246         (WebCore::JSWebGLRenderingContextBase::getShaderParameter):
3247         (WebCore::JSWebGLRenderingContextBase::getUniform):
3248         (WebCore::dataFunctionf):
3249         (WebCore::dataFunctioni):
3250         (WebCore::dataFunctionMatrix):
3251         * html/canvas/WebGL2RenderingContext.cpp:
3252         (WebCore::WebGL2RenderingContext::texSubImage2D):
3253         * html/canvas/WebGLRenderingContext.cpp:
3254         (WebCore::WebGLRenderingContext::texSubImage2D):
3255         * html/canvas/WebGLRenderingContextBase.cpp:
3256         (WebCore::WebGLRenderingContextBase::activeTexture):
3257         (WebCore::WebGLRenderingContextBase::attachShader):
3258         (WebCore::WebGLRenderingContextBase::bindAttribLocation):
3259         (WebCore::WebGLRenderingContextBase::bindBuffer):
3260         (WebCore::WebGLRenderingContextBase::bindFramebuffer):
3261         (WebCore::WebGLRenderingContextBase::bindRenderbuffer):
3262         (WebCore::WebGLRenderingContextBase::bindTexture):
3263         (WebCore::WebGLRenderingContextBase::bufferData):
3264         (WebCore::WebGLRenderingContextBase::bufferSubData):
3265         (WebCore::WebGLRenderingContextBase::compileShader):
3266         (WebCore::WebGLRenderingContextBase::createShader):
3267         (WebCore::WebGLRenderingContextBase::detachShader):
3268         (WebCore::WebGLRenderingContextBase::disableVertexAttribArray):
3269         (WebCore::WebGLRenderingContextBase::drawArrays):
3270         (WebCore::WebGLRenderingContextBase::drawElements):
3271         (WebCore::WebGLRenderingContextBase::enableVertexAttribArray):
3272         (WebCore::WebGLRenderingContextBase::framebufferRenderbuffer):
3273         (WebCore::WebGLRenderingContextBase::framebufferTexture2D):
3274         (WebCore::WebGLRenderingContextBase::getActiveAttrib):
3275         (WebCore::WebGLRenderingContextBase::getActiveUniform):
3276         (WebCore::WebGLRenderingContextBase::getAttachedShaders):
3277         (WebCore::WebGLRenderingContextBase::getBufferParameter):
3278         (WebCore::WebGLRenderingContextBase::getProgramParameter):
3279         (WebCore::WebGLRenderingContextBase::getProgramInfoLog):
3280         (WebCore::WebGLRenderingContextBase::getRenderbufferParameter):
3281         (WebCore::WebGLRenderingContextBase::getShaderParameter):
3282         (WebCore::WebGLRenderingContextBase::getShaderInfoLog):
3283         (WebCore::WebGLRenderingContextBase::getShaderPrecisionFormat):
3284         (WebCore::WebGLRenderingContextBase::getShaderSource):
3285         (WebCore::WebGLRenderingContextBase::getTexParameter):
3286         (WebCore::WebGLRenderingContextBase::getUniform):
3287         (WebCore::WebGLRenderingContextBase::getUniformLocation):
3288         (WebCore::WebGLRenderingContextBase::getVertexAttrib):
3289         (WebCore::WebGLRenderingContextBase::linkProgram):
3290         (WebCore::WebGLRenderingContextBase::readPixels):
3291         (WebCore::WebGLRenderingContextBase::shaderSource):
3292         (WebCore::WebGLRenderingContextBase::videoFrameToImage):
3293         (WebCore::WebGLRenderingContextBase::texImage2D):
3294         (WebCore::WebGLRenderingContextBase::uniform1f):
3295         (WebCore::WebGLRenderingContextBase::uniform1fv):
3296         (WebCore::WebGLRenderingContextBase::uniform1i):
3297         (WebCore::WebGLRenderingContextBase::uniform1iv):
3298         (WebCore::WebGLRenderingContextBase::uniform2f):
3299         (WebCore::WebGLRenderingContextBase::uniform2fv):
3300         (WebCore::WebGLRenderingContextBase::uniform2i):
3301         (WebCore::WebGLRenderingContextBase::uniform2iv):
3302         (WebCore::WebGLRenderingContextBase::uniform3f):
3303         (WebCore::WebGLRenderingContextBase::uniform3fv):
3304         (WebCore::WebGLRenderingContextBase::uniform3i):
3305         (WebCore::WebGLRenderingContextBase::uniform3iv):
3306         (WebCore::WebGLRenderingContextBase::uniform4f):
3307         (WebCore::WebGLRenderingContextBase::uniform4fv):
3308         (WebCore::WebGLRenderingContextBase::uniform4i):
3309         (WebCore::WebGLRenderingContextBase::uniform4iv):
3310         (WebCore::WebGLRenderingContextBase::uniformMatrix2fv):
3311         (WebCore::WebGLRenderingContextBase::uniformMatrix3fv):
3312         (WebCore::WebGLRenderingContextBase::uniformMatrix4fv):
3313         (WebCore::WebGLRenderingContextBase::useProgram):
3314         (WebCore::WebGLRenderingContextBase::validateProgram):
3315         (WebCore::WebGLRenderingContextBase::vertexAttribPointer):
3316         (WebCore::WebGLRenderingContextBase::restoreCurrentFramebuffer):
3317         (WebCore::WebGLRenderingContextBase::restoreCurrentTexture2D):
3318         * html/canvas/WebGLRenderingContextBase.h:
3319         * html/canvas/WebGLRenderingContextBase.idl:
3320
3321 2016-10-19  Myles C. Maxfield  <mmaxfield@apple.com>
3322
3323         [macOS] [iOS] Disable variation fonts on macOS El Capitan and iOS 9
3324         https://bugs.webkit.org/show_bug.cgi?id=163374
3325
3326         Reviewed by Darin Adler.
3327
3328         Because of platform lack of support for variations in in-memory fonts,
3329         this feature should be disabled on the affected OSes.
3330
3331         No tests because there is no behavior change (on the relevant platforms).
3332
3333         * Configurations/FeatureDefines.xcconfig:
3334
3335 2016-10-20  Brady Eidson  <beidson@apple.com>
3336
3337         IndexedDB 2.0: Support IDBObjectStore name assignment.
3338         <rdar://problem/28806931> and https://bugs.webkit.org/show_bug.cgi?id=163749
3339
3340         Reviewed by Alex Christensen.
3341
3342         Tests: storage/indexeddb/modern/objectstore-rename-1-private.html
3343                storage/indexeddb/modern/objectstore-rename-1.html
3344
3345         Touches a *lot* of code sites, but none of them are particularly interesting.
3346         They are all just getting the new name spread out to all of the various objects that need it.
3347
3348         * Modules/indexeddb/IDBDatabase.cpp:
3349         (WebCore::IDBDatabase::renameObjectStore):
3350         * Modules/indexeddb/IDBDatabase.h:
3351
3352         * Modules/indexeddb/IDBObjectStore.cpp:
3353         (WebCore::IDBObjectStore::setName):
3354         * Modules/indexeddb/IDBObjectStore.h:
3355         * Modules/indexeddb/IDBObjectStore.idl:
3356
3357         * Modules/indexeddb/IDBTransaction.cpp:
3358         (WebCore::IDBTransaction::renameObjectStore):
3359         (WebCore::IDBTransaction::renameObjectStoreOnServer):
3360         (WebCore::IDBTransaction::didRenameObjectStoreOnServer):
3361         * Modules/indexeddb/IDBTransaction.h:
3362
3363         * Modules/indexeddb/client/IDBConnectionProxy.cpp:
3364         (WebCore::IDBClient::IDBConnectionProxy::renameObjectStore):
3365         * Modules/indexeddb/client/IDBConnectionProxy.h:
3366
3367         * Modules/indexeddb/client/IDBConnectionToServer.cpp:
3368         (WebCore::IDBClient::IDBConnectionToServer::renameObjectStore):
3369         (WebCore::IDBClient::IDBConnectionToServer::didRenameObjectStore):
3370         * Modules/indexeddb/client/IDBConnectionToServer.h:
3371         * Modules/indexeddb/client/IDBConnectionToServerDelegate.h:
3372
3373         * Modules/indexeddb/server/IDBBackingStore.h:
3374
3375         * Modules/indexeddb/server/IDBConnectionToClient.cpp:
3376         (WebCore::IDBServer::IDBConnectionToClient::didDeleteObjectStore):
3377         (WebCore::IDBServer::IDBConnectionToClient::didRenameObjectStore):
3378         * Modules/indexeddb/server/IDBConnectionToClient.h:
3379         * Modules/indexeddb/server/IDBConnectionToClientDelegate.h:
3380
3381         * Modules/indexeddb/server/IDBServer.cpp:
3382         (WebCore::IDBServer::IDBServer::renameObjectStore):
3383         * Modules/indexeddb/server/IDBServer.h:
3384
3385         * Modules/indexeddb/server/MemoryBackingStoreTransaction.cpp:
3386         (WebCore::IDBServer::MemoryBackingStoreTransaction::objectStoreRenamed):
3387         (WebCore::IDBServer::MemoryBackingStoreTransaction::abort):
3388         * Modules/indexeddb/server/MemoryBackingStoreTransaction.h:
3389
3390         * Modules/indexeddb/server/MemoryIDBBackingStore.cpp:
3391         (WebCore::IDBServer::MemoryIDBBackingStore::renameObjectStore):
3392         * Modules/indexeddb/server/MemoryIDBBackingStore.h:
3393
3394         * Modules/indexeddb/server/MemoryObjectStore.h:
3395         (WebCore::IDBServer::MemoryObjectStore::rename):
3396
3397         * Modules/indexeddb/server/SQLiteIDBBackingStore.cpp:
3398         (WebCore::IDBServer::SQLiteIDBBackingStore::renameObjectStore):
3399         * Modules/indexeddb/server/SQLiteIDBBackingStore.h:
3400
3401         * Modules/indexeddb/server/UniqueIDBDatabase.cpp:
3402         (WebCore::IDBServer::UniqueIDBDatabase::renameObjectStore):
3403         (WebCore::IDBServer::UniqueIDBDatabase::performRenameObjectStore):
3404         (WebCore::IDBServer::UniqueIDBDatabase::didPerformRenameObjectStore):
3405         * Modules/indexeddb/server/UniqueIDBDatabase.h:
3406
3407         * Modules/indexeddb/server/UniqueIDBDatabaseConnection.cpp:
3408         (We