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