WebRTC: Make MediaEndpointPeerConnection handle remotely assigned mids correctly
[WebKit-https.git] / Source / WebCore / ChangeLog
1 2016-10-10  Adam Bergkvist  <adam.bergkvist@ericsson.com> and Alejandro G. Castro <alex@igalia.com>
2
3         WebRTC: Make MediaEndpointPeerConnection handle remotely assigned mids correctly
4         https://bugs.webkit.org/show_bug.cgi?id=163202
5
6         Reviewed by Eric Carlson.
7
8         An RTCRtpTransceiver has a null mid until it's been associated with a
9         media description (with a mid) [1]. During that time, it's identified by
10         a provisional mid that might become its real mid, but the transceiver
11         can also get its mid assigned by a remote media description. In the
12         second case, the mid value is initially unknown. A transceiver's
13         RTCRtpSender must directly (synchronously in the script) provide a muted
14         remote source that is playable by, for example, a media element. This
15         source is initially registered in the MediaEndpoint (WebRTC backend)
16         with the transceiver's provisional mid. So, if the real mid is set by a
17         remote description, the registered mid must be updated to preserve the
18         association between the registered source and the transceiver.
19
20         [1] https://w3c.github.io/webrtc-pc/archives/20160913/webrtc.html#dom-rtcrtptransceiver-mid
21
22         Test: fast/mediastream/RTCPeerConnection-remotely-assigned-transceiver-mid.html
23
24         * Modules/mediastream/MediaEndpointPeerConnection.cpp:
25         Don't break after finding the first transceiver in the loop that builds the send source map.
26         Update the mid used to register the muted remote source if the a transceiver's mid gets
27         assigned by a remote media description.
28         (WebCore::createSourceMap):
29         (WebCore::MediaEndpointPeerConnection::setRemoteDescriptionTask):
30         * platform/mediastream/MediaEndpoint.cpp:
31         * platform/mediastream/MediaEndpoint.h:
32         * platform/mock/MockMediaEndpoint.cpp:
33         (WebCore::MockMediaEndpoint::MockMediaEndpoint):
34         (WebCore::MockMediaEndpoint::updateReceiveConfiguration):
35         (WebCore::MockMediaEndpoint::updateSendConfiguration):
36         (WebCore::MockMediaEndpoint::createMutedRemoteSource):
37         (WebCore::MockMediaEndpoint::replaceMutedRemoteSourceMid):
38         (WebCore::MockMediaEndpoint::emulatePlatformEvent):
39         Add "unmute-remote-sources-by-mid" action that emulates data arriving on media descriptions
40         which unmutes the remote sources.
41         (WebCore::MockMediaEndpoint::updateConfigurationMids):
42         (WebCore::MockMediaEndpoint::unmuteRemoteSourcesByMid):
43         (WebCore::MockMediaEndpoint::unmuteTimerFired):
44         * platform/mock/MockMediaEndpoint.h:
45
46 2016-10-10  Darin Adler  <darin@apple.com>
47
48         Move audio module off of legacy exceptions
49         https://bugs.webkit.org/show_bug.cgi?id=163269
50
51         Reviewed by Alex Christensen.
52
53         * Modules/webaudio/AnalyserNode.cpp:
54         (WebCore::AnalyserNode::setFftSize): Use ExceptionOr.
55         (WebCore::AnalyserNode::setMinDecibels): Ditto.
56         (WebCore::AnalyserNode::setMaxDecibels): Ditto.
57         (WebCore::AnalyserNode::setSmoothingTimeConstant): Ditto.
58         * Modules/webaudio/AnalyserNode.h: Update for above.
59         * Modules/webaudio/AnalyserNode.idl: Ditto.
60
61         * Modules/webaudio/AudioBasicInspectorNode.cpp:
62         (WebCore::AudioBasicInspectorNode::AudioBasicInspectorNode):
63         Initialize m_needAutomaticPull in class definition.
64         (WebCore::AudioBasicInspectorNode::connect): Use ExceptionOr.
65         (WebCore::AudioBasicInspectorNode::disconnect): Ditto.
66         * Modules/webaudio/AudioBasicInspectorNode.h: Updated for above.
67
68         * Modules/webaudio/AudioBuffer.cpp:
69         (WebCore::AudioBuffer::createFromAudioFileData): Use reference.
70         (WebCore::AudioBuffer::AudioBuffer): Initialize m_gain in class definition.
71         (WebCore::AudioBuffer::getChannelData): Use ExceptionOr.
72         (WebCore::AudioBuffer::channelData): Rename to disambiguate with getChannelData.
73         (WebCore::AudioBuffer::zero): Use modern for loop.
74         * Modules/webaudio/AudioBuffer.h: Update for above.
75         * Modules/webaudio/AudioBuffer.idl: Ditto.
76
77         * Modules/webaudio/AudioBufferSourceNode.cpp:
78         (WebCore::AudioBufferSourceNode::process): Use reference.
79         (WebCore::AudioBufferSourceNode::setBuffer): Use channelData.
80         (WebCore::AudioBufferSourceNode::start): Use ExceptionOr.
81         (WebCore::AudioBufferSourceNode::startPlaying): Ditto.
82         * Modules/webaudio/AudioBufferSourceNode.h: Update for above.
83         * Modules/webaudio/AudioBufferSourceNode.idl: Ditto.
84
85         * Modules/webaudio/AudioContext.cpp:
86         (WebCore::AudioContext::createBuffer): Use ExceptionOr.
87         (WebCore::AudioContext::createMediaElementSource): Ditto.
88         (WebCore::AudioContext::createMediaStreamSource): Ditto.
89         (WebCore::AudioContext::createScriptProcessor): Ditto.
90         (WebCore::AudioContext::createDelay): Ditto.
91         (WebCore::AudioContext::createChannelSplitter): Ditto.
92         (WebCore::AudioContext::createChannelMerger): Ditto.
93         (WebCore::AudioContext::createPeriodicWave): Ditto.
94         * Modules/webaudio/AudioContext.h: Update for above.
95         * Modules/webaudio/AudioContext.idl: Ditto.
96
97         * Modules/webaudio/AudioDestinationNode.h: Use unsigned instead
98         of unsigned long for maxChannelCount.
99
100         * Modules/webaudio/AudioNode.cpp:
101         (WebCore::AudioNode::connect): Use ExceptionOr.
102         (WebCore::AudioNode::disconnect): Ditto.
103         (WebCore::AudioNode::channelCount): Use unsigned.
104         (WebCore::AudioNode::setChannelCount): Use ExceptionOr and unsigned.
105         (WebCore::AudioNode::setChannelCountMode): Ditto.
106         (WebCore::AudioNode::setChannelInterpretation): Ditto.
107         * Modules/webaudio/AudioNode.h: Update for above.
108         * Modules/webaudio/AudioNode.idl: Ditto.
109
110         * Modules/webaudio/AudioScheduledSourceNode.cpp:
111         (WebCore::AudioScheduledSourceNode::AudioScheduledSourceNode):
112         Initialize data members in class definition.
113         (WebCore::AudioScheduledSourceNode::updateSchedulingInfo): Take
114         a reference instead of a pointer to the audio bus.
115         (WebCore::AudioScheduledSourceNode::start): Use ExceptionOr.
116         (WebCore::AudioScheduledSourceNode::stop): Ditto.
117         * Modules/webaudio/AudioScheduledSourceNode.h: Update for above.
118
119         * Modules/webaudio/ConvolverNode.cpp:
120         (WebCore::ConvolverNode::ConvolverNode): Initialize m_normalize
121         in class definition.
122         (WebCore::ConvolverNode::setBuffer): Use ExceptionOr.
123         * Modules/webaudio/ConvolverNode.h: Update for above.
124         * Modules/webaudio/ConvolverNode.idl: Ditto.
125
126         * Modules/webaudio/DefaultAudioDestinationNode.cpp:
127         (WebCore::DefaultAudioDestinationNode::DefaultAudioDestinationNode):
128         Initialize m_numberOfInputChannels in class definition.
129         (WebCore::DefaultAudioDestinationNode::maxChannelCount): Use unsigned.
130         (WebCore::DefaultAudioDestinationNode::setChannelCount): Use ExceptionOr.
131         * Modules/webaudio/DefaultAudioDestinationNode.h: Update for changes above.
132
133         * Modules/webaudio/DelayNode.cpp:
134         (WebCore::DelayNode::DelayNode): Moved exception logic out of constructor.
135         (WebCore::DelayNode::create): Added. Moved exception logic in here.
136         (WebCore::DelayNode::delayTime): Moved typecast here from header.
137         * Modules/webaudio/DelayNode.h: Update for above.
138
139         * Modules/webaudio/OfflineAudioContext.cpp:
140         (WebCore::OfflineAudioContext::OfflineAudioContext): Marked inline.
141         (WebCore::OfflineAudioContext::create): Use ExceptionOr.
142         (WebCore::OfflineAudioContext::~OfflineAudioContext): Deleted. Unneeded.
143         * Modules/webaudio/OfflineAudioContext.h: Update for above.
144         * Modules/webaudio/OfflineAudioContext.idl: Ditto.
145
146         * Modules/webaudio/OfflineAudioDestinationNode.cpp:
147         (WebCore::OfflineAudioDestinationNode::offlineRender): Use channelData.
148
149         * Modules/webaudio/OscillatorNode.cpp:
150         (WebCore::OscillatorNode::OscillatorNode): Updated for change to setType.
151         (WebCore::OscillatorNode::setType): Use ExceptionOr.
152         (WebCore::OscillatorNode::process): Use a reference.
153         * Modules/webaudio/OscillatorNode.h: Update for above.
154         * Modules/webaudio/OscillatorNode.idl: Ditto.
155
156         * Modules/webaudio/ScriptProcessorNode.cpp:
157         (WebCore::ScriptProcessorNode::process): Use channelData.
158
159         * bindings/js/JSDOMBinding.h: Added overloads of toJS to it can be used on
160         references to array buffers and array buffer views, not just pointers.
161
162 2016-10-10  Youenn Fablet  <youenn@apple.com>
163
164         Change HTTPHeaderValues from a struct to a namespace
165         https://bugs.webkit.org/show_bug.cgi?id=163203
166
167         Reviewed by Alex Christensen.
168
169         No change of behavior.
170
171         * Modules/fetch/FetchBody.cpp:
172         (WebCore::FetchBody::extract):
173         * platform/network/HTTPHeaderValues.cpp:
174         (WebCore::HTTPHeaderValues::textPlainContentType):
175         (WebCore::HTTPHeaderValues::formURLEncodedContentType):
176         (WebCore::HTTPHeaderValues::TextPlainContentType): Deleted.
177         (WebCore::HTTPHeaderValues::FormURLEncodedContentType): Deleted.
178         * platform/network/HTTPHeaderValues.h:
179         * xml/XMLHttpRequest.cpp:
180         (WebCore::XMLHttpRequest::send):
181
182 2016-10-10  Chris Dumez  <cdumez@apple.com>
183
184         Update WheelEvent / MouseEvent to stop using legacy [ConstructorTemplate=Event]
185         https://bugs.webkit.org/show_bug.cgi?id=163254
186
187         Reviewed by Darin Adler.
188
189         Update WheelEvent / MouseEvent to stop using legacy [ConstructorTemplate=Event]
190         and use a regular constructor instead, as in the specification:
191         - https://www.w3.org/TR/uievents/#interface-mouseevent
192         - https://www.w3.org/TR/uievents/#interface-wheelevent
193
194         * CMakeLists.txt:
195         * DerivedSources.cpp:
196         * DerivedSources.make:
197         * WebCore.xcodeproj/project.pbxproj:
198
199         * bindings/scripts/CodeGeneratorJS.pm:
200         (GenerateHeader):
201         (GenerateDictionaryHeader):
202         Fix our broken dependency tracking when it comes to dictionaries.
203
204         * dom/MouseEvent.cpp:
205         (WebCore::MouseEvent::create):
206         (WebCore::MouseEvent::MouseEvent):
207         * dom/MouseEvent.h:
208         * dom/MouseEvent.idl:
209         * dom/MouseEventInit.h: Added.
210         * dom/MouseEventInit.idl: Added.
211         * dom/MouseRelatedEvent.cpp:
212         (WebCore::MouseRelatedEvent::MouseRelatedEvent):
213         * dom/MouseRelatedEvent.h:
214         * dom/UIEventWithKeyState.h:
215         (WebCore::UIEventWithKeyState::UIEventWithKeyState):
216         * dom/WheelEvent.cpp:
217         (WebCore::WheelEvent::WheelEvent):
218         * dom/WheelEvent.h:
219         * dom/WheelEvent.idl:
220
221 2016-10-10  Chris Dumez  <cdumez@apple.com>
222
223         Add support for languagechange event
224         https://bugs.webkit.org/show_bug.cgi?id=163222
225
226         Reviewed by Ryosuke Niwa.
227
228         Add support for languagechange event:
229         - https://html.spec.whatwg.org/#dom-navigator-languages
230
231         Firefox and Chrome already support this.
232
233         Test: fast/dom/window-languagechange-event.html
234
235         * dom/EventNames.h:
236         * html/HTMLAttributeNames.in:
237         * html/HTMLBodyElement.cpp:
238         (WebCore::HTMLBodyElement::createWindowEventHandlerNameMap):
239         * page/DOMWindow.cpp:
240         (WebCore::languagesChangedCallback):
241         (WebCore::DOMWindow::DOMWindow):
242         (WebCore::DOMWindow::~DOMWindow):
243         (WebCore::DOMWindow::languagesChanged):
244         (WebCore::DOMWindow::canShowModalDialog): Deleted.
245         (WebCore::DOMWindow::removeEventListener): Deleted.
246         * page/DOMWindow.h:
247         * page/WindowEventHandlers.idl:
248
249 2016-10-10  Chris Dumez  <cdumez@apple.com>
250
251         Update GamepadEvent to stop using legacy [ConstructorTemplate=Event]
252         https://bugs.webkit.org/show_bug.cgi?id=163243
253
254         Reviewed by Darin Adler.
255
256         Update GamepadEvent to stop using legacy [ConstructorTemplate=Event]
257         and use a proper constructor as in the specification:
258         - https://w3c.github.io/gamepad/#gamepadevent-interface
259
260         * Modules/gamepad/GamepadEvent.cpp:
261         (WebCore::GamepadEvent::GamepadEvent):
262         * Modules/gamepad/GamepadEvent.h:
263         (WebCore::GamepadEvent::create):
264         (WebCore::GamepadEvent::~GamepadEvent): Deleted.
265         * Modules/gamepad/GamepadEvent.idl:
266
267 2016-10-10  Darin Adler  <darin@apple.com>
268
269         Move Fetch from legacy to new DOM exceptions
270         https://bugs.webkit.org/show_bug.cgi?id=163195
271
272         Reviewed by Chris Dumez.
273
274         * Modules/fetch/FetchHeaders.cpp:
275         (WebCore::canWriteHeader): Use ExceptionOr.
276         (WebCore::FetchHeaders::append): Ditto.
277         (WebCore::FetchHeaders::remove): Ditto.
278         (WebCore::FetchHeaders::get): Ditto.
279         (WebCore::FetchHeaders::has): Ditto.
280         (WebCore::FetchHeaders::set): Ditto.
281         (WebCore::FetchHeaders::filterAndFill): Ditto.
282         (WebCore::FetchHeaders::Iterator::next): Got rid of unneeded code to
283         clear out m_keys after the last call to next, since it will be deleted
284         as soon as the iterator is deleted.
285
286         * Modules/fetch/FetchHeaders.h: Use pragma once. Use ExceptionOr.
287
288         * Modules/fetch/FetchHeaders.idl: Move to non-legacy exceptions.
289
290         * Modules/fetch/FetchRequest.cpp:
291         (WebCore::FetchRequest::setBody): Use ExceptionOr.
292         (WebCore::FetchRequest::clone): Ditto.
293
294         * Modules/fetch/FetchRequest.h: Use pragma once. Use ExceptionOr.
295
296         * Modules/fetch/FetchRequest.idl: Move to non-legacy exceptions.
297
298         * Modules/fetch/FetchResponse.cpp:
299         (WebCore::FetchResponse::redirect): Use ExceptionOr.
300         (WebCore::FetchResponse::setStatus): Ditto.
301
302         * Modules/fetch/FetchResponse.h: Use ExceptionOr.
303
304         * Modules/fetch/FetchResponse.idl: Move to non-legacy exceptions.
305
306         * bindings/js/JSDOMBinding.h: Added implementation of toJSNullableString.
307
308         * bindings/scripts/CodeGeneratorJS.pm:
309         (NativeToJSValue): Call toJSNullableString and toJSString for
310         functions that return ExceptionOr<String>.
311
312 2016-10-10  Nan Wang  <n_wang@apple.com>
313
314         AX: Expose invalid status for input types with that information
315         https://bugs.webkit.org/show_bug.cgi?id=163252
316         <rdar://problem/28704409>
317
318         Reviewed by Chris Fleizach.
319
320         For input types with invalid input value, we should expose the invalid 
321         status to the assitive technology.
322
323         Test: accessibility/mac/invalid-status-for-input-types.html
324
325         * accessibility/AccessibilityObject.cpp:
326         (WebCore::AccessibilityObject::invalidStatus):
327
328 2016-10-10  Konstantin Tokarev  <annulen@yandex.ru>
329
330         Added override specifier to PluginViewBase::isPluginViewBase()
331         https://bugs.webkit.org/show_bug.cgi?id=163218
332
333         Reviewed by Alex Christensen.
334
335         No new tests needed.
336
337         * plugins/PluginViewBase.h:
338
339 2016-10-10  Alex Christensen  <achristensen@webkit.org>
340
341         Don't run SecurityOrigin's port through URLParser
342         https://bugs.webkit.org/show_bug.cgi?id=163253
343
344         Reviewed by Brady Eidson.
345
346         No change in behavior.
347
348         * page/SecurityOrigin.cpp:
349         (WebCore::SecurityOrigin::maybeCreateFromDatabaseIdentifier):
350         (WebCore::SecurityOrigin::create):
351         We used to parse URLs like "file://:0/" which are valid when using URL::parse
352         but aren't valid when we start using the URLParser, which matches other browsers' failure
353         to parse URLs with a port but no host. There is no reason to write and parse the port.
354         Setting m_port directly accomplishes the same thing.
355  
356 2016-10-10  Said Abou-Hallawa  <sabouhallawa@apple.com>
357
358         <Error>: CGContextSetLineDash: invalid dash array: at least one element must be non-zero
359         https://bugs.webkit.org/show_bug.cgi?id=138555
360
361         Reviewed by Simon Fraser.
362
363         Ensure the dashArray has at least one non-zero element before calling
364         GraphicsContext::setLineDash(). Call GraphicsContext::setStrokeStyle()
365         instead, if the dashArray does not have one.
366
367         * rendering/svg/SVGRenderSupport.cpp:
368         (WebCore::SVGRenderSupport::applyStrokeStyleToContext):
369
370 2016-10-10  Brent Fulgham  <bfulgham@apple.com>
371
372         [Win][Direct2D] Correct Radial Graident Bug
373         https://bugs.webkit.org/show_bug.cgi?id=163241
374
375         Reviewed by Darin Adler.
376
377         Radial gradients were not working correctly under Direct2D because the
378         points and radius values used were incorrect. D2D wants a center point and
379         an offset, not a start and end point. It wants an X and Y radius (for an
380         ellipse), not a radius at the start point, and a radius at the end point.
381
382         Covered by existing fast/gradients/css-radial-gradients.html (and others).
383
384         * platform/graphics/Image.cpp:
385         (WebCore::Image::drawTiled): Remove 'notImplemented' code path.
386         * platform/graphics/win/GradientDirect2D.cpp:
387         (WebCore::Gradient::generateGradient): Use correct input values to
388         the Radial Gradient constructor.
389         (WebCore::Gradient::fill): Generate a gradient if we have no active
390         one to use.
391
392 2016-10-10  Jiewen Tan  <jiewen_tan@apple.com>
393
394         Rename CryptoAlgorithmParameters to CryptoAlgorithmParametersDeprecated
395         https://bugs.webkit.org/show_bug.cgi?id=163163
396         <rdar://problem/28681544>
397
398         Reviewed by Brent Fulgham.
399
400         Replace all uses of 'CryptoAlgorithmParameters' with 'CryptoAlgorithmParametersDeprecated' in preparation for a new CryptoAlgorithmParameters type.
401
402         No changes of behaviors. No new tests.
403
404         * Modules/encryptedmedia/CDMSessionClearKey.cpp:
405         * WebCore.xcodeproj/project.pbxproj:
406         * bindings/js/JSCryptoAlgorithmDictionary.cpp:
407         * bindings/js/JSCryptoAlgorithmDictionary.h:
408         * bindings/js/JSCryptoKeySerializationJWK.cpp:
409         * bindings/js/JSCryptoKeySerializationJWK.h:
410         * bindings/js/JSWebKitSubtleCryptoCustom.cpp:
411         * crypto/CryptoAlgorithm.cpp:
412         * crypto/CryptoAlgorithm.h:
413         * crypto/CryptoAlgorithmParametersDeprecated.h: Renamed from Source/WebCore/crypto/CryptoAlgorithmParameters.h.
414         * crypto/CryptoKeySerialization.h:
415         * crypto/algorithms/CryptoAlgorithmAES_CBC.cpp:
416         * crypto/algorithms/CryptoAlgorithmAES_CBC.h:
417         * crypto/algorithms/CryptoAlgorithmAES_KW.cpp:
418         * crypto/algorithms/CryptoAlgorithmAES_KW.h:
419         * crypto/algorithms/CryptoAlgorithmHMAC.cpp:
420         * crypto/algorithms/CryptoAlgorithmHMAC.h:
421         * crypto/algorithms/CryptoAlgorithmRSAES_PKCS1_v1_5.cpp:
422         * crypto/algorithms/CryptoAlgorithmRSAES_PKCS1_v1_5.h:
423         * crypto/algorithms/CryptoAlgorithmRSASSA_PKCS1_v1_5.cpp:
424         * crypto/algorithms/CryptoAlgorithmRSASSA_PKCS1_v1_5.h:
425         * crypto/algorithms/CryptoAlgorithmRSA_OAEP.cpp:
426         * crypto/algorithms/CryptoAlgorithmRSA_OAEP.h:
427         * crypto/algorithms/CryptoAlgorithmSHA1.cpp:
428         * crypto/algorithms/CryptoAlgorithmSHA1.h:
429         * crypto/algorithms/CryptoAlgorithmSHA224.cpp:
430         * crypto/algorithms/CryptoAlgorithmSHA224.h:
431         * crypto/algorithms/CryptoAlgorithmSHA256.cpp:
432         * crypto/algorithms/CryptoAlgorithmSHA256.h:
433         * crypto/algorithms/CryptoAlgorithmSHA384.cpp:
434         * crypto/algorithms/CryptoAlgorithmSHA384.h:
435         * crypto/algorithms/CryptoAlgorithmSHA512.cpp:
436         * crypto/algorithms/CryptoAlgorithmSHA512.h:
437         * crypto/keys/CryptoKeySerializationRaw.cpp:
438         * crypto/gnutls/CryptoAlgorithmAES_CBCGnuTLS.cpp:
439         * crypto/gnutls/CryptoAlgorithmHMACGnuTLS.cpp:
440         * crypto/gnutls/CryptoAlgorithmRSA_OAEPGnuTLS.cpp:
441         * crypto/gnutls/CryptoAlgorithmRSASSA_PKCS1_v1_5GnuTLS.cpp:
442         * crypto/keys/CryptoKeySerializationRaw.h:
443         * crypto/mac/CryptoAlgorithmAES_CBCMac.cpp:
444         * crypto/mac/CryptoAlgorithmHMACMac.cpp:
445         * crypto/mac/CryptoAlgorithmRSASSA_PKCS1_v1_5Mac.cpp:
446         * crypto/mac/CryptoAlgorithmRSA_OAEPMac.cpp:
447         * crypto/parameters/CryptoAlgorithmAesCbcParamsDeprecated.h: Renamed from Source/WebCore/crypto/parameters/CryptoAlgorithmAesCbcParams.h.
448         * crypto/parameters/CryptoAlgorithmAesKeyGenParamsDeprecated.h: Renamed from Source/WebCore/crypto/parameters/CryptoAlgorithmAesKeyGenParams.h.
449         * crypto/parameters/CryptoAlgorithmHmacKeyParamsDeprecated.h: Renamed from Source/WebCore/crypto/parameters/CryptoAlgorithmHmacKeyParams.h.
450         * crypto/parameters/CryptoAlgorithmHmacParamsDeprecated.h: Renamed from Source/WebCore/crypto/parameters/CryptoAlgorithmHmacParams.h.
451         * crypto/parameters/CryptoAlgorithmRsaKeyGenParamsDeprecated.h: Renamed from Source/WebCore/crypto/parameters/CryptoAlgorithmRsaKeyGenParams.h.
452         * crypto/parameters/CryptoAlgorithmRsaKeyParamsWithHashDeprecated.h: Renamed from Source/WebCore/crypto/parameters/CryptoAlgorithmRsaKeyParamsWithHash.h.
453         * crypto/parameters/CryptoAlgorithmRsaOaepParamsDeprecated.h: Renamed from Source/WebCore/crypto/parameters/CryptoAlgorithmRsaOaepParams.h.
454         * crypto/parameters/CryptoAlgorithmRsaSsaParamsDeprecated.h: Renamed from Source/WebCore/crypto/parameters/CryptoAlgorithmRsaSsaParams.h.
455
456 2016-10-10  Darin Adler  <darin@apple.com>
457
458         Move NotificationCenter from legacy to new DOM exceptions
459         https://bugs.webkit.org/show_bug.cgi?id=163217
460
461         Reviewed by Chris Dumez.
462
463         * Modules/notifications/DOMWindowNotifications.cpp:
464         (WebCore::DOMWindowNotifications::webkitNotifications): Pass reference to
465         document instead of pointer. Also use auto and early return.
466
467         * Modules/notifications/Notification.cpp:
468         (WebCore::Notification::Notification): Move checks that can lead to
469         throwing an exception out of the constructor into the create function.
470         (WebCore::Notification::create): Changed to use ExceptionOr. Also moved
471         checks that can lead to throwing an exception here.
472         (WebCore::Notification::show): Update since NotificationController::client
473         now returns a reference.
474         (WebCore::Notification::permission): Ditto.
475         (WebCore::Notification::requestPermission): Ditto.
476
477         * Modules/notifications/Notification.h: Updated for above changes.
478
479         * Modules/notifications/NotificationCenter.cpp:
480         (WebCore::NotificationCenter::create): Take a reference to the script execution
481         context instead of a pointer.
482         (WebCore::NotificationCenter::NotificationCenter): Ditto.
483         (WebCore::NotificationCenter::createNotification): Use ExceptionOr.
484         (WebCore::NotificationCenter::requestPermission): Take an rvalue reference.
485
486         * Modules/notifications/NotificationCenter.h: Use pragma once.
487         Marked the class final. Updated for changes above.
488
489         * Modules/notifications/NotificationCenter.idl: Use non-legacy exceptions.
490
491         * Modules/notifications/NotificationController.cpp:
492         (WebCore::NotificationController::NotificationController): Use a reference rather
493         than a pointer for m_client, since it is never null.
494         (WebCore::NotificationController::~NotificationController): Ditto.
495         (WebCore::NotificationController::clientFrom): Updated for the change above.
496
497         * Modules/notifications/NotificationController.h: Updated for the change above.
498
499         * Modules/notifications/WorkerGlobalScopeNotifications.cpp:
500         (WebCore::WorkerGlobalScopeNotifications::webkitNotifications): Updated to
501         pass a reference for the script execution context. Also added FIXME about the
502         fact that the client is always null.
503
504 2016-10-10  Antoine Quint  <graouts@apple.com>
505
506         [Modern Media Controls] Placards
507         https://bugs.webkit.org/show_bug.cgi?id=163110
508         <rdar://problem/28669342>
509
510         Reviewed by Dean Jackson.
511
512         Inline media controls need to display placards when the video is no longer playing inline,
513         such as when the video is playing fullscreen or via AirPlay. To that end, we introduce a
514         new Placard class and two subclasses for display during fullscreen or AirPlay playback.
515         Note that localization will be done in a later patch.
516
517         Tests: media/modern-media-controls/airplay-placard/airplay-placard.html
518                media/modern-media-controls/pip-placard/pip-placard.html
519                media/modern-media-controls/placard/placard.html
520
521         * Modules/modern-media-controls/controls/airplay-placard.js:
522         (AirplayPlacard):
523         * Modules/modern-media-controls/controls/icon-service.js:
524         * Modules/modern-media-controls/controls/pip-placard.js:
525         (PiPPlacard):
526         * Modules/modern-media-controls/controls/placard.css:
527         (.placard):
528         (.placard .container):
529         (.placard .icon):
530         (.placard .title,):
531         (.placard .title):
532         (.placard .description):
533         * Modules/modern-media-controls/controls/placard.js:
534         (Placard.):
535         * Modules/modern-media-controls/images/iOS/airplay-placard@1x.png: Added.
536         * Modules/modern-media-controls/images/iOS/airplay-placard@2x.png: Added.
537         * Modules/modern-media-controls/images/iOS/airplay-placard@3x.png: Added.
538         * Modules/modern-media-controls/images/iOS/pip-placard@1x.png: Added.
539         * Modules/modern-media-controls/images/iOS/pip-placard@2x.png: Added.
540         * Modules/modern-media-controls/images/iOS/pip-placard@3x.png: Added.
541         * Modules/modern-media-controls/images/macOS/airplay-placard@1x.png: Added.
542         * Modules/modern-media-controls/images/macOS/airplay-placard@2x.png: Added.
543         * Modules/modern-media-controls/images/macOS/pip-placard@1x.png: Added.
544         * Modules/modern-media-controls/images/macOS/pip-placard@2x.png: Added.
545
546 2016-10-10  Chris Dumez  <cdumez@apple.com>
547
548         Add support for Navigator.languages attribute
549         https://bugs.webkit.org/show_bug.cgi?id=163220
550
551         Reviewed by Darin Adler.
552
553         Add support for Navigator.languages attribute:
554         - https://html.spec.whatwg.org/#navigatorlanguage
555
556         Firefox and Chrome already support this.
557
558         Currently, we always return a single language for privacy reasons so
559         this API does not actually bring anything new besides interoperability
560         with other browsers and compliance with the HTML specification.
561
562         No new tests, rebaselined existing tests.
563
564         * page/NavigatorBase.cpp:
565         (WebCore::NavigatorBase::languages):
566         * page/NavigatorBase.h:
567         * page/NavigatorLanguage.idl:
568
569 2016-10-10  Brent Fulgham  <bfulgham@apple.com>
570
571         [Win][Direct2D] Implement dashed and dotted border line drawing
572         https://bugs.webkit.org/show_bug.cgi?id=163235
573
574         Reviewed by Alex Christensen.
575
576         Covered by existing fast/border tests.
577
578         * platform/graphics/GraphicsContext.cpp: Use custom 'setPlatformStrokeStyle' for D2D.
579         * platform/graphics/Path.cpp:
580         (WebCore::Path::length): Don't use default implementation for Direct2D.
581         * platform/graphics/win/GraphicsContextDirect2D.cpp:
582         (WebCore::GraphicsContextPlatformPrivate::brushWithColor): Initialize pointer to nullptr.
583         (WebCore::GraphicsContext::drawRect): Use proper stroke style.
584         (WebCore::GraphicsContextPlatformPrivate::setLineCap): Added.
585         (WebCore::GraphicsContextPlatformPrivate::setLineJoin): Added.
586         (WebCore::GraphicsContextPlatformPrivate::setStrokeStyle): Added.
587         (WebCore::GraphicsContextPlatformPrivate::setMiterLimit): Added.
588         (WebCore::GraphicsContextPlatformPrivate::setDashOffset): Added.
589         (WebCore::GraphicsContextPlatformPrivate::setPatternWidth): Added.
590         (WebCore::GraphicsContextPlatformPrivate::setPatternOffset): Added.
591         (WebCore::GraphicsContextPlatformPrivate::setStrokeThickness): Added.
592         (WebCore::GraphicsContextPlatformPrivate::setDashes): Added.
593         (WebCore::GraphicsContextPlatformPrivate::recomputeStrokeStyle): Added.
594         (WebCore::GraphicsContextPlatformPrivate::strokeStyle): Added.
595         (WebCore::GraphicsContext::drawLine): Use proper stroke style.
596         (WebCore::GraphicsContext::drawEllipse): Ditto.
597         (WebCore::GraphicsContext::drawPath): Ditto.
598         (WebCore::GraphicsContext::strokePath): Ditto.
599         (WebCore::GraphicsContext::setPlatformStrokeStyle): Added.
600         (WebCore::GraphicsContext::setMiterLimit): Tell D2D context about miter limit.
601         (WebCore::GraphicsContext::setLineCap): Ditto for line cap.
602         (WebCore::GraphicsContext::setLineDash): Ditto for dashes.
603         (WebCore::GraphicsContext::setLineJoin): Ditto for join style.
604         (WebCore::GraphicsContext::setPlatformStrokeThickness): Ditto for stroke thickness.
605         (WebCore::GraphicsContext::platformStrokeEllipse): Use proper stroke style.
606         * platform/graphics/win/GraphicsContextPlatformPrivateDirect2D.h:
607         * platform/graphics/win/PathDirect2D.cpp:
608         (WebCore::Path::currentPoint): Zero-initialize a value.
609         (WebCore::Path::length): Added.
610
611 2016-10-10  Chris Dumez  <cdumez@apple.com>
612
613         Update ProgressEvent to stop using legacy [ConstructorTemplate=Event]
614         https://bugs.webkit.org/show_bug.cgi?id=163221
615
616         Reviewed by Darin Adler.
617
618         Update ProgressEvent to stop using legacy [ConstructorTemplate=Event]
619         and use a regular constructor as in the specification:
620         - https://xhr.spec.whatwg.org/#firing-events-using-the-progressevent-interface
621
622         * dom/ProgressEvent.cpp:
623         (WebCore::ProgressEvent::ProgressEvent):
624         * dom/ProgressEvent.h:
625         (WebCore::ProgressEvent::create):
626         * dom/ProgressEvent.idl:
627
628 2016-10-10  Wenson Hsieh  <wenson_hsieh@apple.com>
629
630         Address some review feedback from r206979 and r207010
631         https://bugs.webkit.org/show_bug.cgi?id=163236
632
633         Reviewed by Tim Horton.
634
635         In TypingCommand.h, some methods on TypingCommand should be marked as final to reflect the fact that they
636         override methods in CompositeEditCommand. Also, HTMLFormControlElement::dispatchFormControlInputEvent does not
637         need to specify HTMLElement::dispatchInputEvent() when calling dispatchInputEvent().
638
639         No new tests, since there is no behavior change.
640
641         * editing/TypingCommand.h:
642         * html/HTMLFormControlElement.cpp:
643         (WebCore::HTMLFormControlElement::dispatchFormControlInputEvent):
644
645 2016-10-10  Chris Dumez  <cdumez@apple.com>
646
647         Update MessageEvent to stop using legacy [ConstructorTemplate=Event]
648         https://bugs.webkit.org/show_bug.cgi?id=163187
649
650         Reviewed by Darin Adler.
651
652         Update MessageEvent to stop using legacy [ConstructorTemplate=Event] and
653         use a regular constructor as in the specification:
654         - https://html.spec.whatwg.org/multipage/comms.html#the-messageevent-interfaces
655
656         No new tests, updated existing test.
657
658         * bindings/js/JSDOMBinding.h:
659         (WebCore::toRefPtrNativeArray):
660         * bindings/js/JSDOMConvert.h:
661         (WebCore::convertWrapperTypeSequence):
662         (WebCore::convertWrapperType): Deleted.
663         * bindings/scripts/CodeGeneratorJS.pm:
664         (GenerateDefaultValue):
665         (GenerateDictionaryImplementationContent):
666         (GetNativeType):
667         * dom/MessageEvent.cpp:
668         (WebCore::MessageEvent::MessageEvent):
669         (WebCore::MessageEvent::create):
670         (WebCore::MessageEvent::trySerializeData):
671         (WebCore::MessageEvent::createForBindings): Deleted.
672         (WebCore::MessageEvent::initMessageEvent): Deleted.
673         * dom/MessageEvent.h:
674         * dom/MessageEvent.idl:
675
676 2016-10-10  Antoine Quint  <graouts@apple.com>
677
678         [Modern Media Controls] Buttons
679         https://bugs.webkit.org/show_bug.cgi?id=163109
680         <rdar://problem/28668954>
681
682         Reviewed by Dean Jackson.
683
684         We introduce specific IconButton subclasses for the various buttons we will be using
685         in media controls on macOS (inline and fullscreen) and iOS. One class, StartButton, is
686         a subclass of Button and not IconButton because we're only interested in having it display
687         an <img> element rather than use a mask and requires additional DOM structure.
688
689         Tests: media/modern-media-controls/airplay-button/airplay-button-on.html
690                media/modern-media-controls/airplay-button/airplay-button.html
691                media/modern-media-controls/aspect-ratio-button/aspect-ratio-button.html
692                media/modern-media-controls/forward-button/forward-button.html
693                media/modern-media-controls/fullscreen-button/fullscreen-button.html
694                media/modern-media-controls/mute-button/mute-button.html
695                media/modern-media-controls/pip-button/pip-button.html
696                media/modern-media-controls/play-pause-button/play-pause-button.html
697                media/modern-media-controls/rewind-button/rewind-button.html
698                media/modern-media-controls/skip-back-button/skip-back-button.html
699                media/modern-media-controls/start-button/start-button.html
700                media/modern-media-controls/tracks-button/tracks-button.html
701
702         * Modules/modern-media-controls/controls/airplay-button.css:
703         (button.airplay.on):
704         * Modules/modern-media-controls/controls/airplay-button.js:
705         (AirplayButton):
706         (AirplayButton.prototype.set on):
707         * Modules/modern-media-controls/controls/aspect-ratio-button.js:
708         (AspectRatioButton):
709         (AspectRatioButton.prototype.get scalesToFill):
710         (AspectRatioButton.prototype.set scalesToFill):
711         * Modules/modern-media-controls/controls/forward-button.js:
712         (ForwardButton):
713         * Modules/modern-media-controls/controls/fullscreen-button.js:
714         (FullscreenButton):
715         * Modules/modern-media-controls/controls/icon-button.js:
716         * Modules/modern-media-controls/controls/icon-service.js:
717         * Modules/modern-media-controls/controls/mute-button.js:
718         (MuteButton):
719         (MuteButton.prototype.get muted):
720         (MuteButton.prototype.set muted):
721         * Modules/modern-media-controls/controls/pip-button.js:
722         (PiPButton):
723         * Modules/modern-media-controls/controls/play-pause-button.js:
724         (PlayPauseButton):
725         (PlayPauseButton.prototype.get playing):
726         (PlayPauseButton.prototype.set playing):
727         * Modules/modern-media-controls/controls/rewind-button.js:
728         (RewindButton):
729         * Modules/modern-media-controls/controls/skip-back-button.js:
730         (SkipBackButton):
731         * Modules/modern-media-controls/controls/start-button.js:
732         (StartButton):
733         * Modules/modern-media-controls/controls/tracks-button.js:
734         (TracksButton):
735         * Modules/modern-media-controls/images/iOS/airplay@1x.png: Added.
736         * Modules/modern-media-controls/images/iOS/airplay@2x.png: Added.
737         * Modules/modern-media-controls/images/iOS/enter-fullscreen@1x.png: Added.
738         * Modules/modern-media-controls/images/iOS/enter-fullscreen@2x.png: Added.
739         * Modules/modern-media-controls/images/iOS/enter-fullscreen@3x.png: Added.
740         * Modules/modern-media-controls/images/iOS/interval-skip-back@1x.png: Added.
741         * Modules/modern-media-controls/images/iOS/interval-skip-back@2x.png: Added.
742         * Modules/modern-media-controls/images/iOS/interval-skip-back@3x.png: Added.
743         * Modules/modern-media-controls/images/iOS/pause@1x.png: Added.
744         * Modules/modern-media-controls/images/iOS/pip-in@1x.png: Added.
745         * Modules/modern-media-controls/images/iOS/pip-in@2x.png: Added.
746         * Modules/modern-media-controls/images/iOS/pip-in@3x.png: Added.
747         * Modules/modern-media-controls/images/iOS/play@1x.png: Added.
748         * Modules/modern-media-controls/images/iOS/play@2x.png: Added.
749         * Modules/modern-media-controls/images/iOS/play@3x.png: Added.
750         * Modules/modern-media-controls/images/iOS/start@1x.png: Added.
751         * Modules/modern-media-controls/images/macOS/airplay-fullscreen@1x.png: Added.
752         * Modules/modern-media-controls/images/macOS/airplay-fullscreen@2x.png: Added.
753         * Modules/modern-media-controls/images/macOS/airplay@1x.png: Added.
754         * Modules/modern-media-controls/images/macOS/airplay@2x.png: Added.
755         * Modules/modern-media-controls/images/macOS/enter-fullscreen@1x.png: Added.
756         * Modules/modern-media-controls/images/macOS/enter-fullscreen@2x.png: Added.
757         * Modules/modern-media-controls/images/macOS/exit-fullscreen@1x.png: Added.
758         * Modules/modern-media-controls/images/macOS/exit-fullscreen@2x.png: Added.
759         * Modules/modern-media-controls/images/macOS/forward@1x.png: Added.
760         * Modules/modern-media-controls/images/macOS/forward@2x.png: Added.
761         * Modules/modern-media-controls/images/macOS/interval-skip-back@1x.png: Added.
762         * Modules/modern-media-controls/images/macOS/interval-skip-back@2x.png: Added.
763         * Modules/modern-media-controls/images/macOS/media-selection-fullscreen@1x.png: Added.
764         * Modules/modern-media-controls/images/macOS/media-selection-fullscreen@2x.png: Added.
765         * Modules/modern-media-controls/images/macOS/media-selection@1x.png: Added.
766         * Modules/modern-media-controls/images/macOS/media-selection@2x.png: Added.
767         * Modules/modern-media-controls/images/macOS/pip-in@1x.png: Added.
768         * Modules/modern-media-controls/images/macOS/pip-in@2x.png: Added.
769         * Modules/modern-media-controls/images/macOS/play-fullscreen@1x.png: Added.
770         * Modules/modern-media-controls/images/macOS/play-fullscreen@2x.png: Added.
771         * Modules/modern-media-controls/images/macOS/play@1x.png: Added.
772         * Modules/modern-media-controls/images/macOS/play@2x.png: Added.
773         * Modules/modern-media-controls/images/macOS/rewind@1x.png: Added.
774         * Modules/modern-media-controls/images/macOS/rewind@2x.png: Added.
775         * Modules/modern-media-controls/images/macOS/scale-to-fill@1x.png: Added.
776         * Modules/modern-media-controls/images/macOS/scale-to-fill@2x.png: Added.
777         * Modules/modern-media-controls/images/macOS/scale-to-fit@1x.png: Added.
778         * Modules/modern-media-controls/images/macOS/scale-to-fit@2x.png: Added.
779         * Modules/modern-media-controls/images/macOS/volume-mute@1x.png: Added.
780         * Modules/modern-media-controls/images/macOS/volume-mute@2x.png: Added.
781         * Modules/modern-media-controls/images/macOS/volume@1x.png: Added.
782         * Modules/modern-media-controls/images/macOS/volume@2x.png: Added.
783
784 2016-10-10  Nan Wang  <n_wang@apple.com>
785
786         AX: Update AXPlaceHolder algorithm
787         https://bugs.webkit.org/show_bug.cgi?id=163229
788
789         Reviewed by Chris Fleizach.
790
791         From https://w3c.github.io/html-aam/
792         When the placeholder and aria-placeholder attributes are both present, we
793         should expose the value of the placeholder attribute. Updated the algorithm
794         for that.
795
796         Changes are covered in the modified test.
797
798         * accessibility/AccessibilityObject.cpp:
799         (WebCore::AccessibilityObject::placeholderValue):
800
801 2016-10-10  Yusuke Suzuki  <utatane.tea@gmail.com>
802
803         [DOMJIT] Implement Node accessors in DOMJIT
804         https://bugs.webkit.org/show_bug.cgi?id=163005
805
806         Reviewed by Filip Pizlo.
807
808         This patch implements DOMJIT accessors in WebCore. We plan to offer 2 things in DOMJIT.
809
810             1. Hand written DOM inlining.
811
812             We inject DOMJIT::Patchpoint compiler into JSC. And JSC uses this to inline DOM operation,
813             and drop type checks. Since the operation is fully inlined, potentially it has large
814             performance boost. Note that CSS Selector JIT compiler already does the similar things:
815             accessing parentNode etc. directly by using offsets.
816
817             2. Exposing signature information.
818
819             We will offer function type signature by some representation and pass it to JSC.
820             JSC will use to drop type checks. Since IDL code generator already knows this,
821             we can automatically generate such a information. Since we don't perform any inlining,
822             the performance boost may be limited. But it's worth doing.
823
824         This patch implements the first one, hand written DOM inlining facility. We add a new IDL attribute,
825         "DOMJIT". This means that "This readonly attribute have a DOMJIT patchpoint compiler".
826         We annotate several accessors at first. "firstChild", "lastChild", "nextSibling", "previousSibling",
827         and "parentNode". And we implement DOMJIT::Patchpoint for that in JSNodeDOMJIT.cpp.
828
829         This patchpoint will be integrated into JSC's DFG and FTL. And these tiers can drop type checks and
830         inline the entire code of these accessors. JSC compiler still does not know much about DOM. And WebCore
831         does not know much about each tier of JSC. WebCore just offers the generic patchpoints and they are
832         used in both DFG and FTL tiers. The layer separation is still kept.
833
834         While very small microbenchmark[1] shows performance benefit, still we cannot improve DOM
835         benchmarks due to the lack of following implementations. Once the following implementations
836         are implemented, we will get performance boost.
837
838         1. Super polymorphic sites.
839
840             This inlining is super effective if we run some microbenchmarks. However, Dromaeo does not
841             show so much performance benefit. This is because Dromaeo's dom-traverse.html is super
842             polymorphic call site where JSC gives up optimization. For example, in the following
843             dromaeo's benchmark, we can see so various DOM nodes at the `cur.firstChild` site, like,
844             HTMLDivElement, HTMLAnchorElement, Text, Comment etc. JSC gives up optimization since we
845             encounter so many Structures. This should be optimized since they share the large part of
846             prototype-chain and they hit the exactly same CustomGetter, Node.prototype.firstChild.
847             We will handle this and when we optimize it, this DOMJIT works well on Dromaeo.
848
849                 test( "firstChild", function(){
850                     var nodes = document.body.childNodes, nl = nodes.length;
851
852                     for ( var i = 0; i < num; i++ ) {
853                         for ( var j = 0; j < nl; j++ ) {
854                             var cur = nodes[j];
855                             while ( cur )
856                                 cur = cur.firstChild;
857                             ret = cur;
858                         }
859                     }
860                 });
861
862         2. Emit code in IC.
863
864             Currently, we only optimize DOMJIT accessors in DFG and FTL. However, we should leverage
865             this DOMJIT::Patchpoint to emit inlined code even in Inline Caching (IC). We will emit
866             CheckDOM's code for IC's guard phase, and emit CallDOM's code for IC's get phase. This
867             offers performance benefit even if we live in baseline JIT code. And this should be easy.
868
869         [1]: With the following one, we can see 3x improvement (26ms v.s. 80ms).
870
871             var element = document.getElementsByTagName('div')[3];
872             var before = Date.now();
873             for (var i = 0; i < 1e7; ++i)
874                 element.firstChild;
875             console.log(Date.now() - before);
876
877         * CMakeLists.txt:
878         * ForwardingHeaders/domjit/DOMJITGetterSetter.h:
879         * ForwardingHeaders/domjit/DOMJITPatchpoint.h: Copied from Source/JavaScriptCore/domjit/DOMJITSlowPathCalls.h.
880         * ForwardingHeaders/domjit/DOMJITPatchpointParams.h: Copied from Source/JavaScriptCore/domjit/DOMJITSlowPathCalls.h.
881         * WebCore.xcodeproj/project.pbxproj:
882         * bindings/js/JSDOMGlobalObject.h:
883         * bindings/js/JSDOMWrapper.h:
884         (WebCore::JSDOMWrapper::offsetOfWrapped):
885         (WebCore::JSDOMWrapper::wrapped): Deleted.
886         * bindings/js/ScriptWrappable.h:
887         (WebCore::ScriptWrappable::offsetOfWrapper):
888         * bindings/scripts/CodeGeneratorJS.pm:
889         (GetJSCAttributesForAttribute):
890         (GenerateHeader):
891         (GeneratePropertiesHashTable):
892         (GenerateImplementation):
893         (GenerateHashTableValueArray):
894         * bindings/scripts/IDLAttributes.txt:
895         * dom/ContainerNode.h:
896         (WebCore::ContainerNode::lastChildMemoryOffset):
897         (WebCore::ContainerNode::lastChild): Deleted.
898         * dom/Node.h:
899         (WebCore::Node::flagIsContainer):
900         (WebCore::Node::flagIsText): Deleted.
901         * dom/Node.idl:
902         * domjit/DOMJITHelpers.h: Added.
903         (WebCore::DOMJITHelpers::branchIfNotWorldIsNormal):
904         (WebCore::DOMJITHelpers::branchIfNotWeakIsLive):
905         (WebCore::DOMJITHelpers::tryLookUpWrapperCache):
906         (WebCore::DOMJITHelpers::toWrapper):
907         (WebCore::DOMJITHelpers::branchIfDOMWrapper):
908         (WebCore::DOMJITHelpers::branchIfNotDOMWrapper):
909         (WebCore::DOMJITHelpers::branchIfNode):
910         (WebCore::DOMJITHelpers::branchIfNotNode):
911         (WebCore::DOMJITHelpers::branchIfElement):
912         (WebCore::DOMJITHelpers::branchIfNotElement):
913         (WebCore::DOMJITHelpers::branchIfDocumentWrapper):
914         (WebCore::DOMJITHelpers::branchIfNotDocumentWrapper):
915         * domjit/JSNodeDOMJIT.cpp: Added.
916         (WebCore::toWrapperSlow):
917         (WebCore::createCallDOMForOffsetAccess):
918         (WebCore::checkNode):
919         (WebCore::NodeFirstChildDOMJIT::checkDOM):
920         (WebCore::NodeFirstChildDOMJIT::callDOM):
921         (WebCore::NodeLastChildDOMJIT::checkDOM):
922         (WebCore::NodeLastChildDOMJIT::callDOM):
923         (WebCore::NodeNextSiblingDOMJIT::checkDOM):
924         (WebCore::NodeNextSiblingDOMJIT::callDOM):
925         (WebCore::NodePreviousSiblingDOMJIT::checkDOM):
926         (WebCore::NodePreviousSiblingDOMJIT::callDOM):
927         (WebCore::NodeParentNodeDOMJIT::checkDOM):
928         (WebCore::NodeParentNodeDOMJIT::callDOM):
929
930 2016-10-10  Wenson Hsieh  <wenson_hsieh@apple.com>
931
932         Support InputEvent.data for the new InputEvent spec
933         https://bugs.webkit.org/show_bug.cgi?id=163113
934         <rdar://problem/28681935>
935
936         Reviewed by Darin Adler.
937
938         Introduces InputEvent.data, a string attribute that, if non-null, indicates the text to be inserted by an input
939         event. For text areas and text inputs, the 'insertText', 'insertFromPaste', 'insertFromDrop', and
940         'insertReplacementText' input types should cause subsequent `input` and `beforeinput` events to have non-null
941         data. However, for contenteditable areas, only 'insertText' leads to having data in resulting InputEvents.
942
943         To implement this, we introduce a new virtual method, CompositeEditCommand::inputEventData, which gives
944         composite editing commands the chance to vend a data string for input events they might fire (by default, this
945         is null).
946
947         Tests: fast/events/input-events-paste-data.html
948                fast/events/input-events-typing-data.html
949
950         * dom/InputEvent.cpp:
951         (WebCore::InputEvent::InputEvent):
952         * dom/InputEvent.h:
953         * dom/InputEvent.idl:
954
955         Currently, our InputEventInit struct is wrong. According to the UI-Events spec at www.w3.org/TR/uievents/, the
956         init struct for an InputEvent should contain a data string (added in this patch) as well as an isComposing flag
957         (to be added in a future patch along with composition support). While adding support for the data attribute, we
958         tweak the InputEvent IDL and headers slightly to adjust for this.
959
960         * dom/Node.cpp:
961         (WebCore::Node::dispatchInputEvent):
962         * dom/Node.h:
963         * editing/CompositeEditCommand.h:
964         (WebCore::CompositeEditCommand::inputEventData):
965         * editing/EditCommand.cpp:
966         (WebCore::EditCommand::isEditingTextAreaOrTextInput):
967         * editing/EditCommand.h:
968         * editing/Editor.cpp:
969         (WebCore::dispatchBeforeInputEvent):
970         (WebCore::dispatchInputEvent):
971         (WebCore::dispatchBeforeInputEvents):
972         (WebCore::dispatchInputEvents):
973         (WebCore::Editor::willApplyEditing):
974         (WebCore::Editor::appliedEditing):
975         (WebCore::Editor::setBaseWritingDirection):
976         (WebCore::Editor::computeAndSetTypingStyle):
977         * editing/ReplaceRangeWithTextCommand.cpp:
978         (WebCore::ReplaceRangeWithTextCommand::inputEventData):
979         * editing/ReplaceRangeWithTextCommand.h:
980         * editing/ReplaceSelectionCommand.cpp:
981         (WebCore::ReplaceSelectionCommand::inputEventData):
982         * editing/ReplaceSelectionCommand.h:
983         * editing/SpellingCorrectionCommand.cpp:
984         (WebCore::SpellingCorrectionCommand::inputEventData):
985         * editing/SpellingCorrectionCommand.h:
986         * editing/TypingCommand.cpp:
987         (WebCore::TypingCommand::TypingCommand):
988         (WebCore::TypingCommand::inputEventData):
989         (WebCore::TypingCommand::willAddTypingToOpenCommand):
990         (WebCore::TypingCommand::insertTextRunWithoutNewlines):
991         * editing/TypingCommand.h:
992         * html/HTMLFormControlElement.cpp:
993         (WebCore::HTMLFormControlElement::dispatchFormControlInputEvent):
994         * html/HTMLInputElement.cpp:
995         (WebCore::HTMLInputElement::setEditingValue):
996         (WebCore::HTMLInputElement::setValueFromRenderer):
997         * html/HTMLSelectElement.cpp:
998         (WebCore::HTMLSelectElement::listBoxOnChange):
999         (WebCore::HTMLSelectElement::dispatchChangeEventForMenuList):
1000
1001 2016-10-10  Commit Queue  <commit-queue@webkit.org>
1002
1003         Unreviewed, rolling out r206972.
1004         https://bugs.webkit.org/show_bug.cgi?id=163227
1005
1006         Making EWS flaky (Requested by bfulgham_ on #webkit).
1007
1008         Reverted changeset:
1009
1010         "[CMake] CMake does not support the dep files for implicit
1011         dependency"
1012         https://bugs.webkit.org/show_bug.cgi?id=161433
1013         http://trac.webkit.org/changeset/206972
1014
1015 2016-10-10  Darin Adler  <darin@apple.com>
1016
1017         Move media source from legacy to new DOM exceptions
1018         https://bugs.webkit.org/show_bug.cgi?id=163201
1019
1020         Reviewed by Chris Dumez.
1021
1022         * Modules/mediasource/MediaSource.cpp: Removed unneeded includes.
1023         (WebCore::MediaSource::create): Use auto.
1024         (WebCore::MediaSource::MediaSource): Initialize m_mediaElement in class definition.
1025         (WebCore::MediaSource::setLiveSeekableRange): Use ExceptionOr.
1026         (WebCore::MediaSource::clearLiveSeekableRange): Ditto.
1027         (WebCore::MediaSource::setDuration): Ditto.
1028         (WebCore::MediaSource::setDurationInternal): Ditto.
1029         (WebCore::MediaSource::endOfStream): Ditto.
1030         (WebCore::MediaSource::streamEndedWithError): Use bufferedInternal.
1031         (WebCore::MediaSource::addSourceBuffer): Use ExceptionOr.
1032         (WebCore::MediaSource::removeSourceBuffer): Ditto.
1033         (WebCore::MediaSource::detachFromElement): Use removeSourceBuffer
1034         without IGNORE_EXCEPTION since that is now the default behavior.
1035         (WebCore::MediaSource::activeRanges): Use bufferedInternal.
1036         (WebCore::MediaSource::createSourceBufferPrivate): Use ExceptionOr.
1037
1038         * Modules/mediasource/MediaSource.h: Removed unneeded includes.
1039         Made more things private and also private rather than protected.
1040
1041         * Modules/mediasource/MediaSource.idl: Use non-legacy exceptions.
1042
1043         * Modules/mediasource/SourceBuffer.cpp:
1044         (WebCore::SourceBuffer::buffered): Use ExceptionOr.
1045         (WebCore::SourceBuffer::setTimestampOffset): Ditto.
1046         (WebCore::SourceBuffer::setAppendWindowStart): Ditto.
1047         (WebCore::SourceBuffer::setAppendWindowEnd): Ditto.
1048         (WebCore::SourceBuffer::appendBuffer): Ditto.
1049         (WebCore::SourceBuffer::abort): Ditto.
1050         (WebCore::SourceBuffer::remove): Ditto.
1051         (WebCore::SourceBuffer::appendBufferInternal): Ditto.
1052         (WebCore::SourceBuffer::setMode): Ditto.
1053
1054         * Modules/mediasource/SourceBuffer.h: Removed unneeded includes.
1055         Updated for above changes. Made more things private.
1056
1057         * Modules/mediasource/SourceBuffer.idl: Use non-legacy exceptions.
1058
1059         * platform/graphics/gstreamer/WebKitMediaSourceGStreamer.h:
1060         Added now-needed include of MediaSourcePrivate.h.
1061
1062 2016-10-10  Jer Noble  <jer.noble@apple.com>
1063
1064         Address flaky airplay-* LayouTests
1065         https://bugs.webkit.org/show_bug.cgi?id=163044
1066
1067         Reviewed by Brent Fulgham.
1068
1069         Two separate problems conspired to make airplay tests a bit flaky:
1070
1071         For one, when the HTMLMediaElement clears its MediaPlayer, it won't necessarily notify
1072         clients that it has stopped playing to a wireless target. The WebMediaSessionManager may
1073         eventually cause this value to reset, but it's asynchronous, and may fire after the next
1074         test starts. Reset this state explicitly.
1075
1076         For two, the state of the mock playback target picker was not being reset between test
1077         invocations.
1078
1079         * html/HTMLMediaElement.cpp:
1080         (WebCore::HTMLMediaElement::clearMediaPlayer):
1081         * testing/Internals.cpp:
1082         (WebCore::Internals::resetToConsistentState):
1083
1084 2016-10-10  Brent Fulgham  <bfulgham@apple.com>
1085
1086         Correct typo in comment (patining -> painting).
1087
1088         * platform/graphics/GraphicsContext.cpp:
1089         (WebCore::GraphicsContext::centerLineAndCutOffCorners):
1090
1091 2016-10-10  Brent Fulgham  <bfulgham@apple.com>
1092
1093         Reduce code duplication between CG, Cairo, and Direct2D
1094         https://bugs.webkit.org/show_bug.cgi?id=163157
1095
1096         Reviewed by Darin Adler.
1097
1098         Move a number of routines that have been copied-and-pasted to different
1099         platform files into the main GraphicsContext.cpp file.
1100
1101         No new tests because there is no change in behavior.
1102
1103         * platform/graphics/GraphicsContext.cpp:
1104         (WebCore::GraphicsContext::dashedLineCornerWidthForStrokeWidth): Added.
1105         (WebCore::GraphicsContext::dashedLinePatternWidthForStrokeWidth): Added.
1106         (WebCore::GraphicsContext::dashedLinePatternOffsetForPatternAndStrokeWidth): Added.
1107         (WebCore::GraphicsContext::centerLineAndCutOffCorners): Added.
1108         * platform/graphics/GraphicsContext.h:
1109         * platform/graphics/cairo/GraphicsContextCairo.cpp:
1110         (WebCore::GraphicsContext::drawLine): Call new helper function.
1111         * platform/graphics/cg/GraphicsContextCG.cpp:
1112         (WebCore::GraphicsContext::drawLine): Ditto.
1113         * platform/graphics/win/GraphicsContextDirect2D.cpp:
1114         (WebCore::GraphicsContext::drawLine): Ditto.
1115
1116 2016-10-10  Carlos Garcia Campos  <cgarcia@igalia.com>
1117
1118         REGRESSION(r206731): [SOUP] Network process crash in gotHeadersCallback
1119         https://bugs.webkit.org/show_bug.cgi?id=163170
1120
1121         Reviewed by Michael Catanzaro.
1122
1123         Do not assume NetworkingContext is non-null and valid before using it.
1124
1125         * platform/network/soup/ResourceHandleSoup.cpp:
1126         (WebCore::gotHeadersCallback):
1127         (WebCore::ResourceHandle::didReceiveAuthenticationChallenge):
1128
1129 2016-10-10  Youenn Fablet  <youenn@apple.com>
1130
1131         Images and scripts should be said as clean based on CachedResource::isCORSSameOrigin
1132         https://bugs.webkit.org/show_bug.cgi?id=162390
1133
1134         Reviewed by Darin Adler.
1135
1136         No observable change of behavior.
1137
1138         Renaming CachedResource::isClean to isCORSSameOrigin to match html spec terminology.
1139         Making use of it to check whether images taint canvas and whether script errors should be sanitized.
1140
1141         Some asserts are added to ensure that a resource fetched using one origin is not reused for another origin.
1142
1143         * dom/ScriptExecutionContext.cpp:
1144         (WebCore::ScriptExecutionContext::sanitizeScriptError):
1145         * html/HTMLLinkElement.cpp:
1146         (WebCore::HTMLLinkElement::initializeStyleSheet):
1147         * html/canvas/CanvasRenderingContext.cpp:
1148         (WebCore::CanvasRenderingContext::wouldTaintOrigin):
1149         * loader/cache/CachedImage.cpp:
1150         (WebCore::CachedImage::isOriginClean):
1151         * loader/cache/CachedResource.cpp:
1152         (WebCore::CachedResource::isCORSSameOrigin):
1153         * loader/cache/CachedResource.h:
1154
1155 2016-10-10  Youenn Fablet  <youenn@apple.com>
1156
1157         [Fetch API] Memory cache should not bypass redirect mode
1158         https://bugs.webkit.org/show_bug.cgi?id=162959
1159
1160         Reviewed by Darin Adler.
1161
1162         Test: http/tests/fetch/redirectmode-and-preload.html
1163
1164         Ensure reloading of resources if the redirect modes are different between request and cached resource, and
1165         cached resource has redirections.
1166
1167         As a temporary workaround, we activate resource update for raw resources in
1168         shouldUpdateCachedResourceWithCurrentRequest but disable it in canUpdateFromResource.
1169         This allows handling reloading of resources with different redirection mode in canUpdateFromResource.
1170
1171         A future patch should allow loading cached raw resources from other cached raw resources.
1172
1173         * loader/cache/CachedResource.h:
1174         (WebCore::CachedResource::hasRedirections):
1175         * loader/cache/CachedResourceLoader.cpp:
1176         (WebCore::CachedResourceLoader::shouldUpdateCachedResourceWithCurrentRequest):
1177         (WebCore::canUpdateFromResource):
1178         (WebCore::CachedResourceLoader::updateCachedResourceWithCurrentRequest):
1179
1180 2016-10-10  Youenn Fablet  <youenn@apple.com>
1181
1182         Attribute getter binding generated code should use more references
1183         https://bugs.webkit.org/show_bug.cgi?id=163179
1184
1185         Reviewed by Darin Adler.
1186
1187         No change of behavior.
1188
1189         Using more references in attribute getter generated code since BindingCaller::attribute can do the
1190         pointer-to-references checks once for all.
1191
1192         Needed to update GenerateCallWith and NativeToJSValue to handle the case where references (attribute getters) or
1193         pointers (methods and attribute setters) are to be used.
1194         Future refactoring should allign methods/attribute setters to attribute getters.
1195
1196         * bindings/js/JSDOMBinding.h:
1197         (WebCore::BindingCaller::attribute):
1198         * bindings/scripts/CodeGeneratorJS.pm:
1199         (GenerateImplementation):
1200         (GenerateCallWith):
1201         (NativeToJSValue):
1202         (JSValueToNative):
1203         * bindings/scripts/test/JS/JSTestActiveDOMObject.cpp:
1204         * bindings/scripts/test/JS/JSTestEventConstructor.cpp:
1205         * bindings/scripts/test/JS/JSTestException.cpp:
1206         * bindings/scripts/test/JS/JSTestGlobalObject.cpp:
1207         * bindings/scripts/test/JS/JSTestInterface.cpp:
1208         * bindings/scripts/test/JS/JSTestJSBuiltinConstructor.cpp:
1209         * bindings/scripts/test/JS/JSTestNode.cpp:
1210         * bindings/scripts/test/JS/JSTestNondeterministic.cpp:
1211         * bindings/scripts/test/JS/JSTestObj.cpp:
1212         * bindings/scripts/test/JS/JSattribute.cpp:
1213
1214 2016-10-10  Youenn Fablet  <youenn@apple.com>
1215
1216         Fix Mac Win build after https://trac.webkit.org/changeset/206966
1217         https://bugs.webkit.org/show_bug.cgi?id=163199
1218
1219         Unreviewed.
1220
1221         * bindings/js/JSDOMBinding.h: Marking rejectPromiseWithGetterTypeError as WEBCORE_EXPORT.
1222
1223 2016-10-09  Antti Koivisto  <antti@apple.com>
1224
1225         Enable optimized stylesheet updates in shadow trees
1226         https://bugs.webkit.org/show_bug.cgi?id=163180
1227
1228         Reviewed by Darin Adler.
1229
1230         When we get a new stylesheet (for example when load completes) we invalidate only
1231         those elements in DOM that are affected by the new sheet. This patch makes the
1232         optimization also work in shadow trees.
1233
1234         Test: fast/shadow-dom/scoped-style-invalidation.html
1235
1236         * css/StyleInvalidationAnalysis.cpp:
1237         (WebCore::StyleInvalidationAnalysis::invalidateStyle):
1238         * css/StyleInvalidationAnalysis.h:
1239         * dom/Document.cpp:
1240         (WebCore::Document::didRemoveAllPendingStylesheet):
1241         * style/StyleScope.cpp:
1242         (WebCore::Style::Scope::removePendingSheet):
1243         (WebCore::Style::Scope::analyzeStyleSheetChange):
1244         (WebCore::Style::Scope::updateActiveStyleSheets):
1245
1246 2016-10-10  Youenn Fablet  <youenn@apple.com>
1247
1248         Refactor binding generated casted-this checks for attribute setters
1249         https://bugs.webkit.org/show_bug.cgi?id=163181
1250
1251         Reviewed by Darin Adler.
1252
1253         No change of behavior.
1254         Covered by existing tests and binding expectations.
1255
1256         Adding support for attribute setter in BindingCaller.
1257         Updating binding generator to make use of it.
1258         Future refactoring should use more reference and rename castedThis to thisObject, like for getters.
1259
1260         * bindings/js/JSDOMBinding.h:
1261         (WebCore::BindingCaller::setAttribute):
1262         * bindings/scripts/CodeGeneratorJS.pm:
1263         (GenerateImplementation):
1264         * bindings/scripts/test/JS/JSTestInterface.cpp:
1265         * bindings/scripts/test/JS/JSTestJSBuiltinConstructor.cpp:
1266         * bindings/scripts/test/JS/JSTestNode.cpp:
1267         * bindings/scripts/test/JS/JSTestNondeterministic.cpp:
1268         * bindings/scripts/test/JS/JSTestObj.cpp:
1269         * bindings/scripts/test/JS/JSTestSerializedScriptValueInterface.cpp:
1270         * bindings/scripts/test/JS/JSTestTypedefs.cpp:
1271
1272 2016-10-09  Darin Adler  <darin@apple.com>
1273
1274         Move encrypted media from legacy to new DOM exceptions
1275         https://bugs.webkit.org/show_bug.cgi?id=163194
1276
1277         Reviewed by Youenn Fablet.
1278
1279         * Modules/encryptedmedia/CDM.cpp:
1280         (WebCore::CDM::createSession): Take a reference instead of a pointer.
1281         * Modules/encryptedmedia/CDM.h: Updated for above change.
1282
1283         * Modules/encryptedmedia/legacy/WebKitMediaKeySession.cpp:
1284         (WebCore::WebKitMediaKeySession::create): Take a reference instead of a pointer.
1285         (WebCore::WebKitMediaKeySession::MediaKeySession): Ditto.
1286         (WebCore::WebKitMediaKeySession::~MediaKeySession): Removed unneeded code that
1287         sets m_session to null.
1288         (WebCore::WebKitMediaKeySession::keyRequestTimerFired): Use auto.
1289         (WebCore::WebKitMediaKeySession::update): Use ExceptionOr.
1290         (WebCore::WebKitMediaKeySession::addKeyTimerFired): Use m_keys directly instead
1291         of calling the keys function.
1292         (WebCore::WebKitMediaKeySession::sendError): Set m_error directly instead of
1293         calling the setError function.
1294         (WebCore::WebKitMediaKeySession::mediaKeysStorageDirectory): Use auto.
1295         (WebCore::WebKitMediaKeySession::hasPendingActivity): Check m_session directly
1296         instead of writing !isClosed.
1297         (WebCore::WebKitMediaKeySession::setError): Deleted.
1298
1299         * Modules/encryptedmedia/legacy/WebKitMediaKeySession.h: Use pragma once. Removed
1300         unneeded includes. Changed create to take a reference instead of a pointer.
1301         Made most members and base classes private instead of public. Also removed
1302         a few now-unneeded functions. Made everything that was formerly protected
1303         private instead, since the two are the same in a final class.
1304
1305         * Modules/encryptedmedia/legacy/WebKitMediaKeySession.idl: Removed unneeded comments.
1306         Moved from MayThrowLegacyException to MayThrowException.
1307
1308         * Modules/encryptedmedia/legacy/WebKitMediaKeys.cpp:
1309         (WebCore::WebKitMediaKeys::create): Use ExceptionOr.
1310         (WebCore::WebKitMediaKeys::MediaKeys): Made argument be an rvalue reference.
1311         Also initialize m_mediaElement in the class definition.
1312         (WebCore::WebKitMediaKeys::~MediaKeys): Call detachKeys instead of setKeys(nullptr).
1313         (WebCore::WebKitMediaKeys::createSession): Use ExceptionOr. Also pass reference
1314         insteead of pointer to create. Also removed unneeded separate checks for null
1315         strings in code that already calls isEmpty.
1316         (WebCore::WebKitMediaKeys::isTypeSupported): Removed unneeded checks for null strings
1317         in code that already calls isEmpty.
1318         (WebCore::WebKitMediaKeys::cdmMediaPlayer): Tweaked a bit.
1319         (WebCore::WebKitMediaKeys::cachedKeyForKeyId): Use auto.
1320
1321         * Modules/encryptedmedia/legacy/WebKitMediaKeys.h: Use pragma once. Removed unneeded includes.
1322         Changed cdm() function to return a reference. Initialize m_mediaElement.
1323         Use private instead of protected.
1324
1325         * Modules/encryptedmedia/legacy/WebKitMediaKeys.idl: Use ConstructorMayThrowException
1326         and MayThrowException instead of the legacy versions.
1327
1328 2016-10-09  Zan Dobersek  <zdobersek@igalia.com>
1329
1330         ENABLE_LEGACY_ENCRYPTED_MEDIA interfaces should have a hard-coded WebKit prefix
1331         https://bugs.webkit.org/show_bug.cgi?id=162982
1332
1333         Reviewed by Jer Noble.
1334
1335         Have the Web-exposed interfaces guarded by ENABLE_LEGACY_ENCRYPTED_MEDIA also use
1336         the WebKit prefix in the implementations. This will prevent conflicts between
1337         interfaces with same names in both the legacy API and the future EME API.
1338
1339         Most of the interfaces in this legacy API already used the WebKit prefix when
1340         exposed via JS bindings. The only exception is MediaKeyNeededEvent, which gets
1341         prefixed in this patch.
1342
1343         The interface implementations for this legacy API are also moved under the
1344         Modules/encryptedmedia/legacy/ directory.
1345
1346         No new tests -- covered by existing tests (with the relevant changes reflected
1347         in the updated baselines).
1348
1349         * CMakeLists.txt:
1350         * DerivedSources.cpp:
1351         * DerivedSources.make:
1352         * Modules/encryptedmedia/CDM.cpp:
1353         * Modules/encryptedmedia/CDMSessionClearKey.cpp:
1354         (WebCore::CDMSessionClearKey::generateKeyRequest):
1355         (WebCore::CDMSessionClearKey::update):
1356         * Modules/encryptedmedia/legacy/WebKitMediaKeyMessageEvent.cpp: Renamed from Source/WebCore/Modules/encryptedmedia/MediaKeyMessageEvent.cpp.
1357         (WebCore::WebKitMediaKeyMessageEvent::WebKitMediaKeyMessageEvent):
1358         (WebCore::WebKitMediaKeyMessageEvent::~WebKitMediaKeyMessageEvent):
1359         (WebCore::WebKitMediaKeyMessageEvent::eventInterface):
1360         * Modules/encryptedmedia/legacy/WebKitMediaKeyMessageEvent.h: Renamed from Source/WebCore/Modules/encryptedmedia/MediaKeyMessageEvent.h.
1361         (WebCore::WebKitMediaKeyMessageEvent::create):
1362         (WebCore::WebKitMediaKeyMessageEvent::createForBindings):
1363         * Modules/encryptedmedia/legacy/WebKitMediaKeyMessageEvent.idl: Renamed from Source/WebCore/Modules/encryptedmedia/MediaKeyMessageEvent.idl.
1364         * Modules/encryptedmedia/legacy/WebKitMediaKeyNeededEvent.cpp: Renamed from Source/WebCore/Modules/encryptedmedia/MediaKeyNeededEvent.cpp.
1365         (WebCore::WebKitMediaKeyNeededEvent::WebKitMediaKeyNeededEvent):
1366         (WebCore::WebKitMediaKeyNeededEvent::~WebKitMediaKeyNeededEvent):
1367         (WebCore::WebKitMediaKeyNeededEvent::eventInterface):
1368         * Modules/encryptedmedia/legacy/WebKitMediaKeyNeededEvent.h: Renamed from Source/WebCore/Modules/encryptedmedia/MediaKeyNeededEvent.h.
1369         (WebCore::WebKitMediaKeyNeededEvent::create):
1370         (WebCore::WebKitMediaKeyNeededEvent::createForBindings):
1371         * Modules/encryptedmedia/legacy/WebKitMediaKeyNeededEvent.idl: Renamed from Source/WebCore/Modules/encryptedmedia/MediaKeyNeededEvent.idl.
1372         * Modules/encryptedmedia/legacy/WebKitMediaKeySession.cpp: Renamed from Source/WebCore/Modules/encryptedmedia/MediaKeySession.cpp.
1373         (WebCore::WebKitMediaKeySession::create):
1374         (WebCore::WebKitMediaKeySession::WebKitMediaKeySession):
1375         (WebCore::WebKitMediaKeySession::~WebKitMediaKeySession):
1376         (WebCore::WebKitMediaKeySession::setError):
1377         (WebCore::WebKitMediaKeySession::close):
1378         (WebCore::WebKitMediaKeySession::cachedKeyForKeyId):
1379         (WebCore::WebKitMediaKeySession::sessionId):
1380         (WebCore::WebKitMediaKeySession::generateKeyRequest):
1381         (WebCore::WebKitMediaKeySession::keyRequestTimerFired):
1382         (WebCore::WebKitMediaKeySession::update):
1383         (WebCore::WebKitMediaKeySession::addKeyTimerFired):
1384         (WebCore::WebKitMediaKeySession::sendMessage):
1385         (WebCore::WebKitMediaKeySession::sendError):
1386         (WebCore::WebKitMediaKeySession::mediaKeysStorageDirectory):
1387         (WebCore::WebKitMediaKeySession::hasPendingActivity):
1388         (WebCore::WebKitMediaKeySession::stop):
1389         (WebCore::WebKitMediaKeySession::activeDOMObjectName):
1390         (WebCore::WebKitMediaKeySession::canSuspendForDocumentSuspension):
1391         * Modules/encryptedmedia/legacy/WebKitMediaKeySession.h: Renamed from Source/WebCore/Modules/encryptedmedia/MediaKeySession.h.
1392         * Modules/encryptedmedia/legacy/WebKitMediaKeySession.idl: Renamed from Source/WebCore/Modules/encryptedmedia/MediaKeySession.idl.
1393         * Modules/encryptedmedia/legacy/WebKitMediaKeys.cpp: Renamed from Source/WebCore/Modules/encryptedmedia/MediaKeys.cpp.
1394         (WebCore::WebKitMediaKeys::create):
1395         (WebCore::WebKitMediaKeys::WebKitMediaKeys):
1396         (WebCore::WebKitMediaKeys::~WebKitMediaKeys):
1397         (WebCore::WebKitMediaKeys::createSession):
1398         (WebCore::WebKitMediaKeys::isTypeSupported):
1399         (WebCore::WebKitMediaKeys::setMediaElement):
1400         (WebCore::WebKitMediaKeys::cdmMediaPlayer):
1401         (WebCore::WebKitMediaKeys::keyAdded):
1402         (WebCore::WebKitMediaKeys::cachedKeyForKeyId):
1403         * Modules/encryptedmedia/legacy/WebKitMediaKeys.h: Renamed from Source/WebCore/Modules/encryptedmedia/MediaKeys.h.
1404         * Modules/encryptedmedia/legacy/WebKitMediaKeys.idl: Renamed from Source/WebCore/Modules/encryptedmedia/MediaKeys.idl.
1405         * bindings/js/JSDictionary.cpp:
1406         (WebCore::JSDictionary::convertValue):
1407         * bindings/js/JSDictionary.h:
1408         * dom/EventNames.in:
1409         * dom/EventTargetFactory.in:
1410         * html/HTMLMediaElement.cpp:
1411         (WebCore::HTMLMediaElement::mediaPlayerKeyNeeded):
1412         (WebCore::HTMLMediaElement::setMediaKeys):
1413         * html/HTMLMediaElement.h:
1414         (WebCore::HTMLMediaElement::keys):
1415         * html/HTMLMediaElement.idl:
1416         * html/WebKitMediaKeyError.h: Renamed from Source/WebCore/html/MediaKeyError.h.
1417         (WebCore::WebKitMediaKeyError::create):
1418         (WebCore::WebKitMediaKeyError::WebKitMediaKeyError):
1419         * html/WebKitMediaKeyError.idl: Renamed from Source/WebCore/html/MediaKeyError.idl.
1420         * testing/MockCDM.cpp:
1421         (WebCore::MockCDMSession::generateKeyRequest):
1422         (WebCore::MockCDMSession::update):
1423
1424 2016-10-09  Zan Dobersek  <zdobersek@igalia.com>
1425
1426         Remove stale ENABLE(ENCRYPTED_MEDIA) code in HTMLMediaElement
1427         https://bugs.webkit.org/show_bug.cgi?id=163111
1428
1429         Reviewed by Alex Christensen.
1430
1431         Remove three method implementations in HTMLMediaElement which had their
1432         declarations and the related WebIDL entries removed in the first ENCRYPTED_MEDIA
1433         purge in r206440.
1434
1435         No new tests -- no changes in behavior.
1436
1437         * html/HTMLMediaElement.cpp:
1438         (WebCore::HTMLMediaElement::webkitGenerateKeyRequest): Deleted.
1439         (WebCore::HTMLMediaElement::webkitAddKey): Deleted.
1440         (WebCore::HTMLMediaElement::webkitCancelKeyRequest): Deleted.
1441
1442 2016-10-09  Wenson Hsieh  <wenson_hsieh@apple.com>
1443
1444         Support InputEvent.inputType for the new InputEvent spec
1445         https://bugs.webkit.org/show_bug.cgi?id=163025
1446         <rdar://problem/28658092>
1447
1448         Reviewed by Darin Adler.
1449
1450         Adds support for the inputType attribute of InputEvent. To do this, we introduce a helper to
1451         map EditActions to inputType names, and also split out ambiguous EditActions (such as
1452         EditActionTyping) into more specific subtypes (such as EditActionTypingDeleteBackward,
1453         EditActionTypingInsertParagraph, etc.), each of which corresponds to an inputType.
1454
1455         In places where we create CompositeEditCommands, we now pass in these specific EditActions
1456         where appropriate, and when dispatching `beforeinput` and `input` events, we ask the
1457         CompositeEditCommand for its input type name, which it derives from its editingAction.
1458
1459         Tests: fast/events/before-input-prevent-biu.html
1460                fast/events/before-input-prevent-cut.html
1461                fast/events/before-input-prevent-paste.html
1462                fast/events/before-input-prevent-typing.html
1463                fast/events/before-input-prevent-undo.html
1464
1465         * dom/InputEvent.h:
1466         * dom/Node.cpp:
1467         (WebCore::Node::dispatchInputEvent):
1468         * dom/Node.h:
1469         * editing/CompositeEditCommand.cpp:
1470         (WebCore::CompositeEditCommand::apply):
1471         (WebCore::CompositeEditCommand::inputEventTypeName):
1472
1473         Allows a CompositeEditCommand to specify the inputType its corresponding `beforeinput` and `input` events
1474         should have.
1475
1476         * editing/CompositeEditCommand.h:
1477         (WebCore::CompositeEditCommand::shouldStopCaretBlinking): Deleted.
1478         * editing/EditAction.h:
1479         * editing/EditCommand.cpp:
1480         (WebCore::inputTypeNameForEditingAction):
1481         * editing/EditCommand.h:
1482         * editing/Editor.cpp:
1483         (WebCore::Editor::willApplyEditing):
1484         (WebCore::Editor::appliedEditing):
1485         (WebCore::Editor::willUnapplyEditing):
1486         (WebCore::Editor::unappliedEditing):
1487         (WebCore::Editor::willReapplyEditing):
1488         (WebCore::Editor::reappliedEditing):
1489         (WebCore::Editor::computeAndSetTypingStyle):
1490         * editing/InsertListCommand.cpp:
1491         (WebCore::InsertListCommand::editingAction):
1492         * editing/InsertListCommand.h:
1493         (WebCore::InsertListCommand::preservesTypingStyle): Deleted.
1494         (WebCore::InsertListCommand::editingAction): Deleted.
1495         * editing/ReplaceRangeWithTextCommand.cpp:
1496         (WebCore::ReplaceRangeWithTextCommand::ReplaceRangeWithTextCommand):
1497         * editing/SpellingCorrectionCommand.cpp:
1498         (WebCore::SpellingCorrectionCommand::SpellingCorrectionCommand):
1499         * editing/TypingCommand.cpp:
1500         (WebCore::editActionForTypingCommand):
1501         (WebCore::TypingCommand::TypingCommand):
1502         (WebCore::TypingCommand::inputEventTypeName):
1503
1504         The editingAction() of a TypingCommand is the first editing action the TypingCommand was initialized using.
1505         Since subsequent typing commands update the last open typing command, we override inputEventTypeName here to
1506         use the last updated editing action rather than the default (initial) editing action.
1507
1508         (WebCore::TypingCommand::willAddTypingToOpenCommand):
1509         (WebCore::TypingCommand::insertTextRunWithoutNewlines):
1510         (WebCore::TypingCommand::insertParagraphSeparator):
1511         * editing/TypingCommand.h:
1512
1513 2016-10-09  Darin Adler  <darin@apple.com>
1514
1515         Move ApplePaySession from legacy to new DOM exceptions
1516         https://bugs.webkit.org/show_bug.cgi?id=163191
1517
1518         Reviewed by Sam Weinig.
1519
1520         * Modules/applepay/ApplePaySession.cpp:
1521         (WebCore::ApplePaySession::create): Use ExceptionOr.
1522         (WebCore::ApplePaySession::ApplePaySession): Moved initialization
1523         of two of the data members to class definition.
1524         (WebCore::ApplePaySession::supportsVersion): Use ExceptionOr.
1525         (WebCore::ApplePaySession::canMakePayments): Ditto.
1526         (WebCore::ApplePaySession::canMakePaymentsWithActiveCard): Ditto.
1527         (WebCore::ApplePaySession::openPaymentSetup): Ditto.
1528         (WebCore::ApplePaySession::begin): Ditto.
1529         (WebCore::ApplePaySession::abort): Ditto.
1530         (WebCore::ApplePaySession::completeMerchantValidation): Ditto.
1531         (WebCore::ApplePaySession::completeShippingMethodSelection): Ditto.
1532         (WebCore::ApplePaySession::completeShippingContactSelection): Ditto.
1533         (WebCore::ApplePaySession::completePaymentMethodSelection): Ditto.
1534         (WebCore::ApplePaySession::completePayment): Ditto.
1535         (WebCore::ApplePaySession::validateMerchant): Use auto and get instead of
1536         using a RefPtr type and * for event dispatching.
1537         (WebCore::ApplePaySession::didAuthorizePayment): Ditto.
1538         (WebCore::ApplePaySession::didSelectShippingMethod): Ditto.
1539         (WebCore::ApplePaySession::didSelectShippingContact): Ditto.
1540         (WebCore::ApplePaySession::didSelectPaymentMethod): Ditto.
1541         (WebCore::ApplePaySession::didCancelPayment): Ditto.
1542         (WebCore::ApplePaySession::paymentCoordinator): Moved dereferencing
1543         inside the downcast.
1544
1545         * Modules/applepay/ApplePaySession.h: Updated for changes above.
1546
1547         * Modules/applepay/ApplePaySession.idl: Use MayThrowException.
1548
1549         * bindings/js/JSApplePaySessionCustom.cpp:
1550         (WebCore::JSApplePaySession::completeShippingMethodSelection):
1551         Use propagateException.
1552         (WebCore::JSApplePaySession::completeShippingContactSelection): Ditto.
1553         (WebCore::JSApplePaySession::completePaymentMethodSelection): Ditto.
1554
1555         * bindings/js/JSDOMBinding.h: Added implementation of toJSBoolean.
1556
1557         * bindings/scripts/CodeGeneratorJS.pm:
1558         (GenerateConstructorDefinition): Generate the different arguments for
1559         toJSNewlyCreated when ConstructorMayThrowException is specified that
1560         activate the version of that function that handles exceptions.
1561
1562         * bindings/scripts/IDLAttributes.txt: Added ConstructorMayThrowException.
1563
1564 2016-10-09  Darin Adler  <darin@apple.com>
1565
1566         Replace all uses of ExceptionCodeWithMessage with WebCore::Exception
1567         https://bugs.webkit.org/show_bug.cgi?id=163178
1568
1569         Reviewed by Sam Weinig.
1570
1571         * Modules/indexeddb/IDBCursor.cpp:
1572         (WebCore::IDBCursor::stringToDirection): Return an Optional instead of
1573         using an ExceptionCode out argument, since this function just needs to
1574         indicate failure, not actually throw an exception.
1575         (WebCore::IDBCursor::update): Return ExceptionOr instead of using an
1576         ExceptionCodeWithMessage out argument.
1577         (WebCore::IDBCursor::advance): Ditto.
1578         (WebCore::IDBCursor::continueFunction): Ditto.
1579         (WebCore::IDBCursor::deleteFunction): Ditto.
1580         * Modules/indexeddb/IDBCursor.h: Updated for above changes.
1581
1582         * Modules/indexeddb/IDBCursor.idl: Sorted extended attributes alphabetically.
1583         Use MayThrowException instead of MayThrowLegacyExceptionWithMessage.
1584
1585         * Modules/indexeddb/IDBDatabase.cpp:
1586         (WebCore::IDBDatabase::createObjectStore): Return ExceptionOr instead of
1587         using an ExceptionCodeWithMessage out argument.
1588         (WebCore::IDBDatabase::transaction): Ditto.
1589         (WebCore::IDBDatabase::deleteObjectStore): Ditto.
1590         * Modules/indexeddb/IDBDatabase.h: Updated for above changes.
1591
1592         * Modules/indexeddb/IDBDatabase.idl: Use MayThrowException instead of
1593         MayThrowLegacyExceptionWithMessage.
1594
1595         * Modules/indexeddb/IDBFactory.cpp:
1596         (WebCore::IDBFactory::open): Return ExceptionOr instead of
1597         using an ExceptionCodeWithMessage out argument.
1598         (WebCore::IDBFactory::openInternal): Ditto.
1599         (WebCore::IDBFactory::deleteDatabase): Ditto.
1600         (WebCore::IDBFactory::cmp): Ditto.
1601         * Modules/indexeddb/IDBFactory.h: Updated for above changes.
1602
1603         * Modules/indexeddb/IDBFactory.idl: Use MayThrowException instead of
1604         MayThrowLegacyExceptionWithMessage.
1605
1606         * Modules/indexeddb/IDBIndex.cpp:
1607         (WebCore::IDBIndex::openCursor): Return ExceptionOr instead of
1608         using an ExceptionCodeWithMessage out argument.
1609         (WebCore::IDBIndex::count): Ditto.
1610         (WebCore::IDBIndex::doCount): Ditto.
1611         (WebCore::IDBIndex::openKeyCursor): Ditto.
1612         (WebCore::IDBIndex::get): Ditto.
1613         (WebCore::IDBIndex::doGet): Ditto.
1614         (WebCore::IDBIndex::getKey): Ditto.
1615         (WebCore::IDBIndex::doGetKey): Ditto.
1616         * Modules/indexeddb/IDBIndex.h: Updated for above changes.
1617
1618         * Modules/indexeddb/IDBIndex.idl: Use MayThrowException instead of
1619         MayThrowLegacyExceptionWithMessage.
1620
1621         * Modules/indexeddb/IDBKeyRange.cpp:
1622         (WebCore::IDBKeyRange::only): Return ExceptionOr instead of
1623         using an ExceptionCode out argument.
1624         (WebCore::IDBKeyRange::lowerBound): Ditto.
1625         (WebCore::IDBKeyRange::upperBound): Ditto.
1626         (WebCore::IDBKeyRange::bound): Ditto.
1627         * Modules/indexeddb/IDBKeyRange.h: Updated for above changes.
1628         * Modules/indexeddb/IDBKeyRange.idl: Use MayThrowException instead of
1629         MayThrowLegacyException.
1630
1631         * Modules/indexeddb/IDBObjectStore.cpp:
1632         (WebCore::IDBObjectStore::openCursor): Return ExceptionOr instead of
1633         using an ExceptionCodeWithMessage out argument.
1634         (WebCore::IDBObjectStore::get): Ditto.
1635         (WebCore::IDBObjectStore::add): Ditto.
1636         (WebCore::IDBObjectStore::put): Ditto.
1637         (WebCore::IDBObjectStore::putForCursorUpdate): Ditto.
1638         (WebCore::IDBObjectStore::putOrAdd): Ditto.
1639         (WebCore::IDBObjectStore::deleteFunction): Ditto.
1640         (WebCore::IDBObjectStore::doDelete): Ditto.
1641         (WebCore::IDBObjectStore::clear): Ditto.
1642         (WebCore::IDBObjectStore::createIndex): Ditto.
1643         (WebCore::IDBObjectStore::index): Ditto.
1644         (WebCore::IDBObjectStore::deleteIndex): Ditto.
1645         (WebCore::IDBObjectStore::count): Ditto.
1646         (WebCore::IDBObjectStore::doCount): Ditto.
1647         * Modules/indexeddb/IDBObjectStore.h: Updated for above changes.
1648
1649         * Modules/indexeddb/IDBObjectStore.idl: Use MayThrowException instead of
1650         MayThrowLegacyExceptionWithMessage.
1651
1652         * Modules/indexeddb/IDBRequest.cpp:
1653         (WebCore::IDBRequest::errorCode): Deleted. Was dead code.
1654         (WebCore::IDBRequest::error): Return ExceptionOr instead of
1655         using an ExceptionCodeWithMessage out argument.
1656         * Modules/indexeddb/IDBRequest.h: Updated for above changes.
1657
1658         * Modules/indexeddb/IDBRequest.idl: Use GetterMayThrowException instead of
1659         GetterMayThrowLegacyExceptionWithMessage.
1660
1661         * Modules/indexeddb/IDBTransaction.cpp:
1662         (WebCore::IDBTransaction::stringToMode): Return an Optional instead of
1663         using an ExceptionCode out argument, since this function just needs to
1664         indicate failure, not actually throw an exception.
1665         (WebCore::IDBTransaction::db): Tweaked code a bit.
1666         (WebCore::IDBTransaction::error): Return a pointer instead of a RefPtr.
1667         (WebCore::IDBTransaction::objectStore): Return ExceptionOr instead of
1668         using an ExceptionCodeWithMessage out argument.
1669         (WebCore::IDBTransaction::abortDueToFailedRequest): Call internalAbort.
1670         (WebCore::IDBTransaction::abort): Return ExceptionOr instead of
1671         using an ExceptionCodeWithMessage out argument.
1672         (WebCore::IDBTransaction::internalAbort): Added a version that asserts
1673         instead of throwing an exception for internal use.
1674         (WebCore::IDBTransaction::stop): Call internalAbort.
1675         * Modules/indexeddb/IDBTransaction.h: Updated for above changes.
1676
1677         * Modules/indexeddb/IDBTransaction.idl: Use MayThrowException instead of
1678         MayThrowLegacyExceptionWithMessage.
1679
1680         * Modules/indexeddb/client/IDBConnectionProxy.cpp:
1681         (WebCore::IDBClient::IDBConnectionProxy::openDatabase): Updated to return
1682         a Ref instead of a RefPtr, since the function can never return null.
1683         (WebCore::IDBClient::IDBConnectionProxy::deleteDatabase): Ditto.
1684         * Modules/indexeddb/client/IDBConnectionProxy.h: Updated for above changes.
1685
1686         * Modules/mediastream/MediaEndpointPeerConnection.cpp:
1687         (WebCore::MediaEndpointPeerConnection::setLocalDescriptionTask): Updated
1688         exception handling to use ExceptionOr instead of ExceptionCodeWithMessage.
1689         (WebCore::MediaEndpointPeerConnection::setRemoteDescriptionTask): Ditto.
1690         * Modules/mediastream/MediaEndpointSessionDescription.cpp:
1691         (WebCore::MediaEndpointSessionDescription::create): Ditto.
1692         * Modules/mediastream/MediaEndpointSessionDescription.h: Updated for above change.
1693
1694         * bindings/js/JSDOMBinding.cpp:
1695         (WebCore::createDOMException): Added overload for Exception.
1696         (WebCore::throwDOMException): Deleted overload for ExceptionCodeWithMessage.
1697         Updated code to call the new createDOMException function.
1698         (WebCore::setDOMExceptionSlow): Ditto.
1699         (WebCore::setDOMException): Ditto.
1700
1701         * bindings/js/JSDOMBinding.h: Added overload of createDOMException that takes
1702         an Exception. Deleted functions dealing with ExceptionCodeWithMessage. Fixed
1703         interface of toJSNumber and toJSNullableNumber and implemented toJSNumber.
1704
1705         * bindings/js/JSDOMPromise.cpp:
1706         (WebCore::DeferredPromise::reject): Added overload that takes an Exception.
1707         * bindings/js/JSDOMPromise.h: Updated for above change.
1708
1709         * bindings/js/JSHistoryCustom.cpp:
1710         (WebCore::JSHistory::pushState): Use propagateException to deal with
1711         ExceptionOr instead of ExceptionCodeWithMessage.
1712         (WebCore::JSHistory::replaceState): Ditto.
1713
1714         * bindings/js/JSIDBDatabaseCustom.cpp:
1715         (WebCore::JSIDBDatabase::createObjectStore): Use toJS and
1716         to deal with ExceptionOr rather than setDOMException to deal
1717         with ExceptionCodeWithMessage.
1718
1719         * bindings/js/JSIDBRequestCustom.cpp:
1720         (WebCore::JSIDBRequest::result): Use propagateException and
1721         Exception rather than setDOMException and ExceptionCodeWithMessage.
1722
1723         * bindings/scripts/CodeGeneratorJS.pm:
1724         (GenerateImplementation): Removed support for GetterMayThrowLegacyExceptionWithMessage,
1725         SetterMayThrowLegacyExceptionWithMessage, and MayThrowLegacyExceptionWithMessage.
1726         (GenerateReturnParameters): Ditto.
1727         (GenerateImplementationFunctionCall): Ditto.
1728         (GenerateConstructorDefinition): Ditto.
1729
1730         * bindings/scripts/IDLAttributes.txt: Removed GetterMayThrowLegacyExceptionWithMessage,
1731         SetterMayThrowLegacyExceptionWithMessage, and MayThrowLegacyExceptionWithMessage.
1732
1733         * bindings/scripts/test/JS/JSTestObj.cpp: Regenerated.
1734         * bindings/scripts/test/TestObj.idl: Removed tests cases for now-removed attributes.
1735
1736         * dom/CustomElementRegistry.idl: Use MayThrowException instead of
1737         MayThrowLegacyExceptionWithMessage.
1738
1739         * dom/ExceptionCode.h: Removed ExceptionCodeWithMessage. Also updated to use pragma
1740         once, removed include of WTFString.h and switched to using instead of typedef.
1741
1742         * history/HistoryItem.h: Return a pointer instead of a RefPtr from stateObject
1743         to cut down a little on unnecessary reference count churn.
1744
1745         * inspector/InspectorIndexedDBAgent.cpp: Updated all the code that uses IDB
1746         classes to use the new versions rather than the old ExceptionCodeWithMessage versions.
1747
1748         * page/DOMWindow.cpp:
1749         (WebCore::DOMWindow::history): Pass a reference instead of a pointer.
1750
1751         * page/History.cpp:
1752         (WebCore::History::History): Take a reference instead of a pointer.
1753         (WebCore::History::length): Tweaked to use a local variable.
1754         (WebCore::History::state): Return a pointer instead of a PassRefPtr.
1755         (WebCore::History::stateInternal): Ditto. Also use early return consistently.
1756         (WebCore::History::isSameAsCurrentState): Updated for above change.
1757         (WebCore::History::stateObjectAdded): Return ExceptionOr rather than taking an
1758         ExceptionCodeWithMessage out argument.
1759
1760         * page/History.h: Use pragma once. Removed some unneeded includes. Marked class final.
1761         Updated for changes above.
1762
1763         * page/History.idl: Use MayThrowException instead of MayThrowLegacyException.
1764
1765 2016-10-07  Ryosuke Niwa  <rniwa@webkit.org>
1766
1767         REGRESSION(r165103): labels list doesn't get invalidated when other lists are invalidated at document level
1768         https://bugs.webkit.org/show_bug.cgi?id=163145
1769
1770         Reviewed by Darin Adler.
1771
1772         The bug was caused by Document::invalidateNodeListAndCollectionCaches removing all node lists regardless
1773         of whether they have been invalidated or not.
1774
1775         Fixed the bug by removing only those node lists that got invalidated via LiveNodeList::invalidateCache.
1776
1777         Test: fast/dom/NodeList/form-labels-length.html
1778
1779         * dom/Document.cpp:
1780         (WebCore::Document::Document):
1781         (WebCore::Document::unregisterNodeListForInvalidation): Removed the conditional which allowed removal to
1782         happen while m_listsInvalidatedAtDocument is empty inside invalidateNodeListAndCollectionCaches.
1783         * dom/Document.h:
1784         * dom/Node.cpp:
1785         (WebCore::Document::invalidateNodeListAndCollectionCaches): Just remove the node lists being invalidated via
1786         LiveNodeList's invalidateCache, which calls unregisterNodeListForInvalidation, instead of removing them all.
1787         We make a copy of the list of node lists into a local vector because mutating HashMap while iterating over it
1788         is not a safe operation.
1789
1790 2016-10-09  Chris Dumez  <cdumez@apple.com>
1791
1792         Update generated bindings code so that dictionary structures no longer need explicit constructors
1793         https://bugs.webkit.org/show_bug.cgi?id=163188
1794
1795         Reviewed by Darin Adler.
1796
1797         Update generated bindings code so that dictionary structures no longer
1798         need explicit constructors. We now call the default constructor and
1799         then initialize the members one by one.
1800
1801         * bindings/scripts/CodeGeneratorJS.pm:
1802         (GenerateDictionaryImplementationContent):
1803         * bindings/scripts/test/JS/JSTestObj.cpp:
1804         (WebCore::convertDictionary<TestObj::Dictionary>):
1805         (WebCore::convertDictionary<TestObj::DictionaryThatShouldNotTolerateNull>):
1806         (WebCore::convertDictionary<TestObj::DictionaryThatShouldTolerateNull>):
1807         (WebCore::convertDictionary<AlternateDictionaryName>):
1808         (WebCore::convertDictionary<TestObj::ParentDictionary>):
1809         (WebCore::convertDictionary<TestObj::ChildDictionary>):
1810         * bindings/scripts/test/JS/JSTestStandaloneDictionary.cpp:
1811         (WebCore::convertDictionary<TestStandaloneDictionary>):
1812         * dom/ClipboardEvent.h:
1813         * dom/CustomEvent.h:
1814         * dom/EventInit.h:
1815         (WebCore::EventInit::EventInit): Deleted.
1816         * dom/EventModifierInit.h:
1817         (WebCore::EventModifierInit::EventModifierInit): Deleted.
1818         * dom/KeyboardEvent.cpp:
1819         (WebCore::KeyboardEvent::KeyboardEvent):
1820         * dom/KeyboardEvent.h:
1821         * dom/KeyboardEvent.idl:
1822         * dom/UIEventInit.h:
1823         (WebCore::UIEventInit::UIEventInit): Deleted.
1824         * editing/Editor.cpp:
1825         (WebCore::Editor::dispatchCPPEvent):
1826
1827 2016-10-09  Fujii Hironori  <Hironori.Fujii@sony.com>
1828
1829         [CMake] CMake does not support the dep files for implicit dependency
1830         https://bugs.webkit.org/show_bug.cgi?id=161433
1831
1832         Reviewed by Brent Fulgham.
1833
1834         Created a Perl script to generate all IDL bindings for CMake.
1835         This script can regenerate outdated bindings by based on the
1836         supplemental dependency and dep files created by
1837         '--write-dependencies' switch of generate-bindings.pl.
1838
1839         add_custom_target is used to invoke the script instead of
1840         add_custom_command because Ninja deletes all output files before
1841         executing the command in case of add_custom_command.
1842
1843         USES_TERMINAL option of add_custom_target has two effects:
1844         1) Not buffering output of the command
1845         2) Invoking the command in the special Ninja pool which inhibits parallel build
1846         One needs to use CMake 3.2 or later to enable this feature.
1847
1848         * CMakeLists.txt: Specified target names for
1849         GENERATE_BINDINGS. Added dependency for the targets.
1850         * bindings/scripts/generate-bindings-all.pl: Added.
1851
1852 2016-10-09  Chris Dumez  <cdumez@apple.com>
1853
1854         Update KeyboardEvent to stop using legacy [ConstructorTemplate=Event]
1855         https://bugs.webkit.org/show_bug.cgi?id=163176
1856
1857         Reviewed by Darin Adler.
1858
1859         Update KeyboardEvent to stop using legacy [ConstructorTemplate=Event]
1860         and use a proper constructor instead, like in the specification:
1861         - https://www.w3.org/TR/uievents/#interface-keyboardevent
1862
1863         Also add support for passing modifierAltGraph / modifierCapsLock
1864         in the inialization dictionary as we support those modifiers via
1865         getModifierState().
1866
1867         No new tests, extended existing test.
1868
1869         * CMakeLists.txt:
1870         * DerivedSources.cpp:
1871         * DerivedSources.make:
1872         * WebCore.xcodeproj/project.pbxproj:
1873         * dom/EventModifierInit.h: Added.
1874         (WebCore::EventModifierInit::EventModifierInit):
1875         * dom/EventModifierInit.idl: Added.
1876         * dom/KeyboardEvent.cpp:
1877         (WebCore::KeyboardEvent::KeyboardEvent):
1878         (WebCore::KeyboardEvent::getModifierState):
1879         * dom/KeyboardEvent.h:
1880         * dom/KeyboardEvent.idl:
1881         * dom/MouseRelatedEvent.cpp:
1882         (WebCore::MouseRelatedEvent::MouseRelatedEvent):
1883         * dom/MouseRelatedEvent.h:
1884         * dom/UIEvent.cpp:
1885         (WebCore::UIEvent::UIEvent):
1886         * dom/UIEvent.h:
1887         (WebCore::UIEvent::create): Deleted.
1888         * dom/UIEventInit.h: Added.
1889         (WebCore::UIEventInit::UIEventInit):
1890         * dom/UIEventInit.idl: Added.
1891         * dom/UIEventWithKeyState.h:
1892         (WebCore::UIEventWithKeyState::altGraphKey):
1893         (WebCore::UIEventWithKeyState::capsLockKey):
1894         (WebCore::UIEventWithKeyState::UIEventWithKeyState):
1895         (WebCore::UIEventWithKeyState::ctrlKey): Deleted.
1896         (WebCore::UIEventWithKeyState::shiftKey): Deleted.
1897         (WebCore::UIEventWithKeyState::altKey): Deleted.
1898         (WebCore::UIEventWithKeyState::metaKey): Deleted.
1899
1900 2016-10-09  Youenn Fablet  <youenn@apple.com>
1901
1902         Promise attribute getters should reject promises in case of casted-this errors
1903         https://bugs.webkit.org/show_bug.cgi?id=163167
1904
1905         Reviewed by Darin Adler.
1906
1907         Covered by updated test and binding test.
1908
1909         * bindings/js/JSDOMBinding.cpp:
1910         (WebCore::throwGetterTypeError):
1911         (WebCore::rejectPromiseWithGetterTypeError): Added to reject promises for attribute getters
1912         * bindings/js/JSDOMBinding.h:
1913         (WebCore::BindingCaller::attribute): Introducing promise rejection for type cast errors.
1914         * bindings/scripts/CodeGeneratorJS.pm:
1915         (GenerateImplementation):
1916         * bindings/scripts/test/JS/JSTestObj.cpp: Rebased test. As can be seen, only custom promise attributes are supported.
1917         (WebCore::jsTestObjTestReadOnlyPromiseAttribute):
1918         (WebCore::jsTestObjTestReadOnlyPromiseAttributeGetter):
1919         * bindings/scripts/test/TestObj.idl:
1920
1921 2016-10-08  Chris Dumez  <cdumez@apple.com>
1922
1923         [Mac] Write WebArchive to the pasteboard when copying image in WebKit
1924         https://bugs.webkit.org/show_bug.cgi?id=163100
1925
1926         Reviewed by Darin Adler.
1927
1928         Write WebArchive to the pasteboard when copying image in WebKit. This
1929         fixes pasting such images to a content editable field in WebKit because
1930         Web archives take priority over RTFD when reading from the pasteboard
1931         in WebKit.
1932
1933         Using RTFD when pasting the image in WebKit was causing issues because:
1934         1. The pasted image would not be displayed because our RTFD import code
1935            is buggy.
1936         2. The pasted image URL was a webkit-fake-url://
1937         3. Formatting associated to the image (e.g. inline style) would be lost
1938
1939         No new tests, unskipped existing test on WebKit2.
1940
1941         * editing/Editor.h:
1942         * editing/mac/EditorMac.mm:
1943         (WebCore::Editor::imageInWebArchiveFormat):
1944         (WebCore::Editor::writeImageToPasteboard):
1945         * platform/Pasteboard.h:
1946         * platform/mac/PasteboardMac.mm:
1947         (WebCore::writableTypesForImage):
1948         (WebCore::Pasteboard::write):
1949         (WebCore::Pasteboard::Pasteboard): Deleted.
1950         (WebCore::Pasteboard::createForCopyAndPaste): Deleted.
1951
1952 2016-10-08  Chris Dumez  <cdumez@apple.com>
1953
1954         Update CustomEvent to stop using legacy [ConstructorTemplate=Event]
1955         https://bugs.webkit.org/show_bug.cgi?id=163174
1956
1957         Reviewed by Darin Adler.
1958
1959         Update CustomEvent to stop using legacy [ConstructorTemplate=Event] and
1960         use an actual constructor instead, like in the specification:
1961         - https://dom.spec.whatwg.org/#interface-customevent
1962
1963         There is a very minor behavior change when explictly passing undefined
1964         as detail value in CustomEventInit. We used to initialize detail to
1965         undefined but we now initialize it to null instead, which is its default
1966         value. The new behavior matches the one of Chrome and Firefox.
1967
1968         * bindings/scripts/CodeGeneratorJS.pm:
1969         (GenerateDefaultValue):
1970         (GenerateDictionaryImplementationContent):
1971         * bindings/scripts/test/JS/JSTestObj.cpp:
1972         (WebCore::convertDictionary<TestObj::Dictionary>):
1973         * bindings/scripts/test/TestObj.idl:
1974         * dom/CustomEvent.cpp:
1975         (WebCore::CustomEvent::CustomEvent):
1976         * dom/CustomEvent.h:
1977         * dom/CustomEvent.idl:
1978         * dom/Document.cpp:
1979         (WebCore::Document::createEvent):
1980         * dom/Event.cpp:
1981         (WebCore::Event::Event):
1982         * dom/Event.h:
1983
1984 2016-10-08  Chris Dumez  <cdumez@apple.com>
1985
1986         Add support for ClipboardEvent
1987         https://bugs.webkit.org/show_bug.cgi?id=163164
1988
1989         Reviewed by Darin Adler.
1990
1991         Add support for ClipboardEvent:
1992         - https://www.w3.org/TR/clipboard-apis/#clipboard-event-interfaces
1993
1994         Firefox and Chrome both already support this.
1995
1996         This gives us 5 more points on html5test.com.
1997
1998         Tests: editing/pasteboard/clipboard-event.html
1999                fast/events/clipboard-event-constructor.html
2000
2001         * CMakeLists.txt:
2002         * DerivedSources.cpp:
2003         * DerivedSources.make:
2004         * WebCore.xcodeproj/project.pbxproj:
2005         * bindings/js/JSEventCustom.cpp:
2006         (WebCore::toJSNewlyCreated): Deleted.
2007
2008         * bindings/scripts/CodeGeneratorJS.pm:
2009         (WillConvertUndefinedToDefaultParameterValue):
2010         We use [] as implicit default value for dictionary parameters. This change
2011         is so we call convertDictionary<>() even if the parameter is undefined
2012         because we want to pass a struct to the implementation initialized with
2013         the default member values defined in the IDL.
2014
2015         * dom/ClipboardEvent.cpp:
2016         (WebCore::ClipboardEvent::ClipboardEvent):
2017         (WebCore::ClipboardEvent::eventInterface):
2018         * dom/ClipboardEvent.h:
2019         * dom/ClipboardEvent.idl: Added.
2020         * dom/Event.cpp:
2021         (WebCore::Event::Event):
2022         * dom/Event.h:
2023         * dom/Event.idl:
2024         * dom/EventInit.h: Added.
2025         * dom/EventInit.idl: Added.
2026         * dom/EventNames.in:
2027         * dom/MouseEvent.h:
2028         (WebCore::MouseEvent::dataTransfer):
2029         * editing/Editor.cpp:
2030         (WebCore::Editor::dispatchCPPEvent):
2031
2032 2016-10-06  Darin Adler  <darin@apple.com>
2033
2034         Next step on moving to modern way to return DOM exceptions
2035         https://bugs.webkit.org/show_bug.cgi?id=163016
2036
2037         Reviewed by Ryosuke Niwa.
2038
2039         * Modules/fetch/FetchRequest.idl:
2040         Added MayThrowException to initializeWith since it throws an exception.
2041
2042         * bindings/js/JSCallbackData.cpp:
2043         (WebCore::JSCallbackData::invokeCallback):
2044         * bindings/js/JSCustomElementInterface.cpp:
2045         (WebCore::JSCustomElementInterface::invokeCallback):
2046         * bindings/js/JSCustomSQLStatementErrorCallback.cpp:
2047         (WebCore::JSSQLStatementErrorCallback::handleEvent):
2048         * bindings/js/JSCustomXPathNSResolver.cpp:
2049         (WebCore::JSCustomXPathNSResolver::lookupNamespaceURI):
2050         * bindings/js/JSDOMBinding.cpp:
2051         (WebCore::reportException):
2052         (WebCore::reportCurrentException):
2053         * bindings/js/JSErrorHandler.cpp:
2054         (WebCore::JSErrorHandler::handleEvent):
2055         * bindings/js/JSEventListener.cpp:
2056         (WebCore::JSEventListener::handleEvent):
2057         * bindings/js/JSMutationCallback.cpp:
2058         (WebCore::JSMutationCallback::call):
2059         * bindings/js/JSNodeFilterCustom.cpp:
2060         (WebCore::JSNodeFilter::acceptNode):
2061         * bindings/js/ScheduledAction.cpp:
2062         (WebCore::ScheduledAction::executeFunctionInContext):
2063         * bindings/js/ScriptController.cpp:
2064         (WebCore::ScriptController::evaluateInWorld):
2065         * bindings/js/WorkerScriptController.cpp:
2066         (WebCore::WorkerScriptController::evaluate):
2067         * inspector/PageScriptDebugServer.cpp:
2068         (WebCore::PageScriptDebugServer::reportException):
2069         Use JSC::Exception explicitly to avoid ambiguity with WebCore::Exception,
2070         or in some cases use auto instead.
2071
2072         * bindings/js/JSDOMBinding.cpp:
2073         (WebCore::hasUnpairedSurrogate): Factored this inline function out of valueToUSVString
2074         for clarity.
2075         (WebCore::createDOMException): Removed unused TRY_TO_CREATE_EXCEPTION macro.
2076         (WebCore::propagateExceptionSlowPath): Added.
2077         (WebCore::propagateException): Added.
2078         (WebCore::setDOMException): Removed overload that takes an exception code and message
2079         string separately; no longer needed.
2080
2081         * bindings/js/JSDOMBinding.h: Include the ExceptionOr header
2082         rather than forward declaring. Added more of the ExceptionOr handling
2083         functions; some just declared and not yet defined. Updated for changes
2084         to ExceptionOr interface. Removed the createDOMException function that takes
2085         only an exception code; not needed outside JSDOMBinding.cpp.
2086
2087         * bindings/js/JSXMLHttpRequestCustom.cpp:
2088         (WebCore::JSXMLHttpRequest::send): Rewrote this to use ExceptionOr instead
2089         of ExceptionCode. Added some FIXMEs as well.
2090         (WebCore::JSXMLHttpRequest::responseText): Ditto.
2091         (WebCore::JSXMLHttpRequest::retrieveResponse): Ditto.
2092
2093         * bindings/scripts/CodeGeneratorJS.pm:
2094         (GenerateImplementation): Fixed if statements to follow WebKit coding style
2095         rather than using extra braces. Added call to propagateException for SetterMayThrowException.
2096         (GenerateSerializerFunction): Fixed if statements as above.
2097         (GenerateParametersCheck): Ditto. Also added call to propagateException for functions with
2098         void return type and MayThrowException.
2099         (GenerateReturnParameters): Tweaked coding style a bit.
2100         (addIterableProperties): Fixed if statements as above.
2101         (NativeToJSValue): Added code to handle various cases of GetterMayThrowException
2102         and MayThrowException.
2103         (GenerateConstructorDefinition): Used encodedJSValue() instead of
2104         JSValue::encode(JSValue()), a longer way to say the same thing.
2105
2106         * bindings/scripts/IDLAttributes.txt: Added GetterMayThrowException,
2107         MayThrowException, and SetterMayThrowException.
2108
2109         * bindings/scripts/test/JS/JSTestActiveDOMObject.cpp:
2110         * bindings/scripts/test/JS/JSTestEventConstructor.cpp:
2111         * bindings/scripts/test/JS/JSTestException.cpp:
2112         * bindings/scripts/test/JS/JSTestGlobalObject.cpp:
2113         * bindings/scripts/test/JS/JSTestInterface.cpp:
2114         * bindings/scripts/test/JS/JSTestJSBuiltinConstructor.cpp:
2115         * bindings/scripts/test/JS/JSTestNamedConstructor.cpp:
2116         * bindings/scripts/test/JS/JSTestNode.cpp:
2117         * bindings/scripts/test/JS/JSTestNondeterministic.cpp:
2118         * bindings/scripts/test/JS/JSTestObj.cpp:
2119         * bindings/scripts/test/JS/JSTestSerializedScriptValueInterface.cpp:
2120         * bindings/scripts/test/JS/JSTestTypedefs.cpp:
2121         * bindings/scripts/test/JS/JSattribute.cpp:
2122         Regenerated results.
2123
2124         * bindings/scripts/test/TestObj.idl: Added some test cases.
2125
2126         * dom/DOMImplementation.cpp:
2127         (WebCore::DOMImplementation::createDocumentType): Tweaked formatting.
2128         (WebCore::DOMImplementation::createDocument): Ditto.
2129
2130         * dom/DOMImplementation.idl: Added MayThrowException to two functions since
2131         I am abandoning, for now, the ability to throw exceptions without any extended
2132         attribute in the IDL file. This feature may return at some point if we figure
2133         out a way to do it for functions without return values as well as functions with.
2134
2135         * dom/Document.cpp:
2136         (WebCore::Document::exitPointerLock): Rewrote to streamline logic.
2137         (WebCore::Document::pointerLockElement): Ditto.
2138         (WebCore::Document::inputCursor): Added. No need for this to be inlined.
2139         (WebCore::Document::setInputCursor): Changed to take Ref&&.
2140         (WebCore::Document::getSelection): Added. Moved here from TreeScope.
2141
2142         * dom/Document.h: Updated for above changes.
2143
2144         * dom/Document.idl: Tweaked formatting.
2145
2146         * dom/Exception.h: Merged the two constructors into one with a default
2147         argument value, which should be equally efficient. Added releaseMessage function.
2148         Added assertion that this is only created for actual exceptions with non-zero
2149         ExceptionCode. Unlike ExceptionCode, which has a value of 0 which means no
2150         exception, we do not create an Exception if there is no exception.
2151
2152         * dom/ExceptionOr.h: Renamed takeReturnValue to releaseReturnValue. Replaced
2153         exceptionCode and exceptionMessage with releaseException. Added ExceptionOr<void>
2154         specialization.
2155
2156         * dom/TreeScope.cpp:
2157         (WebCore::TreeScope::~TreeScope): Removed code dealing with
2158         m_selection, which is now in Document.
2159         (WebCore::TreeScope::getSelection): Deleted.
2160
2161         * dom/TreeScope.h: Removed DOMSelection.
2162
2163         * page/DOMSelection.cpp:
2164         (WebCore::selectionShadowAncestor): Changed to take a reference rather than
2165         a guaranteed-non-null pointer.
2166         (WebCore::DOMSelection::DOMSelection): Changed to take a Frame& instead of
2167         of a TreeScope*.
2168         (WebCore::DOMSelection::clearTreeScope): Deleted.
2169         (WebCore::DOMSelection::isCollapsed): Updated call to selectionShadowAncestor.
2170         (WebCore::DOMSelection::type): Took out obsolete uneeeded comment. Got rid
2171         of case where this returns a null string. Use ASCIILiteral.
2172         (WebCore::DOMSelection::rangeCount): Streamlined code.
2173         (WebCore::DOMSelection::collapse): Removed redundant check of m_frame for
2174         null which is already handled by the isValidForPosition function.
2175         Removed non-helpful FIXME.
2176         (WebCore::DOMSelection::collapseToEnd): Changed to use ExceptionOr instead of
2177         ExceptionCode.
2178         (WebCore::DOMSelection::collapseToStart): Ditto.
2179         (WebCore::DOMSelection::setBaseAndExtent): Removed redundant check of m_frame
2180         for null which is already handled by the isValidForPosition function. Removed
2181         non-helpful FIXME.
2182         (WebCore::DOMSelection::setPosition): Ditto.
2183         (WebCore::DOMSelection::extend): Changed to use ExceptionOr instead of
2184         ExceptionCode.
2185         (WebCore::DOMSelection::getRangeAt): Ditto.
2186         (WebCore::DOMSelection::isValidForPosition): Changed to return false when
2187         m_frame is null rather than asserting is is non-null and having every caller
2188         check m_frame before calling this.
2189
2190         * page/DOMSelection.h: Use #pragma once. Fix indentation. Removed unneeded
2191         comments. Use ExceptionOr rather than ExceptionCode.
2192
2193         * page/DOMSelection.idl: Move from MayThrowLegacyException to MayThrowException.
2194
2195         * page/DOMWindow.cpp:
2196         (WebCore::DOMWindow::resetDOMWindowProperties): Sorted properties alphabetically
2197         to make it more obvious if any are accidentally omitted or listed twice.
2198         (WebCore::DOMWindow::getSelection): Changed ownership so that the window owns
2199         the selection like all the other objects, rather than having it be owned by the
2200         document instead.
2201
2202         * page/DOMWindow.h: Added m_selection, sorted all the other related properties
2203         alphabetically so it's easy to compare the list here with elsewhere.
2204
2205         * replay/ReplayController.cpp:
2206         (WebCore::ReplayController::frameNavigated): Updated to call setInputCursor
2207         with a reference rather than a pointer.
2208
2209         * xml/XMLHttpRequest.cpp:
2210         (WebCore::XMLHttpRequest::responseText): Use ExceptionOr rather than ExceptionCode.
2211         (WebCore::XMLHttpRequest::responseXML): Ditto.
2212         (WebCore::XMLHttpRequest::setTimeout): Ditto.
2213         (WebCore::XMLHttpRequest::setResponseType): Ditto.
2214         (WebCore::XMLHttpRequest::setWithCredentials): Ditto.
2215         (WebCore::XMLHttpRequest::open): Ditto.
2216         (WebCore::XMLHttpRequest::prepareToSend): Changed to return an
2217         Optional<ExceptionOr> to reflect the three different states: an exception,
2218         a value to return without sending, or "continue with the send algorithm".
2219         The old code did this with a boolean plus an exception code. This sounds
2220         confusing but is easy to read at the call sites, so probably OK to keep.
2221         (WebCore::XMLHttpRequest::send): Use ExceptionOr rather than ExceptionCode.
2222         (WebCore::XMLHttpRequest::sendBytesData): Ditto.
2223         (WebCore::XMLHttpRequest::createRequest): Ditto.
2224         (WebCore::XMLHttpRequest::overrideMimeType): Ditto.
2225         (WebCore::XMLHttpRequest::setRequestHeader): Ditto.
2226
2227         * xml/XMLHttpRequest.h: Updated for changes above.
2228
2229         * xml/XMLHttpRequest.idl: Sorted interface extended attributes alphabetically.
2230         Changed from MayThrowLegacyException to MayThrowException.
2231
2232 2016-10-06  Sam Weinig  <sam@webkit.org>
2233
2234         Autogenerate passing union types as part of a functions variadic arguments
2235         https://bugs.webkit.org/show_bug.cgi?id=162919
2236
2237         Reviewed by Darin Adler.
2238
2239         * CMakeLists.txt:
2240         * WebCore.xcodeproj/project.pbxproj:
2241         * bindings/js/JSBindingsAllInOne.cpp:
2242         Remove deleted files.
2243
2244         * bindings/generic/IDLTypes.h:
2245         Switch to use std::reference_wrapper as it's implementation type. We may need more
2246         granularity here in the future, but this will work for now.
2247
2248         * bindings/js/JSCharacterDataCustom.cpp: Removed.
2249         * bindings/js/JSDocumentTypeCustom.cpp: Removed.
2250         * bindings/js/JSNodeOrString.cpp: Removed.
2251         * bindings/js/JSNodeOrString.h: Removed.
2252
2253         * bindings/js/JSDOMBinding.h:
2254         (WebCore::VariadicHelperBase::convert): Deleted.
2255         (WebCore::toArguments): Deleted.
2256         Moved to JSDOMConvert.h and renamed to convertVariadicArguments and make
2257         it work in terms of IDLTypes.
2258
2259         * bindings/js/JSDOMConvert.h:
2260         (WebCore::Converter<IDLInterface<T>>::convert):
2261         (WebCore::VariadicConverterBase::convert):
2262         (WebCore::VariadicConverterBase<IDLInterface<T>>::convert):
2263         (WebCore::convertVariadicArguments):
2264
2265         * bindings/js/JSDocumentCustom.cpp:
2266         (WebCore::JSDocument::prepend): Deleted.
2267         (WebCore::JSDocument::append): Deleted.
2268         * bindings/js/JSDocumentFragmentCustom.cpp:
2269         (WebCore::JSDocumentFragment::prepend): Deleted.
2270         (WebCore::JSDocumentFragment::append): Deleted.
2271         * bindings/js/JSElementCustom.cpp:
2272         (WebCore::JSElement::before): Deleted.
2273         (WebCore::JSElement::after): Deleted.
2274         (WebCore::JSElement::replaceWith): Deleted.
2275         (WebCore::JSElement::prepend): Deleted.
2276         (WebCore::JSElement::append): Deleted.
2277         Remove now generated functions.
2278
2279         * bindings/scripts/CodeGenerator.pm:
2280         (assert):
2281         Add assert to help debugging.
2282
2283         (ParseInterface):
2284         Don't treat union types as interfaces.
2285
2286         (GetFlattenedMemberTypes):
2287         (GetNumberOfNullableMemberTypes):
2288         (GetIDLUnionMemberTypes):
2289         Implement WebIDL algorithms for getting the flattened member list of union, and use it
2290         to construct the c++ IDLType.
2291
2292         (GetBaseIDLType):
2293         (GetIDLType):
2294         Add helper to convert an parsed idlType to a c++ IDLType.
2295
2296         (IsWrapperType):
2297         Don't treat union types as wrappers.
2298         
2299         * bindings/scripts/CodeGeneratorJS.pm:
2300         (AddToImplIncludesForIDLType):
2301         Add helper for adding #includes based on a parsed idlType. It recursively handles union types.
2302
2303         (GenerateParametersCheck):
2304         Use the new convertVariadicArguments function to handle all variadic arguments, including
2305         union types.
2306
2307         * bindings/scripts/IDLParser.pm:
2308         (parseDictionaryMember):
2309         (parseAttributeRest):
2310         (parseOptionalOrRequiredArgument):
2311         (parseExceptionField):
2312         Add an idlType to domSignature and populate it.
2313
2314         * bindings/scripts/test/JS/JSTestObj.cpp:
2315         (WebCore::jsTestObjPrototypeFunctionOverloadedMethod13):
2316         (WebCore::jsTestObjPrototypeFunctionVariadicStringMethod):
2317         (WebCore::jsTestObjPrototypeFunctionVariadicDoubleMethod):
2318         (WebCore::jsTestObjPrototypeFunctionVariadicNodeMethod):
2319         (WebCore::jsTestObjPrototypeFunctionVariadicUnionMethod):
2320         * bindings/scripts/test/JS/JSTestOverloadedConstructors.cpp:
2321         (WebCore::constructJSTestOverloadedConstructors5):
2322         * bindings/scripts/test/TestObj.idl:
2323         Add and update tests.
2324
2325         * dom/ChildNode.idl:
2326         * dom/ParentNode.idl:
2327         Remove Custom extended attribute.
2328
2329         * dom/ContainerNode.cpp:
2330         * dom/ContainerNode.h:
2331         * dom/Node.cpp:
2332         * dom/Node.h:
2333         Switch to using std::reference_wrapper instead of Ref<> for passed in parameters.
2334
2335 2016-10-08  Youenn Fablet  <youenn@apple.com>
2336
2337         [Fetch API] Request constructor should provide exception messages
2338         https://bugs.webkit.org/show_bug.cgi?id=162382
2339
2340         Reviewed by Darin Adler.
2341
2342         No change of behavior, except that exceptions now have error messages.
2343
2344         Added support of exception messages to ExceptionOr.
2345         Making use of ExceptionOr for Request constructor parameter checking.
2346
2347         * Modules/fetch/FetchRequest.cpp:
2348         (WebCore::setReferrerPolicy):
2349         (WebCore::setMode):
2350         (WebCore::setCredentials):
2351         (WebCore::setCache):
2352         (WebCore::setRedirect):
2353         (WebCore::setMethod):
2354         (WebCore::setReferrer):
2355         (WebCore::buildOptions):
2356         (WebCore::FetchRequest::initializeOptions):
2357         (WebCore::FetchRequest::initializeWith):
2358         * Modules/fetch/FetchRequest.h:
2359         * Modules/fetch/FetchRequest.idl:
2360         * bindings/js/JSDOMBinding.cpp:
2361         (WebCore::setDOMException):
2362         * bindings/js/JSDOMBinding.h:
2363         (WebCore::toJS):
2364         (WebCore::toJSNewlyCreated):
2365         * dom/Exception.h:
2366         (WebCore::Exception::code):
2367         (WebCore::Exception::message):
2368         (WebCore::Exception::Exception):
2369         * dom/ExceptionOr.h:
2370         (WebCore::ExceptionOr<ReturnType>::exceptionMessage):
2371
2372 2016-10-08  Youenn Fablet  <youenn@apple.com>
2373
2374         Refactor binding generated casted-this checks
2375         https://bugs.webkit.org/show_bug.cgi?id=162677
2376
2377         Reviewed by Darin Adler.
2378
2379         No change of behavior.
2380
2381         Split the attribute getter function in two, one with the signature expected by JSCore and one used after casted-this checks.
2382
2383         The second function takes directly a JSXX object and returns a JSValue instead of an EncodedJSValue.
2384         In the future, the second function should only take references.
2385
2386         Introducing BindingCaller as a way to templatize binding code used to cast thisValue with the desired JSXX value.
2387         This allows implementing the first function using the second function as template parameter.
2388
2389         Introducing JSClass::castForAttribute as a way to encapsulate differences in the way to handle thisValue access.
2390
2391         * bindings/js/JSDOMBinding.h:
2392         (WebCore::BindingCaller::attribute):
2393         * bindings/scripts/CodeGeneratorJS.pm:
2394         (GenerateHeader):
2395         (GenerateImplementation):
2396         * bindings/scripts/test/JS/JSTestActiveDOMObject.cpp:
2397         * bindings/scripts/test/JS/JSTestActiveDOMObject.h:
2398         * bindings/scripts/test/JS/JSTestEventConstructor.cpp:
2399         * bindings/scripts/test/JS/JSTestEventConstructor.h:
2400         * bindings/scripts/test/JS/JSTestException.cpp:
2401         * bindings/scripts/test/JS/JSTestException.h:
2402         * bindings/scripts/test/JS/JSTestGlobalObject.cpp:
2403         * bindings/scripts/test/JS/JSTestInterface.cpp:
2404         * bindings/scripts/test/JS/JSTestInterface.h:
2405         * bindings/scripts/test/JS/JSTestJSBuiltinConstructor.cpp:
2406         * bindings/scripts/test/JS/JSTestJSBuiltinConstructor.h:
2407         * bindings/scripts/test/JS/JSTestNode.cpp:
2408         * bindings/scripts/test/JS/JSTestNode.h:
2409         * bindings/scripts/test/JS/JSTestNondeterministic.cpp:
2410         * bindings/scripts/test/JS/JSTestNondeterministic.h:
2411         * bindings/scripts/test/JS/JSTestObj.cpp:
2412         * bindings/scripts/test/JS/JSTestObj.h:
2413         * bindings/scripts/test/JS/JSTestSerializedScriptValueInterface.cpp:
2414         * bindings/scripts/test/JS/JSTestSerializedScriptValueInterface.h:
2415         * bindings/scripts/test/JS/JSTestTypedefs.cpp:
2416         * bindings/scripts/test/JS/JSTestTypedefs.h:
2417         * bindings/scripts/test/JS/JSattribute.cpp:
2418         * bindings/scripts/test/JS/JSattribute.h:
2419
2420 2016-10-08  Enrique Ocaña González  <eocanha@igalia.com>
2421
2422         Missing include in MediaDescription
2423         https://bugs.webkit.org/show_bug.cgi?id=162873
2424
2425         Reviewed by Xabier Rodriguez-Calvar.
2426
2427         Added missing header.
2428
2429         * platform/MediaDescription.h:
2430
2431 2016-10-08  Antti Koivisto  <antti@apple.com>
2432
2433         Move StyleResolver ownership from Document/ShadowRoot to Style::Scope
2434         https://bugs.webkit.org/show_bug.cgi?id=163148
2435
2436         Reviewed by Andreas Kling.
2437
2438         Reduce duplication between Document and ShadowRoot.
2439
2440         * css/CSSComputedStyleDeclaration.cpp:
2441         (WebCore::ComputedStyleExtractor::propertyValue):
2442         * css/CSSStyleSheet.cpp:
2443         (WebCore::CSSStyleSheet::didMutateRules):
2444         * css/ElementRuleCollector.cpp:
2445         (WebCore::ElementRuleCollector::matchHostPseudoClassRules):
2446         (WebCore::ElementRuleCollector::matchSlottedPseudoElementRules):
2447         * css/MediaQueryMatcher.cpp:
2448         (WebCore::MediaQueryMatcher::documentElementUserAgentStyle):
2449         * css/StyleMedia.cpp:
2450         (WebCore::StyleMedia::matchMedium):
2451         * css/parser/SizesAttributeParser.cpp:
2452         (WebCore::SizesAttributeParser::mediaConditionMatches):
2453         * dom/Document.cpp:
2454         (WebCore::Document::~Document):
2455         (WebCore::Document::childrenChanged):
2456         (WebCore::Document::isPageBoxVisible):
2457         (WebCore::Document::pageSizeAndMarginsInPixels):
2458         (WebCore::Document::userAgentShadowTreeStyleResolver):
2459         (WebCore::Document::fontsNeedUpdate):
2460         (WebCore::Document::didClearStyleResolver):
2461         (WebCore::Document::updateViewportUnitsOnResize):
2462         (WebCore::Document::createStyleResolver): Deleted.
2463         (WebCore::Document::clearStyleResolver): Deleted.
2464         * dom/Document.h:
2465         (WebCore::Document::styleResolverIfExists): Deleted.
2466         (WebCore::Document::ensureStyleResolver): Deleted.
2467         * dom/Element.cpp:
2468         (WebCore::Element::styleResolver):
2469         * dom/ShadowRoot.cpp:
2470         (WebCore::ShadowRoot::styleResolver): Deleted.
2471         (WebCore::ShadowRoot::styleResolverIfExists): Deleted.
2472         (WebCore::ShadowRoot::resetStyleResolver): Deleted.
2473         * dom/ShadowRoot.h:
2474         * page/DOMWindow.cpp:
2475         (WebCore::DOMWindow::getMatchedCSSRules):
2476         * page/FrameView.cpp:
2477         (WebCore::FrameView::layout):
2478         * page/Page.cpp:
2479         (WebCore::Page::updateStyleForAllPagesAfterGlobalChangeInEnvironment):
2480         * page/PrintContext.cpp:
2481         (WebCore::PrintContext::pageProperty):
2482         * platform/MemoryPressureHandler.cpp:
2483         (WebCore::MemoryPressureHandler::releaseCriticalMemory):
2484         * style/AttributeChangeInvalidation.cpp:
2485         (WebCore::Style::mayBeAffectedByHostStyle):
2486         * style/ClassChangeInvalidation.cpp:
2487         (WebCore::Style::mayBeAffectedByHostStyle):
2488         * style/IdChangeInvalidation.cpp:
2489         (WebCore::Style::mayBeAffectedByHostStyle):
2490         * style/StyleScope.cpp:
2491         (WebCore::Style::Scope::resolver):
2492         (WebCore::Style::Scope::resolverIfExists):
2493         (WebCore::Style::Scope::clearResolver):
2494         (WebCore::Style::Scope::analyzeStyleSheetChange):
2495         (WebCore::Style::Scope::updateActiveStyleSheets):
2496         (WebCore::Style::Scope::updateStyleResolver):
2497         (WebCore::Style::Scope::styleResolver): Deleted.
2498         (WebCore::Style::Scope::styleResolverIfExists): Deleted.
2499         * style/StyleScope.h:
2500         * style/StyleSharingResolver.cpp:
2501         (WebCore::Style::SharingResolver::resolve):
2502         (WebCore::Style::SharingResolver::canShareStyleWithElement):
2503         * style/StyleTreeResolver.cpp:
2504         (WebCore::Style::TreeResolver::Scope::Scope):
2505         (WebCore::Style::TreeResolver::resolve):
2506
2507 2016-10-07  Chris Dumez  <cdumez@apple.com>
2508
2509         window.navigator.language incorrectly returns all lowercase string
2510         https://bugs.webkit.org/show_bug.cgi?id=163096
2511
2512         Reviewed by Darin Adler.
2513
2514         Update navigator.language so that it no longer returns an all lowercase
2515         string (e.g. 'en-us' -> 'en-US'). This matches the behavior of other
2516         browsers and the specification which indicate we should return a
2517         BCP 47 language tag:
2518         - https://html.spec.whatwg.org/#dom-navigator-language
2519         - https://tools.ietf.org/html/bcp47
2520
2521         The other call sites relying on userPreferredLanguages() use case
2522         insensitive comparison so they will not break.
2523
2524         No new tests, updated existing test.
2525
2526         * platform/Language.h:
2527
2528 2016-10-07  Wenson Hsieh  <wenson_hsieh@apple.com>
2529
2530         Support onbeforeinput event handling for the new InputEvent spec
2531         https://bugs.webkit.org/show_bug.cgi?id=163021
2532         <rdar://problem/28658073>
2533
2534         Reviewed by Darin Adler.
2535
2536         Adds support for parsing the onbeforeinput attribute, and for sending default-preventable
2537         `beforeinput` InputEvents to the page. To do this, we introduce two new virtual methods:
2538         willApplyCommand and didApplyCommand on the CompositeEditCommand that are called before and
2539         after CompositeEditCommand::doApply, respectively. willApplyCommand indicates whether or not
2540         the composite editor command should proceed with applying the command.
2541
2542         Tweaks existing layout tests and adds new tests.
2543
2544         Tests: fast/events/before-input-events-different-start-end-elements.html
2545                fast/events/before-input-events-prevent-default-in-textfield.html
2546                fast/events/before-input-events-prevent-default.html
2547
2548         * dom/Document.idl:
2549         * dom/Element.idl:
2550         * dom/EventNames.h:
2551         * dom/Node.cpp:
2552         (WebCore::Node::dispatchInputEvent):
2553         (WebCore::Node::defaultEventHandler):
2554
2555         Currently, we fire input events in Node in response to dispatching a webkitEditableContentChangedEvent. After
2556         some discussion, Ryosuke and I believe that it will be ok to instead directly dispatch the input event where we
2557         would normally dispatch a webkitEditableContentChangedEvent.
2558
2559         * editing/CompositeEditCommand.cpp:
2560         (WebCore::EditCommandComposition::unapply):
2561         (WebCore::EditCommandComposition::reapply):
2562
2563         Added calls to Editor::willUnapplyEditing and Editor::willReapplyEditing.
2564
2565         (WebCore::CompositeEditCommand::willApplyCommand):
2566         (WebCore::CompositeEditCommand::apply):
2567         (WebCore::CompositeEditCommand::didApplyCommand):
2568
2569         Added new virtual functions, willApplyCommand and didApplyCommand, that surround a call to
2570         CompositeEditCommand::doApply. By default, they call willApplyEditing and appliedEditing on the editor, but may
2571         be overridden in special cases, such as in TypingCommand, where we invoke appliedEditing after adding a new
2572         typing command to the last open command.
2573
2574         If willApplyCommand returns false, CompositeEditCommand::apply will bail and not proceed with the command.
2575
2576         * editing/CompositeEditCommand.h:
2577         * editing/Editor.cpp:
2578         (WebCore::dispatchBeforeInputEvent):
2579         (WebCore::dispatchBeforeInputEvents):
2580         (WebCore::dispatchInputEvents):
2581         (WebCore::Editor::willApplyEditing):
2582         (WebCore::Editor::appliedEditing):
2583         (WebCore::Editor::willUnapplyEditing):
2584         (WebCore::Editor::unappliedEditing):
2585         (WebCore::Editor::willReapplyEditing):
2586         (WebCore::Editor::reappliedEditing):
2587         (WebCore::Editor::computeAndSetTypingStyle):
2588         (WebCore::dispatchEditableContentChangedEvents): Deleted.
2589         * editing/Editor.h:
2590         * editing/TypingCommand.cpp:
2591         (WebCore::TypingCommand::willApplyCommand):
2592         (WebCore::TypingCommand::didApplyCommand):
2593         (WebCore::TypingCommand::willAddTypingToOpenCommand):
2594         (WebCore::TypingCommand::insertTextRunWithoutNewlines):
2595         (WebCore::TypingCommand::insertLineBreak):
2596         (WebCore::TypingCommand::insertParagraphSeparator):
2597         (WebCore::TypingCommand::insertParagraphSeparatorInQuotedContent):
2598         (WebCore::TypingCommand::deleteKeyPressed):
2599         (WebCore::TypingCommand::forwardDeleteKeyPressed):
2600         (WebCore::TypingCommand::deleteSelection):
2601
2602         These now invoke willAddTypingToOpenCommand before proceeding with creating the command and applying it. The
2603         flow is now:
2604             - willAddTypingToOpenCommand
2605             - create and apply a new command
2606             - typingAddedToOpenCommand
2607
2608         * editing/TypingCommand.h:
2609         (WebCore::TypingCommand::preservesTypingStyle): Deleted.
2610         (WebCore::TypingCommand::shouldRetainAutocorrectionIndicator): Deleted.
2611         (WebCore::TypingCommand::setShouldRetainAutocorrectionIndicator): Deleted.
2612         (WebCore::TypingCommand::shouldStopCaretBlinking): Deleted.
2613         * html/HTMLAttributeNames.in:
2614         * html/HTMLElement.cpp:
2615         (WebCore::HTMLElement::createEventHandlerNameMap):
2616
2617 2016-10-07  Nan Wang  <n_wang@apple.com>
2618
2619         AX: <figcaption> should be AXTitleUIElement for other content inside the <figure>
2620         https://bugs.webkit.org/show_bug.cgi?id=108996
2621
2622         Reviewed by Chris Fleizach.
2623
2624         Exposed the figcaption element to be the AXTitleUIElement for the figure element. And used
2625         the figcaption's content as the accessible name of the figure. Also, updated the figure element's
2626         role description on Mac.
2627         Accessible name and description calculation for figure elements: 
2628         https://w3c.github.io/html-aam/#figure-and-figcaption-elements
2629
2630         Test: accessibility/mac/figure-element.html
2631
2632         * English.lproj/Localizable.strings:
2633         * accessibility/AccessibilityNodeObject.cpp:
2634         (WebCore::AccessibilityNodeObject::captionForFigure):
2635         (WebCore::AccessibilityNodeObject::alternativeText):
2636         * accessibility/AccessibilityNodeObject.h:
2637         * accessibility/AccessibilityObject.cpp:
2638         (WebCore::AccessibilityObject::isFigure):
2639         (WebCore::AccessibilityObject::isSuperscriptStyleGroup): Deleted.
2640         * accessibility/AccessibilityObject.h:
2641         * accessibility/AccessibilityRenderObject.cpp:
2642         (WebCore::AccessibilityRenderObject::exposesTitleUIElement):
2643         (WebCore::AccessibilityRenderObject::titleUIElement):
2644         (WebCore::AccessibilityRenderObject::computeAccessibilityIsIgnored):
2645         * accessibility/mac/WebAccessibilityObjectWrapperMac.mm:
2646         (-[WebAccessibilityObjectWrapper roleDescription]):
2647         * platform/LocalizedStrings.cpp:
2648         (WebCore::AXFigureText):
2649         * platform/LocalizedStrings.h:
2650         * platform/efl/LocalizedStringsEfl.cpp:
2651         (WebCore::AXFigureText):
2652         * platform/gtk/LocalizedStringsGtk.cpp:
2653         (WebCore::AXFigureText):
2654
2655 2016-10-07  Alex Christensen  <achristensen@webkit.org>
2656
2657         Non-special URL fragments should percent-encode non-ASCII characters
2658         https://bugs.webkit.org/show_bug.cgi?id=163153
2659
2660         Reviewed by Tim Horton.
2661
2662         This is needed to keep compatibility with data URLs with non-ASCII characters after a '#'
2663         which works in Chrome, Firefox, and Safari, while maintaining compatibility with Chrome, IE, and Edge
2664         which keep non-ASCII characters in the fragments of special URLs.
2665         This was proposed to the spec in https://github.com/whatwg/url/issues/150
2666
2667         Covered by new API tests.
2668
2669         * platform/URLParser.cpp:
2670         (WebCore::URLParser::syntaxViolation):
2671         Removed assertion because we now have fragments that need percent encoding but are all ASCII.
2672         (WebCore::URLParser::fragmentSyntaxViolation):
2673         (WebCore::URLParser::parse):
2674
2675 2016-10-07  Brent Fulgham  <bfulgham@apple.com>
2676
2677         EventHandler functions that need to guarantee event handler lifetime need to use Ref<Frame>
2678         https://bugs.webkit.org/show_bug.cgi?id=98617
2679         <rdar://problem/12778649>
2680
2681         Reviewed by Daniel Bates.
2682
2683         Improve stability by ensuring that the Frame holding an active EventHandler is kept
2684         alive while in the process of handling events and executing JavaScript.
2685
2686         No new tests since there is no change in behavior.
2687
2688         * page/EventHandler.cpp:
2689         (WebCore::EventHandler::handleMousePressEventSingleClick): Protect the Frame with a Ref<>.
2690         (WebCore::EventHandler::handleMousePressEvent): Ditto.
2691         (WebCore::EventHandler::handleMouseDraggedEvent): Ditto.
2692         (WebCore::EventHandler::eventMayStartDrag): Ditto.
2693         (WebCore::EventHandler::handleMouseReleaseEvent): Ditto.
2694         (WebCore::EventHandler::hitTestResultAtPoint): Ditto.
2695         (WebCore::EventHandler::scrollRecursively): Ditto.
2696         (WebCore::EventHandler::logicalScrollRecursively): Ditto.
2697         (WebCore::EventHandler::selectCursor): Ditto.
2698         (WebCore::EventHandler::handleMouseDoubleClickEvent): Ditto.
2699         (WebCore::EventHandler::mouseMoved): Ditto.
2700         (WebCore::EventHandler::handleMouseMoveEvent): Ditto.
2701         (WebCore::EventHandler::handleMouseForceEvent): Ditto.
2702         (WebCore::EventHandler::dispatchDragEvent): Ditto.
2703         (WebCore::EventHandler::updateDragAndDrop): Ditto.
2704         (WebCore::EventHandler::cancelDragAndDrop): Ditto.
2705         (WebCore::EventHandler::performDragAndDrop): Ditto.
2706         (WebCore::EventHandler::prepareMouseEvent): Ditto.
2707         (WebCore::EventHandler::updateMouseEventTargetNode): Ditto.
2708         (WebCore::EventHandler::dispatchMouseEvent): Ditto.
2709         (WebCore::EventHandler::platformCompleteWheelEvent): Ditto.
2710         (WebCore::EventHandler::handleWheelEvent): Ditto.
2711         (WebCore::EventHandler::defaultWheelEventHandler): Ditto.
2712         (WebCore::EventHandler::sendContextMenuEvent): Ditto.
2713         (WebCore::EventHandler::sendContextMenuEventForKey): Ditto.
2714         (WebCore::EventHandler::hoverTimerFired): Ditto.
2715         (WebCore::EventHandler::keyEvent): Ditto.
2716         (WebCore::EventHandler::defaultKeyboardEventHandler): Ditto.
2717         (WebCore::EventHandler::handleDrag): Ditto.
2718         (WebCore::EventHandler::handleTextInputEvent): Ditto.
2719         (WebCore::EventHandler::defaultSpaceEventHandler): Ditto.
2720         (WebCore::EventHandler::defaultTabEventHandler): Ditto.
2721         (WebCore::EventHandler::sendScrollEvent): Ditto.
2722         (WebCore::EventHandler::handleTouchEvent): Ditto.
2723         * page/ios/EventHandlerIOS.mm:
2724         (WebCore::EventHandler::focusDocumentView): Ditto.
2725         * page/mac/EventHandlerMac.mm:
2726         (WebCore::EventHandler::platformCompleteWheelEvent): Ditto.
2727
2728 2016-10-07  Chris Dumez  <cdumez@apple.com>
2729
2730         Regression(r201970): productSub / vendor / vendorSub should not be exposed on WorkerNavigator
2731         https://bugs.webkit.org/show_bug.cgi?id=163124
2732
2733         Reviewed by Ryosuke Niwa.
2734
2735         productSub / vendor / vendorSub should not be exposed on WorkerNavigator:
2736         - https://html.spec.whatwg.org/#navigatorid
2737
2738         Test case:
2739         - http://w3c-test.org/submissions/3881/html/webappapis/system-state-and-capabilities/the-navigator-object/NavigatorID.worker
2740
2741         Note that the specification also restricts NavigatorID's appCodeName and
2742         product attributes to Window. However, it seems the HTML specification is
2743         about to get updated so that these get exposed to workers:
2744         - https://github.com/whatwg/html/pull/1870
2745
2746         No new tests, updated existing test.
2747
2748         * bindings/scripts/generate-bindings.pl:
2749         (shouldPropertyBeExposed):
2750         * page/NavigatorID.idl:
2751
2752 2016-10-07  Alex Christensen  <achristensen@webkit.org>
2753
2754         Disable URLParser logs by default in all builds
2755         https://bugs.webkit.org/show_bug.cgi?id=163135
2756
2757         Reviewed by Brady Eidson.
2758
2759         In debug builds with the URLParser enabled, some tests time out because
2760         parameters to generate log strings are being evaluated for each character of each URL
2761         and then not being used if URLParser logs are disabled.  Generating these unused parameters
2762         is too slow even for debug builds.  Let's only generate them if they are to be used.
2763
2764         No change in behaviour.
2765
2766         * platform/URLParser.cpp:
2767         (WebCore::URLParser::parse):
2768         (WebCore::URLParser::allValuesEqual):
2769
2770 2016-10-07  Andreas Kling  <akling@apple.com>
2771
2772         [WK2] didRemoveFrameFromHierarchy callback doesn't fire for subframes when evicting from PageCache.
2773         <https://webkit.org/b/163098>
2774         <rdar://problem/28663488>
2775
2776         Reviewed by Antti Koivisto.
2777
2778         Fix a bug where WK2 didRemoveFrameFromHierarchy callbacks wouldn't fire for subframes that were getting
2779         kicked out of PageCache. The problem was happening because CachedFrame would disconnect the Frame from
2780         its Page just before calling FrameLoader::detachViewsAndDocumentLoader() where the callbacks are fired.
2781         Without a Page, the WebFrame on WK2 side can't find its WebPage, and so it can't fire its callbacks.
2782
2783         The fix is just to switch the order of those two lines.
2784
2785         This bug was causing frequent DOM and window object leaks in some clients *cough* Safari *cough* that
2786         were relying on didRemoveFrameFromHierarchy to release their isolated worlds.
2787
2788         Test: WebKit2.DidRemoveFrameFromHiearchyInPageCache
2789
2790         * history/CachedFrame.cpp:
2791         (WebCore::CachedFrame::destroy):
2792
2793 2016-10-07  Nan Wang  <n_wang@apple.com>
2794
2795         AX: AXRoleDescription for details and summary elements
2796         https://bugs.webkit.org/show_bug.cgi?id=163094
2797
2798         Reviewed by Chris Fleizach.
2799
2800         details and summary elements should have AXRoleDescription that is consistent with other
2801         elements that have custom AXSubRole.
2802
2803         Test: accessibility/mac/details-summary-role-description.html
2804
2805         * English.lproj/Localizable.strings:
2806         * accessibility/mac/WebAccessibilityObjectWrapperMac.mm:
2807         (-[WebAccessibilityObjectWrapper roleDescription]):
2808         * platform/LocalizedStrings.cpp:
2809         (WebCore::AXDetailsText):
2810         (WebCore::AXSummaryText):
2811         * platform/LocalizedStrings.h:
2812         * platform/efl/LocalizedStringsEfl.cpp:
2813         (WebCore::AXDetailsText):
2814         (WebCore::AXSummaryText):
2815         * platform/gtk/LocalizedStringsGtk.cpp:
2816         (WebCore::AXDetailsText):
2817         (WebCore::AXSummaryText):
2818
2819 2016-10-07  Ryan Haddad  <ryanhaddad@apple.com>
2820
2821         Fix the Windows build after r206917.
2822
2823         Unreviewed build fix.
2824
2825         * dom/DOMAllInOne.cpp:
2826
2827 2016-10-07  Antti Koivisto  <antti@apple.com>
2828
2829         Rename AuthorStyleSheets to Style::Scope
2830         https://bugs.webkit.org/show_bug.cgi?id=163108
2831
2832         Reviewed by Andreas Kling.
2833
2834         It represents the style scope in DOM.
2835         Also move the file under style/.
2836
2837         * CMakeLists.txt:
2838         * WebCore.xcodeproj/project.pbxproj:
2839         * css/CSSStyleSheet.cpp:
2840         (WebCore::CSSStyleSheet::styleSheetScope):
2841         * css/CSSStyleSheet.h:
2842         * css/InspectorCSSOMWrappers.cpp:
2843         (WebCore::InspectorCSSOMWrappers::getWrapperForRuleInSheets):
2844         * css/InspectorCSSOMWrappers.h:
2845         * css/StyleSheetList.cpp:
2846         (WebCore::StyleSheetList::styleSheets):
2847         (WebCore::StyleSheetList::detachFromDocument):
2848         * dom/AuthorStyleSheets.cpp: Removed.
2849         * dom/AuthorStyleSheets.h: Removed.
2850         * dom/Document.cpp:
2851         (WebCore::Document::Document):
2852         (WebCore::Document::setContentLanguage):
2853         (WebCore::Document::recalcStyle):
2854         (WebCore::Document::needsStyleRecalc):
2855         (WebCore::Document::updateStyleIfNeeded):
2856         (WebCore::Document::updateLayoutIgnorePendingStylesheets):
2857         (WebCore::Document::createStyleResolver):
2858         (WebCore::Document::didRemoveAllPendingStylesheet):
2859         (WebCore::Document::usesStyleBasedEditability):
2860         (WebCore::Document::processHttpEquiv):
2861         (WebCore::Document::preferredStylesheetSet):
2862         (WebCore::Document::selectedStylesheetSet):
2863         (WebCore::Document::setSelectedStylesheetSet):
2864         (WebCore::Document::haveStylesheetsLoaded):
2865         * dom/Document.h:
2866         (WebCore::Document::styleScope):
2867         (WebCore::Document::authorStyleSheets): Deleted.
2868         * dom/ExtensionStyleSheets.cpp:
2869         (WebCore::ExtensionStyleSheets::clearPageUserSheet):
2870         (WebCore::ExtensionStyleSheets::updatePageUserSheet):
2871         (WebCore::ExtensionStyleSheets::invalidateInjectedStyleSheetCache):
2872         (WebCore::ExtensionStyleSheets::addUserStyleSheet):
2873         (WebCore::ExtensionStyleSheets::addAuthorStyleSheetForTesting):
2874         (WebCore::ExtensionStyleSheets::styleResolverChangedTimerFired):
2875         * dom/InlineStyleSheetOwner.cpp:
2876         (WebCore::InlineStyleSheetOwner::insertedIntoDocument):
2877         (WebCore::InlineStyleSheetOwner::removedFromDocument):
2878         (WebCore::InlineStyleSheetOwner::clearDocumentData):
2879         (WebCore::InlineStyleSheetOwner::createSheet):
2880         (WebCore::InlineStyleSheetOwner::sheetLoaded):
2881         (WebCore::InlineStyleSheetOwner::startLoadingDynamicSheet):
2882         * dom/InlineStyleSheetOwner.h:
2883         (WebCore::InlineStyleSheetOwner::styleScope):
2884         (WebCore::InlineStyleSheetOwner::styleSheetScope): Deleted.
2885         * dom/ProcessingInstruction.cpp:
2886         (WebCore::ProcessingInstruction::~ProcessingInstruction):
2887         (WebCore::ProcessingInstruction::checkStyleSheet):
2888         (WebCore::ProcessingInstruction::sheetLoaded):
2889         (WebCore::ProcessingInstruction::insertedInto):
2890         (WebCore::ProcessingInstruction::removedFrom):
2891         * dom/ShadowRoot.cpp:
2892         (WebCore::ShadowRoot::styleResolver):
2893         (WebCore::ShadowRoot::styleScope):
2894         (WebCore::ShadowRoot::updateStyle):
2895         (WebCore::ShadowRoot::authorStyleSheets): Deleted.
2896         * dom/ShadowRoot.h:
2897         * html/HTMLLinkElement.cpp:
2898         (WebCore::HTMLLinkElement::~HTMLLinkElement):
2899         (WebCore::HTMLLinkElement::setDisabledState):
2900         (WebCore::HTMLLinkElement::parseAttribute):
2901         (WebCore::HTMLLinkElement::process):
2902         (WebCore::HTMLLinkElement::insertedInto):
2903         (WebCore::HTMLLinkElement::removedFrom):
2904         (WebCore::HTMLLinkElement::addPendingSheet):
2905         (WebCore::HTMLLinkElement::removePendingSheet):
2906         * html/HTMLStyleElement.cpp:
2907         * inspector/InspectorCSSAgent.cpp:
2908         (WebCore::InspectorCSSAgent::collectAllDocumentStyleSheets):
2909         (WebCore::InspectorCSSAgent::forcePseudoState):
2910         (WebCore::InspectorCSSAgent::buildObjectForRule):
2911         (WebCore::InspectorCSSAgent::resetPseudoStates):
2912         * inspector/InspectorPageAgent.cpp:
2913         (WebCore::InspectorPageAgent::setEmulatedMedia):
2914         * page/DOMWindow.cpp:
2915         (WebCore::DOMWindow::getMatchedCSSRules):
2916         * page/Frame.cpp:
2917         (WebCore::Frame::setPrinting):
2918         * page/FrameView.cpp:
2919         (WebCore::FrameView::layout):
2920         (WebCore::FrameView::setPagination):
2921         (WebCore::FrameView::setViewportSizeForCSSViewportUnits):
2922         * page/Page.cpp:
2923         (WebCore::Page::setViewMode):
2924         (WebCore::Page::setNeedsRecalcStyleInAllFrames):
2925         (WebCore::Page::invalidateInjectedStyleSheetCacheInAllFrames):
2926         * style/StyleScope.cpp: Copied from dom/AuthorStyleSheets.cpp.
2927         (WebCore::Style::Scope::Scope):
2928         (WebCore::Style::Scope::styleResolver):
2929         (WebCore::Style::Scope::styleResolverIfExists):
2930         (WebCore::Style::Scope::forNode):
2931         (WebCore::Style::Scope::removePendingSheet):
2932         (WebCore::Style::Scope::addStyleSheetCandidateNode):
2933         (WebCore::Style::Scope::removeStyleSheetCandidateNode):
2934         (WebCore::Style::Scope::collectActiveStyleSheets):
2935         (WebCore::Style::Scope::analyzeStyleSheetChange):
2936         (WebCore::Style::Scope::updateActiveStyleSheets):
2937         (WebCore::Style::Scope::updateStyleResolver):
2938         (WebCore::Style::Scope::activeStyleSheetsForInspector):
2939         (WebCore::Style::Scope::activeStyleSheetsContains):
2940         (WebCore::Style::Scope::flushPendingUpdate):
2941         (WebCore::Style::Scope::clearPendingUpdate):
2942         (WebCore::Style::Scope::scheduleActiveSetUpdate):
2943         (WebCore::Style::Scope::didChangeCandidatesForActiveSet):
2944         (WebCore::Style::Scope::didChangeContentsOrInterpretation):
2945         (WebCore::Style::Scope::pendingUpdateTimerFired):
2946         (WebCore::AuthorStyleSheets::AuthorStyleSheets): Deleted.
2947         (WebCore::AuthorStyleSheets::styleResolver): Deleted.
2948         (WebCore::AuthorStyleSheets::styleResolverIfExists): Deleted.
2949         (WebCore::AuthorStyleSheets::forNode): Deleted.
2950         (WebCore::AuthorStyleSheets::removePendingSheet): Deleted.
2951         (WebCore::AuthorStyleSheets::addStyleSheetCandidateNode): Deleted.
2952         (WebCore::AuthorStyleSheets::removeStyleSheetCandidateNode): Deleted.
2953         (WebCore::AuthorStyleSheets::collectActiveStyleSheets): Deleted.
2954         (WebCore::AuthorStyleSheets::analyzeStyleSheetChange): Deleted.
2955         (WebCore::AuthorStyleSheets::updateActiveStyleSheets): Deleted.
2956         (WebCore::AuthorStyleSheets::updateStyleResolver): Deleted.
2957         (WebCore::AuthorStyleSheets::activeStyleSheetsForInspector): Deleted.
2958         (WebCore::AuthorStyleSheets::activeStyleSheetsContains): Deleted.
2959         (WebCore::AuthorStyleSheets::flushPendingUpdate): Deleted.
2960         (WebCore::AuthorStyleSheets::clearPendingUpdate): Deleted.
2961         (WebCore::AuthorStyleSheets::scheduleActiveSetUpdate): Deleted.
2962         (WebCore::AuthorStyleSheets::didChangeCandidatesForActiveSet): Deleted.
2963         (WebCore::AuthorStyleSheets::didChangeContentsOrInterpretation): Deleted.
2964         (WebCore::AuthorStyleSheets::pendingUpdateTimerFired): Deleted.
2965         * style/StyleScope.h: Copied from dom/AuthorStyleSheets.h.
2966         * style/StyleTreeResolver.cpp:
2967         * svg/SVGFontFaceElement.cpp:
2968         (WebCore::SVGFontFaceElement::rebuildFontFace):
2969         (WebCore::SVGFontFaceElement::removedFrom):
2970         * xml/XMLTreeViewer.cpp:
2971         (WebCore::XMLTreeViewer::transformDocumentToTreeView):
2972         * xml/parser/XMLDocumentParser.cpp:
2973         (WebCore::XMLDocumentParser::end):
2974         * xml/parser/XMLDocumentParserLibxml2.cpp:
2975         (WebCore::XMLDocumentParser::doEnd):
2976
2977 2016-10-07  Zalan Bujtas  <zalan@apple.com>
2978
2979         https://vuldb.com/?cvssv3.2012 takes long time to load.
2980         https://bugs.webkit.org/show_bug.cgi?id=162994
2981         <rdar://problem/28593746>
2982
2983         Reviewed by Darin Adler.
2984
2985         Stop visiting cousins when we hit the style sharing search threshold.
2986
2987         In addition to mistakenly ignoring the threshold at SharingResolver::findSibling(), we
2988         continued on searching for cousin elements. 
2989
2990         Test: fast/selectors/slow-style-sharing-with-long-cousin-list.html
2991
2992         * style/StyleSharingResolver.cpp:
2993         (WebCore::Style::SharingResolver::resolve):
2994         (WebCore::Style::SharingResolver::findSibling):
2995         (WebCore::Style::SharingResolver::locateCousinList):
2996
2997 2016-10-07  Romain Bellessort  <romain.bellessort@crf.canon.fr>
2998
2999         [Readable Streams API] Implement generic reader functions
3000         https://bugs.webkit.org/show_bug.cgi?id=163003
3001
3002         Reviewed by Darin Adler.
3003
3004         Implements reader generic functions defined by spec in order to prepare BYOBReader integration.
3005         Generic functions factorize some code that is used by both DefaultReader and BYOBReader.
3006
3007         No change in behaviour.
3008
3009         * Modules/streams/ReadableStreamDefaultReader.js:
3010         (cancel): Rely on readableStreamReaderGenericCancel.
3011         (releaseLock): Rely on readableStreamReaderGenericRelease.
3012         * Modules/streams/ReadableStreamInternals.js:
3013         (privateInitializeReadableStreamDefaultReader): Rely on readableStreamReaderGenericInitialize.
3014         (readableStreamReaderGenericInitialize): Added.
3015         (readableStreamReaderGenericCancel): Added.
3016         (readableStreamReaderGenericRelease): Added.
3017
3018 2016-10-07  Adam Bergkvist  <adam.bergkvist@ericsson.com>
3019
3020         WebRTC: Misc gardening: Use typedefs consistently and remove unused code
3021         https://bugs.webkit.org/show_bug.cgi?id=163104
3022
3023         Reviewed by Philippe Normand.
3024
3025         Miscellaneous WebRTC gardening. See file list below for details.
3026
3027         Testing: No change in behavior.
3028
3029         * Modules/mediastream/MediaEndpointPeerConnection.cpp:
3030         * Modules/mediastream/MediaEndpointPeerConnection.h:
3031         Move NotImplemented include to cpp-file.
3032         * platform/mediastream/MediaEndpoint.h:
3033         Use MediaPayloadVector typedef (instead of Vector<RefPtr<MediaPayload>>).
3034         * platform/mediastream/PeerMediaDescription.h:
3035         (WebCore::PeerMediaDescription::source): Deleted.
3036         (WebCore::PeerMediaDescription::setSource): Deleted.
3037         Sources are passed to updateSendConfiguration() via a source map and not added to each
3038         PeerMediaDescription anymore. Remove unused code.
3039         * platform/mock/MockMediaEndpoint.cpp:
3040         (WebCore::MockMediaEndpoint::getDefaultAudioPayloads):
3041         (WebCore::MockMediaEndpoint::getDefaultVideoPayloads):
3042         Use MediaPayloadVector typedef.
3043         * platform/mock/MockMediaEndpoint.h:
3044         Use MediaPayloadVector typedef.
3045
3046 2016-10-07  Gwang Yoon Hwang  <yoon@igalia.com>
3047
3048         [GTK] Remove unneeded creation of TextureMapperPlatformLayerProxy
3049         https://bugs.webkit.org/show_bug.cgi?id=163101
3050
3051         Reviewed by Žan Doberšek.
3052
3053         Covered by existing tests.
3054
3055         * platform/graphics/cairo/ImageBufferCairo.cpp:
3056         (WebCore::ImageBufferData::ImageBufferData): Modified not to create
3057         TextureMapperPlatformLayerProxy if it is not created for the
3058         accelerated 2d canvas.
3059
3060 2016-10-07  Fujii Hironori  <Hironori.Fujii@sony.com>
3061
3062         Use 'use lib $FindBin::Bin' to append Perl module include path
3063         https://bugs.webkit.org/show_bug.cgi?id=162256
3064
3065         Reviewed by Carlos Garcia Campos.
3066
3067         Some Perl  scripts are needed to  be executed with '-I'  switch to
3068         explicitly append Perl module include path.  Use 'use lib' as well
3069         as other Perl scripts do.
3070
3071         * CMakeLists.txt: Removed '-I' options from invocation of Perl.
3072         * DerivedSources.make: Ditto.
3073         * bindings/scripts/generate-bindings.pl: Use 'use lib'.
3074         * bindings/scripts/preprocess-idls.pl: Ditto.
3075         * css/make-css-file-arrays.pl: Ditto.
3076         * css/makegrammar.pl: Ditto.
3077         * css/makeprop.pl: Ditto.
3078         * css/makevalues.pl: Ditto.
3079         * dom/make_dom_exceptions.pl: Ditto.
3080         * dom/make_event_factory.pl: Ditto.
3081         * dom/make_names.pl: Ditto.
3082         * page/make_settings.pl: Ditto.
3083
3084 2016-10-07  Youenn Fablet  <youenn@apple.com>
3085
3086         Refactor CachedResourceClient::notifyFinished
3087         https://bugs.webkit.org/show_bug.cgi?id=162060
3088
3089         Reviewed by Darin Adler.
3090
3091         No change of behavior.
3092
3093         Making CachedResourceClient and CachedRawResourceClient callbacks take CachedResource references and not pointers.
3094         In most cases, the CachedResource parameter is only used for assertions.
3095         Removing that parameter might be contemplated in the future.
3096         The only real case is in RenderImage.
3097
3098         Removed the CachedResource parameter from ContentFilter methods as code was calling these methods with null values.
3099
3100         * dom/LoadableClassicScript.cpp:
3101         (WebCore::LoadableClassicScript::notifyFinished):
3102         * dom/LoadableClassicScript.h:
3103         * html/HTMLImageLoader.cpp:
3104         (WebCore::HTMLImageLoader::notifyFinished):
3105         * html/HTMLImageLoader.h:
3106         * loader/ContentFilter.cpp:
3107         (WebCore::ContentFilter::continueAfterResponseReceived):
3108         (WebCore::ContentFilter::continueAfterDataReceived):
3109         (WebCore::ContentFilter::continueAfterNotifyFinished):
3110         (WebCore::ContentFilter::deliverResourceData):
3111         * loader/ContentFilter.h:
3112         * loader/CrossOriginPreflightChecker.cpp:
3113         (WebCore::CrossOriginPreflightChecker::notifyFinished):
3114         * loader/CrossOriginPreflightChecker.h:
3115         * loader/DocumentLoader.cpp:
3116         (WebCore::DocumentLoader::notifyFinished):
3117         (WebCore::DocumentLoader::handleSubstituteDataLoadNow):
3118         (WebCore::DocumentLoader::redirectReceived):
3119         (WebCore::DocumentLoader::responseReceived):
3120         (WebCore::DocumentLoader::continueAfterContentPolicy):
3121         (WebCore::DocumentLoader::dataReceived):
3122         * loader/DocumentLoader.h:
3123         * loader/DocumentThreadableLoader.cpp:
3124         (WebCore::DocumentThreadableLoader::redirectReceived):
3125         (WebCore::DocumentThreadableLoader::dataSent):
3126         (WebCore::DocumentThreadableLoader::responseReceived):
3127         (WebCore::DocumentThreadableLoader::dataReceived):
3128         (WebCore::DocumentThreadableLoader::notifyFinished):
3129         * loader/DocumentThreadableLoader.h:
3130         * loader/ImageLoader.cpp:
3131         (WebCore::ImageLoader::notifyFinished):
3132         * loader/ImageLoader.h:
3133         * loader/LinkLoader.cpp:
3134         (WebCore::LinkLoader::triggerEvents):
3135         (WebCore::LinkLoader::notifyFinished):
3136         * loader/LinkLoader.h:
3137         * loader/LinkPreloadResourceClients.cpp:
3138         (WebCore::LinkPreloadResourceClient::triggerEvents):
3139         * loader/LinkPreloadResourceClients.h:
3140         * loader/MediaResourceLoader.cpp:
3141         (WebCore::MediaResource::responseReceived):
3142         (WebCore::MediaResource::shouldCacheResponse):
3143         (WebCore::MediaResource::redirectReceived):
3144         (WebCore::MediaResource::dataSent):
3145         (WebCore::MediaResource::dataReceived):
3146         (WebCore::MediaResource::notifyFinished):
3147         (WebCore::MediaResource::getOrCreateReadBuffer):
3148         * loader/MediaResourceLoader.h:
3149         * loader/TextTrackLoader.cpp:
3150         (WebCore::TextTrackLoader::processNewCueData):
3151         (WebCore::TextTrackLoader::deprecatedDidReceiveCachedResource):
3152         (WebCore::TextTrackLoader::notifyFinished):
3153         * loader/TextTrackLoader.h:
3154         * loader/cache/CachedRawResource.cpp:
3155         (WebCore::CachedRawResource::notifyClientsDataWasReceived):
3156         (WebCore::CachedRawResource::didAddClient):
3157         (WebCore::CachedRawResource::redirectReceived):
3158         (WebCore::CachedRawResource::responseReceived):
3159         (WebCore::CachedRawResource::shouldCacheResponse):
3160         (WebCore::CachedRawResource::didSendData):
3161         * loader/cache/CachedRawResourceClient.h:
3162         (WebCore::CachedRawResourceClient::dataSent):
3163         (WebCore::CachedRawResourceClient::responseReceived):
3164         (WebCore::CachedRawResourceClient::shouldCacheResponse):
3165         (WebCore::CachedRawResourceClient::dataReceived):
3166         (WebCore::CachedRawResourceClient::redirectReceived):
3167         (WebCore::CachedRawResourceClient::getOrCreateReadBuffer):
3168         * loader/cache/CachedResource.cpp:
3169         (WebCore::CachedResource::checkNotify):
3170         (WebCore::CachedResource::didAddClient):
3171         * loader/cache/CachedResourceClient.h:
3172         (WebCore::CachedResourceClient::notifyFinished):
3173         (WebCore::CachedResourceClient::deprecatedDidReceiveCachedResource):
3174         * loader/cache/CachedTextTrack.cpp:
3175         (WebCore::CachedTextTrack::updateData):
3176         * loader/icon/IconLoader.cpp:
3177         (WebCore::IconLoader::notifyFinished):
3178         * loader/icon/IconLoader.h:
3179         * loader/soup/CachedRawResourceSoup.cpp:
3180         * platform/graphics/avfoundation/cf/WebCoreAVCFResourceLoader.cpp:
3181         (WebCore::WebCoreAVCFResourceLoader::responseReceived):
3182         (WebCore::WebCoreAVCFResourceLoader::dataReceived):
3183         (WebCore::WebCoreAVCFResourceLoader::notifyFinished):
3184         (WebCore::WebCoreAVCFResourceLoader::fulfillRequestWithResource):
3185         * platform/graphics/avfoundation/cf/WebCoreAVCFResourceLoader.h:
3186         * platform/graphics/avfoundation/objc/WebCoreAVFResourceLoader.h:
3187         * platform/graphics/avfoundation/objc/WebCoreAVFResourceLoader.mm:
3188         (WebCore::WebCoreAVFResourceLoader::responseReceived):
3189         (WebCore::WebCoreAVFResourceLoader::dataReceived):
3190         (WebCore::WebCoreAVFResourceLoader::notifyFinished):
3191         (WebCore::WebCoreAVFResourceLoader::fulfillRequestWithResource):
3192         * rendering/RenderImage.cpp:
3193         (WebCore::RenderImage::notifyFinished):
3194         * rendering/RenderImage.h:
3195         * rendering/RenderLayerFilterInfo.cpp:
3196         (WebCore::RenderLayer::FilterInfo::setRenderer):
3197         (WebCore::RenderLayer::FilterInfo::notifyFinished):
3198         * rendering/RenderLayerFilterInfo.h:
3199         * svg/SVGFEImageElement.cpp:
3200         (WebCore::SVGFEImageElement::notifyFinished):
3201         * svg/SVGFEImageElement.h:
3202         * svg/SVGUseElement.cpp:
3203         (WebCore::SVGUseElement::notifyFinished):
3204         * svg/SVGUseElement.h:
3205         * xml/parser/XMLDocumentParser.cpp:
3206         (WebCore::XMLDocumentParser::notifyFinished):
3207         * xml/parser/XMLDocumentParser.h:
3208
3209 2016-10-06  Youenn Fablet  <youenn@apple.com>
3210
3211         CachedXSLStylesheet does not need to be updated according Origin/Fetch mode
3212         https://bugs.webkit.org/show_bug.cgi?id=162389
3213
3214         Reviewed by Darin Adler.
3215
3216         No change of behavior.
3217
3218         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.
3219
3220         Renaming CachedResource::isClean to CachedResource::isCORSSameOrigin to better match spec terminology.
3221         Updating HTMLLinkElement accordingly.
3222
3223         * html/HTMLLinkElement.cpp:
3224         (WebCore::HTMLLinkElement::initializeStyleSheet):
3225         * loader/cache/CachedResource.cpp:
3226         (WebCore::CachedResource::isCORSSameOrigin): Ensuring that this method is not called for resource types for which CORS is not to be used.
3227         (WebCore::CachedResource::isClean): Deleted.
3228         * loader/cache/CachedResource.h:
3229         * loader/cache/CachedResourceLoader.cpp:
3230         (WebCore::CachedResourceLoader::shouldUpdateCachedResourceWithCurrentRequest):
3231
3232 2016-10-06  Youenn Fablet  <youenn@apple.com>
3233
3234         Add a place for common HTTP Header values
3235         https://bugs.webkit.org/show_bug.cgi?id=163002
3236
3237         Reviewed by Alex Christensen.
3238
3239         No change of behavior.
3240
3241         Introducing HTTPHeaderValues with two Content-Type values.
3242
3243         * CMakeLists.txt:
3244         * Modules/fetch/FetchBody.cpp:
3245         (WebCore::FetchBody::extract):
3246         * WebCore.xcodeproj/project.pbxproj:
3247         * platform/network/HTTPHeaderValues.cpp: Added.
3248         (WebCore::HTTPHeaderValues::TextPlainContentType):
3249         (WebCore::HTTPHeaderValues::FormURLEncodedContentType):
3250         * platform/network/HTTPHeaderValues.h: Added.
3251         * xml/XMLHttpRequest.cpp:
3252         (WebCore::XMLHttpRequest::send):
3253
3254 2016-10-06  Youenn Fablet  <youenn@apple.com>
3255
3256         CachedResourceRequest should not need to store defer and preload options
3257         https://bugs.webkit.org/show_bug.cgi?id=163004
3258
3259         Reviewed by Alex Christensen.
3260
3261         No change of behavior.
3262
3263         Removing CachedResourceRequest defer and preload fields.
3264         These fields are computed inside CachedResourceLoader instead.
3265
3266         Updated setting of priority from CachedResourceRequest to CachedResource.
3267         Priority is set for any new resource (this covers all cases where no cached resource can be reused from the memory cache).
3268         Priority is set for a cached resource if the request is not a preload request.
3269
3270         * loader/LinkLoader.cpp:
3271         (WebCore::LinkLoader::preloadIfNeeded):
3272         * loader/cache/CachedResource.cpp:
3273         (WebCore::CachedResource::CachedResource):
3274         * loader/cache/CachedResourceLoader.cpp:
3275         (WebCore::CachedResourceLoader::requestImage):
3276         (WebCore::CachedResourceLoader::canRequest):
3277         (WebCore::CachedResourceLoader::requestResource):
3278         (WebCore::CachedResourceLoader::determineRevalidationPolicy):
3279         (WebCore::CachedResourceLoader::requestPreload):
3280         * loader/cache/CachedResourceLoader.h:
3281         * loader/cache/CachedResourceRequest.cpp:
3282         (WebCore::CachedResourceRequest::CachedResourceRequest):
3283         * loader/cache/CachedResourceRequest.h:
3284         (WebCore::CachedResourceRequest::priority):
3285         (WebCore::CachedResourceRequest::forPreload): Deleted.
3286         (WebCore::CachedResourceRequest::setForPreload): Deleted.
3287         (WebCore::CachedResourceRequest::defer): Deleted.
3288         (WebCore::CachedResourceRequest::setDefer): Deleted.
3289
3290 2016-10-06  Myles C. Maxfield  <mmaxfield@apple.com>
3291
3292         Variation fonts don't affect glyph advances
3293         https://bugs.webkit.org/show_bug.cgi?id=163093
3294
3295         Reviewed by Darin Adler.
3296
3297         Work around known bug <rdar://problem/28662086>. For variation fonts,
3298         CTFontGetAdvancesForGlyphs() gives correct answers but
3299         CTFontGetUnsummedAdvancesForGlyphsAndStyle() doesn't.
3300
3301         Test: fast/text/variations/advances.html
3302
3303         * platform/graphics/FontPlatformData.h:
3304         (WebCore::FontPlatformData::hasVariations):
3305         * platform/graphics/cocoa/FontCocoa.mm:
3306         (WebCore::Font::platformWidthForGlyph):
3307         * platform/graphics/cocoa/FontPlatformDataCocoa.mm:
3308         (WebCore::FontPlatformData::FontPlatformData):
3309
3310 2016-10-06  Commit Queue  <commit-queue@webkit.org>
3311
3312         Unreviewed, rolling out r206713.
3313         https://bugs.webkit.org/show_bug.cgi?id=163097
3314
3315         triggers apparent codegen bug on ARM 32-bit (Requested by smfr
3316         on #webkit).
3317
3318         Reverted changeset:
3319
3320         "Support transitions/animations of background-position with
3321         right/bottom-relative values"
3322         https://bugs.webkit.org/show_bug.cgi?id=162048
3323         http://trac.webkit.org/changeset/206713
3324
3325 2016-10-06  Daniel Bates  <dabates@apple.com>
3326
3327         Remove unused WebCore::contentDispositionType()
3328         https://bugs.webkit.org/show_bug.cgi?id=163095
3329
3330         Reviewed by Alex Christensen.
3331
3332         The function WebCore::contentDispositionType() was only used by the Chromium and Qt ports
3333         to parse the Content-Disposition HTTP header. Both of these ports have long since been
3334         removed from the repository. We should remove WebCore::contentDispositionType().
3335
3336         * platform/network/HTTPParsers.cpp:
3337         (WebCore::contentDispositionType): Deleted.
3338         * platform/network/HTTPParsers.h:
3339
3340 2016-10-06  Ryosuke Niwa  <rniwa@webkit.org>
3341
3342         Upgrading and constructing element should always report exception instead of rethrowing
3343         https://bugs.webkit.org/show_bug.cgi?id=162996
3344
3345         Reviewed by Darin Adler.
3346
3347         The latest HTML specification specifies that we must report exceptions thrown during element upgrades:
3348         https://html.spec.whatwg.org/#upgrades
3349
3350         In addition, F2F during 2016 TPAC had a consensus that we should do the same for document.createElement:
3351         https://github.com/w3c/webcomponents/issues/569
3352
3353         Since the HTML parser already reports the exception thrown during custom element construction as it does
3354         not have any JS stack, these changes make exceptions thrown during upgrades and constructions.
3355
3356         In our implementation, this only reduces the code complexity as now we can push the logic to fallback
3357         to HTMLUnknownElement into JSCustomElementInterface's constructElement, which has been renamed
3358         to constructElementWithFallback, and eliminate ShouldClearException enum class entirely. Moreover,
3359         constructElementWithFallback can now return Ref instead of RefPtr.
3360
3361         No new tests. Existing tests have been updated.
3362
3363         * bindings/js/JSCustomElementInterface.cpp:
3364         (WebCore::JSCustomElementInterface::constructElementWithFallback): Create a HTMLUnknownElement if
3365         an attempt to construct a custom element had failed in lieu of returning nullptr.
3366         (WebCore::JSCustomElementInterface::tryToConstructCustomElement): Renamed from constructElement.
3367         Always report exceptions (the same behavior as ShouldClearException::Clear).
3368         (WebCore::JSCustomElementInterface::upgradeElement): Report exceptions instead of rethrowing.
3369         * bindings/js/JSCustomElementInterface.h:
3370         * dom/Document.cpp:
3371         (WebCore::createHTMLElementWithNameValidation):
3372         * html/parser/HTMLDocumentParser.cpp:
3373         (WebCore::HTMLDocumentParser::runScriptsForPausedTreeBuilder):
3374
3375 2016-10-06  Chris Dumez  <cdumez@apple.com>
3376
3377         Overwriting an attribute event listener can lead to wrong event listener firing order
3378         https://bugs.webkit.org/show_bug.cgi?id=163083
3379
3380         Reviewed by Darin Adler.
3381
3382         Overwriting an attribute event listener could lead to wrong event listener
3383         firing order in WebKit. This is because we were removing the old event
3384         listener and then appending the new one instead of actually *replacing*
3385         the old one.
3386
3387         No new tests, rebaselined existing tests.
3388
3389         * dom/EventListenerMap.cpp:
3390         (WebCore::EventListenerMap::replace):
3391         * dom/EventListenerMap.h:
3392         * dom/EventTarget.cpp:
3393         (WebCore::EventTarget::setAttributeEventListener):
3394         (WebCore::EventTarget::hasActiveEventListeners): Deleted.
3395         (WebCore::EventTarget::dispatchEventForBindings): Deleted.
3396         * dom/EventTarget.h:
3397 <