2fcbbc327c802b79175626ca063605d8d0b9eaef
[WebKit-https.git] / Source / WebCore / ChangeLog
1 2018-05-18  Zalan Bujtas  <zalan@apple.com>
2
3         [LFC] Implement width computation for non-replaced floating elements.
4         https://bugs.webkit.org/show_bug.cgi?id=185759
5
6         Reviewed by Antti Koivisto.
7
8         * layout/FormattingContext.cpp:
9         (WebCore::Layout::FormattingContext::computeFloatingWidth const):
10         (WebCore::Layout::FormattingContext::computeFloatingNonReplacedWidth const):
11         * layout/FormattingContext.h:
12
13 2018-05-18  Antoine Quint  <graouts@apple.com>
14
15         [modern-media-controls] AirPlaySupport should be disabled by default
16         https://bugs.webkit.org/show_bug.cgi?id=185658
17         <rdar://problem/40272213>
18
19         Reviewed by Simon Fraser.
20
21         We now only enable AirplaySupport if the controls are visible to the user _and_ media has played.
22
23         Test: media/modern-media-controls/airplay-support/airplay-support-disable-event-listeners-until-play.html
24
25         * Modules/modern-media-controls/media/airplay-support.js:
26         (AirplaySupport.prototype.enable):
27         (AirplaySupport.prototype.controlsUserVisibilityDidChange):
28         (AirplaySupport.prototype._shouldBeEnabled):
29         (AirplaySupport):
30
31 2018-05-18  Tim Horton  <timothy_horton@apple.com>
32
33         Stop softlinking QuickLook when loading from client-registered schemes
34         https://bugs.webkit.org/show_bug.cgi?id=185716
35         <rdar://problem/40303227>
36
37         Reviewed by Dan Bernstein.
38
39         No new tests, just a performance improvement.
40
41         * dom/Document.cpp:
42         * platform/SchemeRegistry.cpp:
43         * platform/ios/QuickLook.h:
44         * platform/ios/QuickLook.mm:
45         (WebCore::isQuickLookPreviewURL):
46         (WebCore::QLPreviewProtocol): Deleted.
47         Hard-code the QuickLook preview URL scheme, instead of loading the QuickLook
48         framework to retrieve it. It will never change, and just in case it does,
49         add an ASSERT (which does load QuickLook) so that we'll find out.
50
51 2018-05-18  Antoine Quint  <graouts@apple.com>
52
53         [Web Animations] Turn Web Animations with CSS integration on for test runners
54         https://bugs.webkit.org/show_bug.cgi?id=184819
55         <rdar://problem/39597337>
56
57         Reviewed by Jon Lee.
58
59         We ensure we always call into both CSSAnimationController::cancelAnimations() and
60         AnimationTimeline::cancelDeclarativeAnimationsForElement() since we want teardown of animations
61         to be performed no matter which animation code path is used. What that in mind, we don't
62         conditionalize the CSSAnimationController-related ASSERT() in FrameView::didDestroyRenderTree().
63
64         * dom/Element.cpp:
65         (WebCore::Element::removedFromAncestor):
66         * dom/PseudoElement.cpp:
67         (WebCore::PseudoElement::clearHostElement):
68         * page/FrameView.cpp:
69         (WebCore::FrameView::didDestroyRenderTree):
70         * page/RuntimeEnabledFeatures.h:
71         * rendering/updating/RenderTreeUpdater.cpp:
72         (WebCore::RenderTreeUpdater::tearDownRenderers):
73
74 2018-05-17  David Kilzer  <ddkilzer@apple.com>
75
76         Lazily create WebCore::Timer for WebCore::Image
77         <https://webkit.org/b/185752>
78
79         Reviewed by Simon Fraser.
80
81         Not every image is an animated image, so lazily creating
82         m_animationStartTimer saves 64 bytes per instance of
83         WebCore::Image.
84
85         * platform/graphics/Image.cpp:
86         (WebCore::Image::Image): Remove default initializer for
87         m_animationStartTimer.
88         (WebCore::Image::startAnimationAsynchronously): Initialize
89         m_animationStartTimer if it's not already created.
90         * platform/graphics/Image.h:
91         (WebCore::Image::animationPending const): Update to check if
92         m_animationStartTimer has been set before dereferencing it.
93         (WebCore::Image::m_animationStartTimer): Change type to
94         std::unique_ptr<Timer>.
95
96 2018-05-17  Nan Wang  <n_wang@apple.com>
97
98         AX: [macOS] Expose the primary screen height through AX API
99         https://bugs.webkit.org/show_bug.cgi?id=185742
100
101         Reviewed by Chris Fleizach.
102
103         Added a new attribute to expose the primary screen size on both
104         WebAccessibilityObjectWrapper and WKAccessibilityWebPageObject.
105
106         Test: accessibility/mac/primary-screen-height.html
107
108         * WebCore.xcodeproj/project.pbxproj:
109         * accessibility/mac/WebAccessibilityObjectWrapperMac.h:
110         * accessibility/mac/WebAccessibilityObjectWrapperMac.mm:
111         (-[WebAccessibilityObjectWrapper accessibilityAttributeNames]):
112         (-[WebAccessibilityObjectWrapper primaryScreenHeight]):
113         (-[WebAccessibilityObjectWrapper accessibilityAttributeValue:]):
114         * platform/PlatformScreen.h:
115         * platform/mac/PlatformScreenMac.mm:
116         (WebCore::screenRectForPrimaryScreen):
117
118 2018-05-17  Chris Dumez  <cdumez@apple.com>
119
120         RenderLayer::scrollRectToVisible() should not propagate a subframe's scroll to its cross-origin parent
121         https://bugs.webkit.org/show_bug.cgi?id=185664
122         <rdar://problem/36185260>
123
124         Reviewed by Simon Fraser.
125
126         RenderLayer::scrollRectToVisible() should not propagate a subframe's scroll to its
127         cross-origin parent. There was logic in FrameLoader::scrollToFragmentWithParentBoundary()
128         to temporarily set the 'safeToPropagateScrollToParent' flag to false on the cross-origin
129         ancestor frame during the call to FrameView::scrollToFragment(). This would correctly
130         prevent RenderLayer::scrollRectToVisible() to propagate the scroll to the cross-origin
131         ancestor frame when scrollRectToVisible() is called synchronously. However,
132         scrollRectToVisible() can get called asynchronously in case of a dirty layout, as part
133         of the post layout tasks.
134
135         To address the issue, we get rid of the safeToPropagateScrollToParent flag on FrameView
136         and instead update FrameView::safeToPropagateScrollToParent() to do the cross-origin
137         check. FrameView::safeToPropagateScrollToParent() is called by RenderLayer::scrollRectToVisible()
138         and this is a lot more robust than relying on a flag which gets temporarily set.
139
140         Test: http/tests/navigation/fragment-navigation-cross-origin-subframe-no-scrolling-parent.html
141
142         * dom/Document.cpp:
143         * dom/Document.h:
144         * loader/FrameLoader.cpp:
145         (WebCore::FrameLoader::scrollToFragmentWithParentBoundary):
146         * page/FrameView.cpp:
147         (WebCore::FrameView::FrameView):
148         (WebCore::FrameView::reset):
149         (WebCore::FrameView::safeToPropagateScrollToParent const):
150         * page/FrameView.h:
151
152 2018-05-17  Don Olmstead  <don.olmstead@sony.com>
153
154         [Curl] Enable HTTP/2 Multiplexing
155         https://bugs.webkit.org/show_bug.cgi?id=185746
156
157         Reviewed by Youenn Fablet.
158
159         Covered by existing tests.
160
161         * platform/network/curl/CurlContext.cpp:
162         (WebCore::CurlMultiHandle::CurlMultiHandle):
163
164 2018-05-17  Jeremy Jones  <jeremyj@apple.com>
165
166         Remove unnecessary exit fullscreen call on application resume
167         https://bugs.webkit.org/show_bug.cgi?id=185747
168         rdar://problem/40345725
169
170         Reviewed by Jer Noble.
171
172         No new tests because no behavior change.
173
174         Auto-PiP doesn't automatically return to fullscreen on app resume,
175         so we don't need to keep this vestigial code for handling a corner case of that feature.
176         Also, this can cause an unnecessary exit fullscreen that could cause debug asserts.
177
178         * platform/ios/VideoFullscreenInterfaceAVKit.mm:
179         (VideoFullscreenInterfaceAVKit::applicationDidBecomeActive):
180
181 2018-05-17  Jeremy Jones  <jeremyj@apple.com>
182
183         Fullscreen to PiP results in exit fullscreen call failure
184         https://bugs.webkit.org/show_bug.cgi?id=185699
185         rdar://problem/40310291
186
187         Reviewed by Eric Carlson.
188
189         No new tests because no behavior change.
190
191         Prevent multiple exit fullscreen calls when transitioning from fullscreen to picture-in-picture.
192
193         * platform/ios/VideoFullscreenInterfaceAVKit.mm:
194         (-[WebAVPlayerViewControllerDelegate playerViewControllerShouldAutomaticallyDismissAtPictureInPictureStart:]):
195         Implement this to prevent AVKit from automatically initiating exit fullscreen on pip.
196         
197         (VideoFullscreenInterfaceAVKit::didStartPictureInPicture):
198         Set the return to fullscreen flag here, since this is where exit fullscreen happens.
199
200         (VideoFullscreenInterfaceAVKit::shouldExitFullscreenWithReason):
201         Don't exit fullscreen here since it is already initiated in didStartPictureInPicture.
202
203 2018-05-17  Ryan Haddad  <ryanhaddad@apple.com>
204
205         Unreviewed, rolling out r231899.
206
207         Caused flakiness in two existing modern-media-controls tests.
208
209         Reverted changeset:
210
211         "[modern-media-controls] AirPlaySupport should be disabled by
212         default"
213         https://bugs.webkit.org/show_bug.cgi?id=185658
214         https://trac.webkit.org/changeset/231899
215
216 2018-05-17  Eric Carlson  <eric.carlson@apple.com>
217
218         [iOS] Update AirPlay route monitoring
219         https://bugs.webkit.org/show_bug.cgi?id=185706
220         <rdar://problem/40230677>
221
222         Unreviewed, fix extra zoom mode build after r231913.
223
224         * platform/audio/ios/MediaSessionManagerIOS.mm:
225         (-[WebMediaSessionHelper dealloc]):
226         (-[WebMediaSessionHelper hasWirelessTargetsAvailable]):
227
228 2018-05-17  Jer Noble  <jer.noble@apple.com>
229
230         CRASH in ImageDecoderAVFObjC::sampleAtIndex()
231         https://bugs.webkit.org/show_bug.cgi?id=185734
232         <rdar://problem/40295094>
233
234         Reviewed by Eric Carlson.
235
236         Test: fast/images/animated-image-mp4-crash.html
237
238         Test the correct size value before iterating over the SampleMap in presentationOrder()
239
240         * Modules/mediasource/SampleMap.h:
241         (WebCore::PresentationOrderSampleMap::size const):
242         * platform/graphics/avfoundation/objc/ImageDecoderAVFObjC.mm:
243         (WebCore::ImageDecoderAVFObjC::sampleAtIndex const):
244
245 2018-05-17  Wenson Hsieh  <wenson_hsieh@apple.com>
246
247         [Extra zoom mode] Disabled adaptations are not reset upon mainframe navigation
248         https://bugs.webkit.org/show_bug.cgi?id=185735
249         <rdar://problem/40335311>
250
251         Reviewed by Tim Horton.
252
253         When performing mainframe navigation, we currently don't update the Page's ViewportConfiguration's disabled
254         adaptations. This causes disabled adaptations from the previous main document to persist. To fix this, propagate
255         the new document's disabled adaptations to the client when it becomes the main document in the page.
256
257         Test: fast/viewport/extrazoom/viewport-adaptations-after-navigation.html
258
259         * dom/Document.cpp:
260         (WebCore::Document::didBecomeCurrentDocumentInFrame):
261         (WebCore::Document::processDisabledAdaptations):
262         (WebCore::Document::dispatchDisabledAdaptationsDidChangeForMainFrame):
263         * dom/Document.h:
264
265 2018-05-17  Eric Carlson  <eric.carlson@apple.com>
266
267         [iOS] Update AirPlay route monitoring
268         https://bugs.webkit.org/show_bug.cgi?id=185706
269         <rdar://problem/40230677>
270
271         Reviewed by Jer Noble.
272
273         Use an AVRouteDetector instead of an MPVolumeView and an MPAVRoutingController for AirPlay
274         route detection and availability monitoring.
275
276         No new tests, tested manually.
277
278         * html/MediaElementSession.cpp:
279         (WebCore::MediaElementSession::hasWirelessPlaybackTargets): No need to update m_hasPlaybackTargets
280         manually, it is always updated by the session manager when route availability changes.
281
282         * platform/audio/ios/MediaSessionManagerIOS.mm:
283         (-[WebMediaSessionHelper dealloc]): Pull the logic from safelyTearDown inline.
284         (-[WebMediaSessionHelper hasWirelessTargetsAvailable]): Use the AVRouteDetector.
285         (-[WebMediaSessionHelper startMonitoringAirPlayRoutes]): Ditto.  Simplify logic, there is no
286         need to dispatch twice.
287         (-[WebMediaSessionHelper stopMonitoringAirPlayRoutes]): Don't release the route detector
288         completely, just disable route detection, because AVRouteDetector is a lightweight object so
289         it is not worth the overhead of dealloc/realloc to disable/enable route detection.
290         (-[WebMediaSessionHelper interruption:]): Use callOnWebThreadOrDispatchAsyncOnMainThread
291         instead of WebThreadRun so it works correctly in WK2 as well as in WK1.
292         (-[WebMediaSessionHelper applicationWillEnterForeground:]): Ditto.
293         (-[WebMediaSessionHelper applicationDidBecomeActive:]): Ditto.
294         (-[WebMediaSessionHelper applicationWillResignActive:]): Ditto.
295         (-[WebMediaSessionHelper wirelessRoutesAvailableDidChange:]): Ditto.
296         (-[WebMediaSessionHelper applicationDidEnterBackground:]): Ditto.
297         (safelyTearDown): Deleted.
298
299 2018-05-17  Chris Dumez  <cdumez@apple.com>
300
301         Cross-Origin-Options: deny/allow-postmessage should prevent getting navigated by cross-origin scripts
302         https://bugs.webkit.org/show_bug.cgi?id=185681
303         <rdar://problem/40296313>
304
305         Reviewed by Geoffrey Garen.
306
307         Update our canNavigate() implementation [1] to take into account the Cross-Origin-Options header.
308         If the window being navigated or the window trigerring the navigation have a Cross-Origin-Options
309         header value different than 'allow', then the attempt to navigate will be blocked.
310
311         Note that it was already not possible to navigate via setting window.location since trying to set
312         it would throw a SecurityError with 'Cross-Origin-Options: deny/allow-postmessage'. However, it was
313         possible to trigger a "targeted" navigation via <a target="foo"> or open(url, "foo").
314
315         [1] https://html.spec.whatwg.org/#allowed-to-navigate
316
317         Tests: http/wpt/cross-origin-options/navigation-from-opener-via-open-target.html
318                http/wpt/cross-origin-options/navigation-from-subframe-via-anchor-target.html
319
320         * dom/Document.cpp:
321         (WebCore::Document::canNavigate):
322
323 2018-05-17  Brent Fulgham  <bfulgham@apple.com>
324
325         Storage Access API: Allow documents that have been granted storage access to also do a popup
326         https://bugs.webkit.org/show_bug.cgi?id=185615
327         <rdar://problem/39105791>
328
329         Reviewed by Chris Dumez.
330
331         * dom/Document.cpp:
332         (WebCore::Document::consumeTemporaryUserGesture): Added. Clear the document's active one-time user
333         activity (for window opening) state.
334         (WebCore::Document::enableTemporaryUserGesture): Added. Establish a new active one-time user
335         activity (for window opening) state.
336         (WebCore::Document::requestStorageAccess): If the user approves Storage Access, establish a new
337         UserInteraction scope, then resolve the promise. Also post a task to clear the one-time user
338         gesture state.
339
340 2018-05-17  Zalan Bujtas  <zalan@apple.com>
341
342         [LFC] Introduce DisplayBox::Style
343         https://bugs.webkit.org/show_bug.cgi?id=185733
344
345         Reviewed by Antti Koivisto.
346
347         This is the collection of computed style data needed to paint/hittest the display boxtree.
348
349         * layout/LayoutContext.cpp:
350         (WebCore::Layout::LayoutContext::createDisplayBox):
351         * layout/displaytree/DisplayBox.cpp:
352         (WebCore::Display::Box::Box):
353         (WebCore::Display::Box::Style::Style):
354         (WebCore::Display::Box::borderBox const):
355         (WebCore::Display::Box::contentBox const):
356         * layout/displaytree/DisplayBox.h:
357
358 2018-05-17  Antoine Quint  <graouts@apple.com>
359
360         [modern-media-controls] AirPlaySupport should be disabled by default
361         https://bugs.webkit.org/show_bug.cgi?id=185658
362         <rdar://problem/40272213>
363
364         Reviewed by Simon Fraser.
365
366         We now only enable AirplaySupport if the controls are visible to the user _and_ media has played.
367
368         Test: media/modern-media-controls/airplay-support/airplay-support-disable-event-listeners-until-play.html
369
370         * Modules/modern-media-controls/media/airplay-support.js:
371         (AirplaySupport.prototype.enable):
372         (AirplaySupport.prototype.controlsUserVisibilityDidChange):
373         (AirplaySupport.prototype._shouldBeEnabled):
374         (AirplaySupport):
375
376 2018-05-17  Zalan Bujtas  <zalan@apple.com>
377
378         [LFC] Replace ASSERT_NOT_REACHED with ASSERT_NOT_IMPLEMENTED_YET where applicable.
379         https://bugs.webkit.org/show_bug.cgi?id=185728
380
381         Reviewed by Antti Koivisto.
382
383         * layout/FormattingContext.cpp:
384         (WebCore::Layout::FormattingContext::computeOutOfFlowWidth const): leftover from previous patch.
385         (WebCore::Layout::FormattingContext::computeFloatingWidth const):
386         (WebCore::Layout::FormattingContext::computeOutOfFlowHeight const):
387         (WebCore::Layout::FormattingContext::computeOutOfFlowNonReplacedHeight const):
388         (WebCore::Layout::FormattingContext::computeReplacedWidth const):
389         (WebCore::Layout::FormattingContext::computeOutOfFlowNonReplacedWidth const):
390         (WebCore::Layout::FormattingContext::computeOutOfFlowReplacedWidth const):
391         * layout/LayoutContext.cpp:
392         (WebCore::Layout::LayoutContext::styleChanged):
393         (WebCore::Layout::LayoutContext::formattingContext):
394         * layout/blockformatting/BlockFormattingContext.cpp:
395         (WebCore::Layout::BlockFormattingContext::computeInFlowNonReplacedWidth const):
396         (WebCore::Layout::BlockFormattingContext::computeInFlowHeight const):
397         (WebCore::Layout::BlockFormattingContext::computeInFlowNonReplacedHeight const):
398         * layout/layouttree/LayoutTreeBuilder.cpp:
399         (WebCore::Layout::TreeBuilder::createSubTree):
400
401 2018-05-17  Zalan Bujtas  <zalan@apple.com>
402
403         [LFC] Move replaced logic from Layout::Box to Layout::Replaced class
404         https://bugs.webkit.org/show_bug.cgi?id=185711
405
406         Reviewed by Antti Koivisto.
407
408         * Sources.txt:
409         * WebCore.xcodeproj/project.pbxproj:
410         * layout/FormattingContext.cpp:
411         (WebCore::Layout::FormattingContext::computeOutOfFlowWidth const):
412         (WebCore::Layout::FormattingContext::computeFloatingWidth const):
413         (WebCore::Layout::FormattingContext::computeOutOfFlowHeight const):
414         (WebCore::Layout::FormattingContext::computeInFlowReplacedWidth const):
415         * layout/blockformatting/BlockFormattingContext.cpp:
416         (WebCore::Layout::BlockFormattingContext::computeInFlowWidth const):
417         (WebCore::Layout::BlockFormattingContext::computeInFlowHeight const):
418         * layout/layouttree/LayoutBox.cpp:
419         (WebCore::Layout::Box::isReplaced const): Deleted.
420         (WebCore::Layout::Box::hasIntrinsicWidth const): Deleted.
421         (WebCore::Layout::Box::hasIntrinsicHeight const): Deleted.
422         (WebCore::Layout::Box::hasIntrinsicRatio const): Deleted.
423         (WebCore::Layout::Box::intrinsicWidth const): Deleted.
424         (WebCore::Layout::Box::intrinsicHeight const): Deleted.
425         (WebCore::Layout::Box::intrinsicRatio const): Deleted.
426         * layout/layouttree/LayoutBox.h:
427         (WebCore::Layout::Box::replaced const):
428
429 2018-05-17  Zalan Bujtas  <zalan@apple.com>
430
431         [LFC] Implement width computation for replaced out if flow elements.
432         https://bugs.webkit.org/show_bug.cgi?id=185701
433
434         Reviewed by Antti Koivisto.
435         
436         The used value of 'width' is determined as for inline replaced elements.
437
438         * layout/FormattingContext.cpp:
439         (WebCore::Layout::FormattingContext::computeOutOfFlowNonReplacedHeight const):
440         (WebCore::Layout::FormattingContext::computeOutOfFlowNonReplacedWidth const):
441         (WebCore::Layout::FormattingContext::computeOutOfFlowReplacedWidth const):
442         * layout/FormattingContext.h:
443
444 2018-05-17  Thibault Saunier  <tsaunier@igalia.com>
445
446         [GStreamer]: Consider GstStream(Collection) as if if was not a GInitiallyUnowned
447         https://bugs.webkit.org/show_bug.cgi?id=185657
448
449         Reviewed by Philippe Normand.
450
451         Starting with GStreamer 1.14[1] the reference is sunk at object creation time, making it a normal
452         GObject in practice, in our GRefPtr template implementation we should just consider GstStream
453         as if it was a normal GObject and not care about its floating reference state as
454         the ref is never sunk by anyone before 1.14 though that floating ref is considered
455         as a hard reference by the GstStreamCollection (leading to assertions/)
456
457         The exact same issue happens with GstStreamCollection, so fix it at the same time.
458
459         Also do not adoptRef() on the result of gst_stream_collection_get_stream() as this function
460         is transfer-none.
461
462         [1] commit f119e93b47efb06ffc68c01d3e094d5346c30041 `gst: Clear floating flag in constructor of all GstObject subclasses that are not owned by any parent`
463
464         * platform/graphics/gstreamer/GRefPtrGStreamer.cpp:
465         (WTF::adoptGRef):
466         (WTF::refGPtr<GstStream>):
467         (WTF::refGPtr<GstStreamCollection>):
468         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:
469         (WebCore::MediaPlayerPrivateGStreamer::handleMessage):
470
471 2018-05-16  Devin Rousso  <webkit@devinrousso.com>
472
473         Web Inspector: create a navigation item for toggling the overlay rulers/guides
474         https://bugs.webkit.org/show_bug.cgi?id=185644
475
476         Reviewed by Matt Baker.
477
478         This patch is purely a visual change for WebInspector, and doesn't affect anything else.
479
480         * inspector/agents/InspectorPageAgent.h:
481         * inspector/agents/InspectorPageAgent.cpp:
482         (WebCore::InspectorPageAgent::setShowRulers): Added.
483
484         * inspector/InspectorOverlay.h:
485         * inspector/InspectorOverlay.cpp:
486         (WebCore::InspectorOverlay::shouldShowOverlay):
487         (WebCore::InspectorOverlay::update):
488         (WebCore::InspectorOverlay::setShowRulers): Added.
489         (WebCore::InspectorOverlay::drawRulers): Added.
490         (WebCore::InspectorOverlay::reset):
491
492         * inspector/InspectorOverlayPage.js:
493         (drawNodeHighlight):
494         (drawQuadHighlight):
495         (drawRulers): Added.
496         (_drawBounds): Added.
497         (reset):
498         (_drawRulers): Deleted.
499
500 2018-05-16  Michael Catanzaro  <mcatanzaro@igalia.com>
501
502         [GTK] SoupNetworkSession.h:68:62: error: unknown type name 'URL'
503         https://bugs.webkit.org/show_bug.cgi?id=185378
504
505         Unreviewed, just replace unneeded #include with a forward declaration
506
507         * platform/network/soup/SoupNetworkSession.h:
508
509 2018-05-16  Jer Noble  <jer.noble@apple.com>
510
511         CRASH: Exception thrown from -[AVContentKeySession processContentKeyRequestWithIdentifier:initializationData:options:] after -expire called
512         https://bugs.webkit.org/show_bug.cgi?id=185690
513         <rdar://problem/38297768>
514
515         Reviewed by Eric Carlson.
516
517         Reject all calls to update() after close() has been called on the session.
518
519         * platform/graphics/avfoundation/objc/CDMSessionAVContentKeySession.mm:
520         (WebCore::CDMSessionAVContentKeySession::update):
521
522 2018-05-16  Andy VanWagoner  <andy@vanwagoner.family>
523
524         Add support for Intl NumberFormat formatToParts
525         https://bugs.webkit.org/show_bug.cgi?id=185375
526
527         Reviewed by Yusuke Suzuki.
528
529         Test: js/intl-numberformat-format-to-parts.html
530
531         Add flag & tests for NumberFormat formatToParts.
532
533         * Configurations/FeatureDefines.xcconfig:
534
535 2018-05-16  Eric Carlson  <eric.carlson@apple.com>
536
537         Improve NowPlaying "title"
538         https://bugs.webkit.org/show_bug.cgi?id=185680
539         <rdar://problem/40296700>
540
541         Reviewed by Jer Noble.
542         
543         We send NowPlaying the element's title attribute if not empty, else the element's current url.
544         Title should be preferred because it is the most specific, but we should use the document
545         title if non-empty next, and if falling back to the element's url use just the domain instead
546         of the full url because it isn't likely to be useful to the user given the small amount of
547         space control center uses to display the title. Further, don't use any title at all when
548         in private browsing mode.
549
550         Tests: http/tests/media/now-playing-info-private-browsing.html
551                http/tests/media/now-playing-info.html
552
553         * html/HTMLMediaElement.cpp:
554         (WebCore::HTMLMediaElement::parseAttribute): Update NowPlaying when the title attribute changes.
555         (WebCore::HTMLMediaElement::finishSeek): Update NowPlaying when a seek completes.
556         (WebCore::HTMLMediaElement::mediaSessionTitle const): Update logic.
557         (WebCore::HTMLMediaElement::mediaSessionUniqueIdentifier const): Use the hash of the current 
558         url as the unique identifier.
559         * html/HTMLMediaElement.h:
560
561         * platform/audio/PlatformMediaSession.cpp:
562         (WebCore::PlatformMediaSession::uniqueIdentifier const): New.
563         (WebCore::PlatformMediaSessionClient::mediaSessionUniqueIdentifier const): Ditto.
564         * platform/audio/PlatformMediaSession.h:
565
566         * platform/audio/ios/MediaSessionManagerIOS.mm:
567         (WebCore::MediaSessionManageriOS::updateNowPlayingInfo): Update m_lastUpdatedNowPlayingInfoUniqueIdentifier.
568
569         * platform/audio/mac/MediaSessionManagerMac.mm:
570         (WebCore::MediaSessionManagerMac::updateNowPlayingInfo): Update.
571
572         * testing/Internals.cpp:
573         (WebCore::Internals::nowPlayingState const): Expose NowPlaying state.
574         * testing/Internals.h:
575         * testing/Internals.idl:
576
577 2018-05-16  Daniel Bates  <dabates@apple.com>
578
579         Attempt to fix the WinCairo build following r231859
580         (https://bugs.webkit.org/show_bug.cgi?id=185654)
581
582         Instantiate Cookie as a struct and set applicable fields.
583
584         * platform/network/curl/CookieJarDB.cpp:
585         (WebCore::CookieJarDB::searchCookies):
586
587 2018-05-16  Daniel Bates  <dabates@apple.com>
588
589         Cleanup platform Cookie
590         https://bugs.webkit.org/show_bug.cgi?id=185654
591
592         Reviewed by Per Arne Vollan.
593
594         Remove unnecessary constructor and use =default for default constructor.
595         Simplify Cookie::decode() by having it decode directly into a stack-allocated
596         cookie. Remove some unnecessary local variables. Fix style nits.
597
598         * platform/Cookie.h:
599         (WebCore::Cookie::Cookie):
600         (WebCore::Cookie::isNull const):
601         (WebCore::Cookie::encode const):
602         (WebCore::Cookie::decode):
603         * platform/network/cf/CookieJarCFNet.cpp:
604         (WebCore::getRawCookies):
605         * platform/network/cocoa/CookieCocoa.mm:
606         (WebCore::cookieCreated):
607         (WebCore::Cookie::Cookie):
608         (WebCore::Cookie::operator== const):
609         (WebCore::Cookie::hash const):
610         * platform/network/soup/CookieJarSoup.cpp:
611         (WebCore::getRawCookies):
612
613 2018-05-14  Yusuke Suzuki  <utatane.tea@gmail.com>
614
615         [Win] Use C++17 in MSVC
616         https://bugs.webkit.org/show_bug.cgi?id=185232
617
618         Reviewed by Alex Christensen.
619
620         Workaround for MSVC + /std:c++17.
621
622         * Modules/geolocation/Coordinates.h:
623         (WebCore::Coordinates::isolatedCopy const):
624
625 2018-05-16  Chris Nardi  <cnardi@chromium.org>
626
627         Remove Document#selectedStylesheetSet/preferredStylesheetSet
628         https://bugs.webkit.org/show_bug.cgi?id=185381
629
630         Reviewed by Darin Adler.
631
632         Document#selectedStylesheetSet/preferredStylesheetSet are non-standard methods that
633         are only implemented WebKit. Blink removed these methods in https://crbug.com/690609.
634         The standard versions of these methods are are no longer in the spec. Remove them
635         entirely from our implementation.
636
637         Updated existing tests and imported/w3c/web-platform-tests/cssom/historical.html.
638
639         * dom/Document.cpp:
640         (WebCore::Document::processHttpEquiv):
641         * dom/Document.h:
642         * dom/Document.idl:
643         * style/StyleScope.cpp:
644         (WebCore::Style::Scope::collectActiveStyleSheets):
645         * style/StyleScope.h:
646         (WebCore::Style::Scope::preferredStylesheetSetName const):
647
648 2018-05-16  Zalan Bujtas  <zalan@apple.com>
649
650         [LFC] Implement width computation for replaced inflow elements.
651         https://bugs.webkit.org/show_bug.cgi?id=185672
652
653         Reviewed by Antti Koivisto.
654
655         Replaced width for block, inline and float elements compute the same way. 
656
657         * layout/FormattingContext.cpp:
658         (WebCore::Layout::FormattingContext::computeWidth const):
659         (WebCore::Layout::FormattingContext::computeFloatingWidth const):
660         (WebCore::Layout::FormattingContext::computeInFlowReplacedWidth const):
661         * layout/FormattingContext.h:
662         * layout/blockformatting/BlockFormattingContext.cpp:
663         (WebCore::Layout::BlockFormattingContext::computeInFlowWidth const):
664         * layout/layouttree/LayoutBox.cpp:
665         (WebCore::Layout::Box::hasIntrinsicWidth const):
666         (WebCore::Layout::Box::hasIntrinsicHeight const):
667         (WebCore::Layout::Box::hasIntrinsicRatio const):
668         (WebCore::Layout::Box::intrinsicWidth const):
669         (WebCore::Layout::Box::intrinsicHeight const):
670         (WebCore::Layout::Box::intrinsicRatio const):
671         * layout/layouttree/LayoutBox.h:
672
673 2018-05-16  Zalan Bujtas  <zalan@apple.com>
674
675         [LFC] Make Display::Box box sizing aware
676         https://bugs.webkit.org/show_bug.cgi?id=185649
677
678         Reviewed by Antti Koivisto.
679
680         Display::Box::width() == Display::Box::contentBox().width() <= box-sizing: content-box; (initial and default value)
681         Display::Box::width() == Display::Box::borderBox().width() <= box-sizing: border-box;
682
683         * layout/LayoutContext.cpp:
684         (WebCore::Layout::LayoutContext::createDisplayBox):
685         * layout/displaytree/DisplayBox.cpp:
686         (WebCore::Display::Box::Box):
687         (WebCore::Display::Box::marginBox const):
688         (WebCore::Display::Box::borderBox const):
689         (WebCore::Display::Box::paddingBox const):
690         (WebCore::Display::Box::contentBox const):
691         * layout/displaytree/DisplayBox.h:
692
693 2018-05-16  Antoine Quint  <graouts@apple.com>
694
695         REGRESSION (r230574): Interrupted hardware transitions don't behave correctly
696         https://bugs.webkit.org/show_bug.cgi?id=185299
697         <rdar://problem/39630230>
698
699         Reviewed by Simon Fraser.
700
701         In r230574, the fix for webkit.org/b/184518, we changed the processing order in GraphicsLayerCA::updateAnimations() to first
702         process m_uncomittedAnimations and then m_animationsToProcess, so we are guaranteed animations exist before we attempt to pause
703         or seek them. This broke interrupting and resuming hardware animations (such as an interrupted CSS Transition or an animation
704         running in a non-visible tab) since a pause operation recorded _before_ an animation was added would be paused anyway since
705         the animation was now first added, and then paused. The fix is simply to clear any pending AnimationProcessingAction for a
706         newly-uncommitted animation.
707
708         Test: transitions/interrupted-transition-hardware.html
709
710         * platform/graphics/ca/GraphicsLayerCA.cpp:
711         (WebCore::GraphicsLayerCA::createAnimationFromKeyframes):
712         (WebCore::GraphicsLayerCA::appendToUncommittedAnimations):
713         (WebCore::GraphicsLayerCA::createTransformAnimationsFromKeyframes):
714         * platform/graphics/ca/GraphicsLayerCA.h:
715         (WebCore::GraphicsLayerCA::LayerPropertyAnimation::LayerPropertyAnimation):
716
717 2018-05-15  Yusuke Suzuki  <utatane.tea@gmail.com>
718
719         [JSC] Check TypeInfo first before calling getCallData when we would like to check whether given object is a function
720         https://bugs.webkit.org/show_bug.cgi?id=185601
721
722         Reviewed by Saam Barati.
723
724         No behavior change.
725
726         * Modules/plugins/QuickTimePluginReplacement.mm:
727         (WebCore::QuickTimePluginReplacement::ensureReplacementScriptInjected):
728         * bindings/js/JSCustomElementRegistryCustom.cpp:
729         (WebCore::getCustomElementCallback):
730         * bindings/js/JSDOMConstructorBase.h:
731         * bindings/js/JSDOMConvertCallbacks.h:
732         (WebCore::Converter<IDLCallbackFunction<T>>::convert):
733         * bindings/js/JSDOMPromise.cpp:
734         (WebCore::DOMPromise::whenSettled):
735         * bindings/js/ReadableStream.cpp:
736         (WebCore::ReadableStream::pipeTo):
737         (WebCore::ReadableStream::tee):
738         * bindings/js/ReadableStreamDefaultController.cpp:
739         (WebCore::ReadableStreamDefaultController::invoke):
740         * bindings/scripts/CodeGeneratorJS.pm:
741         (GenerateHeader):
742         (GenerateOverloadDispatcher):
743         * bindings/scripts/test/JS/JSTestObj.h:
744         * bindings/scripts/test/JS/JSTestPluginInterface.h:
745         * bridge/objc/objc_runtime.h:
746         * bridge/runtime_method.h:
747         * bridge/runtime_object.h:
748         * html/HTMLMediaElement.cpp:
749         (WebCore::HTMLMediaElement::ensureMediaControlsInjectedScript):
750         * testing/Internals.cpp:
751         (WebCore::Internals::parserMetaData):
752         (WebCore::Internals::cloneArrayBuffer):
753
754 2018-05-15  Matt Baker  <mattbaker@apple.com>
755
756         Web Inspector: element details hanger in inspector overlay should have better placement logic
757         https://bugs.webkit.org/show_bug.cgi?id=128482
758         <rdar://problem/16020709>
759
760         Reviewed by Timothy Hatcher.
761
762         When determining the best position for the hovered element details "tooltip",
763         perform placement tests in view space, not canvas space, and account for the
764         top content inset.
765
766         * inspector/InspectorOverlayPage.js:
767         (reset): Drive by fix: added missing `.height`.
768         (_drawElementTitle):
769
770 2018-05-15  Commit Queue  <commit-queue@webkit.org>
771
772         Unreviewed, rolling out r231765.
773         https://bugs.webkit.org/show_bug.cgi?id=185668
774
775         the layout test added with this change is very flaky
776         (Requested by realdawei on #webkit).
777
778         Reverted changeset:
779
780         "REGRESSION (r230574): Interrupted hardware transitions don't
781         behave correctly"
782         https://bugs.webkit.org/show_bug.cgi?id=185299
783         https://trac.webkit.org/changeset/231765
784
785 2018-05-15  Devin Rousso  <webkit@devinrousso.com>
786
787         Web Inspector: Add rulers and guides
788         https://bugs.webkit.org/show_bug.cgi?id=32263
789         <rdar://problem/19281564>
790
791         Reviewed by Matt Baker.
792
793         This patch is purely a visual change for WebInspector, and doesn't affect anything else.
794
795         * inspector/InspectorOverlay.h:
796         * inspector/InspectorOverlay.cpp:
797         (WebCore::InspectorOverlay::update):
798         (WebCore::InspectorOverlay::reset):
799         (WebCore::InspectorOverlay::drawGutter): Deleted.
800
801         * inspector/InspectorOverlayPage.html:
802         * inspector/InspectorOverlayPage.js:
803         (Bounds): Added.
804         (Bounds.prototype.get minX): Added.
805         (Bounds.prototype.get minY): Added.
806         (Bounds.prototype.get maxX): Added.
807         (Bounds.prototype.get maxY): Added.
808         (Bounds.prototype.update): Added.
809         (drawNodeHighlight):
810         (drawQuadHighlight):
811         (reset):
812         (_isolateActions): Added.
813         (_quadToPath): Added.
814         (_quadToPath.parseQuadPoint): Added.
815         (_drawOutlinedQuad): Added.
816         (_drawPath): Added.
817         (_drawPath.parsePoints): Added.
818         (_drawOutlinedQuadWithClip): Added.
819         (_drawElementTitle):
820         (_drawShapeHighlight):
821         (_drawFragmentHighlight):
822         (_drawRulers): Added.
823         (quadToPath): Deleted.
824         (drawOutlinedQuad): Deleted.
825         (pathCommand): Deleted.
826         (drawPath): Deleted.
827         (drawOutlinedQuadWithClip): Deleted.
828         (drawGutter): Deleted.
829         * inspector/InspectorOverlayPage.css:
830         (#log): Added.
831         (#right-gutter): Deleted.
832         (#bottom-gutter): Deleted.
833
834 2018-05-15  Jer Noble  <jer.noble@apple.com>
835
836         Media continues loading after rendered invisible (removed from DOM; scrolled off screen)
837         https://bugs.webkit.org/show_bug.cgi?id=185487
838
839         Reviewed by Eric Carlson.
840
841         Test: media/video-buffering-allowed.html
842
843         When a media element is removed from the dom (e.g. through innerHTML=""), it doesn't
844         necessarily stop loading media data; it will continue to do so until its destructor is
845         called through garbage collection. Similarly, when a media element is rendered not-visible
846         by being scrolled off-screen or being made display:none, media loading continues. There
847         are legitimate use cases for out-of-DOM media loading, so only temporarily block loading
848         when the element transitions out of the document. Similarly, only block loading for non-visible
849         media elements when returning from the "page is hidden" state, and only until the media
850         element is asked to play or is otherwise made visible.
851
852         Note: this refactors a lot of code out of PlatformMediaSession and into MediaElementSession,
853         since this code is specific to "media elements".
854
855         * html/HTMLMediaElement.cpp:
856         (WebCore::HTMLMediaElement::HTMLMediaElement):
857         (WebCore::HTMLMediaElement::insertedIntoAncestor):
858         (WebCore::HTMLMediaElement::removedFromAncestor):
859         (WebCore::HTMLMediaElement::playInternal):
860         (WebCore::HTMLMediaElement::stopWithoutDestroyingMediaPlayer):
861         (WebCore::HTMLMediaElement::resume):
862         (WebCore::HTMLMediaElement::visibilityStateChanged):
863         (WebCore::HTMLMediaElement::createMediaPlayer):
864         (WebCore::HTMLMediaElement::setShouldBufferData):
865         (WebCore::HTMLMediaElement::purgeBufferedDataIfPossible):
866         (WebCore::HTMLMediaElement::isVisibleInViewportChanged):
867         (WebCore::HTMLMediaElement::fullscreenModeChanged):
868         (WebCore::HTMLMediaElement::setInActiveDocument):
869         * html/HTMLMediaElement.h:
870         (WebCore::HTMLMediaElement::shouldBufferData const):
871         (WebCore::HTMLMediaElement::elementIsHidden const):
872         * html/MediaElementSession.cpp:
873         (WebCore::MediaElementSession::MediaElementSession):
874         (WebCore::MediaElementSession::clientWillBeginAutoplaying):
875         (WebCore::MediaElementSession::clientWillBeginPlayback):
876         (WebCore::MediaElementSession::clientWillPausePlayback):
877         (WebCore::MediaElementSession::visibilityChanged):
878         (WebCore::MediaElementSession::isVisibleInViewportChanged):
879         (WebCore::MediaElementSession::inActiveDocumentChanged):
880         (WebCore::MediaElementSession::scheduleClientDataBufferingCheck):
881         (WebCore::MediaElementSession::clientDataBufferingTimerFired):
882         (WebCore::MediaElementSession::updateClientDataBuffering):
883         (WebCore::MediaElementSession::dataBufferingPermitted const):
884         (WebCore::MediaElementSession::wantsToObserveViewportVisibilityForAutoplay const):
885         * html/MediaElementSession.h:
886         * platform/audio/PlatformMediaSession.cpp:
887         (WebCore::PlatformMediaSession::PlatformMediaSession):
888         (WebCore::PlatformMediaSession::clientWillBeginAutoplaying):
889         (WebCore::PlatformMediaSession::clientWillBeginPlayback):
890         (WebCore::PlatformMediaSession::clientWillPausePlayback):
891         (): Deleted.
892         (WebCore::PlatformMediaSession::visibilityChanged): Deleted.
893         (WebCore::PlatformMediaSession::scheduleClientDataBufferingCheck): Deleted.
894         (WebCore::PlatformMediaSession::clientDataBufferingTimerFired): Deleted.
895         (WebCore::PlatformMediaSession::updateClientDataBuffering): Deleted.
896         (WebCore::PlatformMediaSession::isHidden const): Deleted.
897         * platform/audio/PlatformMediaSession.h:
898         (WebCore::PlatformMediaSessionClient::setShouldBufferData): Deleted.
899         (WebCore::PlatformMediaSessionClient::elementIsHidden const): Deleted.
900         * platform/audio/PlatformMediaSessionManager.cpp:
901         (WebCore::PlatformMediaSessionManager::sessionCanLoadMedia const): Deleted.
902         * platform/audio/PlatformMediaSessionManager.h:
903         * platform/audio/ios/MediaSessionManagerIOS.h:
904         * platform/audio/ios/MediaSessionManagerIOS.mm:
905         (WebCore::MediaSessionManageriOS::sessionCanLoadMedia const): Deleted.
906         * rendering/RenderVideo.cpp:
907         (WebCore::RenderVideo::willBeDestroyed):
908         * testing/Internals.cpp:
909         (WebCore::Internals::elementShouldBufferData):
910         * testing/Internals.h:
911         * testing/Internals.idl:
912
913 2018-05-15  Charles Vazac  <cvazac@gmail.com>
914
915         Add the PerformanceServerTiming Interface which makes Server-Timing header timing values available to JavaScript running in the browser.
916         https://bugs.webkit.org/show_bug.cgi?id=175569
917
918         Reviewed by Youenn Fablet.
919
920         Tests were imported from web-platform-tests: WebKit/LayoutTests/imported/w3c/web-platform-tests/server-timing/*
921
922         * Sources.txt: Added references to HeaderFieldTokenizer.cpp, ServerTiming.cpp, and ServerTimingParser.cpp.
923         * WebCore.xcodeproj/project.pbxproj: Added various files.
924         * loader/HeaderFieldTokenizer.cpp: Added.
925         (WebCore::HeaderFieldTokenizer::HeaderFieldTokenizer): Added class for tokenizing header values.
926         (WebCore::HeaderFieldTokenizer::consume): Added method to consume a specified character.
927         (WebCore::HeaderFieldTokenizer::consumeQuotedString): Added method to consume a quote-string.
928         (WebCore::HeaderFieldTokenizer::consumeToken): Added a method to consume a token.
929         (WebCore::HeaderFieldTokenizer::consumeTokenOrQuotedString): Added method to consume a quote-string or quote-string, depending on net character.
930         (WebCore::HeaderFieldTokenizer::skipSpaces): Added method to skip whitespace.
931         (WebCore::HeaderFieldTokenizer::consumeBeforeAnyCharMatch): Added method to advance the cursor up until any of a list of characters.
932         * loader/HeaderFieldTokenizer.h: Added.
933         * loader/HTTPHeaderField.cpp: Expose isTokenCharacter and isWhitespace.
934         * loader/HTTPHeaderField.h: Expose isTokenCharacter and isWhitespace.
935         * loader/PolicyChecker.cpp: Added #include so source compiled on my machine.
936         * loader/ResourceTiming.cpp:
937         (WebCore::ResourceTiming::ResourceTiming): Added call to initServerTiming to parse the header.
938         (WebCore::ResourceTiming::initServerTiming): Added method to parse the header.
939         (WebCore::ResourceTiming::populateServerTiming): Added method to populate the server timing entries on a PerformanceResourceTiming object.
940         (WebCore::ResourceTiming::isolatedCopy const): Added code to copy over the server timing entries.
941         * loader/ResourceTiming.h:
942         (WebCore::ResourceTiming::ResourceTiming): Accept collection of server timing entries in c'tor.
943         * loader/ServerTiming.cpp: Added.
944         (WebCore::ServerTiming::setParameter): Set named parameters, ignoring unrecognized or duplicates.
945         (WebCore::ServerTiming::isolatedCopy const): Return a new pointer to the object.
946         * loader/ServerTiming.h: Added.
947         (WebCore::ServerTiming::ServerTiming): Added struct for the data needed by a server timing entry.
948         (WebCore::ServerTiming::name const): Added name field of a server timing entry.
949         (WebCore::ServerTiming::duration const): Added duration field of a server timing entry.
950         (WebCore::ServerTiming::description const): Added description field of a server timing entry.
951         * loader/ServerTimingParser.cpp: Added.
952         (WebCore::ServerTimingParser::parseServerTiming): Parses the header generating a collection of server timing structs.
953         * loader/ServerTimingParser.h: Added.
954         * loader/WorkerThreadableLoader.h: Fix build.
955         * page/Performance.cpp:
956         (WebCore::Performance::addResourceTiming): Fixed a typo.
957         * page/PerformanceResourceTiming.cpp:
958         (WebCore::PerformanceResourceTiming::PerformanceResourceTiming): Given a ResourceTiming object, populate our collection of PerformanceServerTiming objects.
959         * page/PerformanceResourceTiming.h: Added serverTiming member and getter.
960         * page/PerformanceResourceTiming.idl: Added serverTiming member to interface.
961         * platform/network/HTTPHeaderNames.in: Added "Server-Timing" to the header enum.
962         * platform/network/ResourceResponseBase.cpp: Added "Server-Timing" to isSafeCrossOriginResponseHeader whitelist.
963
964 2018-05-15  Brady Eidson  <beidson@apple.com>
965
966         Fix crash after a Worker terminates but there are still IDB transactions the server is trying to open for it.
967         <rdar://problem/33744241> and https://bugs.webkit.org/show_bug.cgi?id=185653
968
969         Reviewed by Andy Estes.
970
971         Test: storage/indexeddb/modern/worker-transaction-open-after-worker-stop.html
972
973         * Modules/indexeddb/client/IDBConnectionProxy.cpp:
974         (WebCore::IDBClient::IDBConnectionProxy::didStartTransaction): It's okay to not be able to find a pending TX
975           that the server has started. e.g. When it was a WebWorker that asked for the TX but it has since terminated.
976
977 2018-05-15  Thomas Klausner  <tk@giga.or.at>
978
979         Add missing header to fix build.
980         https://bugs.webkit.org/show_bug.cgi?id=185378
981
982         Reviewed by Michael Catanzaro.
983
984         * platform/network/soup/SoupNetworkSession.h:
985
986 2018-05-15  Carlos Alberto Lopez Perez  <clopez@igalia.com>
987
988         [WPE] Build failure with RPi userland drivers and gstreamer-gl
989         https://bugs.webkit.org/show_bug.cgi?id=185639
990
991         Reviewed by Philippe Normand.
992
993         When building for the RPi with userland drivers (dispmanx) override the
994         value of GST_GL_HAVE_GLSYNC to 1 to avoid that the gstreamer-gl headers
995         try to redefine the GLsync type that is already defined in libepoxy.
996
997         Defining __gl2_h_ is also needed to avoid other conflicting type
998         definitions that happen between libepoxy and RPi GLES2 userland
999         headers when the gstreamer-gl headers are included.
1000
1001         The issue doesn't happen with 1.14.0, so a check for that is added
1002         as well.
1003
1004         No new tests, no behavior change. It is a build fix.
1005
1006         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp:
1007
1008 2018-05-15  Michael Catanzaro  <mcatanzaro@igalia.com>
1009
1010         Unreviewed, rolling out r230749
1011
1012         This did not work as desired.
1013
1014         * platform/UserAgentQuirks.cpp:
1015         (WebCore::urlRequiresMacintoshPlatform):
1016
1017 2018-05-15  Dirk Schulze  <krit@webkit.org>
1018
1019         Add new SVGDOM SVGFEBLEND constants
1020         https://bugs.webkit.org/show_bug.cgi?id=185581
1021
1022         Reviewed by Simon Fraser.
1023
1024         Provide new SVG DOM constants for the new blend modes added to feBlend.
1025
1026         https://drafts.fxtf.org/filter-effects-1/#InterfaceSVGFEBlendElement
1027
1028         * platform/graphics/GraphicsTypes.cpp:
1029         (WebCore::blendModeName):
1030         * platform/graphics/GraphicsTypes.h:
1031         * svg/SVGFEBlendElement.h:
1032         (WebCore::SVGPropertyTraits<BlendMode>::highestEnumValue):
1033         (WebCore::SVGPropertyTraits<BlendMode>::toString):
1034         * svg/SVGFEBlendElement.idl:
1035
1036 2018-05-15  Antoine Quint  <graouts@apple.com>
1037
1038         [Web Animations] Expose Web Animations CSS integration as an experimental feature
1039         https://bugs.webkit.org/show_bug.cgi?id=185647
1040
1041         Reviewed by Dean Jackson.
1042
1043         Make the Web Animations CSS integration flag an experimental feature, and only indicate that it is on if the Web Animations
1044         experimental feature is also enabled.
1045
1046         * dom/Document.cpp:
1047         (WebCore::Document::didBecomeCurrentDocumentInFrame):
1048         (WebCore::Document::resume):
1049         * dom/Element.cpp:
1050         (WebCore::Element::removedFromAncestor):
1051         * dom/PseudoElement.cpp:
1052         (WebCore::PseudoElement::clearHostElement):
1053         * history/CachedFrame.cpp:
1054         (WebCore::CachedFrameBase::restore):
1055         * page/Frame.cpp:
1056         (WebCore::Frame::clearTimers):
1057         * page/FrameView.cpp:
1058         (WebCore::FrameView::didDestroyRenderTree):
1059         * page/Page.cpp:
1060         (WebCore::Page::handleLowModePowerChange):
1061         (WebCore::Page::setIsVisibleInternal):
1062         (WebCore::Page::hiddenPageCSSAnimationSuspensionStateChanged):
1063         * page/RuntimeEnabledFeatures.h:
1064         (WebCore::RuntimeEnabledFeatures::setWebAnimationsCSSIntegrationEnabled):
1065         (WebCore::RuntimeEnabledFeatures::webAnimationsCSSIntegrationEnabled const):
1066         (WebCore::RuntimeEnabledFeatures::setCSSAnimationsAndCSSTransitionsBackedByWebAnimationsEnabled): Deleted.
1067         (WebCore::RuntimeEnabledFeatures::cssAnimationsAndCSSTransitionsBackedByWebAnimationsEnabled const): Deleted.
1068         * rendering/RenderLayer.cpp:
1069         (WebCore::RenderLayer::currentTransform const):
1070         (WebCore::RenderLayer::calculateClipRects const):
1071         * rendering/RenderLayerBacking.cpp:
1072         (WebCore::RenderLayerBacking::updateGeometry):
1073         * rendering/RenderLayerCompositor.cpp:
1074         (WebCore::RenderLayerCompositor::requiresCompositingForAnimation const):
1075         (WebCore::RenderLayerCompositor::isRunningTransformAnimation const):
1076         * rendering/updating/RenderTreeUpdater.cpp:
1077         (WebCore::RenderTreeUpdater::tearDownRenderers):
1078         * style/StyleTreeResolver.cpp:
1079         (WebCore::Style::TreeResolver::createAnimatedElementUpdate):
1080         * testing/InternalSettings.cpp:
1081         (WebCore::InternalSettings::webAnimationsCSSIntegrationEnabled):
1082         (WebCore::InternalSettings::cssAnimationsAndCSSTransitionsBackedByWebAnimationsEnabled): Deleted.
1083         * testing/InternalSettings.h:
1084         * testing/InternalSettings.idl:
1085         * testing/Internals.cpp:
1086         (WebCore::Internals::numberOfActiveAnimations const):
1087         (WebCore::Internals::animationsAreSuspended const):
1088         (WebCore::Internals::animationsInterval const):
1089         (WebCore::Internals::suspendAnimations const):
1090         (WebCore::Internals::resumeAnimations const):
1091
1092 2018-05-15  David Kilzer  <ddkilzer@apple.com>
1093
1094         Fix -Wreturn-std-move warnings in WebKit found by new clang compiler
1095         <https://webkit.org/b/185621>
1096
1097         Reviewed by Youenn Fablet.
1098
1099         Fix warnings like the following:
1100
1101             In file included from DerivedSources/WebCore/unified-sources/UnifiedSource139.cpp:5:
1102             ./Modules/mediastream/PeerConnectionBackend.cpp:412:16: error: local variable 'sdp' will be copied despite being returned by name [-Werror,-Wreturn-std-move]
1103                     return sdp;
1104                            ^~~
1105             ./Modules/mediastream/PeerConnectionBackend.cpp:412:16: note: call 'std::move' explicitly to avoid copying
1106                     return sdp;
1107                            ^~~
1108                            std::move(sdp)
1109             1 error generated.
1110
1111         * Modules/mediastream/PeerConnectionBackend.cpp:
1112         (WebCore::PeerConnectionBackend::filterSDP const):
1113         * accessibility/AccessibilityObject.cpp:
1114         (WebCore::rangeClosestToRange):
1115         * bindings/js/JSDOMConvertSequences.h:
1116         (WebCore::Detail::GenericSequenceConverter::convert):
1117         (WebCore::Detail::NumericSequenceConverter::convertArray):
1118         * bindings/js/JSDOMConvertStrings.cpp:
1119         (WebCore::stringToByteString):
1120         (WebCore::stringToUSVString):
1121         - Use WTFMove() in return statements to fix the warnings.
1122
1123 2018-05-14  Dean Jackson  <dino@apple.com>
1124
1125         Download and present System Preview
1126         https://bugs.webkit.org/show_bug.cgi?id=185459
1127         <rdar://problem/40079228>
1128
1129         Reviewed by Tim Horton.
1130
1131         If an <a> is a system preview, tell the resource request about it.
1132
1133         * html/HTMLAnchorElement.cpp:
1134         (WebCore::HTMLAnchorElement::handleClick):
1135
1136 2018-05-15  Antti Koivisto  <antti@apple.com>
1137
1138         animation-play-state: paused causes very high cpu load because of style invalidation loop
1139         https://bugs.webkit.org/show_bug.cgi?id=182436
1140         <rdar://problem/37182562>
1141
1142         Reviewed by Dean Jackson.
1143
1144         Test: animations/animation-playstate-paused-style-resolution.html
1145
1146         If the style of an element with 'animation-play-state: paused' is recomputed so it stays
1147         paused we would enter zero-duration animation timer loop.
1148
1149         * page/animation/AnimationBase.cpp:
1150         (WebCore::AnimationBase::updateStateMachine):
1151
1152         Don't move to AnimationState::PausedWaitResponse unless we get AnimationStateInput::StyleAvailable
1153         (matching the comments). Otherwise just stay in the existing paused state.
1154
1155         Remove AnimationStateInput::StartAnimation from assertion as the case can't happen.
1156
1157 2018-05-14  Youenn Fablet  <youenn@apple.com>
1158
1159         readableStreamDefaultControllerError should return early if stream is not readable
1160         https://bugs.webkit.org/show_bug.cgi?id=185602
1161
1162         Reviewed by Chris Dumez.
1163
1164         Return early if stream is not readable in @readableStreamDefaultControllerError.
1165         Update call sites to no longer check for ReadableStream state.
1166         Covered by unflaked and rebased tests.
1167
1168         * Modules/streams/ReadableStreamDefaultController.js:
1169         (error):
1170         * Modules/streams/ReadableStreamInternals.js:
1171         (readableStreamDefaultControllerError):
1172         (readableStreamDefaultControllerCallPullIfNeeded):
1173
1174 2018-05-14  Zalan Bujtas  <zalan@apple.com>
1175
1176         [LFC] Implement width computation for non-replaced block level inflow elements.
1177         https://bugs.webkit.org/show_bug.cgi?id=185641
1178
1179         Reviewed by Sam Weinig.
1180
1181         Block level inflow elements participate in block formatting context.
1182
1183         * layout/FormattingContext.cpp:
1184         (WebCore::Layout::FormattingContext::computeWidth const):
1185         * layout/FormattingContext.h:
1186         * layout/blockformatting/BlockFormattingContext.cpp:
1187         (WebCore::Layout::BlockFormattingContext::computeInFlowWidth const):
1188         * layout/blockformatting/BlockFormattingContext.h:
1189         * layout/inlineformatting/InlineFormattingContext.cpp:
1190         (WebCore::Layout::InlineFormattingContext::computeInFlowWidth const):
1191         * layout/inlineformatting/InlineFormattingContext.h:
1192
1193 2018-05-14  Wenson Hsieh  <wenson_hsieh@apple.com>
1194
1195         Unreviewed, fix the iOS build after r231779
1196
1197         Also address a minor in-person review comment by returning "extrazoom" instead of the empty string.
1198
1199         * page/DisabledAdaptations.cpp:
1200         (WebCore::extraZoomModeAdaptationName):
1201
1202 2018-05-14  Zalan Bujtas  <zalan@apple.com>
1203
1204         [LFC] FormattingContext:computeOutOfFlowNonReplacedHeight/Width should use the computed margins/paddings/borders
1205         https://bugs.webkit.org/show_bug.cgi?id=185633
1206
1207         Reviewed by Sam Weinig.
1208
1209         By the time we start computing height and width, DisplayBox should already have the computed values for margin/padding/border.
1210
1211         * layout/FormattingContext.cpp:
1212         (WebCore::Layout::FormattingContext::computeOutOfFlowNonReplacedHeight const):
1213         (WebCore::Layout::FormattingContext::computeOutOfFlowNonReplacedWidth const):
1214         * layout/displaytree/DisplayBox.h:
1215         (WebCore::Display::Box::paddingTop const):
1216         (WebCore::Display::Box::paddingLeft const):
1217         (WebCore::Display::Box::paddingBottom const):
1218         (WebCore::Display::Box::paddingRight const):
1219         (WebCore::Display::Box::borderTop const):
1220         (WebCore::Display::Box::borderLeft const):
1221         (WebCore::Display::Box::borderBottom const):
1222         (WebCore::Display::Box::borderRight const):
1223
1224 2018-05-14  Wenson Hsieh  <wenson_hsieh@apple.com>
1225
1226         [Extra zoom mode] Google search results are excessively zoomed in
1227         https://bugs.webkit.org/show_bug.cgi?id=185347
1228         <rdar://problem/39999778>
1229
1230         Reviewed by Tim Horton.
1231
1232         It turns out that basing minimum layout size and shrink-to-fit behaviors off of the `shrink-to-fit` viewport
1233         argument poses compatibility risks with web pages that already specify `shrink-to-fit` to opt out of default
1234         viewport shrinking behaviors in 1/3 multitasking mode on iPad.
1235
1236         One way to resolve this is to introduce a new viewport meta content attribute to disable viewport heuristics in
1237         extra zoom mode. However, combined shrink-to-fit and minimum device width behaviors are difficult to describe
1238         using a single backwards-compatible viewport meta content attribute, and the need to suppress the default
1239         behavior of `shrink-to-fit=no` if such an attribute is not disabled further muddles our viewport story.
1240
1241         After some internal deliberation, we’ve decided to experiment with a new meta tag named "disabled-adaptations".
1242         The content of this meta tag is a comma-separated list of adaptation names; if an adaptation name matches a
1243         known adaptation type (for instance, extra zoom mode), we disable the class of behaviors used to adapt web
1244         content. The first and only known adaptation type is extra zoom mode, which affects `shrink-to-fit` and layout
1245         size adjustments.
1246
1247         See per-method changes below for more details.
1248
1249         Test: fast/viewport/extrazoom/viewport-disable-extra-zoom-adaptations.html
1250
1251         * Sources.txt:
1252         * WebCore.xcodeproj/project.pbxproj:
1253         * dom/Document.cpp:
1254         (WebCore::Document::processDisabledAdaptations):
1255         * dom/Document.h:
1256         (WebCore::Document::disabledAdaptations const):
1257
1258         Add disabled adaptations to Document. Changes to disabled adaptations are not propagated if the parsed disabled
1259         adaptation types don't change; upon changing adaptation types, notify the client to adjust for the new disabled
1260         adaptations (currently, this only affects the viewport configuration).
1261
1262         * dom/ViewportArguments.h:
1263         * html/HTMLMetaElement.cpp:
1264         (WebCore::HTMLMetaElement::process):
1265         * html/parser/HTMLPreloadScanner.cpp:
1266         (WebCore::TokenPreloadScanner::StartTagScanner::StartTagScanner):
1267         (WebCore::TokenPreloadScanner::StartTagScanner::processAttributes):
1268         (WebCore::TokenPreloadScanner::StartTagScanner::processAttribute):
1269         * loader/FrameLoader.cpp:
1270         (WebCore::FrameLoader::commitProvisionalLoad):
1271
1272         Restore the set of disabled adaptations when restoring a page from the cache.
1273
1274         * page/Chrome.cpp:
1275         (WebCore::Chrome::dispatchDisabledAdaptationsDidChange const):
1276         * page/Chrome.h:
1277         * page/ChromeClient.h:
1278
1279         Add plumbing for changes to the set of disabled adaptations.
1280
1281         * page/DisabledAdaptations.cpp: Added.
1282         (WebCore::extraZoomModeAdaptationName):
1283         * page/DisabledAdaptations.h: Added.
1284
1285         Introduce a header containing a new enum for the extra zoom mode adaptation, as well as a helper function to
1286         return the extra zoom mode adaptation name.
1287
1288         * page/Page.cpp:
1289         (WebCore::Page::disabledAdaptations const):
1290
1291         Returns the mainframe's set of adaptations to disable.
1292
1293         * page/Page.h:
1294         * page/RemoteFrame.h:
1295         * page/RuntimeEnabledFeatures.h:
1296         (WebCore::RuntimeEnabledFeatures::setDisabledAdaptationsMetaTagEnabled):
1297         (WebCore::RuntimeEnabledFeatures::disabledAdaptationsMetaTagEnabled const):
1298
1299         Add a new runtime feature to gate handling the "disabled-adaptations" meta tag.
1300
1301         * page/ViewportConfiguration.cpp:
1302         (WebCore::shouldOverrideShrinkToFitArgument):
1303         (WebCore::needsUpdateAfterChangingDisabledAdaptations):
1304         (WebCore::ViewportConfiguration::setDisabledAdaptations):
1305         (WebCore::ViewportConfiguration::shouldOverrideDeviceWidthAndShrinkToFit const):
1306
1307         Consult whether or not extra zoom mode adaptations are disabled, instead of the shrink-to-fit attribute value.
1308
1309         (WebCore::ViewportConfiguration::updateConfiguration):
1310         * page/ViewportConfiguration.h:
1311
1312         Add an OptionSet of disabled adaptation types to ViewportConfiguration. Updates to the adaptation type are
1313         propagated to the ViewportConfiguration from Document, through the ChromeClient and the client layer (refer to
1314         changes in WebKit). Once the OptionSet is changed, we recompute the viewport configuration only if needed by the
1315         platform.
1316
1317         (WebCore::ViewportConfiguration::viewLayoutSize const):
1318         (WebCore::ViewportConfiguration::disabledAdaptations const):
1319         * page/WindowFeatures.cpp:
1320         (WebCore::parseDisabledAdaptations):
1321         * page/WindowFeatures.h:
1322
1323         Add a new helper to parse the meta content of a "disabled-adaptations" tag as an OptionSet of disabled
1324         adaptation types. The string is parsed by first splitting on the comma character, and then iterating over lower
1325         case, whitespace-stripped tokens to look for known adaptation names. So far, only extra zoom mode is supported.
1326
1327         * testing/Internals.cpp:
1328         (WebCore::Internals::extraZoomModeAdaptationName const):
1329         * testing/Internals.h:
1330         * testing/Internals.idl:
1331
1332         Expose the extra zoom mode adaptation name to the DOM, only when running layout tests.
1333
1334 2018-05-14  Joanmarie Diggs  <jdiggs@igalia.com>
1335
1336         AX: Listbox and Combobox roles embedded in labels should participate in name calculation
1337         https://bugs.webkit.org/show_bug.cgi?id=185521
1338
1339         Reviewed by Chris Fleizach.
1340
1341         Take selected children into account when computing the name in accessibleNameForNode.
1342         Add ListBox to the roles for which accessibleNameDerivesFromContent returns false so
1343         that native select elements with size > 1 are treated the same way as ARIA listbox.
1344         Also add ListBox to the roles which are treated as controls when used in ARIA. Finally,
1345         prevent labels which contain unrelated controls from being used as an AXTitleUIElement.
1346         This causes us to build a string from the label and its descendants, ensuring the latter
1347         participate in the name calculation.
1348
1349         Test: accessibility/text-alternative-calculation-from-listbox.html
1350
1351         * accessibility/AccessibilityLabel.cpp:
1352         (WebCore::childrenContainUnrelatedControls):
1353         (WebCore::AccessibilityLabel::containsUnrelatedControls const):
1354         * accessibility/AccessibilityLabel.h:
1355         * accessibility/AccessibilityNodeObject.cpp:
1356         (WebCore::accessibleNameForNode):
1357         * accessibility/AccessibilityObject.cpp:
1358         (WebCore::AccessibilityObject::accessibleNameDerivesFromContent const):
1359         (WebCore::AccessibilityObject::isARIAControl):
1360         * accessibility/AccessibilityRenderObject.cpp:
1361         (WebCore::AccessibilityRenderObject::exposesTitleUIElement const):
1362         (WebCore::AccessibilityRenderObject::computeAccessibilityIsIgnored const):
1363
1364 2018-05-14  Antoine Quint  <graouts@apple.com>
1365
1366         [Web Animations] Tests using the new animation engine may crash under WebCore::FrameView::didDestroyRenderTree when using internals methods
1367         https://bugs.webkit.org/show_bug.cgi?id=185612
1368         <rdar://problem/39579344>
1369
1370         Reviewed by Dean Jackson.
1371
1372         Add a new internals.pseudoElement() method to obtain a pseudo element matching a given pseudo-id. This is necessary to be able to move off
1373         internals.pauseTransitionAtTimeOnPseudoElement() and internals.pauseAnimationAtTimeOnPseudoElement() for Web Animations testing.
1374
1375         * testing/Internals.cpp:
1376         (WebCore::Internals::pseudoElement):
1377         * testing/Internals.h:
1378         * testing/Internals.idl:
1379
1380 2018-05-14  Antoine Quint  <graouts@apple.com>
1381
1382         REGRESSION (r230574): Interrupted hardware transitions don't behave correctly
1383         https://bugs.webkit.org/show_bug.cgi?id=185299
1384         <rdar://problem/39630230>
1385
1386         Reviewed by Simon Fraser.
1387
1388         In r230574, the fix for webkit.org/b/184518, we changed the processing order in GraphicsLayerCA::updateAnimations() to first
1389         process m_uncomittedAnimations and then m_animationsToProcess, so we are guaranteed animations exist before we attempt to pause
1390         or seek them. This broke interrupting and resuming hardware animations (such as an interrupted CSS Transition or an animation
1391         running in a non-visible tab) since a pause operation recorded _before_ an animation was added would be paused anyway since
1392         the animation was now first added, and then paused. The fix is simply to clear any pending AnimationProcessingAction for a
1393         newly-uncommitted animation.
1394
1395         Test: transitions/interrupted-transition-hardware.html
1396
1397         * platform/graphics/ca/GraphicsLayerCA.cpp:
1398         (WebCore::GraphicsLayerCA::createAnimationFromKeyframes):
1399         (WebCore::GraphicsLayerCA::appendToUncommittedAnimations):
1400         (WebCore::GraphicsLayerCA::createTransformAnimationsFromKeyframes):
1401         * platform/graphics/ca/GraphicsLayerCA.h:
1402         (WebCore::GraphicsLayerCA::LayerPropertyAnimation::LayerPropertyAnimation):
1403
1404 2018-05-14  Thibault Saunier  <tsaunier@igalia.com>
1405
1406         [GStreamer] Fix style issue in MediaPlayerPrivateGStreamerBase
1407         https://bugs.webkit.org/show_bug.cgi?id=185510
1408
1409         Reviewed by Philippe Normand.
1410
1411         ERROR: Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp:629:  More than one command on the same line  [whitespace/newline] [4]
1412         ERROR: Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp:684:  More than one command on the same line  [whitespace/newline] [4]
1413         ERROR: Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp:807:  More than one command on the same line  [whitespace/newline] [4]
1414
1415         Indentation and style issue fixed only.
1416
1417         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp:
1418         (WebCore::MediaPlayerPrivateGStreamerBase::volumeChangedCallback):
1419         (WebCore::MediaPlayerPrivateGStreamerBase::muteChangedCallback):
1420         (WebCore::MediaPlayerPrivateGStreamerBase::triggerRepaint):
1421
1422 2018-05-14  Zalan Bujtas  <zalan@apple.com>
1423
1424         [LFC] Implement height computation for non-replaced out of flow elements.
1425         https://bugs.webkit.org/show_bug.cgi?id=185585
1426
1427         Reviewed by Antti Koivisto.
1428
1429         * layout/FormattingContext.cpp:
1430         (WebCore::Layout::FormattingContext::computeHeight const):
1431         (WebCore::Layout::FormattingContext::computeOutOfFlowHeight const):
1432         (WebCore::Layout::FormattingContext::layoutOutOfFlowDescendants const):
1433         (WebCore::Layout::FormattingContext::computeOutOfFlowNonReplacedHeight const):
1434         (WebCore::Layout::FormattingContext::computeHeightForBlockFormattingContextRootWithAutoHeight const):
1435         * layout/FormattingContext.h:
1436         * layout/blockformatting/BlockFormattingContext.h:
1437         * layout/displaytree/DisplayBox.h:
1438
1439 2018-05-14  Manuel Rego Casasnovas  <rego@igalia.com>
1440
1441         Renaming of overrides in LayoutBox
1442         https://bugs.webkit.org/show_bug.cgi?id=185609
1443
1444         Reviewed by Javier Fernandez.
1445
1446         The names of the methods for the overrides were not consistent,
1447         this patch fixes it by using the same structure in all the cases.
1448
1449         No new tests, no change of behavior.
1450
1451         * rendering/GridLayoutFunctions.cpp:
1452         (WebCore::GridLayoutFunctions::hasOverrideContainingBlockContentSizeForChild):
1453         * rendering/GridTrackSizingAlgorithm.cpp:
1454         (WebCore::GridTrackSizingAlgorithmStrategy::logicalHeightForChild const):
1455         * rendering/RenderBlock.cpp:
1456         (WebCore::RenderBlock::computeChildPreferredLogicalWidths const):
1457         (WebCore::RenderBlock::availableLogicalHeightForPercentageComputation const):
1458         * rendering/RenderBlockFlow.cpp:
1459         (WebCore::RenderBlockFlow::fitBorderToLinesIfNeeded):
1460         * rendering/RenderBlockLineLayout.cpp:
1461         (WebCore::RenderBlockFlow::updateRubyForJustifiedText):
1462         * rendering/RenderBox.cpp:
1463         (WebCore::RenderBox::willBeDestroyed):
1464         (WebCore::RenderBox::hasOverrideContentLogicalHeight const):
1465         (WebCore::RenderBox::hasOverrideContentLogicalWidth const):
1466         (WebCore::RenderBox::setOverrideContentLogicalHeight):
1467         (WebCore::RenderBox::setOverrideContentLogicalWidth):
1468         (WebCore::RenderBox::clearOverrideContentLogicalHeight):
1469         (WebCore::RenderBox::clearOverrideContentLogicalWidth):
1470         (WebCore::RenderBox::clearOverrideContentSize):
1471         (WebCore::RenderBox::overrideContentLogicalWidth const):
1472         (WebCore::RenderBox::overrideContentLogicalHeight const):
1473         (WebCore::RenderBox::overrideContainingBlockContentLogicalWidth const):
1474         (WebCore::RenderBox::overrideContainingBlockContentLogicalHeight const):
1475         (WebCore::RenderBox::hasOverrideContainingBlockContentLogicalWidth const):
1476         (WebCore::RenderBox::hasOverrideContainingBlockContentLogicalHeight const):
1477         (WebCore::RenderBox::setOverrideContainingBlockContentLogicalWidth):
1478         (WebCore::RenderBox::setOverrideContainingBlockContentLogicalHeight):
1479         (WebCore::RenderBox::clearOverrideContainingBlockContentSize):
1480         (WebCore::RenderBox::clearOverrideContainingBlockContentLogicalHeight):
1481         (WebCore::RenderBox::containingBlockLogicalWidthForContent const):
1482         (WebCore::RenderBox::containingBlockLogicalHeightForContent const):
1483         (WebCore::RenderBox::perpendicularContainingBlockLogicalHeight const):
1484         (WebCore::RenderBox::computeLogicalWidthInFragment const):
1485         (WebCore::RenderBox::computeLogicalHeight const):
1486         (WebCore::RenderBox::computePercentageLogicalHeight const):
1487         (WebCore::RenderBox::computeReplacedLogicalHeightUsing const):
1488         (WebCore::RenderBox::availableLogicalHeightUsing const):
1489         (WebCore::RenderBox::containingBlockLogicalWidthForPositioned const):
1490         (WebCore::RenderBox::containingBlockLogicalHeightForPositioned const):
1491         * rendering/RenderBox.h:
1492         * rendering/RenderBoxModelObject.cpp:
1493         (WebCore::RenderBoxModelObject::hasAutoHeightOrContainingBlockWithAutoHeight const):
1494         * rendering/RenderDeprecatedFlexibleBox.cpp:
1495         (WebCore::contentWidthForChild):
1496         (WebCore::contentHeightForChild):
1497         (WebCore::gatherFlexChildrenInfo):
1498         (WebCore::RenderDeprecatedFlexibleBox::layoutHorizontalBox):
1499         (WebCore::RenderDeprecatedFlexibleBox::layoutVerticalBox):
1500         (WebCore::RenderDeprecatedFlexibleBox::applyLineClamp):
1501         (WebCore::RenderDeprecatedFlexibleBox::clearLineClamp):
1502         * rendering/RenderFlexibleBox.cpp:
1503         (WebCore::RenderFlexibleBox::computeInnerFlexBaseSizeForChild):
1504         (WebCore::RenderFlexibleBox::crossSizeForPercentageResolution):
1505         (WebCore::RenderFlexibleBox::mainSizeForPercentageResolution):
1506         (WebCore::RenderFlexibleBox::constructFlexItem):
1507         (WebCore::RenderFlexibleBox::setOverrideMainAxisContentSizeForChild):
1508         (WebCore::RenderFlexibleBox::applyStretchAlignmentToChild):
1509         * rendering/RenderFullScreen.cpp:
1510         (WebCore::RenderFullScreen::unwrapRenderer):
1511         * rendering/RenderGrid.cpp:
1512         (WebCore::RenderGrid::layoutBlock):
1513         (WebCore::RenderGrid::layoutGridItems):
1514         (WebCore::RenderGrid::applyStretchAlignmentToChildIfNeeded):
1515         * rendering/RenderRubyBase.cpp:
1516         (WebCore::RenderRubyBase::adjustInlineDirectionLineBounds const):
1517         * rendering/RenderTableCell.cpp:
1518         (WebCore::RenderTableCell::setOverrideContentLogicalHeightFromRowHeight):
1519         * rendering/RenderTableCell.h:
1520         * rendering/RenderTableSection.cpp:
1521         (WebCore::RenderTableSection::calcRowLogicalHeight):
1522         (WebCore::RenderTableSection::relayoutCellIfFlexed):
1523
1524 2018-05-14  Zalan Bujtas  <zalan@apple.com>
1525
1526         [LFC] Implement width computation for non-replaced out of flow elements.
1527         https://bugs.webkit.org/show_bug.cgi?id=185598
1528
1529         Reviewed by Antti Koivisto.
1530
1531         * layout/FormattingContext.cpp:
1532         (WebCore::Layout::FormattingContext::computeWidth const):
1533         (WebCore::Layout::FormattingContext::computeOutOfFlowWidth const):
1534         (WebCore::Layout::FormattingContext::layoutOutOfFlowDescendants const):
1535         (WebCore::Layout::FormattingContext::computeOutOfFlowNonReplacedWidth const):
1536         (WebCore::Layout::FormattingContext::shrinkToFitWidth const):
1537         * layout/FormattingContext.h:
1538         * layout/blockformatting/BlockFormattingContext.cpp:
1539         (WebCore::Layout::BlockFormattingContext::layout const):
1540         * layout/displaytree/DisplayBox.h:
1541
1542 2018-05-14  Zan Dobersek  <zdobersek@igalia.com>
1543
1544         Drop the m_compositorTexture member variable in TextureMapperGC3DPlatformLayer.
1545         It's not used at all inside the class or outside it.
1546
1547         Rubber-stamped by Michael Catanzaro.
1548
1549         * platform/graphics/texmap/TextureMapperGC3DPlatformLayer.h:
1550
1551 2018-05-14  Zan Dobersek  <zdobersek@igalia.com>
1552
1553         [GTK] REGRESSION(r231170) Build broken with Clang 5.0
1554         https://bugs.webkit.org/show_bug.cgi?id=185198
1555
1556         Reviewed by Michael Catanzaro.
1557
1558         Avoid gperf files using the register keyword which has been made
1559         reserved and as such unusable in C++17.
1560
1561         * css/makeSelectorPseudoClassAndCompatibilityElementMap.py:
1562         * css/makeSelectorPseudoElementsMap.py:
1563         * css/makeprop.pl:
1564         * css/makevalues.pl:
1565         * platform/ColorData.gperf:
1566         * platform/ReferrerPolicy.h: With std::optional forward declaration
1567         gone, explicitly include the WTF Optional.h header.
1568         * platform/Theme.h: Ditto.
1569         * platform/network/create-http-header-name-table:
1570
1571 2018-05-14  Commit Queue  <commit-queue@webkit.org>
1572
1573         Unreviewed, rolling out r219515.
1574         https://bugs.webkit.org/show_bug.cgi?id=185603
1575
1576         It sometimes makes AudioUnitInitialize call to fail in
1577         CoreAudioCaptureSource (Requested by youenn on #webkit).
1578
1579         Reverted changeset:
1580
1581         "Remove CoreAudioCaptureSource speaker configuration"
1582         https://bugs.webkit.org/show_bug.cgi?id=174512
1583         https://trac.webkit.org/changeset/219515
1584
1585 2018-05-13  Dirk Schulze  <krit@webkit.org>
1586
1587         Implement SVGGeometryElement's isPointInFill and isPointInStroke
1588         https://bugs.webkit.org/show_bug.cgi?id=185580
1589
1590         Reviewed by Antti Koivisto.
1591
1592         Implement isPointInFill and isPointInStroke methods for
1593         SVGGeometryElement interface from SVG2.
1594
1595         https://svgwg.org/svg2-draft/types.html#InterfaceSVGGeometryElement
1596
1597         Tests: svg/dom/SVGGeometry-isPointInFill.xhtml
1598                svg/dom/SVGGeometry-isPointInStroke.xhtml
1599
1600         * rendering/svg/RenderSVGEllipse.cpp:
1601         (WebCore::RenderSVGEllipse::shapeDependentStrokeContains): Flag
1602                 to switch between local and "global" coordinate space for hit testing.
1603         * rendering/svg/RenderSVGEllipse.h:
1604         * rendering/svg/RenderSVGPath.cpp:
1605         (WebCore::RenderSVGPath::shapeDependentStrokeContains): Flag
1606                 to switch between local and "global" coordinate space for hit testing.
1607         * rendering/svg/RenderSVGPath.h:
1608         * rendering/svg/RenderSVGRect.cpp:
1609         (WebCore::RenderSVGRect::shapeDependentStrokeContains): Flag
1610                 to switch between local and "global" coordinate space for hit testing.
1611         * rendering/svg/RenderSVGRect.h:
1612         * rendering/svg/RenderSVGShape.cpp:
1613         (WebCore::RenderSVGShape::shapeDependentStrokeContains): Flag
1614                 to switch between local and "global" coordinate space for hit testing.
1615         (WebCore::RenderSVGShape::isPointInFill): Take the winding rule given by
1616                 `fill-rule` to test if a given point is in the fill area of a path.
1617         (WebCore::RenderSVGShape::isPointInStroke): Take stroke properties into
1618                 account to check if a point is on top of the stroke area.
1619         * rendering/svg/RenderSVGShape.h:
1620         * svg/SVGGeometryElement.cpp:
1621         (WebCore::SVGGeometryElement::isPointInFill):
1622         (WebCore::SVGGeometryElement::isPointInStroke):
1623         (WebCore::SVGGeometryElement::createElementRenderer): Deleted. This is getting implemented
1624                 by inheriting classes. No need to create RenderSVGPath here.
1625         * svg/SVGGeometryElement.h:
1626         * svg/SVGGeometryElement.idl:
1627
1628 2018-05-12  Zalan Bujtas  <zalan@apple.com>
1629
1630         Use WeakPtr for m_enclosingPaginationLayer in RenderLayer
1631         https://bugs.webkit.org/show_bug.cgi?id=185566
1632         <rdar://problem/36486052>
1633
1634         Reviewed by Simon Fraser.
1635
1636         Since RenderLayer does not own the enclosing pagination layout, it should
1637         construct a weak pointer instead of holding on to a raw pointer.
1638
1639         Unable to create a reliably reproducible test case.
1640
1641         * page/mac/EventHandlerMac.mm:
1642         (WebCore::scrollableAreaForEventTarget):
1643         (WebCore::scrollableAreaForContainerNode):
1644         (WebCore::EventHandler::platformPrepareForWheelEvents):
1645         * platform/ScrollableArea.h:
1646         (WebCore::ScrollableArea::weakPtrFactory const):
1647         (WebCore::ScrollableArea::createWeakPtr): Deleted.
1648         * rendering/RenderLayer.cpp:
1649         (WebCore::RenderLayer::RenderLayer):
1650         (WebCore::RenderLayer::updatePagination):
1651         * rendering/RenderLayer.h:
1652
1653 2018-05-11  Daniel Bates  <dabates@apple.com>
1654
1655         X-Frame-Options: SAMEORIGIN needs to check all ancestor frames
1656         https://bugs.webkit.org/show_bug.cgi?id=185567
1657         <rdar://problem/40175008>
1658
1659         Reviewed by Brent Fulgham.
1660
1661         Change the behavior of "X-Frame-Options: SAMEORIGIN" to ensure that all ancestors frames
1662         are same-origin with the document that delivered this header. This prevents an intermediary
1663         malicious frame from clickjacking a child frame whose document is same-origin with the top-
1664         level frame. It also makes the behavior of X-Frame-Options in WebKit more closely match
1665         the behavior of X-Frame-Options in other browsers, including Chrome and Firefox.
1666         
1667         Currently a document delivered with "X-Frame-Options: SAMEORIGIN" must only be same-origin
1668         with the top-level frame's document in order to be displayed. This prevents clickjacking by
1669         a malicious page that embeds a page delivered with "X-Frame-Options: SAMEORIGIN". However,
1670         it does not protect against clickjacking of the "X-Frame-Options: SAMEORIGIN" page (victim)
1671         if embedded by an intermediate malicious iframe, say a "rogue ad", that was embedded in a
1672         document same origin with the victim page. We should protect against such attacks. 
1673
1674         Tests: http/tests/security/XFrameOptions/x-frame-options-ancestors-same-origin-allow.html
1675                http/tests/security/XFrameOptions/x-frame-options-ancestors-same-origin-deny.html
1676
1677         * loader/FrameLoader.cpp:
1678         (WebCore::FrameLoader::shouldInterruptLoadForXFrameOptions):
1679
1680 2018-05-11  Daniel Bates  <dabates@apple.com>
1681
1682         [iOS] Text decoration of dragged content does not paint with opacity
1683         https://bugs.webkit.org/show_bug.cgi?id=185551
1684         <rdar://problem/40166867>
1685
1686         Reviewed by Wenson Hsieh.
1687
1688         Respect alpha when painting the text decoration for dragged content.
1689
1690         * rendering/InlineTextBox.cpp:
1691         (WebCore::InlineTextBox::MarkedTextStyle::areDecorationMarkedTextStylesEqual): Consider alpha when
1692         comparing decoration styles for equality so that we do not coalesce styles with differing alpha.
1693         (WebCore::InlineTextBox::paintMarkedTextDecoration): Respect alpha when painting dragged content.
1694
1695 2018-05-11  Nan Wang  <n_wang@apple.com>
1696
1697         AX: In role=dialog elements with aria-modal=true VoiceOver iOS/macOS can't manually focus or read dialog paragraph description text inside the modal.
1698         https://bugs.webkit.org/show_bug.cgi?id=185219
1699         <rdar://problem/39920009>
1700
1701         Reviewed by Chris Fleizach.
1702
1703         The text node descendants of a modal dialog are ignored. Fixed it by using AccessibilityObject's 
1704         node() to determine if it's the descendant of the modal dialog node.
1705
1706         Test: accessibility/aria-modal-text-descendants.html
1707
1708         * accessibility/AccessibilityObject.cpp:
1709         (WebCore::AccessibilityObject::isModalDescendant const):
1710
1711 2018-05-11  Ryosuke Niwa  <rniwa@webkit.org>
1712
1713         Tapping after CSS-based table casues an infinite loop in wordRangeFromPosition
1714         https://bugs.webkit.org/show_bug.cgi?id=185465
1715         <rdar://problem/35263057>
1716
1717         Reviewed by Antti Koivisto.
1718
1719         The bug was caused by TextIterator not emitting a line break when exiting a CSS-based table when an element
1720         with `display: table-row` has an invisible text node. Specifically, TextIterator::exitNode is never called on
1721         an element with `table-cell: row` when m_node is a text node with whitespaces which appears after an element
1722         with `display: table-cell`.
1723
1724         For example, for a tree structure like:
1725         table-row (R)
1726           table-cell (C)
1727             "text" (1)
1728           " " (2)
1729         Getting out of (C) would result in moving onto (2) without generating a line break for (R).
1730
1731         When this happens in nextBoundary as it tries to find the end of the last word in the table cell, we end up
1732         finding the end of the document as the end of the word. As a result, nextWordBoundaryInDirection, the caller
1733         of nextBoundary, ends up infinite looping between the positon at the end of the document and the position
1734         immediately before the last word in the last table cell when it traverses words backwards.
1735
1736         This patch fixes the hang by addressing this root cause in TextIterator. Namely, TextIterator now generates
1737         a line break when exiting a block while walking up ancestors in TextIterator::advance().
1738
1739         Tests: editing/selection/tapping-in-table-at-end-of-document.html
1740                editing/text-iterator/table-at-end-of-document.html
1741
1742         * editing/TextIterator.cpp:
1743         (WebCore::TextIterator::advance): Fixed the bug.
1744         (WebCore::shouldEmitNewlineAfterNode): Do generate a new line at the end of a document when we're trying to
1745         generate every visible poitions even there are no renderers beyond this point. e.g. a position inside the
1746         last cell of a table at the end of a document hits this condition.
1747         (WebCore::shouldEmitExtraNewlineForNode): Don't emit a line break when the render box's height is 0px
1748         to avoid generating many empty lines for empty paragraph and header elements (this function is used to generate
1749         a blank line between p's and h1/h2/...'s).
1750         (WebCore::TextIterator::exitNode):
1751
1752 2018-05-11  Dean Jackson  <dino@apple.com>
1753
1754         System preview badge doesn't show on <picture> elements
1755         https://bugs.webkit.org/show_bug.cgi?id=185559
1756         <rdar://problem/40150066>
1757
1758         Reviewed by Tim Horton.
1759
1760         We should also identify <img>s that are the child of a <picture>
1761         contained inside the appropriate <a> element.
1762
1763         Tested internally, since the badge is platform specific.
1764
1765         * html/HTMLImageElement.cpp:
1766         (WebCore::HTMLImageElement::isSystemPreviewImage const): Add logic
1767         to look for <picture> parents.
1768
1769 2018-05-11  Chris Dumez  <cdumez@apple.com>
1770
1771         REGRESSION (async policy delegate): Revoking an object URL immediately after triggering download breaks file download
1772         https://bugs.webkit.org/show_bug.cgi?id=185531
1773         <rdar://problem/39909589>
1774
1775         Reviewed by Geoffrey Garen.
1776
1777         Whenever we start an asynchronous navigation policy decision for a blob URL, create a temporary
1778         blob URL pointing to the same data, and update the request's URL. This way, if the page's JS revokes
1779         the URL during the policy decision, the load will still succeed.
1780
1781         Test: fast/dom/HTMLAnchorElement/anchor-file-blob-download-then-revoke.html
1782
1783         * loader/DocumentLoader.cpp:
1784         (WebCore::DocumentLoader::willSendRequest):
1785         * loader/FrameLoader.cpp:
1786         (WebCore::FrameLoader::loadURL):
1787         (WebCore::FrameLoader::load):
1788         (WebCore::FrameLoader::loadPostRequest):
1789         * loader/PolicyChecker.cpp:
1790         (WebCore::PolicyChecker::extendBlobURLLifetimeIfNecessary const):
1791         (WebCore::PolicyChecker::checkNavigationPolicy):
1792         (WebCore::PolicyChecker::checkNewWindowPolicy):
1793         * loader/PolicyChecker.h:
1794
1795 2018-05-11  Antti Koivisto  <antti@apple.com>
1796
1797         LinkLoader fails to remove CachedResourceClient in some cases
1798         https://bugs.webkit.org/show_bug.cgi?id=185553
1799         <rdar://problem/36879656>
1800
1801         Reviewed by Geoffrey Garen.
1802
1803         Test: http/tests/preload/link-preload-client-remove.html
1804
1805         * loader/LinkLoader.cpp:
1806         (WebCore::LinkLoader::loadLink):
1807
1808         If there is a link preload already in progress, we fail to clear the client for the ongoing load.
1809         This may leave the CachedResource client map in a bad state.
1810
1811 2018-05-11  Charles Vazac  <cvazac@gmail.com>
1812
1813         Runtime feature flag for Server-Timing
1814         https://bugs.webkit.org/show_bug.cgi?id=184758
1815
1816         Reviewed by Youenn Fablet.
1817
1818         * Source/WebCore/CMakeLists.txt: Added reference to PerformanceServerTiming.idl.
1819         * Source/WebCore/DerivedSources.make: Added reference to PerformanceServerTiming.idl.
1820         * Source/WebCore/Sources.txt: Added reference to PerformanceServerTiming.cpp and JSPerformanceServerTiming.cpp.
1821         * Source/WebCore/WebCore.xcodeproj/project.pbxproj: Added references to PerformanceServerTiming.cpp, PerformanceServerTiming.h, and PerformanceServerTiming.idl.
1822         * Source/WebCore/bindings/js/WebCoreBuiltinNames.h: Added PerformanceServerTiming.
1823         * Source/WebCore/page/PerformanceResourceTiming.h: Added serverTiming member.
1824         * Source/WebCore/page/PerformanceResourceTiming.idl: Added serverTiming attribute.
1825         * Source/WebCore/page/PerformanceServerTiming.cpp: Added.
1826         * Source/WebCore/page/PerformanceServerTiming.h: Added.
1827         * Source/WebCore/page/PerformanceServerTiming.idl: Added.
1828
1829 2018-05-11  Brady Eidson  <beidson@apple.com>
1830
1831         Make sure history navigations reuse the existing process when necessary.
1832         <rdar://problem/39746516> and https://bugs.webkit.org/show_bug.cgi?id=185532
1833
1834         Reviewed by Ryosuke Niwa.
1835
1836         Covered by new API tests.
1837
1838         In WebCore-land, make sure *all* NavigationActions to a back/forward item are tagged with
1839         the item identifier.
1840
1841         * history/HistoryItem.cpp:
1842         (WebCore::HistoryItem::HistoryItem):
1843         (WebCore::HistoryItem::logString const):
1844         * history/HistoryItem.h:
1845
1846         * loader/FrameLoader.cpp:
1847         (WebCore::FrameLoader::loadDifferentDocumentItem):
1848
1849         * loader/NavigationAction.cpp:
1850         (WebCore::NavigationAction::setTargetBackForwardItem):
1851
1852         * loader/NavigationAction.h:
1853         (WebCore::NavigationAction::targetBackForwardItemIdentifier const):
1854
1855 2018-05-11  Yacine Bandou  <yacine.bandou_ext@softathome.com>
1856
1857         [EME][GStreamer] Handle the protection event in MediaPlayerPrivate
1858         https://bugs.webkit.org/show_bug.cgi?id=185535
1859
1860         Reviewed by Xabier Rodriguez-Calvar.
1861
1862         This patch is based on this calvaris's commit
1863         https://github.com/WebPlatformForEmbedded/WPEWebKit/commit/d966168b0d2b65f9ca9415426e26d3752c78b03e
1864
1865         It adds a handler for the protection event in MediaPalyerPrivateGStreamerBase, it extracts the InitData from the event
1866         and sends the encrypted event to JS via HTMLMediaElement.
1867         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp:
1868         (WebCore::MediaPlayerPrivateGStreamerBase::initializationDataEncountered):
1869         (WebCore::MediaPlayerPrivateGStreamerBase::handleProtectionEvent):
1870         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.h:
1871         * platform/graphics/gstreamer/eme/GStreamerEMEUtilities.h: Add a new type InitData.
1872
1873 2018-05-11  Basuke Suzuki  <Basuke.Suzuki@sony.com>
1874
1875         [Curl] Make the cipher suites, the signing algorithms and the curve lists configurable.
1876         https://bugs.webkit.org/show_bug.cgi?id=185139
1877
1878         Add interface to configure the cipher suites, the signing algorithms and the curve lists 
1879         used by OpenSSL and libcurl to exchange, to sign or to verify keys.
1880
1881         Reviewed by Youenn Fablet.
1882
1883         No new tests in public. Have tested internally.
1884
1885         * platform/network/curl/CurlContext.cpp:
1886         (WebCore::CurlHandle::setSslCipherList):
1887         * platform/network/curl/CurlContext.h:
1888         * platform/network/curl/CurlRequest.cpp:
1889         (WebCore::CurlRequest::setupTransfer):
1890         (WebCore::CurlRequest::willSetupSslCtx):
1891         * platform/network/curl/CurlSSLHandle.cpp:
1892         (WebCore::CurlSSLHandle::getCACertPathEnv):
1893         * platform/network/curl/CurlSSLHandle.h:
1894         (WebCore::CurlSSLHandle::getCipherList const):
1895         (WebCore::CurlSSLHandle::getSignatureAlgorithmsList const):
1896         (WebCore::CurlSSLHandle::getCurvesList const):
1897         (WebCore::CurlSSLHandle::setCipherList):
1898         (WebCore::CurlSSLHandle::setSignatureAlgorithmsList):
1899         (WebCore::CurlSSLHandle::setCurvesList):
1900         (WebCore::CurlSSLHandle::getCACertPath const):
1901         (WebCore::CurlSSLHandle::setCACertPath):
1902         * platform/network/curl/CurlSSLVerifier.cpp:
1903         (WebCore::CurlSSLVerifier::CurlSSLVerifier):
1904
1905 2018-05-10  Daniel Bates  <dabates@apple.com>
1906
1907         Use PlatformStrategies to switch between WebKit and WebKitLegacy checking of CSP frame-ancestors and X-Frame-Options
1908         https://bugs.webkit.org/show_bug.cgi?id=185412
1909
1910         Reviewed by Ryosuke Niwa.
1911
1912         Consolidate the knowledge on how to determine whether security checks were performed on a ResourceResponse
1913         into LoaderStrategy::havePerformedSecurityChecks() (default implementation returns false) and query it
1914         to determine whether CSP frame-ancestors and X-Frame-Options need to be checked for a ResourceResponse.
1915
1916         Additionally, rename LoaderStrategy::isDoingLoadingSecurityChecks() to shouldPerformSecurityChecks()
1917         for consistency with havePerformedSecurityChecks(). Querying shouldPerformSecurityChecks() answers the
1918         question of whether the loader strategy is responsible for performing security checks when building up
1919         a ResourceRequest to have the loader strategy load. And LoaderStrategy::havePerformedSecurityChecks()
1920         is used to determine whether the loader strategy performed these security checks for a given ResourceResponse.
1921
1922         * inspector/agents/InspectorNetworkAgent.cpp:
1923         (WebCore::InspectorNetworkAgent::didReceiveResponse):
1924         (WebCore::InspectorNetworkAgent::didFinishLoading):
1925         (WebCore::isResponseProbablyComingFromNetworkProcess): Deleted.
1926         * loader/DocumentLoader.cpp:
1927         (WebCore::DocumentLoader::responseReceived):
1928         * loader/DocumentThreadableLoader.cpp:
1929         (WebCore::shouldPerformSecurityChecks):
1930         (WebCore::DocumentThreadableLoader::shouldSetHTTPHeadersToKeep const):
1931         (WebCore::DocumentThreadableLoader::makeCrossOriginAccessRequest):
1932         (WebCore::DocumentThreadableLoader::makeSimpleCrossOriginAccessRequest):
1933         (WebCore::DocumentThreadableLoader::redirectReceived):
1934         (WebCore::DocumentThreadableLoader::didFail):
1935         (WebCore::DocumentThreadableLoader::loadRequest):
1936         (WebCore::isDoingSecurityChecksInNetworkProcess): Deleted.
1937         (WebCore::isResponseComingFromNetworkProcess): Deleted.
1938         * loader/LoaderStrategy.cpp:
1939         * loader/LoaderStrategy.h:
1940         * page/Settings.yaml: Remove setting networkProcessCSPFrameAncestorsCheckingEnabled as we now make
1941         use of the loader strategy to determine whether to perform CSP frame-ancestors and X-Frame-Options
1942         checking in DocumentLoader.
1943         * platform/network/ResourceResponseBase.h:
1944         (WebCore::ResourceResponseBase::setSource): Added an ASSERT to catch the programming error of setting
1945         source to ResourceResponse::Source::Unknown. This source type represents an uninitialized ResourceResponse.
1946
1947 2018-05-10  Tim Horton  <timothy_horton@apple.com>
1948
1949         Lookup sometimes shows a second yellow highlight on top of WebKit's TextIndicator
1950         https://bugs.webkit.org/show_bug.cgi?id=185538
1951         <rdar://problem/38817825>
1952
1953         Reviewed by Sam Weinig.
1954
1955         * editing/mac/DictionaryLookup.mm:
1956         (WebCore::showPopupOrCreateAnimationController):
1957         Options can be nil, in which case we can't mutableCopy it and add
1958         LUTermOptionDisableSearchTermIndicator. Instead, create a new dictionary,
1959         and add the items from options, if it's not nil.
1960
1961 2018-05-10  Matt Baker  <mattbaker@apple.com>
1962
1963         Web Inspector: ASSERT_NOT_REACHED in PageDebuggerAgent::didAddEventListener when page adds attribute event listener
1964         https://bugs.webkit.org/show_bug.cgi?id=181580
1965         <rdar://problem/36461309>
1966
1967         Reviewed by Brian Burg.
1968
1969         EventTarget should pass newly added EventListeners to InspectorInstrumentation,
1970         instead of PageDebuggerAgent assuming the last item in the EventListenerVector
1971         is the most recently added listener. This assumption does not hold when
1972         the new listener replaces an existing listener.
1973
1974         * dom/EventTarget.cpp:
1975         (WebCore::EventTarget::addEventListener):
1976         (WebCore::EventTarget::setAttributeEventListener):
1977
1978         * inspector/InspectorInstrumentation.cpp:
1979         (WebCore::InspectorInstrumentation::didAddEventListenerImpl):
1980
1981         * inspector/InspectorInstrumentation.h:
1982         (WebCore::InspectorInstrumentation::didAddEventListener):
1983
1984         * inspector/agents/page/PageDebuggerAgent.cpp:
1985         (WebCore::PageDebuggerAgent::didAddEventListener):
1986         * inspector/agents/page/PageDebuggerAgent.h:
1987
1988 2018-05-10  Chris Dumez  <cdumez@apple.com>
1989
1990         'Cross-Origin-Options header implementation follow-up
1991         https://bugs.webkit.org/show_bug.cgi?id=185520
1992
1993         Reviewed by Ryosuke Niwa.
1994
1995         * dom/Document.cpp:
1996         * dom/Document.h:
1997         * loader/FrameLoader.cpp:
1998         (WebCore::FrameLoader::didBeginDocument):
1999         Using isNull() check is sufficient here as the header parsing
2000         function will do the right thing when passed the empty string.
2001         Also set the options directly on the window instead of the
2002         document. The window is guaranteed to have been constructed
2003         by then because didBeginDocument() is called DocumentWriter::begin()
2004         which calls Document::createDOMWindow() or Document::takeDOMWindowFrom().
2005
2006         * page/AbstractDOMWindow.cpp:
2007         (WebCore::AbstractDOMWindow::AbstractDOMWindow):
2008         * page/AbstractDOMWindow.h:
2009         * page/DOMWindow.cpp:
2010         (WebCore::DOMWindow::DOMWindow):
2011         (WebCore::DOMWindow::didSecureTransitionTo):
2012         * page/RemoteDOMWindow.cpp:
2013         (WebCore::RemoteDOMWindow::RemoteDOMWindow):
2014         * page/RemoteDOMWindow.h:
2015         CrossOriginOptions are now stored only on the Window, not the Document.
2016
2017         * platform/network/HTTPParsers.cpp:
2018         (WebCore::parseCrossOriginOptionsHeader):
2019         Drop strippedHeader local variable as it is not strictly needed.
2020
2021 2018-05-10  Tim Horton  <timothy_horton@apple.com>
2022
2023         Fix the build after r231393
2024         https://bugs.webkit.org/show_bug.cgi?id=185519
2025         <rdar://problem/40131741>
2026
2027         Reviewed by Simon Fraser.
2028
2029         * Configurations/WebCore.xcconfig:
2030
2031 2018-05-10  Eric Carlson  <eric.carlson@apple.com>
2032
2033         Log missing cues correctly
2034         https://bugs.webkit.org/show_bug.cgi?id=185499
2035         <rdar://problem/40113821>
2036
2037         Reviewed by Daniel Bates.
2038
2039         No new tests, tested manually.
2040
2041         * html/track/InbandGenericTextTrack.cpp:
2042         (WebCore::InbandGenericTextTrack::removeGenericCue): Log the cue we searched for, not
2043         the NULL cue.
2044
2045 2018-05-10  Zalan Bujtas  <zalan@apple.com>
2046
2047         [LFC] Implement height computation for non-replaced inflow elements.
2048         https://bugs.webkit.org/show_bug.cgi?id=185474
2049
2050         Reviewed by Antti Koivisto.
2051
2052         Initial implementation. Does not cover all the cases.
2053
2054         * layout/FormattingContext.cpp:
2055         (WebCore::Layout::FormattingContext::computeHeight const):
2056         * layout/FormattingContext.h:
2057         * layout/blockformatting/BlockFormattingContext.cpp:
2058         (WebCore::Layout::BlockFormattingContext::layout const):
2059         (WebCore::Layout::BlockFormattingContext::computeInFlowHeight const):
2060         (WebCore::Layout::BlockFormattingContext::computeInFlowNonReplacedHeight const):
2061         * layout/blockformatting/BlockFormattingContext.h:
2062         * layout/blockformatting/BlockMarginCollapse.cpp:
2063         (WebCore::Layout::collapsedMarginBottomFromLastChild):
2064         (WebCore::Layout::BlockMarginCollapse::isMarginBottomCollapsedWithParent):
2065         (WebCore::Layout::BlockMarginCollapse::isMarginTopCollapsedWithParentMarginBottom):
2066         (WebCore::Layout::isMarginBottomCollapsedWithParent): Deleted.
2067         * layout/blockformatting/BlockMarginCollapse.h:
2068         * layout/inlineformatting/InlineFormattingContext.cpp:
2069         (WebCore::Layout::InlineFormattingContext::computeInFlowHeight const):
2070         * layout/inlineformatting/InlineFormattingContext.h:
2071         * layout/layouttree/LayoutBox.cpp:
2072         (WebCore::Layout::Box::isReplaced const):
2073         * layout/layouttree/LayoutBox.h:
2074
2075 2018-05-10  Thibault Saunier  <tsaunier@igalia.com>
2076
2077         [GTK] Implement ImageBuffer::toBGRAData
2078         https://bugs.webkit.org/show_bug.cgi?id=185511
2079
2080         Reviewed by Michael Catanzaro.
2081
2082         This was never implemented but will be required for the MediaStream API
2083         tests.
2084
2085         * platform/graphics/ImageBuffer.cpp:
2086         (WebCore::ImageBuffer::toBGRAData const):
2087         * platform/graphics/cg/ImageBufferCG.cpp:
2088         (WebCore::ImageBuffer::toBGRAData const):
2089         * platform/graphics/gtk/ImageBufferGtk.cpp:
2090         (WebCore::ImageBuffer::toBGRAData const):
2091
2092 2018-05-10  Yacine Bandou  <yacine.bandou_ext@softathome.com>
2093
2094         [EME][GStreamer] Add a handler for GStreamer protection event
2095         https://bugs.webkit.org/show_bug.cgi?id=185245
2096
2097         Reviewed by Xabier Rodriguez-Calvar.
2098
2099         Qtdemux sends the protection event when encountered a new PSSH box (encrypted content).
2100
2101         The Decryptor is moved from AppendPipeline to PlaybackPipeline (see https://bugs.webkit.org/show_bug.cgi?id=181855),
2102         thus the protection event is no longer handled because the Decryptor is not in the same pipeline as qtdemux.
2103
2104         AppendPipeline: httpsrc-->qtdemux-->appsink
2105         PlaybackPipeline: appsrc-->parser--> decryptor-->decoder-->sink
2106
2107         This patch attaches a probe to the sink pad of the appsink in the appendPipeline in order to
2108         catch and manage the protection event.
2109
2110         * platform/graphics/gstreamer/mse/AppendPipeline.cpp:
2111         (WebCore::AppendPipeline::AppendPipeline):
2112         (WebCore::AppendPipeline::~AppendPipeline):
2113         (WebCore::appendPipelineAppsinkPadEventProbe):
2114         * platform/graphics/gstreamer/mse/AppendPipeline.h:
2115         (WebCore::AppendPipeline::playerPrivate):
2116
2117 2018-05-10  Yacine Bandou  <yacine.bandou_ext@softathome.com>
2118
2119         [EME][GStreamer] Move the decryptor from AppendPipeline to PlaybackPipeline.
2120         https://bugs.webkit.org/show_bug.cgi?id=181855
2121
2122         Reviewed by Xabier Rodriguez-Calvar.
2123
2124         The goal of this move is to handle the limitation of SVP (Secure Video Path) memory size.
2125
2126         When the decryptor is in the AppendPipeline and we use SVP, we buffer in MediaSource queue
2127         the decrypted GstBuffers that are in SVP memory.
2128         This behavior cause an out-of-memory error, because we are limited in SVP memory size.
2129
2130         By moving the decryptor in PlaybackPipeline, we avoid to buffer the decrypted GstBuffers
2131         which use the SVP memory and we buffer the encrypted GstBuffers that are in system memory.
2132
2133         This new architecture also allows to start the buffering before obtaining the DRM license
2134         and it makes easier to manage dynamic change of the license or Key.
2135
2136         The decryptor is auto plugged by GStreamer playbin in PlaybackPipeline.
2137
2138         SVP: Secure Video Path also named trusted or protected video path, it is a memory which is
2139         protected by a hardware access control engine, it is not accessible to other unauthorised
2140         software or hardware components.
2141
2142         Tests:
2143             media/encrypted-media/clearKey/clearKey-cenc-audio-playback-mse.html
2144             media/encrypted-media/clearKey/clearKey-cenc-video-playback-mse.html
2145
2146         * platform/graphics/gstreamer/eme/WebKitCommonEncryptionDecryptorGStreamer.cpp:
2147         (webkitMediaCommonEncryptionDecryptSinkEventHandler):
2148         * platform/graphics/gstreamer/mse/AppendPipeline.cpp:
2149         (WebCore::dumpAppendState):
2150         (WebCore::AppendPipeline::AppendPipeline):
2151         (WebCore::AppendPipeline::handleNeedContextSyncMessage):
2152         (WebCore::AppendPipeline::handleAppsrcNeedDataReceived):
2153         (WebCore::AppendPipeline::setAppendState):
2154         (WebCore::AppendPipeline::parseDemuxerSrcPadCaps):
2155         (WebCore::AppendPipeline::appsinkNewSample):
2156         (WebCore::AppendPipeline::connectDemuxerSrcPadToAppsinkFromAnyThread):
2157         (WebCore::AppendPipeline::disconnectDemuxerSrcPadFromAppsinkFromAnyThread):
2158         (WebCore::appendPipelineElementMessageCallback): Deleted.
2159         (WebCore::AppendPipeline::handleElementMessage): Deleted.
2160         (WebCore::AppendPipeline::dispatchPendingDecryptionStructure): Deleted.
2161         (WebCore::AppendPipeline::dispatchDecryptionStructure): Deleted.
2162         * platform/graphics/gstreamer/mse/AppendPipeline.h:
2163         * platform/graphics/gstreamer/mse/MediaPlayerPrivateGStreamerMSE.cpp:
2164         (WebCore::MediaPlayerPrivateGStreamerMSE::attemptToDecryptWithInstance):
2165         * platform/graphics/gstreamer/mse/PlaybackPipeline.cpp:
2166
2167 2018-05-09  Nan Wang  <n_wang@apple.com>
2168
2169         AX: VoiceOver iframe scrolling focus jumping bug
2170         https://bugs.webkit.org/show_bug.cgi?id=176615
2171         <rdar://problem/34333067>
2172
2173         Reviewed by Chris Fleizach.
2174
2175         Scrolling to make elements visible is not working correctly for elements inside an
2176         offscreen iframe. Fixed it by using RenderLayer::scrollRectToVisible() to handle
2177         scrolling more properly.
2178
2179         Test: accessibility/scroll-to-make-visible-iframe-offscreen.html
2180
2181         * accessibility/AccessibilityObject.cpp:
2182         (WebCore::AccessibilityObject::scrollToMakeVisible const):
2183
2184 2018-05-09  Joanmarie Diggs  <jdiggs@igalia.com>
2185
2186         AX: accessibleNameForNode should simplify whitespace when using innerText
2187         https://bugs.webkit.org/show_bug.cgi?id=185498
2188
2189         Reviewed by Chris Fleizach.
2190
2191         Test: accessibility/text-alternative-calculation-from-unrendered-table.html
2192
2193         Call simplifyWhiteSpace() before returning the innerText value.
2194
2195         * accessibility/AccessibilityNodeObject.cpp:
2196         (WebCore::accessibleNameForNode):
2197
2198 2018-05-09  Chris Dumez  <cdumez@apple.com>
2199
2200         Add initial support for 'Cross-Origin-Options' HTTP response header
2201         https://bugs.webkit.org/show_bug.cgi?id=184996
2202         <rdar://problem/39664620>
2203
2204         Reviewed by Geoff Garen.
2205
2206         Add initial support for 'Cross-Origin-Options' HTTP response header behind an experimental
2207         feature flag, on by default. When the HTTP server services this HTTP response header for a
2208         main resource, we'll set these options on the corresponding Document. This will impact the
2209         behavior of the Document's associated Window API when cross-origin.
2210
2211         The HTTP header has 3 possible values:
2212         - allow: This is the default. Regular cross-origin Window API is available.
2213         - allow-postmessage: Only postMessage() is available on a cross-origin window, trying to
2214           access anything else will throw a SecurityError.
2215         - deny: Trying to do anything with a cross-origin window will throw a SecurityError.
2216
2217         The header has no effect when accessing same origin windows.
2218
2219         Note that on cross-origin access from Window A to Window B, we check the cross-origin
2220         options for both Window A and Window B and use the lowest common denominator as effective
2221         cross-origin options for the access. So if Window A has 'Cross-Origin-Options: deny' and
2222         tries to call postMessage() on Window B which has 'Cross-Origin-Options: allow-postmessage',
2223         we will throw a SecurityError. This is because Window A's more restrictive options (deny)
2224         apply.
2225
2226         Tests: http/wpt/cross-origin-options/allow-postmessage-from-deny.html
2227                http/wpt/cross-origin-options/allow-postmessage.html
2228                http/wpt/cross-origin-options/cross-origin-options-header.html
2229
2230         * bindings/js/JSDOMBindingSecurity.cpp:
2231         (WebCore::BindingSecurity::shouldAllowAccessToDOMWindowGivenMinimumCrossOriginOptions):
2232         * bindings/js/JSDOMBindingSecurity.h:
2233         * bindings/js/JSDOMWindowCustom.cpp:
2234         (WebCore::effectiveCrossOriginOptionsForAccess):
2235         (WebCore::jsDOMWindowGetOwnPropertySlotRestrictedAccess):
2236         (WebCore::JSDOMWindow::getOwnPropertySlot):
2237         (WebCore::JSDOMWindow::getOwnPropertySlotByIndex):
2238         (WebCore::addCrossOriginWindowPropertyNames):
2239         (WebCore::addScopedChildrenIndexes):
2240         (WebCore::addCrossOriginWindowOwnPropertyNames):
2241         (WebCore::JSDOMWindow::getOwnPropertyNames):
2242         * bindings/js/JSDOMWindowCustom.h:
2243         * bindings/js/JSRemoteDOMWindowCustom.cpp:
2244         (WebCore::JSRemoteDOMWindow::getOwnPropertySlot):
2245         (WebCore::JSRemoteDOMWindow::getOwnPropertySlotByIndex):
2246         (WebCore::JSRemoteDOMWindow::getOwnPropertyNames):
2247         * bindings/scripts/CodeGeneratorJS.pm:
2248         (GenerateAttributeGetterBodyDefinition):
2249         (GetCrossOriginsOptionsFromExtendedAttributeValue):
2250         (GenerateAttributeSetterBodyDefinition):
2251         (GenerateOperationBodyDefinition):
2252         * bindings/scripts/IDLAttributes.json:
2253         * dom/Document.cpp:
2254         (WebCore::Document::setCrossOriginOptions):
2255         * dom/Document.h:
2256         (WebCore::Document::crossOriginOptions const):
2257         * loader/FrameLoader.cpp:
2258         (WebCore::FrameLoader::didBeginDocument):
2259         * page/AbstractDOMWindow.cpp:
2260         (WebCore::AbstractDOMWindow::AbstractDOMWindow):
2261         * page/AbstractDOMWindow.h:
2262         (WebCore::AbstractDOMWindow::crossOriginOptions):
2263         (WebCore::AbstractDOMWindow::setCrossOriginOptions):
2264         * page/DOMWindow.cpp:
2265         (WebCore::DOMWindow::DOMWindow):
2266         (WebCore::DOMWindow::didSecureTransitionTo):
2267         * page/DOMWindow.idl:
2268         * page/Frame.h:
2269         * page/RemoteDOMWindow.cpp:
2270         (WebCore::RemoteDOMWindow::RemoteDOMWindow):
2271         * page/RemoteDOMWindow.h:
2272         * page/Settings.yaml:
2273         * platform/network/HTTPHeaderNames.in:
2274         * platform/network/HTTPParsers.cpp:
2275         (WebCore::parseCrossOriginOptionsHeader):
2276         * platform/network/HTTPParsers.h:
2277
2278 2018-05-09  Ryosuke Niwa  <rniwa@webkit.org>
2279
2280         Release assert in TreeScopeOrderedMap::remove via HTMLImageElement::removedFromAncestor
2281         https://bugs.webkit.org/show_bug.cgi?id=185493
2282
2283         Reviewed by Brent Fulgham.
2284
2285         Fixed the bug that HTMLImageElement::removedFromAncestor and HTMLMapElement::removedFromAncestor
2286         were calling removeImageElementByUsemap on the document instead of the shadow tree from which it was removed.
2287
2288         Test: fast/images/imagemap-in-shadow-tree-removed.html
2289
2290         * html/HTMLImageElement.cpp:
2291         (WebCore::HTMLImageElement::removedFromAncestor):
2292         * html/HTMLMapElement.cpp:
2293         (WebCore::HTMLMapElement::removedFromAncestor):
2294
2295 2018-05-09  Joanmarie Diggs  <jdiggs@igalia.com>
2296
2297         AX: Hidden nodes which are not directly referenced should not participate name/description from content
2298         https://bugs.webkit.org/show_bug.cgi?id=185478
2299
2300         Reviewed by Chris Fleizach.
2301
2302         Add a check to AccessibilityNodeObject::textUnderElement() and return early
2303         if the node is hidden, not referenced by aria-labelledby or aria-describedby,
2304         not an HTMLLabelElement, and not fallback content for an HTMLCanvasElement.
2305
2306         Test: accessibility/text-alternative-calculation-hidden-nodes.html
2307
2308         * accessibility/AccessibilityNodeObject.cpp:
2309         (WebCore::AccessibilityNodeObject::textUnderElement const):
2310
2311 2018-05-09  Eric Carlson  <eric.carlson@apple.com>
2312
2313         Update MediaSession to use release logging
2314         https://bugs.webkit.org/show_bug.cgi?id=185376
2315         <rdar://problem/40022203>
2316
2317         Reviewed by Youenn Fablet.
2318
2319         No new tests, tested manually.
2320
2321         * Modules/mediastream/MediaStream.h: hostingDocument() doesn't need to return a const Document.
2322         * Modules/webaudio/AudioContext.cpp:
2323         (WebCore::AudioContext::hostingDocument const): Ditto.
2324         * Modules/webaudio/AudioContext.h:
2325
2326         * html/HTMLMediaElement.h: Ditto.
2327
2328         * html/MediaElementSession.cpp:
2329         (WebCore::MediaElementSession::MediaElementSession):
2330         (WebCore::MediaElementSession::addBehaviorRestriction):
2331         (WebCore::MediaElementSession::removeBehaviorRestriction):
2332         (WebCore::MediaElementSession::dataLoadingPermitted const):
2333         (WebCore::MediaElementSession::fullscreenPermitted const):
2334         (WebCore::MediaElementSession::pageAllowsDataLoading const):
2335         (WebCore::MediaElementSession::pageAllowsPlaybackAfterResuming const):
2336         (WebCore::MediaElementSession::canShowControlsManager const):
2337         (WebCore::MediaElementSession::showPlaybackTargetPicker):
2338         (WebCore::MediaElementSession::hasWirelessPlaybackTargets const):
2339         (WebCore::MediaElementSession::wirelessVideoPlaybackDisabled const):
2340         (WebCore::MediaElementSession::setWirelessVideoPlaybackDisabled):
2341         (WebCore::MediaElementSession::setHasPlaybackTargetAvailabilityListeners):
2342         (WebCore::MediaElementSession::externalOutputDeviceAvailableDidChange):
2343         (WebCore::MediaElementSession::setShouldPlayToPlaybackTarget):
2344         (WebCore::MediaElementSession::mediaEngineUpdated):
2345         (WebCore::MediaElementSession::willLog const): Deleted.
2346         (WebCore::MediaElementSession::logger const): Deleted.
2347         (WebCore::MediaElementSession::logIdentifier const): Deleted.
2348         (WebCore::MediaElementSession::logChannel const): Deleted.
2349         * html/MediaElementSession.h:
2350
2351         * platform/audio/PlatformMediaSession.cpp:
2352         (WebCore::nextLogIdentifier):
2353         (WebCore::convertEnumerationToString):
2354         (WebCore::PlatformMediaSession::PlatformMediaSession):
2355         (WebCore::PlatformMediaSession::setState):
2356         (WebCore::PlatformMediaSession::beginInterruption):
2357         (WebCore::PlatformMediaSession::endInterruption):
2358         (WebCore::PlatformMediaSession::clientWillBeginAutoplaying):
2359         (WebCore::PlatformMediaSession::clientWillPausePlayback):
2360         (WebCore::PlatformMediaSession::pauseSession):
2361         (WebCore::PlatformMediaSession::stopSession):
2362         (WebCore::PlatformMediaSession::clientDataBufferingTimerFired):
2363         (WebCore::PlatformMediaSession::logChannel const):
2364         (WebCore::stateName): Deleted.
2365         (WebCore::interruptionName): Deleted.
2366         * platform/audio/PlatformMediaSession.h:
2367         (WTF::LogArgument<WebCore::PlatformMediaSession::State>::toString):
2368         (WTF::LogArgument<WebCore::PlatformMediaSession::InterruptionType>::toString):
2369
2370 2018-05-09  Thibault Saunier  <tsaunier@igalia.com>
2371
2372         [GStreamer] Never call updateTracks if running on legacy pipeline
2373         https://bugs.webkit.org/show_bug.cgi?id=184581
2374
2375         This makes sure failling code path is never reached in the conditions where it should not have been reached.
2376
2377         Reviewed by Philippe Normand.
2378
2379         Re enables all tests that were disabled after fixing.
2380
2381         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:
2382         (WebCore::MediaPlayerPrivateGStreamer::handleMessage):
2383
2384 2018-05-09  Daniel Bates  <dabates@apple.com>
2385
2386         REGRESSION (r231479): http/tests/appcache/x-frame-options-prevents-framing.php is timing out
2387         https://bugs.webkit.org/show_bug.cgi?id=185443
2388         <rdar://problem/40100660>
2389
2390         Reviewed by Andy Estes.
2391
2392         Following r231479 when using WebKit2 and Restricted HTTP Response Access is enabled (enabled in
2393         WebKitTestRunner) we only check the CSP frame-ancestors directive and X-Frame-Options in
2394         NetworkProcess. We need to check these security requirements in WebContent process whenever
2395         we are performing a substitute data load, such as for app cache, as these loads do not go
2396         through NetworkProcess.
2397
2398         * loader/DocumentLoader.cpp:
2399         (WebCore::DocumentLoader::responseReceived):
2400
2401 2018-05-09  Justin Fan  <justin_fan@apple.com>
2402
2403         Hooked up ASTC support in WebGL; requires OpenGL ES 3 context to work. 
2404         https://bugs.webkit.org/show_bug.cgi?id=185272
2405         <rdar://problem/15745737>
2406
2407         Reviewed by Dean Jackson.
2408
2409         Also added in Khronos' ASTC test from version 1.0.4 beta of their conformance test suite,
2410         although again, this requires OpenGL ES 3 context for WebKit to detect proper support.
2411
2412         Test: fast/canvas/webgl/webgl-compressed-texture-astc.html
2413
2414         * DerivedSources.make:
2415         * Sources.txt:
2416         * WebCore.xcodeproj/project.pbxproj:
2417         * bindings/js/JSDOMConvertWebGL.cpp:
2418         (WebCore::convertToJSValue):
2419         * html/canvas/WebGL2RenderingContext.cpp:
2420         (WebCore::WebGL2RenderingContext::getExtension):
2421         (WebCore::WebGL2RenderingContext::getSupportedExtensions):
2422         * html/canvas/WebGLCompressedTextureASTC.cpp: Added.
2423         (WebCore::WebGLCompressedTextureASTC::WebGLCompressedTextureASTC):
2424         (WebCore::WebGLCompressedTextureASTC::getName const):
2425         (WebCore::WebGLCompressedTextureASTC::supported):
2426         (WebCore::WebGLCompressedTextureASTC::getSupportedProfiles):
2427         * html/canvas/WebGLCompressedTextureASTC.h: Added.
2428         * html/canvas/WebGLCompressedTextureASTC.idl: Added.
2429         * html/canvas/WebGLExtension.h:
2430         * html/canvas/WebGLRenderingContext.cpp:
2431         (WebCore::WebGLRenderingContext::getExtension):
2432         (WebCore::WebGLRenderingContext::getSupportedExtensions):
2433         * html/canvas/WebGLRenderingContextBase.cpp:
2434         (WebCore::WebGLRenderingContextBase::validateCompressedTexFuncData):
2435         (WebCore::WebGLRenderingContextBase::validateCompressedTexDimensions):
2436         * html/canvas/WebGLRenderingContextBase.h:
2437         * platform/graphics/Extensions3D.h:
2438
2439 2018-05-09  Youenn Fablet  <youenn@apple.com>
2440
2441         Allow WebResourceLoader to cancel a load served from a service worker
2442         https://bugs.webkit.org/show_bug.cgi?id=185274
2443
2444         Reviewed by Chris Dumez.
2445
2446         Add support for cancelling a fetch from WebProcess to service worker process.
2447         Use FetchIdentifier instead of uint64_t.
2448
2449         * Modules/fetch/FetchIdentifier.h: Added.
2450         * WebCore.xcodeproj/project.pbxproj:
2451         * workers/service/context/ServiceWorkerFetch.h:
2452         * workers/service/context/ServiceWorkerThreadProxy.cpp:
2453         (WebCore::ServiceWorkerThreadProxy::startFetch):
2454         (WebCore::ServiceWorkerThreadProxy::cancelFetch):
2455         * workers/service/context/ServiceWorkerThreadProxy.h:
2456
2457 2018-05-09  Thibault Saunier  <tsaunier@igalia.com>
2458
2459         [GStreamer] Fix style issue in MediaPlayerPrivateGStreamer
2460         https://bugs.webkit.org/show_bug.cgi?id=185479
2461
2462         Reviewed by Philippe Normand.
2463
2464         ERROR: Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:114:  Multi line control clauses should use braces.  [whitespace/braces] [4]
2465         ERROR: Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:194:  Multi line control clauses should use braces.  [whitespace/braces] [4]
2466         ERROR: Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:398:  One line control clauses should not use braces.  [whitespace/braces] [4]
2467         ERROR: Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:440:  One line control clauses should not use braces.  [whitespace/braces] [4]
2468         ERROR: Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:806:  More than one command on the same line  [whitespace/newline] [4]
2469         ERROR: Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:869:  More than one command on the same line  [whitespace/newline] [4]
2470         ERROR: Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:880:  More than one command on the same line  [whitespace/newline] [4]
2471         ERROR: Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:940:  More than one command on the same line  [whitespace/newline] [4]
2472         ERROR: Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:1102:  Multi line control clauses should use braces.  [whitespace/braces] [4]
2473         ERROR: Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:1109:  Multi line control clauses should use braces.  [whitespace/braces] [4]
2474
2475         Indentation and style issue fixed only.
2476
2477         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:
2478         (WebCore::MediaPlayerPrivateGStreamer::registerMediaEngine):
2479         (WebCore::MediaPlayerPrivateGStreamer::~MediaPlayerPrivateGStreamer):
2480         (WebCore::MediaPlayerPrivateGStreamer::changePipelineState):
2481         (WebCore::MediaPlayerPrivateGStreamer::play):
2482         (WebCore::MediaPlayerPrivateGStreamer::videoChangedCallback):
2483         (WebCore::MediaPlayerPrivateGStreamer::videoSinkCapsChangedCallback):
2484         (WebCore::MediaPlayerPrivateGStreamer::audioChangedCallback):
2485         (WebCore::MediaPlayerPrivateGStreamer::textChangedCallback):
2486         (WebCore::MediaPlayerPrivateGStreamer::buffered const):
2487         (WebCore::MediaPlayerPrivateGStreamer::loadNextLocation):
2488
2489 2018-05-09  Daniel Bates  <dabates@apple.com>
2490
2491         REGRESSION (r231479): com.apple.WebCore crash in WebCore::DocumentLoader::stopLoadingAfterXFrameOptionsOrContentSecurityPolicyDenied()
2492         https://bugs.webkit.org/show_bug.cgi?id=185475
2493         <rdar://problem/40093853>
2494
2495         Reviewed by Andy Estes.
2496
2497         DocumentLoader::stopLoadingAfterXFrameOptionsOrContentSecurityPolicyDenied() must extends its lifetime
2498         until completion as dispatching a DOM load event at the associated frame can cause JavaScript execution
2499         that can do anything, including destroying the loader that dispatched the event.
2500
2501         Following r231479 DocumentLoader::stopLoadingAfterXFrameOptionsOrContentSecurityPolicyDenied() is now
2502         invoked by both DocumentLoader::responseReceived() and WebResourceLoader::stopLoadingAfterXFrameOptionsOrContentSecurityPolicyDenied().
2503         The latter only can happen when using WebKit2 and the experimental feature Restricted HTTP Response Access
2504         is enabled (RuntimeEnabledFeatures::sharedFeatures().restrictedHTTPResponseAccess()). Unlike DocumentLoader::responseReceived()
2505         WebResourceLoader::stopLoadingAfterXFrameOptionsOrContentSecurityPolicyDenied() does not take out a ref
2506         on the DocumentLoader before invoking DocumentLoader::stopLoadingAfterXFrameOptionsOrContentSecurityPolicyDenied().
2507         Therefore, DocumentLoader::stopLoadingAfterXFrameOptionsOrContentSecurityPolicyDenied() can cause its
2508         own destruction as a result of dispatching a DOM load event at the frame. We should take out a ref on
2509         the DocumentLoader when executing DocumentLoader::stopLoadingAfterXFrameOptionsOrContentSecurityPolicyDenied().
2510
2511         * loader/DocumentLoader.cpp:
2512         (WebCore::DocumentLoader::stopLoadingAfterXFrameOptionsOrContentSecurityPolicyDenied):
2513
2514 2018-05-09  Tim Horton  <timothy_horton@apple.com>
2515
2516         Fix the build by ignoring some deprecation warnings
2517
2518         * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
2519         (WebCore::MediaPlayerPrivateAVFoundationObjC::setShouldDisableSleep):
2520
2521 2018-05-09  Michael Catanzaro  <mcatanzaro@igalia.com>
2522
2523         [WPE] Build cleanly with GCC 8 and ICU 60
2524         https://bugs.webkit.org/show_bug.cgi?id=185462
2525
2526         Reviewed by Carlos Alberto Lopez Perez.
2527
2528         * PlatformGTK.cmake: Include directories are in the wrong place.
2529         * accessibility/AXObjectCache.cpp: Silence -Wclass-memaccess problems and leave warnings.
2530         (WebCore::AXObjectCache::startOrEndTextMarkerDataForRange):
2531         (WebCore::AXObjectCache::textMarkerDataForCharacterOffset):
2532         (WebCore::AXObjectCache::textMarkerDataForVisiblePosition):
2533         (WebCore::AXObjectCache::textMarkerDataForFirstPositionInTextControl):
2534         * css/CSSFontFace.cpp: Silence -Wfallthrough
2535         (WebCore::CSSFontFace::fontLoadTiming const):
2536         * css/CSSSelectorList.cpp: Silence -Wclass-memaccess, this one is intentional.
2537         (WebCore::CSSSelectorList::adoptSelectorVector):
2538         * editing/TextIterator.cpp: Silence ICU deprecation warnings.
2539         * platform/Length.h:
2540         (WebCore::Length::operator=): More -Wclass-memaccess, looks benign.
2541         * platform/graphics/Gradient.cpp:
2542         (WebCore::Gradient::hash const): -Wclass-memaccess again. Leave a warning.
2543         * platform/graphics/SurrogatePairAwareTextIterator.cpp: Silence ICU deprecation warnings.
2544         * platform/graphics/cairo/FontCairoHarfbuzzNG.cpp:
2545         (WebCore::FontCascade::fontForCombiningCharacterSequence const): Silence ICU deprecation.
2546         * platform/graphics/freetype/FontCustomPlatformDataFreeType.cpp:
2547         (WebCore::FontCustomPlatformData::FontCustomPlatformData): Silence -Wcast-function-type.
2548         * platform/graphics/freetype/SimpleFontDataFreeType.cpp:
2549         (WebCore::Font::canRenderCombiningCharacterSequence const): Silence ICU deprecation.
2550         * platform/graphics/gstreamer/GstAllocatorFastMalloc.cpp:
2551         (gstAllocatorFastMallocMemUnmap): Fix -Wcast-function-type.
2552         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:
2553         (WebCore::MediaPlayerPrivateGStreamer::updateTracks): Fix bad printf.
2554         (WebCore::MediaPlayerPrivateGStreamer::enableTrack): Another bad printf.
2555         (WebCore::findHLSQueue): Fix -Wcast-function-type.
2556         * platform/graphics/gstreamer/eme/WebKitClearKeyDecryptorGStreamer.cpp:
2557         (webKitMediaClearKeyDecryptorDecrypt): Fix another bad printf.
2558         * platform/network/soup/SocketStreamHandleImplSoup.cpp: Silence -Wcast-function-type.
2559         (WebCore::SocketStreamHandleImpl::beginWaitingForSocketWritability):
2560         * platform/text/TextEncoding.cpp: Silence ICU deprecration.
2561
2562 2018-05-08  Simon Fraser  <simon.fraser@apple.com>
2563
2564         SVG lighting colors need to be converted into linearSRGB
2565         https://bugs.webkit.org/show_bug.cgi?id=181196
2566
2567         Reviewed by Darin Adler.
2568
2569         Address post-commit comments. Don't make a Color that contains linearRGB components,
2570         but use FloatComponents instead. Since these FloatComponents are in the 0-1 range,
2571         FELighting::setPixelInternal() needs to multiply by 255 since the output pixels are
2572         8-bit 0-255.
2573         
2574         Change linearToSRGBColorComponent() and sRGBToLinearColorComponent() to do math in
2575         floats without promoting to doubles.
2576
2577         * platform/graphics/ColorUtilities.cpp:
2578         (WebCore::FloatComponents::FloatComponents):
2579         (WebCore::linearToSRGBColorComponent):
2580         (WebCore::sRGBToLinearColorComponent):
2581         (WebCore::sRGBColorToLinearComponents):
2582         (WebCore::linearToSRGBColor): Deleted.
2583         (WebCore::sRGBToLinearColor): Deleted.
2584         * platform/graphics/ColorUtilities.h:
2585         * platform/graphics/filters/FELighting.cpp:
2586         (WebCore::FELighting::setPixelInternal):
2587         (WebCore::FELighting::drawLighting):
2588
2589 2018-05-09  Timothy Hatcher  <timothy@apple.com>
2590
2591         Use StyleColor::Options in more places.
2592
2593         https://bugs.webkit.org/show_bug.cgi?id=185458
2594         rdar://problem/39853798
2595
2596         Add UseDefaultAppearance to StyleColor::Options, to avoid passing yet another
2597         boolean on some of these functions.
2598
2599         Reviewed by Tim Horton.
2600
2601         * css/MediaQueryEvaluator.cpp:
2602         * css/StyleColor.h:
2603         * dom/Document.cpp:
2604         (WebCore::Document::useDefaultAppearance const):
2605         (WebCore::Document::styleColorOptions const):
2606         * dom/Document.h:
2607         * platform/Theme.cpp:
2608         (WebCore::Theme::paint):
2609         * platform/Theme.h:
2610         * platform/mac/LocalDefaultSystemAppearance.h:
2611         * platform/mac/LocalDefaultSystemAppearance.mm:
2612         (WebCore::LocalDefaultSystemAppearance::LocalDefaultSystemAppearance):
2613         (WebCore::LocalDefaultSystemAppearance::~LocalDefaultSystemAppearance):
2614         * platform/mac/ThemeMac.h:
2615         * platform/mac/ThemeMac.mm:
2616         (WebCore::paintToggleButton):
2617         (WebCore::paintButton):
2618         (WebCore::ThemeMac::ensuredView):
2619         (WebCore::ThemeMac::drawCellOrFocusRingWithViewIntoContext):
2620         (WebCore::ThemeMac::paint):
2621         (-[WebCoreThemeView initWithUseSystemAppearance:]): Deleted.
2622         * platform/wpe/ThemeWPE.cpp:
2623         (WebCore::ThemeWPE::paint):
2624         * platform/wpe/ThemeWPE.h:
2625         * rendering/RenderListBox.cpp:
2626         (WebCore::RenderListBox::paintItemBackground):
2627         * rendering/RenderTheme.cpp:
2628         (WebCore::RenderTheme::paint):
2629         (WebCore::RenderTheme::inactiveListBoxSelectionBackgroundColor const):
2630         (WebCore::RenderTheme::platformInactiveListBoxSelectionBackgroundColor const):
2631         * rendering/RenderTheme.h:
2632         * rendering/RenderThemeGtk.cpp:
2633         (WebCore::RenderThemeGtk::platformInactiveListBoxSelectionBackgroundColor const):
2634         * rendering/RenderThemeGtk.h:
2635         * rendering/RenderThemeMac.h:
2636         * rendering/RenderThemeMac.mm:
2637         (WebCore::RenderThemeMac::documentViewFor const):
2638         (WebCore::RenderThemeMac::platformInactiveListBoxSelectionBackgroundColor const):
2639         (WebCore::RenderThemeMac::systemColor const):
2640         (WebCore::RenderThemeMac::paintCellAndSetFocusedElementNeedsRepaintIfNecessary):
2641         (WebCore::RenderThemeMac::paintSliderThumb):
2642
2643 2018-05-09  Yacine Bandou  <yacine.bandou_ext@softathome.com>
2644
2645         [EME][GStreamer] Crash when the mediaKeys are created before loading the media in debug conf
2646         https://bugs.webkit.org/show_bug.cgi?id=185244
2647
2648         Reviewed by Xabier Rodriguez-Calvar.
2649
2650         The function "MediaPlayerPrivateGStreamerBase::cdmInstanceAttached" is expected to be called once,
2651         so there is an ASSERT(!m_cdmInstance).
2652         But when the MediaKeys are created before loading the media, the cdminstance is created and attached
2653         to the MediaPlayerPrivate via "MediaPlayerPrivateGStreamerBase::cdmInstanceAttached" before loading
2654         the media, then when the media is loading, the function "MediaPlayerPrivateGStreamerBase::cdmInstanceAttached"
2655         will be called several times via the function "mediaEngineWasUpdated" wich is called for each change
2656         in the MediaElement state, thus the WebProcess crashes in the ASSERT(!m_cdmInstance).
2657
2658         This commit avoid the crash by replacing the assert with a simple check.
2659
2660         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp:
2661         (WebCore::MediaPlayerPrivateGStreamerBase::cdmInstanceAttached):
2662         (WebCore::MediaPlayerPrivateGStreamerBase::cdmInstanceDetached):
2663
2664 2018-05-09  Antti Koivisto  <antti@apple.com>
2665
2666         Add OptionSet::operator& and operator bool
2667         https://bugs.webkit.org/show_bug.cgi?id=185306
2668
2669         Reviewed by Anders Carlsson.
2670
2671         Use it in a few places.
2672
2673         * loader/FrameLoader.cpp:
2674         (WebCore::FrameLoader::reload):
2675         * rendering/RenderLayerCompositor.cpp:
2676         (WebCore::RenderLayerCompositor::logReasonsForCompositing):
2677         (WebCore::RenderLayerCompositor::updateScrollCoordinatedLayer):
2678
2679 2018-05-08  Dean Jackson  <dino@apple.com>
2680
2681         Disable system preview link fetching
2682         https://bugs.webkit.org/show_bug.cgi?id=185463
2683
2684         Reviewed by Jon Lee.
2685
2686         Temporarily disable system preview detection when a link
2687         is clicked.
2688
2689         * html/HTMLAnchorElement.cpp:
2690         (WebCore::HTMLAnchorElement::handleClick):
2691
2692 2018-05-08  Wenson Hsieh  <wenson_hsieh@apple.com>
2693
2694         Unreviewed, fix the internal iOS build
2695
2696         Add a missing import statement in an implementation file.
2697
2698         * editing/cocoa/WebContentReaderCocoa.mm:
2699
2700 2018-05-08  Ryan Haddad  <ryanhaddad@apple.com>
2701
2702         Unreviewed, rolling out r231486.
2703
2704         Caused service worker LayoutTest failures on macOS Debug WK2.
2705
2706         Reverted changeset:
2707
2708         "Allow WebResourceLoader to cancel a load served from a
2709         service worker"
2710         https://bugs.webkit.org/show_bug.cgi?id=185274
2711         https://trac.webkit.org/changeset/231486
2712
2713 2018-05-08  Wenson Hsieh  <wenson_hsieh@apple.com>
2714
2715         Consolidate WebContentReaderIOS and WebContentReaderMac into WebContentReaderCocoa
2716         https://bugs.webkit.org/show_bug.cgi?id=185340
2717
2718         Reviewed by Tim Horton.
2719
2720         WebContentReader::readURL is currently the only method implemented separately in iOS and macOS platform
2721         WebContentReader files. The implementation across macOS and iOS is nearly identical (with some exceptions with
2722         the way iOS handles file URLs and plain text editing), so we can merge these into a single method
2723         WebContentReaderCocoa and delete WebContentReaderIOS and WebContentReaderMac.
2724
2725         This also has the added bonus of fixing a latent bug in WebContentReaderMac, wherein URLs written to the
2726         pasteboard using -[NSPasteboard writeObjects:] are currently pasted as empty anchor elements. In this case, the
2727         link title isn't made explicit, so the `title` passed in to WebContentReader::readURL is empty. On iOS, we have
2728         code to fall back to pasting the absolute string of the URL if the title is empty, but on macOS, we'll just use
2729         this empty string as the title of the anchor.
2730
2731         Test: PasteMixedContent.PasteURLWrittenToPasteboardUsingWriteObjects
2732
2733         * SourcesCocoa.txt:
2734         * WebCore.xcodeproj/project.pbxproj:
2735         * editing/cocoa/WebContentReaderCocoa.mm:
2736         (WebCore::WebContentReader::readURL):
2737         * editing/ios/WebContentReaderIOS.mm: Removed.
2738         * editing/mac/WebContentReaderMac.mm: Removed.
2739
2740 2018-05-08  Zalan Bujtas  <zalan@apple.com>
2741
2742         [Simple line layout] Cache run resolver.
2743         https://bugs.webkit.org/show_bug.cgi?id=185411
2744
2745         Reviewed by Antti Koivisto.
2746
2747         This patch caches the run resolver on the [SimpleLine]Layout object. 
2748         In certain cases, when the block container has thousands of elements (foobar1<br>foobar2<br>.....foobar9999<br>),
2749         constructing the resolver (and its dependencies) in a repeating fashion could hang the WebProcess.
2750
2751         Covered by existing tests.
2752
2753         * rendering/SimpleLineLayout.cpp:
2754         (WebCore::SimpleLineLayout::create):
2755         (WebCore::SimpleLineLayout::Layout::create):
2756         (WebCore::SimpleLineLayout::Layout::Layout):
2757         * rendering/SimpleLineLayout.h:
2758         (WebCore::SimpleLineLayout::Layout::runResolver const):
2759         * rendering/SimpleLineLayoutFunctions.cpp:
2760         (WebCore::SimpleLineLayout::paintFlow):
2761         (WebCore::SimpleLineLayout::hitTestFlow):
2762         (WebCore::SimpleLineLayout::collectFlowOverflow):
2763         (WebCore::SimpleLineLayout::computeBoundingBox):
2764         (WebCore::SimpleLineLayout::computeFirstRunLocation):
2765         (WebCore::SimpleLineLayout::collectAbsoluteRects):
2766         (WebCore::SimpleLineLayout::collectAbsoluteQuads):
2767         (WebCore::SimpleLineLayout::textOffsetForPoint):
2768         (WebCore::SimpleLineLayout::collectAbsoluteQuadsForRange):
2769         (WebCore::SimpleLineLayout::generateLineBoxTree):
2770         * rendering/SimpleLineLayoutResolver.cpp:
2771         (WebCore::SimpleLineLayout::LineResolver::LineResolver):
2772         * rendering/SimpleLineLayoutResolver.h:
2773         (WebCore::SimpleLineLayout::lineResolver):
2774
2775 2018-05-08  Brent Fulgham  <bfulgham@apple.com>
2776
2777         Switch some RELEASE_ASSERTS to plain debug ASSERTS in PlatformScreenMac.mm
2778         https://bugs.webkit.org/show_bug.cgi?id=185451
2779         <rdar://problem/39620348>
2780
2781         Reviewed by Zalan Bujtas.
2782
2783         Change a set of RELEASE_ASSERTS used to prevent accessing NSScreen related functions in the
2784         PlatformScreenMac implementation to less expensive Debug ASSERTS.
2785
2786         No change in behavior.
2787
2788         * platform/mac/PlatformScreenMac.mm:
2789         (WebCore::screenHasInvertedColors):
2790         (WebCore::screenDepth):
2791         (WebCore::screenDepthPerComponent):
2792         (WebCore::screenRectForDisplay):
2793         (WebCore::screenRect):
2794         (WebCore::screenAvailableRect):
2795         (WebCore::screenColorSpace):
2796         (WebCore::screenSupportsExtendedColor):
2797
2798 2018-05-08  Daniel Bates  <dabates@apple.com>
2799
2800         Resign Strong Password appearance when text field value changes
2801         https://bugs.webkit.org/show_bug.cgi?id=185433
2802         <rdar://problem/39958508>
2803
2804         Reviewed by Ryosuke Niwa.
2805
2806         Remove the Strong Password decoration when the text field's value changes to avoid interfering
2807         with web sites that allow a person to clear the password field.
2808
2809         Tests: fast/forms/auto-fill-button/auto-fill-strong-password-button-when-maxlength-changes.html
2810                fast/forms/auto-fill-button/auto-fill-strong-password-button-when-minlength-changes.html
2811                fast/forms/auto-fill-button/hide-auto-fill-strong-password-button-when-value-changes.html
2812
2813         * html/HTMLInputElement.cpp:
2814         (WebCore::HTMLInputElement::resignStrongPasswordAppearance): Extracted from HTMLInputElement::updateType().
2815         (WebCore::HTMLInputElement::updateType): Extract out logic to resign the Strong Password appearance
2816         into a function that can be shared by this function and HTMLInputElement::setValue().
2817         (WebCore::HTMLInputElement::setValue): Resign the Strong Password appearance if this field was
2818         changed programmatically (i.e. no DOM change event was dispatched).
2819         * html/HTMLInputElement.h:
2820
2821 2018-05-08  Jer Noble  <jer.noble@apple.com>
2822
2823         Unreviewed build fix; add missing function definition.
2824
2825         * html/HTMLMediaElement.h:
2826         (WebCore::HTMLMediaElement::didPassCORSAccessCheck const):
2827
2828 2018-05-08  Jer Noble  <jer.noble@apple.com>
2829
2830         Mute MediaElementSourceNode when tainted.
2831         https://bugs.webkit.org/show_bug.cgi?id=184866
2832
2833         Reviewed by Eric Carlson.
2834
2835         Test: http/tests/security/webaudio-render-remote-audio-blocked-no-crossorigin.html
2836
2837         * Modules/webaudio/AudioContext.cpp:
2838         (WebCore::AudioContext::wouldTaintOrigin const):
2839         * Modules/webaudio/AudioContext.h:
2840         * Modules/webaudio/MediaElementAudioSourceNode.cpp:
2841         (WebCore::MediaElementAudioSourceNode::setFormat):
2842         (WebCore::MediaElementAudioSourceNode::wouldTaintOrigin):
2843         (WebCore::MediaElementAudioSourceNode::process):
2844         * Modules/webaudio/MediaElementAudioSourceNode.h:
2845
2846 2018-05-08  Eric Carlson  <eric.carlson@apple.com>
2847
2848         Log rtcstats as JSON
2849         https://bugs.webkit.org/show_bug.cgi?id=185437
2850         <rdar://problem/40065332>
2851
2852         Reviewed by Youenn Fablet.
2853
2854         * Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.cpp:
2855         (WebCore::RTCStatsLogger::RTCStatsLogger): Create a wrapper class so we don't have to add a
2856         toJSONString method to libwebrtc.
2857         (WebCore::RTCStatsLogger::toJSONString const): Log stats as JSON.
2858         (WebCore::LibWebRTCMediaEndpoint::OnStatsDelivered): Don't use the LOGIDENTIFIER macro because
2859         it doesn't work well inside of a lambda.
2860         (WTF::LogArgument<WebCore::RTCStatsLogger>::toString): Move into .cpp file because it is only
2861         used here.
2862         * Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.h:
2863         (WTF::LogArgument<webrtc::RTCStats>::toString): Deleted. Move to .cpp file.
2864
2865 2018-05-08  Dean Jackson  <dino@apple.com>
2866
2867         System Preview links should trigger a download
2868         https://bugs.webkit.org/show_bug.cgi?id=185439
2869         <rdar://problem/40065545>
2870
2871         Reviewed by Jon Lee.
2872
2873         Add a new field to FrameLoadRequest, which then is copied
2874         into ResourceRequest, identifying if the link clicked
2875         is a system preview.
2876
2877         * html/HTMLAnchorElement.cpp:
2878         (WebCore::HTMLAnchorElement::handleClick): Look for isSystemPreviewLink().
2879         * loader/FrameLoadRequest.cpp:
2880         (WebCore::FrameLoadRequest::FrameLoadRequest):
2881         * loader/FrameLoadRequest.h: New property.
2882         (WebCore::FrameLoadRequest::FrameLoadRequest):
2883         (WebCore::FrameLoadRequest::isSystemPreview const):
2884         * loader/FrameLoader.cpp:
2885         (WebCore::FrameLoader::urlSelected):
2886         (WebCore::FrameLoader::loadURL):
2887         * loader/FrameLoader.h:
2888         * platform/network/ResourceRequestBase.cpp:
2889         (WebCore::ResourceRequestBase::isSystemPreview const):
2890         (WebCore::ResourceRequestBase::setSystemPreview):
2891         * platform/network/ResourceRequestBase.h:
2892
2893 2018-05-08  Commit Queue  <commit-queue@webkit.org>
2894
2895         Unreviewed, rolling out r231491.
2896         https://bugs.webkit.org/show_bug.cgi?id=185434
2897
2898         Setting the Created key on a cookie does not work yet, due a
2899         bug in CFNetwork (Requested by ggaren on #webkit).
2900
2901         Reverted changeset:
2902
2903         "[WKHTTPCookieStore getAllCookies] returns inconsistent
2904         creation time"
2905         https://bugs.webkit.org/show_bug.cgi?id=185041
2906         https://trac.webkit.org/changeset/231491
2907
2908 2018-05-08  Sihui Liu  <sihui_liu@apple.com>
2909
2910         [WKHTTPCookieStore getAllCookies] returns inconsistent creation time
2911         https://bugs.webkit.org/show_bug.cgi?id=185041
2912         <rdar://problem/34684214>
2913
2914         Reviewed by Geoffrey Garen.
2915
2916         Set creationtime property when creating Cookie object to keep consistency after conversion.
2917
2918         New API test: WebKit.WKHTTPCookieStoreCreationTime.
2919
2920         * platform/network/cocoa/CookieCocoa.mm:
2921         (WebCore::Cookie::operator NSHTTPCookie * const):
2922
2923 2018-05-08  Eric Carlson  <eric.carlson@apple.com>
2924
2925         Text track cue logging should include cue text
2926         https://bugs.webkit.org/show_bug.cgi?id=185353
2927         <rdar://problem/40003565>
2928
2929         Reviewed by Brent Fulgham.
2930
2931         No new tests, tested manually.
2932
2933         * html/track/VTTCue.cpp:
2934         (WebCore::VTTCue::toJSON const):
2935         * platform/graphics/InbandTextTrackPrivateClient.h:
2936         (WebCore::GenericCueData::toJSONString const):
2937         * platform/graphics/iso/ISOVTTCue.cpp:
2938         (WebCore::ISOWebVTTCue::toJSONString const):
2939
2940 2018-05-08  Sam Weinig  <sam@webkit.org>
2941
2942         More cleanup of XMLHttpRequestUpload
2943         https://bugs.webkit.org/show_bug.cgi?id=185409
2944
2945         Reviewed by Alex Christensen.
2946
2947         - Remove unneeded #includes
2948         - Rename m_xmlHttpRequest to m_request
2949         - Make some overloaded some methods private, and mark them as final rather
2950           than override.
2951
2952         * xml/XMLHttpRequestUpload.cpp:
2953         (WebCore::XMLHttpRequestUpload::XMLHttpRequestUpload):
2954         * xml/XMLHttpRequestUpload.h:
2955
2956 2018-05-08  Zalan Bujtas  <zalan@apple.com>
2957
2958         [LFC] Start using BlockMarginCollapse
2959         https://bugs.webkit.org/show_bug.cgi?id=185424
2960
2961         Reviewed by Antti Koivisto.
2962
2963         BlockMarginCollapse could be all static.
2964
2965         * layout/blockformatting/BlockFormattingContext.cpp:
2966         (WebCore::Layout::BlockFormattingContext::marginTop const):
2967         (WebCore::Layout::BlockFormattingContext::marginBottom const):
2968         * layout/blockformatting/BlockMarginCollapse.cpp:
2969         (WebCore::Layout::isMarginTopCollapsedWithSibling):
2970         (WebCore::Layout::isMarginBottomCollapsedWithSibling):
2971         (WebCore::Layout::isMarginTopCollapsedWithParent):
2972         (WebCore::Layout::isMarginBottomCollapsedWithParent):
2973         (WebCore::Layout::collapsedMarginTopFromFirstChild):
2974         (WebCore::Layout::collapsedMarginBottomFromLastChild):
2975         (WebCore::Layout::nonCollapsedMarginTop):
2976         (WebCore::Layout::nonCollapsedMarginBottom):
2977         (WebCore::Layout::BlockMarginCollapse::marginTop):
2978         (WebCore::Layout::BlockMarginCollapse::marginBottom):
2979         (WebCore::Layout::BlockMarginCollapse::BlockMarginCollapse): Deleted.
2980         (WebCore::Layout::BlockMarginCollapse::marginTop const): Deleted.
2981         (WebCore::Layout::BlockMarginCollapse::marginBottom const): Deleted.
2982         (WebCore::Layout::BlockMarginCollapse::isMarginTopCollapsedWithSibling const): Deleted.
2983         (WebCore::Layout::BlockMarginCollapse::isMarginBottomCollapsedWithSibling const): Deleted.
2984         (WebCore::Layout::BlockMarginCollapse::isMarginTopCollapsedWithParent const): Deleted.
2985         (WebCore::Layout::BlockMarginCollapse::isMarginBottomCollapsedWithParent const): Deleted.
2986         (WebCore::Layout::BlockMarginCollapse::nonCollapsedMarginTop const): Deleted.
2987         (WebCore::Layout::BlockMarginCollapse::nonCollapsedMarginBottom const): Deleted.
2988         (WebCore::Layout::BlockMarginCollapse::collapsedMarginTopFromFirstChild const): Deleted.
2989         (WebCore::Layout::BlockMarginCollapse::collapsedMarginBottomFromLastChild const): Deleted.
2990         (WebCore::Layout::BlockMarginCollapse::hasAdjoiningMarginTopAndBottom const): Deleted.
2991         * layout/blockformatting/BlockMarginCollapse.h:
2992
2993 2018-05-08  Youenn Fablet  <youenn@apple.com>
2994
2995         Allow WebResourceLoader to cancel a load served from a service worker
2996         https://bugs.webkit.org/show_bug.cgi?id=185274
2997
2998         Reviewed by Chris Dumez.
2999
3000         Add support for cancelling a fetch from WebProcess to service worker process.
3001         Use FetchIdentifier instead of uint64_t.
3002
3003         * Modules/fetch/FetchIdentifier.h: Added.
3004         * WebCore.xcodeproj/project.pbxproj:
3005         * workers/service/context/ServiceWorkerFetch.h:
3006         * workers/service/context/ServiceWorkerThreadProxy.cpp:
3007         (WebCore::ServiceWorkerThreadProxy::startFetch):
3008         (WebCore::ServiceWorkerThreadProxy::cancelFetch):
3009         * workers/service/context/ServiceWorkerThreadProxy.h:
3010
3011 2018-05-08  Said Abou-Hallawa  <sabouhallawa@apple.com>
3012
3013         feTurbulence is not rendered correctly on Retina display
3014         https://bugs.webkit.org/show_bug.cgi?id=183798
3015
3016         Reviewed by Simon Fraser.
3017
3018         On 2x display the feTurbulence filter creates a scaled ImageBuffer but
3019         processes only the unscaled size. This is a remaining work of r168577 and
3020         is very similar to what was done for the feMorphology filter in r188271.
3021
3022         Test: fast/hidpi/filters-turbulence.html
3023
3024         * platform/graphics/filters/FETurbulence.cpp:
3025         (WebCore::FETurbulence::fillRegion const):
3026         (WebCore::FETurbulence::platformApplySoftware):
3027
3028 2018-05-07  Zalan Bujtas  <zalan@apple.com>
3029
3030         [LFC] Add FormattingContext::layoutOutOfFlowDescendants implementation
3031         https://bugs.webkit.org/show_bug.cgi?id=185377
3032
3033         Reviewed by Antti Koivisto.
3034
3035         Also, remove FormattingContext's m_layoutContext member and pass it in to ::layout() instead.
3036         In theory LayoutContext is needed only during ::layout() call. 
3037
3038         * layout/FormattingContext.cpp:
3039         (WebCore::Layout::FormattingContext::layoutOutOfFlowDescendants const):
3040         * layout/FormattingContext.h:
3041         (WebCore::Layout::FormattingContext::layoutContext const):
3042         * layout/LayoutContext.cpp:
3043         (WebCore::Layout::LayoutContext::updateLayout):
3044         * layout/blockformatting/BlockFormattingContext.cpp:
3045         (WebCore::Layout::BlockFormattingContext::layout const):
3046         * layout/blockformatting/BlockFormattingContext.h:
3047         * layout/inlineformatting/InlineFormattingContext.cpp:
3048         (WebCore::Layout::InlineFormattingContext::layout const):
3049         * layout/inlineformatting/InlineFormattingContext.h:
3050
3051 2018-05-07  Daniel Bates  <dabates@apple.com>
3052
3053         Check X-Frame-Options and CSP frame-ancestors in network process
3054         https://bugs.webkit.org/show_bug.cgi?id=185410
3055         <rdar://problem/37733934>
3056
3057         Reviewed by Ryosuke Niwa.
3058
3059         * WebCore.xcodeproj/project.pbxproj: Make PingLoader.h a private header so that we can include it in WebKit.
3060         * loader/DocumentLoader.cpp:
3061         (WebCore::DocumentLoader::responseReceived): Only check CSP frame-ancestors and X-Frame-Options here if
3062         we are not checking them in the NetworkProcess and HTTP response access is restricted. I code is otherwise kept
3063         unchanged. There may be opportunities to clean this code up more and share more of it. We should look into this
3064         in subsequent bugs.
3065         * loader/DocumentLoader.h: Change visibility of stopLoadingAfterXFrameOptionsOrContentSecurityPolicyDenied() from
3066         private to public and export it so that we can call it from the WebKit.
3067         * loader/PingLoader.h:
3068         * page/Settings.yaml: Add a new setting called networkProcessCSPFrameAncestorsCheckingEnabled (defaults: false)
3069         and is hardcoded in WebPage.cpp to be enabled. This setting is used to determine if we will be using the NetworkProcess.
3070         Ideally we wouldn't have this setting and just key off RuntimeEnabledFeatures::sharedFeatures().restrictedHTTPResponseAccess().
3071         However RuntimeEnabledFeatures::sharedFeatures().restrictedHTTPResponseAccess() is always enabled in WebKit Legacy
3072         at the time of writing (why?). And, strangely, RuntimeEnabledFeatures::sharedFeatures().restrictedHTTPResponseAccess()
3073         is conditionally enabled in WebKit. For now, we add a new setting, networkProcessCSPFrameAncestorsCheckingEnabled,
3074         to determine if CSP checking should be performed in NetworkProcess. For checking to actually happen in NetworkProcess
3075         and not in DocumentLoader::responseReceived() RuntimeEnabledFeatures::sharedFeatures().restrictedHTTPResponseAccess()
3076         will also need to be enabled.
3077         * page/csp/ContentSecurityPolicy.cpp:
3078         (WebCore::ContentSecurityPolicy::allowFrameAncestors const): Added a variant that takes a vector of ancestor origins.
3079         * page/csp/ContentSecurityPolicy.h:
3080         * page/csp/ContentSecurityPolicyDirectiveList.cpp:
3081         (WebCore::checkFrameAncestors): Ditto.
3082         (WebCore::ContentSecurityPolicyDirectiveList::violatedDirectiveForFrameAncestorOrigins const): Ditto.
3083         * page/csp/ContentSecurityPolicyDirectiveList.h: Export constructor so that we can invoke it from NetworkResourceLoader::shouldInterruptLoadForCSPFrameAncestorsOrXFrameOptions().
3084         * page/csp/ContentSecurityPolicyResponseHeaders.h:
3085         * platform/network/HTTPParsers.h: Export XFrameOptionsDisposition() so that we can use in WebKit.
3086
3087 2018-05-07  Daniel Bates  <dabates@apple.com>
3088
3089         Abstract logic to log console messages and send CSP violation reports into a client
3090         https://bugs.webkit.org/show_bug.cgi?id=185393
3091         <rdar://problem/40036053>
3092
3093         Reviewed by Brent Fulgham.
3094
3095         First pass at adding infrastructure to supporting CSP reporting from NetworkProcess and workers.
3096         Replaces the existing ContentSecurityPolicy constructor that takes a Frame with one that
3097         takes a ContentSecurityPolicyClient to delegate to for logging and sending reports. We will look
3098         to remove ContentSecurityPolicy constructor that takes a ScriptExecutionContext in a follow up.
3099
3100         Standardize on instantiating a ContentSecurityPolicy with the full URL to resource that it protects
3101         instead of taking only the SecurityOrigin of this URL. By taking the full URL the ContentSecurityPolicy
3102         object is now capable of resolving a relative report URL without needing a Document/ScriptExecutionContext.
3103
3104         We are underutilizing the CSPInfo struct and ContentSecurityPolicyClient::willSendCSPViolationReport()
3105         delegate callback in this patch. We will make use of this functionality in a subsequent patch to
3106         support collecting script state (e.g. source line number) when reporting CSP violations in worker
3107         threads. We also no longer go through the unnecessary motions to try to collect script state for a
3108         frame-ancestors violation (since DocumentLoader extends ContentSecurityPolicyClient and does not
3109         implement ContentSecurityPolicyClient::willSendCSPViolationReport()). The frame-ancestors directive
3110         is checked before a document is parsed and executes script; => there will never be any script state
3111         to collect; => it is not necessary to try to collect it as we currently do.
3112
3113         * Sources.txt: Add file ContentSecurityPolicyClient.cpp. See the remarks for ContentSecurityPolicyClient.cpp
3114         below on why we have this file.
3115         * WebCore.xcodeproj/project.pbxproj: Add files ContentSecurityPolicyClient.{h, cpp}.
3116         * dom/Document.cpp:
3117         (WebCore::Document::initSecurityContext): Pass the URL of the protected document.
3118         * loader/DocumentLoader.cpp:
3119         (WebCore::DocumentLoader::responseReceived): Ditto.
3120         (WebCore::DocumentLoader::addConsoleMessage): Added.
3121         (WebCore::DocumentLoader::sendCSPViolationReport): Added.
3122         (WebCore::DocumentLoader::dispatchSecurityPolicyViolationEvent): Added.
3123         * loader/DocumentLoader.h:
3124         * loader/FrameLoaderClient.h: Fix typo in comment.
3125         * loader/WorkerThreadableLoader.cpp:
3126         (WebCore::WorkerThreadableLoader::MainThreadBridge::MainThreadBridge): Pass the URL of the worker script.
3127         * page/csp/ContentSecurityPolicy.cpp:
3128         (WebCore::ContentSecurityPolicy::ContentSecurityPolicy): Added overload that takes a URL&& and an optional
3129         ContentSecurityPolicyClient*.
3130         (WebCore::ContentSecurityPolicy::deprecatedURLForReporting const): Extracted and simplified stripURLForUseInReport()
3131         into this member function.
3132         (WebCore::ContentSecurityPolicy::reportViolation const): Modified to make use of the client, if we have
3133         one and removed code for handling a ContentSecurityPolicy that was instantiated with a Frame.
3134         (WebCore::ContentSecurityPolicy::logToConsole const): Ditto.
3135         (WebCore::stripURLForUseInReport): Deleted; incorporated into ContentSecurityPolicy::deprecatedURLForReporting().
3136         * page/csp/ContentSecurityPolicy.h:
3137         * page/csp/ContentSecurityPolicyClient.cpp: Added. This file exists so that we can define the virtual
3138         destructor out-of-line and export this abstract class so as to avoid the need for the vtable to be
3139         defined in the translation unit of each derived class.
3140         * page/csp/ContentSecurityPolicyClient.h: Added.
3141         * page/csp/ContentSecurityPolicySource.cpp:
3142         (WebCore::ContentSecurityPolicySource::operator SecurityOriginData const): Added.
3143         * page/csp/ContentSecurityPolicySource.h:
3144         * workers/WorkerGlobalScope.cpp:
3145         (WebCore::WorkerGlobalScope::WorkerGlobalScope): Instantiate the ContentSecurityPolicy object with the
3146         URL of the worker script.
3147
3148 2018-05-07  Simon Fraser  <simon.fraser@apple.com>
3149
3150         CSS filters which reference SVG filters fail to respect the "color-interpolation-filters" of the filter
3151         https://bugs.webkit.org/show_bug.cgi?id=185343
3152
3153         Reviewed by Dean Jackson.
3154
3155         Test: css3/filters/color-interpolation-filters.html
3156         
3157         When applying CSS reference filters, apply the value of "color-interpolation-filters" for the
3158         referenced filter effect element, just as we do for SVG filters.
3159
3160         * rendering/FilterEffectRenderer.cpp:
3161         (WebCore::FilterEffectRenderer::buildReferenceFilter):
3162
3163 2018-05-07  Daniel Bates  <dabates@apple.com>
3164
3165         CSP status-code incorrect for document blocked due to violation of its frame-ancestors directive
3166         https://bugs.webkit.org/show_bug.cgi?id=185366
3167         <rdar://problem/40035116>
3168
3169         Reviewed by Brent Fulgham.
3170
3171         Fixes an issue where the status-code in the sent CSP report for an HTTP document blocked because
3172         its frame-ancestors directive was violated would be the status code of the previously loaded
3173         document in the frame. If the previously loaded document was about:blank then this would be 0.
3174
3175         Currently whenever we send a CSP report we ask the document's loader (Document::loader()) for the
3176         HTTP status code for the last response. Document::loader() returns the loader for the last committed
3177         document its frame. For a frame-ancestors violation, a CSP report is sent before the document
3178         that had the frame-ancestors directive has been committed and after it has been associate with a frame.
3179         As a result we are in are in a transient transition state for the frame and hence the last response
3180         for new document's loader (Document::loader()) is actually the last response of the previously loaded
3181         document in the frame. Instead we need to take care to tell CSP about the HTTP status code for the
3182         response associated with the document the CSP came from.
3183
3184         * dom/Document.cpp:
3185         (WebCore::Document::processHttpEquiv):
3186         (WebCore::Document::initSecurityContext):
3187         Pass the HTTP status code to CSP.
3188
3189         * page/csp/ContentSecurityPolicy.cpp:
3190         (WebCore::ContentSecurityPolicy::copyStateFrom):
3191         (WebCore::ContentSecurityPolicy::responseHeaders const):
3192         (WebCore::ContentSecurityPolicy::didReceiveHeaders):
3193         (WebCore::ContentSecurityPolicy::didReceiveHeader):
3194         (WebCore::ContentSecurityPolicy::reportViolation const):
3195         * page/csp/ContentSecurityPolicy.h:
3196         Modify existing functions to take the HTTP status code, store it in a instance variable,
3197         and reference this variable when reporting a violation.
3198
3199         * page/csp/ContentSecurityPolicyResponseHeaders.cpp:
3200         (WebCore::ContentSecurityPolicyResponseHeaders::ContentSecurityPolicyResponseHeaders):
3201         (WebCore::ContentSecurityPolicyResponseHeaders::isolatedCopy const):
3202         * page/csp/ContentSecurityPolicyResponseHeaders.h:
3203         (WebCore::ContentSecurityPolicyResponseHeaders::encode const):
3204         (WebCore::ContentSecurityPolicyResponseHeaders::decode):
3205         Store the HTTP status code along with the response headers.
3206
3207 2018-05-07  Daniel Bates  <dabates@apple.com>
3208
3209         CSP referrer incorrect for document blocked due to violation of its frame-ancestors directive
3210         https://bugs.webkit.org/show_bug.cgi?id=185380
3211
3212         Reviewed by Brent Fulgham.
3213
3214         Similar to <https://bugs.webkit.org/show_bug.cgi?id=185366>, fixes an issue where the referrer
3215         in the sent CSP report for an HTTP document blocked because its frame-ancestors directive was
3216         violated would be the referrer of the previously loaded document in the frame.
3217
3218         Currently whenever we send a CSP report we ask the document's loader (Document::loader()) for
3219         the referrer for the last request. Document::loader() returns the loader for the last committed
3220         document in its frame. For a frame-ancestors violation, a CSP report is sent before the document
3221         that had the frame-ancestors directive has been committed and after it has been associate with a
3222         frame. As a result we are in a transient transition state for the frame and hence the last request
3223         for the new document's loader (Document::loader()) is actually the last request of the previously
3224         loaded document in the frame. Instead we need to take care to tell CSP about the referrer for the
3225         request associated with the document the CSP came from.
3226
3227         * loader/DocumentLoader.cpp:
3228         (WebCore::DocumentLoader::responseReceived):
3229
3230 2018-05-07  Brent Fulgham  <bfulgham@apple.com>
3231
3232         Add experimental feature to prompt for Storage Access API use
3233         https://bugs.webkit.org/show_bug.cgi?id=185335
3234         <rdar://problem/39994649>
3235
3236         Reviewed by Alex Christensen and Youenn Fablet.
3237
3238         Create a new experimental feature that gates the ability of WebKit clients to prompt the user when
3239         Storage Access API is invoked.
3240
3241         Currently this feature doesn't have any user-visible impact.
3242
3243         * page/RuntimeEnabledFeatures.h:
3244         (WebCore::RuntimeEnabledFeatures::setStorageAccessPromptsEnabled):
3245         (WebCore::RuntimeEnabledFeatures::storageAccessPromptsEnabled const):
3246         * testing/InternalSettings.cpp:
3247         (WebCore::InternalSettings::Backup::Backup):
3248         (WebCore::InternalSettings::Backup::restoreTo):
3249         (WebCore::InternalSettings::setStorageAccessPromptsEnabled):
3250         * testing/InternalSettings.h:
3251         * testing/InternalSettings.idl:
3252
3253 2018-05-07  Chris Dumez  <cdumez@apple.com>
3254
3255         Stop using an iframe's id as fallback if its name attribute is not set
3256         https://bugs.webkit.org/show_bug.cgi?id=11388
3257
3258         Reviewed by Geoff Garen.
3259
3260         WebKit had logic to use an iframe's id as fallback name when its name
3261         content attribute is not set. This behavior was not standard and did not
3262         match other browsers:
3263         - https://html.spec.whatwg.org/#attr-iframe-name
3264
3265         Gecko / Trident never behaved this way. Blink was aligned with us until
3266         they started to match the specification in:
3267         - https://bugs.chromium.org/p/chromium/issues/detail?id=347169
3268
3269         This WebKit quirk was causing some Web-compatibility issues because it
3270         would affect the behavior of Window's name property getter when trying
3271         to look up an iframe by id. Because of Window's named property getter
3272         behavior [1], we would return the frame's contentWindow instead of the
3273         iframe element itself.
3274
3275         [1] https://html.spec.whatwg.org/multipage/window-object.html#named-access-on-the-window-object
3276
3277         Test: fast/dom/Window/named-getter-frame-id.html
3278
3279         * html/HTMLFrameElementBase.cpp:
3280         (WebCore::HTMLFrameElementBase::openURL):
3281         (WebCore::HTMLFrameElementBase::parseAttribute):
3282         (WebCore::HTMLFrameElementBase::didFinishInsertingNode):
3283         * html/HTMLFrameElementBase.h:
3284
3285 2018-05-07  Chris Dumez  <cdumez@apple.com>
3286
3287         ASSERT(!childItemWithTarget(child->target())) is hit in HistoryItem::addChildItem()
3288         https://bugs.webkit.org/show_bug.cgi?id=185322
3289
3290         Reviewed by Geoff Garen.
3291
3292         We generate unique names for Frame to be used in HistoryItem. Those names not only
3293         need to be unique, they also need to be repeatable to avoid layout tests flakiness
3294         and for things like restoring form state from a HistoryItem.
3295
3296         The previously generated frame names were relying on the Frame's index among a
3297         parent Frame's children. The issue was that we could end up with duplicate names
3298         because one could insert a Frame *before* an existing one. This is because the code
3299         would not take care of updating existing Frames' unique name on frame tree mutation.
3300
3301         Updating frame tree names on mutation would be inefficient and is also not necessary.
3302         The approach chosen in this patch is to stop using the Frame's index and instead rely
3303         on an increasing counter stored on the top-frame's FrameTree. To make the names
3304         repeatable, we reset the counter on page navigation.
3305
3306         * page/Frame.cpp:
3307         (WebCore::Frame::setDocument):
3308         * page/FrameTree.cpp:
3309         (WebCore::FrameTree::uniqueChildName const):
3310         (WebCore::FrameTree::generateUniqueName const):
3311         * page/FrameTree.h:
3312         (WebCore::FrameTree::resetFrameIdentifiers):
3313
3314 2018-05-07  Yacine Bandou  <yacine.bandou_ext@softathome.com>
3315
3316         [EME][GStreamer] Fix wrong subsample parsing on r227067
3317         https://bugs.webkit.org/show_bug.cgi?id=185382
3318
3319         Reviewed by Philippe Normand.
3320
3321         The initialization of sampleIndex should be moved outside of the loop.
3322         Without this patch we will have a bad log and the check of the subsample
3323         count will be useless.
3324
3325         * platform/graphics/gstreamer/eme/WebKitClearKeyDecryptorGStreamer.cpp:
3326         (webKitMediaClearKeyDecryptorDecrypt):
3327
3328 2018-05-07  Daniel Bates  <dabates@apple.com>
3329
3330         CSP should be passed the referrer
3331         https://bugs.webkit.org/show_bug.cgi?id=185367
3332
3333         Reviewed by Per Arne Vollan.
3334
3335         As a step towards formalizing a CSP delegate object and removing the dependencies
3336         on ScriptExecutionContext and Frame, we should pass the document's referrer directly
3337         instead of indirectly obtaining it from the ScriptExecutionContext or Frame used
3338         to instantiate the ContentSecurityPolicy object.
3339
3340         * dom/Document.cpp:
3341         (WebCore::Document::processHttpEquiv): Pass the document's referrer.
3342         (WebCore::Document::initSecurityContext): Ditto.
3343         (WebCore::Document::applyQuickLookSandbox): Ditto.
3344         * loader/DocumentLoader.cpp:
3345         (WebCore::DocumentLoader::responseReceived): Ditto.
3346         * loader/FrameLoader.cpp:
3347         (WebCore::FrameLoader::didBeginDocument): Ditto.
3348         * page/csp/ContentSecurityPolicy.cpp:
3349         (WebCore::ContentSecurityPolicy::copyStateFrom): We pass a null string for the referrer
3350         to didReceiveHeader() as a placeholder since it requires the referrer be given to it. We
3351         fix up the referrer (m_referrer) after copying all the policy headers.
3352         (WebCore::ContentSecurityPolicy::didReceiveHeaders): Ditto.
3353         (WebCore::ContentSecurityPolicy::didReceiveHeader): Modified to take a referrer and WTFMove()s
3354         it into an instance variable (m_referrer).
3355         (WebCore::ContentSecurityPolicy::reportViolation const): Modified to use the stored referrer.
3356         * page/csp/ContentSecurityPolicy.h:
3357         * workers/WorkerGlobalScope.cpp:
3358         (WebCore::WorkerGlobalScope::applyContentSecurityPolicyResponseHeaders): Pass a null string
3359         for the referrer as a worker does not have a referrer.
3360
3361 2018-05-07  Daniel Bates  <dabates@apple.com>
3362
3363         CSP should only notify Inspector to pause the debugger on the first policy to violate a directive
3364         https://bugs.webkit.org/show_bug.cgi?id=185364
3365
3366         Reviewed by Brent Fulgham.
3367
3368         Notify Web Inspector that a script was blocked on the first enforced CSP policy that it
3369         violates.
3370
3371         A page can have more than one enforced Content Security Policy. Currently for inline
3372         scripts, inline event handlers, JavaScript URLs, and eval() that are blocked by CSP
3373         we notify Web Inspector that it was blocked for each CSP policy that blocked it. When
3374         Web Inspector is notified it pauses script execution. It does not seem very meaningful
3375         to pause script execution on the same script for each CSP policy that blocked it.
3376         Therefore, only tell Web Inspector that a script was blocked for the first enforced CSP
3377         policy that blocked it.
3378
3379         * page/csp/ContentSecurityPolicy.cpp:
3380         (WebCore::ContentSecurityPolicy::allowJavaScriptURLs const):
3381         (WebCore::ContentSecurityPolicy::allowInlineEventHandlers const):
3382         (WebCore::ContentSecurityPolicy::allowInlineScript const):
3383         (WebCore::ContentSecurityPolicy::allowEval const):
3384
3385 2018-05-07  Daniel Bates  <dabates@apple.com>
3386
3387         Substitute CrossOriginPreflightResultCache::clear() for CrossOriginPreflightResultCache::empty()
3388         https://bugs.webkit.org/show_bug.cgi?id=185170
3389
3390         Reviewed by Per Arne Vollan.
3391
3392         Rename CrossOriginPreflightResultCache::empty() to CrossOriginPreflightResultCache::clear() make
3393         it consistent with the terminology we use in WebKit to signify a function that clears a collection.
3394         A member function named "empty" is expected to return an instance of a class in its "empty state".
3395         For example, StringImpl::empty() returns a StringImpl instance that represents the empty string.
3396         However CrossOriginPreflightResultCache::empty() clears out the cache in-place. We should rename
3397         this function to better describe its purpose.
3398
3399         * loader/CrossOriginPreflightResultCache.cpp:
3400         (WebCore::CrossOriginPreflightResultCache::clear):
3401         (WebCore::CrossOriginPreflightResultCache::empty): Deleted.
3402         * loader/CrossOriginPreflightResultCache.h:
3403
3404 2018-05-06  Dean Jackson  <dino@apple.com>
3405
3406         WebGL: Reset simulated values after validation fails
3407         https://bugs.webkit.org/show_bug.cgi?id=185363
3408         <rdar://problem/39733417>
3409
3410         Reviewed by Anders Carlsson.
3411
3412         While fixing a previous bug, I forgot to reset some values
3413         when validation fails. This caused a bug where a subsequent
3414         invalid call might use those values and escape detection.
3415
3416         Test: fast/canvas/webgl/index-validation-with-subsequent-draws.html
3417
3418         * html/canvas/WebGLRenderingContextBase.cpp:
3419         (WebCore::WebGLRenderingContextBase::simulateVertexAttrib0): Reset the
3420         sizes when validation fails.
3421         * html/canvas/WebGLRenderingContextBase.h:
3422
3423 2018-05-07  Ms2ger  <Ms2ger@igalia.com>
3424
3425         Support negative sw/sh values in createImageBitmap().
3426         https://bugs.webkit.org/show_bug.cgi?id=184449
3427
3428         Reviewed by Dean Jackson.
3429
3430         Tests: LayoutTests/imported/w3c/web-platform-tests/2dcontext/imagebitmap/createImageBitmap-drawImage.html
3431                LayoutTests/http/wpt/2dcontext/imagebitmap/createImageBitmap.html
3432
3433         * html/ImageBitmap.cpp:
3434         (WebCore::ImageBitmap::createPromise): handle negative values per spec.
3435
3436 2018-05-07  Brian Burg  <bburg@apple.com>
3437
3438         Web Inspector: opt out of process swap on navigation if a Web Inspector frontend is connected
3439         https://bugs.webkit.org/show_bug.cgi?id=184861
3440         <rdar://problem/39153768>
3441
3442         Reviewed by Timothy Hatcher.
3443
3444         Notify the client of the current connection count whenever a frontend connects or disconnects.
3445
3446         Covered by new API test.
3447
3448         * inspector/InspectorClient.h:
3449         (WebCore::InspectorClient::frontendCountChanged):
3450         * inspector/InspectorController.cpp:
3451         (WebCore::InspectorController::connectFrontend):
3452         (WebCore::InspectorController::disconnectFrontend):
3453         (WebCore::InspectorController::disconnectAllFrontends):
3454         * inspector/InspectorController.h:
3455
3456 2018-05-07  Eric Carlson  <eric.carlson@apple.com>
3457
3458         Text track cue logging should include cue text
3459         https://bugs.webkit.org/show_bug.cgi?id=185353
3460         <rdar://problem/40003565>
3461
3462         Reviewed by Youenn Fablet.
3463
3464         No new tests, tested manually.
3465
3466         * html/track/VTTCue.cpp:
3467         (WebCore::VTTCue::toJSONString const): Use toJSON.
3468         (WebCore::VTTCue::toJSON const): New.
3469         * html/track/VTTCue.h:
3470
3471         * platform/graphics/InbandTextTrackPrivateClient.h:
3472         (WebCore::GenericCueData::toJSONString const): Log m_content.
3473
3474         * platform/graphics/iso/ISOVTTCue.cpp:
3475         (WebCore::ISOWebVTTCue::toJSONString const): Log m_cueText.
3476
3477 2018-05-06  Zalan Bujtas  <zalan@apple.com>
3478
3479         [LFC] Add assertions for stale Display::Box geometry
3480         https://bugs.webkit.org/show_bug.cgi?id=185357
3481
3482         Reviewed by Antti Koivisto.
3483
3484         Ensure that we don't access stale geometry of other boxes during layout.
3485         For example, in order to layout a block child we need the containing block's content box top/left and width (but not the height)
3486
3487         * layout/displaytree/DisplayBox.h:
3488         (WebCore::Display::Box::invalidateTop):
3489         (WebCore::Display::Box::invalidateLeft):
3490         (WebCore::Display::Box::invalidateWidth):
3491         (WebCore::Display::Box::invalidateHeight):
3492         (WebCore::Display::Box::hasValidPosition const):
3493         (WebCore::Display::Box::hasValidSize const):
3494         (WebCore::Display::Box::hasValidGeometry const):
3495         (WebCore::Display::Box::invalidatePosition):
3496         (WebCore::Display::Box::invalidateSize):
3497         (WebCore::Display::Box::setHasValidPosition):
3498         (WebCore::Display::Box::setHasValidSize):
3499         (WebCore::Display::Box::setHasValidGeometry):
3500         (WebCore::Display::Box::rect const):
3501         (WebCore::Display::Box::top const):
3502         (WebCore::Display::Box::left const):
3503         (WebCore::Display::Box::bottom const):
3504         (WebCore::Display::Box::right const):
3505         (WebCore::Display::Box::topLeft const):
3506         (WebCore::Display::Box::bottomRight const):
3507         (WebCore::Display::Box::size const):
3508         (WebCore::Display::Box::width const):
3509         (WebCore::Display::Box::height const):
3510         (WebCore::Display::Box::setRect):
3511         (WebCore::Display::Box::setTopLeft):
3512         (WebCore::Display::Box::setTop):
3513         (WebCore::Display::Box::setLeft):
3514         (WebCore::Display::Box::setSize):
3515         (WebCore::Display::Box::setWidth):
3516         (WebCore::Display::Box::setHeight):
3517
3518 2018-05-06  Zalan Bujtas  <zalan@apple.com>
3519
3520         [LFC] Add BlockFormattingContext::computeStaticPosition
3521         https://bugs.webkit.org/show_bug.cgi?id=185352
3522
3523         Reviewed by Antti Koivisto.
3524
3525         This is the core logic for positioning inflow boxes in a block formatting context (very naive though).
3526
3527         * layout/blockformatting/BlockFormattingContext.cpp:
3528         (WebCore::Layout::BlockFormattingContext::computeStaticPosition const):
3529         * layout/displaytree/DisplayBox.h:
3530
3531 2018-05-05  Sam Weinig  <sam@webkit.org>
3532
3533         Cleanup XMLHttpRequestUpload a little
3534         https://bugs.webkit.org/show_bug.cgi?id=185344
3535
3536         Reviewed by Yusuke Suzuki.
3537
3538         * bindings/js/JSXMLHttpRequestCustom.cpp:
3539         (WebCore::JSXMLHttpRequest::visitAdditionalChildren):
3540         Use auto to reduce redundancy.
3541
3542         * xml/XMLHttpRequest.cpp:
3543         (WebCore::XMLHttpRequest::upload):
3544         * xml/XMLHttpRequest.h:
3545         Switch upload() to return a reference.
3546         
3547         * xml/XMLHttpRequestUpload.cpp:
3548         (WebCore::XMLHttpRequestUpload::XMLHttpRequestUpload):
3549         (WebCore::XMLHttpRequestUpload::dispatchProgressEvent):
3550         * xml/XMLHttpRequestUpload.h:
3551         Cleanup formatting, modernize and switch XMLHttpRequest member from a pointer
3552         to a reference.
3553
3554 2018-05-05  Dean Jackson  <dino@apple.com>
3555
3556         Draw a drop-shadow behind the system preview badge
3557         https://bugs.webkit.org/show_bug.cgi?id=185356
3558         <rdar://problem/40004936>
3559
3560         Reviewed by Wenson Hsieh.
3561
3562         Draw a very subtle drop-shadow under the system
3563         preview badge so that it is more visible on a pure
3564         white background.
3565
3566         I also moved some code around to make it more clear
3567         and improved comments.
3568
3569         * rendering/RenderThemeIOS.mm:
3570         (WebCore::RenderThemeIOS::paintSystemPreviewBadge):
3571
3572 2018-05-04  Wenson Hsieh  <wenson_hsieh@apple.com>
3573
3574         [iOS] Multiple links in Mail are dropped in a single line, and are difficult to tell apart
3575         https://bugs.webkit.org/show_bug.cgi?id=185289
3576         <rdar://problem/35756912>
3577
3578         Reviewed by Tim Horton and Darin Adler.
3579
3580         When inserting multiple URLs as individual items in a single drop, we currently separate each item with a space
3581         (see r217284). However, it still seems difficult to tell dropped links apart. This patch makes some slight
3582         tweaks to WebContentReader::readURL so that it inserts line breaks before dropped URLs, if the dropped URL isn't
3583         the first item to be inserted in the resulting document fragment.
3584
3585         Augments existing API tests in DataInteractionTests.
3586
3587         * editing/ios/WebContentReaderIOS.mm:
3588
3589         Additionally remove some extraneous header imports from this implementation file.
3590
3591         (WebCore::WebContentReader::readURL):
3592
3593 2018-05-02  Dean Jackson  <dino@apple.com>
3594
3595         Use IOSurfaces for CoreImage operations where possible
3596         https://bugs.webkit.org/show_bug.cgi?id=185230
3597         <rdar://problem/39926929>
3598
3599         Reviewed by Jon Lee.
3600
3601         On iOS hardware, we can use IOSurfaces as a rendering destination
3602         for CoreImage, which means we're keeping data on the GPU
3603         for rendering.
3604
3605         As a drive-by fix, I used a convenience method for Gaussian blurs.
3606
3607         * rendering/RenderThemeIOS.mm:
3608         (WebCore::RenderThemeIOS::paintSystemPreviewBadge):
3609
3610 2018-05-04  Tim Horton  <timothy_horton@apple.com>
3611
3612         Shift to a lower-level framework for simplifying URLs
3613         https://bugs.webkit.org/show_bug.cgi?id=185334
3614
3615         Reviewed by Dan Bernstein.
3616
3617         * Configurations/WebCore.xcconfig:
3618         * platform/mac/DragImageMac.mm:
3619         (WebCore::LinkImageLayout::LinkImageLayout):
3620
3621 2018-05-03  Ryosuke Niwa  <rniwa@webkit.org>
3622
3623         Release assert in ScriptController::canExecuteScripts via HTMLMediaElement::~HTMLMediaElement()
3624         https://bugs.webkit.org/show_bug.cgi?id=185288
3625
3626         Reviewed by Jer Noble.
3627
3628         The crash is caused by HTMLMediaElement::~HTMLMediaElement canceling the resource load via CachedResource
3629         which ends up calling FrameLoader::checkCompleted() and fire load event on the document synchronously.
3630         Speculatively fix the crash by scheduling the check instead.
3631
3632         In long term, ResourceLoader::cancel should never fire load event synchronously: webkit.org/b/185284.
3633
3634         Unfortunately, no new tests since I can't get MediaResource to get destructed at the right time.
3635
3636         * html/HTMLMediaElement.cpp:
3637         (WebCore::HTMLMediaElement::isRunningDestructor): Added to detect this specific case.
3638         (WebCore::HTMLMediaElementDestructorScope): Added.
3639         (WebCore::HTMLMediaElementDestructorScope::HTMLMediaElementDestructorScope): Added.
3640         (WebCore::HTMLMediaElementDestructorScope::~HTMLMediaElementDestructorScope): Added.
3641         (WebCore::HTMLMediaElement::~HTMLMediaElement): Instantiate HTMLMediaElement.
3642         * html/HTMLMediaElement.h:
3643         * loader/FrameLoader.cpp:
3644         (WebCore::FrameLoader::checkCompleted): Call scheduleCheckCompleted instead of synchronously calling
3645         checkCompleted if we're in the middle of destructing a HTMLMediaElement.
3646
3647 2018-05-04  Ryosuke Niwa  <rniwa@webkit.org>
3648
3649         Rename DocumentOrderedMap to TreeScopeOrderedMap
3650         https://bugs.webkit.org/show_bug.cgi?id=185290
3651
3652         Reviewed by Zalan Bujtas.
3653
3654         Renamed the class since it's almost always a mistake to use this class as a member variable of Document.
3655
3656         * Sources.txt:
3657         * WebCore.xcodeproj/project.pbxproj:
3658         * dom/MouseRelatedEvent.cpp: Include the forgotten DOMWindow.h. Unified build files bit us here.
3659         * dom/TreeScope.cpp:
3660         (WebCore::TreeScope::addElementById):
3661         (WebCore::TreeScope::addElementByName):
3662         (WebCore::TreeScope::addImageMap):
3663         (WebCore::TreeScope::addImageElementByUsemap):
3664         (WebCore::TreeScope::labelElementForId):
3665         * dom/TreeScope.h:
3666         * dom/TreeScopeOrderedMap.cpp: Renamed from DocumentOrderedMap.cpp
3667         * dom/TreeScopeOrderedMap.h: Renamed from DocumentOrderedMap.h
3668         * html/HTMLDocument.h:
3669
3670 2018-05-04  Don Olmstead  <don.olmstead@sony.com>
3671
3672         [Win][WebKit] Fix forwarding headers for Windows build
3673         https://bugs.webkit.org/show_bug.cgi?id=184412
3674
3675         Reviewed by Alex Christensen.
3676
3677         No new tests. No change in behavior.
3678
3679         * PlatformWin.cmake:
3680
3681 2018-05-04  Zalan Bujtas  <zalan@apple.com>
3682
3683         [Simple line layout] Add support for line layout box generation with multiple text renderers.
3684         https://bugs.webkit.org/show_bug.cgi?id=185276
3685
3686         Reviewed by Antti Koivisto.
3687
3688         Covered by existing tests.
3689
3690         * rendering/SimpleLineLayoutFunctions.cpp:
3691         (WebCore::SimpleLineLayout::canUseForLineBoxTree):
3692         (WebCore::SimpleLineLayout::generateLineBoxTree):
3693         * rendering/SimpleLineLayoutResolver.cpp:
3694         (WebCore::SimpleLineLayout::RunResolver::Run::renderer const):
3695         (WebCore::SimpleLineLayout::RunResolver::Run::localStart const):
3696         (WebCore::SimpleLineLayout::RunResolver::Run::localEnd const):
3697         * rendering/SimpleLineLayoutResolver.h:
3698
3699 2018-05-04  Timothy Hatcher  <timothy@apple.com>
3700
3701         Deprecate legacy WebView and friends
3702         https://bugs.webkit.org/show_bug.cgi?id=185279
3703         rdar://problem/33268700
3704
3705         Reviewed by Tim Horton.
3706
3707         * Configurations/WebCore.xcconfig:
3708         Added BUILDING_WEBKIT define to disable the deprecation macros.
3709         * bridge/objc/WebScriptObject.h:
3710         Added deprecation macros to WebScriptObject and WebUndefined.
3711         * platform/cocoa/WebKitAvailability.h:
3712         Added more macros and a way to disable deprecation warnings for
3713         WebKit build and in clients like Safari.
3714
3715 2018-05-04  Eric Carlson  <eric.carlson@apple.com>
3716
3717         Log media time range as JSON
3718         https://bugs.webkit.org/show_bug.cgi?id=185321
3719         <rdar://problem/39986746>
3720
3721         Reviewed by Youenn Fablet.
3722
3723         No new tests, tested manually.
3724
3725         * html/HTMLMediaElement.cpp:
3726         (WebCore::HTMLMediaElement::addPlayedRange): Log as time range.
3727         (WebCore::HTMLMediaElement::visibilityStateChanged): Cleanup.
3728
3729         * platform/graphics/MediaPlayer.h:
3730         (WTF::LogArgument<MediaTime>::toString):
3731         (WTF::LogArgument<MediaTimeRange>::toString):
3732
3733         * platform/graphics/avfoundation/InbandTextTrackPrivateAVF.cpp:
3734         (WebCore::InbandTextTrackPrivateAVF::processAttributedStrings): Log error as time range.
3735
3736 2018-05-04  Zalan Bujtas  <zalan@apple.com>
3737
3738         Use the containing block to compute the pagination gap when the container is inline.
3739         https://bugs.webkit.org/show_bug.cgi?id=184724
3740         <rdar://problem/39521800>
3741
3742         Reviewed by Simon Fraser.
3743
3744         Test: fast/overflow/page-overflow-with-inline-body-crash.html
3745
3746         * page/FrameView.cpp:
3747         (WebCore::FrameView::applyPaginationToViewport):
3748
3749 2018-05-04  Tim Horton  <timothy_horton@apple.com>
3750
3751         Don't use GSFont* in minimal simulator mode
3752         https://bugs.webkit.org/show_bug.cgi?id=185320
3753         <rdar://problem/39734478>
3754
3755         Reviewed by Beth Dakin.
3756
3757         * page/cocoa/MemoryReleaseCocoa.mm:
3758         (WebCore::platformReleaseMemory):
3759
3760 2018-05-04  Chris Dumez  <cdumez@apple.com>
3761
3762         Unreviewed, rolling out r231331.
3763
3764         Caused a few tests to assert
3765
3766         Reverted changeset:
3767
3768         "Stop using an iframe's id as fallback if its name attribute
3769         is not set"
3770         https://bugs.webkit.org/show_bug.cgi?id=11388
3771         https://trac.webkit.org/changeset/231331
3772
3773 2018-05-04  Youenn Fablet  <youenn@apple.com>
3774
3775         Use more references in updateTracksOfType
3776         https://bugs.webkit.org/show_bug.cgi?id=185305
3777
3778         Reviewed by Eric Carlson.
3779
3780         No change of behavior.
3781
3782         * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.mm:
3783         (WebCore::updateTracksOfType):
3784         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::updateTracks):
3785
3786 2018-05-04  Myles C. Maxfield  <mmaxfield@apple.com>
3787
3788         Text shaping in the simple path is flipped in the y direction
3789         https://bugs.webkit.org/show_bug.cgi?id=185062
3790         <rdar://problem/39778678>
3791
3792         Reviewed by Simon Fraser.
3793
3794         Shaping in our simple codepath occurs in an "increasing-y-goes-up" coordinate system, but our painting
3795         code uses an "increasing-y-goes-down" coordinate system. We weren't fixing up the coordinate systems
3796         because we never noticed. This is because the simple codepath is only designed for kerning and ligatures,
3797         neither of which move glyphs vertically in the common case.
3798
3799         Test: fast/text/vertical-displacement-simple-codepath.html
3800
3801         * platform/graphics/Font.cpp:
3802         (WebCore::Font::applyTransforms const):
3803         * platform/graphics/WidthIterator.cpp:
3804         (WebCore::WidthIterator::applyFontTransforms):
3805
3806 2018-05-04  Chris Nardi  <cnardi@chromium.org>
3807
3808         Serialize all URLs with double-quotes per CSSOM spec
3809         https://bugs.webkit.org/show_bug.cgi?id=184935
3810
3811         Reviewed by Antti Koivisto.
3812
3813         According to https://drafts.csswg.org/cssom/#serialize-a-url, all URLs should be serialized as strings,
3814         which means they should have double quotes around the text of the URL. Update our implementation to match
3815         this (and Firefox/Chrome). Also remove isCSSTokenizerURL() as this method is no longer needed.
3816
3817         Tests: Many LayoutTests updated to use double quotes.
3818
3819         * css/CSSMarkup.cpp:
3820         (WebCore::serializeString): Remove FIXME as this was already fixed in a previous patch.
3821         (WebCore::serializeURL): Remove FIXME and update implementation.
3822
3823 2018-05-04  Youenn Fablet  <youenn@apple.com>
3824
3825         LayoutTests/fast/mediastream/change-tracks-media-stream-being-played.html is crashing after r231304
3826         https://bugs.webkit.org/show_bug.cgi?id=185303
3827
3828         Reviewed by Eric Carlson.
3829
3830         We need to stop observing the audio track like we do for video track once we are no longer interested in it.
3831         Covered by test no longer crashing.
3832
3833         * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.mm:
3834         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::updateTracks):
3835
3836 2018-05-04  Zalan Bujtas  <zalan@apple.com>
3837
3838         [LFC] Set the invalidation root as the result of style change.
3839         https://bugs.webkit.org/show_bug.cgi?id=185301
3840
3841         Reviewed by Antti Koivisto.
3842
3843         Compute/propagate the update type on the ancestor chain and return the invalidation root
3844         so that LayoutContext could use it as the entry point for the next layout frame.
3845
3846         * layout/LayoutContext.cpp:
3847         (WebCore::Layout::LayoutContext::updateLayout):
3848         (WebCore::Layout::LayoutContext::styleChanged):
3849         * layout/LayoutContext.h: order is not important.
3850         * layout/blockformatting/BlockInvalidation.cpp:
3851         (WebCore::Layout::invalidationStopsAtFormattingContextBoundary):
3852         (WebCore::Layout::computeUpdateType):
3853         (WebCore::Layout::computeUpdateTypeForAncestor):
3854         (WebCore::Layout::BlockInvalidation::invalidate):
3855         * layout/blockformatting/BlockInvalidation.h:
3856         * layout/inlineformatting/InlineInvalidation.cpp:
3857         (WebCore::Layout::InlineInvalidation::invalidate):
3858         * layout/inlineformatting/InlineInvalidation.h:
3859
3860 2018-05-04  Youenn Fablet  <youenn@apple.com>
3861
3862         PeerConnection should have its connectionState closed even if doing gathering
3863         https://bugs.webkit.org/show_bug.cgi?id=185267
3864
3865         Reviewed by Darin Adler.
3866
3867         Test: webrtc/addICECandidate-closed.html
3868
3869         In case m_iceConnectionState is closed, m_connectionState should also be set to closed
3870         and RTCPeerConnection should be closed so as to reject any other call.
3871
3872         * Modules/mediastream/RTCPeerConnection.cpp:
3873         (WebCore::RTCPeerConnection::close):
3874         (WebCore::RTCPeerConnection::updateConnectionState):
3875
3876 2018-05-04  Yacine Bandou  <yacine.bandou_ext@softathome.com>
3877
3878         [MSE][GStreamer] Delete properly the stream from the WebKitMediaSource
3879         https://bugs.webkit.org/show_bug.cgi?id=185242
3880
3881         Reviewed by Xabier Rodriguez-Calvar.
3882
3883         When the sourceBuffer is removed from mediasource, the appropriate stream is not
3884         properly deleted from WebKitMediaSource, because the appsrc and parser elements
3885         of the stream are not removed from the WebKitMediaSource bin.
3886
3887         This patch avoids the regression of r231089, see https://bugs.webkit.org/show_bug.cgi?id=185071
3888
3889         * platform/graphics/gstreamer/mse/WebKitMediaSourceGStreamer.cpp:
3890         (webKitMediaSrcFreeStream):
3891
3892 2018-05-04  Carlos Garcia Campos  <cgarcia@igalia.com>
3893
3894         [GTK] Epiphany (GNOME Web) says "Error downloading: Service Unavailable." when trying to download an image from discogs.com
3895         https://bugs.webkit.org/show_bug.cgi?id=174730
3896
3897         Reviewed by Michael Catanzaro.
3898
3899         Export ResourceRequestBase::hasHTTPHeaderField().
3900
3901         * platform/network/ResourceRequestBase.h:
3902
3903 2018-05-03  Yusuke Suzuki  <utatane.tea@gmail.com>
3904
3905         Use subprocess.call instead of os.system to handle path with spaces
3906         https://bugs.webkit.org/show_bug.cgi?id=185291
3907
3908         Reviewed by Darin Adler.
3909
3910         If gperf path includes spaces, these python scripts fail to execute gperf.
3911         We use subprocess module instead of os.system to invoke gperf.
3912
3913         * css/makeSelectorPseudoClassAndCompatibilityElementMap.py:
3914         * css/makeSelectorPseudoElementsMap.py:
3915         * platform/network/create-http-header-name-table:
3916
3917 2018-05-03  Yusuke Suzuki  <utatane.tea@gmail.com>
3918
3919         Unreviewed, attempt to fix WinCairo build failure
3920         https://bugs.webkit.org/show_bug.cgi?id=185218
3921
3922         * platform/text/win/LocaleWin.cpp:
3923         (WebCore::LocaleWin::getLocaleInfoString):
3924
3925 2018-05-03  Filip Pizlo  <fpizlo@apple.com>
3926
3927         Strings should not be allocated in a gigacage
3928         https://bugs.webkit.org/show_bug.cgi?id=185218
3929
3930         Reviewed by Saam Barati.
3931
3932         No new tests because no new behavior.
3933
3934         * Modules/indexeddb/server/IDBSerialization.cpp:
3935         (WebCore::decodeKey):
3936         * bindings/js/SerializedScriptValue.cpp:
3937         (WebCore::CloneDeserializer::readString):
3938         * html/canvas/CanvasRenderingContext2D.cpp:
3939         (WebCore::normalizeSpaces):
3940         * html/parser/HTMLTreeBuilder.cpp:
3941         (WebCore::HTMLTreeBuilder::ExternalCharacterTokenBuffer::takeRemainingWhitespace):
3942         * platform/URLParser.cpp:
3943         (WebCore::percentEncodeByte):
3944         (WebCore::serializeURLEncodedForm):
3945         (WebCore::URLParser::serialize):
3946         * platform/URLParser.h:
3947         * platform/graphics/FourCC.cpp:
3948         (WebCore::FourCC::toString const):
3949         * platform/graphics/ca/GraphicsLayerCA.cpp:
3950         (WebCore::GraphicsLayerCA::ReplicaState::cloneID const):
3951         * platform/text/LocaleICU.cpp:
3952         (WebCore::LocaleICU::decimalSymbol):
3953         (WebCore::LocaleICU::decimalTextAttribute):
3954         (WebCore::getDateFormatPattern):
3955         (WebCore::LocaleICU::createLabelVector):
3956         (WebCore::getFormatForSkeleton):
3957         * platform/win/FileSystemWin.cpp:
3958         (WebCore::FileSystem::getFinalPathName):
3959         (WebCore::FileSystem::pathByAppendingComponent):
3960         (WebCore::FileSystem::storageDirectory):
3961
3962 2018-05-02  Brent Fulgham  <bfulgham@apple.com>
3963
3964         Widgets should hold a WeakPtr to their parents
3965         https://bugs.webkit.org/show_bug.cgi?id=185239
3966         <rdar://problem/39741250>
3967
3968         Reviewed by Zalan Bujtas.
3969
3970         * platform/ScrollView.h:
3971         (WebCore::ScrollView::weakPtrFactory): Added.
3972         * platform/Widget.cpp:
3973         (WebCore::Widget::init): Don't perform an unnecessary assignment.
3974         (WebCore::Widget::setParent): Grab a WeakPtr to the parent ScrollView.
3975         * platform/Widget.h:
3976         (WebCore::Widget::parent const): Change type to a WeakPtr.
3977
3978 2018-05-03  Yusuke Suzuki  <utatane.tea@gmail.com>
3979
3980         Use pointer instead of std::optional<T&>
3981         https://bugs.webkit.org/show_bug.cgi?id=185186
3982
3983         Reviewed by Alex Christensen.
3984
3985         std::optional<T&> is not accepted in C++17 spec.
3986         In this patch, we replace it with T*, which is well-aligned to
3987         WebKit's convention.
3988
3989         * Modules/mediastream/RTCPeerConnection.cpp:
3990         (WebCore::iceServersFromConfiguration):
3991         (WebCore::RTCPeerConnection::initializeConfiguration):
3992         (WebCore::RTCPeerConnection::setConfiguration):
3993         * css/parser/CSSParser.cpp:
3994         (WebCore::CSSParser::parseSystemColor):
3995         * css/parser/CSSParser.h: