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