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