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