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