94395e1a8c7c6d0e2fb6af1069b3f8bca757f163
[WebKit-https.git] / Source / WebCore / ChangeLog
1 2017-02-16  Yusuke Suzuki  <utatane.tea@gmail.com>
2
3         Web Inspector: allow import() inside the inspector
4         https://bugs.webkit.org/show_bug.cgi?id=167457
5
6         Reviewed by Ryosuke Niwa.
7
8         When evaluating `import("...")`, we need the caller's context to resolve
9         the module specifier correctly. For example, if `import("./cocoa.js")` is
10         evaluated in the script "drinks/hot.js", this module name is resolved to
11         "drinks/cocoa.js". If the same import operator is evaluated in the script
12         "menu/all.js", the module specifier becomes "menu/cocoa.js".
13
14         Previously we reject the import operator if the caller does not have such
15         a context. These context is SourceOrigin and its ScriptFetcher. While they
16         are offered in the script tag and other code evaluations, the inspector
17         console does not offer that. These class are offered in the WebCore side
18         and we should not touch these classes in the JSC's inspector code.
19
20         Now we relax the above restriction. If the above caller information is not
21         offered, we fallback to the default one. In the web page, we use the page's
22         URL as the caller's source origin. This allows us to evaluate the import
23         operator in the inspector console.
24
25         And as of r167698, the console recognizes `await import("...")` form. We use
26         this to test this `import()` in the console functionality.
27
28         Test: inspector/controller/runtime-controller-import.html
29
30         * bindings/js/ScriptModuleLoader.cpp:
31         (WebCore::ScriptModuleLoader::importModule):
32
33 2017-02-16  Miguel Gomez  <magomez@igalia.com>
34
35         [GTK] scroll with transparent background not repainted after scrollY >= 32768
36         https://bugs.webkit.org/show_bug.cgi?id=154283
37
38         Reviewed by Carlos Garcia Campos.
39
40         Due to a limitation of the pixman backend, which uses 16 bits to hold signed integers, cairo is
41         not able to draw anything when using transformation matrices with values bigger than 32768. When
42         drawing patterns into large pages, the matrices values can overflow those 16 bits, so cairo doesn't
43         draw anything in, which causes the reported transparent backgrounds.
44
45         The patch modifies the transformation matrices both from the current context and the pattern we
46         are painting, to avoid them to hold values that cannot stored in 16 bits.
47
48         There's still the possibility that this happens, but it would require using a pattern with a size
49         bigger than 32768.
50
51         Based on a previous patch by Gwang Yoon Hwang  <yoon@igalia.com>.
52
53         Test: fast/backgrounds/background-repeat-long-scroll.html
54
55         * platform/graphics/cairo/CairoUtilities.cpp:
56         (WebCore::drawPatternToCairoContext):
57
58 2017-02-16  Carlos Garcia Campos  <cgarcia@igalia.com>
59
60         [GTK] Images are never read from the clipboard
61         https://bugs.webkit.org/show_bug.cgi?id=168419
62
63         Reviewed by Sergio Villar Senin.
64
65         We write images in the clipboard, but we don't read them.
66
67         Fixes: editing/pasteboard/paste-image-using-image-data.html
68
69         * editing/Editor.cpp:
70         (WebCore::Editor::createFragmentForImageAndURL): Moved from EditorMac.mm since it's cross-platform code.
71         * editing/Editor.h:
72         * editing/gtk/EditorGtk.cpp:
73         (WebCore::createFragmentFromPasteboardData): Check if there's an image in the selection, and use
74         Editor::createFragmentForImageAndURL in that case.
75         * editing/mac/EditorMac.mm:
76         (WebCore::Editor::createFragmentForImageAndURL): Deleted.
77         * platform/gtk/PasteboardHelper.cpp:
78         (WebCore::PasteboardHelper::getClipboardContents): Check also if there's an image in the clipboard.
79
80 2017-02-15  Jer Noble  <jer.noble@apple.com>
81
82         REGRESSION (r212311): NULL-dereference in HTMLMediaElement::prepareToPlay()
83         https://bugs.webkit.org/show_bug.cgi?id=168404
84         <rdar://problem/30547188>
85
86         Reviewed by Brian Weinstein.
87
88         Prior to r212311, m_player was always guaranteed to be initialized when calling
89         prepareToPlay(). r212311 began calling prepareToPlay() on a subsequent run-loop iteration
90         after creating m_player. So now check whether m_player is NULL before calling methods on it.
91
92         * html/HTMLMediaElement.cpp:
93         (WebCore::HTMLMediaElement::prepareToPlay):
94
95 2017-02-15  Eric Carlson  <eric.carlson@apple.com>
96
97         [MediaStream] delete CaptureDeviceInfo struct
98         https://bugs.webkit.org/show_bug.cgi?id=168395
99
100         The CaptureDeviceInfo struct and CaptureDevice class were almost identical, so
101         add an "enabled" field to the later, delete the former, and switch all uses of
102         CaptureDeviceInfo to CaptureDevice.
103
104         Do some minor drive-by cleanup of AVCaptureDeviceManager::refreshCaptureDevices
105         and CaptureDeviceManager::captureDeviceFromDeviceID.
106         
107         Reviewed by Sam Weinig.
108
109         No new tests, no behavior change.
110
111         * Modules/mediastream/MediaDevicesRequest.cpp:
112         (WebCore::MediaDevicesRequest::start): SourceKind -> DeviceType
113         * platform/mediastream/CaptureDevice.h:
114         (WebCore::CaptureDevice::CaptureDevice):
115         (WebCore::CaptureDevice::type): Renamed from kind.
116         (WebCore::CaptureDevice::setType):
117         (WebCore::CaptureDevice::enabled): Added.
118         (WebCore::CaptureDevice::setEnabled):
119         (WebCore::CaptureDevice::kind): Deleted.
120         (WebCore::CaptureDevice::setKind): Deleted.
121
122         * platform/mediastream/CaptureDeviceManager.cpp:
123         (CaptureDeviceManager::getSourcesInfo):
124         (CaptureDeviceManager::captureDeviceFromDeviceID): Don't call sourceWithUID.
125         (CaptureDeviceManager::bestSourcesForTypeAndConstraints):
126         (CaptureDeviceManager::sourceWithUID):
127         * platform/mediastream/CaptureDeviceManager.h:
128         (WebCore::CaptureDeviceManager::refreshCaptureDevices):
129         (WebCore::CaptureDeviceManager::refreshCaptureDeviceList): Deleted.
130
131         * platform/mediastream/mac/AVCaptureDeviceManager.h:
132         * platform/mediastream/mac/AVCaptureDeviceManager.mm:
133         (WebCore::AVCaptureDeviceManager::captureDevices):
134         (WebCore::deviceIsAvailable):
135         (WebCore::AVCaptureDeviceManager::refreshCaptureDevices):
136         (WebCore::AVCaptureDeviceManager::createMediaSourceForCaptureDeviceWithConstraints):
137         (WebCore::AVCaptureDeviceManager::deviceConnected):
138         (WebCore::AVCaptureDeviceManager::deviceDisconnected):
139         (WebCore::AVCaptureDeviceManager::captureDeviceList): Deleted.
140         (WebCore::shouldConsiderDeviceInDeviceList): Deleted.
141         (WebCore::AVCaptureDeviceManager::refreshCaptureDeviceList): Deleted.
142         * platform/mock/MockRealtimeMediaSource.cpp:
143         (WebCore::MockRealtimeMediaSource::audioDeviceInfo):
144         (WebCore::MockRealtimeMediaSource::videoDeviceInfo):
145
146 2017-02-15  Sam Weinig  <sam@webkit.org>
147
148         [WebIDL] Remove custom conversion from FontFace code by using a Variant
149         https://bugs.webkit.org/show_bug.cgi?id=168384
150
151         Reviewed by Alex Christensen.
152
153         Match the font face spec and use a union rather than any in the FontFace constructor.
154
155         Test: Added additional cases to fast/text/font-face-javascript.html.
156
157         * css/FontFace.cpp:
158         (WebCore::FontFace::create):
159         * css/FontFace.h:
160         * css/FontFace.idl:
161
162 2017-02-15  Jer Noble  <jer.noble@apple.com>
163
164         Disabled Media Sources should render black/silence
165         https://bugs.webkit.org/show_bug.cgi?id=168281
166
167         Reviewed by Eric Carlson.
168
169         Test: webrtc/video-disabled-black.html
170
171         Pass the enabled flag setting down from the MediaStreamTrackPrivate to its underlying
172         source, including RealtimeMediaSource and RealtimeOutgoingAudio/VideoSource. When either
173         enabled is cleared or muted is set, generate empty (black or silent) media, as opposed to
174         pausing media or (worse) continuing to send generated media.
175
176         * platform/mediastream/MediaStreamTrackPrivate.cpp:
177         (WebCore::MediaStreamTrackPrivate::setEnabled):
178         (WebCore::MediaStreamTrackPrivate::sourceEnabledChanged):
179         * platform/mediastream/MediaStreamTrackPrivate.h:
180         * platform/mediastream/RealtimeMediaSource.cpp:
181         (WebCore::RealtimeMediaSource::setEnabled):
182         * platform/mediastream/RealtimeMediaSource.h:
183         (WebCore::RealtimeMediaSource::enabled):
184         * platform/mediastream/mac/AudioTrackPrivateMediaStreamCocoa.h:
185         * platform/mediastream/mac/MockRealtimeAudioSourceMac.mm:
186         (WebCore::MockRealtimeAudioSourceMac::render):
187         * platform/mediastream/mac/RealtimeOutgoingAudioSource.cpp:
188         (WebCore::RealtimeOutgoingAudioSource::sourceMutedChanged):
189         (WebCore::RealtimeOutgoingAudioSource::sourceEnabledChanged):
190         (WebCore::RealtimeOutgoingAudioSource::pullAudioData):
191         * platform/mediastream/mac/RealtimeOutgoingAudioSource.h:
192         * platform/mediastream/mac/RealtimeOutgoingVideoSource.cpp:
193         (WebCore::RealtimeOutgoingVideoSource::sourceMutedChanged):
194         (WebCore::RealtimeOutgoingVideoSource::sourceEnabledChanged):
195         (WebCore::RealtimeOutgoingVideoSource::videoSampleAvailable):
196         * platform/mediastream/mac/RealtimeOutgoingVideoSource.h:
197         * platform/mock/MockRealtimeVideoSource.cpp:
198         (WebCore::MockRealtimeVideoSource::generateFrame):
199
200 2017-02-15  Wenson Hsieh  <wenson_hsieh@apple.com>
201
202         Editing history scripts should not add the contenteditable attribute or override key events
203         https://bugs.webkit.org/show_bug.cgi?id=168389
204         <rdar://problem/30529945>
205
206         Reviewed by Dan Bernstein.
207
208         Clients that hook into editing history tracking should handle setting the contenteditable attribute on the body
209         rather than have the script add it to the body. Additionally, this script should NOT be overriding any keydown
210         events. These were initially added for compatibility with a test harness early on, and should have been removed
211         earlier.
212
213         * Scripts/DumpEditingHistory.js:
214
215 2017-02-15  Jer Noble  <jer.noble@apple.com>
216
217         Pass "RequiresCustomURLLoading" in AVURLAsset options dictionary
218         https://bugs.webkit.org/show_bug.cgi?id=168381
219
220         Reviewed by Eric Carlson.
221
222         * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
223         (WebCore::MediaPlayerPrivateAVFoundationObjC::createAVAssetForURL):
224
225 2017-02-15  Anders Carlsson  <andersca@apple.com>
226
227         Fix build.
228
229         * page/DragController.cpp:
230         (WebCore::DragController::doSystemDrag):
231
232 2017-02-15  Anders Carlsson  <andersca@apple.com>
233
234         Modernize DragClient::startDrag somewhat
235         https://bugs.webkit.org/show_bug.cgi?id=168379
236
237         Reviewed by Tim Horton.
238
239         Change DragClient::startDrag to take a DragImage instead of a DragImageRef, and to pass along the source action
240         instead of whether it's a link or not.
241
242         * loader/EmptyClients.cpp:
243         * page/DragClient.h:
244         * page/DragController.cpp:
245         (WebCore::DragController::startDrag):
246         (WebCore::DragController::doImageDrag):
247         (WebCore::DragController::doSystemDrag):
248         * page/DragController.h:
249
250 2017-02-15  Chris Dumez  <cdumez@apple.com>
251
252         Expose Symbol.toPrimitive / valueOf on Location instances
253         https://bugs.webkit.org/show_bug.cgi?id=168295
254
255         Reviewed by Geoffrey Garen, Keith Miller and Mark Lam.
256
257         Expose Symbol.toPrimitive / valueOf on Location instances as per:
258         - https://html.spec.whatwg.org/#the-location-interface
259
260         Firefox and Chrome already comply with the specification.
261
262         Tests: fast/dom/location-valueOf-after-object-prototype-update.html
263                fast/dom/location-valueOf-after-object-prototype-update2.html
264                imported/w3c/web-platform-tests/html/browsers/history/the-location-interface/location-symbol-toprimitive.html
265                imported/w3c/web-platform-tests/html/browsers/history/the-location-interface/location-valueof.html
266
267         * bindings/scripts/CodeGeneratorJS.pm:
268         (GenerateImplementation):
269
270 2017-02-15  Aakash Jain  <aakash_jain@apple.com>
271
272         Remove WebIOSEvent interface
273         https://bugs.webkit.org/show_bug.cgi?id=168368
274
275         Reviewed by Tim Horton.
276
277         * platform/ios/WebEvent.h: Removed WebIOSEvent.
278
279 2017-02-15  Chris Dumez  <cdumez@apple.com>
280
281         [iOS] Form Validation Bubble should be sensitive to Dynamic Type
282         https://bugs.webkit.org/show_bug.cgi?id=168291
283         <rdar://problem/30508593>
284
285         Reviewed by Tim Horton.
286
287         Update ValidationBubble implementation on iOS to stop obeying the
288         minimum font size setting, given that this setting is not exposed
289         on iOS. Instead, we now rely on
290         [UIFont preferredFontForTextStyle:UIFontTextStyleCallout], which
291         will give us a font whose size obeys Dynamic Type [1] setting on iOS.
292
293         [1] https://developer.apple.com/ios/human-interface-guidelines/visual-design/typography/
294
295         No new tests, no easily testable.
296
297         * platform/ios/ValidationBubbleIOS.mm:
298         (WebCore::ValidationBubble::ValidationBubble):
299
300 2017-02-15  Yusuke Suzuki  <utatane.tea@gmail.com>
301
302         [JSC] Drop PassRefPtr
303         https://bugs.webkit.org/show_bug.cgi?id=168320
304
305         Reviewed by Saam Barati.
306
307         * bindings/js/ScriptSourceCode.h:
308         (WebCore::ScriptSourceCode::ScriptSourceCode):
309         Use Ref and pass it to SourceCode.
310
311         * replay/ReplayController.cpp:
312         (WebCore::ReplayController::frameNavigated):
313         Pass reference.
314
315 2017-02-15  Xabier Rodriguez Calvar  <calvaris@igalia.com>
316
317         [GStreamer][MSE][EME] Handle protection event also at decryptor level
318         https://bugs.webkit.org/show_bug.cgi?id=168316
319
320         Reviewed by Žan Doberšek.
321
322         So far in MSE pipeline we were handling the encryption events
323         only when they arrived at the demuxer but this won't work in any
324         kind of key renegotiation as the event will never arrive. Now we
325         connect to the element messages, check for the drm id and send it
326         to the private player for processing.
327
328         * platform/graphics/gstreamer/mse/AppendPipeline.cpp:
329         (WebCore::appendPipelineElementMessageCallback):
330         (WebCore::AppendPipeline::AppendPipeline):
331         (WebCore::AppendPipeline::handleElementMessage):
332         * platform/graphics/gstreamer/mse/AppendPipeline.h:
333
334 2017-02-15  Zan Dobersek  <zdobersek@igalia.com>
335
336         [EME] MediaKeys::setServerCertificate() must resolve with 'false' when certificates aren't supported
337         https://bugs.webkit.org/show_bug.cgi?id=168362
338
339         Reviewed by Xabier Rodriguez-Calvar.
340
341         In MediaKeys::setServerCertificate(), when the CDM implementation
342         doesn't support server certificates, it should resolve the promise
343         with the 'false' value, as mandated by the specification, and not
344         reject it.
345
346         A test case in mock-MediaKeys-setServerCertificate.html is updated.
347
348         * Modules/encryptedmedia/MediaKeys.cpp:
349         (WebCore::MediaKeys::setServerCertificate):
350
351 2017-02-15  Carlos Garcia Campos  <cgarcia@igalia.com>
352
353         REGRESSION (r206014): HTTPHeaderMap does not consistently use comma without space to separate values of header fields
354         https://bugs.webkit.org/show_bug.cgi?id=168115
355
356         Reviewed by Darin Adler.
357
358         In r206014 HTTPHeaderMap::add() was updated to combine common headers with ',' instead of ", " to match the
359         fetch specification, but the uncommon headers are still combined with ", ".
360
361         * platform/network/HTTPHeaderMap.cpp:
362         (WebCore::HTTPHeaderMap::add):
363
364 2017-02-14  Ryosuke Niwa  <rniwa@webkit.org>
365
366         An assertion failure inside removeChildren
367         https://bugs.webkit.org/show_bug.cgi?id=168069
368
369         Reviewed by Brent Fulgham.
370
371         The bug was caused by notifyRemovePendingSheet executing scripts synchronously where it shouldn't.
372
373         Removed the call to notifyRemovePendingSheetIfNeeded in notifyChildNodeRemoved. Instead, invoke it
374         in its call sites when they're safe.
375
376         Test: http/tests/security/move-iframe-within-focus-handler-inside-removal.html
377
378         * dom/ContainerNode.cpp:
379         (WebCore::ContainerNode::takeAllChildrenFrom):
380         (WebCore::ContainerNode::notifyChildInserted):
381         (WebCore::ContainerNode::removeChild):
382         (WebCore::ContainerNode::parserRemoveChild):
383         (WebCore::ContainerNode::replaceAllChildren):
384         (WebCore::ContainerNode::removeChildren):
385         * dom/ContainerNodeAlgorithms.cpp:
386         (WebCore::notifyChildNodeRemoved):
387
388 2017-02-15  Carlos Garcia Campos  <cgarcia@igalia.com>
389
390         [GStreamer] Several tests are timing out after r212349
391         https://bugs.webkit.org/show_bug.cgi?id=168359
392
393         Reviewed by Žan Doberšek.
394
395         This is because they are failing the cross origin check. Those tests are not using WebKitWebSrc, but
396         GstFileSrc. I didn't consider the case of source not being a WebKitWebSrc.
397
398         Fixes several timeout instroduced in r212349.
399
400         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:
401         (WebCore::MediaPlayerPrivateGStreamer::hasSingleSecurityOrigin): Split the source check in two. First check if
402         it's nullptr, and return false. Then check if it's a WebKitWebSrc and return true if it isn't.
403
404 2017-02-14  Brent Fulgham  <bfulgham@apple.com>
405
406         Revalidate URL after events that could trigger navigations
407         https://bugs.webkit.org/show_bug.cgi?id=168071
408         <rdar://problem/30450379>
409
410         Reviewed by Ryosuke Niwa.
411
412         When arbitary javascript runs during a load, we should revalidate
413         the URLs involved to make sure they are still valid.
414
415         Tests: http/tests/plugins/navigation-during-load-embed.html
416                http/tests/plugins/navigation-during-load.html
417
418         * html/HTMLEmbedElement.cpp:
419         (WebCore::HTMLEmbedElement::updateWidget): Confirm we are still allowed to
420         load the URL after executing JS callbacks.
421         * html/HTMLFrameElementBase.cpp:
422         (WebCore::HTMLFrameElementBase::isURLAllowed): Split existing function into
423         existing protected method, and a new public method that checks a passed URL
424         for validity.
425         * html/HTMLFrameElementBase.h:
426         * html/HTMLFrameOwnerElement.h:
427         (WebCore::HTMLFrameOwnerElement::isURLAllowed):
428         * html/HTMLObjectElement.cpp:
429         (WebCore::HTMLObjectElement::updateWidget): Confirm we are still allowed to
430         load the URL after executing JS callbacks.
431         * loader/SubframeLoader.cpp:
432         (WebCore::SubframeLoader::requestFrame): Ditto.
433
434 2017-02-14  Carlos Garcia Campos  <cgarcia@igalia.com>
435
436         [GStreamer] Implement MediaPlayerPrivate::hasSingleSecurityOrigin()
437         https://bugs.webkit.org/show_bug.cgi?id=168322
438
439         Reviewed by Žan Doberšek.
440
441         It currently returns true unconditionally. Add resolved-location property to WebKitWebSourceGStreamer to track
442         the resolved url returned by the server and use that from MediaPlayerPrivate to check if there was a cross
443         origin redirection.
444
445         Fixes: http/tests/security/canvas-remote-read-remote-video-redirect.html
446
447         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:
448         (WebCore::MediaPlayerPrivateGStreamer::hasSingleSecurityOrigin):
449         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.h:
450         * platform/graphics/gstreamer/WebKitWebSourceGStreamer.cpp:
451         (webKitWebSrcFinalize):
452         (webKitWebSrcGetProperty):
453         (webKitWebSrcStart):
454         (webKitWebSrcQueryWithParent):
455         (webKitWebSrcGetUri):
456         (webKitWebSrcSetUri):
457         (StreamingClient::handleResponseReceived):
458         (ResourceHandleStreamingClient::wasBlocked):
459         (ResourceHandleStreamingClient::cannotShowURL):
460
461 2017-02-14  Carlos Garcia Campos  <cgarcia@igalia.com>
462
463         Unreviewed, rolling out r211967.
464
465         Caused rendering issues in HiDPI
466
467         Reverted changeset:
468
469         "[GTK] scroll with transparent background not repainted after
470         scrollY >= 32768"
471         https://bugs.webkit.org/show_bug.cgi?id=154283
472         http://trac.webkit.org/changeset/211967
473
474 2017-02-14  Carlos Garcia Campos  <cgarcia@igalia.com>
475
476         [GTK] Update cookie manager API to properly work with ephemeral sessions
477         https://bugs.webkit.org/show_bug.cgi?id=168230
478
479         Reviewed by Michael Catanzaro.
480
481         Add implementation for deleteAllCookiesModifiedSince. Note that this only works when the timespan is 0, we need
482         new libsoup API to support removing recently modified cookies.
483
484         * platform/network/soup/CookieJarSoup.cpp:
485         (WebCore::deleteAllCookiesModifiedSince):
486
487 2017-02-14  Joseph Pecoraro  <pecoraro@apple.com>
488
489         [WebIDL] Improve serializer = { inherit }
490         https://bugs.webkit.org/show_bug.cgi?id=168293
491
492         Reviewed by Youenn Fablet.
493
494         * bindings/scripts/CodeGeneratorJS.pm:
495         (GenerateHeader):
496         Expose a serialize() method on the interface.
497
498         (GenerateSerializerFunction):
499         (GenerateSerializerAttributesForInterface): Deleted.
500         Subclasses that have `serializer = { inherit }` can use
501         their parent's serialize() method to get the initial object.
502         We can now collapse everything back into a single function
503         because we only generate code for our own attributes.
504
505         * bindings/scripts/test/JS/JSTestNode.cpp:
506         (WebCore::JSTestNode::serialize):
507         (WebCore::jsTestNodePrototypeFunctionToJSONCaller):
508         * bindings/scripts/test/JS/JSTestNode.h:
509         * bindings/scripts/test/JS/JSTestObj.cpp:
510         (WebCore::JSTestObj::serialize):
511         (WebCore::jsTestObjPrototypeFunctionToJSONCaller):
512         * bindings/scripts/test/JS/JSTestObj.h:
513         * bindings/scripts/test/JS/JSTestSerialization.cpp:
514         (WebCore::JSTestSerialization::serialize):
515         (WebCore::jsTestSerializationPrototypeFunctionToJSONCaller):
516         * bindings/scripts/test/JS/JSTestSerialization.h:
517         * bindings/scripts/test/JS/JSTestSerializationInherit.cpp:
518         (WebCore::JSTestSerializationInherit::serialize):
519         (WebCore::jsTestSerializationInheritPrototypeFunctionToJSONCaller):
520         * bindings/scripts/test/JS/JSTestSerializationInherit.h:
521         * bindings/scripts/test/JS/JSTestSerializationInheritFinal.cpp:
522         (WebCore::JSTestSerializationInheritFinal::serialize):
523         (WebCore::jsTestSerializationInheritFinalPrototypeFunctionToJSONCaller):
524         * bindings/scripts/test/JS/JSTestSerializationInheritFinal.h:
525         Updated results.
526
527 2017-02-14  Aakash Jain  <aakash_jain@apple.com>
528
529         Move methods from WebCoreThread.h to WebCoreThreadInternal.h
530         https://bugs.webkit.org/show_bug.cgi?id=168326
531
532         Reviewed by Alexey Proskuryakov.
533
534         * platform/ios/wak/WebCoreThread.h: Move methods WebThreadRunLoop and WebThreadCurrentContext to WebCoreThreadInternal.h
535         * platform/ios/wak/WebCoreThreadInternal.h: Ditto.
536         * platform/ios/wak/WebCoreThreadRun.cpp: Removed WebCoreThread.h as it is already included by WebCoreThreadInternal.h
537         * platform/ios/wak/WKGraphics.mm: Included WebCoreThreadInternal.h, it subsequently includes WebCoreThread.h
538         * inspector/InspectorTimelineAgent.cpp: Ditto.
539         * page/mac/PageMac.mm: Ditto.
540         * platform/cf/MainThreadSharedTimerCF.cpp: Ditto.
541         * platform/cocoa/MemoryPressureHandlerCocoa.mm: Ditto.
542         * platform/graphics/ca/cocoa/LayerFlushSchedulerMac.cpp: Ditto.
543         * platform/network/cf/SynchronousResourceHandleCFURLConnectionDelegate.cpp: Ditto.
544         * bindings/js/CommonVM.cpp: included WebCoreThreadInternal.h
545
546 2017-02-14  Wenson Hsieh  <wenson_hsieh@apple.com>
547
548         [WK2] Support data interaction on links
549         https://bugs.webkit.org/show_bug.cgi?id=168331
550         <rdar://problem/30200837>
551
552         Reviewed by Tim Horton.
553
554         Adds support for data interaction on links at the WebCore layer, refactoring some drag-and-drop code on the Mac
555         along the way. Also adds two new TestWebKitAPI unit tests in DataInteractionTests.mm: LinkToInput and
556         BackgroundImageLinkToInput (see Tools/ChangeLog for more information).
557
558         * page/DragController.cpp:
559         (WebCore::DragController::startDrag):
560         (WebCore::DragController::doImageDrag):
561         (WebCore::DragController::doSystemDrag):
562
563         Introduce platformAdjustDragImageForDeviceScaleFactor, and special-case drag images for links to anchor at the
564         bottom center.
565
566         * platform/DragImage.cpp:
567         (WebCore::platformAdjustDragImageForDeviceScaleFactor):
568
569         Scale the drag image up by the device scale factor. In WebDragClient, we scale the image back down to the
570         original size. It seems the reason we do this extra dance is because the image sizing heuristic in between
571         assumes that the image dimensions are for a non-retina device, but this work should really not be necessary if
572         we tweak the heuristic to account for deviceScaleFactor. We should address this in a separate patch.
573
574         * platform/DragImage.h:
575         * platform/graphics/Path.h:
576
577 2017-02-14  Basuke Suzuki  <Basuke.Suzuki@am.sony.com>
578
579         [CURL] ResourceError created with error information should have default type Type::General
580         https://bugs.webkit.org/show_bug.cgi?id=168345
581
582         Reviewed by Alex Christensen.
583
584         ResourceError has separate implementaion for each platform
585         so that the interface should be same.
586         On CURL port, the constructor with error information has
587         different default value on `type` parameter. It is Type::Null but other implementaitons have Type::General.
588         This causes some ResourceError is created inconsistent. 
589
590         * platform/network/curl/ResourceError.h:
591         (WebCore::ResourceError::ResourceError):
592
593 2017-02-14  Youenn Fablet  <youennf@gmail.com>
594
595         [WebRTC] Add support for libwebrtc negotiation needed event
596         https://bugs.webkit.org/show_bug.cgi?id=168267
597
598         Reviewed by Eric Carlson.
599
600         Test: webrtc/negotiatedneeded-event-addStream.html
601
602         Moving generic code (markAsNeedingNegotiation) from MediaEndpointPeerConnection to PeerConnectionBackend.
603         This code handles the control of sending or not the negotiationneeded event.
604
605         Updating mock to use markAsNeedingNegotiation when streams are changed.
606         Updating libwebrtc backend to call markAsNeedingNegotiation when required by libwebrtc implementation.
607
608         * Modules/mediastream/MediaEndpointPeerConnection.cpp:
609         (WebCore::MediaEndpointPeerConnection::setLocalDescriptionTask):
610         * Modules/mediastream/MediaEndpointPeerConnection.h:
611         * Modules/mediastream/PeerConnectionBackend.cpp:
612         (WebCore::PeerConnectionBackend::markAsNeedingNegotiation):
613         * Modules/mediastream/PeerConnectionBackend.h:
614         (WebCore::PeerConnectionBackend::isNegotiationNeeded):
615         (WebCore::PeerConnectionBackend::clearNegotiationNeededState):
616         * Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.cpp:
617         (WebCore::LibWebRTCMediaEndpoint::OnRenegotiationNeeded):
618         * Modules/mediastream/libwebrtc/LibWebRTCPeerConnectionBackend.cpp:
619         * Modules/mediastream/libwebrtc/LibWebRTCPeerConnectionBackend.h:
620         * testing/MockLibWebRTCPeerConnection.cpp:
621         (WebCore::MockLibWebRTCPeerConnection::AddStream):
622         (WebCore::MockLibWebRTCPeerConnection::RemoveStream):
623
624 2017-02-14  Brady Eidson  <beidson@apple.com>
625
626         Unreviewed followup to r212330 to fix Debug builds
627
628         * loader/DocumentThreadableLoader.cpp:
629         (WebCore::DocumentThreadableLoader::DocumentThreadableLoader): Add call to relaxAdoptionRequirement().
630
631 2017-02-14  Matt Rajca  <mrajca@apple.com>
632
633         Website policies: iframes should respect the autoplay policy of the top-level document
634         https://bugs.webkit.org/show_bug.cgi?id=168333
635
636         Reviewed by Alex Christensen.
637
638         API tests were added.
639
640         * html/HTMLMediaElement.cpp:
641         (WebCore::HTMLMediaElement::HTMLMediaElement):
642
643 2017-02-14  Dean Jackson  <dino@apple.com>
644
645         Rename preferLowPowerWebGLRendering setting to forceWebGLUsesLowPower
646         https://bugs.webkit.org/show_bug.cgi?id=168339
647         <rdar://problem/30522092>
648
649         Reviewed by Simon Fraser.
650
651         Use a setting name that more clearly reflects what it is doing. It's not
652         preferring to use the low-power GPU, it's forcing it.
653
654         * html/canvas/WebGLRenderingContextBase.cpp:
655         (WebCore::WebGLRenderingContextBase::create):
656         * page/Settings.in:
657
658 2017-02-14  Brady Eidson  <beidson@apple.com>
659
660         Speculative fix for: Crash in DocumentThreadableLoader::redirectReceived.
661         <rdar://problem/29899473> and https://bugs.webkit.org/show_bug.cgi?id=168337
662
663         Reviewed by Geoffrey Garen.
664
665         No new tests (Unable to find a reproduction).
666
667         * loader/DocumentThreadableLoader.cpp:
668         (WebCore::DocumentThreadableLoader::loadRequest):
669
670 2017-02-14  Youenn Fablet  <youenn@apple.com>
671
672         [WebRTC] Remove obsolete WebRTC stats API
673         https://bugs.webkit.org/show_bug.cgi?id=167910
674
675         Reviewed by Alex Christensen.
676
677         No change of behavior as removed constructs are not functional.
678         Removing RTCStatsResponse which no longer exists and made RTCStatsReport an empty container for now.
679
680         * CMakeLists.txt:
681         * DerivedSources.cpp:
682         * DerivedSources.make:
683         * Modules/mediastream/MediaEndpointPeerConnection.cpp:
684         (WebCore::MediaEndpointPeerConnection::getStats):
685         * Modules/mediastream/MediaEndpointPeerConnection.h:
686         * Modules/mediastream/PeerConnectionBackend.h:
687         * Modules/mediastream/RTCPeerConnection.cpp:
688         (WebCore::RTCPeerConnection::getStats):
689         * Modules/mediastream/RTCStatsReport.cpp:
690         (WebCore::RTCStatsReport::create): Deleted.
691         (WebCore::RTCStatsReport::RTCStatsReport): Deleted.
692         (WebCore::RTCStatsReport::names): Deleted.
693         (WebCore::RTCStatsReport::local): Deleted.
694         (WebCore::RTCStatsReport::remote): Deleted.
695         (WebCore::RTCStatsReport::addStatistic): Deleted.
696         * Modules/mediastream/RTCStatsReport.h:
697         (WebCore::RTCStatsReport::create):
698         (WebCore::RTCStatsReport::timestamp): Deleted.
699         (WebCore::RTCStatsReport::id): Deleted.
700         (WebCore::RTCStatsReport::type): Deleted.
701         (WebCore::RTCStatsReport::stat): Deleted.
702         * Modules/mediastream/RTCStatsReport.idl:
703         * Modules/mediastream/RTCStatsResponse.cpp: Removed.
704         * Modules/mediastream/RTCStatsResponse.h: Removed.
705         * Modules/mediastream/RTCStatsResponse.idl: Removed.
706         * WebCore.xcodeproj/project.pbxproj:
707         * platform/mediastream/MediaEndpoint.h:
708         (WebCore::MediaEndpoint::getStats):
709         * platform/mediastream/RTCStatsRequest.h: Removed.
710         * platform/mediastream/RTCStatsResponseBase.h: Removed.
711
712 2017-02-14  Karim H  <karim@karhm.com>
713
714         Removed unused methods of WebCore::FileStream
715         https://bugs.webkit.org/show_bug.cgi?id=168025
716
717         Reviewed by Michael Catanzaro.
718
719         * fileapi/AsyncFileStream.cpp:
720         (WebCore::AsyncFileStream::openForWrite): Deleted.
721         (WebCore::AsyncFileStream::write): Deleted.
722         (WebCore::AsyncFileStream::truncate): Deleted.
723         * fileapi/AsyncFileStream.h:
724         * platform/FileStream.cpp:
725         (WebCore::FileStream::openForWrite): Deleted.
726         (WebCore::FileStream::write): Deleted.
727         (WebCore::FileStream::truncate): Deleted.
728         * platform/FileStream.h:
729
730 2017-02-14  Chris Dumez  <cdumez@apple.com>
731
732         HTML Form Validation bubble should take minimum font size setting into consideration
733         https://bugs.webkit.org/show_bug.cgi?id=168271
734         <rdar://problem/29869869>
735
736         Reviewed by Simon Fraser.
737
738         HTML Form Validation bubble should take minimum font size setting into consideration
739         for better accessibility.
740
741         Test: fast/forms/validation-message-minimum-font-size.html
742
743         * platform/ValidationBubble.h:
744         (WebCore::ValidationBubble::create):
745         (WebCore::ValidationBubble::fontSize):
746         * platform/ios/ValidationBubbleIOS.mm:
747         (WebCore::ValidationBubble::ValidationBubble):
748         * platform/mac/ValidationBubbleMac.mm:
749         (WebCore::ValidationBubble::ValidationBubble):
750         Update the ValidationBubble constructor to take in Settings. For now, there is a
751         single setting that is the minimum font size and that is taken into account when
752         setting the font size of the validation bubble text.
753
754 2017-02-14  Eric Carlson  <eric.carlson@apple.com>
755
756         [MediaStream] add navigator.getUserMedia for compatibility with legacy content
757         https://bugs.webkit.org/show_bug.cgi?id=168324
758         <rdar://problem/30513125>
759
760         Reviewed by Youenn Fablet.
761
762         Tests: fast/mediastream/argument-types.html
763                fast/mediastream/getusermedia.html
764                fast/mediastream/webkitGetUserMedia-shadowing-then.html
765
766         * CMakeLists.txt:
767         * DerivedSources.cpp:
768         * DerivedSources.make:
769         * Modules/mediastream/MediaDevices.idl:
770         * Modules/mediastream/NavigatorUserMedia.idl: Added.
771         * Modules/mediastream/NavigatorUserMedia.js: Added.
772         * WebCore.xcodeproj/project.pbxproj:
773         * bindings/js/WebCoreBuiltinNames.h:
774         * page/Navigator.idl:
775
776 2017-02-14  Chris Dumez  <cdumez@apple.com>
777
778         Fallback to legacy type only when event is trusted
779         https://bugs.webkit.org/show_bug.cgi?id=168301
780
781         Reviewed by Ryosuke Niwa.
782
783         Fallback to legacy type only when event is trusted as per a recent
784         DOM specification change:
785         - https://github.com/whatwg/dom/issues/404
786         - https://github.com/whatwg/dom/pull/406
787
788         No new tests, rebaselined existing test.
789
790         * dom/EventTarget.cpp:
791         (WebCore::legacyType):
792         (WebCore::EventTarget::fireEventListeners):
793
794 2017-02-13  Dean Jackson  <dino@apple.com>
795
796         Rename preferLowPowerToHighPerformance to powerPreference
797         https://bugs.webkit.org/show_bug.cgi?id=168269
798         <rdar://problem/30504444>
799
800         Reviewed by Chris Dumez.
801
802         Based on the discussion in https://github.com/KhronosGroup/WebGL/pull/2283.
803
804         Change WebGLContextAttributes's preferLowPowerToHighPerformance boolean
805         into a powerPreference enum taking three values. The implementation
806         of the enum is in GraphicsContext3DAttributes.
807
808         While the name and values have changed, there should be no change in
809         behaviour caused by this patch.
810
811         * html/canvas/WebGLContextAttributes.h: Use GraphicsContext3DAttributes
812         enum GraphicsContext3DPowerPreference.
813         * html/canvas/WebGLContextAttributes.idl: Rename and add the WebIDL enum.
814         * html/canvas/WebGLRenderingContextBase.cpp: Use the new values.
815         (WebCore::WebGLRenderingContextBase::create):
816         (WebCore::WebGLRenderingContextBase::registerWithWebGLStateTracker):
817         * platform/WebGLStateTracker.cpp:
818         * platform/WebGLStateTracker.h: Update the state tracker to use the new
819         values.
820         * platform/graphics/GraphicsContext3DAttributes.h:
821         * platform/graphics/mac/GraphicsContext3DMac.mm:
822         (WebCore::setPixelFormat): Accept GraphicsContext3DPowerPreference as a parameter.
823         (WebCore::GraphicsContext3D::GraphicsContext3D):
824
825 2017-02-14  Youenn Fablet  <youennf@gmail.com>
826
827         [WebRTC] Implement description getters for libwebrtc RTCPeerConnection
828         https://bugs.webkit.org/show_bug.cgi?id=168234
829
830         Reviewed by Alex Christensen.
831
832         Allows passing W3C webrtc tests.
833
834         Implementing localDescription/remoteDescription using libwebrtc backend.
835         current and pending description getters are made the same as local/remote getters for the moment.
836         This should be fixed when upgrading to latest libwebrtc revision.
837
838         * Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.cpp:
839         (WebCore::toSessionDescriptionType):
840         (WebCore::fromSessionDescriptionType):
841         (WebCore::fromSessionDescription):
842         (WebCore::LibWebRTCMediaEndpoint::localDescription):
843         (WebCore::LibWebRTCMediaEndpoint::remoteDescription):
844         (WebCore::LibWebRTCMediaEndpoint::doSetLocalDescription):
845         (WebCore::LibWebRTCMediaEndpoint::doSetRemoteDescription):
846         * Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.h:
847         * Modules/mediastream/libwebrtc/LibWebRTCPeerConnectionBackend.cpp:
848         (WebCore::LibWebRTCPeerConnectionBackend::localDescription):
849         * Modules/mediastream/libwebrtc/LibWebRTCPeerConnectionBackend.h:
850
851 2017-02-14  Jeremy Jones  <jeremyj@apple.com>
852
853         When playing inline after fullscreen, set a flag instead of adding attribute plays inline, and use in requiresFullscreenForVideoPlayback.
854         https://bugs.webkit.org/show_bug.cgi?id=167815
855         rdar://problem/27685077
856
857         Reviewed by Jer Noble.
858
859         Test: media/media-fullscreen-loop-inline.html
860
861         When video is allowed to play inline after fullscreen. Looped video causes play state to update, which can send video back to fullscreen when
862         allowsInline is false. This change will set a new flag when allowsInlineMediaPlaybackAfterFullscreen allows inline playback that can be tested
863         in requiresFullscreenForVideoPlayback to prevent sending video back into fullscreen when video loops.
864
865         * html/HTMLMediaElement.cpp:
866         (WebCore::HTMLMediaElement::enterFullscreen):
867         (WebCore::HTMLMediaElement::exitFullscreen):
868         * html/HTMLMediaElement.h:
869         (WebCore::HTMLMediaElement::isTemporarilyAllowingInlinePlaybackAfterFullscreen): Added.
870         * html/MediaElementSession.cpp:
871         (WebCore::MediaElementSession::requiresFullscreenForVideoPlayback):
872
873 2017-02-14  Jer Noble  <jer.noble@apple.com>
874
875         Video elements with MediaSource objects set by srcObject are not cleared when srcObject is set to null
876         https://bugs.webkit.org/show_bug.cgi?id=168268
877
878         Reviewed by Eric Carlson.
879
880         Test: fast/mediastream/MediaStream-MediaElement-setObject-null.html
881
882         Make the setSrcObject() operation compliant with the HTML spec. Since the specification defines
883         srcObject in terms of either a MediaSource, MediaStream, or Blob object, add the variant typedef
884         to HTMLMediaElement and move the definition out of the Modules/mediastream extension IDL and into
885         HTMLMediaElement.idl. Then bring the "media elements load" and "resource selection" algorithms up
886         to their most recent definitions in the HTML5 spec.
887
888         Drive-by fix: Allow the (admittedly weird) single-element-union type in IDL.
889
890         * CMakeLists.txt:
891         * DerivedSources.cpp:
892         * DerivedSources.make:
893         * Modules/mediastream/HTMLMediaElementMediaStream.cpp: Removed.
894         * Modules/mediastream/HTMLMediaElementMediaStream.h: Removed.
895         * Modules/mediastream/HTMLMediaElementMediaStream.idl: Removed.
896         * WebCore.xcodeproj/project.pbxproj:
897         * bindings/scripts/IDLParser.pm:
898         (parseUnionType):
899         * html/HTMLAudioElement.cpp:
900         (WebCore::HTMLAudioElement::createForJSConstructor):
901         * html/HTMLMediaElement.cpp:
902         (WebCore::actionName):
903         (WebCore::HTMLMediaElement::parseAttribute):
904         (WebCore::HTMLMediaElement::insertedInto):
905         (WebCore::HTMLMediaElement::scheduleDelayedAction):
906         (WebCore::HTMLMediaElement::scheduleNextSourceChild):
907         (WebCore::HTMLMediaElement::pendingActionTimerFired):
908         (WebCore::HTMLMediaElement::setSrcObject):
909         (WebCore::HTMLMediaElement::load):
910         (WebCore::HTMLMediaElement::prepareForLoad):
911         (WebCore::HTMLMediaElement::selectMediaResource):
912         (WebCore::HTMLMediaElement::loadResource):
913         (WebCore::HTMLMediaElement::playInternal):
914         (WebCore::HTMLMediaElement::pauseInternal):
915         (WebCore::HTMLMediaElement::sourceWasAdded):
916         (WebCore::HTMLMediaElement::clearMediaPlayer):
917         (WebCore::HTMLMediaElement::resume):
918         (WebCore::HTMLMediaElement::mediaCanStart):
919         (WebCore::HTMLMediaElement::createMediaPlayer):
920         (WebCore::HTMLMediaElement::loadInternal): Deleted.
921         * html/HTMLMediaElement.h:
922         (WebCore::HTMLMediaElement::srcObject):
923         * html/HTMLMediaElement.idl:
924         * platform/ContentType.h:
925
926 2017-02-14  Aakash Jain  <aakash_jain@apple.com>
927
928         Remove unused WebThreadContextIsCurrent method from WebCoreThread.h
929         https://bugs.webkit.org/show_bug.cgi?id=168254
930
931         Reviewed by Dan Bernstein.
932
933         * platform/ios/wak/WebCoreThread.h: Removed unused WebThreadContextIsCurrent.
934         * platform/ios/wak/WebCoreThread.mm:
935         (WebThreadContextIsCurrent): Deleted.
936
937 2017-02-14  Alexey Proskuryakov  <ap@apple.com>
938
939         WebCore shouldn't export SystemMemory.h
940         https://bugs.webkit.org/show_bug.cgi?id=168285
941
942         Reviewed by Alex Christensen.
943
944         * WebCore.xcodeproj/project.pbxproj:
945
946 2017-02-13  Filip Pizlo  <fpizlo@apple.com>
947
948         worker.postMessage should throw a TypeError if a SharedArrayBuffer is in the transfer list
949         https://bugs.webkit.org/show_bug.cgi?id=168277
950
951         Reviewed by Mark Lam.
952
953         Test: workers/sab/postMessage-transfer-type-error.html
954         
955         This is a simple spec compliance change. The title says it all.
956
957         * bindings/js/SerializedScriptValue.cpp:
958         (WebCore::SerializedScriptValue::create):
959
960 2017-02-14  Zan Dobersek  <zdobersek@igalia.com>
961
962         HTMLMediaElement: WebKitMediaKeys member name should be prefixed
963         https://bugs.webkit.org/show_bug.cgi?id=168297
964
965         Reviewed by Xabier Rodriguez-Calvar.
966
967         Rename the LEGACY_ENCRYPTED_MEDIA m_mediaKeys variable to m_webkitMediaKeys
968         so that it contains the legacy prefix, just like the API. This will make
969         room for the MediaKeys member variable that will be implemented under
970         the ENCRYPTED_MEDIA guards.
971
972         * html/HTMLMediaElement.cpp:
973         (WebCore::HTMLMediaElement::mediaPlayerCachedKeyForKeyId):
974         (WebCore::HTMLMediaElement::webkitSetMediaKeys):
975         * html/HTMLMediaElement.h:
976         (WebCore::HTMLMediaElement::webkitKeys):
977
978 2017-02-14  Carlos Garcia Campos  <cgarcia@igalia.com>
979
980         [GTK] Make DragImageRef a RefPtr instead of a plain pointer
981         https://bugs.webkit.org/show_bug.cgi?id=168296
982
983         Reviewed by Sergio Villar Senin.
984
985         Use RefPtr<cairo_surface_t> as DragImageRef for GTK+ port to avoid memory leaks.
986
987         * platform/DragImage.h:
988         * platform/gtk/DragImageGtk.cpp:
989         (WebCore::dragImageSize):
990         (WebCore::deleteDragImage):
991         (WebCore::scaleDragImage):
992         (WebCore::dissolveDragImageToFraction):
993         (WebCore::createDragImageFromImage):
994         (WebCore::createDragImageIconForCachedImageFilename):
995
996 2017-02-14  Vanessa Chipirrás Navalón  <vchipirras@igalia.com>
997
998         [GStreamer][MSE] Some GStreamer log messages are generated with the 'default' category
999         https://bugs.webkit.org/show_bug.cgi?id=168015
1000
1001         Reviewed by Xabier Rodriguez-Calvar.
1002
1003         The elements AppendPipeline, PlaybackPipeline, MediaSourceClientGstreamerMSE do not have
1004         a defined Gstreamer log category, then the webkitmse category has been added to them.
1005         WebKitMediaSourceGstreamer has its own category but was not declared at the beginning of
1006         the .cpp file.
1007
1008         * platform/graphics/gstreamer/mse/AppendPipeline.cpp: Added webkitmse category.
1009         * platform/graphics/gstreamer/mse/MediaSourceClientGStreamerMSE.cpp:
1010         Added webkitmse category and gst header.
1011         * platform/graphics/gstreamer/mse/PlaybackPipeline.cpp: Added webkitmse category.
1012         * platform/graphics/gstreamer/mse/WebKitMediaSourceGStreamer.cpp:
1013         Added webkitmediasrc category.
1014
1015 2017-02-14  Carlos Garcia Campos  <cgarcia@igalia.com>
1016
1017         CookieManager only works with the default session
1018         https://bugs.webkit.org/show_bug.cgi?id=168229
1019
1020         Reviewed by Alex Christensen.
1021
1022         Update cookie observer API to use a std::function instead of a function pointer and make it work with multiple
1023         sessions in the backends that support it.
1024
1025         * platform/network/CookieStorage.h:
1026         * platform/network/cf/CookieStorageCFNet.cpp:
1027         (WebCore::cookieChangeCallbackMap):
1028         (WebCore::notifyCookiesChanged):
1029         (WebCore::startObservingCookieChanges):
1030         (WebCore::stopObservingCookieChanges):
1031         * platform/network/mac/CookieStorageMac.mm:
1032         (-[WebCookieStorageObjCAdapter startListeningForCookieChangeNotificationsWithCallback:]):
1033         (-[WebCookieStorageObjCAdapter stopListeningForCookieChangeNotifications]):
1034         (WebCore::startObservingCookieChanges):
1035         (WebCore::stopObservingCookieChanges):
1036         * platform/network/soup/CookieStorageSoup.cpp:
1037         (WebCore::cookieChangeCallbackMap):
1038         (WebCore::soupCookiesChanged):
1039         (WebCore::startObservingCookieChanges):
1040         (WebCore::stopObservingCookieChanges):
1041
1042 2017-02-13  Antoine Quint  <graouts@apple.com>
1043
1044         REGRESSION: Update volume and scrubbing slider to match HI designs
1045         https://bugs.webkit.org/show_bug.cgi?id=168170
1046         <rdar://problem/28095266>
1047
1048         Reviewed by Dean Jackson.
1049
1050         We bring the designs of the control's background materials, scrubber and
1051         volume slider up to spec.
1052
1053         The first important set of changes is that, on macOS, the materials and colors
1054         were incorrect. Buttons and time labels now set a mix-blend-mode to correctly
1055         appear vibrant against the media, and the controls bar, volume container
1056         and tracks menu now use a new BackgroundTint node to correctly apply both
1057         a backdrop-filter and blended tint above it.
1058
1059         The second important set of changes is the rendering of the sliders. Up to now
1060         we would simply style the <input type="range"> track and thumb, applying solid
1061         fills and strokes. We now draw sliders in two ways depending on the platform.
1062         
1063         On macOS, we draw the whole slider with a <canvas> element with "mix-blend-mode"
1064         set to "plus-lighter". On iOS, we draw the track as a <div> with "mix-blend-mode"
1065         set to "plus-darker" and draw the fill (up to the thumb) in the <canvas> with
1066         no blend mode to obtain a pure white color, finally the thumb is rendered by the
1067         <input> element. We couldn't draw the pure white color with the track in the
1068         same <canvas> due to the "plus-darker" blend mode.
1069
1070         Test: media/modern-media-controls/background-tint/background-tint.html
1071
1072         * Modules/modern-media-controls/controls/airplay-button.css:
1073         (button.airplay.on):
1074         * Modules/modern-media-controls/controls/background-tint.css: Added.
1075         (.background-tint):
1076         (.background-tint,):
1077         (.background-tint > .blur):
1078         (.background-tint > .tint):
1079         * Modules/modern-media-controls/controls/background-tint.js: Added.
1080         (BackgroundTint):
1081         * Modules/modern-media-controls/controls/ios-inline-media-controls.css:
1082         (.media-controls.ios.inline .scrubber.slider):
1083         (.media-controls.ios.inline .scrubber.slider > div):
1084         (.media-controls.ios.inline .scrubber.slider > input::-webkit-slider-thumb):
1085         (.media-controls.ios.inline .scrubber.slider > .fill): Deleted.
1086         * Modules/modern-media-controls/controls/macos-compact-inline-media-controls.css:
1087         (.media-controls.mac.inline.compact .volume-slider-container):
1088         (.media-controls.mac.inline.compact .volume.slider):
1089         (.media-controls.mac.inline.compact .scrubber.slider > input::-webkit-slider-thumb): Deleted.
1090         * Modules/modern-media-controls/controls/macos-fullscreen-media-controls.css:
1091         (.media-controls.mac.fullscreen > .controls-bar):
1092         (.media-controls.mac.fullscreen > .controls-bar > .background-tint > div):
1093         (.media-controls.mac.fullscreen .volume.slider):
1094         (.media-controls.mac.fullscreen button.volume-up):
1095         (.media-controls.mac.fullscreen button.rewind):
1096         (.media-controls.mac.fullscreen button.forward):
1097         (.media-controls.mac.fullscreen .buttons-container.right button):
1098         (.media-controls.mac.fullscreen .scrubber):
1099         (.media-controls.mac.fullscreen > .controls-bar button): Deleted.
1100         (.media-controls.mac.fullscreen button.airplay): Deleted.
1101         (.media-controls.mac.fullscreen button.aspect-ratio): Deleted.
1102         (.media-controls.mac.fullscreen button.pip): Deleted.
1103         (.media-controls.mac.fullscreen button.tracks): Deleted.
1104         (.media-controls.mac.fullscreen button.fullscreen): Deleted.
1105         * Modules/modern-media-controls/controls/macos-fullscreen-media-controls.js:
1106         * Modules/modern-media-controls/controls/macos-inline-media-controls.css:
1107         (.media-controls.mac.inline .scrubber.slider):
1108         (.media-controls.mac.inline .volume-slider-container):
1109         (.media-controls.mac.inline .volume-slider-container > .background-tint):
1110         (.media-controls.mac.inline .volume-slider-container > .background-tint > div):
1111         (.media-controls.mac.inline .volume.slider):
1112         (.media-controls.mac.inline button): Deleted.
1113         (.media-controls.mac.inline button:active): Deleted.
1114         (.media-controls.mac.inline > .controls-bar button): Deleted.
1115         (.media-controls.mac.inline > .controls-bar,): Deleted.
1116         (.media-controls.mac.inline .volume-slider-container:before): Deleted.
1117         * Modules/modern-media-controls/controls/macos-inline-media-controls.js:
1118         (MacOSInlineMediaControls.prototype.layout):
1119         * Modules/modern-media-controls/controls/macos-media-controls.css: Added.
1120         (.media-controls.mac button:active):
1121         (.media-controls.mac > .controls-bar button):
1122         (.media-controls.mac > .controls-bar .time-label):
1123         (.media-controls.mac > .controls-bar .slider > canvas):
1124         (.media-controls.mac > .controls-bar .slider > input::-webkit-slider-thumb):
1125         * Modules/modern-media-controls/controls/scrubber.css: Removed.
1126         * Modules/modern-media-controls/controls/scrubber.js:
1127         (Scrubber):
1128         (Scrubber.prototype.get buffered):
1129         (Scrubber.prototype.set buffered):
1130         (Scrubber.prototype.draw):
1131         (Scrubber.prototype._drawMacOS):
1132         (Scrubber.prototype._drawiOS):
1133         * Modules/modern-media-controls/controls/slider.css:
1134         (.slider):
1135         (.slider > canvas,):
1136         (.slider > canvas):
1137         (.slider > input):
1138         (.slider > input,): Deleted.
1139         (.slider > .fill): Deleted.
1140         (.slider > input::-webkit-slider-thumb): Deleted.
1141         * Modules/modern-media-controls/controls/slider.js:
1142         (Slider.prototype.set value):
1143         (Slider.prototype.set width):
1144         (Slider.prototype.commitProperty):
1145         (Slider.prototype.layout):
1146         (Slider.prototype.draw):
1147         (Slider.prototype._handleInputEvent):
1148         (Slider.prototype._handleChangeEvent):
1149         (addRoundedRect):
1150         (Slider.prototype._updateFill): Deleted.
1151         * Modules/modern-media-controls/controls/start-button.css:
1152         (button.start):
1153         * Modules/modern-media-controls/controls/time-control.js:
1154         * Modules/modern-media-controls/controls/time-label.css:
1155         (.time-label):
1156         * Modules/modern-media-controls/controls/tracks-panel.css:
1157         (.tracks-panel):
1158         (.tracks-panel > .background-tint > div):
1159         (.tracks-panel > section):
1160         (.tracks-panel > section:first-of-type):
1161         (.tracks-panel > section > h3):
1162         (.tracks-panel > section > ul):
1163         (.tracks-panel > section > ul > li):
1164         (.tracks-panel > section > ul > li:focus):
1165         (.tracks-panel > section > ul > li.selected:before):
1166         (.tracks-panel > section > ul > li.animated):
1167         (.tracks-panel-section): Deleted.
1168         (.tracks-panel-section:first-of-type): Deleted.
1169         (.tracks-panel-section > h3): Deleted.
1170         (.tracks-panel-section > ul): Deleted.
1171         (.tracks-panel-section > ul > li): Deleted.
1172         (.tracks-panel-section > ul > li:focus): Deleted.
1173         (.tracks-panel-section > ul > li.selected:before): Deleted.
1174         (.tracks-panel-section > ul > li.animated): Deleted.
1175         * Modules/modern-media-controls/controls/tracks-panel.js:
1176         (TracksPanel.prototype._childrenFromDataSource):
1177         (TracksPanel.prototype._childrenFromDataSource.): Deleted.
1178         * Modules/modern-media-controls/controls/volume-slider.js:
1179         (VolumeSlider):
1180         (VolumeSlider.prototype.handleEvent):
1181         (VolumeSlider.prototype.draw):
1182         * Modules/modern-media-controls/js-files:
1183         * Modules/modern-media-controls/media/scrubbing-support.js:
1184         (ScrubbingSupport.prototype.get mediaEvents):
1185         (ScrubbingSupport.prototype.syncControl):
1186         (ScrubbingSupport):
1187
1188 2017-02-13  Alex Christensen  <achristensen@webkit.org>
1189
1190         URLs with an invalid IPv4 address should be invalid
1191         https://bugs.webkit.org/show_bug.cgi?id=168260
1192
1193         Reviewed by Tim Horton.
1194
1195         All URL hosts are fed through the IPv4 parser.  https://webkit.org/ doesn't
1196         look enough like an IPv4 address to be considered an invalid IPv4 address, so 
1197         we continue to the String host processing.  http://127.0.0.257 does, though, and
1198         according to https://url.spec.whatwg.org/#concept-ipv4-parser parsing that URL
1199         should fail.
1200
1201         Covered by newly passing web platform tests.
1202
1203         * platform/URLParser.cpp:
1204         (WebCore::URLParser::parseIPv4Host):
1205         (WebCore::URLParser::parseHostAndPort):
1206         * platform/URLParser.h:
1207
1208 2017-02-13  Dan Bernstein  <mitz@apple.com>
1209
1210         Reverted r212275. It still breaks some Apple-internal builds.
1211
1212         * platform/spi/mac/TUCallSPI.h:
1213
1214 2017-02-13  Joseph Pecoraro  <pecoraro@apple.com>
1215
1216         Address ESLint warnings in modern-media-controls
1217         https://bugs.webkit.org/show_bug.cgi?id=168224
1218
1219         Reviewed by Alexey Proskuryakov.
1220
1221         * Modules/modern-media-controls/controls/controls-bar.js:
1222         * Modules/modern-media-controls/controls/fullscreen-button.js:
1223         * Modules/modern-media-controls/controls/layout-node.js:
1224         * Modules/modern-media-controls/controls/macos-fullscreen-media-controls.js:
1225         * Modules/modern-media-controls/controls/media-controls.js:
1226         * Modules/modern-media-controls/controls/scheduler.js:
1227         * Modules/modern-media-controls/controls/seek-button.js:
1228         * Modules/modern-media-controls/controls/tracks-panel.js:
1229         * Modules/modern-media-controls/controls/volume-slider.js:
1230         * Modules/modern-media-controls/gesture-recognizers/gesture-recognizer.js:
1231         * Modules/modern-media-controls/gesture-recognizers/pinch.js:
1232         * Modules/modern-media-controls/media/fullscreen-support.js:
1233         * Modules/modern-media-controls/media/media-controller.js:
1234         * Modules/modern-media-controls/media/placard-support.js:
1235         * Modules/modern-media-controls/media/status-support.js:
1236         Address pedantic warnings.
1237
1238 2017-02-13  Dan Bernstein  <mitz@apple.com>
1239
1240         Restored changes from r212210 in a way that does not break the build.
1241
1242         * platform/spi/mac/TUCallSPI.h:
1243
1244 2017-02-13  Zalan Bujtas  <zalan@apple.com>
1245
1246         FontCascade::widthForSimpleText should skip applyTransforms() when kerning and ligatures are off.
1247         https://bugs.webkit.org/show_bug.cgi?id=168251
1248         <rdar://problem/30498102>
1249
1250         Reviewed by Antti Koivisto.
1251
1252         Covered by existing (perf)tests.
1253
1254         * platform/graphics/FontCascade.cpp:
1255         (WebCore::FontCascade::widthForSimpleText):
1256
1257 2017-02-12  Brian Burg  <bburg@apple.com>
1258
1259         Web Inspector: expose system user interface layout direction through InspectorFrontendHost
1260         https://bugs.webkit.org/show_bug.cgi?id=168209
1261         <rdar://problem/11573736>
1262
1263         Reviewed by Joseph Pecoraro.
1264
1265         Forward the UserInterfaceLayoutDirection of the inspector page. If the WebKit client has
1266         properly set the UI directionality from system settings in PageClient, this will get inherited
1267         automatically by the Inspector's WebPage instance.
1268
1269         * inspector/InspectorFrontendClient.h:
1270         * inspector/InspectorFrontendClientLocal.cpp:
1271         (WebCore::InspectorFrontendClientLocal::userInterfaceLayoutDirection):
1272         * inspector/InspectorFrontendClientLocal.h:
1273
1274         * inspector/InspectorFrontendHost.h:
1275         * inspector/InspectorFrontendHost.idl:
1276         * inspector/InspectorFrontendHost.cpp:
1277         (WebCore::InspectorFrontendHost::userInterfaceLayoutDirection):
1278         Expose the directionality to the frontend as "ltr" or "rtl" strings.
1279
1280 2017-02-13  Zalan Bujtas  <zalan@apple.com>
1281
1282         Simple line layout: Do not measure runs with trailing whitespace when kerning and ligatures are off.
1283         https://bugs.webkit.org/show_bug.cgi?id=168247
1284         <rdar://problem/30497288>
1285
1286         Reviewed by Antti Koivisto.
1287
1288         The width of the run is supposed to be the same with or without the trailing whitespace.
1289
1290         Covered by performance test.
1291
1292         * rendering/SimpleLineLayoutTextFragmentIterator.cpp:
1293         (WebCore::SimpleLineLayout::TextFragmentIterator::Style::Style):
1294         (WebCore::SimpleLineLayout::TextFragmentIterator::textWidth):
1295         * rendering/SimpleLineLayoutTextFragmentIterator.h:
1296
1297 2017-02-13  Karim H  <karim@karhm.com>
1298
1299         Added the other missing BSTR roles tag names.
1300         https://bugs.webkit.org/show_bug.cgi?id=165545
1301
1302         Reviewed by Chris Fleizach.
1303
1304         Test: accessibility/win/bstr-elements-role.html
1305
1306         * accessibility/AccessibilityRenderObject.cpp:
1307         (WebCore::shouldReturnTagNameAsRoleForMSAA):
1308
1309 2017-02-13  Youenn Fablet  <youennf@gmail.com>
1310
1311         [WebRTC] Creating RTCPeerConnection with libwebrtc backend is crashing on rwt
1312         https://bugs.webkit.org/show_bug.cgi?id=168250
1313
1314         Reviewed by Alex Christensen.
1315
1316         Covered by webrtc tests in LayoutTests and in web-platform-tests.
1317         Making mock peer connection factory keep a ref of the real libwebrtc peer connection factory.
1318         That way, it can create real libwebrtc backends whenever requested by tests.
1319
1320         Moving LibWebRTCUtils.h routines as static LibWebRTCProvider methods.
1321         In the future, we should make them no longer static.
1322
1323         * Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.cpp:
1324         (WebCore::LibWebRTCMediaEndpoint::doCreateOffer):
1325         (WebCore::LibWebRTCMediaEndpoint::doCreateAnswer):
1326         * Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.h:
1327         * WebCore.xcodeproj/project.pbxproj:
1328         * platform/mediastream/libwebrtc/LibWebRTCProvider.cpp: Renamed from Source/WebCore/platform/mediastream/libwebrtc/LibWebRTCUtils.cpp.
1329         (WebCore::LibWebRTCProvider::callOnWebRTCNetworkThread):
1330         (WebCore::LibWebRTCProvider::callOnWebRTCSignalingThread):
1331         (WebCore::LibWebRTCProvider::factory):
1332         (WebCore::LibWebRTCProvider::setPeerConnectionFactory):
1333         (WebCore::createActualPeerConnection):
1334         (WebCore::LibWebRTCProvider::createPeerConnection):
1335         * platform/mediastream/libwebrtc/LibWebRTCProvider.h:
1336         * platform/mediastream/libwebrtc/LibWebRTCUtils.h: Removed.
1337         * platform/mediastream/mac/RealtimeOutgoingAudioSource.cpp:
1338         (WebCore::RealtimeOutgoingAudioSource::audioSamplesAvailable):
1339         * testing/Internals.cpp:
1340         * testing/MockLibWebRTCPeerConnection.cpp:
1341         (WebCore::useMockRTCPeerConnectionFactory):
1342         (WebCore::MockLibWebRTCPeerConnectionForIceCandidates::gotLocalDescription):
1343         (WebCore::releaseInNetworkThread):
1344         (WebCore::MockLibWebRTCPeerConnection::SetLocalDescription):
1345         (WebCore::MockLibWebRTCPeerConnection::SetRemoteDescription):
1346         (WebCore::MockLibWebRTCPeerConnection::CreateOffer):
1347         (WebCore::MockLibWebRTCPeerConnection::CreateAnswer):
1348
1349 2017-02-13  Anders Carlsson  <andersca@apple.com>
1350
1351         Simplify DragController::startDrag
1352         https://bugs.webkit.org/show_bug.cgi?id=168240
1353
1354         Reviewed by Tim Horton.
1355
1356         Use early returns instead of assigning to a variable that's returned at the end of the function.
1357
1358         * page/DragController.cpp:
1359         (WebCore::DragController::startDrag):
1360
1361 2017-02-13  Said Abou-Hallawa  <sabouhallawa@apple.com>
1362
1363         The current frame of an image should not deleted if another frame is asynchronously being decoded
1364         https://bugs.webkit.org/show_bug.cgi?id=167618
1365
1366         Reviewed by Simon Fraser.
1367
1368         Test: fast/images/animated-image-draw-while-decode.html
1369
1370         If the memory cache asks the BitmapImage to destroy all its frames while
1371         the next frame is being decoded, a thread contention may happen. This can
1372         happen when BitmapImage::draw() is called and the next frame is not ready
1373         yet for drawing, so the current frame has to be drawn. This will invoke
1374         a frame decoding in the same image from the drawing committing thread.
1375
1376         We can avoid that by destroying all the frames except the current frame if
1377         the image is asynchronously decoding its frames. This should not add extra
1378         memory overhead because building the image frame cache and then destroying
1379         it, when needed, is an on-going process. The frames will be allocated and
1380         decoded all the time and all of them can be destroyed except the current one.
1381         
1382         * platform/graphics/BitmapImage.cpp:
1383         (WebCore::BitmapImage::destroyDecodedData):
1384         (WebCore::BitmapImage::destroyDecodedDataIfNecessary):
1385         The logic of destroying the ImageFrames was split among BitmapImage, ImageSource
1386         and ImageFrameCache. Move all the logic to BitmapImage and have ImageFrameCache
1387         be responsible only for destroying a range of ImageFrames.
1388
1389         (WebCore::BitmapImage::draw): add an ASSERT_IMPLIES to ensure the current frame
1390         is ready to be rendered if the next frame is being decoded.
1391         
1392         * platform/graphics/BitmapImage.h: Move a const from ImageFrameCache.h to BitmapImage.h.
1393
1394         * platform/graphics/ImageFrameCache.cpp:
1395         (WebCore::ImageFrameCache::destroyDecodedData):
1396         (WebCore::ImageFrameCache::destroyDecodedDataIfNecessary): Deleted.
1397         * platform/graphics/ImageFrameCache.h:
1398         (WebCore::ImageFrameCache::destroyAllDecodedData):
1399         (WebCore::ImageFrameCache::destroyAllDecodedDataExcludeFrame):
1400         (WebCore::ImageFrameCache::destroyDecodedDataBeforeFrame):
1401         Make ImageFrameCache be responsible for destroying a range of ImageFrames.
1402         This range might include all the frames, all the frames but up to a specific
1403         frame, or all the frames but exclude one frame in the middle.
1404         
1405         * platform/graphics/ImageSource.cpp:
1406         (WebCore::ImageSource::clear): No need to call clearFrameBufferCache() from clear().
1407         The decision to call clearFrameBufferCache() or clear() is moved to
1408         BitmapImage::destroyDecodedData().
1409          
1410         (WebCore::ImageSource::destroyDecodedData): Deleted.
1411         (WebCore::ImageSource::destroyDecodedDataIfNecessary): Deleted.
1412         These functions are replaced by another set of functions in ImageSource.h.
1413         
1414         * platform/graphics/ImageSource.h:
1415         (WebCore::ImageSource::destroyAllDecodedData):
1416         (WebCore::ImageSource::destroyAllDecodedDataExcludeFrame):
1417         (WebCore::ImageSource::destroyDecodedDataBeforeFrame):
1418         (WebCore::ImageSource::hasDecodingQueue):
1419         These are new wrappers which call the corresponding ImageFrameCache functions.
1420
1421 2017-02-13  Myles C. Maxfield  <mmaxfield@apple.com>
1422
1423         [Cocoa] Stop soft-linking CTRunGetBaseAdvancesAndOrigins()
1424         https://bugs.webkit.org/show_bug.cgi?id=168256
1425
1426         Reviewed by Alex Christensen.
1427
1428         Use of this function is already behind a platform guard.
1429
1430         No new tests because there is no behavior change.
1431
1432         * platform/graphics/mac/ComplexTextControllerCoreText.mm:
1433         (SOFT_LINK): Deleted.
1434
1435 2017-02-13  Jiewen Tan  <jiewen_tan@apple.com>
1436
1437         [WebCrypto] WebInspector should indicate webkitSubtle is deprecated
1438         https://bugs.webkit.org/show_bug.cgi?id=165913
1439         <rdar://problem/30477222>
1440
1441         Reviewed by Joseph Pecoraro.
1442
1443         Covered by existing tests.
1444
1445         * page/Crypto.cpp:
1446         (WebCore::Crypto::webkitSubtle):
1447
1448 2017-02-13  Simon Fraser  <simon.fraser@apple.com>
1449
1450         Call WKDestroyRenderingResources() on iOS when tabs are backgrounded
1451         https://bugs.webkit.org/show_bug.cgi?id=168261
1452         rdar://problem/30481079
1453
1454         Reviewed by Tim Horton.
1455
1456         Add CABackingStoreCollectBlocking() to QuartzCoreSPI.h, and fix files in WebCore
1457         that do a framework include.
1458
1459         * platform/graphics/cocoa/TextTrackRepresentationCocoa.mm:
1460         * platform/graphics/cocoa/WebActionDisablingCALayerDelegate.h:
1461         * platform/spi/cocoa/QuartzCoreSPI.h:
1462         * platform/spi/mac/NSViewSPI.h:
1463
1464 2017-02-13  Youenn Fablet  <youenn@apple.com>
1465
1466         ASSERTION FAILED: !m_bodyLoader
1467         https://bugs.webkit.org/show_bug.cgi?id=166986
1468
1469         Reviewed by Sam Weinig.
1470
1471         Refactoring to make the unset/set pending activity part of body loader.
1472         This allows ensuring to not forget to do that by simply deleting the body loader.
1473
1474         * Modules/fetch/FetchResponse.cpp:
1475         (WebCore::FetchResponse::fetch):
1476         (WebCore::FetchResponse::BodyLoader::didSucceed):
1477         (WebCore::FetchResponse::BodyLoader::didFail):
1478         (WebCore::FetchResponse::BodyLoader::BodyLoader):
1479         (WebCore::FetchResponse::BodyLoader::~BodyLoader):
1480         (WebCore::FetchResponse::stop):
1481         * Modules/fetch/FetchResponse.h:
1482
1483 2017-02-13  Aakash Jain  <aakash_jain@apple.com>
1484
1485         Remove unused WebCoreThreadSafe.h
1486         https://bugs.webkit.org/show_bug.cgi?id=168236
1487
1488         Reviewed by Dan Bernstein.
1489
1490         * platform/ios/wak/WebCoreThreadSafe.h: Removed.
1491         * WebCore.xcodeproj/project.pbxproj: Removed WebCoreThreadSafe.h
1492         * platform/ios/wak/WebCoreThread.mm: Removed WebCoreThreadSafe.h and included WAKWindow.h directly
1493
1494 2017-02-13  Anders Carlsson  <andersca@apple.com>
1495
1496         Fix iOS build.
1497
1498         * platform/ios/DragImageIOS.mm:
1499         (WebCore::deleteDragImage):
1500
1501 2017-02-13  Sam Weinig  <sam@webkit.org>
1502
1503         Rename MediaQueryExp.h/cpp to MediaQueryExpression.h/cpp
1504         https://bugs.webkit.org/show_bug.cgi?id=168249
1505
1506         Reviewed by Dean Jackson.
1507
1508         Fix a FIXME and rename MediaQueryExp.h/cpp to match the class it contains, MediaQueryExpression.
1509
1510         * CMakeLists.txt:
1511         * WebCore.xcodeproj/project.pbxproj:
1512         * css/CSSAllInOne.cpp:
1513         * css/MediaQuery.h:
1514         * css/MediaQueryEvaluator.h:
1515         * css/MediaQueryExp.cpp: Removed.
1516         * css/MediaQueryExp.h: Removed.
1517         * css/MediaQueryExpression.cpp: Copied from Source/WebCore/css/MediaQueryExp.cpp.
1518         * css/MediaQueryExpression.h: Copied from Source/WebCore/css/MediaQueryExp.h.
1519         * css/parser/MediaQueryParser.h:
1520
1521 2017-02-13  Aakash Jain  <aakash_jain@apple.com>
1522
1523         WAKResponder should be exported from WebCore
1524         https://bugs.webkit.org/show_bug.cgi?id=168245
1525
1526         Reviewed by Dan Bernstein.
1527
1528         * platform/ios/wak/WAKResponder.h:
1529
1530 2017-02-13  Simon Fraser  <simon.fraser@apple.com>
1531
1532         Log to the History Channel in a few more places
1533         https://bugs.webkit.org/show_bug.cgi?id=168252
1534
1535         Reviewed by Brady Eidson.
1536
1537         *** Aliens ***
1538
1539         * loader/HistoryController.cpp:
1540         (WebCore::HistoryController::restoreScrollPositionAndViewState):
1541         (WebCore::HistoryController::updateForReload):
1542         * loader/NavigationScheduler.cpp:
1543         (WebCore::NavigationScheduler::scheduleHistoryNavigation):
1544         (WebCore::NavigationScheduler::timerFired):
1545         (WebCore::NavigationScheduler::cancel):
1546         * page/History.cpp:
1547         (WebCore::History::go):
1548
1549 2017-02-13  Alex Christensen  <achristensen@webkit.org>
1550
1551         Percent should be allowed in non-special URL hosts
1552         https://bugs.webkit.org/show_bug.cgi?id=168255
1553
1554         Reviewed by Tim Horton.
1555
1556         In the last few weeks, the spec has consolidated its sets of code points.
1557         Now forbidden host code points replace the old invalid host code points with
1558         the modification that percents are allowed in non-special hosts because we
1559         percent-encode non-ascii code points in non-special hosts.
1560         See https://url.spec.whatwg.org/#concept-opaque-host-parser
1561
1562         Covered by newly passing web platform tests.
1563
1564         * platform/URLParser.cpp:
1565         (WebCore::isC0Control):
1566         (WebCore::isInUserInfoEncodeSet):
1567         (WebCore::URLParser::hasForbiddenHostCodePoint):
1568         (WebCore::URLParser::parseHostAndPort):
1569         (WebCore::isInvalidDomainCharacter): Deleted.
1570         (WebCore::URLParser::hasInvalidDomainCharacter): Deleted.
1571         * platform/URLParser.h:
1572
1573 2017-02-13  Anders Carlsson  <andersca@apple.com>
1574
1575         Fix Windows build.
1576
1577         * platform/win/PasteboardWin.cpp:
1578         (WebCore::Pasteboard::setDragImage):
1579
1580 2017-02-13  Alex Christensen  <achristensen@webkit.org>
1581
1582         Fix Yosemite build after r211765
1583         https://bugs.webkit.org/show_bug.cgi?id=168246
1584         <rdar://problem/30494174>
1585
1586         Reviewed by Brady Eidson.
1587
1588         * platform/graphics/mac/ComplexTextControllerCoreText.mm:
1589         (SOFT_LINK):
1590
1591 2017-02-13  Anders Carlsson  <andersca@apple.com>
1592
1593         Add a DragImage class that wraps a DragImageRef
1594         https://bugs.webkit.org/show_bug.cgi?id=168131
1595
1596         Reviewed by Beth Dakin.
1597
1598         This allows us to get rid of the explicit deleteDragImage calls and will make additional cleanup of the
1599         various drag code paths possible. No functionality change.
1600
1601         * dom/DataTransfer.cpp:
1602         (WebCore::DataTransfer::updateDragImage):
1603         * page/DragController.cpp:
1604         (WebCore::DragController::startDrag):
1605         (WebCore::DragController::doImageDrag):
1606         (WebCore::DragController::doSystemDrag):
1607         * page/DragController.h:
1608         * platform/DragImage.cpp:
1609         (WebCore::DragImage::DragImage):
1610         (WebCore::DragImage::operator=):
1611         (WebCore::DragImage::~DragImage):
1612         * platform/DragImage.h:
1613         * platform/Pasteboard.h:
1614         * platform/StaticPasteboard.h:
1615         * platform/mac/PasteboardMac.mm:
1616         (WebCore::Pasteboard::setDragImage):
1617
1618 2017-02-13  Chris Dumez  <cdumez@apple.com>
1619
1620         Regression(r211455): ASSERTION FAILED: frameView || pageCacheState() == InPageCache in com.apple.WebCore: WebCore::Document::destroyRenderTree
1621         https://bugs.webkit.org/show_bug.cgi?id=168237
1622         <rdar://problem/30494165>
1623
1624         Reviewed by Gavin Barraclough.
1625
1626         Drop bad assertion under document::destroyRenderTree() that was introduced in r211455.
1627         The assertion seemed like a good idea but the issue is that CachedFrame::destroy()
1628         reset's the document's pageCacheState before calling Document::prepareForDestruction().
1629
1630         No new tests, this fixes assertion hits on our bots.
1631
1632         * dom/Document.cpp:
1633         (WebCore::Document::destroyRenderTree):
1634
1635 2017-02-13  Myles C. Maxfield  <mmaxfield@apple.com>
1636
1637         Update custom line breaking iterators to the latest version of Unicode
1638         https://bugs.webkit.org/show_bug.cgi?id=168182
1639
1640         Reviewed by Zalan Bujtas.
1641
1642         Clean up our breaking code to be more descriptive about the difference between
1643         line-break: auto vs line-break: loose | normal | strict. The only difference is
1644         that we have some hardcoded tables to speed up character iteration for
1645         line-break: auto.
1646
1647         Tests: TestWebKitAPI WebKit2.LineBreaking
1648
1649         * rendering/BreakLines.h:
1650         (WebCore::nextBreakablePosition):
1651         (WebCore::nextBreakablePositionIgnoringNBSP):
1652         (WebCore::nextBreakablePositionWithoutShortcut):
1653         (WebCore::nextBreakablePositionIgnoringNBSPWithoutShortcut):
1654         (WebCore::isBreakable):
1655         (WebCore::nextBreakablePositionNonLoosely): Deleted.
1656         (WebCore::nextBreakablePositionLoosely): Deleted.
1657         (WebCore::nextBreakablePositionLoose): Deleted.
1658         (WebCore::nextBreakablePositionIgnoringNBSPLoose): Deleted.
1659         * rendering/RenderText.cpp:
1660         (WebCore::RenderText::computePreferredLogicalWidths):
1661         * rendering/SimpleLineLayoutTextFragmentIterator.cpp:
1662         (WebCore::SimpleLineLayout::nextBreakablePositionInSegment):
1663         * rendering/line/BreakingContext.h:
1664         (WebCore::BreakingContext::handleText):
1665         (WebCore::BreakingContext::optimalLineBreakLocationForTrailingWord):
1666
1667 2017-02-13  Youenn Fablet  <youenn@apple.com>
1668
1669         Remove @getUserMedia identifier
1670         https://bugs.webkit.org/show_bug.cgi?id=168216
1671
1672         Reviewed by Sam Weinig.
1673
1674         No change of behavior.
1675
1676         * Modules/mediastream/MediaDevices.idl:
1677         * bindings/js/WebCoreBuiltinNames.h:
1678
1679 2017-02-13  Carlos Garcia Campos  <cgarcia@igalia.com>
1680
1681         [GTK] Non-accelerated drawing is broken with HiDPI
1682         https://bugs.webkit.org/show_bug.cgi?id=168128
1683
1684         Reviewed by Michael Catanzaro.
1685
1686         When device scale factor changes, the page notifies the page overlay controller about it. Then overlay root
1687         layers are created to be notified about the device scale factor. That causes us to enter in accelerated
1688         compositing mode, because the graphics layer factory is called. But the render layer compositor doesn't really
1689         enter in accelerated mode, because there aren't page overlays, the accelerated mode is not forced and the website
1690         doesn't require acceleration either. This leaves our drawing area in an inconsistent state, it thinks it's in AC
1691         mode because it has a layer tree host, but without a root layer attached, so nothing is rendered. The page
1692         overlay controller doesn't need to create the layers when device scale factor changes, when an overlay is
1693         installed, layers will be created with the current device scale factor anyway.
1694
1695         * page/PageOverlayController.cpp:
1696         (WebCore::PageOverlayController::didChangeDeviceScaleFactor): Return early if not initialized yet.
1697
1698 2017-02-13  Csaba Osztrogonác  <ossy@webkit.org>
1699
1700         REGRESSION(r210845) Build broken with ENABLE_MHTML disabled
1701         https://bugs.webkit.org/show_bug.cgi?id=167771
1702
1703         Reviewed by Daniel Bates.
1704
1705         * loader/DocumentLoader.cpp:
1706         (WebCore::DocumentLoader::commitData):
1707
1708 2017-02-12  Dan Bernstein  <mitz@apple.com>
1709
1710         Tried to fix USE(APPLE_INTERNAL_SDK) builds after r212211.
1711
1712         * platform/spi/mac/TUCallSPI.h: Reverted to r212210.
1713
1714 2017-02-12  Dan Bernstein  <mitz@apple.com>
1715
1716         Tried to fix USE(APPLE_INTERNAL_SDK) builds after r212211.
1717
1718         * platform/spi/mac/TUCallSPI.h:
1719
1720 2017-02-12  Dan Bernstein  <mitz@apple.com>
1721
1722         Tried to fix USE(APPLE_INTERNAL_SDK) builds after r212211.
1723
1724         * platform/spi/mac/TUCallSPI.h:
1725
1726 2017-02-12  Dan Bernstein  <mitz@apple.com>
1727
1728         Tried to fix USE(APPLE_INTERNAL_SDK) builds after r212211.
1729
1730         * platform/spi/mac/NSMenuSPI.h: Replaced declaration of deprecated method with its current
1731           equivalent.
1732
1733 2017-02-12  Dan Bernstein  <mitz@apple.com>
1734
1735         Tried to fix USE(APPLE_INTERNAL_SDK) builds after r212211.
1736
1737         * platform/spi/mac/NSImmediateActionGestureRecognizerSPI.h:
1738
1739 2017-02-12  Ryosuke Niwa  <rniwa@webkit.org>
1740
1741         parserRemoveChild should unload subframes
1742         https://bugs.webkit.org/show_bug.cgi?id=168151
1743
1744         Reviewed by Darin Adler.
1745
1746         Fix the bug that the adoption agency algorithm does not unload subframes as it disconnects nodes.
1747
1748         Also moved calls to nodeWillBeRemoved inside NoEventDispatchAssertion to expand on r211965.
1749
1750         Tests: fast/parser/adoption-agency-clear-focus-range.html
1751                fast/parser/adoption-agency-unload-iframe-1.html
1752                fast/parser/adoption-agency-unload-iframe-2.html
1753
1754         * dom/ContainerNode.cpp:
1755         (WebCore::ContainerNode::takeAllChildrenFrom): Rewritten using idioms used in removeChildren and parserAppendChild.
1756
1757         Disconnect all subframes first since this can synchronously dispatch an unload event. Then update DOM ranges,
1758         the focused element, and other states in the document.
1759
1760         Second, use the regular removeBetween, notifyChildNodeRemoved, childrenChanged sequence of calls to disconnect nodes
1761         instead of a single call to removeDetachedChildren to properly disconnect child nodes since those nodes may have
1762         already come live due to execution of synchronous scripts prior to the adoption agency algorithm has run, or in
1763         response to the unload event we just dispatched.
1764
1765         Third, append these nodes using parserAppendChild to avoid dispatching mutation events.
1766
1767         (WebCore::willRemoveChild): Removed the call to nodeWillBeRemoved. It's now called within NoEventDispatchAssertion
1768         in each call site of willRemoveChild and willRemoveChildren.
1769         (WebCore::willRemoveChildren): Ditto.
1770         (WebCore::ContainerNode::removeChild): Call nodeWillBeRemoved inside NoEventDispatchAssertion.
1771         (WebCore::ContainerNode::replaceAllChildren): Call nodeWillBeRemoved inside NoEventDispatchAssertion.
1772         (WebCore::ContainerNode::parserRemoveChild): Disconnect subframes and update document's states.
1773
1774         * html/parser/HTMLConstructionSite.cpp:
1775         (WebCore::executeTakeAllChildrenAndReparentTask): Add a release assert that new parent does not already have a parent. 
1776
1777 2017-02-12  Ryosuke Niwa  <rniwa@webkit.org>
1778
1779         REGRESSION (r179497): Crash inside setAttributeNode
1780         https://bugs.webkit.org/show_bug.cgi?id=168161
1781         <rdar://problem/30451581>
1782
1783         Reviewed by Andreas Kling.
1784
1785         The bug was caused by setAttributeNode calling setAttributeInternal with the same element data as the one used
1786         to call removeAttributeInternal despite of the fact removeAttributeInternal could have invoked arbitrary scripts
1787         and mutated element's m_elementData.
1788
1789         Fixed the bug by calling with setAttributeInternal with the result of new invocation of ensureUniqueElementData().
1790
1791         Test: fast/dom/Attr/make-unique-element-data-while-replacing-attr.html
1792
1793         * dom/Element.cpp:
1794         (WebCore::Element::setAttributeNode):
1795
1796 2017-02-12  Ryosuke Niwa  <rniwa@webkit.org>
1797
1798         Rebaseline bindings tests after r212207.
1799
1800         * bindings/scripts/test/JS/JSTestObj.cpp:
1801         * bindings/scripts/test/JS/JSTestOverloadedConstructorsWithSequence.cpp:
1802
1803 2017-02-12  Dan Bernstein  <mitz@apple.com>
1804
1805         [Cocoa] Some -respondsToSelector: checks are unnecessary
1806         https://bugs.webkit.org/show_bug.cgi?id=168183
1807
1808         Reviewed by Tim Horton.
1809
1810         * English.lproj/Localizable.strings: Removed a string that’s no longer needed after the
1811           change to WebKit2/Platform/mac/MenuUtilities.mm.
1812
1813         * editing/mac/DictionaryLookup.mm:
1814         (WebCore::showPopupOrCreateAnimationController): Removed check whether
1815           LULookupDefinitionModule responds to +showDefinitionForTerm:relativeToRect:ofView:options:.
1816
1817         * platform/cocoa/NetworkExtensionContentFilter.mm:
1818         (WebCore::NetworkExtensionContentFilter::initialize): Changed to use
1819           -[NEFilterSource setSourceAppIdentifier:], without checking, instead of
1820           -setSourceAppBundleID:, which does not exist.
1821
1822         * platform/cocoa/ScrollController.mm:
1823         (systemUptime): Deleted.
1824         (WebCore::ScrollController::snapRubberBand): Use -[NSProcessInfo systemUptime] directly.
1825
1826         * platform/graphics/avfoundation/objc/MediaPlaybackTargetPickerMac.mm:
1827         (WebCore::MediaPlaybackTargetPickerMac::showPlaybackTargetPicker): Remove unnecessary check.
1828
1829         * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
1830         (WebCore::MediaPlayerPrivateAVFoundationObjC::createAVPlayerLayer): Ditto.
1831         (WebCore::MediaPlayerPrivateAVFoundationObjC::setVideoFullscreenMode): Ditto.
1832         (WebCore::MediaPlayerPrivateAVFoundationObjC::didPassCORSAccessCheck): Replaced
1833           -respondsToSelector: check with -isKindOfClass: check corresponding to the above cast.
1834         (WebCore::MediaPlayerPrivateAVFoundationObjC::setShouldDisableSleep): Removed unnecessary
1835           check.
1836
1837         * platform/graphics/avfoundation/objc/VideoFullscreenLayerManager.mm:
1838         (WebCore::VideoFullscreenLayerManager::setVideoFullscreenLayer): Removed unnecessary checks.
1839
1840         * platform/graphics/mac/WebGLLayer.mm:
1841         (-[WebGLLayer initWithGraphicsContext3D:]): Ditto.
1842
1843         * platform/mac/PlatformEventFactoryMac.mm:
1844         (WebCore::typeForEvent): Removed check whether NSMenu responds to +menuTypeForEvent: and
1845           all code to handle that case that it doesn’t.
1846
1847         * platform/mac/WebVideoFullscreenController.mm:
1848         (-[WebVideoFullscreenController applicationDidResignActive:]): Removed check whether
1849           NSWindow responds to -isOnActiveSpace.
1850         (-[WebVideoFullscreenController updateMenuAndDockForFullscreen]): Removed check whether
1851           NSApplication responds to -setPresentationOptions:
1852
1853         * platform/mac/WebVideoFullscreenInterfaceMac.mm:
1854         (-[WebVideoFullscreenInterfaceMacObjC updateIsPlaying:newPlaybackRate:]): Removed
1855           unnecessary -respondsToSelector: check.
1856         (-[WebVideoFullscreenInterfaceMacObjC setVideoDimensions:]): Ditto.
1857         (-[WebVideoFullscreenInterfaceMacObjC setUpPIPForVideoView:withFrame:inWindow:]): Ditto.
1858
1859         * platform/spi/cf/CFNetworkSPI.h: Moved declarations of
1860           -[NSURLCache _initWithMemoryCapacity:diskCapacity:relativePath:] and
1861           -[NSURLCache _CFURLCache] to the !USE(APPLE_INTERNAL_SDK) section.
1862
1863         * platform/spi/cocoa/NEFilterSourceSPI.h: Added declaration of NEFilterSource’
1864           sourceAppIdentifier property to the !USE(APPLE_INTERNAL_SDK) section and deleted
1865           unconditional declaration of sourceAppBundleID property, which doesn’t exist.
1866
1867         * platform/spi/cocoa/QuartzCoreSPI.h: Removed redundant declarations.
1868
1869         * platform/spi/ios/DataDetectorsUISPI.h: Moved declarations of DDDetectionController methods
1870           from WebKit2/UIProcess/ios/{WKActionSheetAssistant,WKContentViewInteraction}.mm to here.
1871           Removed an unused declaration.
1872
1873         * platform/spi/mac/LookupSPI.h: Moved redundant declarations into the
1874           !USE(APPLE_INTERNAL_SDK) section.
1875
1876         * platform/spi/mac/NSMenuSPI.h: Changed to import NSMenu_Private.h when using the
1877           Apple internal SDK. Cleaned up the declarations for the other case.
1878
1879         * platform/spi/mac/TUCallSPI.h: Changed to import TUCall_Strings.h when use the Apple
1880           internal SDK.
1881
1882 2017-02-11  Sam Weinig  <sam@webkit.org>
1883
1884         Remove the remaining functions out of JSDOMBinding
1885         https://bugs.webkit.org/show_bug.cgi?id=168179
1886
1887         Reviewed by Darin Adler.
1888
1889         Move utility functions into more appropriate locations.
1890         - Move hasIteratorMethod to runtime/IteratorOperations.h
1891         - Move nonCachingStaticFunctionGetter to runtime/Lookup.h
1892         - Move addImpureProperty to CommonVM
1893
1894         Remove toJS overload that took a Vector<T>. Replace it's usage
1895         with toJS<IDLSequence<T>> usage. To make this work, added two
1896         new types, IDLIDBKeyData and IDLIDBValue.
1897
1898         * Modules/indexeddb/IDBCursor.cpp:
1899         (WebCore::IDBCursor::setGetResult):
1900         * Modules/indexeddb/IDBRequest.cpp:
1901         (WebCore::IDBRequest::setResult):
1902         (WebCore::IDBRequest::setResultToStructuredClone):
1903         Adopt JSDOMConvert infrastructure for conversions using new types.
1904
1905         * bindings/IDLTypes.h:
1906         * bindings/js/JSDOMConvertIndexedDB.h:
1907         (WebCore::JSConverter<IDLIDBKeyData>::convert):
1908         (WebCore::JSConverter<IDLIDBValue>::convert):
1909         Add new types for IDBKeyData and IDBValue.
1910
1911         * bindings/js/CommonVM.cpp:
1912         (WebCore::addImpureProperty):
1913         * bindings/js/CommonVM.h:
1914         Move addImpureProperty here from JSDOMBinding.
1915
1916         * bindings/js/IDBBindingUtilities.cpp:
1917         (WebCore::idbKeyDataToScriptValue): Deleted.
1918         * bindings/js/IDBBindingUtilities.h:
1919         Remove unused idbKeyDataToScriptValue, and group like functions
1920         together.
1921
1922         * bindings/js/JSDOMBinding.cpp: Removed.
1923         * bindings/js/JSDOMBinding.h:
1924         (WebCore::nonCachingStaticFunctionGetter): Deleted.
1925         (WebCore::toJS): Deleted.
1926         Move/remove functions.
1927
1928         * bindings/js/JSDOMConvertUnion.h:
1929         Update for move of hasIteratorMethod to runtime/IteratorOperations.h
1930
1931         * bindings/js/JSDOMWindowCustom.cpp:
1932         * bindings/js/JSHTMLDocumentCustom.cpp:
1933         * bindings/js/JSLocationCustom.cpp:
1934         Update for move of nonCachingStaticFunctionGetter to runtime/Lookup.h
1935
1936         * bindings/js/JSSubtleCryptoCustom.cpp:
1937         Remove unneeded include of runtime/IteratorOperations.h
1938
1939         * bindings/scripts/CodeGeneratorJS.pm:
1940         (GenerateOverloadedFunctionOrConstructor):
1941         Include runtime/IteratorOperations when needing to distinguish a sequence.
1942
1943         * html/HTMLDocument.cpp:
1944         Replace include of JSDOMBinding.h with CommonVM.h for addImpureProperty.
1945
1946 2017-02-12  Carlos Garcia Campos  <cgarcia@igalia.com>
1947
1948         [GTK] Handle caps lock indicator in event modifiers
1949         https://bugs.webkit.org/show_bug.cgi?id=168186
1950
1951         Reviewed by Michael Catanzaro.
1952
1953         Add helper function to check if caps lock is present in the given modifiers. We need this because in GDK
1954         GDK_LOCK_MASK might be either CapsLock or ShiftLock in X11. We use this new method in all platform event
1955         implementations to add the appropriate modifiers.
1956
1957         Fixes: fast/events/special-key-events-in-input-text.html
1958
1959         * platform/PlatformKeyboardEvent.h:
1960         * platform/gtk/PlatformKeyboardEventGtk.cpp:
1961         (WebCore::modifiersForGdkKeyEvent):
1962         (WebCore::PlatformKeyboardEvent::modifiersContainCapsLock):
1963         * platform/gtk/PlatformMouseEventGtk.cpp:
1964         (WebCore::PlatformMouseEvent::PlatformMouseEvent):
1965         * platform/gtk/PlatformWheelEventGtk.cpp:
1966         (WebCore::PlatformWheelEvent::PlatformWheelEvent):
1967
1968 2017-02-11  Sam Weinig  <sam@webkit.org>
1969
1970         Remove custom bindings for XSLTProcessor.idl
1971         https://bugs.webkit.org/show_bug.cgi?id=168174
1972
1973         Reviewed by Andreas Kling.
1974
1975         * CMakeLists.txt:
1976         * WebCore.xcodeproj/project.pbxproj:
1977         * bindings/js/JSBindingsAllInOne.cpp:
1978         * bindings/js/JSXSLTProcessorCustom.cpp: Removed.
1979         Remove file.
1980  
1981         * bindings/js/JSDOMBinding.cpp:
1982         (WebCore::jsStringOrUndefined): Deleted.
1983         * bindings/js/JSDOMBinding.h:
1984         Remove now unused jsStringOrUndefined.
1985
1986         * xml/XSLTProcessor.cpp:
1987         (WebCore::XSLTProcessor::setParameter):
1988         (WebCore::XSLTProcessor::getParameter):
1989         (WebCore::XSLTProcessor::removeParameter):
1990         * xml/XSLTProcessor.idl:
1991         Replace custom bindings bindings with early returns. One subtle difference
1992         between the custom bindings and this, is that getParameter will return 
1993         jsNull() rather than jsUndefined() for null String returns. This matches
1994         all other bindings.
1995
1996 2017-02-11  Olivier Blin  <olivier.blin@softathome.com>
1997
1998         [GStreamer][MSE][EME] Fix decryptor assignment
1999         https://bugs.webkit.org/show_bug.cgi?id=168122
2000
2001         Reviewed by Michael Catanzaro.
2002
2003         The new decryptor is a floating reference so we should not use the
2004         adopt GRefPtr constructor, but use the regular assignment operator
2005         that will sink the object (clear the floating flag).
2006
2007         This fixes assertions in debug build.
2008
2009         See previous pipeline fix in r210851 and WPE commit
2010         06020b18831e1c0eead34e2c1a5a4b7d026c227d.
2011
2012         * platform/graphics/gstreamer/mse/AppendPipeline.cpp:
2013         (WebCore::AppendPipeline::parseDemuxerSrcPadCaps):
2014         Do not use adoptGRef(), it prevented the object from being sunk.
2015
2016 2017-02-11  Simon Fraser  <simon.fraser@apple.com>
2017
2018         Avoid a redundant scroll to 0,0 when navigating back to a url with no fragment
2019         https://bugs.webkit.org/show_bug.cgi?id=168177
2020
2021         Reviewed by Sam Weinig.
2022
2023         FrameView::scrollToFragment() is called from FrameLoader::scrollToFragmentWithParentBoundary()
2024         when navigating within the page. If the URL had no fragment identifier, this code would
2025         call into FrameView::scrollToAnchor() with an empty name, where maintainScrollPositionAtAnchor()
2026         used the document as the anchor, thus scrolling to 0,0. Later, history().restoreScrollPositionAndViewState()
2027         the restores the scroll position from history.
2028         
2029         This scroll to 0,0 happened to be not visible to the page because of scroll event
2030         coalescing, but it makes implementation of history.scrollRestoration harder, so avoid it
2031         by just returning early from FrameView::scrollToFragment() if there is no fragment,
2032         making sure to clear the document's CSSTarget.
2033
2034         * dom/Document.cpp:
2035         (WebCore::Document::setCSSTarget):
2036         * page/FrameView.cpp:
2037         (WebCore::FrameView::scrollToFragment):
2038         (WebCore::FrameView::scrollToAnchor):
2039
2040 2017-02-11  Chris Dumez  <cdumez@apple.com>
2041
2042         Implement URL's toJSON()
2043         https://bugs.webkit.org/show_bug.cgi?id=167979
2044
2045         Reviewed by Sam Weinig.
2046
2047         Implement URL's toJSON() as per:
2048         - https://url.spec.whatwg.org/#dom-url-tojson
2049
2050         This is already supported by Firefox.
2051
2052         Also, drop URLUtils.idl as it is no longer in the specification.
2053         Merge its content to DOMURL.idl as per the URL specification.
2054
2055         Finally, mark href attribute as stringifier and drop the toString()
2056         operation to match the specification. This fixes a bug where our
2057         toString property was not enumerable but should have been.
2058
2059         Tests: fast/url/url-tojson.html
2060                imported/w3c/web-platform-tests/url/url-tojson.html
2061
2062         * CMakeLists.txt:
2063         * DerivedSources.make:
2064         * WebCore.xcodeproj/project.pbxproj:
2065         * html/DOMURL.idl:
2066         * html/URLUtils.h:
2067         (WebCore::URLUtils<T>::toJSON):
2068         * html/URLUtils.idl: Removed.
2069
2070 2017-02-11  Carlos Garcia Campos  <cgarcia@igalia.com>
2071
2072         [GTK][EFL] Implement MIMETypeRegistry::getPreferredExtensionForMIMEType
2073         https://bugs.webkit.org/show_bug.cgi?id=168163
2074
2075         Reviewed by Michael Catanzaro.
2076
2077         It's missing causing several HTML anchor download tests to fail because the suggested filename missed the
2078         extension. This patch moves MIMETypeRegistry::appendFileExtensionIfNecessary() from the cocoa specific file to the
2079         common file because it's not actually platform specific. MIMETypeRegistry::getPreferredExtensionForMIMEType() is
2080         what platforms should implement.
2081
2082         Fixes: fast/dom/HTMLAnchorElement/anchor-download-user-triggered-synthetic-click.html
2083                fast/dom/HTMLAnchorElement/anchor-download.html
2084                fast/dom/HTMLAnchorElement/anchor-file-blob-download-no-extension.html
2085                fast/dom/HTMLAnchorElement/anchor-nodownload-set.html
2086
2087         * platform/MIMETypeRegistry.cpp:
2088         (WebCore::MIMETypeRegistry::appendFileExtensionIfNecessary):
2089         * platform/cocoa/MIMETypeRegistryCocoa.mm:
2090         (WebCore::MIMETypeRegistry::appendFileExtensionIfNecessary): Deleted.
2091         * platform/efl/MIMETypeRegistryEfl.cpp:
2092         (WebCore::MIMETypeRegistry::getPreferredExtensionForMIMEType):
2093         * platform/gtk/MIMETypeRegistryGtk.cpp:
2094         (WebCore::MIMETypeRegistry::getPreferredExtensionForMIMEType):
2095
2096 2017-02-11  Carlos Garcia Campos  <cgarcia@igalia.com>
2097
2098         Unreviewed. Update imageTitle translatable string.
2099
2100         To match mac port. Fixes fast/images/imageDocument-title.html.
2101
2102         * platform/gtk/LocalizedStringsGtk.cpp:
2103         (WebCore::imageTitle):
2104
2105 2017-02-10  John Wilander  <wilander@apple.com>
2106
2107         Updates to Resource Load Statistics: Get the right website data store and introduce timeout for user interaction
2108         https://bugs.webkit.org/show_bug.cgi?id=167474
2109         <rdar://problem/24681808>
2110         <rdar://problem/24703286>
2111         <rdar://problem/30290270>
2112
2113         This patch does the following:
2114         1. Gets the right website data store. API::WebsiteDataStore::defaultDataStore()
2115             does not provide the right data store.
2116         2. Introduces timeout for user interaction. A domain needs interaction every 30
2117             days to stay in that category.
2118         3. Adds grandfathered to the statistics model in preparation for grandfathering of
2119             existing data records.
2120         4. Adds test infrastructure to allow testing of the various rules in place for
2121             data records removal.
2122         5. Fixes various smaller bugs that were found as part of setting up the tests.
2123         6. Regresses the data records removal counting. We need to come up with a thread
2124             safe way of gathering removal statistics from more than one data store now
2125             that we potentially interact with multiple stores.
2126         7. Adds a first set of layout tests for resource load statistics.
2127
2128         Reviewed by Andy Estes.
2129
2130         Tests: http/tests/loading/resourceLoadStatistics/non-prevalent-resource-with-user-interaction.html
2131                http/tests/loading/resourceLoadStatistics/non-prevalent-resource-without-user-interaction.html
2132                http/tests/loading/resourceLoadStatistics/prevalent-resource-with-user-interaction-timeout.html
2133                http/tests/loading/resourceLoadStatistics/prevalent-resource-with-user-interaction.html
2134                http/tests/loading/resourceLoadStatistics/prevalent-resource-without-user-interaction.html
2135
2136         * dom/Document.cpp:
2137         (WebCore::Document::updateLastHandledUserGestureTimestamp):
2138             This now calls ResourceLoadObserver::logUserInteraction() every time since
2139             we want to keep track of the most recent user interaction.
2140         * loader/ResourceLoadObserver.cpp:
2141         (WebCore::ResourceLoadObserver::statisticsStore):
2142             New getter used by WebResourceLoadStatisticsManager::resetToConsistentState().
2143         (WebCore::reduceTimeResolutionToOneDay):
2144             Convenience function.
2145         (WebCore::ResourceLoadObserver::logUserInteractionWithReducedTimeResolution):
2146             Reduces time resolution for privacy reasons.
2147         (WebCore::ResourceLoadObserver::logUserInteraction):
2148         (WebCore::ResourceLoadObserver::clearUserInteraction):
2149         (WebCore::ResourceLoadObserver::hasHadUserInteraction):
2150         (WebCore::ResourceLoadObserver::setPrevalentResource):
2151         (WebCore::ResourceLoadObserver::isPrevalentResource):
2152         (WebCore::ResourceLoadObserver::clearPrevalentResource):
2153         (WebCore::ResourceLoadObserver::setTimeToLiveUserInteraction):
2154         (WebCore::ResourceLoadObserver::fireDataModificationHandler):
2155             New functions that allow WebKitTestRunner to stage exact
2156             statistics, fire the handler, and test the outcome.
2157         * loader/ResourceLoadObserver.h:
2158         * loader/ResourceLoadStatistics.cpp:
2159         (WebCore::ResourceLoadStatistics::encode):
2160         (WebCore::ResourceLoadStatistics::decode):
2161         (WebCore::ResourceLoadStatistics::toString):
2162         (WebCore::ResourceLoadStatistics::merge):
2163             Support for statistics mostRecentUserInteraction, grandfathered, and
2164             dataRecordsRemoved.
2165         * loader/ResourceLoadStatistics.h:
2166         * loader/ResourceLoadStatisticsStore.cpp:
2167         (WebCore::ResourceLoadStatisticsStore::setTimeToLiveUserInteraction):
2168             New function that allows WebKitTestRunner to test 
2169             aging out of user interaction.
2170         (WebCore::ResourceLoadStatisticsStore::hasHadRecentUserInteraction):
2171             Now takes into account the timestamp and ages
2172             out user interaction.
2173         (WebCore::ResourceLoadStatisticsStore::prevalentResourceDomainsWithoutUserInteraction):
2174             Now makes use of ResourceLoadStatisticsStore::hasHadRecentUserInteraction().
2175         * loader/ResourceLoadStatisticsStore.h:
2176
2177 2017-02-10  Sam Weinig  <sam@webkit.org>
2178
2179         [WebIDL] Cleanup XMLHttpRequest's bindings
2180         https://bugs.webkit.org/show_bug.cgi?id=168067
2181
2182         Reviewed by Chris Dumez.
2183
2184         * bindings/js/JSDOMBinding.cpp:
2185         (WebCore::jsOwnedStringOrNull): Deleted.
2186         * bindings/js/JSDOMBinding.h:
2187         Remove jsOwnedStringOrNull and inline it into it's one use
2188         in JSXMLHttpRequestCustom.
2189
2190         * bindings/js/JSXMLHttpRequestCustom.cpp:
2191         (WebCore::JSXMLHttpRequest::responseText):
2192         (WebCore::SendFunctor::SendFunctor): Deleted.
2193         (WebCore::SendFunctor::line): Deleted.
2194         (WebCore::SendFunctor::column): Deleted.
2195         (WebCore::SendFunctor::url): Deleted.
2196         (WebCore::SendFunctor::operator()): Deleted.
2197         (WebCore::JSXMLHttpRequest::send): Deleted.
2198         * xml/XMLHttpRequest.cpp:
2199         (WebCore::XMLHttpRequest::send):
2200         * xml/XMLHttpRequest.h:
2201         Remove custom send, replacing it with a single send implementation that
2202         takes a variant.
2203
2204         * xml/XMLHttpRequest.idl:
2205         Cleanup the IDL to better match the spec. Update correct types where trivial.
2206
2207 2017-02-10  Chris Dumez  <cdumez@apple.com>
2208
2209         document.origin doesn't match spec
2210         https://bugs.webkit.org/show_bug.cgi?id=168022
2211
2212         Reviewed by Sam Weinig.
2213
2214         Update document.origin to return the origin in the expected format:
2215         - https://dom.spec.whatwg.org/#dom-document-origin
2216
2217         Change: "https_webkit.org_0 -> "https://webkit.org".
2218
2219         The new behavior matches Firefox and Chrome.
2220
2221         No new tests, updated existing tests.
2222
2223         * dom/Document.cpp:
2224         (WebCore::Document::origin):
2225
2226 2017-02-10  Daniel Bates  <dabates@apple.com>
2227
2228         Attempt to fix the build following <https://trac.webkit.org/changeset/212173>
2229         (https://bugs.webkit.org/show_bug.cgi?id=166774)
2230
2231         * dom/Document.cpp:
2232         (WebCore::Document::detachFromCachedFrame): Use ASSER_UNUSED() instead of ASSERT() since
2233         the parameter cachedFrame is unused in non-debug build.
2234
2235 2017-02-10  Daniel Bates  <dabates@apple.com>
2236
2237         Detach frame from document when entering page cache
2238         https://bugs.webkit.org/show_bug.cgi?id=166774
2239         <rdar://problem/29904368>
2240
2241         Reviewed by Chris Dumez.
2242
2243         When a page enters the page cache it is unnecessary for it to hold a reference to its
2244         associated frame because subsequent interactions with the page do not need to make use
2245         of it. Once a page exits the page cache we associate it with its frame.
2246
2247         * dom/Document.cpp:
2248         (WebCore::Document::frameDestroyed): Update comment to reflect the renaming of disconnectFromFrame().
2249         (WebCore::Document::attachToCachedFrame): Added.
2250         (WebCore::Document::detachFromCachedFrame): Added.
2251         (WebCore::Document::prepareForDestruction): Only call CSSAnimationController::detachFromDocument() if
2252         we have a frame. Substitute detachFromFrame() for disconnectFromFrame() as the latter was renamed to
2253         the former.
2254         (WebCore::Document::hasEverCalledWindowOpen): Deleted.
2255         (WebCore::Document::markHasCalledWindowOpen): Deleted.
2256         (WebCore::Document::disconnectFromFrame): Renamed to detachFromFrame.
2257         * dom/Document.h:
2258         (WebCore::Document::detachFromFrame): Renamed; formerly named disconnectFromFrame(). Changed
2259         visibility from public to private and made this function inline.
2260         * history/CachedFrame.cpp:
2261         (WebCore::CachedFrameBase::pruneDetachedChildFrames): Remove cached child frames that were
2262         removed from the page when it was in the page cache as there is no need to restore such frames.
2263         (WebCore::CachedFrameBase::restore): Call pruneDetachedChildFrames() before restoring the
2264         frame tree.
2265         (WebCore::CachedFrame::CachedFrame): Detach from the frame.
2266         (WebCore::CachedFrame::open): Assert that we have a document and re-attach the frame.
2267         (WebCore::CachedFrame::destroy): Update assertion as this function should only be called for a
2268         frameless document. Only detach the FrameView, DocumentLoader, and Page when the cached frame is for
2269         subframe and is associated with a Page object. Call CSSAnimationController::detachFromDocument() to
2270         detach the animation controller from the document as it is being destroyed. We have to do this here
2271         because the document does not have a frame. And Document::prepareForDestruction() only calls
2272         CSSAnimationController::detachFromDocument() if the document has a frame.
2273         * history/CachedFrame.h:
2274         * history/PageCache.cpp:
2275         (WebCore::canCachePage): Remove logic that prevents caching of a page that called window.open()
2276         or has an opener as it is feasible to keep such pages in the page cache.
2277         * html/HTMLFrameElementBase.cpp:
2278         (WebCore::HTMLFrameElementBase::finishedInsertingSubtree): Fix style nit.
2279         * loader/FrameLoader.cpp:
2280         (WebCore::FrameLoader::frameDetached): Only stop all loaders and stop active DOM objects if the
2281         page is not in- or about to enter- the page cache. A page in the page cache has finished loading
2282         and its active DOM objects are suspended. Also fix style nit in comment.
2283         (WebCore::FrameLoader::detachFromParent): Only stop all loaders if the page is not in- or about to
2284         enter- the page cache. A page in the page cache has finished loading. Also added a comment to explain
2285         that we protect the frame because stopAllLoaders() can cause the frame to be deallocated.
2286         * page/DOMWindow.cpp:
2287         (WebCore::DOMWindow::createWindow): Remove logic to call markHasCalledWindowOpen() as this
2288         function will be removed.
2289         * page/DiagnosticLoggingKeys.cpp:
2290         (WebCore::DiagnosticLoggingKeys::hasCalledWindowOpenKey): Deleted.
2291         (WebCore::DiagnosticLoggingKeys::hasOpenerKey): Deleted.
2292         * page/DiagnosticLoggingKeys.h:
2293         * page/Page.cpp:
2294         (WebCore::Page::openedByWindowOpen): Deleted.
2295         * page/Page.h:
2296         * page/Settings.in: Remove setting allowsPageCacheWithWindowOpener.
2297
2298 2017-02-10  Simon Fraser  <simon.fraser@apple.com>
2299
2300         REGRESSION (r211845): [ios-simulator] LayoutTest compositing/masks/solid-color-masked.html is a flaky failure
2301         https://bugs.webkit.org/show_bug.cgi?id=168054
2302
2303         Reviewed by Tim Horton.
2304
2305         When adding mask layers, there was an ordering dependency. There was a hack in GraphicsLayerCA::setVisibleAndCoverageRects()
2306         to propagate m_intersectsCoverageRect to masks. However, if GraphicsLayerCA::setVisibleAndCoverageRects()
2307         ran on the masked layer before the mask was added, nothing updated the "m_intersectsCoverageRect" state of the mask layer.
2308
2309         Fix by explicitly calling setVisibleAndCoverageRects() on the mask layer, passing the same rects and
2310         viewport-constrained state as for its host layer (we already assume that their geometry matches).
2311
2312         Tested by compositing/masks/solid-color-masked.html
2313
2314         * platform/graphics/ca/GraphicsLayerCA.cpp:
2315         (WebCore::GraphicsLayerCA::setVisibleAndCoverageRects):
2316         (WebCore::GraphicsLayerCA::recursiveCommitChanges):
2317
2318 2017-02-10  Commit Queue  <commit-queue@webkit.org>
2319
2320         Unreviewed, rolling out r212154, r212154, and r212156.
2321         https://bugs.webkit.org/show_bug.cgi?id=168156
2322
2323         broke internal builds (Requested by smfr on #webkit).
2324
2325         Reverted changesets:
2326
2327         "Add a DragImage class that wraps a DragImageRef"
2328         https://bugs.webkit.org/show_bug.cgi?id=168131
2329         http://trac.webkit.org/changeset/212154
2330
2331         "Add a DragImage class that wraps a DragImageRef"
2332         https://bugs.webkit.org/show_bug.cgi?id=168131
2333         http://trac.webkit.org/changeset/212154
2334
2335         "Try to fix the iOS and Windows builds."
2336         http://trac.webkit.org/changeset/212156
2337
2338 2017-02-10  Csaba Osztrogonác  <ossy@webkit.org>
2339
2340         Fix the !ENABLE(WEBGL) build
2341         https://bugs.webkit.org/show_bug.cgi?id=168112
2342
2343         Reviewed by Alex Christensen.
2344
2345         * html/canvas/WebGLRenderingContextBase.h:
2346
2347 2017-02-10  Youenn Fablet  <youenn@apple.com>
2348
2349         [Fetch API] fetch fails when undefined is passed as headers
2350         https://bugs.webkit.org/show_bug.cgi?id=168043
2351
2352         Reviewed by Geoffrey Garen.
2353
2354         Covered by updated test.
2355
2356         * Modules/fetch/FetchInternals.js:
2357         (fillFetchHeaders): Exit early in case of undefined headers, since it is an optional parameter.
2358
2359 2017-02-10  Csaba Osztrogonác  <ossy@webkit.org>
2360
2361         Fix the !ENABLE(WEB_TIMING) build
2362         https://bugs.webkit.org/show_bug.cgi?id=168113
2363
2364         Reviewed by Alex Christensen.
2365
2366         * workers/WorkerGlobalScope.cpp:
2367         (WebCore::WorkerGlobalScope::WorkerGlobalScope):
2368
2369 2017-02-10  Joseph Pecoraro  <pecoraro@apple.com>
2370
2371         Update features.json for Performance Timing APIs
2372         https://bugs.webkit.org/show_bug.cgi?id=168148
2373
2374         Reviewed by Simon Fraser.
2375
2376         * features.json:
2377
2378 2017-02-10  Anders Carlsson  <andersca@apple.com>
2379
2380         Try to fix the iOS and Windows builds.
2381
2382         * platform/ios/DragImageIOS.mm:
2383         (WebCore::deleteDragImage):
2384         * platform/win/PasteboardWin.cpp:
2385         (WebCore::Pasteboard::setDragImage):
2386
2387 2017-02-10  Anders Carlsson  <andersca@apple.com>
2388
2389         Add a DragImage class that wraps a DragImageRef
2390         https://bugs.webkit.org/show_bug.cgi?id=168131
2391
2392         Reviewed by Beth Dakin.
2393
2394         This allows us to get rid of the explicit deleteDragImage calls and will make additional cleanup of the
2395         various drag code paths possible. No functionality change.
2396
2397         * dom/DataTransfer.cpp:
2398         (WebCore::DataTransfer::updateDragImage):
2399         * page/DragController.cpp:
2400         (WebCore::DragController::startDrag):
2401         (WebCore::DragController::doImageDrag):
2402         (WebCore::DragController::doSystemDrag):
2403         * page/DragController.h:
2404         * platform/DragImage.cpp:
2405         (WebCore::DragImage::DragImage):
2406         (WebCore::DragImage::operator=):
2407         (WebCore::DragImage::~DragImage):
2408         * platform/DragImage.h:
2409         * platform/Pasteboard.h:
2410         * platform/StaticPasteboard.h:
2411         * platform/mac/PasteboardMac.mm:
2412         (WebCore::Pasteboard::setDragImage):
2413
2414 2017-02-10  Simon Fraser  <simon.fraser@apple.com>
2415
2416         Make sure the "inwindow" flag propagates to TiledBackings for masks and reflections
2417         https://bugs.webkit.org/show_bug.cgi?id=168127
2418         rdar://problem/30467120
2419
2420         Reviewed by Tim Horton.
2421         
2422         Replace the special-case, but wrong, GraphicsLayer traversal in setIsInWindowIncludingDescendants()
2423         which forgot to hit masks and replica layers with a generic traverse() function, which
2424         is then used for setting 'inWindow' as well as resetting tracked repaints.
2425
2426         Tests: compositing/tiling/tiled-mask-inwindow.html
2427                compositing/tiling/tiled-reflection-inwindow.html
2428
2429         * page/PageOverlayController.cpp:
2430         (WebCore::PageOverlayController::layerWithDocumentOverlays):
2431         (WebCore::PageOverlayController::layerWithViewOverlays):
2432         * platform/graphics/GraphicsLayer.cpp:
2433         (WebCore::GraphicsLayer::setIsInWindow):
2434         (WebCore::GraphicsLayer::setReplicatedByLayer):
2435         (WebCore::GraphicsLayer::traverse):
2436         (WebCore::GraphicsLayer::setIsInWindowIncludingDescendants): Deleted.
2437         * platform/graphics/GraphicsLayer.h:
2438         * rendering/RenderLayerCompositor.cpp:
2439         (WebCore::RenderLayerCompositor::setIsInWindow):
2440         (WebCore::RenderLayerCompositor::resetTrackedRepaintRects):
2441         (WebCore::resetTrackedRepaintRectsRecursive): Deleted.
2442
2443 2017-02-09  Simon Fraser  <simon.fraser@apple.com>
2444
2445         Tiled layers are sometimes left with some tiles when outside the viewport
2446         https://bugs.webkit.org/show_bug.cgi?id=168104
2447         rdar://problem/30459055
2448
2449         Reviewed by Tim Horton.
2450
2451         When the coverage rect of a TiledBacking goes from a non-empty rect to an empty rect, we
2452         shouldn't just early return from TileGrid::revalidateTiles(), otherwise we are left with some
2453         tiles. Run through the function as normal, which will remove all the tiles for an empty coverage rect.
2454         
2455         Minor logging changes.
2456
2457         Test: tiled-drawing/tile-coverage-iframe-to-zero-coverage.html
2458
2459         * platform/graphics/ca/TileGrid.cpp:
2460         (WebCore::TileGrid::revalidateTiles):
2461
2462 2017-02-10  Zalan Bujtas  <zalan@apple.com>
2463
2464         Mail hangs when removing multiple rows from large table.
2465         https://bugs.webkit.org/show_bug.cgi?id=168103
2466         <rdar://problem/30090186>
2467
2468         Reviewed by Ryosuke Niwa.
2469
2470         DeleteSelectionCommand::removeNode doesn't actually destroy table structure items,
2471         but instead it removes their content. In order to be able to continue editing the table after
2472         the delete, we need to ensure that its cells' width and height are > 0. Currently we issue layout on
2473         each table item recursively.
2474         This patch delays the layout until after we've finished with the entire subtree delete (10x progression).
2475
2476         Performance test added.
2477
2478         * editing/DeleteSelectionCommand.cpp:
2479         (WebCore::DeleteSelectionCommand::insertBlockPlaceholderForTableCellIfNeeded):
2480         (WebCore::DeleteSelectionCommand::removeNodeUpdatingStates):
2481         (WebCore::shouldRemoveContentOnly):
2482         (WebCore::DeleteSelectionCommand::removeNode):
2483         * editing/DeleteSelectionCommand.h:
2484
2485 2017-02-10  Joseph Pecoraro  <pecoraro@apple.com>
2486
2487         [Resource Timing] Enable Resource Timing by default in Tests
2488         https://bugs.webkit.org/show_bug.cgi?id=168145
2489
2490         Reviewed by Ryosuke Niwa.
2491
2492         * loader/ResourceTimingInformation.cpp:
2493         (WebCore::ResourceTimingInformation::addResourceTiming):
2494         * testing/InternalSettings.cpp:
2495         (WebCore::InternalSettings::Backup::Backup):
2496         (WebCore::InternalSettings::Backup::restoreTo):
2497         (WebCore::InternalSettings::setResourceTimingEnabled): Deleted.
2498         * testing/InternalSettings.h:
2499         * testing/InternalSettings.idl:
2500         No longer needed for tests.
2501
2502 2017-02-10  Dan Bernstein  <mitz@apple.com>
2503
2504         [Cocoa] Add shouldChangeSelectedRange to WKWebProcessPlugInEditingDelegate
2505         https://bugs.webkit.org/show_bug.cgi?id=168097
2506
2507         Reviewed by Tim Horton.
2508
2509         Added a userTriggered argument to FrameSelection::setSelectedRange so that WebKit2 can
2510         indicate that changes should be agreed to by the delegate.
2511
2512         * editing/FrameSelection.cpp:
2513         (WebCore::FrameSelection::setSelectedRange): If the change is user-triggered, check with
2514           shouldChangeSelection.
2515         * editing/FrameSelection.h:
2516
2517 2017-02-10  Jonathan Bedard  <jbedard@apple.com>
2518
2519         Removing LayoutTestRelay
2520         https://bugs.webkit.org/show_bug.cgi?id=165927
2521
2522         Reviewed by Daniel Bates.
2523         Part 2
2524
2525         LayoutTestRelay uses SPI, since recent versions of the iOS SDK allow for installing apps on
2526         simulators through simctl (iOS 10 and later), use this functionality instead.
2527
2528         * platform/RuntimeApplicationChecks.mm:
2529         (WebCore::IOSApplication::isDumpRenderTree): Update comment to reflect removal of LayoutTestRelay.
2530
2531 2017-02-10  Youenn Fablet  <youenn@apple.com>
2532
2533         [WebRTC] Implement Outgoing libwebrtc audio source support
2534         https://bugs.webkit.org/show_bug.cgi?id=168118
2535
2536         Reviewed by Eric Carlson.
2537
2538         No new automated tests as we need the audio rendering to work to test the whole loop.
2539
2540         Using an AudioSampleDataSource to convert the captured data to libwebrtc expected format.
2541         Capturing and pushing data happens in the capture thread.
2542         Pulling of converted data happens in libwebrtc thread.
2543
2544         Introducing LibWebRTCAudioFormat.h to centralize libwbebrtc expected audio format.
2545
2546         * WebCore.xcodeproj/project.pbxproj:
2547         * platform/audio/WebAudioBufferList.cpp:
2548         (WebCore::WebAudioBufferList::WebAudioBufferList): Missing initialization leads to assertion failure.
2549         * platform/audio/mac/AudioSampleBufferList.cpp:
2550         (WebCore::AudioSampleBufferList::copyFrom): In case of interleaved channels, there is one buffer but two channels.
2551         * platform/audio/mac/AudioSampleDataSource.cpp:
2552         (WebCore::AudioSampleDataSource::pushSamples):
2553         (WebCore::AudioSampleDataSource::pullAvalaibleSamplesAsChunks):
2554         * platform/audio/mac/AudioSampleDataSource.h:
2555         * platform/mediastream/libwebrtc/LibWebRTCAudioFormat.h: Added.
2556         * platform/mediastream/mac/RealtimeOutgoingAudioSource.cpp:
2557         (WebCore::libwebrtcAudioFormat):
2558         (WebCore::RealtimeOutgoingAudioSource::RealtimeOutgoingAudioSource):
2559         (WebCore::RealtimeOutgoingAudioSource::sourceMutedChanged):
2560         (WebCore::RealtimeOutgoingAudioSource::audioSamplesAvailable):
2561         (WebCore::RealtimeOutgoingAudioSource::pullAudioData):
2562         * platform/mediastream/mac/RealtimeOutgoingAudioSource.h:
2563
2564 2017-02-10  Ryosuke Niwa  <rniwa@webkit.org>
2565
2566         HTMLConstructionSiteTask::Insert should never be called on a node with a parent
2567         https://bugs.webkit.org/show_bug.cgi?id=168099
2568
2569         Reviewed by Sam Weinig.
2570
2571         insertAlreadyParsedChild always use HTMLConstructionSiteTask::InsertAlreadyParsedChild instead
2572         of using HTMLConstructionSiteTask::Insert when fostering a child.
2573
2574         Also combine the step to take all children and re-parenting into a single task instead of
2575         separately issuing TakeAllChildren and Reparent tasks.
2576
2577         No new tests since this is a refactoring.
2578
2579         * html/parser/HTMLConstructionSite.cpp:
2580         (WebCore::insert): Now asserts that the child node never have a parent.
2581         (WebCore::executeInsertAlreadyParsedChildTask): Moved the code to remove the parent here.
2582         (WebCore::executeTakeAllChildrenAndReparentTask): Renamed from executeTakeAllChildrenTask
2583         now that this function also does the reparenting.
2584         (WebCore::executeTask):
2585         (WebCore::HTMLConstructionSite::reparent): Removed the variant only used with takeAllChildren.
2586         (WebCore::HTMLConstructionSite::insertAlreadyParsedChild): Always use InsertAlreadyParsedChild
2587         instead of calling fosterParent which uses Insert when fostering parents.
2588         (WebCore::HTMLConstructionSite::takeAllChildrenAndReparent): Renamed from takeAllChildren.
2589         * html/parser/HTMLConstructionSite.h:
2590         (WebCore::HTMLConstructionSiteTask:Operation):
2591         * html/parser/HTMLTreeBuilder.cpp:
2592         (WebCore::HTMLTreeBuilder::callTheAdoptionAgency):
2593
2594 2017-02-10  Dave Hyatt  <hyatt@apple.com>
2595
2596         [CSS Parser] Make intercap property values serialize correctly
2597         https://bugs.webkit.org/show_bug.cgi?id=168073
2598
2599         Reviewed by Zalan Bujtas.
2600
2601         Fix CSS value keywords to preserve case when the value contains capital
2602         letters. Examples include optimizeSpeed, translateX, scaleY, etc.
2603
2604         * css/CSSPrimitiveValueMappings.h:
2605         (WebCore::CSSPrimitiveValue::CSSPrimitiveValue):
2606         (WebCore::CSSPrimitiveValue::operator EPointerEvents):
2607         (WebCore::CSSPrimitiveValue::operator TextRenderingMode):
2608         (WebCore::CSSPrimitiveValue::operator EImageRendering):
2609         (WebCore::CSSPrimitiveValue::operator EColorInterpolation):
2610         (WebCore::CSSPrimitiveValue::operator EColorRendering):
2611         (WebCore::CSSPrimitiveValue::operator EShapeRendering):
2612         * css/MediaQueryEvaluator.cpp:
2613         (WebCore::colorGamutEvaluate):
2614         * css/SVGCSSValueKeywords.in:
2615         * css/TransformFunctions.cpp:
2616         (WebCore::transformOperationType):
2617         (WebCore::transformsForValue):
2618         * css/makevalues.pl:
2619         * css/parser/CSSParserFastPaths.cpp:
2620         (WebCore::CSSParserFastPaths::isValidKeywordPropertyAndValue):
2621         (WebCore::parseTransformTranslateArguments):
2622         (WebCore::parseSimpleTransformValue):
2623         * css/parser/CSSPropertyParser.cpp:
2624         (WebCore::consumeTransformValue):
2625         * css/parser/CSSPropertyParserHelpers.cpp:
2626         (WebCore::CSSPropertyParserHelpers::parseColorFunctionParameters):
2627
2628 2017-02-10  Zan Dobersek  <zdobersek@igalia.com>
2629
2630         [EME] Implement MediaKeySession::load()
2631         https://bugs.webkit.org/show_bug.cgi?id=168041
2632
2633         Reviewed by Xabier Rodriguez-Calvar.
2634
2635         Implement the MediaKeySession::load() method, tracing the steps as they
2636         are defined in the EME specification. The only exception is step 8.3,
2637         which requires additional facility that tracks currently open sessions
2638         and provides information whether for a given session ID there's already
2639         a MediaKeySession that's not yet been closed.
2640
2641         Session ID sanitization is done through the CDM::sanitizeSessionId()
2642         method, which relays the task to the CDMPrivate implementation.
2643
2644         The CDMInstance::loadSession() virtual method is called with the session
2645         type, sanitized ID, the Document's origin (in string form) and the
2646         callback that's invoked upon completion of the task. The callback
2647         checks whether the operation was successful, or examines the reason for
2648         the load failure in case it wasn't, rejecting the promise in the latter
2649         case either immediately or in the following task at the latest.
2650
2651         When the load was successful, the optional known keys, expiration time
2652         and message are handled appropriately, and the promise is resolved.
2653
2654         MockCDM::sanitizeSessionId() implementation only treats
2655         'valid-loaded-session' as a valid session ID.
2656         MockCDMInstance::loadSession() implementation is kept slim for now, only
2657         providing the 'license-renewal' message when invoking the passed-in
2658         callback. Known keys and expiration time will also be tested once the
2659         relevant MediaKeySession algorithms are implemented.
2660
2661         Test: media/encrypted-media/mock-MediaKeySession-load.html
2662
2663         * Modules/encryptedmedia/CDM.cpp:
2664         (WebCore::CDM::sanitizeSessionId):
2665         * Modules/encryptedmedia/CDM.h:
2666         * Modules/encryptedmedia/CDMInstance.h:
2667         * Modules/encryptedmedia/CDMPrivate.h:
2668         * Modules/encryptedmedia/MediaKeySession.cpp:
2669         (WebCore::MediaKeySession::load):
2670         * testing/MockCDMFactory.cpp:
2671         (WebCore::MockCDM::sanitizeSessionId):
2672         (WebCore::MockCDMInstance::loadSession):
2673         * testing/MockCDMFactory.h:
2674
2675 2017-02-10  Zan Dobersek  <zdobersek@igalia.com>
2676
2677         [EME] Implement MediaKeySession::sessionClosed()
2678         https://bugs.webkit.org/show_bug.cgi?id=168039
2679
2680         Reviewed by Xabier Rodriguez-Calvar.
2681
2682         Implement the 'session closed' algorithm for MediaKeySession by
2683         following the specified steps. After this algorithm is run, the
2684         session should be considered closed, which we track via the m_closed
2685         member variable on the class. This is set to true before the promise
2686         that's accessible through the 'closed' attribute is resolved.
2687
2688         Because the algorithm requires the CDM instance to store any record
2689         of key usage when the session's type is 'persistent-usage-record', the
2690         storeRecordOfKeyUsage() virtual method is added to the CDMInstance
2691         interface. MockCDMInstance implementation is left unimplemented for now.
2692
2693         JSMediaKeySession::closed() accessor now has a custom implementation
2694         that creates a deferred promise for that object if there's none yet, and
2695         shares it with the wrapped class through the registerClosedPromise()
2696         method, storing a reference to the promise in the m_closedPromise
2697         member variable, or resolving the promise immediately if the session was
2698         already closed.
2699
2700         Test cases added to media/encrypted-media/mock-MediaKeySession-close.html.
2701
2702         * Modules/encryptedmedia/CDMInstance.h:
2703         * Modules/encryptedmedia/MediaKeySession.cpp:
2704         (WebCore::MediaKeySession::registerClosedPromise):
2705         (WebCore::MediaKeySession::sessionClosed):
2706         * Modules/encryptedmedia/MediaKeySession.h:
2707         * bindings/js/JSMediaKeySessionCustom.cpp:
2708         (WebCore::JSMediaKeySession::closed):
2709         * testing/MockCDMFactory.cpp:
2710         (WebCore::MockCDMInstance::storeRecordOfKeyUsage):
2711         * testing/MockCDMFactory.h:
2712
2713 2017-02-10  Zan Dobersek  <zdobersek@igalia.com>
2714
2715         [EME] Implement MediaKeySession::updateKeyStatuses(), MediaKeyStatusMap
2716         https://bugs.webkit.org/show_bug.cgi?id=167888
2717
2718         Reviewed by Xabier Rodriguez-Calvar.
2719
2720         Implement MediaKeySession::updateKeyStatuses(), transforming the passed-in
2721         KeyStatusVector into a Vector mapping the key IDs to MediaKeyStatus values.
2722         A keystatuseschange event is fired on the MediaKeySession object afterwards.
2723         The queueing of the task that runs the 'attemp to resume playback' on the
2724         related HTMLMediaElement objects isn't done yet since that algorithm isn't
2725         implemented yet.
2726
2727         The statuses Vector is stored on the MediaKeySession object. That Vector is
2728         then exposed through the MediaKeyStatusMap object, each such object being
2729         unique to one MediaKeySession object. The implementation of MediaKeyStatusMap
2730         thus keeps a reference to the session object as long as that object is alive,
2731         and queries the MediaKeySession::statuses() getter to access the Vector that
2732         contains status information for all the key IDs.
2733
2734         MediaKeyStatusMap::Iterator object keeps a reference to the MediaKeyStatusMap
2735         object and accesses the statuses by indexing into the status Vector of the
2736         related MediaKeySession object.
2737
2738         CDMInstance::updateLicense() now accepts the session ID string as the first
2739         argument, making it possible to specify which session should be updated.
2740
2741         MockCDMFactory::keysForSessionWithID() returns an optional reference to the
2742         Vector value in the session map that lists all the key IDs that are being
2743         stored for that session.
2744
2745         MockCDMInstance::updateLicense() now detects the 'keys-changed' entry in the
2746         passed-in response data, and upon detecting that constructs a KeyStatusVector
2747         object containing all the keys for that session. KeyStatus::Usable is returned
2748         for each object at the moment, but this should be adjustable in the future
2749         through additional parameters passed through the response data. The Vector
2750         object is then passed to the callback and is then passed to the 'update key
2751         statuses' algorithm in MediaKeySession.
2752
2753         Covered by a test case in media/encrypted-media/mock-MediaKeySession-update.html.
2754
2755         * Modules/encryptedmedia/CDMInstance.h:
2756         * Modules/encryptedmedia/MediaKeySession.cpp:
2757         (WebCore::MediaKeySession::MediaKeySession):
2758         (WebCore::MediaKeySession::~MediaKeySession):
2759         (WebCore::MediaKeySession::update):
2760         (WebCore::MediaKeySession::updateKeyStatuses):
2761         * Modules/encryptedmedia/MediaKeySession.h:
2762         * Modules/encryptedmedia/MediaKeyStatusMap.cpp:
2763         (WebCore::MediaKeyStatusMap::MediaKeyStatusMap):
2764         (WebCore::MediaKeyStatusMap::detachSession):
2765         (WebCore::MediaKeyStatusMap::size):
2766         (WebCore::keyIdsMatch):
2767         (WebCore::MediaKeyStatusMap::has):
2768         (WebCore::MediaKeyStatusMap::get):
2769         (WebCore::MediaKeyStatusMap::Iterator::Iterator):
2770         (WebCore::MediaKeyStatusMap::Iterator::next):
2771         * Modules/encryptedmedia/MediaKeyStatusMap.h:
2772         (WebCore::MediaKeyStatusMap::create):
2773         * Modules/encryptedmedia/MediaKeyStatusMap.idl:
2774         * testing/MockCDMFactory.cpp:
2775         (WebCore::MockCDMFactory::keysForSessionWithID):
2776         (WebCore::MockCDMInstance::updateLicense):
2777         * testing/MockCDMFactory.h:
2778
2779 2017-02-09  Simon Fraser  <simon.fraser@apple.com>
2780
2781         Improve IOSurfacePool logging
2782         https://bugs.webkit.org/show_bug.cgi?id=168098
2783
2784         Reviewed by Tim Horton.
2785
2786         Pass a string to DUMP_POOL_STATISTICS so we can tell what's triggering the
2787         logging.
2788
2789         * platform/graphics/cg/IOSurfacePool.cpp:
2790         (WebCore::IOSurfacePool::takeSurface):
2791         (WebCore::IOSurfacePool::addSurface):
2792         (WebCore::IOSurfacePool::evict):
2793         (WebCore::IOSurfacePool::collectionTimerFired):
2794         (WebCore::IOSurfacePool::showPoolStatistics):
2795         * platform/graphics/cg/IOSurfacePool.h:
2796
2797 2017-02-09  Alex Christensen  <achristensen@webkit.org>
2798
2799         Unreviewed, rolling out r212040.
2800
2801         Broke build.  I'm not surprised
2802
2803         Reverted changeset:
2804
2805         "[WebRTC][Mac] Activate libwebrtc"
2806         https://bugs.webkit.org/show_bug.cgi?id=167293
2807         http://trac.webkit.org/changeset/212040
2808
2809 2017-02-09  Chris Dumez  <cdumez@apple.com>
2810
2811         [Mac][WK2] Use MIME type to add file extension to downloads' suggested filenames when missing
2812         https://bugs.webkit.org/show_bug.cgi?id=168077
2813         <rdar://problem/30412595>
2814
2815         Reviewed by Alex Christensen.
2816
2817         Add utility function to MIMETypeRegistry that appends an extension to
2818         a filename if necessary, based on a provided MIME type.
2819
2820         Tests: fast/dom/HTMLAnchorElement/anchor-file-blob-download-no-extension.html
2821                http/tests/download/anchor-download-no-extension.html
2822
2823         * platform/MIMETypeRegistry.cpp:
2824         (WebCore::MIMETypeRegistry::appendFileExtensionIfNecessary):
2825         * platform/MIMETypeRegistry.h:
2826         * platform/cocoa/MIMETypeRegistryCocoa.mm:
2827         (WebCore::MIMETypeRegistry::appendFileExtensionIfNecessary):
2828
2829 2017-02-09  Youenn Fablet  <youenn@apple.com>
2830
2831         [WebRTC][Mac] Activate libwebrtc
2832         https://bugs.webkit.org/show_bug.cgi?id=167293
2833
2834         Reviewed by Alex Christensen.
2835
2836         * Configurations/WebCore.xcconfig:
2837         * Configurations/WebCoreTestSupport.xcconfig:
2838
2839 2017-02-09  Philip Rogers  <pdr@google.com>
2840
2841         SVG clip-path references can clip out later content
2842         https://bugs.webkit.org/show_bug.cgi?id=164181
2843
2844         Reviewed by Said Abou-Hallawa.
2845
2846         RenderSVGResourceClipper can modify the GraphicsContext state (through the path-only
2847         clipping codepath) so we need to ensure RenderLayer::setupClipPath saves the context
2848         and its caller restores it back so later content is not clipped as well.
2849
2850         This patch is based on a chromium patch by fs@opera.com:
2851         https://chromium.googlesource.com/chromium/src/+/b3f7e7d2c4afb3c7e5c7eb438ff5933cbe2109b3
2852
2853         Test: css3/masking/clip-path-reference-restore.html
2854
2855         * rendering/RenderLayer.cpp:
2856         (WebCore::RenderLayer::setupClipPath): Add a GC save and return true to restore. Also switch to downcast instead of static_cast.
2857
2858 2017-02-09  Filip Pizlo  <fpizlo@apple.com>
2859
2860         SharedArrayBuffer does not need to be in the transfer list
2861         https://bugs.webkit.org/show_bug.cgi?id=168079
2862
2863         Reviewed by Geoffrey Garen and Keith Miller.
2864
2865         Tests: workers/sab/multi-memory-multi-buffer.html
2866                workers/sab/multi-memory.html
2867                workers/sab/no-transfer.html
2868                workers/sab/postMessage-clones.html
2869                workers/sab/sent-from-worker-no-transfer.html
2870                workers/sab/sent-from-worker-transfer.html
2871
2872         The SAB API that we originally implemented required that SABs get put in transfer lists
2873         when they are sent to workers.
2874         
2875         The new SAB API that everyone is converging towards requires that you do not put the
2876         SAB in the transfer list. That's supposed to be an error. Instead, anytime that a SAB
2877         is part of any message to or from a dedicated worker then it is automatically shared.
2878         
2879         The new API provides a lot more clarity about what is supposed to happen in contexts
2880         that support transfering but don't support sharing.
2881         
2882         Right now this patch allows both styles to work, but I hope we can disable the transfer
2883         list capability soon.
2884
2885         * bindings/js/IDBBindingUtilities.cpp:
2886         (WebCore::deserializeIDBValueToJSValue):
2887         * bindings/js/JSMessageEventCustom.cpp:
2888         (WebCore::JSMessageEvent::data):
2889         * bindings/js/SerializedScriptValue.cpp:
2890         (WebCore::CloneSerializer::serialize):
2891         (WebCore::CloneSerializer::CloneSerializer):
2892         (WebCore::CloneSerializer::dumpIfTerminal):
2893         (WebCore::CloneDeserializer::deserialize):
2894         (WebCore::CloneDeserializer::CloneDeserializer):
2895         (WebCore::CloneDeserializer::readTerminal):
2896         (WebCore::SerializedScriptValue::SerializedScriptValue):
2897         (WebCore::SerializedScriptValue::create):
2898         (WebCore::SerializedScriptValue::deserialize):
2899         * bindings/js/SerializedScriptValue.h:
2900         (): Deleted.
2901         * dom/CustomEvent.cpp:
2902         (WebCore::CustomEvent::trySerializeDetail):
2903         * dom/ErrorEvent.cpp:
2904         (WebCore::ErrorEvent::trySerializeError):
2905         * dom/MessageEvent.cpp:
2906         (WebCore::MessageEvent::trySerializeData):
2907         * dom/PopStateEvent.cpp:
2908         (WebCore::PopStateEvent::trySerializeState):
2909         * workers/DedicatedWorkerGlobalScope.cpp:
2910         (WebCore::DedicatedWorkerGlobalScope::postMessage):
2911         * workers/Worker.cpp:
2912         (WebCore::Worker::postMessage):
2913
2914 2017-02-09  Brent Fulgham  <bfulgham@apple.com>
2915
2916         Unreviewed build fix after r212025.
2917
2918         inDocument -> isConnected
2919
2920         * html/FormAssociatedElement.cpp:
2921         (WebCore::FormAssociatedElement::didMoveToNewDocument):
2922         (WebCore::FormAssociatedElement::resetFormAttributeTargetObserver):
2923         * html/HTMLFormElement.cpp:
2924         (WebCore::HTMLFormElement::formElementIndex):
2925
2926 2017-02-09  Chris Dumez  <cdumez@apple.com>
2927
2928         Make sure Event keeps its current target element alive
2929         https://bugs.webkit.org/show_bug.cgi?id=167885
2930         <rdar://problem/30376972>
2931
2932         Reviewed by Brent Fulgham.
2933
2934         Make sure Event keeps its current target element alive to avoid
2935         crashes if it is accessed by JS after it has been garbage collected.
2936
2937         Test: fast/events/currentTarget-gc-crash.html
2938
2939         * dom/Event.cpp:
2940         (WebCore::Event::setCurrentTarget):
2941         * dom/Event.h:
2942         (WebCore::Event::currentTarget):
2943
2944 2017-02-09  Ryosuke Niwa  <rniwa@webkit.org>
2945
2946         Crash in render tree after dynamically mutating the slot value
2947         https://bugs.webkit.org/show_bug.cgi?id=167502
2948
2949         Reviewed by Antti Koivisto.
2950
2951         The crash was caused by attributeChanged not destructing the render tree after an assigned element had been
2952         removed from its slot. Since the style resolver can no longer find this element in the flat tree, we need to
2953         delete its render object as if the element had been removed from the DOM tree.
2954
2955         Tests: fast/html/details-summary-slot.html
2956                fast/shadow-dom/shadow-slot-attribute-change-crash.html
2957
2958         * dom/Element.cpp:
2959         (WebCore::Element::attributeChanged):
2960         * html/HTMLSummaryElement.cpp:
2961         (WebCore::SummarySlotElement): Added. Always use the default slot regardless of the slot attribute's value.
2962         (WebCore::HTMLSummaryElement::create): Use SummarySlotElement
2963
2964 2017-02-09  Antti Koivisto  <antti@apple.com>
2965
2966         Details element doesn't work correctly when mutating content between closing and opening
2967         https://bugs.webkit.org/show_bug.cgi?id=167310
2968
2969         Reviewed by Ryosuke Niwa.
2970
2971         Tests: fast/html/details-close-modify-open.html
2972                fast/shadow-dom/slot-remove-mutate-add.html
2973
2974         * dom/SlotAssignment.cpp:
2975         (WebCore::SlotAssignment::didChangeSlot):
2976
2977             Always reset the slot assignment when content is mutated.
2978
2979 2017-02-09  Chris Dumez  <cdumez@apple.com>
2980
2981         Crash under FormSubmission::create()
2982         https://bugs.webkit.org/show_bug.cgi?id=167200
2983         <rdar://problem/30096323>
2984
2985         Reviewed by Darin Adler.
2986
2987         The issue is that FormSubmission::create() was iterating over
2988         form.associatedElements() as was calling Element::appendFormData()
2989         in the loop. HTMLObjectElement::appendFormData() was calling
2990         pluginWidget(PluginLoadingPolicy::Load) which causes a synchronous
2991         layout and can fire events (such as focus event) synchronously.
2992         Firing those events synchronously allows the JS to modify the
2993         form.associatedElements() vector we are currently iterating on.
2994
2995         To avoid this issue, we now call pluginWidget(PluginLoadingPolicy::DoNotLoad)
2996         in HTMLObjectElement::appendFormData() as we are not allowed to fire
2997         synchronous events at this point. I also added a security assertion
2998         in FormSubmission::create() to catch cases where we fire JS events
2999         while iterating over the form associated elements to more easily
3000         notice these things in the future.
3001
3002         Test: fast/forms/formsubmission-appendFormData-crash.html
3003
3004         * html/HTMLObjectElement.cpp:
3005         (WebCore::HTMLObjectElement::appendFormData):
3006         * loader/FormSubmission.cpp:
3007         (WebCore::FormSubmission::create):
3008
3009 2017-02-09  Chris Dumez  <cdumez@apple.com>
3010
3011         Crash under HTMLFormElement::registerFormElement()
3012         https://bugs.webkit.org/show_bug.cgi?id=167162
3013
3014         Reviewed by Ryosuke Niwa.
3015
3016         didMoveToNewDocument() was re-registering FormAttributeTargetObserver
3017         even if the element's inDocument was not set yet. As a result, it was
3018         possible for FormAssociatedElement::resetFormOwner() to be called
3019         when the element was in the tree but with its inDocument still being
3020         false (because insertedInto() has not been called yet). This could
3021         end up calling HTMLFormElement::registerFormElement() even though
3022         the element is still recognized as detached. This is an issue because
3023         HTMLFormElement::m_associatedElements's order and its corresponding
3024         indexes (m_associatedElementsBeforeIndex / m_associatedElementsAfterIndex)
3025         rely on the position of the element with regards to the form element
3026         (before / inside / after).
3027
3028         To address the issue, we now only register the FormAttributeTargetObserver
3029         in didMoveToNewDocument() if the inDocument flag is set to true. This
3030         is similar to what is done at other call sites of
3031         resetFormAttributeTargetObserver(). We also ignore the form content
3032         attribute in HTMLFormElement::formElementIndex() if the element is
3033         not connected.
3034
3035         As per the HTML specification [1], the form content attribute is only
3036         taken if the element is connected (i.e. inDocument flag is true).
3037
3038         Note that FormAssociatedElement::findAssociatedForm() was already
3039         ignoring the form content attribute if the element is disconnected.
3040
3041         [1] https://html.spec.whatwg.org/#reset-the-form-owner (step 3)
3042
3043         Test: fast/forms/registerFormElement-crash.html
3044
3045         * html/FormAssociatedElement.cpp:
3046         (WebCore::FormAssociatedElement::didMoveToNewDocument):
3047         Only call resetFormAttributeTargetObserver() if inDocument flag is set,
3048         similarly to what is done at other call sites.
3049
3050         (WebCore::FormAssociatedElement::resetFormAttributeTargetObserver):
3051         Add an assertion to make sure no one call this method on an element that
3052         is not connected.
3053
3054         * html/HTMLFormElement.cpp:
3055         (WebCore::HTMLFormElement::formElementIndex):
3056         Ignore the form content attribute if the element is not connected, as
3057         per the HTML specification [1].
3058
3059 2017-02-09  Antti Koivisto  <antti@apple.com>
3060
3061         Tear down existing renderers when adding a shadow root.
3062         https://bugs.webkit.org/show_bug.cgi?id=167117
3063
3064         Reviewed by Andreas Kling.
3065
3066         Adding a shadow root may cause children no longer be part of the flat tree. If they had renderers
3067         tear down code would no longer reach them.
3068
3069         Test: fast/shadow-dom/attach-shadow-teardown.html
3070
3071         * dom/Element.cpp:
3072         (WebCore::Element::addShadowRoot):
3073
3074             Tear down existing render tree when adding a shadow root.
3075
3076 2017-02-09  Brent Fulgham  <bfulgham@apple.com>
3077
3078         Handle synchronous layout when setting a selection range
3079         https://bugs.webkit.org/show_bug.cgi?id=167092
3080         <rdar://problem/30041640>
3081
3082         Reviewed by Antti Koivisto.
3083
3084         The 'innerTextElement' of a form control can change during layout due
3085         to arbitrary JavaScript executing. Handle the case where the inner text
3086         element has changed so that current render box height is while setting
3087         a selection range.
3088
3089         Test: fast/forms/input-type-change-during-selection.html
3090
3091         * html/HTMLTextFormControlElement.cpp:
3092         (WebCore::HTMLTextFormControlElement::setSelectionRange):
3093
3094 2017-02-09  Alex Christensen  <achristensen@webkit.org>
3095
3096         Fix CMake build.
3097
3098         * PlatformMac.cmake:
3099
3100 2017-02-09  Brent Fulgham  <bfulgham@apple.com>
3101
3102         Disconnect shadow children of root when detaching a frame
3103         https://bugs.webkit.org/show_bug.cgi?id=166851
3104         <rdar://problem/29930443>
3105
3106         Reviewed by Andy Estes.
3107
3108         If the root of the tree we are disconnecting has a shadow element, include it in the set of
3109         things to disconnect.
3110
3111         Tests: fast/shadow-dom/shadow-at-root-during-disconnect.html
3112
3113         * dom/ContainerNodeAlgorithms.cpp:
3114         (WebCore::disconnectSubframes):
3115
3116 2017-02-09  Alexey Proskuryakov  <ap@apple.com>
3117
3118         Remove unused WebThreadRunSync
3119         https://bugs.webkit.org/show_bug.cgi?id=168024
3120
3121         Reviewed by Tim Horton.
3122
3123         * platform/ios/wak/WebCoreThreadRun.cpp:
3124         * platform/ios/wak/WebCoreThreadRun.h:
3125         * platform/ios/wak/WebCoreThreadSystemInterface.cpp:
3126         (InitWebCoreThreadSystemInterface):
3127
3128 2017-02-09  Ryan Haddad  <ryanhaddad@apple.com>
3129
3130         Unreviewed, rolling out r211802.
3131
3132         This change caused fast/regions/inline-block-inside-anonymous-
3133         overflow-with-covered-controls.html to be a flaky failure.
3134
3135         Reverted changeset:
3136
3137         "[Modern Media Controls] Improve handling of <video> with only
3138         audio tracks"
3139         https://bugs.webkit.org/show_bug.cgi?id=167836
3140         http://trac.webkit.org/changeset/211802
3141
3142 2017-02-09  Alex Christensen  <achristensen@webkit.org>
3143
3144         Fix i386 libwebrtc build
3145         https://bugs.webkit.org/show_bug.cgi?id=168038
3146
3147         * Modules/mediastream/libwebrtc/LibWebRTCDataChannelHandler.h:
3148         DataChannelInterface::buffered_amount returns a uint64_t, and we want a size_t.
3149         If this overflows, then we've run out of memory and crashed a long time ago.
3150
3151 2017-02-09  Andreas Kling  <akling@apple.com>
3152
3153         Document::settings() should return a const Settings&.
3154         <https://webkit.org/b/168061>
3155
3156         Reviewed by Geoffrey Garen.
3157
3158         - Make Document::settings() return a const reference.
3159         - Added Document::mutableSettings() for all your non-const needs.
3160         - Fixed up settings generator to produce const getters.
3161         - Simplify a few settings() call sites that exposed themselves.
3162
3163         * Modules/applepay/ApplePaySession.cpp:
3164         (WebCore::shouldDiscloseApplePayCapability):
3165         * Modules/mediastream/UserMediaRequest.cpp:
3166         (WebCore::canCallGetUserMedia):
3167         * css/CSSFontFace.cpp:
3168         (WebCore::CSSFontFace::appendSources):
3169         * css/CSSFontSelector.cpp:
3170         (WebCore::resolveGenericFamily):
3171         * css/StyleResolver.h:
3172         (WebCore::StyleResolver::settings):
3173         * dom/Document.h:
3174         (WebCore::Document::settings):
3175         (WebCore::Document::mutableSettings):
3176         * html/FTPDirectoryDocument.cpp:
3177         (WebCore::createTemplateDocumentData):
3178         * html/HTMLCanvasElement.cpp:
3179         (WebCore::shouldEnableWebGL):
3180         * html/HTMLEmbedElement.cpp:
3181         (WebCore::HTMLEmbedElement::rendererIsNeeded):
3182         * html/HTMLSelectElement.cpp:
3183         (WebCore::HTMLSelectElement::menuListDefaultEventHandler):
3184         * html/ImageDocument.cpp:
3185         (WebCore::ImageDocument::updateDuringParsing):
3186         * page/csp/ContentSecurityPolicy.cpp:
3187         (WebCore::ContentSecurityPolicy::allowContentSecurityPolicySourceStarToMatchAnyProtocol):
3188         * page/make_settings.pl:
3189         (printGetterAndSetter):
3190         * rendering/SimpleLineLayout.cpp:
3191         (WebCore::SimpleLineLayout::toggleSimpleLineLayout):
3192
3193 2017-02-09  Jer Noble  <jer.noble@apple.com>
3194
3195         Make passing PlatformAudioData in audioSamplesAvaliable const-correct.
3196         https://bugs.webkit.org/show_bug.cgi?id=168051
3197
3198         Reviewed by Eric Carlson.
3199
3200         Modify all the functions which take a (conceptually) read-only audio buffer const-correct.
3201
3202         Drive-by fix: AudioSampleBufferList::copyFrom() set a ivar pointer to the passed in
3203         AudioBufferList. Ensure that the ivar is reset when copyFrom() returns by using a
3204         SetForScope.
3205
3206         * platform/audio/mac/AudioSampleBufferList.cpp:
3207         (WebCore::AudioSampleBufferList::copyFrom):
3208         * platform/audio/mac/AudioSampleBufferList.h:
3209         * platform/audio/mac/AudioSampleDataSource.cpp:
3210         (WebCore::AudioSampleDataSource::pushSamplesInternal):
3211         (WebCore::AudioSampleDataSource::pushSamples):
3212         * platform/audio/mac/AudioSampleDataSource.h:
3213         * platform/mediastream/RealtimeMediaSource.cpp:
3214         (WebCore::RealtimeMediaSource::audioSamplesAvailable):
3215         * platform/mediastream/RealtimeMediaSource.h:
3216         (WebCore::RealtimeMediaSource::Observer::audioSamplesAvailable):
3217         * platform/mediastream/mac/AudioTrackPrivateMediaStreamCocoa.cpp:
3218         (WebCore::AudioTrackPrivateMediaStreamCocoa::audioSamplesAvailable):
3219         * platform/mediastream/mac/AudioTrackPrivateMediaStreamCocoa.h:
3220         * platform/mediastream/mac/RealtimeOutgoingAudioSource.cpp:
3221         (WebCore::RealtimeOutgoingAudioSource::audioSamplesAvailable):
3222         * platform/mediastream/mac/RealtimeOutgoingAudioSource.h:
3223
3224 2017-02-09  Jer Noble  <jer.noble@apple.com>
3225
3226         Fix some logging statements in MediaPlayerPrivateMediaStreamAVFObjC
3227         https://bugs.webkit.org/show_bug.cgi?id=168063
3228
3229         Reviewed by Eric Carlson.
3230
3231         Make the format string match the types passed in (i.e., floats, not strings).
3232
3233         * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.mm:
3234         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::updateSampleTimes):
3235
3236 2017-02-09  Eric Carlson  <eric.carlson@apple.com>
3237
3238         [MediaStream Mac] Handle NULL m_sampleBufferDisplayLayer
3239         https://bugs.webkit.org/show_bug.cgi?id=168060
3240
3241         Reviewed by Jer Noble.
3242
3243         No new tests, this avoids an occasional crash on the bots.
3244
3245         * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.mm:
3246         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::layerStatusDidChange): Don't assume
3247         m_sampleBufferDisplayLayer is valid.
3248
3249 2017-02-09  Chris Dumez  <cdumez@apple.com>
3250
3251         Object.getPrototypeOf(NodeFilter) should be Function.prototype, not Object.prototype
3252         https://bugs.webkit.org/show_bug.cgi?id=167964
3253
3254         Reviewed by Youenn Fablet.
3255
3256         Object.getPrototypeOf(NodeFilter) should be Function.prototype, not Object.prototype
3257         after the following WebIDL spec change:
3258         - https://github.com/heycam/webidl/issues/96
3259
3260         This aligns our behavior with other browsers as the spec has been updated to match
3261         the majority.
3262
3263         No new tests, rebaselined existing test.
3264
3265         * bindings/scripts/CodeGeneratorJS.pm:
3266         (GenerateConstructorHelperMethods):
3267         * bindings/scripts/test/JS/JSTestCallbackInterface.cpp:
3268         (WebCore::JSTestCallbackInterfaceConstructor::prototypeForStructure):
3269
3270 2017-02-09  Miguel Gomez  <magomez@igalia.com>
3271
3272         [GTK] scroll with transparent background not repainted after scrollY >= 32768
3273         https://bugs.webkit.org/show_bug.cgi?id=154283
3274
3275         Reviewed by Carlos Garcia Campos.
3276
3277         Due to a limitation of the pixman backend, which uses 16 bits to hold signed integers, cairo is
3278         not able to draw anything when using transformation matrices with values bigger than 32768. When
3279         drawing patterns into large pages, the matrices values can overflow those 16 bits, so cairo doesn't
3280         draw anything in, which causes the reported transparent backgrounds.
3281
3282         The patch modifies the transformation matrices both from the current context and the pattern we
3283         are painting, to avoid them to hold values that cannot stored in 16 bits.
3284
3285         There's still the possibility that this happens, but it would require using a pattern with a size
3286         bigger than 32768.
3287
3288         Based on a previous patch by Gwang Yoon Hwang  <yoon@igalia.com>.
3289
3290         No new tests.
3291
3292         * platform/graphics/cairo/CairoUtilities.cpp:
3293         (WebCore::drawPatternToCairoContext):
3294
3295 2017-02-09  Brent Fulgham  <bfulgham@apple.com>
3296
3297         Unreviewed build fix after r211965.
3298
3299         * dom/Document.cpp:
3300         (WebCore::Document::adoptNode): inDocument -> isConnected
3301
3302 2017-02-09  Ryosuke Niwa  <rniwa@webkit.org>
3303
3304         Adopting a child node of a script element can run script
3305         https://bugs.webkit.org/show_bug.cgi?id=167318
3306
3307         Reviewed by Darin Adler.
3308
3309         The bug was caused by ScriptElement::childrenChanged indiscriminately running the script.
3310         Do this only if some node has been inserted as spec'ed:
3311
3312         https://html.spec.whatwg.org/multipage/scripting.html#script-processing-model
3313         "The script element is connected and a node or document fragment is inserted into
3314         the script element, after any script elements inserted at that time."
3315
3316         Split NonContentsChildChanged into NonContentsChildInserted and NonContentsChildRemoved to disambiguate
3317         non-contents child such as text and element being removed or inserted. New behavior matches that of
3318         Gecko and Chrome as well as the latest HTML5 specification.
3319
3320         Also deploy NoEventDispatchAssertion in more places. Unfortunately, this results in some DOM trees
3321         internal to WebKit to be mutated while there is NoEventDispatchAssertion in the stack. Added a new RAII
3322         object "EventAllowedScope" to temporarily disable this assertion within such a tree. CachedSVGFont's
3323         ensureCustomFontData used to completely disable this assertion but we no longer have to do this either.
3324
3325         To clarify the new semantics, renamed isEventDispatchForbidden to isEventAllowedInMainThread with
3326         the negated boolean value, and added a new variant isEventDispatchAllowedInSubtree, which checks
3327         isEventDispatchForbidden() is true or if the node was one of an internal DOM node or its descendent
3328         held by EventAllowedScope.
3329
3330         Inspired by https://chromium.googlesource.com/chromium/src/+/604e798ec6ee30f44d57a5c4a44ce3dab3a871ed
3331
3332         Tests: fast/html/script-must-not-run-when-child-is-adopted.html
3333                fast/html/script-must-not-run-when-child-is-removed.html
3334
3335         * dom/CharacterData.cpp:
3336         (WebCore::CharacterData::notifyParentAfterChange): Added NoEventDispatchAssertion.
3337         * dom/ContainerNode.cpp:
3338         (WebCore::ContainerNode::insertBefore): Added NoEventDispatchAssertion around TreeScope's adoptIfNeeded
3339         and insertBeforeCommon as done elsewhere.
3340         (WebCore::ContainerNode::appendChildCommon): Added NoEventDispatchAssertion.
3341         (WebCore::ContainerNode::changeForChildInsertion): Use NonContentsChildInserted here.
3342         (WebCore::ContainerNode::notifyChildRemoved): Added NoEventDispatchAssertion.
3343         (WebCore::ContainerNode::replaceChild): Moved adoptIfNeeded into NoEventDispatchAssertion.
3344         (WebCore::ContainerNode::removeChild): Added NoEventDispatchAssertion.
3345         (WebCore::ContainerNode::parserRemoveChild): Added NoEventDispatchAssertion.
3346         (WebCore::ContainerNode::removeChildren): Call childrenChanged in NoEventDispatchAssertion.
3347         (WebCore::ContainerNode::appendChildWithoutPreInsertionValidityCheck): Moved adoptIfNeeded into
3348         NoEventDispatchAssertion.
3349         (WebCore::dispatchChildInsertionEvents): Check the forbidden-ness more precisely.
3350         (WebCore::dispatchChildRemovalEvents): Ditto.
3351         * dom/ContainerNode.h:
3352         (WebCore::ContainerNode::ChildChange::isInsertion): Added.
3353         * dom/ContainerNodeAlgorithms.cpp:
3354         (WebCore::notifyChildNodeInserted): Check the forbidden-ness more precisely. Here, we check against
3355         insertionPoint since EventAllowedScope checks against the root node.
3356         * dom/Document.cpp:
3357         (WebCore::Document::adoptNode): Assert the node to be adopted has not been inserted back, or else
3358         remove() had resulted in an exception before calling TreeScope::adoptIfNeeded.
3359         * dom/Element.cpp:
3360         (WebCore::Element::childrenChanged):
3361         * dom/NoEventDispatchAssertion.h:
3362         (WebCore::NoEventDispatchAssertion::isEventDispatchForbidden): Added a new variant that takes a node.
3363         If this node is a descendent of a node "marked as safe" by EventAllowedScope, then we don't consider
3364         the event dispatch to be forbidden.
3365         (WebCore::NoEventDispatchAssertion::dropTemporarily): Deleted.
3366         (WebCore::NoEventDispatchAssertion::restoreDropped): Deleted.
3367         (WebCore::NoEventDispatchAssertion::EventAllowedScope): Added. A RAII object which marks descendants of
3368         a given node as "safe" for the purpose of checking isEventDispatchForbidden.
3369         (WebCore::NoEventDispatchAssertion::EventAllowedScope::EventAllowedScope): Added. There can be a chain
3370         of EventAllowedScope objects in the stack. s_currentScope points to the most recently instantiated
3371         RAII object, and each instance remembers prior instance. 
3372         (WebCore::NoEventDispatchAssertion::EventAllowedScope::~EventAllowedScope): Added.
3373         (WebCore::NoEventDispatchAssertion::EventAllowedScope::isAllowedNode): Added. Returns true if the given
3374         node is a descendent of any node held by instances of EventAllowedScope.
3375         (WebCore::NoEventDispatchAssertion::EventAllowedScope::isAllowedNodeInternal): Added. A helper function
3376         for isAllowedNode.
3377         * dom/Node.cpp:
3378         (WebCore::Node::dispatchSubtreeModifiedEvent): Check the forbidden-ness more precisely.
3379         * dom/ScriptElement.cpp:
3380         (WebCore::ScriptElement::childrenChanged): Only prepare the script if we've inserted nodes.
3381         (WebCore::ScriptElement::executeClassicScript): Assert isEventDispatchForbidden is false since running
3382         arbitrary author scripts can, indeed, result dispatch any events.
3383         * dom/ScriptElement.h:
3384         * html/HTMLElement.cpp:
3385         (WebCore::textToFragment): Made this a static local function and not return an exception since there
3386         is no way appendChild called in this function can throw an exception.
3387         (WebCore::HTMLElement::setInnerText): Create EventAllowedScope for the fragment. It's called called by
3388         HTMLTextAreaElement's childrenChanged to update its UA shadow tree, and it's dispatching as event on
3389         a new fragment can't execute arbitrary scripts since it has never been exposed to author scripts.
3390         Because of the precise-ness of this check, this does not disable the assertion for "this" element.
3391         HTMLTextFormControlElement::setInnerTextValue explicitly creates another EventAllowedScope to mark
3392         the shadow tree into which the fragment is inserted safe.
3393         (WebCore::HTMLElement::setOuterText):
3394         * html/HTMLElement.h:
3395         * html/HTMLScriptElement.cpp:
3396         (WebCore::HTMLScriptElement::childrenChanged):
3397         * html/HTMLTextFormControlElement.cpp:
3398         (WebCore::HTMLTextFormControlElement::setInnerTextValue): See above (setInnerText).
3399         * html/track/VTTCue.cpp:
3400         (WebCore::VTTCue::createCueRenderingTree): Create EventAllowedScope for the cloned fragment here since
3401         the VTT tree is never exposed to author scripts.
3402         (WebCore::VTTCue::updateDisplayTree): Ditto.
3403         * loader/cache/CachedSVGFont.cpp:
3404         (WebCore::CachedSVGFont::ensureCustomFontData): Use EventAllowedScope to disable assertions only on
3405         the new SVG document we just created instead of disabling for all DOM trees.
3406         * svg/SVGScriptElement.cpp:
3407         (WebCore::SVGScriptElement::childrenChanged):
3408
3409 2017-02-09  Andreas Kling  <akling@apple.com>
3410
3411         Document should always have a Settings.
3412         <https://webkit.org/b/120172>
3413
3414         Reviewed by Antti Koivisto.
3415
3416         Since a Document can't move between Frames, and it's either frameless
3417         or partnered with a Frame provided at construction time, we know that
3418         it will never need to switch between different Settings objects either.
3419
3420         Give Document a Ref<Settings> that contains either the Frame's Settings
3421         or a default-constructed Settings object if frameless.
3422         Document::settings() is promoted to a reference getter.
3423
3424         The bulk of this patch is removing now-unnecessary null checks.
3425
3426         * Modules/encryptedmedia/legacy/WebKitMediaKeySession.cpp:
3427         (WebCore::WebKitMediaKeySession::mediaKeysStorageDirectory):
3428         * Modules/plugins/PluginReplacement.h:
3429         (WebCore::ReplacementPlugin::isEnabledBySettings):
3430         * Modules/plugins/QuickTimePluginReplacement.h:
3431         * Modules/plugins/QuickTimePluginReplacement.mm:
3432         (WebCore::QuickTimePluginReplacement::isEnabledBySettings):
3433         * Modules/plugins/YouTubePluginReplacement.cpp:
3434         (WebCore::YouTubePluginReplacement::isEnabledBySettings):
3435         * Modules/plugins/YouTubePluginReplacement.h:
3436         * Modules/webaudio/AudioContext.cpp:
3437         (WebCore::AudioContext::constructCommon):
3438         * bindings/js/CachedScriptFetcher.cpp:
3439         (WebCore::CachedScriptFetcher::requestScriptWithCache):
3440         * css/CSSFontFace.cpp:
3441         (WebCore::CSSFontFace::appendSources):
3442         (WebCore::CSSFontFace::webFontsSho