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