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