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