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