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