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