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