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