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