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