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