01a2dfc34a88bc97642203aa9bfad0f31a9377fe
[WebKit-https.git] / Source / WebCore / ChangeLog
1 2016-10-10  Youenn Fablet  <youenn@apple.com>
2
3         Attribute getter binding generated code should use more references
4         https://bugs.webkit.org/show_bug.cgi?id=163179
5
6         Reviewed by Darin Adler.
7
8         No change of behavior.
9
10         Using more references in attribute getter generated code since BindingCaller::attribute can do the
11         pointer-to-references checks once for all.
12
13         Needed to update GenerateCallWith and NativeToJSValue to handle the case where references (attribute getters) or
14         pointers (methods and attribute setters) are to be used.
15         Future refactoring should allign methods/attribute setters to attribute getters.
16
17         * bindings/js/JSDOMBinding.h:
18         (WebCore::BindingCaller::attribute):
19         * bindings/scripts/CodeGeneratorJS.pm:
20         (GenerateImplementation):
21         (GenerateCallWith):
22         (NativeToJSValue):
23         (JSValueToNative):
24         * bindings/scripts/test/JS/JSTestActiveDOMObject.cpp:
25         * bindings/scripts/test/JS/JSTestEventConstructor.cpp:
26         * bindings/scripts/test/JS/JSTestException.cpp:
27         * bindings/scripts/test/JS/JSTestGlobalObject.cpp:
28         * bindings/scripts/test/JS/JSTestInterface.cpp:
29         * bindings/scripts/test/JS/JSTestJSBuiltinConstructor.cpp:
30         * bindings/scripts/test/JS/JSTestNode.cpp:
31         * bindings/scripts/test/JS/JSTestNondeterministic.cpp:
32         * bindings/scripts/test/JS/JSTestObj.cpp:
33         * bindings/scripts/test/JS/JSattribute.cpp:
34
35 2016-10-10  Youenn Fablet  <youenn@apple.com>
36
37         Fix Mac Win build after https://trac.webkit.org/changeset/206966
38         https://bugs.webkit.org/show_bug.cgi?id=163199
39
40         Unreviewed.
41
42         * bindings/js/JSDOMBinding.h: Marking rejectPromiseWithGetterTypeError as WEBCORE_EXPORT.
43
44 2016-10-09  Antti Koivisto  <antti@apple.com>
45
46         Enable optimized stylesheet updates in shadow trees
47         https://bugs.webkit.org/show_bug.cgi?id=163180
48
49         Reviewed by Darin Adler.
50
51         When we get a new stylesheet (for example when load completes) we invalidate only
52         those elements in DOM that are affected by the new sheet. This patch makes the
53         optimization also work in shadow trees.
54
55         Test: fast/shadow-dom/scoped-style-invalidation.html
56
57         * css/StyleInvalidationAnalysis.cpp:
58         (WebCore::StyleInvalidationAnalysis::invalidateStyle):
59         * css/StyleInvalidationAnalysis.h:
60         * dom/Document.cpp:
61         (WebCore::Document::didRemoveAllPendingStylesheet):
62         * style/StyleScope.cpp:
63         (WebCore::Style::Scope::removePendingSheet):
64         (WebCore::Style::Scope::analyzeStyleSheetChange):
65         (WebCore::Style::Scope::updateActiveStyleSheets):
66
67 2016-10-10  Youenn Fablet  <youenn@apple.com>
68
69         Refactor binding generated casted-this checks for attribute setters
70         https://bugs.webkit.org/show_bug.cgi?id=163181
71
72         Reviewed by Darin Adler.
73
74         No change of behavior.
75         Covered by existing tests and binding expectations.
76
77         Adding support for attribute setter in BindingCaller.
78         Updating binding generator to make use of it.
79         Future refactoring should use more reference and rename castedThis to thisObject, like for getters.
80
81         * bindings/js/JSDOMBinding.h:
82         (WebCore::BindingCaller::setAttribute):
83         * bindings/scripts/CodeGeneratorJS.pm:
84         (GenerateImplementation):
85         * bindings/scripts/test/JS/JSTestInterface.cpp:
86         * bindings/scripts/test/JS/JSTestJSBuiltinConstructor.cpp:
87         * bindings/scripts/test/JS/JSTestNode.cpp:
88         * bindings/scripts/test/JS/JSTestNondeterministic.cpp:
89         * bindings/scripts/test/JS/JSTestObj.cpp:
90         * bindings/scripts/test/JS/JSTestSerializedScriptValueInterface.cpp:
91         * bindings/scripts/test/JS/JSTestTypedefs.cpp:
92
93 2016-10-09  Darin Adler  <darin@apple.com>
94
95         Move encrypted media from legacy to new DOM exceptions
96         https://bugs.webkit.org/show_bug.cgi?id=163194
97
98         Reviewed by Youenn Fablet.
99
100         * Modules/encryptedmedia/CDM.cpp:
101         (WebCore::CDM::createSession): Take a reference instead of a pointer.
102         * Modules/encryptedmedia/CDM.h: Updated for above change.
103
104         * Modules/encryptedmedia/legacy/WebKitMediaKeySession.cpp:
105         (WebCore::WebKitMediaKeySession::create): Take a reference instead of a pointer.
106         (WebCore::WebKitMediaKeySession::MediaKeySession): Ditto.
107         (WebCore::WebKitMediaKeySession::~MediaKeySession): Removed unneeded code that
108         sets m_session to null.
109         (WebCore::WebKitMediaKeySession::keyRequestTimerFired): Use auto.
110         (WebCore::WebKitMediaKeySession::update): Use ExceptionOr.
111         (WebCore::WebKitMediaKeySession::addKeyTimerFired): Use m_keys directly instead
112         of calling the keys function.
113         (WebCore::WebKitMediaKeySession::sendError): Set m_error directly instead of
114         calling the setError function.
115         (WebCore::WebKitMediaKeySession::mediaKeysStorageDirectory): Use auto.
116         (WebCore::WebKitMediaKeySession::hasPendingActivity): Check m_session directly
117         instead of writing !isClosed.
118         (WebCore::WebKitMediaKeySession::setError): Deleted.
119
120         * Modules/encryptedmedia/legacy/WebKitMediaKeySession.h: Use pragma once. Removed
121         unneeded includes. Changed create to take a reference instead of a pointer.
122         Made most members and base classes private instead of public. Also removed
123         a few now-unneeded functions. Made everything that was formerly protected
124         private instead, since the two are the same in a final class.
125
126         * Modules/encryptedmedia/legacy/WebKitMediaKeySession.idl: Removed unneeded comments.
127         Moved from MayThrowLegacyException to MayThrowException.
128
129         * Modules/encryptedmedia/legacy/WebKitMediaKeys.cpp:
130         (WebCore::WebKitMediaKeys::create): Use ExceptionOr.
131         (WebCore::WebKitMediaKeys::MediaKeys): Made argument be an rvalue reference.
132         Also initialize m_mediaElement in the class definition.
133         (WebCore::WebKitMediaKeys::~MediaKeys): Call detachKeys instead of setKeys(nullptr).
134         (WebCore::WebKitMediaKeys::createSession): Use ExceptionOr. Also pass reference
135         insteead of pointer to create. Also removed unneeded separate checks for null
136         strings in code that already calls isEmpty.
137         (WebCore::WebKitMediaKeys::isTypeSupported): Removed unneeded checks for null strings
138         in code that already calls isEmpty.
139         (WebCore::WebKitMediaKeys::cdmMediaPlayer): Tweaked a bit.
140         (WebCore::WebKitMediaKeys::cachedKeyForKeyId): Use auto.
141
142         * Modules/encryptedmedia/legacy/WebKitMediaKeys.h: Use pragma once. Removed unneeded includes.
143         Changed cdm() function to return a reference. Initialize m_mediaElement.
144         Use private instead of protected.
145
146         * Modules/encryptedmedia/legacy/WebKitMediaKeys.idl: Use ConstructorMayThrowException
147         and MayThrowException instead of the legacy versions.
148
149 2016-10-09  Zan Dobersek  <zdobersek@igalia.com>
150
151         ENABLE_LEGACY_ENCRYPTED_MEDIA interfaces should have a hard-coded WebKit prefix
152         https://bugs.webkit.org/show_bug.cgi?id=162982
153
154         Reviewed by Jer Noble.
155
156         Have the Web-exposed interfaces guarded by ENABLE_LEGACY_ENCRYPTED_MEDIA also use
157         the WebKit prefix in the implementations. This will prevent conflicts between
158         interfaces with same names in both the legacy API and the future EME API.
159
160         Most of the interfaces in this legacy API already used the WebKit prefix when
161         exposed via JS bindings. The only exception is MediaKeyNeededEvent, which gets
162         prefixed in this patch.
163
164         The interface implementations for this legacy API are also moved under the
165         Modules/encryptedmedia/legacy/ directory.
166
167         No new tests -- covered by existing tests (with the relevant changes reflected
168         in the updated baselines).
169
170         * CMakeLists.txt:
171         * DerivedSources.cpp:
172         * DerivedSources.make:
173         * Modules/encryptedmedia/CDM.cpp:
174         * Modules/encryptedmedia/CDMSessionClearKey.cpp:
175         (WebCore::CDMSessionClearKey::generateKeyRequest):
176         (WebCore::CDMSessionClearKey::update):
177         * Modules/encryptedmedia/legacy/WebKitMediaKeyMessageEvent.cpp: Renamed from Source/WebCore/Modules/encryptedmedia/MediaKeyMessageEvent.cpp.
178         (WebCore::WebKitMediaKeyMessageEvent::WebKitMediaKeyMessageEvent):
179         (WebCore::WebKitMediaKeyMessageEvent::~WebKitMediaKeyMessageEvent):
180         (WebCore::WebKitMediaKeyMessageEvent::eventInterface):
181         * Modules/encryptedmedia/legacy/WebKitMediaKeyMessageEvent.h: Renamed from Source/WebCore/Modules/encryptedmedia/MediaKeyMessageEvent.h.
182         (WebCore::WebKitMediaKeyMessageEvent::create):
183         (WebCore::WebKitMediaKeyMessageEvent::createForBindings):
184         * Modules/encryptedmedia/legacy/WebKitMediaKeyMessageEvent.idl: Renamed from Source/WebCore/Modules/encryptedmedia/MediaKeyMessageEvent.idl.
185         * Modules/encryptedmedia/legacy/WebKitMediaKeyNeededEvent.cpp: Renamed from Source/WebCore/Modules/encryptedmedia/MediaKeyNeededEvent.cpp.
186         (WebCore::WebKitMediaKeyNeededEvent::WebKitMediaKeyNeededEvent):
187         (WebCore::WebKitMediaKeyNeededEvent::~WebKitMediaKeyNeededEvent):
188         (WebCore::WebKitMediaKeyNeededEvent::eventInterface):
189         * Modules/encryptedmedia/legacy/WebKitMediaKeyNeededEvent.h: Renamed from Source/WebCore/Modules/encryptedmedia/MediaKeyNeededEvent.h.
190         (WebCore::WebKitMediaKeyNeededEvent::create):
191         (WebCore::WebKitMediaKeyNeededEvent::createForBindings):
192         * Modules/encryptedmedia/legacy/WebKitMediaKeyNeededEvent.idl: Renamed from Source/WebCore/Modules/encryptedmedia/MediaKeyNeededEvent.idl.
193         * Modules/encryptedmedia/legacy/WebKitMediaKeySession.cpp: Renamed from Source/WebCore/Modules/encryptedmedia/MediaKeySession.cpp.
194         (WebCore::WebKitMediaKeySession::create):
195         (WebCore::WebKitMediaKeySession::WebKitMediaKeySession):
196         (WebCore::WebKitMediaKeySession::~WebKitMediaKeySession):
197         (WebCore::WebKitMediaKeySession::setError):
198         (WebCore::WebKitMediaKeySession::close):
199         (WebCore::WebKitMediaKeySession::cachedKeyForKeyId):
200         (WebCore::WebKitMediaKeySession::sessionId):
201         (WebCore::WebKitMediaKeySession::generateKeyRequest):
202         (WebCore::WebKitMediaKeySession::keyRequestTimerFired):
203         (WebCore::WebKitMediaKeySession::update):
204         (WebCore::WebKitMediaKeySession::addKeyTimerFired):
205         (WebCore::WebKitMediaKeySession::sendMessage):
206         (WebCore::WebKitMediaKeySession::sendError):
207         (WebCore::WebKitMediaKeySession::mediaKeysStorageDirectory):
208         (WebCore::WebKitMediaKeySession::hasPendingActivity):
209         (WebCore::WebKitMediaKeySession::stop):
210         (WebCore::WebKitMediaKeySession::activeDOMObjectName):
211         (WebCore::WebKitMediaKeySession::canSuspendForDocumentSuspension):
212         * Modules/encryptedmedia/legacy/WebKitMediaKeySession.h: Renamed from Source/WebCore/Modules/encryptedmedia/MediaKeySession.h.
213         * Modules/encryptedmedia/legacy/WebKitMediaKeySession.idl: Renamed from Source/WebCore/Modules/encryptedmedia/MediaKeySession.idl.
214         * Modules/encryptedmedia/legacy/WebKitMediaKeys.cpp: Renamed from Source/WebCore/Modules/encryptedmedia/MediaKeys.cpp.
215         (WebCore::WebKitMediaKeys::create):
216         (WebCore::WebKitMediaKeys::WebKitMediaKeys):
217         (WebCore::WebKitMediaKeys::~WebKitMediaKeys):
218         (WebCore::WebKitMediaKeys::createSession):
219         (WebCore::WebKitMediaKeys::isTypeSupported):
220         (WebCore::WebKitMediaKeys::setMediaElement):
221         (WebCore::WebKitMediaKeys::cdmMediaPlayer):
222         (WebCore::WebKitMediaKeys::keyAdded):
223         (WebCore::WebKitMediaKeys::cachedKeyForKeyId):
224         * Modules/encryptedmedia/legacy/WebKitMediaKeys.h: Renamed from Source/WebCore/Modules/encryptedmedia/MediaKeys.h.
225         * Modules/encryptedmedia/legacy/WebKitMediaKeys.idl: Renamed from Source/WebCore/Modules/encryptedmedia/MediaKeys.idl.
226         * bindings/js/JSDictionary.cpp:
227         (WebCore::JSDictionary::convertValue):
228         * bindings/js/JSDictionary.h:
229         * dom/EventNames.in:
230         * dom/EventTargetFactory.in:
231         * html/HTMLMediaElement.cpp:
232         (WebCore::HTMLMediaElement::mediaPlayerKeyNeeded):
233         (WebCore::HTMLMediaElement::setMediaKeys):
234         * html/HTMLMediaElement.h:
235         (WebCore::HTMLMediaElement::keys):
236         * html/HTMLMediaElement.idl:
237         * html/WebKitMediaKeyError.h: Renamed from Source/WebCore/html/MediaKeyError.h.
238         (WebCore::WebKitMediaKeyError::create):
239         (WebCore::WebKitMediaKeyError::WebKitMediaKeyError):
240         * html/WebKitMediaKeyError.idl: Renamed from Source/WebCore/html/MediaKeyError.idl.
241         * testing/MockCDM.cpp:
242         (WebCore::MockCDMSession::generateKeyRequest):
243         (WebCore::MockCDMSession::update):
244
245 2016-10-09  Zan Dobersek  <zdobersek@igalia.com>
246
247         Remove stale ENABLE(ENCRYPTED_MEDIA) code in HTMLMediaElement
248         https://bugs.webkit.org/show_bug.cgi?id=163111
249
250         Reviewed by Alex Christensen.
251
252         Remove three method implementations in HTMLMediaElement which had their
253         declarations and the related WebIDL entries removed in the first ENCRYPTED_MEDIA
254         purge in r206440.
255
256         No new tests -- no changes in behavior.
257
258         * html/HTMLMediaElement.cpp:
259         (WebCore::HTMLMediaElement::webkitGenerateKeyRequest): Deleted.
260         (WebCore::HTMLMediaElement::webkitAddKey): Deleted.
261         (WebCore::HTMLMediaElement::webkitCancelKeyRequest): Deleted.
262
263 2016-10-09  Wenson Hsieh  <wenson_hsieh@apple.com>
264
265         Support InputEvent.inputType for the new InputEvent spec
266         https://bugs.webkit.org/show_bug.cgi?id=163025
267         <rdar://problem/28658092>
268
269         Reviewed by Darin Adler.
270
271         Adds support for the inputType attribute of InputEvent. To do this, we introduce a helper to
272         map EditActions to inputType names, and also split out ambiguous EditActions (such as
273         EditActionTyping) into more specific subtypes (such as EditActionTypingDeleteBackward,
274         EditActionTypingInsertParagraph, etc.), each of which corresponds to an inputType.
275
276         In places where we create CompositeEditCommands, we now pass in these specific EditActions
277         where appropriate, and when dispatching `beforeinput` and `input` events, we ask the
278         CompositeEditCommand for its input type name, which it derives from its editingAction.
279
280         Tests: fast/events/before-input-prevent-biu.html
281                fast/events/before-input-prevent-cut.html
282                fast/events/before-input-prevent-paste.html
283                fast/events/before-input-prevent-typing.html
284                fast/events/before-input-prevent-undo.html
285
286         * dom/InputEvent.h:
287         * dom/Node.cpp:
288         (WebCore::Node::dispatchInputEvent):
289         * dom/Node.h:
290         * editing/CompositeEditCommand.cpp:
291         (WebCore::CompositeEditCommand::apply):
292         (WebCore::CompositeEditCommand::inputEventTypeName):
293
294         Allows a CompositeEditCommand to specify the inputType its corresponding `beforeinput` and `input` events
295         should have.
296
297         * editing/CompositeEditCommand.h:
298         (WebCore::CompositeEditCommand::shouldStopCaretBlinking): Deleted.
299         * editing/EditAction.h:
300         * editing/EditCommand.cpp:
301         (WebCore::inputTypeNameForEditingAction):
302         * editing/EditCommand.h:
303         * editing/Editor.cpp:
304         (WebCore::Editor::willApplyEditing):
305         (WebCore::Editor::appliedEditing):
306         (WebCore::Editor::willUnapplyEditing):
307         (WebCore::Editor::unappliedEditing):
308         (WebCore::Editor::willReapplyEditing):
309         (WebCore::Editor::reappliedEditing):
310         (WebCore::Editor::computeAndSetTypingStyle):
311         * editing/InsertListCommand.cpp:
312         (WebCore::InsertListCommand::editingAction):
313         * editing/InsertListCommand.h:
314         (WebCore::InsertListCommand::preservesTypingStyle): Deleted.
315         (WebCore::InsertListCommand::editingAction): Deleted.
316         * editing/ReplaceRangeWithTextCommand.cpp:
317         (WebCore::ReplaceRangeWithTextCommand::ReplaceRangeWithTextCommand):
318         * editing/SpellingCorrectionCommand.cpp:
319         (WebCore::SpellingCorrectionCommand::SpellingCorrectionCommand):
320         * editing/TypingCommand.cpp:
321         (WebCore::editActionForTypingCommand):
322         (WebCore::TypingCommand::TypingCommand):
323         (WebCore::TypingCommand::inputEventTypeName):
324
325         The editingAction() of a TypingCommand is the first editing action the TypingCommand was initialized using.
326         Since subsequent typing commands update the last open typing command, we override inputEventTypeName here to
327         use the last updated editing action rather than the default (initial) editing action.
328
329         (WebCore::TypingCommand::willAddTypingToOpenCommand):
330         (WebCore::TypingCommand::insertTextRunWithoutNewlines):
331         (WebCore::TypingCommand::insertParagraphSeparator):
332         * editing/TypingCommand.h:
333
334 2016-10-09  Darin Adler  <darin@apple.com>
335
336         Move ApplePaySession from legacy to new DOM exceptions
337         https://bugs.webkit.org/show_bug.cgi?id=163191
338
339         Reviewed by Sam Weinig.
340
341         * Modules/applepay/ApplePaySession.cpp:
342         (WebCore::ApplePaySession::create): Use ExceptionOr.
343         (WebCore::ApplePaySession::ApplePaySession): Moved initialization
344         of two of the data members to class definition.
345         (WebCore::ApplePaySession::supportsVersion): Use ExceptionOr.
346         (WebCore::ApplePaySession::canMakePayments): Ditto.
347         (WebCore::ApplePaySession::canMakePaymentsWithActiveCard): Ditto.
348         (WebCore::ApplePaySession::openPaymentSetup): Ditto.
349         (WebCore::ApplePaySession::begin): Ditto.
350         (WebCore::ApplePaySession::abort): Ditto.
351         (WebCore::ApplePaySession::completeMerchantValidation): Ditto.
352         (WebCore::ApplePaySession::completeShippingMethodSelection): Ditto.
353         (WebCore::ApplePaySession::completeShippingContactSelection): Ditto.
354         (WebCore::ApplePaySession::completePaymentMethodSelection): Ditto.
355         (WebCore::ApplePaySession::completePayment): Ditto.
356         (WebCore::ApplePaySession::validateMerchant): Use auto and get instead of
357         using a RefPtr type and * for event dispatching.
358         (WebCore::ApplePaySession::didAuthorizePayment): Ditto.
359         (WebCore::ApplePaySession::didSelectShippingMethod): Ditto.
360         (WebCore::ApplePaySession::didSelectShippingContact): Ditto.
361         (WebCore::ApplePaySession::didSelectPaymentMethod): Ditto.
362         (WebCore::ApplePaySession::didCancelPayment): Ditto.
363         (WebCore::ApplePaySession::paymentCoordinator): Moved dereferencing
364         inside the downcast.
365
366         * Modules/applepay/ApplePaySession.h: Updated for changes above.
367
368         * Modules/applepay/ApplePaySession.idl: Use MayThrowException.
369
370         * bindings/js/JSApplePaySessionCustom.cpp:
371         (WebCore::JSApplePaySession::completeShippingMethodSelection):
372         Use propagateException.
373         (WebCore::JSApplePaySession::completeShippingContactSelection): Ditto.
374         (WebCore::JSApplePaySession::completePaymentMethodSelection): Ditto.
375
376         * bindings/js/JSDOMBinding.h: Added implementation of toJSBoolean.
377
378         * bindings/scripts/CodeGeneratorJS.pm:
379         (GenerateConstructorDefinition): Generate the different arguments for
380         toJSNewlyCreated when ConstructorMayThrowException is specified that
381         activate the version of that function that handles exceptions.
382
383         * bindings/scripts/IDLAttributes.txt: Added ConstructorMayThrowException.
384
385 2016-10-09  Darin Adler  <darin@apple.com>
386
387         Replace all uses of ExceptionCodeWithMessage with WebCore::Exception
388         https://bugs.webkit.org/show_bug.cgi?id=163178
389
390         Reviewed by Sam Weinig.
391
392         * Modules/indexeddb/IDBCursor.cpp:
393         (WebCore::IDBCursor::stringToDirection): Return an Optional instead of
394         using an ExceptionCode out argument, since this function just needs to
395         indicate failure, not actually throw an exception.
396         (WebCore::IDBCursor::update): Return ExceptionOr instead of using an
397         ExceptionCodeWithMessage out argument.
398         (WebCore::IDBCursor::advance): Ditto.
399         (WebCore::IDBCursor::continueFunction): Ditto.
400         (WebCore::IDBCursor::deleteFunction): Ditto.
401         * Modules/indexeddb/IDBCursor.h: Updated for above changes.
402
403         * Modules/indexeddb/IDBCursor.idl: Sorted extended attributes alphabetically.
404         Use MayThrowException instead of MayThrowLegacyExceptionWithMessage.
405
406         * Modules/indexeddb/IDBDatabase.cpp:
407         (WebCore::IDBDatabase::createObjectStore): Return ExceptionOr instead of
408         using an ExceptionCodeWithMessage out argument.
409         (WebCore::IDBDatabase::transaction): Ditto.
410         (WebCore::IDBDatabase::deleteObjectStore): Ditto.
411         * Modules/indexeddb/IDBDatabase.h: Updated for above changes.
412
413         * Modules/indexeddb/IDBDatabase.idl: Use MayThrowException instead of
414         MayThrowLegacyExceptionWithMessage.
415
416         * Modules/indexeddb/IDBFactory.cpp:
417         (WebCore::IDBFactory::open): Return ExceptionOr instead of
418         using an ExceptionCodeWithMessage out argument.
419         (WebCore::IDBFactory::openInternal): Ditto.
420         (WebCore::IDBFactory::deleteDatabase): Ditto.
421         (WebCore::IDBFactory::cmp): Ditto.
422         * Modules/indexeddb/IDBFactory.h: Updated for above changes.
423
424         * Modules/indexeddb/IDBFactory.idl: Use MayThrowException instead of
425         MayThrowLegacyExceptionWithMessage.
426
427         * Modules/indexeddb/IDBIndex.cpp:
428         (WebCore::IDBIndex::openCursor): Return ExceptionOr instead of
429         using an ExceptionCodeWithMessage out argument.
430         (WebCore::IDBIndex::count): Ditto.
431         (WebCore::IDBIndex::doCount): Ditto.
432         (WebCore::IDBIndex::openKeyCursor): Ditto.
433         (WebCore::IDBIndex::get): Ditto.
434         (WebCore::IDBIndex::doGet): Ditto.
435         (WebCore::IDBIndex::getKey): Ditto.
436         (WebCore::IDBIndex::doGetKey): Ditto.
437         * Modules/indexeddb/IDBIndex.h: Updated for above changes.
438
439         * Modules/indexeddb/IDBIndex.idl: Use MayThrowException instead of
440         MayThrowLegacyExceptionWithMessage.
441
442         * Modules/indexeddb/IDBKeyRange.cpp:
443         (WebCore::IDBKeyRange::only): Return ExceptionOr instead of
444         using an ExceptionCode out argument.
445         (WebCore::IDBKeyRange::lowerBound): Ditto.
446         (WebCore::IDBKeyRange::upperBound): Ditto.
447         (WebCore::IDBKeyRange::bound): Ditto.
448         * Modules/indexeddb/IDBKeyRange.h: Updated for above changes.
449         * Modules/indexeddb/IDBKeyRange.idl: Use MayThrowException instead of
450         MayThrowLegacyException.
451
452         * Modules/indexeddb/IDBObjectStore.cpp:
453         (WebCore::IDBObjectStore::openCursor): Return ExceptionOr instead of
454         using an ExceptionCodeWithMessage out argument.
455         (WebCore::IDBObjectStore::get): Ditto.
456         (WebCore::IDBObjectStore::add): Ditto.
457         (WebCore::IDBObjectStore::put): Ditto.
458         (WebCore::IDBObjectStore::putForCursorUpdate): Ditto.
459         (WebCore::IDBObjectStore::putOrAdd): Ditto.
460         (WebCore::IDBObjectStore::deleteFunction): Ditto.
461         (WebCore::IDBObjectStore::doDelete): Ditto.
462         (WebCore::IDBObjectStore::clear): Ditto.
463         (WebCore::IDBObjectStore::createIndex): Ditto.
464         (WebCore::IDBObjectStore::index): Ditto.
465         (WebCore::IDBObjectStore::deleteIndex): Ditto.
466         (WebCore::IDBObjectStore::count): Ditto.
467         (WebCore::IDBObjectStore::doCount): Ditto.
468         * Modules/indexeddb/IDBObjectStore.h: Updated for above changes.
469
470         * Modules/indexeddb/IDBObjectStore.idl: Use MayThrowException instead of
471         MayThrowLegacyExceptionWithMessage.
472
473         * Modules/indexeddb/IDBRequest.cpp:
474         (WebCore::IDBRequest::errorCode): Deleted. Was dead code.
475         (WebCore::IDBRequest::error): Return ExceptionOr instead of
476         using an ExceptionCodeWithMessage out argument.
477         * Modules/indexeddb/IDBRequest.h: Updated for above changes.
478
479         * Modules/indexeddb/IDBRequest.idl: Use GetterMayThrowException instead of
480         GetterMayThrowLegacyExceptionWithMessage.
481
482         * Modules/indexeddb/IDBTransaction.cpp:
483         (WebCore::IDBTransaction::stringToMode): Return an Optional instead of
484         using an ExceptionCode out argument, since this function just needs to
485         indicate failure, not actually throw an exception.
486         (WebCore::IDBTransaction::db): Tweaked code a bit.
487         (WebCore::IDBTransaction::error): Return a pointer instead of a RefPtr.
488         (WebCore::IDBTransaction::objectStore): Return ExceptionOr instead of
489         using an ExceptionCodeWithMessage out argument.
490         (WebCore::IDBTransaction::abortDueToFailedRequest): Call internalAbort.
491         (WebCore::IDBTransaction::abort): Return ExceptionOr instead of
492         using an ExceptionCodeWithMessage out argument.
493         (WebCore::IDBTransaction::internalAbort): Added a version that asserts
494         instead of throwing an exception for internal use.
495         (WebCore::IDBTransaction::stop): Call internalAbort.
496         * Modules/indexeddb/IDBTransaction.h: Updated for above changes.
497
498         * Modules/indexeddb/IDBTransaction.idl: Use MayThrowException instead of
499         MayThrowLegacyExceptionWithMessage.
500
501         * Modules/indexeddb/client/IDBConnectionProxy.cpp:
502         (WebCore::IDBClient::IDBConnectionProxy::openDatabase): Updated to return
503         a Ref instead of a RefPtr, since the function can never return null.
504         (WebCore::IDBClient::IDBConnectionProxy::deleteDatabase): Ditto.
505         * Modules/indexeddb/client/IDBConnectionProxy.h: Updated for above changes.
506
507         * Modules/mediastream/MediaEndpointPeerConnection.cpp:
508         (WebCore::MediaEndpointPeerConnection::setLocalDescriptionTask): Updated
509         exception handling to use ExceptionOr instead of ExceptionCodeWithMessage.
510         (WebCore::MediaEndpointPeerConnection::setRemoteDescriptionTask): Ditto.
511         * Modules/mediastream/MediaEndpointSessionDescription.cpp:
512         (WebCore::MediaEndpointSessionDescription::create): Ditto.
513         * Modules/mediastream/MediaEndpointSessionDescription.h: Updated for above change.
514
515         * bindings/js/JSDOMBinding.cpp:
516         (WebCore::createDOMException): Added overload for Exception.
517         (WebCore::throwDOMException): Deleted overload for ExceptionCodeWithMessage.
518         Updated code to call the new createDOMException function.
519         (WebCore::setDOMExceptionSlow): Ditto.
520         (WebCore::setDOMException): Ditto.
521
522         * bindings/js/JSDOMBinding.h: Added overload of createDOMException that takes
523         an Exception. Deleted functions dealing with ExceptionCodeWithMessage. Fixed
524         interface of toJSNumber and toJSNullableNumber and implemented toJSNumber.
525
526         * bindings/js/JSDOMPromise.cpp:
527         (WebCore::DeferredPromise::reject): Added overload that takes an Exception.
528         * bindings/js/JSDOMPromise.h: Updated for above change.
529
530         * bindings/js/JSHistoryCustom.cpp:
531         (WebCore::JSHistory::pushState): Use propagateException to deal with
532         ExceptionOr instead of ExceptionCodeWithMessage.
533         (WebCore::JSHistory::replaceState): Ditto.
534
535         * bindings/js/JSIDBDatabaseCustom.cpp:
536         (WebCore::JSIDBDatabase::createObjectStore): Use toJS and
537         to deal with ExceptionOr rather than setDOMException to deal
538         with ExceptionCodeWithMessage.
539
540         * bindings/js/JSIDBRequestCustom.cpp:
541         (WebCore::JSIDBRequest::result): Use propagateException and
542         Exception rather than setDOMException and ExceptionCodeWithMessage.
543
544         * bindings/scripts/CodeGeneratorJS.pm:
545         (GenerateImplementation): Removed support for GetterMayThrowLegacyExceptionWithMessage,
546         SetterMayThrowLegacyExceptionWithMessage, and MayThrowLegacyExceptionWithMessage.
547         (GenerateReturnParameters): Ditto.
548         (GenerateImplementationFunctionCall): Ditto.
549         (GenerateConstructorDefinition): Ditto.
550
551         * bindings/scripts/IDLAttributes.txt: Removed GetterMayThrowLegacyExceptionWithMessage,
552         SetterMayThrowLegacyExceptionWithMessage, and MayThrowLegacyExceptionWithMessage.
553
554         * bindings/scripts/test/JS/JSTestObj.cpp: Regenerated.
555         * bindings/scripts/test/TestObj.idl: Removed tests cases for now-removed attributes.
556
557         * dom/CustomElementRegistry.idl: Use MayThrowException instead of
558         MayThrowLegacyExceptionWithMessage.
559
560         * dom/ExceptionCode.h: Removed ExceptionCodeWithMessage. Also updated to use pragma
561         once, removed include of WTFString.h and switched to using instead of typedef.
562
563         * history/HistoryItem.h: Return a pointer instead of a RefPtr from stateObject
564         to cut down a little on unnecessary reference count churn.
565
566         * inspector/InspectorIndexedDBAgent.cpp: Updated all the code that uses IDB
567         classes to use the new versions rather than the old ExceptionCodeWithMessage versions.
568
569         * page/DOMWindow.cpp:
570         (WebCore::DOMWindow::history): Pass a reference instead of a pointer.
571
572         * page/History.cpp:
573         (WebCore::History::History): Take a reference instead of a pointer.
574         (WebCore::History::length): Tweaked to use a local variable.
575         (WebCore::History::state): Return a pointer instead of a PassRefPtr.
576         (WebCore::History::stateInternal): Ditto. Also use early return consistently.
577         (WebCore::History::isSameAsCurrentState): Updated for above change.
578         (WebCore::History::stateObjectAdded): Return ExceptionOr rather than taking an
579         ExceptionCodeWithMessage out argument.
580
581         * page/History.h: Use pragma once. Removed some unneeded includes. Marked class final.
582         Updated for changes above.
583
584         * page/History.idl: Use MayThrowException instead of MayThrowLegacyException.
585
586 2016-10-07  Ryosuke Niwa  <rniwa@webkit.org>
587
588         REGRESSION(r165103): labels list doesn't get invalidated when other lists are invalidated at document level
589         https://bugs.webkit.org/show_bug.cgi?id=163145
590
591         Reviewed by Darin Adler.
592
593         The bug was caused by Document::invalidateNodeListAndCollectionCaches removing all node lists regardless
594         of whether they have been invalidated or not.
595
596         Fixed the bug by removing only those node lists that got invalidated via LiveNodeList::invalidateCache.
597
598         Test: fast/dom/NodeList/form-labels-length.html
599
600         * dom/Document.cpp:
601         (WebCore::Document::Document):
602         (WebCore::Document::unregisterNodeListForInvalidation): Removed the conditional which allowed removal to
603         happen while m_listsInvalidatedAtDocument is empty inside invalidateNodeListAndCollectionCaches.
604         * dom/Document.h:
605         * dom/Node.cpp:
606         (WebCore::Document::invalidateNodeListAndCollectionCaches): Just remove the node lists being invalidated via
607         LiveNodeList's invalidateCache, which calls unregisterNodeListForInvalidation, instead of removing them all.
608         We make a copy of the list of node lists into a local vector because mutating HashMap while iterating over it
609         is not a safe operation.
610
611 2016-10-09  Chris Dumez  <cdumez@apple.com>
612
613         Update generated bindings code so that dictionary structures no longer need explicit constructors
614         https://bugs.webkit.org/show_bug.cgi?id=163188
615
616         Reviewed by Darin Adler.
617
618         Update generated bindings code so that dictionary structures no longer
619         need explicit constructors. We now call the default constructor and
620         then initialize the members one by one.
621
622         * bindings/scripts/CodeGeneratorJS.pm:
623         (GenerateDictionaryImplementationContent):
624         * bindings/scripts/test/JS/JSTestObj.cpp:
625         (WebCore::convertDictionary<TestObj::Dictionary>):
626         (WebCore::convertDictionary<TestObj::DictionaryThatShouldNotTolerateNull>):
627         (WebCore::convertDictionary<TestObj::DictionaryThatShouldTolerateNull>):
628         (WebCore::convertDictionary<AlternateDictionaryName>):
629         (WebCore::convertDictionary<TestObj::ParentDictionary>):
630         (WebCore::convertDictionary<TestObj::ChildDictionary>):
631         * bindings/scripts/test/JS/JSTestStandaloneDictionary.cpp:
632         (WebCore::convertDictionary<TestStandaloneDictionary>):
633         * dom/ClipboardEvent.h:
634         * dom/CustomEvent.h:
635         * dom/EventInit.h:
636         (WebCore::EventInit::EventInit): Deleted.
637         * dom/EventModifierInit.h:
638         (WebCore::EventModifierInit::EventModifierInit): Deleted.
639         * dom/KeyboardEvent.cpp:
640         (WebCore::KeyboardEvent::KeyboardEvent):
641         * dom/KeyboardEvent.h:
642         * dom/KeyboardEvent.idl:
643         * dom/UIEventInit.h:
644         (WebCore::UIEventInit::UIEventInit): Deleted.
645         * editing/Editor.cpp:
646         (WebCore::Editor::dispatchCPPEvent):
647
648 2016-10-09  Fujii Hironori  <Hironori.Fujii@sony.com>
649
650         [CMake] CMake does not support the dep files for implicit dependency
651         https://bugs.webkit.org/show_bug.cgi?id=161433
652
653         Reviewed by Brent Fulgham.
654
655         Created a Perl script to generate all IDL bindings for CMake.
656         This script can regenerate outdated bindings by based on the
657         supplemental dependency and dep files created by
658         '--write-dependencies' switch of generate-bindings.pl.
659
660         add_custom_target is used to invoke the script instead of
661         add_custom_command because Ninja deletes all output files before
662         executing the command in case of add_custom_command.
663
664         USES_TERMINAL option of add_custom_target has two effects:
665         1) Not buffering output of the command
666         2) Invoking the command in the special Ninja pool which inhibits parallel build
667         One needs to use CMake 3.2 or later to enable this feature.
668
669         * CMakeLists.txt: Specified target names for
670         GENERATE_BINDINGS. Added dependency for the targets.
671         * bindings/scripts/generate-bindings-all.pl: Added.
672
673 2016-10-09  Chris Dumez  <cdumez@apple.com>
674
675         Update KeyboardEvent to stop using legacy [ConstructorTemplate=Event]
676         https://bugs.webkit.org/show_bug.cgi?id=163176
677
678         Reviewed by Darin Adler.
679
680         Update KeyboardEvent to stop using legacy [ConstructorTemplate=Event]
681         and use a proper constructor instead, like in the specification:
682         - https://www.w3.org/TR/uievents/#interface-keyboardevent
683
684         Also add support for passing modifierAltGraph / modifierCapsLock
685         in the inialization dictionary as we support those modifiers via
686         getModifierState().
687
688         No new tests, extended existing test.
689
690         * CMakeLists.txt:
691         * DerivedSources.cpp:
692         * DerivedSources.make:
693         * WebCore.xcodeproj/project.pbxproj:
694         * dom/EventModifierInit.h: Added.
695         (WebCore::EventModifierInit::EventModifierInit):
696         * dom/EventModifierInit.idl: Added.
697         * dom/KeyboardEvent.cpp:
698         (WebCore::KeyboardEvent::KeyboardEvent):
699         (WebCore::KeyboardEvent::getModifierState):
700         * dom/KeyboardEvent.h:
701         * dom/KeyboardEvent.idl:
702         * dom/MouseRelatedEvent.cpp:
703         (WebCore::MouseRelatedEvent::MouseRelatedEvent):
704         * dom/MouseRelatedEvent.h:
705         * dom/UIEvent.cpp:
706         (WebCore::UIEvent::UIEvent):
707         * dom/UIEvent.h:
708         (WebCore::UIEvent::create): Deleted.
709         * dom/UIEventInit.h: Added.
710         (WebCore::UIEventInit::UIEventInit):
711         * dom/UIEventInit.idl: Added.
712         * dom/UIEventWithKeyState.h:
713         (WebCore::UIEventWithKeyState::altGraphKey):
714         (WebCore::UIEventWithKeyState::capsLockKey):
715         (WebCore::UIEventWithKeyState::UIEventWithKeyState):
716         (WebCore::UIEventWithKeyState::ctrlKey): Deleted.
717         (WebCore::UIEventWithKeyState::shiftKey): Deleted.
718         (WebCore::UIEventWithKeyState::altKey): Deleted.
719         (WebCore::UIEventWithKeyState::metaKey): Deleted.
720
721 2016-10-09  Youenn Fablet  <youenn@apple.com>
722
723         Promise attribute getters should reject promises in case of casted-this errors
724         https://bugs.webkit.org/show_bug.cgi?id=163167
725
726         Reviewed by Darin Adler.
727
728         Covered by updated test and binding test.
729
730         * bindings/js/JSDOMBinding.cpp:
731         (WebCore::throwGetterTypeError):
732         (WebCore::rejectPromiseWithGetterTypeError): Added to reject promises for attribute getters
733         * bindings/js/JSDOMBinding.h:
734         (WebCore::BindingCaller::attribute): Introducing promise rejection for type cast errors.
735         * bindings/scripts/CodeGeneratorJS.pm:
736         (GenerateImplementation):
737         * bindings/scripts/test/JS/JSTestObj.cpp: Rebased test. As can be seen, only custom promise attributes are supported.
738         (WebCore::jsTestObjTestReadOnlyPromiseAttribute):
739         (WebCore::jsTestObjTestReadOnlyPromiseAttributeGetter):
740         * bindings/scripts/test/TestObj.idl:
741
742 2016-10-08  Chris Dumez  <cdumez@apple.com>
743
744         [Mac] Write WebArchive to the pasteboard when copying image in WebKit
745         https://bugs.webkit.org/show_bug.cgi?id=163100
746
747         Reviewed by Darin Adler.
748
749         Write WebArchive to the pasteboard when copying image in WebKit. This
750         fixes pasting such images to a content editable field in WebKit because
751         Web archives take priority over RTFD when reading from the pasteboard
752         in WebKit.
753
754         Using RTFD when pasting the image in WebKit was causing issues because:
755         1. The pasted image would not be displayed because our RTFD import code
756            is buggy.
757         2. The pasted image URL was a webkit-fake-url://
758         3. Formatting associated to the image (e.g. inline style) would be lost
759
760         No new tests, unskipped existing test on WebKit2.
761
762         * editing/Editor.h:
763         * editing/mac/EditorMac.mm:
764         (WebCore::Editor::imageInWebArchiveFormat):
765         (WebCore::Editor::writeImageToPasteboard):
766         * platform/Pasteboard.h:
767         * platform/mac/PasteboardMac.mm:
768         (WebCore::writableTypesForImage):
769         (WebCore::Pasteboard::write):
770         (WebCore::Pasteboard::Pasteboard): Deleted.
771         (WebCore::Pasteboard::createForCopyAndPaste): Deleted.
772
773 2016-10-08  Chris Dumez  <cdumez@apple.com>
774
775         Update CustomEvent to stop using legacy [ConstructorTemplate=Event]
776         https://bugs.webkit.org/show_bug.cgi?id=163174
777
778         Reviewed by Darin Adler.
779
780         Update CustomEvent to stop using legacy [ConstructorTemplate=Event] and
781         use an actual constructor instead, like in the specification:
782         - https://dom.spec.whatwg.org/#interface-customevent
783
784         There is a very minor behavior change when explictly passing undefined
785         as detail value in CustomEventInit. We used to initialize detail to
786         undefined but we now initialize it to null instead, which is its default
787         value. The new behavior matches the one of Chrome and Firefox.
788
789         * bindings/scripts/CodeGeneratorJS.pm:
790         (GenerateDefaultValue):
791         (GenerateDictionaryImplementationContent):
792         * bindings/scripts/test/JS/JSTestObj.cpp:
793         (WebCore::convertDictionary<TestObj::Dictionary>):
794         * bindings/scripts/test/TestObj.idl:
795         * dom/CustomEvent.cpp:
796         (WebCore::CustomEvent::CustomEvent):
797         * dom/CustomEvent.h:
798         * dom/CustomEvent.idl:
799         * dom/Document.cpp:
800         (WebCore::Document::createEvent):
801         * dom/Event.cpp:
802         (WebCore::Event::Event):
803         * dom/Event.h:
804
805 2016-10-08  Chris Dumez  <cdumez@apple.com>
806
807         Add support for ClipboardEvent
808         https://bugs.webkit.org/show_bug.cgi?id=163164
809
810         Reviewed by Darin Adler.
811
812         Add support for ClipboardEvent:
813         - https://www.w3.org/TR/clipboard-apis/#clipboard-event-interfaces
814
815         Firefox and Chrome both already support this.
816
817         This gives us 5 more points on html5test.com.
818
819         Tests: editing/pasteboard/clipboard-event.html
820                fast/events/clipboard-event-constructor.html
821
822         * CMakeLists.txt:
823         * DerivedSources.cpp:
824         * DerivedSources.make:
825         * WebCore.xcodeproj/project.pbxproj:
826         * bindings/js/JSEventCustom.cpp:
827         (WebCore::toJSNewlyCreated): Deleted.
828
829         * bindings/scripts/CodeGeneratorJS.pm:
830         (WillConvertUndefinedToDefaultParameterValue):
831         We use [] as implicit default value for dictionary parameters. This change
832         is so we call convertDictionary<>() even if the parameter is undefined
833         because we want to pass a struct to the implementation initialized with
834         the default member values defined in the IDL.
835
836         * dom/ClipboardEvent.cpp:
837         (WebCore::ClipboardEvent::ClipboardEvent):
838         (WebCore::ClipboardEvent::eventInterface):
839         * dom/ClipboardEvent.h:
840         * dom/ClipboardEvent.idl: Added.
841         * dom/Event.cpp:
842         (WebCore::Event::Event):
843         * dom/Event.h:
844         * dom/Event.idl:
845         * dom/EventInit.h: Added.
846         * dom/EventInit.idl: Added.
847         * dom/EventNames.in:
848         * dom/MouseEvent.h:
849         (WebCore::MouseEvent::dataTransfer):
850         * editing/Editor.cpp:
851         (WebCore::Editor::dispatchCPPEvent):
852
853 2016-10-06  Darin Adler  <darin@apple.com>
854
855         Next step on moving to modern way to return DOM exceptions
856         https://bugs.webkit.org/show_bug.cgi?id=163016
857
858         Reviewed by Ryosuke Niwa.
859
860         * Modules/fetch/FetchRequest.idl:
861         Added MayThrowException to initializeWith since it throws an exception.
862
863         * bindings/js/JSCallbackData.cpp:
864         (WebCore::JSCallbackData::invokeCallback):
865         * bindings/js/JSCustomElementInterface.cpp:
866         (WebCore::JSCustomElementInterface::invokeCallback):
867         * bindings/js/JSCustomSQLStatementErrorCallback.cpp:
868         (WebCore::JSSQLStatementErrorCallback::handleEvent):
869         * bindings/js/JSCustomXPathNSResolver.cpp:
870         (WebCore::JSCustomXPathNSResolver::lookupNamespaceURI):
871         * bindings/js/JSDOMBinding.cpp:
872         (WebCore::reportException):
873         (WebCore::reportCurrentException):
874         * bindings/js/JSErrorHandler.cpp:
875         (WebCore::JSErrorHandler::handleEvent):
876         * bindings/js/JSEventListener.cpp:
877         (WebCore::JSEventListener::handleEvent):
878         * bindings/js/JSMutationCallback.cpp:
879         (WebCore::JSMutationCallback::call):
880         * bindings/js/JSNodeFilterCustom.cpp:
881         (WebCore::JSNodeFilter::acceptNode):
882         * bindings/js/ScheduledAction.cpp:
883         (WebCore::ScheduledAction::executeFunctionInContext):
884         * bindings/js/ScriptController.cpp:
885         (WebCore::ScriptController::evaluateInWorld):
886         * bindings/js/WorkerScriptController.cpp:
887         (WebCore::WorkerScriptController::evaluate):
888         * inspector/PageScriptDebugServer.cpp:
889         (WebCore::PageScriptDebugServer::reportException):
890         Use JSC::Exception explicitly to avoid ambiguity with WebCore::Exception,
891         or in some cases use auto instead.
892
893         * bindings/js/JSDOMBinding.cpp:
894         (WebCore::hasUnpairedSurrogate): Factored this inline function out of valueToUSVString
895         for clarity.
896         (WebCore::createDOMException): Removed unused TRY_TO_CREATE_EXCEPTION macro.
897         (WebCore::propagateExceptionSlowPath): Added.
898         (WebCore::propagateException): Added.
899         (WebCore::setDOMException): Removed overload that takes an exception code and message
900         string separately; no longer needed.
901
902         * bindings/js/JSDOMBinding.h: Include the ExceptionOr header
903         rather than forward declaring. Added more of the ExceptionOr handling
904         functions; some just declared and not yet defined. Updated for changes
905         to ExceptionOr interface. Removed the createDOMException function that takes
906         only an exception code; not needed outside JSDOMBinding.cpp.
907
908         * bindings/js/JSXMLHttpRequestCustom.cpp:
909         (WebCore::JSXMLHttpRequest::send): Rewrote this to use ExceptionOr instead
910         of ExceptionCode. Added some FIXMEs as well.
911         (WebCore::JSXMLHttpRequest::responseText): Ditto.
912         (WebCore::JSXMLHttpRequest::retrieveResponse): Ditto.
913
914         * bindings/scripts/CodeGeneratorJS.pm:
915         (GenerateImplementation): Fixed if statements to follow WebKit coding style
916         rather than using extra braces. Added call to propagateException for SetterMayThrowException.
917         (GenerateSerializerFunction): Fixed if statements as above.
918         (GenerateParametersCheck): Ditto. Also added call to propagateException for functions with
919         void return type and MayThrowException.
920         (GenerateReturnParameters): Tweaked coding style a bit.
921         (addIterableProperties): Fixed if statements as above.
922         (NativeToJSValue): Added code to handle various cases of GetterMayThrowException
923         and MayThrowException.
924         (GenerateConstructorDefinition): Used encodedJSValue() instead of
925         JSValue::encode(JSValue()), a longer way to say the same thing.
926
927         * bindings/scripts/IDLAttributes.txt: Added GetterMayThrowException,
928         MayThrowException, and SetterMayThrowException.
929
930         * bindings/scripts/test/JS/JSTestActiveDOMObject.cpp:
931         * bindings/scripts/test/JS/JSTestEventConstructor.cpp:
932         * bindings/scripts/test/JS/JSTestException.cpp:
933         * bindings/scripts/test/JS/JSTestGlobalObject.cpp:
934         * bindings/scripts/test/JS/JSTestInterface.cpp:
935         * bindings/scripts/test/JS/JSTestJSBuiltinConstructor.cpp:
936         * bindings/scripts/test/JS/JSTestNamedConstructor.cpp:
937         * bindings/scripts/test/JS/JSTestNode.cpp:
938         * bindings/scripts/test/JS/JSTestNondeterministic.cpp:
939         * bindings/scripts/test/JS/JSTestObj.cpp:
940         * bindings/scripts/test/JS/JSTestSerializedScriptValueInterface.cpp:
941         * bindings/scripts/test/JS/JSTestTypedefs.cpp:
942         * bindings/scripts/test/JS/JSattribute.cpp:
943         Regenerated results.
944
945         * bindings/scripts/test/TestObj.idl: Added some test cases.
946
947         * dom/DOMImplementation.cpp:
948         (WebCore::DOMImplementation::createDocumentType): Tweaked formatting.
949         (WebCore::DOMImplementation::createDocument): Ditto.
950
951         * dom/DOMImplementation.idl: Added MayThrowException to two functions since
952         I am abandoning, for now, the ability to throw exceptions without any extended
953         attribute in the IDL file. This feature may return at some point if we figure
954         out a way to do it for functions without return values as well as functions with.
955
956         * dom/Document.cpp:
957         (WebCore::Document::exitPointerLock): Rewrote to streamline logic.
958         (WebCore::Document::pointerLockElement): Ditto.
959         (WebCore::Document::inputCursor): Added. No need for this to be inlined.
960         (WebCore::Document::setInputCursor): Changed to take Ref&&.
961         (WebCore::Document::getSelection): Added. Moved here from TreeScope.
962
963         * dom/Document.h: Updated for above changes.
964
965         * dom/Document.idl: Tweaked formatting.
966
967         * dom/Exception.h: Merged the two constructors into one with a default
968         argument value, which should be equally efficient. Added releaseMessage function.
969         Added assertion that this is only created for actual exceptions with non-zero
970         ExceptionCode. Unlike ExceptionCode, which has a value of 0 which means no
971         exception, we do not create an Exception if there is no exception.
972
973         * dom/ExceptionOr.h: Renamed takeReturnValue to releaseReturnValue. Replaced
974         exceptionCode and exceptionMessage with releaseException. Added ExceptionOr<void>
975         specialization.
976
977         * dom/TreeScope.cpp:
978         (WebCore::TreeScope::~TreeScope): Removed code dealing with
979         m_selection, which is now in Document.
980         (WebCore::TreeScope::getSelection): Deleted.
981
982         * dom/TreeScope.h: Removed DOMSelection.
983
984         * page/DOMSelection.cpp:
985         (WebCore::selectionShadowAncestor): Changed to take a reference rather than
986         a guaranteed-non-null pointer.
987         (WebCore::DOMSelection::DOMSelection): Changed to take a Frame& instead of
988         of a TreeScope*.
989         (WebCore::DOMSelection::clearTreeScope): Deleted.
990         (WebCore::DOMSelection::isCollapsed): Updated call to selectionShadowAncestor.
991         (WebCore::DOMSelection::type): Took out obsolete uneeeded comment. Got rid
992         of case where this returns a null string. Use ASCIILiteral.
993         (WebCore::DOMSelection::rangeCount): Streamlined code.
994         (WebCore::DOMSelection::collapse): Removed redundant check of m_frame for
995         null which is already handled by the isValidForPosition function.
996         Removed non-helpful FIXME.
997         (WebCore::DOMSelection::collapseToEnd): Changed to use ExceptionOr instead of
998         ExceptionCode.
999         (WebCore::DOMSelection::collapseToStart): Ditto.
1000         (WebCore::DOMSelection::setBaseAndExtent): Removed redundant check of m_frame
1001         for null which is already handled by the isValidForPosition function. Removed
1002         non-helpful FIXME.
1003         (WebCore::DOMSelection::setPosition): Ditto.
1004         (WebCore::DOMSelection::extend): Changed to use ExceptionOr instead of
1005         ExceptionCode.
1006         (WebCore::DOMSelection::getRangeAt): Ditto.
1007         (WebCore::DOMSelection::isValidForPosition): Changed to return false when
1008         m_frame is null rather than asserting is is non-null and having every caller
1009         check m_frame before calling this.
1010
1011         * page/DOMSelection.h: Use #pragma once. Fix indentation. Removed unneeded
1012         comments. Use ExceptionOr rather than ExceptionCode.
1013
1014         * page/DOMSelection.idl: Move from MayThrowLegacyException to MayThrowException.
1015
1016         * page/DOMWindow.cpp:
1017         (WebCore::DOMWindow::resetDOMWindowProperties): Sorted properties alphabetically
1018         to make it more obvious if any are accidentally omitted or listed twice.
1019         (WebCore::DOMWindow::getSelection): Changed ownership so that the window owns
1020         the selection like all the other objects, rather than having it be owned by the
1021         document instead.
1022
1023         * page/DOMWindow.h: Added m_selection, sorted all the other related properties
1024         alphabetically so it's easy to compare the list here with elsewhere.
1025
1026         * replay/ReplayController.cpp:
1027         (WebCore::ReplayController::frameNavigated): Updated to call setInputCursor
1028         with a reference rather than a pointer.
1029
1030         * xml/XMLHttpRequest.cpp:
1031         (WebCore::XMLHttpRequest::responseText): Use ExceptionOr rather than ExceptionCode.
1032         (WebCore::XMLHttpRequest::responseXML): Ditto.
1033         (WebCore::XMLHttpRequest::setTimeout): Ditto.
1034         (WebCore::XMLHttpRequest::setResponseType): Ditto.
1035         (WebCore::XMLHttpRequest::setWithCredentials): Ditto.
1036         (WebCore::XMLHttpRequest::open): Ditto.
1037         (WebCore::XMLHttpRequest::prepareToSend): Changed to return an
1038         Optional<ExceptionOr> to reflect the three different states: an exception,
1039         a value to return without sending, or "continue with the send algorithm".
1040         The old code did this with a boolean plus an exception code. This sounds
1041         confusing but is easy to read at the call sites, so probably OK to keep.
1042         (WebCore::XMLHttpRequest::send): Use ExceptionOr rather than ExceptionCode.
1043         (WebCore::XMLHttpRequest::sendBytesData): Ditto.
1044         (WebCore::XMLHttpRequest::createRequest): Ditto.
1045         (WebCore::XMLHttpRequest::overrideMimeType): Ditto.
1046         (WebCore::XMLHttpRequest::setRequestHeader): Ditto.
1047
1048         * xml/XMLHttpRequest.h: Updated for changes above.
1049
1050         * xml/XMLHttpRequest.idl: Sorted interface extended attributes alphabetically.
1051         Changed from MayThrowLegacyException to MayThrowException.
1052
1053 2016-10-06  Sam Weinig  <sam@webkit.org>
1054
1055         Autogenerate passing union types as part of a functions variadic arguments
1056         https://bugs.webkit.org/show_bug.cgi?id=162919
1057
1058         Reviewed by Darin Adler.
1059
1060         * CMakeLists.txt:
1061         * WebCore.xcodeproj/project.pbxproj:
1062         * bindings/js/JSBindingsAllInOne.cpp:
1063         Remove deleted files.
1064
1065         * bindings/generic/IDLTypes.h:
1066         Switch to use std::reference_wrapper as it's implementation type. We may need more
1067         granularity here in the future, but this will work for now.
1068
1069         * bindings/js/JSCharacterDataCustom.cpp: Removed.
1070         * bindings/js/JSDocumentTypeCustom.cpp: Removed.
1071         * bindings/js/JSNodeOrString.cpp: Removed.
1072         * bindings/js/JSNodeOrString.h: Removed.
1073
1074         * bindings/js/JSDOMBinding.h:
1075         (WebCore::VariadicHelperBase::convert): Deleted.
1076         (WebCore::toArguments): Deleted.
1077         Moved to JSDOMConvert.h and renamed to convertVariadicArguments and make
1078         it work in terms of IDLTypes.
1079
1080         * bindings/js/JSDOMConvert.h:
1081         (WebCore::Converter<IDLInterface<T>>::convert):
1082         (WebCore::VariadicConverterBase::convert):
1083         (WebCore::VariadicConverterBase<IDLInterface<T>>::convert):
1084         (WebCore::convertVariadicArguments):
1085
1086         * bindings/js/JSDocumentCustom.cpp:
1087         (WebCore::JSDocument::prepend): Deleted.
1088         (WebCore::JSDocument::append): Deleted.
1089         * bindings/js/JSDocumentFragmentCustom.cpp:
1090         (WebCore::JSDocumentFragment::prepend): Deleted.
1091         (WebCore::JSDocumentFragment::append): Deleted.
1092         * bindings/js/JSElementCustom.cpp:
1093         (WebCore::JSElement::before): Deleted.
1094         (WebCore::JSElement::after): Deleted.
1095         (WebCore::JSElement::replaceWith): Deleted.
1096         (WebCore::JSElement::prepend): Deleted.
1097         (WebCore::JSElement::append): Deleted.
1098         Remove now generated functions.
1099
1100         * bindings/scripts/CodeGenerator.pm:
1101         (assert):
1102         Add assert to help debugging.
1103
1104         (ParseInterface):
1105         Don't treat union types as interfaces.
1106
1107         (GetFlattenedMemberTypes):
1108         (GetNumberOfNullableMemberTypes):
1109         (GetIDLUnionMemberTypes):
1110         Implement WebIDL algorithms for getting the flattened member list of union, and use it
1111         to construct the c++ IDLType.
1112
1113         (GetBaseIDLType):
1114         (GetIDLType):
1115         Add helper to convert an parsed idlType to a c++ IDLType.
1116
1117         (IsWrapperType):
1118         Don't treat union types as wrappers.
1119         
1120         * bindings/scripts/CodeGeneratorJS.pm:
1121         (AddToImplIncludesForIDLType):
1122         Add helper for adding #includes based on a parsed idlType. It recursively handles union types.
1123
1124         (GenerateParametersCheck):
1125         Use the new convertVariadicArguments function to handle all variadic arguments, including
1126         union types.
1127
1128         * bindings/scripts/IDLParser.pm:
1129         (parseDictionaryMember):
1130         (parseAttributeRest):
1131         (parseOptionalOrRequiredArgument):
1132         (parseExceptionField):
1133         Add an idlType to domSignature and populate it.
1134
1135         * bindings/scripts/test/JS/JSTestObj.cpp:
1136         (WebCore::jsTestObjPrototypeFunctionOverloadedMethod13):
1137         (WebCore::jsTestObjPrototypeFunctionVariadicStringMethod):
1138         (WebCore::jsTestObjPrototypeFunctionVariadicDoubleMethod):
1139         (WebCore::jsTestObjPrototypeFunctionVariadicNodeMethod):
1140         (WebCore::jsTestObjPrototypeFunctionVariadicUnionMethod):
1141         * bindings/scripts/test/JS/JSTestOverloadedConstructors.cpp:
1142         (WebCore::constructJSTestOverloadedConstructors5):
1143         * bindings/scripts/test/TestObj.idl:
1144         Add and update tests.
1145
1146         * dom/ChildNode.idl:
1147         * dom/ParentNode.idl:
1148         Remove Custom extended attribute.
1149
1150         * dom/ContainerNode.cpp:
1151         * dom/ContainerNode.h:
1152         * dom/Node.cpp:
1153         * dom/Node.h:
1154         Switch to using std::reference_wrapper instead of Ref<> for passed in parameters.
1155
1156 2016-10-08  Youenn Fablet  <youenn@apple.com>
1157
1158         [Fetch API] Request constructor should provide exception messages
1159         https://bugs.webkit.org/show_bug.cgi?id=162382
1160
1161         Reviewed by Darin Adler.
1162
1163         No change of behavior, except that exceptions now have error messages.
1164
1165         Added support of exception messages to ExceptionOr.
1166         Making use of ExceptionOr for Request constructor parameter checking.
1167
1168         * Modules/fetch/FetchRequest.cpp:
1169         (WebCore::setReferrerPolicy):
1170         (WebCore::setMode):
1171         (WebCore::setCredentials):
1172         (WebCore::setCache):
1173         (WebCore::setRedirect):
1174         (WebCore::setMethod):
1175         (WebCore::setReferrer):
1176         (WebCore::buildOptions):
1177         (WebCore::FetchRequest::initializeOptions):
1178         (WebCore::FetchRequest::initializeWith):
1179         * Modules/fetch/FetchRequest.h:
1180         * Modules/fetch/FetchRequest.idl:
1181         * bindings/js/JSDOMBinding.cpp:
1182         (WebCore::setDOMException):
1183         * bindings/js/JSDOMBinding.h:
1184         (WebCore::toJS):
1185         (WebCore::toJSNewlyCreated):
1186         * dom/Exception.h:
1187         (WebCore::Exception::code):
1188         (WebCore::Exception::message):
1189         (WebCore::Exception::Exception):
1190         * dom/ExceptionOr.h:
1191         (WebCore::ExceptionOr<ReturnType>::exceptionMessage):
1192
1193 2016-10-08  Youenn Fablet  <youenn@apple.com>
1194
1195         Refactor binding generated casted-this checks
1196         https://bugs.webkit.org/show_bug.cgi?id=162677
1197
1198         Reviewed by Darin Adler.
1199
1200         No change of behavior.
1201
1202         Split the attribute getter function in two, one with the signature expected by JSCore and one used after casted-this checks.
1203
1204         The second function takes directly a JSXX object and returns a JSValue instead of an EncodedJSValue.
1205         In the future, the second function should only take references.
1206
1207         Introducing BindingCaller as a way to templatize binding code used to cast thisValue with the desired JSXX value.
1208         This allows implementing the first function using the second function as template parameter.
1209
1210         Introducing JSClass::castForAttribute as a way to encapsulate differences in the way to handle thisValue access.
1211
1212         * bindings/js/JSDOMBinding.h:
1213         (WebCore::BindingCaller::attribute):
1214         * bindings/scripts/CodeGeneratorJS.pm:
1215         (GenerateHeader):
1216         (GenerateImplementation):
1217         * bindings/scripts/test/JS/JSTestActiveDOMObject.cpp:
1218         * bindings/scripts/test/JS/JSTestActiveDOMObject.h:
1219         * bindings/scripts/test/JS/JSTestEventConstructor.cpp:
1220         * bindings/scripts/test/JS/JSTestEventConstructor.h:
1221         * bindings/scripts/test/JS/JSTestException.cpp:
1222         * bindings/scripts/test/JS/JSTestException.h:
1223         * bindings/scripts/test/JS/JSTestGlobalObject.cpp:
1224         * bindings/scripts/test/JS/JSTestInterface.cpp:
1225         * bindings/scripts/test/JS/JSTestInterface.h:
1226         * bindings/scripts/test/JS/JSTestJSBuiltinConstructor.cpp:
1227         * bindings/scripts/test/JS/JSTestJSBuiltinConstructor.h:
1228         * bindings/scripts/test/JS/JSTestNode.cpp:
1229         * bindings/scripts/test/JS/JSTestNode.h:
1230         * bindings/scripts/test/JS/JSTestNondeterministic.cpp:
1231         * bindings/scripts/test/JS/JSTestNondeterministic.h:
1232         * bindings/scripts/test/JS/JSTestObj.cpp:
1233         * bindings/scripts/test/JS/JSTestObj.h:
1234         * bindings/scripts/test/JS/JSTestSerializedScriptValueInterface.cpp:
1235         * bindings/scripts/test/JS/JSTestSerializedScriptValueInterface.h:
1236         * bindings/scripts/test/JS/JSTestTypedefs.cpp:
1237         * bindings/scripts/test/JS/JSTestTypedefs.h:
1238         * bindings/scripts/test/JS/JSattribute.cpp:
1239         * bindings/scripts/test/JS/JSattribute.h:
1240
1241 2016-10-08  Enrique Ocaña González  <eocanha@igalia.com>
1242
1243         Missing include in MediaDescription
1244         https://bugs.webkit.org/show_bug.cgi?id=162873
1245
1246         Reviewed by Xabier Rodriguez-Calvar.
1247
1248         Added missing header.
1249
1250         * platform/MediaDescription.h:
1251
1252 2016-10-08  Antti Koivisto  <antti@apple.com>
1253
1254         Move StyleResolver ownership from Document/ShadowRoot to Style::Scope
1255         https://bugs.webkit.org/show_bug.cgi?id=163148
1256
1257         Reviewed by Andreas Kling.
1258
1259         Reduce duplication between Document and ShadowRoot.
1260
1261         * css/CSSComputedStyleDeclaration.cpp:
1262         (WebCore::ComputedStyleExtractor::propertyValue):
1263         * css/CSSStyleSheet.cpp:
1264         (WebCore::CSSStyleSheet::didMutateRules):
1265         * css/ElementRuleCollector.cpp:
1266         (WebCore::ElementRuleCollector::matchHostPseudoClassRules):
1267         (WebCore::ElementRuleCollector::matchSlottedPseudoElementRules):
1268         * css/MediaQueryMatcher.cpp:
1269         (WebCore::MediaQueryMatcher::documentElementUserAgentStyle):
1270         * css/StyleMedia.cpp:
1271         (WebCore::StyleMedia::matchMedium):
1272         * css/parser/SizesAttributeParser.cpp:
1273         (WebCore::SizesAttributeParser::mediaConditionMatches):
1274         * dom/Document.cpp:
1275         (WebCore::Document::~Document):
1276         (WebCore::Document::childrenChanged):
1277         (WebCore::Document::isPageBoxVisible):
1278         (WebCore::Document::pageSizeAndMarginsInPixels):
1279         (WebCore::Document::userAgentShadowTreeStyleResolver):
1280         (WebCore::Document::fontsNeedUpdate):
1281         (WebCore::Document::didClearStyleResolver):
1282         (WebCore::Document::updateViewportUnitsOnResize):
1283         (WebCore::Document::createStyleResolver): Deleted.
1284         (WebCore::Document::clearStyleResolver): Deleted.
1285         * dom/Document.h:
1286         (WebCore::Document::styleResolverIfExists): Deleted.
1287         (WebCore::Document::ensureStyleResolver): Deleted.
1288         * dom/Element.cpp:
1289         (WebCore::Element::styleResolver):
1290         * dom/ShadowRoot.cpp:
1291         (WebCore::ShadowRoot::styleResolver): Deleted.
1292         (WebCore::ShadowRoot::styleResolverIfExists): Deleted.
1293         (WebCore::ShadowRoot::resetStyleResolver): Deleted.
1294         * dom/ShadowRoot.h:
1295         * page/DOMWindow.cpp:
1296         (WebCore::DOMWindow::getMatchedCSSRules):
1297         * page/FrameView.cpp:
1298         (WebCore::FrameView::layout):
1299         * page/Page.cpp:
1300         (WebCore::Page::updateStyleForAllPagesAfterGlobalChangeInEnvironment):
1301         * page/PrintContext.cpp:
1302         (WebCore::PrintContext::pageProperty):
1303         * platform/MemoryPressureHandler.cpp:
1304         (WebCore::MemoryPressureHandler::releaseCriticalMemory):
1305         * style/AttributeChangeInvalidation.cpp:
1306         (WebCore::Style::mayBeAffectedByHostStyle):
1307         * style/ClassChangeInvalidation.cpp:
1308         (WebCore::Style::mayBeAffectedByHostStyle):
1309         * style/IdChangeInvalidation.cpp:
1310         (WebCore::Style::mayBeAffectedByHostStyle):
1311         * style/StyleScope.cpp:
1312         (WebCore::Style::Scope::resolver):
1313         (WebCore::Style::Scope::resolverIfExists):
1314         (WebCore::Style::Scope::clearResolver):
1315         (WebCore::Style::Scope::analyzeStyleSheetChange):
1316         (WebCore::Style::Scope::updateActiveStyleSheets):
1317         (WebCore::Style::Scope::updateStyleResolver):
1318         (WebCore::Style::Scope::styleResolver): Deleted.
1319         (WebCore::Style::Scope::styleResolverIfExists): Deleted.
1320         * style/StyleScope.h:
1321         * style/StyleSharingResolver.cpp:
1322         (WebCore::Style::SharingResolver::resolve):
1323         (WebCore::Style::SharingResolver::canShareStyleWithElement):
1324         * style/StyleTreeResolver.cpp:
1325         (WebCore::Style::TreeResolver::Scope::Scope):
1326         (WebCore::Style::TreeResolver::resolve):
1327
1328 2016-10-07  Chris Dumez  <cdumez@apple.com>
1329
1330         window.navigator.language incorrectly returns all lowercase string
1331         https://bugs.webkit.org/show_bug.cgi?id=163096
1332
1333         Reviewed by Darin Adler.
1334
1335         Update navigator.language so that it no longer returns an all lowercase
1336         string (e.g. 'en-us' -> 'en-US'). This matches the behavior of other
1337         browsers and the specification which indicate we should return a
1338         BCP 47 language tag:
1339         - https://html.spec.whatwg.org/#dom-navigator-language
1340         - https://tools.ietf.org/html/bcp47
1341
1342         The other call sites relying on userPreferredLanguages() use case
1343         insensitive comparison so they will not break.
1344
1345         No new tests, updated existing test.
1346
1347         * platform/Language.h:
1348
1349 2016-10-07  Wenson Hsieh  <wenson_hsieh@apple.com>
1350
1351         Support onbeforeinput event handling for the new InputEvent spec
1352         https://bugs.webkit.org/show_bug.cgi?id=163021
1353         <rdar://problem/28658073>
1354
1355         Reviewed by Darin Adler.
1356
1357         Adds support for parsing the onbeforeinput attribute, and for sending default-preventable
1358         `beforeinput` InputEvents to the page. To do this, we introduce two new virtual methods:
1359         willApplyCommand and didApplyCommand on the CompositeEditCommand that are called before and
1360         after CompositeEditCommand::doApply, respectively. willApplyCommand indicates whether or not
1361         the composite editor command should proceed with applying the command.
1362
1363         Tweaks existing layout tests and adds new tests.
1364
1365         Tests: fast/events/before-input-events-different-start-end-elements.html
1366                fast/events/before-input-events-prevent-default-in-textfield.html
1367                fast/events/before-input-events-prevent-default.html
1368
1369         * dom/Document.idl:
1370         * dom/Element.idl:
1371         * dom/EventNames.h:
1372         * dom/Node.cpp:
1373         (WebCore::Node::dispatchInputEvent):
1374         (WebCore::Node::defaultEventHandler):
1375
1376         Currently, we fire input events in Node in response to dispatching a webkitEditableContentChangedEvent. After
1377         some discussion, Ryosuke and I believe that it will be ok to instead directly dispatch the input event where we
1378         would normally dispatch a webkitEditableContentChangedEvent.
1379
1380         * editing/CompositeEditCommand.cpp:
1381         (WebCore::EditCommandComposition::unapply):
1382         (WebCore::EditCommandComposition::reapply):
1383
1384         Added calls to Editor::willUnapplyEditing and Editor::willReapplyEditing.
1385
1386         (WebCore::CompositeEditCommand::willApplyCommand):
1387         (WebCore::CompositeEditCommand::apply):
1388         (WebCore::CompositeEditCommand::didApplyCommand):
1389
1390         Added new virtual functions, willApplyCommand and didApplyCommand, that surround a call to
1391         CompositeEditCommand::doApply. By default, they call willApplyEditing and appliedEditing on the editor, but may
1392         be overridden in special cases, such as in TypingCommand, where we invoke appliedEditing after adding a new
1393         typing command to the last open command.
1394
1395         If willApplyCommand returns false, CompositeEditCommand::apply will bail and not proceed with the command.
1396
1397         * editing/CompositeEditCommand.h:
1398         * editing/Editor.cpp:
1399         (WebCore::dispatchBeforeInputEvent):
1400         (WebCore::dispatchBeforeInputEvents):
1401         (WebCore::dispatchInputEvents):
1402         (WebCore::Editor::willApplyEditing):
1403         (WebCore::Editor::appliedEditing):
1404         (WebCore::Editor::willUnapplyEditing):
1405         (WebCore::Editor::unappliedEditing):
1406         (WebCore::Editor::willReapplyEditing):
1407         (WebCore::Editor::reappliedEditing):
1408         (WebCore::Editor::computeAndSetTypingStyle):
1409         (WebCore::dispatchEditableContentChangedEvents): Deleted.
1410         * editing/Editor.h:
1411         * editing/TypingCommand.cpp:
1412         (WebCore::TypingCommand::willApplyCommand):
1413         (WebCore::TypingCommand::didApplyCommand):
1414         (WebCore::TypingCommand::willAddTypingToOpenCommand):
1415         (WebCore::TypingCommand::insertTextRunWithoutNewlines):
1416         (WebCore::TypingCommand::insertLineBreak):
1417         (WebCore::TypingCommand::insertParagraphSeparator):
1418         (WebCore::TypingCommand::insertParagraphSeparatorInQuotedContent):
1419         (WebCore::TypingCommand::deleteKeyPressed):
1420         (WebCore::TypingCommand::forwardDeleteKeyPressed):
1421         (WebCore::TypingCommand::deleteSelection):
1422
1423         These now invoke willAddTypingToOpenCommand before proceeding with creating the command and applying it. The
1424         flow is now:
1425             - willAddTypingToOpenCommand
1426             - create and apply a new command
1427             - typingAddedToOpenCommand
1428
1429         * editing/TypingCommand.h:
1430         (WebCore::TypingCommand::preservesTypingStyle): Deleted.
1431         (WebCore::TypingCommand::shouldRetainAutocorrectionIndicator): Deleted.
1432         (WebCore::TypingCommand::setShouldRetainAutocorrectionIndicator): Deleted.
1433         (WebCore::TypingCommand::shouldStopCaretBlinking): Deleted.
1434         * html/HTMLAttributeNames.in:
1435         * html/HTMLElement.cpp:
1436         (WebCore::HTMLElement::createEventHandlerNameMap):
1437
1438 2016-10-07  Nan Wang  <n_wang@apple.com>
1439
1440         AX: <figcaption> should be AXTitleUIElement for other content inside the <figure>
1441         https://bugs.webkit.org/show_bug.cgi?id=108996
1442
1443         Reviewed by Chris Fleizach.
1444
1445         Exposed the figcaption element to be the AXTitleUIElement for the figure element. And used
1446         the figcaption's content as the accessible name of the figure. Also, updated the figure element's
1447         role description on Mac.
1448         Accessible name and description calculation for figure elements: 
1449         https://w3c.github.io/html-aam/#figure-and-figcaption-elements
1450
1451         Test: accessibility/mac/figure-element.html
1452
1453         * English.lproj/Localizable.strings:
1454         * accessibility/AccessibilityNodeObject.cpp:
1455         (WebCore::AccessibilityNodeObject::captionForFigure):
1456         (WebCore::AccessibilityNodeObject::alternativeText):
1457         * accessibility/AccessibilityNodeObject.h:
1458         * accessibility/AccessibilityObject.cpp:
1459         (WebCore::AccessibilityObject::isFigure):
1460         (WebCore::AccessibilityObject::isSuperscriptStyleGroup): Deleted.
1461         * accessibility/AccessibilityObject.h:
1462         * accessibility/AccessibilityRenderObject.cpp:
1463         (WebCore::AccessibilityRenderObject::exposesTitleUIElement):
1464         (WebCore::AccessibilityRenderObject::titleUIElement):
1465         (WebCore::AccessibilityRenderObject::computeAccessibilityIsIgnored):
1466         * accessibility/mac/WebAccessibilityObjectWrapperMac.mm:
1467         (-[WebAccessibilityObjectWrapper roleDescription]):
1468         * platform/LocalizedStrings.cpp:
1469         (WebCore::AXFigureText):
1470         * platform/LocalizedStrings.h:
1471         * platform/efl/LocalizedStringsEfl.cpp:
1472         (WebCore::AXFigureText):
1473         * platform/gtk/LocalizedStringsGtk.cpp:
1474         (WebCore::AXFigureText):
1475
1476 2016-10-07  Alex Christensen  <achristensen@webkit.org>
1477
1478         Non-special URL fragments should percent-encode non-ASCII characters
1479         https://bugs.webkit.org/show_bug.cgi?id=163153
1480
1481         Reviewed by Tim Horton.
1482
1483         This is needed to keep compatibility with data URLs with non-ASCII characters after a '#'
1484         which works in Chrome, Firefox, and Safari, while maintaining compatibility with Chrome, IE, and Edge
1485         which keep non-ASCII characters in the fragments of special URLs.
1486         This was proposed to the spec in https://github.com/whatwg/url/issues/150
1487
1488         Covered by new API tests.
1489
1490         * platform/URLParser.cpp:
1491         (WebCore::URLParser::syntaxViolation):
1492         Removed assertion because we now have fragments that need percent encoding but are all ASCII.
1493         (WebCore::URLParser::fragmentSyntaxViolation):
1494         (WebCore::URLParser::parse):
1495
1496 2016-10-07  Brent Fulgham  <bfulgham@apple.com>
1497
1498         EventHandler functions that need to guarantee event handler lifetime need to use Ref<Frame>
1499         https://bugs.webkit.org/show_bug.cgi?id=98617
1500         <rdar://problem/12778649>
1501
1502         Reviewed by Daniel Bates.
1503
1504         Improve stability by ensuring that the Frame holding an active EventHandler is kept
1505         alive while in the process of handling events and executing JavaScript.
1506
1507         No new tests since there is no change in behavior.
1508
1509         * page/EventHandler.cpp:
1510         (WebCore::EventHandler::handleMousePressEventSingleClick): Protect the Frame with a Ref<>.
1511         (WebCore::EventHandler::handleMousePressEvent): Ditto.
1512         (WebCore::EventHandler::handleMouseDraggedEvent): Ditto.
1513         (WebCore::EventHandler::eventMayStartDrag): Ditto.
1514         (WebCore::EventHandler::handleMouseReleaseEvent): Ditto.
1515         (WebCore::EventHandler::hitTestResultAtPoint): Ditto.
1516         (WebCore::EventHandler::scrollRecursively): Ditto.
1517         (WebCore::EventHandler::logicalScrollRecursively): Ditto.
1518         (WebCore::EventHandler::selectCursor): Ditto.
1519         (WebCore::EventHandler::handleMouseDoubleClickEvent): Ditto.
1520         (WebCore::EventHandler::mouseMoved): Ditto.
1521         (WebCore::EventHandler::handleMouseMoveEvent): Ditto.
1522         (WebCore::EventHandler::handleMouseForceEvent): Ditto.
1523         (WebCore::EventHandler::dispatchDragEvent): Ditto.
1524         (WebCore::EventHandler::updateDragAndDrop): Ditto.
1525         (WebCore::EventHandler::cancelDragAndDrop): Ditto.
1526         (WebCore::EventHandler::performDragAndDrop): Ditto.
1527         (WebCore::EventHandler::prepareMouseEvent): Ditto.
1528         (WebCore::EventHandler::updateMouseEventTargetNode): Ditto.
1529         (WebCore::EventHandler::dispatchMouseEvent): Ditto.
1530         (WebCore::EventHandler::platformCompleteWheelEvent): Ditto.
1531         (WebCore::EventHandler::handleWheelEvent): Ditto.
1532         (WebCore::EventHandler::defaultWheelEventHandler): Ditto.
1533         (WebCore::EventHandler::sendContextMenuEvent): Ditto.
1534         (WebCore::EventHandler::sendContextMenuEventForKey): Ditto.
1535         (WebCore::EventHandler::hoverTimerFired): Ditto.
1536         (WebCore::EventHandler::keyEvent): Ditto.
1537         (WebCore::EventHandler::defaultKeyboardEventHandler): Ditto.
1538         (WebCore::EventHandler::handleDrag): Ditto.
1539         (WebCore::EventHandler::handleTextInputEvent): Ditto.
1540         (WebCore::EventHandler::defaultSpaceEventHandler): Ditto.
1541         (WebCore::EventHandler::defaultTabEventHandler): Ditto.
1542         (WebCore::EventHandler::sendScrollEvent): Ditto.
1543         (WebCore::EventHandler::handleTouchEvent): Ditto.
1544         * page/ios/EventHandlerIOS.mm:
1545         (WebCore::EventHandler::focusDocumentView): Ditto.
1546         * page/mac/EventHandlerMac.mm:
1547         (WebCore::EventHandler::platformCompleteWheelEvent): Ditto.
1548
1549 2016-10-07  Chris Dumez  <cdumez@apple.com>
1550
1551         Regression(r201970): productSub / vendor / vendorSub should not be exposed on WorkerNavigator
1552         https://bugs.webkit.org/show_bug.cgi?id=163124
1553
1554         Reviewed by Ryosuke Niwa.
1555
1556         productSub / vendor / vendorSub should not be exposed on WorkerNavigator:
1557         - https://html.spec.whatwg.org/#navigatorid
1558
1559         Test case:
1560         - http://w3c-test.org/submissions/3881/html/webappapis/system-state-and-capabilities/the-navigator-object/NavigatorID.worker
1561
1562         Note that the specification also restricts NavigatorID's appCodeName and
1563         product attributes to Window. However, it seems the HTML specification is
1564         about to get updated so that these get exposed to workers:
1565         - https://github.com/whatwg/html/pull/1870
1566
1567         No new tests, updated existing test.
1568
1569         * bindings/scripts/generate-bindings.pl:
1570         (shouldPropertyBeExposed):
1571         * page/NavigatorID.idl:
1572
1573 2016-10-07  Alex Christensen  <achristensen@webkit.org>
1574
1575         Disable URLParser logs by default in all builds
1576         https://bugs.webkit.org/show_bug.cgi?id=163135
1577
1578         Reviewed by Brady Eidson.
1579
1580         In debug builds with the URLParser enabled, some tests time out because
1581         parameters to generate log strings are being evaluated for each character of each URL
1582         and then not being used if URLParser logs are disabled.  Generating these unused parameters
1583         is too slow even for debug builds.  Let's only generate them if they are to be used.
1584
1585         No change in behaviour.
1586
1587         * platform/URLParser.cpp:
1588         (WebCore::URLParser::parse):
1589         (WebCore::URLParser::allValuesEqual):
1590
1591 2016-10-07  Andreas Kling  <akling@apple.com>
1592
1593         [WK2] didRemoveFrameFromHierarchy callback doesn't fire for subframes when evicting from PageCache.
1594         <https://webkit.org/b/163098>
1595         <rdar://problem/28663488>
1596
1597         Reviewed by Antti Koivisto.
1598
1599         Fix a bug where WK2 didRemoveFrameFromHierarchy callbacks wouldn't fire for subframes that were getting
1600         kicked out of PageCache. The problem was happening because CachedFrame would disconnect the Frame from
1601         its Page just before calling FrameLoader::detachViewsAndDocumentLoader() where the callbacks are fired.
1602         Without a Page, the WebFrame on WK2 side can't find its WebPage, and so it can't fire its callbacks.
1603
1604         The fix is just to switch the order of those two lines.
1605
1606         This bug was causing frequent DOM and window object leaks in some clients *cough* Safari *cough* that
1607         were relying on didRemoveFrameFromHierarchy to release their isolated worlds.
1608
1609         Test: WebKit2.DidRemoveFrameFromHiearchyInPageCache
1610
1611         * history/CachedFrame.cpp:
1612         (WebCore::CachedFrame::destroy):
1613
1614 2016-10-07  Nan Wang  <n_wang@apple.com>
1615
1616         AX: AXRoleDescription for details and summary elements
1617         https://bugs.webkit.org/show_bug.cgi?id=163094
1618
1619         Reviewed by Chris Fleizach.
1620
1621         details and summary elements should have AXRoleDescription that is consistent with other
1622         elements that have custom AXSubRole.
1623
1624         Test: accessibility/mac/details-summary-role-description.html
1625
1626         * English.lproj/Localizable.strings:
1627         * accessibility/mac/WebAccessibilityObjectWrapperMac.mm:
1628         (-[WebAccessibilityObjectWrapper roleDescription]):
1629         * platform/LocalizedStrings.cpp:
1630         (WebCore::AXDetailsText):
1631         (WebCore::AXSummaryText):
1632         * platform/LocalizedStrings.h:
1633         * platform/efl/LocalizedStringsEfl.cpp:
1634         (WebCore::AXDetailsText):
1635         (WebCore::AXSummaryText):
1636         * platform/gtk/LocalizedStringsGtk.cpp:
1637         (WebCore::AXDetailsText):
1638         (WebCore::AXSummaryText):
1639
1640 2016-10-07  Ryan Haddad  <ryanhaddad@apple.com>
1641
1642         Fix the Windows build after r206917.
1643
1644         Unreviewed build fix.
1645
1646         * dom/DOMAllInOne.cpp:
1647
1648 2016-10-07  Antti Koivisto  <antti@apple.com>
1649
1650         Rename AuthorStyleSheets to Style::Scope
1651         https://bugs.webkit.org/show_bug.cgi?id=163108
1652
1653         Reviewed by Andreas Kling.
1654
1655         It represents the style scope in DOM.
1656         Also move the file under style/.
1657
1658         * CMakeLists.txt:
1659         * WebCore.xcodeproj/project.pbxproj:
1660         * css/CSSStyleSheet.cpp:
1661         (WebCore::CSSStyleSheet::styleSheetScope):
1662         * css/CSSStyleSheet.h:
1663         * css/InspectorCSSOMWrappers.cpp:
1664         (WebCore::InspectorCSSOMWrappers::getWrapperForRuleInSheets):
1665         * css/InspectorCSSOMWrappers.h:
1666         * css/StyleSheetList.cpp:
1667         (WebCore::StyleSheetList::styleSheets):
1668         (WebCore::StyleSheetList::detachFromDocument):
1669         * dom/AuthorStyleSheets.cpp: Removed.
1670         * dom/AuthorStyleSheets.h: Removed.
1671         * dom/Document.cpp:
1672         (WebCore::Document::Document):
1673         (WebCore::Document::setContentLanguage):
1674         (WebCore::Document::recalcStyle):
1675         (WebCore::Document::needsStyleRecalc):
1676         (WebCore::Document::updateStyleIfNeeded):
1677         (WebCore::Document::updateLayoutIgnorePendingStylesheets):
1678         (WebCore::Document::createStyleResolver):
1679         (WebCore::Document::didRemoveAllPendingStylesheet):
1680         (WebCore::Document::usesStyleBasedEditability):
1681         (WebCore::Document::processHttpEquiv):
1682         (WebCore::Document::preferredStylesheetSet):
1683         (WebCore::Document::selectedStylesheetSet):
1684         (WebCore::Document::setSelectedStylesheetSet):
1685         (WebCore::Document::haveStylesheetsLoaded):
1686         * dom/Document.h:
1687         (WebCore::Document::styleScope):
1688         (WebCore::Document::authorStyleSheets): Deleted.
1689         * dom/ExtensionStyleSheets.cpp:
1690         (WebCore::ExtensionStyleSheets::clearPageUserSheet):
1691         (WebCore::ExtensionStyleSheets::updatePageUserSheet):
1692         (WebCore::ExtensionStyleSheets::invalidateInjectedStyleSheetCache):
1693         (WebCore::ExtensionStyleSheets::addUserStyleSheet):
1694         (WebCore::ExtensionStyleSheets::addAuthorStyleSheetForTesting):
1695         (WebCore::ExtensionStyleSheets::styleResolverChangedTimerFired):
1696         * dom/InlineStyleSheetOwner.cpp:
1697         (WebCore::InlineStyleSheetOwner::insertedIntoDocument):
1698         (WebCore::InlineStyleSheetOwner::removedFromDocument):
1699         (WebCore::InlineStyleSheetOwner::clearDocumentData):
1700         (WebCore::InlineStyleSheetOwner::createSheet):
1701         (WebCore::InlineStyleSheetOwner::sheetLoaded):
1702         (WebCore::InlineStyleSheetOwner::startLoadingDynamicSheet):
1703         * dom/InlineStyleSheetOwner.h:
1704         (WebCore::InlineStyleSheetOwner::styleScope):
1705         (WebCore::InlineStyleSheetOwner::styleSheetScope): Deleted.
1706         * dom/ProcessingInstruction.cpp:
1707         (WebCore::ProcessingInstruction::~ProcessingInstruction):
1708         (WebCore::ProcessingInstruction::checkStyleSheet):
1709         (WebCore::ProcessingInstruction::sheetLoaded):
1710         (WebCore::ProcessingInstruction::insertedInto):
1711         (WebCore::ProcessingInstruction::removedFrom):
1712         * dom/ShadowRoot.cpp:
1713         (WebCore::ShadowRoot::styleResolver):
1714         (WebCore::ShadowRoot::styleScope):
1715         (WebCore::ShadowRoot::updateStyle):
1716         (WebCore::ShadowRoot::authorStyleSheets): Deleted.
1717         * dom/ShadowRoot.h:
1718         * html/HTMLLinkElement.cpp:
1719         (WebCore::HTMLLinkElement::~HTMLLinkElement):
1720         (WebCore::HTMLLinkElement::setDisabledState):
1721         (WebCore::HTMLLinkElement::parseAttribute):
1722         (WebCore::HTMLLinkElement::process):
1723         (WebCore::HTMLLinkElement::insertedInto):
1724         (WebCore::HTMLLinkElement::removedFrom):
1725         (WebCore::HTMLLinkElement::addPendingSheet):
1726         (WebCore::HTMLLinkElement::removePendingSheet):
1727         * html/HTMLStyleElement.cpp:
1728         * inspector/InspectorCSSAgent.cpp:
1729         (WebCore::InspectorCSSAgent::collectAllDocumentStyleSheets):
1730         (WebCore::InspectorCSSAgent::forcePseudoState):
1731         (WebCore::InspectorCSSAgent::buildObjectForRule):
1732         (WebCore::InspectorCSSAgent::resetPseudoStates):
1733         * inspector/InspectorPageAgent.cpp:
1734         (WebCore::InspectorPageAgent::setEmulatedMedia):
1735         * page/DOMWindow.cpp:
1736         (WebCore::DOMWindow::getMatchedCSSRules):
1737         * page/Frame.cpp:
1738         (WebCore::Frame::setPrinting):
1739         * page/FrameView.cpp:
1740         (WebCore::FrameView::layout):
1741         (WebCore::FrameView::setPagination):
1742         (WebCore::FrameView::setViewportSizeForCSSViewportUnits):
1743         * page/Page.cpp:
1744         (WebCore::Page::setViewMode):
1745         (WebCore::Page::setNeedsRecalcStyleInAllFrames):
1746         (WebCore::Page::invalidateInjectedStyleSheetCacheInAllFrames):
1747         * style/StyleScope.cpp: Copied from dom/AuthorStyleSheets.cpp.
1748         (WebCore::Style::Scope::Scope):
1749         (WebCore::Style::Scope::styleResolver):
1750         (WebCore::Style::Scope::styleResolverIfExists):
1751         (WebCore::Style::Scope::forNode):
1752         (WebCore::Style::Scope::removePendingSheet):
1753         (WebCore::Style::Scope::addStyleSheetCandidateNode):
1754         (WebCore::Style::Scope::removeStyleSheetCandidateNode):
1755         (WebCore::Style::Scope::collectActiveStyleSheets):
1756         (WebCore::Style::Scope::analyzeStyleSheetChange):
1757         (WebCore::Style::Scope::updateActiveStyleSheets):
1758         (WebCore::Style::Scope::updateStyleResolver):
1759         (WebCore::Style::Scope::activeStyleSheetsForInspector):
1760         (WebCore::Style::Scope::activeStyleSheetsContains):
1761         (WebCore::Style::Scope::flushPendingUpdate):
1762         (WebCore::Style::Scope::clearPendingUpdate):
1763         (WebCore::Style::Scope::scheduleActiveSetUpdate):
1764         (WebCore::Style::Scope::didChangeCandidatesForActiveSet):
1765         (WebCore::Style::Scope::didChangeContentsOrInterpretation):
1766         (WebCore::Style::Scope::pendingUpdateTimerFired):
1767         (WebCore::AuthorStyleSheets::AuthorStyleSheets): Deleted.
1768         (WebCore::AuthorStyleSheets::styleResolver): Deleted.
1769         (WebCore::AuthorStyleSheets::styleResolverIfExists): Deleted.
1770         (WebCore::AuthorStyleSheets::forNode): Deleted.
1771         (WebCore::AuthorStyleSheets::removePendingSheet): Deleted.
1772         (WebCore::AuthorStyleSheets::addStyleSheetCandidateNode): Deleted.
1773         (WebCore::AuthorStyleSheets::removeStyleSheetCandidateNode): Deleted.
1774         (WebCore::AuthorStyleSheets::collectActiveStyleSheets): Deleted.
1775         (WebCore::AuthorStyleSheets::analyzeStyleSheetChange): Deleted.
1776         (WebCore::AuthorStyleSheets::updateActiveStyleSheets): Deleted.
1777         (WebCore::AuthorStyleSheets::updateStyleResolver): Deleted.
1778         (WebCore::AuthorStyleSheets::activeStyleSheetsForInspector): Deleted.
1779         (WebCore::AuthorStyleSheets::activeStyleSheetsContains): Deleted.
1780         (WebCore::AuthorStyleSheets::flushPendingUpdate): Deleted.
1781         (WebCore::AuthorStyleSheets::clearPendingUpdate): Deleted.
1782         (WebCore::AuthorStyleSheets::scheduleActiveSetUpdate): Deleted.
1783         (WebCore::AuthorStyleSheets::didChangeCandidatesForActiveSet): Deleted.
1784         (WebCore::AuthorStyleSheets::didChangeContentsOrInterpretation): Deleted.
1785         (WebCore::AuthorStyleSheets::pendingUpdateTimerFired): Deleted.
1786         * style/StyleScope.h: Copied from dom/AuthorStyleSheets.h.
1787         * style/StyleTreeResolver.cpp:
1788         * svg/SVGFontFaceElement.cpp:
1789         (WebCore::SVGFontFaceElement::rebuildFontFace):
1790         (WebCore::SVGFontFaceElement::removedFrom):
1791         * xml/XMLTreeViewer.cpp:
1792         (WebCore::XMLTreeViewer::transformDocumentToTreeView):
1793         * xml/parser/XMLDocumentParser.cpp:
1794         (WebCore::XMLDocumentParser::end):
1795         * xml/parser/XMLDocumentParserLibxml2.cpp:
1796         (WebCore::XMLDocumentParser::doEnd):
1797
1798 2016-10-07  Zalan Bujtas  <zalan@apple.com>
1799
1800         https://vuldb.com/?cvssv3.2012 takes long time to load.
1801         https://bugs.webkit.org/show_bug.cgi?id=162994
1802         <rdar://problem/28593746>
1803
1804         Reviewed by Darin Adler.
1805
1806         Stop visiting cousins when we hit the style sharing search threshold.
1807
1808         In addition to mistakenly ignoring the threshold at SharingResolver::findSibling(), we
1809         continued on searching for cousin elements. 
1810
1811         Test: fast/selectors/slow-style-sharing-with-long-cousin-list.html
1812
1813         * style/StyleSharingResolver.cpp:
1814         (WebCore::Style::SharingResolver::resolve):
1815         (WebCore::Style::SharingResolver::findSibling):
1816         (WebCore::Style::SharingResolver::locateCousinList):
1817
1818 2016-10-07  Romain Bellessort  <romain.bellessort@crf.canon.fr>
1819
1820         [Readable Streams API] Implement generic reader functions
1821         https://bugs.webkit.org/show_bug.cgi?id=163003
1822
1823         Reviewed by Darin Adler.
1824
1825         Implements reader generic functions defined by spec in order to prepare BYOBReader integration.
1826         Generic functions factorize some code that is used by both DefaultReader and BYOBReader.
1827
1828         No change in behaviour.
1829
1830         * Modules/streams/ReadableStreamDefaultReader.js:
1831         (cancel): Rely on readableStreamReaderGenericCancel.
1832         (releaseLock): Rely on readableStreamReaderGenericRelease.
1833         * Modules/streams/ReadableStreamInternals.js:
1834         (privateInitializeReadableStreamDefaultReader): Rely on readableStreamReaderGenericInitialize.
1835         (readableStreamReaderGenericInitialize): Added.
1836         (readableStreamReaderGenericCancel): Added.
1837         (readableStreamReaderGenericRelease): Added.
1838
1839 2016-10-07  Adam Bergkvist  <adam.bergkvist@ericsson.com>
1840
1841         WebRTC: Misc gardening: Use typedefs consistently and remove unused code
1842         https://bugs.webkit.org/show_bug.cgi?id=163104
1843
1844         Reviewed by Philippe Normand.
1845
1846         Miscellaneous WebRTC gardening. See file list below for details.
1847
1848         Testing: No change in behavior.
1849
1850         * Modules/mediastream/MediaEndpointPeerConnection.cpp:
1851         * Modules/mediastream/MediaEndpointPeerConnection.h:
1852         Move NotImplemented include to cpp-file.
1853         * platform/mediastream/MediaEndpoint.h:
1854         Use MediaPayloadVector typedef (instead of Vector<RefPtr<MediaPayload>>).
1855         * platform/mediastream/PeerMediaDescription.h:
1856         (WebCore::PeerMediaDescription::source): Deleted.
1857         (WebCore::PeerMediaDescription::setSource): Deleted.
1858         Sources are passed to updateSendConfiguration() via a source map and not added to each
1859         PeerMediaDescription anymore. Remove unused code.
1860         * platform/mock/MockMediaEndpoint.cpp:
1861         (WebCore::MockMediaEndpoint::getDefaultAudioPayloads):
1862         (WebCore::MockMediaEndpoint::getDefaultVideoPayloads):
1863         Use MediaPayloadVector typedef.
1864         * platform/mock/MockMediaEndpoint.h:
1865         Use MediaPayloadVector typedef.
1866
1867 2016-10-07  Gwang Yoon Hwang  <yoon@igalia.com>
1868
1869         [GTK] Remove unneeded creation of TextureMapperPlatformLayerProxy
1870         https://bugs.webkit.org/show_bug.cgi?id=163101
1871
1872         Reviewed by Žan Doberšek.
1873
1874         Covered by existing tests.
1875
1876         * platform/graphics/cairo/ImageBufferCairo.cpp:
1877         (WebCore::ImageBufferData::ImageBufferData): Modified not to create
1878         TextureMapperPlatformLayerProxy if it is not created for the
1879         accelerated 2d canvas.
1880
1881 2016-10-07  Fujii Hironori  <Hironori.Fujii@sony.com>
1882
1883         Use 'use lib $FindBin::Bin' to append Perl module include path
1884         https://bugs.webkit.org/show_bug.cgi?id=162256
1885
1886         Reviewed by Carlos Garcia Campos.
1887
1888         Some Perl  scripts are needed to  be executed with '-I'  switch to
1889         explicitly append Perl module include path.  Use 'use lib' as well
1890         as other Perl scripts do.
1891
1892         * CMakeLists.txt: Removed '-I' options from invocation of Perl.
1893         * DerivedSources.make: Ditto.
1894         * bindings/scripts/generate-bindings.pl: Use 'use lib'.
1895         * bindings/scripts/preprocess-idls.pl: Ditto.
1896         * css/make-css-file-arrays.pl: Ditto.
1897         * css/makegrammar.pl: Ditto.
1898         * css/makeprop.pl: Ditto.
1899         * css/makevalues.pl: Ditto.
1900         * dom/make_dom_exceptions.pl: Ditto.
1901         * dom/make_event_factory.pl: Ditto.
1902         * dom/make_names.pl: Ditto.
1903         * page/make_settings.pl: Ditto.
1904
1905 2016-10-07  Youenn Fablet  <youenn@apple.com>
1906
1907         Refactor CachedResourceClient::notifyFinished
1908         https://bugs.webkit.org/show_bug.cgi?id=162060
1909
1910         Reviewed by Darin Adler.
1911
1912         No change of behavior.
1913
1914         Making CachedResourceClient and CachedRawResourceClient callbacks take CachedResource references and not pointers.
1915         In most cases, the CachedResource parameter is only used for assertions.
1916         Removing that parameter might be contemplated in the future.
1917         The only real case is in RenderImage.
1918
1919         Removed the CachedResource parameter from ContentFilter methods as code was calling these methods with null values.
1920
1921         * dom/LoadableClassicScript.cpp:
1922         (WebCore::LoadableClassicScript::notifyFinished):
1923         * dom/LoadableClassicScript.h:
1924         * html/HTMLImageLoader.cpp:
1925         (WebCore::HTMLImageLoader::notifyFinished):
1926         * html/HTMLImageLoader.h:
1927         * loader/ContentFilter.cpp:
1928         (WebCore::ContentFilter::continueAfterResponseReceived):
1929         (WebCore::ContentFilter::continueAfterDataReceived):
1930         (WebCore::ContentFilter::continueAfterNotifyFinished):
1931         (WebCore::ContentFilter::deliverResourceData):
1932         * loader/ContentFilter.h:
1933         * loader/CrossOriginPreflightChecker.cpp:
1934         (WebCore::CrossOriginPreflightChecker::notifyFinished):
1935         * loader/CrossOriginPreflightChecker.h:
1936         * loader/DocumentLoader.cpp:
1937         (WebCore::DocumentLoader::notifyFinished):
1938         (WebCore::DocumentLoader::handleSubstituteDataLoadNow):
1939         (WebCore::DocumentLoader::redirectReceived):
1940         (WebCore::DocumentLoader::responseReceived):
1941         (WebCore::DocumentLoader::continueAfterContentPolicy):
1942         (WebCore::DocumentLoader::dataReceived):
1943         * loader/DocumentLoader.h:
1944         * loader/DocumentThreadableLoader.cpp:
1945         (WebCore::DocumentThreadableLoader::redirectReceived):
1946         (WebCore::DocumentThreadableLoader::dataSent):
1947         (WebCore::DocumentThreadableLoader::responseReceived):
1948         (WebCore::DocumentThreadableLoader::dataReceived):
1949         (WebCore::DocumentThreadableLoader::notifyFinished):
1950         * loader/DocumentThreadableLoader.h:
1951         * loader/ImageLoader.cpp:
1952         (WebCore::ImageLoader::notifyFinished):
1953         * loader/ImageLoader.h:
1954         * loader/LinkLoader.cpp:
1955         (WebCore::LinkLoader::triggerEvents):
1956         (WebCore::LinkLoader::notifyFinished):
1957         * loader/LinkLoader.h:
1958         * loader/LinkPreloadResourceClients.cpp:
1959         (WebCore::LinkPreloadResourceClient::triggerEvents):
1960         * loader/LinkPreloadResourceClients.h:
1961         * loader/MediaResourceLoader.cpp:
1962         (WebCore::MediaResource::responseReceived):
1963         (WebCore::MediaResource::shouldCacheResponse):
1964         (WebCore::MediaResource::redirectReceived):
1965         (WebCore::MediaResource::dataSent):
1966         (WebCore::MediaResource::dataReceived):
1967         (WebCore::MediaResource::notifyFinished):
1968         (WebCore::MediaResource::getOrCreateReadBuffer):
1969         * loader/MediaResourceLoader.h:
1970         * loader/TextTrackLoader.cpp:
1971         (WebCore::TextTrackLoader::processNewCueData):
1972         (WebCore::TextTrackLoader::deprecatedDidReceiveCachedResource):
1973         (WebCore::TextTrackLoader::notifyFinished):
1974         * loader/TextTrackLoader.h:
1975         * loader/cache/CachedRawResource.cpp:
1976         (WebCore::CachedRawResource::notifyClientsDataWasReceived):
1977         (WebCore::CachedRawResource::didAddClient):
1978         (WebCore::CachedRawResource::redirectReceived):
1979         (WebCore::CachedRawResource::responseReceived):
1980         (WebCore::CachedRawResource::shouldCacheResponse):
1981         (WebCore::CachedRawResource::didSendData):
1982         * loader/cache/CachedRawResourceClient.h:
1983         (WebCore::CachedRawResourceClient::dataSent):
1984         (WebCore::CachedRawResourceClient::responseReceived):
1985         (WebCore::CachedRawResourceClient::shouldCacheResponse):
1986         (WebCore::CachedRawResourceClient::dataReceived):
1987         (WebCore::CachedRawResourceClient::redirectReceived):
1988         (WebCore::CachedRawResourceClient::getOrCreateReadBuffer):
1989         * loader/cache/CachedResource.cpp:
1990         (WebCore::CachedResource::checkNotify):
1991         (WebCore::CachedResource::didAddClient):
1992         * loader/cache/CachedResourceClient.h:
1993         (WebCore::CachedResourceClient::notifyFinished):
1994         (WebCore::CachedResourceClient::deprecatedDidReceiveCachedResource):
1995         * loader/cache/CachedTextTrack.cpp:
1996         (WebCore::CachedTextTrack::updateData):
1997         * loader/icon/IconLoader.cpp:
1998         (WebCore::IconLoader::notifyFinished):
1999         * loader/icon/IconLoader.h:
2000         * loader/soup/CachedRawResourceSoup.cpp:
2001         * platform/graphics/avfoundation/cf/WebCoreAVCFResourceLoader.cpp:
2002         (WebCore::WebCoreAVCFResourceLoader::responseReceived):
2003         (WebCore::WebCoreAVCFResourceLoader::dataReceived):
2004         (WebCore::WebCoreAVCFResourceLoader::notifyFinished):
2005         (WebCore::WebCoreAVCFResourceLoader::fulfillRequestWithResource):
2006         * platform/graphics/avfoundation/cf/WebCoreAVCFResourceLoader.h:
2007         * platform/graphics/avfoundation/objc/WebCoreAVFResourceLoader.h:
2008         * platform/graphics/avfoundation/objc/WebCoreAVFResourceLoader.mm:
2009         (WebCore::WebCoreAVFResourceLoader::responseReceived):
2010         (WebCore::WebCoreAVFResourceLoader::dataReceived):
2011         (WebCore::WebCoreAVFResourceLoader::notifyFinished):
2012         (WebCore::WebCoreAVFResourceLoader::fulfillRequestWithResource):
2013         * rendering/RenderImage.cpp:
2014         (WebCore::RenderImage::notifyFinished):
2015         * rendering/RenderImage.h:
2016         * rendering/RenderLayerFilterInfo.cpp:
2017         (WebCore::RenderLayer::FilterInfo::setRenderer):
2018         (WebCore::RenderLayer::FilterInfo::notifyFinished):
2019         * rendering/RenderLayerFilterInfo.h:
2020         * svg/SVGFEImageElement.cpp:
2021         (WebCore::SVGFEImageElement::notifyFinished):
2022         * svg/SVGFEImageElement.h:
2023         * svg/SVGUseElement.cpp:
2024         (WebCore::SVGUseElement::notifyFinished):
2025         * svg/SVGUseElement.h:
2026         * xml/parser/XMLDocumentParser.cpp:
2027         (WebCore::XMLDocumentParser::notifyFinished):
2028         * xml/parser/XMLDocumentParser.h:
2029
2030 2016-10-06  Youenn Fablet  <youenn@apple.com>
2031
2032         CachedXSLStylesheet does not need to be updated according Origin/Fetch mode
2033         https://bugs.webkit.org/show_bug.cgi?id=162389
2034
2035         Reviewed by Darin Adler.
2036
2037         No change of behavior.
2038
2039         Making clear that there is no reason to update cached XSLT resources according the origin, given that CORS is never checked and loading is always same-origin.
2040
2041         Renaming CachedResource::isClean to CachedResource::isCORSSameOrigin to better match spec terminology.
2042         Updating HTMLLinkElement accordingly.
2043
2044         * html/HTMLLinkElement.cpp:
2045         (WebCore::HTMLLinkElement::initializeStyleSheet):
2046         * loader/cache/CachedResource.cpp:
2047         (WebCore::CachedResource::isCORSSameOrigin): Ensuring that this method is not called for resource types for which CORS is not to be used.
2048         (WebCore::CachedResource::isClean): Deleted.
2049         * loader/cache/CachedResource.h:
2050         * loader/cache/CachedResourceLoader.cpp:
2051         (WebCore::CachedResourceLoader::shouldUpdateCachedResourceWithCurrentRequest):
2052
2053 2016-10-06  Youenn Fablet  <youenn@apple.com>
2054
2055         Add a place for common HTTP Header values
2056         https://bugs.webkit.org/show_bug.cgi?id=163002
2057
2058         Reviewed by Alex Christensen.
2059
2060         No change of behavior.
2061
2062         Introducing HTTPHeaderValues with two Content-Type values.
2063
2064         * CMakeLists.txt:
2065         * Modules/fetch/FetchBody.cpp:
2066         (WebCore::FetchBody::extract):
2067         * WebCore.xcodeproj/project.pbxproj:
2068         * platform/network/HTTPHeaderValues.cpp: Added.
2069         (WebCore::HTTPHeaderValues::TextPlainContentType):
2070         (WebCore::HTTPHeaderValues::FormURLEncodedContentType):
2071         * platform/network/HTTPHeaderValues.h: Added.
2072         * xml/XMLHttpRequest.cpp:
2073         (WebCore::XMLHttpRequest::send):
2074
2075 2016-10-06  Youenn Fablet  <youenn@apple.com>
2076
2077         CachedResourceRequest should not need to store defer and preload options
2078         https://bugs.webkit.org/show_bug.cgi?id=163004
2079
2080         Reviewed by Alex Christensen.
2081
2082         No change of behavior.
2083
2084         Removing CachedResourceRequest defer and preload fields.
2085         These fields are computed inside CachedResourceLoader instead.
2086
2087         Updated setting of priority from CachedResourceRequest to CachedResource.
2088         Priority is set for any new resource (this covers all cases where no cached resource can be reused from the memory cache).
2089         Priority is set for a cached resource if the request is not a preload request.
2090
2091         * loader/LinkLoader.cpp:
2092         (WebCore::LinkLoader::preloadIfNeeded):
2093         * loader/cache/CachedResource.cpp:
2094         (WebCore::CachedResource::CachedResource):
2095         * loader/cache/CachedResourceLoader.cpp:
2096         (WebCore::CachedResourceLoader::requestImage):
2097         (WebCore::CachedResourceLoader::canRequest):
2098         (WebCore::CachedResourceLoader::requestResource):
2099         (WebCore::CachedResourceLoader::determineRevalidationPolicy):
2100         (WebCore::CachedResourceLoader::requestPreload):
2101         * loader/cache/CachedResourceLoader.h:
2102         * loader/cache/CachedResourceRequest.cpp:
2103         (WebCore::CachedResourceRequest::CachedResourceRequest):
2104         * loader/cache/CachedResourceRequest.h:
2105         (WebCore::CachedResourceRequest::priority):
2106         (WebCore::CachedResourceRequest::forPreload): Deleted.
2107         (WebCore::CachedResourceRequest::setForPreload): Deleted.
2108         (WebCore::CachedResourceRequest::defer): Deleted.
2109         (WebCore::CachedResourceRequest::setDefer): Deleted.
2110
2111 2016-10-06  Myles C. Maxfield  <mmaxfield@apple.com>
2112
2113         Variation fonts don't affect glyph advances
2114         https://bugs.webkit.org/show_bug.cgi?id=163093
2115
2116         Reviewed by Darin Adler.
2117
2118         Work around known bug <rdar://problem/28662086>. For variation fonts,
2119         CTFontGetAdvancesForGlyphs() gives correct answers but
2120         CTFontGetUnsummedAdvancesForGlyphsAndStyle() doesn't.
2121
2122         Test: fast/text/variations/advances.html
2123
2124         * platform/graphics/FontPlatformData.h:
2125         (WebCore::FontPlatformData::hasVariations):
2126         * platform/graphics/cocoa/FontCocoa.mm:
2127         (WebCore::Font::platformWidthForGlyph):
2128         * platform/graphics/cocoa/FontPlatformDataCocoa.mm:
2129         (WebCore::FontPlatformData::FontPlatformData):
2130
2131 2016-10-06  Commit Queue  <commit-queue@webkit.org>
2132
2133         Unreviewed, rolling out r206713.
2134         https://bugs.webkit.org/show_bug.cgi?id=163097
2135
2136         triggers apparent codegen bug on ARM 32-bit (Requested by smfr
2137         on #webkit).
2138
2139         Reverted changeset:
2140
2141         "Support transitions/animations of background-position with
2142         right/bottom-relative values"
2143         https://bugs.webkit.org/show_bug.cgi?id=162048
2144         http://trac.webkit.org/changeset/206713
2145
2146 2016-10-06  Daniel Bates  <dabates@apple.com>
2147
2148         Remove unused WebCore::contentDispositionType()
2149         https://bugs.webkit.org/show_bug.cgi?id=163095
2150
2151         Reviewed by Alex Christensen.
2152
2153         The function WebCore::contentDispositionType() was only used by the Chromium and Qt ports
2154         to parse the Content-Disposition HTTP header. Both of these ports have long since been
2155         removed from the repository. We should remove WebCore::contentDispositionType().
2156
2157         * platform/network/HTTPParsers.cpp:
2158         (WebCore::contentDispositionType): Deleted.
2159         * platform/network/HTTPParsers.h:
2160
2161 2016-10-06  Ryosuke Niwa  <rniwa@webkit.org>
2162
2163         Upgrading and constructing element should always report exception instead of rethrowing
2164         https://bugs.webkit.org/show_bug.cgi?id=162996
2165
2166         Reviewed by Darin Adler.
2167
2168         The latest HTML specification specifies that we must report exceptions thrown during element upgrades:
2169         https://html.spec.whatwg.org/#upgrades
2170
2171         In addition, F2F during 2016 TPAC had a consensus that we should do the same for document.createElement:
2172         https://github.com/w3c/webcomponents/issues/569
2173
2174         Since the HTML parser already reports the exception thrown during custom element construction as it does
2175         not have any JS stack, these changes make exceptions thrown during upgrades and constructions.
2176
2177         In our implementation, this only reduces the code complexity as now we can push the logic to fallback
2178         to HTMLUnknownElement into JSCustomElementInterface's constructElement, which has been renamed
2179         to constructElementWithFallback, and eliminate ShouldClearException enum class entirely. Moreover,
2180         constructElementWithFallback can now return Ref instead of RefPtr.
2181
2182         No new tests. Existing tests have been updated.
2183
2184         * bindings/js/JSCustomElementInterface.cpp:
2185         (WebCore::JSCustomElementInterface::constructElementWithFallback): Create a HTMLUnknownElement if
2186         an attempt to construct a custom element had failed in lieu of returning nullptr.
2187         (WebCore::JSCustomElementInterface::tryToConstructCustomElement): Renamed from constructElement.
2188         Always report exceptions (the same behavior as ShouldClearException::Clear).
2189         (WebCore::JSCustomElementInterface::upgradeElement): Report exceptions instead of rethrowing.
2190         * bindings/js/JSCustomElementInterface.h:
2191         * dom/Document.cpp:
2192         (WebCore::createHTMLElementWithNameValidation):
2193         * html/parser/HTMLDocumentParser.cpp:
2194         (WebCore::HTMLDocumentParser::runScriptsForPausedTreeBuilder):
2195
2196 2016-10-06  Chris Dumez  <cdumez@apple.com>
2197
2198         Overwriting an attribute event listener can lead to wrong event listener firing order
2199         https://bugs.webkit.org/show_bug.cgi?id=163083
2200
2201         Reviewed by Darin Adler.
2202
2203         Overwriting an attribute event listener could lead to wrong event listener
2204         firing order in WebKit. This is because we were removing the old event
2205         listener and then appending the new one instead of actually *replacing*
2206         the old one.
2207
2208         No new tests, rebaselined existing tests.
2209
2210         * dom/EventListenerMap.cpp:
2211         (WebCore::EventListenerMap::replace):
2212         * dom/EventListenerMap.h:
2213         * dom/EventTarget.cpp:
2214         (WebCore::EventTarget::setAttributeEventListener):
2215         (WebCore::EventTarget::hasActiveEventListeners): Deleted.
2216         (WebCore::EventTarget::dispatchEventForBindings): Deleted.
2217         * dom/EventTarget.h:
2218
2219 2016-10-06  Alex Christensen  <achristensen@webkit.org>
2220
2221         URLParser: Non-ASCII characters in Non-UTF-8 encoded queries of relative URLs with ws, wss, or nonspecial schemes should be UTF-8 encoded
2222         https://bugs.webkit.org/show_bug.cgi?id=163089
2223
2224         Reviewed by Tim Horton.
2225
2226         This is a change similar to r206818 but with relative URLs.
2227         This matches the spec, URL::parse, and other browsers' behavior.
2228         Covered by new API tests for URLParser.
2229         This also fixes tests like http/tests/misc/url-in-utf32le.html when URLParser is enabled.
2230
2231         * platform/URL.cpp:
2232         (WebCore::URL::URL):
2233         Use the same encoding for the URL constructor whether or not the URLParser is enabled.
2234         * platform/URLParser.cpp:
2235         (WebCore::URLParser::copyURLPartsUntil):
2236         (WebCore::URLParser::parse):
2237         (WebCore::isSpecial): Deleted.
2238         * platform/URLParser.h:
2239         Use UTF-8 for non-special, ws, or wss schemes.
2240
2241 2016-10-06  Zalan Bujtas  <zalan@apple.com>
2242
2243         Add back ASSERT(!needsLayout) to RenderTableSection which is now valid
2244         https://bugs.webkit.org/show_bug.cgi?id=92954
2245         <rdar://problem/12147973>
2246
2247         Reviewed by Dan Bernstein.
2248
2249         LayoutTests pass fine now with this assert on.
2250
2251         Covered by existing tests.
2252
2253         * rendering/RenderTableSection.cpp:
2254         (WebCore::RenderTableSection::paint):
2255
2256 2016-10-06  Jiewen Tan  <jiewen_tan@apple.com>
2257
2258         Add a dummy SubtleCrypto interface
2259         https://bugs.webkit.org/show_bug.cgi?id=162992
2260         <rdar://problem/28643573>
2261
2262         Reviewed by Brent Fulgham.
2263
2264         Add a dummy SubtleCrypto interface and rename KeyPair to CryptoKeyPair.
2265
2266         Tests: crypto/subtle/gc-2.html
2267                crypto/subtle/gc-3.html
2268                crypto/subtle/gc.html
2269                crypto/webkitSubtle/aes-cbc-192-encrypt-decrypt.html
2270                crypto/webkitSubtle/aes-cbc-256-encrypt-decrypt.html
2271                crypto/webkitSubtle/aes-cbc-encrypt-decrypt-with-padding.html
2272                crypto/webkitSubtle/aes-cbc-encrypt-decrypt.html
2273                crypto/webkitSubtle/aes-cbc-generate-key.html
2274                crypto/webkitSubtle/aes-cbc-import-jwk.html
2275                crypto/webkitSubtle/aes-cbc-invalid-length.html
2276                crypto/webkitSubtle/aes-cbc-unwrap-failure.html
2277                crypto/webkitSubtle/aes-cbc-unwrap-rsa.html
2278                crypto/webkitSubtle/aes-cbc-wrap-rsa-non-extractable.html
2279                crypto/webkitSubtle/aes-cbc-wrap-rsa.html
2280                crypto/webkitSubtle/aes-cbc-wrong-key-class.html
2281                crypto/webkitSubtle/aes-export-key.html
2282                crypto/webkitSubtle/aes-kw-key-manipulation.html
2283                crypto/webkitSubtle/aes-kw-wrap-unwrap-aes.html
2284                crypto/webkitSubtle/aes-postMessage.html
2285                crypto/webkitSubtle/argument-conversion.html
2286                crypto/webkitSubtle/array-buffer-view-offset.html
2287                crypto/webkitSubtle/crypto-key-algorithm-gc.html
2288                crypto/webkitSubtle/crypto-key-usages-gc.html
2289                crypto/webkitSubtle/hmac-check-algorithm.html
2290                crypto/webkitSubtle/hmac-export-key.html
2291                crypto/webkitSubtle/hmac-generate-key.html
2292                crypto/webkitSubtle/hmac-import-jwk.html
2293                crypto/webkitSubtle/hmac-postMessage.html
2294                crypto/webkitSubtle/hmac-sign-verify-empty-key.html
2295                crypto/webkitSubtle/hmac-sign-verify.html
2296                crypto/webkitSubtle/import-jwk.html
2297                crypto/webkitSubtle/jwk-export-use-values.html
2298                crypto/webkitSubtle/jwk-import-use-values.html
2299                crypto/webkitSubtle/rsa-export-generated-keys.html
2300                crypto/webkitSubtle/rsa-export-key.html
2301                crypto/webkitSubtle/rsa-export-private-key.html
2302                crypto/webkitSubtle/rsa-indexeddb-non-exportable-private.html
2303                crypto/webkitSubtle/rsa-indexeddb-non-exportable.html
2304                crypto/webkitSubtle/rsa-indexeddb-private.html
2305                crypto/webkitSubtle/rsa-indexeddb.html
2306                crypto/webkitSubtle/rsa-oaep-generate-non-extractable-key.html
2307                crypto/webkitSubtle/rsa-oaep-key-manipulation.html
2308                crypto/webkitSubtle/rsa-oaep-plaintext-length.html
2309                crypto/webkitSubtle/rsa-oaep-wrap-unwrap-aes.html
2310                crypto/webkitSubtle/rsa-postMessage.html
2311                crypto/webkitSubtle/rsaes-pkcs1-v1_5-decrypt.html
2312                crypto/webkitSubtle/rsaes-pkcs1-v1_5-wrap-unwrap-aes.html
2313                crypto/webkitSubtle/rsassa-pkcs1-v1_5-generate-key-with-leading-zeroes-in-exponent.html
2314                crypto/webkitSubtle/rsassa-pkcs1-v1_5-generate-key.html
2315                crypto/webkitSubtle/rsassa-pkcs1-v1_5-import-jwk-small-key.html
2316                crypto/webkitSubtle/rsassa-pkcs1-v1_5-import-jwk.html
2317                crypto/webkitSubtle/rsassa-pkcs1-v1_5-sign-verify.html
2318                crypto/webkitSubtle/sha-1.html
2319                crypto/webkitSubtle/sha-224.html
2320                crypto/webkitSubtle/sha-256.html
2321                crypto/webkitSubtle/sha-384.html
2322                crypto/webkitSubtle/sha-512.html
2323                crypto/webkitSubtle/unimplemented-unwrap-crash.html
2324                crypto/webkitSubtle/unwrapKey-check-usage.html
2325                crypto/webkitSubtle/wrapKey-check-usage.html
2326                crypto/workers/subtle/aes-postMessage-worker.html
2327                crypto/workers/subtle/gc-worker.html
2328                crypto/workers/subtle/hmac-postMessage-worker.html
2329                crypto/workers/subtle/hrsa-postMessage-worker.html
2330                crypto/workers/subtle/multiple-postMessage-worker.html
2331                crypto/workers/subtle/rsa-postMessage-worker.html
2332
2333         * CMakeLists.txt:
2334         * DerivedSources.cpp:
2335         * DerivedSources.make:
2336         * PlatformEfl.cmake:
2337         * PlatformGTK.cmake:
2338         * PlatformMac.cmake:
2339         * WebCore.xcodeproj/project.pbxproj:
2340         * crypto/CryptoKeyPair.idl:
2341         * crypto/SubtleCrypto.cpp:
2342         (WebCore::SubtleCrypto::SubtleCrypto):
2343         * crypto/SubtleCrypto.h:
2344         (WebCore::SubtleCrypto::create):
2345         * crypto/SubtleCrypto.idl: Added.
2346         * page/Crypto.cpp:
2347         (WebCore::Crypto::Crypto):
2348         (WebCore::Crypto::subtle):
2349         * page/Crypto.h:
2350         * page/Crypto.idl:
2351
2352 2016-10-06  Anders Carlsson  <andersca@apple.com>
2353
2354         Crash when ApplePaySession.completeMerchantValidation is not passed a dictionary
2355         https://bugs.webkit.org/show_bug.cgi?id=163074
2356         rdar://problem/27824842
2357
2358         Reviewed by Tim Horton.
2359
2360         Raise a type error on a null initializer object.
2361
2362         * Modules/applepay/ApplePaySession.cpp:
2363         (WebCore::ApplePaySession::completeMerchantValidation):
2364
2365 2016-10-06  Antti Koivisto  <antti@apple.com>
2366
2367         Mutating styleSheet in shadow tree doesn't update the style
2368         https://bugs.webkit.org/show_bug.cgi?id=162744
2369         <rdar://problem/28550588>
2370
2371         Reviewed by Ryosuke Niwa.
2372
2373         We weren't always invalidating the right AuthorStyleSheets (to be renamed) instance
2374         for the scope after mutations.
2375
2376         Test: fast/shadow-dom/mutating-stylesheet-in-shadow-tree.html
2377
2378         * css/CSSStyleSheet.cpp:
2379         (WebCore::CSSStyleSheet::didMutateRules):
2380         (WebCore::CSSStyleSheet::didMutate):
2381         (WebCore::CSSStyleSheet::clearOwnerNode):
2382         (WebCore::CSSStyleSheet::rootStyleSheet):
2383         (WebCore::CSSStyleSheet::ownerDocument):
2384         (WebCore::CSSStyleSheet::styleSheetScope):
2385
2386             Invalidate the right scope after stylesheet mutations.
2387
2388         * css/CSSStyleSheet.h:
2389         * dom/AuthorStyleSheets.cpp:
2390         (WebCore::AuthorStyleSheets::styleResolver):
2391         (WebCore::AuthorStyleSheets::styleResolverIfExists):
2392
2393             Take care to update the right style resolver.
2394
2395         (WebCore::AuthorStyleSheets::forNode):
2396         (WebCore::AuthorStyleSheets::removeStyleSheetCandidateNode):
2397
2398             Start the update timer so clients don't need to request update separately.
2399
2400         (WebCore::AuthorStyleSheets::analyzeStyleSheetChange):
2401         (WebCore::AuthorStyleSheets::updateActiveStyleSheets):
2402         (WebCore::AuthorStyleSheets::updateStyleResolver):
2403         * dom/AuthorStyleSheets.h:
2404         * dom/InlineStyleSheetOwner.cpp:
2405         (WebCore::InlineStyleSheetOwner::insertedIntoDocument):
2406
2407             Save the scope we were inserted into so removals can be done reliably.
2408
2409         (WebCore::InlineStyleSheetOwner::removedFromDocument):
2410
2411             Use and clear the saved scope.
2412             Remove didChangeCandidatesForActiveSet() as it is now done by removeStyleSheetCandidateNode() call.
2413
2414         (WebCore::InlineStyleSheetOwner::clearDocumentData):
2415         (WebCore::InlineStyleSheetOwner::createSheet):
2416         (WebCore::InlineStyleSheetOwner::sheetLoaded):
2417         (WebCore::InlineStyleSheetOwner::startLoadingDynamicSheet):
2418         (WebCore::authorStyleSheetsForElement): Deleted.
2419         * dom/InlineStyleSheetOwner.h:
2420         (WebCore::InlineStyleSheetOwner::styleSheetScope):
2421         * dom/ShadowRoot.cpp:
2422         (WebCore::ShadowRoot::styleResolverIfExists):
2423         * dom/ShadowRoot.h:
2424         * html/HTMLLinkElement.cpp:
2425         (WebCore::HTMLLinkElement::removedFrom):
2426
2427             Remove didChangeCandidatesForActiveSet() as it is now done by removeStyleSheetCandidateNode() call.
2428
2429         * html/HTMLStyleElement.cpp:
2430         (WebCore::HTMLStyleElement::~HTMLStyleElement):
2431         (WebCore::HTMLStyleElement::parseAttribute):
2432
2433             Fix a bug where we wouldn't create stylesheet if a style element was activated by removing a media attribute.
2434
2435         (WebCore::HTMLStyleElement::insertedInto):
2436         (WebCore::HTMLStyleElement::removedFrom):
2437         * page/DOMWindow.cpp:
2438         (WebCore::DOMWindow::getMatchedCSSRules):
2439         * svg/SVGStyleElement.cpp:
2440         (WebCore::SVGStyleElement::~SVGStyleElement):
2441         (WebCore::SVGStyleElement::insertedInto):
2442         (WebCore::SVGStyleElement::removedFrom):
2443
2444 2016-10-06  Alex Christensen  <achristensen@webkit.org>
2445
2446         Skip tabs and newlines between end of query and beginning of fragment in non-UTF-8-encoded URLs
2447         https://bugs.webkit.org/show_bug.cgi?id=163071
2448
2449         Reviewed by Tim Horton.
2450
2451         Covered by a new API test that would have asserted before this change.
2452
2453         * platform/URLParser.cpp:
2454         (WebCore::URLParser::encodeQuery):
2455         Skip tabs and newlines before asserting that we are at the end.
2456
2457 2016-10-06  Alex Christensen  <achristensen@webkit.org>
2458
2459         URLParser should parse file URLs with ports consistently
2460         https://bugs.webkit.org/show_bug.cgi?id=163075
2461
2462         Reviewed by Brady Eidson.
2463
2464         Covered by API tests.  We used to assert when parsing the newly tested URLs.
2465
2466         * platform/URLParser.cpp:
2467         (WebCore::URLParser::parse):
2468
2469 2016-10-06  Chris Dumez  <cdumez@apple.com>
2470
2471         [WebIDL] Add support for having dictionaries in their own IDL file
2472         https://bugs.webkit.org/show_bug.cgi?id=162912
2473
2474         Reviewed by Darin Adler.
2475
2476         Add support for having dictionaries in their own IDL file so that they
2477         can be shared by multiple interfaces.
2478
2479         Leverage this new support to merge Element::ScrollToOptions and
2480         DOMWindow::ScrollToOptions.
2481
2482         No new tests, extended bindings tests.
2483
2484         * CMakeLists.txt:
2485         * DerivedSources.cpp:
2486         * DerivedSources.make:
2487         * WebCore.xcodeproj/project.pbxproj:
2488         * bindings/scripts/CodeGenerator.pm:
2489         (ProcessDocument):
2490         (IDLFileForInterface):
2491         (GetDictionaryByName):
2492         (IsDictionaryType):
2493         (HasEnumImplementationNameOverride): Deleted.
2494         (GetEnumImplementationNameOverride): Deleted.
2495         * bindings/scripts/CodeGeneratorJS.pm:
2496         (GenerateDictionary):
2497         (GetEnumerationClassName):
2498         (GenerateEnumerationImplementationContent):
2499         (GenerateEnumerationHeaderContent):
2500         (GetDictionaryClassName):
2501         (GenerateDefaultValue):
2502         (GenerateDictionaryHeaderContent):
2503         (GenerateDictionariesHeaderContent):
2504         (GenerateDictionaryImplementationContent):
2505         (GenerateDictionariesImplementationContent):
2506         (GenerateHeader):
2507         (GenerateImplementation):
2508         (GenerateParametersCheck):
2509         (GenerateDictionaryHeader):
2510         (GenerateDictionaryImplementation):
2511         (GenerateCallbackHeader):
2512         (GenerateCallbackImplementation):
2513         (GetNativeType):
2514         (JSValueToNative):
2515         (GetNestedClassName): Deleted.
2516         (GenerateConversionRuleWithLeadingComma): Deleted.
2517         (addIterableProperties): Deleted.
2518         * bindings/scripts/preprocess-idls.pl:
2519         (containsInterfaceOrExceptionFromIDL):
2520         * bindings/scripts/test/JS/JSTestObj.cpp:
2521         (WebCore::jsTestObjPrototypeFunctionOperationWithExternalDictionaryParameter):
2522         (WebCore::jsTestObjPrototypeFunctionAttachShadowRoot): Deleted.
2523         * bindings/scripts/test/JS/JSTestStandaloneDictionary.cpp: Added.
2524         (WebCore::convertDictionary<TestStandaloneDictionary>):
2525         * bindings/scripts/test/JS/JSTestStandaloneDictionary.h: Added.
2526         * bindings/scripts/test/TestObj.idl:
2527         * bindings/scripts/test/TestStandaloneDictionary.idl: Added.
2528         * dom/Element.h:
2529         * dom/Element.idl:
2530         * html/HTMLBodyElement.cpp:
2531         (WebCore::HTMLBodyElement::scrollTo):
2532         * page/DOMWindow.h:
2533         * page/DOMWindow.idl:
2534         * page/ScrollToOptions.h: Added.
2535         * page/ScrollToOptions.idl: Added.
2536
2537 2016-10-06  Brent Fulgham  <bfulgham@apple.com>
2538
2539         Unreviewed build fix.
2540
2541         * platform/graphics/Image.cpp: Add missing include
2542         for 'NotImplemented' when building under Direct2D.
2543
2544 2016-10-06  Brent Fulgham  <bfulgham@apple.com>
2545
2546         [Win][Direct2D] Add Direct2D CMake rules
2547         https://bugs.webkit.org/show_bug.cgi?id=162925
2548
2549         Reviewed by Brent Fulgham.
2550
2551         Modify PlatformAppleWin.cmake to conditionally build the CoreGraphics
2552         and CoreAnimation implementation, or the Direct2D files, depending
2553         on whether the USE_DIRECT2D macro is set in the CMake build options.
2554         By default it builds the normal CA/CG way.
2555
2556         Add a stub GraphicsLayer implementation for Direct2D.
2557
2558         No new tests because there is no change in our active ports.
2559
2560         * PlatformAppleWin.cmake: Conditionalize the build for CA/CG or
2561         Direct2D.
2562         * config.h: Make sure CA is turned of for Direct2D builds.
2563         * page/win/FrameWinDirect2D.cpp: Add missing include file.
2564         * platform/graphics/win/GraphicsLayerDirect2D.cpp: Added.
2565         * platform/graphics/win/GraphicsLayerDirect2D.h: Added.
2566
2567 2016-10-06  Yusuke Suzuki  <utatane.tea@gmail.com>
2568
2569         [WebCore][JSC] Use new @throwTypeError and @throwRangeError intrinsics
2570         https://bugs.webkit.org/show_bug.cgi?id=163001
2571
2572         Reviewed by Keith Miller.
2573
2574         Replace `throw new @XXXError(...)` to @throwXXXError intrinsic.
2575         It reduces the size of bytecode sequence and facilitate inlining.
2576
2577         No behavior change.
2578
2579         * Modules/fetch/FetchHeaders.js:
2580         (initializeFetchHeaders):
2581         * Modules/fetch/FetchInternals.js:
2582         (fillFetchHeaders):
2583         * Modules/fetch/FetchRequest.js:
2584         (initializeFetchRequest):
2585         * Modules/fetch/FetchResponse.js:
2586         (initializeFetchResponse):
2587         (clone):
2588         * Modules/mediastream/NavigatorUserMedia.js:
2589         (webkitGetUserMedia):
2590         * Modules/mediastream/RTCPeerConnection.js:
2591         (initializeRTCPeerConnection):
2592         (getLocalStreams):
2593         (getStreamById):
2594         (addStream):
2595         * Modules/streams/ReadableStream.js:
2596         (initializeReadableStream):
2597         (getReader):
2598         * Modules/streams/ReadableStreamDefaultController.js:
2599         (enqueue):
2600         (error):
2601         (close):
2602         * Modules/streams/ReadableStreamDefaultReader.js:
2603         (releaseLock):
2604         * Modules/streams/ReadableStreamInternals.js:
2605         (privateInitializeReadableStreamDefaultReader):
2606         (privateInitializeReadableStreamDefaultController):
2607         (doStructuredClone):
2608         (readableStreamError):
2609         * Modules/streams/StreamInternals.js:
2610         (validateAndNormalizeQueuingStrategy):
2611         (enqueueValueWithSize):
2612         * Modules/streams/WritableStream.js:
2613         (initializeWritableStream):
2614         (state):
2615         * xml/XMLHttpRequest.js:
2616         (response):
2617
2618 2016-10-06  John Wilander  <wilander@apple.com>
2619
2620         Update Resource Load Statistics
2621         https://bugs.webkit.org/show_bug.cgi?id=162811
2622
2623         Reviewed by Alex Christensen.
2624
2625         No new tests. The counting is based on top privately owned domains
2626         which currently is not supported by layout tests nor API tests.
2627
2628         * Modules/websockets/WebSocket.cpp:
2629         (WebCore::WebSocket::connect):
2630             Now captures statistics for web sockets too.
2631         * loader/FrameLoader.cpp:
2632         (WebCore::FrameLoader::loadResourceSynchronously):
2633         * loader/ResourceLoadObserver.cpp:
2634             Now captures statistics for synchronous XHR too.
2635         (WebCore::is3xxRedirect):
2636             Convenience function.
2637         (WebCore::ResourceLoadObserver::shouldLog):
2638             Convenience function.
2639         (WebCore::ResourceLoadObserver::logFrameNavigation):
2640             Updated to make use of new convenience functions.
2641         (WebCore::ResourceLoadObserver::logSubresourceLoading):
2642             Updated to make use of new convenience functions.
2643         (WebCore::ResourceLoadObserver::logWebSocketLoading):
2644             Added.
2645         (WebCore::ResourceLoadObserver::logUserInteraction):
2646             Updated to make use of new convenience functions.
2647         (WebCore::ResourceLoadObserver::primaryDomain):
2648             Now makes use of the Public Suffix list.
2649             Removed old custom parsing of primary domain.
2650         * loader/ResourceLoadObserver.h:
2651         * loader/ResourceLoadStatisticsStore.cpp:
2652         (WebCore::ResourceLoadStatisticsStore::prevalentResourceDomainsWithoutUserInteraction):
2653             Convenience function.
2654         (WebCore::ResourceLoadStatisticsStore::processStatistics): Deleted.
2655         * loader/ResourceLoadStatisticsStore.h:
2656         * loader/SubresourceLoader.cpp:
2657         (WebCore::SubresourceLoader::willSendRequestInternal):
2658             Moved logging call higher up and added a check for whether we
2659             are loading the main resource. The reason for moving it up is
2660             to capture the request before some data may be cleared out in
2661             redirect handling. We also want to capture failed CORS requests
2662             since they are sent and then cancelled on the way back.
2663
2664 2016-10-06  Adam Bergkvist  <adam.bergkvist@ericsson.com>
2665
2666         WebRTC: Add support for the iceconnectionstatechange event in MediaEndpointPeerConnection
2667         https://bugs.webkit.org/show_bug.cgi?id=162961
2668
2669         Reviewed by Eric Carlson.
2670
2671         Implement MediaEndpointPeerConnection's iceTransportStateChanged callback. When called, it
2672         updates the ICE transport state of the corresponding transceiver and determines if the
2673         RTCPeerConnection's aggregated iceConnectionState needs to be updated.
2674
2675         Update MediaEndpointMock's emulatePlatformEvent feature to support a new action:
2676         "step-ice-transport-states". When initiated, this action replays a predefined set of ICE
2677         transport state changes on a set of transceivers which can be observed via the
2678         iceTransportStateChanged (mentioned above).
2679
2680         Test: fast/mediastream/RTCPeerConnection-iceconnectionstatechange-event.html
2681
2682         * Modules/mediastream/MediaEndpointPeerConnection.cpp:
2683         (WebCore::deriveAggregatedIceConnectionState):
2684         (WebCore::MediaEndpointPeerConnection::iceTransportStateChanged):
2685         * Modules/mediastream/MediaEndpointPeerConnection.h:
2686         * platform/mediastream/MediaEndpoint.h:
2687         (WebCore::MediaEndpointClient::~MediaEndpointClient):
2688         * platform/mock/MockMediaEndpoint.cpp:
2689         (WebCore::MockMediaEndpoint::MockMediaEndpoint):
2690         (WebCore::MockMediaEndpoint::emulatePlatformEvent):
2691         (WebCore::MockMediaEndpoint::stepIceTransportStates):
2692         (WebCore::MockMediaEndpoint::iceTransportTimerFired):
2693         * platform/mock/MockMediaEndpoint.h:
2694
2695 2016-10-06  Youenn Fablet  <youenn@apple.com>
2696
2697         CachedResource client handling methods should take reference
2698         https://bugs.webkit.org/show_bug.cgi?id=163014
2699
2700         Reviewed by Alex Christensen.
2701
2702         No change of behavior.
2703
2704         * bindings/js/CachedScriptSourceProvider.h:
2705         (WebCore::CachedScriptSourceProvider::~CachedScriptSourceProvider):
2706         (WebCore::CachedScriptSourceProvider::CachedScriptSourceProvider):
2707         * css/CSSCrossfadeValue.cpp:
2708         (WebCore::CSSCrossfadeValue::~CSSCrossfadeValue):
2709         (WebCore::CSSCrossfadeValue::loadSubimages):
2710         * css/CSSFilterImageValue.cpp:
2711         (WebCore::CSSFilterImageValue::~CSSFilterImageValue):
2712         (WebCore::CSSFilterImageValue::loadSubimages):
2713         * css/CSSFontFaceSource.cpp:
2714         (WebCore::CSSFontFaceSource::CSSFontFaceSource):
2715         (WebCore::CSSFontFaceSource::~CSSFontFaceSource):
2716         * css/StyleRuleImport.cpp:
2717         (WebCore::StyleRuleImport::~StyleRuleImport):
2718         (WebCore::StyleRuleImport::requestStyleSheet):
2719         * dom/DataTransfer.cpp:
2720         (WebCore::DragImageLoader::startLoading):
2721         (WebCore::DragImageLoader::stopLoading):
2722         * dom/LoadableClassicScript.cpp:
2723         (WebCore::LoadableClassicScript::create):
2724         (WebCore::LoadableClassicScript::~LoadableClassicScript):
2725         * dom/ProcessingInstruction.cpp:
2726         (WebCore::ProcessingInstruction::~ProcessingInstruction):
2727         (WebCore::ProcessingInstruction::checkStyleSheet):
2728         (WebCore::ProcessingInstruction::parseStyleSheet):
2729         * html/HTMLLinkElement.cpp:
2730         (WebCore::HTMLLinkElement::~HTMLLinkElement):
2731         (WebCore::HTMLLinkElement::process):
2732         * loader/CrossOriginPreflightChecker.cpp:
2733         (WebCore::CrossOriginPreflightChecker::~CrossOriginPreflightChecker):
2734         (WebCore::CrossOriginPreflightChecker::startPreflight):
2735         * loader/DocumentLoader.cpp:
2736         (WebCore::DocumentLoader::detachFromFrame):
2737         (WebCore::DocumentLoader::clearMainResource):
2738         (WebCore::DocumentLoader::becomeMainResourceClient):
2739         * loader/DocumentThreadableLoader.cpp:
2740         (WebCore::DocumentThreadableLoader::~DocumentThreadableLoader):
2741         (WebCore::DocumentThreadableLoader::clearResource):
2742         (WebCore::DocumentThreadableLoader::loadRequest):
2743         * loader/ImageLoader.cpp:
2744         (WebCore::ImageLoader::~ImageLoader):
2745         (WebCore::ImageLoader::clearImageWithoutConsideringPendingLoadEvent):
2746         (WebCore::ImageLoader::updateFromElement):
2747         (WebCore::ImageLoader::dispatchPendingBeforeLoadEvent):
2748         * loader/LinkLoader.cpp:
2749         (WebCore::LinkLoader::~LinkLoader):
2750         (WebCore::LinkLoader::notifyFinished):
2751         (WebCore::LinkLoader::loadLink):
2752         * loader/LinkPreloadResourceClients.h:
2753         (WebCore::LinkPreloadResourceClient::addResource):
2754         (WebCore::LinkPreloadResourceClient::clearResource):
2755         * loader/MediaResourceLoader.cpp:
2756         (WebCore::MediaResource::MediaResource):
2757         (WebCore::MediaResource::stop):
2758         * loader/TextTrackLoader.cpp:
2759         (WebCore::TextTrackLoader::~TextTrackLoader):
2760         (WebCore::TextTrackLoader::cancelLoad):
2761         (WebCore::TextTrackLoader::load):
2762         * loader/cache/CachedCSSStyleSheet.cpp:
2763         (WebCore::CachedCSSStyleSheet::didAddClient):
2764         * loader/cache/CachedCSSStyleSheet.h:
2765         * loader/cache/CachedFont.cpp:
2766         (WebCore::CachedFont::didAddClient):
2767         * loader/cache/CachedFont.h:
2768         * loader/cache/CachedImage.cpp:
2769         (WebCore::CachedImage::didAddClient):
2770         (WebCore::CachedImage::didRemoveClient):
2771         * loader/cache/CachedImage.h:
2772         * loader/cache/CachedRawResource.cpp:
2773         (WebCore::CachedRawResource::didAddClient):
2774         * loader/cache/CachedRawResource.h:
2775         * loader/cache/CachedResource.cpp:
2776         (WebCore::CachedResource::addClient):
2777         (WebCore::CachedResource::didAddClient):
2778         (WebCore::CachedResource::addClientToSet):
2779         (WebCore::CachedResource::removeClient):
2780         (WebCore::CachedResource::switchClientsToRevalidatedResource):
2781         (WebCore::CachedResource::Callback::timerFired):
2782         * loader/cache/CachedResource.h:
2783         (WebCore::CachedResource::hasClient):
2784         (WebCore::CachedResource::didRemoveClient):
2785         * loader/cache/CachedSVGDocumentReference.cpp:
2786         (WebCore::CachedSVGDocumentReference::~CachedSVGDocumentReference):
2787         (WebCore::CachedSVGDocumentReference::load):
2788         * loader/cache/CachedXSLStyleSheet.cpp:
2789         (WebCore::CachedXSLStyleSheet::didAddClient):
2790         * loader/cache/CachedXSLStyleSheet.h:
2791         * loader/cache/MemoryCache.cpp:
2792         (WebCore::MemoryCache::addImageToCache):
2793         (WebCore::MemoryCache::removeImageFromCache):
2794         * loader/icon/IconLoader.cpp:
2795         (WebCore::IconLoader::startLoading):
2796         (WebCore::IconLoader::stopLoading):
2797         * platform/graphics/avfoundation/cf/WebCoreAVCFResourceLoader.cpp:
2798         (WebCore::WebCoreAVCFResourceLoader::startLoading):
2799         (WebCore::WebCoreAVCFResourceLoader::stopLoading):
2800         * platform/graphics/avfoundation/objc/WebCoreAVFResourceLoader.mm:
2801         (WebCore::WebCoreAVFResourceLoader::startLoading):
2802         (WebCore::WebCoreAVFResourceLoader::stopLoading):
2803         * rendering/RenderImageResource.cpp:
2804         (WebCore::RenderImageResource::shutdown):
2805         (WebCore::RenderImageResource::setCachedImage):
2806         * rendering/RenderLayerFilterInfo.cpp:
2807         (WebCore::RenderLayer::FilterInfo::updateReferenceFilterClients):
2808         (WebCore::RenderLayer::FilterInfo::removeReferenceFilterClients):
2809         * rendering/style/StyleCachedImage.cpp:
2810         (WebCore::StyleCachedImage::addClient):
2811         (WebCore::StyleCachedImage::removeClient):
2812         * svg/SVGFEImageElement.cpp:
2813         (WebCore::SVGFEImageElement::clearResourceReferences):
2814         (WebCore::SVGFEImageElement::requestImageResource):
2815         * svg/SVGFontFaceUriElement.cpp:
2816         (WebCore::SVGFontFaceUriElement::~SVGFontFaceUriElement):
2817         (WebCore::SVGFontFaceUriElement::loadFont):
2818         * svg/SVGUseElement.cpp:
2819         (WebCore::SVGUseElement::~SVGUseElement):
2820         (WebCore::SVGUseElement::updateExternalDocument):
2821         * xml/XSLImportRule.cpp:
2822         (WebCore::XSLImportRule::~XSLImportRule):
2823         (WebCore::XSLImportRule::setXSLStyleSheet):
2824         (WebCore::XSLImportRule::loadSheet):
2825         * xml/parser/XMLDocumentParser.cpp:
2826         (WebCore::XMLDocumentParser::notifyFinished):
2827         * xml/parser/XMLDocumentParserLibxml2.cpp:
2828         (WebCore::XMLDocumentParser::~XMLDocumentParser):
2829         (WebCore::XMLDocumentParser::endElementNs):
2830
2831 2016-10-05  Philippe Normand  <pnormand@igalia.com>
2832
2833         [GStreamer][OWR] GL rendering support
2834         https://bugs.webkit.org/show_bug.cgi?id=162972
2835
2836         Reviewed by Žan Doberšek.
2837
2838         When GStreamer-GL is enabled the GL context needs to be properly passed
2839         to the GStreamer pipeline running within the OpenWebRTC video renderer.
2840         This is now supported using a new OpenWebRTC API that allows the
2841         renderer to request the context from the application using a callback
2842         registered within the renderer.
2843
2844         The player's GL context/display set-up was refactored to a new
2845         method, requestGLContext, which is used as callback for the
2846         OpenWebRTC request_context handler.
2847
2848         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp:
2849         (WebCore::MediaPlayerPrivateGStreamerBase::handleSyncMessage):
2850         (WebCore::MediaPlayerPrivateGStreamerBase::requestGLContext):
2851         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.h:
2852         (WebCore::MediaPlayerPrivateGStreamerBase::gstGLContext):
2853         (WebCore::MediaPlayerPrivateGStreamerBase::gstGLDisplay):
2854         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerOwr.cpp:
2855         (WebCore::MediaPlayerPrivateGStreamerOwr::createVideoSink):
2856
2857 2016-10-06  Antoine Quint  <graouts@apple.com>
2858
2859         [Modern Media Controls] Icon service and the IconButton class
2860         https://bugs.webkit.org/show_bug.cgi?id=162970
2861         <rdar://problem/28631803>
2862
2863         Reviewed by Dean Jackson.
2864
2865         We introduce the new IconButton class to display buttons that show an icon
2866         in modern media controls. An IconButton uses a CSS mask-image to display the icon
2867         such that we may set the actual button color to any value by setting the element's
2868         background-color property.
2869
2870         Icons are obtained through the `iconService` singleton which knows how to load the
2871         right icon for the current layout traits and resolution. Icons loaded through the
2872         icon service are cached. In a later patch, we will be introducing functionality,
2873         through the MediaControlsHost, to load the icon from the WebCore bundle.
2874
2875         Tests: media/modern-media-controls/icon-button/icon-button-active-state.html
2876                media/modern-media-controls/icon-button/icon-button.html
2877                media/modern-media-controls/icon-service/icon-service.html
2878
2879         * Modules/modern-media-controls/controls/button.css:
2880         (button):
2881         * Modules/modern-media-controls/controls/icon-button.css: Copied from Source/WebCore/Modules/modern-media-controls/controls/button.css.
2882         (button.icon):
2883         (button.icon:active):
2884         * Modules/modern-media-controls/controls/icon-button.js: Added.
2885         (IconButton):
2886         (IconButton.prototype.get iconName):
2887         (IconButton.prototype.set iconName):
2888         (IconButton.prototype.handleEvent):
2889         (IconButton.prototype.layout):
2890         (IconButton.prototype._imageDidLoad):
2891         (IconButton.prototype._updateImage):
2892         * Modules/modern-media-controls/controls/icon-service.js: Copied from Source/WebCore/Modules/modern-media-controls/controls/layout-item.js.
2893         (const.iconService.new.IconService):
2894         (const.iconService.new.IconService.prototype.imageForIconNameAndLayoutTraits):
2895         (const.iconService.new.IconService.prototype.urlForIconNameAndLayoutTraits):
2896         * Modules/modern-media-controls/controls/layout-item.js:
2897         * Modules/modern-media-controls/images/iOS/pause@2x.png: Added.
2898         * Modules/modern-media-controls/images/iOS/pause@3x.png: Added.
2899         * Modules/modern-media-controls/images/iOS/start@2x.png: Added.
2900         * Modules/modern-media-controls/images/iOS/start@3x.png: Added.
2901         * Modules/modern-media-controls/images/macOS/pause-fullscreen@1x.png: Added.
2902         * Modules/modern-media-controls/images/macOS/pause-fullscreen@2x.png: Added.
2903         * Modules/modern-media-controls/images/macOS/pause@1x.png: Added.
2904         * Modules/modern-media-controls/images/macOS/pause@2x.png: Added.
2905         * Modules/modern-media-controls/images/macOS/start@1x.png: Added.
2906         * Modules/modern-media-controls/images/macOS/start@2x.png: Added.
2907
2908 2016-10-06  Miguel Gomez  <magomez@igalia.com>
2909
2910         [GTK] Fix build with GSTREAMER_GL enabled and ACCELERATED_2D_CANVAS disabled
2911         https://bugs.webkit.org/show_bug.cgi?id=163008
2912
2913         Reviewed by Carlos Garcia Campos.
2914
2915         Put functions using cairo-gl behind appropriate guards.
2916
2917         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp:
2918         (WebCore::MediaPlayerPrivateGStreamerBase::paintToCairoSurface): Deleted.
2919         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.h:
2920
2921 2016-10-06  Miguel Gomez  <magomez@igalia.com>
2922
2923         [GTK] Copying video textures to webgl should not depend on cairo-gl
2924         https://bugs.webkit.org/show_bug.cgi?id=162904
2925
2926         Reviewed by Žan Doberšek.
2927
2928         Perform the texture copy without using cairo-gl.
2929
2930         Covered by existent tests.
2931
2932         * platform/GStreamer.cmake:
2933         Add the new VideoTextureCopierGStreamer class to the build.
2934         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp:
2935         (WebCore::MediaPlayerPrivateGStreamerBase::copyVideoTextureToPlatformTexture):
2936         Use VideoTextureCopierGStreamer to perform the copy.
2937         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.h:
2938         Add a VideoTextureCopierGStreamer as a class attribute.
2939         * platform/graphics/gstreamer/VideoTextureCopierGStreamer.cpp: Added.
2940         (WebCore::VideoTextureCopierGStreamer::VideoTextureCopierGStreamer):
2941         (WebCore::VideoTextureCopierGStreamer::~VideoTextureCopierGStreamer):
2942         (WebCore::VideoTextureCopierGStreamer::updateTextureSpaceMatrix):
2943         Recalculates the matrix used as the texture coordinates transformation.
2944         (WebCore::VideoTextureCopierGStreamer::updateTransformationMatrix):
2945         Recalculates the matrices used as the vertices coordinates transformation.
2946         (WebCore::VideoTextureCopierGStreamer::copyVideoTextureToPlatformTexture):
2947         Performs the texture copy by using a shader that applies the rotation needed to follow
2948         the video orientation.
2949         * platform/graphics/gstreamer/VideoTextureCopierGStreamer.h: Added.
2950
2951 2016-10-06  Gwang Yoon Hwang  <yoon@igalia.com>
2952
2953         [GTK] Build fix for X11 and GStreamerGL after r183731
2954         https://bugs.webkit.org/show_bug.cgi?id=163000
2955
2956         Reviewed by Philippe Normand.
2957
2958         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp:
2959         Include gstgldisplay_egl.h if platform uses EGL.
2960
2961 2016-10-06  Mario Sanchez Prada  <mario@endlessm.com>
2962
2963         [GStreamer] Can't play any video with GSTREAMER_GL enabled
2964         https://bugs.webkit.org/show_bug.cgi?id=162669
2965
2966         Reviewed by Philippe Normand.
2967
2968         Make sure an EGLDisplay type is passed when creating the GstGlDisplay
2969         for the EGL code path, instead of a native X11 display type, so
2970         that we get a valid GstGlDisplay as a result, not a dummy one.
2971
2972         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp:
2973         (WebCore::MediaPlayerPrivateGStreamerBase::ensureGstGLContext):
2974
2975 2016-10-06  Youenn Fablet  <youenn@apple.com>
2976
2977         [Fetch API] Forbid redirection to non-HTTP(s) URL in non-navigation mode.
2978         https://bugs.webkit.org/show_bug.cgi?id=162785
2979
2980         Reviewed by Alex Christensen.
2981
2982         Covered by rebased and existing tests.
2983
2984         Ensuring non-HTTP redirection URLs are not followed at DocumentThreadableLoader level for fetch API only.
2985         This should be applied to all clients at some point, but there is still some uncertainty for data URLs.
2986
2987         Did some refactoring to better separate the case of security checks in case of regular request or redirected request.
2988         This allows in particular to handle more clearly the case of data URLs which are allowed in all modes for regular requests.
2989         But they are not allowed for same-origin redirected requests.
2990
2991         * WebCore.xcodeproj/project.pbxproj:
2992         * loader/DocumentThreadableLoader.cpp:
2993         (WebCore::reportRedirectionWithBadScheme): Reporting bad scheme redirection error.
2994         (WebCore::DocumentThreadableLoader::redirectReceived): Checking that redirection URLs are HTTP(s) in case of Fetch API.
2995         * loader/SubresourceLoader.cpp:
2996         (WebCore::SubresourceLoader::willSendRequestInternal):
2997         * loader/cache/CachedResourceLoader.cpp:
2998         (WebCore::CachedResourceLoader::requestImage):
2999         (WebCore::CachedResourceLoader::checkInsecureContent):
3000         (WebCore::CachedResourceLoader::allowedByContentSecurityPolicy):
3001         (WebCore::isSameOriginDataURL):
3002         (WebCore::CachedResourceLoader::canRequest):
3003         (WebCore::CachedResourceLoader::canRequestAfterRedirection):
3004         (WebCore::CachedResourceLoader::canRequestInContentDispositionAttachmentSandbox):
3005         (WebCore::CachedResourceLoader::requestResource):
3006         * loader/cache/CachedResourceLoader.h:
3007
3008 2016-10-06  Youenn Fablet  <youenn@apple.com>
3009
3010         [Fetch API] Use ReadableStream pull to transfer binary data to stream when application needs it
3011         https://bugs.webkit.org/show_bug.cgi?id=162892
3012
3013         Reviewed by Alex Christensen.
3014
3015         Covered by existing tests.
3016
3017         Before this patch, FetchResponse was never resolving the start promise.
3018         This way, it could enqueue data, error or close the stream whenever desired.
3019
3020         With this patch, FetchResponse will feed the stream when being asked to.
3021         This allows keeping the data in WebCore until the application needs it.
3022         This is only implemented for network data.
3023         For other data owned by response (blob, text...), data will be enqueued like previously as fast as possible.
3024
3025         Note that FetchResponse can enqueue/error/close the stream at any time since JSFetchResponse has a reference to the stream.
3026         And the stream has a reference to the controller.
3027
3028         In addition to transfer binary chunks to ReadableStream only when needed, WebCore is now aware of the data
3029         stored in the response, which may allow applying backpressure to the network source in the future.
3030
3031         * Modules/fetch/FetchResponse.cpp:
3032         (WebCore::FetchResponse::BodyLoader::didSucceed):
3033         (WebCore::FetchResponse::BodyLoader::didReceiveData): Enqueuing only if stream is pulling.
3034         Otherwise, storing in FetchBodyConsumer. If stream is pulling, we enqueue both buffered data and received chunk.
3035         (WebCore::FetchResponse::consumeBodyAsStream): Resolving pull promise if we enqueued some buffered data.
3036         (WebCore::FetchResponse::closeStream):
3037         (WebCore::FetchResponse::feedStream): If we have some buffered data, we enqueue it. If there is no loader, the stream can be closed.
3038         * Modules/fetch/FetchResponse.h:
3039         * Modules/fetch/FetchResponseSource.cpp:
3040         (WebCore::FetchResponseSource::doPull):
3041         (WebCore::FetchResponseSource::close):
3042         (WebCore::FetchResponseSource::error):
3043         * Modules/fetch/FetchResponseSource.h:
3044         * Modules/streams/ReadableStreamSource.h:
3045         (WebCore::ReadableStreamSource::isPulling): Renamed from isStarting.
3046         (WebCore::ReadableStreamSource::isStarting): Deleted.
3047
3048 2016-10-06  Adam Bergkvist  <adam.bergkvist@ericsson.com>
3049
3050         WebRTC: Add support for the icecandidate event in MediaEndpointPeerConnection
3051         https://bugs.webkit.org/show_bug.cgi?id=162957
3052
3053         Reviewed by Eric Carlson.
3054
3055         Implement MediaEndpointPeerConnection's gotIceCandidate and doneGatheringCandidates
3056         callbacks. These are used by the MediaEndpoint (WebRTC backend implementation) to
3057         notify about ICE events.
3058
3059         Add API to Internals to emulate WebRTC platform events, such as dispatching a set of ICE
3060         candidates followed by a gathering done indication. Initially, only a single action,
3061         "dispatch-fake-ice-candidates", is supported, but the intention is to extend the set of
3062         actions to support more test cases.
3063
3064         Test: fast/mediastream/RTCPeerConnection-icecandidate-event.html
3065
3066         * Modules/mediastream/MediaEndpointPeerConnection.cpp:
3067         (WebCore::MediaEndpointPeerConnection::emulatePlatformEvent):
3068         (WebCore::MediaEndpointPeerConnection::gotIceCandidate):
3069         (WebCore::MediaEndpointPeerConnection::doneGatheringCandidates):
3070         * Modules/mediastream/MediaEndpointPeerConnection.h:
3071         * Modules/mediastream/PeerConnectionBackend.h:
3072         * Modules/mediastream/RTCIceTransport.h: Added.
3073         RTCIceCandidate will eventually be part of the JS API, but right now it's
3074         only used to keep track of the ICE states related to a RTCRtpTranscevier.
3075         (WebCore::RTCIceTransport::create):
3076         (WebCore::RTCIceTransport::~RTCIceTransport):
3077         (WebCore::RTCIceTransport::transportState):
3078         (WebCore::RTCIceTransport::setTransportState):
3079         (WebCore::RTCIceTransport::gatheringState):
3080         (WebCore::RTCIceTransport::setGatheringState):
3081         (WebCore::RTCIceTransport::RTCIceTransport):
3082         * Modules/mediastream/RTCPeerConnection.cpp:
3083         (WebCore::RTCPeerConnection::emulatePlatformEvent):
3084         * Modules/mediastream/RTCPeerConnection.h:
3085         * Modules/mediastream/RTCRtpTransceiver.cpp:
3086         (WebCore::RTCRtpTransceiver::RTCRtpTransceiver):
3087         * Modules/mediastream/RTCRtpTransceiver.h:
3088         (WebCore::RTCRtpTransceiver::iceTransport):
3089         * WebCore.xcodeproj/project.pbxproj:
3090         * platform/mediastream/MediaEndpoint.h:
3091         (WebCore::MediaEndpoint::emulatePlatformEvent):
3092         * platform/mediastream/PeerConnectionStates.h:
3093         * platform/mock/MockMediaEndpoint.cpp:
3094         (WebCore::MockMediaEndpoint::MockMediaEndpoint):
3095         (WebCore::MockMediaEndpoint::updateReceiveConfiguration):
3096         (WebCore::MockMediaEndpoint::emulatePlatformEvent):
3097         (WebCore::MockMediaEndpoint::dispatchFakeIceCandidates):
3098         (WebCore::MockMediaEndpoint::iceCandidateTimerFired):
3099         * platform/mock/MockMediaEndpoint.h:
3100         * testing/Internals.cpp:
3101         (WebCore::Internals::emulateRTCPeerConnectionPlatformEvent):
3102         Generic API to signal down to the WebRTC platform mock.
3103         * testing/Internals.h:
3104         * testing/Internals.idl:
3105
3106 2016-10-06  Nan Wang  <n_wang@apple.com>
3107
3108         AX:[Mac] Unable to edit text input, textarea fields in iframe using VO naivgation
3109         https://bugs.webkit.org/show_bug.cgi?id=162999
3110
3111         Reviewed by Chris Fleizach.
3112
3113         In WebKit1, the top web area setting the selection to an input element inside an iframe
3114         will make the input field not editable. The issue is that when the web area and the input element
3115         have different documents, the setSelection function in FrameSelection will set the selection on
3116         the input's frame and cause the caret to disappear. I fixed it by not setting the selection in such case.
3117
3118         Test: accessibility/mac/wk1-set-selected-text-marker-range-input-element.html
3119
3120         * accessibility/AccessibilityRenderObject.cpp:
3121         (WebCore::AccessibilityRenderObject::setSelectedVisiblePositionRange):
3122
3123 2016-10-05  Commit Queue  <commit-queue@webkit.org>
3124
3125         Unreviewed, rolling out r206845.
3126         https://bugs.webkit.org/show_bug.cgi?id=162998
3127
3128         broke el capitan build (Requested by alexchristensen on
3129         #webkit).
3130
3131         Reverted changeset:
3132
3133         "Add Display P3 ColorSpace"
3134         https://bugs.webkit.org/show_bug.cgi?id=162880
3135         http://trac.webkit.org/changeset/206845
3136
3137 2016-10-05  Youenn Fablet  <youenn@apple.com>
3138
3139         Reuse CodeGenerator::UpdateFile in Tools CodeGenerator
3140         https://bugs.webkit.org/show_bug.cgi?id=162960
3141
3142         Reviewed by Alex Christensen.
3143
3144         No change of behavior.
3145
3146         * bindings/scripts/CodeGenerator.pm:
3147         (UpdateFile): Adding FIXME to enable lazy writing when feasible.
3148
3149 2016-10-05  Michael Catanzaro  <mcatanzaro@igalia.com>
3150
3151         [SOUP] HostTLSCertificateSet should not use SHA-1 hashes to compare certificates
3152         https://bugs.webkit.org/show_bug.cgi?id=162965
3153
3154         Reviewed by Carlos Garcia Campos.
3155
3156         Use SHA-256 instead.
3157
3158         No new tests, covered by TestSSL.
3159
3160         * platform/network/soup/SoupNetworkSession.cpp:
3161         (WebCore::HostTLSCertificateSet::computeCertificateHash):
3162
3163 2016-10-05  Michael Catanzaro  <mcatanzaro@igalia.com>
3164
3165         [GTK] Bump Chrome version in Chrome user agent quirk
3166         https://bugs.webkit.org/show_bug.cgi?id=162984
3167
3168         Reviewed by Carlos Garcia Campos.
3169
3170         * platform/gtk/UserAgentGtk.cpp:
3171         (WebCore::buildUserAgentString):
3172
3173 2016-10-05  Dean Jackson  <dino@apple.com>
3174
3175         Add Display P3 ColorSpace
3176         https://bugs.webkit.org/show_bug.cgi?id=162880
3177         <rdar://problem/28598564>
3178
3179         Reviewed by Sam Weinig.
3180
3181         Add a new ColorSpace for Display P3.
3182
3183         This will be tested once the Color class can create
3184         objects that reference other color spaces.
3185
3186         * platform/graphics/ColorSpace.h:
3187         * platform/graphics/cg/GraphicsContextCG.cpp:
3188         (WebCore::displayP3ColorSpaceRef):
3189         * platform/graphics/cg/GraphicsContextCG.h:
3190         (WebCore::cachedCGColorSpace):
3191
3192 2016-10-05  Wenson Hsieh  <wenson_hsieh@apple.com>
3193
3194         Introduce InputEvent bindings in preparation for the input events spec
3195         https://bugs.webkit.org/show_bug.cgi?id=162954
3196
3197         Reviewed by Ryosuke Niwa.
3198
3199         Creates new bindings for InputEvent. Also introduces a runtime switch that allows Node to dispatch InputEvents
3200         rather than generic events of type 'input'. Adds a new test verifying that when the switch is enabled, inputs
3201         and contenteditable divs fire these new InputEvents on input. So far, only inputType is a part of the object
3202         prototype, since we will be implementing this first. getTargetRanges() will follow once the finer details of
3203         StaticRange are hashed out. See https://bugs.webkit.org/show_bug.cgi?id=162947 for more details.
3204
3205         Tests: fast/events/input-events-fired-when-typing.html
3206                fast/events/ios/input-events-fired-when-typing-in-contenteditable.html
3207
3208         * CMakeLists.txt:
3209         * DerivedSources.cpp:
3210         * DerivedSources.make:
3211         * WebCore.xcodeproj/project.pbxproj:
3212         * dom/DOMAllInOne.cpp:
3213         * dom/Event.cpp:
3214         (WebCore::Event::composed):
3215         (WebCore::Event::isInputEvent):
3216         * dom/Event.h:
3217         * dom/EventNames.in:
3218         * dom/InputEvent.cpp: Added.
3219         (WebCore::InputEvent::InputEvent):
3220         * dom/InputEvent.h: Added.
3221         * dom/InputEvent.idl: Added.
3222         * dom/Node.cpp:
3223         (WebCore::Node::dispatchInputEvent):
3224         (WebCore::Node::defaultEventHandler):
3225         * dom/Node.h:
3226         * editing/Editor.cpp:
3227         (WebCore::Editor::setBaseWritingDirection):
3228         * html/HTMLFormControlElement.cpp:
3229         (WebCore::HTMLFormControlElement::dispatchFormControlInputEvent):
3230         * html/HTMLInputElement.cpp:
3231         (WebCore::HTMLInputElement::setEditingValue):
3232         (WebCore::HTMLInputElement::setValueFromRenderer):
3233         * html/HTMLSelectElement.cpp:
3234         (WebCore::HTMLSelectElement::listBoxOnChange):
3235         (WebCore::HTMLSelectElement::dispatchChangeEventForMenuList):
3236         * html/shadow/MediaControlElements.cpp:
3237         (WebCore::MediaControlTimelineElement::defaultEventHandler):
3238         * page/Settings.in:
3239         * testing/InternalSettings.cpp:
3240         (WebCore::InternalSettings::Backup::Backup):
3241         (WebCore::InternalSettings::Backup::restoreTo):
3242         * testing/InternalSettings.h:
3243         * testing/InternalSettings.idl:
3244
3245 2016-10-05  Alex Christensen  <achristensen@webkit.org>
3246
3247         URLParser should parse IPv4 addresses as the last two pieces of an IPv6 address
3248         https://bugs.webkit.org/show_bug.cgi?id=162991
3249
3250         Reviewed by Saam Barati.
3251
3252         The last 32 bits of an IPv6 address can be written in the form of an IPv4 address,
3253         but the syntax is stricter than if it were just an IPv4 address.  There must be 4 pieces,
3254         and each piece must be decimal (no octal or hex allowed).  These should serialize to
3255         regular hex IPv6 addresses.
3256
3257         Covered by new API tests.
3258
3259         * platform/URLParser.cpp:
3260         (WebCore::URLParser::parseIPv4Piece):
3261         (WebCore::URLParser::parseIPv4Host):
3262         (WebCore::URLParser::parseIPv4PieceInsideIPv6):
3263         (WebCore::URLParser::parseIPv4AddressInsideIPv6):
3264         (WebCore::URLParser::parseIPv6Host):
3265         (WebCore::URLParser::parseIPv4Number): Deleted.
3266         * platform/URLParser.h:
3267
3268 2016-10-05  Myles C. Maxfield  <mmaxfield@apple.com>
3269
3270         Put variation fonts work behind a compile-time flag
3271         https://bugs.webkit.org/show_bug.cgi?id=162949
3272
3273         Reviewed by Simon Fraser.
3274
3275         No new tests because there is no behavior change.
3276
3277         * Configurations/FeatureDefines.xcconfig:
3278         * css/CSSComputedStyleDeclaration.cpp:
3279         (WebCore::ComputedStyleExtractor::propertyValue):
3280         * css/CSSFontVariationValue.cpp:
3281         * css/CSSFontVariationValue.h:
3282         * css/CSSPropertyNames.in:
3283         * css/CSSValue.cpp:
3284         (WebCore::CSSValue::equals):
3285         (WebCore::CSSValue::cssText):
3286         (WebCore::CSSValue::destroy):
3287         * css/CSSValue.h:
3288         (WebCore::CSSValue::isFontFeatureValue): Deleted.
3289         (WebCore::CSSValue::isFontVariationValue): Deleted.
3290         * css/StyleBuilderConverter.h:
3291         (WebCore::StyleBuilderConverter::convertFontVariationSettings): Deleted.
3292         * css/StyleBuilderCustom.h:
3293         (WebCore::StyleBuilderCustom::applyInheritFontFeatureSettings): Deleted.
3294         (WebCore::StyleBuilderCustom::applyInheritFontVariationSettings): Deleted.
3295         * css/parser/CSSParser.cpp:
3296         (WebCore::CSSParserContext::CSSParserContext):
3297         (WebCore::operator==):
3298         (WebCore::CSSParser::parseValue):
3299         (WebCore::CSSParser::parseFontVariationSettings): Deleted.
3300         * css/parser/CSSParserMode.h:
3301         * page/Settings.in:
3302         * page/animation/CSSPropertyAnimation.cpp:
3303         (WebCore::CSSPropertyAnimationWrapperMap::CSSPropertyAnimationWrapperMap):
3304         (WebCore::blendFunc): Deleted.
3305         * platform/graphics/FontCache.h:
3306         (WebCore::FontDescriptionKey::FontDescriptionKey):
3307         (WebCore::FontDescriptionKey::operator==):
3308         (WebCore::FontDescriptionKey::computeHash):
3309         * platform/graphics/FontDescription.cpp:
3310         * platform/graphics/FontDescription.h:
3311         (WebCore::FontDescription::operator==):
3312         (WebCore::FontDescription::setFeatureSettings): Deleted.
3313         (WebCore::FontDescription::setVariationSettings): Deleted.
3314         * platform/graphics/FontTaggedSettings.cpp:
3315         (WebCore::operator<<): Deleted.
3316         * platform/graphics/FontTaggedSettings.h:
3317         (WebCore::FontVariationSettings::isEmpty):
3318         * platform/graphics/cocoa/FontCacheCoreText.cpp:
3319         (WebCore::preparePlatformFont):
3320         * platform/graphics/cocoa/FontPlatformDataCocoa.mm:
3321         (WebCore::cascadeToLastResortAndVariationsFontDescriptor):
3322         * rendering/style/RenderStyle.cpp:
3323         (WebCore::RenderStyle::setFontVariationSettings): Deleted.
3324         * rendering/style/RenderStyle.h:
3325         (WebCore::RenderStyle::fontVariationSettings): Deleted.
3326         * testing/InternalSettings.cpp:
3327         (WebCore::InternalSettings::Backup::Backup):
3328         (WebCore::InternalSettings::Backup::restoreTo):
3329         (WebCore::InternalSettings::variationFontsEnabled):
3330         (WebCore::InternalSettings::setVariationFontsEnabled):
3331         * testing/InternalSettings.h:
3332
3333 2016-10-05  Brent Fulgham  <bfulgham@apple.com>
3334
3335         Unreviewed build fix after r206830
3336
3337         * platform/graphics/win/FontPlatformDataWin.cpp: Add missing include
3338         when building with Direct2D.
3339
3340 2016-10-05  Brent Fulgham  <bfulgham@apple.com>
3341
3342         [Win][Direct2D] Disable some CoreGraphics and CoreAnimation-based logic when building for D2D
3343         https://bugs.webkit.org/show_bug.cgi?id=162977
3344
3345         Reviewed by Alex Christensen.
3346
3347         Currently the Direct2D implementation does not support some of the accelerated compositing
3348         features that require CoreAnimation. During this bring-up, we want to disable these routines
3349         so that we can build and run in (mostly) unaccelerated drawing.
3350
3351         This patch mostly consists of adding "#if USE(CG)" and "#if USE(CA)" to files that are
3352         specific to those implementations.
3353
3354         This change should have no impact on non-Direct2D ports.
3355
3356         No change in behavior for active ports.
3357
3358         * config.h: Turn of CG when building in Direct2D.
3359         * css/CSSFontFaceSource.cpp:
3360         * loader/cache/CachedFont.cpp:
3361         * loader/cache/CachedSVGFont.cpp:
3362         * page/CaptionUserPreferencesMediaAF.cpp:
3363         * page/win/FrameCGWin.cpp:
3364         * page/win/FrameDirect2D.cpp: Added.
3365         * platform/graphics/Font.cpp:
3366         * platform/graphics/FontCache.cpp:
3367         * platform/graphics/FontPlatformData.cpp:
3368         * platform/graphics/GraphicsContext.h:
3369         * platform/graphics/Image.cpp:
3370         * platform/graphics/avfoundation/cf/CDMSessionAVFoundationCF.cpp:
3371         * platform/graphics/avfoundation/cf/MediaPlayerPrivateAVFoundationCF.cpp:
3372         * platform/graphics/ca/GraphicsLayerCA.cpp:
3373         * platform/graphics/ca/PlatformCALayer.cpp:
3374         * platform/graphics/ca/TileController.cpp:
3375         * platform/graphics/ca/TileGrid.cpp:
3376         * platform/graphics/ca/TileGrid.h:
3377         * platform/graphics/ca/win/CACFLayerTreeHost.cpp:
3378         * platform/graphics/ca/win/LayerChangesFlusher.cpp:
3379         * platform/graphics/ca/win/PlatformCAAnimationWin.cpp:
3380         * platform/graphics/ca/win/PlatformCAAnimationWin.h:
3381         * platform/graphics/ca/win/PlatformCAFiltersWin.cpp:
3382         * platform/graphics/ca/win/PlatformCALayerWin.cpp:
3383         * platform/graphics/ca/win/PlatformCALayerWinInternal.cpp:
3384         * platform/graphics/ca/win/WKCACFViewLayerTreeHost.cpp:
3385         * platform/graphics/ca/win/WebTiledBackingLayerWin.cpp:
3386         * platform/graphics/cg/GradientCG.cpp:
3387         * platform/graphics/cg/GraphicsContextCG.cpp:
3388         * platform/graphics/cg/ImageBufferCG.cpp:
3389         * platform/graphics/cg/ImageBufferDataCG.cpp:
3390         * platform/graphics/cg/PDFDocumentImage.cpp:
3391         * platform/graphics/cg/PatternCG.cpp:
3392         * platform/graphics/cg/SubimageCacheWithTimer.cpp:
3393         * platform/graphics/win/FontCGWin.cpp:
3394         * platform/graphics/win/FontPlatformDataCGWin.cpp:
3395         * platform/graphics/win/GlyphPageTreeNodeCGWin.cpp:
3396         * platform/graphics/win/GlyphPageTreeNodeDirect2D.cpp:
3397         * platform/graphics/win/GradientDirect2D.cpp:
3398         * platform/graphics/win/PathDirect2D.cpp: Fix a few build problems I didn't notice
3399         while building without Direct2D active.
3400         * platform/graphics/win/SimpleFontDataCGWin.cpp:
3401         * platform/graphics/win/SimpleFontDataWin.cpp:
3402         * platform/win/DragImageCGWin.cpp:
3403         * platform/win/DragImageDirect2D.cpp: Added.
3404         * rendering/RenderMediaControls.cpp:
3405
3406 2016-10-05  Chris Dumez  <cdumez@apple.com>
3407
3408         KeyboardEvent.getModifierState() should support "CapsLock" modifier
3409         https://bugs.webkit.org/show_bug.cgi?id=162861
3410
3411         Reviewed by Darin Adler.
3412
3413         Add support for "CapsLock" modifier on Mac / iOS for KeyboardEvent's
3414         getModifierState() API, as per:
3415         - https://w3c.github.io/uievents/#dom-keyboardevent-getmodifierstate
3416
3417         No new tests, updated existing test.
3418
3419         * dom/KeyboardEvent.cpp:
3420         (WebCore::KeyboardEvent::KeyboardEvent):
3421         (WebCore::KeyboardEvent::getModifierState):
3422         * dom/KeyboardEvent.h:
3423         * platform/PlatformEvent.h:
3424         * platform/ios/PlatformEventFactoryIOS.mm:
3425         (WebCore::modifiersForEvent):
3426         * platform/mac/PlatformEventFactoryMac.mm:
3427         (WebCore::keyIdentifierForKeyEvent):
3428
3429 2016-10-05  Michael Catanzaro  <mcatanzaro@igalia.com>
3430
3431         [GTK] Improve OS X UA quirk
3432         https://bugs.webkit.org/show_bug.cgi?id=162613
3433
3434         Reviewed by Carlos Garcia Campos.
3435
3436         Include OS X version number in user agent, like Safari does.
3437
3438         * platform/gtk/UserAgentGtk.cpp:
3439         (WebCore::buildUserAgentString):
3440
3441 2016-10-05  Michael Catanzaro  <mcatanzaro@igalia.com>
3442
3443         [GTK] Improve comment in platformVersionForUAString
3444         https://bugs.webkit.org/show_bug.cgi?id=162612
3445
3446         Reviewed by Carlos Garcia Campos.
3447
3448         * platform/gtk/UserAgentGtk.cpp:
3449         (WebCore::platformVersionForUAString):
3450
3451 2016-10-05  Zalan Bujtas  <zalan@apple.com>
3452
3453         Missing quotation mark when <q> gets reparented.
3454         https://bugs.webkit.org/show_bug.cgi?id=162940
3455
3456         Reviewed by Darin Adler.
3457
3458         When an opening RenderQuote gets removed due to some change in the render tree,
3459         we notify the closing RenderQuote so that it can update its content (") accordingly (and vice versa).
3460         However when the same RenderQuote is added back to the render tree (aka reparenting), we fail to
3461         let the other RenderQuote know about it and its content becomes stale.  
3462         This patch ensures that when either the opening or closing part of the quotation mark gets reparented,
3463         we inform the other, corresponding opening/closing renderer about it.
3464
3465         Test: fast/css-generated-content/missing-quotes-with-dynamic-content.html
3466
3467         * dom/PseudoElement.cpp:
3468         (WebCore::PseudoElement::didAttachRenderers):
3469         * rendering/RenderQuote.cpp:
3470         (WebCore::RenderQuote::insertedIntoTree):
3471         * rendering/RenderQuote.h:
3472
3473 2016-10-05  Alex Christensen  <achristensen@webkit.org>
3474
3475         URLParser should correctly strip unnecessary 0's in IPv6 addresses
3476         https://bugs.webkit.org/show_bug.cgi?id=162979
3477
3478         Reviewed by Brady Eidson.
3479
3480         Covered by new API tests.
3481
3482         * platform/URLParser.cpp:
3483         (WebCore::URLParser::parseIPv6Host):
3484         Strip leading 0's and any 0's before the last 0 if the value is 0.
3485
3486 2016-10-05  Alex Christensen  <achristensen@webkit.org>
3487
3488         UTF-8 encode queries of nonspecial and websocket schemes
3489         https://bugs.webkit.org/show_bug.cgi?id=162956
3490
3491         Reviewed by Geoffrey Garen and Brady Eidson.
3492
3493         The URL spec says in the query state:
3494         'If url is not special or url's scheme is either "ws" or "wss", set encoding to UTF-8.'
3495         This should be determined as soon as we are done parsing the scheme.
3496         
3497         Covered by new API tests.
3498         This also fixes tests like fast/loader/javascript-url-encoding-2.html when URLParser is enabled.
3499
3500         * platform/URLParser.cpp:
3501         (WebCore::isValidSchemeCharacter):
3502         Renamed Scheme to ValidScheme so I can use Scheme as the name of an enum class in the same namespace.
3503         (WebCore::isSpecial):
3504         (WebCore::scheme):
3505         Separate functionality so we can have different behavior for different sets of
3506         ws and wss schemes, special, and non-special schemes.
3507         (WebCore::URLParser::copyURLPartsUntil):
3508         (WebCore::URLParser::parse):
3509         Set isUTF8Encoding to true when we finish parsing the scheme if the scheme is ws, wss, or non-special,
3510         according to spec.  This also matches existing behavior.  This way we will already know whether to go
3511         into UTF8Query or NonUTF8Query state when we see a '?'.
3512         (WebCore::isSpecialScheme): Deleted.
3513
3514 2016-10-05  Alex Christensen  <achristensen@webkit.org>
3515
3516         Prepare to enable URLParser
3517         https://bugs.webkit.org/show_bug.cgi?id=162974
3518
3519         Reviewed by Brady Eidson.
3520
3521         * platform/URL.cpp:
3522         (WebCore::URL::serialize):
3523         When we enable the URLParser, this attempt to make serialized URLs more spec compliant
3524         won't be needed any more.
3525
3526 2016-10-05  Brent Fulgham  <bfulgham@apple.com>
3527
3528         [Win][Direct2D] Add initial D2D Path and Gradient implementation
3529         https://bugs.webkit.org/show_bug.cgi?id=162923
3530
3531         Reviewed by Alex Christensen.
3532
3533         This patch lands a set of new files that implements initial Path
3534         and Gradient features on Windows using Direct2D.
3535
3536         No new tests until complete backend lands.
3537
3538         * platform/graphics/Gradient.h:
3539         * platform/graphics/Path.cpp:
3540         * platform/graphics/Path.h:
3541         * platform/graphics/win/GradientDirect2D.cpp: Added.
3542         * platform/graphics/win/PathDirect2D.cpp: Added.
3543
3544 2016-10-05  Romain Bellessort  <romain.bellessort@crf.canon.fr>
3545
3546         [Readable Streams API] Align function names with spec
3547         https://bugs.webkit.org/show_bug.cgi?id=162967
3548
3549         Reviewed by Darin Adler.
3550
3551         Align function names with spec. Behaviour was already in line with spec, but previous function names had
3552         sometimes been preserved to track the changes more easily. This led to some inconsistencies (for instance,
3553         enqueueInReadableStream was still used even though it works on a controller instead of a stream) and it
3554         also made it more difficult to compare spec and implementation.
3555
3556         No change in behaviour.
3557
3558         * Modules/fetch/FetchInternals.js:
3559         (consumeStream): Updated with new function names.
3560         * Modules/fetch/FetchResponse.js:
3561         (clone): Updated with new function names.
3562         * Modules/streams/ReadableStream.js:
3563         (tee): Updated with new function names.
3564         * Modules/streams/ReadableStreamDefaultController.js:
3565         (enqueue): Updated with new function names.
3566         (error): Updated with new function names.
3567         * Modules/streams/ReadableStreamDefaultReader.js:
3568         (read): Updated with new function names.
3569         * Modules/streams/ReadableStreamInternals.js:
3570         (privateInitializeReadableStreamDefaultController): Updated with new function names.
3571         (readableStreamDefaultControllerError): Updated with new function names.
3572         (readableStreamTee): Updated with new function names.
3573         (readableStreamTeePullFunction): Updated with new function names.
3574         (readableStreamTeeBranch2CancelFunction): Updated with new function names.
3575         (readableStreamError): Updated with new function names.
3576         (readableStreamCancel): Updated with new function names.
3577         (readableStreamDefaultControllerPull): Updated with new function names.
3578         (readableStreamDefaultControllerClose): Updated with new function names.
3579         (readableStreamClose): Updated with new function names.
3580         (readableStreamDefaultControllerEnqueue): Updated with new function names.
3581         (readableStreamDefaultReaderRead): Updated with new function names.
3582
3583 2016-10-05  Chris Dumez  <cdumez@apple.com>
3584
3585         [Bindings] Declare dictionary / enumeration template specializations in the header
3586         https://bugs.webkit.org/show_bug.cgi?id=162929
3587
3588         Reviewed by Darin Adler.
3589
3590         Declare dictionary / enumeration template specializations in the header
3591         so that:
3592         - They can be used from custom bindings code.
3593         - Dictionaries / enumerations can be used to their own IDL files to
3594           share them (Bug 162912).
3595
3596         No new tests, rebaselined bindings tests.
3597
3598         * WebCore.xcodeproj/project.pbxproj:
3599         * bindings/generic/IDLTypes.h:
3600         * bindings/js/JSDOMConvert.h:
3601         * bindings/scripts/CodeGeneratorJS.pm:
3602         (GenerateInterface):
3603         (GenerateEnumerationImplementationContent):
3604         (GenerateEnumerationHeaderContent):
3605         (GenerateDictionaryHeaderContent):
3606         (GenerateHeader):
3607         (GenerateCallbackHeader):
3608         (GenerateCallbackImplementation):
3609         (GenerateDefaultValue): Deleted.
3610         (GenerateDictionaryImplementationContent): Deleted.
3611         (GenerateParametersCheck): Deleted.
3612         * bindings/scripts/test/JS/JSTestObj.cpp:
3613         * bindings/scripts/test/JS/JSTestObj.h:
3614
3615 2016-10-05  Zan Dobersek  <zdobersek@igalia.com>
3616
3617         Rename ENABLE_ENCRYPTED_MEDIA_V2 to ENABLE_LEGACY_ENCRYPTED_MEDIA
3618         https://bugs.webkit.org/show_bug.cgi?id=162903
3619
3620         Reviewed by Alex Christensen.
3621
3622         Rename build guards for the remaining implementation of the legacy EME API
3623         to ENABLE_LEGACY_ENCRYPTED_MEDIA. This will allow for the future implementation
3624         of the near-finished API to be guarded with the simple ENABLE_ENCRYPTED_MEDIA guards.
3625
3626         No new tests -- no change in behavior.
3627
3628         * CMakeLists.txt:
3629         * Configurations/FeatureDefines.xcconfig:
3630         * DerivedSources.cpp:
3631         * DerivedSources.make:
3632         * Modules/encryptedmedia/CDM.cpp:
3633         * Modules/encryptedmedia/CDM.h:
3634         * Modules/encryptedmedia/CDMPrivate.h:
3635         * Modules/encryptedmedia/CDMPrivateClearKey.cpp:
3636         * Modules/encryptedmedia/CDMPrivateClearKey.h:
3637         * Modules/encryptedmedia/CDMPrivateMediaPlayer.cpp:
3638         * Modules/encryptedmedia/CDMPrivateMediaPlayer.h:
3639         * Modules/encryptedmedia/CDMSessionClearKey.cpp:
3640         * Modules/encryptedmedia/CDMSessionClearKey.h:
3641         * Modules/encryptedmedia/MediaKeyMessageEvent.cpp:
3642         * Modules/encryptedmedia/MediaKeyMessageEvent.h:
3643         * Modules/encryptedmedia/MediaKeyMessageEvent.idl:
3644         * Modules/encryptedmedia/MediaKeyNeededEvent.cpp:
3645         * Modules/encryptedmedia/MediaKeyNeededEvent.h:
3646         * Modules/encryptedmedia/MediaKeyNeededEvent.idl:
3647         * Modules/encryptedmedia/MediaKeySession.cpp:
3648         * Modules/encryptedmedia/MediaKeySession.h:
3649         * Modules/encryptedmedia/MediaKeySession.idl:
3650         * Modules/encryptedmedia/MediaKeys.cpp:
3651         * Modules/encryptedmedia/MediaKeys.h:
3652         * Modules/encryptedmedia/MediaKeys.idl:
3653         * bindings/js/JSDictionary.cpp:
3654         * bindings/js/JSDictionary.h:
3655         * dom/Element.idl:
3656         * dom/EventNames.in:
3657         * dom/EventTargetFactory.in:
3658         * html/HTMLMediaElement.cpp:
3659         (WebCore::HTMLMediaElement::~HTMLMediaElement):
3660         (WebCore::HTMLMediaElement::webkitGenerateKeyRequest):
3661         (WebCore::HTMLMediaElement::webkitAddKey):
3662         * html/HTMLMediaElement.h:
3663         * html/HTMLMediaElement.idl:
3664         * html/MediaError.h:
3665         * html/MediaError.idl:
3666         * html/MediaKeyError.h:
3667         * html/MediaKeyError.idl:
3668         * page/Settings.h:
3669         * platform/graphics/CDMSession.h:
3670         * platform/graphics/MediaPlayer.cpp:
3671         * platform/graphics/MediaPlayer.h:
3672         * platform/graphics/MediaPlayerPrivate.h:
3673         * platform/graphics/avfoundation/CDMPrivateMediaSourceAVFObjC.h:
3674         * platform/graphics/avfoundation/CDMPrivateMediaSourceAVFObjC.mm:
3675         * platform/graphics/avfoundation/MediaPlayerPrivateAVFoundation.cpp:
3676         * platform/graphics/avfoundation/MediaPlayerPrivateAVFoundation.h:
3677         * platform/graphics/avfoundation/cf/CDMSessionAVFoundationCF.cpp:
3678         * platform/graphics/avfoundation/cf/CDMSessionAVFoundationCF.h:
3679         * platform/graphics/avfoundation/cf/MediaPlayerPrivateAVFoundationCF.cpp:
3680         (WebCore::MediaPlayerPrivateAVFoundationCF::supportsKeySystem):
3681         (WebCore::AVFWrapper::shouldWaitForLoadingOfResource):
3682         * platform/graphics/avfoundation/cf/MediaPlayerPrivateAVFoundationCF.h:
3683         * platform/graphics/avfoundation/objc/CDMSessionAVContentKeySession.h:
3684         * platform/graphics/avfoundation/objc/CDMSessionAVContentKeySession.mm:
3685         * platform/graphics/avfoundation/objc/CDMSessionAVFoundationObjC.h:
3686         * platform/graphics/avfoundation/objc/CDMSessionAVFoundationObjC.mm:
3687         * platform/graphics/avfoundation/objc/CDMSessionAVStreamSession.h:
3688         * platform/graphics/avfoundation/objc/CDMSessionAVStreamSession.mm:
3689         * platform/graphics/avfoundation/objc/CDMSessionMediaSourceAVFObjC.h:
3690         * platform/graphics/avfoundation/objc/CDMSessionMediaSourceAVFObjC.mm:
3691         * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.h:
3692         * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
3693         (WebCore::MediaPlayerPrivateAVFoundationObjC::supportsKeySystem):
3694         (WebCore::MediaPlayerPrivateAVFoundationObjC::shouldWaitForLoadingOfResource):
3695         (WebCore::playerKVOProperties):
3696         (-[WebCoreAVFMovieObserver observeValueForKeyPath:ofObject:change:context:]):
3697         * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.h:
3698         * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.mm:
3699         * platform/graphics/avfoundation/objc/MediaSourcePrivateAVFObjC.h:
3700         * platform/graphics/avfoundation/objc/MediaSourcePrivateAVFObjC.mm:
3701         * platform/graphics/avfoundation/objc/SourceBufferPrivateAVFObjC.mm:
3702         (WebCore::SourceBufferPrivateAVFObjC::willProvideContentKeyRequestInitializationDataForTrackID):
3703         (WebCore::SourceBufferPrivateAVFObjC::didProvideContentKeyRequestInitializationDataForTrackID):
3704         * testing/Internals.cpp:
3705         * testing/Internals.h:
3706         * testing/Internals.idl:
3707         * testing/MockCDM.cpp:
3708         * testing/MockCDM.h:
3709
3710 2016-10-05  Daniel Bates  <dabates@apple.com>
3711
3712         Do not follow redirects when sending violation report
3713         https://bugs.webkit.org/show_bug.cgi?id=162520
3714         <rdar://problem/27957639>
3715
3716         Reviewed by Alex Christensen.
3717
3718         Do not follow redirects when sending a Content Security Policy or XSS Auditor violation report
3719         as redirects can be used to forward report details to a third-party.
3720
3721         This changes makes WebKit more closely conform to the reporting requirements in section Reporting
3722         of the Content Security Level 2 standard: <https://w3c.github.io/webappsec-csp/2/#violation-reports>
3723         (Editor's Draft, 25 April 2016).
3724
3725         Tests: http/tests/security/contentSecurityPolicy/report-blocked-uri-and-do-not-follow-redirect-when-sending-report.php
3726                http/tests/security/xssAuditor/report-script-tag-and-do-not-follow-redirect-when-sending-report.html
3727                http/tests/security/xssAuditor/report-script-tag-full-block-and-do-not-follow-redirect-when-sending-report.html
3728
3729         * loader/LoaderStrategy.h: Modified createPingHandle() to take a boolean, shouldFollowRedirects,
3730         whether to follow redirect responses for a ping request.
3731         * loader/PingLoader.cpp:
3732         (WebCore::PingLoader::loadImage): Pass ShouldFollowRedirects::Yes to PingLoader::startPingLoad to
3733         keep our current behavior.
3734         (WebCore::PingLoader::sendPing): Ditto. Note our current behavior of following redirects matches
3735         the behavior described in the section "Hyperlink auditing" of the HTML standard:
3736         <https://html.spec.whatwg.org/multipage/semantics.html#hyperlink-auditing> (23 September 2016).
3737         (WebCore::PingLoader::sendViolationReport): Pass ShouldFollowRedirects::No to PingLoader::startPingLoad
3738         so that we do not follow redirects when sending a violation report.
3739         (WebCore::PingLoader::startPingLoad): Modified to take argument shouldFollowRedirects whether to
3740         follow redirect responses for a ping request.
3741         * loader/PingLoader.h:
3742         * platform/network/PingHandle.h: Add boolean m_shouldFollowRedirects. I grouped this boolean with
3743         the existing boolean, m_shouldUseCredentialStorage, as opposed to appending to the end of the class
3744         definition to avoid increasing object size as clang will coalesces the two bools into a single
3745         machine word. Override ResourceHandleClient::willSendRequest() and ResourceHandleClient::willSendRequestAsync()
3746         to follow a redirect, if applicable. 
3747
3748 2016-10-05  Carlos Garcia Campos  <cgarcia@igalia.com>
3749
3750         [SOUP] Move global TLS errors handling from ResourceHandle to SoupNetworkSession
3751         https://bugs.webkit.org/show_bug.cgi?id=162910
3752
3753         Reviewed by Alex Christensen.
3754
3755         So that it will be shared with network session code. Also remove setHostAllowsAnyHTTPSCertificate() that we have
3756         never actually used.
3757
3758         * platform/network/ResourceHandle.h:
3759         * platform/network/soup/ResourceHandleSoup.cpp:
3760         (WebCore::tlsErrorsChangedCallback): Use SoupNetworkSession::checkTLSErrors().
3761         * platform/network/soup/SoupNetworkSession.cpp:
3762         (WebCore::HostTLSCertificateSet::add):
3763         (WebCore::HostTLSCertificateSet::contains):
3764         (WebCore::HostTLSCertificateSet::computeCertificateHash):
3765         (WebCore::clientCertificates):
3766         (WebCore::SoupNetworkSession::setShouldIgnoreTLSErrors):
3767         (WebCore::SoupNetworkSession::checkTLSErrors):
3768         (WebCore::SoupNetworkSession::allowSpecificHTTPSCertificateForHost):
3769         * platform/network/soup/SoupNetworkSession.h:
3770
3771 2016-10-05  Carlos Garcia Campos  <cgarcia@igalia.com>
3772
3773         [SOUP] Move request HTTP body handling to ResourceRequestSoup and simplify it
3774         https://bugs.webkit.org/show_bug.cgi?id=162891
3775
3776         Reviewed by Michael Catanzaro.
3777
3778         We are currently adding the HTTP body to the message in ResourceHandleSoup, but we could do it as part of the
3779         ResourceRequest::updateSoupMessage() method, since the HTTP body is indeed part of the request. The code can be
3780         also simplified, especially the handling of files, by using SharedBuffer that already mmaps the file when
3781         possible, instead of using GMappedFile API.
3782
3783         * platform/SharedBuffer.h: Add createSoupBuffer() method.
3784         * platform/network/soup/ResourceHandleSoup.cpp:
3785         (WebCore::createSoupMessageForHandleAndRequest):
3786         (WebCore::milisecondsSinceRequest): Deleted.
3787         (WebCore::ResourceHandle::didStartRequest): Deleted.
3788         (WebCore::startingCallback): Deleted.
3789         (WebCore::networkEventCallback): Deleted.
3790         (WebCore::ResourceHandle::start): Deleted.
3791         (WebCore::ResourceHandle::releaseForDownload): Deleted.
3792         (WebCore::ResourceHandle::timeoutFired): Deleted.
3793         * platform/network/soup/ResourceRequest.h:
3794         * platform/network/soup/ResourceRequestSoup.cpp:
3795         (WebCore::appendEncodedBlobItemToSoupMessageBody): Helper method to append the blob to the request message body.
3796         (WebCore::ResourceRequest::updateSoupMessageBody): Add HTTPBody to the request message body.
3797         (WebCore::ResourceRequest::updateSoupMessage): Call updateSoupMessageBody() to also update the body.
3798         * platform/soup/SharedBufferSoup.cpp:
3799         (WebCore::SharedBuffer::createSoupBuffer): Returns a new SoupBuffer for the SharedBuffer.
3800
3801 2016-10-04  Chris Dumez  <cdumez@apple.com>
3802
3803         Implement KeyboardEvent.code from the UI Event spec
3804         https://bugs.webkit.org/show_bug.cgi?id=149584
3805
3806         Reviewed by Darin Adler.
3807
3808         Add support for Keyboard.code attribute:
3809         - https://w3c.github.io/uievents/#dom-keyboardevent-code
3810         - https://w3c.github.io/uievents-code/
3811
3812         The feature is only enabled on Mac for now as the implementation is
3813         platform-specific and Mac only.
3814
3815         Test: fast/events/keyboardevent-code.html
3816
3817         * dom/KeyboardEvent.cpp:
3818         (WebCore::KeyboardEvent::KeyboardEvent):
3819         * dom/KeyboardEvent.h:
3820         * dom/KeyboardEvent.idl:
3821         * platform/PlatformKeyboardEvent.h:
3822         (WebCore::PlatformKeyboardEvent::PlatformKeyboardEvent):
3823         (WebCore::PlatformKeyboardEvent::code):
3824         (WebCore::PlatformKeyboardEvent::unmodifiedText): Deleted.
3825         * platform/mac/PlatformEventFactoryMac.h:
3826         * platform/mac/PlatformEventFactoryMac.mm:
3827         (WebCore::codeForKeyEvent):
3828         (WebCore::keyIdentifierForKeyEvent):
3829         * replay/SerializationMethods.cpp:
3830         (JSC::EncodingTraits<PlatformKeyboardEvent>::encodeValue):
3831         (JSC::EncodingTraits<PlatformKeyboardEvent>::decodeValue):
3832
3833 2016-10-04  Said Abou-Hallawa  <sabouhallawa@apple.com>
3834
3835         The dragged image should be the current frame only of the animated image
3836         https://bugs.webkit.org/show_bug.cgi?id=162109
3837
3838         Reviewed by Tim Horton.
3839
3840         Instead of creating an NSImage with all the frames for the dragImage,
3841         create an NSImage with the current frame only.
3842
3843         * dom/DataTransferMac.mm:
3844         (WebCore::DataTransfer::createDragImage): Call snapshotNSImage() to create the dragImage.
3845         * editing/cocoa/HTMLConverter.mm:
3846         (fileWrapperForElement):  Call the Image function with its new name.
3847         * platform/graphics/BitmapImage.h:
3848         * platform/graphics/Image.h:
3849         (WebCore::Image::nsImage): Rename getNSImage() to nsImage().
3850         (WebCore::Image::snapshotNSImage): Returns the NSImage of the current frame.
3851         (WebCore::Image::tiffRepresentation): Rename getTIFFRepresentation() to tiffRepresentation().
3852         (WebCore::Image::getNSImage): Deleted.
3853         (WebCore::Image::getTIFFRepresentation): Deleted.
3854         * platform/graphics/mac/ImageMac.mm:
3855         (WebCore::BitmapImage::tiffRepresentation): Rename getTIFFRepresentation() to tiffRepresentation().
3856         (WebCore::BitmapImage::nsImage): Rename getNSImage() to nsImage().
3857         (WebCore::BitmapImage::snapshotNSImage): Returns the NSImage of the current frame.
3858         (WebCore::BitmapImage::getTIFFRepresentation): Deleted.
3859         (WebCore::BitmapImage::getNSImage): Deleted.
3860         * platform/mac/CursorMac.mm:
3861         (WebCore::createCustomCursor): Call snapshotNSImage() since the cursor does not animate anyway.
3862         * platform/mac/DragImageMac.mm:
3863         (WebCore::createDragImageFromImage): Use snapshotNSImage() for the dragImage.
3864         * platform/mac/PasteboardMac.mm:
3865         (WebCore::Pasteboard::write): Call the Image function with its new name.
3866
3867 2016-10-04  Andy Estes  <aestes@apple.com>
3868
3869         [iOS] Crash in WebResourceLoaderQuickLookDelegate when the client cancels the navigation to a QuickLook resource
3870         https://bugs.webkit.org/show_bug.cgi?id=162950
3871         <rdar://problem/23759114>
3872
3873         Reviewed by Brady Eidson.
3874
3875         When we receive data from QLPreviewConverter for the first time, we call
3876         ResourceLoader::didReceiveResponse() with the preview NSURLResponse from QuickLook. If the
3877         client decides to cancel this navigation in decidePolicyForResponse(),
3878         WebResourceLoaderQuickLookDelegate will end up with a null _resourceLoader after
3879         didReceiveResponse() returns. This change adds null checks in the methods that use
3880         _resourceLoader after calling -_sendDidReceiveResponseIfNecessary.
3881
3882         New API test: QuickLook.CancelNavigationAfterResponse
3883
3884         * platform/network/ios/QuickLook.mm:
3885         (-[WebResourceLoaderQuickLookDelegate connection:didReceiveDataArray:]): Changed to only
3886         call ResourceLoader::didReceiveDataArray() if _resourceLoader is non-null.
3887         (-[WebResourceLoaderQuickLookDelegate connection:didReceiveData:lengthReceived:]): Ditto for
3888         ResourceLoader::didReceiveData().
3889         (-[WebResourceLoaderQuickLookDelegate connection:didFailWithError:]): Ditto for
3890         ResourceLoader::didFail().
3891
3892 2016-10-04  Chris Dumez  <cdumez@apple.com>
3893
3894         Add support for KeyboardEvent.isComposing attribute
3895         https://bugs.webkit.org/show_bug.cgi?id=162921
3896
3897         Reviewed by Darin Adler.
3898
3899         Add support for KeyboardEvent.isComposing attribute:
3900         - https://www.w3.org/TR/uievents/#dom-keyboardevent-iscomposing
3901         - https://www.w3.org/TR/uievents/#ref-for-dom-keyboardevent-iscomposing-3
3902
3903         Manual test: https://jsfiddle.net/ay92sr08/9/
3904
3905         No new tests, extended existing tests.
3906
3907         * dom/KeyboardEvent.cpp:
3908         (WebCore::KeyboardEvent::KeyboardEvent):
3909         * dom/KeyboardEvent.h:
3910         * dom/KeyboardEvent.idl:
3911
3912 2016-10-03  Ryosuke Niwa  <rniwa@webkit.org>
3913
3914         ShadowRoot interface should have elementFromPoint
3915         https://bugs.webkit.org/show_bug.cgi?id=162882
3916
3917         Reviewed by Chris Dumez.
3918
3919         Add elementFromPoint to ShadowRoot's prototype as specified at:
3920         https://www.w3.org/TR/shadow-dom/#extensions-to-the-documentorshadowroot-mixin
3921         with changes proposed at https://github.com/w3c/csswg-drafts/issues/556
3922
3923         Added TreeScope::retargetToScope which implements 
3924
3925         This patch also factors DocumentOrShadowRoot.idl out of Document and ShadowRoot interfaces to better match
3926         the latest DOM specification: https://dom.spec.whatwg.org/#mixin-documentorshadowroot
3927
3928         Test: fast/shadow-dom/Document-prototype-elementFromPoint.html
3929
3930         * CMakeLists.txt:
3931         * DerivedSources.make:
3932         * WebCore.xcodeproj/project.pbxproj:
3933         * dom/Document.cpp:
3934         (WebCore::Document::nodeFromPoint): Moved to TreeScope.
3935         (WebCore::Document::elementFromPoint): Moved to TreeScope.
3936         * dom/Document.h:
3937         * dom/Document.idl: Moved elementFromPoint and activeElement to DocumentOrShadowRoot.idl.
3938         * dom/DocumentOrShadowRoot.idl: Added.
3939         * dom/EventPath.cpp:
3940         (WebCore::RelatedNodeRetargeter::checkConsistency): Use newly added TreeScope::retargetToScope.
3941         * dom/ShadowRoot.idl: Moved activeElement to DocumentOrShadowRoot.idl.
3942         * dom/TreeScope.cpp:
3943         (WebCore::TreeScope::retargetToScope): Added. Implements https://dom.spec.whatwg.org/#retarget efficiently.
3944         Instead of checking whether A (node) is a shadow-including inclusive ancestor of B (this scope) at each
3945         parent, find the lowest ancestor which contains both A and B, and return the self-inclusive ancestor of B
3946         in that tree. To find the lowest common ancestor in O(n), traverse all ancestors of A and B separately and
3947         do a top-down traversal. The last tree scope in which A's ancestor and B's ancestor match is the lowest
3948         common ancestor.
3949         (WebCore::TreeScope::nodeFromPoint): Moved from Document.
3950         (WebCore::TreeScope::elementFromPoint): Moved from Document. Use retargetToScope and parentInComposedTree
3951         instead of parentNode and ancestorInThisScope to match the semantics proposed in
3952         https://github.com/w3c/csswg-drafts/issues/556
3953         * dom/TreeScope.h:
3954
3955 2016-10-04  Myles C. Maxfield  <mmaxfield@apple.com>
3956
3957         font-family: cursive should map to KaiTi in Chinese
3958         https://bugs.webkit.org/show_bug.cgi?id=162889
3959         <rdar://problem/28363547>
3960
3961         Reviewed by Tim Horton.
3962
3963         According to Bobby Tung, this is a better mapping. Previously, we were
3964         relying on the system fallback mechanism. However, an explicit mapping
3965         is more robust.
3966
3967         Test: fast/text/cursive-zh.html
3968
3969         * page/cocoa/SettingsCocoa.mm:
3970         (WebCore::Settings::initializeDefaultFontFamilies):
3971
3972 2016-10-04  Alex Christensen  <achristensen@webkit.org>
3973
3974         URLParser: query-only URLs relative to file URLs should just add a query
3975         https://bugs.webkit.org/show_bug.cgi?id=162888
3976
3977         Reviewed by Tim Horton.
3978
3979         Covered by new API tests.
3980
3981         * platform/URLParser.cpp: