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