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