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