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