c9dd6774b51aa601b16e13d71c4cdb5af2dd5f53
[WebKit-https.git] / Source / WebCore / ChangeLog
1 2018-04-24  Simon Fraser  <simon.fraser@apple.com>
2
3         Add a new "color-filter" CSS property as an experimental feature
4         https://bugs.webkit.org/show_bug.cgi?id=184940
5         rdar://problem/39664904
6
7         Reviewed by Jon Lee.
8         
9         Add a new CSS property called "color-filter" as an experimental feature (off by default).
10         
11         This property specifies a list of filter functions (as specified in https://drafts.fxtf.org/filter-effects/#supported-filter-functions)
12         to CSS colors, allowing authors to modify the provided page colors, for example to improve accessibility.
13         Filters that move pixels (i.e. blur() and drop-shadow()) are invalid in this property.
14         
15         Colors will be mapped through the filter functions just before paint time, and gradient stop colors will also be mapped.
16         
17         This patch adds support for parsing color-filter.
18
19         Test: css3/color-filters/color-filter-parsing.html
20
21         * css/CSSComputedStyleDeclaration.cpp:
22         (WebCore::ComputedStyleExtractor::valueForPropertyinStyle):
23         * css/CSSProperties.json:
24         * css/parser/CSSParser.cpp:
25         (WebCore::CSSParserContext::CSSParserContext):
26         (WebCore::operator==):
27         * css/parser/CSSParserMode.h:
28         * css/parser/CSSPropertyParser.cpp:
29         (WebCore::CSSPropertyParser::parseSingleValue):
30         * css/parser/CSSPropertyParserHelpers.cpp:
31         (WebCore::CSSPropertyParserHelpers::isColorFilterFunction):
32         (WebCore::CSSPropertyParserHelpers::consumeFilterFunction):
33         (WebCore::CSSPropertyParserHelpers::consumeFilter):
34         * css/parser/CSSPropertyParserHelpers.h:
35         * page/Settings.yaml:
36         * rendering/style/RenderStyle.cpp:
37         (WebCore::RenderStyle::changeRequiresRepaint const):
38         * rendering/style/RenderStyle.h:
39         (WebCore::RenderStyle::mutableColorFilter):
40         (WebCore::RenderStyle::colorFilter const):
41         (WebCore::RenderStyle::hasColorFilter const):
42         (WebCore::RenderStyle::setColorFilter):
43         (WebCore::RenderStyle::initialColorFilter):
44         * rendering/style/StyleRareInheritedData.cpp:
45         (WebCore::StyleRareInheritedData::StyleRareInheritedData):
46         (WebCore::StyleRareInheritedData::operator== const):
47         (WebCore::StyleRareInheritedData::hasColorFilters const):
48         * rendering/style/StyleRareInheritedData.h:
49
50 2018-04-24  Simon Fraser  <simon.fraser@apple.com>
51
52         shape-outside and filter styles occur twice in the result of getComputedStyle
53         https://bugs.webkit.org/show_bug.cgi?id=184931
54
55         Reviewed by Antti Koivisto.
56
57         CSSPropertyShapeOutside and CSSPropertyFilter were duplicated in the list of computedProperties[]
58         used by getComputedStyle. Remove the duplication.
59         
60         Tested by existing tests.
61
62         * css/CSSComputedStyleDeclaration.cpp:
63
64 2018-04-24  Basuke Suzuki  <Basuke.Suzuki@sony.com>
65
66         [Curl] Extract proxy settings into a separate class to hold advanced information.
67         https://bugs.webkit.org/show_bug.cgi?id=184714
68
69         It was simplely structure to hold proxy setting. To support advanced feature of proxy
70         such as authentication, more inteligent object is required to store intermediate state
71         or errors. That's why we've introduced new class for that purpose.
72
73         Reviewed by Youenn Fablet.
74
75         No new tests because there's no new behavior.
76
77         * platform/Curl.cmake:
78         * platform/network/curl/CurlContext.cpp:
79         (WebCore::CurlHandle::enableProxyIfExists):
80         (WebCore::CurlContext::ProxyInfo::url const): Deleted.
81         (WebCore::CurlContext::setProxyInfo): Deleted.
82         * platform/network/curl/CurlContext.h:
83         (WebCore::CurlContext::proxySettings const):
84         (WebCore::CurlContext::setProxySettings):
85         (WebCore::CurlContext::setProxyUserPass):
86         (WebCore::CurlContext::proxyInfo const): Deleted.
87         (WebCore::CurlContext::setProxyInfo): Deleted.
88         * platform/network/curl/CurlProxySettings.cpp: Added.
89         (WebCore::CurlProxySettings::CurlProxySettings):
90         (WebCore::CurlProxySettings::rebuildUrl):
91         (WebCore::CurlProxySettings::setUserPass):
92         (WebCore::protocolIsInSocksFamily):
93         (WebCore::getProxyPort):
94         (WebCore::createProxyUrl):
95         * platform/network/curl/CurlProxySettings.h: Added.
96         (WebCore::CurlProxySettings::CurlProxySettings):
97         (WebCore::CurlProxySettings::isEmpty const):
98         (WebCore::CurlProxySettings::mode const):
99         (WebCore::CurlProxySettings::url const):
100         (WebCore::CurlProxySettings::ignoreHosts const):
101         (WebCore::CurlProxySettings::user const):
102         (WebCore::CurlProxySettings::password const):
103         * platform/network/curl/CurlRequest.cpp:
104         (WebCore::CurlRequest::didReceiveHeader):
105         * platform/network/curl/CurlResponse.h:
106         (WebCore::CurlResponse::isolatedCopy const):
107         * platform/network/curl/ResourceResponseCurl.cpp:
108         (WebCore::ResourceResponse::ResourceResponse):
109
110 2018-04-24  Youenn Fablet  <youenn@apple.com>
111
112         Throw in case of PeerConnection created for detached documents
113         https://bugs.webkit.org/show_bug.cgi?id=184921
114         <rdar://problem/39629216>
115
116         Reviewed by Eric Carlson.
117
118         Add a check to ensure that page is not null when creating a peer connection backend.
119         In that case, the peer connection constructor will later on throw.
120         The same for setConfiguration is done.
121         Behavior is consistent with Chrome.
122
123         Test: webrtc/pc-detached-document.html
124
125         * Modules/mediastream/libwebrtc/LibWebRTCPeerConnectionBackend.cpp:
126         (WebCore::createLibWebRTCPeerConnectionBackend):
127         (WebCore::LibWebRTCPeerConnectionBackend::LibWebRTCPeerConnectionBackend):
128         (WebCore::LibWebRTCPeerConnectionBackend::setConfiguration):
129         (WebCore::libWebRTCProvider): Deleted.
130         * Modules/mediastream/libwebrtc/LibWebRTCPeerConnectionBackend.h:
131
132 2018-04-24  John Wilander  <wilander@apple.com>
133
134         From-Origin: Support for 'same' and 'same-site' response header, nested frame origin check
135         https://bugs.webkit.org/show_bug.cgi?id=184560
136         <rdar://problem/38901344>
137
138         Reviewed by Youenn Fablet and Daniel Bates.
139
140         Tests: http/tests/from-origin/document-from-origin-same-accepted.html
141                http/tests/from-origin/document-from-origin-same-blocked.html
142                http/tests/from-origin/document-from-origin-same-site-accepted.html
143                http/tests/from-origin/document-from-origin-same-site-blocked.html
144                http/tests/from-origin/document-nested-from-origin-same-accepted.html
145                http/tests/from-origin/document-nested-from-origin-same-blocked.html
146                http/tests/from-origin/fetch-data-iframe-from-origin-same-blocked.html
147                http/tests/from-origin/fetch-from-origin-same-accepted.html
148                http/tests/from-origin/fetch-from-origin-same-blocked.html
149                http/tests/from-origin/fetch-from-origin-same-site-accepted.html
150                http/tests/from-origin/fetch-from-origin-same-site-blocked.html
151                http/tests/from-origin/fetch-iframe-from-origin-same-accepted.html
152                http/tests/from-origin/fetch-iframe-from-origin-same-blocked.html
153                http/tests/from-origin/image-about-blank-from-origin-same-blocked.html
154                http/tests/from-origin/image-from-origin-same-accepted.html
155                http/tests/from-origin/image-from-origin-same-blocked.html
156                http/tests/from-origin/image-from-origin-same-site-accepted.html
157                http/tests/from-origin/image-from-origin-same-site-blocked.html
158                http/tests/from-origin/redirect-document-from-origin-same-blocked.html
159                http/tests/from-origin/redirect-fetch-from-origin-same-blocked.html
160                http/tests/from-origin/redirect-image-from-origin-same-blocked.html
161                http/tests/from-origin/redirect-script-from-origin-same-blocked.html
162                http/tests/from-origin/redirect-xhr-from-origin-same-blocked.html
163                http/tests/from-origin/sandboxed-sub-frame-from-origin-same-blocked.html
164                http/tests/from-origin/sandboxed-sub-frame-nested-cross-origin-from-origin-same-blocked.html
165                http/tests/from-origin/sandboxed-sub-frame-nested-same-origin-from-origin-same-blocked.html
166                http/tests/from-origin/script-from-origin-same-accepted.html
167                http/tests/from-origin/script-from-origin-same-blocked.html
168                http/tests/from-origin/script-from-origin-same-site-accepted.html
169                http/tests/from-origin/script-from-origin-same-site-blocked.html
170                http/tests/from-origin/top-frame-document-from-origin-same-accepted.php
171                http/tests/from-origin/xhr-from-origin-same-accepted.html
172                http/tests/from-origin/xhr-from-origin-same-blocked.html
173                http/tests/from-origin/xhr-from-origin-same-site-accepted.html
174                http/tests/from-origin/xhr-from-origin-same-site-blocked.html
175
176         * loader/SubresourceLoader.cpp:
177         (WebCore::SubresourceLoader::didFail):
178             Outputs the error's localized description in a console message except when the destination
179             is FetchOptions::Destination::Serviceworker or FetchOptions::Destination::EmptyString.
180         * page/RuntimeEnabledFeatures.h:
181         (WebCore::RuntimeEnabledFeatures::setFromOriginResponseHeaderEnabled):
182         (WebCore::RuntimeEnabledFeatures::fromOriginResponseHeaderEnabled const):
183             Added From-Origin support as an experimental feature.
184         * platform/network/HTTPHeaderNames.in:
185             Added From-Origin.
186         * platform/network/HTTPParsers.cpp:
187         (WebCore::parseFromOriginHeader):
188             Parses the From-Origin header, currently supporting 'Same' and 'Same-Site.'
189         * platform/network/HTTPParsers.h:
190
191 2018-04-24  Antti Koivisto  <antti@apple.com>
192
193         Rename LayoutCtx.h/cpp to LayoutContext.h/cpp
194         https://bugs.webkit.org/show_bug.cgi?id=184922
195
196         Reviewed by Zalan Bujtas.
197
198         To achieve this the existing LayoutContext class is renamed to FrameViewLayoutContext.
199
200         * Sources.txt:
201         * WebCore.xcodeproj/project.pbxproj:
202         * layout/LayoutContext.cpp: Copied from Source/WebCore/layout/LayoutCtx.cpp.
203         * layout/LayoutContext.h: Copied from Source/WebCore/layout/LayoutCtx.h.
204         * layout/LayoutCtx.cpp: Removed.
205         * layout/LayoutCtx.h: Removed.
206         * page/FrameView.cpp:
207         (WebCore::FrameView::shouldDeferScrollUpdateAfterContentSizeChange):
208         (WebCore::FrameView::updateLayoutViewport):
209         (WebCore::FrameView::updateLayerPositionsAfterScrolling):
210         (WebCore::FrameView::updateCompositingLayersAfterScrolling):
211         (WebCore::FrameView::availableContentSizeChanged):
212         * page/FrameView.h:
213         * page/FrameViewLayoutContext.cpp: Copied from Source/WebCore/page/LayoutContext.cpp.
214         (WebCore::LayoutScope::LayoutScope):
215         (WebCore::FrameViewLayoutContext::FrameViewLayoutContext):
216         (WebCore::FrameViewLayoutContext::~FrameViewLayoutContext):
217         (WebCore::FrameViewLayoutContext::layout):
218         (WebCore::FrameViewLayoutContext::runOrScheduleAsynchronousTasks):
219         (WebCore::FrameViewLayoutContext::runAsynchronousTasks):
220         (WebCore::FrameViewLayoutContext::flushAsynchronousTasks):
221         (WebCore::FrameViewLayoutContext::reset):
222         (WebCore::FrameViewLayoutContext::needsLayout const):
223         (WebCore::FrameViewLayoutContext::setNeedsLayout):
224         (WebCore::FrameViewLayoutContext::enableSetNeedsLayout):
225         (WebCore::FrameViewLayoutContext::disableSetNeedsLayout):
226         (WebCore::FrameViewLayoutContext::scheduleLayout):
227         (WebCore::FrameViewLayoutContext::unscheduleLayout):
228         (WebCore::FrameViewLayoutContext::scheduleSubtreeLayout):
229         (WebCore::FrameViewLayoutContext::layoutTimerFired):
230         (WebCore::FrameViewLayoutContext::convertSubtreeLayoutToFullLayout):
231         (WebCore::FrameViewLayoutContext::setSubtreeLayoutRoot):
232         (WebCore::FrameViewLayoutContext::canPerformLayout const):
233         (WebCore::FrameViewLayoutContext::applyTextSizingIfNeeded):
234         (WebCore::FrameViewLayoutContext::updateStyleForLayout):
235         (WebCore::FrameViewLayoutContext::handleLayoutWithFrameFlatteningIfNeeded):
236         (WebCore::FrameViewLayoutContext::startLayoutAtMainFrameViewIfNeeded):
237         (WebCore::FrameViewLayoutContext::layoutDelta const):
238         (WebCore::FrameViewLayoutContext::addLayoutDelta):
239         (WebCore::FrameViewLayoutContext::layoutDeltaMatches):
240         (WebCore::FrameViewLayoutContext::layoutState const):
241         (WebCore::FrameViewLayoutContext::pushLayoutState):
242         (WebCore::FrameViewLayoutContext::pushLayoutStateForPaginationIfNeeded):
243         (WebCore::FrameViewLayoutContext::popLayoutState):
244         (WebCore::FrameViewLayoutContext::checkLayoutState):
245         (WebCore::FrameViewLayoutContext::frame const):
246         (WebCore::FrameViewLayoutContext::view const):
247         (WebCore::FrameViewLayoutContext::renderView const):
248         (WebCore::FrameViewLayoutContext::document const):
249         (WebCore::LayoutContext::LayoutContext): Deleted.
250         (WebCore::LayoutContext::~LayoutContext): Deleted.
251         (WebCore::LayoutContext::layout): Deleted.
252         (WebCore::LayoutContext::runOrScheduleAsynchronousTasks): Deleted.
253         (WebCore::LayoutContext::runAsynchronousTasks): Deleted.
254         (WebCore::LayoutContext::flushAsynchronousTasks): Deleted.
255         (WebCore::LayoutContext::reset): Deleted.
256         (WebCore::LayoutContext::needsLayout const): Deleted.
257         (WebCore::LayoutContext::setNeedsLayout): Deleted.
258         (WebCore::LayoutContext::enableSetNeedsLayout): Deleted.
259         (WebCore::LayoutContext::disableSetNeedsLayout): Deleted.
260         (WebCore::LayoutContext::scheduleLayout): Deleted.
261         (WebCore::LayoutContext::unscheduleLayout): Deleted.
262         (WebCore::LayoutContext::scheduleSubtreeLayout): Deleted.
263         (WebCore::LayoutContext::layoutTimerFired): Deleted.
264         (WebCore::LayoutContext::convertSubtreeLayoutToFullLayout): Deleted.
265         (WebCore::LayoutContext::setSubtreeLayoutRoot): Deleted.
266         (WebCore::LayoutContext::canPerformLayout const): Deleted.
267         (WebCore::LayoutContext::applyTextSizingIfNeeded): Deleted.
268         (WebCore::LayoutContext::updateStyleForLayout): Deleted.
269         (WebCore::LayoutContext::handleLayoutWithFrameFlatteningIfNeeded): Deleted.
270         (WebCore::LayoutContext::startLayoutAtMainFrameViewIfNeeded): Deleted.
271         (WebCore::LayoutContext::layoutDelta const): Deleted.
272         (WebCore::LayoutContext::addLayoutDelta): Deleted.
273         (WebCore::LayoutContext::layoutDeltaMatches): Deleted.
274         (WebCore::LayoutContext::layoutState const): Deleted.
275         (WebCore::LayoutContext::pushLayoutState): Deleted.
276         (WebCore::LayoutContext::pushLayoutStateForPaginationIfNeeded): Deleted.
277         (WebCore::LayoutContext::popLayoutState): Deleted.
278         (WebCore::LayoutContext::checkLayoutState): Deleted.
279         (WebCore::LayoutContext::frame const): Deleted.
280         (WebCore::LayoutContext::view const): Deleted.
281         (WebCore::LayoutContext::renderView const): Deleted.
282         (WebCore::LayoutContext::document const): Deleted.
283         * page/FrameViewLayoutContext.h: Copied from Source/WebCore/page/LayoutContext.h.
284         (WebCore::LayoutContext::startDisallowingLayout): Deleted.
285         (WebCore::LayoutContext::endDisallowingLayout): Deleted.
286         (WebCore::LayoutContext::layoutPhase const): Deleted.
287         (WebCore::LayoutContext::isLayoutNested const): Deleted.
288         (WebCore::LayoutContext::isLayoutPending const): Deleted.
289         (WebCore::LayoutContext::isInLayout const): Deleted.
290         (WebCore::LayoutContext::isInRenderTreeLayout const): Deleted.
291         (WebCore::LayoutContext::inPaintableState const): Deleted.
292         (WebCore::LayoutContext::layoutCount const): Deleted.
293         (WebCore::LayoutContext::subtreeLayoutRoot const): Deleted.
294         (WebCore::LayoutContext::clearSubtreeLayoutRoot): Deleted.
295         (WebCore::LayoutContext::resetFirstLayoutFlag): Deleted.
296         (WebCore::LayoutContext::didFirstLayout const): Deleted.
297         (WebCore::LayoutContext::setNeedsFullRepaint): Deleted.
298         (WebCore::LayoutContext::needsFullRepaint const): Deleted.
299         (WebCore::LayoutContext::isPaintOffsetCacheEnabled const): Deleted.
300         (WebCore::LayoutContext::layoutDisallowed const): Deleted.
301         (WebCore::LayoutContext::isLayoutSchedulingEnabled const): Deleted.
302         (WebCore::LayoutContext::inAsynchronousTasks const): Deleted.
303         (WebCore::LayoutContext::disablePaintOffsetCache): Deleted.
304         (WebCore::LayoutContext::enablePaintOffsetCache): Deleted.
305         * page/LayoutContext.cpp: Removed.
306         * page/LayoutContext.h: Removed.
307         * rendering/LayoutState.cpp:
308         (WebCore::LayoutState::LayoutState):
309         (WebCore::LayoutState::computePaginationInformation):
310         (WebCore::LayoutState::establishLineGrid):
311         (WebCore::LayoutStateDisabler::LayoutStateDisabler):
312         * rendering/LayoutState.h:
313
314 2018-04-24  Mark Lam  <mark.lam@apple.com>
315
316         Need to acquire the VM lock before calling toNumber on a JSValue.
317         https://bugs.webkit.org/show_bug.cgi?id=184924
318         <rdar://problem/39690679>
319
320         Reviewed by Saam Barati.
321
322         * bridge/objc/objc_utility.mm:
323         (JSC::Bindings::convertValueToObjcValue):
324
325 2018-04-24  Tadeu Zagallo  <tzagallo@apple.com>
326
327         REGRESSION(r221839): Fix requests with FormData containing empty files
328         https://bugs.webkit.org/show_bug.cgi?id=184490
329         <rdar://problem/39385169>
330
331         Reviewed by Geoffrey Garen.
332
333         We should not append the blob to the FormData when it is a file but has no path. It broke
334         the submission since the request was failing to read the file in FormDataStreamCFNet.h:156
335
336         Test: http/tests/local/formdata/send-form-data-with-empty-file.html
337
338         * platform/network/FormData.cpp:
339         (WebCore::FormData::appendMultiPartFileValue):
340
341 2018-04-24  Zalan Bujtas  <zalan@apple.com>
342
343         Fix project file after r230931.
344
345         * WebCore.xcodeproj/project.pbxproj:
346
347 2018-04-24  Jer Noble  <jer.noble@apple.com>
348
349         Don't add system framework paths to FRAMEWORK_SEARCH_PATHS
350         https://bugs.webkit.org/show_bug.cgi?id=184786
351
352         Reviewed by Tim Horton.
353
354         * Configurations/WebCore.xcconfig:
355         * DerivedSources.make:
356         * WebCore.xcodeproj/project.pbxproj:
357
358 2018-04-24  Zan Dobersek  <zdobersek@igalia.com>
359
360         [CoordGraphics] Remove dead fixed layer code
361         https://bugs.webkit.org/show_bug.cgi?id=184912
362
363         Reviewed by Michael Catanzaro.
364
365         Remove CoordinatedGraphicsLayer::setFixedToViewport() and the
366         corresponding attribute on the CoordinatedGraphicsLayerState struct.
367         The method is not called anywhere since r230952.
368
369         CoordinatedGraphicsState struct also loses the scrollPosition attribute
370         that also isn't used anymore.
371
372         Changes to GraphicsLayerTextureMapper class mirror those made to
373         CoordinatedGraphicsLayer, removing support for the fixed-to-viewport
374         attribute. This too was not called from anywhere.
375
376         All that enables us removing fixed-to-viewport handling in the
377         TextureMapperLayer class. Along with related changes in the
378         CoordinatedGraphicsScene class, we're able to remove a bunch of methods
379         and member variables that are not used or needed anymore.
380
381         * platform/graphics/texmap/GraphicsLayerTextureMapper.cpp:
382         (WebCore::GraphicsLayerTextureMapper::GraphicsLayerTextureMapper):
383         (WebCore::GraphicsLayerTextureMapper::commitLayerChanges):
384         (WebCore::GraphicsLayerTextureMapper::setFixedToViewport): Deleted.
385         * platform/graphics/texmap/GraphicsLayerTextureMapper.h:
386         * platform/graphics/texmap/TextureMapperLayer.cpp:
387         (WebCore::TextureMapperLayer::computeTransformsRecursive):
388         (WebCore::TextureMapperLayer::setFixedToViewport): Deleted.
389         (WebCore::TextureMapperLayer::isAncestorFixedToViewport const): Deleted.
390         (WebCore::TextureMapperLayer::setScrollPositionDeltaIfNeeded): Deleted.
391         * platform/graphics/texmap/TextureMapperLayer.h:
392         * platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.cpp:
393         (WebCore::CoordinatedGraphicsLayer::CoordinatedGraphicsLayer):
394         (WebCore::CoordinatedGraphicsLayer::syncLayerState):
395         (WebCore::CoordinatedGraphicsLayer::setFixedToViewport): Deleted.
396         * platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.h:
397         * platform/graphics/texmap/coordinated/CoordinatedGraphicsState.h:
398         (WebCore::CoordinatedGraphicsLayerState::CoordinatedGraphicsLayerState):
399
400 2018-04-24  Zan Dobersek  <zdobersek@igalia.com>
401
402         [CoordGraphics] Remove unused fixed layout functionality
403         https://bugs.webkit.org/show_bug.cgi?id=184908
404
405         Reviewed by Carlos Garcia Campos.
406
407         Ports using the CoordinatedGraphics subsystem don't expose fixed layout
408         support. As such, we're able to remove a lot of unused code and
409         unnecessary USE(COORDINATED_GRAPHICS) special cases in generic sections
410         in both WebCore and WebKit.
411
412         With fixed layout not available for use to users of the GTK+ and WPE
413         ports, we can remove the ScrollingCoordinatorCoordinatedGraphics
414         implementation, making room for an implementation that inherits from
415         AsyncScrollingCoordinator in the future. For that purpose the
416         ScrollingCoordinator::create() function is moved into the
417         ScrollingCoordinatorCoordinatedGraphics.cpp file already.
418
419         This also enables removing delegatedScrollRequested() method from
420         HostWindow and the inheriting ChromeClient interface.
421
422         * loader/EmptyClients.h:
423         * page/Chrome.cpp:
424         (WebCore::Chrome::delegatedScrollRequested): Deleted.
425         * page/Chrome.h:
426         * page/ChromeClient.h:
427         * page/scrolling/ScrollingCoordinator.cpp:
428         (WebCore::ScrollingCoordinator::create):
429         * page/scrolling/coordinatedgraphics/ScrollingCoordinatorCoordinatedGraphics.cpp:
430         (WebCore::ScrollingCoordinator::create):
431         (WebCore::ScrollingCoordinatorCoordinatedGraphics::ScrollingCoordinatorCoordinatedGraphics): Deleted.
432         (WebCore::ScrollingCoordinatorCoordinatedGraphics::attachToStateTree): Deleted.
433         (WebCore::ScrollingCoordinatorCoordinatedGraphics::detachFromStateTree): Deleted.
434         (WebCore::ScrollingCoordinatorCoordinatedGraphics::clearStateTree): Deleted.
435         (WebCore::ScrollingCoordinatorCoordinatedGraphics::updateNodeLayer): Deleted.
436         (WebCore::ScrollingCoordinatorCoordinatedGraphics::updateNodeViewportConstraints): Deleted.
437         (WebCore::ScrollingCoordinatorCoordinatedGraphics::requestScrollPositionUpdate): Deleted.
438         * page/scrolling/coordinatedgraphics/ScrollingCoordinatorCoordinatedGraphics.h: Removed.
439         * platform/HostWindow.h:
440
441 2018-04-24  Daniel Bates  <dabates@apple.com>
442
443         Attempt to fix the Apple Internal build following r230922
444         (https://bugs.webkit.org/show_bug.cgi?id=184737)
445
446         Cast the return value of std::map::size() to a size_t before logging it with format specifier
447         "%zu". std::map::size() returns a size_type. According to <http://en.cppreference.com/w/cpp/container/map>
448         size_type is "usually a size_t", but it may not be. An Apple Internal debug builder reports
449         that size_type = unsigned int != unsigned long = size_t.
450
451         * Modules/mediasource/SourceBuffer.cpp:
452         (WebCore::SourceBuffer::provideMediaData):
453
454 2018-04-24  Zan Dobersek  <zdobersek@igalia.com>
455
456         [CoordGraphics] Avoid painting backing stores for zero-opacity layers
457         https://bugs.webkit.org/show_bug.cgi?id=184143
458
459         Reviewed by Carlos Garcia Campos.
460
461         Skip generating backing stores for layers that have zero opacity and do
462         not animate the opacity value. In the current CoordinatedGraphics system
463         this can end up saving loads of memory on Web content that deploys a
464         large number of such elements.
465
466         * platform/graphics/texmap/TextureMapperLayer.h:
467         * platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.cpp:
468         (WebCore::CoordinatedGraphicsLayer::shouldHaveBackingStore const):
469
470 2018-04-24  Daniel Bates  <dabates@apple.com>
471
472         Attempt to fix the Apple Internal build following r230944
473         (https://bugs.webkit.org/show_bug.cgi?id=159464)
474
475         * platform/network/mac/CookieJarMac.mm:
476
477 2018-04-24  Daniel Bates  <dabates@apple.com>
478
479         Another attempt to fix the Mac and iOS build following r230944
480         (https://bugs.webkit.org/show_bug.cgi?id=159464)
481
482         * platform/network/mac/CookieJarMac.mm:
483         (WebCore::policyProperties):
484
485 2018-04-24  Daniel Bates  <dabates@apple.com>
486
487         Attempt to fix the Mac and iOS build following r230944
488         (https://bugs.webkit.org/show_bug.cgi?id=159464)
489
490         * platform/network/mac/CookieJarMac.mm:
491         (WebCore::policyProperties):
492
493 2018-04-23  Daniel Bates  <dabates@apple.com>
494
495         Implement Same-Site cookies
496         https://bugs.webkit.org/show_bug.cgi?id=159464
497         <rdar://problem/27196358>
498
499         Reviewed by Brent Fulgham.
500
501         Implements support for Same-Site cookies as per <https://tools.ietf.org/html/draft-ietf-httpbis-cookie-same-site-00>.
502         The implementation is materially consistent with the spec. though implements the computation
503         for a document's "site for cookies" indirectly as part of loading its frame. This is done to
504         avoid traversing the frame tree on each subresource request initiated by the document or one
505         of its workers. We take advantage of the fact that Web Workers and Service Workers use their
506         host document's loader to load resources on their behalf to use the correct "site for cookies"
507         for requests (e.g. fetch()) initiating by them without the need to duplicate and store the
508         host document's "site for cookies" in the worker's script execution context.
509
510         The implementation differs from the spec. in the handling of about: URLs and the empty URL
511         and makes the implementation in WebKit match the behavior of Chrome and Firefox as well as
512         consistent with origin inheritance as described in <https://html.spec.whatwg.org/multipage/browsers.html#origin>
513         (16 April 2018). Specifically, requests to about:blank, about:srcdoc and the empty URL ("")
514         are treated as same-site because these URLs inherit their origin from their owner.
515
516         Tests: http/tests/cookies/same-site/fetch-after-navigating-iframe-in-cross-origin-page.html
517                http/tests/cookies/same-site/fetch-after-top-level-navigation-from-cross-origin-page.html
518                http/tests/cookies/same-site/fetch-after-top-level-navigation-initiated-from-iframe-in-cross-origin-page.html
519                http/tests/cookies/same-site/fetch-cookies-set-in-about-blank-iframe.html
520                http/tests/cookies/same-site/fetch-in-about-blank-page.html
521                http/tests/cookies/same-site/fetch-in-cross-origin-iframe.html
522                http/tests/cookies/same-site/fetch-in-cross-origin-page.html
523                http/tests/cookies/same-site/fetch-in-cross-origin-service-worker.html
524                http/tests/cookies/same-site/fetch-in-cross-origin-worker.html
525                http/tests/cookies/same-site/fetch-in-same-origin-page.html
526                http/tests/cookies/same-site/fetch-in-same-origin-service-worker.html
527                http/tests/cookies/same-site/fetch-in-same-origin-srcdoc-iframe.html
528                http/tests/cookies/same-site/fetch-in-same-origin-worker.html
529                http/tests/cookies/same-site/popup-cross-site-post.html
530                http/tests/cookies/same-site/popup-cross-site.html
531                http/tests/cookies/same-site/popup-same-site-post.html
532                http/tests/cookies/same-site/popup-same-site-via-cross-site-redirect.html
533                http/tests/cookies/same-site/popup-same-site-via-same-site-redirect.html
534                http/tests/cookies/same-site/popup-same-site.html
535
536         * Sources.txt: Add source file SameSiteInfo.cpp.
537         * WebCore.xcodeproj/project.pbxproj: Add source files SameSiteInfo.{cpp, h}.
538         * dom/Document.cpp:
539         (WebCore::Document::initSecurityContext): Modified to call SecurityPolicy::shouldInheritSecurityOriginFromOwner().
540         (WebCore::Document::shouldInheritContentSecurityPolicyFromOwner const): Ditto.
541         (WebCore::shouldInheritSecurityOriginFromOwner): Deleted; moved to SecurityPolicy.
542         * dom/Document.h:
543         (WebCore::Document::firstPartyForSameSiteCookies const): Added.
544         (WebCore::Document::setFirstPartyForSameSiteCookies): Added.
545         * loader/CookieJar.cpp:
546         (WebCore::sameSiteInfo): Returns the same-site info for the request used to load the specified document.
547         (WebCore::cookies): Pass the same-site info down to the platform.
548         (WebCore::cookieRequestHeaderFieldProxy): Ditto.
549         (WebCore::setCookies): Ditto.
550         (WebCore::cookieRequestHeaderFieldValue): Ditto.
551         (WebCore::getRawCookies): Ditto.
552         * loader/DocumentLoader.cpp:
553         (WebCore::DocumentLoader::willSendRequest): Add same-site info to the request.
554         (WebCore::DocumentLoader::startLoadingMainResource): Update a FIXME comment to explain that
555         we can simplify ResourceRequestBase if we can remove the call to addExtraFieldsToMainResourceRequest()
556         here. Specifically, we would not need to differentiate between a request with an unspecified
557         same-site state (default state of a new request) from a request whose same-site state has
558         been explicitly set if we can assume that the same-site state of a request is set exactly
559         once. In absence of this guarantee we need an "unspecified" state to avoid overriding existing
560         same-site information computed with a null initiating document (the case of a new address bar
561         initiated load) from a load initiated by the document associated with this loader.
562         * loader/FrameLoader.cpp:
563         (WebCore::FrameLoader::setFirstPartyForCookies): Modified to also update the first party for
564         same-site cookies ("site for cookies").
565         (WebCore::FrameLoader::load): Add same-site info to the request.
566         (WebCore::FrameLoader::reload): Ditto.
567         (WebCore::FrameLoader::setOriginalURLForDownloadRequest): Ditto.
568         (WebCore::FrameLoader::addExtraFieldsToRequest): If the request does not already have
569         same-site info then compute it and add it to the request. Mark main frame main resource
570         requests as a "top-site".
571         (WebCore::FrameLoader::addSameSiteInfoToRequestIfNeeded): Implements the "'Same-site' and 'cross-site'
572         Requests" algorithm from <https://tools.ietf.org/html/draft-ietf-httpbis-cookie-same-site-00#section-2.1>.
573         (WebCore::createWindow): Add same-site info to the request.
574         * loader/FrameLoader.h:
575         * loader/ResourceLoader.cpp:
576         (WebCore::ResourceLoader::init): Ditto.
577         * page/DOMWindow.cpp:
578         (WebCore::DOMWindow::createWindow): Ditto.
579         * page/SecurityPolicy.cpp:
580         (WebCore::SecurityPolicy::shouldInheritSecurityOriginFromOwner): Moved from Document.cpp.
581         * page/SecurityPolicy.h:
582         * platform/CookiesStrategy.h:
583         * platform/network/CacheValidation.cpp:
584         (WebCore::headerValueForVary): Pass the same-site info down to the platform.
585         * platform/network/CookieRequestHeaderFieldProxy.h:
586         (WebCore::CookieRequestHeaderFieldProxy::encode const): Encode same-site bits.
587         (WebCore::CookieRequestHeaderFieldProxy::decode): Decode same-site bits.
588         * platform/network/PlatformCookieJar.h:
589         * platform/network/ResourceRequestBase.cpp:
590         (WebCore::ResourceRequestBase::setAsIsolatedCopy): Added.
591         (WebCore::ResourceRequestBase::isSameSite const): Added.
592         (WebCore::ResourceRequestBase::setIsSameSite): Added.
593         (WebCore::ResourceRequestBase::isTopSite const): Added.
594         (WebCore::ResourceRequestBase::setIsTopSite): Added.
595         (WebCore::equalIgnoringHeaderFields):
596         * platform/network/ResourceRequestBase.h:
597         (WebCore::ResourceRequestBase::isSameSiteUnspecified const): Added. See comment for DocumentLoader::startLoadingMainResource()
598         for more details.
599         (WebCore::registrableDomainsAreEqual): Added.
600         (WebCore::ResourceRequestBase::encodeBase const): Encode same-site bits.
601         (WebCore::ResourceRequestBase::decodeBase): Decode same-site bits.
602         * platform/network/SameSiteInfo.cpp: Added.
603         (WebCore::SameSiteInfo::create):
604         * platform/network/SameSiteInfo.h: Added.
605         (WebCore::SameSiteInfo::encode const):
606         (WebCore::SameSiteInfo::decode):
607         * platform/network/cf/CookieJarCFNet.cpp:
608         (WebCore::setCookiesFromDOM): Pass Same-Site info down.
609         (WebCore::cookiesForDOM): Ditto.
610         (WebCore::cookieRequestHeaderFieldValue): Ditto.
611         (WebCore::getRawCookies): Ditto.
612         * platform/network/cf/ResourceRequestCFNet.cpp:
613         (WebCore::siteForCookies): Added.
614         (WebCore::ResourceRequest::doUpdatePlatformRequest): Update platform request with same-site info.
615         (WebCore::ResourceRequest::doUpdateResourceRequest): Ditto.
616         * platform/network/cocoa/ResourceRequestCocoa.mm:
617         (WebCore::ResourceRequest::doUpdateResourceRequest): Ditto.
618         (WebCore::siteForCookies): Added.
619         (WebCore::ResourceRequest::doUpdatePlatformRequest): Update platform request with same-site info.
620         * platform/network/curl/CookieJarCurl.cpp:
621         (WebCore::cookiesForDOM): Pass Same-Site info down.
622         (WebCore::setCookiesFromDOM): Ditto.
623         (WebCore::cookieRequestHeaderFieldValue): Ditto.
624         (WebCore::getRawCookies): Ditto.
625         * platform/network/curl/CookieJarCurl.h:
626         * platform/network/curl/CookieJarCurlDatabase.cpp:
627         (WebCore::CookieJarCurlDatabase::setCookiesFromDOM const): Ditto.
628         (WebCore::CookieJarCurlDatabase::cookiesForDOM const): Ditto.
629         (WebCore::CookieJarCurlDatabase::cookieRequestHeaderFieldValue const): Ditto.
630         (WebCore::CookieJarCurlDatabase::getRawCookies const): Ditto.
631         * platform/network/curl/CookieJarCurlDatabase.h:
632         * platform/network/curl/ResourceHandleCurl.cpp:
633         (WebCore::ResourceHandle::createCurlRequest): Ditto.
634         * platform/network/mac/CookieJarMac.mm:
635         (WebCore::cookiesForURL): Added; shared function to return the cookies based on the specified criterion. 
636         (WebCore::setHTTPCookiesForURL): Moved from the bottom of the file to top to be closer to the other
637         CFNetwork helper functions. Modified to support fetching same-site cookies.
638         (WebCore::httpCookiesForURL): Moved to be under setHTTPCookiesForURL(). Modified to call cookiesForURL().
639         Note the SPI used in cookiesForURL() apply the same criterion for whether to fetch secure cookies as we
640         were computing here. That is, the CFNetwork SPI only returns secure cookies if the specified URL's scheme
641         case-insensitively matches "https".
642         (WebCore::cookiesInPartitionForURL): Wrote in terms of cookiesForURL().
643         (WebCore::cookiesForSession): Pass the Same-Site info.
644         (WebCore::cookiesForDOM): Ditto.
645         (WebCore::cookieRequestHeaderFieldValue): Ditto.
646         (WebCore::setCookiesFromDOM): Ditto.
647         (WebCore::getRawCookies): Ditto.
648         (WebCore::deleteCookie): Pass std::nullopt for the Same-Site info so that we do not consider the SameSite
649         attribute when fetching cookies to delete.
650         * platform/network/soup/CookieJarSoup.cpp:
651         (WebCore::setCookiesFromDOM): Pass the Same-Site info.
652         (WebCore::cookiesForDOM): Ditto.
653         (WebCore::cookieRequestHeaderFieldValue): Ditto.
654         (WebCore::getRawCookies): Ditto.
655         * workers/service/context/ServiceWorkerThreadProxy.cpp:
656         (WebCore::createPageForServiceWorker): Set the first party for same site cookies ("site for cookies") to
657         the script URL.
658         * xml/XSLTProcessor.cpp:
659         (WebCore::XSLTProcessor::createDocumentFromSource): Copy the first party for same-site cookies to the
660         new document.
661
662 2018-04-23  Youenn Fablet  <youenn@apple.com>
663
664         Make WebLoaderStrategy send to NetworkResourceLoader necessary parameters to handle full loads in NetworkProcess
665         https://bugs.webkit.org/show_bug.cgi?id=184763
666
667         Reviewed by Chris Dumez.
668
669         No change of behavior yet since we do not use these parameters in NetworkProcess yet.
670
671         Add PreflightPolicy and CSP response headers as ResourceLoaderOptions.
672         This allows passing them from DocumentThreadableLoader to WebLoaderStrategy.
673
674         Allow getting the original headers from a SubresourceLoader.
675         This allows passing them from DocumentThreadableLoader down to WebLoaderStrategy.
676
677         * Modules/fetch/FetchLoader.cpp:
678         (WebCore::FetchLoader::startLoadingBlobURL):
679         (WebCore::FetchLoader::start):
680         * loader/DocumentThreadableLoader.cpp:
681         (WebCore::DocumentThreadableLoader::DocumentThreadableLoader):
682         (WebCore::DocumentThreadableLoader::makeCrossOriginAccessRequest):
683         (WebCore::DocumentThreadableLoader::makeSimpleCrossOriginAccessRequest):
684         * loader/ResourceLoaderOptions.h:
685         * loader/SubresourceLoader.cpp:
686         (WebCore::SubresourceLoader::originalHeaders const):
687         * loader/SubresourceLoader.h:
688         * loader/ThreadableLoader.cpp:
689         (WebCore::ThreadableLoaderOptions::ThreadableLoaderOptions):
690         (WebCore::ThreadableLoaderOptions::isolatedCopy const):
691         * loader/ThreadableLoader.h:
692         * page/EventSource.cpp:
693         (WebCore::EventSource::connect):
694         * xml/XMLHttpRequest.cpp:
695         (WebCore::XMLHttpRequest::createRequest):
696
697 2018-04-23  Michael Catanzaro  <mcatanzaro@igalia.com>
698
699         [WPE][GTK] Remove WlUniquePtr<wl_display> footgun
700         https://bugs.webkit.org/show_bug.cgi?id=184405
701
702         Reviewed by Carlos Garcia Campos.
703
704         WlUniquePtr<wl_display> is a pretty big footgun because there are two different destruction
705         functions -- wl_display_disconnect() and wl_display_destroy() -- and which one you need to
706         use depends on how the wl_display() was created, and WebKit uses both in different places.
707         So WlUniquePtr<wl_display> is pretty unsafe. See bug #176490 for an example of fun caused
708         by using it incorrectly.
709
710         Let's use std::unique_ptr with custom deleter functors instead.
711
712         * platform/graphics/wayland/WlUniquePtr.h:
713
714 2018-04-23  Antti Koivisto  <antti@apple.com>
715
716         REGRESSION (r220112): reCAPTCHA images render off screen on Twitch.tv app Log In or Sign Up
717         https://bugs.webkit.org/show_bug.cgi?id=182859
718         <rdar://problem/37595065>
719
720         Reviewed by Zalan Bujtas.
721
722         Roll out this change from the trunk as the issue it fixed no longer occurs.
723
724         * css/MediaQueryEvaluator.cpp:
725         (WebCore::orientationEvaluate):
726         (WebCore::aspectRatioEvaluate):
727         (WebCore::heightEvaluate):
728         (WebCore::widthEvaluate):
729         * page/FrameView.cpp:
730         (WebCore::FrameView::layoutSizeForMediaQuery const): Deleted.
731         * page/FrameView.h:
732         * page/LayoutContext.cpp:
733         (WebCore::LayoutContext::handleLayoutWithFrameFlatteningIfNeeded):
734
735 2018-04-23  Daniel Bates  <dabates@apple.com>
736
737         Another attempt to fix the Windows build following r230921
738         (https://bugs.webkit.org/show_bug.cgi?id=159464)
739
740         Pass dictionary key name using a string instead of a constant and pass CFURL* to
741         siteForCookies().
742
743         * platform/network/cf/ResourceRequestCFNet.cpp:
744         (WebCore::ResourceRequest::doUpdatePlatformRequest):
745         (WebCore::ResourceRequest::doUpdateResourceRequest):
746
747 2018-04-23  Zalan Bujtas  <zalan@apple.com>
748
749         [LayoutFormattingContext] Initial commit.
750         https://bugs.webkit.org/show_bug.cgi?id=184896
751
752         Reviewed by Antti Koivisto.
753
754         This is the initial commit of the new layout component -class definitions only (and mostly public functions).
755         See the header files (and Tools/LayoutReloaded project) for more information.
756
757         // Top level layout.
758         rootContainer = TreeBuilder::createLayoutTree(document);
759         rootDisplayBox = new Display::Box();
760         rootDisplayBox->setSize(viewportSize);
761         layoutContext = new LayoutContext(rootContainer, rootDisplayBox);
762         layoutContext->layout(rootContainer);
763
764         Driven by build time flag (currently off). Not testable yet.
765
766         * Configurations/FeatureDefines.xcconfig:
767         * Sources.txt:
768         * WebCore.xcodeproj/project.pbxproj:
769         * layout/BlockFormatting/BlockFormattingContext.cpp: Added.
770         * layout/BlockFormatting/BlockFormattingContext.h: Added.
771         * layout/BlockFormatting/BlockFormattingState.cpp: Added.
772         * layout/BlockFormatting/BlockFormattingState.h: Added.
773         * layout/BlockFormatting/BlockMarginCollapse.cpp: Added.
774         * layout/BlockFormatting/BlockMarginCollapse.h: Added.
775         * layout/DisplayTree/DisplayBox.cpp: Added.
776         * layout/DisplayTree/DisplayBox.h: Added.
777         * layout/FloatingContext.cpp: Added.
778         * layout/FloatingContext.h: Added.
779         * layout/FloatingState.cpp: Added.
780         * layout/FloatingState.h: Added.
781         * layout/FormattingContext.cpp: Added.
782         * layout/FormattingContext.h: Added.
783         * layout/FormattingState.cpp: Added.
784         * layout/FormattingState.h: Added.
785         * layout/InlineFormatting/InlineFormattingContext.cpp: Added.
786         * layout/InlineFormatting/InlineFormattingContext.h: Added.
787         * layout/InlineFormatting/InlineFormattingState.cpp: Added.
788         * layout/InlineFormatting/InlineFormattingState.h: Added.
789         * layout/LayoutCtx.cpp: Added.
790         * layout/LayoutCtx.h: Added.
791         * layout/LayoutTree/LayoutBlockContainer.cpp: Added.
792         * layout/LayoutTree/LayoutBlockContainer.h: Added.
793         * layout/LayoutTree/LayoutBox.cpp: Added.
794         * layout/LayoutTree/LayoutBox.h: Added.
795         * layout/LayoutTree/LayoutContainer.cpp: Added.
796         * layout/LayoutTree/LayoutContainer.h: Added.
797         * layout/LayoutTree/LayoutCtx.h: Added.
798         * layout/LayoutTree/LayoutInlineBox.cpp: Added.
799         * layout/LayoutTree/LayoutInlineBox.h: Added.
800         * layout/LayoutTree/LayoutInlineContainer.cpp: Added.
801         * layout/LayoutTree/LayoutInlineContainer.h: Added.
802
803 2018-04-23  Daniel Bates  <dabates@apple.com>
804
805         Attempt to fix the Mac and iOS build after r230921
806         (https://bugs.webkit.org/show_bug.cgi?id=159464)
807
808         Pass strings for the dictionary key names instead of using an extern constant as the
809         latter may not be available on all systems.
810
811         * platform/network/mac/CookieJarMac.mm:
812         (WebCore::setHTTPCookiesForURL):
813
814 2018-04-23  Daniel Bates  <dabates@apple.com>
815
816         Attempt to fix the build after r230921
817         (https://bugs.webkit.org/show_bug.cgi?id=159464)
818
819         Pass Same-Site info through.
820
821         * platform/network/cf/CookieJarCFNet.cpp:
822         (WebCore::cookieRequestHeaderFieldValue):
823         * platform/network/curl/CookieJarCurl.cpp:
824         (WebCore::cookieRequestHeaderFieldValue):
825         * platform/network/curl/CookieJarCurlDatabase.cpp:
826         (WebCore::CookieJarCurlDatabase::cookieRequestHeaderFieldValue const):
827         * platform/network/soup/CookieJarSoup.cpp:
828         (WebCore::cookieRequestHeaderFieldValue):
829
830 2018-04-23  Ryan Haddad  <ryanhaddad@apple.com>
831
832         Unreviewed, speculative macOS build fix attempt.
833
834         * Modules/mediasource/SourceBuffer.cpp:
835         (WebCore::SourceBuffer::provideMediaData):
836
837 2018-04-23  Daniel Bates  <dabates@apple.com>
838
839         Implement Same-Site cookies
840         https://bugs.webkit.org/show_bug.cgi?id=159464
841         <rdar://problem/27196358>
842
843         Reviewed by Brent Fulgham.
844
845         Implements support for Same-Site cookies as per <https://tools.ietf.org/html/draft-ietf-httpbis-cookie-same-site-00>.
846         The implementation is materially consistent with the spec. though implements the computation
847         for a document's "site for cookies" indirectly as part of loading its frame. This is done to
848         avoid traversing the frame tree on each subresource request initiated by the document or one
849         of its workers. We take advantage of the fact that Web Workers and Service Workers use their
850         host document's loader to load resources on their behalf to use the correct "site for cookies"
851         for requests (e.g. fetch()) initiating by them without the need to duplicate and store the
852         host document's "site for cookies" in the worker's script execution context.
853
854         The implementation differs from the spec. in the handling of about: URLs and the empty URL
855         and makes the implementation in WebKit match the behavior of Chrome and Firefox as well as
856         consistent with origin inheritance as described in <https://html.spec.whatwg.org/multipage/browsers.html#origin>
857         (16 April 2018). Specifically, requests to about:blank, about:srcdoc and the empty URL ("")
858         are treated as same-site because these URLs inherit their origin from their owner.
859
860         Tests: http/tests/cookies/same-site/fetch-after-navigating-iframe-in-cross-origin-page.html
861                http/tests/cookies/same-site/fetch-after-top-level-navigation-from-cross-origin-page.html
862                http/tests/cookies/same-site/fetch-after-top-level-navigation-initiated-from-iframe-in-cross-origin-page.html
863                http/tests/cookies/same-site/fetch-cookies-set-in-about-blank-iframe.html
864                http/tests/cookies/same-site/fetch-in-about-blank-page.html
865                http/tests/cookies/same-site/fetch-in-cross-origin-iframe.html
866                http/tests/cookies/same-site/fetch-in-cross-origin-page.html
867                http/tests/cookies/same-site/fetch-in-cross-origin-service-worker.html
868                http/tests/cookies/same-site/fetch-in-cross-origin-worker.html
869                http/tests/cookies/same-site/fetch-in-same-origin-page.html
870                http/tests/cookies/same-site/fetch-in-same-origin-service-worker.html
871                http/tests/cookies/same-site/fetch-in-same-origin-srcdoc-iframe.html
872                http/tests/cookies/same-site/fetch-in-same-origin-worker.html
873                http/tests/cookies/same-site/popup-cross-site-post.html
874                http/tests/cookies/same-site/popup-cross-site.html
875                http/tests/cookies/same-site/popup-same-site-post.html
876                http/tests/cookies/same-site/popup-same-site-via-cross-site-redirect.html
877                http/tests/cookies/same-site/popup-same-site-via-same-site-redirect.html
878                http/tests/cookies/same-site/popup-same-site.html
879
880         * Sources.txt: Add source file SameSiteInfo.cpp.
881         * WebCore.xcodeproj/project.pbxproj: Add source files SameSiteInfo.{cpp, h}.
882         * dom/Document.cpp:
883         (WebCore::Document::initSecurityContext): Modified to call SecurityPolicy::shouldInheritSecurityOriginFromOwner().
884         (WebCore::Document::shouldInheritContentSecurityPolicyFromOwner const): Ditto.
885         (WebCore::shouldInheritSecurityOriginFromOwner): Deleted; moved to SecurityPolicy.
886         * dom/Document.h:
887         (WebCore::Document::firstPartyForSameSiteCookies const): Added.
888         (WebCore::Document::setFirstPartyForSameSiteCookies): Added.
889         * loader/CookieJar.cpp:
890         (WebCore::sameSiteInfo): Returns the same-site info for the request used to load the specified document.
891         (WebCore::cookies): Pass the same-site info down to the platform.
892         (WebCore::cookieRequestHeaderFieldProxy): Ditto.
893         (WebCore::setCookies): Ditto.
894         (WebCore::cookieRequestHeaderFieldValue): Ditto.
895         (WebCore::getRawCookies): Ditto.
896         * loader/DocumentLoader.cpp:
897         (WebCore::DocumentLoader::willSendRequest): Add same-site info to the request.
898         (WebCore::DocumentLoader::startLoadingMainResource): Update a FIXME comment to explain that
899         we can simplify ResourceRequestBase if we can remove the call to addExtraFieldsToMainResourceRequest()
900         here. Specifically, we would not need to differentiate between a request with an unspecified
901         same-site state (default state of a new request) from a request whose same-site state has
902         been explicitly set if we can assume that the same-site state of a request is set exactly
903         once. In absence of this guarantee we need an "unspecified" state to avoid overriding existing
904         same-site information computed with a null initiating document (the case of a new address bar
905         initiated load) from a load initiated by the document associated with this loader.
906         * loader/FrameLoader.cpp:
907         (WebCore::FrameLoader::setFirstPartyForCookies): Modified to also update the first party for
908         same-site cookies ("site for cookies").
909         (WebCore::FrameLoader::load): Add same-site info to the request.
910         (WebCore::FrameLoader::reload): Ditto.
911         (WebCore::FrameLoader::setOriginalURLForDownloadRequest): Ditto.
912         (WebCore::FrameLoader::addExtraFieldsToRequest): If the request does not already have
913         same-site info then compute it and add it to the request. Mark main frame main resource
914         requests as a "top-site".
915         (WebCore::FrameLoader::addSameSiteInfoToRequestIfNeeded): Implements the "'Same-site' and 'cross-site'
916         Requests" algorithm from <https://tools.ietf.org/html/draft-ietf-httpbis-cookie-same-site-00#section-2.1>.
917         (WebCore::createWindow): Add same-site info to the request.
918         * loader/FrameLoader.h:
919         * loader/ResourceLoader.cpp:
920         (WebCore::ResourceLoader::init): Ditto.
921         * page/DOMWindow.cpp:
922         (WebCore::DOMWindow::createWindow): Ditto.
923         * page/SecurityPolicy.cpp:
924         (WebCore::SecurityPolicy::shouldInheritSecurityOriginFromOwner): Moved from Document.cpp.
925         * page/SecurityPolicy.h:
926         * platform/CookiesStrategy.h:
927         * platform/network/CacheValidation.cpp:
928         (WebCore::headerValueForVary): Pass the same-site info down to the platform.
929         * platform/network/CookieRequestHeaderFieldProxy.h:
930         (WebCore::CookieRequestHeaderFieldProxy::encode const): Encode same-site bits.
931         (WebCore::CookieRequestHeaderFieldProxy::decode): Decode same-site bits.
932         * platform/network/PlatformCookieJar.h:
933         * platform/network/ResourceRequestBase.cpp:
934         (WebCore::ResourceRequestBase::setAsIsolatedCopy): Added.
935         (WebCore::ResourceRequestBase::isSameSite const): Added.
936         (WebCore::ResourceRequestBase::setIsSameSite): Added.
937         (WebCore::ResourceRequestBase::isTopSite const): Added.
938         (WebCore::ResourceRequestBase::setIsTopSite): Added.
939         (WebCore::equalIgnoringHeaderFields):
940         * platform/network/ResourceRequestBase.h:
941         (WebCore::ResourceRequestBase::isSameSiteUnspecified const): Added. See comment for DocumentLoader::startLoadingMainResource()
942         for more details.
943         (WebCore::registrableDomainsAreEqual): Added.
944         (WebCore::ResourceRequestBase::encodeBase const): Encode same-site bits.
945         (WebCore::ResourceRequestBase::decodeBase): Decode same-site bits.
946         * platform/network/SameSiteInfo.cpp: Added.
947         (WebCore::SameSiteInfo::create):
948         * platform/network/SameSiteInfo.h: Added.
949         (WebCore::SameSiteInfo::encode const):
950         (WebCore::SameSiteInfo::decode):
951         * platform/network/cf/CookieJarCFNet.cpp:
952         (WebCore::setCookiesFromDOM): Pass Same-Site info down.
953         (WebCore::cookiesForDOM): Ditto.
954         (WebCore::cookieRequestHeaderFieldValue): Ditto.
955         (WebCore::getRawCookies): Ditto.
956         * platform/network/cf/ResourceRequestCFNet.cpp:
957         (WebCore::siteForCookies): Added.
958         (WebCore::ResourceRequest::doUpdatePlatformRequest): Update platform request with same-site info.
959         (WebCore::ResourceRequest::doUpdateResourceRequest): Ditto.
960         * platform/network/cocoa/ResourceRequestCocoa.mm:
961         (WebCore::ResourceRequest::doUpdateResourceRequest): Ditto.
962         (WebCore::siteForCookies): Added.
963         (WebCore::ResourceRequest::doUpdatePlatformRequest): Update platform request with same-site info.
964         * platform/network/curl/CookieJarCurl.cpp:
965         (WebCore::cookiesForDOM): Pass Same-Site info down.
966         (WebCore::setCookiesFromDOM): Ditto.
967         (WebCore::cookieRequestHeaderFieldValue): Ditto.
968         (WebCore::getRawCookies): Ditto.
969         * platform/network/curl/CookieJarCurl.h:
970         * platform/network/curl/CookieJarCurlDatabase.cpp:
971         (WebCore::CookieJarCurlDatabase::setCookiesFromDOM const): Ditto.
972         (WebCore::CookieJarCurlDatabase::cookiesForDOM const): Ditto.
973         (WebCore::CookieJarCurlDatabase::cookieRequestHeaderFieldValue const): Ditto.
974         (WebCore::CookieJarCurlDatabase::getRawCookies const): Ditto.
975         * platform/network/curl/CookieJarCurlDatabase.h:
976         * platform/network/curl/ResourceHandleCurl.cpp:
977         (WebCore::ResourceHandle::createCurlRequest): Ditto.
978         * platform/network/mac/CookieJarMac.mm:
979         (WebCore::cookiesForURL): Added; shared function to return the cookies based on the specified criterion.
980         (WebCore::setHTTPCookiesForURL): Moved from the bottom of the file to top to be closer to the other
981         CFNetwork helper functions. Modified to support fetching same-site cookies.
982         (WebCore::httpCookiesForURL): Moved to be under setHTTPCookiesForURL(). Modified to call cookiesForURL().
983         Note the SPI used in cookiesForURL() apply the same criterion for whether to fetch secure cookies as we
984         were computing here. That is, the CFNetwork SPI only returns secure cookies if the specified URL's scheme
985         case-insensitively matches "https".
986         (WebCore::cookiesInPartitionForURL): Wrote in terms of cookiesForURL().
987         (WebCore::cookiesForSession): Pass the Same-Site info.
988         (WebCore::cookiesForDOM): Ditto.
989         (WebCore::cookieRequestHeaderFieldValue): Ditto.
990         (WebCore::setCookiesFromDOM): Ditto.
991         (WebCore::getRawCookies): Ditto.
992         (WebCore::deleteCookie): Pass std::nullopt for the Same-Site info so that we do not consider the SameSite
993         attribute when fetching cookies to delete.
994         * platform/network/soup/CookieJarSoup.cpp:
995         (WebCore::setCookiesFromDOM): Pass the Same-Site info.
996         (WebCore::cookiesForDOM): Ditto.
997         (WebCore::cookieRequestHeaderFieldValue): Ditto.
998         (WebCore::getRawCookies): Ditto.
999         * workers/service/context/ServiceWorkerThreadProxy.cpp:
1000         (WebCore::createPageForServiceWorker): Set the first party for same site cookies ("site for cookies") to
1001         the script URL.
1002         * xml/XSLTProcessor.cpp:
1003         (WebCore::XSLTProcessor::createDocumentFromSource): Copy the first party for same-site cookies to the
1004         new document.
1005
1006 2018-04-23  Chris Dumez  <cdumez@apple.com>
1007
1008         HTML String load cannot be prevented by responding 'Cancel' asynchronously in decidePolicyForNavigationAction
1009         https://bugs.webkit.org/show_bug.cgi?id=184848
1010         <rdar://problem/39145306>
1011
1012         Reviewed by Brady Eidson.
1013
1014         When calling loadHTMLString on a WebView, we end up doing a load for 'about:blank'
1015         with substitute data. In such case, we want to do a regular asynchronous policy
1016         delegate check, there is no reason we need it to be synchronous. Update our check
1017         to make sure we only do a synchronous policy check for initial 'about:blank' loads
1018         that do not have substitute data.
1019
1020         * loader/PolicyChecker.cpp:
1021         (WebCore::PolicyChecker::checkNavigationPolicy):
1022
1023 2018-04-23  Wenson Hsieh  <wenson_hsieh@apple.com>
1024
1025         [Extra zoom mode] 100vw is roughly half of the viewport width in extra zoom mode
1026         https://bugs.webkit.org/show_bug.cgi?id=184871
1027         <rdar://problem/39477595>
1028
1029         Reviewed by Andy Estes.
1030
1031         Currently, when computing CSS viewport units, we use ViewportConfiguration::initialScaleIgnoringContentSize().
1032         This method computes an initial scale from the layout width and height without relying on any information
1033         derived from the current content size. This is done to ensure that the content size and viewport dimensions for
1034         CSS viewport units should not be simultaneously dependent on each other.
1035
1036         Since shrink-to-fit heuristics depend on content size, we currently assume that shrink-to-fit is disabled when
1037         computing initialScaleIgnoringContentSize, by always passing in `false` for `shouldIgnoreScalingConstraints`.
1038         However, in extra zoom mode, the opposite is true: since we force both `m_canIgnoreScalingConstraints` and
1039         `m_forceHorizontalShrinkToFit` to be `true` in this mode, we will always try to shrink-to-fit regardless of
1040         content size.
1041
1042         Because of this shrink-to-fit disparity between `initialScale` and `initialScaleIgnoringContentSize`, viewport
1043         units in extra zoom mode are currently computed assuming an initial scale set by the page, whereas the real
1044         viewport is scaled to fit, which causes any lengths computed in terms of vw and vh to be incorrect. To fix this,
1045         we introduce a version of shouldIgnoreScalingConstraints() that returns `true` iff scaling constraints are
1046         always ignored, regardless of content size. We then use this in initialScaleIgnoringContentSize, instead of
1047         always passing in `false` for `shouldIgnoreScalingConstraints`.
1048
1049         Test: fast/css/extrazoom/viewport-units-shrink-to-fit.html
1050
1051         * page/ViewportConfiguration.cpp:
1052         (WebCore::ViewportConfiguration::shouldIgnoreScalingConstraintsRegardlessOfContentSize const):
1053         (WebCore::ViewportConfiguration::initialScaleIgnoringContentSize const):
1054         * page/ViewportConfiguration.h:
1055
1056 2018-04-23  Zalan Bujtas  <zalan@apple.com>
1057
1058         [Simple line layout] Generate inline boxtree using simple line layout runs.
1059         https://bugs.webkit.org/show_bug.cgi?id=184833
1060
1061         Reviewed by Antti Koivisto.
1062
1063         RenderBlockFlow::ensureLineBoxes triggers line layout on the block content to replace
1064         the simple line layout runs with an inline boxtree. The runs generated by the fast path
1065         should always match the inline tree boxes.
1066         In this patch instead of triggering layout, we just convert the simple line runs to
1067         inline boxes.
1068         Currently, it works with only one, non-paginated text renderer, but we should be
1069         able to extend it to all the simple line layout content.   
1070
1071         Covered by existing tests.
1072
1073         * rendering/InlineBox.h:
1074         (WebCore::InlineBox::setHasHyphen):
1075         (WebCore::InlineBox::setCanHaveLeadingExpansion):
1076         (WebCore::InlineBox::setCanHaveTrailingExpansion):
1077         (WebCore::InlineBox::setForceTrailingExpansion):
1078         (WebCore::InlineBox::setForceLeadingExpansion):
1079         (WebCore::InlineBox::hasHyphen const):
1080         (WebCore::InlineBox::canHaveLeadingExpansion const):
1081         (WebCore::InlineBox::canHaveTrailingExpansion const):
1082         (WebCore::InlineBox::forceTrailingExpansion const):
1083         * rendering/RenderBlockFlow.cpp:
1084         (WebCore::RenderBlockFlow::ensureLineBoxes):
1085         * rendering/RenderBlockFlow.h:
1086         * rendering/SimpleLineLayoutFlowContents.h:
1087         (WebCore::SimpleLineLayout::FlowContents::segmentForRun const):
1088         * rendering/SimpleLineLayoutFunctions.cpp:
1089         (WebCore::SimpleLineLayout::canUseForLineBoxTree):
1090         (WebCore::SimpleLineLayout::initializeInlineBox):
1091         (WebCore::SimpleLineLayout::generateLineBoxTree):
1092         * rendering/SimpleLineLayoutFunctions.h:
1093         * rendering/SimpleLineLayoutResolver.cpp:
1094         (WebCore::SimpleLineLayout::RunResolver::rangeForLine const):
1095         * rendering/SimpleLineLayoutResolver.h:
1096
1097 2018-04-23  Zan Dobersek  <zdobersek@igalia.com>
1098
1099         [CoordGraphics] Remove unused trajectory cruft in CoordinatedLayerTreeHost, CoordinatedGraphicsLayer
1100         https://bugs.webkit.org/show_bug.cgi?id=184881
1101
1102         Reviewed by Michael Catanzaro.
1103
1104         Remove the redundant findFirstDescendantWithContentsRecursively() and
1105         setVisibleContentRectTrajectoryVector() methods on the
1106         CoordinatedGraphicsLayer class.
1107
1108         * platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.cpp:
1109         (WebCore::CoordinatedGraphicsLayer::findFirstDescendantWithContentsRecursively): Deleted.
1110         (WebCore::CoordinatedGraphicsLayer::setVisibleContentRectTrajectoryVector): Deleted.
1111         * platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.h:
1112
1113 2018-04-23  Zan Dobersek  <zdobersek@igalia.com>
1114
1115         [CoordGraphics] TiledBackingStore unnecessarily tracks alpha support value
1116         https://bugs.webkit.org/show_bug.cgi?id=184880
1117
1118         Reviewed by Michael Catanzaro.
1119
1120         Drop the m_supportsAlpha member from the TiledBackingStore class. The
1121         member value was unused. TiledBackingStore::setSupportsAlpha() method
1122         is removed.
1123
1124         TiledBackingStore::setSupportsAlpha() invalidated the backing store,
1125         so CoordinatedGraphicsLayer::setContentsOpaque() now enforces the same
1126         behavior by manually updating the m_needsDisplay struct. This means
1127         that during the following layer flush the backing store is repainted
1128         in its entirety.
1129
1130         * platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.cpp:
1131         (WebCore::CoordinatedGraphicsLayer::setContentsOpaque):
1132         (WebCore::CoordinatedGraphicsLayer::createBackingStore):
1133         * platform/graphics/texmap/coordinated/TiledBackingStore.cpp:
1134         (WebCore::TiledBackingStore::TiledBackingStore):
1135         (WebCore::TiledBackingStore::setSupportsAlpha): Deleted.
1136         * platform/graphics/texmap/coordinated/TiledBackingStore.h:
1137
1138 2018-04-23  Thibault Saunier  <tsaunier@igalia.com>
1139
1140         [GStreamer] Start implementing Audio/VideoTrackPrivateGSTreamer::kind method
1141         https://bugs.webkit.org/show_bug.cgi?id=184650
1142
1143         Reviewed by Philippe Normand.
1144
1145         In the playbin3 case we can assume that if the GstStream is selected by default,
1146         it is the Main track of that kind.
1147
1148         No new tests are added as:
1149             * It relies on playbin3 case which support might be compiled out
1150             * we already have a few test that are currently disabled in the mediastream
1151               testsuite. This patch is part of the work to enable them.
1152
1153         * platform/graphics/gstreamer/AudioTrackPrivateGStreamer.cpp:
1154         (WebCore::AudioTrackPrivateGStreamer::kind const):
1155         * platform/graphics/gstreamer/AudioTrackPrivateGStreamer.h:
1156         * platform/graphics/gstreamer/VideoTrackPrivateGStreamer.cpp:
1157         (WebCore::VideoTrackPrivateGStreamer::kind const):
1158         * platform/graphics/gstreamer/VideoTrackPrivateGStreamer.h:
1159
1160 2018-04-23  Alicia Boya García  <aboya@igalia.com>
1161
1162         [MSE] Add allSamplesInTrackEnqueued event
1163         https://bugs.webkit.org/show_bug.cgi?id=184737
1164
1165         MediaSource has a .endOfStream() method to signal when there are no more frames
1166         after the ones currently buffered.
1167
1168         This bit of data is important for some multimedia frameworks. For instance, in
1169         GStreamer a stream of frames being decoded should be terminated by a
1170         'end-of-stream' (EOS) event that has a similar meaning. Some GStreamer elements
1171         will expect this event in order to work properly under some circumstances.
1172
1173         Unfortunately currently WebKit provides no mechanism for this: an event of
1174         sorts should be emitted after no more frames are going to be enqueued to signal
1175         the end of the stream. The closest mechanism WebKit has for this is
1176         `markEndOfStream()`, but it's not exactly the same: markEndOfStream() informs
1177         that -- as far as network buffering is concerned -- we are done; but at that
1178         point there may still be (and often are) many frames waiting in the
1179         decodeQueue, so it would be wrong to signal the decoder that there are no more
1180         frames.
1181
1182         This patch introduces a new optional method in SourceBufferPrivate,
1183         `allSamplesInTrackEnqueued(const AtomicString& trackID)` that is called
1184         whenever the MediaSource is in "ended" state (the user has called
1185         `MediaSource.endOfStream()`) and the decodeQueue is empty. Media framework
1186         implementations can use this method to send a EOS event to a decoder that needs
1187         it.
1188
1189         Reviewed by Xabier Rodriguez-Calvar.
1190
1191         * Modules/mediasource/MediaSource.cpp:
1192         (WebCore::MediaSource::streamEndedWithError):
1193         * Modules/mediasource/SourceBuffer.cpp:
1194         (WebCore::SourceBuffer::provideMediaData):
1195         (WebCore::SourceBuffer::trySignalAllSamplesInTrackEnqueued):
1196         (WebCore::SourceBuffer::trySignalAllSamplesEnqueued):
1197         * Modules/mediasource/SourceBuffer.h:
1198         * platform/graphics/SourceBufferPrivate.h:
1199         (WebCore::SourceBufferPrivate::allSamplesInTrackEnqueued):
1200         * platform/graphics/gstreamer/mse/MediaSourceClientGStreamerMSE.cpp:
1201         (WebCore::MediaSourceClientGStreamerMSE::allSamplesInTrackEnqueued):
1202         * platform/graphics/gstreamer/mse/MediaSourceClientGStreamerMSE.h:
1203         * platform/graphics/gstreamer/mse/PlaybackPipeline.cpp:
1204         (WebCore::PlaybackPipeline::allSamplesInTrackEnqueued):
1205         * platform/graphics/gstreamer/mse/PlaybackPipeline.h:
1206         * platform/graphics/gstreamer/mse/SourceBufferPrivateGStreamer.cpp:
1207         (WebCore::SourceBufferPrivateGStreamer::allSamplesInTrackEnqueued):
1208         * platform/graphics/gstreamer/mse/SourceBufferPrivateGStreamer.h:
1209
1210 2018-04-23  Ms2ger  <Ms2ger@igalia.com>
1211
1212         Avoid uninitialized memory read.
1213         https://bugs.webkit.org/show_bug.cgi?id=184505
1214         <rdar://problem/39348325>
1215
1216         Reviewed by Dean Jackson.
1217
1218         Test: imported/w3c/web-platform-tests/2dcontext/imagebitmap/createImageBitmap-bounds.html
1219
1220         * html/ImageBitmap.cpp:
1221         (WebCore::croppedSourceRectangleWithFormatting):
1222
1223 2018-04-23  Zan Dobersek  <zdobersek@igalia.com>
1224
1225         [TexMap] Drop RefCounted inheritance off of TextureMapperBackingStore
1226         https://bugs.webkit.org/show_bug.cgi?id=184810
1227
1228         Reviewed by Carlos Garcia Campos.
1229
1230         Turn TextureMapperBackingStore into a simple interface that doesn't
1231         inherit from RefCounted<>. Instead, push that inheritance off to the
1232         classes that implement the TextureMapperBackingStore interface. This
1233         narrows down the purpose of TextureMapperBackingStore towards a simple
1234         interface that TextureMapper algorithms can work with.
1235
1236         TextureMapperLayer has its m_backingStore member variable turn into
1237         a simple pointer instead of a RefPtr<>. Setter method and call sites of
1238         that method are updated to reflect that.
1239
1240         TextureMapperTiledBackingStore now inherits from RefCounted<> directly,
1241         instead of through TextureMapperBackingStore.
1242
1243         * platform/graphics/texmap/GraphicsLayerTextureMapper.cpp:
1244         (WebCore::GraphicsLayerTextureMapper::commitLayerChanges):
1245         (WebCore::GraphicsLayerTextureMapper::updateBackingStoreIfNeeded):
1246         * platform/graphics/texmap/GraphicsLayerTextureMapper.h:
1247         * platform/graphics/texmap/TextureMapperBackingStore.h:
1248         * platform/graphics/texmap/TextureMapperLayer.cpp:
1249         (WebCore::TextureMapperLayer::setBackingStore):
1250         * platform/graphics/texmap/TextureMapperLayer.h:
1251         * platform/graphics/texmap/TextureMapperTiledBackingStore.h:
1252
1253 2018-04-22  Zan Dobersek  <zdobersek@igalia.com>
1254
1255         [AsyncScrolling] Add generic ScrollingThread implementation
1256         https://bugs.webkit.org/show_bug.cgi?id=184809
1257
1258         Reviewed by Yusuke Suzuki.
1259
1260         Add a generic ScrollingThread implementation that internally uses
1261         RunLoop facilities to run the scrolling thread and dispatch
1262         callbacks on that thread.
1263
1264         ScrollingThread::initializeRunLoop() retrieves address of the
1265         thread-specific RunLoop and signals the Condition object.
1266         ScrollingThread::wakeUpRunLoop() uses RunLoop::dispatch() to schedule
1267         callback dispatches on the scrolling thread.
1268
1269         ScrollingThread::createThreadIfNeeded() mimics Cocoa implementation and
1270         waits for the RunLoop address to be retrieved before continuing.
1271
1272         * SourcesGTK.txt: Add to build.
1273         * SourcesWPE.txt: Ditto.
1274         * page/scrolling/ScrollingThread.cpp:
1275         (WebCore::ScrollingThread::createThreadIfNeeded):
1276         * page/scrolling/ScrollingThread.h:
1277         * page/scrolling/generic/ScrollingThreadGeneric.cpp: Added.
1278         (WebCore::ScrollingThread::initializeRunLoop):
1279         (WebCore::ScrollingThread::wakeUpRunLoop):
1280
1281 2018-04-22  Zan Dobersek  <zdobersek@igalia.com>
1282
1283         [CoordinatedGraphics] Unused contentsSize, coveredRect attributes in CoordinatedGraphicsState
1284         https://bugs.webkit.org/show_bug.cgi?id=184811
1285
1286         Reviewed by Carlos Garcia Campos.
1287
1288         Remove the unused contentsSize and coveredRect attributes on the
1289         CoordinatedGraphicsState struct. CoordinatedGraphicsLayer::coverRect()
1290         method is now unused and can also be removed.
1291
1292         * platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.h:
1293         * platform/graphics/texmap/coordinated/CoordinatedGraphicsState.h:
1294
1295 2018-04-21  Daniel Bates  <dabates@apple.com>
1296
1297         Cleanup CookieRequestHeaderFieldProxy
1298         https://bugs.webkit.org/show_bug.cgi?id=184868
1299
1300         Remove extraneous whitespace that I inadvertently added.
1301
1302         * platform/network/CookieRequestHeaderFieldProxy.h:
1303         (WebCore::CookieRequestHeaderFieldProxy::decode):
1304
1305 2018-04-21  Daniel Bates  <dabates@apple.com>
1306
1307         Cleanup CookieRequestHeaderFieldProxy
1308         https://bugs.webkit.org/show_bug.cgi?id=184868
1309
1310         Reviewed by Youenn Fablet.
1311
1312         Simplify the struct CookieRequestHeaderFieldProxy and make it consistent with other structs.
1313         Among other changes, remove constructors for CookieRequestHeaderFieldProxy as they are
1314         unnecessary as all supported compilers support non-static data member initializers (NSDMI)
1315         for aggregates, remove prefix "m_" from the name of fields as this is struct exists for
1316         convenience and offers no encapsulation and simplify decoding logic of this struct.
1317
1318         No functionality changed. So, no new tests.
1319
1320         * loader/CookieJar.cpp:
1321         (WebCore::cookieRequestHeaderFieldProxy):
1322         * platform/network/CookieRequestHeaderFieldProxy.h:
1323         (WebCore::CookieRequestHeaderFieldProxy::encode const):
1324         (WebCore::CookieRequestHeaderFieldProxy::decode):
1325         (WebCore::CookieRequestHeaderFieldProxy::CookieRequestHeaderFieldProxy): Deleted.
1326         * platform/network/SocketStreamHandleImpl.cpp:
1327         (WebCore::cookieDataForHandshake):
1328         * platform/network/cf/CookieJarCFNet.cpp:
1329         (WebCore::cookieRequestHeaderFieldValue):
1330         * platform/network/curl/CookieJarCurl.cpp:
1331         (WebCore::cookieRequestHeaderFieldValue):
1332         * platform/network/curl/CookieJarCurlDatabase.cpp:
1333         (WebCore::CookieJarCurlDatabase::cookieRequestHeaderFieldValue const):
1334         * platform/network/mac/CookieJarMac.mm:
1335         (WebCore::cookieRequestHeaderFieldValue):
1336         * platform/network/soup/CookieJarSoup.cpp:
1337         (WebCore::cookieRequestHeaderFieldValue):
1338
1339 2018-04-21  Antoine Quint  <graouts@apple.com>
1340
1341         [Modern Media Controls] Show a loading indicator after pressing the play button in compact mode
1342         https://bugs.webkit.org/show_bug.cgi?id=184863
1343         <rdar://problem/38939468>
1344
1345         Reviewed by Dean Jackson.
1346
1347         We now display a loading indicator after pressing the play button when in compact mode. We also update the
1348         behavior to use assets provided through WebKitAdditions (see webkit.org/b/184862) for the play button and
1349         the invalid icon. Additionally, we always show a 20% opaque black overlay in the background while any piece
1350         of user interface is up.
1351
1352         * Modules/modern-media-controls/controls/compact-activity-indicator.css: Added.
1353         (button.compact-activity-indicator > picture): The loading indicator asset is a sprite made of 23 frames, so
1354         we specify the mask size (since all buttons are rendered via a mask) to be 23 * 100% the rendered size. The
1355         display of the loading indicator is performed with a first intro animation which runs once through the first
1356         8 frames and then a continuously looping animation going through the remaining frames. We use a frames()
1357         timing function to achieve the frame-by-frame effect while using only from/to keyframe animations. When we
1358         fade out, we use a simply opacity fade, which is combined with the spinning animation. We use CSS variables
1359         to encode both animations so they can be used combined or one at a time without redefining the whole animation
1360         property.
1361         (button.compact-activity-indicator.spins > picture): Use the "spins" animation variable when spinning.
1362         (button.compact-activity-indicator.spins.fades-out > picture): Combine the "spins" and "fades-out" animation
1363         variables when fading out.
1364         (@keyframes compact-activity-indicator-intro): Animation going through the first 8 frames of the loading indicator.
1365         (@keyframes compact-activity-indicator-loop): Animation going through the remaining frames of the loading indicator.
1366         (@keyframes compact-activity-indicator-fades-out): Animation fading opacity from 1 to 0.
1367         * Modules/modern-media-controls/controls/compact-activity-indicator.js: Added.
1368         (CompactActivityIndicator):
1369         (CompactActivityIndicator.prototype.show): Add the "spins" CSS class to show the control spinning with the intro animation.
1370         (CompactActivityIndicator.prototype.hide): Add the "fades-out" CSS class to hide the control, removing both this class and
1371         the "spins" class when the fade-out animation completes.
1372         * Modules/modern-media-controls/controls/compact-media-controls.css: Added.
1373         (.media-controls.compact:before): Add a 20% black overlay over the video frame to provide contrast for controls.
1374         (.media-controls.compact button): Ensure buttons are sized to use the entire video frame so that their hit region
1375         comprises the whole video frame.
1376         (.media-controls.compact button > picture): Override default blending styles for a simple solid white mask.
1377         (.media-controls.compact button:active > picture): Turn off the scale down effect when pressing a button.
1378         * Modules/modern-media-controls/controls/compact-media-controls.js: Expose a "state" property for the compact media controls,
1379         which can be exlusively one of three: "paused", "pending" and "invalid".
1380         (CompactMediaControls.):
1381         (CompactMediaControls.prototype.get state):
1382         (CompactMediaControls.prototype.set state):
1383         (CompactMediaControls.prototype.layout): In the "paused" state, show the play button. In the "pending" state show
1384         the loading indicator. In the "invalid" state show the invalid button.
1385         (CompactMediaControls.prototype.get placard): Deleted.
1386         (CompactMediaControls.prototype.set placard): Deleted.
1387         * Modules/modern-media-controls/js-files:
1388         * Modules/modern-media-controls/media/compact-media-controls-support.js: Added.
1389         (CompactMediaControlsSupport.prototype.get mediaEvents):
1390         (CompactMediaControlsSupport.prototype.handleEvent): Make the controls enter the "paused" state when receiving a "pause"
1391         event. Make the controls enter the "invalid" state when receiving an "error" event. 
1392         (CompactMediaControlsSupport.prototype.enable):
1393         (CompactMediaControlsSupport.prototype.disable):
1394         (CompactMediaControlsSupport.prototype.buttonWasPressed): Play the media when pressing the play button and make the controls
1395         enter the "pending" state. When pressing the loading indicator, pause the media and make the controls enter the "paused" state.
1396         (CompactMediaControlsSupport.prototype._buttons):
1397         (CompactMediaControlsSupport):
1398         * Modules/modern-media-controls/media/media-controller.js:
1399         (MediaController.prototype._supportingObjectClasses): Only use CompactMediaControlsSupport as a media controller supporting object
1400         in the compact mode.
1401         * Modules/modern-media-controls/media/placard-support.js:
1402         (PlacardSupport.prototype.get mediaEvents): This media controller support object no longer needs to deal with compact mode.
1403         * Modules/modern-media-controls/media/playback-support.js:
1404         (PlaybackSupport.prototype.syncControl): This media controller support object no longer needs to deal with compact mode.
1405         (PlaybackSupport):
1406
1407 2018-04-21  Antoine Quint  <graouts@apple.com>
1408
1409         [Modern Media Controls] Obtain compact mode icons through WebKitAdditions
1410         https://bugs.webkit.org/show_bug.cgi?id=184862
1411         <rdar://problem/39621645>
1412
1413         Reviewed by Jon Lee.
1414
1415         * Modules/modern-media-controls/controls/button.js:
1416         (Button.prototype._updateImageMetrics): Handle PDF assets where the image source's intrinsic size needs
1417         to be adjusted for the device pixel density.
1418         (Button):
1419         * Modules/modern-media-controls/controls/icon-service.js: Expect three additional icons provided through
1420         WebKitAdditions, including two in the PDF format, so we add support for this format.
1421         * WebCore.xcodeproj/project.pbxproj: Copy additional assets from the WebKitAdditions build directory should
1422         any be present.
1423
1424 2018-04-21  Dean Jackson  <dino@apple.com>
1425
1426         Expose whether you've build with the Apple Internal SDK
1427         https://bugs.webkit.org/show_bug.cgi?id=184864
1428
1429         Reviewed by Wenson Hsieh.
1430
1431         Internals API to let a test know if it is running with the
1432         Apple internal SDK.
1433
1434         * testing/Internals.cpp:
1435         (WebCore::usingAppleInternalSDK const):
1436         * testing/Internals.h:
1437         * testing/Internals.idl:
1438
1439 2018-04-20  Nan Wang  <n_wang@apple.com>
1440
1441         AX: AOM does not work with DOM Level 1 events
1442         https://bugs.webkit.org/show_bug.cgi?id=184847
1443
1444         Reviewed by Chris Fleizach.
1445
1446         Added the accessibility events to the HTML attribute names.
1447
1448         Test cases are added to the existing layout tests.
1449
1450         * html/HTMLAttributeNames.in:
1451         * html/HTMLElement.cpp:
1452         (WebCore::HTMLElement::createEventHandlerNameMap):
1453
1454 2018-04-20  Carlos Garcia Campos  <cgarcia@igalia.com>
1455
1456         REGRESSION(r228088): [SOUP] Check TLS errors for WebSockets on GTlsConnection::accept-certificate
1457         https://bugs.webkit.org/show_bug.cgi?id=184804
1458
1459         Reviewed by Michael Catanzaro.
1460
1461         * platform/network/soup/SocketStreamHandleImpl.h: Add a public url getter.
1462         * platform/network/soup/SocketStreamHandleImplSoup.cpp:
1463         (WebCore::acceptCertificateCallback): Call SoupNetworkSession::checkTLSErrors() to decide whether to accept the
1464         certificate or not.
1465         (WebCore::connectProgressCallback): Receive the SocketStreamHandle and pass it to acceptCertificateCallback callback.
1466         (WebCore::socketClientEventCallback): Ditto.
1467         (WebCore::SocketStreamHandleImpl::create): Always connect to network events.
1468         (WebCore::wssConnectionAcceptCertificateCallback): Deleted.
1469         (WebCore::wssSocketClientEventCallback): Deleted.
1470
1471 2018-04-20  Carlos Garcia Campos  <cgarcia@igalia.com>
1472
1473         [SOUP] Do TLS error checking on GTlsConnection::accept-certificate
1474         https://bugs.webkit.org/show_bug.cgi?id=184480
1475
1476         Reviewed by Michael Catanzaro.
1477
1478         * platform/network/soup/ResourceError.h: Change tlsError to recieve a failing URL instead of a SoupRequest,
1479         since the request was only used to get the failing URL.
1480         * platform/network/soup/ResourceErrorSoup.cpp:
1481         (WebCore::ResourceError::tlsError): Use the given failing URL.
1482         * platform/network/soup/SoupNetworkSession.cpp:
1483         (WebCore::SoupNetworkSession::SoupNetworkSession): Use ssl-strict when creating the SoupSession to handle the
1484         certificates ourselves by connecting to GTlsConnection::accept-certificate.
1485         (WebCore::SoupNetworkSession::checkTLSErrors): Updated to receive a URL, certificate and errors instead of
1486         receiving a SoupRequest and SoupMessage and extract the url, certirficate and errors from them. Also return the
1487         optional error directly instead of using a completion handler since the function is always synchronous.
1488         * platform/network/soup/SoupNetworkSession.h:
1489
1490 2018-04-20  Tim Horton  <timothy_horton@apple.com>
1491
1492         Adjust geolocation feature flag
1493         https://bugs.webkit.org/show_bug.cgi?id=184856
1494
1495         Reviewed by Wenson Hsieh.
1496
1497         * Configurations/FeatureDefines.xcconfig:
1498
1499 2018-04-20  Chris Dumez  <cdumez@apple.com>
1500
1501         Unreviewed attempt to fix Windows build after r230875.
1502
1503         * platform/network/cf/CookieJarCFNet.cpp:
1504         (WebCore::cookieRequestHeaderFieldValue):
1505         * platform/network/curl/CookieJarCurlDatabase.cpp:
1506
1507 2018-04-20  Chris Dumez  <cdumez@apple.com>
1508
1509         REGRESSION (r229828): web view doesn’t update or respond to resizing until client calls policy decision handler
1510         https://bugs.webkit.org/show_bug.cgi?id=184210
1511         <rdar://problem/39072354>
1512
1513         Reviewed by Wenson Hsieh.
1514
1515         r229828 tried to have some API tests happy on iOS by freezing the layer tree
1516         during the navigation policy decision. However, this is observable by the client
1517         application and a regression from when the policy delegate was synchronous.
1518
1519         To address the issue, this patch reverts r229828 and instead updates the iOS
1520         API tests to wait for the next presentation update after navigating
1521         before interacting with the view.
1522
1523         * loader/FrameLoaderClient.h:
1524         * loader/PolicyChecker.cpp:
1525         (WebCore::PolicyChecker::checkNavigationPolicy):
1526
1527 2018-04-20  Brent Fulgham  <bfulgham@apple.com>
1528
1529         Limit cookie header access to Network process
1530         https://bugs.webkit.org/show_bug.cgi?id=184764
1531         <rdar://problem/36785285>
1532
1533         Reviewed by Youenn Fablet.
1534
1535         Revise the handling of cookie request headers so that we don't interact with them in the
1536         WebContent process. They are only needed for interaction with the server and the network
1537         process, so we should limit their scope to just the Network process.
1538
1539         Instead, we should handle a token that represents the cookie headers in the WebContent
1540         process, which can be converted to the relevant cookie data in the network process when
1541         needed.
1542
1543         * Modules/websockets/WebSocketChannel.cpp:
1544         (WebCore::WebSocketChannel::didOpenSocketStream):
1545         * Modules/websockets/WebSocketHandshake.cpp:
1546         (WebCore::WebSocketHandshake::clientHandshakeMessage const):
1547         (WebCore::WebSocketHandshake::clientHandshakeRequest const):
1548         (WebCore::WebSocketHandshake::clientHandshakeCookieRequestHeaderFieldProxy const):
1549         (WebCore::WebSocketHandshake::clientHandshakeMessage): Deleted.
1550         (WebCore::WebSocketHandshake::clientHandshakeRequest): Deleted.
1551         * Modules/websockets/WebSocketHandshake.h:
1552         * WebCore.xcodeproj/project.pbxproj:
1553         * loader/CookieJar.cpp:
1554         (WebCore::cookieRequestHeaderFieldProxy):
1555         * loader/CookieJar.h:
1556         * platform/network/CookieRequestHeaderFieldProxy.h: Added.
1557         (WebCore::CookieRequestHeaderFieldProxy::CookieRequestHeaderFieldProxy):
1558         (WebCore::CookieRequestHeaderFieldProxy::isolatedCopy const):
1559         (WebCore::CookieRequestHeaderFieldProxy::encode const):
1560         (WebCore::CookieRequestHeaderFieldProxy::decode):
1561         * platform/network/PlatformCookieJar.h:
1562         * platform/network/SocketStreamHandle.cpp:
1563         (WebCore::SocketStreamHandle::sendHandshake):
1564         * platform/network/SocketStreamHandle.h:
1565         * platform/network/SocketStreamHandleImpl.cpp:
1566         (WebCore::SocketStreamHandleImpl::platformSendHandshake):
1567         * platform/network/cf/SocketStreamHandleImpl.h:
1568         * platform/network/curl/CookieJarCurl.cpp:
1569         (WebCore::cookieRequestHeaderFieldValue):
1570         * platform/network/curl/CookieJarCurl.h:
1571         * platform/network/curl/SocketStreamHandleImpl.h:
1572         * platform/network/mac/CookieJarMac.mm:
1573         (WebCore::cookieRequestHeaderFieldValue):
1574         * platform/network/soup/CookieJarSoup.cpp:
1575         (WebCore::cookieRequestHeaderFieldValue):
1576         * platform/network/soup/SocketStreamHandleImpl.h:
1577
1578 2018-04-20  Daniel Bates  <dabates@apple.com>
1579
1580         Hide Strong Password label when text field is too narrow
1581         https://bugs.webkit.org/show_bug.cgi?id=184785
1582         <rdar://problem/38183939>
1583
1584         Reviewed by Zalan Bujtas.
1585
1586         We accomplish this illusion by allowing the text field's decorations to wrap, specifying flex
1587         shrink factors, a flex basis and hiding overflow. Hiding overflow is accomplished by a
1588         combination of setting "overflow: hidden", "text-overflow: clip", and patching RenderTextControlSingleLine::layout()
1589         to ensure that the height of the container element is equal to the intrinsic height of the
1590         inner elements. Because the container is a flex box and we want to vertically center its
1591         contents we also need to fix up the y-position of the container element as it may have flexed
1592         as a result of forcing its height to match the intrinsic height of the inner elements.
1593
1594         * css/html.css:
1595         (input::-webkit-strong-password-auto-fill-button): Specify a flex-shrink factor and prevent
1596         wrapping of the "Strong Password" text when flexed.
1597         * html/shadow/TextControlInnerElements.cpp:
1598         (WebCore::TextControlInnerContainer::TextControlInnerContainer): Register for a custom style
1599         resolution callback so that we can style the container if it is a Strong Password or Strong
1600         Confirmation Password text field. Ideally we could accomplish this effect with a user agent-
1601         specific pseudo class together with a selector definition in the user agent style sheet,
1602         html.css. Unfortunately the style resolver does not seem to apply pseudo classes to
1603         shadow DOM pseudo elements (why?). Therefore we use a custom style resolution callback to
1604         achieve the same effect.
1605         (WebCore::isStrongPasswordTextField): Returns whether the specified DOM element is a Strong
1606         Password text field.
1607         (WebCore::TextControlInnerContainer::resolveCustomStyle): Conditionally apply CSS properties
1608         "flex-wrap: wrap" and overflow: hidden" if the shadow host of this container is a Strong
1609         Password text field.
1610         (WebCore::TextControlInnerElement::resolveCustomStyle): Conditionally style the inner text
1611         if the shadow host of this container is a Strong Password text field. We need to apply these
1612         styles here as opposed to in html.css for the same reason we need to apply the styles to
1613         the container in a custom style resolution callback. See the comments for TextControlInnerContainer()
1614         above for more details
1615         * html/shadow/TextControlInnerElements.h:
1616         * rendering/RenderTextControlSingleLine.cpp:
1617         (WebCore::resetOverriddenHeight): Added. Incorporates the logic from setNeedsLayoutOnAncestors().
1618         (WebCore::RenderTextControlSingleLine::layout): Override the height of the container element to
1619         match the height of the inner elements when this text field is a Strong Password field. We cache
1620         the container's logical top before adjusting its height so that we can restore it after performing
1621         a second layout of this renderer. This is needed because we vertically center the elements in this
1622         renderer and adjusting the height of the container may cause it to flex and re-position along its
1623         cross axis when the container's height is taller than the inner element's height (e.g. the "Strong
1624         Password" label wraps to the next line). This re-positioning causes a noticeable jitter when
1625         transitioning from a field that has a visible "Strong Password" label to one that does not. Caching
1626         and restoring the logical top of the container element avoids this jitter.
1627         (WebCore::setNeedsLayoutOnAncestors): Deleted. Moved its implementation into resetOverriddenHeight().
1628
1629 2018-04-20  Dean Jackson  <dino@apple.com>
1630
1631         Render a badge on system preview images
1632         https://bugs.webkit.org/show_bug.cgi?id=184854
1633         <rdar://problem/39615154>
1634
1635         Reviewed by Tim Horton.
1636
1637         At paint time, if a RenderImage is an image element
1638         which is identified as a system preview, then draw
1639         a little badge in the top right corner.
1640
1641         It is expected that platforms will override the
1642         default rendering with something that identifies
1643         how a system preview will operate. e.g. QuickLook
1644         on Apple systems.
1645
1646         Test: system-preview/badge.html
1647
1648         * rendering/RenderImage.cpp:
1649         (WebCore::RenderImage::paintIntoRect): If we are
1650         a system preview, call RenderTheme to draw a badge.
1651         * rendering/RenderTheme.cpp:
1652         (WebCore::RenderTheme::paintSystemPreviewBadge): A default
1653         implementation that draws a red circle.
1654         * rendering/RenderTheme.h:
1655
1656 2018-04-20  Brian Burg  <bburg@apple.com>
1657
1658         Web Inspector: remove some dead code in IdentifiersFactory
1659         https://bugs.webkit.org/show_bug.cgi?id=184839
1660
1661         Reviewed by Timothy Hatcher.
1662
1663         * inspector/InspectorController.cpp:
1664         (WebCore::InspectorController::setProcessId): Deleted.
1665         * inspector/InspectorController.h:
1666
1667 2018-04-20  Chris Dumez  <cdumez@apple.com>
1668
1669         Use WindowProxy in DOMWindow.idl
1670         https://bugs.webkit.org/show_bug.cgi?id=184820
1671
1672         Reviewed by Sam Weinig.
1673
1674         Use WindowProxy in DOMWindow.idl to match the specification more closely.
1675
1676         * bindings/js/JSWindowProxy.h:
1677         * bindings/js/WindowProxy.cpp:
1678         (WebCore::WindowProxy::window const):
1679         * bindings/js/WindowProxy.h:
1680         * bindings/scripts/CodeGeneratorJS.pm:
1681         (NativeToJSValueDOMConvertNeedsState):
1682         * dom/Document.cpp:
1683         * dom/Document.h:
1684         * dom/Document.idl:
1685         * page/DOMWindow.cpp:
1686         (WebCore::DOMWindow::focus):
1687         (WebCore::DOMWindow::self const):
1688         (WebCore::DOMWindow::opener const):
1689         (WebCore::DOMWindow::parent const):
1690         (WebCore::DOMWindow::top const):
1691         (WebCore::DOMWindow::open):
1692         * page/DOMWindow.h:
1693         * page/DOMWindow.idl:
1694         * testing/Internals.cpp:
1695         (WebCore::Internals::openDummyInspectorFrontend):
1696         * testing/Internals.h:
1697         * testing/Internals.idl:
1698
1699 2018-04-20  Chris Dumez  <cdumez@apple.com>
1700
1701         Update cross-origin SecurityError messages to not include the target origin
1702         https://bugs.webkit.org/show_bug.cgi?id=184803
1703         <rdar://problem/39547724>
1704
1705         Reviewed by Sam Weinig.
1706
1707         No new tests, rebaselined existing tests.
1708
1709         * bindings/js/JSDOMBindingSecurity.cpp:
1710         (WebCore::canAccessDocument):
1711         (WebCore::BindingSecurity::shouldAllowAccessToFrame):
1712         (WebCore::BindingSecurity::shouldAllowAccessToDOMWindow):
1713         * page/DOMWindow.cpp:
1714         (WebCore::DOMWindow::crossDomainAccessErrorMessage):
1715         (WebCore::DOMWindow::isInsecureScriptAccess):
1716         * page/DOMWindow.h:
1717         * page/Location.cpp:
1718         (WebCore::Location::reload):
1719
1720 2018-04-20  Chris Nardi  <cnardi@chromium.org>
1721
1722         Update HSL/HSLA parsing to match CSS Color 4
1723         https://bugs.webkit.org/show_bug.cgi?id=180528
1724         <rdar://problem/35926675>
1725
1726         CSS Color 4 specifies a comma optional syntax for HSL/HSLA, as well as allowing angle values for the
1727         hue and percent alpha values. Update our parsing to match this.
1728
1729         Reviewed by Simon Fraser.
1730
1731         This change also updates the import of WPT css-color to test the changes.
1732
1733         Tests: LayoutTests/imported/w3c/web-platform-tests/css/css-color/hsl{a}-{001-008}.html
1734
1735         * css/parser/CSSPropertyParserHelpers.cpp:
1736         (WebCore::CSSPropertyParserHelpers::parseHSLParameters):
1737         (WebCore::CSSPropertyParserHelpers::parseColorFunction):
1738         (WebCore::CSSPropertyParserHelpers::consumeColor):
1739         * platform/graphics/Color.cpp:
1740         (WebCore::calcHue):
1741         (WebCore::makeRGBAFromHSLA):
1742
1743 2018-04-20  Wenson Hsieh  <wenson_hsieh@apple.com>
1744
1745         [Extra zoom mode] Injected bundle form client should be notified when editing text fields
1746         https://bugs.webkit.org/show_bug.cgi?id=184822
1747         <rdar://problem/38807319>
1748
1749         Reviewed by Tim Horton.
1750
1751         Export the constructor and destructor of UserTypingGestureIndicator for use in WebKit (see WebPage.cpp).
1752
1753         Test: fast/forms/extrazoom/edit-text-field-calls-injected-bundle.html
1754
1755         * dom/UserTypingGestureIndicator.h:
1756
1757 2018-04-18  Jer Noble  <jer.noble@apple.com>
1758
1759         Don't put build products into WK_ALTERNATE_WEBKIT_SDK_PATH for engineering builds
1760         https://bugs.webkit.org/show_bug.cgi?id=184762
1761
1762         Reviewed by Dan Bernstein.
1763
1764         * Configurations/WebCore.xcconfig:
1765         * WebCore.xcodeproj/project.pbxproj:
1766
1767 2018-04-20  Daniel Bates  <dabates@apple.com>
1768
1769         Remove code for compilers that did not support NSDMI for aggregates
1770         https://bugs.webkit.org/show_bug.cgi?id=184599
1771
1772         Reviewed by Per Arne Vollan.
1773
1774         Remove workaround for earlier Visual Studio versions that did not support non-static data
1775         member initializers (NSDMI) for aggregates. We have since updated all the build.webkit.org
1776         and EWS bots to a newer version that supports this feature.
1777
1778         * Modules/cache/CacheQueryOptions.h:
1779         (WebCore::CacheQueryOptions::CacheQueryOptions): Deleted.
1780         * dom/Node.h:
1781         (WebCore::Node::InsertionType::InsertionType): Deleted.
1782         (WebCore::Node::RemovalType::RemovalType): Deleted.
1783         * html/canvas/CanvasStyle.h:
1784         (WebCore::CanvasStyle::CMYKAColor::CMYKAColor): Deleted.
1785         * page/EventHandler.h:
1786         (WebCore::EventHandler::DragTargetResponse::DragTargetResponse): Deleted.
1787         * page/animation/CSSAnimationController.h:
1788         (WebCore::AnimationUpdate::AnimationUpdate): Deleted.
1789         * platform/graphics/FontSelectionAlgorithm.h:
1790         (WebCore::FontSelectionRequest::tied const):
1791         (WebCore::FontSelectionRequest::FontSelectionRequest): Deleted.
1792         (WebCore::FontSelectionCapabilities::FontSelectionCapabilities): Deleted.
1793         * platform/mediastream/IceCandidate.h:
1794         (WebCore::IceCandidate::IceCandidate): Deleted.
1795         * platform/text/StringWithDirection.h:
1796         (WebCore::StringWithDirection::StringWithDirection): Deleted.
1797         * rendering/MarkedText.h:
1798         (WebCore::MarkedText::MarkedText): Deleted.
1799         * style/StyleUpdate.h:
1800         (WebCore::Style::ElementUpdate::ElementUpdate): Deleted.
1801         (WebCore::Style::ElementUpdates::ElementUpdates): Deleted.
1802         (WebCore::Style::TextUpdate::TextUpdate): Deleted.
1803
1804 2018-04-20  Youenn Fablet  <youenn@apple.com>
1805
1806         WebPage sometimes incorrectly rules out PDF as a mime type that can be showed
1807         https://bugs.webkit.org/show_bug.cgi?id=184369
1808
1809         Reviewed by Chris Dumez.
1810
1811         WebPage does need to check for plugins at reception of the response.
1812         In that case, the page URL is the URL from which we are navigating out.
1813         Add plugin API to check for plugin availability with an extra URL parameter to cover that case.
1814
1815         Covered by API test.
1816
1817         * plugins/PluginData.cpp:
1818         (WebCore::PluginData::supportsWebVisibleMimeTypeForURL const):
1819         (WebCore::PluginData::supportsWebVisibleMimeType const):
1820         * plugins/PluginData.h:
1821
1822 2018-04-20  Daniel Bates  <dabates@apple.com>
1823
1824         Remove Strong Password decoration when text field type changes
1825         https://bugs.webkit.org/show_bug.cgi?id=184795
1826         <rdar://problem/38325108>
1827
1828         Reviewed by Antti Koivisto.
1829
1830         Remove the Strong Password decoration when the text field's type changes to avoid interfering
1831         with web sites that allow a person to show/hide their password.
1832
1833         Test: fast/forms/auto-fill-button/hide-strong-password-when-field-type-changes.html
1834
1835         * html/HTMLInputElement.cpp:
1836         (WebCore::HTMLInputElement::updateType):
1837
1838 2018-04-20  Javier Fernandez  <jfernandez@igalia.com>
1839
1840         Update Alignment shorthands to the spec now that they are not ambiguous
1841         https://bugs.webkit.org/show_bug.cgi?id=184812
1842
1843         Reviewed by Antti Koivisto.
1844
1845         Now that the issue [1] about the syntax ambiguity has been resolved we
1846         don't need to use the custom syntax anymore. The Alignment shorthands
1847         use now the simple syntax, defined based on the longhands' syntax.
1848
1849         Since we allow all the values valid for each longhand, we'll update
1850         in this CL the corresponding web platform tests. Additionally, this CL
1851         updates also the shorthand serialization tests [2], which didn't
1852         consider the new value 'legacy' for justify-items (and place-items) due
1853         to the bug [3] Firefox still has pending to be fixed.
1854
1855         [1] https://github.com/w3c/csswg-drafts/issues/1001
1856         [2] css/css-align/default-alignment/shorthand-serialization-001.html
1857         [3] https://bugzilla.mozilla.org/show_bug.cgi?id=1363875
1858
1859         Tests: imported/w3c/web-platform-tests/css/css-align/default-alignment/shorthand-serialization-001.html
1860                imported/w3c/web-platform-tests/css/css-align/gaps/gap-normal-computed-001.html
1861                imported/w3c/web-platform-tests/css/css-align/gaps/gap-normal-used-001.html
1862                imported/w3c/web-platform-tests/css/css-align/gaps/gap-normal-used-002.html
1863
1864         * css/parser/CSSPropertyParser.cpp:
1865         (WebCore::CSSPropertyParser::consumePlaceContentShorthand): Using the justify-content and align-content parsing logic to parse the shorthand.
1866         (WebCore::CSSPropertyParser::consumePlaceItemsShorthand): Using the justify-items and align-items parsing logic to parse the shorthand.
1867         (WebCore::CSSPropertyParser::consumePlaceSelfShorthand): Using the justify-self and align-self parsing logic to parse the shorthand.
1868
1869 2018-04-20  Daniel Bates  <dabates@apple.com>
1870
1871         Unreviewed, rolling out r230117.
1872
1873         Broke find-in-page for PDFs
1874
1875         Reverted changeset:
1876
1877         "ASSERTION FAILED: ASSERT(!containsImage ||
1878         MIMETypeRegistry::isSupportedImageResourceMIMEType([resource
1879         MIMEType])) in -[NSPasteboard(WebExtras)
1880         _web_writePromisedRTFDFromArchive:containsImage:]"
1881         https://bugs.webkit.org/show_bug.cgi?id=184161
1882         https://trac.webkit.org/changeset/230117
1883
1884 2018-04-20  Eric Carlson  <eric.carlson@apple.com>
1885
1886         Pausing should clear m_waitingToEnterFullscreen
1887         https://bugs.webkit.org/show_bug.cgi?id=184831
1888         <rdar://problem/39602852>
1889
1890         Reviewed by Jer Noble.
1891
1892         * html/HTMLMediaElement.cpp:
1893         (WebCore::HTMLMediaElement::pause): Clear m_waitingToEnterFullscreen
1894
1895 2018-04-20  Eric Carlson  <eric.carlson@apple.com>
1896
1897         [Extra zoom mode] Disable CA transactions while setting up for fullscreen
1898         https://bugs.webkit.org/show_bug.cgi?id=184817
1899         <rdar://problem/39596075>
1900
1901         Reviewed by Jer Noble.
1902
1903         This was tested manually as it is not possible to write an automated test for this.
1904
1905         * platform/ios/VideoFullscreenInterfaceAVKit.mm:
1906         (VideoFullscreenInterfaceAVKit::doSetup): Move the call to disable CA transactions outside
1907         of the EXTRA_ZOOM_MODE check, the [CATransaction commit] was already unguarded.
1908
1909 2018-04-20  Youenn Fablet  <youenn@apple.com>
1910
1911         Make PluginData cache its web visible plugins
1912         https://bugs.webkit.org/show_bug.cgi?id=184421
1913
1914         Reviewed by Chris Dumez.
1915
1916         Buffer visible plugins until the page URL changes.
1917         For that purpose, we now cache the visible plugins and the URL it was computed from in PluginData.
1918
1919         Update plugin info provider API to pass the URL used to check for plugin visibility.
1920
1921         No observable change of behavior.
1922
1923         * loader/EmptyClients.cpp:
1924         * plugins/PluginData.cpp:
1925         (WebCore::PluginData::webVisiblePlugins const):
1926         (WebCore::PluginData::publiclyVisiblePlugins const):
1927         (WebCore::PluginData::supportsMimeType const):
1928         * plugins/PluginData.h:
1929         * plugins/PluginInfoProvider.h:
1930
1931 2018-04-20  Chris Dumez  <cdumez@apple.com>
1932
1933         Unreviewed build fix after r230840.
1934
1935         * bindings/js/JSWindowProxy.cpp:
1936         (WebCore::JSWindowProxy::attachDebugger):
1937
1938 2018-04-20  Chris Dumez  <cdumez@apple.com>
1939
1940         Unreviewed attempt to fix the Windows build after r230831.
1941
1942         * bindings/js/JSWindowProxy.cpp:
1943         (WebCore::JSWindowProxy::create):
1944         (WebCore::JSWindowProxy::attachDebugger):
1945
1946 2018-04-20  Chris Nardi  <cnardi@chromium.org>
1947
1948         Omit default value when serializing font-feature-settings
1949         https://bugs.webkit.org/show_bug.cgi?id=182382
1950
1951         Reviewed by Myles C. Maxfield.
1952
1953         According to the shortest-serialization principle [1], values should be omitted if their omission
1954         wouldn't change the value of reparsing. As "1"/"on" is the default value for font-feature-settings,
1955         omit this when serializing, matching the behavior of Firefox and Chrome.
1956
1957         [1]: https://github.com/w3c/csswg-drafts/issues/1564
1958
1959         Updated css3/font-feature-settings-parsing.html, fast/css/inherited-properties-rare-text.html,
1960         and fast/text/font-face-javascript.html.
1961
1962         * css/CSSFontFeatureValue.cpp:
1963         (WebCore::CSSFontFeatureValue::customCSSText const):
1964
1965 2018-04-19  Alexey Proskuryakov  <ap@apple.com>
1966
1967         More WK_ALTERNATE_FRAMEWORKS_DIR adoption in WebCore
1968         https://bugs.webkit.org/show_bug.cgi?id=184805
1969
1970         Reviewed by Dan Bernstein.
1971
1972         * Configurations/WebCoreTestShim.xcconfig:
1973         * Configurations/WebCoreTestSupport.xcconfig:
1974
1975 2018-04-19  Brady Eidson  <beidson@apple.com>
1976
1977         Make back forward cache work with process swapping.
1978         <rdar://problem/38676604> and https://bugs.webkit.org/show_bug.cgi?id=184793
1979
1980         Reviewed by Chris Dumez.
1981
1982         Covered by API tests.
1983
1984         * loader/FrameLoader.cpp:
1985         (WebCore::FrameLoader::loadWithNavigationAction):
1986         (WebCore::FrameLoader::load):
1987         (WebCore::FrameLoader::loadWithDocumentLoader):
1988         (WebCore::FrameLoader::reloadWithOverrideEncoding):
1989         (WebCore::FrameLoader::reload):
1990         (WebCore::FrameLoader::commitProvisionalLoad):
1991         (WebCore::FrameLoader::loadDifferentDocumentItem):
1992         * loader/FrameLoader.h:
1993
1994 2018-04-19  Chris Dumez  <cdumez@apple.com>
1995
1996         Rename JSDOMWindowProxy to JSWindowProxy
1997         https://bugs.webkit.org/show_bug.cgi?id=184797
1998
1999         Reviewed by Sam Weinig.
2000
2001         Rename JSDOMWindowProxy to JSWindowProxy for consistency with WindowProxy.
2002
2003         * Sources.txt:
2004         * WebCore.xcodeproj/project.pbxproj:
2005         * bindings/IDLTypes.h:
2006         * bindings/js/JSBindingsAllInOne.cpp:
2007         * bindings/js/JSDOMConvertWindowProxy.h:
2008         * bindings/js/JSDOMWindowBase.cpp:
2009         (WebCore::JSDOMWindowBase::JSDOMWindowBase):
2010         (WebCore::JSDOMWindowBase::finishCreation):
2011         (WebCore::JSDOMWindowBase::proxy const):
2012         (WebCore::toJSDOMWindow):
2013         * bindings/js/JSDOMWindowBase.h:
2014         * bindings/js/JSDOMWindowCustom.cpp:
2015         (WebCore::JSDOMWindow::toWrapped):
2016         * bindings/js/JSEventTargetCustom.cpp:
2017         (WebCore::JSEventTarget::toWrapped):
2018         * bindings/js/JSRemoteDOMWindowBase.cpp:
2019         (WebCore::JSRemoteDOMWindowBase::JSRemoteDOMWindowBase):
2020         (WebCore::toJSRemoteDOMWindow):
2021         * bindings/js/JSRemoteDOMWindowBase.h:
2022         * bindings/js/JSWindowProxy.cpp: Renamed from Source/WebCore/bindings/js/JSDOMWindowProxy.cpp.
2023         (WebCore::JSWindowProxy::JSWindowProxy):
2024         (WebCore::JSWindowProxy::finishCreation):
2025         (WebCore::JSWindowProxy::create):
2026         (WebCore::JSWindowProxy::destroy):
2027         (WebCore::JSWindowProxy::setWindow):
2028         (WebCore::JSWindowProxy::attachDebugger):
2029         (WebCore::JSWindowProxy::wrapped const):
2030         (WebCore::JSWindowProxy::toWrapped):
2031         (WebCore::toJS):
2032         (WebCore::toJSWindowProxy):
2033         * bindings/js/JSWindowProxy.h: Renamed from Source/WebCore/bindings/js/JSDOMWindowProxy.h.
2034         (WebCore::toJS):
2035         (WebCore::toJSWindowProxy):
2036         * bindings/js/ScriptController.cpp:
2037         (WebCore::ScriptController::initScriptForWindowProxy):
2038         * bindings/js/ScriptController.h:
2039         * bindings/js/WindowProxy.cpp:
2040         (WebCore::WindowProxy::createJSWindowProxy):
2041         (WebCore::WindowProxy::jsWindowProxiesAsVector const):
2042         (WebCore::WindowProxy::createJSWindowProxyWithInitializedScript):
2043         * bindings/js/WindowProxy.h:
2044         (WebCore::WindowProxy::jsWindowProxy):
2045         (WebCore::WindowProxy::existingJSWindowProxy const):
2046         * bindings/scripts/CodeGeneratorJS.pm:
2047         (AddToIncludesForIDLType):
2048         (GenerateHeader):
2049         (GenerateOverloadDispatcher):
2050         (GenerateImplementation):
2051         * bindings/scripts/test/JS/JSTestObj.cpp:
2052         (WebCore::jsTestObjPrototypeFunctionOverloadedMethodOverloadDispatcher):
2053         * page/Frame.cpp:
2054         * page/csp/ContentSecurityPolicy.cpp:
2055         (WebCore::ContentSecurityPolicy::didCreateWindowProxy const):
2056         * page/csp/ContentSecurityPolicy.h:
2057
2058 2018-04-19  Dirk Schulze  <krit@webbkit.org>
2059
2060         Introduce SVGGeometryElement interface
2061         https://bugs.webkit.org/show_bug.cgi?id=184768
2062
2063         Reviewed by Antti Koivisto.
2064
2065         Start implementing SVGGeometryElement interface from SVG2.
2066         https://svgwg.org/svg2-draft/types.html#InterfaceSVGGeometryElement
2067
2068         Start with SVGPathElement only for now. Also, just inferface gets implemented
2069         by this patch. No new functionality like isPointInFill yet.
2070         Fix getPointAtLength and make it more restrictive. This follows the spec and
2071         all other implementations.
2072
2073         Added additional test scenarios to existing tests.
2074
2075         * CMakeLists.txt:
2076         * DerivedSources.make:
2077         * Sources.txt:
2078         * WebCore.xcodeproj/project.pbxproj:
2079         * bindings/scripts/CodeGeneratorJS.pm:
2080         (GetGnuVTableOffsetForType):
2081         * svg/SVGAllInOne.cpp:
2082         * svg/SVGGeometryElement.cpp: Added.
2083         (WebCore::SVGGeometryElement::SVGGeometryElement):
2084         (WebCore::SVGGeometryElement::isSupportedAttribute):
2085         (WebCore::SVGGeometryElement::parseAttribute):
2086         (WebCore::SVGGeometryElement::svgAttributeChanged):
2087         (WebCore::SVGGeometryElement::createElementRenderer):
2088         * svg/SVGGeometryElement.h: Added.
2089         * svg/SVGGeometryElement.idl: Added.
2090         * svg/SVGGradientElement.cpp:
2091         * svg/SVGPathElement.cpp:
2092         (WebCore::SVGPathElement::SVGPathElement):
2093         (WebCore::SVGPathElement::parseAttribute):
2094         (WebCore::SVGPathElement::svgAttributeChanged):
2095         (WebCore::SVGPathElement::insertedIntoAncestor):
2096         (WebCore::SVGPathElement::removedFromAncestor):
2097         * svg/SVGPathElement.h:
2098         * svg/SVGPathElement.idl:
2099
2100 2018-04-19  Tadeu Zagallo  <tzagallo@apple.com>
2101
2102         REGRESSION(r227340): ArrayBuffers were not being serialized when sent via MessagePorts
2103         https://bugs.webkit.org/show_bug.cgi?id=184254
2104         <rdar://problem/39140200>
2105
2106         Reviewed by Daniel Bates.
2107
2108         Add a new encoding method to SerializedScriptValue that includes ArrayBuffers.
2109
2110         Test: workers/message-port.html
2111
2112         * bindings/js/SerializedScriptValue.h:
2113         (WebCore::SerializedScriptValue::encode const):
2114         (WebCore::SerializedScriptValue::decode):
2115         * dom/messageports/MessageWithMessagePorts.h:
2116         (WebCore::MessageWithMessagePorts::encode const):
2117         (WebCore::MessageWithMessagePorts::decode):
2118
2119 2018-04-19  David Kilzer  <ddkilzer@apple.com>
2120
2121         Enable Objective-C weak references
2122         <https://webkit.org/b/184789>
2123         <rdar://problem/39571716>
2124
2125         Reviewed by Dan Bernstein.
2126
2127         * Configurations/Base.xcconfig:
2128         (CLANG_ENABLE_OBJC_WEAK): Enable.
2129
2130 2018-04-19  Antti Koivisto  <antti@apple.com>
2131
2132         Don't use RenderTreeBuilder::current() in RenderTreeUpdater
2133         https://bugs.webkit.org/show_bug.cgi?id=184794
2134
2135         Reviewed by Zalan Bujtas.
2136
2137         Pass the builder as a parameter where needed.
2138
2139         * rendering/updating/RenderTreeUpdater.cpp:
2140         (WebCore::RenderTreeUpdater::updateElementRenderer):
2141         (WebCore::RenderTreeUpdater::updateTextRenderer):
2142         (WebCore::RenderTreeUpdater::tearDownRenderers):
2143         (WebCore::RenderTreeUpdater::tearDownRenderer):
2144         (WebCore::RenderTreeUpdater::tearDownTextRenderer):
2145         (WebCore::RenderTreeUpdater::tearDownLeftoverPaginationRenderersIfNeeded):
2146         (WebCore::RenderTreeUpdater::tearDownLeftoverShadowHostChildren):
2147         * rendering/updating/RenderTreeUpdater.h:
2148         * rendering/updating/RenderTreeUpdaterGeneratedContent.cpp:
2149         (WebCore::RenderTreeUpdater::GeneratedContent::updatePseudoElement):
2150         (WebCore::RenderTreeUpdater::GeneratedContent::removeBeforePseudoElement):
2151         (WebCore::RenderTreeUpdater::GeneratedContent::removeAfterPseudoElement):
2152         * rendering/updating/RenderTreeUpdaterGeneratedContent.h:
2153
2154 2018-04-19  Eric Carlson  <eric.carlson@apple.com>
2155
2156         Runtime logging during GC can cause crash
2157         https://bugs.webkit.org/show_bug.cgi?id=184792
2158         <rdar://problem/39567927>
2159
2160         Reviewed by Jer Noble.
2161
2162         Test: media/destructor-logging-crash.html
2163
2164         * dom/Document.cpp:
2165         (WebCore::Document::~Document): Clear the logger observer immediately so anything logged
2166         as a side effect of the destructor won't cause a problem.
2167         (WebCore::Document::didLogMessage): Create the ConsoleMessage in a task.
2168         * dom/Document.h:
2169
2170 2018-04-19  Youenn Fablet  <youenn@apple.com>
2171
2172         Web Inspector backend should get headers & cookies from network process separately from resource requests
2173         https://bugs.webkit.org/show_bug.cgi?id=184396
2174         <rdar://problem/38877384>
2175
2176         Reviewed by Brian Burg.
2177
2178         Add two new loader strategies to get response and network metrics directly from
2179         NetworkProcess based on resource loader identifier.
2180         Use these methods in InspectorNetworkAgent when response/metrics might be filtered.
2181
2182         Covered by existing tests, in particular http/tests/inspector/network/fetch-network-data.html which would fail
2183         without this since we are now setting the sourceOrigin for NetworkResourceLoader, which is used to sanitize response headers.
2184
2185         * inspector/agents/InspectorNetworkAgent.cpp:
2186         (WebCore::InspectorNetworkAgent::didReceiveResponse):
2187         (WebCore::InspectorNetworkAgent::didFinishLoading):
2188         * loader/LoaderStrategy.cpp:
2189         (WebCore::LoaderStrategy::responseFromResourceLoaIdentifier):
2190         (WebCore::LoaderStrategy::networkMetricsFromResourceLoaIdentifier):
2191         * loader/LoaderStrategy.h:
2192
2193 2018-04-19  Wenson Hsieh  <wenson_hsieh@apple.com>
2194
2195         [Extra zoom mode] Add a mechanism to extend the height of the layout viewport in extra zoom mode
2196         https://bugs.webkit.org/show_bug.cgi?id=184782
2197         <rdar://problem/38346712>
2198
2199         Reviewed by Tim Horton.
2200
2201         Add a new helper on FrameView to compute an expanded layout viewport size, as well as a new setting for the
2202         height expansion factor when computing visual viewport dimensions. See WebKit/ChangeLog for more detail.
2203
2204         Test: fast/visual-viewport/extrazoom/layout-viewport-after-scrolling-and-resizing.html
2205
2206         * page/FrameView.cpp:
2207         (WebCore::FrameView::expandedLayoutViewportSize):
2208         * page/FrameView.h:
2209         * page/Settings.yaml:
2210
2211 2018-04-19  Chris Dumez  <cdumez@apple.com>
2212
2213         REGRESSION (r229133): decidePolicyForNavigationAction not called for loading an HTML string
2214         https://bugs.webkit.org/show_bug.cgi?id=184209
2215         <rdar://problem/39145306>
2216
2217         Reviewed by Ryosuke Niwa.
2218
2219         In r229133, we stopped doing navigation policy checks for about:blank because about:blank
2220         loads need to happen synchronously for Web-compatibility. However, this regressed loading
2221         an HTML string in a WebView because in such cases, the URL is also about:blank with
2222         substitute data.
2223
2224         In this patch, we take a more conservative approach and restore policy checking for
2225         'about:blank' but using synchronous IPC.
2226
2227         * loader/PolicyChecker.cpp:
2228         (WebCore::PolicyChecker::checkNavigationPolicy):
2229
2230 2018-04-19  Chris Nardi  <cnardi@chromium.org>
2231
2232         Support calc() in webkit-gradient and cross-fade
2233         https://bugs.webkit.org/show_bug.cgi?id=182225
2234
2235         Reviewed by Simon Fraser.
2236
2237         calc() was previously unsupported in webkit-gradient and webkit-cross-fade, but both should take calc() values.
2238         Update the code to support calc() values.
2239
2240         Tests: LayoutTests/css3/calc/cross-fade-calc.html
2241                LayoutTests/css3/calc/webkit-gradient-calc.html
2242
2243         * css/parser/CSSPropertyParserHelpers.cpp:
2244         (WebCore::CSSPropertyParserHelpers::consumeDeprecatedGradientColorStop):
2245         (WebCore::CSSPropertyParserHelpers::consumeCrossFade):
2246
2247 2018-04-17  Filip Pizlo  <fpizlo@apple.com>
2248
2249         The InternalFunction hierarchy should be in IsoSubspaces
2250         https://bugs.webkit.org/show_bug.cgi?id=184721
2251
2252         Reviewed by Saam Barati.
2253
2254         No new tests because no new behavior.
2255
2256         * bindings/js/WebCoreJSClientData.cpp:
2257         (WebCore::JSVMClientData::JSVMClientData):
2258         * bindings/js/WebCoreJSClientData.h:
2259         (WebCore::JSVMClientData::runtimeMethodSpace):
2260         * bridge/runtime_method.cpp:
2261         (JSC::RuntimeMethod::subspaceForImpl):
2262         * bridge/runtime_method.h:
2263
2264 2018-04-19  Brady Eidson  <beidson@apple.com>
2265
2266         Add globally-unique HistoryItem identifiers (and have WebKit2 adopt them).
2267         <rdar://problem/39533949> and https://bugs.webkit.org/show_bug.cgi?id=184750
2268
2269         Reviewed by Ryosuke Niwa.
2270
2271         No new tests (Refactor, no behavior change).
2272
2273         In WebCore, we:
2274         - Add a process-unique "BackForwardItemIdentifier"
2275         - Make all HistoryItems have such an identifier as a member
2276
2277         * WebCore.xcodeproj/project.pbxproj:
2278
2279         * history/BackForwardItemIdentifier.h: Added.
2280         (WebCore::BackForwardItemIdentifier::logString const):
2281         (WebCore::operator==):
2282         (WebCore::BackForwardItemIdentifier::encode const):
2283         (WebCore::BackForwardItemIdentifier::decode):
2284         (WebCore::BackForwardItemIdentifier::hash const):
2285         (WTF::BackForwardItemIdentifierHash::hash):
2286         (WTF::BackForwardItemIdentifierHash::equal):
2287         (WTF::HashTraits<WebCore::BackForwardItemIdentifier>::emptyValue):
2288         (WTF::HashTraits<WebCore::BackForwardItemIdentifier>::constructDeletedValue):
2289         (WTF::HashTraits<WebCore::BackForwardItemIdentifier>::isDeletedValue):
2290
2291         * history/HistoryItem.cpp:
2292         (WebCore::HistoryItem::generateSequenceNumber):
2293         (WebCore::HistoryItem::HistoryItem):
2294         (WebCore::generateSequenceNumber): Deleted.
2295
2296         * history/HistoryItem.h:
2297         (WebCore::HistoryItem::create):
2298         (WebCore::HistoryItem::identifier const):
2299
2300 2018-04-19  Nan Wang  <n_wang@apple.com>
2301
2302         AX: AOM: respect the accessibility setting for dispatching the accessible events
2303         https://bugs.webkit.org/show_bug.cgi?id=184619
2304
2305         Reviewed by Ryosuke Niwa.
2306
2307         Added accessibilityEventsEnabled as a setting on the page.
2308
2309         Test: accessibility/ios-simulator/accessibility-events-setting.html
2310
2311         * accessibility/AccessibilityObject.cpp:
2312         (WebCore::AccessibilityObject::shouldDispatchAccessibilityEvent const):
2313         * page/Settings.yaml:
2314         * testing/InternalSettings.cpp:
2315         (WebCore::InternalSettings::Backup::Backup):
2316         (WebCore::InternalSettings::Backup::restoreTo):
2317         (WebCore::InternalSettings::setAccessibilityEventsEnabled):
2318         * testing/InternalSettings.h:
2319         * testing/InternalSettings.idl:
2320
2321 2018-04-18  Jer Noble  <jer.noble@apple.com>
2322
2323         Fix build when WK_ALTERNATE_FRAMEWORKS_DIR is set to non-empty value
2324         https://bugs.webkit.org/show_bug.cgi?id=184693
2325         <rdar://problem/39491884>
2326
2327         Reviewed by Tim Horton.
2328
2329         * Configurations/WebCore.xcconfig:
2330
2331 2018-04-19  Eric Stobbart  <ericstobbart@gmail.com>
2332
2333         Change MediaSource WebCore to return NewObject for SourceBuffers
2334         https://bugs.webkit.org/show_bug.cgi?id=184642
2335
2336         Reviewed by Chris Dumez.
2337
2338         Minor change inline with IDL documentation
2339
2340         * Modules/mediasource/MediaSource.cpp:
2341         (WebCore::MediaSource::addSourceBuffer):
2342         (): Deleted.
2343         * Modules/mediasource/MediaSource.h:
2344         * Modules/mediasource/MediaSource.idl:
2345
2346 2018-04-19  Yusuke Suzuki  <utatane.tea@gmail.com>
2347
2348         Unreviewed, build fix for Ubuntu LTS GCC
2349         https://bugs.webkit.org/show_bug.cgi?id=184756
2350
2351         The variable name "windowProxy" (with auto&) conflicts with the function name "windowProxy".
2352
2353         * bindings/js/ScriptController.cpp:
2354         (WebCore::ScriptController::updateDocument):
2355         (WebCore::ScriptController::collectIsolatedContexts):
2356
2357 2018-04-19  Manuel Rego Casasnovas  <rego@igalia.com>
2358
2359         Caret rendered at incorrect location inside empty table cell
2360         https://bugs.webkit.org/show_bug.cgi?id=85385
2361
2362         Reviewed by Zalan Bujtas.
2363
2364         This is based on a previous patch by Shezan Baig <shezbaig.wk@gmail.com>.
2365
2366         This fixes the position of the caret in empty cells,
2367         that was painted lower than expected
2368         (and then modified when you start to edit the cell).
2369
2370         Ensures that editable table cells have at least one line when
2371         they are laid out. This ensures that the cell's intrinsic before/after
2372         padding is calculated correctly, which results in the caret location
2373         being calculated correctly.
2374
2375         Test: editing/caret/caret-in-empty-cell.html
2376
2377         * rendering/RenderTableCell.cpp:
2378         (WebCore::RenderTableCell::hasLineIfEmpty): Override method to consider
2379         that it has an an empty line if the table cell is editable.
2380         * rendering/RenderTableCell.h:
2381
2382 2018-04-18  Daniel Bates  <dabates@apple.com>
2383
2384         Cleanup TextControlInnerElements
2385         https://bugs.webkit.org/show_bug.cgi?id=184475
2386
2387         Reviewed by Antti Koivisto.
2388
2389         Clean up TextControlInnerElement::resolveCustomStyle(), move the implementation of
2390         TextControlPlaceholderElement::create() from the header to the cpp file, replace
2391         fancy comments to demarcate classes with MARK: so that they show up in Xcode's
2392         function menu.
2393
2394         * html/shadow/TextControlInnerElements.cpp:
2395         (WebCore::TextControlInnerElement::resolveCustomStyle):
2396         (WebCore::TextControlPlaceholderElement::TextControlPlaceholderElement):
2397         (WebCore::TextControlPlaceholderElement::create):
2398         * html/shadow/TextControlInnerElements.h:
2399
2400 2018-04-18  Chris Dumez  <cdumez@apple.com>
2401
2402         Rename WindowProxyController to WindowProxy
2403         https://bugs.webkit.org/show_bug.cgi?id=184756
2404
2405         Reviewed by Sam Weinig.
2406
2407         Rename WindowProxyController to WindowProxy for clarity. When the IDL uses WindowProxy, the implementation
2408         needed use WindowProxyController type, which was a bit confusing.
2409
2410         * Sources.txt:
2411         * WebCore.xcodeproj/project.pbxproj:
2412         * bindings/js/DOMWrapperWorld.cpp:
2413         (WebCore::DOMWrapperWorld::~DOMWrapperWorld):
2414         (WebCore::DOMWrapperWorld::clearWrappers):
2415         * bindings/js/DOMWrapperWorld.h:
2416         (WebCore::DOMWrapperWorld::didCreateWindowProxy):
2417         (WebCore::DOMWrapperWorld::didDestroyWindowProxy):
2418         * bindings/js/JSBindingsAllInOne.cpp:
2419         * bindings/js/JSDOMWindowBase.cpp:
2420         (WebCore::toJS):
2421         * bindings/js/JSDOMWindowProxy.cpp:
2422         (WebCore::toJS):
2423         (WebCore::toJSDOMWindowProxy):
2424         * bindings/js/JSDOMWindowProxy.h:
2425         (WebCore::toJS):
2426         (WebCore::toJSDOMWindowProxy):
2427         * bindings/js/ScriptCachedFrameData.cpp:
2428         (WebCore::ScriptCachedFrameData::ScriptCachedFrameData):
2429         (WebCore::ScriptCachedFrameData::restore):
2430         * bindings/js/ScriptController.cpp:
2431         (WebCore::ScriptController::evaluateInWorld):
2432         (WebCore::ScriptController::loadModuleScriptInWorld):
2433         (WebCore::ScriptController::linkAndEvaluateModuleScriptInWorld):
2434         (WebCore::ScriptController::evaluateModule):
2435         (WebCore::ScriptController::setupModuleScriptHandlers):
2436         (WebCore::ScriptController::windowProxy):
2437         (WebCore::ScriptController::enableEval):
2438         (WebCore::ScriptController::enableWebAssembly):
2439         (WebCore::ScriptController::disableEval):
2440         (WebCore::ScriptController::disableWebAssembly):
2441         (WebCore::ScriptController::updateDocument):
2442         (WebCore::ScriptController::collectIsolatedContexts):
2443         (WebCore::ScriptController::windowScriptNPObject):
2444         (WebCore::ScriptController::executeIfJavaScriptURL):
2445         * bindings/js/ScriptController.h:
2446         (WebCore::ScriptController::globalObject):
2447         * bindings/js/ScriptControllerMac.mm:
2448         (WebCore::ScriptController::windowScriptObject):
2449         * bindings/js/ScriptState.cpp:
2450         (WebCore::mainWorldExecState):
2451         * bindings/js/WindowProxy.cpp: Renamed from Source/WebCore/bindings/js/WindowProxyController.cpp.
2452         (WebCore::WindowProxy::WindowProxy):
2453         (WebCore::WindowProxy::~WindowProxy):
2454         (WebCore::WindowProxy::destroyJSWindowProxy):
2455         (WebCore::WindowProxy::createJSWindowProxy):
2456         (WebCore::WindowProxy::jsWindowProxiesAsVector const):
2457         (WebCore::WindowProxy::createJSWindowProxyWithInitializedScript):
2458         (WebCore::WindowProxy::clearJSWindowProxiesNotMatchingDOMWindow):
2459         (WebCore::WindowProxy::setDOMWindow):
2460         (WebCore::WindowProxy::attachDebugger):
2461         * bindings/js/WindowProxy.h: Renamed from Source/WebCore/bindings/js/WindowProxyController.h.
2462         (WebCore::WindowProxy::jsWindowProxies const):
2463         (WebCore::WindowProxy::releaseJSWindowProxies):
2464         (WebCore::WindowProxy::setJSWindowProxies):
2465         (WebCore::WindowProxy::jsWindowProxy):
2466         (WebCore::WindowProxy::existingJSWindowProxy const):
2467         (WebCore::WindowProxy::globalObject):
2468         * loader/FrameLoader.cpp:
2469         (WebCore::FrameLoader::clear):
2470         (WebCore::FrameLoader::dispatchDidClearWindowObjectInWorld):
2471         * page/AbstractFrame.cpp:
2472         (WebCore::AbstractFrame::AbstractFrame):
2473         * page/AbstractFrame.h:
2474         (WebCore::AbstractFrame::windowProxy):
2475         (WebCore::AbstractFrame::windowProxy const):
2476         * page/Page.cpp:
2477         (WebCore::Page::setDebugger):
2478         * page/RemoteDOMWindow.cpp:
2479         (WebCore::RemoteDOMWindow::self const):
2480         (WebCore::RemoteDOMWindow::top const):
2481         (WebCore::RemoteDOMWindow::opener const):
2482         (WebCore::RemoteDOMWindow::parent const):
2483         * page/RemoteDOMWindow.h:
2484
2485 2018-04-18  Chris Dumez  <cdumez@apple.com>
2486
2487         Set RemoteDOMWindow's initial opener
2488         https://bugs.webkit.org/show_bug.cgi?id=184716
2489
2490         Reviewed by Sam Weinig.
2491
2492         Add support for WindowProxy type in the IDL. The implementation should
2493         return a WindowProxyController and toJS() will take care of converting
2494         this into a JSValue via JSDOMWindowProxy.
2495
2496         No new tests, rebaselined existing test.
2497
2498         * WebCore.xcodeproj/project.pbxproj:
2499         * bindings/IDLTypes.h:
2500         * bindings/js/JSDOMConvertWindowProxy.h: Added.
2501         (WebCore::JSConverter<IDLWindowProxy>::convert):
2502         * bindings/js/JSDOMWindowBase.cpp:
2503         (WebCore::toJS):
2504         * bindings/js/JSDOMWindowBase.h:
2505         (WebCore::toJS):
2506         * bindings/js/JSDOMWindowProxy.cpp:
2507         (WebCore::toJS):
2508         (WebCore::toJSDOMWindowProxy):
2509         * bindings/js/JSDOMWindowProxy.h:
2510         (WebCore::toJS):
2511         (WebCore::toJSDOMWindowProxy):
2512         * bindings/js/JSRemoteDOMWindowBase.cpp:
2513         * bindings/js/JSRemoteDOMWindowBase.h:
2514         * bindings/scripts/CodeGenerator.pm:
2515         (IsBuiltinType):
2516         * bindings/scripts/CodeGeneratorJS.pm:
2517         (AddToIncludesForIDLType):
2518         (GetBaseIDLType):
2519         * page/RemoteDOMWindow.cpp:
2520         (WebCore::RemoteDOMWindow::self const):
2521         (WebCore::RemoteDOMWindow::top const):
2522         (WebCore::RemoteDOMWindow::opener const):
2523         (WebCore::RemoteDOMWindow::parent const):
2524         * page/RemoteDOMWindow.h:
2525         * page/RemoteDOMWindow.idl:
2526         * page/RemoteFrame.h:
2527
2528 2018-04-18  Dean Jackson  <dino@apple.com>
2529
2530         Detect system preview links
2531         https://bugs.webkit.org/show_bug.cgi?id=184753
2532         <rdar://problem/39500514>
2533
2534         Reviewed by Antoine Quint.
2535
2536         Detect a special type of link anchor, which we're calling System Previews.
2537         Ultimately this will allow WebKit to present such links in a special
2538         way.
2539
2540         A System Preview link is an <a> element, with a rel attribute that
2541         includes "system-preview". It has a single element child, which is
2542         either an <img> or a <picture>.
2543
2544         Test: system-preview/detection.html
2545
2546         * html/HTMLAnchorElement.cpp:
2547         (WebCore::HTMLAnchorElement::relList): Add braces.
2548         (WebCore::HTMLAnchorElement::isSystemPreviewLink const): New
2549         function.
2550         * html/HTMLAnchorElement.h:
2551
2552         * html/HTMLImageElement.cpp:
2553         (WebCore::HTMLImageElement::isSystemPreviewImage const): Ask the
2554         parent if it is a system preview link.
2555         * html/HTMLImageElement.h:
2556         * html/HTMLPictureElement.cpp:
2557         (WebCore::HTMLPictureElement::isSystemPreviewImage const): Ditto.
2558         * html/HTMLPictureElement.h:
2559
2560         * testing/Internals.cpp: Testing helpers.
2561         (WebCore::Internals::systemPreviewRelType):
2562         (WebCore::Internals::isSystemPreviewLink const):
2563         (WebCore::Internals::isSystemPreviewImage const):
2564         * testing/Internals.h:
2565         * testing/Internals.idl:
2566
2567 2018-04-18  Antti Koivisto  <antti@apple.com>
2568
2569         :active pseudo class doesn't deactivate when using pressure sensitive trackpad
2570         https://bugs.webkit.org/show_bug.cgi?id=181680
2571
2572         Reviewed by Beth Dakin.
2573
2574         Trackpad sends a mouse force event with force of zero after mouse up event. This causes the element under cursor
2575         activate again.
2576
2577         Even a fake event test doesn't appear to be currently possible as TestRunner crashes if you try to send mouseForceChanged.
2578         All the tests using it are skipped.
2579
2580         * page/EventHandler.cpp:
2581         (WebCore::EventHandler::handleMouseForceEvent):
2582
2583         Don't add HitTestRequest::Active if the force of the force event is zero.
2584
2585 2018-04-18  Megan Gardner  <megan_gardner@apple.com>
2586
2587         Ensure correct screen sizes
2588         https://bugs.webkit.org/show_bug.cgi?id=184757
2589         
2590         Reviewed by Wenson Hsieh.
2591         
2592         Make sure that the screen sizes are actually correct.
2593
2594         Not currently testable, will add tests when it is.
2595
2596         * platform/ios/PlatformScreenIOS.mm:
2597
2598 2018-04-18  Nan Wang  <n_wang@apple.com>
2599
2600         AX: [macOS] WebKit hangs when triggering an alert from an AOM increment event
2601         https://bugs.webkit.org/show_bug.cgi?id=184742
2602
2603         Reviewed by Chris Fleizach.
2604
2605         Made increment and decrement actions on the macOS to be async. So that VoiceOver
2606         won't hang indefinitely if performing the actions causes an alert or other modal
2607         behaviors.
2608
2609         Test: accessibility/mac/async-increment-decrement-action.html
2610
2611         * accessibility/mac/WebAccessibilityObjectWrapperMac.mm:
2612         (-[WebAccessibilityObjectWrapper accessibilityPerformIncrementAction]):
2613         (-[WebAccessibilityObjectWrapper _accessibilityPerformIncrementAction]):
2614         (-[WebAccessibilityObjectWrapper accessibilityPerformDecrementAction]):
2615         (-[WebAccessibilityObjectWrapper _accessibilityPerformDecrementAction]):
2616         (-[WebAccessibilityObjectWrapper accessibilityPerformAction:]):
2617
2618 2018-04-18  Youenn Fablet  <youenn@apple.com>
2619
2620         MediaResourceLoader should set its fetch destination
2621         https://bugs.webkit.org/show_bug.cgi?id=184746
2622
2623         Reviewed by Eric Carlson.
2624
2625         Covered by updated test.
2626
2627         * loader/MediaResourceLoader.cpp:
2628         (WebCore::MediaResourceLoader::requestResource):
2629
2630 2018-04-18  Jer Noble  <jer.noble@apple.com>
2631
2632         Fix runtime errors in simulator while playing media
2633         https://bugs.webkit.org/show_bug.cgi?id=184751
2634
2635         Reviewed by Eric Carlson.
2636
2637         AVURLAssetHTTPCookiesKey may not be present, and AVPlayer may not respond to certain methods.
2638
2639         * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
2640         (WebCore::MediaPlayerPrivateAVFoundationObjC::createAVAssetForURL):
2641         (WebCore::MediaPlayerPrivateAVFoundationObjC::createAVPlayer):
2642         (WebCore::MediaPlayerPrivateAVFoundationObjC::updateDisableExternalPlayback):
2643         (WebCore::MediaPlayerPrivateAVFoundationObjC::setShouldDisableSleep):
2644
2645 2018-04-18  Jer Noble  <jer.noble@apple.com>
2646
2647         Ignore ASSERT when setting AVAudioSessionCategory returns an error on simulator.
2648         https://bugs.webkit.org/show_bug.cgi?id=184698
2649
2650         Reviewed by Eric Carlson.
2651
2652         * platform/audio/ios/AudioSessionIOS.mm:
2653         * platform/audio/mac/AudioSessionMac.cpp:
2654
2655 2018-04-18  Sihui Liu  <sihui_liu@apple.com>
2656
2657         REGRESSION: Using the reload button while offline pushes identical pages onto the back/forward list
2658         https://bugs.webkit.org/show_bug.cgi?id=184570
2659         <rdar://problem/34807323>
2660
2661         Reviewed by Chris Dumez.
2662
2663         Set FrameLoadType properly when error occurs in reload.
2664
2665         tests: Tools/TestWebKitAPI/Tests/WebKitCocoa/LoadAlternateHTMLString.mm
2666
2667         * loader/FrameLoader.cpp:
2668         (WebCore::FrameLoader::load):
2669
2670 2018-04-18  Chris Dumez  <cdumez@apple.com>
2671
2672         Add support for converting a local window to a remote window
2673         https://bugs.webkit.org/show_bug.cgi?id=184515
2674         <rdar://problem/39011318>
2675
2676         Reviewed by Ryosuke Niwa.
2677
2678         Add initial support for process-swapping when navigating cross-origin as a result
2679         of a window.open(). The window object returned by window.open() is initially same
2680         origin and is for about:blank. The navigation cross-origin then happens and the
2681         JS wrappers for the window then point to a cross-origin window which is remote (i.e.
2682         hosted in another WebProcess).
2683
2684         The RemoteDOMWindow exposed to JS looks like a regular cross-origin Window with a few
2685         exceptions due to our incomplete implementation (e.g. w.location returns null) and 
2686         most of its API is currently not functional. The RemoteDOMWindow API will be implemented
2687         in a follow-up by relying on IPC.
2688
2689         Test: http/tests/navigation/process-swap-window-open.html
2690
2691         * bindings/js/JSDOMGlobalObject.cpp:
2692         (WebCore::JSDOMGlobalObject::scriptExecutionContext const):
2693         * bindings/js/JSDOMPromiseDeferred.h:
2694         * bindings/js/JSDOMWindowProperties.cpp:
2695         (WebCore::JSDOMWindowProperties::getOwnPropertySlot):
2696         * bindings/js/JSDOMWindowProxy.cpp:
2697         (WebCore::JSDOMWindowProxy::finishCreation):
2698         (WebCore::JSDOMWindowProxy::create):
2699         * bindings/js/JSDOMWindowProxy.h:
2700         * bindings/js/JSDOMWrapper.cpp:
2701         (WebCore::JSDOMObject::JSDOMObject):
2702         * bindings/js/JSDOMWrapper.h:
2703         * bindings/js/WindowProxyController.cpp:
2704         (WebCore::WindowProxyController::createWindowProxy):
2705         (WebCore::WindowProxyController::setDOMWindowForWindowProxy):
2706         * bridge/objc/WebScriptObject.mm:
2707         (-[WebScriptObject _isSafeScript]):
2708         Teach more of our bindings code about RemoteDOMWindows.
2709
2710         * dom/Document.cpp:
2711         (WebCore::Document::createDOMWindow):
2712         * loader/FrameLoaderClient.h:
2713         Add FrameLoaderClient function to notify the client when a DOMWindow is constructed in
2714         the frame. This is needed for WebKit2 to link the old window to its new representation
2715         in the new WebProcess.
2716
2717 2018-04-17  Zan Dobersek  <zdobersek@igalia.com>
2718
2719         [CMake] Add and enable the ENABLE_CSS_ANIMATIONS_LEVEL_2 feature define
2720         https://bugs.webkit.org/show_bug.cgi?id=184681
2721
2722         Reviewed by Carlos Garcia Campos.
2723
2724         * Sources.txt: Include CSSAnimationTriggerScrollValue.cpp in the build.
2725         * WebCore.xcodeproj/project.pbxproj: Remove CSSAnimationTriggerScrollValue.cpp
2726         build target now that it's built via Sources.txt.
2727
2728 2018-04-17  Zan Dobersek  <zdobersek@igalia.com>
2729
2730         [CoordGraphics] CoordinatedImageBacking can simplify image drawing
2731         https://bugs.webkit.org/show_bug.cgi?id=183986
2732
2733         Reviewed by Michael Catanzaro.
2734
2735         In CoordinatedImageBacking::update(), when drawing the image into a
2736         freshly-created image backing, we can avoid save-and-restoring the
2737         painting context. We also don't have to clip it, since the clipping area
2738         is the same as the image (and buffer) bounds. Since the buffer is
2739         initialized to transparent color, we can use the CompositeCopy operator
2740         to just copy image data into the destination since there's nothing to
2741         paint the source over.
2742
2743         No new tests -- no change in functionality.
2744
2745         * platform/graphics/texmap/coordinated/CoordinatedImageBacking.cpp:
2746         (WebCore::CoordinatedImageBacking::update):
2747
2748 2018-04-17  Michael Catanzaro  <mcatanzaro@igalia.com>
2749
2750         [GTK] Webkit should spoof as Safari on a Mac for Outlook.com
2751         https://bugs.webkit.org/show_bug.cgi?id=184573
2752
2753         Reviewed by Carlos Alberto Lopez Perez.
2754
2755         Add quirk for outlook.live.com.
2756
2757         * platform/UserAgentQuirks.cpp:
2758         (WebCore::urlRequiresMacintoshPlatform):
2759
2760 2018-04-17  Mark Lam  <mark.lam@apple.com>
2761
2762         Templatize CodePtr/Refs/FunctionPtrs with PtrTags.
2763         https://bugs.webkit.org/show_bug.cgi?id=184702
2764         <rdar://problem/35391681>
2765
2766         Reviewed by Filip Pizlo and Saam Barati.
2767
2768         No new tests. This is covered by existing tests.
2769
2770         * WebCore.xcodeproj/project.pbxproj:
2771         * css/ElementRuleCollector.cpp:
2772         (WebCore::ElementRuleCollector::ruleMatches):
2773         * cssjit/CSSPtrTag.h: Added.
2774         * cssjit/CompiledSelector.h:
2775         * cssjit/FunctionCall.h:
2776         (WebCore::FunctionCall::FunctionCall):
2777         (WebCore::FunctionCall::setFunctionAddress):
2778         (WebCore::FunctionCall::prepareAndCall):
2779         * cssjit/SelectorCompiler.cpp:
2780         (WebCore::SelectorCompiler::compileSelector):
2781         (WebCore::SelectorCompiler::SelectorFragment::appendUnoptimizedPseudoClassWithContext):
2782         (WebCore::SelectorCompiler::addPseudoClassType):
2783         (WebCore::SelectorCompiler::SelectorCodeGenerator::compile):
2784         (WebCore::SelectorCompiler::SelectorCodeGenerator::generateElementAttributeFunctionCallValueMatching):
2785         (WebCore::SelectorCompiler::SelectorCodeGenerator::generateElementFunctionCallTest):
2786         (WebCore::SelectorCompiler::SelectorCodeGenerator::generateContextFunctionCallTest):
2787         * cssjit/SelectorCompiler.h:
2788         (WebCore::SelectorCompiler::ruleCollectorSimpleSelectorCheckerFunction):
2789         (WebCore::SelectorCompiler::querySelectorSimpleSelectorCheckerFunction):
2790         (WebCore::SelectorCompiler::ruleCollectorSelectorCheckerFunctionWithCheckingContext):
2791         (WebCore::SelectorCompiler::querySelectorSelectorCheckerFunctionWithCheckingContext):
2792         * dom/SelectorQuery.cpp:
2793         (WebCore::SelectorDataList::executeCompiledSingleMultiSelectorData const):
2794         (WebCore::SelectorDataList::execute const):
2795         * dom/SelectorQuery.h:
2796
2797 2018-04-17  Tadeu Zagallo  <tzagallo@apple.com>
2798
2799         Retain MessagePortChannel for transfer when disentangling ports
2800         https://bugs.webkit.org/show_bug.cgi?id=184502
2801         <rdar://problem/39372771>
2802
2803         Reviewed by Geoffrey Garen.
2804
2805         MessagePortChannels should be retained while ports are being transferred, but that was only
2806         happening when sending a port through another port, but not when sending it through a worker.
2807
2808         Test: workers/worker-to-worker.html
2809
2810         * dom/messageports/MessagePortChannel.cpp:
2811         (WebCore::MessagePortChannel::entanglePortWithProcess):
2812         (WebCore::MessagePortChannel::disentanglePort):
2813         (WebCore::MessagePortChannel::postMessageToRemote):
2814         (WebCore::MessagePortChannel::takeAllMessagesForPort):
2815
2816 2018-04-17  Tadeu Zagallo  <tzagallo@apple.com>
2817
2818         References from CSSStyleDeclaration to CSSValues should be weak
2819         https://bugs.webkit.org/show_bug.cgi?id=180280
2820         <rdar://problem/35804869>
2821
2822         Reviewed by Geoffrey Garen.
2823
2824         No new tests - used the existing test to verify the leak
2825
2826         * css/DeprecatedCSSOMValue.h:
2827         (WebCore::DeprecatedCSSOMValue::weakPtrFactory):
2828         * css/PropertySetCSSStyleDeclaration.cpp:
2829         (WebCore::PropertySetCSSStyleDeclaration::wrapForDeprecatedCSSOM):
2830         * css/PropertySetCSSStyleDeclaration.h:
2831
2832 2018-04-17  Jonathan Bedard  <jbedard@apple.com>
2833
2834         Unreviewed rollout of r230632. Regression in memory usage.
2835
2836         That bug tracked in https://bugs.webkit.org/show_bug.cgi?id=184569.
2837
2838         Tests: animations/animation-internals-api-multiple-keyframes.html
2839                animations/animation-internals-api.html
2840                transitions/transition-drt-api-delay.html
2841                transitions/transition-drt-api.html
2842
2843         * page/RuntimeEnabledFeatures.h:
2844         * testing/Internals.cpp:
2845         (WebCore::Internals::pseudoElement): Deleted.
2846         * testing/Internals.h:
2847         * testing/Internals.idl:
2848
2849 2018-04-17  Tadeu Zagallo  <tzagallo@apple.com>
2850
2851         Do not unregister MessagePorts on deallocation if it has been disentangled
2852         https://bugs.webkit.org/show_bug.cgi?id=184285
2853         <rdar://problem/39256714>
2854
2855         Reviewed by Darin Adler.
2856
2857         Test: workers/message-port-gc.html
2858
2859         * dom/MessagePort.cpp:
2860         (WebCore::MessagePort::deref const):
2861
2862 2018-04-17  Basuke Suzuki  <Basuke.Suzuki@sony.com>
2863
2864         [Curl] Fix timing of reporting error to the client
2865         https://bugs.webkit.org/show_bug.cgi?id=184707
2866
2867         Before checking the result code, check the status of callback invocation and
2868         do the right thing.
2869
2870         Reviewed by Youenn Fablet.
2871
2872         No new tests because there's no new behavior.
2873
2874         * platform/network/curl/CurlRequest.cpp:
2875         (WebCore::CurlRequest::didCompleteTransfer):
2876         * platform/network/curl/CurlRequest.h:
2877         (WebCore::CurlRequest::needToInvokeDidReceiveResponse const):
2878
2879 2018-04-17  Basuke Suzuki  <Basuke.Suzuki@sony.com>
2880
2881         [Curl] Export authentication information to be used by the client.
2882         https://bugs.webkit.org/show_bug.cgi?id=184709
2883
2884         Just added getters for username and password member variables.
2885
2886         Reviewed by Alex Christensen.
2887
2888         No new tests because there's no new behavior.
2889
2890         * platform/network/curl/CurlRequest.h:
2891         (WebCore::CurlRequest::user const):
2892         (WebCore::CurlRequest::password const):
2893
2894 2018-04-17  Chris Dumez  <cdumez@apple.com>
2895
2896         REGRESSION (r229831): CMD-clicking an iCloud web app link unexpectedly opens that link in a new tab and the current tab
2897         https://bugs.webkit.org/show_bug.cgi?id=184678
2898         <rdar://problem/39422122>
2899
2900         Reviewed by Alex Christensen.
2901
2902         Frament navigations need to happen synchronously for Web-compatibility. Because of this,
2903         r225657 added code to make sure that if the client does not make the navigation policy
2904         decision synchronously for frament navigations, then we'll stop waiting for the client
2905         and proceed with the navigation. However, r229831 make the navigation policy decision
2906         IPC decision, meaning that even if the client responds synchronously, it would be
2907         asynchronously from WebCore's point of view. As a result, we would always ignore the
2908         client's policy decision when doing a fragment navigation.
2909
2910         This is an issue on iclould.com because the web-app links are fragment URLs. When you
2911         CMD+click one of these link, we do the navigation policy check. As a result of this
2912         check, Safari responds IGNORE to the policy decision and instead decides to load the
2913         link in a new tab (because CMD key is pressed). Due to the bug mentioned above, we
2914         would not obey the IGNORE policy decision from Safari and load the link in the current
2915         tab, even though Safari would already be loading it in a new tab.
2916
2917         To address the issue, I reintroduced a synchronous code path for navigation policy
2918         decision making, backed by synchronous IPC. This synchronous code path is now used for
2919         fragment navigations to restore pre-r229831 behavior. If the client does not answer
2920         synchronously, we'll proceed with the navigation anyway, as was happening pre-r229831.
2921
2922         Test: http/tests/navigation/fragment-navigation-policy-ignore.html
2923
2924         * loader/EmptyClients.cpp:
2925         (WebCore::EmptyFrameLoaderClient::dispatchDecidePolicyForNavigationAction):
2926         * loader/EmptyFrameLoaderClient.h:
2927         * loader/FrameLoader.cpp:
2928         (WebCore::FrameLoader::loadURL):
2929         (WebCore::FrameLoader::loadWithDocumentLoader):
2930         * loader/FrameLoaderClient.h:
2931         * loader/PolicyChecker.cpp:
2932         (WebCore::PolicyChecker::checkNavigationPolicy):
2933         * loader/PolicyChecker.h:
2934
2935 2018-04-17  Matt Lewis  <jlewis3@apple.com>
2936
2937         Unreviewed, rolling out r230713.
2938
2939         This caused internal build failures.
2940
2941         Reverted changeset:
2942
2943         "Implement checked cast for DDResultRef once
2944         DDResultGetTypeID() is available"
2945         https://bugs.webkit.org/show_bug.cgi?id=184554
2946         https://trac.webkit.org/changeset/230713
2947
2948 2018-04-17  Chris Dumez  <cdumez@apple.com>
2949
2950         Add bindings code for RemoteDOMWindow
2951         https://bugs.webkit.org/show_bug.cgi?id=184653
2952
2953         Reviewed by Ryosuke Niwa.
2954
2955         Add bindings code for RemoteDOMWindow. A RemoteDOMWindow behaves exactly like a cross-origin
2956         DOMWindow, which is backed by a RemoteDOMWindow object instead of a DOMWindow one. Since
2957         a RemoteDOMWindow is always cross origin, we do not need cross-origin checks and the bindings
2958         code is identical to the DOMWindow code paths from cross-origin handling.
2959
2960         No new tests, this code will be used and tested via Bug 184515.
2961
2962         * CMakeLists.txt:
2963         * DerivedSources.make:
2964         * Sources.txt:
2965         * WebCore.xcodeproj/project.pbxproj:
2966         * bindings/js/JSBindingsAllInOne.cpp:
2967         * bindings/js/JSDOMWindowCustom.cpp:
2968         (WebCore::jsDOMWindowGetOwnPropertySlotRestrictedAccess):
2969         (WebCore::JSDOMWindow::getOwnPropertySlot):
2970         (WebCore::JSDOMWindow::getOwnPropertySlotByIndex):
2971         (WebCore::addCrossOriginWindowOwnPropertyNames):
2972         * bindings/js/JSDOMWindowCustom.h:
2973
2974         * bindings/js/JSRemoteDOMWindowBase.cpp: Added.
2975         (WebCore::JSRemoteDOMWindowBase::JSRemoteDOMWindowBase):
2976         (WebCore::JSRemoteDOMWindowBase::destroy):
2977         (WebCore::JSRemoteDOMWindowBase::javaScriptRuntimeFlags):
2978         (WebCore::toJS):
2979         (WebCore::toJSRemoteDOMWindow):
2980         * bindings/js/JSRemoteDOMWindowBase.h: Added.
2981         JSRemoteDOMWindow unfortunately currently needs to be a global object because of:
2982         1. a JSProxy's target needs to be a JSGlobalObject currently
2983         2. The 'structure()->setGlobalObject(vm, &window);' call in
2984            JSDOMWindowProxy::setWindow(VM&, JSDOMGlobalObject&) which requires a JSGlobalObject.
2985         Ideally, this wouldn't be the case in the future but this would require some code refactoring.
2986         Our DOM global objects normally subclass JSDOMGlobalObject so I decided to subclass JSDOMGlobalObject,
2987         which brings some things our bindings code expect. However, subclassing JSDOMGlobalObject directly is
2988         problematic because it does not hold the m_wrapped implementation pointer. To address this issue, all
2989         our our DOM global objects have a JS*Base base class which subclasses JSDOMGlobalObject and stores the
2990         m_wrapped implementation pointer. I followed the same pattern here.
2991
2992         (WebCore::toJS):
2993         * bindings/js/JSRemoteDOMWindowCustom.cpp: Added.
2994         (WebCore::JSRemoteDOMWindow::getOwnPropertySlot):
2995         (WebCore::JSRemoteDOMWindow::getOwnPropertySlotByIndex):
2996         (WebCore::JSRemoteDOMWindow::put):
2997         (WebCore::JSRemoteDOMWindow::putByIndex):
2998         (WebCore::JSRemoteDOMWindow::deleteProperty):
2999         (WebCore::JSRemoteDOMWindow::deletePropertyByIndex):
3000         (WebCore::JSRemoteDOMWindow::getOwnPropertyNames):
3001         (WebCore::JSRemoteDOMWindow::defineOwnProperty):
3002         (WebCore::JSRemoteDOMWindow::getPrototype):
3003         (WebCore::JSRemoteDOMWindow::preventExtensions):
3004         (WebCore::JSRemoteDOMWindow::toStringName):
3005         * bindings/scripts/CodeGeneratorJS.pm:
3006         (IsDOMGlobalObject):
3007         (GenerateHeader):
3008         (GenerateOverloadDispatcher):
3009         (GenerateImplementation):
3010         * page/RemoteDOMWindow.idl: Added.
3011
3012 2018-04-17  David Kilzer  <ddkilzer@apple.com>
3013
3014         Implement checked cast for DDResultRef once DDResultGetTypeID() is available
3015         <https://webkit.org/b/184554>
3016         <rdar://problem/36241894>
3017
3018         Reviewed by Brent Fulgham.
3019
3020         * editing/cocoa/DataDetection.mm:
3021         (WebCore::detectItemAtPositionWithRange): Implement checked cast
3022         for DDResultRef.
3023
3024 2018-04-17  Said Abou-Hallawa  <sabouhallawa@apple.com>
3025
3026         Animated GIF imagery with finite looping are falling one loop short
3027         https://bugs.webkit.org/show_bug.cgi?id=183153
3028
3029         Reviewed by Simon Fraser.
3030
3031         The Netscape Looping Application Extension is a block which may be added
3032         to a GIF file to tell the viewer to loop through the entire GIF frames.
3033         This is communicated through two bytes designated for the "loopCount" in
3034         this block.
3035
3036         The entire block may not be found in the GIF, in which case the GIF is 
3037         supposed to animate its entire frames only once.
3038
3039         If the block exists and loopCount = 0, this means the image has to loop
3040         through its frames indefinitely.
3041
3042         If the block exist and loopCount > 0, this should mean the image has to
3043         loop through its frames loopCount + 1 times. The extra loop seems to be
3044         the consensus among most of the GIF generators and viewers. For example,
3045         if the image designer wants the image to loop through its frames n times:
3046         -- The GIF generator (e.g. Adobe Photoshop and https://ezgif.com/maker) 
3047            will write n - 1 for loopCount. However http://gifmaker.me and 
3048            http://gifmaker.org write n for loopCount.
3049         -- The browser (e.g. Chrome 65.0.3325 181 and FireFox Quantum 59.0.2) will
3050            translate loopCount = n - 1 to: animate GIF once + loop n - 1, which 
3051            means loop the GIF n times.
3052
3053         Because the specs are not really clear about this, we are going to consider
3054         the agreed-upon behavior among most of the web browsers the specs here.
3055
3056         * platform/graphics/cg/ImageDecoderCG.cpp:
3057         (WebCore::ImageDecoderCG::repetitionCount const):
3058         * platform/image-decoders/gif/GIFImageDecoder.cpp:
3059         (WebCore::GIFImageDecoder::repetitionCount const):
3060
3061 2018-04-17  Saam Barati  <sbarati@apple.com>
3062
3063         Add system trace points for process launch and for initializeWebProcess
3064         https://bugs.webkit.org/show_bug.cgi?id=184669
3065
3066         Reviewed by Simon Fraser.
3067
3068         No testing needed because there is no new functionality here.
3069
3070         * loader/FrameLoader.cpp:
3071         (WebCore::FrameLoader::provisionalLoadStarted):
3072         (WebCore::FrameLoader::checkLoadCompleteForThisFrame):
3073         * loader/SubresourceLoader.cpp:
3074         (WebCore::SubresourceLoader::willSendRequestInternal):
3075         (WebCore::SubresourceLoader::didFinishLoading):
3076         (WebCore::SubresourceLoader::didFail):
3077         (WebCore::SubresourceLoader::didCancel):
3078
3079 2018-04-17  Eric Carlson  <eric.carlson@apple.com>
3080
3081         [iOS] AirPlay device name is sometimes wrong
3082         https://bugs.webkit.org/show_bug.cgi?id=184543
3083         <rdar://problem/39105498>
3084
3085         Reviewed by Jer Noble.
3086
3087         No new tests, this can only be tested with a specific hardware setup.
3088
3089         * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
3090         (WebCore::exernalDeviceDisplayNameForPlayer): Get the device name from the AVOutputContext
3091         when possible.
3092
3093 2018-04-17  Carlos Alberto Lopez Perez  <clopez@igalia.com>
3094
3095         [GTK] Build fix after r230529 (WaylandCompositorDisplay leaks its wl_display)
3096         https://bugs.webkit.org/show_bug.cgi?id=184406
3097
3098         Rubber-stamped by Michael Catanzaro.
3099
3100         Fix build with clang 3.8
3101
3102         No new tests, it is a build fix.
3103
3104         * platform/graphics/wayland/PlatformDisplayWayland.cpp:
3105         (WebCore::PlatformDisplayWayland::create):
3106
3107 2018-04-16  Antoine Quint  <graouts@apple.com>
3108
3109         Layout Test animations/needs-layout.html is a flaky Image Failure.
3110         https://bugs.webkit.org/show_bug.cgi?id=172397
3111
3112         Reviewed by Dean Jackson.
3113
3114         Animations that animate a transform and uses a relative value for either the x or y components
3115         require a layout before starting, which CSSAnimationController would perform in the call to
3116         CSSAnimationControllerPrivate::animationTimerFired() made immediately after a CSS animation was
3117         created.
3118
3119         We now perform a similar task where upon setting new blending keyframes we compute a flag indicating
3120         if the keyframe effect is animating a transform with relative x or y components. Then, when we perform
3121         the first invalidation task, which runs in the next run loop after a change to the timing model has
3122         been made, such as a call to play() on a CSSAnimation made in the TreeResolver::createAnimatedElementUpdate()
3123         where the CSSAnimation was created, we call forceLayout() on this element's FrameView. We also ensure
3124         we commit animations on the compositor immediately after that too, instead of waiting until the next
3125         DisplayRefreshMonitor callback.
3126
3127         * animation/DocumentTimeline.cpp:
3128         (WebCore::DocumentTimeline::performInvalidationTask):
3129         (WebCore::DocumentTimeline::updateAnimations):
3130         * animation/KeyframeEffectReadOnly.cpp:
3131         (WebCore::KeyframeEffectReadOnly::forceLayoutIfNeeded):
3132         (WebCore::KeyframeEffectReadOnly::setBlendingKeyframes):
3133         (WebCore::KeyframeEffectReadOnly::computedNeedsForcedLayout):
3134         (WebCore::KeyframeEffectReadOnly::applyPendingAcceleratedActions):
3135         * animation/KeyframeEffectReadOnly.h:
3136
3137 2018-04-16  Pablo Saavedra  <psaavedra@igalia.com>
3138
3139         Inconsistent EGL defines in ImageBufferCairo
3140         https://bugs.webkit.org/show_bug.cgi?id=184661
3141
3142         Reviewed by Žan Doberšek.
3143
3144         On revision r219391 libepoxy is added. The headers in
3145         ImageBufferCairo.cpp become inconsistent when 2D canvas is enabled
3146         (-DENABLE_ACCELERATED_2D_CANVAS=ON) due to a redefinition error during
3147         the Webkit build:
3148
3149             ...
3150             /usr/include/GLES2/gl2.h:503:82: error: 'voi
3151             epoxy_glAttachShader(GLuint, GLuint)' redeclared as different kind
3152             of symbol
3153             GL_APICALL void         GL_APIENTRY glAttachShader (GLuint
3154             program, GLuint shader);
3155
3156         No new tests.
3157
3158         * platform/graphics/cairo/ImageBufferCairo.cpp:
3159
3160 2018-04-16  Filip Pizlo  <fpizlo@apple.com>
3161
3162         MutationObserver should be in an IsoHeap
3163         https://bugs.webkit.org/show_bug.cgi?id=184671
3164         <rdar://problem/36081981>
3165
3166         Reviewed by Sam Weinig.
3167
3168         No new tests because no new behavior.
3169
3170         * dom/MutationObserver.cpp:
3171         * dom/MutationObserver.h:
3172
3173 2018-04-16  Youenn Fablet  <youenn@apple.com>
3174
3175         Use NetworkLoadChecker to handle synchronous HTTP loads
3176         https://bugs.webkit.org/show_bug.cgi?id=184240
3177
3178         Reviewed by Chris Dumez.
3179
3180         Update LoaderStrategy::loadResourceSynchronously to pass FetchOptions directly.
3181         Update various call sites accordingly. This allows NetworkProcess to do all necessary checks.
3182         Add an option to disable security checks if NetworkProcess does it for WebProcess.
3183         This option will be also used for regular asynchronous loads in future patches.
3184
3185         Update DocumentThreadableLoader to bypass preflighting and response validation checks in case they are done in NetworkProcess.
3186
3187         Covered by existing and rebased tests.
3188
3189         * loader/CrossOriginPreflightChecker.cpp:
3190         (WebCore::CrossOriginPreflightChecker::doPreflight):
3191         * loader/DocumentThreadableLoader.cpp:
3192         (WebCore::DocumentThreadableLoader::DocumentThreadableLoader):
3193         (WebCore::DocumentThreadableLoader::loadRequest):
3194         * loader/FrameLoader.cpp:
3195         (WebCore::FrameLoader::loadResourceSynchronously):
3196         * loader/FrameLoader.h:
3197         * loader/LoaderStrategy.h:
3198         * xml/XSLTProcessorLibxslt.cpp:
3199         (WebCore::docLoaderFunc):
3200         * xml/parser/XMLDocumentParserLibxml2.cpp:
3201         (WebCore::openFunc):
3202
3203 2018-04-16  Christopher Reid  <chris.reid@sony.com>
3204
3205         [WinCairo] Media elements should be enabled by default
3206         https://bugs.webkit.org/show_bug.cgi?id=184597
3207
3208         Reviewed by Per Arne Vollan.
3209
3210         Enabling media elements by default with media foundation.
3211
3212         * page/SettingsDefaultValues.h:
3213
3214 2018-04-16  Christopher Reid  <chris.reid@sony.com>
3215
3216         [Curl] Add the Accept-Language field to curl request headers
3217         https://bugs.webkit.org/show_bug.cgi?id=184605
3218
3219         Reviewed by Alex Christensen.
3220
3221         Add Accept-Language field to curl request headers
3222
3223         * platform/network/curl/CurlRequest.cpp:
3224         * platform/network/curl/CurlRequest.h:
3225
3226 2018-04-16  Chris Dumez  <cdumez@apple.com>
3227
3228         Move more WindowProxy-related logic from ScriptController to WindowProxyController
3229         https://bugs.webkit.org/show_bug.cgi?id=184640
3230
3231         Reviewed by Ryosuke Niwa.
3232
3233         Move more WindowProxy-related logic from ScriptController to WindowProxyController,
3234         for clarity.
3235
3236         * bindings/js/JSDOMWindowProxy.cpp:
3237         (WebCore::JSDOMWindowProxy::attachDebugger):
3238         * bindings/js/JSDOMWindowProxy.h:
3239         * bindings/js/ScriptCachedFrameData.cpp:
3240         (WebCore::ScriptCachedFrameData::ScriptCachedFrameData):
3241         (WebCore::ScriptCachedFrameData::restore):
3242         * bindings/js/ScriptController.cpp:
3243         (WebCore::ScriptController::~ScriptController):
3244         (WebCore::ScriptController::initScriptForWindowProxy):
3245         * bindings/js/ScriptController.h:
3246         (WebCore::ScriptController::existingCacheableBindingRootObject const):
3247         * bindings/js/WindowProxyController.cpp:
3248         (WebCore::collectGarbageAfterWindowProxyDestruction):
3249         (WebCore::WindowProxyController::~WindowProxyController):
3250         (WebCore::WindowProxyController::clearWindowProxiesNotMatchingDOMWindow):
3251         (WebCore::WindowProxyController::setDOMWindowForWindowProxy):
3252         (WebCore::WindowProxyController::attachDebugger):
3253         * bindings/js/WindowProxyController.h:
3254         * loader/FrameLoader.cpp:
3255         (WebCore::FrameLoader::clear):
3256         * page/Page.cpp:
3257         (WebCore::Page::setDebugger):
3258
3259 2018-04-16  Thibault Saunier  <tsaunier@igalia.com>
3260
3261         [GStreamer] Set *TrackPrivateGStreamer::active based on GstStream default select in constructor
3262         https://bugs.webkit.org/show_bug.cgi?id=184652
3263
3264         Reviewed by Philippe Normand.
3265
3266         In the constructor we should mark selected streams based on the default values from GstStream,
3267         if the user changes them, they will be updated as required later on.
3268
3269         No new tests are added as we already have a few ones that are currently disabled in
3270         the mediastream testsuite. This patch is part of the work to enable them.
3271
3272         * platform/graphics/gstreamer/AudioTrackPrivateGStreamer.cpp:
3273         (WebCore::AudioTrackPrivateGStreamer::AudioTrackPrivateGStreamer):
3274         * platform/graphics/gstreamer/VideoTrackPrivateGStreamer.cpp:
3275         (WebCore::VideoTrackPrivateGStreamer::VideoTrackPrivateGStreamer):
3276
3277 2018-04-16  Thibault Saunier  <tsaunier@igalia.com>
3278
3279         [GStreamer] Set TrackPrivateBaseGStreamer metadata information even if no client is avalaible
3280         https://bugs.webkit.org/show_bug.cgi?id=184651
3281
3282         Reviewed by Philippe Normand.
3283
3284         We can't notify the client if none is connected, but still we need to fill our metadatas from
3285         the provided GstTagList, especially in the case of playbin3 where the client is not set yet
3286         at construct time but the metadata might already be preset (and won't be updated later on).
3287
3288         No new tests are added as we already have a few ones that are currently disabled in
3289         the mediastream testsuite. This patch is part of the work to enable them.
3290
3291         * platform/graphics/gstreamer/TrackPrivateBaseGStreamer.cpp:
3292         (WebCore::TrackPrivateBaseGStreamer::notifyTrackOfTagsChanged):
3293
3294 2018-04-16  Antoine Quint  <graouts@apple.com>
3295
3296         [Web Animations] Ensure we never return -0 through the API
3297         https://bugs.webkit.org/show_bug.cgi?id=184644
3298
3299         Reviewed by Dean Jackson.
3300
3301         We could sometimes return -0 instead of 0, which is surprising and leads to an error in WPT tests.
3302         This would happen when playbackRate < 0.
3303
3304         * animation/WebAnimationUtilities.h:
3305         (WebCore::secondsToWebAnimationsAPITime):
3306
3307 2018-04-15  Antoine Quint  <graouts@apple.com>
3308
3309         [Web Animations] Animations do not naturally get a finish event
3310         https://bugs.webkit.org/show_bug.cgi?id=184639
3311         <rdar://problem/39397649>
3312
3313         Reviewed by Jon Lee.
3314
3315         We must call updateFinishedState() when an animation gets sampled as it means its timeline's time has progressed
3316         and it may have crossed to a finished state. Calling updateFinishedState() when sampling means that we'll correctly
3317         set the animation's hold time to its end value, which means that currentTime() will now always be clamped to return
3318         the end time once its has reached it, so we must not schedule animations to resolve immediately anymore since otherwise
3319         they will keep being scheduled in a loop.
3320
3321         * animation/WebAnimation.cpp:
3322         (WebCore::WebAnimation::timeToNextRequiredTick const):
3323         (WebCore::WebAnimation::resolve):
3324
3325 2018-04-15  Chris Dumez  <cdumez@apple.com>
3326
3327         Change Event's returnValue so it doesn't expose a new primitive
3328         https://bugs.webkit.org/show_bug.cgi?id=184415
3329
3330         Reviewed by Darin Adler.
3331
3332         Update Event.returnValue setter to match the latest DOM specification after:
3333         - https://github.com/whatwg/dom/pull/626
3334
3335         In particular, the returnValue setter is now a no-op if the new flag value
3336         is true. If the input flag value is false, it only sets the 'canceled' flag
3337         if the event is cancelable and the event’s in passive listener flag is unset.
3338
3339         Test: imported/w3c/web-platform-tests/dom/events/Event-returnValue.html
3340
3341         * dom/Event.cpp:
3342         (WebCore::Event::setLegacyReturnValue):
3343         (WebCore::Event::setCanceledFlagIfPossible):
3344         (WebCore::Event::preventDefault):
3345         * dom/Event.h:
3346
3347 2018-04-14  Thibault Saunier  <tsaunier@igalia.com>
3348
3349         [GStreamer] Expose a method to retrieve the GstStream from a TrackPrivateBaseGStreamer
3350         https://bugs.webkit.org/show_bug.cgi?id=184620
3351
3352         Reviewed by Philippe Normand.
3353
3354         This is a minor change, a dedicated test doesn't really make sense here.
3355
3356         * platform/graphics/gstreamer/TrackPrivateBaseGStreamer.h:
3357         (WebCore::TrackPrivateBaseGStreamer::stream):
3358
3359 2018-04-13  Ryosuke Niwa  <rniwa@webkit.org>
3360
3361         WebKit crashes when libwebrtc.dylib is missing
3362         https://bugs.webkit.org/show_bug.cgi?id=184607
3363
3364         Rubber-stamped by Jer Noble.
3365
3366         Don't call LibWebRTC related code when libwebrtc is not available.
3367
3368         * dom/Document.cpp:
3369         (WebCore::Document::prepareForDestruction):
3370         (WebCore::Document::suspend):
3371
3372 2018-04-13  Chris Dumez  <cdumez@apple.com>
3373
3374         Split WindowProxy handling out of ScriptController and into a new class owned by AbstractFrame
3375         https://bugs.webkit.org/show_bug.cgi?id=184591
3376
3377         Reviewed by Sam Weinig.
3378
3379         Split WindowProxy handling out of ScriptController and into a new class owned by AbstractFrame.
3380         RemoteFrames do not need a ScriptController but do need to maintain WindowProxies.
3381         This is work towards fixing Bug 184515.
3382
3383         * Sources.txt:
3384         * WebCore.xcodeproj/project.pbxproj:
3385         * bindings/js/DOMWrapperWorld.cpp:
3386         (WebCore::DOMWrapperWorld::~DOMWrapperWorld):
3387         (WebCore::DOMWrapperWorld::clearWrappers):
3388         * bindings/js/DOMWrapperWorld.h:
3389         (WebCore::DOMWrapperWorld::didCreateWindowProxy):
3390         (WebCore::DOMWrapperWorld::didDestroyWindowProxy):
3391         * bindings/js/JSBindingsAllInOne.cpp:
3392         * bindings/js/JSDOMWindowBase.cpp:
3393         (WebCore::toJSDOMWindow):
3394         * bindings/js/JSDOMWindowProxy.cpp:
3395         (WebCore::toJS):
3396         (WebCore::toJSDOMWindowProxy):
3397         * bindings/js/ScriptCachedFrameData.cpp:
3398         (WebCore::ScriptCachedFrameData::ScriptCachedFrameData):
3399         (WebCore::ScriptCachedFrameData::restore):
3400         * bindings/js/ScriptController.cpp:
3401         (WebCore::ScriptController::~ScriptController):
3402         (WebCore::ScriptController::evaluateInWorld):
3403         (WebCore::ScriptController::loadModuleScriptInWorld):
3404         (WebCore::ScriptController::linkAndEvaluateModuleScriptInWorld):
3405         (WebCore::ScriptController::evaluateModule):
3406         (WebCore::ScriptController::clearWindowProxiesNotMatchingDOMWindow):
3407         (WebCore::ScriptController::setDOMWindowForWindowProxy):
3408         (WebCore::ScriptController::initScriptForWindowProxy):
3409         (WebCore::ScriptController::setupModuleScriptHandlers):
3410         (WebCore::ScriptController::windowProxyController):
3411         (WebCore::ScriptController::enableEval):
3412         (WebCore::ScriptController::enableWebAssembly):
3413         (WebCore::ScriptController::disableEval):
3414         (WebCore::ScriptController::disableWebAssembly):
3415         (WebCore::ScriptController::attachDebugger):
3416         (WebCore::ScriptController::updateDocument):
3417         (WebCore::ScriptController::collectIsolatedContexts):
3418         (WebCore::ScriptController::windowScriptNPObject):
3419         (WebCore::ScriptController::executeIfJavaScriptURL):
3420         * bindings/js/ScriptController.h:
3421         (WebCore::ScriptController::globalObject):
3422         * bindings/js/ScriptControllerMac.mm:
3423         (WebCore::ScriptController::windowScriptObject):
3424         * bindings/js/ScriptState.cpp:
3425         (WebCore::mainWorldExecState):
3426         * bindings/js/WindowProxyController.cpp: Added.
3427         (WebCore::WindowProxyController::WindowProxyController):
3428         (WebCore::WindowProxyController::destroyWindowProxy):
3429         (WebCore::WindowProxyController::createWindowProxy):
3430         (WebCore::WindowProxyController::windowProxies):
3431         (WebCore::WindowProxyController::createWindowProxyWithInitializedScript):
3432         * bindings/js/WindowProxyController.h: Added.
3433         (WebCore::WindowProxyController::releaseWindowProxies):
3434         (WebCore::WindowProxyController::setWindowProxies):
3435         (WebCore::WindowProxyController::windowProxy):
3436         (WebCore::WindowProxyController::existingWindowProxy const):
3437         (WebCore::WindowProxyController::globalObject):
3438         * loader/FrameLoader.cpp:
3439         (WebCore::FrameLoader::dispatchDidClearWindowObjectInWorld):
3440         * page/AbstractFrame.cpp:
3441         (WebCore::AbstractFrame::AbstractFrame):
3442         * page/AbstractFrame.h:
3443         (WebCore::AbstractFrame::windowProxyController):
3444         (WebCore::AbstractFrame::windowProxyController const):
3445
3446 2018-04-13  Brady Eidson  <beidson@apple.com>
3447
3448         Introduce SuspendedPageProxy to keep old web processes around after their WebPageProxy has been swapped to a new one.
3449         https://bugs.webkit.org/show_bug.cgi?id=184559
3450
3451         Reviewed by Alex Christensen.
3452
3453         Covered by new API test.
3454
3455         WebCore changes rework the meaning of a "ForSuspension" policy to simply navigate the page to about:blank.
3456
3457         * loader/DocumentLoader.cpp:
3458         (WebCore::DocumentLoader::redirectReceived):
3459         (WebCore::DocumentLoader::willSendRequest):
3460         (WebCore::DocumentLoader::startLoadingMainResource):
3461         * loader/DocumentLoader.h:
3462
3463         * loader/FrameLoader.cpp:
3464         (WebCore::FrameLoader::init):
3465         (WebCore::FrameLoader::continueLoadAfterNavigationPolicy):
3466
3467 2018-04-13  Chris Dumez  <cdumez@apple.com>
3468
3469         input.webkitEntries does not work as expected when folder contains accented chars
3470         https://bugs.webkit.org/show_bug.cgi?id=184517
3471         <rdar://problem/39265537>
3472
3473         Reviewed by Alex Christensen.
3474
3475         Use String::fromUTF8() to construct a WTF String from the char* returned by
3476         dirname() in FileSystem::directoryName(). Previously, we were just calling
3477         the String constructor, which would treat the input as latin 1 instead of
3478         UTF-8.
3479
3480         Change is covered by an API test rather than a layout test due to file versioning
3481         limitations.
3482
3483         * platform/posix/FileSystemPOSIX.cpp:
3484         (WebCore::FileSystem::directoryName):
3485
3486 2018-04-13  Yusuke Suzuki  <utatane.tea@gmail.com>
3487
3488         [WebCore] Use @getByIdDirectPrivate / @putByIdDirectPrivate in WebCore JS
3489         https://bugs.webkit.org/show_bug.cgi?id=184401
3490
3491         Rubber stamped by Saam Barati.
3492
3493         Apply bug 183970 changes to WebCore JS too. This offers solid type checking
3494         with @getByIdDirectPrivate().
3495
3496         * Modules/mediastream/RTCPeerConnection.js:
3497         (initializeRTCPeerConnection):
3498         (getLocalStreams):
3499         (getStreamById):
3500         (addStream):
3501         * Modules/mediastream/RTCPeerConnectionInternals.js:
3502         (isRTCPeerConnection):
3503         * Modules/streams/ReadableByteStreamController.js:
3504         (enqueue):
3505         (error):
3506         (close):
3507         (getter.byobRequest):
3508         * Modules/streams/ReadableByteStreamInternals.js:
3509         (privateInitializeReadableStreamBYOBReader):
3510         (privateInitializeReadableByteStreamController):
3511         (privateInitializeReadableStreamBYOBRequest):
3512         (isReadableByteStreamController):
3513         (isReadableStreamBYOBRequest):
3514         (isReadableStreamBYOBReader):
3515         (readableByteStreamControllerCancel):
3516         (readableByteStreamControllerError):
3517         (readableByteStreamControllerClose):
3518         (readableByteStreamControllerClearPendingPullIntos):
3519         (readableByteStreamControllerGetDesiredSize):
3520         (readableStreamHasBYOBReader):
3521         (readableStreamHasDefaultReader):
3522         (readableByteStreamControllerHandleQueueDrain):
3523         (readableByteStreamControllerPull):
3524         (readableByteStreamControllerShouldCallPull):
3525         (readableByteStreamControllerCallPullIfNeeded):
3526         (readableByteStreamControllerEnqueue):
3527         (readableByteStreamControllerEnqueueChunk):
3528         (readableByteStreamControllerRespondWithNewView):
3529         (readableByteStreamControllerRespond):
3530         (readableByteStreamControllerRespondInternal):
3531         (readableByteStreamControllerRespondInReadableState):
3532         (readableByteStreamControllerRespondInClosedState):
3533         (readableByteStreamControllerProcessPullDescriptors):
3534         (readableByteStreamControllerFillDescriptorFromQueue):
3535         (readableByteStreamControllerShiftPendingDescriptor):
3536         (readableByteStreamControllerInvalidateBYOBRequest):
3537         (readableByteStreamControllerCommitDescriptor):
3538         (readableStreamFulfillReadIntoRequest):
3539         (readableByteStreamControllerPullInto):
3540         (readableStreamAddReadIntoRequest):
3541         * Modules/streams/ReadableStream.js:
3542         (initializeReadableStream):
3543         (pipeThrough):
3544         * Modules/streams/ReadableStreamBYOBReader.js:
3545         (cancel):
3546         (read):
3547         (releaseLock):
3548         (getter.closed):
3549         * Modules/streams/ReadableStreamBYOBRequest.js:
3550         (respond):
3551         (respondWithNewView):
3552         (getter.view):
3553         * Modules/streams/ReadableStreamDefaultController.js:
3554         (error):
3555         * Modules/streams/ReadableStreamDefaultReader.js:
3556         (cancel):
3557         (read):
3558         (releaseLock):
3559         (getter.closed):
3560         * Modules/streams/ReadableStreamInternals.js:
3561         (privateInitializeReadableStreamDefaultReader):
3562         (readableStreamReaderGenericInitialize):
3563         (readableStreamDefaultControllerError):
3564         (readableStreamPipeTo):
3565         (readableStreamTee):
3566         (isReadableStream):
3567         (isReadableStreamDefaultReader):
3568         (isReadableStreamDefaultController):
3569         (readableStreamError):
3570         (readableStreamDefaultControllerCallPullIfNeeded):
3571         (readableStreamDefaultControllerGetDesiredSize):
3572         (readableStreamReaderGenericCancel):
3573         (readableStreamCancel):
3574         (readableStreamDefaultControllerCancel):
3575         (readableStreamDefaultControllerPull):
3576         (readableStreamDefaultControllerClose):
3577         (readableStreamClose):
3578         (readableStreamFulfillReadRequest):
3579         (readableStreamDefaultReaderRead):
3580         (readableStreamAddReadRequest):
3581         (isReadableStreamDisturbed):
3582         (readableStreamReaderGenericRelease):
3583         (readableStreamDefaultControllerCanCloseOrEnqueue):
3584         (privateInitializeReadableStreamDefaultController): Deleted.
3585         * Modules/streams/StreamInternals.js:
3586         (validateAndNormalizeQueuingStrategy):
3587         * Modules/streams/WritableStream.js:
3588         (initializeWritableStream):
3589         (abort):
3590         (close):
3591         (write):
3592         (getter.closed):
3593         (getter.ready):
3594         (getter.state):
3595         * Modules/streams/WritableStreamInternals.js:
3596         (isWritableStream):
3597         (syncWritableStreamStateWithQueue):
3598         (errorWritableStream):
3599         (callOrScheduleWritableStreamAdvanceQueue):
3600         * bindings/js/JSDOMBindingInternals.js:
3601         (mapLikeForEach):
3602
3603 2018-04-12  Antoine Quint  <graouts@apple.com>
3604
3605         [Web Animations] Turn CSS Animations and CSS Transitions as Web Animations on by default
3606         https://bugs.webkit.org/show_bug.cgi?id=184569
3607         <rdar://problem/38671301>
3608
3609         Reviewed by Jon Lee.
3610
3611         We now set the CSS Animations and CSS Transitions as Web Animations flag on by default. To ensure that some remaining
3612         tests pass with this flag on, we expose a way to get to a PseudoElement via a new internals.pseudoElement() method. This
3613         allows tests that used internals.pauseAnimationAtTimeOnPseudoElement() and internals.pauseTransitionAtTimeOnPseudoElement()
3614         to now work with the Web Animations API.
3615
3616         * page/RuntimeEnabledFeatures.h:
3617         * testing/Internals.cpp:
3618         (WebCore::Internals::pseudoElement):
3619         * testing/Internals.h:
3620         * testing/Internals.idl:
3621
3622 2018-04-13  Sergio Villar Senin  <svillar@igalia.com>
3623
3624         [WebVR][OpenVR] Implement requestPresent()/exitPresent() and getLayers()
3625         https://bugs.webkit.org/show_bug.cgi?id=184530
3626
3627         Reviewed by Žan Doberšek.
3628
3629         WebVR apps should invoke requestPresent() to start presenting contents of a VRLayerInit
3630         (right now a HTML canvas with a WebGL context) on the VRDisplay. This request might fail for
3631         a variety of reasons and can be eventually cancelled with exitPresent(). Once we are
3632         presenting we could access the presenting layers (right now just one) with getLayers().
3633
3634         Note that we are not presenting anything to the HMD yet, that will be done later in a follow
3635         up patch.
3636
3637         I took the chance to correct a mistak in the VRDisplayCapabilities object which has a method
3638         that should be called maxLayers instead of maxLayer.
3639
3640         * Modules/webvr/VRDisplay.cpp:
3641         (WebCore::VRDisplay::requestPresent):
3642         (WebCore::VRDisplay::stopPresenting):
3643         (WebCore::VRDisplay::exitPresent):
3644         (WebCore::VRDisplay::getLayers const):
3645         (WebCore::VRDisplay::isPresenting const): Deleted. Implemented in the header file.
3646         * Modules/webvr/VRDisplay.h:
3647         (WebCore::VRDisplay::isPresenting const):
3648         * Modules/webvr/VRDisplayCapabilities.h:
3649         (WebCore::VRDisplayCapabilities::maxLayers const): Renamed from maxLayer().
3650         (WebCore::VRDisplayCapabilities::maxLayer const): Deleted.
3651         * Modules/webvr/VRDisplayCapabilities.idl:
3652
3653 2018-04-13  Miguel Gomez  <magomez@igalia.com>
3654
3655         REGRESSION(r230627): [GTK][WPE] Possible deadlock when destroying the player in non AC mode
3656         https://bugs.webkit.org/show_bug.cgi?id=184583
3657
3658         Reviewed by Carlos Garcia Campos.
3659
3660         In non AC mode, ensure that a deadlock can't happen when destroying MediaPlayerPrivateGStreamerBase.
3661
3662         Covered by existent tests.
3663
3664         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp:
3665         (WebCore::MediaPlayerPrivateGStreamerBase::~MediaPlayerPrivateGStreamerBase):
3666         (WebCore::MediaPlayerPrivateGStreamerBase::triggerRepaint):
3667         (WebCore::MediaPlayerPrivateGStreamerBase::cancelRepaint):
3668         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.h:
3669
3670 2018-04-13  Miguel Gomez  <magomez@igalia.com>
3671
3672         [GTK] [gstreamer] video won't unpause when built with -DUSE_GSTREAMER_GL=OFF
3673         https://bugs.webkit.org/show_bug.cgi?id=183362
3674
3675         Reviewed by Carlos Garcia Campos.
3676
3677         Remove the drawCancelled flag and use a new one to indicate that the player is being destroyed.
3678         That new flag is only enabled on destruction and it's not modified by cancelRepaint(), which
3679         can be used to handle the pause event without avoiding future renderings. Also cancelRepaint()
3680         has only effect when not in AC mode.
3681
3682         Covered by existent tests.
3683
3684         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp:
3685         (WebCore::MediaPlayerPrivateGStreamerBase::~MediaPlayerPrivateGStreamerBase):
3686         (WebCore::MediaPlayerPrivateGStreamerBase::triggerRepaint):
3687         (WebCore::MediaPlayerPrivateGStreamerBase::cancelRepaint):
3688         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.h:
3689
3690 2018-04-13  Xabier Rodriguez Calvar  <calvaris@igalia.com>
3691
3692         [GStreamer] Convert GStreamerUtilities in GStreamerCommon and include the GStreamer smart pointer traits
3693         https://bugs.webkit.org/show_bug.cgi?id=184533
3694
3695         Reviewed by Philippe Normand.
3696
3697         Renamed GStreamerUtilities* files into GStreamerCommon* and
3698         modified files including them accordingly. Include
3699         GRefPtrGStreamer.h and GUniquePtrGStreamer.h in GStreamerCommon.h
3700         to avoid problems destroying objects when those files are
3701         forgotten to be included.
3702
3703         * Modules/webaudio/AudioContext.cpp:
3704         * platform/GStreamer.cmake:
3705         * platform/audio/gstreamer/WebKitWebAudioSourceGStreamer.cpp:
3706         * platform/graphics/gstreamer/AudioTrackPrivateGStreamer.h:
3707         * platform/graphics/gstreamer/GStreamerCommon.cpp: Renamed from Source/WebCore/platform/graphics/gstreamer/GStreamerUtilities.cpp.
3708         * platform/graphics/gstreamer/GStreamerCommon.h: Renamed from Source/WebCore/platform/graphics/gstreamer/GStreamerUtilities.h.
3709         * platform/graphics/gstreamer/ImageGStreamer.h:
3710         * platform/graphics/gstreamer/ImageGStreamerCairo.cpp:
3711         * platform/graphics/gstreamer/InbandTextTrackPrivateGStreamer.cpp:
3712         * platform/graphics/gstreamer/InbandTextTrackPrivateGStreamer.h:
3713         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:
3714         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.h:
3715         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp:
3716         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.h:
3717         * platform/graphics/gstreamer/MediaSampleGStreamer.cpp:
3718         * platform/graphics/gstreamer/MediaSampleGStreamer.h:
3719         * platform/graphics/gstreamer/TextCombinerGStreamer.cpp:
3720         * platform/graphics/gstreamer/TrackPrivateBaseGStreamer.cpp:
3721         * platform/graphics/gstreamer/TrackPrivateBaseGStreamer.h:
3722         * platform/graphics/gstreamer/VideoSinkGStreamer.cpp:
3723         * platform/graphics/gstreamer/VideoTrackPrivateGStreamer.h:
3724         * platform/graphics/gstreamer/WebKitWebSourceGStreamer.cpp:
3725         * platform/graphics/gstreamer/eme/GStreamerEMEUtilities.cpp:
3726         * platform/graphics/gstreamer/eme/GStreamerEMEUtilities.h:
3727         * platform/graphics/gstreamer/eme/WebKitClearKeyDecryptorGStreamer.cpp:
3728         * platform/graphics/gstreamer/eme/WebKitCommonEncryptionDecryptorGStreamer.cpp:
3729         * platform/graphics/gstreamer/mse/AppendPipeline.cpp:
3730         * platform/graphics/gstreamer/mse/AppendPipeline.h:
3731         * platform/graphics/gstreamer/mse/GStreamerMediaDescription.cpp:
3732         * platform/graphics/gstreamer/mse/GStreamerMediaDescription.h:
3733         * platform/graphics/gstreamer/mse/MediaPlayerPrivateGStreamerMSE.cpp:
3734         * platform/graphics/gstreamer/mse/MediaPlayerPrivateGStreamerMSE.h:
3735         * platform/graphics/gstreamer/mse/MediaSourceClientGStreamerMSE.h:
3736         * platform/graphics/gstreamer/mse/PlaybackPipeline.cpp:
3737         * platform/graphics/gstreamer/mse/SourceBufferPrivateGStreamer.cpp:
3738         * platform/graphics/gstreamer/mse/WebKitMediaSourceGStreamer.cpp:
3739         * platform/graphics/gstreamer/mse/WebKitMediaSourceGStreamer.h:
3740
3741 2018-04-12  Christopher Reid  <chris.reid@sony.com>
3742
3743         [Curl] Fix clang build error in CurlContext.cpp
3744         https://bugs.webkit.org/show_bug.cgi?id=184561
3745
3746         Reviewed by Darin Adler.
3747
3748         MSVC allows explicit template specialization in classes but gcc/clang do not.
3749
3750         * platform/network/curl/CurlContext.cpp:
3751
3752 2018-04-12  Christopher Reid  <chris.reid@sony.com>
3753
3754         [Curl] Cookie Database on memory path should be :memory:
3755         https://bugs.webkit.org/show_bug.cgi?id=184572
3756
3757         Reviewed by Alex Christensen.
3758
3759         CookieJarDB::isOnMemory is comparing the database path with :onmemory: but it should be using :memory:
3760         For reference, see: https://www.sqlite.org/inmemorydb.html
3761
3762         * platform/network/curl/CookieJarDB.h:
3763
3764 2018-04-12  Daniel Bates  <dabates@apple.com>
3765
3766         Attmept to fix the Windows build following <https://trac.webkit.org/changeset/230602/>
3767         (https://bugs.webkit.org/show_bug.cgi?id=184386)
3768
3769         Visual Studio cannot prove that all cases in the switch are covered :(
3770         So, add an ASSERT_NOT_REACHED() and a return a value outside of the switch block. 
3771
3772         * loader/cache/CachedResourceLoader.cpp:
3773         (WebCore::destinationForType):
3774
3775 2018-04-12  Chris Dumez  <cdumez@apple.com>
3776
3777         Introduce remote variants of Frame / DOMWindow classes
3778         https://bugs.webkit.org/show_bug.cgi?id=184467
3779         <rdar://problem/39011267>
3780
3781         Reviewed by Ryosuke Niwa.
3782
3783         Introduce remote variants of Frame / DOMWindow classes, for when these frames / windows
3784         are hosted on another WebProcess. Those will be used in a follow-up patch.
3785
3786         The hierarchy is as follows (class naming will be improved in a follow-up patch to minimise
3787         patch size):
3788         - AbstractFrame: A frame that can be either local or remote (hosted on another WebProcess)
3789             - Frame: A local frame
3790             - RemoteFrame: A frame hosted on another WebProcess. A RemoteFrame's window is also remote.
3791         - AbstractDOMWindow: A window that be either local or remote (hosted on another WebProcess)
3792             - DOMWindow: A local DOMWindow
3793             - RemoteDOMWindow: A window hosted on another WebProcess. A RemoteDOMWindow's frame is also
3794               remote. A RemoteDOMWindow is always cross-origin.
3795
3796         This patch introduces global identifiers (unique across all WebProcesses) for both Frames and
3797         Windows. This is useful as we need to know which Frame / DOMWindow a particular RemoteFrame /
3798         RemoteDOMWindow is pointing to.
3799
3800         Follow-up patch will add support for converting a local DOMWindow / Frame into a remote ones,
3801         when a newly opened window (via window.open) is navigated cross-origin (Bug 184515).
3802
3803         Other things we'll need to implement in follow-ups:
3804         - RemoteDOMWindow will need to know about its opener in order to support the window.opener
3805           API. Internally, the opener will be stored as a RemoteFrame so that window.opener always
3806           returns the current window in the opener frame (which changes upon navigation).
3807         - Nullify a RemoteDOMWindow's frame whenever the window it is pointing to becomes frameless.
3808           A frameless window behaves very differently (e.g. very little API is exposed to the Web).
3809           This happens when either the newly opened window is either closed or navigated.
3810
3811         * Sources.txt:
3812         * WebCore.xcodeproj/project.pbxproj:
3813         * loader/ContentFilter.cpp:
3814         (WebCore::ContentFilter::didDecide):
3815         * page/AbstractDOMWindow.cpp: Added.
3816         (WebCore::AbstractDOMWindow::AbstractDOMWindow):
3817         (WebCore::AbstractDOMWindow::~AbstractDOMWindow):
3818         * page/AbstractDOMWindow.h: Added.
3819         (WebCore::AbstractDOMWindow::identifier const):
3820         * page/AbstractFrame.cpp: Added.
3821         (WebCore::AbstractFrame::AbstractFrame):
3822         (WebCore::AbstractFrame::~AbstractFrame):
3823         * page/AbstractFrame.h: Added.
3824         (WebCore::AbstractFrame::window const):
3825         * page/DOMWindow.cpp:
3826         (WebCore::DOMWindow::DOMWindow):
3827         * page/DOMWindow.h:
3828         (isType):
3829         * page/Frame.cpp:
3830         (WebCore::Frame::window const):
3831         (WebCore::Frame::virtualWindow const):
3832         * page/Frame.h:
3833         (isType):
3834         * page/GlobalFrameIdentifier.h: Added.
3835         (WebCore::GlobalFrameIdentifier::encode const):
3836         (WebCore::GlobalFrameIdentifier::decode):
3837         * page/GlobalWindowIdentifier.h: Added.
3838         (WebCore::operator==):
3839         (WebCore::GlobalWindowIdentifier::hash const):
3840         (WebCore::GlobalWindowIdentifier::encode const):
3841         (WebCore::GlobalWindowIdentifier::decode):
3842         (WTF::GlobalWindowIdentifierHash::hash):
3843         (WTF::GlobalWindowIdentifierHash::equal):
3844         (WTF::HashTraits<WebCore::GlobalWindowIdentifier>::emptyValue):
3845         (WTF::HashTraits<WebCore::GlobalWindowIdentifier>::constructDeletedValue):
3846         (WTF::HashTraits<WebCore::GlobalWindowIdentifier>::isDeletedValue):
3847
3848         * page/RemoteDOMWindow.cpp: Added.
3849         (WebCore::RemoteDOMWindow::RemoteDOMWindow):
3850         (WebCore::RemoteDOMWindow::~RemoteDOMWindow):
3851         (WebCore::RemoteDOMWindow::self const):
3852         (WebCore::RemoteDOMWindow::location const):
3853         (WebCore::RemoteDOMWindow::close):
3854         (WebCore::RemoteDOMWindow::closed const):
3855         (WebCore::RemoteDOMWindow::focus):
3856         (WebCore::RemoteDOMWindow::blur):
3857         (WebCore::RemoteDOMWindow::length const):
3858         (WebCore::RemoteDOMWindow::top const):
3859         (WebCore::RemoteDOMWindow::opener const):
3860         (WebCore::RemoteDOMWindow::parent const):
3861         (WebCore::RemoteDOMWindow::postMessage):
3862         The DOM API exposed on RemoteDOMWindow is only the subset of the DOMWindow API that is exposed cross origin,
3863         since remote DOMWindow are always from a different origin. The short-term plan is to implement these in a
3864         follow-up by relying on IPC (synchronous when necessary) to fetch the information from the real window in
3865         the WebProcess where it lives. Longer term, we should probably keep RemoteDOMWindow members in sync with the
3866         DOMWindow they're pointing to, so we do not have to rely on synchronous IPC.
3867
3868         * page/RemoteDOMWindow.h: Added.
3869         (isType):
3870         * page/RemoteFrame.cpp: Added.
3871         (WebCore::RemoteFrame::RemoteFrame):
3872         (WebCore::RemoteFrame::~RemoteFrame):
3873         (WebCore::RemoteFrame::virtualWindow const):
3874         * page/RemoteFrame.h: Added.
3875         (isType):
3876
3877 2018-04-12  Daniel Bates  <dabates@apple.com>
3878
3879         Content-Type not enforced for <script> allows for XSS
3880         https://bugs.webkit.org/show_bug.cgi?id=184386
3881         <rdar://problem/39112268>
3882
3883         Reviewed by Brady Eidson.
3884
3885         As per the Fetch standard, <https://fetch.spec.whatwg.org/#should-response-to-request-be-blocked-due-to-mime-type?> (16 March 2018),
3886         we should block JavaScript scripts that are served with MIME type text/csv, or a MIME type
3887         that begins with "audio/", "image/" or "video/".
3888
3889         As a side benefit of this change we now set the destination property [1] on preload requests.
3890
3891         [1] <https://fetch.spec.whatwg.org/#concept-request-destination>
3892
3893         Tests: http/tests/security/script-with-banned-mimetype.html
3894                http/tests/workers/worker-importScripts-banned-mimetype.html
3895
3896         * Sources.txt: Add file FetchIdioms.cpp.
3897         * WebCore.xcodeproj/project.pbxproj: Add files FetchIdioms.{cpp, h}.
3898         * dom/LoadableClassicScript.cpp:
3899         (WebCore::LoadableClassicScript::notifyFinished): Check the MIME type of the response and
3900         block the script if applicable.
3901         * dom/LoadableScript.h: Add error type MIMEType.
3902         * loader/FetchIdioms.cpp: Added.
3903         (WebCore::shouldBlockResponseDueToMIMEType): Implements the "Should response to request be blocked
3904         due to its MIME type?" algorithm from the Fetch standard.
3905         * loader/FetchIdioms.h: Added.
3906         * loader/FetchOptions.h:
3907         (WebCore::isScriptLikeDestination): Implements the definition of "script like" as per <https://fetch.spec.whatwg.org/#request-destination-script-like>.
3908         * loader/cache/CachedResourceLoader.cpp:
3909         (WebCore::CachedResourceLoader::requestImage): Removed logic to set the destination property as
3910         CachedResourceLoader::requestResource() is now responsible for doing this.
3911         (WebCore::CachedResourceLoader::requestFont): Ditto.
3912         (WebCore::CachedResourceLoader::requestTextTrack): Ditto.
3913         (WebCore::CachedResourceLoader::requestCSSStyleSheet): Ditto.
3914         (WebCore::CachedResourceLoader::requestScript): Ditto.
3915         (WebCore::CachedResourceLoader::requestXSLStyleSheet): Ditto.
3916         (WebCore::CachedResourceLoader::requestMedia): Update comment to express that we should assert
3917         that the destination property is either video or audio.
3918         (WebCore::CachedResourceLoader::requestIcon): Remove logic to set the destination property as
3919         CachedResourceLoader::requestResource() is now responsible for doing this.
3920         (WebCore::CachedResourceLoader::requestRawResource): Removed assertion as this function is used to
3921         load many kinds of requests that have different destination properties. The caller is responsible
3922         for setting the appropriate destintion property.
3923         (WebCore::CachedResourceLoader::requestMainResource): Remove logic to set the destination property
3924         as CachedResourceLoader::requestResource() is now responsible for doing this.
3925         (WebCore::destinationForType): Helper function that maps CachedResource::Type to FetchOptions::Destination.
3926         (WebCore::CachedResourceLoader::requestResource): Set the destination property on the request if not
3927         already set.
3928         * loader/cache/CachedResourceLoader.h: Segregate requestRawResource() from the other request functions
3929         and add a comment to explain what it is used for.
3930         * workers/Worker.cpp:
3931         (WebCore::Worker::create):
3932         * workers/WorkerScriptLoader.cpp:
3933         (WebCore::WorkerScriptLoader::loadSynchronously): Set the destination property to FetchOptions::Destination::Script
3934         and store it in an instance variable as we will need to reference it once we receive the HTTP response.
3935         Note that this function is only used to support the Web API importScripts().
3936         (WebCore::WorkerScriptLoader::loadAsynchronously): Store the passed destination property in an
3937         instance as we will need to reference it once we receive the HTTP response.
3938         (WebCore::WorkerScriptLoader::didReceiveResponse): Check the MIME type of the response and
3939         block the script if applicable.
3940         * workers/WorkerScriptLoader.h:
3941         * workers/service/ServiceWorkerJob.cpp: