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