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