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