25497b0f6ad2c8bae0f72111ec7124f3cbd9450c
[WebKit-https.git] / Source / WebCore / ChangeLog
1 2018-06-22  Miguel Gomez  <magomez@igalia.com>
2
3         [WPE][ThreadedRendering] WPE crashes rendering some pieces of text when using ThreadedRendering
4         https://bugs.webkit.org/show_bug.cgi?id=186886
5
6         Reviewed by Žan Doberšek.
7
8         Modify DisplayList DrawGlyphs element to use a GraphicsContext for replaying. To do so, modify
9         GraphicsContext::drawGlyphs() API so it doesn't require a FontCascade, and update all the calls
10         to it.
11
12         Covered by existent tests.
13
14         * platform/graphics/FontCascade.cpp:
15         (WebCore::FontCascade::drawGlyphBuffer const):
16         * platform/graphics/GraphicsContext.cpp:
17         (WebCore::GraphicsContext::drawGlyphs):
18         * platform/graphics/GraphicsContext.h:
19         * platform/graphics/displaylists/DisplayListItems.cpp:
20         (WebCore::DisplayList::DrawGlyphs::apply const):
21         * rendering/mathml/MathOperator.cpp:
22         (WebCore::MathOperator::paintGlyph):
23         (WebCore::MathOperator::paint):
24         * rendering/mathml/RenderMathMLToken.cpp:
25         (WebCore::RenderMathMLToken::paint):
26
27 2018-06-15  Jer Noble  <jer.noble@apple.com>
28
29         Address fullscreen api CSS env feedback
30         https://bugs.webkit.org/show_bug.cgi?id=186684
31
32         Reviewed by Simon Fraser.
33
34         Test: fullscreen/fullscreen-env.html
35
36         + Update the phishing alert text to be more explicit about the specific threats
37           phishing sites represent.
38         + Make the top inset static, rather than dynamic.
39         + Add bottom, left, and right insets for completeness.
40         + Set the fullscreen animation duration as well as delay.
41         + Notify the page when the controls show and hide.
42
43         * English.lproj/Localizable.strings:
44         * css/CSSSelector.cpp:
45         (WebCore::CSSSelector::selectorText const):
46         * css/CSSSelector.h:
47         * css/SelectorChecker.cpp:
48         (WebCore::SelectorChecker::checkOne const):
49         * css/SelectorCheckerTestFunctions.h:
50         (WebCore::matchesFullScreenControlsHiddenPseudoClass):
51         * css/SelectorPseudoClassAndCompatibilityElementMap.in:
52         * cssjit/SelectorCompiler.cpp:
53         (WebCore::SelectorCompiler::addPseudoClassType):
54         * dom/ConstantPropertyMap.cpp:
55         (WebCore::ConstantPropertyMap::nameForProperty const):
56         (WebCore::ConstantPropertyMap::updateConstantsForFullscreenInsets):
57         (WebCore::ConstantPropertyMap::didChangeFullscreenInsets):
58         (WebCore::ConstantPropertyMap::setFullscreenAutoHideDuration):
59         (WebCore::ConstantPropertyMap::setFullscreenInsetTop): Deleted.
60         * dom/ConstantPropertyMap.h:
61         * dom/Document.cpp:
62         (WebCore::Document::areFullscreenControlsHidden const):
63         (WebCore::Document::setFullscreenControlsHidden):
64         * dom/Document.h:
65         * page/Page.cpp:
66         (WebCore::Page::setFullscreenInsets):
67         (WebCore::Page::setFullscreenAutoHideDuration):
68         (WebCore::Page::setFullscreenControlsHidden):
69         (WebCore::Page::setFullscreenInsetTop): Deleted.
70         * page/Page.h:
71         (WebCore::Page::fullscreenInsets const):
72         * testing/Internals.cpp:
73         (WebCore::Internals::resetToConsistentState):
74         (WebCore::Internals::setFullscreenInsets):
75         (WebCore::Internals::setFullscreenAutoHideDuration):
76         (WebCore::Internals::setFullscreenControlsHidden):
77         (WebCore::Internals::setFullscreenInsetTop): Deleted.
78         * testing/Internals.h:
79         * testing/Internals.idl:
80
81 2018-06-21  Jer Noble  <jer.noble@apple.com>
82
83         [Fullscreen] Page sometimes ends up with an incorrect zoom level after entering fullscreen
84         https://bugs.webkit.org/show_bug.cgi?id=186822
85
86         Reviewed by Simon Fraser.
87
88         * dom/Document.cpp:
89         (WebCore::Document::setOverrideViewportArguments):
90         (WebCore::Document::updateViewportArguments):
91         * dom/Document.h:
92
93 2018-06-20  Said Abou-Hallawa  <sabouhallawa@apple.com>
94
95         RenderSVGInline has to be inline always regardless of its css display value
96         https://bugs.webkit.org/show_bug.cgi?id=186656
97
98         Reviewed by Zalan Bujtas.
99
100         According to https://www.w3.org/TR/SVG2/text.html#TextLayout, the <text>
101         element has to be laid out as if it were a block element and any <tspan>,
102         <textPath>, <a> and <tref> descendants were inline elements.
103
104         If a css rule, which contains the property "display: block;", is applied
105         to any of children of a <text> element, this property has to be ignored.
106
107         We currently ignore this property in RenderSVGInline::updateFromStyle()
108         by forcing setInline(true). But we do not do the same thing in 
109         RenderTreeBuilder::normalizeTreeAfterStyleChange(). In fact we allow
110         making the children of the <text> element to be non-inline. This puts
111         the render tree in weired state and causes many assertions to fire while
112         laying out RenderSVGText. 
113
114         Test: svg/dom/svg-inline-text-display-block-crash.html
115
116         * rendering/updating/RenderTreeBuilder.cpp:
117         (WebCore::RenderTreeBuilder::normalizeTreeAfterStyleChange):
118
119 2018-06-20  Zalan Bujtas  <zalan@apple.com>
120
121         Do not reuse generated inline renderer for the first letter.
122         https://bugs.webkit.org/show_bug.cgi?id=186657
123         <rdar://problem/41157892>
124
125         Reviewed by Simon Fraser.
126
127         When the first letter pseudo element is present, we construct a dedicated subtree for its content like this:
128
129         <div><span>foobar</span></div> -> with ::first-letter on the <div>
130         DIV RenderBlock
131             SPAN RenderInline
132                 RenderInline (generated wrapper for the first letter content)
133                     RenderText (fist letter content)
134                 RenderText (remaining text content)
135
136         "display: contents" on the <span> forces us not to construct a RenderInline for the <span> (or just come up with a wrapper at best).
137         FirstLetter::createRenderers logic needs to check for such cases and pick the correct parent for the first letter subtree accordingly.
138
139         Test: fast/text/first-letter-with-display-contents-crash.html
140               imported/w3c/web-platform-tests/css/css-display/display-contents-first-letter-002.html is not crashing anymore either.
141
142         * rendering/updating/RenderTreeBuilderFirstLetter.cpp:
143         (WebCore::RenderTreeBuilder::FirstLetter::createRenderers):
144
145 2018-06-21  Chris Dumez  <cdumez@apple.com>
146
147         JSPerformanceObserverCallback creates a GC strongly-referenced Function that is never cleaned up
148         https://bugs.webkit.org/show_bug.cgi?id=186873
149         <rdar://problem/41271574>
150
151         Reviewed by Simon Fraser.
152
153         Add [IsWeakCallback] to PerformanceObserverCallback interface so that the generated
154         JSPerformanceObserverCallback uses a JSC::Weak instead of a JSC::Strong to store the
155         js function. To keep the function alive, add [JSCustomMarkFunction] to PerformanceObserver
156         interface and have its visitAdditionalChildren() visit the callback's js function.
157         Finally, because we want the callback to still be called even if the JS does not keep
158         the PerformanceObserver wrapper alive, add [CustomIsReachable] to PerformanceObserver
159         interface and have its isReachableFromOpaqueRoots() return true if the observer is
160         registered (i.e. it may need to call the callback in the future).
161
162         I have confirmed locally, that the Performance / PerformanceObserver / Document
163         objects properly get destroyed if I navigate away from a page that had a performance
164         observer and trigger a memory pressure warning. Also,
165         `notifyutil -p com.apple.WebKit.showAllDocuments` no longer shows the old document.
166
167         Tests: performance-api/performance-observer-callback-after-gc.html
168                performance-api/performance-observer-no-document-leak.html
169
170         * Sources.txt:
171         * WebCore.xcodeproj/project.pbxproj:
172         * bindings/js/JSPerformanceObserverCustom.cpp: Added.
173         (WebCore::JSPerformanceObserver::visitAdditionalChildren):
174         (WebCore::JSPerformanceObserverOwner::isReachableFromOpaqueRoots):
175         * bindings/js/ScriptController.cpp:
176         * page/PerformanceObserver.cpp:
177         (WebCore::PerformanceObserver::disassociate):
178         * page/PerformanceObserver.h:
179         (WebCore::PerformanceObserver::isRegistered const):
180         (WebCore::PerformanceObserver::callback):
181         * page/PerformanceObserver.idl:
182         * page/PerformanceObserverCallback.h:
183         * page/PerformanceObserverCallback.idl:
184
185 2018-06-20  Antoine Quint  <graouts@apple.com>
186
187         [Web Animations] Make imported/mozilla/css-animations/test_animation-ready.html pass reliably
188         https://bugs.webkit.org/show_bug.cgi?id=183830
189         <rdar://problem/40997539>
190
191         Reviewed by Dean Jackson.
192
193         The CSS Animations Level 2 spec explains how the Web Animations API and CSS Animations interact and requires
194         pending styles changes on the target element of a CSS Animation to be flushed when using a Web Animations API
195         on it in order to ensure that any animation- CSS property is accounted for.
196
197         * animation/CSSAnimation.cpp:
198         (WebCore::CSSAnimation::bindingsStartTime const):
199         (WebCore::CSSAnimation::setBindingsStartTime):
200         (WebCore::CSSAnimation::bindingsCurrentTime const):
201         (WebCore::CSSAnimation::setBindingsCurrentTime):
202         (WebCore::CSSAnimation::bindingsPlayState const):
203         (WebCore::CSSAnimation::bindingsPending const):
204         (WebCore::CSSAnimation::bindingsReady):
205         (WebCore::CSSAnimation::bindingsFinished):
206         (WebCore::CSSAnimation::bindingsPlay):
207         (WebCore::CSSAnimation::bindingsPause):
208         (WebCore::CSSAnimation::flushPendingStyleChanges const):
209         * animation/CSSAnimation.h:
210         * animation/WebAnimation.h:
211         (WebCore::WebAnimation::bindingsPlayState const):
212         (WebCore::WebAnimation::bindingsPending const):
213         (WebCore::WebAnimation::bindingsReady):
214         (WebCore::WebAnimation::bindingsFinished):
215         (WebCore::WebAnimation::bindingsPlay):
216         (WebCore::WebAnimation::bindingsPause):
217         * animation/WebAnimation.idl:
218
219 2018-06-21  Jer Noble  <jer.noble@apple.com>
220
221         [Fullscreen] Suspend page (and pause video) while phishing warning is presented
222         https://bugs.webkit.org/show_bug.cgi?id=186856
223         <rdar://problem/41212444>
224
225         Reviewed by Tim Horton.
226
227         Pause the media element when the page is suspended, and unpause when the page resumes.
228
229         * html/HTMLMediaElement.cpp:
230         (WebCore::HTMLMediaElement::HTMLMediaElement):
231         (WebCore::HTMLMediaElement::suspend):
232         (WebCore::HTMLMediaElement::resume):
233         * html/HTMLMediaElement.h:
234
235 2018-06-21  Michael Catanzaro  <mcatanzaro@igalia.com>
236
237         Bad optional access in WebCore::ContentSecurityPolicySource::portMatches
238         https://bugs.webkit.org/show_bug.cgi?id=186535
239
240         Reviewed by Daniel Bates.
241
242         Make sure the ports have explicit values before dereferencing them.
243
244         This is hard to test. If the layout test script-src-parsing-implicit-and-explicit-port-number
245         continues to pass for WebKitLegacy, then I have at least probably not broken anything. To
246         reproduce the crash in a layout test that I can run, I think I would need to implement
247         internals.registerDefaultPortForProtocol for modern WebKit, which is too much work for this
248         crash. Otherwise, we'd need to run the test server on port 80, which would be unfriendly.
249
250         * page/csp/ContentSecurityPolicySource.cpp:
251         (WebCore::ContentSecurityPolicySource::portMatches const):
252
253 2018-06-21  Fujii Hironori  <Hironori.Fujii@sony.com>
254
255         [GStreamer] ASSERTION FAILED: end.isValid() in PlatformTimeRanges::add
256         https://bugs.webkit.org/show_bug.cgi?id=186880
257
258         Reviewed by Xabier Rodriguez-Calvar.
259
260         Bug 180253 has added assertions the arugments `start` and `end` is
261         valid MediaTime in PlatformTimeRanges::add. Since then, some
262         LayoutTests fail due to the assertion failure.
263
264         The invalid MediaTime is added into the PlatformTimeRanges in
265         MediaPlayerPrivateGStreamer::buffered. Before adding MediaTime,
266         original implementation checks MediaTime::operator bool() returns
267         true. But, this method returns true if the time value is invalid.
268         Then, PlatformTimeRanges::add is called with an invalid MediaTime.
269
270         No new tests (No behavior change).
271
272         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:
273         (WebCore::MediaPlayerPrivateGStreamer::buffered const): Check
274         maxTimeLoaded() is valid before adding to `timeRanges`.
275
276 2018-06-20  David Kilzer  <ddkilzer@apple.com>
277
278         Fix leaks in WebCore found by clang static analyzer in deep mode
279         <https://webkit.org/b/186865>
280
281         Reviewed by Joseph Pecoraro.
282
283         * platform/mac/WebCoreNSURLExtras.mm:
284         (WebCore::mapHostNames): Fix leak of an empty NSMutableArray
285         during an early return.  RetainPtr<> is not used here since
286         a pointer to the NSMutableArray * is passed around.
287         * platform/mediastream/mac/ScreenDisplayCaptureSourceMac.mm:
288         (WebCore::ScreenDisplayCaptureSourceMac::createDisplayStream):
289         Fix leak of a CGDisplayModeRef during an early return.
290
291 2018-06-20  Wenson Hsieh  <wenson_hsieh@apple.com>
292
293         Unreviewed, fix the watchOS build after r233016.
294
295         * page/EventHandler.cpp:
296         (WebCore::EventHandler::selectionExtentRespectingEditingBoundary):
297
298         Move this helper out of the ENABLE(DRAG_SUPPORT) guard.
299
300         * page/EventHandler.h:
301
302 2018-06-20  Simon Fraser  <simon.fraser@apple.com>
303
304         AnimationList wastes 60KB of vector capacity
305         https://bugs.webkit.org/show_bug.cgi?id=186701
306
307         Reviewed by Chris Dumez.
308
309         AnimationList was the second most wasteful call site for Vector capacity on theverge.com,
310         wasting almost 60KB. Lists had between 1 and 3 entries, so give AnimationList's vector of
311         Animations a min capacity of zero so it doesn't grow in increments of 16.
312         
313         Also shrink Animation from 88 bytes to 72 bytes by optimizing packing.
314
315         * platform/animation/Animation.cpp:
316         (WebCore::Animation::Animation):
317         (WebCore::Animation::operator=):
318         (WebCore::Animation::animationsMatch const):
319         * platform/animation/Animation.h:
320         (WebCore::Animation::animationMode const):
321         (WebCore::Animation::setAnimationMode):
322         * platform/animation/AnimationList.h:
323
324 2018-06-20  Simon Fraser  <simon.fraser@apple.com>
325
326         ContentSecurityPolicySourceList wastes 51KB of Vector capacity on cnn.com
327         https://bugs.webkit.org/show_bug.cgi?id=186706
328
329         Reviewed by Chris Dumez.
330
331         Make ContentSecurityPolicySourceList::parse() call shrinkToFit() on m_list
332         after parsing to eliminate wasted vector capacity.
333         
334         Shrink ContentSecurityPolicySource down to 40 bytes by optimizing packing.
335
336         * page/csp/ContentSecurityPolicySource.cpp:
337         (WebCore::ContentSecurityPolicySource::ContentSecurityPolicySource):
338         * page/csp/ContentSecurityPolicySource.h:
339         * page/csp/ContentSecurityPolicySourceList.cpp:
340         (WebCore::ContentSecurityPolicySourceList::matches const):
341         (WebCore::ContentSecurityPolicySourceList::parse):
342         (WebCore::ContentSecurityPolicySourceList::matches): Deleted.
343         * page/csp/ContentSecurityPolicySourceList.h:
344
345 2018-06-20  Megan Gardner  <megan_gardner@apple.com>
346
347         Restrict Selection in contenteditable the extent of that contenteditable
348         https://bugs.webkit.org/show_bug.cgi?id=186792
349
350         Reviewed by Wenson Hsieh.
351
352         My system currently will not allow me to run tests. I will add one when I can update.
353
354         Expose the already existing funcitonality to restrict a selection to a single contentenditable
355
356         * page/EventHandler.cpp:
357         (WebCore::EventHandler::selectionExtentRespectingEditingBoundary):
358         (WebCore::selectionExtentRespectingEditingBoundary): Deleted.
359         * page/EventHandler.h:
360         * rendering/HitTestResult.h:
361
362 2018-06-20  Simon Fraser  <simon.fraser@apple.com>
363
364         CSSFontFace wastes 59KB of Vector capacity on nytimes.com
365         https://bugs.webkit.org/show_bug.cgi?id=186708
366
367         Reviewed by Anders Carlsson.
368
369         Most CSSFontFace have one or two CSSFontFaceSource so don't allocate
370         vector capacity in the default 16-size chunks.
371
372         * css/CSSFontFace.h:
373
374 2018-06-20  Antoine Quint  <graouts@apple.com>
375
376         [Web Animations] Make imported/mozilla/css-transitions/test_element-get-animations.html pass reliably
377         https://bugs.webkit.org/show_bug.cgi?id=183841
378         <rdar://problem/40998101>
379
380         Reviewed by Dean Jackson.
381
382         We must ignore CSS Animations with "animation-name: none".
383
384         * animation/AnimationTimeline.cpp:
385         (WebCore::AnimationTimeline::updateCSSAnimationsForElement):
386
387 2018-06-20  Miguel Gomez  <magomez@igalia.com>
388
389         [GTK][ThreadedRendering][Nicosia] Themed elements cannot be rendered using threaded rendering
390         https://bugs.webkit.org/show_bug.cgi?id=186840
391
392         Reviewed by Carlos Garcia Campos.
393
394         Disable threaded rendering for GTK port.
395
396         * platform/graphics/nicosia/NicosiaPaintingEngine.cpp:
397         (Nicosia::PaintingEngine::create):
398
399 2018-06-20  Yusuke Suzuki  <utatane.tea@gmail.com>
400
401         [GTK][WPE][Nicosia] Add name for Nicosia Painting Threads
402         https://bugs.webkit.org/show_bug.cgi?id=186836
403
404         Reviewed by Carlos Garcia Campos.
405
406         Use "PaintingThread" name.
407
408         * platform/graphics/nicosia/NicosiaPaintingEngineThreaded.cpp:
409         (Nicosia::PaintingEngineThreaded::PaintingEngineThreaded):
410
411 2018-06-19  Antoine Quint  <graouts@apple.com>
412
413         [Web Animations] Make imported/mozilla/css-animations/test_pseudoElement-get-animations.html pass reliably
414         https://bugs.webkit.org/show_bug.cgi?id=183818
415         <rdar://problem/40997015>
416
417         Reviewed by Dean Jackson.
418
419         We add a new opt-in flag to return sorted animations when calling AnimationTimeline::animationsForElement() so that
420         Element::getAnimations() can opt into returning animations sorted by the rules defined by the CSS Transitions spec.
421         The rule is that CSS Transitions must be sorted prior to CSS Animations and regular Web Animations, and then sorted
422         by the time they were generated and, if generated at the same time, sorted alphabetically based on the transitioned
423         property. To be able to accomodate this, we add a new generationTime() method to CSSTransition.
424
425         * animation/AnimationTimeline.cpp:
426         (WebCore::AnimationTimeline::animationsForElement const):
427         (WebCore::AnimationTimeline::updateCSSTransitionsForElement):
428         * animation/AnimationTimeline.h:
429         * animation/CSSTransition.cpp:
430         (WebCore::CSSTransition::create):
431         (WebCore::CSSTransition::CSSTransition):
432         * animation/CSSTransition.h:
433         * dom/Element.cpp:
434         (WebCore::Element::getAnimations):
435
436 2018-06-19  Basuke Suzuki  <Basuke.Suzuki@sony.com>
437
438         [Curl] Allow passing contents of Root CA data directly.
439         https://bugs.webkit.org/show_bug.cgi?id=185782
440
441         Currently the data must be in a file and set by its path. This patch
442         allow application to set root CA data by passing binary data directly.
443
444         Reviewed by Yusuke Suzuki.
445
446         No new tests. Tested internally.
447
448         * platform/network/curl/CurlRequest.cpp:
449         (WebCore::CurlRequest::setupTransfer):
450         * platform/network/curl/CurlSSLHandle.cpp:
451         (WebCore::CurlSSLHandle::CurlSSLHandle):
452         (WebCore::CurlSSLHandle::getCACertPathEnv):
453         (WebCore::CurlSSLHandle::setCACertPath):
454         (WebCore::CurlSSLHandle::setCACertData):
455         (WebCore::CurlSSLHandle::clearCACertInfo):
456         * platform/network/curl/CurlSSLHandle.h:
457         (WebCore::CurlSSLHandle::getCipherList const):
458         (WebCore::CurlSSLHandle::getSignatureAlgorithmsList const):
459         (WebCore::CurlSSLHandle::getCurvesList const):
460         (WebCore::CurlSSLHandle::setCipherList):
461         (WebCore::CurlSSLHandle::setSignatureAlgorithmsList):
462         (WebCore::CurlSSLHandle::setCurvesList):
463         (WebCore::CurlSSLHandle::setIgnoreSSLErrors):
464         (WebCore::CurlSSLHandle::getCACertInfo const):
465         (WebCore::CurlSSLHandle::getCACertPath const): Deleted.
466         (WebCore::CurlSSLHandle::setCACertPath): Deleted.
467         * platform/network/curl/CurlSSLVerifier.cpp:
468         (WebCore::CurlSSLVerifier::CurlSSLVerifier):
469
470 2018-06-19  Dean Jackson  <dino@apple.com>
471
472         ARKit badge drop shadow updates its blur radius based on page zoom
473         https://bugs.webkit.org/show_bug.cgi?id=186829
474         <rdar://problem/40738779>
475
476         Reviewed by Tim Horton.
477
478         We need to make sure the shadow blur radius takes into account the
479         current zoom. Thankfully, the GraphicsContext platform code already
480         does this, so just use it.
481
482         * rendering/RenderThemeIOS.mm:
483         (WebCore::RenderThemeIOS::paintSystemPreviewBadge):
484
485 2018-06-19  Dean Jackson  <dino@apple.com>
486
487         Blank viewer comes up and then auto-dismisses when device is not connected to Internet
488         https://bugs.webkit.org/show_bug.cgi?id=186825
489         <rdar://problem/40294170>
490
491         Reviewed by Tim Horton.
492
493         Export isSuccessful() to WebKit.
494
495         * platform/network/ResourceResponseBase.h:
496
497 2018-06-19  Basuke Suzuki  <Basuke.Suzuki@sony.com>
498
499         [Curl] Enable Proxy Authentication.
500         https://bugs.webkit.org/show_bug.cgi?id=185266
501
502         Add support for Proxy Authentication to curl network layer.
503
504         Reviewed by Alex Christensen.
505
506         No new tests in public. Tested internally.
507
508         * platform/network/curl/AuthenticationChallenge.h:
509         * platform/network/curl/AuthenticationChallengeCurl.cpp:
510         (WebCore::AuthenticationChallenge::protectionSpaceServerTypeFromURI):
511         (WebCore::AuthenticationChallenge::protectionSpaceFromHandle):
512         (WebCore::AuthenticationChallenge::determineProxyPort):
513         (WebCore::AuthenticationChallenge::authenticationSchemeFromCurlAuth):
514         (WebCore::AuthenticationChallenge::parseRealm):
515         * platform/network/curl/CurlContext.cpp:
516         (WebCore::CurlHandle::enableProxyIfExists):
517         (WebCore::CurlHandle::getProxyUrl):
518         (WebCore::CurlHandle::getProxyAuthAvail):
519         (WebCore::CurlHandle::getPrimaryPort): Deleted.
520         * platform/network/curl/CurlContext.h:
521         (WebCore::CurlContext::setDefaultProxyAuthMethod):
522         (WebCore::CurlContext::setProxyAuthMethod):
523         * platform/network/curl/CurlProxySettings.cpp:
524         (WebCore::determineAuthMethod):
525         (WebCore::CurlProxySettings::setAuthMethod):
526         (WebCore::protocolIsInSocksFamily):
527         * platform/network/curl/CurlProxySettings.h:
528         (WebCore::CurlProxySettings::setDefaultAuthMethod):
529         (WebCore::CurlProxySettings::authMethod const):
530         * platform/network/curl/CurlRequest.cpp:
531         (WebCore::CurlRequest::didReceiveHeader):
532         * platform/network/curl/CurlResponse.h:
533         (WebCore::CurlResponse::isolatedCopy const):
534         * platform/network/curl/ResourceResponse.h:
535         * platform/network/curl/ResourceResponseCurl.cpp:
536         (WebCore::ResourceResponse::isProxyAuthenticationRequired const):
537
538 2018-06-19  Tim Horton  <timothy_horton@apple.com>
539
540         Unpainted area while scrolling in Reader is white
541         https://bugs.webkit.org/show_bug.cgi?id=186541
542         <rdar://problem/40471363>
543
544         Reviewed by Timothy Hatcher.
545
546         New test: tiled-drawing/simple-document-with-dynamic-background-color.html
547
548         For platforms that do not use the overhang layer, we depend on
549         RenderView's background color to fill unpainted space.
550
551         RenderView's background color is only updated inside updateRootLayerConfiguration,
552         and it is possible with a simple enough page to change the document's
553         background color without running that code.
554
555         * page/FrameView.cpp:
556         (WebCore::FrameView::setTransparent):
557         (WebCore::FrameView::setBaseBackgroundColor):
558         Make use of the newly added rootBackgroundColorOrTransparencyChanged.
559
560         (WebCore::FrameView::calculateExtendedBackgroundMode const):
561         Update a comment, since the function it mentioned is no longer.
562
563         (WebCore::FrameView::updateTilesForExtendedBackgroundMode):
564         Remove this code that clears the root extended background color
565         if using tiles to extend in both directions. Two reasons:
566         1) it seems harmless to also have a root extended background color
567         2) this just gets clobbered by the call in RenderView::paintBoxDecorations
568
569         * rendering/RenderLayerCompositor.cpp:
570         (WebCore::RenderLayerCompositor::updateCompositingLayers):
571         Add a bit that will do a updateConfiguration() on the root layer if no
572         other work needs to be done, so that we can update the root layer's
573         transparency or background color without doing a full layer rebuild.
574
575         (WebCore::RenderLayerCompositor::rootOrBodyStyleChanged):
576         Make use of the newly added rootBackgroundColorOrTransparencyChanged.
577
578         (WebCore::RenderLayerCompositor::rootBackgroundColorOrTransparencyChanged):
579         Change rootBackgroundTransparencyChanged to also cover color changes.
580         Fold setRootExtendedBackgroundColor in here, and make use of
581         setRootLayerConfigurationNeedsUpdate() instead of doing a full rebuild.
582         Previously, we would bail if the transparency state hadn't changed;
583         now, we'll also update the root layer's background color and the
584         exposed-to-WebKit extended background color if they change too.
585
586         (WebCore::RenderLayerCompositor::rootBackgroundTransparencyChanged): Deleted.
587         (WebCore::RenderLayerCompositor::setRootExtendedBackgroundColor): Deleted.
588
589         * rendering/RenderLayerCompositor.h:
590         Add setRootLayerConfigurationNeedsUpdate, remove setRootExtendedBackgroundColor,
591         and add both a bit indicating that the root layer configuration needs updating
592         and the cached view background color to make the early return in
593         rootBackgroundColorOrTransparencyChanged possible.
594
595         * rendering/RenderView.cpp:
596         (WebCore::RenderView::paintBoxDecorations):
597         Make use of the newly added rootBackgroundColorOrTransparencyChanged.
598
599 2018-06-19  Youenn Fablet  <youenn@apple.com>
600
601         Need to properly handle removal of worker in SWServer::unregisterServiceWorkerClient timer lambda
602         https://bugs.webkit.org/show_bug.cgi?id=186674
603         <rdar://problem/40974812>
604
605         Reviewed by Chris Dumez.
606
607         While looping over the running workers map and trying to terminate some of the workers,
608         there is a chance that the map will be modified synchronously which may affect iterating the map.
609         This patch removes that potential threat.
610
611         * workers/service/server/SWServer.cpp:
612         (WebCore::SWServer::unregisterServiceWorkerClient):
613
614 2018-06-19  Antoine Quint  <graouts@apple.com>
615
616         [Web Animations] Make imported/mozilla/css-animations/test_animation-playstate.html pass reliably
617         https://bugs.webkit.org/show_bug.cgi?id=183828
618         <rdar://problem/40997469>
619
620         Reviewed by Dean Jackson.
621
622         We need to ensure pending styles have been resolved prior to returning the play state for a CSS Animation since
623         it can be controlled by the animation-play-state CSS property. To that end we expose a specific bindings-only
624         method which we override for CSSAnimation to force a style update.
625
626         * animation/CSSAnimation.cpp:
627         (WebCore::CSSAnimation::bindingsPlayState const):
628         * animation/CSSAnimation.h:
629         * animation/WebAnimation.h:
630         (WebCore::WebAnimation::bindingsPlayState const):
631         * animation/WebAnimation.idl:
632
633 2018-06-19  David Kilzer  <ddkilzer@apple.com>
634
635         Revert: Add logging when splashboardd enables WebThread
636         <https://webkit.org/b/186793>
637         <rdar://problem/41213255>
638
639         Turns out this isn't needed, so reverting r232959.
640
641         * platform/RuntimeApplicationChecks.h:
642         * platform/cocoa/RuntimeApplicationChecksCocoa.mm:
643         (WebCore::IOSApplication::isSplashBoardd): Deleted.
644         * platform/ios/wak/WebCoreThread.mm:
645         (WebThreadEnable):
646
647 2018-06-19  Wenson Hsieh  <wenson_hsieh@apple.com>
648
649         [WebKit on watchOS] Vend username text content type when using scribble in login fields
650         https://bugs.webkit.org/show_bug.cgi?id=186791
651         <rdar://problem/41226935>
652
653         Reviewed by Beth Dakin.
654
655         Expose AutofillElements' autofillable username input element. See WebKit ChangeLog for more details.
656
657         * editing/ios/AutofillElements.h:
658         (WebCore::AutofillElements::username const):
659
660 2018-06-19  Chris Dumez  <cdumez@apple.com>
661
662         WebCoreNSURLSessionDataTaskClient::redirectReceived() calls WebCore on non-main thread
663         https://bugs.webkit.org/show_bug.cgi?id=186805
664         <rdar://problem/36960714>
665
666         Reviewed by Youenn Fablet.
667
668         Make sure WebCoreNSURLSessionDataTaskClient::redirectReceived() dispatches to the main
669         thread before calling its completion handler. Otherwise, we end up calling into WebCore
670         on a NSOperationQueue background thread and we crash.
671
672         * platform/network/cocoa/WebCoreNSURLSession.mm:
673         (WebCore::WebCoreNSURLSessionDataTaskClient::redirectReceived):
674
675 2018-06-19  Chris Dumez  <cdumez@apple.com>
676
677         HTTPHeaderMap wastes 226KB of HashTable capacity on cnn.com
678         https://bugs.webkit.org/show_bug.cgi?id=186735
679         <rdar://problem/41189164>
680
681         Reviewed by Geoffrey Garen.
682
683         Resource requests and responses normally do not have a large amount of HTTP headers
684         (local testing shows 6 common headers on average and 0.3 uncommon ones).
685         As a result, move the internal representation of HTTPHeaderMap from HashMaps to
686         Vectors. Given the number of headers, the impact on performance should be negligible.
687         However, the new implementation uses a lot less memory. In a follow-up, we can save
688         even more memory by calling HTTPHeaderMap::shrinkToFit() when possible.
689
690         * loader/CrossOriginAccessControl.cpp:
691         (WebCore::createAccessControlPreflightRequest):
692         * loader/DocumentLoader.cpp:
693         (WebCore::DocumentLoader::responseReceived):
694         * loader/cache/CachedRawResource.cpp:
695         (WebCore::CachedRawResource::canReuse const):
696         * platform/network/HTTPHeaderMap.cpp:
697         (WebCore::HTTPHeaderMap::isolatedCopy const):
698         (WebCore::HTTPHeaderMap::get const):
699         (WebCore::HTTPHeaderMap::set):
700         (WebCore::HTTPHeaderMap::add):
701         (WebCore::HTTPHeaderMap::append):
702         (WebCore::HTTPHeaderMap::addIfNotPresent):
703         (WebCore::HTTPHeaderMap::contains const):
704         (WebCore::HTTPHeaderMap::remove):
705         * platform/network/HTTPHeaderMap.h:
706         (WebCore::HTTPHeaderMap::CommonHeader::isolatedCopy const):
707         (WebCore::HTTPHeaderMap::CommonHeader::operator== const):
708         (WebCore::HTTPHeaderMap::UncommonHeader::isolatedCopy const):
709         (WebCore::HTTPHeaderMap::UncommonHeader::operator== const):
710         (WebCore::HTTPHeaderMap::HTTPHeaderMapConstIterator::HTTPHeaderMapConstIterator):
711         (WebCore::HTTPHeaderMap::HTTPHeaderMapConstIterator::updateKeyValue):
712         (WebCore::HTTPHeaderMap::shrinkToFit):
713         (WebCore::HTTPHeaderMap::commonHeaders const):
714         (WebCore::HTTPHeaderMap::uncommonHeaders const):
715         (WebCore::HTTPHeaderMap::commonHeaders):
716         (WebCore::HTTPHeaderMap::uncommonHeaders):
717         (WebCore::HTTPHeaderMap::CommonHeader::encode const):
718         (WebCore::HTTPHeaderMap::CommonHeader::decode):
719         (WebCore::HTTPHeaderMap::UncommonHeader::encode const):
720         (WebCore::HTTPHeaderMap::UncommonHeader::decode):
721         (WebCore::HTTPHeaderMap::encode const):
722         (WebCore::HTTPHeaderMap::decode):
723         * platform/network/ResourceResponseBase.cpp:
724         (WebCore::ResourceResponseBase::filter):
725         (WebCore::ResourceResponseBase::sanitizeHTTPHeaderFields):
726
727 2018-06-19  Youenn Fablet  <youenn@apple.com>
728
729         Network Preflights do not show in WebInspector after moving CORS checks to NetworkProcess
730         https://bugs.webkit.org/show_bug.cgi?id=186312
731         <rdar://problem/40495434>
732
733         Reviewed by Chris Dumez.
734
735         Test: http/wpt/fetch/inspect-preflight.html
736
737         No change of behavior in regular conditions.
738         All intermediate requests/responses are now buffered in NetworkProcess if Web inspector shows up.
739         Add NetworkLoadInformation and NetworkIntermediateLoadInformation for that purpose.
740
741         Add a new LoaderStrategy method to grab this information from NetworkProcess synchronously.
742         Add Internals API for testing the storage by the Network Process and the sending to WebProcess.
743
744         * WebCore.xcodeproj/project.pbxproj:
745         * loader/LoaderStrategy.cpp:
746         (WebCore::LoaderStrategy::intermediateLoadInformationFromResourceLoadIdentifier):
747         * loader/LoaderStrategy.h:
748         * platform/network/NetworkLoadInformation.h: Added.
749         (WebCore::NetworkTransactionInformation::encode const):
750         (WebCore::NetworkTransactionInformation::decode):
751         * testing/Internals.cpp:
752         (WebCore::Internals::setCaptureExtraNetworkLoadMetricsEnabled):
753         (WebCore::Internals::ongoingLoadDescriptions):
754         * testing/Internals.h:
755         * testing/Internals.idl:
756
757 2018-06-19  Antoine Quint  <graouts@apple.com>
758
759         [Web Animations] Make imported/mozilla/css-transitions/test_animation-cancel.html pass reliably
760         https://bugs.webkit.org/show_bug.cgi?id=183821
761         <rdar://problem/40997034>
762
763         Reviewed by Dean Jackson.
764
765         If an element gets a "display: none" style RenderTreeUpdater::tearDownRenderers() will be called with a RendererUpdateCancelingAnimations
766         teardown type on all of its children. We need to ensure all declarative animations, and only those since regular Web Animations should be
767         kept active regardless of their target's style, are canceled in this situation.
768
769         * animation/AnimationTimeline.cpp:
770         (WebCore::AnimationTimeline::cancelDeclarativeAnimationsForElement):
771         * animation/AnimationTimeline.h:
772         * rendering/updating/RenderTreeUpdater.cpp:
773         (WebCore::RenderTreeUpdater::tearDownRenderers):
774
775 2018-06-19  David Kilzer  <ddkilzer@apple.com>
776
777         Add logging when splashboardd enables WebThread
778         <https://webkit.org/b/186793>
779         <rdar://problem/41213255>
780
781         Reviewed by Daniel Bates.
782
783         * platform/RuntimeApplicationChecks.h:
784         (WebCore::IOSApplication::isSplashBoardd): Add declaration.
785         * platform/cocoa/RuntimeApplicationChecksCocoa.mm:
786         (WebCore::IOSApplication::isSplashBoardd): Add implementation.
787         * platform/ios/wak/WebCoreThread.mm:
788         (WebThreadEnable): Call RELEASE_LOG_FAULT() if this is called by
789         splashboardd.
790
791 2018-06-19  Miguel Gomez  <magomez@igalia.com>
792
793         [GTK][WPE][Nicosia] Add environment variable to enable threaded rendering and set the number of painting threads
794         https://bugs.webkit.org/show_bug.cgi?id=186801
795
796         Reviewed by Carlos Garcia Campos.
797
798         Add and environment variable to enable the usage of the threaded renderer and define the number
799         of painting threads.
800
801         No new tests.
802
803         * platform/graphics/nicosia/NicosiaPaintingEngine.cpp:
804         (Nicosia::PaintingEngine::create):
805         * platform/graphics/nicosia/NicosiaPaintingEngineThreaded.cpp:
806         (Nicosia::PaintingEngineThreaded::PaintingEngineThreaded):
807         * platform/graphics/nicosia/NicosiaPaintingEngineThreaded.h:
808
809 2018-06-19  Youenn Fablet  <youenn@apple.com>
810
811         RTCRtpSender.replaceTrack(null) ends current track
812         https://bugs.webkit.org/show_bug.cgi?id=184911
813         <rdar://problem/40758138>
814
815         Reviewed by Eric Carlson.
816
817         Before the patch, when replacing the sender track by null, the previous track was stopped.
818         Instead of doing that, the track now stays alive and it is the realtime source that is stopped.
819         This ensures that the data is no longer sent while the track can still be used elsewhere.
820
821         Covered by updated and rebased tests.
822
823         * Modules/mediastream/PeerConnectionBackend.h:
824         * Modules/mediastream/RTCPeerConnection.cpp:
825         (WebCore::RTCPeerConnection::addTransceiver):
826         (WebCore::RTCPeerConnection::enqueueReplaceTrackTask):
827         (WebCore::RTCPeerConnection::replaceTrack):
828         * Modules/mediastream/RTCPeerConnection.h:
829         * Modules/mediastream/RTCRtpSender.cpp:
830         (WebCore::RTCRtpSender::replaceTrack):
831         * Modules/mediastream/libwebrtc/LibWebRTCPeerConnectionBackend.cpp:
832         (WebCore::updateTrackSource):
833         (WebCore::LibWebRTCPeerConnectionBackend::replaceTrack):
834         * Modules/mediastream/libwebrtc/LibWebRTCPeerConnectionBackend.h:
835
836 2018-06-18  Chris Dumez  <cdumez@apple.com>
837
838         Better pack ResourceRequest
839         https://bugs.webkit.org/show_bug.cgi?id=186717
840
841         Reviewed by Darin Adler.
842
843         Better pack ResourceRequest to reduce its size from 240 to 232 bytes
844         on Mac.
845
846         * platform/network/ResourceRequestBase.h:
847
848 2018-06-18  Antoine Quint  <graouts@apple.com>
849
850         [Web Animations] Implement "Starting of transitions" section from CSS Transitions
851         https://bugs.webkit.org/show_bug.cgi?id=186517
852         <rdar://problem/41000798>
853
854         Reviewed by Dean Jackson.
855
856         We implement the whole section at https://drafts.csswg.org/css-transitions-1/#starting so that we have spec-compliant starting of CSS Transitions.
857         To correctly implement this we now maintain two maps of transitions for a given property, a set of running transitions (m_elementToRunningCSSTransitionByCSSPropertyID)
858         and a set of completed transition (m_elementToCompletedCSSTransitionByCSSPropertyID).
859
860         * animation/AnimationTimeline.cpp:
861         (WebCore::removeCSSTransitionFromMap): Add a utility to remove a CSSTransition from one of the two HashMap<Element*, HashMap<CSSPropertyID, RefPtr<CSSTransition>>>
862         managed by AnimationTimeline (m_elementToRunningCSSTransitionByCSSPropertyID and m_elementToCompletedCSSTransitionByCSSPropertyID).
863         (WebCore::AnimationTimeline::animationWasRemovedFromElement): Use the new removeCSSTransitionFromMap() utility.
864         (WebCore::AnimationTimeline::updateCSSAnimationsForElement): We rename "oldStyle" to "currentStyle" to align with the naming used by updateCSSAnimationsForElement().
865         We also remove an initial check that has been pushed up to Style::TreeResolver::createAnimatedElementUpdate().
866         (WebCore::propertyInStyleMatchesValueForTransitionInMap): When running the steps mandated by the spec we often need to check whether a given property has a transition
867         in an AnimationList that matches the value used in a given RenderStyle.
868         (WebCore::transitionCombinedDuration): We need to compute the combined duration twice while running the steps mandated by the spec, so we have a dedicated utility.
869         (WebCore::transitionMatchesProperty): New utility that indicates whether a WebCore::Animation matches a given property, by virtue of targeting it directly, targeting
870         a shorthand for which this property is a longhand, or targeting "all".
871         (WebCore::AnimationTimeline::updateCSSTransitionsForElement): This is where all of the new implementation for starting transitions happens. We implement the steps
872         as they appear in the spec.
873         (WebCore::shouldBackingAnimationBeConsideredForCSSTransition): Deleted.
874         * animation/AnimationTimeline.h:
875         * animation/CSSAnimation.cpp:
876         (WebCore::CSSAnimation::syncPropertiesWithBackingAnimation): Since only CSS Animations respect the delay and duration values as parsed directly in a WebCore:Animation
877         object, we move code that was previously in DeclarativeAnimation::syncPropertiesWithBackingAnimation to this method. CSS Transitions set those values based on the
878         delay and duration parameters passed to CSSTransition::create() and computed in AnimationTimeline::updateCSSTransitionsForElement().
879         * animation/CSSTransition.cpp:
880         (WebCore::CSSTransition::create): Since the transition's delay and duration is computed in AnimationTimeline::updateCSSTransitionsForElement(), we now require them
881         to be passed when creating a CSSTransition and pass those to the new setTimingProperties() function. We also expect a target style and reversing-adjusted start style,
882         as well as a reversing-shortening factor.
883         (WebCore::CSSTransition::CSSTransition): 
884         (WebCore::CSSTransition::resolve): We need to be able to query the last style computed by a call to resolve() from AnimationTimeline::updateCSSTransitionsForElement(),
885         we subclass this newly-virtual WebAnimation method and clone the style after we blended the property targeted by this transition.
886         (WebCore::CSSTransition::setTimingProperties): Set the transition delay and duration as provided in the call to create().
887         (WebCore::CSSTransition::canBeListed const): Fix a crash that was found while working on this bug where we could access a null effect.
888         (WebCore::CSSTransition::initialize): Deleted.
889         (WebCore::CSSTransition::matchesBackingAnimationAndStyles const): Deleted.
890         * animation/CSSTransition.h:
891         * animation/DeclarativeAnimation.cpp:
892         (WebCore::DeclarativeAnimation::syncPropertiesWithBackingAnimation): This virtual method now has an empty definition since the timing properties are now only set
893         for CSSAnimation.
894         * animation/KeyframeEffectReadOnly.cpp:
895         (WebCore::KeyframeEffectReadOnly::stylesWouldYieldNewCSSTransitionsBlendingKeyframes const): Deleted.
896         * animation/KeyframeEffectReadOnly.h:
897         * animation/WebAnimation.h:
898         * page/animation/CSSPropertyAnimation.cpp:
899         (WebCore::AnimationPropertyWrapperBase::canInterpolate const): Since we need to be able to determine whether some property values can be interpolated, we add a new
900         canInterpolate() method to the base wrapper class so the cases where we can't interpolate values (length with an "auto" type) may return false.
901         (WebCore::LengthPropertyWrapper::LengthPropertyWrapper): Lengths can only be interpolated if both the start and end values are not "auto".
902         (WebCore::LengthVariantPropertyWrapper::LengthVariantPropertyWrapper):
903         (WebCore::CSSPropertyAnimationWrapperMap::CSSPropertyAnimationWrapperMap):
904         (WebCore::CSSPropertyAnimation::canPropertyBeInterpolated):
905         * page/animation/CSSPropertyAnimation.h:
906         * style/StyleTreeResolver.cpp:
907         (WebCore::Style::TreeResolver::createAnimatedElementUpdate): Move a check found in both updateCSSAnimationsForElement() and updateCSSTransitionsForElement() to their
908         shared call site.
909
910 2018-06-18  Nan Wang  <n_wang@apple.com>
911
912         AX: [macOS] When zoom is enabled, focus doesn't follow text cursor
913         https://bugs.webkit.org/show_bug.cgi?id=186697
914
915         Reviewed by Darin Adler.
916
917         Now that web process doesn't have access to NSScreen. The conversion of the 
918         rects is wrong. Fixed this by using the right function that's available in
919         WebCore to get the rects.
920
921         * editing/mac/FrameSelectionMac.mm:
922         (WebCore::accessibilityConvertScreenRect):
923
924 2018-06-18  Youenn Fablet  <youenn@apple.com>
925
926         Expose RTCPeerConnectionIceEventInit constructor
927         https://bugs.webkit.org/show_bug.cgi?id=186770
928
929         Reviewed by Alex Christensen.
930
931         Add event constructor as per specification.
932         Add support for the url attribute.
933         For that purpose, we need to pipe that information from LibWebRTCMediaEndpoint
934         up to RTCPeerConnectionIceEvent.
935
936         Covered by rebased test.
937
938         * Modules/mediastream/PeerConnectionBackend.cpp:
939         (WebCore::PeerConnectionBackend::fireICECandidateEvent):
940         (WebCore::PeerConnectionBackend::disableICECandidateFiltering):
941         (WebCore::PeerConnectionBackend::newICECandidate):
942         (WebCore::PeerConnectionBackend::doneGatheringCandidates):
943         (WebCore::PeerConnectionBackend::finishedRegisteringMDNSName):
944         * Modules/mediastream/PeerConnectionBackend.h:
945         * Modules/mediastream/RTCPeerConnectionIceEvent.cpp:
946         (WebCore::RTCPeerConnectionIceEvent::create):
947         (WebCore::RTCPeerConnectionIceEvent::RTCPeerConnectionIceEvent):
948         * Modules/mediastream/RTCPeerConnectionIceEvent.h:
949         (WebCore::RTCPeerConnectionIceEvent::url const):
950         * Modules/mediastream/RTCPeerConnectionIceEvent.idl:
951         * Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.cpp:
952         (WebCore::LibWebRTCMediaEndpoint::OnIceCandidate):
953         * bindings/js/WebCoreBuiltinNames.h:
954         * dom/EventNames.in:
955
956 2018-06-18  Simon Fraser  <simon.fraser@apple.com>
957
958         SVGTransformListValues wastes 127KB of Vector capacity on nytimes.com
959         https://bugs.webkit.org/show_bug.cgi?id=186704
960
961         Reviewed by Said Abou-Hallawa.
962
963         SVGTransformListValues has inline capacity 1, and every SVGGraphicsElement has
964         a SVGSynchronizableAnimatedProperty<WebCore::SVGTransformListValues>, so the inline
965         capacity wastes space for every SVGGraphicsElement that doesn't have a transform (i.e.
966         most of them).
967         
968         So make SVGTransformListValues have zero inline capacity, and set its min capacity to
969         2, rather than the default 16, since most transform lists are short.
970
971         * svg/SVGTransformListValues.h:
972
973 2018-06-18  Said Abou-Hallawa  <sabouhallawa@apple.com>
974
975         Document should not be mutated under SMILTimeContainer::updateAnimations()
976         https://bugs.webkit.org/show_bug.cgi?id=186658
977
978         Reviewed by Simon Fraser.
979
980         To update the animation of an SVG <animate> element, we call
981         SVGAnimateElementBase::resetAnimatedType(). It ensures the pointer m_animator
982         is valid. If it animates a css property, it calls computeCSSPropertyValue()
983         which calls resolveStyle() via other calls. resolveStyle() may call delayed
984         callbacks through the destructor of PostResolutionCallbackDisabler. These
985         callbacks may fire events. These events may execute JS event handlers.
986         If one of these event handlers deletes the same SVG <animate> we animate,
987         we will end up calling SVGAnimateElementBase::resetAnimatedPropertyType()
988         of the same <animate> element. This function  will delete the same m_animator
989         which resetAnimatedType() still holds and will use later. This code
990         re-entrance is unexpected and unwanted.
991
992         The fix is to disable mutating the DOM while updating the SVG animations.
993
994         Test: svg/dom/css-animate-input-foucs-crash.html
995
996         * svg/animation/SMILTimeContainer.cpp:
997         (WebCore::SMILTimeContainer::updateAnimations):
998
999 2018-06-18  Commit Queue  <commit-queue@webkit.org>
1000
1001         Unreviewed, rolling out r232935.
1002         https://bugs.webkit.org/show_bug.cgi?id=186783
1003
1004         This patch broke macOS 32-bit build (Requested by n_wang on
1005         #webkit).
1006
1007         Reverted changeset:
1008
1009         "AX: [macOS] When zoom is enabled, focus doesn't follow text
1010         cursor"
1011         https://bugs.webkit.org/show_bug.cgi?id=186697
1012         https://trac.webkit.org/changeset/232935
1013
1014 2018-06-18  Nan Wang  <n_wang@apple.com>
1015
1016         AX: [macOS] When zoom is enabled, focus doesn't follow text cursor
1017         https://bugs.webkit.org/show_bug.cgi?id=186697
1018
1019         Reviewed by Darin Adler.
1020
1021         Now that web process doesn't have access to NSScreen. The conversion of the 
1022         rects is wrong. Fixed this by using the right function that's available in
1023         WebCore to convert the rects.
1024
1025         * editing/mac/FrameSelectionMac.mm:
1026         (WebCore::accessibilityConvertScreenRect):
1027
1028 2018-06-18  Youenn Fablet  <youenn@apple.com>
1029
1030         Validate Cross-Origin-Resource-Policy for resources cached in the MemoryCache
1031         https://bugs.webkit.org/show_bug.cgi?id=186639
1032         <rdar://problem/41106984>
1033
1034         Reviewed by Geoffrey Garen.
1035
1036         Add a method to check CORP.
1037         Make use of it to validate any memory cached resource.
1038         Whitelist CORP header so that it is not filtered out by Network Process.
1039
1040         Test: http/wpt/cross-origin-resource-policy/image-in-iframe-loads.html
1041
1042         * loader/CrossOriginAccessControl.cpp:
1043         (WebCore::shouldCrossOriginResourcePolicyCancelLoad):
1044         (WebCore::validateCrossOriginResourcePolicy):
1045         * loader/CrossOriginAccessControl.h:
1046         * loader/cache/CachedResourceLoader.cpp:
1047         (WebCore::CachedResourceLoader::requestResource):
1048         * platform/network/ResourceResponseBase.cpp:
1049         (WebCore::isSafeRedirectionResponseHeader):
1050         (WebCore::isSafeCrossOriginResponseHeader):
1051
1052 2018-06-18  Carlos Alberto Lopez Perez  <clopez@igalia.com>
1053
1054         [WTF] Remove workarounds needed to support libstdc++-4
1055         https://bugs.webkit.org/show_bug.cgi?id=186762
1056
1057         Reviewed by Michael Catanzaro.
1058
1059         Revert r226299, r226300 r226301 and r226302.
1060
1061         No new tests, no change in behaviour.
1062
1063         * platform/graphics/FontSelectionAlgorithm.h:
1064         (WebCore::FontSelectionValue::clampFloat):
1065         * platform/graphics/avfoundation/cf/MediaPlayerPrivateAVFoundationCF.cpp:
1066         (WebCore::MediaPlayerPrivateAVFoundationCF::currentMediaTime const):
1067         * platform/graphics/win/UniscribeController.cpp:
1068         (WebCore::UniscribeController::shapeAndPlaceItem):
1069
1070 2018-06-18  Karl Leplat  <karl.leplat_ext@softathome.com>
1071
1072         [Threaded paintingEngine] Fix rendering glitches
1073         https://bugs.webkit.org/show_bug.cgi?id=186764
1074
1075         Reviewed by Žan Doberšek.
1076
1077         * platform/graphics/nicosia/NicosiaPaintingEngineBasic.cpp:
1078         (Nicosia::PaintingEngineBasic::paint):
1079         To keep backwards compatibility with no multi-threaded,
1080         we call Nicosia::Buffer functions beginPainting() and completePainting().
1081
1082
1083 2018-06-18  Tomas Popela  <tpopela@redhat.com>
1084
1085         Properly check the sscanf return valua
1086         https://bugs.webkit.org/show_bug.cgi?id=186757
1087
1088         Reviewed by Carlos Garcia Campos.
1089
1090         Check if we matched anything and if we matched the expected amount of
1091         data.
1092
1093         * page/linux/ResourceUsageThreadLinux.cpp:
1094         (WebCore::cpuPeriod):
1095
1096 2018-06-18  Tomas Popela  <tpopela@redhat.com>
1097
1098         [GTK] Wrong variable used in RenderThemeGtk
1099         https://bugs.webkit.org/show_bug.cgi?id=186756
1100
1101         Reviewed by Carlos Garcia Campos.
1102
1103         Use SliderThumbHorizontalPart instead of SliderHorizontalPart.
1104
1105         * rendering/RenderThemeGtk.cpp:
1106         (WebCore::RenderThemeGtk::adjustSliderThumbSize const):
1107
1108 2018-06-18  Philippe Normand  <pnormand@igalia.com>
1109
1110         [GStreamer] Crash when adding in-band text track with playbin3 enabled
1111         https://bugs.webkit.org/show_bug.cgi?id=186654
1112
1113         Reviewed by Xabier Rodriguez-Calvar.
1114
1115         Text track indexes should be relative to the total amount of
1116         in-band text tracks. The previous code would induce the creation
1117         of in-band text tracks with indexes relative to the total amount
1118         of all in-band (audio, video, text) tracks.
1119
1120         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:
1121         (WebCore::MediaPlayerPrivateGStreamer::updateTracks):
1122
1123 2018-06-17  Zalan Bujtas  <zalan@apple.com>
1124
1125         Anonymous block collapsing can destroy the renderer's parent.
1126         https://bugs.webkit.org/show_bug.cgi?id=186655
1127         <rdar://problem/41157554>
1128
1129         Reviewed by Antti Koivisto.
1130
1131         While destroying a chain of renderers (text renderer -> first letter renderer), we need to
1132         check if the anonymous block collapsing destroyed the parent renderer (see webkit.org/b/186746).
1133
1134         Test: fast/text/first-letter-with-anon-wrapper-crash.html
1135
1136         * rendering/updating/RenderTreeBuilder.cpp:
1137         (WebCore::RenderTreeBuilder::destroyAndCleanUpAnonymousWrappers):
1138
1139 2018-06-17  Wenson Hsieh  <wenson_hsieh@apple.com>
1140
1141         [WebKit on watchOS] Upstream watchOS source additions to OpenSource (Part 3)
1142         https://bugs.webkit.org/show_bug.cgi?id=186442
1143         <rdar://problem/40879364>
1144
1145         Reviewed by Darin Adler.
1146
1147         Rename references to "Extra zoom mode". No change in behavior.
1148
1149         * page/DisabledAdaptations.cpp:
1150         (WebCore::watchAdaptationName):
1151         (WebCore::extraZoomModeAdaptationName): Deleted.
1152         * page/DisabledAdaptations.h:
1153         * page/ViewportConfiguration.cpp:
1154         (WebCore::needsUpdateAfterChangingDisabledAdaptations):
1155         (WebCore::ViewportConfiguration::shouldOverrideDeviceWidthAndShrinkToFit const):
1156         * page/WindowFeatures.cpp:
1157         (WebCore::parseDisabledAdaptations):
1158         * testing/Internals.cpp:
1159         (WebCore::Internals::extraZoomModeAdaptationName const): Deleted.
1160         * testing/Internals.h:
1161         * testing/Internals.idl:
1162
1163 2018-06-17  Youenn Fablet  <youenn@apple.com>
1164
1165         Rename Document::hasHadActiveMediaStreamTrack to Document::hasHadCaptureMediaStreamTrack
1166         https://bugs.webkit.org/show_bug.cgi?id=186743
1167         rdar://problem/41151193
1168
1169         Reviewed by Eric Carlson.
1170
1171         Covered by existing tests.
1172
1173         Rename setter and getter to be more accurate.
1174         Move the place to call the setter to when creating a capture stream.
1175
1176         * Modules/mediastream/MediaDevicesRequest.cpp:
1177         (WebCore::MediaDevicesRequest::start):
1178         * Modules/mediastream/MediaStream.cpp:
1179         (WebCore::MediaStream::statusDidChange):
1180         * Modules/mediastream/UserMediaRequest.cpp:
1181         (WebCore::UserMediaRequest::mediaStreamIsReady):
1182         * dom/Document.h:
1183         (WebCore::Document::setHasCaptureMediaStreamTrack):
1184         (WebCore::Document::hasHadCaptureMediaStreamTrack const):
1185         (WebCore::Document::setHasActiveMediaStreamTrack): Deleted.
1186         (WebCore::Document::hasHadActiveMediaStreamTrack const): Deleted.
1187
1188 2018-06-17  Zalan Bujtas  <zalan@apple.com>
1189
1190         [LFC] DisplayBox API should be more clear about height/width vs. contentBoxHeight/width
1191         https://bugs.webkit.org/show_bug.cgi?id=186744
1192
1193         Reviewed by Antti Koivisto.
1194
1195         Display::Box::height/width -> border box size.
1196         Display::Box::contentBoxHeight/width -> content box size.
1197         Display::Box::top/left/bottom/right -> border box position in the containing box's coordinate system.
1198         Display::Box::marginBox/borderBox/paddingBox/contentBox -> relative to border box (border box is { 0, 0 })
1199  
1200         (This patch also removes the box-sizing logic from Display::Box. FormattingContext::Geometry should set the
1201         correct contentBoxSize/borderBoxSize based on the CSS property.)
1202
1203         * layout/FormattingContext.cpp:
1204         (WebCore::Layout::FormattingContext::computeFloatingHeightAndMargin const):
1205         (WebCore::Layout::FormattingContext::computeFloatingWidthAndMargin const):
1206         (WebCore::Layout::FormattingContext::computeOutOfFlowHorizontalGeometry const):
1207         (WebCore::Layout::FormattingContext::computeOutOfFlowVerticalGeometry const):
1208         (WebCore::Layout::FormattingContext::validateGeometryConstraintsAfterLayout const):
1209         * layout/FormattingContextGeometry.cpp:
1210         (WebCore::Layout::FormattingContext::Geometry::outOfFlowNonReplacedHorizontalGeometry):
1211         (WebCore::Layout::FormattingContext::Geometry::outOfFlowReplacedVerticalGeometry):
1212         (WebCore::Layout::FormattingContext::Geometry::outOfFlowReplacedHorizontalGeometry):
1213         (WebCore::Layout::FormattingContext::Geometry::floatingNonReplacedHeightAndMargin):
1214         (WebCore::Layout::FormattingContext::Geometry::floatingNonReplacedWidthAndMargin):
1215         (WebCore::Layout::FormattingContext::Geometry::inlineReplacedHeightAndMargin):
1216         (WebCore::Layout::FormattingContext::Geometry::inlineReplacedWidthAndMargin):
1217         (WebCore::Layout::FormattingContext::Geometry::computedPadding):
1218         (WebCore::Layout::FormattingContext::Geometry::computedNonCollapsedHorizontalMarginValue):
1219         (WebCore::Layout::FormattingContext::Geometry::computedNonCollapsedVerticalMarginValue):
1220         * layout/LayoutContext.cpp:
1221         (WebCore::Layout::LayoutContext::initializeRoot):
1222         * layout/blockformatting/BlockFormattingContext.cpp:
1223         (WebCore::Layout::BlockFormattingContext::computeInFlowHeightAndMargin const):
1224         (WebCore::Layout::BlockFormattingContext::computeInFlowWidthAndMargin const):
1225         * layout/blockformatting/BlockFormattingContextGeometry.cpp:
1226         (WebCore::Layout::BlockFormattingContext::Geometry::inFlowNonReplacedHeightAndMargin):
1227         (WebCore::Layout::BlockFormattingContext::Geometry::inFlowNonReplacedWidthAndMargin):
1228         (WebCore::Layout::BlockFormattingContext::Geometry::staticPosition):
1229         (WebCore::Layout::BlockFormattingContext::Geometry::inFlowPositionedPosition):
1230         * layout/displaytree/DisplayBox.cpp:
1231         (WebCore::Display::Box::marginBox const):
1232         (WebCore::Display::Box::borderBox const):
1233         (WebCore::Display::Box::paddingBox const):
1234         (WebCore::Display::Box::contentBox const):
1235         * layout/displaytree/DisplayBox.h:
1236         (WebCore::Display::Box::top const):
1237         (WebCore::Display::Box::left const):
1238         (WebCore::Display::Box::bottom const):
1239         (WebCore::Display::Box::right const):
1240         (WebCore::Display::Box::topLeft const):
1241         (WebCore::Display::Box::bottomRight const):
1242         (WebCore::Display::Box::size const):
1243         (WebCore::Display::Box::width const):
1244         (WebCore::Display::Box::height const):
1245         (WebCore::Display::Box::rect const):
1246         (WebCore::Display::Box::setTopLeft):
1247         (WebCore::Display::Box::setTop):
1248         (WebCore::Display::Box::setLeft):
1249         (WebCore::Display::Box::moveHorizontally):
1250         (WebCore::Display::Box::moveVertically):
1251         (WebCore::Display::Box::setHasValidContentHeight):
1252         (WebCore::Display::Box::setHasValidContentWidth):
1253         (WebCore::Display::Box::setContentBoxHeight):
1254         (WebCore::Display::Box::setContentBoxWidth):
1255         (WebCore::Display::Box::contentBoxHeight const):
1256         (WebCore::Display::Box::contentBoxWidth const):
1257         (WebCore::Display::Box::setWidth): Deleted.
1258         (WebCore::Display::Box::setHeight): Deleted.
1259         (WebCore::Display::Box::setSize): Deleted.
1260
1261 2018-06-17  Carlos Eduardo Ramalho  <cadubentzen@gmail.com>
1262
1263         [GTK] Correct behavior for dark themes
1264         https://bugs.webkit.org/show_bug.cgi?id=186219
1265
1266         Reviewed by Michael Catanzaro.
1267
1268         Override RenderThemeGtk::isControlStyled() to not style
1269         text inputs if color is set different than default.
1270
1271         No new tests. Manual theme test and existing layout tests already cover it.
1272
1273         * rendering/RenderThemeGtk.cpp:
1274         (WebCore::RenderThemeGtk::isControlStyled const):
1275         * rendering/RenderThemeGtk.h:
1276
1277 2018-06-12  Darin Adler  <darin@apple.com>
1278
1279         [Cocoa] Make some RetainPtr refinements to get more ready for ARC
1280         https://bugs.webkit.org/show_bug.cgi?id=186526
1281
1282         Reviewed by Anders Carlsson.
1283
1284         * platform/ios/UserAgentIOS.mm:
1285         (WebCore::deviceNameForUserAgent): Drop unnecessary use of RetainPtr.
1286
1287         * platform/mac/URLMac.mm:
1288         (WebCore::URL::operator NSURL * const): Use bridgingAutorelease.
1289
1290 2018-06-16  Chris Dumez  <cdumez@apple.com>
1291
1292         Better pack ResourceResponse
1293         https://bugs.webkit.org/show_bug.cgi?id=186718
1294
1295         Reviewed by Simon Fraser.
1296
1297         Better pack ResourceResponse to reduce its size on Mac from 632 to 616 bytes.
1298
1299         * platform/network/ResourceResponseBase.h:
1300
1301 2018-06-15  Chris Dumez  <cdumez@apple.com>
1302
1303         Better pack MediaQuery
1304         https://bugs.webkit.org/show_bug.cgi?id=186716
1305
1306         Reviewed by Simon Fraser.
1307
1308         Better pack MediaQuery to reduce its size from 48 bytes to 40 and save
1309         some memory.
1310
1311         * css/MediaQuery.cpp:
1312         (WebCore::MediaQuery::MediaQuery):
1313         * css/MediaQuery.h:
1314
1315 2018-06-15  Chris Dumez  <cdumez@apple.com>
1316
1317         StyleRuleMedia wastes 158KB of Vector capacity on cnn.com
1318         https://bugs.webkit.org/show_bug.cgi?id=186705
1319         <rdar://problem/41173637>
1320
1321         Reviewed by Simon Fraser.
1322
1323         Call shrinkToFit on RefPtr<StyleRuleBase> vectors in CSSParserImpl, after we're
1324         done parsing and before constructing StyleRuleMedia, StyleRuleSupports and
1325         deferred rules in StyleRuleGroup.
1326
1327         * css/parser/CSSParserImpl.cpp:
1328         (WebCore::CSSParserImpl::parseDeferredRuleList):
1329         (WebCore::CSSParserImpl::consumeMediaRule):
1330         (WebCore::CSSParserImpl::consumeSupportsRule):
1331
1332 2018-06-15  Chris Dumez  <cdumez@apple.com>
1333
1334         MediaQuerySet wastes a lot of vector capacity
1335         https://bugs.webkit.org/show_bug.cgi?id=186696
1336         <rdar://problem/41172850>
1337
1338         Reviewed by Simon Fraser.
1339
1340         Call shrinkToFit() on the MediaQuerySet after we're done parsing it
1341         to avoid wasting memory.
1342
1343         * css/parser/MediaQueryParser.cpp:
1344         (WebCore::MediaQueryParser::parseInternal):
1345
1346 2018-06-15  Chris Dumez  <cdumez@apple.com>
1347
1348         CachedRawResource wastes 57K of Vector capacity
1349         https://bugs.webkit.org/show_bug.cgi?id=186703
1350         <rdar://problem/41173515>
1351
1352         Reviewed by Simon Fraser.
1353
1354         Use 0 as minimum capacity for CachedRawResource::m_redirectChain, instead of the
1355         default value of 16. m_redirectChain usually contains very few items so 16 is
1356         wasteful, especially considering that m_redirectChain contains fairly large
1357         objects (std::pair<ResourceRequest, ResourceResponse>). CachedRawResource are
1358         stored in the memory cache so it is important to not use more memory than
1359         necessary.
1360
1361         We are also not worried about the performance cost of allocations here since
1362         this vector is only populated on HTTP redirects.
1363
1364         * loader/cache/CachedRawResource.h:
1365
1366 2018-06-15  Antti Koivisto  <antti@apple.com>
1367
1368         Semantic colors should not be transformed by color-filter
1369         https://bugs.webkit.org/show_bug.cgi?id=186566
1370         <rdar://problem/40705739>
1371
1372         Reviewed by Simon Fraser.
1373
1374         Test: css3/color-filters/color-filter-ignore-semantic.html
1375
1376         * platform/graphics/Color.h:
1377         (WebCore::Color::Color):
1378         (WebCore::Color::isSemantic const):
1379         (WebCore::Color::setIsSemantic):
1380
1381         Add a bit to Color to indicate it originated from a semantic color name.
1382         Note that a color compares unequal to the semantic version of the same color.
1383
1384         * platform/graphics/filters/FilterOperations.cpp:
1385         (WebCore::FilterOperations::transformColor const):
1386         * platform/graphics/mac/ColorMac.h:
1387         * platform/graphics/mac/ColorMac.mm:
1388         (WebCore::semanticColorFromNSColor):
1389         * rendering/RenderThemeMac.mm:
1390         (WebCore::RenderThemeMac::systemColor const):
1391
1392         Set the bit for semantic system colors.
1393
1394         * rendering/RenderTreeAsText.cpp:
1395         (WebCore::RenderTreeAsText::writeRenderObject):
1396
1397         Fix up the output to avoid unneccary render tree dump changes.
1398
1399 2018-06-15  Chris Dumez  <cdumez@apple.com>
1400
1401         Add API test coverage for SW RegistrationDatabase destruction and fix issues found by the test
1402         https://bugs.webkit.org/show_bug.cgi?id=186681
1403
1404         Reviewed by Brady Eidson.
1405
1406         * workers/service/server/RegistrationDatabase.cpp:
1407         (WebCore::RegistrationDatabase::RegistrationDatabase):
1408         (WebCore::RegistrationDatabase::importRecords):
1409         * workers/service/server/RegistrationDatabase.h:
1410         Rename m_session to m_sessionID for clarity.
1411
1412         * workers/service/server/RegistrationStore.cpp:
1413         (WebCore::RegistrationStore::~RegistrationStore):
1414         Drop bad assertion now that the RegistrationDatabase is refcounted
1415         and can outlive the RegistrationStore. The RegistrationDatabase will
1416         take care of closing / destroying the SQLiteDatabase on the background
1417         thread when destroyed.
1418
1419 2018-06-15  Timothy Hatcher  <timothy@apple.com>
1420
1421         REGRESSION (r232799): Form controls are blank in dark mode.
1422
1423         https://bugs.webkit.org/show_bug.cgi?id=186677
1424         rdar://problem/41162899
1425
1426         Reviewed by Wenson Hsieh.
1427
1428         * rendering/RenderThemeMac.mm:
1429         (-[WebCoreTextFieldCell _adjustedCoreUIDrawOptionsForDrawingBordersOnly:]):
1430         Dark mode controls don't have borders, just a semi-transparent background of shadows.
1431         In the dark mode case we can't disable borders, or we will not paint anything for the control.
1432
1433 2018-06-15  Zalan Bujtas  <zalan@apple.com>
1434
1435         [LFC] Fix static position left/top
1436         https://bugs.webkit.org/show_bug.cgi?id=186640
1437
1438         Reviewed by Antti Koivisto.
1439
1440         In visual formatting model, we normally go like [top, left] while LayoutPoint takes [x, y]. Let's make this less error prone.
1441
1442         * layout/FormattingContext.h:
1443         (WebCore::Layout::FormattingContext::Geometry::Position::operator LayoutPoint const):
1444         * layout/blockformatting/BlockFormattingContext.h:
1445         * layout/blockformatting/BlockFormattingContextGeometry.cpp:
1446         (WebCore::Layout::BlockFormattingContext::Geometry::staticPosition):
1447         (WebCore::Layout::BlockFormattingContext::Geometry::inFlowPositionedPosition):
1448
1449 2018-06-15  Chris Dumez  <cdumez@apple.com>
1450
1451         Crash under WebCore::SWServer::registrationStoreImportComplete()
1452         https://bugs.webkit.org/show_bug.cgi?id=186644
1453         <rdar://problem/40982257>
1454
1455         Reviewed by Brady Eidson.
1456
1457         Fix lifetime management issues with RegistrationDatabase. RegistrationDatabase
1458         was previously subclassing CrossThreadTaskHandler. CrossThreadTaskHandler
1459         currently is not safe for objects that can get destroyed (such as
1460         RegistrationDatabase). This is because it does not keep the object alive
1461         when going to the background thread or back to the main thread. This would
1462         cause crashes such as the one in the radar.
1463
1464         To address the issue, stop subclassing CrossThreadTaskHandler and use a
1465         simple WorkQueue instead. RegistrationDatabase is now ThreadSafeRefCounted
1466         and we take care of ref'ing it whenever we dispatch a task to the work queue
1467         or back to the main thread. Because the RegistrationDatabase can now outlive
1468         the RegistrationStore, m_store is now a WeakPtr.
1469
1470         * workers/service/server/RegistrationDatabase.cpp:
1471         (WebCore::RegistrationDatabase::RegistrationDatabase):
1472         (WebCore::RegistrationDatabase::~RegistrationDatabase):
1473         (WebCore::RegistrationDatabase::postTaskToWorkQueue):
1474         (WebCore::RegistrationDatabase::openSQLiteDatabase):
1475         (WebCore::RegistrationDatabase::importRecordsIfNecessary):
1476         (WebCore::RegistrationDatabase::pushChanges):
1477         (WebCore::RegistrationDatabase::clearAll):
1478         (WebCore::RegistrationDatabase::importRecords):
1479         (WebCore::RegistrationDatabase::addRegistrationToStore):
1480         (WebCore::RegistrationDatabase::databaseFailedToOpen):
1481         (WebCore::RegistrationDatabase::databaseOpenedAndRecordsImported):
1482         * workers/service/server/RegistrationDatabase.h:
1483         (WebCore::RegistrationDatabase::create):
1484         * workers/service/server/RegistrationStore.cpp:
1485         (WebCore::RegistrationStore::RegistrationStore):
1486         (WebCore::RegistrationStore::~RegistrationStore):
1487         (WebCore::RegistrationStore::pushChangesToDatabase):
1488         (WebCore::RegistrationStore::clearAll):
1489         * workers/service/server/RegistrationStore.h:
1490
1491 2018-06-15  Zalan Bujtas  <zalan@apple.com>
1492
1493         [LFC] Align compute functions styles.
1494         https://bugs.webkit.org/show_bug.cgi?id=186649
1495
1496         Reviewed by Antti Koivisto.
1497
1498         Improve code readability.
1499
1500         * layout/FormattingContext.h:
1501         * layout/FormattingContextGeometry.cpp:
1502         (WebCore::Layout::contentHeightForFormattingContextRoot):
1503         (WebCore::Layout::FormattingContext::Geometry::computedValueIfNotAuto):
1504         (WebCore::Layout::FormattingContext::Geometry::outOfFlowReplacedVerticalGeometry):
1505         (WebCore::Layout::FormattingContext::Geometry::outOfFlowReplacedHorizontalGeometry):
1506         (WebCore::Layout::FormattingContext::Geometry::floatingNonReplacedWidthAndMargin):
1507         (WebCore::Layout::FormattingContext::Geometry::floatingReplacedHeightAndMargin):
1508         (WebCore::Layout::FormattingContext::Geometry::floatingReplacedWidthAndMargin):
1509         (WebCore::Layout::FormattingContext::Geometry::inlineReplacedHeightAndMargin):
1510         (WebCore::Layout::FormattingContext::Geometry::inlineReplacedWidthAndMargin):
1511         (WebCore::Layout::FormattingContext::Geometry::computedNonCollapsedHorizontalMarginValue):
1512         (WebCore::Layout::FormattingContext::Geometry::computedNonCollapsedVerticalMarginValue):
1513         (WebCore::Layout::computedValueIfNotAuto): Deleted.
1514         * layout/blockformatting/BlockFormattingContextGeometry.cpp:
1515         (WebCore::Layout::BlockFormattingContext::Geometry::inFlowNonReplacedHeightAndMargin):
1516         (WebCore::Layout::BlockFormattingContext::Geometry::inFlowNonReplacedWidthAndMargin):
1517         (WebCore::Layout::BlockFormattingContext::Geometry::inFlowReplacedWidthAndMargin):
1518         (WebCore::Layout::BlockFormattingContext::Geometry::staticPosition):
1519         (WebCore::Layout::BlockFormattingContext::Geometry::inFlowPositionedPosition):
1520
1521 2018-06-15  Zalan Bujtas  <zalan@apple.com>
1522
1523         [LFC] Add FormattingContextLayout logging channel
1524         https://bugs.webkit.org/show_bug.cgi?id=186637
1525
1526         Reviewed by Antti Koivisto.
1527
1528         Add some basic layout logging (-WebCoreLogging "FormattingContextLayout").
1529
1530         * layout/FormattingContext.cpp:
1531         (WebCore::Layout::FormattingContext::placeInFlowPositionedChildren const):
1532         (WebCore::Layout::FormattingContext::layoutOutOfFlowDescendants const):
1533         * layout/FormattingContextGeometry.cpp:
1534         (WebCore::Layout::contentHeightForFormattingContextRoot):
1535         (WebCore::Layout::shrinkToFitWidth):
1536         (WebCore::Layout::FormattingContext::Geometry::outOfFlowNonReplacedVerticalGeometry):
1537         (WebCore::Layout::FormattingContext::Geometry::outOfFlowNonReplacedHorizontalGeometry):
1538         (WebCore::Layout::FormattingContext::Geometry::outOfFlowReplacedVerticalGeometry):
1539         (WebCore::Layout::FormattingContext::Geometry::outOfFlowReplacedHorizontalGeometry):
1540         (WebCore::Layout::FormattingContext::Geometry::floatingNonReplacedHeightAndMargin):
1541         (WebCore::Layout::FormattingContext::Geometry::floatingNonReplacedWidthAndMargin):
1542         (WebCore::Layout::FormattingContext::Geometry::floatingReplacedHeightAndMargin):
1543         (WebCore::Layout::FormattingContext::Geometry::floatingReplacedWidthAndMargin):
1544         (WebCore::Layout::FormattingContext::Geometry::inlineReplacedHeightAndMargin):
1545         (WebCore::Layout::FormattingContext::Geometry::inlineReplacedWidthAndMargin):
1546         (WebCore::Layout::FormattingContext::Geometry::computedBorder):
1547         (WebCore::Layout::FormattingContext::Geometry::computedPadding):
1548         (WebCore::Layout::FormattingContext::Geometry::computedNonCollapsedHorizontalMarginValue):
1549         (WebCore::Layout::FormattingContext::Geometry::computedNonCollapsedVerticalMarginValue):
1550         * layout/Verification.cpp:
1551         (WebCore::Layout::outputMismatchingBoxInformationIfNeeded):
1552         (WebCore::Layout::verifyAndOutputSubtree):
1553         (WebCore::Layout::LayoutContext::verifyAndOutputMismatchingLayoutTree const):
1554         * layout/blockformatting/BlockFormattingContext.cpp:
1555         (WebCore::Layout::BlockFormattingContext::layout const):
1556         * layout/blockformatting/BlockFormattingContextGeometry.cpp:
1557         (WebCore::Layout::BlockFormattingContext::Geometry::inFlowNonReplacedHeightAndMargin):
1558         (WebCore::Layout::BlockFormattingContext::Geometry::inFlowNonReplacedWidthAndMargin):
1559         (WebCore::Layout::BlockFormattingContext::Geometry::inFlowReplacedWidthAndMargin):
1560         (WebCore::Layout::BlockFormattingContext::Geometry::staticPosition):
1561         (WebCore::Layout::BlockFormattingContext::Geometry::inFlowPositionedPosition):
1562         * layout/layouttree/LayoutTreeBuilder.cpp:
1563         (WebCore::Layout::outputLayoutBox):
1564         (WebCore::Layout::outputLayoutTree):
1565         (WebCore::Layout::TreeBuilder::showLayoutTree):
1566         (WebCore::Layout::printLayoutTreeForLiveDocuments):
1567         * layout/layouttree/LayoutTreeBuilder.h:
1568         * platform/Logging.h:
1569
1570 2018-06-15  Antoine Quint  <graouts@apple.com>
1571
1572         [Web Animations] CSS Animations should take precedence over CSS Transitions
1573         https://bugs.webkit.org/show_bug.cgi?id=186651
1574
1575         Reviewed by Dean Jackson.
1576
1577         Ensure CSS Animations override CSS Transitions by modifying the order in which animations are returned by animationsForElement().
1578
1579         * animation/AnimationTimeline.cpp:
1580         (WebCore::AnimationTimeline::animationsForElement const):
1581
1582 2018-06-14  Youenn Fablet  <youenn@apple.com>
1583
1584         Make NetworkProcess get cache storage parameters at creation of the CacheStorage engine
1585         https://bugs.webkit.org/show_bug.cgi?id=186166
1586
1587         Reviewed by Alex Christensen.
1588
1589         Covered by existing tests.
1590
1591         * platform/network/NetworkStorageSession.h:
1592         (WebCore::NetworkStorageSession::cacheStorageDirectory const): Deleted.
1593         (WebCore::NetworkStorageSession::setCacheStorageDirectory): Deleted.
1594         (WebCore::NetworkStorageSession::cacheStoragePerOriginQuota const): Deleted.
1595         (WebCore::NetworkStorageSession::setCacheStoragePerOriginQuota): Deleted.
1596
1597 2018-06-14  Matt Lewis  <jlewis3@apple.com>
1598
1599         Unreviewed, rolling out r232823.
1600
1601         This caused both test timeouts and api failures.
1602
1603         Reverted changeset:
1604
1605         "[Mail] Use the Mail Viewer width as the base for resolving
1606         horizontal viewport units"
1607         https://bugs.webkit.org/show_bug.cgi?id=186585
1608         https://trac.webkit.org/changeset/232823
1609
1610 2018-06-14  Nan Wang  <n_wang@apple.com>
1611
1612         AX: Crash in AccessibilityNodeObject::textUnderElement(WebCore::AccessibilityTextUnderElementMode) const + 536
1613         https://bugs.webkit.org/show_bug.cgi?id=186629
1614
1615         Reviewed by Chris Fleizach.
1616
1617         This crashed when we passed a null node to ancestorsOfType. Fixed it
1618         by adding a null check.
1619
1620         Test: accessibility/hidden-object-text-value-crash.html
1621
1622         * accessibility/AccessibilityNodeObject.cpp:
1623         (WebCore::AccessibilityNodeObject::textUnderElement const):
1624
1625 2018-06-14  Timothy Hatcher  <timothy@apple.com>
1626
1627         Expose more semantic system colors.
1628
1629         https://bugs.webkit.org/show_bug.cgi?id=186609
1630         rdar://problem/39287277
1631
1632         Reviewed by Tim Horton.
1633
1634         Add the following semantic colors:
1635          -apple-system-control-accent
1636          -apple-system-even-alternating-content-background
1637          -apple-system-odd-alternating-content-background
1638          -apple-system-selected-content-background
1639          -apple-system-unemphasized-selected-content-background
1640          -apple-system-selected-text
1641          -apple-system-unemphasized-selected-text
1642          -apple-system-selected-text-background
1643          -apple-system-unemphasized-selected-text-background
1644          -apple-system-placeholder-text
1645          -apple-system-find-highlight-background
1646          -apple-system-separator
1647
1648         * css/CSSValueKeywords.in:
1649         * rendering/RenderThemeMac.mm:
1650         (WebCore::RenderThemeMac::systemColor const):
1651
1652 2018-06-14  Eric Carlson  <eric.carlson@apple.com>
1653
1654         [iOS] WebAVPlayerController isPlayingOnSecondScreen should be declared read-write
1655         https://bugs.webkit.org/show_bug.cgi?id=186621
1656         <rdar://problem/40243303>
1657
1658         Reviewed by Jer Noble.
1659
1660         * platform/ios/WebAVPlayerController.h:
1661
1662 2018-06-13  Zalan Bujtas  <zalan@apple.com>
1663
1664         [LFC] Miscellaneous fixes to be able to layout <div> with fixed width/height
1665         https://bugs.webkit.org/show_bug.cgi?id=186616
1666
1667         Reviewed by Antti Koivisto.
1668
1669         1. Move box horizontally/vertically when relevant margin is computed.
1670         2. Fix isStretchedToViewport() logic and make sure that the width/height is adjusted with the margin when the box is stretchy.
1671         3. Fix isPaddingApplicable() and add "GenericElement" for elements that don't need special handling.
1672
1673         With this patch LFC produces the correct geometry for the following content:
1674         <html><body><div style="width: 100px; height: 100px;"></div></body></html>
1675
1676         * layout/FormattingContext.cpp:
1677         (WebCore::Layout::FormattingContext::computeFloatingHeightAndMargin const):
1678         (WebCore::Layout::FormattingContext::computeFloatingWidthAndMargin const):
1679         * layout/blockformatting/BlockFormattingContext.cpp:
1680         (WebCore::Layout::BlockFormattingContext::layout const):
1681         (WebCore::Layout::BlockFormattingContext::computeInFlowHeightAndMargin const):
1682         (WebCore::Layout::BlockFormattingContext::computeInFlowWidthAndMargin const):
1683         * layout/blockformatting/BlockFormattingContextGeometry.cpp:
1684         (WebCore::Layout::isStretchedToViewport):
1685         (WebCore::Layout::BlockFormattingContext::Geometry::inFlowNonReplacedHeightAndMargin):
1686         (WebCore::Layout::BlockFormattingContext::Geometry::inFlowNonReplacedWidthAndMargin):
1687         (WebCore::Layout::BlockFormattingContext::Geometry::staticPosition):
1688         * layout/displaytree/DisplayBox.h:
1689         (WebCore::Display::Box::moveHorizontally):
1690         (WebCore::Display::Box::moveVertically):
1691         (WebCore::Display::Box::Rect::setWidth):
1692         (WebCore::Display::Box::Rect::setHeight):
1693         (WebCore::Display::Box::Rect::moveHorizontally):
1694         (WebCore::Display::Box::Rect::moveVertically):
1695         * layout/layouttree/LayoutBox.cpp:
1696         (WebCore::Layout::Box::isPaddingApplicable const):
1697         * layout/layouttree/LayoutBox.h:
1698         * layout/layouttree/LayoutTreeBuilder.cpp:
1699         (WebCore::Layout::TreeBuilder::createSubTree):
1700
1701 2018-06-13  Chris Dumez  <cdumez@apple.com>
1702
1703         Crash under SWServer::unregisterConnection(Connection&)
1704         https://bugs.webkit.org/show_bug.cgi?id=186584
1705         <rdar://problem/40931680>
1706
1707         Reviewed by Youenn Fablet.
1708
1709         The crash was due to SWServer::Connection objects outliving their SWServer, even
1710         though SWServer::Connection::m_server is a C++ reference. This was possible because
1711         SWServer does not own the connections, StorageToWebProcessConnection does. This
1712         started crashing recently, after r232423, because SWServer can get destroyed now.
1713         The SWServer might get destroyed before the StorageToWebProcessConnection, in which
1714         case the SWServer::Connection objects will get destroyed later. We were crashing
1715         because the SWServer::Connection destructor tries to unregister the connection from
1716         the SWServer (which is dead).
1717
1718         To address the issue, the SWServer now owns the connections. StorageToWebProcessConnection
1719         merely has weak pointers to the connections.
1720
1721         * workers/service/server/SWServer.cpp:
1722         (WebCore::SWServer::Connection::Connection):
1723         (WebCore::SWServer::addConnection):
1724         (WebCore::SWServer::removeConnection):
1725         (WebCore::SWServer::resolveRegistrationReadyRequests):
1726         * workers/service/server/SWServer.h:
1727         (WebCore::SWServer::Connection::~Connection):
1728         (WebCore::SWServer::Connection::server):
1729         (WebCore::SWServer::connection):
1730         * workers/service/server/SWServerRegistration.cpp:
1731         (WebCore::SWServerRegistration::forEachConnection):
1732         (WebCore::SWServerRegistration::notifyClientsOfControllerChange):
1733         (WebCore::SWServerRegistration::controlClient):
1734
1735 2018-06-13  Zalan Bujtas  <zalan@apple.com>
1736
1737         [Mail] Use the Mail Viewer width as the base for resolving horizontal viewport units
1738         https://bugs.webkit.org/show_bug.cgi?id=186585
1739         <rdar://problem/30685325>
1740
1741         Reviewed by Tim Horton.
1742
1743         Use the existing "override viewport size for viewport units" mechanism to compute the preferred
1744         viewport unit values for the Mail Viewer html content. 
1745
1746         Test: fast/dynamic/mail-autosize-viewport-unit.html
1747
1748         * page/FrameView.cpp:
1749         (WebCore::FrameView::FrameView):
1750         (WebCore::FrameView::enableAutoSizeMode):
1751         (WebCore::FrameView::clearViewportSizeOverrideForCSSViewportUnits):
1752         (WebCore::FrameView::setViewportSizeForCSSViewportUnits):
1753         (WebCore::FrameView::overrideViewportSizeForCSSViewportUnits):
1754         (WebCore::FrameView::viewportSizeForCSSViewportUnits const):
1755         * page/FrameView.h:
1756
1757 2018-06-13  Dean Jackson  <dino@apple.com>
1758
1759         Disable AR support in WKWebView clients
1760         https://bugs.webkit.org/show_bug.cgi?id=186611
1761         <rdar://problem/39544684>
1762
1763         Reviewed by Jon Lee.
1764
1765         Since it hasn't been adequately tested, System Preview (AR) should
1766         be disabled by default for WKWebViews.
1767
1768         Add a new RuntimeEnabledFeature to control this, and guard for
1769         this case everywhere we use system previews.
1770
1771         * html/HTMLAnchorElement.cpp:
1772         (WebCore::HTMLAnchorElement::isSystemPreviewLink const):
1773         (WebCore::HTMLAnchorElement::handleClick):
1774         * html/HTMLImageElement.cpp:
1775         (WebCore::HTMLImageElement::isSystemPreviewImage const):
1776         * html/HTMLPictureElement.cpp:
1777         (WebCore::HTMLPictureElement::isSystemPreviewImage const):
1778         * page/RuntimeEnabledFeatures.h:
1779         (WebCore::RuntimeEnabledFeatures::setSystemPreviewEnabled):
1780         (WebCore::RuntimeEnabledFeatures::systemPreviewEnabled const):
1781         * rendering/RenderImage.cpp:
1782         (WebCore::RenderImage::paintIntoRect):
1783
1784 2018-06-13  Youenn Fablet  <youenn@apple.com>
1785
1786         Supported plugin check should be based on plugin identifier
1787         https://bugs.webkit.org/show_bug.cgi?id=186578
1788         <rdar://problem/40523828>
1789
1790         Reviewed by Darin Adler.
1791
1792         Rename SupportedPluginName in SupportedPluginIdentifier.
1793         Add cross-platform support for plug-in identifier.
1794
1795         Update built-in PDF plug-in to check its identifier instead of its name.
1796         This is stronger as the name may change according localization.
1797
1798         * loader/EmptyClients.cpp:
1799         * plugins/PluginData.cpp:
1800         (WebCore::isBuiltInPDFPlugIn):
1801         (WebCore::PluginData::initPlugins):
1802         * plugins/PluginData.h:
1803         (WebCore::operator==):
1804         (WebCore::isSupportedPlugin):
1805         (WebCore::SupportedPluginIdentifier::decode):
1806         (WebCore::SupportedPluginIdentifier::encode const):
1807         (WebCore::SupportedPluginName::decode): Deleted.
1808         (WebCore::SupportedPluginName::encode const): Deleted.
1809         * plugins/PluginInfoProvider.h:
1810
1811 2018-06-13  Chris Dumez  <cdumez@apple.com>
1812
1813         PSON: http/tests/resourceLoadStatistics/classify-as-prevalent-based-on-top-frame-redirect-collusion.html ASSERTS with process swap enabled
1814         https://bugs.webkit.org/show_bug.cgi?id=186545
1815
1816         Reviewed by Brady Eidson.
1817
1818         Move frame navigation logging for ITP purposes from the WebProcess to the UIProcess.
1819         This information was previously logged in DocumentLoader::willSendRequest() and was getting
1820         sync'd to the UIProcess at regular intervals or when the layout tests call testRunner's
1821         statisticsNotifyObserver(). We now do the logging directly in the UIProcess, in
1822         WebPageProxy::decidePolicyForNavigationAction (which was getting called via IPC from
1823         DocumentLoader::willSendRequest()).
1824
1825         This is more efficient and will also be needed soon due to the way process swap on navigation
1826         deals with cross-origin redirects. On cross-origin redirect of the main frame, PSON cancels
1827         the load and started a new load to the redirected to URL in the new WebProcess. As a result,
1828         the new WebProcess is not aware that the load is a redirect, which is information that ITP
1829         requires. By moving the ITP logging to the UIProcess, we still have access to this
1830         information. 
1831
1832         * loader/DocumentLoader.cpp:
1833         (WebCore::DocumentLoader::willSendRequest):
1834         Stop logging the navigation now that it is logged in the UIProcess.
1835
1836         * loader/EmptyClients.cpp:
1837         (WebCore::EmptyFrameLoaderClient::dispatchDecidePolicyForNavigationAction):
1838         * loader/EmptyFrameLoaderClient.h:
1839         * loader/FrameLoader.cpp:
1840         (WebCore::FrameLoader::loadURL):
1841         (WebCore::FrameLoader::loadWithDocumentLoader):
1842         * loader/FrameLoaderClient.h:
1843         * loader/PolicyChecker.cpp:
1844         (WebCore::PolicyChecker::checkNavigationPolicy):
1845         * loader/PolicyChecker.h:
1846         We now pass the full redirect request to the decidePolicyForNavigationAction
1847         delegate instead of a simple isRedirect boolean, so that we have the redirect
1848         response URL in the UIProcess for ITP logging.
1849
1850         * loader/ResourceLoadObserver.cpp:
1851         (WebCore::areDomainsAssociated):
1852         (WebCore::ResourceLoadObserver::logSubresourceLoading):
1853         (WebCore::ResourceLoadObserver::logWebSocketLoading):
1854         (WebCore::ResourceLoadObserver::logUserInteractionWithReducedTimeResolution):
1855         * loader/ResourceLoadObserver.h:
1856         * loader/ResourceLoadStatistics.cpp:
1857         (WebCore::ResourceLoadStatistics::areDomainsAssociated):
1858         (WebCore::ResourceLoadStatistics::reduceTimeResolution):
1859         * loader/ResourceLoadStatistics.h:
1860         - Remove ResourceLoadObserver::logFrameNavigation() now that it is on the WebResourceLoadStatisticsStore.
1861         - Move some code from ResourceLoadObserver to ResourceLoadStatistics so that it can
1862           be called from the UIProcess and to avoid code duplication.
1863
1864 2018-06-13  Mark Lam  <mark.lam@apple.com>
1865
1866         FloatingPointEnvironment is only needed for ARM CPUs.
1867         https://bugs.webkit.org/show_bug.cgi?id=186567
1868         <rdar://problem/40929441>
1869
1870         Reviewed by Michael Saboff.
1871
1872         No new tests.  This behavior is already covered by existing tests.
1873
1874         * platform/ios/wak/FloatingPointEnvironment.cpp:
1875         * platform/ios/wak/FloatingPointEnvironment.h:
1876         (WebCore::FloatingPointEnvironment::enableDenormalSupport):
1877         (WebCore::FloatingPointEnvironment::saveMainThreadEnvironment):
1878         (WebCore::FloatingPointEnvironment::propagateMainThreadEnvironment):
1879         (WebCore::FloatingPointEnvironment::singleton):
1880
1881 2018-06-13  Timothy Hatcher  <timothy@apple.com>
1882
1883         Input form controls have a white background in dark mode, when they should not.
1884
1885         https://bugs.webkit.org/show_bug.cgi?id=186577
1886         rdar://problem/39258325
1887
1888         Reviewed by Tim Horton.
1889
1890         * DerivedSources.make: Allow WTF_PLATFORM_MAC ifdefs to preprocess in html.css.
1891         * css/CSSValueKeywords.in: Added -apple-system-control-background.
1892         * css/MediaQueryExpression.cpp:
1893         (WebCore::featureWithValidIdent): Allow dark mode media query in user agent stylesheets.
1894         (WebCore::isFeatureValidWithoutValue): Ditto.
1895         * css/MediaQueryParserContext.cpp:
1896         (WebCore::MediaQueryParserContext::MediaQueryParserContext): Transfer the CSSParserMode from CSSParserContext.
1897         * css/MediaQueryParserContext.h:
1898         * css/html.css: Set color and background-color to semantic colors for input, textarea, and select.
1899         Make input background-color transparent in dark mode to match AppKit.
1900         * rendering/RenderThemeMac.mm:
1901         (WebCore::RenderThemeMac::systemColor const): Added -apple-system-control-background.
1902         (WebCore::RenderThemeMac::paintTextField): Adjust the drawing rect to match new artwork in macOS 10.14.
1903
1904 2018-06-13  Said Abou-Hallawa  <sabouhallawa@apple.com>
1905
1906         TileFirstPaint strategy for async image decoding should be disabled for non root RenderLayers
1907         https://bugs.webkit.org/show_bug.cgi?id=186336
1908         <rdar://problem/40808099>
1909
1910         Reviewed by Simon Fraser.
1911
1912         When showing a composited RenderLayer for the first time, the images in 
1913         this layer have to be decoded synchronously to avoid unwanted flashing.
1914
1915         To create a layout test for this patch, FrameDecodingDurationForTesting
1916         needs to be generalized for large and animated images. The decoding thread
1917         now forces the decoding time to be at least equal to 
1918         FrameDecodingDurationForTesting.
1919
1920         Test: fast/images/async-image-composited-show.html
1921
1922         * platform/graphics/BitmapImage.cpp:
1923         (WebCore::BitmapImage::shouldUseAsyncDecodingForAnimatedImages const):
1924         (WebCore::BitmapImage::internalStartAnimation):
1925         (WebCore::BitmapImage::advanceAnimation):
1926         * platform/graphics/BitmapImage.h:
1927         * platform/graphics/ImageSource.cpp:
1928         (WebCore::ImageSource::startAsyncDecodingQueue):
1929         * platform/graphics/ImageSource.h:
1930         (WebCore::ImageSource::setFrameDecodingDurationForTesting):
1931         (WebCore::ImageSource::frameDecodingDurationForTesting const):
1932         * rendering/RenderLayer.cpp:
1933         (WebCore::RenderLayer::paintLayerContents):
1934
1935 2018-06-13  Wenson Hsieh  <wenson_hsieh@apple.com>
1936
1937         CSS "background-color" style no longer affects natively rendered text fields
1938         https://bugs.webkit.org/show_bug.cgi?id=186597
1939         <rdar://problem/41050528>
1940
1941         Reviewed by Tim Horton.
1942
1943         AppKit currently does not support rendering background color to the edges of a text field cell. This means that
1944         in WebCore, when natively rendering text inputs with background color, we need to only draw the bezels of a text
1945         field, such that the background color we paint behind the text field will be shown. Currently, the way we
1946         accomplish this is by intercepting an internal NSTextField method that computes drawing options for CoreUI, and
1947         inserting a `"borders only" => true` entry.
1948
1949         However, in a recent build of macOS Mojave, AppKit tweaked -_coreUIDrawOptionsWithFrame:inView:includeFocus: to
1950         add an extra argument (such that it's now -_coreUIDrawOptionsWithFrame:inView:includeFocus:maskOnly:), which
1951         negates the above workaround. To fix this in the short term, augment the workaround to apply to the latest macOS
1952         Mojave as well. A longer-term fix is already tracked in <rdar://problem/11385461>, which would allow WebKit to
1953         simply specify a background color on the text field cell, and have AppKit render it properly to the edges of the
1954         bezels.
1955
1956         Covered by a test that is currently failing on Mojave: fast/forms/hidpi-textfield-background-bleeding.html
1957
1958         * rendering/RenderThemeMac.mm:
1959         (-[WebCoreTextFieldCell _adjustedCoreUIDrawOptionsForDrawingBordersOnly:]):
1960         (-[WebCoreTextFieldCell _coreUIDrawOptionsWithFrame:inView:includeFocus:]):
1961         (-[WebCoreTextFieldCell _coreUIDrawOptionsWithFrame:inView:includeFocus:maskOnly:]):
1962
1963 2018-06-13  Thibault Saunier  <tsaunier@igalia.com>
1964
1965         [WPE] Build getUserMedia support
1966         https://bugs.webkit.org/show_bug.cgi?id=186547
1967
1968         Reviewed by Alejandro G. Castro.
1969
1970         Enable mediastream tests.
1971
1972         * PlatformWPE.cmake: Build MediaStream support.
1973         * SourcesGTK.txt: Moved GStreamer related files to GStreamer.cmake.
1974         * SourcesWPE.txt: Removed `platform/mediastream/libwebrtc/LibWebRTCProviderGlib.cpp`
1975         which is now in GStreamer.cmake.
1976         * platform/GStreamer.cmake: Build more MediaStream/webrtc related files.
1977         * platform/graphics/ImageBuffer.cpp: Handle the fact that toBGRAData is
1978         now built directly into the Cairo backend and not GTK anymore.
1979         * platform/graphics/cairo/ImageBufferCairo.cpp: Implement `toBGRAData`
1980         * platform/graphics/gtk/ImageBufferGtk.cpp: Removed `toBGRAData` as it is
1981         now implemented in the Cairo backend itself.
1982         * platform/mediastream/gstreamer/GStreamerMediaStreamSource.cpp: Switch an
1983         ASSERT to RELEASE_ASSERT when adding the GhostPad to itself. This was making
1984         test fail when built in RELEASE mode.
1985         (WebCore::webkitMediaStreamSrcChain): Minor variable name change to make it
1986         more accurate.
1987         (WebCore::webkitMediaStreamSrcAddPad): Now add the ghost pad to the element
1988         before setting its chain function, making things clearer.
1989         (WebCore::webkitMediaStreamSrcSetupSrc): Remove extra new line.
1990
1991 2018-06-13  Philippe Normand  <pnormand@igalia.com>
1992
1993         [GStreamer] fast/canvas/webgl crashes
1994         https://bugs.webkit.org/show_bug.cgi?id=186590
1995
1996         Reviewed by Carlos Alberto Lopez Perez.
1997
1998         After r232747 the sample managed by the player can be empty,
1999         without buffer. So we need to check for this before mapping video
2000         frames. Also use the GstVideoFrameHolder in more places to reduce
2001         copy-paste churn.
2002
2003         * platform/graphics/gstreamer/ImageGStreamer.h:
2004         * platform/graphics/gstreamer/ImageGStreamerCairo.cpp:
2005         (ImageGStreamer::ImageGStreamer):
2006         (ImageGStreamer::~ImageGStreamer):
2007         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp:
2008         (WebCore::GstVideoFrameHolder::GstVideoFrameHolder):
2009         (WebCore::MediaPlayerPrivateGStreamerBase::copyVideoTextureToPlatformTexture):
2010         (WebCore::MediaPlayerPrivateGStreamerBase::nativeImageForCurrentTime):
2011
2012 2018-06-13  Philippe Normand  <pnormand@igalia.com>
2013
2014         Unreviewed GTK build fix for --cmakeargs=-DUSE_GSTREAMER_GL=OFF
2015
2016         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:
2017         (WebCore::MediaPlayerPrivateGStreamer::load):
2018         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp:
2019         (WebCore::MediaPlayerPrivateGStreamerBase::pushTextureToCompositor):
2020
2021 2018-06-12  Philippe Normand  <pnormand@igalia.com>
2022
2023         [GStreamer] Video freezes when GStreamerGL is not installed
2024         https://bugs.webkit.org/show_bug.cgi?id=184925
2025
2026         Reviewed by Žan Doberšek.
2027
2028         At runtime when the GStreamer opengl plugin isn't available the
2029         player will fallback to the internal WebKit video sink. The
2030         VideoFrameHolder was refactored to handle both cases (opengl,
2031         non-opengl).
2032
2033         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp:
2034         (WebCore::GstVideoFrameHolder::GstVideoFrameHolder):
2035         (WebCore::GstVideoFrameHolder::~GstVideoFrameHolder):
2036         (WebCore::GstVideoFrameHolder::frame const):
2037         (WebCore::GstVideoFrameHolder::updateTexture):
2038         (WebCore::MediaPlayerPrivateGStreamerBase::pushTextureToCompositor):
2039         (WebCore::MediaPlayerPrivateGStreamerBase::triggerRepaint):
2040         (WebCore::GstVideoFrameHolder::isValid const): Deleted.
2041         (WebCore::MediaPlayerPrivateGStreamerBase::updateTexture): Deleted.
2042         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.h:
2043
2044 2018-06-12  Zalan Bujtas  <zalan@apple.com>
2045
2046         Complex text handling should opt out of bounded text layout.
2047         https://bugs.webkit.org/show_bug.cgi?id=186571
2048         <rdar://problem/41060908>
2049
2050         Reviewed by Tim Horton.
2051
2052         Test: fast/text/complex-long-text-crash.html
2053
2054         * platform/graphics/mac/ComplexTextControllerCoreText.mm:
2055         (WebCore::ComplexTextController::collectComplexTextRunsForCharacters):
2056
2057 2018-06-12  Ryan Haddad  <ryanhaddad@apple.com>
2058
2059         Unreviewed, rolling out r232774.
2060
2061         Breaks internal builds.
2062
2063         Reverted changeset:
2064
2065         "Complex text handling should opt out of bounded text layout."
2066         https://bugs.webkit.org/show_bug.cgi?id=186571
2067         https://trac.webkit.org/changeset/232774
2068
2069 2018-06-12  Ryosuke Niwa  <rniwa@webkit.org>
2070
2071         iOS WK1: Occasional crash in FrameView::setScrollPosition
2072         https://bugs.webkit.org/show_bug.cgi?id=186575
2073
2074         Reviewed by David Kilzer.
2075
2076         The bug was caused by ScrollView::platformSetScrollPosition releasing the web thread lock
2077         and DumpRenderTree requesting a new page load thereby destroying FrameView.
2078
2079         Fixed the crash by keeping FrameView alive while scrollToFocusedElementTimerFired is getting called.
2080
2081         No new tests since the bug is caught by existing layout tests under guard malloc.
2082
2083         * page/FrameView.cpp:
2084         (WebCore::FrameView::scrollToFocusedElementTimerFired):
2085
2086 2018-06-12  Zalan Bujtas  <zalan@apple.com>
2087
2088         Complex text handling should opt out of bounded text layout.
2089         https://bugs.webkit.org/show_bug.cgi?id=186571
2090         <rdar://problem/40801429>
2091
2092         Reviewed by Tim Horton.
2093
2094         Test: fast/text/complex-long-text-crash.html
2095
2096         * platform/graphics/mac/ComplexTextControllerCoreText.mm:
2097         (WebCore::ComplexTextController::collectComplexTextRunsForCharacters):
2098
2099 2018-06-12  Wenson Hsieh  <wenson_hsieh@apple.com>
2100
2101         Unreviewed, fix the Windows build after r232757
2102
2103         * editing/ReplaceSelectionCommand.cpp:
2104         (WebCore::ReplaceSelectionCommand::InsertedNodes::willRemoveNodePreservingChildren):
2105
2106 2018-06-12  Wenson Hsieh  <wenson_hsieh@apple.com>
2107
2108         REGRESSION(r228724): Occasional crash when executing ReplaceSelectionCommand at the end of the document
2109         https://bugs.webkit.org/show_bug.cgi?id=186555
2110         <rdar://problem/39703004>
2111
2112         Reviewed by Ryosuke Niwa.
2113
2114         r228724 removed a null check for m_lastNodeInserted in InsertedNodes::pastLastLeaf(). This null check was
2115         guarding against the case where m_firstNodeInserted might exist, but m_lastNodeInserted is null, which may
2116         happen when inserting content at the end of the document, since InsertedNodes::willRemoveNodePreservingChildren
2117         may cause m_lastNodeInserted to be null. This is because the removed node may be at the very end of the document
2118         _and also_ not have any children, which means that both `node->lastChild()` as well as
2119         `NodeTraversal::nextSkippingChildren(*node)` will be null.
2120
2121         After getting into this state, we subsequently crash when attempting to compute InsertedNodes::pastLastLeaf().
2122         To fix this, avoid accidentally clearing out m_lastNodeInserted; if the last inserted node has neither a child
2123         nor a next node, seek backwards to the previous node in the DOM instead, and clamp to the first inserted node,
2124         such that the last inserted node's document position is at or after the first inserted node's position.
2125
2126         Test: editing/execCommand/insert-apple-style-span-at-document-end.html
2127
2128         * editing/ReplaceSelectionCommand.cpp:
2129         (WebCore::ReplaceSelectionCommand::InsertedNodes::willRemoveNodePreservingChildren):
2130
2131 2018-06-12  Jianjun Zhu  <jianjun.zhu@intel.com>
2132
2133         Hash deviceId and groupId of MediaTrackCapabilities.
2134         https://bugs.webkit.org/show_bug.cgi?id=186471
2135
2136         Reviewed by Eric Carlson.
2137
2138         This change makes the identifier for the source of the MediaStreamTrack
2139         has the same value returned by enumerateDevices(). It also prevents real
2140         device ID being leaked.
2141
2142         (WebCore::MediaStreamTrack::getCapabilities const):
2143         * Modules/mediastream/MediaStreamTrack.h:
2144         * Modules/mediastream/MediaStreamTrack.idl:
2145
2146 2018-06-12  Philippe Normand  <pnormand@igalia.com>
2147
2148         Unreviewed WPE build fix after r232749.
2149
2150         * platform/graphics/gstreamer/eme/GStreamerEMEUtilities.h:
2151
2152 2018-06-12  Zalan Bujtas  <zalan@apple.com>
2153
2154         [LFC] Add vertical margin computation for inflow non-replaced box and for the (10.6.6) complicated cases.
2155         https://bugs.webkit.org/show_bug.cgi?id=186469
2156
2157         Reviewed by Antti Koivisto.
2158
2159         * layout/FormattingContextGeometry.cpp:
2160         (WebCore::Layout::FormattingContext::Geometry::outOfFlowNonReplacedVerticalGeometry):
2161         (WebCore::Layout::FormattingContext::Geometry::floatingNonReplacedHeightAndMargin):
2162         (WebCore::Layout::FormattingContext::Geometry::floatingNonReplacedWidthAndMargin):
2163         * layout/blockformatting/BlockFormattingContextGeometry.cpp:
2164         (WebCore::Layout::BlockFormattingContext::Geometry::inFlowNonReplacedHeightAndMargin):
2165
2166 2018-06-12  Philippe Normand  <pnormand@igalia.com>
2167
2168         [GStreamer] Bump required version to 1.8.3
2169         https://bugs.webkit.org/show_bug.cgi?id=186558
2170
2171         Reviewed by Xabier Rodriguez-Calvar.
2172
2173         * platform/GStreamer.cmake: Remove useless file.
2174         * platform/audio/gstreamer/WebKitWebAudioSourceGStreamer.cpp:
2175         (webKitWebAudioSrcChangeState): Remove useless version check.
2176         * platform/graphics/gstreamer/eme/GStreamerEMEUtilities.cpp:
2177         Removed. createDecryptor() is dead code since the decryptors moved
2178         to the MSE playback pipeline.
2179         * platform/graphics/gstreamer/eme/GStreamerEMEUtilities.h:
2180         (WebCore::GStreamerEMEUtilities::keySystemToUuid):
2181
2182 2018-06-11  Philippe Normand  <philn@igalia.com>
2183
2184         [GStreamer] flush video sample upon DRAIN query
2185         https://bugs.webkit.org/show_bug.cgi?id=186481
2186
2187         Reviewed by Xabier Rodriguez-Calvar.
2188
2189         Use the appsink sink pad pad probe for both event and drain query
2190         management. This patch is partially based on
2191         https://github.com/WebPlatformForEmbedded/WPEWebKit/commit/d3a336523d123119fe1dd53da5d9006c92cf078c
2192         by Enrique Ocaña González <eocanha@igalia.com>.
2193
2194         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp:
2195         (WebCore::MediaPlayerPrivateGStreamerBase::flushCurrentBuffer):
2196         (WebCore::MediaPlayerPrivateGStreamerBase::createGLAppSink):
2197
2198 2018-06-11  Zalan Bujtas  <zalan@apple.com>
2199
2200         [LFC] Replace HorizontalGeometry::width and margin with WidthAndMargin (Vertical too)
2201         https://bugs.webkit.org/show_bug.cgi?id=186556
2202
2203         Reviewed by Sam Weinig.
2204
2205         HorizontalGeometry::width and margin -> WidthAndMargin
2206         VerticalGeometry::height and margin -> HeightAndMargin
2207
2208         * layout/FormattingContext.cpp:
2209         (WebCore::Layout::FormattingContext::computeOutOfFlowHorizontalGeometry const):
2210         (WebCore::Layout::FormattingContext::computeOutOfFlowVerticalGeometry const):
2211         * layout/FormattingContext.h:
2212         * layout/FormattingContextGeometry.cpp:
2213         (WebCore::Layout::FormattingContext::Geometry::outOfFlowNonReplacedVerticalGeometry):
2214         (WebCore::Layout::FormattingContext::Geometry::outOfFlowNonReplacedHorizontalGeometry):
2215         (WebCore::Layout::FormattingContext::Geometry::outOfFlowReplacedVerticalGeometry):
2216         (WebCore::Layout::FormattingContext::Geometry::outOfFlowReplacedHorizontalGeometry):
2217         (WebCore::Layout::FormattingContext::Geometry::inlineReplacedWidthAndMargin):
2218         (WebCore::Layout::FormattingContext::Geometry::computedNonCollapsedHorizontalMarginValue):
2219         (WebCore::Layout::FormattingContext::Geometry::computedNonCollapsedVerticalMarginValue):
2220
2221 2018-06-11  Youenn Fablet  <youenn@apple.com>
2222
2223         Improve error messages in case FetchEvent.respondWith has a rejected promise
2224         https://bugs.webkit.org/show_bug.cgi?id=186368
2225
2226         Reviewed by Chris Dumez.
2227
2228         Covered by rebased tests.
2229
2230         Introduce a new error domain for service worker ResourceError.
2231         Used this domain to log in the console any such error.
2232
2233         Update FetchEvent implementation to get meaningful error messages for respondWith error cases.
2234         In particular, convert the rejected promise JS value as a string to populate the error message.
2235
2236         * loader/SubresourceLoader.cpp:
2237         (WebCore::SubresourceLoader::didFail):
2238         * platform/network/ResourceErrorBase.cpp:
2239         * platform/network/ResourceErrorBase.h:
2240         * testing/ServiceWorkerInternals.cpp:
2241         (WebCore::ServiceWorkerInternals::waitForFetchEventToFinish):
2242         * workers/service/FetchEvent.cpp:
2243         (WebCore::FetchEvent::~FetchEvent):
2244         (WebCore::FetchEvent::createResponseError):
2245         (WebCore::FetchEvent::onResponse):
2246         (WebCore::FetchEvent::respondWithError):
2247         (WebCore::FetchEvent::processResponse):
2248         (WebCore::FetchEvent::promiseIsSettled):
2249         * workers/service/FetchEvent.h:
2250         * workers/service/context/ServiceWorkerFetch.cpp:
2251         (WebCore::ServiceWorkerFetch::processResponse):
2252         (WebCore::ServiceWorkerFetch::dispatchFetchEvent):
2253
2254 2018-06-11  Chris Dumez  <cdumez@apple.com>
2255
2256         http/tests/security/xss-DENIED-script-inject-into-inactive-window2.html times out with PSON enabled
2257         https://bugs.webkit.org/show_bug.cgi?id=186546
2258
2259         Reviewed by Brady Eidson.
2260
2261         Add a hasOpenedFrames flag to NavigationAction, which we'll use in the UIProcess when deciding
2262         to process swap on navigation or not.
2263
2264         Test: http/tests/security/xss-DENIED-script-inject-into-inactive-window2-pson.html
2265
2266         * loader/FrameLoader.cpp:
2267         (WebCore::FrameLoader::loadURL):
2268         * loader/NavigationAction.h:
2269         (WebCore::NavigationAction::hasOpenedFrames const):
2270         (WebCore::NavigationAction::setHasOpenedFrames):
2271
2272 2018-06-11  Tim Horton  <timothy_horton@apple.com>
2273
2274         Link drag image is inconsistently unreadable in dark mode
2275         https://bugs.webkit.org/show_bug.cgi?id=186472
2276
2277         Reviewed by Timothy Hatcher.
2278
2279         * platform/mac/DragImageMac.mm:
2280         (WebCore::createDragImageForLink):
2281         Use LocalDefaultSystemAppearance so that NSColors used inside
2282         createDragImageForLink are interpreted correctly. This function
2283         always follows the system appearance regardless of what the preference
2284         is set to, because it's generating UI that isn't part of the page.
2285
2286         Use controlBackgroundColor to get a consistently contrasting background
2287         for the link drag image.
2288
2289 2018-06-11  Chris Dumez  <cdumez@apple.com>
2290
2291         http/tests/security/cors-post-redirect-307.html fails with PSON enabled
2292         https://bugs.webkit.org/show_bug.cgi?id=186441
2293
2294         Reviewed by Brady Eidson.
2295
2296         When we are continuing a load in a new process, we currently bypass the navigation policy
2297         check. We now also bypass the adding of headers such as the Origin one since the request
2298         was already processed in the previous process. This is important because in the case of
2299         a cross-origin redirect, the previous process has removed the Origin header from the
2300         request and we do not want the new process to add it again.
2301
2302         Test: http/tests/security/cors-post-redirect-307-pson.html
2303
2304         * WebCore.xcodeproj/project.pbxproj:
2305         * history/BackForwardController.cpp:
2306         (WebCore::BackForwardController::goBackOrForward):
2307         (WebCore::BackForwardController::goBack):
2308         (WebCore::BackForwardController::goForward):
2309         * loader/FrameLoadRequest.h:
2310         (WebCore::FrameLoadRequest::setShouldTreatAsContinuingLoad):
2311         (WebCore::FrameLoadRequest::shouldTreatAsContinuingLoad const):
2312         (WebCore::FrameLoadRequest::setShouldCheckNavigationPolicy): Deleted.
2313         (WebCore::FrameLoadRequest::shouldCheckNavigationPolicy const): Deleted.
2314         * loader/FrameLoader.cpp:
2315         (WebCore::FrameLoader::loadURLIntoChildFrame):
2316         (WebCore::FrameLoader::load):
2317         (WebCore::FrameLoader::loadWithNavigationAction):
2318         (WebCore::FrameLoader::loadWithDocumentLoader):
2319         (WebCore::FrameLoader::reloadWithOverrideEncoding):
2320         (WebCore::FrameLoader::reload):
2321         (WebCore::FrameLoader::addExtraFieldsToRequest):
2322         (WebCore::FrameLoader::addHTTPOriginIfNeeded):
2323         (WebCore::FrameLoader::loadDifferentDocumentItem):
2324         (WebCore::FrameLoader::loadItem):
2325         (WebCore::FrameLoader::retryAfterFailedCacheOnlyMainResourceLoad):
2326         * loader/FrameLoader.h:
2327         * loader/HistoryController.cpp:
2328         (WebCore::HistoryController::goToItem):
2329         (WebCore::HistoryController::setDefersLoading):
2330         (WebCore::HistoryController::recursiveGoToItem):
2331         * loader/HistoryController.h:
2332         * loader/ShouldTreatAsContinuingLoad.h: Renamed from Source/WebCore/loader/NavigationPolicyCheck.h.
2333         * page/Page.cpp:
2334         (WebCore::Page::goToItem):
2335         * page/Page.h:
2336
2337 2018-06-11  Youenn Fablet  <youenn@apple.com>
2338
2339         Accept request header values should be more tightly checked after r232572 in case of CORS load
2340         https://bugs.webkit.org/show_bug.cgi?id=186533
2341         <rdar://problem/40933880>
2342
2343         Reviewed by Darin Adler.
2344
2345         Covered by updated test.
2346
2347         * platform/network/HTTPParsers.cpp:
2348         (WebCore::isValidAcceptHeaderValue): Checking that Accept header value conforms with RFC7370.
2349         If not, this will trigger preflighting for CORS cross origin loads.
2350         Current checks for Accept-Language and Content-Language are sufficient to ensure values conform with RFC7370.
2351
2352 2018-06-11  Chris Dumez  <cdumez@apple.com>
2353
2354         Crash under com.apple.WebKit.Networking at WebCore: WebCore::NetworkStorageSession::hasStorageAccess const
2355         https://bugs.webkit.org/show_bug.cgi?id=186433
2356         <rdar://problem/40750907>
2357
2358         Reviewed by Geoffrey Garen.
2359
2360         Do some hardening in NetworkStorageSession::hasStorageAccess() to make sure
2361         we do not try and do a HashMap lookup with a null firstPartyDomain, as this
2362         would crash.
2363
2364         * platform/network/cf/NetworkStorageSessionCFNet.cpp:
2365         (WebCore::NetworkStorageSession::hasStorageAccess const):
2366
2367 2018-06-11  Zalan Bujtas  <zalan@apple.com>
2368
2369         [LFC] Remove redundant position functions for out-of-flow elements
2370         https://bugs.webkit.org/show_bug.cgi?id=186525
2371
2372         Reviewed by Antti Koivisto.
2373
2374         Position is computed as part of the Horizontal/Vertical geometry computation.
2375         (see outOfFlow(Non)ReplacedHorizontalGeometry/outOfFlow(Non)ReplacedVerticalGeometry functions)
2376
2377         * layout/FormattingContext.cpp:
2378         (WebCore::Layout::FormattingContext::layoutOutOfFlowDescendants const):
2379         (WebCore::Layout::FormattingContext::computeOutOfFlowPosition const): Deleted.
2380         * layout/FormattingContext.h:
2381         * layout/FormattingContextGeometry.cpp:
2382         (WebCore::Layout::outOfFlowNonReplacedPosition): Deleted.
2383         (WebCore::Layout::outOfFlowReplacedPosition): Deleted.
2384         (WebCore::Layout::FormattingContext::Geometry::outOfFlowPosition): Deleted.
2385
2386 2018-06-11  Zalan Bujtas  <zalan@apple.com>
2387
2388         [LFC] Merge top, bottom, height and vertical margin computation for out-of-flow replaced elements
2389         https://bugs.webkit.org/show_bug.cgi?id=186524
2390
2391         Reviewed by Antti Koivisto.
2392
2393         Implement https://www.w3.org/TR/CSS22/visudet.html#abs-replaced-height
2394         (10.6.5 Absolutely positioned, replaced elements)
2395
2396         * layout/FormattingContextGeometry.cpp:
2397         (WebCore::Layout::FormattingContext::Geometry::outOfFlowReplacedVerticalGeometry):
2398
2399 2018-06-11  Zalan Bujtas  <zalan@apple.com>
2400
2401         [LFC] Merge left, right, width and horizontal margin computation for out-of-flow replaced elements
2402         https://bugs.webkit.org/show_bug.cgi?id=186475
2403
2404         Reviewed by Antti Koivisto.
2405
2406         Implement https://www.w3.org/TR/CSS22/visudet.html#abs-replaced-width
2407         (10.3.8 Absolutely positioned, replaced elements)
2408
2409         * layout/FormattingContext.cpp:
2410         (WebCore::Layout::FormattingContext::computeOutOfFlowHorizontalGeometry const):
2411         (WebCore::Layout::FormattingContext::layoutOutOfFlowDescendants const):
2412         (WebCore::Layout::FormattingContext::computeOutOfFlowWidthAndMargin const): Deleted.
2413         * layout/FormattingContext.h:
2414         * layout/FormattingContextGeometry.cpp:
2415         (WebCore::Layout::FormattingContext::Geometry::outOfFlowNonReplacedHorizontalGeometry):
2416         (WebCore::Layout::computedValueIfNotAuto):
2417         (WebCore::Layout::FormattingContext::Geometry::outOfFlowReplacedHorizontalGeometry):
2418         (WebCore::Layout::FormattingContext::Geometry::outOfFlowHorizontalGeometry):
2419         (WebCore::Layout::FormattingContext::Geometry::outOfFlowNonReplacedWidthAndMargin): Deleted.
2420         (WebCore::Layout::FormattingContext::Geometry::outOfFlowReplacedWidthAndMargin): Deleted.
2421         (WebCore::Layout::FormattingContext::Geometry::outOfFlowWidthAndMargin): Deleted.
2422
2423 2018-06-11  Zalan Bujtas  <zalan@apple.com>
2424
2425         [LFC] Merge left, right, width and horizontal margin computation for out-of-flow non-replaced elements
2426         https://bugs.webkit.org/show_bug.cgi?id=186474
2427
2428         Reviewed by Antti Koivisto.
2429
2430         Implement https://www.w3.org/TR/CSS22/visudet.html#abs-non-replaced-width 
2431         (10.3.7 Absolutely positioned, non-replaced elements)
2432
2433         * layout/FormattingContext.cpp:
2434         (WebCore::Layout::FormattingContext::computeOutOfFlowHorizontalGeometry const):
2435         (WebCore::Layout::FormattingContext::layoutOutOfFlowDescendants const):
2436         (WebCore::Layout::FormattingContext::computeOutOfFlowWidthAndMargin const): Deleted.
2437         * layout/FormattingContext.h:
2438         * layout/FormattingContextGeometry.cpp:
2439         (WebCore::Layout::FormattingContext::Geometry::outOfFlowNonReplacedHorizontalGeometry):
2440         (WebCore::Layout::FormattingContext::Geometry::outOfFlowReplacedHorizontalGeometry):
2441         (WebCore::Layout::FormattingContext::Geometry::outOfFlowHorizontalGeometry):
2442         (WebCore::Layout::FormattingContext::Geometry::outOfFlowNonReplacedWidthAndMargin): Deleted.
2443         (WebCore::Layout::FormattingContext::Geometry::outOfFlowReplacedWidthAndMargin): Deleted.
2444         (WebCore::Layout::FormattingContext::Geometry::outOfFlowWidthAndMargin): Deleted.
2445
2446 2018-06-10  Zalan Bujtas  <zalan@apple.com>
2447
2448         [LFC] Merge top, bottom, height and vertical margin computation for out-of-flow non-replaced elements
2449         https://bugs.webkit.org/show_bug.cgi?id=186476
2450
2451         Reviewed by Antti Koivisto.
2452
2453         Implement https://www.w3.org/TR/CSS22/visudet.html#abs-non-replaced-height
2454         (10.6.4 Absolutely positioned, non-replaced elements)
2455
2456         * layout/FormattingContext.cpp:
2457         (WebCore::Layout::FormattingContext::computeOutOfFlowVerticalGeometry const):
2458         (WebCore::Layout::FormattingContext::layoutOutOfFlowDescendants const):
2459         (WebCore::Layout::FormattingContext::computeOutOfFlowHeight const): Deleted.
2460         * layout/FormattingContext.h:
2461         * layout/FormattingContextGeometry.cpp:
2462         (WebCore::Layout::computedValueIfNotAuto):
2463         (WebCore::Layout::FormattingContext::Geometry::outOfFlowNonReplacedVerticalGeometry):
2464         (WebCore::Layout::FormattingContext::Geometry::outOfFlowReplacedVerticalGeometry):
2465         (WebCore::Layout::FormattingContext::Geometry::outOfFlowVerticalGeometry):
2466         (WebCore::Layout::FormattingContext::Geometry::outOfFlowNonReplacedHeightAndMargin): Deleted.
2467         (WebCore::Layout::FormattingContext::Geometry::outOfFlowReplacedHeightAndMargin): Deleted.
2468         (WebCore::Layout::FormattingContext::Geometry::outOfFlowHeightAndMargin): Deleted.
2469
2470 2018-06-10  Carlos Garcia Campos  <cgarcia@igalia.com>
2471
2472         [GTK][WPE] Add API run run javascript from a WebKitWebView in an isolated world
2473         https://bugs.webkit.org/show_bug.cgi?id=186192
2474
2475         Reviewed by Michael Catanzaro.
2476
2477         * bindings/js/ScriptController.cpp:
2478         (WebCore::ScriptController::executeScriptInWorld): Add ExceptionDetails parameter.
2479         * bindings/js/ScriptController.h:
2480
2481 2018-06-10  Michael Catanzaro  <mcatanzaro@igalia.com>
2482
2483         [WPE][GTK] paypal.com requires user agent quirk
2484         https://bugs.webkit.org/show_bug.cgi?id=186466
2485
2486         Reviewed by Carlos Garcia Campos.
2487
2488         * platform/UserAgentQuirks.cpp:
2489         (WebCore::urlRequiresMacintoshPlatform):
2490
2491 2018-06-09  Dan Bernstein  <mitz@apple.com>
2492
2493         [Xcode] Clean up and modernize some build setting definitions
2494         https://bugs.webkit.org/show_bug.cgi?id=186463
2495
2496         Reviewed by Sam Weinig.
2497
2498         * Configurations/Base.xcconfig: Removed definition for macOS 10.11.
2499         * Configurations/DebugRelease.xcconfig: Ditto.
2500         * Configurations/FeatureDefines.xcconfig: Simplified the definitions of ENABLE_APPLE_PAY and
2501           ENABLE_VIDEO_PRESENTATION_MODE now macOS 10.12 is the earliest supported version.
2502         * Configurations/Version.xcconfig: Removed definition for macOS 10.11.
2503         * Configurations/WebCore.xcconfig: Simplified the definition of WK_PRIVATE_FRAMEWORKS_DIR
2504           now that WK_XCODE_SUPPORTS_TEXT_BASED_STUBS is true for all supported Xcode versions.
2505         * Configurations/WebKitTargetConditionals.xcconfig: Removed definitions for macOS 10.11.
2506
2507 2018-06-09  Dan Bernstein  <mitz@apple.com>
2508
2509         Added missing file references to the Configuration group.
2510
2511         * WebCore.xcodeproj/project.pbxproj:
2512
2513 2018-06-09  Zalan Bujtas  <zalan@apple.com>
2514
2515         REGRESSION (r230480): Cannot adjust photo position on LinkedIn's profile page
2516         https://bugs.webkit.org/show_bug.cgi?id=186464
2517         <rdar://problem/40369448>
2518
2519         Reviewed by Simon Fraser.
2520
2521         The optimization logic for skipping image layout when we only need overflow computation should check if the image actually needs
2522         simplified layout only. The needsSimplifiedNormalFlowLayout() flag means that the overflow information needs to be updated but
2523         it does not mean that overflow is the only property that we need to recompute.
2524
2525         Test: fast/images/positioned-image-when-transform-is-present.html
2526
2527         * rendering/RenderImage.cpp:
2528         (WebCore::RenderImage::layout):
2529         * rendering/RenderObject.h:
2530         (WebCore::RenderObject::needsSimplifiedNormalFlowLayoutOnly const):
2531
2532 2018-06-09  Ryosuke Niwa  <rniwa@webkit.org>
2533
2534         REGRESSION(macOS Mojave): move-by-word-visually-multi-line.html fails
2535         https://bugs.webkit.org/show_bug.cgi?id=186454
2536
2537         Reviewed by Darin Adler.
2538
2539         Like r232635, this patch fixes a selection test failure caused by the change in ICU's behavior in macOS Mojave,
2540         which caused isWordTextBreak to return true in more cases.
2541
2542         In this particular failing test case, previousTextOrLineBreakBox and nextTextOrLineBreakBox were failing to find
2543         an inline text box when it found an inline box for a BR, which was mentioned by an existing FIXME comment.
2544         Consequently, visualWordPosition were erroneously detecting the end of a word followed by a blank line created by
2545         a BR as a valid word boundary to move when the Windows editing behavior is enacted.
2546
2547         Addressed the FIXME comment by finding the next inline text box skipping all inline boxes for BRs. Renamed
2548         misleadingly named previousBoxInDifferentBlock and nextBoxInDifferentBlock to previousBoxInDifferentLine and
2549         nextBoxInDifferentLine respectively, and set them to true as they're really indicating whether line boxes
2550         belong to a distinct line or not; whether an inline box belong to two (render) blocks or not is irrelevant.
2551
2552         Finally, this patch fixes a bug in visualWordPosition that it was failing to skip blank lines when a word break is
2553         found as we traversed past a line break. In those cases, we must skip all line breaks before stopping.
2554
2555         Tests: editing/selection/move-by-word-visually-mac.html
2556                editing/selection/move-by-word-visually-multi-line.htm
2557
2558         * editing/VisibleUnits.cpp:
2559         (WebCore::CachedLogicallyOrderedLeafBoxes::previousTextOrLineBreakBox):
2560         (WebCore::CachedLogicallyOrderedLeafBoxes::nextTextOrLineBreakBox):
2561         (WebCore::CachedLogicallyOrderedLeafBoxes::boxIndexInLeaves const):
2562         (WebCore::logicallyPreviousBox):
2563         (WebCore::logicallyNextBox):
2564         (WebCore::wordBreakIteratorForMinOffsetBoundary):
2565         (WebCore::wordBreakIteratorForMaxOffsetBoundary):
2566         (WebCore::visualWordPosition):
2567
2568 2018-06-09  Zalan Bujtas  <zalan@apple.com>
2569
2570         [LFC] MarginCollapse functions should be able to resolve non-fixed margin values
2571         https://bugs.webkit.org/show_bug.cgi?id=186461
2572
2573         Reviewed by Antti Koivisto.
2574
2575         We need the containing block's computed width to resolve vertical and horizontal margins.
2576
2577         * layout/blockformatting/BlockFormattingContext.h:
2578         * layout/blockformatting/BlockMarginCollapse.cpp:
2579         (WebCore::Layout::BlockFormattingContext::MarginCollapse::collapsedMarginTopFromFirstChild):
2580         (WebCore::Layout::BlockFormattingContext::MarginCollapse::nonCollapsedMarginTop):
2581         (WebCore::Layout::BlockFormattingContext::MarginCollapse::computedNonCollapsedMarginTop):
2582         (WebCore::Layout::BlockFormattingContext::MarginCollapse::computedNonCollapsedMarginBottom):
2583         (WebCore::Layout::BlockFormattingContext::MarginCollapse::marginTop):
2584         (WebCore::Layout::BlockFormattingContext::MarginCollapse::marginBottom):
2585         (WebCore::Layout::BlockFormattingContext::MarginCollapse::collapsedMarginBottomFromLastChild):
2586         (WebCore::Layout::BlockFormattingContext::MarginCollapse::nonCollapsedMarginBottom):
2587         (WebCore::Layout::collapsedMarginTopFromFirstChild): Deleted.
2588         (WebCore::Layout::nonCollapsedMarginTop): Deleted.
2589
2590 2018-06-08  Darin Adler  <darin@apple.com>
2591
2592         [Cocoa] Remove all uses of NSAutoreleasePool as part of preparation for ARC
2593         https://bugs.webkit.org/show_bug.cgi?id=186436
2594
2595         Reviewed by Anders Carlsson.
2596
2597         * bridge/objc/objc_class.mm: Use import instead of include.
2598
2599         * bridge/objc/objc_instance.h: Replaced _pool member to hold an object with
2600         m_autoreleasePool member to hold a token from objc_autoreleasePoolPush. Also
2601         initialize all data members here in the class definition.
2602
2603         * bridge/objc/objc_instance.mm:
2604         (ObjcInstance::ObjcInstance): Moved most initialization to class definition.
2605         (ObjcInstance::virtualBegin): Use objc_autoreleasePoolPush instead of
2606         NSAutoreleasePool class.
2607         (ObjcInstance::virtualEnd): Use objc_autoreleasePoolPop.
2608
2609         * bridge/objc/objc_runtime.mm: Use import instead of include.
2610         * bridge/objc/objc_utility.mm: Ditto.
2611
2612         * platform/audio/mac/AudioBusMac.mm:
2613         (WebCore::AudioBus::loadPlatformResource): Use @autoreleasepool.
2614
2615         * platform/ios/wak/WebCoreThread.mm: Re-sorted includes. Removed declaration of
2616         autorelease pool SPI and use FoundationSPI.h instead.
2617
2618         * platform/network/cocoa/ResourceResponseCocoa.mm:
2619         (WebCore::ResourceResponse::platformLazyInit): Use @autoreleasepool.
2620
2621 2018-06-08  Wenson Hsieh  <wenson_hsieh@apple.com>
2622
2623         [WebKit on watchOS] Upstream watchOS source additions to OpenSource (Part 1)
2624         https://bugs.webkit.org/show_bug.cgi?id=186442
2625         <rdar://problem/40879364>
2626
2627         Reviewed by Tim Horton.
2628
2629         No change in behavior.
2630
2631         * Configurations/FeatureDefines.xcconfig:
2632         * page/DisabledAdaptations.cpp:
2633         (WebCore::extraZoomModeAdaptationName):
2634
2635 2018-06-08  Per Arne Vollan  <pvollan@apple.com>
2636
2637         Only display refresh monitors having requested display refresh callback should get notified on screen updates.
2638         https://bugs.webkit.org/show_bug.cgi?id=186397
2639         <rdar://problem/40897835>
2640
2641         Reviewed by Brent Fulgham.
2642
2643         Since all display refresh monitors in the WebContent process share a single UI process display link,
2644         we should make sure that only the monitors having requested callback are getting notified on screen
2645         updates. I have not been able to reproduce a case where a monitor is being notified without having
2646         requested updates, but we should safeguard the code for future code changes.
2647
2648         No new tests, since this is a safeguarding measure.
2649
2650         * platform/graphics/DisplayRefreshMonitor.h:
2651         (WebCore::DisplayRefreshMonitor::hasRequestedRefreshCallback const):
2652         * platform/graphics/DisplayRefreshMonitorManager.cpp:
2653         (WebCore::DisplayRefreshMonitorManager::displayWasUpdated):
2654
2655 2018-06-07  Jer Noble  <jer.noble@apple.com>
2656
2657         REGRESSION:  Cannot listen to audio on Google Translate with side switch set to "vibrate"
2658         https://bugs.webkit.org/show_bug.cgi?id=186415
2659         <rdar://problem/40584651>
2660
2661         Reviewed by Eric Carlson.
2662
2663         Test: platform/mac/media/audio-session-category-audio-autoplay.html
2664
2665         Make sure that the PlatformMediaSession's state has already been set when calling updateSessionStates().
2666
2667         * platform/audio/PlatformMediaSession.cpp:
2668         (WebCore::PlatformMediaSession::setState):
2669         * platform/audio/PlatformMediaSessionManager.cpp:
2670         (WebCore::PlatformMediaSessionManager::sessionWillBeginPlayback):
2671         (WebCore::PlatformMediaSessionManager::sessionStateChanged):
2672
2673 2018-06-08  Dean Jackson  <dino@apple.com>
2674
2675         'setRenderPipelineState:' is unavailable: not available on iOS
2676         https://bugs.webkit.org/show_bug.cgi?id=186449
2677         <rdar://problem/40880602>
2678
2679         Reviewed by Simon Fraser.
2680
2681         Be more explicit about the protocol type to avoid
2682         the compiler getting confused by a similar signature.
2683
2684         * platform/graphics/cocoa/GPURenderCommandEncoderMetal.mm:
2685         (WebCore::GPURenderCommandEncoder::setRenderPipelineState):
2686
2687 2018-06-08  Darin Adler  <darin@apple.com>
2688
2689         Fix iOS build.
2690
2691         * platform/ios/QuickLookSoftLink.mm: Removed QLPreviousScheme, which I said I did in the
2692         change log but looks like it didn't happen.
2693
2694 2018-06-08  Darin Adler  <darin@apple.com>
2695
2696         [Cocoa] Make more of our soft linking ARC-compatible
2697         https://bugs.webkit.org/show_bug.cgi?id=186437
2698
2699         Reviewed by Daniel Bates.
2700
2701         * editing/cocoa/DataDetection.mm:
2702         (WebCore::removeResultLinksFromAnchor): Fix comment referring to unused constant DDURLScheme.
2703
2704         * platform/cocoa/DataDetectorsCoreSoftLink.h: Removed unused DDURLScheme.
2705         * platform/cocoa/DataDetectorsCoreSoftLink.mm: Ditto.
2706
2707         * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
2708         Use SOFT_LINK_CONSTANT_MAY_FAIL for NSString constants instead of using
2709         SOFT_LINK_POINTER_OPTIONAL. Required moving iOS-specific items inside the
2710         #if PLATFORM(IOS) section.
2711         (WebCore::MediaPlayerPrivateAVFoundationObjC::createAVAssetForURL): Use the
2712         canLoad functions instead of checking for null to handle possibly-missing string constants.
2713         (WebCore::metadataType): Ditto.
2714
2715         * platform/graphics/avfoundation/objc/SourceBufferPrivateAVFObjC.mm: Removed unused
2716         AVMediaTypeVideo, AVMediaTypeAudio, and AVMediaTypeText soft linking.
2717
2718         * platform/ios/QuickLook.mm:
2719         (WebCore::isQuickLookPreviewURL): Removed unneeded assertion.
2720
2721         * platform/ios/QuickLookSoftLink.h: Removed unneeded QLPreviousScheme, which was used only
2722         for an assertion, one we can do without.
2723         * platform/ios/QuickLookSoftLink.mm: Ditto.
2724
2725         * platform/mediastream/mac/AVVideoCaptureSource.mm: Removed unused soft linking of
2726         AVCaptureVideoPreviewLayer class and AVCaptureSessionPresetLow string constant. Use
2727         SOFT_LINK_CONSTANT_MAY_FAIL for NSString constants instead of using
2728         SOFT_LINK_POINTER_OPTIONAL.
2729         (WebCore::AVVideoCaptureSource::initializeCapabilities): Use the canLoad functions
2730         instead of checking for null to handle possibly-missing string constants.
2731         (WebCore::sizeForPreset): Ditto.
2732         (WebCore::AVVideoCaptureSource::bestSessionPresetForVideoDimensions const): Ditto.
2733
2734 2018-06-08  Aditya Keerthi  <akeerthi@apple.com>
2735
2736         [Datalist] Allow TextFieldInputType to show and hide suggestions
2737         https://bugs.webkit.org/show_bug.cgi?id=186151
2738
2739         Reviewed by Tim Horton.
2740
2741         TextFieldInputTypes with a list attribute should be able to display suggestions as the user
2742         interacts with the input field. In order to display suggestions for an input field with a list
2743         attribute, we need provide certain information - including the items to suggest and the location
2744         to present the suggestions. TextFieldInputType can now provide this information by conforming to
2745         the DataListSuggestionsClient interface.
2746
2747         In this initial patch, the suggestions can be shown in two ways. The first is by clicking on the
2748         input field. The other is by typing text in the field. In a later patch, we will add a third way
2749         to display suggestions, using a button. These ways to activate the suggestions are enumerated in
2750         DataListSuggestionInformation.
2751
2752         We hide the suggestions if there are no more to show, or if the input has blurred.
2753
2754         Tests to be added once work has been done in the UIProcess.
2755
2756         * WebCore.xcodeproj/project.pbxproj:
2757         * html/DataListSuggestionInformation.h: Added. Contains the information necessary to display suggestions.
2758         * html/TextFieldInputType.cpp:
2759         (WebCore::TextFieldInputType::~TextFieldInputType):
2760         (WebCore::TextFieldInputType::handleClickEvent): Show suggestions when the element is clicked.
2761         (WebCore::TextFieldInputType::handleKeydownEvent): Allow users to interact with the suggestions using the keyboard.
2762         (WebCore::TextFieldInputType::elementDidBlur): Hide the suggestions.
2763         (WebCore::TextFieldInputType::shouldRespectListAttribute):
2764         (WebCore::TextFieldInputType::didSetValueByUserEdit): Update the suggestions if the text has changed.
2765         (WebCore::TextFieldInputType::elementRectRelativeToRootView const): Provide the location where the suggestions should be shown.
2766         (WebCore::TextFieldInputType::suggestions const): Provide the list of suggestions.
2767         (WebCore::TextFieldInputType::didSelectDataListOption): Update the text once an suggestion has been selected.
2768         (WebCore::TextFieldInputType::didCloseSuggestions):
2769         (WebCore::TextFieldInputType::displaySuggestions):
2770         (WebCore::TextFieldInputType::closeSuggestions):
2771         * html/TextFieldInputType.h:
2772         * loader/EmptyClients.cpp:
2773         (WebCore::EmptyChromeClient::createDataListSuggestionPicker):
2774         * loader/EmptyClients.h:
2775         * page/Chrome.cpp:
2776         (WebCore::Chrome::createDataListSuggestionPicker):
2777         * page/Chrome.h:
2778         * page/ChromeClient.h:
2779         * platform/DataListSuggestionPicker.h: Added.
2780         (WebCore::DataListSuggestionPicker::close):
2781         (WebCore::DataListSuggestionPicker::handleKeydownWithIdentifier):
2782         (WebCore::DataListSuggestionPicker::displayWithActivationType):
2783         * platform/DataListSuggestionsClient.h: Added.
2784
2785 2018-06-07  Ryosuke Niwa  <rniwa@webkit.org>
2786
2787         REGRESSION(macOS Mojave): move-by-word-visually-inline-block-positioned-element.html fails
2788         https://bugs.webkit.org/show_bug.cgi?id=186424
2789
2790         Reviewed by Wenson Hsieh.
2791
2792         The test failure is ultimately caused by the change in ICU's behavior. With the CPU in the latest macOS Mojave,
2793         ubrk_getRuleStatus returns 200 / UBRK_WORD_LETTER at the end of a buffer given to UBreakIterator. This caused
2794         isWordTextBreak to return true instead of false in isLogicalStartOfWord at the end of the buffer.
2795
2796         This ICU behavior shouldn't have caused a problem in theory. However, WebKit had a bug in visualWordPosition which
2797         caused UBreakIterator to not include the succeeding word when traversing words to the left (backwards in LTR text)
2798         at the beginning of the last block element with exactly one line box after an non-statically positioned element.
2799
2800         In this case, visualWordPosition invokes wordBreakIteratorForMaxOffsetBoundary (because adjacentCharacterPosition
2801         is now at the end of the last word in the non-statically positioned element) to setup UBreakIterator. Because
2802         there are no line boxes left in the current line (in the last block element with exactly one line box),
2803         logicallyNextBox enters the while loop and invoke nextRootInlineBoxCandidatePosition to find the next root line box.
2804         However, the visible position given to this function is at the beginning of the first word in the block element.
2805         As a result, nextRootInlineBoxCandidatePosition skips over this entire line and finds no line box after the one
2806         we had in the non-statically positioned element.
2807
2808         Let us consider the following concrete example in which a position: static div is followed by another div, and each
2809         div contains text nodes "hello" and "world" respectively:
2810         - div position: static (1)
2811             - "hello"
2812         - div (2)
2813             - "world"
2814         Suppose we're at the offset 0 of "world", and trying to move to the left. In this case, adjacentCharacterPosition is
2815         at offset 5 of "world". The next line box should be that of "world". However, because we invoke logicallyNextBox via
2816         wordBreakIteratorForMaxOffsetBoundary with the visible position at offset 0 of "world", it skips this line and return
2817         nullptr.
2818
2819         This patch addresses this test failure by fixing visualWordPosition by passing adjacentCharacterPosition (at offset 5
2820         of "hello") as the visible position to find the next text box so that nextRootInlineBoxCandidatePosition invoked in
2821         logicallyNextBox would not skip the line ("world") from which we started the traversal to find the next line box.
2822
2823         Tests: editing/selection/move-by-word-visually-inline-block-positioned-element.html
2824
2825         * editing/VisibleUnits.cpp:
2826         (WebCore::visualWordPosition):
2827
2828 2018-06-08  Brent Fulgham  <bfulgham@apple.com>
2829
2830         REGRESSION (r230930): Link drag image is very blurry
2831         https://bugs.webkit.org/show_bug.cgi?id=186435
2832         <rdar://problem/40797202>
2833
2834         Reviewed by Tim Horton.
2835
2836         Tell NSImage the proper display scale factor it needs when performing a 'lockFocus' by passing
2837         the correct scaling transform as an NSImageHintCTM.
2838
2839         I reviewed the other drag operations (selection, image, and attachment) and confirmed through
2840         manual testing that these operations already properly scale the images. It appears that links
2841         were the only place where we relied on NSImage to determine and use the relevant device scale
2842         factor.
2843
2844         * SourcesCocoa.txt: Add new WebKitNSImageExtras.mm file.
2845         * WebCore.xcodeproj/project.pbxproj: Update for new files.
2846         * platform/graphics/mac/WebKitNSImageExtras.h: Added.
2847         * platform/graphics/mac/WebKitNSImageExtras.mm: Added.
2848         (-[NSImage _web_lockFocusWithTransform:]): Helper method that takes a device scale factor, creates the
2849         relevant scaling NSAffineTransform and passes it to the internal NSImage 'lockFocusWithRect' as the
2850         NSImageHintCTM hint.
2851         * platform/mac/DragImageMac.mm:
2852         (WebCore::createDragImageForLink): Use the new helper function.
2853
2854 2018-06-08  Zalan Bujtas  <zalan@apple.com>
2855
2856         [LFC] Add vertical margin computation for inline, block-level, inline-block and floating replaced elements
2857         https://bugs.webkit.org/show_bug.cgi?id=186432
2858
2859         Reviewed by Antti Koivisto.
2860
2861         * layout/FormattingContext.h:
2862         * layout/FormattingContextGeometry.cpp:
2863         (WebCore::Layout::FormattingContext::Geometry::floatingNonReplacedWidthAndMargin):
2864         (WebCore::Layout::FormattingContext::Geometry::floatingReplacedWidthAndMargin): Use the computed non-auto values when margin is not auto.
2865         (WebCore::Layout::FormattingContext::Geometry::inlineReplacedHeightAndMargin):
2866         (WebCore::Layout::FormattingContext::Geometry::computedNonCollapsedHorizontalMarginValue):
2867         (WebCore::Layout::FormattingContext::Geometry::computedNonCollapsedVerticalMarginValue):
2868
2869 2018-06-07  Yusuke Suzuki  <utatane.tea@gmail.com>
2870
2871         [WTF] Add WorkerPool
2872         https://bugs.webkit.org/show_bug.cgi?id=174569
2873
2874         Reviewed by Carlos Garcia Campos.
2875
2876         We start using WorkerPool for NicosiaPaintingEngineThreaded instead of glib thread pool.
2877         This makes NicosiaPaintingEngineThreaded platform-independent and usable for WinCairo.
2878
2879         * platform/graphics/nicosia/NicosiaPaintingEngineThreaded.cpp:
2880         (Nicosia::PaintingEngineThreaded::PaintingEngineThreaded):
2881         (Nicosia::PaintingEngineThreaded::~PaintingEngineThreaded):
2882         (Nicosia::PaintingEngineThreaded::paint):
2883         (Nicosia::s_threadFunc): Deleted.
2884         * platform/graphics/nicosia/NicosiaPaintingEngineThreaded.h:
2885
2886 2018-06-08  Miguel Gomez  <magomez@igalia.com>
2887
2888         [GTK][WPE] Wrong result when calling ImageBufferCairo's getImageData()
2889         https://bugs.webkit.org/show_bug.cgi?id=186384
2890
2891         Reviewed by Michael Catanzaro.
2892
2893         Fix calculations so the result is the expected one.
2894
2895         * platform/graphics/cairo/ImageBufferCairo.cpp:
2896         (WebCore::getImageData):
2897
2898 2018-06-07  Fujii Hironori  <Hironori.Fujii@sony.com>
2899
2900         Add base class to get WeakPtrFactory member and avoid some boilerplate code
2901         https://bugs.webkit.org/show_bug.cgi?id=186407
2902         <rdar://problem/40922716>
2903
2904         Unreviewed WinCairo build fix
2905
2906         MediaPlayerPrivateMediaFoundation.cpp(1726): error C2039: 'makeWeakPtr': is not a member of 'WebCore::MediaPlayerPrivateMediaFoundation'
2907
2908         No new tests (No behavior change).
2909
2910         * platform/graphics/win/MediaPlayerPrivateMediaFoundation.cpp:
2911         (WebCore::MediaPlayerPrivateMediaFoundation::CustomVideoPresenter::processInputNotify):
2912
2913 2018-06-07  Chris Dumez  <cdumez@apple.com>
2914
2915         Add base class to get WeakPtrFactory member and avoid some boilerplate code
2916         https://bugs.webkit.org/show_bug.cgi?id=186407
2917
2918         Reviewed by Brent Fulgham.
2919
2920         Add CanMakeWeakPtr base class to get WeakPtrFactory member and its getter, in
2921         order to avoid some boilerplate code in every class needing a WeakPtrFactory.
2922         This also gets rid of old-style createWeakPtr() methods in favor of the newer
2923         makeWeakPtr().
2924
2925         * Modules/credentialmanagement/CredentialsMessenger.h:
2926         * Modules/credentialmanagement/NavigatorCredentials.cpp:
2927         (WebCore::NavigatorCredentials::credentials):
2928         * Modules/encryptedmedia/CDM.cpp:
2929         (WebCore::CDM::doSupportedConfigurationStep):
2930         (WebCore::CDM::getConsentStatus):
2931         * Modules/encryptedmedia/CDM.h:
2932         * Modules/encryptedmedia/MediaKeySession.cpp:
2933         (WebCore::MediaKeySession::generateRequest):
2934         (WebCore::MediaKeySession::load):
2935         (WebCore::MediaKeySession::update):
2936         (WebCore::MediaKeySession::close):
2937         (WebCore::MediaKeySession::remove):
2938         * Modules/encryptedmedia/MediaKeySession.h:
2939         * Modules/encryptedmedia/MediaKeys.cpp:
2940         (WebCore::MediaKeys::createSession):
2941         * Modules/encryptedmedia/MediaKeys.h:
2942         * Modules/gamepad/GamepadManager.cpp:
2943         (WebCore::GamepadManager::platformGamepadDisconnected):
2944         (WebCore::GamepadManager::makeGamepadVisible):
2945         * Modules/mediastream/MediaDevices.cpp:
2946         (WebCore::MediaDevices::MediaDevices):
2947         * Modules/mediastream/MediaDevices.h:
2948         * Modules/mediastream/MediaStreamTrack.cpp:
2949         (WebCore::MediaStreamTrack::applyConstraints):
2950         * Modules/mediastream/MediaStreamTrack.h:
2951         * Modules/webauthn/cocoa/LocalAuthenticator.h:
2952         * Modules/webauthn/cocoa/LocalAuthenticator.mm:
2953         (WebCore::LocalAuthenticator::makeCredential):
2954         * accessibility/AccessibilityRenderObject.h:
2955         * accessibility/AccessibilitySVGRoot.cpp:
2956         (WebCore::AccessibilitySVGRoot::setParent):
2957         * crypto/SubtleCrypto.cpp:
2958         (WebCore::SubtleCrypto::encrypt):
2959         (WebCore::SubtleCrypto::decrypt):
2960         (WebCore::SubtleCrypto::sign):
2961         (WebCore::SubtleCrypto::verify):
2962         (WebCore::SubtleCrypto::digest):
2963         (WebCore::SubtleCrypto::generateKey):
2964         (WebCore::SubtleCrypto::deriveKey):
2965         (WebCore::SubtleCrypto::deriveBits):
2966         (WebCore::SubtleCrypto::importKey):
2967         (WebCore::SubtleCrypto::exportKey):
2968         (WebCore::SubtleCrypto::wrapKey):
2969         (WebCore::SubtleCrypto::unwrapKey):
2970         * crypto/SubtleCrypto.h:
2971         * css/CSSFontFace.cpp:
2972         (WebCore::CSSFontFace::CSSFontFace):
2973         (WebCore::CSSFontFace::wrapper):
2974         (WebCore::CSSFontFace::setWrapper):
2975         * css/DeprecatedCSSOMValue.h:
2976         * css/FontFace.cpp:
2977         * css/FontFace.h:
2978         * css/MediaQueryEvaluator.cpp:
2979         (WebCore::MediaQueryEvaluator::MediaQueryEvaluator):
2980         * css/StyleSheetContents.h:
2981         * css/parser/CSSDeferredParser.cpp:
2982         (WebCore::CSSDeferredParser::CSSDeferredParser):
2983         * dom/DataTransferItemList.cpp:
2984         (WebCore::DataTransferItemList::add):
2985         (WebCore::DataTransferItemList::ensureItems const):
2986         (WebCore::DataTransferItemList::didSetStringData):
2987         * dom/DataTransferItemList.h:
2988         * dom/Document.cpp:
2989         (WebCore::Document::postTask):
2990         (WebCore::Document::hasStorageAccess):
2991         (WebCore::Document::requestStorageAccess):
2992         * dom/Document.h:
2993         (WebCore::Document::setContextDocument):
2994         * dom/MessagePort.h:
2995         * html/HTMLImageElement.cpp:
2996         (WebCore::HTMLImageElement::setPictureElement):
2997         * html/HTMLInputElement.h:
2998         * html/HTMLMediaElement.cpp:
2999         (WebCore::HTMLMediaElement::mediaPlayerCreateResourceLoader):
3000         * html/HTMLMediaElement.h:
3001         * html/HTMLPictureElement.h:
3002         * html/parser/HTMLResourcePreloader.h:
3003         * layout/layouttree/LayoutBox.h:
3004         (WebCore::Layout::Box::style const):
3005         * loader/FormState.h:
3006         * loader/LinkLoader.cpp:
3007         (WebCore::LinkLoader::preconnectIfNeeded):
3008         * loader/LinkLoader.h:
3009         * loader/LinkPreloadResourceClients.cpp:
3010         (WebCore::LinkPreloadResourceClient::LinkPreloadResourceClient):
3011         * loader/MediaResourceLoader.cpp:
3012         (WebCore::MediaResourceLoader::MediaResourceLoader):
3013         * loader/MediaResourceLoader.h:
3014         * page/DOMWindow.h:
3015         * page/EventHandler.cpp:
3016         (WebCore::widgetForElement):
3017         (WebCore::EventHandler::updateLastScrollbarUnderMouse):
3018         * platform/GenericTaskQueue.cpp:
3019         (WebCore::TaskDispatcher<Timer>::postTask):
3020         * platform/GenericTaskQueue.h:
3021         (WebCore::GenericTaskQueue::enqueueTask):
3022         (WebCore::GenericTaskQueue::cancelAllTasks):
3023         * platform/ScrollView.h:
3024         * platform/ScrollableArea.h:
3025         * platform/Scrollbar.h:
3026         * platform/Widget.cpp:
3027         (WebCore::Widget::setParent):
3028         * platform/Widget.h:
3029         * platform/audio/gstreamer/AudioFileReaderGStreamer.cpp:
3030         (WebCore::AudioFileReader::decodeAudioForBusCreation):
3031         * platform/audio/mac/AudioHardwareListenerMac.cpp:
3032         (WebCore::AudioHardwareListenerMac::AudioHardwareListenerMac):
3033         * platform/audio/mac/AudioHardwareListenerMac.h:
3034         * platform/encryptedmedia/clearkey/CDMClearKey.cpp:
3035         (WebCore::CDMInstanceClearKey::requestLicense):
3036         (WebCore::CDMInstanceClearKey::updateLicense):
3037         (WebCore::CDMInstanceClearKey::loadSession):
3038         (WebCore::CDMInstanceClearKey::closeSession):
3039         (WebCore::CDMInstanceClearKey::removeSessionData):
3040         * platform/encryptedmedia/clearkey/CDMClearKey.h:
3041         * platform/graphics/FontCascade.h:
3042         * platform/graphics/avfoundation/MediaPlayerPrivateAVFoundation.cpp:
3043         (WebCore::MediaPlayerPrivateAVFoundation::scheduleMainThreadNotification):
3044         (WebCore::MediaPlayerPrivateAVFoundation::dispatchNotification):
3045         * platform/graphics/avfoundation/MediaPlayerPrivateAVFoundation.h:
3046         * platform/graphics/avfoundation/objc/CDMInstanceFairPlayStreamingAVFObjC.h:
3047         * platform/graphics/avfoundation/objc/CDMInstanceFairPlayStreamingAVFObjC.mm:
3048         (WebCore::CDMInstanceFairPlayStreamingAVFObjC::didProvideRequest):
3049         * platform/graphics/avfoundation/objc/CDMSessionAVFoundationObjC.h:
3050         * platform/graphics/avfoundation/objc/CDMSessionAVFoundationObjC.mm:
3051         (WebCore::CDMSessionAVFoundationObjC::CDMSessionAVFoundationObjC):
3052         * platform/graphics/avfoundation/objc/CDMSessionAVStreamSession.h:
3053         * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.h:
3054         * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
3055         (WebCore::MediaPlayerPrivateAVFoundationObjC::createVideoLayer):
3056         (WebCore::MediaPlayerPrivateAVFoundationObjC::checkPlayability):
3057         (WebCore::MediaPlayerPrivateAVFoundationObjC::beginLoadingMetadata):
3058         (WebCore::MediaPlayerPrivateAVFoundationObjC::seekToTime):
3059         (WebCore::MediaPlayerPrivateAVFoundationObjC::createSession):
3060         (WebCore::MediaPlayerPrivateAVFoundationObjC::setShouldPlayToPlaybackTarget):
3061         (-[WebCoreAVFMovieObserver observeValueForKeyPath:ofObject:change:context:]):
3062         * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.h:
3063         * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.mm:
3064         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::requestNotificationWhenReadyForVideoData):
3065         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::scheduleDeferredTask):
3066         * platform/graphics/cv/TextureCacheCV.h:
3067         * platform/graphics/cv/TextureCacheCV.mm:
3068         (WebCore::TextureCacheCV::textureFromImage):
3069         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:
3070         (WebCore::MediaPlayerPrivateGStreamer::notifyPlayerOfVideo):
3071         (WebCore::MediaPlayerPrivateGStreamer::notifyPlayerOfAudio):
3072         (WebCore::MediaPlayerPrivateGStreamer::handleMessage):
3073         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.h:
3074         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp:
3075         (WebCore::MediaPlayerPrivateGStreamerBase::handleSyncMessage):
3076         (WebCore::MediaPlayerPrivateGStreamerBase::initializationDataEncountered):
3077         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.h:
3078         * platform/graphics/gstreamer/mse/AppendPipeline.cpp:
3079         (WebCore::AppendPipeline::connectDemuxerSrcPadToAppsink):
3080         * platform/graphics/mac/DisplayRefreshMonitorMac.cpp:
3081         (WebCore::DisplayRefreshMonitorMac::displayLinkFired):
3082         * platform/graphics/mac/DisplayRefreshMonitorMac.h:
3083         * platform/graphics/texmap/TextureMapperLayer.cpp:
3084         (WebCore::TextureMapperLayer::setMaskLayer):
3085         (WebCore::TextureMapperLayer::setReplicaLayer):
3086         * platform/graphics/texmap/TextureMapperLayer.h:
3087         * platform/graphics/win/MediaPlayerPrivateMediaFoundation.cpp:
3088         (WebCore::MediaPlayerPrivateMediaFoundation::endCreatedMediaSource):
3089         (WebCore::MediaPlayerPrivateMediaFoundation::endGetEvent):
3090         (WebCore::MediaPlayerPrivateMediaFoundation::CustomVideoPresenter::processInputNotify):
3091         * platform/graphics/win/MediaPlayerPrivateMediaFoundation.h:
3092         * platform/ios/RemoteCommandListenerIOS.h:
3093         * platform/ios/RemoteCommandListenerIOS.mm:
3094         (WebCore::RemoteCommandListenerIOS::RemoteCommandListenerIOS):
3095         * platform/mac/RemoteCommandListenerMac.h:
3096         * platform/mac/RemoteCommandListenerMac.mm:
3097         (WebCore::RemoteCommandListenerMac::RemoteCommandListenerMac):
3098         * platform/mediastream/MediaStreamPrivate.cpp:
3099         (WebCore::MediaStreamPrivate::scheduleDeferredTask):
3100         * platform/mediastream/MediaStreamPrivate.h:
3101         * platform/mediastream/RealtimeMediaSource.cpp:
3102         (WebCore::RealtimeMediaSource::scheduleDeferredTask):
3103         * platform/mediastream/RealtimeMediaSource.h:
3104         * platform/mediastream/mac/ScreenDisplayCaptureSourceMac.h:
3105         * platform/mediastream/mac/ScreenDisplayCaptureSourceMac.mm:
3106         (WebCore::ScreenDisplayCaptureSourceMac::createDisplayStream):
3107         * platform/vr/VRPlatformDisplay.h:
3108         * platform/vr/openvr/VRPlatformManagerOpenVR.cpp:
3109         (WebCore::VRPlatformManagerOpenVR::getVRDisplays):
3110         * rendering/FloatingObjects.h:
3111         (WebCore::FloatingObject::setOriginatingLine):
3112         * rendering/RenderObject.h:
3113         * rendering/RootInlineBox.cpp:
3114         * rendering/RootInlineBox.h:
3115         * svg/SVGPathElement.h:
3116         * svg/SVGPathSegWithContext.h:
3117         (WebCore::SVGPathSegWithContext::SVGPathSegWithContext):
3118         (WebCore::SVGPathSegWithContext::setContextAndRole):
3119         * svg/SVGTransformList.h:
3120         * svg/properties/SVGAnimatedListPropertyTearOff.h:
3121         (WebCore::SVGAnimatedListPropertyTearOff::baseVal):
3122         (WebCore::SVGAnimatedListPropertyTearOff::animVal):
3123         * svg/properties/SVGAnimatedPathSegListPropertyTearOff.h:
3124         * svg/properties/SVGAnimatedPropertyTearOff.h:
3125         * svg/properties/SVGAnimatedTransformListPropertyTearOff.h:
3126         * svg/properties/SVGListProperty.h:
3127         (WebCore::SVGListProperty::initializeValuesAndWrappers):
3128         (WebCore::SVGListProperty::getItemValuesAndWrappers):
3129         (WebCore::SVGListProperty::insertItemBeforeValuesAndWrappers):
3130         (WebCore::SVGListProperty::replaceItemValuesAndWrappers):
3131         (WebCore::SVGListProperty::appendItemValuesAndWrappers):
3132         * svg/properties/SVGMatrixTearOff.h:
3133         * svg/properties/SVGPropertyTearOff.h:
3134         * testing/MockCDMFactory.cpp:
3135         (WebCore::MockCDMFactory::createCDM):
3136         (WebCore::MockCDM::createInstance):
3137         * testing/MockCDMFactory.h:
3138         * workers/service/ExtendableEvent.h:
3139         * workers/service/FetchEvent.cpp:
3140         (WebCore::FetchEvent::respondWith):
3141         * workers/service/server/SWServer.h:
3142         * xml/DOMParser.cpp:
3143         (WebCore::DOMParser::DOMParser):
3144
3145 2018-06-07  Chris Dumez  <cdumez@apple.com>
3146
3147         PopStateEvent should not be cancelable by default
3148         https://bugs.webkit.org/show_bug.cgi?id=186420
3149
3150         Reviewed by Darin Adler.
3151
3152         PopStateEvent should not be cancelable by default:
3153         - https://github.com/web-platform-tests/wpt/pull/11355
3154         - https://html.spec.whatwg.org/#history-traversal
3155
3156         All other browsers agree with the specification.
3157
3158         No new tests, updated existing tests.
3159
3160         * dom/PopStateEvent.cpp:
3161         (WebCore::PopStateEvent::PopStateEvent):
3162
3163 2018-06-07  Simon Fraser  <simon.fraser@apple.com>
3164
3165         Remove a log that was left in by mistake.
3166
3167         * loader/cache/MemoryCache.cpp:
3168         (WebCore::MemoryCache::pruneLiveResourcesToSize):
3169
3170 2018-06-07  Antoine Quint  <graouts@apple.com>
3171
3172         [ASan / StressGC] DumpRenderTree crashed in com.apple.WebCore: WebCore::EventTarget::ref + 16
3173         https://bugs.webkit.org/show_bug.cgi?id=186207
3174         <rdar://problem/40568747>
3175
3176         Reviewed by Dean Jackson.
3177
3178         Ensure that we clear the DOM event queue for declarative animations once an animation is cleared for
3179         an element since the element can be deleted before events get dispatched asynchronouly for this animation.
3180
3181         We also only call AnimationTimeline::removeAnimationsForElement() from RenderTreeUpdater::tearDownRenderers()
3182         in the case where we're tearing down the whole document as otherwise this would yield early clearing of the event
3183         queue in the case where an element would get a "display: none" style.
3184
3185         * animation/AnimationTimeline.cpp:
3186         (WebCore::AnimationTimeline::removeAnimationsForElement):
3187         * animation/DeclarativeAnimation.cpp:
3188         (WebCore::DeclarativeAnimation::~DeclarativeAnimation):
3189         (WebCore::DeclarativeAnimation::prepareAnimationForRemoval):
3190         * animation/DeclarativeAnimation.h:
3191         * animation/WebAnimation.cpp:
3192         (WebCore::WebAnimation::prepareAnimationForRemoval):
3193         * animation/WebAnimation.h:
3194         * rendering/updating/RenderTreeUpdater.cpp:
3195         (WebCore::RenderTreeUpdater::tearDownRenderers):
3196
3197 2018-06-07  Don Olmstead  <don.olmstead@sony.com>
3198
3199         [CoordGraphics] Fix compilation errors around USE(COORDINATED_GRAPHICS)
3200         https://bugs.webkit.org/show_bug.cgi?id=186374
3201
3202         Reviewed by Žan Doberšek.
3203
3204         No new tests. No change in behavior.
3205
3206         * page/scrolling/AsyncScrollingCoordinator.cpp:
3207         (WebCore::AsyncScrollingCoordinator::reconcileScrollingState):
3208         (WebCore::AsyncScrollingCoordinator::reconcileViewportConstrainedLayerPositions):
3209         * page/scrolling/coordinatedgraphics/ScrollingCoordinatorCoordinatedGraphics.cpp:
3210         * page/scrolling/coordinatedgraphics/ScrollingTreeFixedNode.cpp:
3211         * page/scrolling/coordinatedgraphics/ScrollingTreeStickyNode.cpp:
3212         * platform/PlatformWheelEvent.h:
3213         * platform/graphics/nicosia/NicosiaPaintingEngineThreaded.cpp:
3214         * platform/graphics/nicosia/NicosiaPaintingEngineThreaded.h:
3215         * platform/graphics/texmap/TextureMapperPlatformLayerBuffer.cpp:
3216         * platform/graphics/texmap/TextureMapperPlatformLayerBuffer.h:
3217
3218 2018-06-07  Thibault Saunier  <tsaunier@igalia.com> and Alejandro G. Castro  <alex@igalia.com>
3219
3220         [GTK][WPE] Start implementing MediaStream API
3221         https://bugs.webkit.org/show_bug.cgi?id=185787
3222
3223         Reviewed by Philippe Normand.
3224
3225         We are adding all the required classes to make the
3226         MediaStream API work, that means our own RealtimeMediaSourceCenterLibWebRTC
3227         for the platform, the GStreamerCaptureDeviceManager, the audio/video capturers
3228         and their respective audio/video sources as well as a dedicated GStreamer Source
3229         that adds support for using MediaStream stream inside playbin3.
3230         We are using the GstDeviceMonitor to list devices on the devices.
3231
3232         Enable mediastream tests.
3233
3234         * platform/GStreamer.cmake: Added the new files to the compilation.
3235         * platform/audio/AudioStreamDescription.h: Added new GStreamer type.
3236         * platform/audio/PlatformAudioData.h: Added new GStreamer type for
3237         the GStreamerAudioData class.
3238         * platform/graphics/gstreamer/GStreamerCommon.cpp:
3239         (WebCore::simpleBusMessageCallback): This function and the next
3240         one help us to connect a monitoring callback to a pipeline for
3241         debugging.
3242         (WebCore::connectSimpleBusMessageCallback): Ditto.
3243         * platform/graphics/gstreamer/GStreamerCommon.h: Ditto
3244         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:
3245         (WebCore::MediaPlayerPrivateGStreamer::load): Make use of the loadFull() method.
3246         (WebCore::MediaPlayerPrivateGStreamer::loadFull): Very similar to load()
3247         but allows specifying what pipeline type to use (null to let the function determine
3248         which one should be used). This is required as we force to always use playbin3 for the
3249         mediastream source as it relies on the GstStream API.
3250         (WebCore::MediaPlayerPrivateGStreamer::playbackPosition const): Style fix.
3251         (WebCore::MediaPlayerPrivateGStreamer::naturalSize const): Added, use MediaStream specific information if available.
3252         (WebCore::MediaPlayerPrivateGStreamer::updateTracks): Some style fixes.
3253         (WebCore::MediaPlayerPrivateGStreamer::handleMessage): Enhance dotfiles names.
3254         (WebCore::MediaPlayerPrivateGStreamer::processTableOfContentsEntry): Minor formatting fix.
3255         (WebCore::MediaPlayerPrivateGStreamer::sourceSetup): Set MediaStream on WebKitMediaStreamSource when setting it up.
3256         (WebCore::MediaPlayerPrivateGStreamer::supportsType): Advertise that we support MediaStream if support is built.
3257         (WebCore::MediaPlayerPrivateGStreamer::createGSTPlayBin): Make sure playbin3 is forced when loading a MediaStream.
3258         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.h: Add a reference to the MediaStream object and declare loadFull and naturalSize override.
3259         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp:
3260         (WebCore::registerWebKitGStreamerElements): Register the new MediaStreamSrc element.
3261         * platform/graphics/gstreamer/VideoTrackPrivateGStreamer.cpp:
3262         (WebCore::VideoTrackPrivateGStreamer::VideoTrackPrivateGStreamer): Make sure that MediaStream MAIN tracks are selected by default. We have no way to do it in MediaStreamSrc now as the GstStreamCollection is recreated by parsebin.
3263         * platform/mediastream/RealtimeMediaSource.h: Make CaptureFailed a virtual method as in our mocks we require need to make
3264         * platform/mediastream/RealtimeMediaSourceCenter.cpp:
3265         (WebCore::RealtimeMediaSourceCenter::singleton): Remove the code
3266         used for compilation for the platform when we do not have a
3267         RealtimeMediaSourceCenterLibWebRTC. Now we return the proper class
3268         for the platform.
3269         * platform/mediastream/gstreamer/GStreamerAudioCaptureSource.cpp:
3270         Added class representing the RealtimeMediaSource for the Audio
3271         with GStreamer.
3272         * platform/mediastream/gstreamer/GStreamerAudioCaptureSource.h:
3273         Ditto.
3274         * platform/mediastream/gstreamer/GStreamerAudioCapturer.cpp: Added
3275         this class that represents the GStreamer pipeline that captures
3276         audio from the system devices, it inherits from GStreamerCapturer.
3277         * platform/mediastream/gstreamer/GStreamerAudioCapturer.h: Dito.
3278         * platform/mediastream/gstreamer/GStreamerAudioData.h: Added this
3279         class implementing PlatformAudioData for the GStreamer platform,
3280         used to pass the samples information.
3281         * platform/mediastream/gstreamer/GStreamerAudioStreamDescription.h:
3282         Added this class implementing AudioStreamDescription to export the
3283         information about the audio stream to libwebrtc.
3284         * platform/mediastream/gstreamer/GStreamerCaptureDevice.h: Added
3285         this base class for the audio and video capturing devices, it
3286         implements general WebKit CaptureDevice class.
3287         * platform/mediastream/gstreamer/GStreamerCaptureDeviceManager.cpp:
3288         Added this class that implements the system monitor to get the
3289         list of available devices in the system. It uses GstDeviceMonitor
3290         to handle the operation. It uses two singleton device managers one
3291         for audio and another one for video, as required by the
3292         RealtimeMediaSourceCenter design.
3293         * platform/mediastream/gstreamer/GStreamerCaptureDeviceManager.h: Ditto.
3294         * platform/mediastream/gstreamer/GStreamerCapturer.cpp: Added this
3295         base class representing how GStreamer captures the media from the
3296         input devices in the system. Two classes inherit from this one to
3297         capture audio and video. It setups the GStreamer pipeline and adds
3298         functions to control it.
3299         * platform/mediastream/gstreamer/GStreamerCapturer.h: Ditto.
3300         * platform/mediastream/gstreamer/GStreamerMediaStreamSource.cpp: Added.
3301         Implements a subclass of GstBin as a source element that will contain several
3302         GstAppSrc, basically one per MediaStreamTrackPrivate of the MediaStreamPrivate
3303         passed in parameter. It adds Observers on the MediaStreamTracks and
3304         pushes the data to the sources as required. The element implements the GstURIHandler
3305         interface so it can be used in playbin. The MediaPlayerPrivateGStreamer is responsible
3306         for passing the MediaStreamPrivate object to the source when required.
3307         (WebCore::webkitMediaStreamSrcPadProbeCb): Event probe that fixes stream_start events (setting the ID etc)
3308         and finally add src pads to the pipeline.
3309         * platform/mediastream/gstreamer/GStreamerMediaStreamSource.h: Ditto.
3310         * platform/mediastream/gstreamer/GStreamerVideoCaptureSource.cpp:
3311         Added this RealtimeMediaSource representing the source of the
3312         video data for the GStreamer platform. It handles the settings and
3313         capabilities of the source and creates the capturer used to
3314         control the operation of the stream.
3315         * platform/mediastream/gstreamer/GStreamerVideoCaptureSource.h: Ditto.
3316         * platform/mediastream/gstreamer/GStreamerVideoCapturer.cpp: Added
3317         this class that inherits from the GStreamerCapturer and controls
3318         the GStreamer pipelines of the video streams of the system.
3319         * platform/mediastream/gstreamer/GStreamerVideoCapturer.h: Ditto.
3320         * platform/mediastream/gstreamer/MockGStreamerAudioCaptureSource.cpp: Added. Implementation of a Mock capturer for audio stream.
3321         Subclasses GStreamerAudioCapturer and wraps a MockRealtimeAudioSource so that the behaviour is the same a MockRealtimeAudioSource
3322         but still the GStreamer implementation code paths are tested.
3323         * platform/mediastream/gstreamer/MockGStreamerAudioCaptureSource.h: Ditto.
3324         * platform/mediastream/gstreamer/MockGStreamerVideoCaptureSource.cpp: Added. Implementation of a Mock capturer for video stream.
3325         Subclasses GStreamerVideoCapturer and wraps a MockRealtimeVideoSource so that the behaviour is the same a MockRealtimeVideoSource
3326         but still the GStreamer implementation code paths are tested.
3327         * platform/mediastream/gstreamer/MockGStreamerVideoCaptureSource.h: Ditto.
3328         * platform/mediastream/gstreamer/RealtimeMediaSourceCenterLibWebRTC.cpp:
3329         Added this class that implements the key RealtimeMediaSourceCenter
3330         functions to configure the base class for the platform, using the
3331         other GStreamer classes.
3332         * platform/mock/MockRealtimeAudioSource.cpp: Do not build ::create if GStreamer implementation is built
3333         * platform/mock/MockRealtimeVideoSource.cpp: Do not build ::create if GStreamer implementation is built
3334
3335 2018-06-07  Brent Fulgham  <bfulgham@apple.com>
3336
3337         Handle Storage Access API calls in the absence of an attached frame
3338         https://bugs.webkit.org/show_bug.cgi?id=186373
3339         <rdar://problem/40028265>
3340
3341         Reviewed by Daniel Bates.
3342
3343         Tests: http/tests/storageAccess/has-storage-access-crash.html
3344                http/tests/storageAccess/request-storage-access-crash.html
3345
3346         The new frame-specific storage access checks were done without confirming a
3347         frame was present, although the frame state was validated in other parts of
3348         the same method.
3349         
3350         This patch checks for a non-null frame before making frame-specific calls.
3351
3352         * dom/Document.cpp:
3353         (WebCore::Document::hasStorageAccess):
3354         (WebCore::Document::requestStorageAccess):
3355
3356 2018-06-07  Zalan Bujtas  <zalan@apple.com>
3357
3358         [LFC] Merge height and vertical margin computation
3359         https://bugs.webkit.org/show_bug.cgi?id=186394
3360
3361         Reviewed by Antti Koivisto.
3362
3363         To match the spec (and the width/horizontal margin computation). -currently with default values.
3364
3365         * layout/FormattingContext.cpp:
3366         (WebCore::Layout::FormattingContext::computeFloatingHeightAndMargin const):
3367         (WebCore::Layout::FormattingContext::computeOutOfFlowHeight const):
3368         (WebCore::Layout::FormattingContext::computeFloatingHeight const): Deleted.
3369         * layout/FormattingContext.h:
3370         * layout/FormattingContextGeometry.cpp:
3371         (WebCore::Layout::FormattingContext::Geometry::outOfFlowNonReplacedHeightAndMargin):
3372         (WebCore::Layout::FormattingContext::Geometry::outOfFlowReplacedHeightAndMargin):
3373         (WebCore::Layout::FormattingContext::Geometry::floatingNonReplacedHeightAndMargin):
3374         (WebCore::Layout::FormattingContext::Geometry::floatingReplacedHeightAndMargin):
3375         (WebCore::Layout::FormattingContext::Geometry::outOfFlowHeightAndMargin):
3376         (WebCore::Layout::FormattingContext::Geometry::floatingHeightAndMargin):
3377         (WebCore::Layout::FormattingContext::Geometry::inlineReplacedHeightAndMargin):
3378         (WebCore::Layout::outOfFlowNonReplacedHeight): Deleted.
3379         (WebCore::Layout::FormattingContext::Geometry::outOfFlowReplacedHeight): Deleted.
3380         (WebCore::Layout::floatingNonReplacedHeight): Deleted.
3381         (WebCore::Layout::FormattingContext::Geometry::floatingReplacedHeight): Deleted.
3382         (WebCore::Layout::FormattingContext::Geometry::outOfFlowHeight): Deleted.
3383         (WebCore::Layout::FormattingContext::Geometry::floatingHeight): Deleted.
3384         (WebCore::Layout::FormattingContext::Geometry::inlineReplacedHeight): Deleted.
3385         * layout/blockformatting/BlockFormattingContext.cpp:
3386         (WebCore::Layout::BlockFormattingContext::layout const):
3387         (WebCore::Layout::BlockFormattingContext::computeHeightAndMargin const):
3388         (WebCore::Layout::BlockFormattingContext::computeInFlowHeightAndMargin const):
3389         (WebCore::Layout::BlockFormattingContext::computeHeight const): Deleted.
3390         (WebCore::Layout::BlockFormattingContext::computeInFlowHeight const): Deleted.
3391         * layout/blockformatting/BlockFormattingContext.h:
3392         * layout/blockformatting/BlockFormattingContextGeometry.cpp:
3393         (WebCore::Layout::BlockFormattingContext::Geometry::inFlowNonReplacedHeightAndMargin):
3394         (WebCore::Layout::BlockFormattingContext::Geometry::inFlowHeightAndMargin):
3395         (WebCore::Layout::BlockFormattingContext::Geometry::inFlowNonReplacedHeight): Deleted.
3396         (WebCore::Layout::BlockFormattingContext::Geometry::inFlowHeight): Deleted.
3397
3398 2018-06-07  Antti Koivisto  <antti@apple.com>
3399
3400         Don't start service worker fetch when there is substitute data
3401         https://bugs.webkit.org/show_bug.cgi?id=186349
3402         <rdar://problem/38881568>
3403
3404         Reviewed by Youenn Fablet.
3405
3406         Loading content via WKWebView.loadData may also end up starting a main resource service worker fetch.
3407         This breaks DocumentWriter assumptions.
3408
3409         * loader/DocumentLoader.cpp:
3410         (WebCore::DocumentLoader::tryLoadingRequestFromApplicationCache):
3411         (WebCore::DocumentLoader::tryLoadingSubstituteData):
3412
3413         Factor substitute resource loading out from tryLoadingRequestFromApplicationCache.
3414
3415         (WebCore::DocumentLoader::startLoadingMainResource):
3416
3417         If we have substitute data already (typically from WKWebView.loadData), allow service worker registration
3418         but load the main resource using the substitute data.
3419
3420         (WebCore::DocumentLoader::handleSubstituteDataLoadSoon): Deleted.
3421
3422         Merge to tryLoadingSubstituteData.
3423
3424         * loader/DocumentLoader.h:
3425
3426 2018-06-07  Thibault Saunier  <tsaunier@igalia.com>
3427
3428         [GStreamer] Fix the way GstStreamCollection is handled
3429         https://bugs.webkit.org/show_bug.cgi?id=184588
3430
3431         Reviewed by Philippe Normand.
3432
3433         The stream collection message replaces the collection of stream previously
3434         advertised, this means that we should rebuild our set of Track from scratch
3435         and not update previously exposed tracks.
3436
3437         In the end, this simplifies the code as we do not care about what
3438         tracks existed previously, we just need to expose what GStreamer tells
3439         us, deleting any previous state.
3440
3441         Handle the STREAM_COLLECTION message from the sync handler so that tracks
3442         are updated before we mark the pipeline as READY for the live case (everything
3443         happen synchronously with the call to the `load()` method in that case),
3444         the update still always happens on the main thread.
3445
3446         No new tests is added as this is mostly refactoring, it is already tested and it
3447         will fix MediaStream tests that are currently disabled as the support is being
3448         implemented in #185787.
3449
3450         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:
3451         (WebCore::MediaPlayerPrivateGStreamer::clearTracks): Removes all tracks.
3452         (WebCore::MediaPlayerPrivateGStreamer::updateTracks): Updates configured tracks from the new GstStreamColection track.
3453         (WebCore::MediaPlayerPrivateGStreamer::handleMessage): Stop handling GST_STREAM_COLLECTION event.
3454         (WebCore::MediaPlayerPrivateGStreamer::handleSyncMessage): Handle stream collection event synchronously.
3455         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.h: Add handleSyncMessage
3456
3457 2018-06-07  Michael Catanzaro  <mcatanzaro@igalia.com>
3458
3459         Remove unused image encoders
3460         https://bugs.webkit.org/show_bug.cgi?id=186365
3461
3462         Reviewed by Carlos Garcia Campos.
3463
3464         * platform/image-encoders/JPEGImageEncoder.cpp: Removed.
3465         * platform/image-encoders/JPEGImageEncoder.h: Removed.
3466         * platform/image-encoders/PNGImageEncoder.cpp: Removed.
3467         * platform/image-encoders/PNGImageEncoder.h: Removed.
3468
3469 2018-06-06  Youenn Fablet  <youenn@apple.com>
3470
3471         HTTP Header values validation is too strict
3472         https://bugs.webkit.org/show_bug.cgi?id=167112
3473
3474         Reviewed by Alex Christensen.
3475
3476         Moving header values and names from DOMString to ByteString as per spec.
3477         Updating WebCore::isValidHTTPHeaderValue as per https://fetch.spec.whatwg.org/#terminology-headers.
3478
3479         Covered by rebased and updated tests.
3480         Updated test is now also passing in other browsers.
3481
3482         * platform/network/HTTPParsers.cpp:
3483         (WebCore::isValidHTTPHeaderValue):
3484
3485 2018-06-06  Youenn Fablet  <youenn@apple.com>
3486
3487         Add Accept-Encoding: identity to Range requests
3488         https://bugs.webkit.org/show_bug.cgi?id=186335
3489         <rdar://problem/40837190>
3490
3491         Reviewed by Eric Carlson.
3492
3493         Tests: imported/w3c/web-platform-tests/fetch/range/general.any.html
3494                imported/w3c/web-platform-tests/fetch/range/general.any.worker.html
3495
3496         * loader/cache/CachedResourceLoader.cpp:
3497         (WebCore::CachedResourceLoader::updateHTTPRequestHeaders):
3498         * loader/cache/CachedResourceRequest.cpp:
3499         (WebCore::CachedResourceRequest::updateAcceptEncodingHeader):
3500         * loader/cache/CachedResourceRequest.h:
3501
3502 2018-06-06  Per Arne Vollan  <pvollan@apple.com>
3503
3504         Display links are sometimes not notifying WebCore when fired.
3505         https://bugs.webkit.org/show_bug.cgi?id=186367
3506         <rdar://problem/40439109>
3507
3508         Reviewed by Brent Fulgham.
3509
3510         When the WebContent process is receiving an IPC message notifying about a screen update, all display refresh monitors
3511         are notified by the manager in DisplayRefreshMonitorManager::displayWasUpdated(). The manager checks that the monitor
3512         is scheduled before notifying. This is a problem, since the scheduled flag is always set to false in the
3513         DisplayRefreshMonitor::displayDidRefresh() method, when the monitor is first notified about a screen update. This can
3514         lead to display links running without notifying the monitors, causing extra CPU usage. It can also prevent them from
3515         being deleted, since the monitors are not notified. Instead, we can check that the display refresh monitor is active
3516         before notifying it. This matches the original display link implementation used when the WebContent process has
3517         WindowServer access, where the monitors are always notified.
3518
3519         No new tests, since I have not been able to reproduce this in a test case yet.
3520
3521         * platform/graphics/DisplayRefreshMonitorManager.cpp:
3522         (WebCore::DisplayRefreshMonitorManager::displayWasUpdated):
3523
3524 2018-06-06  Antoine Quint  <graouts@apple.com>
3525
3526         Rename color-filter to -apple-color-filter and do not expose it to Web content
3527         https://bugs.webkit.org/show_bug.cgi?id=186306
3528         <rdar://problem/39874167>
3529
3530         Reviewed by Simon Fraser.
3531
3532         Rename the color-filter CSS property to -apple-color-filter.
3533
3534         * animation/KeyframeEffectReadOnly.cpp:
3535         (WebCore::KeyframeEffectReadOnly::checkForMatchingColorFilterFunctionLists):
3536         * css/CSSComputedStyleDeclaration.cpp:
3537         (WebCore::ComputedStyleExtractor::valueForPropertyinStyle):
3538         * css/CSSGradientValue.cpp:
3539         (WebCore::CSSGradientValue::image):
3540         (WebCore::CSSGradientValue::computeStops):
3541         (WebCore::CSSGradientValue::knownToBeOpaque const):
3542         * css/CSSProperties.json:
3543         * css/parser/CSSPropertyParser.cpp:
3544         (WebCore::CSSPropertyParser::parseSingleValue):
3545         * page/animation/CSSPropertyAnimation.cpp:
3546         (WebCore::blendFunc):
3547         (WebCore::CSSPropertyAnimationWrapperMap::CSSPropertyAnimationWrapperMap):
3548         * page/animation/ImplicitAnimation.cpp:
3549         (WebCore::ImplicitAnimation::checkForMatchingColorFilterFunctionLists):
3550         * page/animation/KeyframeAnimation.cpp:
3551         (WebCore::KeyframeAnimation::checkForMatchingColorFilterFunctionLists):
3552         * rendering/InlineTextBox.cpp:
3553         (WebCore::InlineTextBox::paintMarkedTextForeground):
3554         (WebCore::InlineTextBox::paintMarkedTextDecoration):
3555         * rendering/style/RenderStyle.cpp:
3556         (WebCore::RenderStyle::changeRequiresRepaint const):
3557         (WebCore::RenderStyle::visitedDependentColorWithColorFilter const):
3558         (WebCore::RenderStyle::colorByApplyingColorFilter const):
3559         * rendering/style/RenderStyle.h:
3560         (WebCore::RenderStyle::mutableAppleColorFilter):
3561         (WebCore::RenderStyle::appleColorFilter const):
3562         (WebCore::RenderStyle::hasAppleColorFilter const):
3563         (WebCore::RenderStyle::setAppleColorFilter):
3564         (WebCore::RenderStyle::initialAppleColorFilter):
3565         (WebCore::RenderStyle::mutableColorFilter): Deleted.
3566         (WebCore::RenderStyle::colorFilter const): Deleted.
3567         (WebCore::RenderStyle::hasColorFilter const): Deleted.
3568         (WebCore::RenderStyle::setColorFilter): Deleted.
3569         (WebCore::RenderStyle::initialColorFilter): Deleted.
3570         * rendering/style/StyleRareInheritedData.cpp:
3571         (WebCore::StyleRareInheritedData::StyleRareInheritedData):
3572         (WebCore::StyleRareInheritedData::operator== const):
3573         (WebCore::StyleRareInheritedData::hasColorFilters const):
3574         * rendering/style/StyleRareInheritedData.h:
3575
3576 2018-06-06  Jer Noble  <jer.noble@apple.com>
3577
3578         REGRESSION (r231817?): Layout Test media/track/track-delete-during-setup.html is a flaky timeout
3579         https://bugs.webkit.org/show_bug.cgi?id=185889
3580         <rdar://problem/40583180>
3581
3582         Reviewed by Eric Carlson.
3583
3584         Explicitly update the network and ready states when detaching the AVPlayerItem
3585         from the AVPlayer.
3586
3587         * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
3588         (WebCore::MediaPlayerPrivateAVFoundationObjC::setShouldBufferData):
3589
3590 2018-06-06  Antoine Quint  <graouts@apple.com>
3591
3592         Use the default label for snapshotted plug-ins if no mime-type is available
3593         https://bugs.webkit.org/show_bug.cgi?id=186348
3594
3595         Reviewed by Jon Lee.
3596
3597         In case the mime-type is not available, use the default labels otherwise we'd crash trying to look up the empty string in the HashMap.
3598
3599         * html/HTMLPlugInImageElement.cpp:
3600         (WebCore::titleText):
3601         (WebCore::subtitleText):
3602
3603 2018-06-06  Timothy Hatcher  <timothy@apple.com>
3604
3605         Wrong NSVisualEffectMaterial used for exit full screen overlay in dark mode.
3606
3607         https://bugs.webkit.org/show_bug.cgi?id=186350
3608         rdar://problem/39135535
3609
3610         Reviewed by Anders Carlsson.
3611
3612         * platform/mac/WebCoreFullScreenPlaceholderView.mm:
3613         (-[WebCoreFullScreenPlaceholderView initWithFrame:]):
3614         Use the NSVisualEffectMaterialFullScreenUI on macOS 10.14 and don't
3615         set an explicit NSAppearance.
3616
3617 2018-06-06  Jer Noble  <jer.noble@apple.com>
3618
3619         Regions outside of the fullscreen window are exposed during zoom operations
3620         https://bugs.webkit.org/show_bug.cgi?id=186330
3621         <rdar://problem/34698009>
3622
3623         Reviewed by Simon Fraser.
3624
3625         Test: fullscreen/full-screen-layer-dump.html
3626
3627         Introduce the concept of "requiresBackgroundLayer" to RenderLayerBacking, for use by
3628         RenderFullScreen. Previously, the backgroundLayer in RenderLayerBacking was only used
3629         by the root renderer with fixed backgrounds. Give the RenderFullScreen a background layer
3630         that's approximately 3x as tall and wide as the renderer itself, so nothing is exposed
3631         during pinch operations.
3632
3633         * rendering/RenderLayerBacking.cpp:
3634         (WebCore::RenderLayerBacking::RenderLayerBacking):
3635         (WebCore::RenderLayerBacking::updateConfiguration):
3636         (WebCore::RenderLayerBacking::updateGeometry):
3637         (WebCore::RenderLayerBacking::updateDrawsContent):
3638         (WebCore::RenderLayerBacking::setRequiresBackgroundLayer):
3639         (WebCore::RenderLayerBacking::updateBackgroundLayer):
3640         (WebCore::RenderLayerBacking::updateDirectlyCompositedBackgroundColor):
3641         (WebCore::RenderLayerBacking::paintIntoLayer):
3642         * rendering/RenderLayerBacking.h:
3643
3644 2018-06-06  Jer Noble  <jer.noble@apple.com>
3645
3646         Set the AVAssetResourceLoaderRequest's contentType to AVStreamingKeyDeliveryContentKeyType in the case of a FPS key request.
3647         https://bugs.webkit.org/show_bug.cgi?id=186328
3648         <rdar://problem/40829228>
3649
3650         Reviewed by Eric Carlson.
3651
3652         * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
3653         (WebCore::MediaPlayerPrivateAVFoundationObjC::attemptToDecryptWithInstance):
3654
3655 2018-06-06  Zalan Bujtas  <zalan@apple.com>
3656
3657         [LFC] Add margin computation for floating, replaced elements.
3658         https://bugs.webkit.org/show_bug.cgi?id=186337
3659
3660         Reviewed by Antti Koivisto.
3661
3662         If 'margin-left' or 'margin-right' are computed as 'auto', their used value is '0'.
3663
3664         * layout/FormattingContext.h:
3665         * layout/FormattingContextGeometry.cpp:
3666         (WebCore::Layout::FormattingContext::Geometry::floatingReplacedWidthAndMargin):
3667         (WebCore::Layout::FormattingContext::Geometry::inlineReplacedWidthAndMargin):
3668
3669 2018-06-06  Zalan Bujtas  <zalan@apple.com>
3670
3671         [LFC] Add margin computation for floating, no-replaced elements.
3672         https://bugs.webkit.org/show_bug.cgi?id=186334
3673
3674         Reviewed by Antti Koivisto.
3675
3676         If 'margin-left', or 'margin-right' are computed as 'auto', their used value is '0'.
3677
3678         * layout/FormattingContextGeometry.cpp:
3679         (WebCore::Layout::FormattingContext::Geometry::floatingNonReplacedWidthAndMargin):
3680
3681 2018-06-06  Antti Koivisto  <antti@apple.com>
3682
3683         Use minimal coverage rect for tiled layers when under memory pressure
3684         https://bugs.webkit.org/show_bug.cgi?id=186185
3685         <rdar://problem/40713608>
3686
3687         Reviewed by Darin Adler.
3688
3689         We do this for the main content layer already.
3690
3691         * platform/graphics/ca/GraphicsLayerCA.cpp:
3692         (WebCore::GraphicsLayerCA::adjustTiledLayerVisibleRect):
3693
3694 2018-06-05  Antoine Quint  <graouts@apple.com>
3695
3696         [Web Animations] Only expose CSSAnimation and CSSTransition if the WebAnimationsCSSIntegration runtime flag is enabled
3697         https://bugs.webkit.org/show_bug.cgi?id=186305
3698
3699         Reviewed by Dean Jackson.
3700
3701         * animation/CSSAnimation.idl:
3702         * animation/CSSTransition.idl:
3703
3704 2018-06-05  Per Arne Vollan  <pvollan@apple.com>
3705
3706         Move OpenGL display mask to screen data struct.
3707         https://bugs.webkit.org/show_bug.cgi?id=186198
3708         <rdar://problem/40724854>
3709
3710         Reviewed by Brent Fulgham.
3711
3712         Currently, the OpenGL display mask is a global in the WebContent process. This is not correct in all cases, since
3713         it is possible to have two Web views in the same WebContent process, displayed on different displays. This can be
3714         resolved by moving the OpenGL display mask to a new ScreenData struct, containing information specific to each
3715         display. The display ID of the host window is used to find the OpenGL display mask when needed. This patch makes
3716         the host window available when creating an IOSurface, in order to find the right OpenGL display mask. If no host
3717         window is available, the OpenGL display mask of the main display is used.
3718
3719         No new tests, since testing this requires two Web views in the same WebContent process, displayed on
3720         two different monitors.
3721
3722         * html/HTMLCanvasElement.cpp:
3723         (WebCore::HTMLCanvasElement::createImageBuffer const):
3724         * platform/PlatformScreen.h:
3725         * platform/ScreenProperties.h:
3726         (WebCore::ScreenProperties::encode const):
3727         (WebCore::ScreenProperties::decode):
3728         (WebCore::ScreenData::encode const):
3729         (WebCore::ScreenData::decode):
3730         * platform/graphics/GraphicsContext3D.h:
3731         * platform/graphics/ImageBuffer.cpp:
3732         (WebCore::ImageBuffer::create):
3733         * platform/graphics/ImageBuffer.h:
3734         * platform/graphics/cg/ImageBufferCG.cpp:
3735         (WebCore::ImageBuffer::createCompatibleBuffer):
3736         (WebCore::ImageBuffer::ImageBuffer):
3737         * platform/graphics/cocoa/GraphicsContext3DCocoa.mm:
3738         (WebCore::GraphicsContext3D::GraphicsContext3D):
3739         (WebCore::GraphicsContext3D::allowOfflineRenderers const):
3740         (WebCore::GraphicsContext3D::setOpenGLDisplayMask): Deleted.
3741         (WebCore::GraphicsContext3D::getOpenGLDisplayMask): Deleted.
3742         * platform/graphics/cocoa/IOSurface.h:
3743         * platform/graphics/cocoa/IOSurface.mm:
3744         (WebCore::IOSurface::ensurePlatformContext):
3745         * platform/mac/PlatformScreenMac.mm:
3746         (WebCore::screenProperties):
3747         (WebCore::collectScreenProperties):
3748         (WebCore::setScreenProperties):
3749         (WebCore::screenData):
3750         (WebCore::primaryOpenGLDisplayMask):
3751         (WebCore::displayMaskForDisplay):
3752         (WebCore::getScreenProperties):
3753         (WebCore::screenIsMonochrome):
3754         (WebCore::screenHasInvertedColors):
3755         (WebCore::screenDepth):
3756         (WebCore::screenDepthPerComponent):
3757         (WebCore::screenRectForDisplay):
3758         (WebCore::screenRect):
3759         (WebCore::screenAvailableRect):
3760         (WebCore::screenColorSpace):
3761         (WebCore::screenSupportsExtendedColor):
3762
3763 2018-06-05  Jer Noble  <jer.noble@apple.com>
3764
3765         REGRESSION (231817): Videos permanently blank out after switching out of a tab and back in
3766         https://bugs.webkit.org/show_bug.cgi?id=186326
3767         <rdar://problem/40778157>
3768
3769         Reviewed by Eric Carlson.
3770
3771         Check whether the element is visible in the viewport when the web view itself becomes visible, and if so, clear the m_elementIsHiddenUntilVisibleInViewport flag.
3772
3773         * html/MediaElementSession.cpp:
3774         (WebCore::MediaElementSession::visibilityChanged):
3775         * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
3776
3777 2018-06-05  Zalan Bujtas  <zalan@apple.com>
3778
3779         [LFC] Move inflow, replaced width and margin computation to a dedicated function.
3780         https://bugs.webkit.org/show_bug.cgi?id=186327
3781
3782         Reviewed by Sam Weinig.
3783
3784         I was searching for the function inFlowReplacedWidthAndMargin() and there was none.
3785
3786         * layout/blockformatting/BlockFormattingContext.h:
3787         * layout/blockformatting/BlockFormattingContextGeometry.cpp:
3788         (WebCore::Layout::BlockFormattingContext::Geometry::inFlowReplacedWidthAndMargin):
3789         (WebCore::Layout::BlockFormattingContext::Geometry::inFlowWidthAndMargin):
3790
3791 2018-06-05  Zalan Bujtas  <zalan@apple.com>
3792
3793         [LFC] Add missing margins for inflow, non replaced block and replaced inline elements
3794         https://bugs.webkit.org/show_bug.cgi?id=186332
3795
3796         Reviewed by Darin Adler.
3797
3798         * layout/FormattingContextGeometry.cpp:
3799         (WebCore::Layout::FormattingContext::Geometry::inlineReplacedWidthAndMargin):
3800         * layout/blockformatting/BlockFormattingContextGeometry.cpp:
3801         (WebCore::Layout::BlockFormattingContext::Geometry::inFlowNonReplacedWidthAndMargin):
3802
3803 2018-06-05  Wenson Hsieh  <wenson_hsieh@apple.com>
3804
3805         [macOS] Spelling errors in the middle of an inserted paragraph are not displayed
3806         https://bugs.webkit.org/show_bug.cgi?id=185584
3807         <rdar://problem/38676081>
3808
3809         Reviewed by Ryosuke Niwa.
3810
3811         Currently when typing, we only consider the range of adjacent words when determining where to place spelling
3812         correction markers, even though we provide NSSpellChecker with the full context of the sentence (and get back
3813         results encompassing the full range). In macOS Mojave, NSSpellChecker may now return spell checking results that
3814         include correctly spelled words that are misused in the context of the sentence. This means that while typing a
3815         sentence, a different part of the sentence may gain or lose spelling markers as a result.
3816
3817         To support this, WebKit needs to mark or unmark spelling corrections in the full range of the sentence whenever
3818         a full word is typed (since the context of other words within the sentence may have changed, resulting in
3819         different platform spellchecking results). In markMisspellingsAfterTypingToWord, we expand the spell checking
3820         range past the adjacent words so that it encompasses the largest subrange of the full sentence that includes the
3821         start of the typed word, and does not include any position that is under an element with `spellcheck=false`.
3822
3823         This guarantees that we don't erroneously place spelling document markers under elements where spellchecking is
3824         disabled, while allowing for sentence retro corrections when spellchecking is enabled. However, this doesn't
3825         handle the case where an element with spellchecking disabled lies between a sentence retro correction range and
3826         the currently typed word. In the future, we could fix this by refactoring SpellCheckRequest to track a list of
3827         non-contiguous spelling correction ranges — see the FIXME in markMisspellingsAfterTypingToWord for more detail.
3828
3829         Covered by 2 new layout tests, as well as an existing spell-checking test that should now be passing.
3830
3831         Tests: editing/spelling/retro-correction-spelling-markers.html
3832                editing/spelling/spelling-markers-after-pasting-sentence.html
3833
3834         * editing/Editor.cpp:
3835         (WebCore::Editor::markMisspellingsAfterTypingToWord):
3836         * testing/Internals.h:
3837         * testing/Internals.idl:
3838
3839         Add an internal testing helper to determine whether retro sentence corrections are enabled.
3840
3841 2018-06-05  Darin Adler  <darin@apple.com>
3842
3843         [Cocoa] Retire DispatchPtr, and add more move semantics and simpler #ifs to other smart pointers
3844         https://bugs.webkit.org/show_bug.cgi?id=186324
3845
3846         Reviewed by Anders Carlsson.
3847
3848         * platform/FileMonitor.h: Use OSObjectPtr instead of DispatchPtr.
3849         * platform/cocoa/FileMonitorCocoa.mm:
3850         (WebCore::FileMonitor::FileMonitor): Ditto.
3851
3852 2018-06-05  Ryan Haddad  <ryanhaddad@apple.com>
3853
3854         Unreviewed, fix the macOS build with recent SDKs.
3855
3856         * page/mac/ServicesOverlayController.mm:
3857         (WebCore::ServicesOverlayController::Highlight::paintContents):
3858
3859 2018-06-05  Brent Fulgham  <bfulgham@apple.com>
3860
3861         Adjust compile and runtime flags to match shippable state of features
3862         https://bugs.webkit.org/show_bug.cgi?id=186319
3863         <rdar://problem/40352045>
3864
3865         Reviewed by Maciej Stachowiak, Jon Lee, and others.
3866
3867         * Configurations/FeatureDefines.xcconfig: Don't build ENABLE_INPUT_TYPE_COLOR
3868         or ENABLE_INPUT_TYPE_COLOR_POPOVER.
3869
3870 2018-06-05  Timothy Hatcher  <timothy@apple.com>
3871
3872         Clean up LocalDefaultSystemAppearance and prefers-dark-interface media query
3873
3874         https://bugs.webkit.org/show_bug.cgi?id=186323
3875         rdar://problem/38382252
3876
3877         Reviewed by Tim Horton.
3878
3879         * css/MediaFeatureNames.h:
3880         * css/MediaQueryEvaluator.cpp:
3881         (WebCore::prefersDarkInterfaceEvaluate):
3882         (WebCore::defaultAppearanceEvaluate): Deleted.
3883         * css/MediaQueryExpression.cpp:
3884         (WebCore::featureWithValidIdent):
3885         (WebCore::isFeatureValidWithoutValue):
3886         * platform/mac/LocalDefaultSystemAppearance.mm:
3887         (WebCore::LocalDefaultSystemAppearance::LocalDefaultSystemAppearance):
3888
3889 2018-06-05  Darin Adler  <darin@apple.com>
3890
3891         [Cocoa] Improve some soft linking compatibility with ARC
3892         https://bugs.webkit.org/show_bug.cgi?id=186309
3893
3894         Reviewed by Anders Carlsson.
3895
3896         * platform/audio/ios/AudioSessionIOS.mm: Use SOFT_LINK_CONSTANT instead of SOFT_LINK_POINTER
3897         for NSString constants.
3898         * platform/audio/ios/MediaSessionManagerIOS.mm: Ditto.
3899         * platform/graphics/avfoundation/AudioSourceProviderAVFObjC.mm: Ditto.
3900         * platform/graphics/avfoundation/objc/InbandTextTrackPrivateAVFObjC.mm: Ditto.
3901         * platform/graphics/avfoundation/objc/InbandTextTrackPrivateLegacyAVFObjC.mm: Ditto.
3902         * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm: Ditto.
3903         (WebCore::MediaPlayerPrivateAVFoundationObjC::synchronizeTextTrackState): Use __bridge for
3904         some bridging casts.
3905         (WebCore::MediaPlayerPrivateAVFoundationObjC::createAVAssetForURL): Ditto.
3906         (WebCore::MediaPlayerPrivateAVFoundationObjC::updateLastImage): Ditto.
3907         (WebCore::MediaPlayerPrivateAVFoundationObjC::processCue): Ditto.
3908         * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.mm: Use
3909         SOFT_LINK_CONSTANT instead of SOFT_LINK_POINTER for NSString constants.
3910         * platform/mediastream/ios/CoreAudioCaptureSourceIOS.mm: Ditto.
3911         * platform/mediastream/mac/AVCaptureDeviceManager.mm: Ditto.
3912         * platform/mediastream/mac/AVMediaCaptureSource.mm: Ditto.
3913         * platform/mediastream/mac/AVVideoCaptureSource.mm: Ditto.
3914
3915 2018-06-05  Youenn Fablet  <youenn@apple.com>
3916
3917         ServiceWorker registration should store any script fetched through importScripts
3918         https://bugs.webkit.org/show_bug.cgi?id=182444
3919         <rdar://problem/37164835>
3920
3921         Reviewed by Chris Dumez.
3922
3923         Covered by added test http/wpt/service-workers/persistent-importScripts.html.
3924
3925         Update importScripts implementation to look for/update the resource map in case of service worker scope.
3926         This resource map is stored persistently and sent when running the service worker.
3927
3928         Add support to persistent storage of this resource map.
3929         This requires updating the schema database.
3930         The schema version is bumped to 2 and we delete any data related to old registrations.
3931
3932         When updating the service worker, the resource map is currently flushed so that all scripts will be retrieved from the network.
3933
3934         Did some limited refactoring to put more loading handling in WorkerScriptLoader.
3935
3936         * workers/WorkerGlobalScope.cpp:
3937         (WebCore::WorkerGlobalScope::importScripts):
3938         * workers/WorkerScriptLoader.cpp:
3939         (WebCore::WorkerScriptLoader::loadSynchronously):
3940         (WebCore::WorkerScriptLoader::script):
3941         * workers/WorkerScriptLoader.h:
3942         * workers/service/ServiceWorkerContextData.cpp:
3943         (WebCore::ServiceWorkerContextData::isolatedCopy const):
3944         * workers/service/ServiceWorkerContextData.h:
3945         (WebCore::ServiceWorkerContextData::ImportedScript::isolatedCopy const):
3946         (WebCore::ServiceWorkerContextData::ImportedScript::encode const):
3947         (WebCore::ServiceWorkerContextData::ImportedScript::decode):
3948         (WebCore::ServiceWorkerContextData::encode const):
3949         (WebCore::ServiceWorkerContextData::decode):
3950         * workers/service/ServiceWorkerGlobalScope.cpp:
3951         (WebCore::ServiceWorkerGlobalScope::scriptResource const):
3952         (WebCore::ServiceWorkerGlobalScope::setScriptResource):
3953         * workers/service/ServiceWorkerGlobalScope.h:
3954         * workers/service/context/SWContextManager.h:
3955         * workers/service/server/RegistrationDatabase.cpp:
3956         (WebCore::v1RecordsTableSchema):
3957         (WebCore::RegistrationDatabase::doPushChanges):
3958         (WebCore::RegistrationDatabase::importRecords):
3959         * workers/service/server/SWServer.cpp:
3960         (WebCore::SWServer::addRegistrationFromStore):
3961         (WebCore::SWServer::updateWorker):
3962         (WebCore::SWServer::installContextData):
3963         * workers/service/server/SWServer.h:
3964         * workers/service/server/SWServerJobQueue.cpp:
3965         (WebCore::SWServerJobQueue::scriptFetchFinished):
3966         * workers/service/server/SWServerToContextConnection.cpp:
3967         (WebCore::SWServerToContextConnection::setScriptResource):
3968         * workers/service/server/SWServerToContextConnection.h: