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