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