fa5808ed3801f3f8e3989339b5598cdfa74be240
[WebKit-https.git] / Source / WebCore / ChangeLog
1 2017-03-22  Youenn Fablet  <youenn@apple.com>
2
3         RTCPeerConnection is crashing if no backend is created
4         https://bugs.webkit.org/show_bug.cgi?id=169938
5
6         Reviewed by Geoffrey Garen.
7
8         RTCPeerConnection should not be visible if it is not able to create a backend.
9         In case when this happens anyway, it should be able to be stopped and destroyed without crashing.
10         To do so, we need to set its state to closed.
11
12         * Modules/mediastream/RTCPeerConnection.cpp:
13         (WebCore::RTCPeerConnection::RTCPeerConnection):
14         (WebCore::RTCPeerConnection::close): Cosmetic change, just in case stop becomes reentrant at some point.
15
16 2017-03-22  Antoine Quint  <graouts@webkit.org>
17
18         [Modern Media Controls] Rendering glitches for fullscreen controls while dragging
19         https://bugs.webkit.org/show_bug.cgi?id=169949
20         <rdar://problem/30687803>
21
22         Reviewed by Eric Carlson.
23
24         Clipping the controls bar has some unwelcome side effects and isn't necessary, so
25         we simply remove it. An existing test was amended to check that there is no clipping
26         applied to the controls bar.
27
28         * Modules/modern-media-controls/controls/macos-fullscreen-media-controls.css:
29         (.media-controls.mac.fullscreen > .controls-bar):
30
31 2017-03-22  John Wilander  <wilander@apple.com>
32
33         Add back the null check in TextureCacheCV::textureFromImage()
34         https://bugs.webkit.org/show_bug.cgi?id=169931
35         <rdar://problem/27139820>
36
37         Reviewed by Alex Christensen.
38
39         No new tests. Just adding back a check that was previously there.
40
41         * platform/graphics/cv/TextureCacheCV.mm:
42         (WebCore::TextureCacheCV::textureFromImage):
43
44 2017-03-21  Antti Koivisto  <antti@apple.com>
45
46         Use AtomicString in RuleSet and RuleFeature
47         https://bugs.webkit.org/show_bug.cgi?id=119310
48         <rdar://problem/28214658>
49
50         Reviewed by Andreas Kling.
51
52         ..instead of the plain AtomicStringImpl*. This introduces some ref churn but not too much.
53
54         * css/DocumentRuleSets.cpp:
55         (WebCore::DocumentRuleSets::ancestorClassRules):
56         (WebCore::DocumentRuleSets::ancestorAttributeRulesForHTML):
57         * css/DocumentRuleSets.h:
58         * css/ElementRuleCollector.cpp:
59         (WebCore::ElementRuleCollector::collectMatchingRules):
60         (WebCore::ElementRuleCollector::collectMatchingShadowPseudoElementRules):
61         * css/RuleFeature.cpp:
62         (WebCore::RuleFeatureSet::recursivelyCollectFeaturesFromSelector):
63         (WebCore::makeAttributeSelectorKey):
64         (WebCore::RuleFeatureSet::collectFeatures):
65         * css/RuleFeature.h:
66         * css/RuleSet.cpp:
67         (WebCore::RuleSet::addToRuleSet):
68         (WebCore::rulesCountForName):
69         (WebCore::RuleSet::addRule):
70         * css/RuleSet.h:
71         (WebCore::RuleSet::idRules):
72         (WebCore::RuleSet::classRules):
73         (WebCore::RuleSet::shadowPseudoElementRules):
74         (WebCore::RuleSet::tagRules):
75         * css/StyleResolver.h:
76         (WebCore::StyleResolver::hasSelectorForAttribute):
77         (WebCore::StyleResolver::hasSelectorForClass):
78         (WebCore::StyleResolver::hasSelectorForId):
79         * style/AttributeChangeInvalidation.cpp:
80         (WebCore::Style::mayBeAffectedByAttributeChange):
81         (WebCore::Style::AttributeChangeInvalidation::invalidateStyle):
82         * style/IdChangeInvalidation.cpp:
83         (WebCore::Style::mayBeAffectedByHostRules):
84         (WebCore::Style::mayBeAffectedBySlottedRules):
85         (WebCore::Style::IdChangeInvalidation::invalidateStyle):
86         * style/StyleSharingResolver.cpp:
87         (WebCore::Style::SharingResolver::resolve):
88         (WebCore::Style::SharingResolver::canShareStyleWithElement):
89         (WebCore::Style::SharingResolver::classNamesAffectedByRules):
90
91 2017-03-22  Youenn Fablet  <youenn@apple.com>
92
93         Safari sends empty "Access-Control-Request-Headers" in preflight request
94         https://bugs.webkit.org/show_bug.cgi?id=169851
95
96         Reviewed by Chris Dumez.
97
98         Covered by updated test.
99
100         * loader/CrossOriginAccessControl.cpp:
101         (WebCore::createAccessControlPreflightRequest): Not adding "Access-Control-Request-Headers" to
102         request header if value is empty.
103
104 2017-03-22  Youenn Fablet  <youenn@apple.com>
105
106         XMLHttpRequest: getAllResponseHeaders() should lowercase header names before sorting
107         https://bugs.webkit.org/show_bug.cgi?id=169286
108
109         Reviewed by Chris Dumez.
110
111         Covered by rebased tests.
112
113         https://xhr.spec.whatwg.org/#the-getallresponseheaders()-method now mandates to lowercase the header names and
114         sort them before appending them. This ensures that differences in the way headers are processed by browsers are
115         not visible to web pages. This also moves towards lowercased/case-insensitive header processing which should be
116         the norm.
117
118         * xml/XMLHttpRequest.cpp:
119         (WebCore::XMLHttpRequest::getAllResponseHeaders): Lower-casing, then sorting, then serializing headers.
120         * xml/XMLHttpRequest.h: Storing getAllResponseHeaders result if case needed again.
121
122 2017-03-22  Chris Dumez  <cdumez@apple.com>
123
124         Implement the "noopener" feature for window.open()
125         https://bugs.webkit.org/show_bug.cgi?id=163960
126         <rdar://problem/28941679>
127
128         Reviewed by Sam Weinig.
129
130         Implement the "noopener" feature for window.open(). If 'noopener' is passed to window.open()
131         then the new Window's opener property will be null.
132
133         Tests: imported/w3c/web-platform-tests/html/browsers/windows/auxiliary-browsing-contexts/opener-closed.html
134                imported/w3c/web-platform-tests/html/browsers/windows/auxiliary-browsing-contexts/opener-multiple.html
135                imported/w3c/web-platform-tests/html/browsers/windows/auxiliary-browsing-contexts/opener-noopener.html
136                imported/w3c/web-platform-tests/html/browsers/windows/auxiliary-browsing-contexts/opener-noreferrer.html
137                imported/w3c/web-platform-tests/html/browsers/windows/auxiliary-browsing-contexts/opener.html
138
139         * page/DOMWindow.cpp:
140         (WebCore::DOMWindow::createWindow):
141         * page/WindowFeatures.cpp:
142         (WebCore::parseWindowFeatures):
143         (WebCore::setWindowFeature):
144         * page/WindowFeatures.h:
145
146 2017-03-21  Sergio Villar Senin  <svillar@igalia.com>
147
148         [Soup] "Only from websites I visit" cookie policy is broken
149         https://bugs.webkit.org/show_bug.cgi?id=168912
150
151         Reviewed by Carlos Garcia Campos.
152
153         Do not reset the first party for cookies on redirects. That's properly done for the main
154         resource in DocumentLoader::willSendRequest and, in the case of subresources, is absolutely
155         wrong (which is what we were doing since r143931).
156
157         The most notable effect was that subresources loaded via redirects were effectively
158         bypassing the "no third party" policy for cookies.
159
160         Test: http/tests/security/cookies/third-party-cookie-blocking-redirect.html
161
162         * platform/network/soup/ResourceHandleSoup.cpp:
163         (WebCore::doRedirect):
164
165 2017-03-22  Carlos Garcia Campos  <cgarcia@igalia.com>
166
167         Make it possible to use WEB_UI_STRING macros to mark translatable strings in glib based ports
168         https://bugs.webkit.org/show_bug.cgi?id=169672
169
170         Reviewed by Michael Catanzaro.
171
172         WEB_UI_STRING macros are currently used by Cocoa based ports and Windows port. For other ports it simply returns
173         the given string, but it's not translated. In the GTK+ port we have all translatable strings from
174         LocalizedStrings.cpp copied in LocalizedStringsGtk.cpp to use the glib macros to mark them as translatable. In
175         most of the cases the strings are exactly in the same, in some others (the context menu ones) the string only
176         differs in the mnemonics used by GTK, and only in a few cases the strings are different. We could remove most of
177         that duplication if strings used by WEB_UI_STRING were marked as translatable in glib based ports too.
178
179         This patch makes that possible with the following changes:
180
181           - Add WEB_UI_STRING_WITH_MNEMONIC() to handle the cases where the strings only differ in the mnemonics. It
182             receives the string with mnemonics that is ignored in all ports except GTK+.
183           - All platform specific strings have been moved to the platform files, to ensure scanners don't include
184             strings from other ports.
185           - For the same reason a new macro WEB_UI_CFSTRING has been also added, just to make sure that CF strings are
186             only used by CF based ports. The implementation is the same as WEB_UI_STRING, it only changes the name to
187             not confuse the scanners.
188           - And again for the same reason, for non-CF and non-Glib cases WEB_UI_STRING is not used, since in those cases
189             strings are not really translated and String::fromUTF8() is actually used. So, now we use String::fromUTF8()
190             directly instead of WEB_UI_STRING to not confuse the scanners.
191
192         * CMakeLists.txt: Add LocalizedStrings.cpp to the compilation.
193         * PlatformGTK.cmake: Move LocalizedStringsGtk.cpp to the list of sources not depending on GTK+, since it no
194         longer uses GTK+.
195         * extract-localizable-strings.pl: Update it to handle the new macros.
196         * platform/LocalizedStrings.cpp:
197         (WebCore::formatLocalizedString):
198         (WebCore::contextMenuItemTagOpenLinkInNewWindow):
199         (WebCore::contextMenuItemTagDownloadLinkToDisk):
200         (WebCore::contextMenuItemTagOpenImageInNewWindow):
201         (WebCore::contextMenuItemTagCopyImageToClipboard):
202         (WebCore::contextMenuItemTagOpenFrameInNewWindow):
203         (WebCore::contextMenuItemTagCopy):
204         (WebCore::contextMenuItemTagGoBack):
205         (WebCore::contextMenuItemTagGoForward):
206         (WebCore::contextMenuItemTagStop):
207         (WebCore::contextMenuItemTagReload):
208         (WebCore::contextMenuItemTagCut):
209         (WebCore::contextMenuItemTagPaste):
210         (WebCore::contextMenuItemTagIgnoreSpelling):
211         (WebCore::contextMenuItemTagLearnSpelling):
212         (WebCore::contextMenuItemTagLookUpInDictionary):
213         (WebCore::contextMenuItemTagOpenLink):
214         (WebCore::contextMenuItemTagIgnoreGrammar):
215         (WebCore::contextMenuItemTagSpellingMenu):
216         (WebCore::contextMenuItemTagShowSpellingPanel):
217         (WebCore::contextMenuItemTagCheckSpelling):
218         (WebCore::contextMenuItemTagCheckSpellingWhileTyping):
219         (WebCore::contextMenuItemTagCheckGrammarWithSpelling):
220         (WebCore::contextMenuItemTagFontMenu):
221         (WebCore::contextMenuItemTagBold):
222         (WebCore::contextMenuItemTagItalic):
223         (WebCore::contextMenuItemTagUnderline):
224         (WebCore::contextMenuItemTagOutline):
225         (WebCore::contextMenuItemTagOpenVideoInNewWindow):
226         (WebCore::contextMenuItemTagOpenAudioInNewWindow):
227         (WebCore::contextMenuItemTagDownloadVideoToDisk):
228         (WebCore::contextMenuItemTagDownloadAudioToDisk):
229         (WebCore::contextMenuItemTagExitVideoFullscreen):
230         (WebCore::contextMenuItemTagMediaPlay):
231         (WebCore::contextMenuItemTagMediaPause):
232         (WebCore::contextMenuItemTagMediaMute):
233         (WebCore::contextMenuItemTagInspectElement):
234         (WebCore::AXAutoFillContactsLabel):
235         (WebCore::imageTitle):
236         (WebCore::validationMessageRangeUnderflowText):
237         (WebCore::validationMessageRangeOverflowText):
238         (WebCore::textTrackCountryAndLanguageMenuItemText):
239         (WebCore::textTrackLanguageMenuItemText):
240         (WebCore::closedCaptionTrackMenuItemText):
241         (WebCore::sdhTrackMenuItemText):
242         (WebCore::easyReaderTrackMenuItemText):
243         (WebCore::forcedTrackMenuItemText):
244         (WebCore::audioDescriptionTrackSuffixText):
245         (WebCore::webCryptoMasterKeyKeychainLabel):
246         * platform/LocalizedStrings.h:
247         * platform/cocoa/LocalizedStringsCocoa.mm:
248         (WebCore::copyImageUnknownFileLabel):
249         (WebCore::contextMenuItemTagSearchInSpotlight):
250         (WebCore::contextMenuItemTagSearchWeb):
251         (WebCore::contextMenuItemTagShowFonts):
252         (WebCore::contextMenuItemTagStyles):
253         (WebCore::contextMenuItemTagShowColors):
254         (WebCore::contextMenuItemTagSpeechMenu):
255         (WebCore::contextMenuItemTagStartSpeaking):
256         (WebCore::contextMenuItemTagStopSpeaking):
257         (WebCore::contextMenuItemTagCorrectSpellingAutomatically):
258         (WebCore::contextMenuItemTagSubstitutionsMenu):
259         (WebCore::contextMenuItemTagShowSubstitutions):
260         (WebCore::contextMenuItemTagSmartCopyPaste):
261         (WebCore::contextMenuItemTagSmartQuotes):
262         (WebCore::contextMenuItemTagSmartDashes):
263         (WebCore::contextMenuItemTagSmartLinks):
264         (WebCore::contextMenuItemTagTextReplacement):
265         (WebCore::contextMenuItemTagTransformationsMenu):
266         (WebCore::contextMenuItemTagMakeUpperCase):
267         (WebCore::contextMenuItemTagMakeLowerCase):
268         (WebCore::contextMenuItemTagCapitalize):
269         (WebCore::contextMenuItemTagChangeBack):
270         (WebCore::contextMenuItemTagEnterVideoEnhancedFullscreen):
271         (WebCore::contextMenuItemTagExitVideoEnhancedFullscreen):
272         (WebCore::AXARIAContentGroupText):
273         (WebCore::AXHorizontalRuleDescriptionText):
274         (WebCore::AXMarkText):
275         (WebCore::AXMeterGaugeRegionOptimumText):
276         (WebCore::AXMeterGaugeRegionSuboptimalText):
277         (WebCore::AXMeterGaugeRegionLessGoodText):
278         (WebCore::builtInPDFPluginName):
279         (WebCore::pdfDocumentTypeDescription):
280         (WebCore::postScriptDocumentTypeDescription):
281         (WebCore::keygenMenuItem2048):
282         (WebCore::keygenKeychainItemName):
283         (WebCore::htmlSelectMultipleItems):
284         (WebCore::fileButtonChooseMediaFileLabel):
285         (WebCore::fileButtonChooseMultipleMediaFilesLabel):
286         (WebCore::fileButtonNoMediaFileSelectedLabel):
287         (WebCore::fileButtonNoMediaFilesSelectedLabel):
288         (WebCore::insertListTypeNone):
289         (WebCore::insertListTypeBulleted):
290         (WebCore::insertListTypeBulletedAccessibilityTitle):
291         (WebCore::insertListTypeNumbered):
292         (WebCore::insertListTypeNumberedAccessibilityTitle):
293         (WebCore::exitFullScreenButtonAccessibilityTitle):
294         * platform/gtk/LocalizedStringsGtk.cpp:
295         (WebCore::contextMenuItemTagDelete):
296         (WebCore::contextMenuItemTagSelectAll):
297         * platform/win/LocalizedStringsWin.cpp:
298         (WebCore::contextMenuItemTagSearchWeb):
299         (WebCore::uploadFileText):
300         (WebCore::allFilesText):
301
302 2017-03-21  Myles C. Maxfield  <mmaxfield@apple.com>
303
304         [iOS] Migrate off of CTFontCreateForCSS
305         https://bugs.webkit.org/show_bug.cgi?id=168894
306
307         Reviewed by Antti Koivisto.
308
309         Use the new font selection algorithm introduced in r213163 on iOS.
310
311         Test: fast/text/font-weights.html
312
313         * platform/graphics/cocoa/FontCacheCoreText.cpp:
314         * platform/graphics/cocoa/FontCocoa.mm: On iOS only, CTFontCreateForCSS()
315         will return a 0-sized font if the passed size parameter is 0. However, all
316         other CT APIs will create a 12-px-sized font if the passed size parameter is
317         0. Most of our code knows and understands this (because this is how it works
318         on the Mac). However, this one place needs to be updated to understand this.
319
320 2017-03-21  Simon Fraser  <simon.fraser@apple.com>
321
322         Make non-decoded image flashing less intrusive
323         https://bugs.webkit.org/show_bug.cgi?id=169942
324
325         Reviewed by Said Abou-Hallawa.
326
327         When compositing borders are enabled, we paint yellow for images that paint but don't yet have a decoded
328         frame. Give this yellow 50% alpha to make it less intrusive
329
330         Also log to the images log channel when we destroy decoded data.
331
332         * platform/graphics/BitmapImage.cpp:
333         (WebCore::BitmapImage::destroyDecodedData):
334         (WebCore::BitmapImage::draw):
335
336 2017-03-20  Matt Rajca  <mrajca@apple.com>
337
338         Loosen audio playback restrictions when the volume is 0.
339         https://bugs.webkit.org/show_bug.cgi?id=169897
340
341         Reviewed by Eric Carlson.
342
343         Added API tests.
344
345         * html/MediaElementSession.cpp:
346         (WebCore::MediaElementSession::playbackPermitted):
347
348 2017-03-21  Brady Eidson  <beidson@apple.com>
349
350         Disable all virtual tables.
351         <rdar://problem/31081972> and https://bugs.webkit.org/show_bug.cgi?id=169928
352         
353         Reviewed by Jer Noble.
354
355         No new tests (Covered by changes to existing test).
356
357         * Modules/webdatabase/DatabaseAuthorizer.cpp:
358         (WebCore::DatabaseAuthorizer::createVTable):
359         (WebCore::DatabaseAuthorizer::dropVTable):
360
361 2017-03-21  Anders Carlsson  <andersca@apple.com>
362
363         Remove bogus availability annotations from DOM SPI headers.
364         rdar://problem/31015675
365
366         Rubber-stamped by Dan Bernstein.
367
368         * platform/cocoa/WebKitAvailability.h:
369         Remove __NSi_9876_5 #define.
370
371 2017-03-21  Zalan Bujtas  <zalan@apple.com>
372
373         Tear down descendant renderers when <slot>'s display value is set to no "contents".
374         https://bugs.webkit.org/show_bug.cgi?id=169921
375         <rdar://problem/30336417>
376
377         Reviewed by Antti Koivisto.
378
379         Since "display: contents" does not generate a renderer, when an element's display value is
380         changed to something other than "contents", we not only create a renderer but also reparent its descendant
381         subtree (e.g from slot's parent to the newly constructed slot renderer). During this reparenting, we
382         need to tear down the descendant subtree tree and build it up again to reflect the new rendering context.
383
384         Test: fast/shadow-dom/slot-with-continuation-descendants.html
385
386         * style/RenderTreeUpdater.cpp:
387         (WebCore::RenderTreeUpdater::updateElementRenderer):
388
389 2017-03-19  Wenson Hsieh  <wenson_hsieh@apple.com>
390
391         Teach TextIndicator to estimate the background color of the given Range
392         https://bugs.webkit.org/show_bug.cgi?id=169869
393         <rdar://problem/31127272>
394
395         Reviewed by Anders Carlsson and Simon Fraser.
396
397         Introduces a simple heuristic to compute a background color that is appropriate to use as a border surrounding
398         the snapshot of the given Range. This work is only carried out if TextIndicatorOptionComputeEstimatedBackgroundColor
399         is specified. The details of how this background color is estimated (as well as when to fall back) can be improved
400         in several ways (one idea is to sample colors along the edge of the snapshot). For the time being, this patch
401         naively walks up the render tree in search of enclosing parent renderers that have background colors. If any
402         renderers have a style that is deemed too complex to capture in a single background color, then fall back to the
403         base document background color; otherwise, the estimated background color is the result of blending these
404         background colors together.
405
406         * page/TextIndicator.cpp:
407         (WebCore::styleContainsComplexBackground):
408
409         Bail out of the background color codepath if the renderer has backdrop filters, has a background image, or uses
410         a non-normal blend mode.
411
412         (WebCore::fallbackBackgroundColorForTextSelection):
413         (WebCore::estimatedBackgroundColorForRange):
414         (WebCore::initializeIndicator):
415         * page/TextIndicator.h:
416
417 2017-03-20  Jer Noble  <jer.noble@apple.com>
418
419         Crash in WebCore: WebCore::CARingBuffer::getCurrentFrameBounds + 28
420         https://bugs.webkit.org/show_bug.cgi?id=169887
421         <rdar://problem/23648082>
422
423         Reviewed by Eric Carlson.
424
425         Because AudioSourceProviderAVFObjC::prepareCallback() can concievably be called after the AudioSourceProviderAVFObjC
426         it refers to has been destroyed, add an extra layer of indirection between the tap and the provider, and invalidate
427         that level of indirection before the AudioSourceProviderAVFObjC is destroyed.
428
429         * platform/graphics/avfoundation/AudioSourceProviderAVFObjC.h:
430         * platform/graphics/avfoundation/AudioSourceProviderAVFObjC.mm:
431         (WebCore::AudioSourceProviderAVFObjC::initCallback):
432         (WebCore::AudioSourceProviderAVFObjC::finalizeCallback):
433         (WebCore::AudioSourceProviderAVFObjC::prepareCallback):
434         (WebCore::AudioSourceProviderAVFObjC::unprepareCallback):
435         (WebCore::AudioSourceProviderAVFObjC::processCallback):
436
437 2017-03-21  Simon Fraser  <simon.fraser@apple.com>
438
439         Remove logging left in by mistake.
440
441         * rendering/RenderNamedFlowThread.cpp:
442         (WebCore::RenderNamedFlowThread::willBeDestroyed):
443
444 2017-03-21  Jon Lee  <jonlee@apple.com>
445
446         Clean up RTCSdpType, RTC enums and headers
447         https://bugs.webkit.org/show_bug.cgi?id=169741
448
449         Reviewed by Youenn Fablet.
450
451         Convert to RTCSdpType.
452         * Modules/mediastream/MediaEndpointPeerConnection.cpp:
453         * Modules/mediastream/MediaEndpointPeerConnection.h:
454         * Modules/mediastream/MediaEndpointSessionDescription.cpp:
455         * Modules/mediastream/MediaEndpointSessionDescription.h:
456         * Modules/mediastream/PeerConnectionBackend.cpp:
457         * Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.cpp:
458
459         Convert SDP argument to lvalue.
460         * Modules/mediastream/RTCSessionDescription.cpp:
461         * Modules/mediastream/RTCSessionDescription.h:
462         * Modules/mediastream/RTCSessionDescription.idl:
463
464         Keep RTC enum IDLs above platform. Move the C++ enum headers into platform.
465         * Modules/mediastream/RTCEnums.h: Removed.
466         * Modules/mediastream/RTCIceConnectionState.h: Removed.
467         * Modules/mediastream/RTCIceGatheringState.h: Removed.
468         * Modules/mediastream/RTCIceTransportState.h: Removed.
469         * Modules/mediastream/RTCSignalingState.h: Removed.
470         * platform/mediastream/PeerConnectionStates.h: Remove from .xcodeproj. Move enums to separate headers.
471         * platform/mediastream/RTCBundlePolicy.h:
472         * platform/mediastream/RTCIceConnectionState.h:
473         * platform/mediastream/RTCIceGatheringState.h:
474         * platform/mediastream/RTCIceTransportPolicy.h:
475         * platform/mediastream/RTCIceTransportState.h:
476         * platform/mediastream/RTCRtpTransceiverDirection.h: Renamed from Source/WebCore/Modules/mediastream/RTCRtpTransceiverDirection.h.
477         * platform/mediastream/RTCSdpType.h:
478         * platform/mediastream/RTCSignalingState.h:
479
480         Move RtpTransceiverDirection out to a separate IDL.
481         * Modules/mediastream/RTCPeerConnection.idl:
482         * Modules/mediastream/RTCRtpTransceiver.cpp:
483         * Modules/mediastream/RTCRtpTransceiver.h:
484         * WebCore.xcodeproj/project.pbxproj:
485
486         Replace RTCEnums include with specific headers per enum.
487         * Modules/mediastream/PeerConnectionBackend.h:
488         * Modules/mediastream/RTCConfiguration.h:
489         * Modules/mediastream/RTCIceTransport.h:
490         * Modules/mediastream/RTCPeerConnection.cpp:
491         (WebCore::RTCPeerConnection::completeAddTransceiver): Remove unneeded static_cast.
492         * Modules/mediastream/RTCPeerConnection.h:
493         * Modules/mediastream/RTCRtpTransceiver.h:
494         * platform/mediastream/MediaEndpoint.h:
495         * platform/mediastream/MediaEndpointConfiguration.h:
496         * platform/mock/MockMediaEndpoint.h:
497
498         Clean up license.
499         * Modules/mediastream/libwebrtc/LibWebRTCDataChannelHandler.h:
500         * Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.h:
501         * Modules/mediastream/libwebrtc/LibWebRTCPeerConnectionBackend.h:
502
503         Modernize header to use #pragma once.
504         * platform/mediastream/RTCDTMFSenderHandler.h:
505         * platform/mediastream/RTCDTMFSenderHandlerClient.h:
506         * platform/mediastream/RTCIceCandidateDescriptor.h:
507         * platform/mediastream/RTCPeerConnectionHandlerClient.h:
508         * platform/mediastream/RTCSessionDescriptionDescriptor.h:
509         * platform/mediastream/RTCSessionDescriptionRequest.h:
510         * platform/mediastream/RTCVoidRequest.h:
511         * platform/mock/RTCNotifiersMock.h:
512
513 2017-03-20  Jon Lee  <jonlee@apple.com>
514
515         Add iceCandidatePoolSize to RTCConfiguration
516         https://bugs.webkit.org/show_bug.cgi?id=169866
517
518         Reviewed by Youenn Fablet.
519
520         Test: webrtc/rtcconfiguration-icecandidatepoolsize.html
521
522         * Modules/mediastream/RTCConfiguration.h:
523         * Modules/mediastream/RTCConfiguration.idl: Add iceCandidatePoolSize.
524         * Modules/mediastream/RTCPeerConnection.cpp:
525         (WebCore::RTCPeerConnection::setConfiguration):
526         * Modules/mediastream/libwebrtc/LibWebRTCPeerConnectionBackend.cpp:
527         (WebCore::configurationFromMediaEndpointConfiguration): Set the size in libwebrtc.
528         * platform/mediastream/MediaEndpointConfiguration.cpp:
529         (WebCore::MediaEndpointConfiguration::MediaEndpointConfiguration):
530         * platform/mediastream/MediaEndpointConfiguration.h:
531
532 2017-03-20  Jon Lee  <jonlee@apple.com>
533
534         Follow-up on comments for bug 169664
535         https://bugs.webkit.org/show_bug.cgi?id=169709
536
537         Reviewed by Youenn Fablet.
538
539         * Modules/mediastream/MediaEndpointPeerConnection.cpp:
540         (WebCore::deriveAggregatedIceConnectionState): Update deriveAggregatedIceConnectionState.
541         (WebCore::MediaEndpointPeerConnection::iceTransportStateChanged): Set a capacity and used
542         uncheckedAppend.
543
544 2017-03-20  Simon Fraser  <simon.fraser@apple.com>
545
546         Add a system trace point for memory warning handling
547         https://bugs.webkit.org/show_bug.cgi?id=169893
548
549         Reviewed by Zalan Bujtas.
550
551         Add a TraceScope for low memory handling, which logs 'critical' and 'synchronous'.
552
553         * page/MemoryRelease.cpp:
554         (WebCore::releaseMemory):
555
556 2017-03-20  Simon Fraser  <simon.fraser@apple.com>
557
558         Optimize packing of Document and superclass data members
559         https://bugs.webkit.org/show_bug.cgi?id=169880
560
561         Reviewed by Antti Koivisto.
562
563         Move data members around to optimize packing in SecurityContext, SuspendableTimer and Document.
564         This saves as few hundred bytes on Document.
565         
566         Padding detected via Tools/Scripts/dump-class-layout
567
568         * dom/Document.cpp:
569         (WebCore::Document::Document):
570         * dom/Document.h:
571         * dom/ScriptExecutionContext.h:
572         * dom/SecurityContext.cpp:
573         (WebCore::SecurityContext::SecurityContext):
574         * dom/SecurityContext.h:
575         * page/SuspendableTimer.cpp:
576         (WebCore::SuspendableTimer::SuspendableTimer):
577         * page/SuspendableTimer.h:
578
579 2017-03-20  Chris Dumez  <cdumez@apple.com>
580
581         Suspend media playback in background tabs
582         https://bugs.webkit.org/show_bug.cgi?id=169883
583         <rdar://problem/28056151>
584
585         Reviewed by Eric Carlson.
586
587         Suspend media playback in background tabs to save battery
588         except in cases where we cannot (e.g. PiP, AirPlay).
589
590         Test: media/media-playback-page-visibility.html
591
592         * html/HTMLMediaElement.cpp:
593         (WebCore::HTMLMediaElement::visibilityStateChanged):
594         When page visibility state changes, begin / end media session
595         interruption with reason PlatformMediaSession::EnteringBackground.
596         This reason was already used on iOS when the application enters
597         or exist background. HTMLMediaElement::shouldOverrideBackgroundPlaybackRestriction()
598         takes care of preventing interruption in case of AirPlay or PiP.
599
600 2017-03-20  Daniel Bates  <dabates@apple.com>
601
602         Prevent new navigations from onbeforeunload handler
603         https://bugs.webkit.org/show_bug.cgi?id=169891
604         <rdar://problem/31155736>
605
606         Reviewed by Ryosuke Niwa.
607
608         Ensure that all navigations initiated from an onbeforeunload handler are disallowed
609         regardless of how they were scheduled. Such navigations go against the expectation
610         of a user.
611
612         * loader/FrameLoader.cpp:
613         (WebCore::FrameLoader::isNavigationAllowed): Added.
614         (WebCore::FrameLoader::loadURL): Modified code to call FrameLoader::isNavigationAllowed().
615         (WebCore::FrameLoader::loadWithDocumentLoader): Ditto.
616         (WebCore::FrameLoader::stopAllLoaders): Ditto.
617         * loader/FrameLoader.h:
618
619 2017-03-20  Alex Christensen  <achristensen@webkit.org>
620
621         Prepare SocketStreamHandle for being created from WK2
622         https://bugs.webkit.org/show_bug.cgi?id=169885
623
624         Reviewed by Andy Estes.
625
626         No change in behavior.
627
628         * Modules/websockets/WebSocketChannel.cpp:
629         (WebCore::WebSocketChannel::didOpenSocketStream):
630         (WebCore::WebSocketChannel::sendFrame):
631         Rename send to sendData to prevent name collisions with IPC::MessageSender::send.
632         * platform/network/SocketStreamHandle.cpp:
633         (WebCore::SocketStreamHandle::sendData):
634         (WebCore::SocketStreamHandle::send): Deleted.
635         * platform/network/SocketStreamHandle.h:
636         * platform/network/cf/SocketStreamHandleImpl.h:
637         * platform/network/curl/SocketStreamHandleImpl.h:
638         * platform/network/soup/SocketStreamHandleImpl.h:
639         Make platformSend and platformClose public so I can call them from IPC proxies.
640
641 2017-03-20  Andy Estes  <aestes@apple.com>
642
643         [QuickLook] Subresources should be in the same origin as the main document
644         https://bugs.webkit.org/show_bug.cgi?id=169868
645         <rdar://problem/29898214>
646
647         Reviewed by Daniel Bates.
648
649         Prior to this change, QuickLook documents were placed in a unique origin, which meant all
650         subresources were loaded as cross-origin requests. This prevented XMLHttpRequests to the
651         QuickLook custom protocol, since cross-origin XHRs must be made to a protocol that
652         understands CORS.
653
654         Instead of a unique origin, we now create an origin for QuickLook documents from the preview
655         response URL (an x-apple-ql-id: URL), which will allow QuickLook to make same-origin XHRs by
656         using a URL with the same scheme and host as the preview response URL.
657
658         Test: http/tests/quicklook/same-origin-xmlhttprequest-allowed.html
659
660         * dom/Document.cpp:
661         (WebCore::Document::applyQuickLookSandbox):
662
663 2017-03-17  Jiewen Tan  <jiewen_tan@apple.com>
664
665         window.crypto.getRandomValues() uses the insecure RC4 RNG
666         https://bugs.webkit.org/show_bug.cgi?id=169623
667         <rdar://problem/31044229>
668
669         Reviewed by Brent Fulgham.
670
671         This patch replaces the RC4 RNG with one based on AES-CTR.
672
673         No change of behavior.
674
675         * page/Crypto.cpp:
676         (WebCore::Crypto::getRandomValues):
677
678 2017-03-20  Eric Carlson  <eric.carlson@apple.com>
679
680         [MediaStream] Respect constraints passed to getUserMedia
681         https://bugs.webkit.org/show_bug.cgi?id=169870
682         <rdar://problem/31138936>
683
684         Reviewed by Youenn Fablet and Jer Noble.
685         
686         Remember the fitness score calculated when evaluating constraints passed to getUserMedia, so
687         the best device is chosen when more than one device supports the constraints. Register two
688         mock video and two mock audio devices with different capabilities so these changes can 
689         be tested.
690
691         No new tests, existing tests updated.
692
693         * platform/mediastream/RealtimeMediaSource.cpp:
694         (WebCore::RealtimeMediaSource::selectSettings): Store fitness score in m_fitnessScore.
695         * platform/mediastream/RealtimeMediaSource.h:
696
697         * platform/mediastream/mac/MockRealtimeAudioSourceMac.h:
698         * platform/mediastream/mac/MockRealtimeAudioSourceMac.mm:
699         (WebCore::MockRealtimeAudioSource::create): Don't assume sampleRate is 44.1K
700         (WebCore::MockRealtimeAudioSourceMac::emitSampleBuffers): Use sampleRate() instead of m_sampleRate.
701         (WebCore::MockRealtimeAudioSourceMac::reconfigure): Ditto.
702         (WebCore::MockRealtimeAudioSourceMac::render): Ditto.
703         (WebCore::MockRealtimeAudioSourceMac::applySampleRate): Ditto.
704
705         * platform/mock/MockRealtimeAudioSource.cpp:
706         (WebCore::MockRealtimeAudioSource::updateSettings): Don't assume sampleRate is 44.1K
707         (WebCore::MockRealtimeAudioSource::initializeCapabilities): Support a range of sample rates.
708         (WebCore::MockRealtimeAudioSource::startProducingData): Initialize sampleRate if it hasn't
709         already been set.
710
711         * platform/mock/MockRealtimeMediaSource.cpp:
712         (WebCore::MockRealtimeMediaSource::audioDevices): Return an array of devices.
713         (WebCore::MockRealtimeMediaSource::videoDevices): Ditto.
714         (WebCore::MockRealtimeMediaSource::MockRealtimeMediaSource):
715         (WebCore::MockRealtimeMediaSource::mockAudioSourcePersistentID): Deleted.
716         (WebCore::MockRealtimeMediaSource::mockVideoSourcePersistentID): Deleted.
717         (WebCore::MockRealtimeMediaSource::mockAudioSourceName): Deleted.
718         (WebCore::MockRealtimeMediaSource::mockVideoSourceName): Deleted.
719         (WebCore::MockRealtimeMediaSource::audioDeviceInfo): Deleted.
720         (WebCore::MockRealtimeMediaSource::videoDeviceInfo): Deleted.
721         * platform/mock/MockRealtimeMediaSource.h:
722
723         * platform/mock/MockRealtimeMediaSourceCenter.cpp:
724         (WebCore::MockRealtimeMediaSourceCenter::validateRequestConstraints):
725         (WebCore::MockRealtimeMediaSourceCenter::createMediaStream):
726         (WebCore::MockRealtimeMediaSourceCenter::getMediaStreamDevices):
727         * platform/mock/MockRealtimeVideoSource.cpp:
728         (WebCore::MockRealtimeVideoSource::MockRealtimeVideoSource):
729
730 2017-03-20  Wenson Hsieh  <wenson_hsieh@apple.com>
731
732         TextIndicator should support a mode where selection rects are used to size the snapshot
733         https://bugs.webkit.org/show_bug.cgi?id=169845
734         <rdar://problem/31127818>
735
736         Reviewed by Beth Dakin.
737
738         Adds TextIndicator support in iOS for using the would-be selection rects of a given range to determine
739         snapshotting bounds. See below changes for more details.
740
741         * dom/Range.cpp:
742         (WebCore::Range::collectSelectionRectsWithoutUnionInteriorLines):
743         (WebCore::Range::collectSelectionRects):
744
745         Mark these helper methods as const.
746
747         * dom/Range.h:
748         * page/TextIndicator.cpp:
749         (WebCore::getSelectionRectsForRange):
750         (WebCore::initializeIndicator):
751
752         If TextIndicatorOptionUseSelectionRectForSizing is enabled, then compute selection rects and set the text rects
753         to be the resulting selection rects. These are in document coordinates.
754
755         * page/TextIndicator.h:
756
757 2017-03-20  Simon Fraser  <simon.fraser@apple.com>
758
759         Move code out of renderer destructors into willBeDestroyed()
760         https://bugs.webkit.org/show_bug.cgi?id=169650
761
762         Reviewed by Antti Koivisto.
763
764         This is done for four reasons. First, code in willBeDestroyed() is able to call
765         virtual functions on derived classes. Second, this code will run before we've destroyed
766         the renderer's rareData, so can safely access it. Third, RenderWidget is special, and can have
767         its lifetime extended via manual ref-counting, and we want all cleanup to complete
768         before it goes into this weird zombie state. Fourth, in a shiny future where we have
769         ref-counted RenderObjects, we want cleanup code to be run explicitly and not tied
770         to object lifetime, and this is a step in that direction.
771
772         For all classes that derive from RenderObject, move code from the destructor into
773         willBeDestroyed(). New willBeDestroyed() implementations must call the base class.
774
775         RenderBlock and RenderBlockFlow are special; RenderBlockFlow::willBeDestroyed()
776         skips over RenderBlock::willBeDestroyed(), but they both need to run some code, which
777         I moved into RenderBlock::blockWillBeDestroyed().
778
779         * rendering/RenderBlock.cpp:
780         (WebCore::RenderBlock::~RenderBlock):
781         (WebCore::RenderBlock::willBeDestroyed):
782         (WebCore::RenderBlock::blockWillBeDestroyed):
783         * rendering/RenderBlock.h:
784         * rendering/RenderBlockFlow.cpp:
785         (WebCore::RenderBlockFlow::~RenderBlockFlow):
786         (WebCore::RenderBlockFlow::willBeDestroyed):
787         * rendering/RenderBox.cpp:
788         (WebCore::RenderBox::~RenderBox):
789         (WebCore::RenderBox::willBeDestroyed):
790         * rendering/RenderBox.h:
791         * rendering/RenderBoxModelObject.cpp:
792         (WebCore::RenderBoxModelObject::~RenderBoxModelObject):
793         * rendering/RenderCounter.cpp:
794         (WebCore::RenderCounter::~RenderCounter):
795         (WebCore::RenderCounter::willBeDestroyed):
796         * rendering/RenderCounter.h:
797         * rendering/RenderElement.cpp:
798         (WebCore::RenderElement::~RenderElement):
799         (WebCore::RenderElement::willBeDestroyed):
800         * rendering/RenderEmbeddedObject.cpp:
801         (WebCore::RenderEmbeddedObject::~RenderEmbeddedObject):
802         (WebCore::RenderEmbeddedObject::willBeDestroyed):
803         * rendering/RenderEmbeddedObject.h:
804         * rendering/RenderImage.cpp:
805         (WebCore::RenderImage::~RenderImage):
806         (WebCore::RenderImage::willBeDestroyed):
807         * rendering/RenderImage.h:
808         * rendering/RenderLayerModelObject.cpp:
809         (WebCore::RenderLayerModelObject::~RenderLayerModelObject):
810         (WebCore::RenderLayerModelObject::willBeDestroyed):
811         * rendering/RenderLayerModelObject.h:
812         * rendering/RenderLineBreak.cpp:
813         (WebCore::RenderLineBreak::~RenderLineBreak):
814         (WebCore::RenderLineBreak::willBeDestroyed):
815         * rendering/RenderLineBreak.h:
816         * rendering/RenderListBox.cpp:
817         (WebCore::RenderListBox::~RenderListBox):
818         (WebCore::RenderListBox::willBeDestroyed):
819         * rendering/RenderListBox.h:
820         * rendering/RenderListItem.cpp:
821         (WebCore::RenderListItem::~RenderListItem):
822         (WebCore::RenderListItem::willBeDestroyed):
823         * rendering/RenderListItem.h:
824         * rendering/RenderListMarker.cpp:
825         (WebCore::RenderListMarker::~RenderListMarker):
826         (WebCore::RenderListMarker::willBeDestroyed):
827         * rendering/RenderListMarker.h:
828         * rendering/RenderMenuList.cpp:
829         (WebCore::RenderMenuList::~RenderMenuList):
830         (WebCore::RenderMenuList::willBeDestroyed):
831         * rendering/RenderMenuList.h:
832         * rendering/RenderNamedFlowThread.cpp:
833         (WebCore::RenderNamedFlowThread::~RenderNamedFlowThread):
834         (WebCore::RenderNamedFlowThread::willBeDestroyed):
835         * rendering/RenderNamedFlowThread.h:
836         * rendering/RenderObject.cpp:
837         (WebCore::RenderObject::willBeDestroyed):
838         * rendering/RenderQuote.cpp:
839         (WebCore::RenderQuote::~RenderQuote):
840         (WebCore::RenderQuote::willBeDestroyed):
841         * rendering/RenderQuote.h:
842         * rendering/RenderSearchField.cpp:
843         (WebCore::RenderSearchField::~RenderSearchField):
844         (WebCore::RenderSearchField::willBeDestroyed):
845         * rendering/RenderSearchField.h:
846         * rendering/RenderSnapshottedPlugIn.cpp:
847         (WebCore::RenderSnapshottedPlugIn::~RenderSnapshottedPlugIn):
848         (WebCore::RenderSnapshottedPlugIn::willBeDestroyed):
849         * rendering/RenderSnapshottedPlugIn.h:
850         * rendering/RenderText.cpp:
851         (WebCore::RenderText::~RenderText):
852         (WebCore::RenderText::willBeDestroyed):
853         * rendering/RenderTextControlMultiLine.cpp:
854         (WebCore::RenderTextControlMultiLine::~RenderTextControlMultiLine):
855         (WebCore::RenderTextControlMultiLine::willBeDestroyed):
856         * rendering/RenderTextControlMultiLine.h:
857         * rendering/RenderVideo.cpp:
858         (WebCore::RenderVideo::~RenderVideo):
859         (WebCore::RenderVideo::willBeDestroyed):
860         * rendering/RenderVideo.h:
861         * rendering/RenderWidget.h:
862         * rendering/svg/RenderSVGImage.cpp:
863         (WebCore::RenderSVGImage::~RenderSVGImage):
864         (WebCore::RenderSVGImage::willBeDestroyed):
865         * rendering/svg/RenderSVGImage.h:
866         * rendering/svg/RenderSVGResourceContainer.cpp:
867         (WebCore::RenderSVGResourceContainer::~RenderSVGResourceContainer):
868         (WebCore::RenderSVGResourceContainer::willBeDestroyed):
869
870 2017-03-20  Jon Lee  <jonlee@apple.com>
871
872         Mark differences in media stream implementation
873         https://bugs.webkit.org/show_bug.cgi?id=169873
874
875         Reviewed by Eric Carlson.
876
877         Rearrange IDL and add comments based on 05 February 2017 Editor's Draft of Media
878         Capture and Streams spec.
879         * Modules/mediastream/DOMURLMediaStream.idl:
880         * Modules/mediastream/MediaDeviceInfo.idl:
881         * Modules/mediastream/MediaDevices.idl:
882         * Modules/mediastream/MediaStream.idl:
883         * Modules/mediastream/MediaStreamEvent.idl:
884         * Modules/mediastream/MediaStreamTrack.idl:
885         * Modules/mediastream/MediaStreamTrackEvent.idl:
886         * Modules/mediastream/MediaTrackConstraints.idl:
887         * Modules/mediastream/MediaTrackSupportedConstraints.idl:
888         * Modules/mediastream/NavigatorMediaDevices.idl:
889         * Modules/mediastream/NavigatorUserMedia.idl:
890
891 2017-03-20  Per Arne Vollan  <pvollan@apple.com>
892
893         Use CopyFontDescriptorWithStrokeForStyle to get correct stroke width for captions.
894         https://bugs.webkit.org/show_bug.cgi?id=169674
895
896         Reviewed by Eric Carlson.
897
898         Use the MediaAccessibility function MACopyFontDescriptorWithStrokeForStyle to get
899         correct video captions stroke width from a given font size.
900
901         * html/shadow/MediaControlElements.cpp:
902         (WebCore::MediaControlTextTrackContainerElement::updateTextStrokeStyle):
903         (WebCore::MediaControlTextTrackContainerElement::updateTimerFired):
904         * html/shadow/MediaControlElements.h:
905         * page/CaptionUserPreferences.h:
906         (WebCore::CaptionUserPreferences::captionStrokeWidth):
907         * page/CaptionUserPreferencesMediaAF.cpp:
908         (WebCore::CaptionUserPreferencesMediaAF::captionStrokeWidth):
909         (WebCore::CaptionUserPreferencesMediaAF::captionsTextEdgeCSS):
910         (WebCore::CaptionUserPreferencesMediaAF::strokeWidth): Deleted.
911         * page/CaptionUserPreferencesMediaAF.h:
912         * platform/cf/MediaAccessibilitySoftLink.cpp:
913         * platform/cf/MediaAccessibilitySoftLink.h:
914
915 2017-03-20  Emanuele Aina  <emanuele.aina@collabora.com>
916
917         [Cairo] Ensure depth and stencil renderbuffers are created on GLESv2
918         https://bugs.webkit.org/show_bug.cgi?id=166643
919
920         Reviewed by Darin Adler.
921
922         If the gfx device doesn't support GL_OES_packed_depth_stencil, the
923         separate depth and stencil buffers are not generated.
924
925         Copy what GraphicsContext3DEfl used to do and apply it in
926         GraphicsContext3DCairo.
927
928         The Intel gfx driver seem to tolerate unbound renderbuffers, but
929         enabling debugging in Mesa yields an error:
930
931         $ MESA_DEBUG=1 \
932           MESA_EXTENSION_OVERRIDE=-GL_OES_packed_depth_stencil
933           ./bin/MiniBrowser http://webglsamples.org/aquarium/aquarium.html
934         Mesa: User error: GL_INVALID_OPERATION in glRenderbufferStorage(no renderbuffer bound)
935
936         * platform/graphics/GraphicsContext3D.h:
937         * platform/graphics/cairo/GraphicsContext3DCairo.cpp:
938         (WebCore::GraphicsContext3D::GraphicsContext3D):
939         Ensure separate depth and stencil renderbuffers are created.
940         (WebCore::GraphicsContext3D::~GraphicsContext3D):
941         Ensure separate depth and stencil renderbuffers are released.
942
943 2017-03-19  Chris Dumez  <cdumez@apple.com>
944
945         Implement self.origin
946         https://bugs.webkit.org/show_bug.cgi?id=168023
947
948         Reviewed by Sam Weinig.
949
950         Implement self.origin:
951         - https://html.spec.whatwg.org/multipage/webappapis.html#windoworworkerglobalscope
952
953         Firefox and Chrome already support this.
954
955         Test: imported/w3c/web-platform-tests/html/webappapis/the-windoworworkerglobalscope-mixin/Worker_Self_Origin.html
956
957         * page/DOMWindow.cpp:
958         (WebCore::DOMWindow::origin):
959         * page/DOMWindow.h:
960         * page/WindowOrWorkerGlobalScope.idl:
961         * workers/WorkerGlobalScope.cpp:
962         (WebCore::WorkerGlobalScope::origin):
963         * workers/WorkerGlobalScope.h:
964
965 2017-03-18  Jon Lee  <jonlee@apple.com>
966
967         Add support for ImplementedAs, Clamp, EnforceRange, TreatNullAs for dictionary members
968         https://bugs.webkit.org/show_bug.cgi?id=169731
969
970         Reviewed by Alex Christensen.
971
972         * bindings/scripts/CodeGeneratorJS.pm:
973         (GenerateDictionaryImplementationContent): Create a new $implementationAsKey. Look for
974         ImplementedAs, and if it exists, override the value with the alias. Set the parameters of
975         convert<>() using JSValueToNative.
976         (IsValidContextForJSValueToNative): Update to include IDLDictionaryMembers.
977         (JSValueToNative): Bypass parseEnumeration serialization for enums if the context is an
978         IDLDictionaryMember. Dictionary members need convert<IDLEnumeration> which throw a TypeError
979         or return the enum (and utilizes parseEnumeration). parseEnumeration, in contrast, returns
980         an optional.
981
982         * bindings/scripts/test/TestObj.idl: Add test cases in TestDictionary.
983
984         Update test results.
985         * bindings/scripts/test/JS/JSTestEventConstructor.cpp:
986         * bindings/scripts/test/JS/JSTestObj.cpp:
987         * bindings/scripts/test/JS/JSTestStandaloneDictionary.cpp:
988
989 2017-03-18  Simon Fraser  <simon.fraser@apple.com>
990
991         Use initializers for Document member variables
992         https://bugs.webkit.org/show_bug.cgi?id=169848
993
994         Reviewed by Chris Dumez.
995
996         Move Document to use C++11 brace initializers.
997
998         No behavior change.
999
1000         * dom/Document.cpp:
1001         (WebCore::Document::Document):
1002         * dom/Document.h:
1003         (WebCore::Document::xmlStandaloneStatus):
1004         (WebCore::Document::setHasXMLDeclaration):
1005
1006 2017-03-18  Chris Dumez  <cdumez@apple.com>
1007
1008         innerText setter inserts empty text node if value starts with newline
1009         https://bugs.webkit.org/show_bug.cgi?id=169600
1010
1011         Reviewed by Ryosuke Niwa.
1012
1013         innerText setter should not create empty text nodes as per:
1014         - https://html.spec.whatwg.org/multipage/dom.html#the-innertext-idl-attribute (step 6.2)
1015
1016         No new tests, updated existing test.
1017
1018         * html/HTMLElement.cpp:
1019         (WebCore::textToFragment):
1020
1021 2017-03-18  Chris Dumez  <cdumez@apple.com>
1022
1023         Allow setting the prototype of cross-origin objects, as long as they don't change
1024         https://bugs.webkit.org/show_bug.cgi?id=169787
1025
1026         Reviewed by Mark Lam.
1027
1028         Allow setting the prototype of cross-origin objects, as long as they don't change:
1029         - https://html.spec.whatwg.org/multipage/browsers.html#windowproxy-setprototypeof
1030         - https://html.spec.whatwg.org/multipage/browsers.html#location-setprototypeof
1031         - https://tc39.github.io/ecma262/#sec-set-immutable-prototype
1032
1033         Tests: imported/w3c/web-platform-tests/common/domain-setter.sub.html
1034                imported/w3c/web-platform-tests/html/browsers/history/the-location-interface/location-prototype-setting-cross-origin-domain.sub.html
1035                imported/w3c/web-platform-tests/html/browsers/history/the-location-interface/location-prototype-setting-goes-cross-origin-domain.sub.html
1036                imported/w3c/web-platform-tests/html/browsers/history/the-location-interface/location-prototype-setting-same-origin-domain.sub.html
1037                imported/w3c/web-platform-tests/html/browsers/history/the-location-interface/location-prototype-setting-same-origin.html
1038                imported/w3c/web-platform-tests/html/browsers/the-windowproxy-exotic-object/windowproxy-prototype-setting-cross-origin-domain.sub.html
1039                imported/w3c/web-platform-tests/html/browsers/the-windowproxy-exotic-object/windowproxy-prototype-setting-goes-cross-origin-domain.sub.html
1040                imported/w3c/web-platform-tests/html/browsers/the-windowproxy-exotic-object/windowproxy-prototype-setting-same-origin-domain.sub.html
1041                imported/w3c/web-platform-tests/html/browsers/the-windowproxy-exotic-object/windowproxy-prototype-setting-same-origin.html
1042
1043         * bindings/js/JSLocationCustom.cpp:
1044         * page/Location.idl:
1045         Drop custom setPrototype() implementation for Location and mark Location as an immutable
1046         prototype exotic object now that JSC does the right thing for those.
1047
1048 2017-03-17  Youenn Fablet  <youenn@apple.com>
1049
1050         Stop sending media data as soon as peer connection is closed
1051         https://bugs.webkit.org/show_bug.cgi?id=169813
1052
1053         Reviewed by Eric Carlson.
1054
1055         Stopping sending of media data as soon as the peer connection is closed.
1056         By stopping sending at source level, this may stop by a few frames/chunks earlier than before.
1057         Making sure RealtimeOutgoingVideoSource is stopping observing the media source when being stopped and deleted.
1058
1059         * Modules/mediastream/libwebrtc/LibWebRTCPeerConnectionBackend.cpp:
1060         (WebCore::LibWebRTCPeerConnectionBackend::doStop):
1061         * platform/mediastream/mac/RealtimeOutgoingAudioSource.cpp:
1062         (WebCore::RealtimeOutgoingAudioSource::stop):
1063         * platform/mediastream/mac/RealtimeOutgoingAudioSource.h:
1064         * platform/mediastream/mac/RealtimeOutgoingVideoSource.cpp:
1065         (WebCore::RealtimeOutgoingVideoSource::stop):
1066         * platform/mediastream/mac/RealtimeOutgoingVideoSource.h:
1067
1068 2017-03-17  Youenn Fablet  <youenn@apple.com>
1069
1070         Implement incoming webrtc data based on tracksCurr
1071         https://bugs.webkit.org/show_bug.cgi?id=169836
1072
1073         Reviewed by Eric Carlson.
1074
1075         Test: webrtc/video-with-receiver.html
1076
1077         Constructing incoming tracks based on libwebrtc OnAddTrack.
1078         Constructing incoming media streams based on libwebrtc OnAddStream.
1079         Firing only addstream if legacy API flag is on.
1080
1081         Ensuring that media stream and media stream tracks relationship is still correctly implemented.
1082         For that, we keep a map that relates libwebrtc media streams with WebCore media streams.
1083         Adding the ability to get a receiver related to the track on the track event.
1084
1085         Implementing the possibility to create a transceiver ahead of track arrival time.
1086         Created transceivers that are not related to any real source are kept in the peer connection back end.
1087         When a libwebrtc track is appearing, it is associated with the track source of the corresponding transceiver based on track type.
1088
1089         Added the ability to create empty real time sources and set their data libwebrtc track when being available.
1090
1091         * Modules/mediastream/MediaStream.cpp:
1092         (WebCore::MediaStream::addTrackFromPlatform):
1093         * Modules/mediastream/MediaStream.h:
1094         * Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.cpp:
1095         (WebCore::LibWebRTCMediaEndpoint::mediaStreamFromRTCStream):
1096         (WebCore::LibWebRTCMediaEndpoint::addRemoteStream):
1097         (WebCore::LibWebRTCMediaEndpoint::addRemoteTrack):
1098         (WebCore::LibWebRTCMediaEndpoint::removeRemoteStream):
1099         (WebCore::LibWebRTCMediaEndpoint::OnAddStream):
1100         (WebCore::LibWebRTCMediaEndpoint::OnRemoveStream):
1101         (WebCore::LibWebRTCMediaEndpoint::OnAddTrack):
1102         (WebCore::LibWebRTCMediaEndpoint::stop):
1103         (WebCore::createMediaStreamTrack): Deleted.
1104         (WebCore::LibWebRTCMediaEndpoint::addStream): Deleted.
1105         * Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.h:
1106         * Modules/mediastream/libwebrtc/LibWebRTCPeerConnectionBackend.cpp:
1107         (WebCore::LibWebRTCPeerConnectionBackend::doStop):
1108         (WebCore::createReceiverForSource):
1109         (WebCore::createEmptySource):
1110         (WebCore::LibWebRTCPeerConnectionBackend::createReceiver):
1111         (WebCore::LibWebRTCPeerConnectionBackend::videoReceiver):
1112         (WebCore::LibWebRTCPeerConnectionBackend::audioReceiver):
1113         (WebCore::LibWebRTCPeerConnectionBackend::removeRemoteStream):
1114         (WebCore::LibWebRTCPeerConnectionBackend::addRemoteStream):
1115         * Modules/mediastream/libwebrtc/LibWebRTCPeerConnectionBackend.h:
1116         * platform/mediastream/mac/RealtimeIncomingAudioSource.cpp:
1117         (WebCore::RealtimeIncomingAudioSource::setSourceTrack):
1118         * platform/mediastream/mac/RealtimeIncomingAudioSource.h:
1119         * platform/mediastream/mac/RealtimeIncomingVideoSource.cpp:
1120         (WebCore::RealtimeIncomingVideoSource::setSourceTrack):
1121         * platform/mediastream/mac/RealtimeIncomingVideoSource.h:
1122
1123 2017-03-17  Eric Carlson  <eric.carlson@apple.com>
1124
1125         [MediaStream] Compensate for video capture orientation
1126         https://bugs.webkit.org/show_bug.cgi?id=169313
1127         <rdar://problem/30994785>
1128
1129         Unreviewed, fix a crash in r214120 found by the bots.
1130
1131         * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.mm:
1132         (-[WebAVSampleBufferStatusChangeListener invalidate]): Drive-by removal of unnecessary code.
1133         (-[WebAVSampleBufferStatusChangeListener observeValueForKeyPath:ofObject:change:context:]):
1134         Actually retain self before callOnMainThread.
1135         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::~MediaPlayerPrivateMediaStreamAVFObjC): 
1136         Invalidate the change listener first.
1137
1138 2017-03-17  Dean Jackson  <dino@apple.com>
1139
1140         MediaQueryList instances do not update for `prefers-reduced-motion`
1141         https://bugs.webkit.org/show_bug.cgi?id=169835
1142         <rdar://problem/30339378>
1143
1144         Reviewed by Anders Carlsson.
1145
1146         Tell the document it needs to evaluate the MediaQueryLists
1147         if accessibility settings change.
1148
1149         Test: fast/media/mq-prefers-reduced-motion-matchMedia.html
1150
1151         * page/Page.cpp:
1152         (WebCore::Page::accessibilitySettingsDidChange):
1153
1154 2017-03-17  Brady Eidson  <beidson@apple.com>
1155
1156         Make HTTPCookieStorage operate in the UIProcess in absence of a WebProcessPool.
1157         <rdar://problem/31102330> and https://bugs.webkit.org/show_bug.cgi?id=169797
1158
1159         Reviewed by Alex Christensen.
1160
1161         No new tests (No behavior change).
1162
1163         * platform/network/NetworkStorageSession.h:
1164         * platform/network/cocoa/NetworkStorageSessionCocoa.mm:
1165         (WebCore::NetworkStorageSession::flushCookieStore):
1166
1167         * platform/network/soup/NetworkStorageSessionSoup.cpp:
1168         (WebCore::NetworkStorageSession::flushCookieStore):
1169
1170 2017-03-17  Dave Hyatt  <hyatt@apple.com>
1171
1172         Disable per-region boxes for multicolumn
1173         https://bugs.webkit.org/show_bug.cgi?id=169830
1174
1175         Reviewed by Zalan Bujtas.
1176
1177         Test: fast/multicol/float-adjacent-to-overflow-block.html
1178
1179         * rendering/RenderBlockFlow.cpp:
1180         (WebCore::RenderBlockFlow::determineLogicalLeftPositionForChild):
1181         * rendering/RenderBox.cpp:
1182         (WebCore::RenderBox::borderBoxRectInRegion):
1183         (WebCore::RenderBox::renderBoxRegionInfo):
1184         Limit all of the per-region box code to RenderNamedFlowThreads.
1185         This code should never be used by multicolumn layout.
1186
1187 2017-03-17  Said Abou-Hallawa  <sabouhallawa@apple.com>
1188
1189         Time channel attack on SVG Filters
1190         https://bugs.webkit.org/show_bug.cgi?id=118689
1191
1192         Reviewed by Simon Fraser.
1193
1194         The time channel attack can happen if the attacker applies FEColorMatrix
1195         or FEConvolveMatrix and provides a matrix which is filled with subnormal
1196         floating point values. Performing floating-point operations on subnormals
1197         is very expensive unless the pixel in the source graphics is black (or
1198         zero). By measuring the time a filter takes to be applied, the attacker
1199         can know whether the pixel he wants to steal from  an iframe is black or
1200         white. By repeating the same process on all the pixels in the iframe, the
1201         attacker can reconstruct the whole page of the iframe.
1202
1203         To fix this issue, the values in the matrices of these filters will clamped
1204         to FLT_MIN. We do not want to consume too much time calculating filtered
1205         pixels because of such tiny values. The difference between applying FLT_MIN
1206         and applying a subnormal should not be even noticeable. Normalizing the
1207         floating-point matrices should happen only at the beginning of the filter
1208         platformApplySoftware().
1209
1210         * platform/graphics/filters/FEColorMatrix.cpp:
1211         (WebCore::FEColorMatrix::platformApplySoftware):
1212         * platform/graphics/filters/FEConvolveMatrix.cpp:
1213         (WebCore::FEConvolveMatrix::fastSetInteriorPixels):
1214         (WebCore::FEConvolveMatrix::fastSetOuterPixels):
1215         (WebCore::FEConvolveMatrix::platformApplySoftware):
1216         * platform/graphics/filters/FEConvolveMatrix.h:
1217         * platform/graphics/filters/FilterEffect.h:
1218         (WebCore::FilterEffect::normalizedFloats):
1219
1220 2017-03-17  Jer Noble  <jer.noble@apple.com>
1221
1222         Explicitly resize the audio buffer in RealtimeOutgoingAudioSource.
1223         https://bugs.webkit.org/show_bug.cgi?id=169814
1224         <rdar://problem/30975496>
1225
1226         Reviewed by Eric Carlson.
1227
1228         Rather than just reserving sufficient capacity, actually change the buffer's underlying size to match.
1229
1230         * platform/mediastream/mac/RealtimeOutgoingAudioSource.cpp:
1231         (WebCore::RealtimeOutgoingAudioSource::pullAudioData):
1232
1233 2017-03-17  Jiewen Tan  <jiewen_tan@apple.com>
1234
1235         [WebCrypto] Make sure all CryptoKey classes are structured clonable
1236         https://bugs.webkit.org/show_bug.cgi?id=169232
1237         <rdar://problem/31106660>
1238
1239         Reviewed by Brent Fulgham.
1240
1241         This patch does the following few things: 1) It makes CryptoKeyEC and CryptoKeyRaw
1242         structured clonable; 2) It makes CryptoKeyAES and CryptoKeyHMAC to use a move importer
1243         during deserialization; 3) It adds some tests to make sure CryptoKeyAES, CryptoKeyHMAC
1244         and CryptoKeyRSA won't lose their internal data during serialization/deserialization.
1245
1246         Tests: crypto/workers/subtle/ec-postMessage-worker.html
1247                crypto/workers/subtle/raw-postMessage-worker.html
1248
1249         * bindings/js/SerializedScriptValue.cpp:
1250         (WebCore::CloneSerializer::write):
1251         (WebCore::CloneDeserializer::readHMACKey):
1252         (WebCore::CloneDeserializer::readAESKey):
1253         (WebCore::CloneDeserializer::readECKey):
1254         (WebCore::CloneDeserializer::readRawKey):
1255         (WebCore::CloneDeserializer::readCryptoKey):
1256         * crypto/keys/CryptoKeyEC.cpp:
1257         (WebCore::CryptoKeyEC::namedCurveString):
1258         (WebCore::CryptoKeyEC::isValidECAlgorithm):
1259         * crypto/keys/CryptoKeyEC.h:
1260
1261 2017-03-17  Michael Saboff  <msaboff@apple.com>
1262
1263         Use USE_INTERNAL_SDK to compute ENABLE_FAST_JIT_PERMISSIONS instead of HAVE_INTERNAL_SDK
1264         https://bugs.webkit.org/show_bug.cgi?id=169817
1265
1266         Reviewed by Filip Pizlo.
1267
1268         * Configurations/FeatureDefines.xcconfig:
1269
1270 2017-03-17  Eric Carlson  <eric.carlson@apple.com>
1271
1272         [MediaStream] Compensate for video capture orientation
1273         https://bugs.webkit.org/show_bug.cgi?id=169313
1274         <rdar://problem/30994785>
1275
1276         Reviewed by Jer Noble.
1277
1278         No new tests, the mock video source doesn't support rotation. Test will be added when this
1279         is fixed in https://bugs.webkit.org/show_bug.cgi?id=169822.
1280
1281         Add 'orientation' and 'mirrored' attributes to MediaSample
1282         * platform/MediaSample.h:
1283         (WebCore::MediaSample::videoOrientation):
1284         (WebCore::MediaSample::videoMirrored):
1285         * platform/graphics/avfoundation/MediaSampleAVFObjC.h:
1286
1287         A video sample can be rotated and/or mirrored, so the video layer may need to be rotated
1288         and resized for display. We don't want expose this information to the renderer, so allocate
1289         return a generic CALayer as the player's platforLayer, and add the video layer as a sublayer
1290         so we can adjust it to display correctly. Add an enum for playback state as well as display
1291         mode so we correctly display a black frame when video frames are available but playback has
1292         not yet started.
1293
1294         * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.h:
1295         * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.mm:
1296         (-[WebAVSampleBufferStatusChangeListener initWithParent:]):
1297         (-[WebAVSampleBufferStatusChangeListener invalidate]):
1298         (-[WebAVSampleBufferStatusChangeListener beginObservingLayers]):
1299         (-[WebAVSampleBufferStatusChangeListener stopObservingLayers]): Ditto.
1300         (-[WebAVSampleBufferStatusChangeListener observeValueForKeyPath:ofObject:change:context:]):
1301         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::videoTransformationMatrix):
1302         (WebCore::runWithoutAnimations):
1303         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::enqueueVideoSample):
1304         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::layerErrorDidChange):
1305         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::ensureLayers):
1306         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::destroyLayers):
1307         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::cancelLoad):
1308         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::platformLayer):
1309         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::displayLayer):
1310         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::backgroundLayer):
1311         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::currentDisplayMode):
1312         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::updateDisplayMode):
1313         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::play):
1314         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::pause):
1315         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::currentMediaTime):
1316         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::activeStatusChanged):
1317         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::updateRenderingMode):
1318         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::checkSelectedVideoTrack):
1319         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::paintCurrentFrameInContext):
1320         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::acceleratedRenderingStateChanged):
1321         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::setShouldBufferData):
1322         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::backgroundLayerBoundsChanged):
1323         (-[WebAVSampleBufferStatusChangeListener beginObservingLayer:]): Deleted.
1324         (-[WebAVSampleBufferStatusChangeListener stopObservingLayer:]): Deleted.
1325         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::ensureLayer): Deleted.
1326         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::destroyLayer): Deleted.
1327         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::paused): Deleted.
1328         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::shouldBePlaying): Deleted.
1329
1330         * platform/mediastream/mac/AVVideoCaptureSource.h:
1331         * platform/mediastream/mac/AVVideoCaptureSource.mm:
1332         (WebCore::AVVideoCaptureSource::processNewFrame): Add connection parameter so we can get the
1333         video orientation.
1334         (WebCore::AVVideoCaptureSource::captureOutputDidOutputSampleBufferFromConnection):
1335
1336         Pass sample orientation to libwebrtc.
1337         * platform/mediastream/mac/RealtimeOutgoingVideoSource.cpp:
1338         (WebCore::RealtimeOutgoingVideoSource::sendFrame):
1339         (WebCore::RealtimeOutgoingVideoSource::videoSampleAvailable):
1340         * platform/mediastream/mac/RealtimeOutgoingVideoSource.h:
1341
1342 2017-03-17  Zalan Bujtas  <zalan@apple.com>
1343
1344         Fix the flow thread state on the descendants of out of flow positioned replaced elements.
1345         https://bugs.webkit.org/show_bug.cgi?id=169821
1346         <rdar://problem/30964017>
1347
1348         Reviewed by Simon Fraser.
1349
1350         Descendants of a replaced out of flow elmement should inherit the flowthread state
1351         from the replaced element and not from the replaced element's parent.
1352
1353         Test: fast/multicol/fix-inherit-when-container-is-replaced.html
1354
1355         * rendering/RenderObject.cpp:
1356         (WebCore::RenderObject::computedFlowThreadState):
1357
1358 2017-03-17  Jon Davis  <jond@apple.com>
1359
1360         Update feature status for outdated entries: CSS Shapes, Force Click Events
1361         https://bugs.webkit.org/show_bug.cgi?id=169829
1362
1363         Reviewed by Matt Baker.
1364
1365         * features.json:
1366
1367 2017-03-17  Alex Christensen  <achristensen@webkit.org>
1368
1369         Make SocketStreamError a private header.
1370         https://bugs.webkit.org/show_bug.cgi?id=169831
1371
1372         * WebCore.xcodeproj/project.pbxproj:
1373         I'll need this from WebKit2.
1374
1375 2017-03-17  Alex Christensen  <achristensen@webkit.org>
1376
1377         Add encoder for SocketStreamError
1378         https://bugs.webkit.org/show_bug.cgi?id=169831
1379
1380         Reviewed by Andy Estes.
1381
1382         This isn't used yet, but we'll soon need to send these across IPC.
1383
1384         * platform/network/SocketStreamError.h:
1385         (WebCore::SocketStreamError::encode):
1386         (WebCore::SocketStreamError::decode):
1387
1388 2017-03-17  Alex Christensen  <achristensen@webkit.org>
1389
1390         Make SocketStreamHandle virtual functions asynchronous
1391         https://bugs.webkit.org/show_bug.cgi?id=169818
1392
1393         Reviewed by Andy Estes.
1394
1395         No change in behavior.  Instead of returning immediately, call a completion handler.
1396         This is in preparation for making them truly asynchronous.
1397
1398         I still need to be able to synchronously get the number of buffered bytes, but the
1399         buffer itself will soon be in the NetworkProcess with a new subclass of SocketStreamHandle
1400         that messages across IPC.  The number of buffered bytes will still be stored in the WebProcess,
1401         and when it updates, the message from SocketStreamHandleClient::didUpdateBufferedAmount will update it.
1402
1403         * CMakeLists.txt:
1404         * WebCore.xcodeproj/project.pbxproj:
1405         * platform/network/SocketStreamHandle.cpp:
1406         (WebCore::SocketStreamHandle::send):
1407         (WebCore::SocketStreamHandle::close):
1408         (WebCore::SocketStreamHandle::sendPendingData): Deleted.
1409         * platform/network/SocketStreamHandle.h:
1410         (WebCore::SocketStreamHandle::bufferedAmount): Deleted.
1411         * platform/network/SocketStreamHandleImpl.cpp: Added.
1412         (WebCore::SocketStreamHandleImpl::platformSend):
1413         (WebCore::SocketStreamHandleImpl::sendPendingData):
1414         (WebCore::SocketStreamHandleImpl::bufferedAmount):
1415         m_buffer was moved from SocketStreamHandle to SocketStreamHandleImpl, so some of the logic must move with it.
1416         I moved as much logic that was shared in the superclass to a new shared location for code shared among the subclass implementations.
1417         * platform/network/cf/SocketStreamHandleImpl.h:
1418         * platform/network/cf/SocketStreamHandleImplCFNet.cpp:
1419         (WebCore::SocketStreamHandleImpl::platformSendInternal):
1420         (WebCore::SocketStreamHandleImpl::platformSend): Deleted.
1421         * platform/network/curl/SocketStreamHandleImpl.h:
1422         * platform/network/curl/SocketStreamHandleImplCurl.cpp:
1423         (WebCore::SocketStreamHandleImpl::platformSendInternal):
1424         (WebCore::SocketStreamHandleImpl::platformSend): Deleted.
1425         * platform/network/soup/SocketStreamHandleImpl.h:
1426         * platform/network/soup/SocketStreamHandleImplSoup.cpp:
1427         (WebCore::SocketStreamHandleImpl::platformSendInternal):
1428         (WebCore::SocketStreamHandleImpl::platformSend): Deleted.
1429
1430 2017-03-17  Antti Koivisto  <antti@apple.com>
1431
1432         Add a reload policy where only expired subresources are revalidated
1433         https://bugs.webkit.org/show_bug.cgi?id=169756
1434
1435         Reviewed by Andreas Kling.
1436
1437         Test: http/tests/cache/reload-expired-only.html
1438
1439         The default reload behavior revalidates all resources on the page. This patch adds
1440         a new policy that revalidates expired (and uncacheable) resources only. Using this
1441         policy can speed up reloads significantly and also reduce network traffic and server
1442         load.
1443
1444         * history/PageCache.cpp:
1445         (WebCore::canCachePage):
1446         * inspector/InspectorPageAgent.cpp:
1447         (WebCore::InspectorPageAgent::reload):
1448         * loader/FrameLoader.cpp:
1449         (WebCore::isBackForwardLoadType):
1450         (WebCore::isReload):
1451
1452             Add a helper function.
1453
1454         (WebCore::FrameLoader::loadURL):
1455         (WebCore::logNavigation):
1456         (WebCore::FrameLoader::reload):
1457
1458             Replace bool arguments with OptionSet<ReloadOption>. Most of the patch is about adapting to this.
1459
1460         (WebCore::FrameLoader::transitionToCommitted):
1461         (WebCore::FrameLoader::subresourceCachePolicy):
1462
1463             Return CachePolicyVerify for 'ReloadExpiredOnly' frame load type. This is the substantive
1464             change that causes the behavior difference.
1465
1466         (WebCore::FrameLoader::checkLoadCompleteForThisFrame):
1467         (WebCore::FrameLoader::defaultRequestCachingPolicy):
1468
1469             Flip the isMainResource condition for better readability.
1470
1471         (WebCore::FrameLoader::shouldPerformFragmentNavigation):
1472         (WebCore::FrameLoader::loadDifferentDocumentItem):
1473         * loader/FrameLoader.h:
1474         (WebCore::FrameLoader::reload):
1475         * loader/FrameLoaderTypes.h:
1476         * loader/HistoryController.cpp:
1477         (WebCore::HistoryController::restoreDocumentState):
1478         * page/DiagnosticLoggingKeys.cpp:
1479         (WebCore::DiagnosticLoggingKeys::reloadRevalidatingExpiredKey):
1480         * page/DiagnosticLoggingKeys.h:
1481         * replay/UserInputBridge.cpp:
1482         (WebCore::UserInputBridge::reloadFrame):
1483         * replay/UserInputBridge.h:
1484         * testing/Internals.cpp:
1485         (WebCore::Internals::forceReload):
1486         (WebCore::Internals::reloadExpiredOnly):
1487
1488             Testing support.
1489
1490         * testing/Internals.h:
1491         * testing/Internals.idl:
1492
1493 2017-03-17  Nan Wang  <n_wang@apple.com>
1494
1495         AX: VoiceOver no longer works corectly with editable text in the web
1496         https://bugs.webkit.org/show_bug.cgi?id=169801
1497
1498         Reviewed by Chris Fleizach.
1499
1500         The issue is that since we are entering text controls when getting the text marker,
1501         the end text marker of the input tag might associate to the placeholder div instead of 
1502         the input tag itself. 
1503         Fixed the issue by checking the shadow elements using shadowHost() instead of isShadowRoot().
1504         Also, only enter text controls when navigating by characters/indexes, so that both Mac and
1505         iOS will get the correct text marker ranges for shadow host elements.
1506
1507         Tests: accessibility/ios-simulator/element-text-range-for-text-control.html
1508                accessibility/mac/text-markers-for-input-with-placeholder.html
1509
1510         * accessibility/AXObjectCache.cpp:
1511         (WebCore::AXObjectCache::traverseToOffsetInRange):
1512         (WebCore::AXObjectCache::startOrEndCharacterOffsetForRange):
1513         (WebCore::AXObjectCache::characterOffsetForIndex):
1514         * accessibility/AXObjectCache.h:
1515
1516 2017-03-17  Wenson Hsieh  <wenson_hsieh@apple.com>
1517
1518         [WK1] Support animated transitions when performing a data interaction operation
1519         https://bugs.webkit.org/show_bug.cgi?id=169805
1520         <rdar://problem/31045767>
1521
1522         Reviewed by Beth Dakin and Megan Gardner.
1523
1524         When performing a snapshot excluding the current selection, use ScrollableArea::visibleContentRect to compute
1525         the visible content rect rather than FrameView::visualViewportRect. In WebKit1, the latter will return the
1526         entire content view's bounds.
1527
1528         * page/TextIndicator.cpp:
1529         (WebCore::takeSnapshots):
1530
1531 2017-03-17  Dave Hyatt  <hyatt@apple.com>
1532
1533         Initial letter does not paginate properly.
1534         https://bugs.webkit.org/show_bug.cgi?id=169795
1535         <rdar://problem/23715770>
1536
1537         Reviewed by Zalan Bujtas.
1538
1539         Tests: fast/css-generated-content/initial-letter-pagination-raised.html
1540                fast/css-generated-content/initial-letter-pagination-raised-rl.html
1541                fast/css-generated-content/initial-letter-pagination-sunken.html
1542                fast/css-generated-content/initial-letter-pagination-sunken-rl.html
1543
1544         * rendering/FloatingObjects.cpp:
1545         (WebCore::FloatingObject::FloatingObject):
1546         (WebCore::FloatingObject::copyToNewContainer):
1547         (WebCore::FloatingObject::cloneForNewParent):
1548         (WebCore::FloatingObject::translationOffsetToAncestor):
1549         * rendering/FloatingObjects.h:
1550         (WebCore::FloatingObject::setMarginOffset):
1551         (WebCore::FloatingObject::locationOffsetOfBorderBox):
1552         (WebCore::FloatingObject::marginOffset):
1553         Add the margin offset to the FloatingObject so that we can control the
1554         placement of the border box relative to the margin box without relying
1555         on only the CSS-specified margins. This allows for sunken initial letter
1556         FloatingObjects to be created and propagated out to ancestor blocks for painting
1557         without altering the CSS margins of the sunken letter.
1558
1559         * rendering/RenderBlockFlow.cpp:
1560         (WebCore::RenderBlockFlow::adjustForUnsplittableChild):
1561         Update the logical height for initial letter containers after the initial
1562         letter shifts to the next page, since the lines that follow need to lay out
1563         relative to the initial letter, i.e., they shift down if it shifts down.
1564
1565         (WebCore::RenderBlockFlow::addOverflowFromFloats):
1566         (WebCore::RenderBlockFlow::paintFloats):
1567         (WebCore::RenderBlockFlow::clipOutFloatingObjects):
1568         Patched to use the new helpers on FloatingObject rather than
1569         xPositionForFloatIncludingMargins and yPositionForFloatIncludingMargins.
1570
1571         (WebCore::RenderBlockFlow::computeLogicalLocationForFloat):
1572         Updated to set the placement and margins of the floating object before
1573         returning. The initial letter adjustments have been factored out into their
1574         own function.
1575
1576         (WebCore::RenderBlockFlow::adjustInitialLetterPosition):
1577         A helper function called by computeLogicalLocationForFloat that handles
1578         the placement and margin adjustments for initial letters. Note that sunken
1579         letters no longer "hack" the top margin of the child but instead rely on
1580         the fact that the FloatingObject has its own independent margin offset now
1581         that can be set to a value that is distinct from the CSS supplied margin.
1582
1583         (WebCore::RenderBlockFlow::positionNewFloats):
1584         Revised to no longer do the placement, but to let computeLogicalLocationForFloat
1585         do it. The height is still set here however, since we don't know that until after
1586         the child has received a layout.
1587
1588         (WebCore::RenderBlockFlow::addOverhangingFloats):
1589         (WebCore::RenderBlockFlow::flipFloatForWritingModeForChild):
1590         (WebCore::RenderBlockFlow::hitTestFloats):
1591         (WebCore::RenderBlockFlow::adjustForBorderFit):
1592         Patched to use the new FloatingObject helpers rather than
1593         xPositionForFloatIncludingMargins and yPositionForFloatIncludingMargins.
1594
1595         * rendering/RenderBlockFlow.h:
1596         (WebCore::RenderBlockFlow::setLogicalMarginsForFloat):
1597         New helper function for setting the margin offsets on a FloatingObject.
1598
1599         (WebCore::RenderBlockFlow::xPositionForFloatIncludingMargin): Deleted.
1600         (WebCore::RenderBlockFlow::yPositionForFloatIncludingMargin): Deleted.
1601         Deleted in favor of new FloatingObject helpers.
1602
1603         * rendering/RenderBox.cpp:
1604         (WebCore::RenderBox::isUnsplittableForPagination):
1605         Make initial letter unsplittable as far as pagination is concerned.
1606
1607         * rendering/RootInlineBox.cpp:
1608         (WebCore::RootInlineBox::ascentAndDescentForBox):
1609         (WebCore::RootInlineBox::includeFontForBox):
1610         (WebCore::RootInlineBox::includeGlyphsForBox):
1611         (WebCore::RootInlineBox::fitsToGlyphs):
1612         Turn off the restriction that you can't fit to vertical glyphs. The numbers returned
1613         are fine now. This allows vertical initial letters to work.
1614
1615 2017-03-17  Youenn Fablet  <youenn@apple.com>
1616
1617         RealtimeIncomingAudioSource is not stopping properly
1618         https://bugs.webkit.org/show_bug.cgi?id=169807
1619
1620         Reviewed by Eric Carlson.
1621
1622         Test: webrtc/release-after-getting-track.html
1623
1624         * platform/mediastream/mac/RealtimeIncomingAudioSource.cpp:
1625         (WebCore::RealtimeIncomingAudioSource::~RealtimeIncomingAudioSource):
1626         (WebCore::RealtimeIncomingAudioSource::stopProducingData):
1627
1628 2017-03-16  Alex Christensen  <achristensen@webkit.org>
1629
1630         Use completion handlers instead of return values for sending websocket data
1631         https://bugs.webkit.org/show_bug.cgi?id=169802
1632
1633         Reviewed by Carlos Garcia Campos.
1634
1635         No change in behavior, but this is a baby step towards making things more asynchronous.
1636
1637         * Modules/websockets/WebSocketChannel.cpp:
1638         (WebCore::WebSocketChannel::didOpenSocketStream):
1639         (WebCore::WebSocketChannel::processOutgoingFrameQueue):
1640         (WebCore::WebSocketChannel::sendFrame):
1641         * Modules/websockets/WebSocketChannel.h:
1642         * platform/network/SocketStreamHandle.cpp:
1643         (WebCore::SocketStreamHandle::send):
1644         * platform/network/SocketStreamHandle.h:
1645         * platform/network/cf/SocketStreamHandleImpl.h:
1646
1647 2017-03-17  Zan Dobersek  <zdobersek@igalia.com>
1648
1649         WebGPU: build fixes for non-Cocoa platforms
1650         https://bugs.webkit.org/show_bug.cgi?id=169781
1651
1652         Reviewed by Alex Christensen.
1653
1654         Enable building WebGPU code for other ports and fix various build
1655         failures. This still leaves the GPUDevice::platformLayer() method
1656         missing for other ports, as well as the general implementation of
1657         the WebGPU platform abstractions under platform/graphics/gpu/.
1658
1659         * CMakeLists.txt: Move the WebGPU build targets here.
1660         * PlatformMac.cmake:
1661         * html/canvas/WebGPULibrary.h: Explicitly include the WTFString.h
1662         header to suppress missing WTF::String definition errors.
1663         * platform/graphics/gpu/GPUBuffer.cpp:
1664         (WebCore::GPUBuffer::contents): Avoid ambiguous calls to
1665         ArrayBuffer::create() by passing nullptr as the first argument.
1666         * platform/graphics/gpu/GPUDevice.h: Include the Forward.h header
1667         to forward-declare the WTF::String class. Also remove the unused
1668         PlatformGPUDevice typedef for non-Cocoa platforms.
1669         (WebCore::GPUDevice::layer): Move this and the related m_layer
1670         member variable under the PLATFORM(COCOA) guard.
1671         * platform/graphics/gpu/GPUFunction.cpp:
1672         (WebCore::GPUFunction::GPUFunction): Remove the GPULibrary
1673         parameter checks in this no-op constructor that's used on
1674         non-Cocoa platforms.
1675
1676 2017-03-17  Miguel Gomez  <magomez@igalia.com>
1677
1678         Follow-up (r213833): write a layout test for 169199
1679         https://bugs.webkit.org/show_bug.cgi?id=169576
1680         <rdar://problem/31024766>
1681
1682         Reviewed by Said Abou-Hallawa.
1683
1684         Add a function to Internals to force the deletion of the ImageDecoder just after
1685         requesting the async decoding of a frame, and implement that behaviour in BitmapImage.
1686
1687         Test: fast/images/clear-animation-decoder.html
1688
1689         * platform/graphics/BitmapImage.cpp:
1690         (WebCore::BitmapImage::internalStartAnimation):
1691         * platform/graphics/BitmapImage.h:
1692         * testing/Internals.cpp:
1693         (WebCore::Internals::setClearDecoderAfterAsyncFrameRequestForTesting):
1694         * testing/Internals.h:
1695         * testing/Internals.idl:
1696
1697 2017-03-17  Carlos Garcia Campos  <cgarcia@igalia.com>
1698
1699         [Cairo] Handle the blend mode in GraphicsContext::drawPattern
1700         https://bugs.webkit.org/show_bug.cgi?id=169746
1701
1702         Reviewed by Žan Doberšek.
1703
1704         We are not taking into account the blend mode when passing the cairo operator to drawPatternToCairoContext().
1705         This is based on patch by Žan Doberšek, just adding the toCairoOperator changes to make it easier to handle
1706         it. Instead of checking everywhere if blend mode is Normal to decide whether to use toCairoOperator with
1707         CompositeOperator or BlendMode, there's no a single toCairoOperator that receives both parameters, but BlendMode
1708         is optional and defaults to Normal.
1709
1710         * platform/graphics/cairo/CairoUtilities.cpp:
1711         (WebCore::toCairoCompositeOperator):
1712         (WebCore::toCairoOperator):
1713         * platform/graphics/cairo/CairoUtilities.h:
1714         * platform/graphics/cairo/GraphicsContextCairo.cpp:
1715         (WebCore::GraphicsContext::setPlatformCompositeOperation):
1716         (WebCore::GraphicsContext::drawPattern):
1717
1718 2017-03-16  Alex Christensen  <achristensen@webkit.org>
1719
1720         Fix GTK build.
1721
1722         * platform/network/soup/SocketStreamHandleImplSoup.cpp:
1723         (WebCore::SocketStreamHandleImpl::readBytes):
1724         Changing RefPtr to Ref broke something.
1725         For the record, EWS was orange so I couldn't see these build failures.
1726
1727 2017-03-16  Alex Christensen  <achristensen@webkit.org>
1728
1729         Fix GTK build.
1730
1731         * platform/network/soup/SocketStreamHandleImplSoup.cpp:
1732         (WebCore::SocketStreamHandleImpl::readBytes):
1733         didFailToReceiveSocketStreamData needs a parameter.
1734
1735 2017-03-16  Dean Jackson  <dino@apple.com>
1736
1737         WebGL: Improve index validation when using uint index values
1738         https://bugs.webkit.org/show_bug.cgi?id=169798
1739
1740         Reviewed by Simon Fraser.
1741
1742         Make sure that we test index validation with the correct type.
1743         Also stop using -1 in WebGLBuffer to indicate non-existant values.
1744
1745         Test: fast/canvas/webgl/draw-elements-out-of-bounds-uint-index.html
1746
1747         * html/canvas/WebGL2RenderingContext.cpp:
1748         (WebCore::WebGL2RenderingContext::validateIndexArrayConservative): Use optional<> and
1749         unsigned values.
1750         * html/canvas/WebGLBuffer.cpp: Use unsigned for maxIndex (they can't be negative)
1751         and optional<> to indicate unknown value.
1752         (WebCore::WebGLBuffer::getCachedMaxIndex):
1753         (WebCore::WebGLBuffer::setCachedMaxIndex):
1754         * html/canvas/WebGLBuffer.h:
1755         * html/canvas/WebGLRenderingContext.cpp:
1756         (WebCore::WebGLRenderingContext::validateIndexArrayConservative): Use optional<> and
1757         unsigned values.
1758         * html/canvas/WebGLRenderingContextBase.cpp:
1759         (WebCore::WebGLRenderingContextBase::validateVertexAttributes): No need to check if
1760         an unsigned value is less than zero.
1761
1762 2017-03-16  Simon Fraser  <simon.fraser@apple.com>
1763
1764         Improve the system tracing points
1765         https://bugs.webkit.org/show_bug.cgi?id=169790
1766
1767         Reviewed by Zalan Bujtas.
1768
1769         Use a more cohesive set of system trace points that give a good overview of what
1770         WebKit is doing. Added points for resource loading, render tree building, sync messages
1771         to the web process, async image decode, WASM and fetching cookies.
1772
1773         * loader/CookieJar.cpp:
1774         (WebCore::cookies):
1775         * loader/FrameLoader.cpp:
1776         (WebCore::FrameLoader::provisionalLoadStarted):
1777         (WebCore::FrameLoader::checkLoadCompleteForThisFrame):
1778         * loader/SubresourceLoader.cpp:
1779         (WebCore::SubresourceLoader::willSendRequestInternal):
1780         (WebCore::logResourceLoaded):
1781         (WebCore::SubresourceLoader::didFinishLoading):
1782         (WebCore::SubresourceLoader::didFail):
1783         (WebCore::SubresourceLoader::didCancel):
1784         * page/FrameView.cpp:
1785         (WebCore::FrameView::paintContents):
1786         * platform/graphics/ImageFrameCache.cpp:
1787         (WebCore::ImageFrameCache::startAsyncDecodingQueue):
1788         * platform/graphics/ios/DisplayRefreshMonitorIOS.mm:
1789         (WebCore::DisplayRefreshMonitorIOS::requestRefreshCallback):
1790         (WebCore::DisplayRefreshMonitorIOS::displayLinkFired):
1791         * style/RenderTreeUpdater.cpp:
1792         (WebCore::RenderTreeUpdater::commit):
1793
1794 2017-03-16  Simon Fraser  <simon.fraser@apple.com>
1795
1796         RenderView::documentBeingDestroyed() needs a new name.
1797         https://bugs.webkit.org/show_bug.cgi?id=166727
1798
1799         Reviewed by Andreas Kling.
1800
1801         Now that we destroy the render tree for documents going into the page cache, RenderView::documentBeingDestroyed()
1802         is misleadingly named. Rename it to renderTreeBeingDestroyed() and fix all callers.
1803
1804         * page/FrameView.cpp:
1805         (WebCore::FrameView::scheduleRelayoutOfSubtree):
1806         * page/scrolling/ScrollingCoordinator.cpp:
1807         (WebCore::ScrollingCoordinator::absoluteEventTrackingRegionsForFrame):
1808         * rendering/CounterNode.cpp:
1809         (WebCore::CounterNode::resetRenderers):
1810         * rendering/ImageQualityController.cpp:
1811         (WebCore::ImageQualityController::highQualityRepaintTimerFired):
1812         * rendering/RenderBlock.cpp:
1813         (WebCore::RenderBlock::willBeDestroyed):
1814         (WebCore::canMergeContiguousAnonymousBlocks):
1815         (WebCore::RenderBlock::removeChild):
1816         * rendering/RenderBlockFlow.cpp:
1817         (WebCore::RenderBlockFlow::willBeDestroyed):
1818         (WebCore::RenderBlockFlow::removeChild):
1819         * rendering/RenderBox.cpp:
1820         (WebCore::RenderBox::removeFloatingOrPositionedChildFromBlockLists):
1821         (WebCore::RenderBox::deleteLineBoxWrapper):
1822         * rendering/RenderBoxModelObject.cpp:
1823         (WebCore::RenderBoxModelObject::willBeDestroyed):
1824         * rendering/RenderElement.cpp:
1825         (WebCore::RenderElement::insertChildInternal):
1826         (WebCore::RenderElement::removeChildInternal):
1827         (WebCore::RenderElement::clearLayoutRootIfNeeded):
1828         (WebCore::RenderElement::willBeDestroyed):
1829         * rendering/RenderImage.cpp:
1830         (WebCore::RenderImage::imageChanged):
1831         (WebCore::RenderImage::notifyFinished):
1832         * rendering/RenderInline.cpp:
1833         (WebCore::RenderInline::willBeDestroyed):
1834         * rendering/RenderLayer.cpp:
1835         (WebCore::RenderLayer::removeChild):
1836         (WebCore::RenderLayer::calculateClipRects):
1837         * rendering/RenderLayerBacking.cpp:
1838         (WebCore::RenderLayerBacking::notifyFlushRequired):
1839         * rendering/RenderLayerCompositor.cpp:
1840         (WebCore::RenderLayerCompositor::layerWillBeRemoved):
1841         (WebCore::RenderLayerCompositor::fixedRootBackgroundLayerChanged):
1842         * rendering/RenderLineBreak.cpp:
1843         (WebCore::RenderLineBreak::deleteInlineBoxWrapper):
1844         * rendering/RenderNamedFlowFragment.cpp:
1845         (WebCore::RenderNamedFlowFragment::attachRegion):
1846         * rendering/RenderObject.cpp:
1847         (WebCore::RenderObject::resetFlowThreadStateOnRemoval):
1848         (WebCore::RenderObject::willBeDestroyed):
1849         (WebCore::RenderObject::destroyAndCleanupAnonymousWrappers):
1850         * rendering/RenderObject.h:
1851         (WebCore::RenderObject::renderTreeBeingDestroyed):
1852         (WebCore::RenderObject::documentBeingDestroyed): Deleted.
1853         * rendering/RenderQuote.cpp:
1854         (WebCore::RenderQuote::detachQuote):
1855         * rendering/RenderRegion.cpp:
1856         (WebCore::RenderRegion::attachRegion):
1857         * rendering/RenderReplaced.cpp:
1858         (WebCore::RenderReplaced::willBeDestroyed):
1859         * rendering/RenderRubyRun.cpp:
1860         (WebCore::RenderRubyRun::removeChild):
1861         * rendering/RenderTable.h:
1862         (WebCore::RenderTable::setNeedsSectionRecalc):
1863         * rendering/RenderText.cpp:
1864         (WebCore::RenderText::removeAndDestroyTextBoxes):
1865         * rendering/RenderVideo.cpp:
1866         (WebCore::RenderVideo::updatePlayer):
1867         * rendering/svg/RenderSVGResource.cpp:
1868         (WebCore::RenderSVGResource::markForLayoutAndParentResourceInvalidation):
1869         * rendering/svg/RenderSVGResourceContainer.cpp:
1870         (WebCore::RenderSVGResourceContainer::markClientForInvalidation):
1871         * rendering/svg/RenderSVGText.cpp:
1872         (WebCore::RenderSVGText::subtreeChildWasAdded):
1873         (WebCore::RenderSVGText::subtreeChildWillBeRemoved):
1874         (WebCore::RenderSVGText::subtreeChildWasRemoved):
1875         (WebCore::RenderSVGText::subtreeStyleDidChange):
1876
1877 2017-03-16  Youenn Fablet  <youenn@apple.com>
1878
1879         Wrap legacy WebRTC API in runtime flag
1880         https://bugs.webkit.org/show_bug.cgi?id=169646
1881
1882         Reviewed by Alex Christensen.
1883
1884         Test: webrtc/legacy-api.html
1885
1886         Adding a runtime flag for legacy API.
1887         Making some WebIDL peer connection members runtime-enabled.
1888         Adding a JS private getter on this flag so that overloaded operations behave as promise-based only if flag is turned off.
1889
1890         * Modules/mediastream/RTCPeerConnection.idl:
1891         * Modules/mediastream/RTCPeerConnectionInternals.js:
1892         * bindings/js/JSDOMGlobalObject.cpp:
1893         (WebCore::isWebRTCLegacyAPIEnabled):
1894         (WebCore::JSDOMGlobalObject::addBuiltinGlobals):
1895         * bindings/js/WebCoreBuiltinNames.h:
1896         * page/RuntimeEnabledFeatures.h:
1897         (WebCore::RuntimeEnabledFeatures::webRTCLegacyAPIEnabled):
1898         (WebCore::RuntimeEnabledFeatures::setWebRTCLegacyAPIEnabled):
1899
1900 2017-03-16  Jiewen Tan  <jiewen_tan@apple.com>
1901
1902         [WebCrypto] Support SPKI/PKCS8 for Elliptic Curve
1903         https://bugs.webkit.org/show_bug.cgi?id=169318
1904         <rdar://problem/31081956>
1905
1906         Reviewed by Brent Fulgham.
1907
1908         This patch adds SPKI/PKCS8 support for Elliptic Curve cryptos. We can now import/export
1909         SPKI/PKCS8 Elliptic Curve keys after this change. Few things to note: 1) This patch
1910         implements a loose DER encoder/decoder for hacking the underlying CommonCrypto library.
1911         2) It only permits id-ecPublicKey as the AlgorithmIdentifier following OpenSSL/Chrome(BoringSSL).
1912         3) It follows OpenSSL/Chrome(BoringSSL) to replace ECParameters in ECPrivateKey with custom
1913         tags. Hence, we should fully comply with OpenSSL/Chrome(BoringSSL).
1914
1915         Tests: crypto/subtle/ec-import-jwk-key-export-pkcs8-key.html
1916                crypto/subtle/ec-import-jwk-key-export-spki-key.html
1917                crypto/subtle/ec-import-pkcs8-key-export-jwk-key.html
1918                crypto/subtle/ec-import-pkcs8-key-export-pkcs8-key-p256.html
1919                crypto/subtle/ec-import-pkcs8-key-export-pkcs8-key-p384.html
1920                crypto/subtle/ec-import-raw-key-export-spki-key.html
1921                crypto/subtle/ec-import-spki-key-export-jwk-key.html
1922                crypto/subtle/ec-import-spki-key-export-raw-key.html
1923                crypto/subtle/ec-import-spki-key-export-spki-key-p256.html
1924                crypto/subtle/ec-import-spki-key-export-spki-key-p384.html
1925                crypto/subtle/ecdh-generate-export-key-spki-p256.html
1926                crypto/subtle/ecdh-generate-export-key-spki-p384.html
1927                crypto/subtle/ecdh-generate-export-pkcs8-p256.html
1928                crypto/subtle/ecdh-generate-export-pkcs8-p384.html
1929                crypto/subtle/ecdh-import-pkcs8-key-p256.html
1930                crypto/subtle/ecdh-import-pkcs8-key-p384.html
1931                crypto/subtle/ecdh-import-spki-key-p256.html
1932                crypto/subtle/ecdh-import-spki-key-p384.html
1933                crypto/workers/subtle/ec-generate-export-pkcs8-key.html
1934                crypto/workers/subtle/ec-generate-export-spki-key.html
1935                crypto/workers/subtle/ec-import-pkcs8-key.html
1936                crypto/workers/subtle/ec-import-spki-key.html
1937
1938         * WebCore.xcodeproj/project.pbxproj:
1939         * crypto/algorithms/CryptoAlgorithmECDH.cpp:
1940         (WebCore::CryptoAlgorithmECDH::importKey):
1941         (WebCore::CryptoAlgorithmECDH::exportKey):
1942         * crypto/gnutls/CryptoKeyECGnuTLS.cpp:
1943         (WebCore::CryptoKeyEC::platformExportRaw):
1944         (WebCore::CryptoKeyEC::platformImportSpki):
1945         (WebCore::CryptoKeyEC::platformExportSpki):
1946         (WebCore::CryptoKeyEC::platformImportPkcs8):
1947         (WebCore::CryptoKeyEC::platformExportPkcs8):
1948         (WebCore::CryptoKeyEC::exportRaw): Deleted.
1949         * crypto/keys/CryptoKeyEC.cpp:
1950         (WebCore::CryptoKeyEC::importSpki):
1951         (WebCore::CryptoKeyEC::importPkcs8):
1952         (WebCore::CryptoKeyEC::exportRaw):
1953         (WebCore::CryptoKeyEC::exportSpki):
1954         (WebCore::CryptoKeyEC::exportPkcs8):
1955         * crypto/keys/CryptoKeyEC.h:
1956         * crypto/mac/CommonCryptoDERUtilities.h: Added.
1957         (WebCore::bytesUsedToEncodedLength):
1958         (WebCore::extraBytesNeededForEncodedLength):
1959         (WebCore::addEncodedASN1Length):
1960         (WebCore::bytesNeededForEncodedLength):
1961         * crypto/mac/CryptoKeyECMac.cpp:
1962         (WebCore::compareBytes):
1963         (WebCore::CryptoKeyEC::platformExportRaw):
1964         (WebCore::CryptoKeyEC::platformImportJWKPrivate):
1965         (WebCore::getOID):
1966         (WebCore::CryptoKeyEC::platformImportSpki):
1967         (WebCore::CryptoKeyEC::platformExportSpki):
1968         (WebCore::CryptoKeyEC::platformImportPkcs8):
1969         (WebCore::CryptoKeyEC::platformExportPkcs8):
1970         (WebCore::CryptoKeyEC::exportRaw): Deleted.
1971         Enlarge the robust of exportRaw.
1972         * crypto/mac/CryptoKeyRSAMac.cpp:
1973         (WebCore::CryptoKeyRSA::exportSpki):
1974         (WebCore::CryptoKeyRSA::exportPkcs8):
1975         Enhance the implementation.
1976         (WebCore::bytesUsedToEncodedLength): Deleted.
1977         (WebCore::bytesNeededForEncodedLength): Deleted.
1978         (WebCore::addEncodedASN1Length): Deleted.
1979         Moved to CommonCryptoDERUtilities.h.
1980
1981 2017-03-16  Alex Christensen  <achristensen@webkit.org>
1982
1983         Don't use an optional for didReceiveSocketStreamData's length
1984         https://bugs.webkit.org/show_bug.cgi?id=169699
1985
1986         Reviewed by Brady Eidson.
1987
1988         Rather than sending a message with an optional length, send a message with a length
1989         and send a different message if the receiving of bytes failed.
1990
1991         No new tests (no behavior change).
1992
1993         * Modules/websockets/WebSocketChannel.cpp:
1994         (WebCore::WebSocketChannel::didReceiveSocketStreamData):
1995         * Modules/websockets/WebSocketChannel.h:
1996         * platform/network/SocketStreamHandleClient.h:
1997         * platform/network/cf/SocketStreamHandleImplCFNet.cpp:
1998         (WebCore::SocketStreamHandleImpl::readStreamCallback):
1999         * platform/network/soup/SocketStreamHandleImplSoup.cpp:
2000         (WebCore::SocketStreamHandleImpl::readBytes):
2001
2002 2017-03-16  Zalan Bujtas  <zalan@apple.com>
2003
2004         Simple line layout: Extend webkit-hyphenate-limit-lines to cover subsequent words.
2005         https://bugs.webkit.org/show_bug.cgi?id=169631
2006
2007         Reviewed by Antti Koivisto.
2008
2009         This patch extends webkit-hyphenate-limit-lines to cover separate words across multiple lines.
2010         Example:
2011           webkit-hyphenate-limit-lines: 1;
2012           "if this line wraps at foo-
2013           bar, the next line should
2014           not hyphenate at all. How-
2015           ever the line after that
2016           could."
2017
2018         Test: fast/text/simple-line-layout-hyphenation-limit-lines-accross-words.html
2019
2020         * rendering/SimpleLineLayout.cpp:
2021         (WebCore::SimpleLineLayout::LineState::setHyphenationDisabled):
2022         (WebCore::SimpleLineLayout::LineState::isHyphenationDisabled):
2023         (WebCore::SimpleLineLayout::updateLineConstrains):
2024         (WebCore::SimpleLineLayout::hyphenPositionForFragment):
2025         (WebCore::SimpleLineLayout::splitFragmentToFitLine):
2026         (WebCore::SimpleLineLayout::createLineRuns):
2027         (WebCore::SimpleLineLayout::createTextRuns):
2028         * rendering/SimpleLineLayoutTextFragmentIterator.h:
2029         (WebCore::SimpleLineLayout::TextFragmentIterator::TextFragment::hasHyphen):
2030         (WebCore::SimpleLineLayout::TextFragmentIterator::TextFragment::splitWithHyphen):
2031         (WebCore::SimpleLineLayout::TextFragmentIterator::TextFragment::wrappingWithHyphenCounter): Deleted.
2032
2033 2017-03-16  Zan Dobersek  <zdobersek@igalia.com>
2034
2035         [GLib] Add SSLKeyGeneratorGLib.cpp
2036         https://bugs.webkit.org/show_bug.cgi?id=169740
2037
2038         Reviewed by Sergio Villar Senin.
2039
2040         Move the getSupportedKeySizes() and signedPublicKeyAndChallengeString()
2041         functions from TemporaryLinkStubs.cpp to SSLKeyGeneratorGLib.cpp. The
2042         userIdleTime() function can be removed in this process since it's not
2043         used anywhere anymore.
2044
2045         * PlatformGTK.cmake:
2046         * platform/glib/SSLKeyGeneratorGLib.cpp: Renamed from Source/WebCore/platform/gtk/TemporaryLinkStubs.cpp.
2047         (WebCore::getSupportedKeySizes):
2048         (WebCore::signedPublicKeyAndChallengeString):
2049
2050 2017-03-16  Zalan Bujtas  <zalan@apple.com>
2051
2052         Stay inside the continuation while searching for a candidate ancestor for insertion.
2053         https://bugs.webkit.org/show_bug.cgi?id=169768
2054         <rdar://problem/30959936>
2055
2056         Reviewed by David Hyatt.
2057
2058         Test: fast/inline/continuation-crash-with-anon-ancestors.html
2059
2060         * rendering/RenderInline.cpp:
2061         (WebCore::RenderInline::addChildToContinuation):
2062
2063 2017-03-16  Jon Lee  <jonlee@apple.com>
2064
2065         Add FIXMEs to update WebRTC
2066         https://bugs.webkit.org/show_bug.cgi?id=169735
2067
2068         Reviewed by Youenn Fablet.
2069
2070         Rearrange order of methods and properties based on the 13 March 2017
2071         version of the WebRTC spec.
2072
2073         * CMakeLists.txt: Add RTCIceTransport and RTCIceTransportState.
2074         * DerivedSources.make:
2075         * Modules/mediastream/RTCDTMFSender.idl:
2076         * Modules/mediastream/RTCDTMFToneChangeEvent.idl:
2077         * Modules/mediastream/RTCDataChannelEvent.idl:
2078         * Modules/mediastream/RTCIceCandidate.idl:
2079         * Modules/mediastream/RTCIceCandidateEvent.idl:
2080         * Modules/mediastream/RTCIceServer.idl:
2081         * Modules/mediastream/RTCIceTransport.cpp: Added.
2082         * Modules/mediastream/RTCIceTransport.idl: Added.
2083         * Modules/mediastream/RTCIceTransport.h: Minor update to rename state to transportState.
2084         (WebCore::RTCIceTransport::state):
2085         (WebCore::RTCIceTransport::setState):
2086         (WebCore::RTCIceTransport::transportState): Deleted.
2087         (WebCore::RTCIceTransport::setTransportState): Deleted.
2088         * Modules/mediastream/RTCIceTransportState.h: Added.
2089         * Modules/mediastream/RTCIceTransportState.idl: Added.
2090         * Modules/mediastream/RTCPeerConnection.h:
2091         * Modules/mediastream/RTCPeerConnection.idl:
2092         * Modules/mediastream/RTCRtpReceiver.idl:
2093         * Modules/mediastream/RTCRtpSender.idl:
2094         * Modules/mediastream/RTCRtpTransceiver.idl:
2095         * Modules/mediastream/RTCStatsReport.idl:
2096         * WebCore.xcodeproj/project.pbxproj:
2097         * Modules/mediastream/MediaEndpointPeerConnection.cpp:
2098         (WebCore::MediaEndpointPeerConnection::iceTransportStateChanged): Refactor.
2099
2100 2017-03-16  Youenn Fablet  <youenn@apple.com>
2101
2102         Improve WebRTC track enabled support
2103         https://bugs.webkit.org/show_bug.cgi?id=169727
2104
2105         Reviewed by Alex Christensen.
2106
2107         Tests: webrtc/peer-connection-audio-mute2.html
2108                webrtc/peer-connection-remote-audio-mute.html
2109                webrtc/video-remote-mute.html
2110
2111         Making sure muted/disabled sources produce silence/black frames.
2112         For outgoing audio/video sources, this should be done by the actual a/v providers.
2113         We keep this filtering here until we are sure they implement that.
2114
2115         * platform/audio/mac/AudioSampleDataSource.mm:
2116         (WebCore::AudioSampleDataSource::pullAvalaibleSamplesAsChunks): Ensuring disabled audio tracks send silence.
2117         Used for outgoing webrtc tracks.
2118         * platform/mediastream/mac/MockRealtimeAudioSourceMac.mm:
2119         (WebCore::MockRealtimeAudioSourceMac::render): Ditto.
2120         * platform/mediastream/mac/RealtimeIncomingAudioSource.cpp:
2121         (WebCore::RealtimeIncomingAudioSource::OnData): Ditto.
2122         * platform/mediastream/mac/RealtimeIncomingVideoSource.cpp:
2123         (WebCore::RealtimeIncomingVideoSource::pixelBufferFromVideoFrame): Generating black frames if muted.
2124         (WebCore::RealtimeIncomingVideoSource::OnFrame):
2125         * platform/mediastream/mac/RealtimeIncomingVideoSource.h:
2126         * platform/mediastream/mac/RealtimeOutgoingVideoSource.cpp:
2127         (WebCore::RealtimeOutgoingVideoSource::videoSampleAvailable): Ensuring we quit after sending black frame.
2128
2129 2017-03-16  Youenn Fablet  <youenn@apple.com>
2130
2131         LibWebRTC outgoing source should be thread safe refcounted
2132         https://bugs.webkit.org/show_bug.cgi?id=169726
2133
2134         Reviewed by Alex Christensen.
2135
2136         Preventive fix.
2137         Also fixing the size of the buffer for the audio source as its reserved size is byte count.
2138
2139         * platform/mediastream/mac/RealtimeOutgoingAudioSource.h:
2140         * platform/mediastream/mac/RealtimeOutgoingVideoSource.h:
2141
2142 2017-03-16  Youenn Fablet  <youenn@apple.com>
2143
2144         MediaStreamTrack remote() no longer exists
2145         https://bugs.webkit.org/show_bug.cgi?id=169734
2146
2147         Reviewed by Alex Christensen.
2148
2149         Removing MediaStreamTrack remote.
2150         Removing RealtimeMediaSource::remote as isCaptureSource which is closer to its use in MediaStreamPrivate to
2151         detect whether sources are capture sources or not.
2152
2153         * Modules/mediastream/MediaStream.cpp:
2154         (WebCore::MediaStream::mediaState):
2155         * platform/mediastream/MediaStreamPrivate.cpp:
2156         (WebCore::MediaStreamPrivate::hasCaptureVideoSource):
2157         (WebCore::MediaStreamPrivate::hasCaptureAudioSource):
2158         (WebCore::MediaStreamPrivate::hasLocalVideoSource): Deleted.
2159         (WebCore::MediaStreamPrivate::hasLocalAudioSource): Deleted.
2160         * platform/mediastream/MediaStreamPrivate.h:
2161         * Modules/mediastream/MediaStreamTrack.cpp:
2162         (WebCore::MediaStreamTrack::stopProducingData):
2163         (WebCore::MediaStreamTrack::remote): Deleted.
2164         * Modules/mediastream/MediaStreamTrack.h:
2165         * Modules/mediastream/MediaStreamTrack.idl:
2166         * Modules/webaudio/MediaStreamAudioSource.h:
2167         * platform/mediastream/MediaStreamPrivate.cpp:
2168         (WebCore::MediaStreamPrivate::hasLocalVideoSource):
2169         (WebCore::MediaStreamPrivate::hasLocalAudioSource):
2170         * platform/mediastream/MediaStreamTrackPrivate.cpp:
2171         (WebCore::MediaStreamTrackPrivate::isCaptureTrack):
2172         (WebCore::MediaStreamTrackPrivate::remote): Deleted.
2173         * platform/mediastream/MediaStreamTrackPrivate.h:
2174         * platform/mediastream/RealtimeMediaSource.cpp:
2175         (WebCore::RealtimeMediaSource::reset):
2176         * platform/mediastream/RealtimeMediaSource.h:
2177         (WebCore::RealtimeMediaSource::isCaptureSource):
2178         (WebCore::RealtimeMediaSource::remote): Deleted.
2179         (WebCore::RealtimeMediaSource::setRemote): Deleted.
2180         * platform/mediastream/mac/AVMediaCaptureSource.h:
2181         * platform/mock/MockRealtimeAudioSource.h:
2182         * platform/mock/MockRealtimeVideoSource.h:
2183
2184 2017-03-16  Manuel Rego Casasnovas  <rego@igalia.com>
2185
2186         [css-grid] Crash on debug removing a positioned child
2187         https://bugs.webkit.org/show_bug.cgi?id=169739
2188
2189         Reviewed by Sergio Villar Senin.
2190
2191         When we add or remove a positioned item we don't need to mark
2192         the grid as dirty, because positioned items do not affect the layout
2193         of the grid at all.
2194
2195         This was causing a crash when a positioned item was removed
2196         after a layout. As after the positioned item was removed,
2197         the method RenderGrid::layoutBlock() was not called,
2198         so when the grid was repainted we got a crash.
2199
2200         Test: fast/css-grid-layout/grid-crash-remove-positioned-item.html
2201
2202         * rendering/RenderGrid.cpp:
2203         (WebCore::RenderGrid::addChild): Add early return to avoid marking
2204         the grid as dirty for positioned grid items.
2205         (WebCore::RenderGrid::removeChild): Ditto.
2206
2207 2017-03-16  Carlos Alberto Lopez Perez  <clopez@igalia.com>
2208
2209         [WebRTC] SDP sess-id in the "o=" line should be a value between 0 and LLONG_MAX.
2210         https://bugs.webkit.org/show_bug.cgi?id=169681
2211
2212         Reviewed by Alejandro G. Castro.
2213
2214         Use an int64_t type for storing sess-id and ensure that the value generated is always between 0 and LLONG_MAX (2^63-1).
2215         To the JS world (sdp.js) we pass and read this value as a string type.
2216
2217         The JS world (sdp.js) was already using a string type for sess-id.
2218         This caused a bug when reading the sess-id value at configurationFromJSON(): no value was obtained because a numeric type was expected.
2219
2220         So, after this patch, sess-id is passed and read as a string from sdp.js, and converted to an int64_t type for internal use.
2221         This way we also avoid a rounding problem that happens with values near LLONG_MAX when converting from int64_t to double when passed to the JS world,
2222         and that could cause that we end passing a number bigger than LLONG_MAX to sdp.js.
2223
2224         * Modules/mediastream/SDPProcessor.cpp:
2225         (WebCore::configurationFromJSON):
2226         (WebCore::configurationToJSON):
2227         * platform/mediastream/MediaEndpointSessionConfiguration.h:
2228         (WebCore::MediaEndpointSessionConfiguration::sessionId):
2229         (WebCore::MediaEndpointSessionConfiguration::setSessionId):
2230         (WebCore::MediaEndpointSessionConfiguration::MediaEndpointSessionConfiguration):
2231
2232 2017-03-15  Jon Lee  <jonlee@apple.com>
2233
2234         Flatten RTC enum naming
2235         https://bugs.webkit.org/show_bug.cgi?id=169664
2236
2237         Reviewed by Youenn Fablet.
2238
2239         Use consistent names of RTC enums throughout WebCore. This means surfacing
2240         ICE enums out of PeerConnectionState. Keep the old names around for other
2241         ports.
2242
2243         Add RTCIceConnectionState, RTCIceGatheringState, and RTCSignalingState enums.
2244         * CMakeLists.txt:
2245         * DerivedSources.make:
2246         * Modules/mediastream/RTCIceConnectionState.h: Added. The enum is defined in
2247         PeerConnectionStates.h, so just include that file.
2248         * Modules/mediastream/RTCIceConnectionState.idl: Added.
2249         * Modules/mediastream/RTCIceGatheringState.h: Added.
2250         * Modules/mediastream/RTCIceGatheringState.idl: Added.
2251         * Modules/mediastream/RTCSignalingState.h: Added.
2252         * Modules/mediastream/RTCSignalingState.idl: Added.
2253         * WebCore.xcodeproj/project.pbxproj:
2254
2255         * platform/mediastream/PeerConnectionStates.h: Move the existing enums into
2256         WebCore, but keep aliases to the old names within the PeerConnectionStates
2257         namespace.
2258
2259         Refactor to use the new enum names.
2260         * Modules/mediastream/MediaEndpointPeerConnection.cpp: Refactor.
2261         * Modules/mediastream/MediaEndpointPeerConnection.h:
2262         * Modules/mediastream/PeerConnectionBackend.cpp:
2263         * Modules/mediastream/PeerConnectionBackend.h:
2264         * Modules/mediastream/RTCConfiguration.h:
2265         * Modules/mediastream/RTCConfiguration.idl: Add FIXMEs for bringing this up
2266         to spec.
2267         * Modules/mediastream/RTCIceTransport.h:
2268         * Modules/mediastream/RTCPeerConnection.cpp: Refactor the three functions
2269         below to using the enum instead of returning strings. This allows remove of
2270         the internal* versions of these functions.
2271         (WebCore::RTCPeerConnection::signalingState): Deleted.
2272         (WebCore::RTCPeerConnection::iceGatheringState): Deleted.
2273         (WebCore::RTCPeerConnection::iceConnectionState): Deleted.
2274         * Modules/mediastream/RTCPeerConnection.h: Replace internalSignalingState,
2275         internalIceGatheringState, and internalIceConnectionState.
2276         * Modules/mediastream/RTCPeerConnection.idl:
2277         * Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.cpp:
2278         * Modules/mediastream/libwebrtc/LibWebRTCPeerConnectionBackend.cpp:
2279         * platform/mediastream/MediaEndpoint.h:
2280         * platform/mediastream/MediaEndpointConfiguration.cpp:
2281         * platform/mediastream/MediaEndpointConfiguration.h:
2282         * platform/mock/MockMediaEndpoint.cpp:
2283         * platform/mock/MockMediaEndpoint.h:
2284         * platform/mediastream/openwebrtc/MediaEndpointOwr.cpp:
2285         (WebCore::MediaEndpointOwr::processIceTransportStateChange):
2286
2287 2017-03-15  Jer Noble  <jer.noble@apple.com>
2288
2289         Optionally capture audio in the UIProcess
2290         https://bugs.webkit.org/show_bug.cgi?id=169609
2291
2292         Reviewed by Alex Christensen.
2293
2294         Export some previously un-exported symbols from WebCore for use in WebKit2.
2295
2296         * WebCore.xcodeproj/project.pbxproj:
2297         * platform/audio/WebAudioBufferList.h:
2298         * platform/mediastream/RealtimeMediaSource.h:
2299
2300 2017-03-15  Zalan Bujtas  <zalan@apple.com>
2301
2302         Do not reparent floating object until after intruding/overhanging dependency is cleared.
2303         https://bugs.webkit.org/show_bug.cgi?id=169711
2304         <rdar://problem/30959743>
2305
2306         Reviewed by Simon Fraser.
2307
2308         This patch ensures that we cleanup the m_floatingObjects for siblings before reparenting the fresh float.  
2309
2310         Test: fast/block/float/inline-becomes-float-and-moves-around.html
2311
2312         * rendering/RenderBlockFlow.cpp:
2313         (WebCore::RenderBlockFlow::styleDidChange):
2314         * rendering/RenderElement.cpp:
2315         (WebCore::RenderElement::styleDidChange):
2316         * rendering/RenderElement.h:
2317         (WebCore::RenderElement::noLongerAffectsParentBlock):
2318
2319 2017-03-15  Dean Jackson  <dino@apple.com>
2320
2321         Make a base class for WebGL and WebGPU contexts
2322         https://bugs.webkit.org/show_bug.cgi?id=169651
2323         <rdar://problem/31053489>
2324
2325         Reviewed by Simon Fraser.
2326
2327         Add a new pure virtual base class, GPUBasedCanvasRenderingContext, that
2328         will be used by WebGL and WebGPU rendering contexts. This allows us
2329         to avoid some code duplication, since many places treat the two
2330         as the same.
2331
2332         Also rename is3d() -> isWebGL() and isGPU() -> isWebGPU().
2333
2334         * WebCore.xcodeproj/project.pbxproj: New file.
2335         * html/HTMLCanvasElement.cpp:
2336         (WebCore::HTMLCanvasElement::getContextWebGL):
2337         (WebCore::HTMLCanvasElement::getContextWebGPU):
2338         (WebCore::HTMLCanvasElement::reset):
2339         (WebCore::HTMLCanvasElement::paint):
2340         (WebCore::HTMLCanvasElement::isGPUBased):
2341         (WebCore::HTMLCanvasElement::getImageData):
2342         (WebCore::HTMLCanvasElement::isGPU): Deleted.
2343         (WebCore::HTMLCanvasElement::is3D): Deleted.
2344         * html/HTMLCanvasElement.h:
2345         * html/canvas/CanvasRenderingContext.h:
2346         (WebCore::CanvasRenderingContext::isWebGL):
2347         (WebCore::CanvasRenderingContext::isWebGPU):
2348         (WebCore::CanvasRenderingContext::isGPUBased):
2349         (WebCore::CanvasRenderingContext::is3d): Deleted.
2350         (WebCore::CanvasRenderingContext::isGPU): Deleted.
2351         * html/canvas/GPUBasedCanvasRenderingContext.h: Added.
2352         (WebCore::GPUBasedCanvasRenderingContext::GPUBasedCanvasRenderingContext):
2353         * html/canvas/WebGLRenderingContextBase.cpp:
2354         (WebCore::WebGLRenderingContextBase::WebGLRenderingContextBase):
2355         * html/canvas/WebGLRenderingContextBase.h:
2356         * html/canvas/WebGPURenderingContext.cpp:
2357         (WebCore::WebGPURenderingContext::WebGPURenderingContext):
2358         * html/canvas/WebGPURenderingContext.h:
2359         * rendering/RenderLayerBacking.cpp:
2360         (WebCore::canvasCompositingStrategy):
2361
2362 2017-03-15  Daniel Bates  <dabates@apple.com>
2363
2364         Iteratively dispatch DOM events after restoring a cached page
2365         https://bugs.webkit.org/show_bug.cgi?id=169703
2366         <rdar://problem/31075903>
2367
2368         Reviewed by Brady Eidson.
2369
2370         Make dispatching of DOM events when restoring a page from the page cache symmetric with
2371         dispatching of events when saving a page to the page cache.
2372
2373         * history/CachedFrame.cpp:
2374         (WebCore::CachedFrameBase::restore): Move code to dispatch events from here to FrameLoader::didRestoreFromCachedPage().
2375         * loader/FrameLoader.cpp:
2376         (WebCore::FrameLoader::commitProvisionalLoad): Ensure that no DOM events are dispatched during
2377         restoration of a cached page. Call didRestoreFromCachedPage() after restoring the page to
2378         dispatch DOM events on the restored frames.
2379         (WebCore::FrameLoader::willRestoreFromCachedPage): Renamed; formerly named prepareForCachedPageRestore().
2380         (WebCore::FrameLoader::didRestoreFromCachedPage): Added.
2381         (WebCore::FrameLoader::prepareForCachedPageRestore): Renamed to willRestoreFromCachedPage().
2382         * loader/FrameLoader.h:
2383         * page/FrameTree.cpp:
2384         (WebCore::FrameTree::traverseNextInPostOrderWithWrap): Returns the next Frame* in a post-order
2385         traversal of the frame tree optionally wrapping around to the deepest first child in the tree.
2386         (WebCore::FrameTree::deepFirstChild): Added.
2387         * page/FrameTree.h:
2388
2389 2017-03-15  Dave Hyatt  <hyatt@apple.com>
2390
2391         Positioned SVG not sized correctly
2392         https://bugs.webkit.org/show_bug.cgi?id=169693
2393         <rdar://problem/30996893>
2394
2395         Reviewed by Zalan Bujtas.
2396
2397         Test: svg/in-html/rect-positioned.html
2398
2399         Change computeReplacedLogicalHeight to take an estimatedUsedWidth. This
2400         value is used instead of the available logical width to resolve replaced
2401         elements without intrinsic sizes but with aspect ratios set.
2402
2403         * rendering/RenderBox.cpp:
2404         (WebCore::RenderBox::computeReplacedLogicalHeight):
2405         * rendering/RenderBox.h:
2406         * rendering/RenderReplaced.cpp:
2407         (WebCore::RenderReplaced::computeConstrainedLogicalWidth):
2408         (WebCore::RenderReplaced::computeReplacedLogicalWidth):
2409         (WebCore::RenderReplaced::computeReplacedLogicalHeight):
2410         * rendering/RenderReplaced.h:
2411         * rendering/RenderVideo.cpp:
2412         (WebCore::RenderVideo::computeReplacedLogicalHeight): Deleted.
2413         * rendering/RenderVideo.h:
2414         * rendering/svg/RenderSVGRoot.cpp:
2415         (WebCore::RenderSVGRoot::computeReplacedLogicalWidth):
2416         (WebCore::RenderSVGRoot::computeReplacedLogicalHeight):
2417         * rendering/svg/RenderSVGRoot.h:
2418
2419 2017-03-15  Antoine Quint  <graouts@apple.com>
2420
2421         [Modern Media Controls] Using the arrow keys to navigate in the tracks menu also scrolls the page
2422         https://bugs.webkit.org/show_bug.cgi?id=169671
2423         <rdar://problem/31060091>
2424
2425         Reviewed by Eric Carlson.
2426
2427         We need to call preventDefault() when handling a "keydown" event that we recognize.
2428
2429         Test: media/modern-media-controls/tracks-panel/tracks-panel-prevent-default-on-keydown.html
2430
2431         * Modules/modern-media-controls/controls/tracks-panel.js:
2432         (TracksPanel.prototype._handleKeydown):
2433
2434 2017-03-15  Antoine Quint  <graouts@apple.com>
2435
2436         [Modern Media Controls] Tracks menu overlaps controls bar in fullscreen
2437         https://bugs.webkit.org/show_bug.cgi?id=169670
2438         <rdar://problem/31060086>
2439         
2440         Reviewed by Eric Carlson.
2441
2442         It used to be that the top of the tracks button was the same as the top of the controls
2443         bar, but that changed when we fixed https://bugs.webkit.org/show_bug.cgi?id=169412. We
2444         now use the top of the controls bar to computed the y-position for the tracks panel.
2445
2446         We are not adding a new test, instead we're unflaking a test that started failing
2447         reliably once we fixed https://bugs.webkit.org/show_bug.cgi?id=169412.
2448
2449         * Modules/modern-media-controls/controls/macos-media-controls.js:
2450         (MacOSMediaControls.prototype.showTracksPanel):
2451
2452 2017-03-14  Jon Lee  <jonlee@apple.com>
2453
2454         Clean up RTCPeerConnection IDL
2455         https://bugs.webkit.org/show_bug.cgi?id=169660
2456
2457         Reviewed by Youenn Fablet.
2458
2459         * Modules/mediastream/RTCPeerConnection.cpp:
2460         (WebCore::RTCPeerConnection::addTransceiver): Refactor to use RTCRtpTransceiverInit.
2461         (WebCore::RTCPeerConnection::completeAddTransceiver):
2462         * Modules/mediastream/RTCPeerConnection.h: Remove redundant definitions.
2463         * Modules/mediastream/RTCPeerConnection.idl: Using 13 March 2017 Editor's Draft of
2464         WebRTC spec. Move RTCOfferAnswerOptions out to separate IDLs. Keep RTCDataChannelInit and
2465         RTCRtpTransceiverInit since they appear to be used only in RTCPeerConnection.
2466             Reorder the properties, functions, and events based on their appearance in the spec.
2467         Legacy MediaStream calls are placed at the end. I tried to use "partial interface" in the
2468         same file, but in the end nothing was generated, so everything is contained in one interface
2469         block.
2470
2471         * Modules/mediastream/RTCEnums.h: Added. This will be an all-in-one header to hold the
2472         enums.
2473
2474         Move RTCAnswerOptions, RTCOfferAnswerOptions, RTCOfferOptions, RTCRtpTransceiverDirection
2475         out to their own IDL's.
2476         * CMakeLists.txt:
2477         * DerivedSources.make:
2478         * Modules/mediastream/RTCAnswerOptions.h: Added.
2479         * Modules/mediastream/RTCAnswerOptions.idl: Added.
2480         * Modules/mediastream/RTCOfferAnswerOptions.h:
2481         * Modules/mediastream/RTCOfferAnswerOptions.idl: Added.
2482         * Modules/mediastream/RTCOfferOptions.h: Added. Remove |offerToReceiveVideo| and
2483         |offerToReceiveAudio|, which are not used.
2484         * Modules/mediastream/RTCOfferOptions.idl: Added.
2485         * Modules/mediastream/RTCRtpTransceiverDirection.h: Added.
2486         * Modules/mediastream/RTCRtpTransceiverDirection.idl: Added. Use a typedef for
2487         RTCRtpTransceiverDirection to prevent the code generator from prefixing RTCRtpTransceiver.
2488         * Modules/mediastream/RTCRtpTransceiver.idl: Move RTCRtpTransceiverDirection.
2489         * WebCore.xcodeproj/project.pbxproj: Add IDLs and derived sources. Remove unused
2490         HTMLMediaElementMediaStream.h. Reorder.
2491
2492         Refactor.
2493         * Modules/mediastream/RTCRtpTransceiver.h: Use RTCRtpTransceiverDirection.
2494         * Modules/mediastream/MediaEndpointPeerConnection.cpp:
2495
2496 2017-03-15  Zan Dobersek  <zdobersek@igalia.com>
2497
2498         [GTK] Initialize m_button, m_clickCount members in PlatformMouseEvent constructors
2499         https://bugs.webkit.org/show_bug.cgi?id=169666
2500
2501         Reviewed by Michael Catanzaro.
2502
2503         Initialize the m_button and m_clickCount class members in the GTK+-specific
2504         implementation of PlatformMouseEvent constructors to NoButton and 0,
2505         respectively. The constructors expect to operate on passed-in GTK+ events
2506         that will be able to initialize those two members to some valid values, but
2507         this is not guaranteed.
2508
2509         * platform/gtk/PlatformMouseEventGtk.cpp:
2510         (WebCore::PlatformMouseEvent::PlatformMouseEvent):
2511
2512 2017-03-15  Zan Dobersek  <zdobersek@igalia.com>
2513
2514         [TexMap] Add missing class member initializations
2515         https://bugs.webkit.org/show_bug.cgi?id=169665
2516
2517         Reviewed by Michael Catanzaro.
2518
2519         Zero-initialize the members in various TextureMapper classes
2520         that are missing the proper initialization, as reported by
2521         the Coverity tool.
2522
2523         * platform/graphics/texmap/BitmapTexturePool.h:
2524         * platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.h:
2525         * platform/graphics/texmap/coordinated/CoordinatedGraphicsState.h:
2526         (WebCore::CoordinatedGraphicsLayerState::CoordinatedGraphicsLayerState):
2527         * platform/graphics/texmap/coordinated/SurfaceUpdateInfo.h:
2528
2529 2017-03-15  Alex Christensen  <achristensen@webkit.org>
2530
2531         Compiled content extensions should include the JSON source
2532         https://bugs.webkit.org/show_bug.cgi?id=169643
2533
2534         Reviewed by Geoffrey Garen.
2535
2536         Serializing the JSON string from which a content extension was compiled
2537         to disk with the compiled content extension will allow us to validate content
2538         extensions and automatically migrate older content extensions to new versions.
2539         It less than doubles the size of the compiled content extension on disk, and when
2540         interpreting the bytecode that memory is never read, so it doesn't increase our
2541         dirty memory usage.
2542
2543         Covered by new API tests.
2544
2545         * contentextensions/ContentExtensionCompiler.cpp:
2546         (WebCore::ContentExtensions::compileRuleList):
2547         * contentextensions/ContentExtensionCompiler.h:
2548
2549 2017-03-15  Antoine Quint  <graouts@apple.com>
2550
2551         [Modern Media Controls] Captions do not default to Auto when language is changed
2552         https://bugs.webkit.org/show_bug.cgi?id=169675
2553         <rdar://problem/30423369>
2554
2555         Reviewed by Eric Carlson.
2556
2557         Ensure we correctly mark the Off and Auto items as selected when we are using the
2558         Off and Auto tracks.
2559
2560         Tests: media/modern-media-controls/tracks-support/tracks-support-auto-text-track.html
2561                media/modern-media-controls/tracks-support/tracks-support-off-text-track.html
2562
2563         * Modules/modern-media-controls/media/tracks-support.js:
2564         (TracksSupport.prototype.tracksPanelIsTrackInSectionSelected):
2565         (TracksSupport.prototype.tracksPanelSelectionDidChange):
2566
2567 2017-03-15  Ryan Haddad  <ryanhaddad@apple.com>
2568
2569         Unreviewed, rolling out r213977.
2570
2571         This change broke the Windows build.
2572
2573         Reverted changeset:
2574
2575         "Make a base class for WebGL and WebGPU contexts"
2576         https://bugs.webkit.org/show_bug.cgi?id=169651
2577         http://trac.webkit.org/changeset/213977
2578
2579 2017-03-15  Youenn Fablet  <youenn@apple.com>
2580
2581         run-webkit-tests is always creating mock libwebrtc tracks
2582         https://bugs.webkit.org/show_bug.cgi?id=169658
2583
2584         Reviewed by Alex Christensen.
2585
2586         Tests: webrtc/peer-connection-audio-mute.html
2587                webrtc/video-mute.html
2588
2589         Creating real libwebrtc av tracks in case of RealTwoPeerConnections mock factory.
2590
2591         * testing/MockLibWebRTCPeerConnection.cpp:
2592         (WebCore::MockLibWebRTCPeerConnectionFactory::CreateVideoTrack):
2593         (WebCore::MockLibWebRTCPeerConnectionFactory::CreateAudioTrack):
2594         * testing/MockLibWebRTCPeerConnection.h:
2595
2596 2017-03-15  Youenn Fablet  <youenn@apple.com>
2597
2598         Preventive clean-up: ensure RTCPeerConnection stays valid when calling postTask
2599         https://bugs.webkit.org/show_bug.cgi?id=169661
2600
2601         Reviewed by Alex Christensen.
2602
2603         Protecting the RTCPeerConnection object when calling postTask since it might get collected between the task post
2604         and task run. Also do not send negotiationNeeded event if RTCPeerConnection is closed (covered by added test).
2605
2606         * Modules/mediastream/RTCPeerConnection.cpp:
2607         (WebCore::RTCPeerConnection::updateIceGatheringState):
2608         (WebCore::RTCPeerConnection::updateIceConnectionState):
2609         (WebCore::RTCPeerConnection::scheduleNegotiationNeededEvent):
2610
2611 2017-03-15  Antoine Quint  <graouts@apple.com>
2612
2613         [Modern Media Controls] Always use six digits to display time when overall media duration is an hour or more
2614         https://bugs.webkit.org/show_bug.cgi?id=169668
2615         <rdar://problem/31059699>
2616
2617         Reviewed by Dean Jackson.
2618
2619         Always use six digits to display times when the overall media duration is an hour or more. This
2620         ensures that we don't display too much white space around labels when we know we will eventually
2621         need six digits to display the full time, but the current time to display is under an hour.
2622
2623         Test: media/modern-media-controls/time-control/time-control-use-six-digits-for-time-labels.html
2624
2625         * Modules/modern-media-controls/controls/time-control.js:
2626         (TimeControl.prototype.get useSixDigitsForTimeLabels):
2627         (TimeControl.prototype.set useSixDigitsForTimeLabels):
2628         (TimeControl.prototype.set width):
2629         (TimeControl.prototype.get isSufficientlyWide):
2630         (TimeControl.prototype._availableWidthHasChanged):
2631         (TimeControl.prototype.get labelsMayDisplayTimesOverAnHour): Deleted.
2632         (TimeControl.prototype.set labelsMayDisplayTimesOverAnHour): Deleted.
2633         * Modules/modern-media-controls/controls/time-label.js:
2634         (TimeLabel.prototype._formattedTime):
2635         * Modules/modern-media-controls/media/time-labels-support.js:
2636         (TimeLabelsSupport.prototype.syncControl):
2637         (TimeLabelsSupport):
2638
2639 2017-03-15  Dean Jackson  <dino@apple.com>
2640
2641         Sort Xcode project files
2642         https://bugs.webkit.org/show_bug.cgi?id=169669
2643
2644         Reviewed by Antoine Quint.
2645
2646         * WebCore.xcodeproj/project.pbxproj:
2647
2648 2017-03-14  Dean Jackson  <dino@apple.com>
2649
2650         Make a base class for WebGL and WebGPU contexts
2651         https://bugs.webkit.org/show_bug.cgi?id=169651
2652         <rdar://problem/31053489>
2653
2654         Reviewed by Simon Fraser.
2655
2656         Add a new pure virtual base class, GPUBasedCanvasRenderingContext, that
2657         will be used by WebGL and WebGPU rendering contexts. This allows us
2658         to avoid some code duplication, since many places treat the two
2659         as the same.
2660
2661         Also rename is3d() -> isWebGL() and isGPU() -> isWebGPU().
2662
2663         * WebCore.xcodeproj/project.pbxproj: New file.
2664         * html/HTMLCanvasElement.cpp:
2665         (WebCore::HTMLCanvasElement::getContextWebGL):
2666         (WebCore::HTMLCanvasElement::getContextWebGPU):
2667         (WebCore::HTMLCanvasElement::reset):
2668         (WebCore::HTMLCanvasElement::paint):
2669         (WebCore::HTMLCanvasElement::isGPUBased):
2670         (WebCore::HTMLCanvasElement::getImageData):
2671         (WebCore::HTMLCanvasElement::isGPU): Deleted.
2672         (WebCore::HTMLCanvasElement::is3D): Deleted.
2673         * html/HTMLCanvasElement.h:
2674         * html/canvas/CanvasRenderingContext.h:
2675         (WebCore::CanvasRenderingContext::isWebGL):
2676         (WebCore::CanvasRenderingContext::isWebGPU):
2677         (WebCore::CanvasRenderingContext::isGPUBased):
2678         (WebCore::CanvasRenderingContext::is3d): Deleted.
2679         (WebCore::CanvasRenderingContext::isGPU): Deleted.
2680         * html/canvas/GPUBasedCanvasRenderingContext.h: Added.
2681         (WebCore::GPUBasedCanvasRenderingContext::GPUBasedCanvasRenderingContext):
2682         * html/canvas/WebGLRenderingContextBase.cpp:
2683         (WebCore::WebGLRenderingContextBase::WebGLRenderingContextBase):
2684         * html/canvas/WebGLRenderingContextBase.h:
2685         * html/canvas/WebGPURenderingContext.cpp:
2686         (WebCore::WebGPURenderingContext::WebGPURenderingContext):
2687         * html/canvas/WebGPURenderingContext.h:
2688         * rendering/RenderLayerBacking.cpp:
2689         (WebCore::canvasCompositingStrategy):
2690
2691 2017-03-15  Zan Dobersek  <zdobersek@igalia.com>
2692
2693         Unreviewed GTK+ build fix. Sprinkle ENABLE(MEDIA_STREAM) build guards
2694         in the Internals class to avoid compilation failures when building
2695         with this feature disabled.
2696
2697         * testing/Internals.cpp:
2698         (WebCore::Internals::~Internals):
2699         * testing/Internals.h:
2700         * testing/Internals.idl:
2701
2702 2017-03-14  Youenn Fablet  <youenn@apple.com>
2703
2704         CanvasCapture should not generate a frame per each canvas draw command
2705         https://bugs.webkit.org/show_bug.cgi?id=169498
2706
2707         Reviewed by Simon Fraser & Eric Carlson.
2708
2709         Test: fast/mediastream/captureStream/canvas2d-heavy-drawing.html
2710
2711         Making Canvas capture be asynchronous.
2712         This ensures that one frame will be created for a set of synchronous draw commands.
2713         In the future, we should find a better approach, like aligning with requestAnimationFrame.
2714         Adding internals observer API for media stream tracks.
2715
2716         * Modules/mediastream/CanvasCaptureMediaStreamTrack.cpp:
2717         (WebCore::CanvasCaptureMediaStreamTrack::Source::Source):
2718         (WebCore::CanvasCaptureMediaStreamTrack::Source::canvasChanged):
2719         * Modules/mediastream/CanvasCaptureMediaStreamTrack.h:
2720         * Modules/mediastream/MediaStreamTrack.idl:
2721         * platform/mediastream/RealtimeMediaSource.h:
2722         * testing/Internals.cpp:
2723         (WebCore::Internals::~Internals):
2724         (WebCore::Internals::observeMediaStreamTrack):
2725         * testing/Internals.h:
2726         * testing/Internals.idl:
2727
2728 2017-03-14  Wenson Hsieh  <wenson_hsieh@apple.com>
2729
2730         RenderElements should unregister for viewport visibility callbacks when they are destroyed
2731         https://bugs.webkit.org/show_bug.cgi?id=169521
2732         <rdar://problem/30959545>
2733
2734         Reviewed by Simon Fraser.
2735
2736         When registering a RenderElement for viewport visibility callbacks, we always need to make sure that it is unregistered
2737         before it is destroyed. While we account for this in the destructor of RenderElement, we only unregister in the destructor
2738         if we are already registered for visibility callbacks. In the call to RenderObject::willBeDestroyed(), we clear out rare
2739         data, which holds RenderElement's viewport callback registration state, so upon entering the destructor of RenderElement,
2740         we skip unregistration because RenderElement thinks that it is not registered.
2741
2742         We can mitigate this by unregistering the RenderElement earlier, in RenderElement::willBeDestroyed, prior to clearing out
2743         the rare data. However, we'd ideally want to move the cleanup logic out of the destructor altogether and into willBeDestroyed
2744         (see https://bugs.webkit.org/show_bug.cgi?id=169650).
2745
2746         Test: fast/media/video-element-in-details-collapse.html
2747
2748         * rendering/RenderElement.cpp:
2749         (WebCore::RenderElement::willBeDestroyed):
2750
2751 2017-03-14  Dean Jackson  <dino@apple.com>
2752
2753         Rename LayerTypeWebGLLayer and use it for both WebGL and WebGPU
2754         https://bugs.webkit.org/show_bug.cgi?id=169628
2755         <rdar://problems/31047025>
2756
2757         Fix Windows build.
2758
2759         * platform/graphics/ca/win/PlatformCALayerWin.cpp:
2760         (printLayer):
2761
2762 2017-03-14  Andy Estes  <aestes@apple.com>
2763
2764         REGRESSION (r209760): Apple Pay doesn't work on sites that specify empty contact fields
2765         https://bugs.webkit.org/show_bug.cgi?id=169639
2766         <rdar://problem/30957789>
2767
2768         Reviewed by Anders Carlsson.
2769
2770         Shipping and billing contact fields are allowed to be empty.
2771
2772         * Modules/applepay/ApplePaySession.cpp:
2773         (WebCore::convertAndValidate):
2774
2775 2017-03-14  Anders Carlsson  <andersca@apple.com>
2776
2777         Propagate PassKit errors
2778         https://bugs.webkit.org/show_bug.cgi?id=169633
2779         rdar://problem/31043392
2780
2781         Reviewed by Dean Jackson.
2782
2783         * Modules/applepay/ApplePayError.idl:
2784         * Modules/applepay/ApplePaySession.cpp:
2785         (WebCore::convert):
2786         (WebCore::convertAndValidate):
2787         * Modules/applepay/PaymentRequest.h:
2788
2789 2017-03-14  Alan Kinsley  <zalan@apple.com>
2790
2791         Simple line layout: Adjust hyphenation constrains based on the normal line layout line-breaking logic.
2792         https://bugs.webkit.org/show_bug.cgi?id=169617
2793
2794         Reviewed by Antti Koivisto.
2795
2796         This patch ensures that simple line layout ends up with the same hyphenation context as normal line layout. 
2797
2798         Test: fast/text/simple-line-layout-hyphenation-constrains.html
2799
2800         * rendering/SimpleLineLayout.cpp:
2801         (WebCore::SimpleLineLayout::hyphenPositionForFragment): see webkit.org/b/169613
2802         (WebCore::SimpleLineLayout::splitFragmentToFitLine):
2803         * rendering/line/BreakingContext.h: Integral -> fractional.
2804         (WebCore::tryHyphenating):
2805
2806 2017-03-06  Jer Noble  <jer.noble@apple.com>
2807
2808         Refactor: Allow WebKit2 to override the creation of RealtimeMediaSources
2809         https://bugs.webkit.org/show_bug.cgi?id=169227
2810
2811         Reviewed by Eric Carlson.
2812
2813         Allow clients of RealtimeMediaSourceCenter to specify a factory for creating
2814         RealtimeMediaSources, to be used by subclasess of RealtimeMediaSourceCenter. Add virtual
2815         methods to retrieve the "default" factories for the RealtimeMediaSourceCenter subclass. The
2816         requires moving the creation of sources up from CaptureDeviceManager into
2817         RealtimeMediaSourceCenterMac, and the addition of factory methods to AVAudioCaptureSource
2818         and AVVideoCaptureSource.
2819
2820         * platform/mediastream/CaptureDeviceManager.cpp:
2821         (CaptureDeviceManager::deviceWithUID):
2822         (CaptureDeviceManager::bestSourcesForTypeAndConstraints): Deleted.
2823         (CaptureDeviceManager::sourceWithUID): Deleted.
2824         * platform/mediastream/CaptureDeviceManager.h:
2825         * platform/mediastream/RealtimeMediaSource.h:
2826         * platform/mediastream/RealtimeMediaSourceCenter.cpp:
2827         (WebCore::RealtimeMediaSourceCenter::setAudioFactory):
2828         (WebCore::RealtimeMediaSourceCenter::unsetAudioFactory):
2829         (WebCore::RealtimeMediaSourceCenter::setVideoFactory):
2830         (WebCore::RealtimeMediaSourceCenter::unsetVideoFactory):
2831         * platform/mediastream/RealtimeMediaSourceCenter.h:
2832         (WebCore::RealtimeMediaSourceCenter::audioFactory):
2833         (WebCore::RealtimeMediaSourceCenter::videoFactory):
2834         * platform/mediastream/mac/AVAudioCaptureSource.h:
2835         * platform/mediastream/mac/AVAudioCaptureSource.mm:
2836         (WebCore::AVAudioCaptureSource::factory):
2837         * platform/mediastream/mac/AVCaptureDeviceManager.h:
2838         * platform/mediastream/mac/AVCaptureDeviceManager.mm:
2839         (WebCore::AVCaptureDeviceManager::createMediaSourceForCaptureDeviceWithConstraints): Deleted.
2840         * platform/mediastream/mac/AVMediaCaptureSource.h:
2841         * platform/mediastream/mac/AVVideoCaptureSource.h:
2842         * platform/mediastream/mac/AVVideoCaptureSource.mm:
2843         (WebCore::AVVideoCaptureSource::factory):
2844         * platform/mediastream/mac/RealtimeMediaSourceCenterMac.cpp:
2845         (WebCore::RealtimeMediaSourceCenterMac::RealtimeMediaSourceCenterMac):
2846         (WebCore::RealtimeMediaSourceCenterMac::validateRequestConstraints):
2847         (WebCore::RealtimeMediaSourceCenterMac::createMediaStream):
2848         (WebCore::RealtimeMediaSourceCenterMac::bestSourcesForTypeAndConstraints):
2849         (WebCore::RealtimeMediaSourceCenterMac::defaultAudioFactory):
2850         (WebCore::RealtimeMediaSourceCenterMac::defaultVideoFactory):
2851         * platform/mediastream/mac/RealtimeMediaSourceCenterMac.h:
2852         * platform/mock/MockRealtimeAudioSource.cpp:
2853         (WebCore::MockRealtimeAudioSource::factory):
2854         * platform/mock/MockRealtimeAudioSource.h:
2855         * platform/mock/MockRealtimeMediaSourceCenter.cpp:
2856         (WebCore::MockRealtimeMediaSourceCenter::defaultAudioFactory):
2857         (WebCore::MockRealtimeMediaSourceCenter::defaultVideoFactory):
2858         * platform/mock/MockRealtimeMediaSourceCenter.h:
2859         * platform/mock/MockRealtimeVideoSource.cpp:
2860         (WebCore::MockRealtimeVideoSource::factory):
2861         * platform/mock/MockRealtimeVideoSource.h:
2862
2863 2017-03-14  Dean Jackson  <dino@apple.com>
2864
2865         Rename LayerTypeWebGLLayer and use it for both WebGL and WebGPU
2866         https://bugs.webkit.org/show_bug.cgi?id=169628
2867         <rdar://problems/31047025>
2868
2869         Reviewed by Simon Fraser.
2870
2871         Rename LayerTypeWebGLLayer to LayerTypeContentsProvidedLayer
2872         and use it for both WebGLLayer and WebGPULayer, to avoid
2873         code duplication.
2874
2875         * platform/graphics/ca/PlatformCALayer.cpp:
2876         (WebCore::operator<<):
2877         * platform/graphics/ca/PlatformCALayer.h:
2878         * platform/graphics/ca/cocoa/PlatformCALayerCocoa.mm:
2879         (PlatformCALayerCocoa::layerTypeForPlatformLayer):
2880         (PlatformCALayerCocoa::PlatformCALayerCocoa):
2881         (PlatformCALayerCocoa::commonInit):
2882
2883 2017-03-13  Jer Noble  <jer.noble@apple.com>
2884
2885         Make classes used by Media Stream encode/decode friendly
2886         https://bugs.webkit.org/show_bug.cgi?id=169567
2887
2888         Reviewed by Eric Carlson.
2889
2890         Add encode() and decode() methods and implementations to a variety of media stream related classes.
2891
2892         * platform/audio/mac/CAAudioStreamDescription.h:
2893         (WebCore::CAAudioStreamDescription::encode):
2894         (WebCore::CAAudioStreamDescription::decode):
2895         * platform/mediastream/RealtimeMediaSourceSettings.h:
2896         (WebCore::RealtimeMediaSourceSettings::width):
2897         (WebCore::RealtimeMediaSourceSettings::setWidth):
2898         (WebCore::RealtimeMediaSourceSettings::height):
2899         (WebCore::RealtimeMediaSourceSettings::setHeight):
2900         (WebCore::RealtimeMediaSourceSettings::sampleRate):
2901         (WebCore::RealtimeMediaSourceSettings::setSampleRate):
2902         (WebCore::RealtimeMediaSourceSettings::sampleSize):
2903         (WebCore::RealtimeMediaSourceSettings::setSampleSize):
2904         (WebCore::RealtimeMediaSourceSettings::encode):
2905         (WebCore::RealtimeMediaSourceSettings::decode):
2906         * platform/mediastream/RealtimeMediaSourceSupportedConstraints.h:
2907         (WebCore::RealtimeMediaSourceSupportedConstraints::encode):
2908         (WebCore::RealtimeMediaSourceSupportedConstraints::decode):
2909
2910 2017-03-14  Jer Noble  <jer.noble@apple.com>
2911
2912         Adapt CARingBuffer to be usable across processes
2913         https://bugs.webkit.org/show_bug.cgi?id=169591
2914
2915         Reviewed by Alex Christensen.
2916
2917         When used with a SharedMemory backing store, storing the pointers to channel data at the beginning
2918         of the channel data itself is problematic: when the SharedMemory is mapped on the far side of the
2919         process boundary, it will not exist at the same memory location as it did on the near side. Instead
2920         of storing these pointers inside the channel data, store them in a small (usually 1 or 2 entry) vector
2921         recreated when the backing store is (re-)allocated.
2922
2923         * platform/audio/mac/CARingBuffer.cpp:
2924         (WebCore::CARingBuffer::CARingBuffer):
2925         (WebCore::CARingBuffer::allocate):
2926         (WebCore::CARingBuffer::deallocate):
2927         (WebCore::ZeroRange):
2928         (WebCore::StoreABL):
2929         (WebCore::FetchABL):
2930         (WebCore::CARingBuffer::store):
2931         (WebCore::CARingBuffer::getCurrentFrameBounds):
2932         (WebCore::CARingBuffer::fetch):
2933         * platform/audio/mac/CARingBuffer.h:
2934
2935 2017-03-14  Jer Noble  <jer.noble@apple.com>
2936
2937         Pulling more frames from AudioSampleDataSource than the last push added will always fail.
2938         https://bugs.webkit.org/show_bug.cgi?id=168644
2939
2940         Reviewed by Eric Carlson.
2941
2942         Rather than use the delta between the ring buffer's end time and the last pushed timestamp
2943         (or what is effectively the number of samples in the last push operation) to determine if
2944         there is enough buffered data to satisfy a pull operation, use the ring buffer's actual
2945         buffered duration.
2946
2947         Then, instead of saving the last pushed timestamp, explicitly save the last push count, and
2948         use that data to inform how much to offset the output timestamps (or what is effectively how
2949         much to allow the source to pre-buffer).
2950
2951         * platform/audio/mac/AudioSampleDataSource.cpp:
2952         (WebCore::AudioSampleDataSource::pushSamplesInternal):
2953         (WebCore::AudioSampleDataSource::pullSamplesInternal):
2954         * platform/audio/mac/AudioSampleDataSource.h:
2955
2956 2017-03-14  Megan Gardner  <megan_gardner@apple.com>
2957
2958         Correctly export WebItemProviderPasteboard
2959         https://bugs.webkit.org/show_bug.cgi?id=169578
2960
2961         Reviewed by Tim Horton.
2962
2963         * platform/ios/WebItemProviderPasteboard.h:
2964
2965 2017-03-14  Adrian Perez de Castro  <aperez@igalia.com>
2966
2967         Remove redundant check for "firstLine" in RenderBlock::lineHeight()
2968         https://bugs.webkit.org/show_bug.cgi?id=169610
2969
2970         Reviewed by Michael Catanzaro.
2971
2972         * rendering/RenderBlock.cpp:
2973         (WebCore::RenderBlock::lineHeight): Remove test of "firstLine" that
2974         was already checked in the condition for the enclosing if-clause.
2975
2976 2017-03-14  Antoine Quint  <graouts@apple.com>
2977
2978         [Modern Media Controls] Fullscreen controls during Live Broadcast is completely broken
2979         https://bugs.webkit.org/show_bug.cgi?id=169354
2980         <rdar://problem/30636370>
2981
2982         Reviewed by Dean Jackson.
2983
2984         When playing a Live Broadcast video in fullscreen, we should not show any scrubbing-related
2985         piece of UI and ensure that we show the status label.
2986
2987         Test: http/tests/media/modern-media-controls/macos-fullscreen-media-controls/macos-fullscreen-media-controls-live-broadcast.html
2988
2989         * Modules/modern-media-controls/controls/macos-fullscreen-media-controls.css:
2990         (.media-controls.mac.fullscreen > .controls-bar .status-label):
2991         * Modules/modern-media-controls/controls/macos-fullscreen-media-controls.js:
2992         (MacOSFullscreenMediaControls.prototype.layout):
2993         * Modules/modern-media-controls/media/seek-support.js:
2994         (SeekSupport.prototype.get mediaEvents):
2995         (SeekSupport.prototype.syncControl):
2996
2997 2017-03-14  Joseph Pecoraro  <pecoraro@apple.com>
2998
2999         Web Inspector: More accurate Resource Timing data in Web Inspector
3000         https://bugs.webkit.org/show_bug.cgi?id=169577
3001
3002         Reviewed by Youenn Fablet.
3003
3004         * inspector/InspectorNetworkAgent.h:
3005         * inspector/InspectorNetworkAgent.cpp:
3006         (WebCore::InspectorNetworkAgent::didFinishLoading):
3007         Use the ResourceLoader to get the start time that responseEnd is relative to
3008         so we can send the more accurate responseEnd when available.
3009
3010         * inspector/InspectorInstrumentation.cpp:
3011         (WebCore::InspectorInstrumentation::didFinishLoadingImpl):
3012         * inspector/InspectorInstrumentation.h:
3013         (WebCore::InspectorInstrumentation::didFinishLoading):
3014         * loader/CrossOriginPreflightChecker.cpp:
3015         (WebCore::CrossOriginPreflightChecker::validatePreflightResponse):
3016         * loader/DocumentLoader.cpp:
3017         (WebCore::DocumentLoader::finishedLoading):
3018         * loader/ResourceLoadNotifier.cpp:
3019         (WebCore::ResourceLoadNotifier::didFinishLoad):
3020         (WebCore::ResourceLoadNotifier::dispatchDidFinishLoading):
3021         (WebCore::ResourceLoadNotifier::sendRemainingDelegateMessages):
3022         * loader/ResourceLoadNotifier.h:
3023         * loader/appcache/ApplicationCacheGroup.cpp:
3024         (WebCore::ApplicationCacheGroup::didFinishLoading):
3025         Pass ResourceLoader through to Web Inspector in didFinishLoading.
3026
3027         * platform/network/cocoa/NetworkLoadMetrics.mm:
3028         (WebCore::copyTimingData):
3029         The differences from the reference start are in Seconds, not milliseconds.
3030
3031 2017-03-14  Wenson Hsieh  <wenson_hsieh@apple.com>
3032
3033         [WK2] Data interaction tests occasionally hit assertions in debug builds
3034         https://bugs.webkit.org/show_bug.cgi?id=169002
3035         <rdar://problem/30994806>
3036
3037         Reviewed by Tim Horton.
3038
3039         Data interaction unit tests occasionally fail due to the UI process expecting the latest received EditorState to
3040         contain post layout data, but finding that it does not in -[WKContentView selectedTextRange]. The incomplete
3041         EditorStates in question are sent while performing a data interaction operation, due to transient changes in the
3042         frame selection. The UI process does not need to (and should not) be informed of these selection changes at all.
3043
3044         We can fix this by preventing the editor client from responding to selection changes during data interaction
3045         operation. This patch also renames setIgnoreCompositionSelectionChange to setIgnoreSelectionChanges to better
3046         reflect the fact that it is used outside of the context of holding selection change updates during IME. We
3047         already use this affordance in various places, such as TextIndicator (while taking a snapshot on iOS), in
3048         FindController on iOS, and when replacing selected or dictated text. Additionally, there is no logic in
3049         setIgnoreCompositionSelectionChange that limits its use to composition.
3050
3051         * editing/Editor.cpp:
3052         (WebCore::Editor::cancelCompositionIfSelectionIsInvalid):
3053         (WebCore::Editor::setComposition):
3054         (WebCore::Editor::revealSelectionAfterEditingOperation):
3055         (WebCore::Editor::setIgnoreSelectionChanges):
3056         (WebCore::Editor::changeSelectionAfterCommand):
3057         (WebCore::Editor::respondToChangedSelection):
3058         (WebCore::Editor::setIgnoreCompositionSelectionChange): Deleted.
3059         * editing/Editor.h:
3060         (WebCore::Editor::ignoreSelectionChanges):
3061         (WebCore::Editor::ignoreCompositionSelectionChange): Deleted.
3062         * editing/mac/EditorMac.mm:
3063         (WebCore::Editor::selectionWillChange):
3064         * page/TextIndicator.cpp:
3065         (WebCore::TextIndicator::createWithRange):
3066
3067 2017-03-14  Antoine Quint  <graouts@apple.com>
3068
3069         [Modern Media Controls] iOS may attempt to load fullscreen icon variants
3070         https://bugs.webkit.org/show_bug.cgi?id=169608
3071         <rdar://problem/31037369>
3072
3073         Reviewed by Eric Carlson.
3074
3075         Only return fullscreen or compact variants for macOS.
3076
3077         * Modules/modern-media-controls/controls/icon-service.js:
3078         (const.iconService.new.IconService.prototype._fileNameAndPlatformForIconNameAndLayoutTraits):
3079         (const.iconService.new.IconService):
3080
3081 2017-03-14  Antoine Quint  <graouts@apple.com>
3082
3083         [Modern Media Controls] Controls are laid out incorrectly with RTL languages
3084         https://bugs.webkit.org/show_bug.cgi?id=169605
3085         <rdar://problem/30975709>
3086
3087         Reviewed by Eric Carlson.
3088
3089         Encorce "direction: ltr" on the controls since the controls layout should not be changed
3090         by the host page's direction.
3091
3092         Test: media/modern-media-controls/media-controls/media-controls-controls-bar-always-ltr.html
3093
3094         * Modules/modern-media-controls/controls/controls-bar.css:
3095         (.controls-bar):
3096
3097 2017-03-13  Wenson Hsieh  <wenson_hsieh@apple.com>
3098
3099         Make RepaintRegionAccumulator hold a WeakPtr to its root RenderView
3100         https://bugs.webkit.org/show_bug.cgi?id=168480
3101         <rdar://problem/30566976>
3102
3103         Reviewed by Antti Koivisto.
3104
3105         Implements two mitigations to prevent the symptoms of the bug from occurring (see the bugzilla for more details).
3106
3107         Test: editing/execCommand/show-modal-dialog-during-execCommand.html
3108
3109         * editing/EditorCommand.cpp:
3110         (WebCore::Editor::Command::execute):
3111
3112         Do not allow edit commands to execute if the frame's document before and after layout differ (that is, edit commands
3113         triggered by a certain document should not run on a different document).
3114
3115         * rendering/RenderView.cpp:
3116         (WebCore::RenderView::RenderView):
3117         (WebCore::RenderView::RepaintRegionAccumulator::RepaintRegionAccumulator):
3118
3119         Turns RepaintRegionAccumulator's reference to its root RenderView into a WeakPtr to gracefully handle the case
3120         where its RenderView is destroyed before RepaintRegionAccumulator's destructor gets a chance to flush the
3121         RenderView's repaint regions.
3122
3123         * rendering/RenderView.h:
3124
3125 2017-03-14  Zan Dobersek  <zdobersek@igalia.com>
3126
3127         [GLib] Use USE(GLIB) guards in WebCore/workers/
3128         https://bugs.webkit.org/show_bug.cgi?id=169595
3129
3130         Reviewed by Carlos Garcia Campos.
3131
3132         Utilize the USE(GLIB) build guards in the WorkerRunLoop and WorkerThread
3133         class implementations to guard GLib-specific header inclusions and GLib
3134         API invocations, instead of the more specific PLATFORM(GTK) guards.
3135
3136         * workers/WorkerRunLoop.cpp:
3137         (WebCore::WorkerRunLoop::runInMode):
3138         * workers/WorkerThread.cpp:
3139         (WebCore::WorkerThread::workerThread):
3140
3141 2017-03-14  Zan Dobersek  <zdobersek@igalia.com>
3142
3143         [Soup] Suppress compiler warnings in NetworkStorageSession
3144         https://bugs.webkit.org/show_bug.cgi?id=169593
3145
3146         Reviewed by Carlos Garcia Campos.
3147
3148         Return default-constructed Vector objects in the NetworkStorageSession's
3149         getAllCookies() and getCookies() methods, avoiding compiler warnings.
3150
3151         * platform/network/soup/NetworkStorageSessionSoup.cpp:
3152         (WebCore::NetworkStorageSession::getAllCookies):
3153         (WebCore::NetworkStorageSession::getCookies):
3154
3155 2017-03-13  Joseph Pecoraro  <pecoraro@apple.com>
3156
3157         Remove unused methods of ResourceRequestBase
3158         https://bugs.webkit.org/show_bug.cgi?id=169579
3159
3160         Reviewed by Youenn Fablet.
3161
3162         * platform/network/ResourceRequestBase.h:
3163         (WebCore::ResourceRequestBase::reportUploadProgress): Deleted.
3164         (WebCore::ResourceRequestBase::setReportUploadProgress): Deleted.
3165         (WebCore::ResourceRequestBase::reportLoadTiming): Deleted.
3166         (WebCore::ResourceRequestBase::setReportLoadTiming): Deleted.
3167         (WebCore::ResourceRequestBase::reportRawHeaders): Deleted.
3168         (WebCore::ResourceRequestBase::setReportRawHeaders): Deleted.
3169         Remove unused code.
3170
3171         * inspector/InspectorNetworkAgent.cpp:
3172         (WebCore::InspectorNetworkAgent::willSendRequest):
3173         * loader/ResourceLoadNotifier.cpp:
3174         (WebCore::ResourceLoadNotifier::dispatchWillSendRequest):
3175         * xml/XMLHttpRequest.cpp:
3176         (WebCore::XMLHttpRequest::createRequest):
3177         Remove callers of setters that did nothing.
3178
3179 2017-03-13  Youenn Fablet  <youenn@apple.com>
3180
3181         Make RealtimeMediaSource::type an enum class
3182         https://bugs.webkit.org/show_bug.cgi?id=169491
3183
3184         Reviewed by Sam Weinig.
3185
3186         No change of behavior.
3187
3188         * Modules/mediastream/CanvasCaptureMediaStreamTrack.cpp:
3189         (WebCore::CanvasCaptureMediaStreamTrack::Source::Source):
3190         * Modules/mediastream/MediaStream.cpp:
3191         (WebCore::MediaStream::getAudioTracks):
3192         (WebCore::MediaStream::getVideoTracks):
3193         * Modules/mediastream/MediaStreamTrack.cpp:
3194         (WebCore::MediaStreamTrack::kind):
3195         * Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.cpp:
3196         (WebCore::LibWebRTCMediaEndpoint::addTrack):
3197         * Modules/webaudio/MediaStreamAudioSource.cpp:
3198         (WebCore::MediaStreamAudioSource::MediaStreamAudioSource):
3199         * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.mm:
3200         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::sampleBufferUpdated):
3201         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::updateTracks):
3202         * platform/mediastream/CaptureDeviceManager.cpp:
3203         (CaptureDeviceManager::bestSourcesForTypeAndConstraints):
3204         (CaptureDeviceManager::sourceWithUID):
3205         * platform/mediastream/MediaEndpoint.cpp:
3206         * platform/mediastream/RealtimeMediaSource.h:
3207         * platform/mediastream/mac/AVAudioCaptureSource.mm:
3208         (WebCore::AVAudioCaptureSource::AVAudioCaptureSource):
3209         * platform/mediastream/mac/AVVideoCaptureSource.mm:
3210         (WebCore::AVVideoCaptureSource::AVVideoCaptureSource):
3211         * platform/mediastream/mac/RealtimeMediaSourceCenterMac.cpp:
3212         (WebCore::RealtimeMediaSourceCenterMac::createMediaStream):
3213         * platform/mock/MockMediaEndpoint.cpp:
3214         (WebCore::MockMediaEndpoint::createMutedRemoteSource):
3215         * platform/mock/MockRealtimeAudioSource.cpp:
3216         (WebCore::MockRealtimeAudioSource::MockRealtimeAudioSource):
3217         * platform/mock/MockRealtimeMediaSource.cpp:
3218         (WebCore::MockRealtimeMediaSource::MockRealtimeMediaSource):
3219         * platform/mock/MockRealtimeVideoSource.cpp:
3220         (WebCore::MockRealtimeVideoSource::MockRealtimeVideoSource):
3221
3222 2017-03-13  Eric Carlson  <eric.carlson@apple.com>
3223
3224         [MediaStream] Move paintCurrentFrameInContext from RealtimeMediaSources to MediaPlayer
3225         https://bugs.webkit.org/show_bug.cgi?id=169474
3226         <rdar://problem/30976747>
3227
3228         Reviewed by Youenn Fablet.
3229
3230         Every video capture source has extremely similar code to render the current frame to
3231         a graphics context. Because the media player gets every video sample buffer, have it
3232         hang onto the most recent frame so it can implement paintCurrentFrameInContext directly.
3233         Fix an existing race condition that occasionally caused the readyState to advance to 
3234         "have enough data" before a video was ready to paint by defining a MediaStreamTrackPrivate
3235         readyState and observing that.
3236
3237         No new tests, covered by existing tests. These changes uncovered a bug in 
3238         fast/mediastream/MediaStream-video-element-video-tracks-disabled-then-enabled.html, which 
3239         was updated.
3240
3241         * Modules/mediastream/CanvasCaptureMediaStreamTrack.cpp:
3242         (WebCore::CanvasCaptureMediaStreamTrack::Source::captureCanvas):
3243         (WebCore::CanvasCaptureMediaStreamTrack::Source::paintCurrentFrameInContext): Deleted.
3244         (WebCore::CanvasCaptureMediaStreamTrack::Source::currentFrameImage): Deleted.
3245         * Modules/mediastream/CanvasCaptureMediaStreamTrack.h:
3246
3247         * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.h:
3248         * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.mm:
3249         (-[WebAVSampleBufferStatusChangeListener observeValueForKeyPath:ofObject:change:context:]):
3250         Drive-by change - don't pass status to parent callback, it is a property of the layer.
3251         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::isAvailable): Drive-by cleanup - we don't
3252         use AVSampleBufferRenderSynchronizer so don't fail if it isn't available.
3253         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::enqueueVideoSample): Hang onto new frame,
3254         invalidate cached image, update readyState.
3255         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::layerStatusDidChange): No more "updatePausedImage".
3256         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::ensureLayer): Drive-by cleanup - Add an early
3257          return if there is no need for a layer.
3258         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::destroyLayer): renderingModeChanged -> updateRenderingMode.
3259         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::currentDisplayMode): Minor cleanup.
3260         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::updateDisplayMode): Renamed from renderingModeChanged,
3261         add a bool return to signal when the mode changes.
3262         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::play): No more m_haveEverPlayed. Update display
3263         mode immediately.
3264         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::pause): No more paused image.
3265         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::currentReadyState): Only return HaveNothing, HaveMetadata,
3266         or HaveEnoughData. Don't return HaveEnoughData until all enabled tracks are providing data and never
3267         drop back to HaveMetadata.
3268         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::updateRenderingMode): Renamed from renderingModeChanged.
3269         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::characteristicsChanged): Update intrinsic
3270         size directly.
3271         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::sampleBufferUpdated): No more m_hasReceivedMedia.
3272         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::readyStateChanged): Ditto.
3273         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::checkSelectedVideoTrack): Reset imagePainter
3274         when active video track changes.
3275         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::updateCurrentFrameImage): Deleted.
3276         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::paintCurrentFrameInContext): Paint current
3277         frame image.
3278         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::CurrentFramePainter::reset): New.
3279         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::shouldEnqueueVideoSampleBuffer): Deleted.
3280         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::updatePausedImage): Deleted.
3281         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::updateIntrinsicSize): Deleted.
3282         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::renderingModeChanged): Deleted.
3283         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::audioSamplesAvailable): Deleted.
3284
3285         * platform/mediastream/MediaStreamPrivate.cpp:
3286         (WebCore::MediaStreamPrivate::paintCurrentFrameInContext): Deleted.
3287         (WebCore::MediaStreamPrivate::currentFrameImage): Deleted.
3288         * platform/mediastream/MediaStreamPrivate.h:
3289
3290         * platform/mediastream/MediaStreamTrackPrivate.cpp:
3291         (WebCore::MediaStreamTrackPrivate::MediaStreamTrackPrivate):
3292         (WebCore::MediaStreamTrackPrivate::endTrack): Update readyState.
3293         (WebCore::MediaStreamTrackPrivate::clone): Clone readyState.
3294         (WebCore::MediaStreamTrackPrivate::sourceStopped): Update readyState.
3295         (WebCore::MediaStreamTrackPrivate::videoSampleAvailable): Ditto.
3296         (WebCore::MediaStreamTrackPrivate::audioSamplesAvailable): Ditto.
3297         (WebCore::MediaStreamTrackPrivate::updateReadyState): New, update readyState and notify observers.
3298         (WebCore::MediaStreamTrackPrivate::paintCurrentFrameInContext): Deleted.
3299         * platform/mediastream/MediaStreamTrackPrivate.h:
3300
3301         * platform/mediastream/MediaStreamTrackPrivate.cpp:
3302         (WebCore::MediaStreamTrackPrivate::paintCurrentFrameInContext): Deleted.
3303         * platform/mediastream/RealtimeMediaSource.h:
3304         (WebCore::RealtimeMediaSource::currentFrameImage): Deleted.
3305         (WebCore::RealtimeMediaSource::paintCurrentFrameInContext): Deleted.
3306
3307         * platform/mediastream/mac/AVMediaCaptureSource.mm:
3308         (-[WebCoreAVMediaCaptureSourceObserver disconnect]): Drive-by fix - clear m_callback
3309         after calling removeNotificationObservers.
3310         (-[WebCoreAVMediaCaptureSourceObserver removeNotificationObservers]): Drive-by fix - remove 
3311         the correct listener.
3312         (-[WebCoreAVMediaCaptureSourceObserver endSessionInterrupted:]):
3313
3314         * platform/mediastream/mac/AVVideoCaptureSource.h:
3315         * platform/mediastream/mac/AVVideoCaptureSource.mm:
3316         (WebCore::AVVideoCaptureSource::currentFrameImage): Deleted.
3317         (WebCore::AVVideoCaptureSource::currentFrameCGImage): Deleted.
3318         (WebCore::AVVideoCaptureSource::paintCurrentFrameInContext): Deleted.
3319
3320         * platform/mediastream/mac/RealtimeIncomingVideoSource.cpp:
3321         (WebCore::drawImage): Deleted.
3322         (WebCore::RealtimeIncomingVideoSource::currentFrameImage): Deleted.
3323         (WebCore::RealtimeIncomingVideoSource::paintCurrentFrameInContext): Deleted.
3324         * platform/mediastream/mac/RealtimeIncomingVideoSource.h:
3325
3326         * platform/mock/MockRealtimeVideoSource.cpp:
3327         (WebCore::MockRealtimeVideoSource::paintCurrentFrameInContext): Deleted.
3328         (WebCore::MockRealtimeVideoSource::currentFrameImage): Deleted.
3329         * platform/mock/MockRealtimeVideoSource.h:
3330
3331 2017-03-13  Carlos Alberto Lopez Perez  <clopez@igalia.com>
3332
3333         [GTK][SOUP] Fix build after r213877
3334         https://bugs.webkit.org/show_bug.cgi?id=140191
3335
3336         Unreviewed build fix.
3337
3338         * platform/network/soup/NetworkStorageSessionSoup.cpp:
3339         (WebCore::NetworkStorageSession::setCookie): Add missing setCookie() declaration.
3340
3341 2017-03-13  Brady Eidson  <beidson@apple.com>
3342
3343         WKWebView provides no access to cookies.
3344         https://bugs.webkit.org/show_bug.cgi?id=140191
3345
3346         Reviewed by Tim Horton.
3347
3348         Covered by API tests.
3349
3350         * platform/Cookie.h:
3351
3352         * platform/network/NetworkStorageSession.h:
3353         * platform/network/cocoa/NetworkStorageSessionCocoa.mm:
3354         (WebCore::NetworkStorageSession::setCookie):
3355         (WebCore::NetworkStorageSession::deleteCookie):
3356         (WebCore::nsCookiesToCookieVector):
3357         (WebCore::NetworkStorageSession::getAllCookies):
3358         (WebCore::NetworkStorageSession::getCookies):
3359
3360         * platform/network/soup/NetworkStorageSessionSoup.cpp:
3361         (WebCore::NetworkStorageSession::deleteCookie):
3362         (WebCore::NetworkStorageSession::getAllCookies):
3363         (WebCore::NetworkStorageSession::getCookies):
3364
3365 2017-03-13  Devin Rousso  <webkit@devinrousso.com>
3366
3367         Web Inspector: Event Listeners section is missing 'once', 'passive' event listener flags
3368         https://bugs.webkit.org/show_bug.cgi?id=167080
3369
3370         Reviewed by Joseph Pecoraro.
3371
3372         Test: inspector/dom/getEventListenersForNode.html
3373
3374         * inspector/InspectorDOMAgent.cpp:
3375         (WebCore::InspectorDOMAgent::buildObjectForEventListener):
3376         Add "passive" and "once" values to the EventListener protocol object when applicable.
3377
3378 2017-03-13  John Wilander  <wilander@apple.com>
3379
3380         Resource Load Statistics: More efficient network process messaging + Fix bug in user interaction reporting
3381         https://bugs.webkit.org/show_bug.cgi?id=169506
3382
3383         Reviewed by Alex Christensen.
3384
3385         Covered by previous test which now follows the code path more closely to when reporting
3386         happens in the web process.
3387
3388         * loader/ResourceLoadObserver.cpp:
3389         (WebCore::ResourceLoadObserver::logUserInteractionWithReducedTimeResolution):
3390             No longer explicitly calls ResourceLoadStatisticsStore::fireShouldPartitionCookiesHandler().
3391             Instead just calls ResourceLoadStatisticsStore::fireDataModificationHandler().
3392         (WebCore::ResourceLoadObserver::logUserInteraction):
3393             Updated to call the new ResourceLoadStatisticsStore::fireShouldPartitionCookiesHandler().
3394         (WebCore::ResourceLoadObserver::fireShouldPartitionCookiesHandler):
3395             Now takes two vectors – domainsToRemove and domainsToAdd.
3396         * loader/ResourceLoadObserver.h:
3397         * loader/ResourceLoadStatistics.cpp:
3398         (WebCore::ResourceLoadStatistics::toString):
3399             Added boolean field isMarkedForCookiePartitioning.
3400         (WebCore::ResourceLoadStatistics::merge):
3401             Added boolean field isMarkedForCookiePartitioning.
3402         * loader/ResourceLoadStatistics.h:
3403             Added boolean field isMarkedForCookiePartitioning.
3404         * loader/ResourceLoadStatisticsStore.cpp:
3405         (WebCore::ResourceLoadStatisticsStore::readDataFromDecoder):
3406             Now marks statistics with isMarkedForCookiePartitioning before sending them off to
3407             ResourceLoadStatisticsStore::fireShouldPartitionCookiesHandler().
3408         (WebCore::ResourceLoadStatisticsStore::setShouldPartitionCookiesCallback):
3409             Now accepts a handler with two vectors.
3410         (WebCore::ResourceLoadStatisticsStore::fireShouldPartitionCookiesHandler):
3411             Now the only exported version of this function is the one without arguments.
3412             The one internal to WebCore accepts two vectors – domainsToRemove and domainsToAdd.
3413             The exported one generates the two vectors and then calls the internal one.
3414         (WebCore::ResourceLoadStatisticsStore::hasHadRecentUserInteraction):
3415             No longer explicitly calls ResourceLoadStatisticsStore::fireShouldPartitionCookiesHandler().
3416         * loader/ResourceLoadStatisticsStore.h:
3417         * platform/network/NetworkStorageSession.h:
3418         * platform/network/cf/NetworkStorageSessionCFNet.cpp:
3419         (WebCore::NetworkStorageSession::setShouldPartitionCookiesForHosts):
3420             Now takes two vectors – domainsToRemove and domainsToAdd.
3421
3422 2017-03-13  Dean Jackson  <dino@apple.com>
3423
3424         Respect the runtime flag for WebGPU, default feature to off.
3425         https://bugs.webkit.org/show_bug.cgi?id=169564
3426         <rdar://problems/31018864>
3427
3428         Reviewed by Tim Horton.
3429
3430         Make sure WebGPU respects its runtime feature flag. Also, since
3431         this implementation doesn't validate content, it should default
3432         to being disabled.
3433
3434         Test: fast/canvas/webgpu/webgpu-runtime-flag.html
3435
3436         * html/HTMLCanvasElement.cpp:
3437         (WebCore::HTMLCanvasElement::getContext):
3438         (WebCore::HTMLCanvasElement::getContextWebGPU):
3439
3440 2017-03-13  Alex Christensen  <achristensen@webkit.org>
3441
3442         Fix CMake build.
3443
3444         * PlatformMac.cmake:
3445         Add new files.
3446
3447 2017-03-13  Chris Dumez  <cdumez@apple.com>
3448
3449         Allow termination of background WebProcesses that go over a given CPU usage threshold
3450         https://bugs.webkit.org/show_bug.cgi?id=169456
3451         <rdar://problem/30960968>
3452
3453         Reviewed by Andreas Kling.
3454
3455         Add CPUMonitor utility class to monitor CPU usage and call a provided lambda
3456         whenever the process exceeds the provided CPU limit over a given period of
3457         time.
3458
3459         * WebCore.xcodeproj/project.pbxproj:
3460         * platform/CPUMonitor.cpp: Added.
3461         (WebCore::CPUMonitor::CPUMonitor):
3462         (WebCore::CPUMonitor::setCPULimit):
3463         (WebCore::CPUMonitor::timerFired):
3464         * platform/CPUMonitor.h: Added.
3465
3466 2017-03-13  Antoine Quint  <graouts@apple.com>
3467
3468         [Modern Media Controls] Volume icon doesn't turn to mute when the knob is set to 0
3469         https://bugs.webkit.org/show_bug.cgi?id=169553
3470         <rdar://problem/30754543>
3471
3472         Reviewed by Eric Carlson.
3473
3474         When we start changing the volume using the mouse, we record the volume at that point
3475         and as we drag the volume slider, we set the mute button to show that the media is
3476         muted if the volume is 0, and set the actual media volume to be the initial volume
3477         prior to dragging. This way, when we toggle the "muted" property by pressing the
3478         mute button, the original volume is restored.
3479
3480         To function correctly, this required some changed to Slider. The volume slider would
3481         fail to update if the value set was the same as the initial value since we would use
3482         only the "change" event to identify the end of a slider drag interaction. This was
3483         incorrect since if the initial value and the final value while dragging the slider
3484         were the same, no "change" event would be fired. So we now use mouse events to
3485         identify when the slider is being dragged.
3486
3487         Test: media/modern-media-controls/volume-support/volume-support-drag-to-mute.html
3488
3489         * Modules/modern-media-controls/controls/slider.js:
3490         (Slider.prototype.set value):
3491         (Slider.prototype.handleEvent):
3492         (Slider.prototype._handleMousedownEvent):
3493         (Slider.prototype._handleInputEvent):
3494         (Slider.prototype._handleMouseupEvent):
3495         (Slider.prototype._handleChangeEvent): Deleted.
3496         * Modules/modern-media-controls/controls/volume-slider.js:
3497         (VolumeSlider):
3498         (VolumeSlider.prototype.draw):
3499         (VolumeSlider.prototype.handleEvent): Deleted.
3500         * Modules/modern-media-controls/media/volume-support.js:
3501         (VolumeSupport.prototype.controlValueWillStartChanging):
3502         (VolumeSupport.prototype.controlValueDidChange):
3503
3504 2017-03-13  Per Arne Vollan  <pvollan@apple.com>
3505
3506         [Win] Compile error.
3507         https://bugs.webkit.org/show_bug.cgi?id=169546
3508
3509         Reviewed by Brent Fulgham.
3510
3511         There is no matching constructor in the Cookie class.
3512
3513         * platform/network/cf/CookieJarCFNet.cpp:
3514         (WebCore::getRawCookies):
3515
3516 2017-03-13  Miguel Gomez  <magomez@igalia.com>
3517
3518         ImageDecoder can be deleted while the async decoder thread is still using it
3519         https://bugs.webkit.org/show_bug.cgi?id=169199
3520
3521         Reviewed by Carlos Garcia Campos.
3522
3523         Make the image decoder used by ImageSource and ImageFrameCache into a RefPtr instead of
3524         and unique_ptr, and pass a reference to the decoder thread. This ensures that the decoder
3525         will stay alive as long as the decoding thread is processing frames. Also, stop the async
3526         decoding queue if a new decoder is set to ImageFrameCache.
3527
3528         No new tests.
3529
3530         * platform/graphics/ImageFrameCache.cpp:
3531         (WebCore::ImageFrameCache::setDecoder):
3532         (WebCore::ImageFrameCache::decoder):
3533         (WebCore::ImageFrameCache::startAsyncDecodingQueue):
3534         (WebCore::ImageFrameCache::metadata):
3535         * platform/graphics/ImageFrameCache.h:
3536         (WebCore::ImageFrameCache::setDecoder): Deleted.
3537         Moved to source file so we can keep the ImageDecoder forward declaration.
3538         (WebCore::ImageFrameCache::decoder): Deleted.
3539         Moved to source file so we can keep the ImageDecoder forward declaration.
3540         * platform/graphics/ImageSource.h:
3541         * platform/graphics/cg/ImageDecoderCG.h:
3542         (WebCore::ImageDecoder::create):
3543         * platform/graphics/win/ImageDecoderDirect2D.h:
3544         (WebCore::ImageDecoder::create):
3545         * platform/image-decoders/ImageDecoder.cpp:
3546         (WebCore::ImageDecoder::create):
3547         * platform/image-decoders/ImageDecoder.h:
3548
3549 2017-03-13  Manuel Rego Casasnovas  <rego@igalia.com>
3550
3551         Unprefix -webkit-min-content, -webkit-max-content and -webkit-fit-content
3552         https://bugs.webkit.org/show_bug.cgi?id=169195
3553
3554         Reviewed by Sergio Villar Senin.
3555
3556         Based on Blink r200846 by <cbiesinger@chromium.org>.
3557         https://src.chromium.org/viewvc/blink?revision=200846&view=revision
3558
3559         This patch adds support for the unprefixed version of these properties,
3560         while it keeps the prefixed ones working too.
3561         -webkit-fill-available is left out of this change, as the CSS WG
3562         is still defining the final keyword and behavior.
3563
3564         With this patch WebKit will be in the same situation than Blink
3565         regarding these intrinsic sizing keywords (see http://crbug.com/245157).
3566
3567         Test: fast/css-intrinsic-dimensions/height-property-value.html
3568               fast/css-intrinsic-dimensions/width-property-value.html
3569
3570         * css/CSSPrimitiveValue.cpp:
3571         (WebCore::CSSPrimitiveValue::init):
3572         * css/CSSValueKeywords.in:
3573         * css/StyleBuilderConverter.h:
3574         (WebCore::StyleBuilderConverter::convertLengthSizing):
3575         (WebCore::StyleBuilderConverter::createGridTrackBreadth):
3576         * css/html.css:
3577         (fieldset):
3578         * css/parser/CSSPropertyParser.cpp:
3579         (WebCore::validWidthOrHeightKeyword):
3580         (WebCore::isGridTrackFixedSized):
3581         (WebCore::consumeGridBreadth):
3582         * html/track/TextTrackCueGeneric.cpp:
3583         (WebCore::TextTrackCueGenericBoxElement::applyCSSProperties):
3584         * html/track/VTTCue.cpp:
3585         (WebCore::VTTCueBox::applyCSSProperties):
3586
3587 2017-03-13  Dean Jackson  <dino@apple.com>
3588
3589         WebGPU remote layer hosting
3590         https://bugs.webkit.org/show_bug.cgi?id=169539
3591         <rdar://problem/31005380>
3592
3593         Reviewed by Jon Lee.
3594
3595         Implement the WebProcess side of WebGPULayer hosting,
3596         via LayerTypeWebGPULayer.
3597
3598         * platform/graphics/ca/PlatformCALayer.cpp:
3599         (WebCore::operator<<): Provide nice pretty printing.
3600         * platform/graphics/ca/PlatformCALayer.h: Add LayerTypeWebGPULayer.
3601         * platform/graphics/ca/cocoa/PlatformCALayerCocoa.mm: Support LayerTypeWebGPULayer.
3602         (PlatformCALayerCocoa::layerTypeForPlatformLayer):
3603         (PlatformCALayerCocoa::PlatformCALayerCocoa):
3604         (PlatformCALayerCocoa::commonInit):
3605
3606 2017-03-13  Zan Dobersek  <zdobersek@igalia.com>
3607
3608         Unreviewed GTK+ build fix. Adjust the Cookie constructor
3609         invocation in CookieJarSoup, using empty values for the
3610         newly-added parameters. This should probably be revised
3611         to determine whether meaningful values can be passed in.
3612
3613         * platform/network/soup/CookieJarSoup.cpp:
3614         (WebCore::getRawCookies):
3615
3616 2017-03-13  Jon Lee  <jonlee@apple.com>
3617
3618         WebGPU: Backend - hosting WebGPU layers
3619         https://bugs.webkit.org/show_bug.cgi?id=169366
3620         <rdar://problem/30928735>
3621
3622         Reviewed by Dean Jackson.
3623
3624         * html/canvas/WebGPURenderingContext.cpp:
3625         (WebCore::WebGPURenderingContext::create): Create the device and the
3626         rendering context.
3627         * platform/graphics/cocoa/GPUCommandBufferMetal.mm:
3628         (WebCore::GPUCommandBuffer::commit):
3629         * platform/graphics/cocoa/GPUDrawableMetal.mm:
3630         (WebCore::GPUDrawable::release): Fix a log message
3631         * platform/graphics/gpu/GPUCommandBuffer.cpp:
3632         (WebCore::GPUCommandBuffer::commit): Deleted. Moved to GPUCommandBufferMetal.
3633         * rendering/RenderLayerBacking.cpp:
3634         (WebCore::canvasCompositingStrategy): WebGPU canvas should return CanvasAsLayerContents.
3635
3636 2017-03-12  Jon Lee  <jonlee@apple.com>
3637
3638         Remove stubs from WebGPU front end
3639         https://bugs.webkit.org/show_bug.cgi?id=169375
3640
3641         Reviewed by Dean Jackson.
3642
3643         Remove stubs and use the back end.
3644         * html/canvas/WebGPUCommandBuffer.cpp:
3645         * html/canvas/WebGPUCommandBuffer.h:
3646         * html/canvas/WebGPUCommandQueue.cpp:
3647         * html/canvas/WebGPUCommandQueue.h:
3648         * html/canvas/WebGPUDepthStencilDescriptor.cpp:
3649         (WebCore::WebGPUDepthStencilDescriptor::setDepthCompareFunction): Remove redundant clause.
3650         * html/canvas/WebGPUDepthStencilDescriptor.h:
3651         * html/canvas/WebGPUDepthStencilDescriptor.idl: Remove label property. Not needed yet.
3652         * html/canvas/WebGPUDepthStencilState.cpp:
3653         * html/canvas/WebGPUDepthStencilState.h:
3654         * html/canvas/WebGPUEnums.cpp:
3655         * html/canvas/WebGPUEnums.h:
3656         * html/canvas/WebGPURenderCommandEncoder.cpp:
3657         * html/canvas/WebGPURenderCommandEncoder.h:
3658         * html/canvas/WebGPURenderPassAttachmentDescriptor.cpp:
3659         * html/canvas/WebGPURenderPassAttachmentDescriptor.h:
3660         * html/canvas/WebGPURenderPassColorAttachmentDescriptor.cpp:
3661         * html/canvas/WebGPURenderPassColorAttachmentDescriptor.h:
3662         * html/canvas/WebGPURenderPassDepthAttachmentDescriptor.cpp:
3663         * html/canvas/WebGPURenderPassDepthAttachmentDescriptor.h:
3664         * html/canvas/WebGPURenderPassDescriptor.cpp:
3665         (WebCore::WebGPURenderPassDescriptor::colorAttachments): Uncomment code with GPURenderPassColorAttachmentDescriptor available.
3666         * html/canvas/WebGPURenderPassDescriptor.h:
3667         * html/canvas/WebGPURenderPipelineColorAttachmentDescriptor.cpp:
3668         * html/canvas/WebGPURenderPipelineColorAttachmentDescriptor.h:
3669         * html/canvas/WebGPURenderPipelineDescriptor.cpp:
3670         * html/canvas/WebGPURenderPipelineDescriptor.h:
3671         * html/canvas/WebGPURenderPipelineDescriptor.idl: Remove label property. Not needed yet.
3672         * html/canvas/WebGPURenderPipelineState.cpp:
3673         * html/canvas/WebGPURenderPipelineState.h:
3674
3675 2017-03-12  Dean Jackson  <dino@apple.com>
3676
3677         WebGPU Backend
3678         https://bugs.webkit.org/show_bug.cgi?id=169535
3679         <rdar://problem/31002364>
3680
3681         Reviewed by Jon Lee.
3682
3683         Fill in the remainder of the WebGPU backend. This is effectively
3684         a C++ representation of the Metal API.
3685
3686         * WebCore.xcodeproj/project.pbxproj:
3687         * html/canvas/WebGPUDrawable.cpp:
3688         (WebCore::WebGPUDrawable::WebGPUDrawable):
3689         * html/canvas/WebGPUDrawable.h:
3690         (WebCore::GPUDrawable::texture): Deleted.
3691         * platform/graphics/cocoa/GPUBufferMetal.mm:
3692         (WebCore::GPUBuffer::GPUBuffer):
3693         (WebCore::GPUBuffer::platformBuffer):
3694         * platform/graphics/cocoa/GPUCommandBufferMetal.mm: Copied from Source/WebCore/platform/graphics/cocoa/GPUFunctionMetal.mm.
3695         (WebCore::GPUCommandBuffer::GPUCommandBuffer):
3696         (WebCore::GPUCommandBuffer::platformCommandBuffer):
3697         (WebCore::GPUCommandBuffer::presentDrawable):
3698         * platform/graphics/cocoa/GPUCommandQueueMetal.mm: Copied from Source/WebCore/platform/graphics/cocoa/GPUFunctionMetal.mm.
3699         (WebCore::GPUCommandQueue::GPUCommandQueue):
3700         (WebCore::GPUCommandQueue::label):
3701         (WebCore::GPUCommandQueue::setLabel):
3702         (WebCore::GPUCommandQueue::platformCommandQueue):
3703         * platform/graphics/cocoa/GPUDepthStencilDescriptorMetal.mm: Copied from Source/WebCore/platform/graphics/cocoa/GPUTextureMetal.mm.
3704         (WebCore::GPUDepthStencilDescriptor::GPUDepthStencilDescriptor):
3705         (WebCore::GPUDepthStencilDescriptor::depthWriteEnabled):
3706         (WebCore::GPUDepthStencilDescriptor::setDepthWriteEnabled):
3707         (WebCore::GPUDepthStencilDescriptor::depthCompareFunction):
3708         (WebCore::GPUDepthStencilDescriptor::setDepthCompareFunction):
3709         (WebCore::GPUDepthStencilDescriptor::platformDepthStencilDescriptor):
3710         * platform/graphics/cocoa/GPUDepthStencilStateMetal.mm: Copied from Source/WebCore/platform/graphics/cocoa/GPUFunctionMetal.mm.
3711         (WebCore::GPUDepthStencilState::GPUDepthStencilState):
3712         (WebCore::GPUDepthStencilState::label):
3713         (WebCore::GPUDepthStencilState::setLabel):
3714         (WebCore::GPUDepthStencilState::platformDepthStencilState):
3715         * platform/graphics/cocoa/GPUDrawableMetal.mm: Copied from Source/WebCore/platform/graphics/cocoa/GPUFunctionMetal.mm.
3716         (WebCore::GPUDrawable::GPUDrawable):
3717         (WebCore::GPUDrawable::release):
3718         (WebCore::GPUDrawable::platformDrawable):
3719         (WebCore::GPUDrawable::platformTexture):
3720         * platform/graphics/cocoa/GPUFunctionMetal.mm:
3721         (WebCore::GPUFunction::GPUFunction):
3722         (WebCore::GPUFunction::platformFunction):
3723         * platform/graphics/cocoa/GPULibraryMetal.mm:
3724         (WebCore::GPULibrary::GPULibrary):
3725         (WebCore::GPULibrary::setLabel):
3726         (WebCore::GPULibrary::platformLibrary):
3727         * platform/graphics/cocoa/GPURenderCommandEncoderMetal.mm: Added.
3728         (WebCore::GPURenderCommandEncoder::GPURenderCommandEncoder):
3729         (WebCore::GPURenderCommandEncoder::setRenderPipelineState):
3730         (WebCore::GPURenderCommandEncoder::setDepthStencilState):
3731         (WebCore::GPURenderCommandEncoder::setVertexBuffer):
3732         (WebCore::GPURenderCommandEncoder::setFragmentBuffer):
3733         (WebCore::GPURenderCommandEncoder::drawPrimitives):
3734         (WebCore::GPURenderCommandEncoder::endEncoding):
3735         (WebCore::GPURenderCommandEncoder::platformRenderCommandEncoder):
3736         * platform/graphics/cocoa/GPURenderPassAttachmentDescriptorMetal.mm: Added.
3737         (WebCore::GPURenderPassAttachmentDescriptor::GPURenderPassAttachmentDescriptor):
3738         (WebCore::GPURenderPassAttachmentDescriptor::loadAction):
3739         (WebCore::GPURenderPassAttachmentDescriptor::setLoadAction):
3740         (WebCore::GPURenderPassAttachmentDescriptor::storeAction):
3741         (WebCore::GPURenderPassAttachmentDescriptor::setStoreAction):
3742         (WebCore::GPURenderPassAttachmentDescriptor::setTexture):
3743         (WebCore::GPURenderPassAttachmentDescriptor::platformRenderPassAttachmentDescriptor):
3744         * platform/graphics/cocoa/GPURenderPassColorAttachmentDescriptorMetal.mm: Added.
3745         (WebCore::GPURenderPassColorAttachmentDescriptor::create):
3746         (WebCore::GPURenderPassColorAttachmentDescriptor::GPURenderPassColorAttachmentDescriptor):
3747         (WebCore::GPURenderPassColorAttachmentDescriptor::clearColor):
3748         (WebCore::GPURenderPassColorAttachmentDescriptor::setClearColor):
3749         (WebCore::GPURenderPassColorAttachmentDescriptor::platformRenderPassColorAttachmentDescriptor):
3750         * platform/graphics/cocoa/GPURenderPassDepthAttachmentDescriptorMetal.mm: Added.
3751         (WebCore::GPURenderPassDepthAttachmentDescriptor::create):
3752         (WebCore::GPURenderPassDepthAttachmentDescriptor::GPURenderPassDepthAttachmentDescriptor):
3753         (WebCore::GPURenderPassDepthAttachmentDescriptor::clearDepth):
3754         (WebCore::GPURenderPassDepthAttachmentDescriptor::setClearDepth):
3755         (WebCore::GPURenderPassDepthAttachmentDescriptor::platformRenderPassDepthAttachmentDescriptor):
3756         * platform/graphics/cocoa/GPURenderPassDescriptorMetal.mm: Copied from Source/WebCore/platform/graphics/cocoa/GPUBufferMetal.mm.
3757         (WebCore::GPURenderPassDescriptor::GPURenderPassDescriptor):
3758         (WebCore::GPURenderPassDescriptor::colorAttachments):
3759         (WebCore::GPURenderPassDescriptor::depthAttachment):
3760         (WebCore::GPURenderPassDescriptor::platformRenderPassDescriptor):
3761         * platform/graphics/cocoa/GPURenderPipelineColorAttachmentDescriptorMetal.mm: Copied from Source/WebCore/platform/graphics/cocoa/GPULibraryMetal.mm.
3762         (WebCore::GPURenderPipelineColorAttachmentDescriptor::create):
3763         (WebCore::GPURenderPipelineColorAttachmentDescriptor::GPURenderPipelineColorAttachmentDescriptor):
3764         (WebCore::GPURenderPipelineColorAttachmentDescriptor::pixelFormat):
3765         (WebCore::GPURenderPipelineColorAttachmentDescriptor::setPixelFormat):
3766         (WebCore::GPURenderPipelineColorAttachmentDescriptor::platformRenderPipelineColorAttachmentDescriptor):
3767         * platform/graphics/cocoa/GPURenderPipelineDescriptorMetal.mm: Added.
3768         (WebCore::GPURenderPipelineDescriptor::GPURenderPipelineDescriptor):
3769         (WebCore::GPURenderPipelineDescriptor::depthAttachmentPixelFormat):
3770         (WebCore::GPURenderPipelineDescriptor::setDepthAttachmentPixelFormat):
3771         (WebCore::GPURenderPipelineDescriptor::setVertexFunction):
3772         (WebCore::GPURenderPipelineDescriptor::setFragmentFunction):
3773         (WebCore::GPURenderPipelineDescriptor::colorAttachments):
3774         (WebCore::GPURenderPipelineDescriptor::reset):
3775         (WebCore::GPURenderPipelineDescriptor::platformRenderPipelineDescriptor):
3776         * platform/graphics/cocoa/GPURenderPipelineStateMetal.mm: Copied from Source/WebCore/platform/graphics/cocoa/GPUTextureMetal.mm.
3777         (WebCore::GPURenderPipelineState::GPURenderPipelineState):
3778         (WebCore::GPURenderPipelineState::label):
3779         (WebCore::GPURenderPipelineState::setLabel):
3780         (WebCore::GPURenderPipelineState::platformRenderPipelineState):
3781         * platform/graphics/cocoa/GPUTextureDescriptorMetal.mm:
3782         (WebCore::GPUTextureDescriptor::GPUTextureDescriptor):
3783         (WebCore::GPUTextureDescriptor::platformTextureDescriptor):
3784         * platform/graphics/cocoa/GPUTextureMetal.mm:
3785         (WebCore::GPUTexture::GPUTexture):
3786         (WebCore::GPUTexture::platformTexture):
3787         * platform/graphics/gpu/GPUBuffer.cpp:
3788         * platform/graphics/gpu/GPUBuffer.h:
3789         * platform/graphics/gpu/GPUCommandBuffer.cpp: Copied from Source/WebCore/platform/graphics/gpu/GPUBuffer.cpp.
3790         (WebCore::GPUCommandBuffer::create):
3791         (WebCore::GPUCommandBuffer::~GPUCommandBuffer):
3792         (WebCore::GPUCommandBuffer::commit):
3793         (WebCore::GPUCommandBuffer::createRenderCommandEncoder):
3794         (WebCore::GPUCommandBuffer::presentDrawable):
3795         * platform/graphics/gpu/GPUCommandBuffer.h: Copied from Source/WebCore/platform/graphics/gpu/GPUTexture.h.
3796         * platform/graphics/gpu/GPUCommandQueue.cpp: Copied from Source/WebCore/platform/graphics/gpu/GPUBuffer.cpp.
3797         (WebCore::GPUCommandQueue::create):
3798         (WebCore::GPUCommandQueue::~GPUCommandQueue):
3799         (WebCore::GPUCommandQueue::createCommandBuffer):
3800         (WebCore::GPUCommandQueue::label):
3801         (WebCore::GPUCommandQueue::setLabel):
3802         * platform/graphics/gpu/GPUCommandQueue.h: Copied from Source/WebCore/platform/graphics/gpu/GPULibrary.h.
3803         * platform/graphics/gpu/GPUDepthStencilDescriptor.cpp: Copied from Source/WebCore/platform/graphics/gpu/GPUTexture.cpp.
3804         (WebCore::GPUDepthStencilDescriptor::create):
3805         (WebCore::GPUDepthStencilDescriptor::~GPUDepthStencilDescriptor):
3806         (WebCore::GPUDepthStencilDescriptor::depthWriteEnabled):
3807         (WebCore::GPUDepthStencilDescriptor::setDepthWriteEnabled):
3808         (WebCore::GPUDepthStencilDescriptor::depthCompareFunction):
3809         (WebCore::GPUDepthStencilDescriptor::setDepthCompareFunction):
3810         * platform/graphics/gpu/GPUDepthStencilDescriptor.h: Copied from Source/WebCore/platform/graphics/gpu/GPUTexture.h.
3811         * platform/graphics/gpu/GPUDepthStencilState.cpp: Copied from Source/WebCore/platform/graphics/gpu/GPUBuffer.cpp.
3812         (WebCore::GPUDepthStencilState::create):
3813         (WebCore::GPUDepthStencilState::~GPUDepthStencilState):
3814         (WebCore::GPUDepthStencilState::label):
3815         (WebCore::GPUDepthStencilState::setLabel):
3816         * platform/graphics/gpu/GPUDepthStencilState.h: Copied from Source/WebCore/platform/graphics/gpu/GPULibrary.h.
3817         * platform/graphics/gpu/GPUDevice.cpp:
3818         (WebCore::GPUDevice::createCommandQueue):
3819         (WebCore::GPUDevice::getFramebuffer):
3820         * platform/graphics/gpu/GPUDevice.h:
3821         (WebCore::GPUDevice::markLayerComposited):
3822         (WebCore::GPUDevice::createCommandQueue): Deleted.
3823         (WebCore::GPUDevice::getFramebuffer): Deleted.
3824         * platform/graphics/gpu/GPUDrawable.cpp: Copied from Source/WebCore/platform/graphics/gpu/GPUBuffer.cpp.
3825         (WebCore::GPUDrawable::create):
3826         (WebCore::GPUDrawable::~GPUDrawable):
3827         (WebCore::GPUDrawable::release):
3828         * platform/graphics/gpu/GPUDrawable.h: Copied from Source/WebCore/platform/graphics/gpu/GPUTexture.h.
3829         * platform/graphics/gpu/GPUEnums.h: Copied from Source/WebCore/platform/graphics/cocoa/GPUFunctionMetal.mm.
3830         * platform/graphics/gpu/GPUFunction.h:
3831         * platform/graphics/gpu/GPULibrary.cpp:
3832         * platform/graphics/gpu/GPULibrary.h:
3833         * platform/graphics/gpu/GPURenderCommandEncoder.cpp: Copied from Source/WebCore/platform/graphics/gpu/GPULibrary.cpp.
3834         (WebCore::GPURenderCommandEncoder::create):
3835         (WebCore::GPURenderCommandEncoder::~GPURenderCommandEncoder):
3836         (WebCore::GPURenderCommandEncoder::setRenderPipelineState):
3837         (WebCore::GPURenderCommandEncoder::setDepthStencilState):
3838         (WebCore::GPURenderCommandEncoder::setVertexBuffer):
3839         (WebCore::GPURenderCommandEncoder::setFragmentBuffer):
3840         (WebCore::GPURenderCommandEncoder::drawPrimitives):
3841         (WebCore::GPURenderCommandEncoder::endEncoding):
3842         * platform/graphics/gpu/GPURenderCommandEncoder.h: Copied from Source/WebCore/platform/graphics/gpu/GPUTexture.h.
3843         * platform/graphics/gpu/GPURenderPassAttachmentDescriptor.cpp: Copied from Source/WebCore/platform/graphics/gpu/GPUTexture.cpp.
3844         (WebCore::GPURenderPassAttachmentDescriptor::~GPURenderPassAttachmentDescriptor):
3845         (WebCore::GPURenderPassAttachmentDescriptor::GPURenderPassAttachmentDescriptor):
3846         (WebCore::GPURenderPassAttachmentDescriptor::loadAction):
3847         (WebCore::GPURenderPassAttachmentDescriptor::setLoadAction):
3848         (WebCore::GPURenderPassAttachmentDescriptor::storeAction):
3849         (WebCore::GPURenderPassAttachmentDescriptor::setStoreAction):
3850         (WebCore::GPURenderPassAttachmentDescriptor::setTexture):
3851         * platform/graphics/gpu/GPURenderPassAttachmentDescriptor.h: Copied from Source/WebCore/platform/graphics/gpu/GPUTexture.h.
3852         * platform/graphics/gpu/GPURenderPassColorAttachmentDescriptor.cpp: Copied from Source/WebCore/platform/graphics/gpu/GPUDevice.cpp.
3853         (WebCore::GPURenderPassColorAttachmentDescriptor::create):
3854         (WebCore::GPURenderPassColorAttachmentDescriptor::GPURenderPassColorAttachmentDescriptor):
3855         (WebCore::GPURenderPassColorAttachmentDescriptor::~GPURenderPassColorAttachmentDescriptor):
3856         (WebCore::GPURenderPassColorAttachmentDescriptor::clearColor):
3857         (WebCore::GPURenderPassColorAttachmentDescriptor::setClearColor):
3858         * platform/graphics/gpu/GPURenderPassColorAttachmentDescriptor.h: Copied from Source/WebCore/platform/graphics/gpu/GPUTexture.h.
3859         * platform/graphics/gpu/GPURenderPassDepthAttachmentDescriptor.cpp: Copied from Source/WebCore/platform/graphics/gpu/GPUTexture.cpp.
3860         (WebCore::GPURenderPassDepthAttachmentDescriptor::create):
3861         (WebCore::GPURenderPassDepthAttachmentDescriptor::GPURenderPassDepthAttachmentDescriptor):
3862         (WebCore::GPURenderPassDepthAttachmentDescriptor::~GPURenderPassDepthAttachmentDescriptor):
3863         (WebCore::GPURenderPassDepthAttachmentDescriptor::clearDepth):
3864         (WebCore::GPURenderPassDepthAttachmentDescriptor::setClearDepth):
3865         * platform/graphics/gpu/GPURenderPassDepthAttachmentDescriptor.h: Copied from Source/WebCore/platform/graphics/gpu/GPUTexture.h.
3866         * platform/graphics/gpu/GPURenderPassDescriptor.cpp: Copied from Source/WebCore/platform/graphics/gpu/GPUBuffer.cpp.
3867         (WebCore::GPURenderPassDescriptor::create):
3868         (WebCore::GPURenderPassDescriptor::~GPURenderPassDescriptor):
3869         (WebCore::GPURenderPassDescriptor::depthAttachment):
3870         * platform/graphics/gpu/GPURenderPassDescriptor.h: Copied from Source/WebCore/platform/graphics/gpu/GPUTexture.h.
3871         * platform/graphics/gpu/GPURenderPipelineColorAttachmentDescriptor.cpp: Copied from Source/WebCore/platform/graphics/gpu/GPUTexture.cpp.
3872         (WebCore::GPURenderPipelineColorAttachmentDescriptor::~GPURenderPipelineColorAttachmentDescriptor):
3873         (WebCore::GPURenderPipelineColorAttachmentDescriptor::GPURenderPipelineColorAttachmentDescriptor):
3874         (WebCore::GPURenderPipelineColorAttachmentDescriptor::pixelFormat):
3875         (WebCore::GPURenderPipelineColorAttachmentDescriptor::setPixelFormat):
3876         * platform/graphics/gpu/GPURenderPipelineColorAttachmentDescriptor.h: Copied from Source/WebCore/platform/graphics/gpu/GPUTexture.h.
3877         * platform/graphics/gpu/GPURenderPipelineDescriptor.cpp: Copied from Source/WebCore/platform/graphics/gpu/GPUDevice.cpp.
3878         (WebCore::GPURenderPipelineDescriptor::create):
3879         (WebCore::GPURenderPipelineDescriptor::~GPURenderPipelineDescriptor):
3880         (WebCore::GPURenderPipelineDescriptor::depthAttachmentPixelFormat):
3881         (WebCore::GPURenderPipelineDescriptor::setDepthAttachmentPixelFormat):
3882         (WebCore::GPURenderPipelineDescriptor::setVertexFunction):
3883         (WebCore::GPURenderPipelineDescriptor::setFragmentFunction):
3884         (WebCore::GPURenderPipelineDescriptor::colorAttachments):
3885         * platform/graphics/gpu/GPURenderPipelineDescriptor.h: Copied from Source/WebCore/platform/graphics/gpu/GPULibrary.h.
3886         * platform/graphics/gpu/GPURenderPipelineState.cpp: Copied from Source/WebCore/platform/graphics/gpu/GPULibrary.cpp.
3887         (WebCore::GPURenderPipelineState::create):
3888         (WebCore::GPURenderPipelineState::~GPURenderPipelineState):
3889         (WebCore::GPURenderPipelineState::label):
3890         (WebCore::GPURenderPipelineState::setLabel):
3891         * platform/graphics/gpu/GPURenderPipelineState.h: Copied from Source/WebCore/platform/graphics/gpu/GPULibrary.h.
3892         * platform/graphics/gpu/GPUTexture.cpp:
3893         (WebCore::GPUTexture::createFromDrawable):
3894         (WebCore::GPUTexture::createFromExistingTexture): Deleted.
3895         * platform/graphics/gpu/GPUTexture.h:
3896         * platform/graphics/gpu/GPUTextureDescriptor.cpp:
3897         * platform/graphics/gpu/GPUTextureDescriptor.h:
3898
3899 2017-03-12  Zalan Bujtas  <zalan@apple.com>
3900
3901         Simple line layout: Paginated content is not painted properly when font overflows line height.
3902         https://bugs.webkit.org/show_bug.cgi?id=169516
3903
3904         Reviewed by Antti Koivisto.
3905
3906         adjustLineIndexForStruts should take the IndexType::First/Last into account
3907         when searching for the line index in a paginated context.
3908         This also changes the the computed offset height from m_lineHeight to m_ascent + m_descent
3909         so that we can find lines with large fonts (but small line height).
3910
3911         Test: fast/multicol/simple-line-layout-line-index-after-strut.html
3912
3913         * rendering/SimpleLineLayoutResolver.cpp:
3914         (WebCore::SimpleLineLayout::RunResolver::adjustLineIndexForStruts):
3915         (WebCore::SimpleLineLayout::RunResolver::lineIndexForHeight):
3916         (WebCore::SimpleLineLayout::RunResolver::rangeForRect):
3917         * rendering/SimpleLineLayoutResolver.h:
3918
3919 2017-03-12  Brady Eidson  <beidson@apple.com>
3920
3921         Add full NSHTTPCookie fidelity to WebCore::Cookie.
3922         https://bugs.webkit.org/show_bug.cgi?id=169514
3923
3924         Reviewed by Dean Jackson.
3925
3926         No new tests (Refactor, no testable behavior change for now).
3927
3928         * platform/Cookie.h:
3929         (WebCore::Cookie::Cookie):
3930         (WebCore::Cookie::encode):
3931         (WebCore::Cookie::decode):
3932         
3933         * platform/network/cocoa/CookieCocoa.mm:
3934         (WebCore::portVectorFromList):
3935         (WebCore::portStringFromVector):
3936         (WebCore::Cookie::Cookie):
3937         (WebCore::Cookie::operator NSHTTPCookie *):
3938         
3939         * platform/network/mac/CookieJarMac.mm:
3940         (WebCore::getRawCookies):
3941
3942 2017-03-12  Said Abou-Hallawa  <sabouhallawa@apple.com>
3943
3944         REGRESSION (r213764): Async image decoding is disabled for animated images
3945         https://bugs.webkit.org/show_bug.cgi?id=169529
3946
3947         Reviewed by Jon Lee.
3948         
3949         The change r213764 causes the animated images to be decoded synchronously
3950         because we were calling frameImageAtIndex() with an empty sizeForDrawing
3951         but with a valid subsamplingLevel. This call is translated to be synchronous
3952         image decoding. The fix is get the current image frame without any decoding.
3953         This is because are sure that in the case of animated image, the current
3954         image frame can not be deleted.
3955
3956         * platform/graphics/BitmapImage.cpp:
3957         (WebCore::BitmapImage::draw):
3958
3959 2017-03-12  Romain Bellessort  <romain.bellessort@crf.canon.fr>
3960
3961         [Readable Streams API] Implement ReadableStreamBYOBRequest respond() (closed stream state)
3962         https://bugs.webkit.org/show_bug.cgi?id=168781
3963
3964         Reviewed by Youenn Fablet.
3965
3966         Implemented ReadableStreamBYOBRequest respond() method in the case of a closed stream.
3967
3968         Added tests related to respond() method and updated WPT imported tests expectations.
3969
3970         * Modules/streams/ReadableByteStreamInternals.js:
3971         (readableByteStreamControllerRespond): Added.
3972         (readableByteStreamControllerRespondInternal): Added.
3973         (readableByteStreamControllerRespondInClosedState): Added.
3974         (readableByteStreamControllerShiftPendingPullInto): Added.
3975         (readableByteStreamControllerInvalidateBYOBRequest): Added.
3976         (readableByteStreamControllerCommitPullIntoDescriptor): Added.
3977         (readableByteStreamControllerConvertPullIntoDescriptor): Added.
3978         (readableStreamFulfill