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