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