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