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