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