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