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