fc66240c67d4b4a38760c535cf62da3080605550
[WebKit-https.git] / Source / WebCore / ChangeLog
1 2017-02-20  Carlos Garcia Campos  <cgarcia@igalia.com>
2
3         REGRESSION(r212345): [GTK] ASSERT(cookieChangeCallbackMap().contains(jar)) failed in WebCore::stopObservingCookieChanges:54
4         https://bugs.webkit.org/show_bug.cgi?id=168375
5
6         Reviewed by Alex Christensen.
7
8         Simplify the way cookie storage is handled in NetworkStorageSessionSoup. Now we always keep a reference to the
9         cookie jar, no matter if we have a session or not, that is always kept in sync with the one actually used by the
10         session. We always connect to the changed signal of the current cookie jar and notify the observer if it has been
11         set.
12
13         * platform/network/NetworkStorageSession.h:
14         * platform/network/soup/CookieStorageSoup.cpp:
15         (WebCore::startObservingCookieChanges): Remove this implementation and add an ASSERT to ensure we don't use this anymore.
16         (WebCore::stopObservingCookieChanges): Ditto.
17         (WebCore::cookieChangeCallbackMap): Deleted.
18         (WebCore::soupCookiesChanged): Deleted.
19         * platform/network/soup/NetworkStorageSessionSoup.cpp:
20         (WebCore::NetworkStorageSession::NetworkStorageSession): Initialize the cookie storage.
21         (WebCore::NetworkStorageSession::~NetworkStorageSession): Disconnect the changed signal.
22         (WebCore::NetworkStorageSession::getOrCreateSoupNetworkSession): Always pass the current cookie storage.
23         (WebCore::NetworkStorageSession::cookiesDidChange): Notify the observer.
24         (WebCore::NetworkStorageSession::cookieStorage): Return the current cookie storage.
25         (WebCore::NetworkStorageSession::setCookieStorage): Update the current cookie storage and update the session if
26         needed too. We always have a valid cookie storage so if nullptr is given we create a new one.
27         (WebCore::NetworkStorageSession::setCookieObserverHandler): Set a cookie observer handler.
28
29 2017-02-19  Chris Dumez  <cdumez@apple.com>
30
31         onbeforeunload event return value coercion is not per-spec
32         https://bugs.webkit.org/show_bug.cgi?id=168382
33
34         Reviewed by Darin Adler.
35
36         Update handling of value returned by onbeforeunload event listeners
37         to match Firefox and the specification:
38         - https://html.spec.whatwg.org/#the-event-handler-processing-algorithm (step 4)
39
40         Namely, the following changes were made:
41         - Only set the event's returnValue attribute to the returned value if the attribute
42           value is the empty string (so as to not override the attribute value if it has
43           explicitly been set by JS).
44         - Cancel the event when the return value is not null by calling preventDefault().
45
46         Additionally, the following changes were made:
47         - Ask the user to confirm the navigation if the event was canceled, not just if the
48           returnValue attribute was set to a non-empty string.
49         as per:
50         - https://html.spec.whatwg.org/#prompt-to-unload-a-document (step 8)
51
52         Tests: fast/events/before-unload-return-string-conversion.html
53                imported/w3c/web-platform-tests/html/browsers/browsing-the-web/unloading-documents/beforeunload-canceling.html
54
55         * bindings/js/JSEventListener.cpp:
56         (WebCore::handleBeforeUnloadEventReturnValue):
57         (WebCore::JSEventListener::handleEvent):
58         * loader/FrameLoader.cpp:
59         (WebCore::shouldAskForNavigationConfirmation):
60         (WebCore::FrameLoader::dispatchBeforeUnloadEvent):
61
62 2017-02-19  Carlos Garcia Campos  <cgarcia@igalia.com>
63
64         [SOUP] Call SoupNetworkSession::setShouldIgnoreTLSErrors when testRunner.setAllowsAnySSLCertificate() is called
65         https://bugs.webkit.org/show_bug.cgi?id=168571
66
67         Reviewed by Michael Catanzaro.
68
69         Fixes: http/tests/ssl/upgrade-origin-usage.html
70
71         * testing/InternalSettings.cpp:
72         (WebCore::InternalSettings::setAllowsAnySSLCertificate):
73
74 2017-02-18  Ryosuke Niwa  <rniwa@webkit.org>
75
76         REGRESSION(r212218): Assertion failures in and after parserRemoveChild
77         https://bugs.webkit.org/show_bug.cgi?id=168458
78
79         Reviewed by Antti Koivisto.
80
81         The bug was caused by parserRemoveChild not preceeding to remove oldChild even when
82         oldChild had been inserted elsewhere during unload evnets of the disconnected frames.
83         Fixed the bug by checking this condition and exiting early.
84
85         Also fixed various callers of parserRemoveChild to not call parserAppendChild when
86         the removed node had already been inserted elsewhere by scripts.
87
88         Tests: fast/parser/adoption-agency-unload-iframe-3.html
89                fast/parser/adoption-agency-unload-iframe-4.html
90                fast/parser/xml-error-unload-iframe.html
91
92         * dom/ContainerNode.cpp:
93         (WebCore::ContainerNode::parserRemoveChild): Exit early when the node had been
94         inserted elsewhere while firing unload events. Also moved the call to
95         notifyRemovePendingSheetIfNeeded outside NoEventDispatchAssertion since it can
96         synchrnously fire a focus event.
97         (WebCore::ContainerNode::parserAppendChild): Moved adoptNode call to inside
98         NoEventDispatchAssertion since adoptNode call here should never mutate DOM.
99         * html/parser/HTMLConstructionSite.cpp:
100         (WebCore::executeReparentTask): Added an early exit when the node had already been
101         inserted elsewhere.
102         (WebCore::executeInsertAlreadyParsedChildTask): Ditto.
103         * xml/XMLErrors.cpp:
104         (WebCore::XMLErrors::insertErrorMessageBlock): Ditto.
105         * xml/parser/XMLDocumentParser.cpp:
106         (WebCore::XMLDocumentParser::end): Fixed a crash unveiled by one of the test cases.
107         Exit early when insertErrorMessageBlock detached the parser (by author scripts).
108         (WebCore::XMLDocumentParser::finish): Keep the parser alive until we exit.
109
110 2017-02-19  Chris Dumez  <cdumez@apple.com>
111
112         <input type=color readonly> doesn't act per spec
113         https://bugs.webkit.org/show_bug.cgi?id=168421
114         <rdar://problem/30593185>
115
116         Reviewed by Ryosuke Niwa.
117
118         The 'readonly' attribute should not apply to <input type=color> as per the
119         HTML specification:
120         - https://html.spec.whatwg.org/#the-input-element:attr-input-readonly-3
121
122         Chrome / Firefox and Edge already behave as per the specification.
123
124         Tests: fast/forms/color/input-color-disabled.html
125                fast/forms/color/input-color-readonly.html
126
127         * html/ColorInputType.cpp:
128         (WebCore::ColorInputType::handleDOMActivateEvent):
129         (WebCore::ColorInputType::didChooseColor):
130
131 2017-02-19  Commit Queue  <commit-queue@webkit.org>
132
133         Unreviewed, rolling out r212466.
134         https://bugs.webkit.org/show_bug.cgi?id=168577
135
136         causes crashes on AArch64 on linux, maybe it's causing crashes
137         on iOS too (Requested by pizlo on #webkit).
138
139         Reverted changeset:
140
141         "The collector thread should only start when the mutator
142         doesn't have heap access"
143         https://bugs.webkit.org/show_bug.cgi?id=167737
144         http://trac.webkit.org/changeset/212466
145
146 2017-02-19  Zalan Bujtas  <zalan@apple.com>
147
148         Simple line layout: Implement positionForPoint.
149         https://bugs.webkit.org/show_bug.cgi?id=168565
150         <rdar://problem/30593370>
151
152         Reviewed by Antti Koivisto.
153
154         With this patch, now we don't need to switch over to line box tree anymore when positionForPoint()
155         is called on a single RenderText content (which is the majority of the simple line content).
156         This patch also adds a new positionForPoint method which returns a Position object instead of VisiblePosition.
157         Some of the positionForPoint() callsites are only interested in the Position object so constructing a VisiblePosition
158         (which could potentially kick off a layout) is a waste. At this point the non-simple line layout codepath still constructs
159         a VisiblePosition and that should be addresses as part of webkit.org/b/168566.
160
161         Covered by existing tests.
162
163         * dom/Document.cpp:
164         (WebCore::Document::caretRangeFromPoint):
165         * rendering/RenderBlockFlow.cpp:
166         (WebCore::RenderBlockFlow::positionForPoint):
167         * rendering/RenderBlockFlow.h:
168         * rendering/RenderObject.cpp:
169         (WebCore::RenderObject::positionForPoint):
170         * rendering/RenderObject.h:
171         * rendering/RenderText.cpp:
172         (WebCore::RenderText::positionForPoint):
173         * rendering/RenderText.h:
174         * rendering/SimpleLineLayoutFunctions.cpp:
175         (WebCore::SimpleLineLayout::positionForPoint):
176         * rendering/SimpleLineLayoutFunctions.h:
177         * rendering/SimpleLineLayoutResolver.cpp:
178         (WebCore::SimpleLineLayout::RunResolver::runForPoint):
179         * rendering/SimpleLineLayoutResolver.h:
180         (WebCore::SimpleLineLayout::RunResolver::Run::logicalLeft):
181         (WebCore::SimpleLineLayout::RunResolver::Run::logicalRight):
182
183 2017-02-19  Antti Koivisto  <antti@apple.com>
184
185         Execute pending scripts asynchronously after stylesheet loads complete
186         https://bugs.webkit.org/show_bug.cgi?id=168367
187         rdar://problem/30561379
188
189         Reviewed by Andreas Kling.
190
191         The current synchronous execution is fragile and creates various problems.
192
193         * css/StyleSheetContents.cpp:
194         (WebCore::StyleSheetContents::checkLoaded):
195         * dom/ContainerNode.cpp:
196         (WebCore::ContainerNode::takeAllChildrenFrom):
197         (WebCore::ContainerNode::notifyChildInserted):
198         (WebCore::ContainerNode::removeChild):
199         (WebCore::ContainerNode::parserRemoveChild):
200         (WebCore::ContainerNode::removeChildren):
201
202             Remove various places where we would trigger delayed synchronous execution.
203
204         * dom/Document.cpp:
205         (WebCore::Document::Document):
206         (WebCore::Document::recalcStyle):
207
208             Trigger scroll to anchor at the end of style resolution instead of when style sheet load completes.
209
210         (WebCore::Document::didRemoveAllPendingStylesheet):
211
212             Call asynchronous script execution function.
213
214         * dom/Document.h:
215         (WebCore::Document::setNeedsNotifyRemoveAllPendingStylesheet): Deleted.
216         (WebCore::Document::notifyRemovePendingSheetIfNeeded): Deleted.
217         * dom/ScriptableDocumentParser.cpp:
218         (WebCore::ScriptableDocumentParser::ScriptableDocumentParser):
219         (WebCore::ScriptableDocumentParser::executeScriptsWaitingForStylesheetsSoon):
220         (WebCore::ScriptableDocumentParser::scriptsWaitingForStylesheetsExecutionTimerFired):
221
222             Add a timer for executing pending scripts.
223
224         (WebCore::ScriptableDocumentParser::detach):
225         * dom/ScriptableDocumentParser.h:
226         (WebCore::ScriptableDocumentParser::executeScriptsWaitingForStylesheets):
227         * html/HTMLLinkElement.cpp:
228         (WebCore::HTMLLinkElement::removedFrom):
229         (WebCore::HTMLLinkElement::removePendingSheet):
230         * html/HTMLLinkElement.h:
231         * html/parser/HTMLDocumentParser.cpp:
232         (WebCore::HTMLDocumentParser::detach):
233         * loader/DocumentLoader.cpp:
234         (WebCore::DocumentLoader::isLoadingInAPISense):
235
236             Stay in loading state if we have a pending script. This matches existing behavior.
237
238         * style/StyleScope.cpp:
239         (WebCore::Style::Scope::removePendingSheet):
240         * style/StyleScope.h:
241
242 2017-02-18  Chris Dumez  <cdumez@apple.com>
243
244         <input type=range readonly> doesn't act per spec
245         https://bugs.webkit.org/show_bug.cgi?id=168422
246         <rdar://problem/30593189>
247
248         Reviewed by Ryosuke Niwa.
249
250         'readonly' attribute should not apply to <input type=range> as per the HTML
251         specification:
252         - https://html.spec.whatwg.org/#the-input-element:attr-input-readonly-3
253
254         Firefox and Edge already behave as per the specification.
255
256         No new tests, updated existing tests.
257
258         * html/RangeInputType.cpp:
259         (WebCore::RangeInputType::handleMouseDownEvent):
260         (WebCore::RangeInputType::handleTouchEvent):
261         (WebCore::RangeInputType::handleKeydownEvent):
262         * html/shadow/SliderThumbElement.cpp:
263         (WebCore::SliderThumbElement::defaultEventHandler):
264         (WebCore::SliderThumbElement::willRespondToMouseMoveEvents):
265         (WebCore::SliderThumbElement::willRespondToMouseClickEvents):
266
267 2017-02-18  Chris Dumez  <cdumez@apple.com>
268
269         Recursive MessagePort.postMessage() calls causes tab to become unresponsive
270         https://bugs.webkit.org/show_bug.cgi?id=168548
271         <rdar://problem/29808005>
272
273         Reviewed by Darin Adler.
274
275         MessagePort::dispatchMessages() was getting messages one by one of the
276         channel's MessageQueue and firing the MessageEvent for each of them.
277         The issue is that we can get stuck in an infinite loop if the
278         MessageEvent handler posts a message on the same post.
279
280         To address the issue, we now takes all messages from the queue before
281         iterating over them to fire the event. This way, if new messages are
282         added to the queue in one of the MessageEvent handlers, they will not
283         be processed until the next event loop iteration, as is expected.
284
285         Test: fast/events/message-port-postMessage-recursive.html
286
287         * dom/MessagePort.cpp:
288         (WebCore::MessagePort::dispatchMessages):
289         * dom/MessagePortChannel.h:
290         (WebCore::MessagePortChannel::EventData::EventData):
291         * dom/default/PlatformMessagePortChannel.cpp:
292         (WebCore::MessagePortChannel::postMessageToRemote):
293         * dom/default/PlatformMessagePortChannel.h:
294         (WebCore::PlatformMessagePortChannel::MessagePortQueue::takeMessage):
295         (WebCore::PlatformMessagePortChannel::MessagePortQueue::takeAllMessages):
296         (WebCore::PlatformMessagePortChannel::MessagePortQueue::appendAndCheckEmpty):
297
298 2017-02-18  Michael Catanzaro  <mcatanzaro@igalia.com>
299
300         Remove COORDINATED_GRAPHICS_MULTIPROCESS
301         https://bugs.webkit.org/show_bug.cgi?id=168514
302
303         Reviewed by Darin Adler.
304
305         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp:
306         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.h:
307
308 2017-02-17  Simon Fraser  <simon.fraser@apple.com>
309
310         Allow properties in CSSProperties.json that don't trigger code generation
311         https://bugs.webkit.org/show_bug.cgi?id=168535
312
313         Reviewed by Sam Weinig.
314         
315         In order to track the development of CSS properties that we have not yet implemented,
316         support '"skip-codegen" : true' in "codegen-properties".
317
318         Test by adding a few fill-related properties with this attribute.
319
320         * css/CSSProperties.json:
321         * css/makeprop.pl:
322         (isPropertyEnabled):
323         (addProperty):
324
325 2017-02-17  Brian Burg  <bburg@apple.com>
326
327         Web Inspector: RTL: Inspector window should dock to the left when using RTL layout direction
328         https://bugs.webkit.org/show_bug.cgi?id=168273
329         <rdar://problem/29949325>
330
331         Reviewed by Matt Baker.
332
333         Add the ability to dock Web Inspector to the left of the inspected view.
334         The frontend decides whether the Dock to Side button docks left or right
335         based on the current layout direction.
336
337         * inspector/InspectorFrontendClient.h:
338         * inspector/InspectorFrontendClientLocal.cpp:
339         (WebCore::InspectorFrontendClientLocal::setAttachedWindow):
340         * inspector/InspectorFrontendHost.cpp:
341         (WebCore::InspectorFrontendHost::requestSetDockSide):
342
343 2017-02-16  Simon Fraser  <simon.fraser@apple.com>
344
345         Allow PlatformCALayers to specify that they want deep color backing store
346         https://bugs.webkit.org/show_bug.cgi?id=168495
347
348         Reviewed by Tim Horton.
349         
350         Currently capable iOS devices get deep color backing store by virtue of a supports
351         check in PlatformCALayerCocoa::PlatformCALayerCocoa(), and LegacyTileGridTile.
352
353         Future work will make layer contents format selection more complex, so express the need
354         for deep color on PlatformCALayer, and have the creators of PlatformCALayer (mainly the
355         flavors of GraphicsLayerCA) choose for them to support deep color. A bit of special-casing
356         is needed to propagte the state to TileControllers.
357         
358         The deep-colorness now propagates from PlatformCALayerRemote to RemoteLayerBackingStore,
359         instead of RemoteLayerBackingStore looking at the properties of the screen directly.
360
361         Remove PlatformCALayer::LayerTypeWebTiledLayer which was only used for the old CATiledLayers
362         that we no longer use.
363
364         An iphone7 test verifies that page tiles, normal layers and tiled layers get the deep
365         color state set on them.
366
367         Test: tiled-drawing/ios/iphone7/compositing-layers-deep-color.html
368
369         * platform/graphics/ca/GraphicsLayerCA.cpp:
370         (WebCore::GraphicsLayerCA::createPlatformCALayer):
371         (WebCore::GraphicsLayerCA::dumpAdditionalProperties):
372         * platform/graphics/ca/GraphicsLayerCA.h:
373         * platform/graphics/ca/PlatformCALayer.cpp:
374         (WebCore::PlatformCALayer::canHaveBackingStore):
375         (WebCore::operator<<):
376         * platform/graphics/ca/PlatformCALayer.h:
377         * platform/graphics/ca/TileController.cpp:
378         (WebCore::TileController::setZoomedOutContentsScale):
379         (WebCore::TileController::setAcceleratesDrawing):
380         (WebCore::TileController::setWantsDeepColorBackingStore):
381         (WebCore::TileController::createTileLayer):
382         * platform/graphics/ca/TileController.h:
383         * platform/graphics/ca/TileGrid.cpp:
384         (WebCore::TileGrid::updateTileLayerProperties):
385         * platform/graphics/ca/cocoa/PlatformCALayerCocoa.h:
386         * platform/graphics/ca/cocoa/PlatformCALayerCocoa.mm:
387         (PlatformCALayerCocoa::PlatformCALayerCocoa):
388         (PlatformCALayerCocoa::commonInit):
389         (PlatformCALayerCocoa::wantsDeepColorBackingStore):
390         (PlatformCALayerCocoa::setWantsDeepColorBackingStore):
391         (layerContentsFormat):
392         (PlatformCALayerCocoa::updateContentsFormat):
393         * platform/graphics/ca/cocoa/WebTiledBackingLayer.h:
394         * platform/graphics/ca/cocoa/WebTiledBackingLayer.mm:
395         (-[WebTiledBackingLayer setWantsDeepColorBackingStore:]):
396         (-[WebTiledBackingLayer wantsDeepColorBackingStore]):
397         * platform/graphics/ca/win/PlatformCALayerWin.cpp:
398         (PlatformCALayerWin::wantsDeepColorBackingStore):
399         (PlatformCALayerWin::setWantsDeepColorBackingStore):
400         (printLayer):
401         * platform/graphics/ca/win/PlatformCALayerWin.h:
402         * platform/spi/cocoa/QuartzCoreSPI.h:
403
404 2017-02-17  Jer Noble  <jer.noble@apple.com>
405
406         Refactoring: Make sure to unprepare WebAudioSourceProviderAVFObjC when its owner is destroyed.
407         https://bugs.webkit.org/show_bug.cgi?id=168532
408
409         Reviewed by Youenn Fablet.
410
411         Because WebAudioSourceProviderAVFObjC has a back-pointer to the object which creted it, make
412         sure that back-pointer is invalidated once the creating object is destroyed by calling
413         WebAudioSOurceProviderAVFObjC::unprepare().
414
415         Drive-by Fix: In WebAudioSourceProviderAVFObjC::audioSamplesAvailable(), PlatformAudioData will
416         always be of the WebAudioBufferList type. If this ever becomes untrue, an invalid downcast will
417         be caught by downcast<>, so just remove the is<> check.
418
419         * platform/mediastream/mac/AVAudioCaptureSource.mm:
420         (WebCore::AVAudioCaptureSource::~AVAudioCaptureSource):
421         * platform/mediastream/mac/MockRealtimeAudioSourceMac.h:
422         * platform/mediastream/mac/MockRealtimeAudioSourceMac.mm:
423         (WebCore::MockRealtimeAudioSourceMac::~MockRealtimeAudioSourceMac):
424         * platform/mediastream/mac/RealtimeIncomingAudioSource.cpp:
425         (WebCore::RealtimeIncomingAudioSource::~RealtimeIncomingAudioSource):
426         * platform/mediastream/mac/RealtimeIncomingAudioSource.h:
427         * platform/mediastream/mac/WebAudioSourceProviderAVFObjC.mm:
428         (WebCore::WebAudioSourceProviderAVFObjC::~WebAudioSourceProviderAVFObjC):
429         (WebCore::WebAudioSourceProviderAVFObjC::setClient):
430         (WebCore::WebAudioSourceProviderAVFObjC::unprepare):
431         (WebCore::WebAudioSourceProviderAVFObjC::audioSamplesAvailable):
432
433 2017-02-17  Antoine Quint  <graouts@apple.com>
434
435         [Modern Media Controls] Improve handling of <video> with only audio tracks
436         https://bugs.webkit.org/show_bug.cgi?id=167836
437         <rdar://problem/30255812>
438
439         Reviewed by Dean Jackson.
440
441         We now check for the availability of video tracks before considering a <video>
442         element is displaying an actual video file and turning auto-hide on. We also
443         check that we have video tracks before enabling the fullscreen button. This
444         brings the behavior of a <video> pointing to a resource with no video tracks
445         to be the same as an <audio> element.
446
447         Test: media/modern-media-controls/media-controller/media-controller-video-with-only-audio.html
448
449         * Modules/modern-media-controls/media/controls-visibility-support.js:
450         (ControlsVisibilitySupport.prototype.get tracksToMonitor):
451         (ControlsVisibilitySupport.prototype._updateControls):
452         (ControlsVisibilitySupport):
453         * Modules/modern-media-controls/media/fullscreen-support.js:
454         (FullscreenSupport.prototype.syncControl):
455         (FullscreenSupport):
456
457 2017-02-17  Antoine Quint  <graouts@apple.com>
458
459         [Modern Media Controls] Toggle playback when clicking on the video on macOS
460         https://bugs.webkit.org/show_bug.cgi?id=168515
461         <rdar://problem/30577441>
462
463         Reviewed by Dean Jackson.
464
465         Listen to click events on the macOS media controls. Detect any clicks that were on the
466         background instead of the controls widgets themselves, and tell the delegate (MediaController)
467         about them.
468
469         Tests: media/modern-media-controls/media-controller/media-controller-click-on-video-background-should-pause.html
470                media/modern-media-controls/media-controller/media-controller-click-on-video-background-to-dismiss-tracks-panel-should-not-toggle-playback.html
471                media/modern-media-controls/media-controller/media-controller-click-on-video-controls-should-not-pause.html
472
473         * Modules/modern-media-controls/controls/macos-fullscreen-media-controls.js:
474         (MacOSFullscreenMediaControls.prototype._handleMousedown):
475         * Modules/modern-media-controls/controls/macos-inline-media-controls.js:
476         (MacOSInlineMediaControls.prototype.handleEvent):
477         * Modules/modern-media-controls/controls/macos-media-controls.js:
478         (MacOSMediaControls.prototype.handleEvent):
479         (MacOSMediaControls):
480         * Modules/modern-media-controls/media/media-controller.js:
481         (MediaController.prototype.togglePlayback):
482         (MediaController.prototype.macOSControlsBackgroundWasClicked):
483         (MediaController.prototype._updateControlsIfNeeded):
484         * Modules/modern-media-controls/media/playback-support.js:
485         (PlaybackSupport.prototype.buttonWasPressed):
486
487 2017-02-17  Jer Noble  <jer.noble@apple.com>
488
489         Refactoring: Remove AudioSourceObserverObjC and AudioCaptureSourceProviderObjC
490         https://bugs.webkit.org/show_bug.cgi?id=168520
491
492         Reviewed by Youenn Fablet.
493
494         Having AudioCaptureSourceProviderObjC as the type provided to WebAudioSourceProviderAVFObjC
495         (and only ever to WebAudioSourceProviderAVFObjC) makes it impossible for that class to add
496         an observer on RealtimeMediaSource, of which all classes inheriting from
497         WebAudioSourceProviderAVFObjC are subclasses. There is no need to treat
498         WebAudioSourceProviderAVFObjC as an "observer", since the only thing it will ever observe is
499         the object which created it and hold an explicit reference to it. So replace all instances
500         of the "observer" pattern with direct calls to the necessary (newly non-virtual) methods.
501         This allows WebAudioSourceProviderAVFObjC to register as an observer directly on
502         RealtimeMediaSource, to listen for audioSamplesAvailable() instead of process(), and remove
503         a lot of unnecessary conversion code and observer duplication.
504
505         * WebCore.xcodeproj/project.pbxproj:
506         * platform/mediastream/RealtimeMediaSource.h:
507         (WebCore::RealtimeMediaSource::Observer::sourceStopped):
508         (WebCore::RealtimeMediaSource::Observer::sourceMutedChanged):
509         (WebCore::RealtimeMediaSource::Observer::sourceEnabledChanged):
510         (WebCore::RealtimeMediaSource::Observer::sourceSettingsChanged):
511         (WebCore::RealtimeMediaSource::Observer::preventSourceFromStopping):
512         * platform/mediastream/mac/AVAudioCaptureSource.h:
513         * platform/mediastream/mac/AVAudioCaptureSource.mm:
514         (WebCore::AVAudioCaptureSource::shutdownCaptureSession):
515         (WebCore::AVAudioCaptureSource::captureOutputDidOutputSampleBufferFromConnection):
516         (WebCore::AVAudioCaptureSource::addObserver): Deleted.
517         (WebCore::AVAudioCaptureSource::removeObserver): Deleted.
518         (WebCore::AVAudioCaptureSource::start): Deleted.
519         * platform/mediastream/mac/AudioCaptureSourceProviderObjC.h: Removed.
520         * platform/mediastream/mac/AudioSourceObserverObjC.h: Removed.
521         * platform/mediastream/mac/AudioTrackPrivateMediaStreamCocoa.h:
522         * platform/mediastream/mac/MockRealtimeAudioSourceMac.h:
523         * platform/mediastream/mac/MockRealtimeAudioSourceMac.mm:
524         (WebCore::MockRealtimeAudioSourceMac::emitSampleBuffers):
525         (WebCore::MockRealtimeAudioSourceMac::reconfigure):
526         (WebCore::MockRealtimeAudioSourceMac::audioSourceProvider):
527         (WebCore::MockRealtimeAudioSourceMac::addObserver): Deleted.
528         (WebCore::MockRealtimeAudioSourceMac::removeObserver): Deleted.
529         (WebCore::MockRealtimeAudioSourceMac::start): Deleted.
530         * platform/mediastream/mac/RealtimeIncomingAudioSource.cpp:
531         (WebCore::RealtimeIncomingAudioSource::audioSourceProvider):
532         (WebCore::RealtimeIncomingAudioSource::addObserver): Deleted.
533         (WebCore::RealtimeIncomingAudioSource::removeObserver): Deleted.
534         (WebCore::RealtimeIncomingAudioSource::start): Deleted.
535         * platform/mediastream/mac/RealtimeIncomingAudioSource.h:
536         * platform/mediastream/mac/RealtimeOutgoingAudioSource.h:
537         * platform/mediastream/mac/RealtimeOutgoingVideoSource.h:
538         * platform/mediastream/mac/WebAudioSourceProviderAVFObjC.h:
539         * platform/mediastream/mac/WebAudioSourceProviderAVFObjC.mm:
540         (WebCore::WebAudioSourceProviderAVFObjC::create):
541         (WebCore::WebAudioSourceProviderAVFObjC::WebAudioSourceProviderAVFObjC):
542         (WebCore::WebAudioSourceProviderAVFObjC::setClient):
543         (WebCore::WebAudioSourceProviderAVFObjC::audioSamplesAvailable):
544         (WebCore::WebAudioSourceProviderAVFObjC::process): Deleted.
545
546 2017-02-17  Antoine Quint  <graouts@apple.com>
547
548         REGRESSION: Subtitles menu in media controls allows multiple items to be selected
549         https://bugs.webkit.org/show_bug.cgi?id=168168
550         <rdar://problem/30488605>
551
552         Reviewed by Dean Jackson.
553
554         Ensure that only a single audio track and a single text track can be selected
555         in the tracks panel at any given point.
556
557         * Modules/modern-media-controls/media/tracks-support.js:
558         (TracksSupport.prototype.tracksPanelSelectionDidChange):
559         (TracksSupport.prototype._sortedTrackList):
560         (TracksSupport):
561
562 2017-02-17  Jeremy Jones  <jeremyj@apple.com>
563
564         Invalidate WebAVSampleBufferStatusChangeListener when MediaPlayerPrivateMediaStreamAVFObjC is deallocated.
565         https://bugs.webkit.org/show_bug.cgi?id=168488
566
567         Reviewed by Jer Noble.
568
569         Fixes periodically crashing test: fast/mediastream/MediaStream-video-element-track-stop.html
570
571         WebAVSampleBufferStatusChangeListener has an unretained referecne to MediaPlayerPrivateMediaStreamAVFObjC
572         that must be invaldated when MediaPlayerPrivateMediaStreamAVFObjC is deallocated.
573
574         * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.mm:
575         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::~MediaPlayerPrivateMediaStreamAVFObjC):
576
577 2017-02-17  Antoine Quint  <graouts@apple.com>
578
579         [Modern Media Controls] Improve handling of live broadcast video
580         https://bugs.webkit.org/show_bug.cgi?id=168506
581         <rdar://problem/30432094>
582
583         Reviewed by Dean Jackson.
584
585         We improve the handling of live broadcast video by:
586         
587             - checking that we have a media source before deciding to show the controls
588               bar and start button
589             - support a mode where neither the status text nor the scrubber is visible
590               in case we're still waiting on sufficient data to determine the video
591               time and we haven't really started loading data yet
592             - not showing time labels when we have an infinite duration
593             - ensuring the status label is left-aligned
594
595         Test: media/modern-media-controls/status-label/status-label-text-align.html
596
597         * Modules/modern-media-controls/controls/macos-inline-media-controls.js:
598         (MacOSInlineMediaControls.prototype.layout):
599         * Modules/modern-media-controls/controls/status-label.css:
600         (.status-label):
601         * Modules/modern-media-controls/controls/status-label.js:
602         (StatusLabel.prototype.get enabled):
603         (StatusLabel.prototype.set enabled):
604         * Modules/modern-media-controls/media/controls-visibility-support.js:
605         (ControlsVisibilitySupport.prototype._updateControls):
606         (ControlsVisibilitySupport):
607         * Modules/modern-media-controls/media/status-support.js:
608         (StatusSupport.prototype.syncControl):
609         (StatusSupport):
610         * Modules/modern-media-controls/media/time-labels-support.js:
611         (TimeLabelsSupport.prototype.syncControl):
612         (TimeLabelsSupport):
613
614 2017-02-17  Anders Carlsson  <andersca@apple.com>
615
616         Begin overhauling the pasteboard implementation
617         https://bugs.webkit.org/show_bug.cgi?id=168525
618
619         Reviewed by Tim Horton.
620
621         Add a new PasteboardWriterData object. This object will hold data that is going
622         to be written to the pasteboard at some point. Currently it only supports plain text.
623
624         Also add a Mac-only PasteboardWriter class which can convert a PasteboardWriterDataObject
625         into an object that conforms to NSPasteboardWriting.
626
627         The basic idea is that instead of doing a bunch of pasteboard operations,
628         we'll just package all the pasteboard data up into an object and ship it over to WebKit.
629
630         This code is currently unused but will be adopted by a new drag implementation (in an upcoming patch).
631
632         * WebCore.xcodeproj/project.pbxproj:
633         * platform/PasteboardWriterData.cpp: Added.
634         (WebCore::PasteboardWriterData::PasteboardWriterData):
635         (WebCore::PasteboardWriterData::~PasteboardWriterData):
636         (WebCore::PasteboardWriterData::isEmpty):
637         (WebCore::PasteboardWriterData::setPlainText):
638         * platform/PasteboardWriterData.h: Added.
639         * platform/mac/PasteboardWriter.h: Added.
640         * platform/mac/PasteboardWriter.mm: Added.
641         (WebCore::createPasteboardWriting):
642         * platform/spi/mac/NSPasteboardSPI.h: Added.
643
644 2017-02-17  Per Arne Vollan  <pvollan@apple.com>
645
646         Apply SVG styles paint-order, stroke-linejoin, and stroke-linecap on DOM text.
647         https://bugs.webkit.org/show_bug.cgi?id=168044
648         rdar://problem/30165746
649
650         Reviewed by Simon Fraser.
651
652         This patch moves these styles out of svg, and sets the properties on video cues.
653
654         Tests: fast/css/parsing-paint-order.html
655                fast/css/parsing-stroke-linecap.html
656                fast/css/parsing-stroke-linejoin.html
657                fast/css/parsing-stroke-width.html
658
659         * css/CSSComputedStyleDeclaration.cpp:
660         (WebCore::paintOrder):
661         (WebCore::ComputedStyleExtractor::propertyValue):
662         * css/CSSProperties.json:
663         * css/SVGCSSComputedStyleDeclaration.cpp:
664         (WebCore::ComputedStyleExtractor::svgPropertyValue):
665         (WebCore::paintOrder): Deleted.
666         * css/StyleResolver.cpp:
667         (WebCore::StyleResolver::isValidCueStyleProperty):
668         * page/CaptionUserPreferencesMediaAF.cpp:
669         (WebCore::CaptionUserPreferencesMediaAF::cssPropertyWithTextEdgeColor):
670         * rendering/style/RenderStyle.cpp:
671         (WebCore::RenderStyle::diff):
672         (WebCore::RenderStyle::paintTypesForPaintOrder):
673         * rendering/style/RenderStyle.h:
674         (WebCore::RenderStyle::setPaintOrder):
675         (WebCore::RenderStyle::paintOrder):
676         (WebCore::RenderStyle::initialPaintOrder):
677         (WebCore::RenderStyle::setCapStyle):
678         (WebCore::RenderStyle::capStyle):
679         (WebCore::RenderStyle::initialCapStyle):
680         (WebCore::RenderStyle::setJoinStyle):
681         (WebCore::RenderStyle::joinStyle):
682         (WebCore::RenderStyle::initialJoinStyle):
683         (WebCore::RenderStyle::strokeWidth):
684         (WebCore::RenderStyle::setStrokeWidth):
685         (WebCore::RenderStyle::hasVisibleStroke):
686         (WebCore::RenderStyle::setStrokeOpacity):
687         * rendering/style/SVGRenderStyle.cpp:
688         (WebCore::SVGRenderStyle::diff):
689         (WebCore::SVGRenderStyle::paintTypesForPaintOrder): Deleted.
690         * rendering/style/SVGRenderStyle.h:
691         (WebCore::SVGRenderStyle::initialBufferedRendering):
692         (WebCore::SVGRenderStyle::initialFillRule):
693         (WebCore::SVGRenderStyle::initialMaskType):
694         (WebCore::SVGRenderStyle::setBufferedRendering):
695         (WebCore::SVGRenderStyle::setFillRule):
696         (WebCore::SVGRenderStyle::setMaskType):
697         (WebCore::SVGRenderStyle::bufferedRendering):
698         (WebCore::SVGRenderStyle::fillRule):
699         (WebCore::SVGRenderStyle::strokeMiterLimit):
700         (WebCore::SVGRenderStyle::maskType):
701         (WebCore::SVGRenderStyle::hasStroke):
702         (WebCore::SVGRenderStyle::setBitDefaults):
703         (WebCore::SVGRenderStyle::InheritedFlags::operator==):
704         (WebCore::SVGRenderStyle::initialCapStyle): Deleted.
705         (WebCore::SVGRenderStyle::initialJoinStyle): Deleted.
706         (WebCore::SVGRenderStyle::initialPaintOrder): Deleted.
707         (WebCore::SVGRenderStyle::setCapStyle): Deleted.
708         (WebCore::SVGRenderStyle::setJoinStyle): Deleted.
709         (WebCore::SVGRenderStyle::setPaintOrder): Deleted.
710         (WebCore::SVGRenderStyle::capStyle): Deleted.
711         (WebCore::SVGRenderStyle::joinStyle): Deleted.
712         (WebCore::SVGRenderStyle::strokeWidth): Deleted.
713         (WebCore::SVGRenderStyle::paintOrder): Deleted.
714         (WebCore::SVGRenderStyle::hasVisibleStroke): Deleted.
715         (WebCore::SVGRenderStyle::setStrokeWidth): Deleted.
716         * rendering/style/SVGRenderStyleDefs.cpp:
717         (WebCore::StyleStrokeData::StyleStrokeData):
718         (WebCore::StyleStrokeData::operator==):
719         * rendering/style/SVGRenderStyleDefs.h:
720         * rendering/style/StyleRareInheritedData.cpp:
721         (WebCore::StyleRareInheritedData::StyleRareInheritedData):
722         (WebCore::StyleRareInheritedData::operator==):
723         * rendering/style/StyleRareInheritedData.h:
724         * rendering/svg/RenderSVGEllipse.cpp:
725         (WebCore::RenderSVGEllipse::strokeShape):
726         * rendering/svg/RenderSVGPath.cpp:
727         (WebCore::RenderSVGPath::strokeShape):
728         (WebCore::RenderSVGPath::shapeDependentStrokeContains):
729         (WebCore::RenderSVGPath::shouldStrokeZeroLengthSubpath):
730         (WebCore::RenderSVGPath::zeroLengthLinecapPath):
731         * rendering/svg/RenderSVGRect.cpp:
732         (WebCore::RenderSVGRect::strokeShape):
733         * rendering/svg/RenderSVGShape.cpp:
734         (WebCore::RenderSVGShape::strokeShape):
735         (WebCore::RenderSVGShape::fillStrokeMarkers):
736         (WebCore::RenderSVGShape::strokeWidth):
737         (WebCore::RenderSVGShape::hasSmoothStroke):
738         * rendering/svg/RenderSVGText.cpp:
739         (WebCore::RenderSVGText::strokeBoundingBox):
740         * rendering/svg/SVGInlineTextBox.cpp:
741         (WebCore::SVGInlineTextBox::paint):
742         (WebCore::SVGInlineTextBox::paintDecoration):
743         * rendering/svg/SVGRenderSupport.cpp:
744         (WebCore::SVGRenderSupport::applyStrokeStyleToContext):
745         * rendering/svg/SVGRenderTreeAsText.cpp:
746         (WebCore::writeStyle):
747
748 2017-02-17  Carlos Garcia Campos  <cgarcia@igalia.com>
749
750         [SOUP] Handle Settings::allowsAnySSLCertificate() in SSL sockets
751         https://bugs.webkit.org/show_bug.cgi?id=168521
752
753         Reviewed by Michael Catanzaro.
754
755         When Settings::allowsAnySSLCertificate() is enabled, connect to accept-certificate signal of the GTlsConnection
756         to always accept the certificates.
757
758         Fixes: http/tests/websocket/tests/hybi/simple-wss.html
759
760         * platform/network/soup/SocketStreamHandleImplSoup.cpp:
761         (WebCore::wssConnectionAcceptCertificateCallback):
762         (WebCore::wssSocketClientEventCallback):
763         (WebCore::SocketStreamHandleImpl::create):
764
765 2017-02-17  Simon Fraser  <simon.fraser@apple.com>
766
767         Fixed elements bounce when rubber-banding at the bottom of the page
768         https://bugs.webkit.org/show_bug.cgi?id=168493
769         rdar://problem/30567713
770
771         Reviewed by Tim Horton.
772
773         FrameView::visibleDocumentRect() was computing a bad visible rect when bottom-rubber-banding,
774         by adding rubberBandBottom which is negative, rather than subtracting.
775
776         Log some more scrolling stuff.
777
778         Ironically, the existing test didn't test stick-to-viewport fixed position because
779         backgroundShouldExtendBeyondPage() is off by default in WTR, so clone it to a test
780         that sets this, to test both behaviors.
781
782         This also revealed that dynamic changes to backgroundShouldExtendBeyondPage() need
783         to be propagated to the scrolling tree, which is fixed in AsyncScrollingCoordinator::frameViewLayoutUpdated().
784
785         Test: fast/visual-viewport/rubberbanding-viewport-rects-extended-background.html
786
787         * page/FrameView.cpp:
788         (WebCore::FrameView::updateLayoutViewport):
789         (WebCore::FrameView::visibleDocumentRect):
790         * page/scrolling/AsyncScrollingCoordinator.cpp:
791         (WebCore::AsyncScrollingCoordinator::frameViewLayoutUpdated):
792         * page/scrolling/ScrollingStateFrameScrollingNode.cpp:
793         (WebCore::ScrollingStateFrameScrollingNode::dumpProperties):
794         * page/scrolling/ScrollingTreeFrameScrollingNode.cpp:
795         (WebCore::ScrollingTreeFrameScrollingNode::layoutViewportForScrollPosition):
796         * page/scrolling/mac/ScrollingCoordinatorMac.mm:
797         (WebCore::ScrollingCoordinatorMac::scheduleTreeStateCommit):
798         (WebCore::ScrollingCoordinatorMac::commitTreeState):
799
800 2017-02-17  Simon Fraser  <simon.fraser@apple.com>
801
802         REGRESSION (209396): Apple Pay buttons do not render
803         https://bugs.webkit.org/show_bug.cgi?id=168523
804         rdar://problem/30451563
805
806         Reviewed by Geoffrey Garen.
807
808         The new CSS parser mistakenly converted -apple-pay-button values to
809         -webkit-pay-button, breaking -webkit-appearance: -apple-pay-button.
810
811         Fix by excluding "-apple-pay" prefixed values from the conversion.
812
813         Test: fast/css/appearance-apple-pay-button.html
814
815         * css/parser/CSSPropertyParser.cpp:
816         (WebCore::isAppleLegacyCssValueKeyword):
817
818 2017-02-17  Commit Queue  <commit-queue@webkit.org>
819
820         Unreviewed, rolling out r212463.
821         https://bugs.webkit.org/show_bug.cgi?id=168526
822
823         Some crashes with GuardMalloc (Requested by anttik on
824         #webkit).
825
826         Reverted changeset:
827
828         "Execute pending scripts asynchronously after stylesheet loads
829         complete"
830         https://bugs.webkit.org/show_bug.cgi?id=168367
831         http://trac.webkit.org/changeset/212463
832
833 2017-02-16  Brent Fulgham  <bfulgham@apple.com>
834
835         RenderView needs to be updated when FrameView changes
836         https://bugs.webkit.org/show_bug.cgi?id=168481
837         <rdar://problem/30339638>
838
839         Reviewed by Andreas Kling.
840
841         The state of the Document's RenderView can get out of sync with the Frame's FrameView.
842         We need a notification mechanism so that modifications to the Frame's view are properly
843         relayed to Document so that it can have a correct RenderView.
844
845         * dom/Document.cpp:
846         (WebCore::Document::didBecomeCurrentDocumentInView): Create an updated render tree (if
847         one does not already exist).
848         (WebCore::Document::destroyRenderTree): Remove an incorrect ASSERT. We may enter this
849         code when the Frame uses 'setView(nullptr)', which happens during certain  updates.
850         * dom/Document.h:
851         * page/Frame.cpp:
852         (WebCore::Frame::setView): Destroy the old render tree (if present) before switching to
853         the new view. Then notify the document that it is now the current document in the new view.
854
855 2017-02-17  Enrique Ocaña González  <eocanha@igalia.com>
856
857         [GStreamer] Fast replay on video hide/unhide on platforms with limited video buffer pools
858         https://bugs.webkit.org/show_bug.cgi?id=168505
859
860         Reviewed by Žan Doberšek.
861
862         The WebKit code isn't consuming the video samples when the video layer is hidden,
863         so the buffers aren't being returned to the pool and starve the decoder when the
864         buffer pool runs out of buffers (on platforms using a buffer pool and a custom
865         allocator, such as OMX on the Raspberry Pi 2). When the video layer is restored,
866         the pipeline tries to catch up and the user sees the video "going fast forward".
867
868         The added code "consumes" (removes and unrefs) the buffer in that case. However,
869         the sample isn't completely removed because it still holds important info (eg:
870         caps) needed for the proper operation of the video element.
871
872         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp:
873         (WebCore::MediaPlayerPrivateGStreamerBase::pushTextureToCompositor):
874
875 2017-02-17  Carlos Garcia Campos  <cgarcia@igalia.com>
876
877         [SOUP] Stop removing the fragment identifier from resource requests
878         https://bugs.webkit.org/show_bug.cgi?id=168509
879
880         Reviewed by Sergio Villar Senin.
881
882         I don't know why, but have always removed the fragment identifier from the URL when creating the SoupURI that
883         is passed to libsoup. Maybe it was a bug in a very old version of libsoup, but it doesn't look necessary anymore
884         and it's causing several layout test failures.
885
886         Fixes: http/tests/svg/svg-use-external.html
887                imported/w3c/web-platform-tests/html/webappapis/scripting/processing-model-2/compile-error-same-origin-with-hash.html
888                imported/w3c/web-platform-tests/html/webappapis/scripting/processing-model-2/runtime-error-same-origin-with-hash.html
889
890         * platform/network/soup/ResourceRequestSoup.cpp:
891         (WebCore::ResourceRequest::createSoupURI): Do not remove the fragment identifier from the URL.
892
893 2017-02-16  Yusuke Suzuki  <utatane.tea@gmail.com>
894
895         [JSC] Drop PassRefPtr from ArrayBuffer
896         https://bugs.webkit.org/show_bug.cgi?id=168455
897
898         Reviewed by Geoffrey Garen.
899
900         * bindings/js/SerializedScriptValue.cpp:
901         (WebCore::CloneDeserializer::readArrayBufferView):
902         * css/FontFace.cpp:
903         (WebCore::FontFace::create):
904         * platform/graphics/avfoundation/MediaPlayerPrivateAVFoundation.cpp:
905         (WebCore::MediaPlayerPrivateAVFoundation::extractKeyURIKeyIDAndCertificateFromInitData):
906         * platform/graphics/avfoundation/cf/MediaPlayerPrivateAVFoundationCF.cpp:
907         (WebCore::AVFWrapper::shouldWaitForLoadingOfResource):
908         * platform/graphics/avfoundation/objc/CDMSessionAVFoundationObjC.mm:
909         (WebCore::CDMSessionAVFoundationObjC::generateKeyRequest):
910         * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
911         (WebCore::MediaPlayerPrivateAVFoundationObjC::shouldWaitForLoadingOfResource):
912
913 2017-02-16  Simon Fraser  <simon.fraser@apple.com>
914
915         REGRESSION(r212439): Web Inspector Toolbar / Window appears broken
916         https://bugs.webkit.org/show_bug.cgi?id=168494
917
918         Reviewed by Joseph Pecoraro.
919
920         Missed one conversion from acceleratesDrawing to drawsAsynchronously, which
921         caused non-Whippet GrpahicsContext shadow drawing to happen unexpectedly.
922
923         * platform/graphics/ca/cocoa/WebTiledBackingLayer.mm:
924         (-[WebTiledBackingLayer drawsAsynchronously]):
925         (-[WebTiledBackingLayer acceleratesDrawing]): Deleted.
926
927 2017-02-16  Chris Dumez  <cdumez@apple.com>
928
929         <input>.labels is empty if type changes from text->hidden->checkbox
930         https://bugs.webkit.org/show_bug.cgi?id=168358
931
932         Reviewed by Ryosuke Niwa.
933
934         We were invalidating LabelsNodeLists on 'for' attribute change.
935         We now also invalidate them of 'type' attribute change since
936         HTMLInputElements whose type is 'hidden' do not support labels.
937
938         No new tests, updated existing test.
939
940         * dom/Document.h:
941         * dom/LiveNodeList.h:
942         (WebCore::shouldInvalidateTypeOnAttributeChange):
943         * html/LabelsNodeList.cpp:
944         (WebCore::LabelsNodeList::LabelsNodeList):
945
946 2017-02-16  Michael Catanzaro  <mcatanzaro@igalia.com>
947
948         Remove even more EFL from WebCore
949         https://bugs.webkit.org/show_bug.cgi?id=168485
950
951         Reviewed by Alex Christensen.
952
953         * accessibility/atk/WebKitAccessibleWrapperAtk.cpp:
954         (webkitAccessibleGetAttributes):
955         (atkRole):
956         * css/StyleRule.cpp:
957         (WebCore::StyleRuleBase::copy):
958         * platform/ContextMenuItem.h:
959         * platform/graphics/OpenGLESShims.h:
960         * platform/graphics/PlatformDisplay.cpp:
961         (WebCore::PlatformDisplay::createPlatformDisplay):
962         * platform/graphics/PlatformDisplay.h:
963         * platform/graphics/cairo/ImageBufferCairo.cpp:
964         * platform/graphics/freetype/SimpleFontDataFreeType.cpp:
965         (WebCore::Font::platformInit):
966         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:
967         (WebCore::MediaPlayerPrivateGStreamer::MediaPlayerPrivateGStreamer):
968         * platform/graphics/texmap/GraphicsLayerTextureMapper.cpp:
969         (WebCore::GraphicsLayerTextureMapper::setContentsToImage):
970         * platform/graphics/texmap/TextureMapperGC3DPlatformLayer.cpp:
971         * platform/graphics/texmap/TextureMapperGC3DPlatformLayer.h:
972         * platform/network/soup/ResourceErrorSoup.cpp:
973         (WebCore::ResourceError::timeoutError):
974         * platform/network/soup/SoupNetworkSession.cpp:
975         (WebCore::SoupNetworkSession::setProxySettingsFromEnvironment): Deleted.
976         * platform/network/soup/SoupNetworkSession.h:
977
978 2017-02-16  Daniel Bates  <dabates@apple.com>
979
980         Remove Chromium-specific code to call FrameLoaderClient::redirectDataToPlugin(nullptr)
981         https://bugs.webkit.org/show_bug.cgi?id=168417
982         <rdar://problem/30541748>
983
984         Reviewed by Brent Fulgham.
985
986         Remove Chromium-specific code that was added in r125500 to call FrameLoaderClient::redirectDataToPlugin(nullptr)
987         in PluginDocument::detachFromPluginElement(). Calling redirectDataToPlugin() with nullptr was used by the
988         Chromium port to signify that the plugin document was being destroyed so that they could tear down their
989         plugin widget. And PluginDocument::detachFromPluginElement() is the only place that calls redirectDataToPlugin()
990         passing nullptr. No other port made use of this machinery and the Chromium port has long since been removed
991         from the Open Source WebKit Project. We should remove this code.
992
993         * html/PluginDocument.cpp:
994         (WebCore::PluginDocumentParser::appendBytes): Pass the plugin widget by reference.
995         (WebCore::PluginDocument::detachFromPluginElement): Remove call to FrameLoaderClient::redirectDataToPlugin().
996         This call was only used by the Chromium port as means to be notified when the plugin document was being
997         destroyed. No other port made use of this notification or needed such a notification.
998         * loader/EmptyClients.cpp: Change argument of redirectDataToPlugin() from Widget* to Widget& to convey
999         that this function always takes a valid Widget. Also remove unnecessary argument name as the data type
1000         of the argument and the name of the function sufficiently describes the purpose of the argument.
1001         * loader/FrameLoaderClient.h: Ditto.
1002
1003 2017-02-16  Myles C. Maxfield  <mmaxfield@apple.com>
1004
1005         font-weight in @font-face can cause a font to be downloaded even when it's not used
1006         https://bugs.webkit.org/show_bug.cgi?id=168114
1007         <rdar://problem/30301317>
1008
1009         Reviewed by Darin Adler.
1010
1011         There were two problems with our font loading code.
1012
1013         When we are in the middle of a download, we will use a special interstitial font,
1014         and this special font has a flag set which will cause it to be invisible when it is
1015         drawn. However, when we start using this font during the load, we give it a
1016         unicode-range of U+0-0 which means that it will never be used, and fallback will
1017         happen to other weights immediately. 
1018
1019         The second problem with the font loading code is that this interstital font is just
1020         Times. Times doesn't support every character, which means that if we are trying
1021         to render some exotic character, we fall back to other weights. The solution here
1022         is to use LastResort as the interstitial font, because it supports all characters.
1023         Because its metrics are reasonable and we don't ever actually paint this
1024         interstitial font, this choice is no worse than Times.
1025
1026         Tests: fast/text/font-style-download.html
1027                fast/text/font-weight-download-2.html
1028                fast/text/font-weight-download.html
1029                fast/text/font-weight-fallback.html
1030
1031         * css/CSSFontFace.cpp:
1032         (WebCore::CSSFontFace::font):
1033         * css/CSSSegmentedFontFace.cpp:
1034         (WebCore::appendFont):
1035         (WebCore::CSSSegmentedFontFace::fontRanges):
1036         (WebCore::appendFontWithInvalidUnicodeRangeIfLoading): Deleted.
1037         * platform/graphics/Font.h:
1038         (WebCore::Font::widthForGlyph):
1039         * platform/graphics/FontCache.h:
1040         * platform/graphics/freetype/FontCacheFreeType.cpp:
1041         (WebCore::FontCache::lastResortFallbackFontForEveryCharacter):
1042         * platform/graphics/mac/FontCacheMac.mm:
1043         (WebCore::FontCache::lastResortFallbackFontForEveryCharacter):
1044         * platform/graphics/win/FontCacheWin.cpp:
1045         (WebCore::FontCache::lastResortFallbackFontForEveryCharacter):
1046
1047 2017-02-16  Alex Christensen  <achristensen@webkit.org>
1048
1049         Remove EFL-specific files in Source.
1050
1051         Rubber-stamped by Anders Carlsson.
1052
1053         * editing/efl: Removed.
1054         * page/efl: Removed.
1055         * platform/audio/efl: Removed.
1056         * platform/efl: Removed.
1057         * platform/efl/DefaultTheme: Removed.
1058         * platform/efl/DefaultTheme/widget: Removed.
1059         * platform/efl/DefaultTheme/widget/button: Removed.
1060         * platform/efl/DefaultTheme/widget/check: Removed.
1061         * platform/efl/DefaultTheme/widget/combo: Removed.
1062         * platform/efl/DefaultTheme/widget/entry: Removed.
1063         * platform/efl/DefaultTheme/widget/progressbar: Removed.
1064         * platform/efl/DefaultTheme/widget/radio: Removed.
1065         * platform/efl/DefaultTheme/widget/scrollbar: Removed.
1066         * platform/efl/DefaultTheme/widget/search: Removed.
1067         * platform/efl/DefaultTheme/widget/search/cancel: Removed.
1068         * platform/efl/DefaultTheme/widget/search/decoration: Removed.
1069         * platform/efl/DefaultTheme/widget/search/field: Removed.
1070         * platform/efl/DefaultTheme/widget/slider: Removed.
1071         * platform/efl/DefaultTheme/widget/spinner: Removed.
1072         * platform/gamepad/efl: Removed.
1073         * platform/graphics/efl: Removed.
1074         * platform/graphics/surfaces/efl: Removed.
1075         * platform/network/efl: Removed.
1076
1077 2017-02-16  Simon Fraser  <simon.fraser@apple.com>
1078
1079         Add WebUSB to features.json as a "Not Considering".
1080
1081         * features.json:
1082
1083 2017-02-16  Alex Christensen  <achristensen@webkit.org>
1084
1085         Remove old URL parser
1086         https://bugs.webkit.org/show_bug.cgi?id=168483
1087
1088         Reviewed by Tim Horton.
1089
1090         * platform/URL.cpp:
1091         (WebCore::isSchemeFirstChar):
1092         (WebCore::isSchemeChar):
1093         (WebCore::URL::URL):
1094         (WebCore::URL::setProtocol):
1095         (WebCore::URL::setHost):
1096         (WebCore::URL::removePort):
1097         (WebCore::URL::setPort):
1098         (WebCore::URL::setHostAndPort):
1099         (WebCore::URL::setUser):
1100         (WebCore::URL::setPass):
1101         (WebCore::URL::setFragmentIdentifier):
1102         (WebCore::URL::setQuery):
1103         (WebCore::URL::setPath):
1104         (WebCore::URL::serialize):
1105         (WebCore::isUserInfoChar): Deleted.
1106         (WebCore::isHostnameChar): Deleted.
1107         (WebCore::isIPv6Char): Deleted.
1108         (WebCore::isPathSegmentEndChar): Deleted.
1109         (WebCore::appendASCII): Deleted.
1110         (WebCore::findFirstOf): Deleted.
1111         (WebCore::checkEncodedString): Deleted.
1112         (WebCore::URL::init): Deleted.
1113         (WebCore::appendEscapingBadChars): Deleted.
1114         (WebCore::escapeAndAppendNonHierarchicalPart): Deleted.
1115         (WebCore::copyPathRemovingDots): Deleted.
1116         (WebCore::hasSlashDotOrDotDot): Deleted.
1117         (WebCore::URL::parse): Deleted.
1118         (WebCore::cannotBeABaseURL): Deleted.
1119         (WebCore::isDefaultPortForScheme): Deleted.
1120         (WebCore::hostPortIsEmptyButCredentialsArePresent): Deleted.
1121         (WebCore::isNonFileHierarchicalScheme): Deleted.
1122         (WebCore::isCanonicalHostnameLowercaseForScheme): Deleted.
1123         (WebCore::findHostnamesInMailToURL): Deleted.
1124         (WebCore::findHostnameInHierarchicalURL): Deleted.
1125         (WebCore::encodeHostnames): Deleted.
1126         (WebCore::encodeRelativeString): Deleted.
1127         (WebCore::substituteBackslashes): Deleted.
1128         * platform/URLParser.cpp:
1129         (WebCore::URLParser::URLParser):
1130         (WebCore::URLParser::setEnabled): Deleted.
1131         (WebCore::URLParser::enabled): Deleted.
1132         * platform/URLParser.h:
1133         * platform/cf/URLCF.cpp:
1134         (WebCore::URL::URL):
1135         * platform/mac/URLMac.mm:
1136         (WebCore::URL::URL):
1137
1138 2017-02-16  Anders Carlsson  <andersca@apple.com>
1139
1140         Build fixes.
1141
1142         * page/gtk/EventHandlerGtk.cpp:
1143         (WebCore::EventHandler::createDraggingDataTransfer):
1144         * page/win/EventHandlerWin.cpp:
1145         (WebCore::EventHandler::createDraggingDataTransfer):
1146
1147 2017-02-16  Anders Carlsson  <andersca@apple.com>
1148
1149         Remove EFL from WebCore
1150         https://bugs.webkit.org/show_bug.cgi?id=168477
1151
1152         Reviewed by Brian Burg.
1153
1154         * accessibility/AccessibilityList.cpp:
1155         (WebCore::AccessibilityList::childHasPseudoVisibleListItemMarkers):
1156         * accessibility/AccessibilityNodeObject.cpp:
1157         (WebCore::AccessibilityNodeObject::canSetValueAttribute):
1158         * accessibility/AccessibilityObject.cpp:
1159         (WebCore::AccessibilityObject::AccessibilityObject):
1160         (WebCore::AccessibilityObject::textIteratorBehaviorForTextRange):
1161         * accessibility/AccessibilityObject.h:
1162         * accessibility/AccessibilityRenderObject.cpp:
1163         (WebCore::AccessibilityRenderObject::determineAccessibilityRole):
1164         * accessibility/AccessibilityTableColumn.cpp:
1165         (WebCore::AccessibilityTableColumn::computeAccessibilityIsIgnored):
1166         * accessibility/AccessibilityTableHeaderContainer.cpp:
1167         (WebCore::AccessibilityTableHeaderContainer::computeAccessibilityIsIgnored):
1168         * crypto/CryptoKey.cpp:
1169         * crypto/keys/CryptoKeyRSA.h:
1170         * dom/Document.cpp:
1171         (WebCore::Document::implicitClose):
1172         * editing/Editor.cpp:
1173         (WebCore::Editor::performCutOrCopy):
1174         (WebCore::Editor::copyImage):
1175         * editing/Editor.h:
1176         * editing/FrameSelection.h:
1177         * html/HTMLCanvasElement.cpp:
1178         (WebCore::requiresAcceleratedCompositingForWebGL):
1179         * inspector/InspectorFrontendHost.cpp:
1180         (WebCore::InspectorFrontendHost::port):
1181         * loader/HistoryController.cpp:
1182         (WebCore::HistoryController::restoreScrollPositionAndViewState):
1183         * loader/icon/IconDatabase.cpp:
1184         (WebCore::IconDatabase::performURLImport):
1185         * page/ContextMenuController.cpp:
1186         (WebCore::ContextMenuController::contextMenuItemSelected):
1187         (WebCore::ContextMenuController::populate):
1188         (WebCore::ContextMenuController::checkOrEnableIfNeeded):
1189         * page/DragController.cpp:
1190         (WebCore::DragController::startDrag):
1191         * page/EventHandler.cpp:
1192         (WebCore::EventHandler::eventInvertsTabsToLinksClientCallResult):
1193         * page/FrameView.cpp:
1194         (WebCore::FrameView::layout):
1195         * platform/ContextMenuItem.h:
1196         * platform/Cursor.h:
1197         * platform/DragData.h:
1198         * platform/DragImage.h:
1199         * platform/FileSystem.h:
1200         * platform/LocalizedStrings.h:
1201         * platform/MIMETypeRegistry.cpp:
1202         (WebCore::initializeSupportedImageMIMETypesForEncoding):
1203         * platform/NotImplemented.h:
1204         * platform/Pasteboard.h:
1205         * platform/PlatformKeyboardEvent.h:
1206         * platform/PlatformMouseEvent.h:
1207         * platform/PlatformSpeechSynthesizer.h:
1208         * platform/PlatformWheelEvent.h:
1209         * platform/Widget.h:
1210         * platform/graphics/ANGLEWebKitBridge.h:
1211         * platform/graphics/BitmapImage.h:
1212         * platform/graphics/GraphicsContext3D.h:
1213         * platform/graphics/Icon.h:
1214         * platform/graphics/Image.h:
1215         (WebCore::Image::getEvasObject): Deleted.
1216         * platform/graphics/IntPoint.h:
1217         * platform/graphics/IntRect.h:
1218         * platform/graphics/opengl/Extensions3DOpenGL.cpp:
1219         (WebCore::Extensions3DOpenGL::createVertexArrayOES):
1220         (WebCore::Extensions3DOpenGL::deleteVertexArrayOES):
1221         (WebCore::Extensions3DOpenGL::isVertexArrayOES):
1222         (WebCore::Extensions3DOpenGL::bindVertexArrayOES):
1223         (WebCore::Extensions3DOpenGL::supportsExtension):
1224         * platform/graphics/opengl/Extensions3DOpenGL.h:
1225         * platform/graphics/opengl/Extensions3DOpenGLCommon.cpp:
1226         * platform/graphics/opengl/GraphicsContext3DOpenGL.cpp:
1227         * platform/graphics/opengl/GraphicsContext3DOpenGLCommon.cpp:
1228         (WebCore::GraphicsContext3D::createForCurrentGLContext):
1229         (WebCore::GraphicsContext3D::reshape):
1230         (WebCore::GraphicsContext3D::createVertexArray):
1231         (WebCore::GraphicsContext3D::deleteVertexArray):
1232         (WebCore::GraphicsContext3D::isVertexArray):
1233         (WebCore::GraphicsContext3D::bindVertexArray):
1234         * platform/graphics/opengl/TemporaryOpenGLSetting.cpp:
1235         * platform/network/NetworkStateNotifier.h:
1236         * platform/posix/FileSystemPOSIX.cpp:
1237         * rendering/RenderLayerCompositor.cpp:
1238         (WebCore::RenderLayerCompositor::ensureRootLayer):
1239         * rendering/RenderText.cpp:
1240         (WebCore::RenderText::previousOffsetForBackwardDeletion):
1241         * xml/XSLStyleSheetLibxslt.cpp:
1242         * xml/XSLTExtensions.cpp:
1243         * xml/XSLTProcessorLibxslt.cpp:
1244         * xml/XSLTUnicodeSort.cpp:
1245
1246 2017-02-16  Zalan Bujtas  <zalan@apple.com>
1247
1248         Simple line layout: Add forced line layout info to coverage print.
1249         https://bugs.webkit.org/show_bug.cgi?id=168470
1250
1251         Reviewed by Simon Fraser.
1252
1253         This is about potential vs. actual coverage:
1254
1255         Simple line layout potential coverage: 65.05%
1256         Simple line layout actual coverage: 46.60%
1257         Forced line layout blocks: 4 content length: 57(18.45%)
1258
1259         Not testable.
1260
1261         * rendering/SimpleLineLayout.cpp:
1262         (WebCore::SimpleLineLayout::printSimpleLineLayoutCoverage):
1263
1264 2017-02-16  Anders Carlsson  <andersca@apple.com>
1265
1266         Rename DataTransfer functions to indicate whether they are for dragging or dropping
1267         https://bugs.webkit.org/show_bug.cgi?id=168478
1268
1269         Reviewed by Tim Horton.
1270
1271         * dom/DataTransfer.cpp:
1272         (WebCore::DataTransfer::createForDrag):
1273         (WebCore::DataTransfer::createForDrop):
1274         (WebCore::DataTransfer::createForDragAndDrop): Deleted.
1275         * dom/DataTransfer.h:
1276         * page/DragController.cpp:
1277         (WebCore::DragController::dragExited):
1278         (WebCore::DragController::performDragOperation):
1279         (WebCore::DragController::tryDHTMLDrag):
1280         * page/mac/EventHandlerMac.mm:
1281         (WebCore::EventHandler::createDraggingDataTransfer):
1282
1283 2017-02-16  Anders Carlsson  <andersca@apple.com>
1284
1285         Rename EventHandler::freeDataTransfer to invalidateDataTransfer
1286         https://bugs.webkit.org/show_bug.cgi?id=168472
1287
1288         Reviewed by Tim Horton.
1289
1290         The code doesn't necessarily free the data transfer object, so rename the member function
1291         to reflect that. Also, get rid of a goto.
1292
1293         * page/EventHandler.cpp:
1294         (WebCore::EventHandler::invalidateDataTransfer):
1295         (WebCore::EventHandler::dragSourceEndedAt):
1296         (WebCore::EventHandler::handleDrag):
1297         (WebCore::EventHandler::freeDataTransfer): Deleted.
1298         * page/EventHandler.h:
1299
1300 2017-02-16  Alex Christensen  <achristensen@webkit.org>
1301
1302         Special URLs without a host are invalid
1303         https://bugs.webkit.org/show_bug.cgi?id=168461
1304
1305         Reviewed by Tim Horton.
1306
1307         http://? should be invalid.  This matches Chrome and the spec and the intent of my implementation
1308         of URLParser which already fails with urls like http:// and this was just an oversight.
1309         Covered by newly passing web platform tests.  Updated API tests.
1310
1311         * platform/URLParser.cpp:
1312         (WebCore::URLParser::parse):
1313
1314 2017-02-16  Zalan Bujtas  <zalan@apple.com>
1315
1316         Simple line layout: Add support for pagination.
1317         https://bugs.webkit.org/show_bug.cgi?id=168355
1318         <rdar://problem/30119769>
1319
1320         Reviewed by David Hyatt.
1321
1322         This patch adds basic support for paginated content including widows and orphans.
1323
1324         This is based on the normal line layout pagination logic. However there are 2 major
1325         advantages here (and they allow us to have a much simpler logic):
1326         1. all the lines are positioned by the time we start paginating them and
1327         2. lines always have uniform heights. 
1328
1329         This is not enabled yet.
1330
1331         * rendering/RenderBlockFlow.h:
1332         * rendering/SimpleLineLayout.cpp:
1333         (WebCore::SimpleLineLayout::computeLineTopAndBottomWithOverflow):
1334         (WebCore::SimpleLineLayout::computeLineBreakIndex):
1335         (WebCore::SimpleLineLayout::setPageBreakForLine):
1336         (WebCore::SimpleLineLayout::computeOffsetAfterLineBreak):
1337         (WebCore::SimpleLineLayout::updateMinimumPageHeight):
1338         (WebCore::SimpleLineLayout::adjustLinePositionsForPagination):
1339         (WebCore::SimpleLineLayout::create):
1340         (WebCore::SimpleLineLayout::Layout::create):
1341         (WebCore::SimpleLineLayout::Layout::Layout):
1342         * rendering/SimpleLineLayout.h:
1343         (WebCore::SimpleLineLayout::Layout::isPaginated):
1344         (WebCore::SimpleLineLayout::Layout::struts):
1345         * rendering/SimpleLineLayoutFunctions.h:
1346         (WebCore::SimpleLineLayout::computeFlowHeight):
1347         * rendering/SimpleLineLayoutResolver.h:
1348         (WebCore::SimpleLineLayout::RunResolver::Run::computeBaselinePosition):
1349
1350 2017-02-11  Filip Pizlo  <fpizlo@apple.com>
1351
1352         The collector thread should only start when the mutator doesn't have heap access
1353         https://bugs.webkit.org/show_bug.cgi?id=167737
1354
1355         Reviewed by Keith Miller.
1356
1357         Added new tests in JSTests and LayoutTests.
1358         
1359         The WebCore changes involve:
1360         
1361         - Refactoring around new header discipline.
1362         
1363         - Adding crazy GC APIs to window.internals to enable us to test the GC's runloop discipline.
1364
1365         * ForwardingHeaders/heap/GCFinalizationCallback.h: Added.
1366         * ForwardingHeaders/heap/IncrementalSweeper.h: Added.
1367         * ForwardingHeaders/heap/MachineStackMarker.h: Added.
1368         * ForwardingHeaders/heap/RunningScope.h: Added.
1369         * bindings/js/CommonVM.cpp:
1370         * testing/Internals.cpp:
1371         (WebCore::Internals::parserMetaData):
1372         (WebCore::Internals::isReadableStreamDisturbed):
1373         (WebCore::Internals::isGCRunning):
1374         (WebCore::Internals::addGCFinalizationCallback):
1375         (WebCore::Internals::stopSweeping):
1376         (WebCore::Internals::startSweeping):
1377         * testing/Internals.h:
1378         * testing/Internals.idl:
1379
1380 2017-02-16  Jiewen Tan  <jiewen_tan@apple.com>
1381
1382         [WebCrypto] remove toJSValueFromJsonWebKey from custom SubtleCrypto binding codes
1383         https://bugs.webkit.org/show_bug.cgi?id=167026
1384
1385         Reviewed by Chris Dumez.
1386
1387         Covered by existing tests.
1388
1389         * bindings/js/JSSubtleCryptoCustom.cpp:
1390         (WebCore::jsSubtleCryptoFunctionExportKeyPromise):
1391         (WebCore::jsSubtleCryptoFunctionWrapKeyPromise):
1392         (WebCore::toJSValueFromJsonWebKey): Deleted.
1393         * crypto/JsonWebKey.h:
1394         * crypto/JsonWebKey.idl:
1395         * crypto/RsaOtherPrimesInfo.idl:
1396         Change std::optional<String> to String in order to use toJS<IDLDictionary<JsonWebKey>>.
1397         * crypto/algorithms/CryptoAlgorithmAES_CBC.cpp:
1398         (WebCore::CryptoAlgorithmAES_CBC::importKey):
1399         * crypto/algorithms/CryptoAlgorithmAES_KW.cpp:
1400         (WebCore::CryptoAlgorithmAES_KW::importKey):
1401         * crypto/algorithms/CryptoAlgorithmHMAC.cpp:
1402         (WebCore::CryptoAlgorithmHMAC::importKey):
1403         * crypto/algorithms/CryptoAlgorithmRSAES_PKCS1_v1_5.cpp:
1404         (WebCore::CryptoAlgorithmRSAES_PKCS1_v1_5::importKey):
1405         * crypto/algorithms/CryptoAlgorithmRSASSA_PKCS1_v1_5.cpp:
1406         (WebCore::CryptoAlgorithmRSASSA_PKCS1_v1_5::importKey):
1407         * crypto/algorithms/CryptoAlgorithmRSA_OAEP.cpp:
1408         (WebCore::CryptoAlgorithmRSA_OAEP::importKey):
1409         * crypto/keys/CryptoKeyAES.cpp:
1410         (WebCore::CryptoKeyAES::importJwk):
1411         Only check if key_ops contains all of the specified usages when key_ops field of jwk is present,
1412         as per the specification: https://www.w3.org/TR/WebCryptoAPI/#aes-cbc-operations
1413         * crypto/keys/CryptoKeyAES.h:
1414         * crypto/keys/CryptoKeyHMAC.cpp:
1415         (WebCore::CryptoKeyHMAC::importJwk):
1416         * crypto/keys/CryptoKeyHMAC.h:
1417         * crypto/keys/CryptoKeyRSA.cpp:
1418         (WebCore::CryptoKeyRSA::importJwk):
1419         Accommodate the change from std::optional<String> to String.
1420         * crypto/mac/CryptoKeyRSAMac.cpp:
1421         (WebCore::CryptoKeyRSA::create):
1422         Add a null check for p.
1423
1424 2017-02-16  Antti Koivisto  <antti@apple.com>
1425
1426         Execute pending scripts asynchronously after stylesheet loads complete
1427         https://bugs.webkit.org/show_bug.cgi?id=168367
1428         rdar://problem/30561379
1429
1430         Reviewed by Andreas Kling.
1431
1432         The current synchronous execution is fragile and creates various problems.
1433
1434         * css/StyleSheetContents.cpp:
1435         (WebCore::StyleSheetContents::checkLoaded):
1436         * dom/ContainerNode.cpp:
1437         (WebCore::ContainerNode::takeAllChildrenFrom):
1438         (WebCore::ContainerNode::notifyChildInserted):
1439         (WebCore::ContainerNode::removeChild):
1440         (WebCore::ContainerNode::parserRemoveChild):
1441         (WebCore::ContainerNode::removeChildren):
1442
1443             Remove various places where we would trigger delayed synchronous execution.
1444
1445         * dom/Document.cpp:
1446         (WebCore::Document::Document):
1447         (WebCore::Document::recalcStyle):
1448
1449             Trigger scroll to anchor at the end of style resolution instead of when style sheet load completes.
1450
1451         (WebCore::Document::didRemoveAllPendingStylesheet):
1452
1453             Call asynchronous script execution function.
1454
1455         * dom/Document.h:
1456         (WebCore::Document::setNeedsNotifyRemoveAllPendingStylesheet): Deleted.
1457         (WebCore::Document::notifyRemovePendingSheetIfNeeded): Deleted.
1458         * dom/ScriptableDocumentParser.cpp:
1459         (WebCore::ScriptableDocumentParser::ScriptableDocumentParser):
1460         (WebCore::ScriptableDocumentParser::executeScriptsWaitingForStylesheetsSoon):
1461         (WebCore::ScriptableDocumentParser::scriptsWaitingForStylesheetsExecutionTimerFired):
1462
1463             Add a timer for executing pending scripts.
1464
1465         (WebCore::ScriptableDocumentParser::detach):
1466         * dom/ScriptableDocumentParser.h:
1467         (WebCore::ScriptableDocumentParser::executeScriptsWaitingForStylesheets):
1468         * html/HTMLLinkElement.cpp:
1469         (WebCore::HTMLLinkElement::removedFrom):
1470         (WebCore::HTMLLinkElement::removePendingSheet):
1471         * html/HTMLLinkElement.h:
1472         * html/parser/HTMLDocumentParser.cpp:
1473         (WebCore::HTMLDocumentParser::detach):
1474         * loader/DocumentLoader.cpp:
1475         (WebCore::DocumentLoader::isLoadingInAPISense):
1476
1477             Stay in loading state if we have a pending script. This matches existing behavior.
1478
1479         * style/StyleScope.cpp:
1480         (WebCore::Style::Scope::removePendingSheet):
1481         * style/StyleScope.h:
1482
1483 2017-02-16  Anders Carlsson  <andersca@apple.com>
1484
1485         Set the DHTML drag image in the DHTML type check
1486         https://bugs.webkit.org/show_bug.cgi?id=168451
1487
1488         Reviewed by Wenson Hsieh.
1489
1490         * page/DragController.cpp:
1491         (WebCore::DragController::startDrag):
1492
1493 2017-02-16  Anders Carlsson  <andersca@apple.com>
1494
1495         Begin removing EFL code from WebCore.
1496
1497         Rubber-stamped by Alex Christensen.
1498
1499         * PlatformEfl.cmake: Removed.
1500         * editing/efl/EditorEfl.cpp: Removed.
1501         * page/efl/DragControllerEfl.cpp: Removed.
1502         * page/efl/EventHandlerEfl.cpp: Removed.
1503         * platform/audio/efl/AudioBusEfl.cpp: Removed.
1504         * platform/efl/CursorEfl.cpp: Removed.
1505         * platform/efl/DefaultTheme/CMakeLists.txt: Removed.
1506         * platform/efl/DefaultTheme/default.edc: Removed.
1507         * platform/efl/DefaultTheme/widget/button/button.edc: Removed.
1508         * platform/efl/DefaultTheme/widget/button/img_button_focus.png: Removed.
1509         * platform/efl/DefaultTheme/widget/button/img_button_hover.png: Removed.
1510         * platform/efl/DefaultTheme/widget/button/img_button_normal.png: Removed.
1511         * platform/efl/DefaultTheme/widget/button/img_button_press.png: Removed.
1512         * platform/efl/DefaultTheme/widget/check/check.edc: Removed.
1513         * platform/efl/DefaultTheme/widget/check/img_check_bg_disabled.png: Removed.
1514         * platform/efl/DefaultTheme/widget/check/img_check_bg_enabled.png: Removed.
1515         * platform/efl/DefaultTheme/widget/check/img_check_off.png: Removed.
1516         * platform/efl/DefaultTheme/widget/check/img_check_off_focus.png: Removed.
1517         * platform/efl/DefaultTheme/widget/check/img_check_off_hover.png: Removed.
1518         * platform/efl/DefaultTheme/widget/check/img_check_on.png: Removed.
1519         * platform/efl/DefaultTheme/widget/check/img_check_on_focus.png: Removed.
1520         * platform/efl/DefaultTheme/widget/check/img_check_on_hover.png: Removed.
1521         * platform/efl/DefaultTheme/widget/combo/combo.edc: Removed.
1522         * platform/efl/DefaultTheme/widget/combo/combo_focus.png: Removed.
1523         * platform/efl/DefaultTheme/widget/combo/combo_focus_button.png: Removed.
1524         * platform/efl/DefaultTheme/widget/combo/combo_focus_button_transparent.png: Removed.
1525         * platform/efl/DefaultTheme/widget/combo/combo_focus_transparent.png: Removed.
1526         * platform/efl/DefaultTheme/widget/combo/combo_hover.png: Removed.
1527         * platform/efl/DefaultTheme/widget/combo/combo_hover_button.png: Removed.
1528         * platform/efl/DefaultTheme/widget/combo/combo_hover_button_transparent.png: Removed.
1529         * platform/efl/DefaultTheme/widget/combo/combo_hover_transparent.png: Removed.
1530         * platform/efl/DefaultTheme/widget/combo/combo_normal.png: Removed.
1531         * platform/efl/DefaultTheme/widget/combo/combo_normal_button.png: Removed.
1532         * platform/efl/DefaultTheme/widget/combo/combo_normal_button_transparent.png: Removed.
1533         * platform/efl/DefaultTheme/widget/combo/combo_normal_transparent.png: Removed.
1534         * platform/efl/DefaultTheme/widget/combo/combo_press.png: Removed.
1535         * platform/efl/DefaultTheme/widget/combo/combo_press_button.png: Removed.
1536         * platform/efl/DefaultTheme/widget/combo/combo_press_button_transparent.png: Removed.
1537         * platform/efl/DefaultTheme/widget/combo/combo_press_transparent.png: Removed.
1538         * platform/efl/DefaultTheme/widget/combo/icon.png: Removed.
1539         * platform/efl/DefaultTheme/widget/entry/entry.edc: Removed.
1540         * platform/efl/DefaultTheme/widget/entry/img_focused.png: Removed.
1541         * platform/efl/DefaultTheme/widget/entry/img_hovered.png: Removed.
1542         * platform/efl/DefaultTheme/widget/entry/img_normal.png: Removed.
1543         * platform/efl/DefaultTheme/widget/progressbar/bt_base.png: Removed.
1544         * platform/efl/DefaultTheme/widget/progressbar/progressbar.edc: Removed.
1545         * platform/efl/DefaultTheme/widget/progressbar/shelf_inset.png: Removed.
1546         * platform/efl/DefaultTheme/widget/radio/img_radio_bg_disabled.png: Removed.
1547         * platform/efl/DefaultTheme/widget/radio/img_radio_bg_enabled.png: Removed.
1548         * platform/efl/DefaultTheme/widget/radio/img_radio_off.png: Removed.
1549         * platform/efl/DefaultTheme/widget/radio/img_radio_off_focus.png: Removed.
1550         * platform/efl/DefaultTheme/widget/radio/img_radio_off_hover.png: Removed.
1551         * platform/efl/DefaultTheme/widget/radio/img_radio_on.png: Removed.
1552         * platform/efl/DefaultTheme/widget/radio/img_radio_on_focus.png: Removed.
1553         * platform/efl/DefaultTheme/widget/radio/img_radio_on_hover.png: Removed.
1554         * platform/efl/DefaultTheme/widget/radio/radio.edc: Removed.
1555         * platform/efl/DefaultTheme/widget/scrollbar/scrollbar.edc: Removed.
1556         * platform/efl/DefaultTheme/widget/scrollbar/scrollbar_bg_horizontal.png: Removed.
1557         * platform/efl/DefaultTheme/widget/scrollbar/scrollbar_bg_vertical.png: Removed.
1558         * platform/efl/DefaultTheme/widget/scrollbar/scrollbar_thumb_horizontal.png: Removed.
1559         * platform/efl/DefaultTheme/widget/scrollbar/scrollbar_thumb_vertical.png: Removed.
1560         * platform/efl/DefaultTheme/widget/search/cancel/cancel_normal_button.png: Removed.
1561         * platform/efl/DefaultTheme/widget/search/cancel/cancel_normal_button2.png: Removed.
1562         * platform/efl/DefaultTheme/widget/search/cancel/search_cancel.edc: Removed.
1563         * platform/efl/DefaultTheme/widget/search/decoration/decoration_normal_button.png: Removed.
1564         * platform/efl/DefaultTheme/widget/search/decoration/search_decoration.edc: Removed.
1565         * platform/efl/DefaultTheme/widget/search/field/field_focused.png: Removed.
1566         * platform/efl/DefaultTheme/widget/search/field/field_hovered.png: Removed.
1567         * platform/efl/DefaultTheme/widget/search/field/field_normal.png: Removed.
1568         * platform/efl/DefaultTheme/widget/search/field/search_field.edc: Removed.
1569         * platform/efl/DefaultTheme/widget/slider/slider.edc: Removed.
1570         * platform/efl/DefaultTheme/widget/slider/slider_fill_h.png: Removed.
1571         * platform/efl/DefaultTheme/widget/slider/slider_fill_v.png: Removed.
1572         * platform/efl/DefaultTheme/widget/slider/slider_h.png: Removed.
1573         * platform/efl/DefaultTheme/widget/slider/slider_thumb_h.png: Removed.
1574         * platform/efl/DefaultTheme/widget/slider/slider_thumb_press_h.png: Removed.
1575         * platform/efl/DefaultTheme/widget/slider/slider_thumb_press_v.png: Removed.
1576         * platform/efl/DefaultTheme/widget/slider/slider_thumb_v.png: Removed.
1577         * platform/efl/DefaultTheme/widget/slider/slider_v.png: Removed.
1578         * platform/efl/DefaultTheme/widget/spinner/sp_bg.png: Removed.
1579         * platform/efl/DefaultTheme/widget/spinner/sp_down_default.png: Removed.
1580         * platform/efl/DefaultTheme/widget/spinner/sp_down_hover.png: Removed.
1581         * platform/efl/DefaultTheme/widget/spinner/sp_down_pressed.png: Removed.
1582         * platform/efl/DefaultTheme/widget/spinner/sp_up_default.png: Removed.
1583         * platform/efl/DefaultTheme/widget/spinner/sp_up_hover.png: Removed.
1584         * platform/efl/DefaultTheme/widget/spinner/sp_up_pressed.png: Removed.
1585         * platform/efl/DefaultTheme/widget/spinner/spinner.edc: Removed.
1586         * platform/efl/DragDataEfl.cpp: Removed.
1587         * platform/efl/DragImageEfl.cpp: Removed.
1588         * platform/efl/EflInspectorUtilities.cpp: Removed.
1589         * platform/efl/EflInspectorUtilities.h: Removed.
1590         * platform/efl/EflKeyboardUtilities.cpp: Removed.
1591         * platform/efl/EflKeyboardUtilities.h: Removed.
1592         * platform/efl/EflScreenUtilities.cpp: Removed.
1593         * platform/efl/EflScreenUtilities.h: Removed.
1594         * platform/efl/ErrorsEfl.cpp: Removed.
1595         * platform/efl/ErrorsEfl.h: Removed.
1596         * platform/efl/EventLoopEfl.cpp: Removed.
1597         * platform/efl/FileSystemEfl.cpp: Removed.
1598         * platform/efl/LocalizedStringsEfl.cpp: Removed.
1599         * platform/efl/MIMETypeRegistryEfl.cpp: Removed.
1600         * platform/efl/MainThreadSharedTimerEfl.cpp: Removed.
1601         * platform/efl/PasteboardEfl.cpp: Removed.
1602         * platform/efl/PlatformKeyboardEventEfl.cpp: Removed.
1603         * platform/efl/PlatformMouseEventEfl.cpp: Removed.
1604         * platform/efl/PlatformScreenEfl.cpp: Removed.
1605         * platform/efl/PlatformSpeechSynthesisProviderEfl.cpp: Removed.
1606         * platform/efl/PlatformSpeechSynthesisProviderEfl.h: Removed.
1607         * platform/efl/PlatformSpeechSynthesizerEfl.cpp: Removed.
1608         * platform/efl/PlatformWheelEventEfl.cpp: Removed.
1609         * platform/efl/ScrollbarThemeEfl.cpp: Removed.
1610         * platform/efl/ScrollbarThemeEfl.h: Removed.
1611         * platform/efl/SoundEfl.cpp: Removed.
1612         * platform/efl/TemporaryLinkStubs.cpp: Removed.
1613         * platform/efl/UserAgentEfl.cpp: Removed.
1614         * platform/efl/WidgetEfl.cpp: Removed.
1615         * platform/gamepad/efl/GamepadsEfl.cpp: Removed.
1616         * platform/graphics/efl/CairoUtilitiesEfl.cpp: Removed.
1617         * platform/graphics/efl/CairoUtilitiesEfl.h: Removed.
1618         * platform/graphics/efl/EvasGLContext.cpp: Removed.
1619         * platform/graphics/efl/EvasGLContext.h: Removed.
1620         * platform/graphics/efl/EvasGLSurface.cpp: Removed.
1621         * platform/graphics/efl/EvasGLSurface.h: Removed.
1622         * platform/graphics/efl/GraphicsContext3DEfl.cpp: Removed.
1623         * platform/graphics/efl/GraphicsContext3DPrivate.cpp: Removed.
1624         * platform/graphics/efl/GraphicsContext3DPrivate.h: Removed.
1625         * platform/graphics/efl/IconEfl.cpp: Removed.
1626         * platform/graphics/efl/ImageBufferEfl.cpp: Removed.
1627         * platform/graphics/efl/ImageEfl.cpp: Removed.
1628         * platform/graphics/efl/IntPointEfl.cpp: Removed.
1629         * platform/graphics/efl/IntRectEfl.cpp: Removed.
1630         * platform/graphics/surfaces/efl/GraphicsSurfaceCommon.cpp: Removed.
1631         * platform/network/efl/NetworkStateNotifierEfl.cpp: Removed.
1632         * rendering/RenderThemeEfl.cpp: Removed.
1633         * rendering/RenderThemeEfl.h: Removed.
1634
1635 2017-02-16  Joseph Pecoraro  <pecoraro@apple.com>
1636
1637         [Resource Timing] Support Resource Timing in Workers
1638         https://bugs.webkit.org/show_bug.cgi?id=168086
1639         <rdar://problem/30430117>
1640
1641         Reviewed by Alex Christensen.
1642
1643         Worker's load resources through the Document that loaded them. However,
1644         their PerformanceResourceTiming entries should be added to the Performance
1645         object inside the Worker context, not the Document's context.
1646
1647         This change adds an InitiatorContext to ResourceLoadOptions so that loaders
1648         can determine if the load was initiated by the Document or a Worker. This
1649         allows loaders to then know if the ResourceTiming data they collect should
1650         be added to the Document's Performance object or forwarded on to the Worker's.
1651
1652         This adds a new ThreadableLoaderClient method intended only for the purpose
1653         of adding the ResourceTiming information to the Worker's Performance object.
1654         Unlike other ThreadableLoaderClient methods that are bridged and forwarded
1655         on to a client inside the worker (e.g. XMLHttpRequest or FetchLoader) this
1656         method never needs to be handled by clients and can be uniformly handled by
1657         the WorkerThreadableLoader itself.
1658
1659         We also add a new ResourceTiming object that encapsulates all of the data
1660         ultimately needed for a PerformanceResourceTimingEntry object. This allows
1661         for all of the information to be gathered while loading on the Document
1662         before serializing across to the Worker. That includes the Timing-Allow-Origin
1663         check which uses the SecurityOrigin of the Worker.
1664
1665         This also modernizes and addresses issues in the Resource Timing implementation.
1666         Better handling cases like loading from the Cache, Synchronous Loads, and
1667         improving initiatorType information.
1668
1669         Tests: imported/w3c/web-platform-tests/resource-timing/rt-cors.html
1670                imported/w3c/web-platform-tests/resource-timing/rt-cors.worker.html
1671                imported/w3c/web-platform-tests/resource-timing/rt-initiatorType-css.html
1672                imported/w3c/web-platform-tests/resource-timing/rt-initiatorType-element.html
1673                imported/w3c/web-platform-tests/resource-timing/rt-initiatorType-fetch.html
1674                imported/w3c/web-platform-tests/resource-timing/rt-initiatorType-media.html
1675                imported/w3c/web-platform-tests/resource-timing/rt-initiatorType-other.html
1676                imported/w3c/web-platform-tests/resource-timing/rt-initiatorType-script-module.html
1677                imported/w3c/web-platform-tests/resource-timing/rt-initiatorType-xmlhttprequest.html
1678                imported/w3c/web-platform-tests/resource-timing/rt-initiatorType.worker.html
1679                imported/w3c/web-platform-tests/resource-timing/rt-performance-extensions.html
1680                imported/w3c/web-platform-tests/resource-timing/rt-performance-extensions.worker.html
1681                imported/w3c/web-platform-tests/resource-timing/rt-resource-errors.html
1682                imported/w3c/web-platform-tests/resource-timing/rt-resource-ignored.html
1683                imported/w3c/web-platform-tests/resource-timing/rt-resources-per-frame.html
1684                imported/w3c/web-platform-tests/resource-timing/rt-resources-per-worker.html
1685                imported/w3c/web-platform-tests/resource-timing/rt-serialization.html
1686                imported/w3c/web-platform-tests/resource-timing/rt-shared-resource-in-frames.html
1687                imported/w3c/web-platform-tests/resource-timing/rt-shared-resource-in-workers.html
1688                performance-api/resource-timing-apis.html
1689
1690         * CMakeLists.txt:
1691         * WebCore.xcodeproj/project.pbxproj:
1692         New files.
1693
1694         * platform/network/NetworkLoadTiming.h:
1695         (WebCore::NetworkLoadTiming::reset): Deleted.
1696         We no longer need to reset.
1697
1698         * loader/ResourceTiming.cpp: Added.
1699         (WebCore::passesTimingAllowCheck):
1700         (WebCore::ResourceTiming::fromCache):
1701         (WebCore::ResourceTiming::fromLoad):
1702         (WebCore::ResourceTiming::fromSynchronousLoad):
1703         (WebCore::ResourceTiming::ResourceTiming):
1704         (WebCore::ResourceTiming::isolatedCopy):
1705         * loader/ResourceTiming.h: Added.
1706         (WebCore::ResourceTiming::url):
1707         (WebCore::ResourceTiming::initiator):
1708         (WebCore::ResourceTiming::loadTiming):
1709         (WebCore::ResourceTiming::networkLoadTiming):
1710         (WebCore::ResourceTiming::allowTimingDetails):
1711         (WebCore::ResourceTiming::overrideInitiatorName):
1712         (WebCore::ResourceTiming::ResourceTiming):
1713         Class that encapsulates all of the data needed for a PerformanceResourceTiming entry.
1714         There are three static constructors indicating the different ways this object can
1715         be constructed and the different data available at the time of construction.
1716
1717         * loader/ResourceLoaderOptions.h:
1718         Add the new InitiatorContext, default to Document.
1719
1720         * loader/ThreadableLoaderClient.h:
1721         (WebCore::ThreadableLoaderClient::didFinishTiming):
1722         New client method only used by WorkerThreadableLoader.
1723
1724         * loader/WorkerThreadableLoader.h:
1725         * loader/WorkerThreadableLoader.cpp:
1726         (WebCore::WorkerThreadableLoader::MainThreadBridge::MainThreadBridge):
1727         (WebCore::WorkerThreadableLoader::MainThreadBridge::didFinishTiming):
1728         All loads initiated in a WorkerThreadableLoader get identified as InitiatorContext::Worker.
1729         Add timing information to the Performance object when received. No need to inform clients.
1730
1731         * loader/DocumentThreadableLoader.h:
1732         * loader/DocumentThreadableLoader.cpp:
1733         (WebCore::DocumentThreadableLoader::finishedTimingForWorkerLoad):
1734         (WebCore::DocumentThreadableLoader::loadRequest):
1735         Provide APIs to pass timing data on to a WorkerThreadableLoader.
1736         Create ResourceTiming data for synchronous loads.
1737
1738         * loader/LoadTiming.h:
1739         * loader/LoadTiming.cpp:
1740         (WebCore::LoadTiming::isolatedCopy):
1741         Add isolatedCopy to allow this data to be passed across to a Worker.
1742
1743         * loader/ResourceTimingInformation.h:
1744         * loader/ResourceTimingInformation.cpp:
1745         (WebCore::ResourceTimingInformation::shouldAddResourceTiming):
1746         (WebCore::ResourceTimingInformation::addResourceTiming):
1747         (WebCore::ResourceTimingInformation::storeResourceTimingInitiatorInformation):
1748         Refactor to remove unused / unnecessary bits. Extract out some helpful code.
1749         Changed this to match when Blink decides when to add or ignore entries, however
1750         this may change over time.
1751
1752         * loader/SubresourceLoader.cpp:
1753         (WebCore::SubresourceLoader::didFinishLoading):
1754         (WebCore::SubresourceLoader::notifyDone):
1755         (WebCore::SubresourceLoader::reportResourceTiming):
1756         * loader/SubresourceLoader.h:
1757         * loader/cache/CachedRawResource.cpp:
1758         (WebCore::CachedRawResource::finishedTimingForWorkerLoad):
1759         * loader/cache/CachedRawResource.h:
1760         * loader/cache/CachedRawResourceClient.h:
1761         (WebCore::CachedRawResourceClient::finishedTimingForWorkerLoad):
1762         Plumbing to report timing information to Worker if this resource was loaded for a Worker.
1763
1764         * loader/cache/CachedResource.cpp:
1765         (WebCore::CachedResource::CachedResource):
1766         * loader/cache/CachedResource.h:
1767         (WebCore::CachedResource::initiatorName):
1768         Store the initiator name on the CachedResource like other data added to the original
1769         CachedResourceRequest. This is a bit of a hack but follows an existing pattern, and
1770         cleans up other hacks that worked around this later on.
1771
1772         * loader/cache/CachedResourceLoader.h:
1773         * loader/cache/CachedResourceLoader.cpp:
1774         (WebCore::CachedResourceLoader::requestResource):
1775         (WebCore::CachedResourceLoader::revalidateResource):
1776         (WebCore::CachedResourceLoader::loadResource):
1777         Simply the creation of a ResourceTiming object for cache hits.
1778         Report timing information to Worker if this resource was loaded for a Worker.
1779
1780         (WebCore::CachedResourceLoader::loadDone):
1781         Eliminate this redundant point attempting to add a ResourceTiming entry.
1782
1783         * loader/cache/CachedResourceRequest.cpp:
1784         (WebCore::CachedResourceRequest::initiatorName):
1785         Update to match the spec. The fallback is "other".
1786
1787         * page/Performance.h:
1788         * page/Performance.cpp:
1789         (WebCore::Performance::setResourceTimingBufferSize):
1790         (WebCore::Performance::addResourceTiming):
1791         Update to support PerformanceObservers.
1792         Update to match spec (event should bubble).
1793
1794         * page/PerformanceResourceTiming.h:
1795         * page/PerformanceResourceTiming.cpp:
1796         (WebCore::PerformanceResourceTiming::create):
1797         (WebCore::PerformanceResourceTiming::PerformanceResourceTiming):
1798         (WebCore::PerformanceResourceTiming::fetchStart):
1799         (WebCore::PerformanceResourceTiming::domainLookupStart):
1800         (WebCore::PerformanceResourceTiming::domainLookupEnd):
1801         (WebCore::PerformanceResourceTiming::connectStart):
1802         (WebCore::PerformanceResourceTiming::connectEnd):
1803         (WebCore::PerformanceResourceTiming::secureConnectionStart):
1804         (WebCore::PerformanceResourceTiming::requestStart):
1805         (WebCore::PerformanceResourceTiming::responseStart):
1806         (WebCore::PerformanceResourceTiming::responseEnd):
1807         (WebCore::PerformanceResourceTiming::networkLoadTimeToDOMHighResTimeStamp):
1808         Construct with a ResourceTiming object containing all the data we need for the entry.
1809         Update to match spec for what is required, should fallback, should be zero, etc.
1810
1811         (WebCore::passesTimingAllowCheck): Deleted.
1812         Extracted this to ResourceTiming creation time in the loading context,
1813         since this can't be determined on the Worker context without also having
1814         all of the header information from each resource response.
1815
1816         * page/PerformanceResourceTiming.idl:
1817         Expose to Workers!
1818
1819 2017-02-16  Yusuke Suzuki  <utatane.tea@gmail.com>
1820
1821         [JSC] Drop PassRefPtr in inspector/
1822         https://bugs.webkit.org/show_bug.cgi?id=168420
1823
1824         Reviewed by Alex Christensen.
1825
1826         Use Ref<Inspector::ScriptArguments> and Ref<ScriptCallStack> as much as possible.
1827         It drops some unnecessary null checks.
1828
1829         * bindings/scripts/CodeGeneratorJS.pm:
1830         (GenerateCallWith):
1831         * bindings/scripts/test/JS/JSTestObj.cpp:
1832         (WebCore::jsTestObjPrototypeFunctionWithScriptArgumentsAndCallStackCaller):
1833         * dom/ScriptExecutionContext.cpp:
1834         (WebCore::ScriptExecutionContext::PendingException::PendingException):
1835         * inspector/InspectorInstrumentation.cpp:
1836         (WebCore::InspectorInstrumentation::consoleCountImpl):
1837         (WebCore::InspectorInstrumentation::stopConsoleTimingImpl):
1838         (WebCore::InspectorInstrumentation::consoleTimeStampImpl):
1839         * inspector/InspectorInstrumentation.h:
1840         (WebCore::InspectorInstrumentation::consoleCount):
1841         (WebCore::InspectorInstrumentation::stopConsoleTiming):
1842         (WebCore::InspectorInstrumentation::consoleTimeStamp):
1843         * inspector/InspectorNetworkAgent.cpp:
1844         (WebCore::InspectorNetworkAgent::buildInitiatorObject):
1845         * inspector/TimelineRecordFactory.cpp:
1846         (WebCore::TimelineRecordFactory::createGenericRecord):
1847         * inspector/WebInjectedScriptManager.cpp:
1848         (WebCore::WebInjectedScriptManager::WebInjectedScriptManager):
1849         * inspector/WebInjectedScriptManager.h:
1850         * page/DOMWindow.cpp:
1851         (WebCore::DOMWindow::postMessageTimerFired):
1852         We dispatch appropriate addMessage function according to whether
1853         `timer.stackTrace()` is nullptr.
1854
1855         * page/PageConsoleClient.cpp:
1856         (WebCore::PageConsoleClient::addMessage):
1857         (WebCore::PageConsoleClient::messageWithTypeAndLevel):
1858         (WebCore::PageConsoleClient::count):
1859         (WebCore::PageConsoleClient::timeEnd):
1860         (WebCore::PageConsoleClient::timeStamp):
1861         * page/PageConsoleClient.h:
1862         * workers/WorkerConsoleClient.cpp:
1863         (WebCore::WorkerConsoleClient::messageWithTypeAndLevel):
1864         (WebCore::WorkerConsoleClient::count):
1865         (WebCore::WorkerConsoleClient::timeEnd):
1866         (WebCore::WorkerConsoleClient::timeStamp):
1867         * workers/WorkerConsoleClient.h:
1868         * workers/WorkerGlobalScope.cpp:
1869         (WebCore::WorkerGlobalScope::addMessage):
1870
1871 2017-02-16  Chris Fleizach  <cfleizach@apple.com>
1872
1873         AX: Make form validation accessible on iOS
1874         https://bugs.webkit.org/show_bug.cgi?id=168400
1875
1876         Reviewed by Chris Dumez.
1877
1878         Hide the popover content of form validation from accessibility (since its not interactable)
1879         and instead announce the message.
1880
1881         * platform/ios/ValidationBubbleIOS.mm:
1882         (WebCore::ValidationBubble::show):
1883
1884 2017-02-16  Simon Fraser  <simon.fraser@apple.com>
1885
1886         Clean up use of some CALayer-related SPI
1887         https://bugs.webkit.org/show_bug.cgi?id=168401
1888
1889         Reviewed by Tim Horton.
1890
1891         Use -setDrawsAsynchronously: rather than the old -setAcceleratesDrawing: SPI.
1892
1893         Remove CATiledLayer-related stuff from QuartzCoreSPI.h, since we don't use it any more.
1894
1895         * platform/graphics/ca/cocoa/PlatformCALayerCocoa.mm:
1896         (PlatformCALayerCocoa::acceleratesDrawing):
1897         (PlatformCALayerCocoa::setAcceleratesDrawing):
1898         * platform/graphics/ca/cocoa/WebTiledBackingLayer.mm:
1899         (-[WebTiledBackingLayer setDrawsAsynchronously:]): This override passes the state
1900         onto the TileController.
1901         (-[WebTiledBackingLayer setAcceleratesDrawing:]): Deleted.
1902         * platform/ios/LegacyTileGridTile.mm:
1903         (WebCore::LegacyTileGridTile::LegacyTileGridTile):
1904         * platform/spi/cocoa/QuartzCoreSPI.h:
1905
1906 2017-02-16  Yusuke Suzuki  <utatane.tea@gmail.com>
1907
1908         Web Inspector: allow import() inside the inspector
1909         https://bugs.webkit.org/show_bug.cgi?id=167457
1910
1911         Reviewed by Ryosuke Niwa.
1912
1913         When evaluating `import("...")`, we need the caller's context to resolve
1914         the module specifier correctly. For example, if `import("./cocoa.js")` is
1915         evaluated in the script "drinks/hot.js", this module name is resolved to
1916         "drinks/cocoa.js". If the same import operator is evaluated in the script
1917         "menu/all.js", the module specifier becomes "menu/cocoa.js".
1918
1919         Previously we reject the import operator if the caller does not have such
1920         a context. These context is SourceOrigin and its ScriptFetcher. While they
1921         are offered in the script tag and other code evaluations, the inspector
1922         console does not offer that. These class are offered in the WebCore side
1923         and we should not touch these classes in the JSC's inspector code.
1924
1925         Now we relax the above restriction. If the above caller information is not
1926         offered, we fallback to the default one. In the web page, we use the page's
1927         URL as the caller's source origin. This allows us to evaluate the import
1928         operator in the inspector console.
1929
1930         And as of r167698, the console recognizes `await import("...")` form. We use
1931         this to test this `import()` in the console functionality.
1932
1933         Test: inspector/controller/runtime-controller-import.html
1934
1935         * bindings/js/ScriptModuleLoader.cpp:
1936         (WebCore::ScriptModuleLoader::importModule):
1937
1938 2017-02-16  Miguel Gomez  <magomez@igalia.com>
1939
1940         [GTK] scroll with transparent background not repainted after scrollY >= 32768
1941         https://bugs.webkit.org/show_bug.cgi?id=154283
1942
1943         Reviewed by Carlos Garcia Campos.
1944
1945         Due to a limitation of the pixman backend, which uses 16 bits to hold signed integers, cairo is
1946         not able to draw anything when using transformation matrices with values bigger than 32768. When
1947         drawing patterns into large pages, the matrices values can overflow those 16 bits, so cairo doesn't
1948         draw anything in, which causes the reported transparent backgrounds.
1949
1950         The patch modifies the transformation matrices both from the current context and the pattern we
1951         are painting, to avoid them to hold values that cannot stored in 16 bits.
1952
1953         There's still the possibility that this happens, but it would require using a pattern with a size
1954         bigger than 32768.
1955
1956         Based on a previous patch by Gwang Yoon Hwang  <yoon@igalia.com>.
1957
1958         Test: fast/backgrounds/background-repeat-long-scroll.html
1959
1960         * platform/graphics/cairo/CairoUtilities.cpp:
1961         (WebCore::drawPatternToCairoContext):
1962
1963 2017-02-16  Carlos Garcia Campos  <cgarcia@igalia.com>
1964
1965         [GTK] Images are never read from the clipboard
1966         https://bugs.webkit.org/show_bug.cgi?id=168419
1967
1968         Reviewed by Sergio Villar Senin.
1969
1970         We write images in the clipboard, but we don't read them.
1971
1972         Fixes: editing/pasteboard/paste-image-using-image-data.html
1973
1974         * editing/Editor.cpp:
1975         (WebCore::Editor::createFragmentForImageAndURL): Moved from EditorMac.mm since it's cross-platform code.
1976         * editing/Editor.h:
1977         * editing/gtk/EditorGtk.cpp:
1978         (WebCore::createFragmentFromPasteboardData): Check if there's an image in the selection, and use
1979         Editor::createFragmentForImageAndURL in that case.
1980         * editing/mac/EditorMac.mm:
1981         (WebCore::Editor::createFragmentForImageAndURL): Deleted.
1982         * platform/gtk/PasteboardHelper.cpp:
1983         (WebCore::PasteboardHelper::getClipboardContents): Check also if there's an image in the clipboard.
1984
1985 2017-02-15  Jer Noble  <jer.noble@apple.com>
1986
1987         REGRESSION (r212311): NULL-dereference in HTMLMediaElement::prepareToPlay()
1988         https://bugs.webkit.org/show_bug.cgi?id=168404
1989         <rdar://problem/30547188>
1990
1991         Reviewed by Brian Weinstein.
1992
1993         Prior to r212311, m_player was always guaranteed to be initialized when calling
1994         prepareToPlay(). r212311 began calling prepareToPlay() on a subsequent run-loop iteration
1995         after creating m_player. So now check whether m_player is NULL before calling methods on it.
1996
1997         * html/HTMLMediaElement.cpp:
1998         (WebCore::HTMLMediaElement::prepareToPlay):
1999
2000 2017-02-15  Eric Carlson  <eric.carlson@apple.com>
2001
2002         [MediaStream] delete CaptureDeviceInfo struct
2003         https://bugs.webkit.org/show_bug.cgi?id=168395
2004
2005         The CaptureDeviceInfo struct and CaptureDevice class were almost identical, so
2006         add an "enabled" field to the later, delete the former, and switch all uses of
2007         CaptureDeviceInfo to CaptureDevice.
2008
2009         Do some minor drive-by cleanup of AVCaptureDeviceManager::refreshCaptureDevices
2010         and CaptureDeviceManager::captureDeviceFromDeviceID.
2011         
2012         Reviewed by Sam Weinig.
2013
2014         No new tests, no behavior change.
2015
2016         * Modules/mediastream/MediaDevicesRequest.cpp:
2017         (WebCore::MediaDevicesRequest::start): SourceKind -> DeviceType
2018         * platform/mediastream/CaptureDevice.h:
2019         (WebCore::CaptureDevice::CaptureDevice):
2020         (WebCore::CaptureDevice::type): Renamed from kind.
2021         (WebCore::CaptureDevice::setType):
2022         (WebCore::CaptureDevice::enabled): Added.
2023         (WebCore::CaptureDevice::setEnabled):
2024         (WebCore::CaptureDevice::kind): Deleted.
2025         (WebCore::CaptureDevice::setKind): Deleted.
2026
2027         * platform/mediastream/CaptureDeviceManager.cpp:
2028         (CaptureDeviceManager::getSourcesInfo):
2029         (CaptureDeviceManager::captureDeviceFromDeviceID): Don't call sourceWithUID.
2030         (CaptureDeviceManager::bestSourcesForTypeAndConstraints):
2031         (CaptureDeviceManager::sourceWithUID):
2032         * platform/mediastream/CaptureDeviceManager.h:
2033         (WebCore::CaptureDeviceManager::refreshCaptureDevices):
2034         (WebCore::CaptureDeviceManager::refreshCaptureDeviceList): Deleted.
2035
2036         * platform/mediastream/mac/AVCaptureDeviceManager.h:
2037         * platform/mediastream/mac/AVCaptureDeviceManager.mm:
2038         (WebCore::AVCaptureDeviceManager::captureDevices):
2039         (WebCore::deviceIsAvailable):
2040         (WebCore::AVCaptureDeviceManager::refreshCaptureDevices):
2041         (WebCore::AVCaptureDeviceManager::createMediaSourceForCaptureDeviceWithConstraints):
2042         (WebCore::AVCaptureDeviceManager::deviceConnected):
2043         (WebCore::AVCaptureDeviceManager::deviceDisconnected):
2044         (WebCore::AVCaptureDeviceManager::captureDeviceList): Deleted.
2045         (WebCore::shouldConsiderDeviceInDeviceList): Deleted.
2046         (WebCore::AVCaptureDeviceManager::refreshCaptureDeviceList): Deleted.
2047         * platform/mock/MockRealtimeMediaSource.cpp:
2048         (WebCore::MockRealtimeMediaSource::audioDeviceInfo):
2049         (WebCore::MockRealtimeMediaSource::videoDeviceInfo):
2050
2051 2017-02-15  Sam Weinig  <sam@webkit.org>
2052
2053         [WebIDL] Remove custom conversion from FontFace code by using a Variant
2054         https://bugs.webkit.org/show_bug.cgi?id=168384
2055
2056         Reviewed by Alex Christensen.
2057
2058         Match the font face spec and use a union rather than any in the FontFace constructor.
2059
2060         Test: Added additional cases to fast/text/font-face-javascript.html.
2061
2062         * css/FontFace.cpp:
2063         (WebCore::FontFace::create):
2064         * css/FontFace.h:
2065         * css/FontFace.idl:
2066
2067 2017-02-15  Jer Noble  <jer.noble@apple.com>
2068
2069         Disabled Media Sources should render black/silence
2070         https://bugs.webkit.org/show_bug.cgi?id=168281
2071
2072         Reviewed by Eric Carlson.
2073
2074         Test: webrtc/video-disabled-black.html
2075
2076         Pass the enabled flag setting down from the MediaStreamTrackPrivate to its underlying
2077         source, including RealtimeMediaSource and RealtimeOutgoingAudio/VideoSource. When either
2078         enabled is cleared or muted is set, generate empty (black or silent) media, as opposed to
2079         pausing media or (worse) continuing to send generated media.
2080
2081         * platform/mediastream/MediaStreamTrackPrivate.cpp:
2082         (WebCore::MediaStreamTrackPrivate::setEnabled):
2083         (WebCore::MediaStreamTrackPrivate::sourceEnabledChanged):
2084         * platform/mediastream/MediaStreamTrackPrivate.h:
2085         * platform/mediastream/RealtimeMediaSource.cpp:
2086         (WebCore::RealtimeMediaSource::setEnabled):
2087         * platform/mediastream/RealtimeMediaSource.h:
2088         (WebCore::RealtimeMediaSource::enabled):
2089         * platform/mediastream/mac/AudioTrackPrivateMediaStreamCocoa.h:
2090         * platform/mediastream/mac/MockRealtimeAudioSourceMac.mm:
2091         (WebCore::MockRealtimeAudioSourceMac::render):
2092         * platform/mediastream/mac/RealtimeOutgoingAudioSource.cpp:
2093         (WebCore::RealtimeOutgoingAudioSource::sourceMutedChanged):
2094         (WebCore::RealtimeOutgoingAudioSource::sourceEnabledChanged):
2095         (WebCore::RealtimeOutgoingAudioSource::pullAudioData):
2096         * platform/mediastream/mac/RealtimeOutgoingAudioSource.h:
2097         * platform/mediastream/mac/RealtimeOutgoingVideoSource.cpp:
2098         (WebCore::RealtimeOutgoingVideoSource::sourceMutedChanged):
2099         (WebCore::RealtimeOutgoingVideoSource::sourceEnabledChanged):
2100         (WebCore::RealtimeOutgoingVideoSource::videoSampleAvailable):
2101         * platform/mediastream/mac/RealtimeOutgoingVideoSource.h:
2102         * platform/mock/MockRealtimeVideoSource.cpp:
2103         (WebCore::MockRealtimeVideoSource::generateFrame):
2104
2105 2017-02-15  Wenson Hsieh  <wenson_hsieh@apple.com>
2106
2107         Editing history scripts should not add the contenteditable attribute or override key events
2108         https://bugs.webkit.org/show_bug.cgi?id=168389
2109         <rdar://problem/30529945>
2110
2111         Reviewed by Dan Bernstein.
2112
2113         Clients that hook into editing history tracking should handle setting the contenteditable attribute on the body
2114         rather than have the script add it to the body. Additionally, this script should NOT be overriding any keydown
2115         events. These were initially added for compatibility with a test harness early on, and should have been removed
2116         earlier.
2117
2118         * Scripts/DumpEditingHistory.js:
2119
2120 2017-02-15  Jer Noble  <jer.noble@apple.com>
2121
2122         Pass "RequiresCustomURLLoading" in AVURLAsset options dictionary
2123         https://bugs.webkit.org/show_bug.cgi?id=168381
2124
2125         Reviewed by Eric Carlson.
2126
2127         * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
2128         (WebCore::MediaPlayerPrivateAVFoundationObjC::createAVAssetForURL):
2129
2130 2017-02-15  Anders Carlsson  <andersca@apple.com>
2131
2132         Fix build.
2133
2134         * page/DragController.cpp:
2135         (WebCore::DragController::doSystemDrag):
2136
2137 2017-02-15  Anders Carlsson  <andersca@apple.com>
2138
2139         Modernize DragClient::startDrag somewhat
2140         https://bugs.webkit.org/show_bug.cgi?id=168379
2141
2142         Reviewed by Tim Horton.
2143
2144         Change DragClient::startDrag to take a DragImage instead of a DragImageRef, and to pass along the source action
2145         instead of whether it's a link or not.
2146
2147         * loader/EmptyClients.cpp:
2148         * page/DragClient.h:
2149         * page/DragController.cpp:
2150         (WebCore::DragController::startDrag):
2151         (WebCore::DragController::doImageDrag):
2152         (WebCore::DragController::doSystemDrag):
2153         * page/DragController.h:
2154
2155 2017-02-15  Chris Dumez  <cdumez@apple.com>
2156
2157         Expose Symbol.toPrimitive / valueOf on Location instances
2158         https://bugs.webkit.org/show_bug.cgi?id=168295
2159
2160         Reviewed by Geoffrey Garen, Keith Miller and Mark Lam.
2161
2162         Expose Symbol.toPrimitive / valueOf on Location instances as per:
2163         - https://html.spec.whatwg.org/#the-location-interface
2164
2165         Firefox and Chrome already comply with the specification.
2166
2167         Tests: fast/dom/location-valueOf-after-object-prototype-update.html
2168                fast/dom/location-valueOf-after-object-prototype-update2.html
2169                imported/w3c/web-platform-tests/html/browsers/history/the-location-interface/location-symbol-toprimitive.html
2170                imported/w3c/web-platform-tests/html/browsers/history/the-location-interface/location-valueof.html
2171
2172         * bindings/scripts/CodeGeneratorJS.pm:
2173         (GenerateImplementation):
2174
2175 2017-02-15  Aakash Jain  <aakash_jain@apple.com>
2176
2177         Remove WebIOSEvent interface
2178         https://bugs.webkit.org/show_bug.cgi?id=168368
2179
2180         Reviewed by Tim Horton.
2181
2182         * platform/ios/WebEvent.h: Removed WebIOSEvent.
2183
2184 2017-02-15  Chris Dumez  <cdumez@apple.com>
2185
2186         [iOS] Form Validation Bubble should be sensitive to Dynamic Type
2187         https://bugs.webkit.org/show_bug.cgi?id=168291
2188         <rdar://problem/30508593>
2189
2190         Reviewed by Tim Horton.
2191
2192         Update ValidationBubble implementation on iOS to stop obeying the
2193         minimum font size setting, given that this setting is not exposed
2194         on iOS. Instead, we now rely on
2195         [UIFont preferredFontForTextStyle:UIFontTextStyleCallout], which
2196         will give us a font whose size obeys Dynamic Type [1] setting on iOS.
2197
2198         [1] https://developer.apple.com/ios/human-interface-guidelines/visual-design/typography/
2199
2200         No new tests, no easily testable.
2201
2202         * platform/ios/ValidationBubbleIOS.mm:
2203         (WebCore::ValidationBubble::ValidationBubble):
2204
2205 2017-02-15  Yusuke Suzuki  <utatane.tea@gmail.com>
2206
2207         [JSC] Drop PassRefPtr
2208         https://bugs.webkit.org/show_bug.cgi?id=168320
2209
2210         Reviewed by Saam Barati.
2211
2212         * bindings/js/ScriptSourceCode.h:
2213         (WebCore::ScriptSourceCode::ScriptSourceCode):
2214         Use Ref and pass it to SourceCode.
2215
2216         * replay/ReplayController.cpp:
2217         (WebCore::ReplayController::frameNavigated):
2218         Pass reference.
2219
2220 2017-02-15  Xabier Rodriguez Calvar  <calvaris@igalia.com>
2221
2222         [GStreamer][MSE][EME] Handle protection event also at decryptor level
2223         https://bugs.webkit.org/show_bug.cgi?id=168316
2224
2225         Reviewed by Žan Doberšek.
2226
2227         So far in MSE pipeline we were handling the encryption events
2228         only when they arrived at the demuxer but this won't work in any
2229         kind of key renegotiation as the event will never arrive. Now we
2230         connect to the element messages, check for the drm id and send it
2231         to the private player for processing.
2232
2233         * platform/graphics/gstreamer/mse/AppendPipeline.cpp:
2234         (WebCore::appendPipelineElementMessageCallback):
2235         (WebCore::AppendPipeline::AppendPipeline):
2236         (WebCore::AppendPipeline::handleElementMessage):
2237         * platform/graphics/gstreamer/mse/AppendPipeline.h:
2238
2239 2017-02-15  Zan Dobersek  <zdobersek@igalia.com>
2240
2241         [EME] MediaKeys::setServerCertificate() must resolve with 'false' when certificates aren't supported
2242         https://bugs.webkit.org/show_bug.cgi?id=168362
2243
2244         Reviewed by Xabier Rodriguez-Calvar.
2245
2246         In MediaKeys::setServerCertificate(), when the CDM implementation
2247         doesn't support server certificates, it should resolve the promise
2248         with the 'false' value, as mandated by the specification, and not
2249         reject it.
2250
2251         A test case in mock-MediaKeys-setServerCertificate.html is updated.
2252
2253         * Modules/encryptedmedia/MediaKeys.cpp:
2254         (WebCore::MediaKeys::setServerCertificate):
2255
2256 2017-02-15  Carlos Garcia Campos  <cgarcia@igalia.com>
2257
2258         REGRESSION (r206014): HTTPHeaderMap does not consistently use comma without space to separate values of header fields
2259         https://bugs.webkit.org/show_bug.cgi?id=168115
2260
2261         Reviewed by Darin Adler.
2262
2263         In r206014 HTTPHeaderMap::add() was updated to combine common headers with ',' instead of ", " to match the
2264         fetch specification, but the uncommon headers are still combined with ", ".
2265
2266         * platform/network/HTTPHeaderMap.cpp:
2267         (WebCore::HTTPHeaderMap::add):
2268
2269 2017-02-14  Ryosuke Niwa  <rniwa@webkit.org>
2270
2271         An assertion failure inside removeChildren
2272         https://bugs.webkit.org/show_bug.cgi?id=168069
2273
2274         Reviewed by Brent Fulgham.
2275
2276         The bug was caused by notifyRemovePendingSheet executing scripts synchronously where it shouldn't.
2277
2278         Removed the call to notifyRemovePendingSheetIfNeeded in notifyChildNodeRemoved. Instead, invoke it
2279         in its call sites when they're safe.
2280
2281         Test: http/tests/security/move-iframe-within-focus-handler-inside-removal.html
2282
2283         * dom/ContainerNode.cpp:
2284         (WebCore::ContainerNode::takeAllChildrenFrom):
2285         (WebCore::ContainerNode::notifyChildInserted):
2286         (WebCore::ContainerNode::removeChild):
2287         (WebCore::ContainerNode::parserRemoveChild):
2288         (WebCore::ContainerNode::replaceAllChildren):
2289         (WebCore::ContainerNode::removeChildren):
2290         * dom/ContainerNodeAlgorithms.cpp:
2291         (WebCore::notifyChildNodeRemoved):
2292
2293 2017-02-15  Carlos Garcia Campos  <cgarcia@igalia.com>
2294
2295         [GStreamer] Several tests are timing out after r212349
2296         https://bugs.webkit.org/show_bug.cgi?id=168359
2297
2298         Reviewed by Žan Doberšek.
2299
2300         This is because they are failing the cross origin check. Those tests are not using WebKitWebSrc, but
2301         GstFileSrc. I didn't consider the case of source not being a WebKitWebSrc.
2302
2303         Fixes several timeout instroduced in r212349.
2304
2305         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:
2306         (WebCore::MediaPlayerPrivateGStreamer::hasSingleSecurityOrigin): Split the source check in two. First check if
2307         it's nullptr, and return false. Then check if it's a WebKitWebSrc and return true if it isn't.
2308
2309 2017-02-14  Brent Fulgham  <bfulgham@apple.com>
2310
2311         Revalidate URL after events that could trigger navigations
2312         https://bugs.webkit.org/show_bug.cgi?id=168071
2313         <rdar://problem/30450379>
2314
2315         Reviewed by Ryosuke Niwa.
2316
2317         When arbitary javascript runs during a load, we should revalidate
2318         the URLs involved to make sure they are still valid.
2319
2320         Tests: http/tests/plugins/navigation-during-load-embed.html
2321                http/tests/plugins/navigation-during-load.html
2322
2323         * html/HTMLEmbedElement.cpp:
2324         (WebCore::HTMLEmbedElement::updateWidget): Confirm we are still allowed to
2325         load the URL after executing JS callbacks.
2326         * html/HTMLFrameElementBase.cpp:
2327         (WebCore::HTMLFrameElementBase::isURLAllowed): Split existing function into
2328         existing protected method, and a new public method that checks a passed URL
2329         for validity.
2330         * html/HTMLFrameElementBase.h:
2331         * html/HTMLFrameOwnerElement.h:
2332         (WebCore::HTMLFrameOwnerElement::isURLAllowed):
2333         * html/HTMLObjectElement.cpp:
2334         (WebCore::HTMLObjectElement::updateWidget): Confirm we are still allowed to
2335         load the URL after executing JS callbacks.
2336         * loader/SubframeLoader.cpp:
2337         (WebCore::SubframeLoader::requestFrame): Ditto.
2338
2339 2017-02-14  Carlos Garcia Campos  <cgarcia@igalia.com>
2340
2341         [GStreamer] Implement MediaPlayerPrivate::hasSingleSecurityOrigin()
2342         https://bugs.webkit.org/show_bug.cgi?id=168322
2343
2344         Reviewed by Žan Doberšek.
2345
2346         It currently returns true unconditionally. Add resolved-location property to WebKitWebSourceGStreamer to track
2347         the resolved url returned by the server and use that from MediaPlayerPrivate to check if there was a cross
2348         origin redirection.
2349
2350         Fixes: http/tests/security/canvas-remote-read-remote-video-redirect.html
2351
2352         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:
2353         (WebCore::MediaPlayerPrivateGStreamer::hasSingleSecurityOrigin):
2354         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.h:
2355         * platform/graphics/gstreamer/WebKitWebSourceGStreamer.cpp:
2356         (webKitWebSrcFinalize):
2357         (webKitWebSrcGetProperty):
2358         (webKitWebSrcStart):
2359         (webKitWebSrcQueryWithParent):
2360         (webKitWebSrcGetUri):
2361         (webKitWebSrcSetUri):
2362         (StreamingClient::handleResponseReceived):
2363         (ResourceHandleStreamingClient::wasBlocked):
2364         (ResourceHandleStreamingClient::cannotShowURL):
2365
2366 2017-02-14  Carlos Garcia Campos  <cgarcia@igalia.com>
2367
2368         Unreviewed, rolling out r211967.
2369
2370         Caused rendering issues in HiDPI
2371
2372         Reverted changeset:
2373
2374         "[GTK] scroll with transparent background not repainted after
2375         scrollY >= 32768"
2376         https://bugs.webkit.org/show_bug.cgi?id=154283
2377         http://trac.webkit.org/changeset/211967
2378
2379 2017-02-14  Carlos Garcia Campos  <cgarcia@igalia.com>
2380
2381         [GTK] Update cookie manager API to properly work with ephemeral sessions
2382         https://bugs.webkit.org/show_bug.cgi?id=168230
2383
2384         Reviewed by Michael Catanzaro.
2385
2386         Add implementation for deleteAllCookiesModifiedSince. Note that this only works when the timespan is 0, we need
2387         new libsoup API to support removing recently modified cookies.
2388
2389         * platform/network/soup/CookieJarSoup.cpp:
2390         (WebCore::deleteAllCookiesModifiedSince):
2391
2392 2017-02-14  Joseph Pecoraro  <pecoraro@apple.com>
2393
2394         [WebIDL] Improve serializer = { inherit }
2395         https://bugs.webkit.org/show_bug.cgi?id=168293
2396
2397         Reviewed by Youenn Fablet.
2398
2399         * bindings/scripts/CodeGeneratorJS.pm:
2400         (GenerateHeader):
2401         Expose a serialize() method on the interface.
2402
2403         (GenerateSerializerFunction):
2404         (GenerateSerializerAttributesForInterface): Deleted.
2405         Subclasses that have `serializer = { inherit }` can use
2406         their parent's serialize() method to get the initial object.
2407         We can now collapse everything back into a single function
2408         because we only generate code for our own attributes.
2409
2410         * bindings/scripts/test/JS/JSTestNode.cpp:
2411         (WebCore::JSTestNode::serialize):
2412         (WebCore::jsTestNodePrototypeFunctionToJSONCaller):
2413         * bindings/scripts/test/JS/JSTestNode.h:
2414         * bindings/scripts/test/JS/JSTestObj.cpp:
2415         (WebCore::JSTestObj::serialize):
2416         (WebCore::jsTestObjPrototypeFunctionToJSONCaller):
2417         * bindings/scripts/test/JS/JSTestObj.h:
2418         * bindings/scripts/test/JS/JSTestSerialization.cpp:
2419         (WebCore::JSTestSerialization::serialize):
2420         (WebCore::jsTestSerializationPrototypeFunctionToJSONCaller):
2421         * bindings/scripts/test/JS/JSTestSerialization.h:
2422         * bindings/scripts/test/JS/JSTestSerializationInherit.cpp:
2423         (WebCore::JSTestSerializationInherit::serialize):
2424         (WebCore::jsTestSerializationInheritPrototypeFunctionToJSONCaller):
2425         * bindings/scripts/test/JS/JSTestSerializationInherit.h:
2426         * bindings/scripts/test/JS/JSTestSerializationInheritFinal.cpp:
2427         (WebCore::JSTestSerializationInheritFinal::serialize):
2428         (WebCore::jsTestSerializationInheritFinalPrototypeFunctionToJSONCaller):
2429         * bindings/scripts/test/JS/JSTestSerializationInheritFinal.h:
2430         Updated results.
2431
2432 2017-02-14  Aakash Jain  <aakash_jain@apple.com>
2433
2434         Move methods from WebCoreThread.h to WebCoreThreadInternal.h
2435         https://bugs.webkit.org/show_bug.cgi?id=168326
2436
2437         Reviewed by Alexey Proskuryakov.
2438
2439         * platform/ios/wak/WebCoreThread.h: Move methods WebThreadRunLoop and WebThreadCurrentContext to WebCoreThreadInternal.h
2440         * platform/ios/wak/WebCoreThreadInternal.h: Ditto.
2441         * platform/ios/wak/WebCoreThreadRun.cpp: Removed WebCoreThread.h as it is already included by WebCoreThreadInternal.h
2442         * platform/ios/wak/WKGraphics.mm: Included WebCoreThreadInternal.h, it subsequently includes WebCoreThread.h
2443         * inspector/InspectorTimelineAgent.cpp: Ditto.
2444         * page/mac/PageMac.mm: Ditto.
2445         * platform/cf/MainThreadSharedTimerCF.cpp: Ditto.
2446         * platform/cocoa/MemoryPressureHandlerCocoa.mm: Ditto.
2447         * platform/graphics/ca/cocoa/LayerFlushSchedulerMac.cpp: Ditto.
2448         * platform/network/cf/SynchronousResourceHandleCFURLConnectionDelegate.cpp: Ditto.
2449         * bindings/js/CommonVM.cpp: included WebCoreThreadInternal.h
2450
2451 2017-02-14  Wenson Hsieh  <wenson_hsieh@apple.com>
2452
2453         [WK2] Support data interaction on links
2454         https://bugs.webkit.org/show_bug.cgi?id=168331
2455         <rdar://problem/30200837>
2456
2457         Reviewed by Tim Horton.
2458
2459         Adds support for data interaction on links at the WebCore layer, refactoring some drag-and-drop code on the Mac
2460         along the way. Also adds two new TestWebKitAPI unit tests in DataInteractionTests.mm: LinkToInput and
2461         BackgroundImageLinkToInput (see Tools/ChangeLog for more information).
2462
2463         * page/DragController.cpp:
2464         (WebCore::DragController::startDrag):
2465         (WebCore::DragController::doImageDrag):
2466         (WebCore::DragController::doSystemDrag):
2467
2468         Introduce platformAdjustDragImageForDeviceScaleFactor, and special-case drag images for links to anchor at the
2469         bottom center.
2470
2471         * platform/DragImage.cpp:
2472         (WebCore::platformAdjustDragImageForDeviceScaleFactor):
2473
2474         Scale the drag image up by the device scale factor. In WebDragClient, we scale the image back down to the
2475         original size. It seems the reason we do this extra dance is because the image sizing heuristic in between
2476         assumes that the image dimensions are for a non-retina device, but this work should really not be necessary if
2477         we tweak the heuristic to account for deviceScaleFactor. We should address this in a separate patch.
2478
2479         * platform/DragImage.h:
2480         * platform/graphics/Path.h:
2481
2482 2017-02-14  Basuke Suzuki  <Basuke.Suzuki@am.sony.com>
2483
2484         [CURL] ResourceError created with error information should have default type Type::General
2485         https://bugs.webkit.org/show_bug.cgi?id=168345
2486
2487         Reviewed by Alex Christensen.
2488
2489         ResourceError has separate implementaion for each platform
2490         so that the interface should be same.
2491         On CURL port, the constructor with error information has
2492         different default value on `type` parameter. It is Type::Null but other implementaitons have Type::General.
2493         This causes some ResourceError is created inconsistent. 
2494
2495         * platform/network/curl/ResourceError.h:
2496         (WebCore::ResourceError::ResourceError):
2497
2498 2017-02-14  Youenn Fablet  <youennf@gmail.com>
2499
2500         [WebRTC] Add support for libwebrtc negotiation needed event
2501         https://bugs.webkit.org/show_bug.cgi?id=168267
2502
2503         Reviewed by Eric Carlson.
2504
2505         Test: webrtc/negotiatedneeded-event-addStream.html
2506
2507         Moving generic code (markAsNeedingNegotiation) from MediaEndpointPeerConnection to PeerConnectionBackend.
2508         This code handles the control of sending or not the negotiationneeded event.
2509
2510         Updating mock to use markAsNeedingNegotiation when streams are changed.
2511         Updating libwebrtc backend to call markAsNeedingNegotiation when required by libwebrtc implementation.
2512
2513         * Modules/mediastream/MediaEndpointPeerConnection.cpp:
2514         (WebCore::MediaEndpointPeerConnection::setLocalDescriptionTask):
2515         * Modules/mediastream/MediaEndpointPeerConnection.h:
2516         * Modules/mediastream/PeerConnectionBackend.cpp:
2517         (WebCore::PeerConnectionBackend::markAsNeedingNegotiation):
2518         * Modules/mediastream/PeerConnectionBackend.h:
2519         (WebCore::PeerConnectionBackend::isNegotiationNeeded):
2520         (WebCore::PeerConnectionBackend::clearNegotiationNeededState):
2521         * Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.cpp:
2522         (WebCore::LibWebRTCMediaEndpoint::OnRenegotiationNeeded):
2523         * Modules/mediastream/libwebrtc/LibWebRTCPeerConnectionBackend.cpp:
2524         * Modules/mediastream/libwebrtc/LibWebRTCPeerConnectionBackend.h:
2525         * testing/MockLibWebRTCPeerConnection.cpp:
2526         (WebCore::MockLibWebRTCPeerConnection::AddStream):
2527         (WebCore::MockLibWebRTCPeerConnection::RemoveStream):
2528
2529 2017-02-14  Brady Eidson  <beidson@apple.com>
2530
2531         Unreviewed followup to r212330 to fix Debug builds
2532
2533         * loader/DocumentThreadableLoader.cpp:
2534         (WebCore::DocumentThreadableLoader::DocumentThreadableLoader): Add call to relaxAdoptionRequirement().
2535
2536 2017-02-14  Matt Rajca  <mrajca@apple.com>
2537
2538         Website policies: iframes should respect the autoplay policy of the top-level document
2539         https://bugs.webkit.org/show_bug.cgi?id=168333
2540
2541         Reviewed by Alex Christensen.
2542
2543         API tests were added.
2544
2545         * html/HTMLMediaElement.cpp:
2546         (WebCore::HTMLMediaElement::HTMLMediaElement):
2547
2548 2017-02-14  Dean Jackson  <dino@apple.com>
2549
2550         Rename preferLowPowerWebGLRendering setting to forceWebGLUsesLowPower
2551         https://bugs.webkit.org/show_bug.cgi?id=168339
2552         <rdar://problem/30522092>
2553
2554         Reviewed by Simon Fraser.
2555
2556         Use a setting name that more clearly reflects what it is doing. It's not
2557         preferring to use the low-power GPU, it's forcing it.
2558
2559         * html/canvas/WebGLRenderingContextBase.cpp:
2560         (WebCore::WebGLRenderingContextBase::create):
2561         * page/Settings.in:
2562
2563 2017-02-14  Brady Eidson  <beidson@apple.com>
2564
2565         Speculative fix for: Crash in DocumentThreadableLoader::redirectReceived.
2566         <rdar://problem/29899473> and https://bugs.webkit.org/show_bug.cgi?id=168337
2567
2568         Reviewed by Geoffrey Garen.
2569
2570         No new tests (Unable to find a reproduction).
2571
2572         * loader/DocumentThreadableLoader.cpp:
2573         (WebCore::DocumentThreadableLoader::loadRequest):
2574
2575 2017-02-14  Youenn Fablet  <youenn@apple.com>
2576
2577         [WebRTC] Remove obsolete WebRTC stats API
2578         https://bugs.webkit.org/show_bug.cgi?id=167910
2579
2580         Reviewed by Alex Christensen.
2581
2582         No change of behavior as removed constructs are not functional.
2583         Removing RTCStatsResponse which no longer exists and made RTCStatsReport an empty container for now.
2584
2585         * CMakeLists.txt:
2586         * DerivedSources.cpp:
2587         * DerivedSources.make:
2588         * Modules/mediastream/MediaEndpointPeerConnection.cpp:
2589         (WebCore::MediaEndpointPeerConnection::getStats):
2590         * Modules/mediastream/MediaEndpointPeerConnection.h:
2591         * Modules/mediastream/PeerConnectionBackend.h:
2592         * Modules/mediastream/RTCPeerConnection.cpp:
2593         (WebCore::RTCPeerConnection::getStats):
2594         * Modules/mediastream/RTCStatsReport.cpp:
2595         (WebCore::RTCStatsReport::create): Deleted.
2596         (WebCore::RTCStatsReport::RTCStatsReport): Deleted.
2597         (WebCore::RTCStatsReport::names): Deleted.
2598         (WebCore::RTCStatsReport::local): Deleted.
2599         (WebCore::RTCStatsReport::remote): Deleted.
2600         (WebCore::RTCStatsReport::addStatistic): Deleted.
2601         * Modules/mediastream/RTCStatsReport.h:
2602         (WebCore::RTCStatsReport::create):
2603         (WebCore::RTCStatsReport::timestamp): Deleted.
2604         (WebCore::RTCStatsReport::id): Deleted.
2605         (WebCore::RTCStatsReport::type): Deleted.
2606         (WebCore::RTCStatsReport::stat): Deleted.
2607         * Modules/mediastream/RTCStatsReport.idl:
2608         * Modules/mediastream/RTCStatsResponse.cpp: Removed.
2609         * Modules/mediastream/RTCStatsResponse.h: Removed.
2610         * Modules/mediastream/RTCStatsResponse.idl: Removed.
2611         * WebCore.xcodeproj/project.pbxproj:
2612         * platform/mediastream/MediaEndpoint.h:
2613         (WebCore::MediaEndpoint::getStats):
2614         * platform/mediastream/RTCStatsRequest.h: Removed.
2615         * platform/mediastream/RTCStatsResponseBase.h: Removed.
2616
2617 2017-02-14  Karim H  <karim@karhm.com>
2618
2619         Removed unused methods of WebCore::FileStream
2620         https://bugs.webkit.org/show_bug.cgi?id=168025
2621
2622         Reviewed by Michael Catanzaro.
2623
2624         * fileapi/AsyncFileStream.cpp:
2625         (WebCore::AsyncFileStream::openForWrite): Deleted.
2626         (WebCore::AsyncFileStream::write): Deleted.
2627         (WebCore::AsyncFileStream::truncate): Deleted.
2628         * fileapi/AsyncFileStream.h:
2629         * platform/FileStream.cpp:
2630         (WebCore::FileStream::openForWrite): Deleted.
2631         (WebCore::FileStream::write): Deleted.
2632         (WebCore::FileStream::truncate): Deleted.
2633         * platform/FileStream.h:
2634
2635 2017-02-14  Chris Dumez  <cdumez@apple.com>
2636
2637         HTML Form Validation bubble should take minimum font size setting into consideration
2638         https://bugs.webkit.org/show_bug.cgi?id=168271
2639         <rdar://problem/29869869>
2640
2641         Reviewed by Simon Fraser.
2642
2643         HTML Form Validation bubble should take minimum font size setting into consideration
2644         for better accessibility.
2645
2646         Test: fast/forms/validation-message-minimum-font-size.html
2647
2648         * platform/ValidationBubble.h:
2649         (WebCore::ValidationBubble::create):
2650         (WebCore::ValidationBubble::fontSize):
2651         * platform/ios/ValidationBubbleIOS.mm:
2652         (WebCore::ValidationBubble::ValidationBubble):
2653         * platform/mac/ValidationBubbleMac.mm:
2654         (WebCore::ValidationBubble::ValidationBubble):
2655         Update the ValidationBubble constructor to take in Settings. For now, there is a
2656         single setting that is the minimum font size and that is taken into account when
2657         setting the font size of the validation bubble text.
2658
2659 2017-02-14  Eric Carlson  <eric.carlson@apple.com>
2660
2661         [MediaStream] add navigator.getUserMedia for compatibility with legacy content
2662         https://bugs.webkit.org/show_bug.cgi?id=168324
2663         <rdar://problem/30513125>
2664
2665         Reviewed by Youenn Fablet.
2666
2667         Tests: fast/mediastream/argument-types.html
2668                fast/mediastream/getusermedia.html
2669                fast/mediastream/webkitGetUserMedia-shadowing-then.html
2670
2671         * CMakeLists.txt:
2672         * DerivedSources.cpp:
2673         * DerivedSources.make:
2674         * Modules/mediastream/MediaDevices.idl:
2675         * Modules/mediastream/NavigatorUserMedia.idl: Added.
2676         * Modules/mediastream/NavigatorUserMedia.js: Added.
2677         * WebCore.xcodeproj/project.pbxproj:
2678         * bindings/js/WebCoreBuiltinNames.h:
2679         * page/Navigator.idl:
2680
2681 2017-02-14  Chris Dumez  <cdumez@apple.com>
2682
2683         Fallback to legacy type only when event is trusted
2684         https://bugs.webkit.org/show_bug.cgi?id=168301
2685
2686         Reviewed by Ryosuke Niwa.
2687
2688         Fallback to legacy type only when event is trusted as per a recent
2689         DOM specification change:
2690         - https://github.com/whatwg/dom/issues/404
2691         - https://github.com/whatwg/dom/pull/406
2692
2693         No new tests, rebaselined existing test.
2694
2695         * dom/EventTarget.cpp:
2696         (WebCore::legacyType):
2697         (WebCore::EventTarget::fireEventListeners):
2698
2699 2017-02-13  Dean Jackson  <dino@apple.com>
2700
2701         Rename preferLowPowerToHighPerformance to powerPreference
2702         https://bugs.webkit.org/show_bug.cgi?id=168269
2703         <rdar://problem/30504444>
2704
2705         Reviewed by Chris Dumez.
2706
2707         Based on the discussion in https://github.com/KhronosGroup/WebGL/pull/2283.
2708
2709         Change WebGLContextAttributes's preferLowPowerToHighPerformance boolean
2710         into a powerPreference enum taking three values. The implementation
2711         of the enum is in GraphicsContext3DAttributes.
2712
2713         While the name and values have changed, there should be no change in
2714         behaviour caused by this patch.
2715
2716         * html/canvas/WebGLContextAttributes.h: Use GraphicsContext3DAttributes
2717         enum GraphicsContext3DPowerPreference.
2718         * html/canvas/WebGLContextAttributes.idl: Rename and add the WebIDL enum.
2719         * html/canvas/WebGLRenderingContextBase.cpp: Use the new values.
2720         (WebCore::WebGLRenderingContextBase::create):
2721         (WebCore::WebGLRenderingContextBase::registerWithWebGLStateTracker):
2722         * platform/WebGLStateTracker.cpp:
2723         * platform/WebGLStateTracker.h: Update the state tracker to use the new
2724         values.
2725         * platform/graphics/GraphicsContext3DAttributes.h:
2726         * platform/graphics/mac/GraphicsContext3DMac.mm:
2727         (WebCore::setPixelFormat): Accept GraphicsContext3DPowerPreference as a parameter.
2728         (WebCore::GraphicsContext3D::GraphicsContext3D):
2729
2730 2017-02-14  Youenn Fablet  <youennf@gmail.com>
2731
2732         [WebRTC] Implement description getters for libwebrtc RTCPeerConnection
2733         https://bugs.webkit.org/show_bug.cgi?id=168234
2734
2735         Reviewed by Alex Christensen.
2736
2737         Allows passing W3C webrtc tests.
2738
2739         Implementing localDescription/remoteDescription using libwebrtc backend.
2740         current and pending description getters are made the same as local/remote getters for the moment.
2741         This should be fixed when upgrading to latest libwebrtc revision.
2742
2743         * Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.cpp:
2744         (WebCore::toSessionDescriptionType):
2745         (WebCore::fromSessionDescriptionType):
2746         (WebCore::fromSessionDescription):
2747         (WebCore::LibWebRTCMediaEndpoint::localDescription):
2748         (WebCore::LibWebRTCMediaEndpoint::remoteDescription):
2749         (WebCore::LibWebRTCMediaEndpoint::doSetLocalDescription):
2750         (WebCore::LibWebRTCMediaEndpoint::doSetRemoteDescription):
2751         * Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.h:
2752         * Modules/mediastream/libwebrtc/LibWebRTCPeerConnectionBackend.cpp:
2753         (WebCore::LibWebRTCPeerConnectionBackend::localDescription):
2754         * Modules/mediastream/libwebrtc/LibWebRTCPeerConnectionBackend.h:
2755
2756 2017-02-14  Jeremy Jones  <jeremyj@apple.com>
2757
2758         When playing inline after fullscreen, set a flag instead of adding attribute plays inline, and use in requiresFullscreenForVideoPlayback.
2759         https://bugs.webkit.org/show_bug.cgi?id=167815
2760         rdar://problem/27685077
2761
2762         Reviewed by Jer Noble.
2763
2764         Test: media/media-fullscreen-loop-inline.html
2765
2766         When video is allowed to play inline after fullscreen. Looped video causes play state to update, which can send video back to fullscreen when
2767         allowsInline is false. This change will set a new flag when allowsInlineMediaPlaybackAfterFullscreen allows inline playback that can be tested
2768         in requiresFullscreenForVideoPlayback to prevent sending video back into fullscreen when video loops.
2769
2770         * html/HTMLMediaElement.cpp:
2771         (WebCore::HTMLMediaElement::enterFullscreen):
2772         (WebCore::HTMLMediaElement::exitFullscreen):
2773         * html/HTMLMediaElement.h:
2774         (WebCore::HTMLMediaElement::isTemporarilyAllowingInlinePlaybackAfterFullscreen): Added.
2775         * html/MediaElementSession.cpp:
2776         (WebCore::MediaElementSession::requiresFullscreenForVideoPlayback):
2777
2778 2017-02-14  Jer Noble  <jer.noble@apple.com>
2779
2780         Video elements with MediaSource objects set by srcObject are not cleared when srcObject is set to null
2781         https://bugs.webkit.org/show_bug.cgi?id=168268
2782
2783         Reviewed by Eric Carlson.
2784
2785         Test: fast/mediastream/MediaStream-MediaElement-setObject-null.html
2786
2787         Make the setSrcObject() operation compliant with the HTML spec. Since the specification defines
2788         srcObject in terms of either a MediaSource, MediaStream, or Blob object, add the variant typedef
2789         to HTMLMediaElement and move the definition out of the Modules/mediastream extension IDL and into
2790         HTMLMediaElement.idl. Then bring the "media elements load" and "resource selection" algorithms up
2791         to their most recent definitions in the HTML5 spec.
2792
2793         Drive-by fix: Allow the (admittedly weird) single-element-union type in IDL.
2794
2795         * CMakeLists.txt:
2796         * DerivedSources.cpp:
2797         * DerivedSources.make:
2798         * Modules/mediastream/HTMLMediaElementMediaStream.cpp: Removed.
2799         * Modules/mediastream/HTMLMediaElementMediaStream.h: Removed.
2800         * Modules/mediastream/HTMLMediaElementMediaStream.idl: Removed.
2801         * WebCore.xcodeproj/project.pbxproj:
2802         * bindings/scripts/IDLParser.pm:
2803         (parseUnionType):
2804         * html/HTMLAudioElement.cpp:
2805         (WebCore::HTMLAudioElement::createForJSConstructor):
2806         * html/HTMLMediaElement.cpp:
2807         (WebCore::actionName):
2808         (WebCore::HTMLMediaElement::parseAttribute):
2809         (WebCore::HTMLMediaElement::insertedInto):
2810         (WebCore::HTMLMediaElement::scheduleDelayedAction):
2811         (WebCore::HTMLMediaElement::scheduleNextSourceChild):
2812         (WebCore::HTMLMediaElement::pendingActionTimerFired):
2813         (WebCore::HTMLMediaElement::setSrcObject):
2814         (WebCore::HTMLMediaElement::load):
2815         (WebCore::HTMLMediaElement::prepareForLoad):
2816         (WebCore::HTMLMediaElement::selectMediaResource):
2817         (WebCore::HTMLMediaElement::loadResource):
2818         (WebCore::HTMLMediaElement::playInternal):
2819         (WebCore::HTMLMediaElement::pauseInternal):
2820         (WebCore::HTMLMediaElement::sourceWasAdded):
2821         (WebCore::HTMLMediaElement::clearMediaPlayer):
2822         (WebCore::HTMLMediaElement::resume):
2823         (WebCore::HTMLMediaElement::mediaCanStart):
2824         (WebCore::HTMLMediaElement::createMediaPlayer):
2825         (WebCore::HTMLMediaElement::loadInternal): Deleted.
2826         * html/HTMLMediaElement.h:
2827         (WebCore::HTMLMediaElement::srcObject):
2828         * html/HTMLMediaElement.idl:
2829         * platform/ContentType.h:
2830
2831 2017-02-14  Aakash Jain  <aakash_jain@apple.com>
2832
2833         Remove unused WebThreadContextIsCurrent method from WebCoreThread.h
2834         https://bugs.webkit.org/show_bug.cgi?id=168254
2835
2836         Reviewed by Dan Bernstein.
2837
2838         * platform/ios/wak/WebCoreThread.h: Removed unused WebThreadContextIsCurrent.
2839         * platform/ios/wak/WebCoreThread.mm:
2840         (WebThreadContextIsCurrent): Deleted.
2841
2842 2017-02-14  Alexey Proskuryakov  <ap@apple.com>
2843
2844         WebCore shouldn't export SystemMemory.h
2845         https://bugs.webkit.org/show_bug.cgi?id=168285
2846
2847         Reviewed by Alex Christensen.
2848
2849         * WebCore.xcodeproj/project.pbxproj:
2850
2851 2017-02-13  Filip Pizlo  <fpizlo@apple.com>
2852
2853         worker.postMessage should throw a TypeError if a SharedArrayBuffer is in the transfer list
2854         https://bugs.webkit.org/show_bug.cgi?id=168277
2855
2856         Reviewed by Mark Lam.
2857
2858         Test: workers/sab/postMessage-transfer-type-error.html
2859         
2860         This is a simple spec compliance change. The title says it all.
2861
2862         * bindings/js/SerializedScriptValue.cpp:
2863         (WebCore::SerializedScriptValue::create):
2864
2865 2017-02-14  Zan Dobersek  <zdobersek@igalia.com>
2866
2867         HTMLMediaElement: WebKitMediaKeys member name should be prefixed
2868         https://bugs.webkit.org/show_bug.cgi?id=168297
2869
2870         Reviewed by Xabier Rodriguez-Calvar.
2871
2872         Rename the LEGACY_ENCRYPTED_MEDIA m_mediaKeys variable to m_webkitMediaKeys
2873         so that it contains the legacy prefix, just like the API. This will make
2874         room for the MediaKeys member variable that will be implemented under
2875         the ENCRYPTED_MEDIA guards.
2876
2877         * html/HTMLMediaElement.cpp:
2878         (WebCore::HTMLMediaElement::mediaPlayerCachedKeyForKeyId):
2879         (WebCore::HTMLMediaElement::webkitSetMediaKeys):
2880         * html/HTMLMediaElement.h:
2881         (WebCore::HTMLMediaElement::webkitKeys):
2882
2883 2017-02-14  Carlos Garcia Campos  <cgarcia@igalia.com>
2884
2885         [GTK] Make DragImageRef a RefPtr instead of a plain pointer
2886         https://bugs.webkit.org/show_bug.cgi?id=168296
2887
2888         Reviewed by Sergio Villar Senin.
2889
2890         Use RefPtr<cairo_surface_t> as DragImageRef for GTK+ port to avoid memory leaks.
2891
2892         * platform/DragImage.h:
2893         * platform/gtk/DragImageGtk.cpp:
2894         (WebCore::dragImageSize):
2895         (WebCore::deleteDragImage):
2896         (WebCore::scaleDragImage):
2897         (WebCore::dissolveDragImageToFraction):
2898         (WebCore::createDragImageFromImage):
2899         (WebCore::createDragImageIconForCachedImageFilename):
2900
2901 2017-02-14  Vanessa Chipirrás Navalón  <vchipirras@igalia.com>
2902
2903         [GStreamer][MSE] Some GStreamer log messages are generated with the 'default' category
2904         https://bugs.webkit.org/show_bug.cgi?id=168015
2905
2906         Reviewed by Xabier Rodriguez-Calvar.
2907
2908         The elements AppendPipeline, PlaybackPipeline, MediaSourceClientGstreamerMSE do not have
2909         a defined Gstreamer log category, then the webkitmse category has been added to them.
2910         WebKitMediaSourceGstreamer has its own category but was not declared at the beginning of
2911         the .cpp file.
2912
2913         * platform/graphics/gstreamer/mse/AppendPipeline.cpp: Added webkitmse category.
2914         * platform/graphics/gstreamer/mse/MediaSourceClientGStreamerMSE.cpp:
2915         Added webkitmse category and gst header.
2916         * platform/graphics/gstreamer/mse/PlaybackPipeline.cpp: Added webkitmse category.
2917         * platform/graphics/gstreamer/mse/WebKitMediaSourceGStreamer.cpp:
2918         Added webkitmediasrc category.
2919
2920 2017-02-14  Carlos Garcia Campos  <cgarcia@igalia.com>
2921
2922         CookieManager only works with the default session
2923         https://bugs.webkit.org/show_bug.cgi?id=168229
2924
2925         Reviewed by Alex Christensen.
2926
2927         Update cookie observer API to use a std::function instead of a function pointer and make it work with multiple
2928         sessions in the backends that support it.
2929
2930         * platform/network/CookieStorage.h:
2931         * platform/network/cf/CookieStorageCFNet.cpp:
2932         (WebCore::cookieChangeCallbackMap):
2933         (WebCore::notifyCookiesChanged):
2934         (WebCore::startObservingCookieChanges):
2935         (WebCore::stopObservingCookieChanges):
2936         * platform/network/mac/CookieStorageMac.mm:
2937         (-[WebCookieStorageObjCAdapter startListeningForCookieChangeNotificationsWithCallback:]):
2938         (-[WebCookieStorageObjCAdapter stopListeningForCookieChangeNotifications]):
2939         (WebCore::startObservingCookieChanges):
2940         (WebCore::stopObservingCookieChanges):
2941         * platform/network/soup/CookieStorageSoup.cpp:
2942         (WebCore::cookieChangeCallbackMap):
2943         (WebCore::soupCookiesChanged):
2944         (WebCore::startObservingCookieChanges):
2945         (WebCore::stopObservingCookieChanges):
2946
2947 2017-02-13  Antoine Quint  <graouts@apple.com>
2948
2949         REGRESSION: Update volume and scrubbing slider to match HI designs
2950         https://bugs.webkit.org/show_bug.cgi?id=168170
2951         <rdar://problem/28095266>
2952
2953         Reviewed by Dean Jackson.
2954
2955         We bring the designs of the control's background materials, scrubber and
2956         volume slider up to spec.
2957
2958         The first important set of changes is that, on macOS, the materials and colors
2959         were incorrect. Buttons and time labels now set a mix-blend-mode to correctly
2960         appear vibrant against the media, and the controls bar, volume container
2961         and tracks menu now use a new BackgroundTint node to correctly apply both
2962         a backdrop-filter and blended tint above it.
2963
2964         The second important set of changes is the rendering of the sliders. Up to now
2965         we would simply style the <input type="range"> track and thumb, applying solid
2966         fills and strokes. We now draw sliders in two ways depending on the platform.
2967         
2968         On macOS, we draw the whole slider with a <canvas> element with "mix-blend-mode"
2969         set to "plus-lighter". On iOS, we draw the track as a <div> with "mix-blend-mode"
2970         set to "plus-darker" and draw the fill (up to the thumb) in the <canvas> with
2971         no blend mode to obtain a pure white color, finally the thumb is rendered by the
2972         <input> element. We couldn't draw the pure white color with the track in the
2973         same <canvas> due to the "plus-darker" blend mode.
2974
2975         Test: media/modern-media-controls/background-tint/background-tint.html
2976
2977         * Modules/modern-media-controls/controls/airplay-button.css:
2978         (button.airplay.on):
2979         * Modules/modern-media-controls/controls/background-tint.css: Added.
2980         (.background-tint):
2981         (.background-tint,):
2982         (.background-tint > .blur):
2983         (.background-tint > .tint):
2984         * Modules/modern-media-controls/controls/background-tint.js: Added.
2985         (BackgroundTint):
2986         * Modules/modern-media-controls/controls/ios-inline-media-controls.css:
2987         (.media-controls.ios.inline .scrubber.slider):
2988         (.media-controls.ios.inline .scrubber.slider > div):
2989         (.media-controls.ios.inline .scrubber.slider > input::-webkit-slider-thumb):
2990         (.media-controls.ios.inline .scrubber.slider > .fill): Deleted.
2991         * Modules/modern-media-controls/controls/macos-compact-inline-media-controls.css:
2992         (.media-controls.mac.inline.compact .volume-slider-container):
2993         (.media-controls.mac.inline.compact .volume.slider):
2994         (.media-controls.mac.inline.compact .scrubber.slider > input::-webkit-slider-thumb): Deleted.
2995         * Modules/modern-media-controls/controls/macos-fullscreen-media-controls.css:
2996         (.media-controls.mac.fullscreen > .controls-bar):
2997         (.media-controls.mac.fullscreen > .controls-bar > .background-tint > div):
2998         (.media-controls.mac.fullscreen .volume.slider):
2999         (.media-controls.mac.fullscreen button.volume-up):
3000         (.media-controls.mac.fullscreen button.rewind):
3001         (.media-controls.mac.fullscreen button.forward):
3002         (.media-controls.mac.fullscreen .buttons-container.right button):
3003         (.media-controls.mac.fullscreen .scrubber):
3004         (.media-controls.mac.fullscreen > .controls-bar button): Deleted.
3005         (.media-controls.mac.fullscreen button.airplay): Deleted.
3006         (.media-controls.mac.fullscreen button.aspect-ratio): Deleted.
3007         (.media-controls.mac.fullscreen button.pip): Deleted.
3008         (.media-controls.mac.fullscreen button.tracks): Deleted.
3009         (.media-controls.mac.fullscreen button.fullscreen): Deleted.
3010         * Modules/modern-media-controls/controls/macos-fullscreen-media-controls.js:
3011         * Modules/modern-media-controls/controls/macos-inline-media-controls.css:
3012         (.media-controls.mac.inline .scrubber.slider):
3013         (.media-controls.mac.inline .volume-slider-container):
3014         (.media-controls.mac.inline .volume-slider-container > .background-tint):
3015         (.media-controls.mac.inline .volume-slider-container > .background-tint > div):
3016         (.media-controls.mac.inline .volume.slider):
3017         (.media-controls.mac.inline button): Deleted.
3018         (.media-controls.mac.inline button:active): Deleted.
3019         (.media-controls.mac.inline > .controls-bar button): Deleted.
3020         (.media-controls.mac.inline > .controls-bar,): Deleted.
3021         (.media-controls.mac.inline .volume-slider-container:before): Deleted.
3022         * Modules/modern-media-controls/controls/macos-inline-media-controls.js:
3023         (MacOSInlineMediaControls.prototype.layout):
3024         * Modules/modern-media-controls/controls/macos-media-controls.css: Added.
3025         (.media-controls.mac button:active):
3026         (.media-controls.mac > .controls-bar button):
3027         (.media-controls.mac > .controls-bar .time-label):
3028         (.media-controls.mac > .controls-bar .slider > canvas):
3029         (.media-controls.mac > .controls-bar .slider > input::-webkit-slider-thumb):
3030         * Modules/modern-media-controls/controls/scrubber.css: Removed.
3031         * Modules/modern-media-controls/controls/scrubber.js:
3032         (Scrubber):
3033         (Scrubber.prototype.get buffered):
3034         (Scrubber.prototype.set buffered):
3035         (Scrubber.prototype.draw):
3036         (Scrubber.prototype._drawMacOS):
3037         (Scrubber.prototype._drawiOS):
3038         * Modules/modern-media-controls/controls/slider.css:
3039         (.slider):
3040         (.slider > canvas,):
3041         (.slider > canvas):
3042         (.slider > input):
3043         (.slider > input,): Deleted.
3044         (.slider > .fill): Deleted.
3045         (.slider > input::-webkit-slider-thumb): Deleted.
3046         * Modules/modern-media-controls/controls/slider.js:
3047         (Slider.prototype.set value):
3048         (Slider.prototype.set width):
3049         (Slider.prototype.commitProperty):
3050         (Slider.prototype.layout):
3051         (Slider.prototype.draw):
3052         (Slider.prototype._handleInputEvent):
3053         (Slider.prototype._handleChangeEvent):
3054         (addRoundedRect):
3055         (Slider.prototype._updateFill): Deleted.
3056         * Modules/modern-media-controls/controls/start-button.css:
3057         (button.start):
3058         * Modules/modern-media-controls/controls/time-control.js:
3059         * Modules/modern-media-controls/controls/time-label.css:
3060         (.time-label):
3061         * Modules/modern-media-controls/controls/tracks-panel.css:
3062         (.tracks-panel):
3063         (.tracks-panel > .background-tint > div):
3064         (.tracks-panel > section):
3065         (.tracks-panel > section:first-of-type):
3066         (.tracks-panel > section > h3):
3067         (.tracks-panel > section > ul):
3068         (.tracks-panel > section > ul > li):
3069         (.tracks-panel > section > ul > li:focus):
3070         (.tracks-panel > section > ul > li.selected:before):
3071         (.tracks-panel > section > ul > li.animated):
3072         (.tracks-panel-section): Deleted.
3073         (.tracks-panel-section:first-of-type): Deleted.
3074         (.tracks-panel-section > h3): Deleted.
3075         (.tracks-panel-section > ul): Deleted.
3076         (.tracks-panel-section > ul > li): Deleted.
3077         (.tracks-panel-section > ul > li:focus): Deleted.
3078         (.tracks-panel-section > ul > li.selected:before): Deleted.
3079         (.tracks-panel-section > ul > li.animated): Deleted.
3080         * Modules/modern-media-controls/controls/tracks-panel.js:
3081         (TracksPanel.prototype._childrenFromDataSource):
3082         (TracksPanel.prototype._childrenFromDataSource.): Deleted.
3083         * Modules/modern-media-controls/controls/volume-slider.js:
3084         (VolumeSlider):
3085         (VolumeSlider.prototype.handleEvent):
3086         (VolumeSlider.prototype.draw):
3087         * Modules/modern-media-controls/js-files:
3088         * Modules/modern-media-controls/media/scrubbing-support.js:
3089         (ScrubbingSupport.prototype.get mediaEvents):
3090         (ScrubbingSupport.prototype.syncControl):
3091         (ScrubbingSupport):
3092
3093 2017-02-13  Alex Christensen  <achristensen@webkit.org>
3094
3095         URLs with an invalid IPv4 address should be invalid
3096         https://bugs.webkit.org/show_bug.cgi?id=168260
3097
3098         Reviewed by Tim Horton.
3099
3100         All URL hosts are fed through the IPv4 parser.  https://webkit.org/ doesn't
3101         look enough like an IPv4 address to be considered an invalid IPv4 address, so 
3102         we continue to the String host processing.  http://127.0.0.257 does, though, and
3103         according to https://url.spec.whatwg.org/#concept-ipv4-parser parsing that URL
3104         should fail.
3105
3106         Covered by newly passing web platform tests.
3107
3108         * platform/URLParser.cpp:
3109         (WebCore::URLParser::parseIPv4Host):
3110         (WebCore::URLParser::parseHostAndPort):
3111         * platform/URLParser.h:
3112
3113 2017-02-13  Dan Bernstein  <mitz@apple.com>
3114
3115         Reverted r212275. It still breaks some Apple-internal builds.
3116
3117         * platform/spi/mac/TUCallSPI.h:
3118
3119 2017-02-13  Joseph Pecoraro  <pecoraro@apple.com>
3120
3121         Address ESLint warnings in modern-media-controls
3122         https://bugs.webkit.org/show_bug.cgi?id=168224
3123
3124         Reviewed by Alexey Proskuryakov.
3125
3126         * Modules/modern-media-controls/controls/controls-bar.js:
3127         * Modules/modern-media-controls/controls/fullscreen-button.js:
3128         * Modules/modern-media-controls/controls/layout-node.js:
3129         * Modules/modern-media-controls/controls/macos-fullscreen-media-controls.js:
3130         * Modules/modern-media-controls/controls/media-controls.js:
3131         * Modules/modern-media-controls/controls/scheduler.js:
3132         * Modules/modern-media-controls/controls/seek-button.js:
3133         * Modules/modern-media-controls/controls/tracks-panel.js:
3134         * Modules/modern-media-controls/controls/volume-slider.js:
3135         * Modules/modern-media-controls/gesture-recognizers/gesture-recognizer.js:
3136         * Modules/modern-media-controls/gesture-recognizers/pinch.js:
3137         * Modules/modern-media-controls/media/fullscreen-support.js:
3138         * Modules/modern-media-controls/media/media-controller.js:
3139         * Modules/modern-media-controls/media/placard-support.js:
3140         * Modules/modern-media-controls/media/status-support.js:
3141         Address pedantic warnings.
3142
3143 2017-02-13  Dan Bernstein  <mitz@apple.com>
3144
3145         Restored changes from r212210 in a way that does not break the build.
3146
3147         * platform/spi/mac/TUCallSPI.h:
3148
3149 2017-02-13  Zalan Bujtas  <zalan@apple.com>
3150
3151         FontCascade::widthForSimpleText should skip applyTransforms() when kerning and ligatures are off.
3152         https://bugs.webkit.org/show_bug.cgi?id=168251
3153         <rdar://problem/30498102>
3154
3155         Reviewed by Antti Koivisto.
3156
3157         Covered by existing (perf)tests.
3158
3159         * platform/graphics/FontCascade.cpp:
3160         (WebCore::FontCascade::widthForSimpleText):
3161
3162 2017-02-12  Brian Burg  <bburg@apple.com>
3163
3164         Web Inspector: expose system user interface layout direction through InspectorFrontendHost
3165         https://bugs.webkit.org/show_bug.cgi?id=168209
3166         <rdar://problem/11573736>
3167
3168         Reviewed by Joseph Pecoraro.
3169
3170         Forward the UserInterfaceLayoutDirection of the inspector page. If the WebKit client has
3171         properly set the UI directionality from system settings in PageClient, this will get inherited
3172         automatically by the Inspector's WebPage instance.
3173
3174         * inspector/InspectorFrontendClient.h:
3175         * inspector/InspectorFrontendClientLocal.cpp:
3176         (WebCore::InspectorFrontendClientLocal::userInterfaceLayoutDirection):
3177         * inspector/InspectorFrontendClientLocal.h:
3178
3179         * inspector/InspectorFrontendHost.h:
3180         * inspector/InspectorFrontendHost.idl:
3181         * inspector/InspectorFrontendHost.cpp:
3182         (WebCore::InspectorFrontendHost::userInterfaceLayoutDirection):
3183         Expose the directionality to the frontend as "ltr" or "rtl" strings.
3184
3185 2017-02-13  Zalan Bujtas  <zalan@apple.com>
3186
3187         Simple line layout: Do not measure runs with trailing whitespace when kerning and ligatures are off.
3188         https://bugs.webkit.org/show_bug.cgi?id=168247
3189         <rdar://problem/30497288>
3190
3191         Reviewed by Antti Koivisto.
3192
3193         The width of the run is supposed to be the same with or without the trailing whitespace.
3194
3195         Covered by performance test.
3196
3197         * rendering/SimpleLineLayoutTextFragmentIterator.cpp:
3198         (WebCore::SimpleLineLayout::TextFragmentIterator::Style::Style):
3199         (WebCore::SimpleLineLayout::TextFragmentIterator::textWidth):
3200         * rendering/SimpleLineLayoutTextFragmentIterator.h:
3201
3202 2017-02-13  Karim H  <karim@karhm.com>
3203
3204         Added the other missing BSTR roles tag names.
3205         https://bugs.webkit.org/show_bug.cgi?id=165545
3206
3207         Reviewed by Chris Fleizach.
3208
3209         Test: accessibility/win/bstr-elements-role.html
3210
3211         * accessibility/AccessibilityRenderObject.cpp:
3212         (WebCore::shouldReturnTagNameAsRoleForMSAA):
3213
3214 2017-02-13  Youenn Fablet  <youennf@gmail.com>
3215
3216         [WebRTC] Creating RTCPeerConnection with libwebrtc backend is crashing on rwt
3217         https://bugs.webkit.org/show_bug.cgi?id=168250
3218
3219         Reviewed by Alex Christensen.
3220
3221         Covered by webrtc tests in LayoutTests and in web-platform-tests.
3222         Making mock peer connection factory keep a ref of the real libwebrtc peer connection factory.
3223         That way, it can create real libwebrtc backends whenever requested by tests.
3224
3225         Moving LibWebRTCUtils.h routines as static LibWebRTCProvider methods.
3226         In the future, we should make them no longer static.
3227
3228         * Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.cpp:
3229         (WebCore::LibWebRTCMediaEndpoint::doCreateOffer):
3230         (WebCore::LibWebRTCMediaEndpoint::doCreateAnswer):
3231         * Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.h:
3232         * WebCore.xcodeproj/project.pbxproj:
3233         * platform/mediastream/libwebrtc/LibWebRTCProvider.cpp: Renamed from Source/WebCore/platform/mediastream/libwebrtc/LibWebRTCUtils.cpp.
3234         (WebCore::LibWebRTCProvider::callOnWebRTCNetworkThread):
3235         (WebCore::LibWebRTCProvider::callOnWebRTCSignalingThread):
3236         (WebCore::LibWebRTCProvider::factory):
3237         (WebCore::LibWebRTCProvider::setPeerConnectionFactory):
3238         (WebCore::createActualPeerConnection):
3239         (WebCore::LibWebRTCProvider::createPeerConnection):
3240         * platform/mediastream/libwebrtc/LibWebRTCProvider.h:
3241         * platform/mediastream/libwebrtc/LibWebRTCUtils.h: Removed.
3242         * platform/mediastream/mac/RealtimeOutgoingAudioSource.cpp:
3243         (WebCore::RealtimeOutgoingAudioSource::audioSamplesAvailable):
3244         * testing/Internals.cpp:
3245         * testing/MockLibWebRTCPeerConnection.cpp:
3246         (WebCore::useMockRTCPeerConnectionFactory):
3247         (WebCore::MockLibWebRTCPeerConnectionForIceCandidates::gotLocalDescription):
3248         (WebCore::releaseInNetworkThread):
3249         (WebCore::MockLibWebRTCPeerConnection::SetLocalDescription):
3250         (WebCore::MockLibWebRTCPeerConnection::SetRemoteDescription):
3251         (WebCore::MockLibWebRTCPeerConnection::CreateOffer):
3252         (WebCore::MockLibWebRTCPeerConnection::CreateAnswer):
3253
3254 2017-02-13  Anders Carlsson  <andersca@apple.com>
3255
3256         Simplify DragController::startDrag
3257         https://bugs.webkit.org/show_bug.cgi?id=168240
3258
3259         Reviewed by Tim Horton.
3260
3261         Use early returns instead of assigning to a variable that's returned at the end of the function.
3262
3263         * page/DragController.cpp:
3264         (WebCore::DragController::startDrag):
3265
3266 2017-02-13  Said Abou-Hallawa  <sabouhallawa@apple.com>
3267
3268         The current frame of an image should not deleted if another frame is asynchronously being decoded
3269         https://bugs.webkit.org/show_bug.cgi?id=167618
3270
3271         Reviewed by Simon Fraser.
3272
3273         Test: fast/images/animated-image-draw-while-decode.html
3274
3275         If the memory cache asks the BitmapImage to destroy all its frames while
3276         the next frame is being decoded, a thread contention may happen. This can
3277         happen when BitmapImage::draw() is called and the next frame is not ready
3278         yet for drawing, so the current frame has to be drawn. This will invoke
3279         a frame decoding in the same image from the drawing committing thread.
3280
3281         We can avoid that by destroying all the frames except the current frame if
3282         the image is asynchronously decoding its frames. This should not add extra
3283         memory overhead because building the image frame cache and then destroying
3284         it, when needed, is an on-going process. The frames will be allocated and
3285         decoded all the time and all of them can be destroyed except the current one.
3286         
3287         * platform/graphics/BitmapImage.cpp:
3288         (WebCore::BitmapImage::destroyDecodedData):
3289         (WebCore::BitmapImage::destroyDecodedDataIfNecessary):
3290         The logic of destroying the ImageFrames was split among BitmapImage, ImageSource
3291         and ImageFrameCache. Move all the logic to BitmapImage and have ImageFrameCache
3292         be responsible only for destroying a range of ImageFrames.
3293
3294         (WebCore::BitmapImage::draw): add an ASSERT_IMPLIES to ensure the current frame
3295         is ready to be rendered if the next frame is being decoded.
3296         
3297         * platform/graphics/BitmapImage.h: Move a const from ImageFrameCache.h to BitmapImage.h.
3298
3299         * platform/graphics/ImageFrameCache.cpp:
3300         (WebCore::ImageFrameCache::destroyDecodedData):
3301         (WebCore::ImageFrameCache::destroyDecodedDataIfNecessary): Deleted.
3302         * platform/graphics/ImageFrameCache.h:
3303         (WebCore::ImageFrameCache::destroyAllDecodedData):
3304         (WebCore::ImageFrameCache::destroyAllDecodedDataExcludeFrame):
3305         (WebCore::ImageFrameCache::destroyDecodedDataBeforeFrame):
3306         Make ImageFrameCache be responsible for destroying a range of ImageFrames.
3307         This range might include all the frames, all the frames but up to a specific
3308         frame, or all the frames but exclude one frame in the middle.
3309         
3310         * platform/graphics/ImageSource.cpp:
3311         (WebCore::ImageSource::clear): No need to call clearFrameBufferCache() from clear().
3312         The decision to call clearFrameBufferCache() or clear() is moved to
3313         BitmapImage::destroyDecodedData().
3314          
3315         (WebCore::ImageSource::destroyDecodedData): Deleted.
3316         (WebCore::ImageSource::destroyDecodedDataIfNecessary): Deleted.
3317         These functions are replaced by another set of functions in ImageSource.h.
3318         
3319         * platform/graphics/ImageSource.h:
3320         (WebCore::ImageSource::destroyAllDecodedData):
3321         (WebCore::ImageSource::destroyAllDecodedDataExcludeFrame):
3322         (WebCore::ImageSource::destroyDecodedDataBeforeFrame):
3323         (WebCore::ImageSource::hasDecodingQueue):
3324         These are new wrappers which call the corresponding ImageFrameCache functions.
3325
3326 2017-02-13  Myles C. Maxfield  <mmaxfield@apple.com>
3327
3328         [Cocoa] Stop soft-linking CTRunGetBaseAdvancesAndOrigins()
3329         https://bugs.webkit.org/show_bug.cgi?id=168256
3330
3331         Reviewed by Alex Christensen.
3332
3333         Use of this function is already behind a platform guard.
3334
3335         No new tests because there is no behavior change.
3336
3337         * platform/graphics/mac/ComplexTextControllerCoreText.mm:
3338         (SOFT_LINK): Deleted.
3339
3340 2017-02-13  Jiewen Tan  <jiewen_tan@apple.com>
3341
3342         [WebCrypto] WebInspector should indicate webkitSubtle is deprecated
3343         https://bugs.webkit.org/show_bug.cgi?id=165913
3344         <rdar://problem/30477222>
3345
3346         Reviewed by Joseph Pecoraro.
3347
3348         Covered by existing tests.
3349
3350         * page/Crypto.cpp:
3351         (WebCore::Crypto::webkitSubtle):
3352
3353 2017-02-13  Simon Fraser  <simon.fraser@apple.com>
3354
3355         Call WKDestroyRenderingResources() on iOS when tabs are backgrounded
3356         https://bugs.webkit.org/show_bug.cgi?id=168261
3357         rdar://problem/30481079
3358
3359         Reviewed by Tim Horton.
3360
3361         Add CABackingStoreCollectBlocking() to QuartzCoreSPI.h, and fix files in WebCore
3362         that do a framework include.
3363
3364         * platform/graphics/cocoa/TextTrackRepresentationCocoa.mm:
3365         * platform/graphics/cocoa/WebActionDisablingCALayerDelegate.h:
3366         * platform/spi/cocoa/QuartzCoreSPI.h:
3367         * platform/spi/mac/NSViewSPI.h:
3368
3369 2017-02-13  Youenn Fablet  <youenn@apple.com>
3370
3371         ASSERTION FAILED: !m_bodyLoader
3372         https://bugs.webkit.org/show_bug.cgi?id=166986
3373
3374         Reviewed by Sam Weinig.
3375
3376         Refactoring to make the unset/set pending activity part of body loader.
3377         This allows ensuring to not forget to do that by simply deleting the body loader.
3378
3379         * Modules/fetch/FetchResponse.cpp:
3380         (WebCore::FetchResponse::fetch):
3381         (WebCore::FetchResponse::BodyLoader::didSucceed):
3382         (WebCore::FetchResponse::BodyLoader::didFail):
3383         (WebCore::FetchResponse::BodyLoader::BodyLoader):
3384         (WebCore::FetchResponse::BodyLoader::~BodyLoader):
3385         (WebCore::FetchResponse::stop):
3386         * Modules/fetch/FetchResponse.h:
3387
3388 2017-02-13  Aakash Jain  <aakash_jain@apple.com>
3389
3390         Remove unused WebCoreThreadSafe.h
3391         https://bugs.webkit.org/show_bug.cgi?id=168236
3392
3393         Reviewed by Dan Bernstein.
3394
3395         * platform/ios/wak/WebCoreThreadSafe.h: Removed.
3396         * WebCore.xcodeproj/project.pbxproj: Removed WebCoreThreadSafe.h
3397         * platform/ios/wak/WebCoreThread.mm: Removed WebCoreThreadSafe.h and included WAKWindow.h directly
3398
3399 2017-02-13  Anders Carlsson  <andersca@apple.com>
3400
3401         Fix iOS build.
3402
3403         * platform/ios/DragImageIOS.mm:
3404         (WebCore::deleteDragImage):
3405
3406 2017-02-13  Sam Weinig  <sam@webkit.org>
3407
3408         Rename MediaQueryExp.h/cpp to MediaQueryExpression.h/cpp
3409         https://bugs.webkit.org/show_bug.cgi?id=168249
3410
3411         Reviewed by Dean Jackson.
3412
3413         Fix a FIXME and rename MediaQueryExp.h/cpp to match the class it contains, MediaQueryExpression.
3414
3415         * CMakeLists.txt:
3416         * WebCore.xcodeproj/project.pbxproj:
3417         * css/CSSAllInOne.cpp:
3418         * css/MediaQuery.h:
3419         * css/MediaQueryEvaluator.h:
3420         * css/MediaQueryExp.cpp: Removed.
3421         * css/MediaQueryExp.h: Removed.
3422         * css/MediaQueryExpression.cpp: Copied from Source/WebCore/css/MediaQueryExp.cpp.
3423         * css/MediaQueryExpression.h: Copied from Source/WebCore/css/MediaQueryExp.h.
3424         * css/parser/MediaQueryParser.h:
3425
3426 2017-02-13  Aakash Jain  <aakash_jain@apple.com>
3427
3428         WAKResponder should be exported from WebCore
3429         https://bugs.webkit.org/show_bug.cgi?id=168245
3430
3431         Reviewed by Dan Bernstein.
3432
3433         * platform/ios/wak/WAKResponder.h:
3434
3435 2017-02-13  Simon Fraser  <simon.fraser@apple.com>
3436
3437         Log to the History Channel in a few more places
3438         https://bugs.webkit.org/show_bug.cgi?id=168252
3439
3440         Reviewed by Brady Eidson.
3441
3442         *** Aliens ***
3443
3444         * loader/HistoryController.cpp:
3445         (WebCore::HistoryController::restoreScrollPositionAndViewState):
3446         (WebCore::HistoryController::updateForReload):
3447         * loader/NavigationScheduler.cpp:
3448         (WebCore::NavigationScheduler::scheduleHistoryNavigation):
3449         (WebCore::NavigationScheduler::timerFired):
3450         (WebCore::NavigationScheduler::cancel):
3451         * page/History.cpp:
3452         (WebCore::History::go):
3453
3454 2017-02-13  Alex Christensen  <achristensen@webkit.org>
3455
3456         Percent should be allowed in non-special URL hosts
3457         https://bugs.webkit.org/show_bug.cgi?id=168255
3458
3459         Reviewed by Tim Horton.
3460
3461         In the last few weeks, the spec has consolidated its sets of code points.
3462         Now forbidden host code points replace the old invalid host code points with
3463         the modification that percents are allowed in non-special hosts because we
3464         percent-encode non-ascii code points in non-special hosts.
3465         See https://url.spec.whatwg.org/#concept-opaque-host-parser
3466
3467         Covered by newly passing web platform tests.
3468
3469         * platform/URLParser.cpp:
3470         (WebCore::isC0Control):
3471         (WebCore::isInUserInfoEncodeSet):
3472         (WebCore::URLParser::hasForbiddenHostCodePoint):
3473         (WebCore::URLParser::parseHostAndPort):
3474         (WebCore::isInvalidDomainCharacter): Deleted.
3475         (WebCore::URLParser::hasInvalidDomainCharacter): Deleted.
3476         * platform/URLParser.h:
3477
3478 2017-02-13  Anders Carlsson  <andersca@apple.com>
3479
3480         Fix Windows build.
3481
3482         * platform/win/PasteboardWin.cpp:
3483         (WebCore::Pasteboard::setDragImage):
3484
3485 2017-02-13  Alex Christensen  <achristensen@webkit.org>
3486
3487         Fix Yosemite build after r211765
3488         https://bugs.webkit.org/show_bug.cgi?id=168246
3489         <rdar://problem/30494174>
3490
3491         Reviewed by Brady Eidson.
3492
3493         * platform/graphics/mac/ComplexTextControllerCoreText.mm:
3494         (SOFT_LINK):
3495
3496 2017-02-13  Anders Carlsson  <andersca@apple.com>
3497
3498         Add a DragImage class that wraps a DragImageRef
3499         https://bugs.webkit.org/show_bug.cgi?id=168131
3500
3501         Reviewed by Beth Dakin.
3502
3503         This allows us to get rid of the explicit deleteDragImage calls and will make additional cleanup of the
3504         various drag code paths possible. No functionality change.
3505
3506         * dom/DataTransfer.cpp:
3507         (WebCore::DataTransfer::updateDragImage):
3508         * page/DragController.cpp:
3509         (WebCore::DragController::startDrag):
3510         (WebCore::DragController::doImageDrag):
3511         (WebCore::DragController::doSystemDrag):
3512         * page/DragController.h:
3513         * platform/DragImage.cpp:
3514         (WebCore::DragImage::DragImage):
3515         (WebCore::DragImage::operator=):
3516         (WebCore::DragImage::~DragImage):
3517         * platform/DragImage.h:
3518         * platform/Pasteboard.h:
3519         * platform/StaticPasteboard.h:
3520         * platform/mac/PasteboardMac.mm:
3521         (WebCore::Pasteboard::setDragImage):
3522
3523 2017-02-13  Chris Dumez  <cdumez@apple.com>
3524
3525         Regression(r211455): ASSERTION FAILED: frameView || pageCacheState() == InPageCache in com.apple.WebCore: WebCore::Document::destroyRenderTree
3526         https://bugs.webkit.org/show_bug.cgi?id=168237
3527         <rdar://problem/30494165>
3528
3529         Reviewed by Gavin Barraclough.
3530
3531         Drop bad assertion under document::destroyRenderTree() that was introduced in r211455.
3532         The assertion seemed like a good idea but the issue is that CachedFrame::destroy()
3533         reset's the document's pageCacheState before calling Document::prepareForDestruction().
3534
3535         No new tests, this fixes assertion hits on our bots.
3536
3537         * dom/Document.cpp:
3538         (WebCore::Document::destroyRenderTree):
3539
3540 2017-02-13  Myles C. Maxfield  <mmaxfield@apple.com>
3541
3542         Update custom line breaking iterators to the latest version of Unicode
3543         https://bugs.webkit.org/show_bug.cgi?id=168182
3544
3545         Reviewed by Zalan Bujtas.
3546
3547         Clean up our breaking code to be more descriptive about the difference between
3548         line-break: auto vs line-break: loose | normal | strict. The only difference is
3549         that we have some hardcoded tables to speed up character iteration for
3550         line-break: auto.
3551
3552         Tests: TestWebKitAPI WebKit2.LineBreaking
3553
3554         * rendering/BreakLines.h:
3555         (WebCore::nextBreakablePosition):
3556         (WebCore::nextBreakablePositionIgnoringNBSP):
3557         (WebCore::nextBreakablePositionWithoutShortcut):
3558         (WebCore::nextBreakablePositionIgnoringNBSPWithoutShortcut):
3559         (WebCore::isBreakable):
3560         (WebCore::nextBreakablePositionNonLoosely): Deleted.
3561         (WebCore::nextBreakablePositionLoosely): Deleted.
3562         (WebCore::nextBreakablePositionLoose): Deleted.
3563         (WebCore::nextBreakablePositionIgnoringNBSPLoose): Deleted.
3564         * rendering/RenderText.cpp:
3565         (WebCore::RenderText::computePreferredLogicalWidths):
3566         * rendering/SimpleLineLayoutTextFragmentIterator.cpp:
3567         (WebCore::SimpleLineLayout::nextBreakablePositionInSegment):
3568         * rendering/line/BreakingContext.h:
3569         (WebCore::BreakingContext::handleText):
3570         (WebCore::BreakingContext::optimalLineBreakLocationForTrailingWord):
3571
3572 2017-02-13  Youenn Fablet  <youenn@apple.com>
3573
3574         Remove @getUserMedia identifier
3575         https://bugs.webkit.org/show_bug.cgi?id=168216
3576
3577         Reviewed by Sam Weinig.
3578
3579         No change of behavior.
3580
3581         * Modules/mediastream/MediaDevices.idl:
3582         * bindings/js/WebCoreBuiltinNames.h:
3583
3584 2017-02-13  Carlos Garcia Campos  <cgarcia@igalia.com>
3585
3586         [GTK] Non-accelerated drawing is broken with HiDPI
3587         https://bugs.webkit.org/show_bug.cgi?id=168128
3588
3589         Reviewed by Michael Catanzaro.
3590
3591         When device scale factor changes, the page notifies the page overlay controller about it. Then overlay root
3592         layers are created to be notified about the device scale factor. That causes us to enter in accelerated
3593         compositing mode, because the graphics layer factory is called. But the render layer compositor doesn't really
3594         enter in accelerated mode, because there aren't page overlays, the accelerated mode is not forced and the website
3595         doesn't require acceleration either. This leaves our drawing area in an inconsistent state, it thinks it's in AC
3596         mode because it has a layer tree host, but without a root layer attached, so nothing is rendered. The page
3597         overlay controller doesn't need to create the layers when device scale factor changes, when an overlay is
3598         installed, layers will be created with the current device scale factor anyway.
3599
3600         * page/PageOverlayController.cpp:
3601         (WebCore::PageOverlayController::didChangeDeviceScaleFactor): Return early if not initialized yet.
3602
3603 2017-02-13  Csaba Osztrogonác  <ossy@webkit.org>
3604
3605         REGRESSION(r210845) Build broken with ENABLE_MHTML disabled
3606         https://bugs.webkit.org/show_bug.cgi?id=167771
3607
3608         Reviewed by Daniel Bates.
3609
3610         * loader/DocumentLoader.cpp:
3611         (WebCore::DocumentLoader::commitData):
3612
3613 2017-02-12  Dan Bernstein  <mitz@apple.com>
3614
3615         Tried to fix USE(APPLE_INTERNAL_SDK) builds after r212211.
3616
3617         * platform/spi/mac/TUCallSPI.h: Reverted to r212210.
3618
3619 2017-02-12  Dan Bernstein  <mitz@apple.com>
3620
3621         Tried to fix USE(APPLE_INTERNAL_SDK) builds after r212211.
3622
3623         * platform/spi/mac/TUCallSPI.h:
3624
3625 2017-02-12  Dan Bernstein  <mitz@apple.com>
3626
3627         Tried to fix USE(APPLE_INTERNAL_SDK) builds after r212211.
3628
3629         * platform/spi/mac/TUCallSPI.h:
3630
3631 2017-02-12  Dan Bernstein  <mitz@apple.com>
3632
3633         Tried to fix USE(APPLE_INTERNAL_SDK) builds after r212211.
3634
3635         * platform/spi/mac/NSMenuSPI.h: Replaced declaration of deprecated method with its current
3636           equivalent.
3637
3638 2017-02-12  Dan Bernstein  <mitz@apple.com>
3639
3640         Tried to fix USE(APPLE_INTERNAL_SDK) builds after r212211.
3641
3642         * platform/spi/mac/NSImmediateActionGestureRecognizerSPI.h:
3643
3644 2017-02-12  Ryosuke Niwa  <rniwa@webkit.org>
3645
3646         parserRemoveChild should unload subframes
3647         https://bugs.webkit.org/show_bug.cgi?id=168151
3648
3649         Reviewed by Darin Adler.
3650
3651         Fix the bug that the adoption agency algorithm does not unload subframes as it disconnects nodes.
3652
3653         Also moved calls to nodeWillBeRemoved inside NoEventDispatchAssertion to expand on r211965.
3654
3655         Tests: fast/parser/adoption-agency-clear-focus-range.html
3656                fast/parser/adoption-agency-unload-iframe-1.html
3657                fast/parser/adoption-agency-unload-iframe-2.html
3658
3659         * dom/ContainerNode.cpp:
3660         (WebCore::ContainerNode::takeAllChildrenFrom): Rewritten using idioms used in removeChildren and parserAppendChild.
3661
3662         Disconnect all subframes first since this can synchronously dispatch an unload event. Then update DOM ranges,
3663         the focused element, and other states in the document.
3664
3665         Second, use the regular removeBetween, notifyChildNodeRemoved, childrenChanged sequence of calls to disconnect nodes
3666         instead of a single call to removeDetachedChildren to properly disconnect child nodes since those nodes may have
3667         already come live due to execution of synchronous scripts prior to the adoption agency algorithm has run, or in
3668         response to the unload event we just dispatched.
3669
3670         Third, append these nodes using parserAppendChild to avoid dispatching mutation events.
3671
3672         (WebCore::willRemoveChild): Removed the call to nodeWillBeRemoved. It's now called within NoEventDispatchAssertion
3673         in each call site of willRemoveChild and willRemoveChildren.
3674         (WebCore::willRemoveChildren): Ditto.
3675         (WebCore::ContainerNode::removeChild): Call nodeWillBeRemoved inside NoEventDispatchAssertion.
3676         (WebCore::ContainerNode::replaceAllChildren): Call nodeWillBeRemoved inside NoEventDispatchAssertion.
3677         (WebCore::ContainerNode::parserRemoveChild): Disconnect subframes and update document's states.
3678
3679         * html/parser/HTMLConstructionSite.cpp:
3680         (WebCore::executeTakeAllChildrenAndReparentTask): Add a release assert that new parent does not already have a parent. 
3681
3682 2017-02-12  Ryosuke Niwa  <rniwa@webkit.org>
3683
3684         REGRESSION (r179497): Crash inside setAttributeNode
3685         https://bugs.webkit.org/show_bug.cgi?id=168161
3686         <rdar://problem/30451581>
3687
3688         Reviewed by Andreas Kling.
3689
3690         The bug was caused by setAttributeNode calling setAttributeInternal with the same element data as the one used
3691         to call removeAttributeInternal despite of the fact removeAttributeInternal could have invoked arbitrary scripts
3692         and mutated element's m_elementData.
3693
3694         Fixed the bug by calling with setAttributeInternal with the result of new invocation of ensureUniqueElementData().
3695
3696         Test: fast/dom/Attr/make-unique-element-data-while-replacing-attr.html
3697
3698         * dom/Element.cpp:
3699         (WebCore::Element::setAttributeNode):
3700
3701 2017-02-12  Ryosuke Niwa  <rniwa@webkit.org>
3702
3703         Rebaseline bindings tests after r212207.
3704
3705         * bindings/scripts/test/JS/JSTestObj.cpp:
3706         * bindings/scripts/test/JS/JSTestOverloadedConstructorsWithSequence.cpp:
3707
3708 2017-02-12  Dan Bernstein  <mitz@apple.com>
3709
3710         [Cocoa] Some -respondsToSelector: checks are unnecessary
3711         https://bugs.webkit.org/show_bug.cgi?id=168183
3712
3713         Reviewed by Tim Horton.
3714
3715         * English.lproj/Localizable.strings: Removed a string that’s no longer needed after the
3716           change to WebKit2/Platform/mac/MenuUtilities.mm.
3717
3718         * editing/mac/DictionaryLookup.mm:
3719         (WebCore::showPopupOrCreateAnimationController): Removed check whether
3720           LULookupDefinitionModule responds to +showDefinitionForTerm:relativeToRect:ofView:options:.
3721
3722         * platform/cocoa/NetworkExtensionContentFilter.mm:
3723         (WebCore::NetworkExtensionContentFilter::initialize): Changed to use
3724           -[NEFilterSource setSourceAppIdentifier:], without checking, instead of
3725           -setSourceAppBundleID:, which does not exist.
3726
3727         * platform/cocoa/ScrollController.mm:
3728         (systemUptime): Deleted.
3729         (WebCore::ScrollController::snapRubberBand): Use -[NSProcessInfo systemUptime] directly.
3730
3731         * platform/graphics/avfoundation/objc/MediaPlaybackTargetPickerMac.mm:
3732         (WebCore::MediaPlaybackTargetPickerMac::showPlaybackTargetPicker): Remove unnecessary check.
3733
3734         * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
3735         (WebCore::MediaPlayerPrivateAVFoundationObjC::createAVPlayerLayer): Ditto.
3736         (WebCore::MediaPlayerPrivateAVFoundationObjC::setVideoFullscreenMode): Ditto.
3737         (WebCore::MediaPlayerPrivateAVFoundationObjC::didPassCORSAccessCheck): Replaced
3738           -respondsToSelector: check with -isKindOfClass: check corresponding to the above cast.
3739         (WebCore::MediaPlayerPrivateAVFoundationObjC::setShouldDisableSleep): Removed unnecessary
3740           check.
3741
3742         * platform/graphics/avfoundation/objc/VideoFullscreenLayerManager.mm:
3743         (WebCore::VideoFullscreenLayerManager::setVideoFullscreenLayer): Removed unnecessary checks.
3744
3745         * platform/graphics/mac/WebGLLayer.mm:
3746         (-[WebGLLayer initWithGraphicsContext3D:]): Ditto.
3747
3748         * platform/mac/PlatformEventFactoryMac.mm:
3749         (WebCore::typeForEvent): Removed check whether NSMenu responds to +menuTypeForEvent: and
3750           all code to handle that case that it doesn’t.
3751
3752         * platform/mac/WebVideoFullscreenController.mm:
3753         (-[WebVideoFullscreenController applicationDidResignActive:]): Removed check whether
3754           NSWindow responds to -isOnActiveSpace.
3755         (-[WebVideoFullscreenController updateMenuAndDockForFullscreen]): Removed check whether
3756           NSApplication responds to -setPresentationOptions:
3757
3758         * platform/mac/WebVideoFullscreenInterfaceMac.mm:
3759         (-[WebVideoFullscreenInterfaceMacObjC updateIsPlaying:newPlaybackRate:]): Removed
3760           unnecessary -respondsToSelector: check.
3761         (-[WebVideoFullscreenInterfaceMacObjC setVideoDimensions:]): Ditto.
3762         (-[WebVideoFullscreenInterfaceMacObjC setUpPIPForVideoView:withFrame:inWindow:]): Ditto.
3763
3764         * platform/spi/cf/CFNetworkSPI.h: Moved declarations of
3765           -[NSURLCache _initWithMemoryCapacity:diskCapacity:relativePath:] and
3766           -[NSURLCache _CFURLCache] to the !USE(APPLE_INTERNAL_SDK) section.
3767
3768         * platform/spi/cocoa/NEFilterSourceSPI.h: Added declaration of NEFilterSource’
3769           sourceAppIdentifier property to the !USE(APPLE_INTERNAL_SDK) section and deleted
3770           unconditional declaration of sourceAppBundleID property, which doesn’t exist.
3771
3772         * platform/spi/cocoa/QuartzCoreSPI.h: Removed redundant declarations.
3773
3774         * platform/spi/ios/DataDetectorsUISPI.h: Moved declarations of DDDetectionController methods
3775           from WebKit2/UIProcess/ios/{WKActionSheetAssistant,WKContentViewInteraction}.mm to here.
3776           Removed an unused declaration.
3777
3778         * platform/spi/mac/LookupSPI.h: Moved redundant declarations into the
3779           !USE(APPLE_INTERNAL_SDK) section.
3780
3781         * platform/spi/mac/NSMenuSPI.h: Changed to import NSMenu_Private.h when using the
3782           Apple internal SDK. Cleaned up the declarations for the other case.
3783
3784         * platform/spi/mac/TUCallSPI.h: Changed to import TUCall_Strings.h when use the Apple
3785           internal SDK.
3786
3787 2017-02-11  Sam Weinig  <sam@webkit.org>
3788
3789         Remove the remaining functions out of JSDOMBinding
3790         https://bugs.webkit.org/show_bug.cgi?id=168179
3791
3792         Reviewed by Darin Adler.
3793
3794         Move utility functions into more appropriate locations.
3795         - Move hasIteratorMethod to runtime/IteratorOperations.h
3796         - Move nonCachingStaticFunctionGetter to runtime/Lookup.h
3797         - Move addImpureProperty to CommonVM
3798
3799         Remove toJS overload that took a Vector<T>. Replace it's usage
3800         with toJS<IDLSequence<T>> usage. To make this work, added two
3801         new types, IDLIDBKeyData and IDLIDBValue.
3802
3803         * Modules/indexeddb/IDBCursor.cpp:
3804         (WebCore::IDBCursor::setGetResult):
3805         * Modules/indexeddb/IDBRequest.cpp:
3806         (WebCore::IDBRequest::setResult):
3807         (WebCore::IDBRequest::setResultToStructuredClone):
3808         Adopt JSDOMConvert infrastructure for conversions using new types.
3809
3810         * bindings/IDLTypes.h:
3811         * bindings/js/JSDOMConvertIndexedDB.h:
3812         (WebCore::JSConverter<IDLIDBKeyData>::convert):
3813         (WebCore::JSConverter<IDLIDBValue>::convert):
3814         Add new types for IDBKeyData and IDBValue.
3815
3816         * bindings/js/CommonVM.cpp:
3817         (WebCore::addImpureProperty):
3818         * bindings/js/CommonVM.h:
3819         Move addImpureProperty here from JSDOMBinding.
3820
3821         * bindings/js/IDBBindingUtilities.cpp:
3822         (WebCore::idbKeyDataToScriptValue): Deleted.
3823         * bindings/js/IDBBindingUtilities.h:
3824         Remove unused idbKeyDataToScriptValue, and group like functions
3825         together.
3826
3827         * bindings/js/JSDOMBinding.cpp: Removed.
3828         * bindings/js/JSDOMBinding.h:
3829         (WebCore::nonCachingStaticFunctionGetter): Deleted.
3830         (WebCore::toJS): Deleted.
3831         Move/remove functions.
3832
3833         * bindings/js/JSDOMConvertUnion.h:
3834         Update for move of hasIteratorMethod to runtime/IteratorOperations.h
3835
3836         * bindings/js/JSDOMWindowCustom.cpp:
3837         * bindings/js/JSHTMLDocumentCustom.cpp:
3838         * bindings/js/JSLocationCustom.cpp:
3839         Update for move of nonCachingStaticFunctionGetter to runtime/Lookup.h
3840
3841         * bindings/js/JSSubtleCryptoCustom.cpp:
3842         Remove unneeded include of runtime/IteratorOperations.h
3843
3844         * bindings/scripts/CodeGeneratorJS.pm:
3845         (GenerateOverloadedFunctionOrConstructor):
3846         Include runtime/IteratorOperations when needing to distinguish a sequence.
3847
3848         * html/HTMLDocument.cpp:
3849         Replace include of JSDOMBinding.h with CommonVM.h for addImpureProperty.
3850
3851 2017-02-12  Carlos Garcia Campos  <cgarcia@igalia.com>
3852
3853         [GTK] Handle caps lock indicator in event modifiers
3854         https://bugs.webkit.org/show_bug.cgi?id=168186
3855
3856         Reviewed by Michael Catanzaro.
3857
3858         Add helper function to check if caps lock is present in the given modifiers. We need this because in GDK
3859         GDK_LOCK_MASK might be either CapsLock or ShiftLock in X11. We use this new method in all platform event
3860         implementations to add the appropriate modifiers.
3861
3862         Fixes: fast/events/special-key-events-in-input-text.html
3863
3864         * platform/PlatformKeyboardEvent.h:
3865         * platform/gtk/PlatformKeyboardEventGtk.cpp:
3866         (WebCore::modifiersForGdkKeyEvent):
3867         (WebCore::PlatformKeyboardEvent::modifiersContainCapsLock):
3868         * platform/gtk/PlatformMouseEventGtk.cpp:
3869         (WebCore::PlatformMouseEvent::PlatformMouseEvent):
3870         * platform/gtk/PlatformWheelEventGtk.cpp:
3871         (WebCore::PlatformWheelEvent::PlatformWheelEvent):
3872
3873 2017-02-11  Sam Weinig  <sam@webkit.org>
3874
3875         Remove custom bindings for XSLTProcessor.idl
3876         https://bugs.webkit.org/show_bug.cgi?id=168174
3877
3878         Reviewed by Andreas Kling.
3879
3880         * CMakeLists.txt:
3881         * WebCore.xcodeproj/project.pbxproj:
3882         * bindings/js/JSBindingsAllInOne.cpp:
3883         * bindings/js/JSXSLTProcessorCustom.cpp: Removed.
3884         Remove file.
3885  
3886         * bindings/js/JSDOMBinding.cpp:
3887         (WebCore::jsStringOrUndefined): Deleted.
3888         * bindings/js/JSDOMBinding.h:
3889         Remove now unused jsStringOrUndefined.
3890
3891         * xml/XSLTProcessor.cpp:
3892         (WebCore::XSLTProcessor::setParameter):
3893         (WebCore::XSLTProcessor::getParameter):
3894         (WebCore::XSLTProcessor::removeParameter):
3895         * xml/XSLTProcessor.idl:
3896         Replace custom bindings bindings with early returns. One subtle difference
3897         between the custom bindings and this, is that getParameter will return 
3898         jsNull() rather than jsUndefined() for null String returns. This matches
3899         all other bindings.
3900
3901 2017-02-11  Olivier Blin  <olivier.blin@softathome.com>
3902
3903         [GStreamer][MSE][EME] Fix decryptor assignment
3904         https://bugs.webkit.org/show_bug.cgi?id=168122
3905
3906         Reviewed by Michael Catanzaro.
3907
3908         The new decryptor is a floating reference so we should not use the
3909         adopt GRefPtr constructor, but use the regular assignment operator
3910         that will sink the object (clear the floating flag).
3911
3912         This fixes assertions in debug build.
3913
3914         See previous pipeline fix in r210851 and WPE commit
3915         06020b18831e1c0eead34e2c1a5a4b7d026c227d.
3916
3917         * platform/graphics/gstreamer/mse/AppendPipeline.cpp:
3918         (WebCore::AppendPipeline::parseDemuxerSrcPadCaps):
3919         Do not use adoptGRef(), it prevented the object from being sunk.
3920
3921 2017-02-11  Simon Fraser  <simon.fraser@apple.com>
3922
3923         Avoid a redundant scroll to 0,0 when navigating back to a url with no fragment
3924         https://bugs.webkit.org/show_bug.cgi?id=168177
3925
3926         Reviewed by Sam Weinig.
3927
3928         FrameView::scrollToFragment() is called from FrameLoader::scrollToFragmentWithParentBoundary()
3929         when navigating within the page. If the URL had no fragment identifier, this code would
3930         call into FrameView::scrollToAnchor() with an empty name, where maintainScrollPositionAtAnchor()
3931         used the document as the anchor, thus scrolling to 0,0. Later, history().restoreScrollPositionAndViewState()
3932         the restores the scroll position from history.
3933         
3934         This scroll to 0,0 happened to be not visible to the page because of scroll event
3935         coalescing, but it makes implementation of history.scrollRestoration harder, so avoid it
3936         by just returning early from FrameView::scrollToFragment() if there is no fragment,
3937         making sure to clear the document's CSSTarget.
3938
3939         * dom/Document.cpp:
3940         (WebCore::Document::setCSSTarget):
3941         * page/FrameView.cpp:
3942         (WebCore::FrameView::scrollToFragment):
3943         (WebCore::FrameView::scrollToAnchor):
3944
3945 2017-02-11  Chris Dumez  <cdumez@apple.com>
3946
3947         Implement URL's toJSON()
3948         https://bugs.webkit.org/show_bug.cgi?id=167979
3949
3950         Reviewed by Sam Weinig.
3951
3952         Implement URL's toJSON() as per:
3953         - https://url.spec.whatwg.org/#dom-url-tojson
3954
3955         This is already supported by Firefox.
3956
3957         Also, drop URLUtils.idl as it is no longer in the specification.
3958         Merge its content to DOMURL.idl as per the URL specification.
3959
3960         Finally, mark href attribute as stringifier and drop the toString()
3961         operation to match the specification. This fixes a bug where our
3962         toString property was not enumerable but should have been.
3963
3964         Tests: fast/url/url-tojson.html
3965                imported/w3c/web-platform-tests/url/url-tojson.html
3966
3967         * CMakeLists.txt:
3968         * DerivedSources.make:
3969         * WebCore.xcodeproj/project.pbxproj:
3970         * html/DOMURL.idl:
3971         * html/URLUtils.h:
3972         (WebCore::URLUtils<T>::toJSON):
3973         * html/URLUtils.idl: Removed.
3974
3975 2017-02-11  Carlos Garcia Campos  <cgarcia@igalia.com>
3976
3977         [GTK][EFL] Implement MIMETypeRegistry::getPreferredExtensionForMIMEType
3978         https://bugs.webkit.org/show_bug.cgi?id=168163
3979
3980         Reviewed by Michael Catanzaro.
3981
3982         It's missing causing several HTML anchor download tests to fail because the suggested filename missed the
3983         extension. This patch moves MIMETypeRegistry::appendFileExtensionIfNecessary() from the cocoa specific file to the
3984         common file because it's not actually platform specific. MIMETypeRegistry::getPreferredExtensionForMIMEType() is
3985         what platforms should implement.
3986
3987         Fixes: fast/dom/HTMLAnchorElement/anchor-download-user-triggered-synthetic-click.html
3988                fast/dom/HTMLAnchorElement/anchor-download.html
3989                fast/dom/HTMLAnchorElement/anchor-file-blob-download-no-extension.html
3990                fast/dom/HTMLAnchorElement/anchor-nodownload-set.html
3991
3992         * platform/MIMETypeRegistry.cpp:
3993         (WebCore::MIMETypeRegistry::appendFileExtensionIfNecessary):
3994         * platform/cocoa/MIMETypeRegistryCocoa.mm:
3995         (WebCore::MIMETypeRegistry::appendFileExtensionIfNecessary): Deleted.
3996         * platform/efl/MIMETypeRegistryEfl.cpp:
3997         (WebCore::MIMETypeRegistry::getPreferredExtensionForMIMEType):
3998         * platform/gtk/MIMETypeRegistryGtk.cpp:
3999         (WebCore::MIMETypeRegistry::getPreferredExtensionForMIMEType):
4000
4001 2017-02-11  Carlos Garcia Campos  <cgarcia@igalia.com>
4002
4003         Unreviewed. Update imageTitle translatable string.
4004
4005         To match mac port. Fixes fast/images/imageDocument-title.html.
4006
4007         * platform/gtk/LocalizedStringsGtk.cpp:
4008         (WebCore::imageTitle):
4009
4010 2017-02-10  John Wilander  <wilander@apple.com><