b45afb3db2898492d85d8febe7f657ad11a0af5b
[WebKit-https.git] / Source / WebCore / ChangeLog
1 2018-05-01  Yusuke Suzuki  <utatane.tea@gmail.com>
2
3         Use pointer instead of std::optional<std::reference_wrapper<>>
4         https://bugs.webkit.org/show_bug.cgi?id=185186
5
6         Reviewed by Alex Christensen.
7
8         std::optional<T&> is not accepted in C++17 spec. So we replaced it
9         with std::optional<std::reference_wrapper<T>>.
10
11         In this patch, we replace it with T*, which is well-aligned to
12         WebKit's convention.
13
14         * Modules/mediastream/RTCPeerConnection.cpp:
15         (WebCore::iceServersFromConfiguration):
16         (WebCore::RTCPeerConnection::initializeConfiguration):
17         (WebCore::RTCPeerConnection::setConfiguration):
18         * css/parser/CSSParser.cpp:
19         (WebCore::CSSParser::parseSystemColor):
20         * css/parser/CSSParser.h:
21         * dom/DatasetDOMStringMap.cpp:
22         (WebCore::DatasetDOMStringMap::item const):
23         (WebCore::DatasetDOMStringMap::namedItem const):
24         * dom/DatasetDOMStringMap.h:
25         * dom/Element.cpp:
26         (WebCore::Element::insertAdjacentHTML):
27         * dom/Element.h:
28         * html/canvas/CanvasStyle.cpp:
29         (WebCore::parseColor):
30         * inspector/DOMEditor.cpp:
31         * platform/network/curl/CurlFormDataStream.cpp:
32         (WebCore::CurlFormDataStream::getPostData):
33         * platform/network/curl/CurlFormDataStream.h:
34         * platform/network/curl/CurlRequest.cpp:
35         (WebCore::CurlRequest::setupPOST):
36         * testing/MockCDMFactory.cpp:
37         (WebCore::MockCDMFactory::keysForSessionWithID const):
38         (WebCore::MockCDMInstance::updateLicense):
39         * testing/MockCDMFactory.h:
40
41 2018-05-02  Keith Rollin  <krollin@apple.com>
42
43         Add facility for tracking times and results of page and resource loading
44         https://bugs.webkit.org/show_bug.cgi?id=184838
45         <rdar://problem/36548974>
46
47         Reviewed by Brent Fulgham.
48
49         Update FrameProgressTracker to send the necessary page load start/stop
50         signals so that we can track the entire page load at a network level.
51         Add an empty override of the pure virtual
52         LoaderStrategy::pageLoadCompleted method.
53
54         No new tests. There is no testable effect from these changes. On
55         Cocoa, measurable changes take place in another (non-WebKit) process.
56         On non-Cocoa systems, this facility is currently disabled.
57
58         * loader/FrameLoader.cpp:
59         (WebCore::FrameLoader::FrameProgressTracker::progressCompleted):
60         * loader/LoaderStrategy.h:
61
62 2018-05-02  Aditya Keerthi  <akeerthi@apple.com>
63
64         Can't copy and paste URLs that have no title into Mail (macOS)
65         https://bugs.webkit.org/show_bug.cgi?id=185205
66         <rdar://problem/36352406>
67
68         Reviewed by Tim Horton.
69
70         The pasteboardURL generated has an empty title for URLs without titles. Currently, the pasteboardURL.title is being saved to the pasteboard.
71
72         To fix the error, we check whether the title is empty and instead save the lastPathComponent to the pasteboard. This matches current behavior as the fallback title.
73
74         Augmented WebKitLegacy.ContextMenuCanCopyURL test
75
76         * platform/mac/PasteboardMac.mm:
77         (WebCore::writeURLForTypes):
78
79 2018-05-01  Ryosuke Niwa  <rniwa@webkit.org>
80
81         REGRESSION(r225868): Release assert when removing an SVGUseElement from Document::m_svgUseElements
82         https://bugs.webkit.org/show_bug.cgi?id=182188
83         <rdar://problem/36689240>
84
85         Reviewed by Antti Koivisto.
86
87         Fixed the crash by removing up the release assert.
88
89         The crash is likely caused by re-entrancy to Document::resolveStyle during SVGUseElement::updateShadowTree.
90         Because Document::resolveStyle invokes updateShadowTree on SVG use elements in Document::m_svgUseElements
91         without clearing the map, the nested call to resolveStyle ends up calling updateShadowTree() for all elements
92         in m_svgUseElements and removing them all from the map. When the stack frame eventually comes back to the outer
93         invocation of Document::resolveStyle, updateShadowTree gets invoked for the second time on SVG use elements
94         whose shadow tree had already been updated within the inner invocation to updateShadowTree, and release-asserts.
95
96         There is an alternative fix: avoid calling updateShadowTree on a svg element when shadowTreeNeedsUpdate returns
97         true on the element in resolveStyle. However, removing the release assert is a sure way to fix the crash so
98         this patch opts for that fix instead especially since we don't have any reproducible test case for this crash.
99
100         This release assertion was added in r225868 as a cautious measure to catch any use-after-frees of SVGUseElement's
101         since m_svgUseElements stored raw pointes to SVG use elements but this crash is not an indicative of any UAF,
102         and there is no evidence that r225868 has led to new UAFs even after five months.
103
104         No new tests. I couldn't find a way to trigger a nested style update inside SVGUseElement::updateShadowTree.
105
106         * dom/Document.cpp:
107         (WebCore::Document::removeSVGUseElement):
108
109 2018-05-02  Dirk Schulze  <dschulze@chromium.org>
110
111         getCharNumAtPosition should take DOMPointInit as argument
112         https://bugs.webkit.org/show_bug.cgi?id=184695
113
114         Reviewed by Antti Koivisto.
115
116         Extend existing tests for getCharNumAtPosition.
117
118         * svg/SVGTextContentElement.cpp:
119         (WebCore::SVGTextContentElement::getCharNumAtPosition):
120         * svg/SVGTextContentElement.h:
121         * svg/SVGTextContentElement.idl: Use DOMPointInit argument.
122
123 2018-05-02  Youenn Fablet  <youenn@apple.com>
124
125         Use NetworkLoadChecker for navigation loads
126         https://bugs.webkit.org/show_bug.cgi?id=184892
127         <rdar://problem/39652686>
128
129         Reviewed by Chris Dumez.
130
131         Sanitize headers according response tainting.
132         If tainting is basic, it means same origin load in which case we only filter Cookie related headers.
133         If tainting is Opaque, we filter all uncommon headers.
134         If tainting is CORS, we filter all uncommon headers except the one explicitely allowed by CORS headers.
135         Covered by updated test.
136
137         * platform/network/ResourceResponseBase.cpp:
138         (WebCore::ResourceResponseBase::sanitizeHTTPHeaderFieldsAccordingToTainting):
139         (WebCore::ResourceResponseBase::sanitizeHTTPHeaderFields):
140         * platform/network/ResourceResponseBase.h:
141
142 2018-05-02  Myles C. Maxfield  <mmaxfield@apple.com>
143
144         Collection fragment identifiers don't use PostScript names
145         https://bugs.webkit.org/show_bug.cgi?id=184624
146         <rdar://problem/39432089>
147
148         Reviewed by Simon Fraser.
149
150         In a previous version of the CSS Fonts spec, there was text saying that items in font collections
151         should be 1-indexed (so the first item would be MyFonts.ttc#1). However, this is unfortunate because
152         inserting an item into the middle of a collection would throw off all content that uses the file.
153         Instead, the spec has since changed to use PostScript names (so the content instead would say
154         MyFonts.ttc#MyFont-Regular).
155
156         Test: fast/text/font-collection.html
157
158         * css/CSSFontFaceSource.cpp:
159         (WebCore::CSSFontFaceSource::load):
160         * loader/cache/CachedFont.cpp:
161         (WebCore::CachedFont::calculateItemInCollection const):
162         (WebCore::CachedFont::ensureCustomFontData):
163         (WebCore::CachedFont::createCustomFontData):
164         (WebCore::CachedFont::calculateIndex const): Deleted.
165         * loader/cache/CachedFont.h:
166         * platform/graphics/mac/FontCustomPlatformData.cpp:
167         (WebCore::createFontCustomPlatformData):
168         * platform/graphics/mac/FontCustomPlatformData.h:
169
170 2018-05-02  Brian Burg  <bburg@apple.com>
171
172         Web Inspector: opt out of process swap on navigation if a Web Inspector frontend is connected
173         https://bugs.webkit.org/show_bug.cgi?id=184861
174         <rdar://problem/39153768>
175
176         Reviewed by Ryosuke Niwa.
177
178         Notify the client of the current connection count whenever a frontend connects or disconnects.
179
180         Covered by new API test.
181
182         * inspector/InspectorClient.h:
183         (WebCore::InspectorClient::frontendCountChanged):
184         * inspector/InspectorController.cpp:
185         (WebCore::InspectorController::connectFrontend):
186         (WebCore::InspectorController::disconnectFrontend):
187         (WebCore::InspectorController::disconnectAllFrontends):
188         * inspector/InspectorController.h:
189
190 2018-05-02  Carlos Alberto Lopez Perez  <clopez@igalia.com>
191
192         [GStreamer] Remove unneeded include of gstgldisplay_wayland.h after r228866 and r229022
193         https://bugs.webkit.org/show_bug.cgi?id=185207
194
195         Reviewed by Michael Catanzaro.
196
197         Remove unneeded include of gstgldisplay_wayland.h
198
199         No new tests, no change in behaviour.
200
201         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp:
202
203 2018-05-02  Chris Dumez  <cdumez@apple.com>
204
205         document.open() event listener removal is not immediate
206         https://bugs.webkit.org/show_bug.cgi?id=185191
207
208         Reviewed by Darin Adler.
209
210         We need to make sure we set the 'wasremoved' flag on RegisteredEventListeners
211         whenever they get removed from the EventListenerMap. We were doing so correctly
212         in EventListenerMap:remove() but not EventListenerMap::clear(). This patch
213         updates clear() accordingly.
214
215         The reason we need to set this flag is that RegisteredEventListeners is RefCounted
216         and EventTarget::fireEventListeners() may be currently running and calling
217         each listener one by one, holding a reference to all listener of a given event.
218
219         Test: fast/dom/Document/document-open-removes-all-listeners.html
220
221         * dom/EventListenerMap.cpp:
222         (WebCore::EventListenerMap::clear):
223
224 2018-05-02  Zalan Bujtas <zalan@apple.com>
225
226         Use WeakPtr in GridCell
227         https://bugs.webkit.org/show_bug.cgi?id=185180
228         <rdar://problem/39432165>
229
230         Reviewed by Antti Koivisto.
231
232         Since GridCell does not own the renderers, it should
233         construct weak pointers.
234
235         Unable to create a reliably reproducible test case.
236
237         * rendering/Grid.cpp:
238         (WebCore::Grid::insert):
239         (WebCore::GridIterator::nextGridItem):
240         * rendering/Grid.h:
241         * rendering/RenderGrid.cpp:
242         (WebCore::RenderGrid::firstLineBaseline const):
243
244 2018-05-02  Eric Carlson  <eric.carlson@apple.com>
245
246         [iOS] Provide audio route information when invoking AirPlay picker
247         https://bugs.webkit.org/show_bug.cgi?id=185199
248         <rdar://problem/39853103>
249
250         Reviewed by Jer Noble.
251
252         No new tests, this requires a specific hardware setup.
253
254         * dom/Document.cpp:
255         (WebCore::Document::showPlaybackTargetPicker): Pass route sharing policy and routing context UID.
256         * dom/Document.h:
257
258         * html/MediaElementSession.cpp:
259         (WebCore::MediaElementSession::showPlaybackTargetPicker): Ditto.
260
261         * loader/EmptyClients.h:
262         * page/ChromeClient.h:
263
264         * page/Page.cpp:
265         (WebCore::Page::showPlaybackTargetPicker): Ditto.
266         * page/Page.h:
267
268         * platform/audio/AudioSession.cpp:
269         (WebCore::AudioSession::routeSharingPolicy const): Empty implementation for non-iOS ports.
270         (WebCore::routingContextUID const): Ditto.
271         * platform/audio/AudioSession.h:
272
273         * platform/audio/ios/AudioSessionIOS.mm:
274         (WebCore::AudioSession::routeSharingPolicy const): Return the route sharing policy.
275         (WebCore::AudioSession::routingContextUID const): Return the route context UID.
276
277 2018-05-02  Dean Jackson  <dino@apple.com>
278
279         Draw SystemPreview badge to specification on iOS
280         https://bugs.webkit.org/show_bug.cgi?id=185203
281         <rdar://problem/39908855>
282
283         Reviewed by Tim Horton.
284
285         Use CoreImage to render a badge with a blurred background,
286         at particular sizes.
287
288         This will be tested internally while we're getting artwork
289         from WebKitAdditions.
290
291         * Configurations/WebCore.xcconfig: Link against CoreImage.
292         * rendering/RenderThemeIOS.h:
293         * rendering/RenderThemeIOS.mm:
294         (WebCore::RenderThemeIOS::paintSystemPreviewBadge): New function
295         in the iOS platform RenderTheme that draws the system preview.
296
297 2018-05-01  Brent Fulgham  <bfulgham@apple.com>
298
299         Prevent Debug ASSERT when changing forms
300         https://bugs.webkit.org/show_bug.cgi?id=185173
301         <rdar://problem/39738669>
302
303         Reviewed by Ryosuke Niwa.
304
305         Form submission could trigger a debug assertion during validation when
306         a form is changed during an input submission. Fix this by cleaning up
307         the event handling logic and make it more consistent with modern WebKit
308         coding style.
309
310         Test: fast/forms/form-submission-crash-3.html
311
312         * html/HTMLButtonElement.cpp:
313         (WebCore::HTMLButtonElement::defaultEventHandler): Make sure layout runs before
314         attempting to perform event handling.
315         * html/HTMLFormElement.cpp:
316         (WebCore::HTMLFormElement::reportValidity): Ditto.
317         (WebCore::HTMLFormElement::validateInteractively): Remove call to perform layout here,
318         since we expect this to happen earlier in the layout pass. Add an assertion that the
319         tree is not dirty.
320         * html/ImageInputType.cpp:
321         (WebCore::ImageInputType::handleDOMActivateEvent): Make sure layout runs before
322         attempting to perform event handling.
323         * html/SubmitInputType.cpp:
324         (WebCore::SubmitInputType::handleDOMActivateEvent): Ditto.
325
326 2018-05-02  Jer Noble  <jer.noble@apple.com>
327
328         Unreviewed; address review comments made before landing r231231.
329
330         * platform/ios/WebVideoFullscreenControllerAVKit.mm:
331         (VideoFullscreenControllerContext::volume const):
332
333 2018-05-02  Jer Noble  <jer.noble@apple.com>
334
335         Pipe volume through PlaybackSessionManager/Proxy.
336         https://bugs.webkit.org/show_bug.cgi?id=185182
337
338         Reviewed by Eric Carlson.
339
340         Add support for the volume property to PlaybackSessionModel, and all its clients.
341
342         * platform/cocoa/PlaybackSessionModel.h:
343         (WebCore::PlaybackSessionModelClient::volumeChanged):
344         * platform/cocoa/PlaybackSessionModelMediaElement.h:
345         * platform/cocoa/PlaybackSessionModelMediaElement.mm:
346         (WebCore::PlaybackSessionModelMediaElement::updateForEventName):
347         (WebCore::PlaybackSessionModelMediaElement::setVolume):
348         (WebCore::PlaybackSessionModelMediaElement::volume const):
349         * platform/ios/PlaybackSessionInterfaceAVKit.h:
350         * platform/ios/PlaybackSessionInterfaceAVKit.mm:
351         (WebCore::PlaybackSessionInterfaceAVKit::volumeChanged):
352         * platform/ios/WebAVPlayerController.h:
353         * platform/ios/WebAVPlayerController.mm:
354         (-[WebAVPlayerController volume]):
355         (-[WebAVPlayerController setVolume:]):
356         (-[WebAVPlayerController volumeChanged:]):
357         (-[WebAVPlayerController resetMediaState]):
358         * platform/ios/WebVideoFullscreenControllerAVKit.mm:
359         (VideoFullscreenControllerContext::volumeChanged):
360         (VideoFullscreenControllerContext::volume const):
361         (VideoFullscreenControllerContext::setVolume):
362
363 2018-05-01  Yusuke Suzuki  <utatane.tea@gmail.com>
364
365         Unreviewed, fix build in WinCairo
366         https://bugs.webkit.org/show_bug.cgi?id=185169
367
368         * bindings/js/JSDOMWindowBase.cpp:
369         (WebCore::JSDOMWindowBase::instantiateStreaming):
370         * bindings/js/JSDOMWindowBase.h:
371
372 2018-05-01  Yusuke Suzuki  <utatane.tea@gmail.com>
373
374         Use default std::optional if it is provided
375         https://bugs.webkit.org/show_bug.cgi?id=185159
376
377         Reviewed by JF Bastien.
378
379         * Modules/mediastream/RTCPeerConnection.cpp:
380         (WebCore::iceServersFromConfiguration):
381         (WebCore::RTCPeerConnection::setConfiguration):
382         * css/parser/CSSParser.cpp:
383         (WebCore::CSSParser::parseSystemColor):
384         * css/parser/CSSParser.h:
385         * dom/DatasetDOMStringMap.cpp:
386         (WebCore::DatasetDOMStringMap::item const):
387         (WebCore::DatasetDOMStringMap::namedItem const):
388         (WebCore:: const): Deleted.
389         * dom/DatasetDOMStringMap.h:
390         * dom/Element.cpp:
391         (WebCore::Element::insertAdjacentHTML):
392         * dom/Element.h:
393         * inspector/DOMEditor.cpp:
394         * platform/network/curl/CurlFormDataStream.cpp:
395         (WebCore::CurlFormDataStream::getPostData):
396         (): Deleted.
397         * platform/network/curl/CurlFormDataStream.h:
398         * testing/MockCDMFactory.cpp:
399         (WebCore::MockCDMFactory::keysForSessionWithID const):
400         (WebCore::MockCDMInstance::updateLicense):
401         (WebCore:: const): Deleted.
402         * testing/MockCDMFactory.h:
403
404 2018-05-01  Chris Dumez  <cdumez@apple.com>
405
406         Add release assertions in CFNetwork's SocketStreamHandleImpl to help debug a threading issue
407         https://bugs.webkit.org/show_bug.cgi?id=185181
408
409         Reviewed by Geoffrey Garen.
410
411         Add release assertions in CFNetwork's SocketStreamHandleImpl to help debug a threading issue
412         on iOS WebKitLegacy (Bug 185073). It appears readStreamCallback() can get called on the UIThread,
413         which should not be possible if scheduleStreams() was called on the WebThread, as it is supposed
414         to. The new release assertion in scheduleStreams() should tell us if somebody is calling it from
415         the UIthread instead of the WebThread on iOS WebKitLegacy.
416
417         * platform/network/cf/SocketStreamHandleImplCFNet.cpp:
418         (WebCore::SocketStreamHandleImpl::scheduleStreams):
419         (WebCore::SocketStreamHandleImpl::readStreamCallback):
420
421 2018-05-01  Wenson Hsieh  <wenson_hsieh@apple.com>
422
423         Unreviewed, remove an unused variable in RuntimeEnabledFeatures.h
424
425         * page/RuntimeEnabledFeatures.h:
426
427 2018-05-01  Oleksandr Skachkov  <gskachkov@gmail.com>
428
429         Fix build error after r231194
430         https://bugs.webkit.org/show_bug.cgi?id=185169
431
432         Reviewed by JF Bastien.
433
434         Prevent compile error in iOS Simulator debug build
435         by tagging function
436
437         * bindings/js/JSDOMWindowBase.cpp:
438         (WebCore::JSDOMWindowBase::compileStreaming):
439         (WebCore::JSDOMWindowBase::instantiateStreaming):
440
441 2018-05-01  Oleksandr Skachkov  <gskachkov@gmail.com>
442
443         WebAssembly: add support for stream APIs - JavaScript API
444         https://bugs.webkit.org/show_bug.cgi?id=183442
445
446         Reviewed by Yusuke Suzuki and JF Bastien.
447
448         Add WebAssembly streaming API to WebCore.
449
450         * Configurations/FeatureDefines.xcconfig:
451         * bindings/js/JSDOMWindowBase.cpp:
452         (WebCore::tryAllocate):
453         (WebCore::isResponseCorrect):
454         (WebCore::handleResponseOnStreamingAction):
455         (WebCore::JSDOMWindowBase::compileStreaming):
456         (WebCore::JSDOMWindowBase::instantiateStreaming):
457         * bindings/js/JSDOMWindowBase.h:
458         * bindings/js/JSRemoteDOMWindowBase.cpp:
459         * bindings/js/JSWorkerGlobalScopeBase.cpp:
460
461 2018-04-30  Myles C. Maxfield  <mmaxfield@apple.com>
462
463         Improve the performance of FontCascadeDescription's effectiveFamilies
464         https://bugs.webkit.org/show_bug.cgi?id=184720
465         <rdar://problem/38970927>
466
467         Reviewed by Simon Fraser.
468
469         The page that had the performance problem renders many different Chinese characters in system-ui
470         with only a small number of individual fonts. It turns out we were calling into the system-ui
471         machinery for each character in order to opportunistically start loading data URLs (see also:
472         https://bugs.webkit.org/show_bug.cgi?id=175845). These data URLS will never represent the system
473         font, so we don't need to invoke the system-ui machinery at all.
474
475         This patch makes a 92x performance improvement on the associated performance test. This test is
476         designed to test Chinese text rendered with system-ui.
477
478         Performance test: Layout/system-ui.html
479
480         * platform/graphics/FontCascadeFonts.cpp:
481         (WebCore::opportunisticallyStartFontDataURLLoading):
482
483 2018-04-30  Jer Noble  <jer.noble@apple.com>
484
485         <img src=mp4> does not display on ios despite Accept: video/* advertisement
486         https://bugs.webkit.org/show_bug.cgi?id=185029
487         <rdar://problem/39771989>
488
489         Reviewed by Eric Carlson.
490
491         Returning "NO" from resourceLoader:shouldWaitForLoadingOfResource: signals that the load failed,
492         even if the resource request is successfully fulfilled prior to the return. Always return YES in
493         the case that loading succeeded.
494
495         * platform/graphics/avfoundation/objc/ImageDecoderAVFObjC.mm:
496         (-[WebCoreSharedBufferResourceLoaderDelegate resourceLoader:shouldWaitForLoadingOfRequestedResource:]):
497
498 2018-04-30  Zalan Bujtas  <zalan@apple.com>
499
500         REGRESSION(r230914) Selecting text on this apple.com page makes it vanish
501         https://bugs.webkit.org/show_bug.cgi?id=185142
502         <rdar://problem/39821446>
503
504         Reviewed by Simon Fraser.
505
506         Set the overflow rect on the inline textbox when needed.
507
508         Test: fast/text/simple-line-layout-selection-with-overflow.html
509
510         * rendering/SimpleLineLayoutFunctions.cpp:
511         (WebCore::SimpleLineLayout::initializeInlineTextBox):
512         (WebCore::SimpleLineLayout::generateLineBoxTree):
513         (WebCore::SimpleLineLayout::initializeInlineBox): Deleted.
514
515 2018-04-30  JF Bastien  <jfbastien@apple.com>
516
517         Use some C++17 features
518         https://bugs.webkit.org/show_bug.cgi?id=185135
519
520         Reviewed by Alex Christensen.
521
522         As discussed here [0] let's move WebKit to a subset of C++17. We
523         now require GCC 6 [1] which means that, according to [2] we can
524         use the following C++17 language features (I removed some
525         uninteresting ones):
526
527          - New auto rules for direct-list-initialization
528          - static_assert with no message
529          - typename in a template template parameter
530          - Nested namespace definition
531          - Attributes for namespaces and enumerators
532          - u8 character literals
533          - Allow constant evaluation for all non-type template arguments
534          - Fold Expressions
535          - Unary fold expressions and empty parameter packs
536          - __has_include in preprocessor conditional
537          - Differing begin and end types in range-based for
538          - Improving std::pair and std::tuple
539
540         Consult the Tony Tables [3] to see before / after examples.
541
542         Of course we can use any library feature if we're willing to
543         import them to WTF (and they don't require language support).
544
545
546           [0]: https://lists.webkit.org/pipermail/webkit-dev/2018-March/029922.html
547           [1]: https://trac.webkit.org/changeset/231152/webkit
548           [2]: https://en.cppreference.com/w/cpp/compiler_support
549           [3]: https://github.com/tvaneerd/cpp17_in_TTs/blob/master/ALL_IN_ONE.md
550
551         * DerivedSources.make:
552         * platform/URLParser.cpp: work around an odd GCC 6 bug with class
553           static value as a template parameter.
554         (WebCore::URLParser::percentDecode):
555         (WebCore::URLParser::domainToASCII):
556         (WebCore::URLParser::hasForbiddenHostCodePoint):
557         (WebCore::URLParser::parseHostAndPort):
558         * platform/URLParser.h:
559
560 2018-04-30  Wenson Hsieh  <wenson_hsieh@apple.com>
561
562         [Extra zoom mode] Respect the existing shrink-to-fit attribute instead of using min-device-width
563         https://bugs.webkit.org/show_bug.cgi?id=185132
564         <rdar://problem/39834562>
565
566         Reviewed by Tim Horton.
567
568         Removes the `min-device-width` attribute added in r231095. Instead, we key this behavior off of the
569         `shrink-to-fit` attribute introduced for multitasking on iPad, such that `shrink-to-fit=no` achieves the same
570         behavior as `min-device-width=0` in extra zoom mode. See comments below for more detail.
571
572         Adjusted an existing layout test: fast/viewport/extrazoom/viewport-change-min-device-width.html.
573
574         * dom/ViewportArguments.cpp:
575         (WebCore::setViewportFeature):
576         (WebCore::operator<<):
577         * dom/ViewportArguments.h:
578
579         Removes the `minDeviceWidth` viewport argument.
580
581         * page/RuntimeEnabledFeatures.h:
582         (WebCore::RuntimeEnabledFeatures::setMinDeviceWidthEnabled): Deleted.
583         (WebCore::RuntimeEnabledFeatures::minDeviceWidthEnabled const): Deleted.
584
585         Removes the runtime switch for `min-device-width`.
586
587         * page/ViewportConfiguration.cpp:
588         (WebCore::platformDeviceWidthOverride):
589
590         Hard-code the override device width in extra zoom mode.
591
592         (WebCore::ViewportConfiguration::shouldOverrideDeviceWidthAndShrinkToFit const):
593
594         In extra zoom mode, override the device width only if shrink-to-fit has not been expliticly disabled, and the
595         device width is less than the override device width.
596
597         (WebCore::ViewportConfiguration::shouldIgnoreHorizontalScalingConstraints const):
598         (WebCore::ViewportConfiguration::shouldIgnoreScalingConstraintsRegardlessOfContentSize const):
599         (WebCore::ViewportConfiguration::updateConfiguration):
600         (WebCore::ViewportConfiguration::updateMinimumLayoutSize):
601
602         Do not override the minimum layout size if `shrink-to-fit` has been explicitly explicitly disabled, or if the
603         device width is greater than the override device width.
604
605         (WebCore::computedMinDeviceWidth): Deleted.
606         (WebCore::ViewportConfiguration::shouldOverrideDeviceWidthWithMinDeviceWidth const): Deleted.
607         * page/ViewportConfiguration.h:
608
609 2018-04-30  Chris Nardi  <cnardi@chromium.org>
610
611         Serialize font-variation-settings with double-quotes per spec
612         https://bugs.webkit.org/show_bug.cgi?id=182542
613
614         Reviewed by Myles C. Maxfield.
615
616         According to the CSSOM spec [1], all strings should be serialized with double-quotes.
617         The axis name in font-variation-settings was previously serialized with single-quotes;
618         change this to double-quotes to match the spec and non-WebKit browsers.
619
620         [1]: https://drafts.csswg.org/cssom/#common-serializing-idioms
621
622         Updated fast/text/variations/getComputedStyle.html to test the change.
623
624         * css/CSSFontVariationValue.cpp:
625         (WebCore::CSSFontVariationValue::customCSSText const):
626
627 2018-04-30  Chris Dumez  <cdumez@apple.com>
628
629         Fix bad use of RunLoop::main().dispatch() in MessagePort::dispatchMessages()
630         https://bugs.webkit.org/show_bug.cgi?id=185134
631
632         Reviewed by Geoffrey Garen.
633
634         Fix bad use of RunLoop::main().dispatch() in MessagePort::dispatchMessages(). This code runs on iOS WebKitLegacy
635         and it is therefore unsafe to use RunLoop::main() here. We want to use callOnMainThread() instead to run code on
636         the WebThread.
637
638         * dom/MessagePort.cpp:
639         (WebCore::MessagePort::dispatchMessages):
640
641 2018-04-30  Simon Fraser  <simon.fraser@apple.com>
642
643         Make color-filter affect caret-color
644         https://bugs.webkit.org/show_bug.cgi?id=185129
645         rdar://problem/39829066
646
647         Reviewed by Tim Horton.
648         
649         Transform the colors used to compare the caret color with the background through
650         color-filter (since we want contrasting colors after filters are applied), and
651         transform caret-color itself.
652
653         Test: css3/color-filters/color-filter-caret-color.html
654
655         * editing/FrameSelection.cpp:
656         (WebCore::CaretBase::paintCaret const):
657
658 2018-04-30  Michael Catanzaro  <mcatanzaro@igalia.com>
659
660         [GTK] Webkit should spoof as Safari on a Mac when on Chase.com
661         https://bugs.webkit.org/show_bug.cgi?id=185103
662
663         Reviewed by Carlos Garcia Campos.
664
665         Send a fake user agent to chase.com to make it work.
666
667         * platform/UserAgentQuirks.cpp:
668         (WebCore::urlRequiresMacintoshPlatform):
669         (WebCore::UserAgentQuirks::stringForQuirk): Also, remove this stale comment.
670
671 2018-04-29  Simon Fraser  <simon.fraser@apple.com>
672
673         Make color-filter affect <attachment>
674         https://bugs.webkit.org/show_bug.cgi?id=185122
675         rdar://problem/39818763
676
677         Reviewed by Tim Horton.
678         
679         Convert the colors used to render <attachment> through color-filter, except
680         for those parts that render over the icon (like the progress bar).
681
682         Not easily testable.
683
684         * rendering/RenderThemeMac.mm:
685         (WebCore::titleTextColorForAttachment):
686         (WebCore::AttachmentLayout::layOutTitle):
687         (WebCore::AttachmentLayout::layOutSubtitle):
688         (WebCore::paintAttachmentIconBackground):
689         (WebCore::paintAttachmentTitleBackground):
690         (WebCore::paintAttachmentPlaceholderBorder):
691
692 2018-04-28  Simon Fraser  <simon.fraser@apple.com>
693
694         Fix color-filter to apply to SVG colors
695         https://bugs.webkit.org/show_bug.cgi?id=185113
696         rdar://problem/39665082
697
698         Reviewed by Dean Jackson.
699         
700         Convert SVG colors through color-filter operations for the places in SVG
701         that use color, namely fill and stroke, gradients, lighting colors and
702         drop-shadow.
703
704         Test: css3/color-filters/svg/color-filter-inline-svg.html
705
706         * rendering/svg/RenderSVGResourceGradient.cpp:
707         (WebCore::RenderSVGResourceGradient::applyResource):
708         * rendering/svg/RenderSVGResourceGradient.h:
709         * rendering/svg/RenderSVGResourceLinearGradient.cpp:
710         (WebCore::RenderSVGResourceLinearGradient::buildGradient const):
711         * rendering/svg/RenderSVGResourceLinearGradient.h:
712         * rendering/svg/RenderSVGResourceRadialGradient.cpp:
713         (WebCore::RenderSVGResourceRadialGradient::buildGradient const):
714         * rendering/svg/RenderSVGResourceRadialGradient.h:
715         * rendering/svg/RenderSVGResourceSolidColor.cpp:
716         (WebCore::RenderSVGResourceSolidColor::applyResource):
717         * svg/SVGFEDiffuseLightingElement.cpp:
718         (WebCore::SVGFEDiffuseLightingElement::setFilterEffectAttribute):
719         (WebCore::SVGFEDiffuseLightingElement::build):
720         * svg/SVGFEDropShadowElement.cpp:
721         (WebCore::SVGFEDropShadowElement::build):
722         * svg/SVGFEFloodElement.cpp:
723         (WebCore::SVGFEFloodElement::build):
724         * svg/SVGFESpecularLightingElement.cpp:
725         (WebCore::SVGFESpecularLightingElement::setFilterEffectAttribute):
726         (WebCore::SVGFESpecularLightingElement::build):
727
728 2018-04-29  Michael Catanzaro  <mcatanzaro@igalia.com>
729
730         [CMake] Require GCC 6
731         https://bugs.webkit.org/show_bug.cgi?id=184985
732
733         Reviewed by Alex Christensen.
734
735         Remove a GCC 5 fallback path. This seems to be the only such fallback path in WebKit.
736
737         * platform/graphics/FourCC.h:
738         (WebCore::FourCC::FourCC):
739
740 2018-04-29  Zalan Bujtas  <zalan@apple.com>
741
742         [LFC] Implement Display::Box functions
743         https://bugs.webkit.org/show_bug.cgi?id=185116
744
745         Reviewed by Antti Koivisto.
746
747         * layout/displaytree/DisplayBox.cpp:
748         (WebCore::Display::Box::Box):
749         (WebCore::Display::Box::~Box):
750         (WebCore::Display::Box::marginBox const):
751         (WebCore::Display::Box::borderBox const):
752         (WebCore::Display::Box::paddingBox const):
753         (WebCore::Display::Box::contentBox const):
754         * layout/displaytree/DisplayBox.h:
755         (WebCore::Display::Box::rect const):
756         (WebCore::Display::Box::top const):
757         (WebCore::Display::Box::left const):
758         (WebCore::Display::Box::bottom const):
759         (WebCore::Display::Box::right const):
760         (WebCore::Display::Box::topLeft const):
761         (WebCore::Display::Box::bottomRight const):
762         (WebCore::Display::Box::size const):
763         (WebCore::Display::Box::width const):
764         (WebCore::Display::Box::height const):
765         (WebCore::Display::Box::marginTop const):
766         (WebCore::Display::Box::marginLeft const):
767         (WebCore::Display::Box::marginBottom const):
768         (WebCore::Display::Box::marginRight const):
769         (WebCore::Display::Box::parent const):
770         (WebCore::Display::Box::nextSibling const):
771         (WebCore::Display::Box::previousSibling const):
772         (WebCore::Display::Box::firstChild const):
773         (WebCore::Display::Box::lastChild const):
774         (WebCore::Display::Box::setRect):
775         (WebCore::Display::Box::setTopLeft):
776         (WebCore::Display::Box::setTop):
777         (WebCore::Display::Box::setLeft):
778         (WebCore::Display::Box::setSize):
779         (WebCore::Display::Box::setWidth):
780         (WebCore::Display::Box::setHeight):
781         (WebCore::Display::Box::setMarginTop):
782         (WebCore::Display::Box::setMarginLeft):
783         (WebCore::Display::Box::setMarginBottom):
784         (WebCore::Display::Box::setMarginRight):
785         (WebCore::Display::Box::setBorderTop):
786         (WebCore::Display::Box::setBorderLeft):
787         (WebCore::Display::Box::setBorderBottom):
788         (WebCore::Display::Box::setBorderRight):
789         (WebCore::Display::Box::setPaddingTop):
790         (WebCore::Display::Box::setPaddingLeft):
791         (WebCore::Display::Box::setPaddingBottom):
792         (WebCore::Display::Box::setPaddingRight):
793         (WebCore::Display::Box::setParent):
794         (WebCore::Display::Box::setNextSibling):
795         (WebCore::Display::Box::setPreviousSibling):
796         (WebCore::Display::Box::setFirstChild):
797         (WebCore::Display::Box::setLastChild):
798
799 2018-04-29  Youenn Fablet  <youenn@apple.com>
800
801         Make RestrictedHTTPResponseAccess flag true by default
802         https://bugs.webkit.org/show_bug.cgi?id=185089
803
804         Reviewed by Geoffrey Garen.
805
806         * page/RuntimeEnabledFeatures.h:
807
808 2018-04-28  Sihui Liu  <sihui_liu@apple.com>
809
810         [Cocoa] Set HTTPOnly flag when converting Cookie to NSHTTPCookie
811         https://bugs.webkit.org/show_bug.cgi?id=185052
812
813         Reviewed by Geoffrey Garen.
814
815         Set HTTPOnly for NSHTTPCookie when it's converted from Cookie, so the WebKit APIs could 
816         create NSHTTPCookie with correct HTTPOnly flag. Also, reverted the change made to operator
817         function because we want the Cookie class to act as a wrapper for NSHTTPCookie and leverage
818         its equal function. 
819
820         Modified API test: WebKit.WKHTTPCookieStoreHttpOnly
821
822         * platform/network/cocoa/CookieCocoa.mm:
823         (WebCore::Cookie::operator NSHTTPCookie * const):
824         (WebCore::Cookie::operator== const):
825         * platform/network/cocoa/NetworkStorageSessionCocoa.mm:
826         (WebCore::NetworkStorageSession::deleteCookie):
827
828 2018-04-28  Zalan Bujtas  <zalan@apple.com>
829
830         [LFC] Add LayoutTreeBuilder class to generate the layout tree
831         https://bugs.webkit.org/show_bug.cgi?id=185108
832
833         Reviewed by Antti Koivisto.
834
835         This is for testing purposes.
836
837         * WebCore.xcodeproj/project.pbxproj:
838         * layout/FormattingState.cpp:
839         (WebCore::Layout::FormattingState::~FormattingState):
840         * layout/FormattingState.h:
841         * layout/LayoutContext.h:
842         * layout/blockformatting/BlockFormattingState.cpp:
843         (WebCore::Layout::BlockFormattingState::~BlockFormattingState):
844         * layout/blockformatting/BlockFormattingState.h:
845         * layout/inlineformatting/InlineFormattingState.cpp:
846         (WebCore::Layout::InlineFormattingState::~InlineFormattingState):
847         * layout/inlineformatting/InlineFormattingState.h:
848         * layout/layouttree/LayoutBlockContainer.h:
849         * layout/layouttree/LayoutBox.h:
850         * layout/layouttree/LayoutContainer.h:
851         * layout/layouttree/LayoutInlineContainer.h:
852         * layout/layouttree/LayoutTreeBuilder.cpp: Added.
853         (WebCore::Layout::TreeBuilder::createLayoutTree):
854         (WebCore::Layout::TreeBuilder::createSubTree):
855         (WebCore::Layout::outputLayoutBox):
856         (WebCore::Layout::outputLayoutTree):
857         (WebCore::Layout::TreeBuilder::showLayoutTree):
858         (WebCore::Layout::printLayoutTreeForLiveDocuments):
859         * layout/layouttree/LayoutTreeBuilder.h: Copied from Source/WebCore/layout/layouttree/LayoutBlockContainer.h.
860         * page/mac/PageMac.mm:
861         (WebCore::Page::platformInitialize):
862
863 2018-04-28  Zalan Bujtas  <zalan@apple.com>
864
865         [LFC] Implement BlockMarginCollapse functions.
866         https://bugs.webkit.org/show_bug.cgi?id=185036
867
868         Reviewed by Antti Koivisto.
869
870         * layout/blockformatting/BlockMarginCollapse.cpp:
871         (WebCore::Layout::marginValue):
872         (WebCore::Layout::BlockMarginCollapse::BlockMarginCollapse):
873         (WebCore::Layout::BlockMarginCollapse::marginTop const):
874         (WebCore::Layout::BlockMarginCollapse::marginBottom const):
875         (WebCore::Layout::BlockMarginCollapse::isMarginTopCollapsedWithSibling const):
876         (WebCore::Layout::BlockMarginCollapse::isMarginBottomCollapsedWithSibling const):
877         (WebCore::Layout::BlockMarginCollapse::isMarginTopCollapsedWithParent const):
878         (WebCore::Layout::BlockMarginCollapse::isMarginBottomCollapsedWithParent const):
879         (WebCore::Layout::BlockMarginCollapse::nonCollapsedMarginTop const):
880         (WebCore::Layout::BlockMarginCollapse::nonCollapsedMarginBottom const):
881         (WebCore::Layout::BlockMarginCollapse::collapsedMarginTopFromFirstChild const):
882         (WebCore::Layout::BlockMarginCollapse::collapsedMarginBottomFromLastChild const):
883         (WebCore::Layout::BlockMarginCollapse::hasAdjoiningMarginTopAndBottom const):
884         * layout/blockformatting/BlockMarginCollapse.h:
885         * layout/layouttree/LayoutBox.h:
886         (WebCore::Layout::Box::style const):
887
888 2018-04-27  David Kilzer  <ddkilzer@apple.com>
889
890         Add logging when SpringBoard enables WebThread
891         <https://webkit.org/b/185100>
892         <rdar://problem/39746542>
893
894         Reviewed by Daniel Bates.
895
896         * platform/RuntimeApplicationChecks.h:
897         (WebCore::IOSApplication::isSpringBoard): Add declaration.
898         * platform/cocoa/RuntimeApplicationChecksCocoa.mm:
899         (WebCore::IOSApplication::isSpringBoard): Add implementation.
900         * platform/ios/wak/WebCoreThread.mm:
901         (WebThreadEnable): Call RELEASE_LOG_FAULT() if this is called by
902         SpringBoard.
903
904 2018-04-27  Keith Rollin  <krollin@apple.com>
905
906         Fix crash in DocumentLoader::startLoadingMainResource
907         https://bugs.webkit.org/show_bug.cgi?id=185088
908         rdar://problem/39689263
909
910         Reviewed by Chris Dumez.
911
912         Add a "protectedThis" to address a case where a deleted "this" was
913         accessed in a RELEASE_LOG statement.
914
915         No new tests -- covered by existing tests, which now pass.
916
917         * loader/DocumentLoader.cpp:
918         (WebCore::DocumentLoader::startLoadingMainResource):
919
920 2018-04-27  Simon Fraser  <simon.fraser@apple.com>
921
922         Implement color-filter for text stroke
923         https://bugs.webkit.org/show_bug.cgi?id=185098
924
925         Reviewed by Alan Bujtas.
926         
927         Transform the text stroke color through color-filter.
928
929         Test: css3/color-filters/color-filter-text-stroke.html
930
931         * rendering/TextPaintStyle.cpp:
932         (WebCore::computeTextPaintStyle):
933
934 2018-04-27  Simon Fraser  <simon.fraser@apple.com>
935
936         Implement animation for color-filter
937         https://bugs.webkit.org/show_bug.cgi?id=185092
938         rdar://problem/39773810
939
940         Reviewed by Tim Horton.
941         
942         Implement animation of color-filter.
943         
944         This requires tracking whether the color-filter function lists match for both old and new
945         animation code paths.
946         
947         The filter-related ProperyWappers in CSSPropertyAnimation are cleaned up to use a single wrapper,
948         which has to pass the propertyID to the blend function so we know which "lists match" to check.
949         This wrapper reports that its accelerated for filter and backdrop-filter, but not color-filter.
950
951         Test: css3/color-filters/color-filter-animation.html
952
953         * animation/CSSPropertyBlendingClient.h:
954         * animation/KeyframeEffectReadOnly.cpp:
955         (WebCore::KeyframeEffectReadOnly::setBlendingKeyframes):
956         (WebCore::KeyframeEffectReadOnly::checkForMatchingColorFilterFunctionLists):
957         * animation/KeyframeEffectReadOnly.h:
958         * page/animation/AnimationBase.h:
959         * page/animation/CSSPropertyAnimation.cpp:
960         (WebCore::blendFunc):
961         (WebCore::PropertyWrapperFilter::PropertyWrapperFilter):
962         (WebCore::CSSPropertyAnimationWrapperMap::CSSPropertyAnimationWrapperMap):
963         (WebCore::PropertyWrapperAcceleratedFilter::PropertyWrapperAcceleratedFilter): Deleted.
964         (WebCore::PropertyWrapperAcceleratedBackdropFilter::PropertyWrapperAcceleratedBackdropFilter): Deleted.
965         (WebCore::PropertyWrapperAcceleratedBackdropFilter::animationIsAccelerated const): Deleted.
966         (WebCore::PropertyWrapperAcceleratedBackdropFilter::blend const): Deleted.
967         * page/animation/ImplicitAnimation.cpp:
968         (WebCore::ImplicitAnimation::reset):
969         (WebCore::ImplicitAnimation::checkForMatchingColorFilterFunctionLists):
970         * page/animation/ImplicitAnimation.h:
971         * page/animation/KeyframeAnimation.cpp:
972         (WebCore::KeyframeAnimation::KeyframeAnimation):
973         (WebCore::KeyframeAnimation::checkForMatchingColorFilterFunctionLists):
974         * page/animation/KeyframeAnimation.h:
975
976 2018-04-27  Zalan Bujtas  <zalan@apple.com>
977
978         [LFC] Add FormattingContext::computeWidth/computeHeight logic.
979         https://bugs.webkit.org/show_bug.cgi?id=185091
980
981         Reviewed by Antti Koivisto.
982
983         Inflow width and height can't really be computed without knowing the exact context. 
984
985         * layout/FormattingContext.cpp:
986         (WebCore::Layout::FormattingContext::computeWidth const):
987         (WebCore::Layout::FormattingContext::computeHeight const):
988         (WebCore::Layout::FormattingContext::computeOutOfFlowWidth const):
989         (WebCore::Layout::FormattingContext::computeFloatingWidth const):
990         (WebCore::Layout::FormattingContext::computeOutOfFlowHeight const):
991         (WebCore::Layout::FormattingContext::computeFloatingHeight const):
992         * layout/FormattingContext.h:
993         * layout/blockformatting/BlockFormattingContext.cpp:
994         (WebCore::Layout::BlockFormattingContext::computeInFlowWidth const):
995         (WebCore::Layout::BlockFormattingContext::computeInFlowHeight const):
996         (WebCore::Layout::BlockFormattingContext::computeWidth const): Deleted.
997         (WebCore::Layout::BlockFormattingContext::computeHeight const): Deleted.
998         * layout/blockformatting/BlockFormattingContext.h:
999         * layout/inlineformatting/InlineFormattingContext.cpp:
1000         (WebCore::Layout::InlineFormattingContext::computeInFlowWidth const):
1001         (WebCore::Layout::InlineFormattingContext::computeInFlowHeight const):
1002         * layout/inlineformatting/InlineFormattingContext.h:
1003
1004 2018-04-27  Chris Dumez  <cdumez@apple.com>
1005
1006         Use WindowProxy instead of DOMWindow in our IDL
1007         https://bugs.webkit.org/show_bug.cgi?id=185022
1008
1009         Reviewed by Sam Weinig.
1010
1011         Stop using DOMWindow in all of our IDL files and use WindowProxy as
1012         per their respective specifications. As a result, the implementation
1013         as also updated to use WindowProxy type instead of DOMWindow.
1014
1015         * WebCore.xcodeproj/project.pbxproj:
1016         * bindings/js/JSDOMConvertWindowProxy.h: Removed.
1017         * bindings/js/JSWindowProxy.cpp:
1018         (WebCore::JSWindowProxy::windowProxy const):
1019         (WebCore::JSWindowProxy::toWrapped):
1020         * bindings/js/JSWindowProxy.h:
1021         (WebCore::window):
1022         Use static_cast<>() instead of jsCast<>() because jsCast<>()
1023         relies on classInfo() which is not allowed to be called during
1024         JS sweep due to an assertion inside classInfo(). The JSWindowProxy
1025         objects are held strongly by the WindowProxy so we know the JSWindowProxy
1026         object is not getting destroyed here.
1027
1028         (WebCore::toJS):
1029         * bindings/js/WindowProxy.cpp:
1030         (WebCore::WindowProxy::globalObject):
1031         * bindings/js/WindowProxy.h:
1032         (WebCore::WindowProxy::frame const):
1033         * bindings/scripts/CodeGenerator.pm:
1034         (IsBuiltinType):
1035         (ComputeIsCallbackInterface):
1036         (ComputeIsCallbackFunction):
1037         * bindings/scripts/CodeGeneratorJS.pm:
1038         (AddToIncludesForIDLType):
1039         (GetBaseIDLType):
1040         (NativeToJSValueDOMConvertNeedsState):
1041         * bindings/scripts/test/JS/JSTestObj.cpp:
1042         (WebCore::jsTestObjPrototypeFunctionOverloadedMethod9Body):
1043         (WebCore::jsTestObjPrototypeFunctionOverloadedMethodOverloadDispatcher):
1044         * bindings/scripts/test/TestObj.idl:
1045         * dom/CompositionEvent.cpp:
1046         (WebCore::CompositionEvent::CompositionEvent):
1047         (WebCore::CompositionEvent::initCompositionEvent):
1048         * dom/CompositionEvent.h:
1049         * dom/CompositionEvent.idl:
1050         * dom/Document.cpp:
1051         (WebCore::Document::defaultView const):
1052         * dom/Document.h:
1053         * dom/Document.idl:
1054         * dom/DocumentTouch.cpp:
1055         (WebCore::DocumentTouch::createTouch):
1056         * dom/DocumentTouch.h:
1057         * dom/DocumentTouch.idl:
1058         * dom/FocusEvent.cpp:
1059         (WebCore::FocusEvent::FocusEvent):
1060         * dom/FocusEvent.h:
1061         * dom/InputEvent.cpp:
1062         (WebCore::InputEvent::create):
1063         (WebCore::InputEvent::InputEvent):
1064         * dom/InputEvent.h:
1065         * dom/KeyboardEvent.cpp:
1066         (WebCore::KeyboardEvent::KeyboardEvent):
1067         (WebCore::KeyboardEvent::create):
1068         (WebCore::KeyboardEvent::initKeyboardEvent):
1069         (WebCore::KeyboardEvent::charCode const):
1070         * dom/KeyboardEvent.h:
1071         * dom/KeyboardEvent.idl:
1072         * dom/MessageEvent.h:
1073         * dom/MessageEvent.idl:
1074         * dom/MouseEvent.cpp:
1075         (WebCore::MouseEvent::create):
1076         (WebCore::MouseEvent::MouseEvent):
1077         (WebCore::MouseEvent::initMouseEvent):
1078         (WebCore::MouseEvent::initMouseEventQuirk):
1079         * dom/MouseEvent.h:
1080         * dom/MouseEvent.idl:
1081         * dom/MouseRelatedEvent.cpp:
1082         (WebCore::MouseRelatedEvent::MouseRelatedEvent):
1083         (WebCore::MouseRelatedEvent::init):
1084         (WebCore::MouseRelatedEvent::frameViewFromWindowProxy):
1085         (WebCore::MouseRelatedEvent::initCoordinates):
1086         (WebCore::MouseRelatedEvent::documentToAbsoluteScaleFactor const):
1087         (WebCore::MouseRelatedEvent::computePageLocation):
1088         (WebCore::MouseRelatedEvent::locationInRootViewCoordinates const):
1089         * dom/MouseRelatedEvent.h:
1090         * dom/Node.cpp:
1091         * dom/SimulatedClick.cpp:
1092         * dom/TextEvent.cpp:
1093         (WebCore::TextEvent::create):
1094         (WebCore::TextEvent::createForPlainTextPaste):
1095         (WebCore::TextEvent::createForFragmentPaste):
1096         (WebCore::TextEvent::createForDrop):
1097         (WebCore::TextEvent::createForDictation):
1098         (WebCore::TextEvent::TextEvent):
1099         (WebCore::TextEvent::initTextEvent):
1100         * dom/TextEvent.h:
1101         * dom/TextEvent.idl:
1102         * dom/TouchEvent.idl:
1103         * dom/UIEvent.cpp:
1104         (WebCore::UIEvent::UIEvent):
1105         (WebCore::UIEvent::initUIEvent):
1106         * dom/UIEvent.h:
1107         (WebCore::UIEvent::create):
1108         (WebCore::UIEvent::view const):
1109         * dom/UIEvent.idl:
1110         * dom/UIEventInit.h:
1111         * dom/UIEventInit.idl:
1112         * dom/UIEventWithKeyState.h:
1113         (WebCore::UIEventWithKeyState::UIEventWithKeyState):
1114         * dom/WheelEvent.cpp:
1115         (WebCore::WheelEvent::WheelEvent):
1116         (WebCore::WheelEvent::create):
1117         (WebCore::WheelEvent::initWebKitWheelEvent):
1118         * dom/WheelEvent.h:
1119         * dom/WheelEvent.idl:
1120         * editing/AlternativeTextController.cpp:
1121         (WebCore::AlternativeTextController::insertDictatedText):
1122         * editing/Editor.cpp:
1123         (WebCore::Editor::pasteAsPlainText):
1124         (WebCore::Editor::pasteAsFragment):
1125         (WebCore::Editor::setComposition):
1126         * html/HTMLDocument.cpp:
1127         (WebCore::HTMLDocument::namedItem):
1128         * html/HTMLDocument.h:
1129         * html/HTMLDocument.idl:
1130         * html/HTMLFrameElement.idl:
1131         * html/HTMLFrameOwnerElement.cpp:
1132         (WebCore::HTMLFrameOwnerElement::contentWindow const):
1133         * html/HTMLFrameOwnerElement.h:
1134         * html/HTMLFrameSetElement.cpp:
1135         (WebCore::HTMLFrameSetElement::namedItem):
1136         * html/HTMLFrameSetElement.h:
1137         * html/HTMLFrameSetElement.idl:
1138         * html/HTMLIFrameElement.idl:
1139         * html/ImageDocument.cpp:
1140         * page/DOMWindow.cpp:
1141         (WebCore::PostMessageTimer::PostMessageTimer):
1142         (WebCore::PostMessageTimer::event):
1143         (WebCore::DOMWindow::postMessage):
1144         * page/DragController.cpp:
1145         (WebCore::DragController::dispatchTextInputEventFor):
1146         * page/EventHandler.cpp:
1147         (WebCore::EventHandler::handleTextInputEvent):
1148
1149 2018-04-27  Nan Wang  <n_wang@apple.com>
1150
1151         AX: Accessibility needs to know which part of the content view is visible on iOS
1152         https://bugs.webkit.org/show_bug.cgi?id=185085
1153         <rdar://problem/39801363>
1154
1155         Reviewed by Chris Fleizach.
1156
1157         Exposed unobscuredContentRect() to iOS accessibility object wrapper.
1158
1159         Test: accessibility/ios-simulator/unobscured-content-rect.html
1160
1161         * accessibility/ios/WebAccessibilityObjectWrapperIOS.mm:
1162         (-[WebAccessibilityObjectWrapper accessibilityVisibleContentRect]):
1163
1164 2018-04-27  Simon Fraser  <simon.fraser@apple.com>
1165
1166         Refactor filter list checking code
1167         https://bugs.webkit.org/show_bug.cgi?id=185087
1168
1169         Reviewed by Alan Bujtas.
1170
1171         Deduplicate code between filter and backdrop-filter for checking whether function lists
1172         match, by making a shared function that takes a std::function.
1173         
1174         The call sites have to declare the return type (-> const FilterOperations&) to avoid std::function
1175         converting the return type into a value.
1176
1177         * animation/KeyframeEffectReadOnly.cpp:
1178         (WebCore::KeyframeEffectReadOnly::checkForMatchingFilterFunctionLists const):
1179         (WebCore::KeyframeEffectReadOnly::checkForMatchingFilterFunctionLists):
1180         (WebCore::KeyframeEffectReadOnly::checkForMatchingBackdropFilterFunctionLists):
1181         * animation/KeyframeEffectReadOnly.h:
1182         * page/animation/KeyframeAnimation.cpp:
1183         (WebCore::KeyframeAnimation::checkForMatchingFilterFunctionLists const):
1184         (WebCore::KeyframeAnimation::checkForMatchingFilterFunctionLists):
1185         (WebCore::KeyframeAnimation::checkForMatchingBackdropFilterFunctionLists):
1186         * page/animation/KeyframeAnimation.h:
1187
1188 2018-04-27  Chris Dumez  <cdumez@apple.com>
1189
1190         Regression(r222392?): Events can have a negative timestamp which causes app breakage
1191         https://bugs.webkit.org/show_bug.cgi?id=185040
1192         <rdar://problem/39638051>
1193
1194         Reviewed by Wenson Hsieh.
1195
1196         The real fix is in UIKit when generating the touch timestamps. However, this patch
1197         does some hardening to make sure that Event.timestamp can never return a negative
1198         value even if something goes wrong.
1199
1200         * dom/Event.cpp:
1201         (WebCore::Event::timeStampForBindings const):
1202
1203 2018-04-27  Christopher Reid  <chris.reid@sony.com>
1204
1205         URL::appendEncodedHostName is using the deprecated uidna_IDNToASCII function
1206         https://bugs.webkit.org/show_bug.cgi?id=184836
1207
1208         Reviewed by Alex Christensen.
1209
1210         Update URL::appendEncodedHostName to use uidna_nameToASCII as done in r208902.
1211
1212         Test: LayoutTests\fast\url\url-hostname-encoding.html
1213
1214         * platform/URL.cpp:
1215
1216 2018-04-27  Youenn Fablet  <youenn@apple.com>
1217
1218         CachedRawResource is not handling incremental data computation correctly
1219         https://bugs.webkit.org/show_bug.cgi?id=184936
1220         <rdar://problem/38798141>
1221
1222         Reviewed by Darin Adler.
1223
1224         * loader/cache/CachedRawResource.cpp:
1225         (WebCore::CachedRawResource::updateBuffer): Fixing style.
1226
1227 2018-04-27  Zalan Bujtas  <zalan@apple.com>
1228
1229         [LFC] Implement BlockFormattingContext::layout logic and its dependencies
1230         https://bugs.webkit.org/show_bug.cgi?id=185024
1231
1232         Reviewed by Antti Koivisto.
1233
1234         This patch implements the logic for block formatting context according to
1235         https://www.w3.org/TR/CSS22/visuren.html#block-formatting
1236
1237         1. Traverse the tree iteratively (in post-order fashion) and compute the width/static position for the containers as
1238         we visit the descendant nodes until we hit a leaf node.
1239         2. Compute the position/geometry of the leaf node and move over to its sibling(s).
1240         3. Finalize the container's height/final position as we climb back on the tree.
1241         4. Run layout on the out-of-flow descendants.  
1242
1243         Note that subtrees with a formatting context root need to be laid out completely before moving on to the next box.
1244         The formatting root box is laid out in the formatting context it lives in, however its descendants get laid out
1245         in a separate formatting context (excluding out-of-flow boxes that don't belong to the root). 
1246
1247         * layout/FloatingContext.cpp:
1248         (WebCore::Layout::FloatingContext::FloatingContext):
1249         (WebCore::Layout::FloatingContext::computePosition):
1250         * layout/FormattingContext.cpp:
1251         (WebCore::Layout::FormattingContext::placeInFlowPositionedChildren const):
1252         (WebCore::Layout::FormattingContext::layoutOutOfFlowDescendants const):
1253         * layout/FormattingContext.h:
1254         * layout/LayoutContext.cpp:
1255         (WebCore::Layout::LayoutContext::updateLayout):
1256         (WebCore::Layout::LayoutContext::establishedFormattingState):
1257         * layout/LayoutContext.h:
1258         * layout/blockformatting/BlockFormattingContext.cpp:
1259         (WebCore::Layout::BlockFormattingContext::layout const):
1260         (WebCore::Layout::BlockFormattingContext::layout): Deleted.
1261         * layout/blockformatting/BlockFormattingContext.h:
1262         * layout/inlineformatting/InlineFormattingContext.cpp:
1263         (WebCore::Layout::InlineFormattingContext::layout const):
1264         (WebCore::Layout::InlineFormattingContext::layout): Deleted.
1265         * layout/inlineformatting/InlineFormattingContext.h:
1266
1267 2018-04-27  Youenn Fablet  <youenn@apple.com>
1268
1269         Use NetworkLoadChecker for XHR/fetch loads
1270         https://bugs.webkit.org/show_bug.cgi?id=184741
1271
1272         Reviewed by Chris Dumez.
1273
1274         Covered by existing tests.
1275
1276         * loader/DocumentThreadableLoader.cpp:
1277         (WebCore::DocumentThreadableLoader::shouldSetHTTPHeadersToKeep const):
1278         We need to set this option for CORS done in NetworkProcess.
1279         (WebCore::DocumentThreadableLoader::DocumentThreadableLoader):
1280         Set httpHeadersTokeep when needed (service worker or CORS loads).
1281         Remove the synchronous disabling of preflight since this is now also done for asynchronous loads.
1282         (WebCore::DocumentThreadableLoader::checkURLSchemeAsCORSEnabled):
1283         Helper routine to make the same check for both simple and preflight case.
1284         This allows more consistent error logging between WK1 and WK2.
1285         (WebCore::DocumentThreadableLoader::makeCrossOriginAccessRequest):
1286         Skip preflight in case this is done in NetworkProcess.
1287         (WebCore::DocumentThreadableLoader::makeSimpleCrossOriginAccessRequest):
1288         (WebCore::isResponseComingFromNetworkProcess):
1289         (WebCore::DocumentThreadableLoader::redirectReceived):
1290         Bypass security checks when they are already done in NetworkProcess.
1291         (WebCore::DocumentThreadableLoader::didFail):
1292         In case of AccessControl error, it might be due to a CSP check done in NetworkProcess.
1293         Check it again to enable specific CSP console logging and error reporting.
1294         (WebCore::DocumentThreadableLoader::loadRequest):
1295         Recreating the error in case of synchronous loads to be able to log it adequately.
1296         (WebCore::DocumentThreadableLoader::isDoingSecurityChecksInNetworkProcess const):
1297         * loader/DocumentThreadableLoader.h:
1298         * loader/SubresourceLoader.cpp:
1299         (WebCore::SubresourceLoader::checkResponseCrossOriginAccessControl):
1300         Specific handling of SameOrigin credential mode for which cross-origin load will not use any credential.
1301         (WebCore::SubresourceLoader::checkRedirectionCrossOriginAccessControl):
1302         We keep the application headers so that DocumentThreadableLoader does not have to restart a brand new load.
1303         * loader/cache/CachedResourceLoader.cpp:
1304         (WebCore::CachedResourceLoader::requestResource):
1305         DocumentThreadableLoader is setting referrer and origin directly. Until we fix that, we remove them from the original requests
1306         as applications are not supposed to set these headers.
1307
1308 2018-04-27  Wenson Hsieh  <wenson_hsieh@apple.com>
1309
1310         Add an experimental feature flag for viewport "min-device-width"
1311         https://bugs.webkit.org/show_bug.cgi?id=185050
1312         <rdar://problem/39624038>
1313
1314         Reviewed by Tim Horton.
1315
1316         Add MinDeviceWidthEnabled as a new runtime-enabled feature.
1317
1318         * dom/ViewportArguments.cpp:
1319         (WebCore::setViewportFeature):
1320
1321         Gate the parsing of "min-device-width" on the runtime-enabled feature being flipped on.
1322
1323         * page/RuntimeEnabledFeatures.h:
1324         (WebCore::RuntimeEnabledFeatures::setMinDeviceWidthEnabled):
1325         (WebCore::RuntimeEnabledFeatures::minDeviceWidthEnabled const):
1326
1327 2018-04-27  Simon Fraser  <simon.fraser@apple.com>
1328
1329         Make color-filter transform gradient colors
1330         https://bugs.webkit.org/show_bug.cgi?id=185080
1331
1332         Reviewed by Zalan Bujtas.
1333         
1334         In CSSGradientValue::computeStops(), transform the color of each gradient color
1335         stop through the color filter. Having a color filter makes the gradient uncacheable.
1336         
1337         Color filters can add alpha, so we also have to fix up CSSGradientValue::knownToBeOpaque()
1338         to take a RenderStyle and convert the colors before testing opaqueness. Clean up some related
1339         functions to take const RenderStyle&.
1340
1341         Test: css3/color-filters/color-filter-gradients.html
1342
1343         * css/CSSCrossfadeValue.cpp:
1344         (WebCore::subimageKnownToBeOpaque):
1345         * css/CSSFilterImageValue.cpp:
1346         (WebCore::CSSFilterImageValue::knownToBeOpaque const):
1347         * css/CSSFilterImageValue.h:
1348         * css/CSSGradientValue.cpp:
1349         (WebCore::CSSGradientValue::image):
1350         (WebCore::CSSGradientValue::computeStops):
1351         (WebCore::CSSGradientValue::knownToBeOpaque const):
1352         (WebCore::CSSLinearGradientValue::createGradient):
1353         (WebCore::CSSRadialGradientValue::createGradient):
1354         * css/CSSGradientValue.h:
1355         * css/CSSImageGeneratorValue.cpp:
1356         (WebCore::CSSImageGeneratorValue::knownToBeOpaque const):
1357         * css/CSSImageValue.cpp:
1358         (WebCore::CSSImageValue::knownToBeOpaque const):
1359         * css/CSSImageValue.h:
1360
1361 2018-04-26  Simon Fraser  <simon.fraser@apple.com>
1362
1363         Fix color-filter to apply to text decorations
1364         https://bugs.webkit.org/show_bug.cgi?id=185068
1365         <rdar://problem/39782136>
1366
1367         Reviewed by Alan Bujtas.
1368         
1369         Transform the colors of text shadows, and the shadows of text-decorations through
1370         the color-filter.
1371         
1372         Rather than clone the ShadowData stored on TextPainter and TextDecorationPainter
1373         (which would have awkward ownership implications) we pass the color filters through
1374         and just map the color through it before painting.
1375         
1376         Re-order the members of TextPainter a little to optimize padding.
1377         
1378         Also fix a bug where FilterOperations::transformColor() could transform an invalid
1379         color to a valid one; we never want this.
1380
1381         Tests: css3/color-filters/color-filter-text-decoration-shadow.html
1382                css3/color-filters/color-filter-text-shadow.html
1383
1384         * platform/graphics/filters/FilterOperations.cpp:
1385         (WebCore::FilterOperations::transformColor const):
1386         * rendering/InlineTextBox.cpp:
1387         (WebCore::InlineTextBox::paintMarkedTextForeground):
1388         (WebCore::InlineTextBox::paintMarkedTextDecoration):
1389         * rendering/TextDecorationPainter.cpp:
1390         (WebCore::TextDecorationPainter::paintTextDecoration):
1391         * rendering/TextDecorationPainter.h:
1392         (WebCore::TextDecorationPainter::setTextShadow):
1393         (WebCore::TextDecorationPainter::setShadowColorFilter):
1394         (WebCore::TextDecorationPainter::addTextShadow): Deleted.
1395         * rendering/TextPainter.cpp:
1396         (WebCore::ShadowApplier::ShadowApplier):
1397         (WebCore::TextPainter::paintTextWithShadows):
1398         (WebCore::TextPainter::paintTextAndEmphasisMarksIfNeeded): Simplify the logic that only paints the shadow
1399         on the first iteration.
1400         (WebCore::TextPainter::paintRange):
1401         * rendering/TextPainter.h:
1402         (WebCore::TextPainter::setShadowColorFilter):
1403         * rendering/svg/SVGInlineTextBox.cpp:
1404         (WebCore::SVGInlineTextBox::paintTextWithShadows):
1405
1406 2018-04-27  Wenson Hsieh  <wenson_hsieh@apple.com>
1407
1408         Rename minimumLayoutSize to viewLayoutSize
1409         https://bugs.webkit.org/show_bug.cgi?id=185050
1410         <rdar://problem/39624038>
1411
1412         Reviewed by Tim Horton.
1413
1414         See WebKit/ChangeLog for more information. No change in behavior.
1415
1416         * page/ViewportConfiguration.cpp:
1417         (WebCore::ViewportConfiguration::ViewportConfiguration):
1418         (WebCore::ViewportConfiguration::setViewLayoutSize):
1419
1420         Remove a FIXME comment that is addressed by this refactoring.
1421
1422         (WebCore::ViewportConfiguration::shouldOverrideDeviceWidthWithMinDeviceWidth const):
1423         (WebCore::ViewportConfiguration::initialScaleFromSize const):
1424         (WebCore::ViewportConfiguration::minimumScale const):
1425         (WebCore::ViewportConfiguration::updateMinimumLayoutSize):
1426         (WebCore::ViewportConfiguration::setMinimumLayoutSize): Deleted.
1427         * page/ViewportConfiguration.h:
1428         (WebCore::ViewportConfiguration::viewLayoutSize const):
1429         (WebCore::ViewportConfiguration::viewSize const): Deleted.
1430
1431 2018-04-27  Zalan Bujtas  <zalan@apple.com>
1432
1433         [LFC] Formatting contexts should create floating states.
1434         https://bugs.webkit.org/show_bug.cgi?id=185032
1435
1436         Reviewed by Antti Koivisto.
1437
1438         This patch implements the logic for sharing floating states across multiple formatting contexts.
1439         At this point this is mostly about inline formatting contexts. They either create a new floating state
1440         or inherit it from the parent formatting context.
1441
1442         * layout/FloatingState.cpp:
1443         (WebCore::Layout::FloatingState::FloatingState):
1444         * layout/FloatingState.h:
1445         (WebCore::Layout::FloatingState::create):
1446         * layout/FormattingContext.cpp:
1447         (WebCore::Layout::FormattingContext::FormattingContext):
1448         * layout/FormattingContext.h:
1449         (WebCore::Layout::FormattingContext::layoutContext const):
1450         * layout/FormattingState.cpp:
1451         (WebCore::Layout::FormattingState::FormattingState):
1452         * layout/FormattingState.h:
1453         (WebCore::Layout::FormattingState::floatingState const):
1454         * layout/LayoutContext.cpp:
1455         (WebCore::Layout::LayoutContext::updateLayout):
1456         (WebCore::Layout::LayoutContext::formattingStateForBox const):
1457         (WebCore::Layout::LayoutContext::establishedFormattingState):
1458         (WebCore::Layout::LayoutContext::formattingContext):
1459         (WebCore::Layout::LayoutContext::formattingState): Deleted.
1460         * layout/LayoutContext.h:
1461         * layout/blockformatting/BlockFormattingContext.cpp:
1462         (WebCore::Layout::BlockFormattingContext::BlockFormattingContext):
1463         (WebCore::Layout::BlockFormattingContext::createFormattingState const):
1464         (WebCore::Layout::BlockFormattingContext::createOrFindFloatingState const):
1465         (WebCore::Layout::BlockFormattingContext::formattingState const): Deleted.
1466         * layout/blockformatting/BlockFormattingContext.h:
1467         * layout/blockformatting/BlockFormattingState.cpp:
1468         (WebCore::Layout::BlockFormattingState::BlockFormattingState):
1469         * layout/blockformatting/BlockFormattingState.h:
1470         * layout/inlineformatting/InlineFormattingContext.cpp:
1471         (WebCore::Layout::InlineFormattingContext::InlineFormattingContext):
1472         (WebCore::Layout::InlineFormattingContext::createFormattingState const):
1473         (WebCore::Layout::InlineFormattingContext::createOrFindFloatingState const):
1474         (WebCore::Layout::InlineFormattingContext::formattingState const): Deleted.
1475         * layout/inlineformatting/InlineFormattingContext.h:
1476         * layout/inlineformatting/InlineFormattingState.cpp:
1477         (WebCore::Layout::InlineFormattingState::InlineFormattingState):
1478         * layout/inlineformatting/InlineFormattingState.h:
1479         * layout/layouttree/LayoutBox.cpp:
1480         (WebCore::Layout::Box::formattingContextRoot const):
1481         * layout/layouttree/LayoutBox.h:
1482
1483 2018-04-27  Wenson Hsieh  <wenson_hsieh@apple.com>
1484
1485         [Extra zoom mode] Add a mechanism to override default viewport behaviors in extra zoom mode
1486         https://bugs.webkit.org/show_bug.cgi?id=185050
1487         <rdar://problem/39624038>
1488
1489         Reviewed by Tim Horton.
1490
1491         Currently, in extra zoom mode, there's no way for web pages to opt out of the default viewport behaviors
1492         (namely, laying out at a larger width and shrinking to fit) when the web view is very tall and narrow. This
1493         patch adds a new experimental viewport attribute, "min-device-width", that can be used to prevent WebKit from
1494         automatically clamping the web view width to a greater value for the device width in this scenario.
1495
1496         Note that after this patch, logic that plumbs a minimumLayoutSize from WKWebView to the viewport configuration
1497         will need to be renamed to reflect that this size is no longer the minimum layout size, but rather, the view
1498         size that is used for viewport device dimensions by default. This refactoring will be done in a followup part.
1499
1500         See per-method comments below for more detail.
1501
1502         Test: fast/viewport/extrazoom/viewport-change-min-device-width.html
1503
1504         * dom/ViewportArguments.cpp:
1505         (WebCore::setViewportFeature):
1506         (WebCore::operator<<):
1507         * dom/ViewportArguments.h:
1508
1509         Removes `m_forceHorizontalShrinkToFit` (more detail below).
1510
1511         * page/ViewportConfiguration.cpp:
1512         (WebCore::computedMinDeviceWidth):
1513         (WebCore::ViewportConfiguration::ViewportConfiguration):
1514         (WebCore::ViewportConfiguration::setMinimumLayoutSize):
1515
1516         Instead of directly setting the minimum layout size, setMinimumLayoutSize now first sets the view size (i.e. the
1517         size we use for `device-width` in the viewport meta tag), and then updates the minimum layout size.
1518
1519         (WebCore::ViewportConfiguration::shouldOverrideDeviceWidthWithMinDeviceWidth const):
1520
1521         Replaces `m_forceHorizontalShrinkToFit`. Whether or not we shrink to fit is now determined by whether the
1522         min-device-width attribute is actively clamping the width of the view.
1523
1524         (WebCore::ViewportConfiguration::shouldIgnoreHorizontalScalingConstraints const):
1525         (WebCore::ViewportConfiguration::shouldIgnoreScalingConstraintsRegardlessOfContentSize const):
1526         (WebCore::ViewportConfiguration::updateMinimumLayoutSize):
1527
1528         Computes and sets the minimum layout size using the view size, taking the minimum device width into account if
1529         needed.
1530
1531         (WebCore::ViewportConfiguration::description const):
1532         (WebCore::ViewportConfiguration::setForceHorizontalShrinkToFit): Deleted.
1533         * page/ViewportConfiguration.h:
1534
1535 2018-04-27  Zalan Bujtas  <zalan@apple.com>
1536
1537         [LFC] Formatting contexts should take const Box&
1538         https://bugs.webkit.org/show_bug.cgi?id=185031
1539
1540         Reviewed by Sam Weinig.
1541
1542         The formatting root boxes are supposed to be all const. The only reason why
1543         they are not is because WeakPtr<> does not support const objects yet.
1544         Use const_cast instead (remove it when WeakPtr<> gains const support).
1545
1546         * layout/FormattingContext.cpp:
1547         (WebCore::Layout::FormattingContext::FormattingContext):
1548         * layout/FormattingContext.h:
1549         * layout/LayoutContext.cpp:
1550         (WebCore::Layout::LayoutContext::LayoutContext):
1551         (WebCore::Layout::LayoutContext::formattingContext):
1552         * layout/LayoutContext.h:
1553         * layout/blockformatting/BlockFormattingContext.cpp:
1554         (WebCore::Layout::BlockFormattingContext::BlockFormattingContext):
1555         * layout/blockformatting/BlockFormattingContext.h:
1556         * layout/inlineformatting/InlineFormattingContext.cpp:
1557         (WebCore::Layout::InlineFormattingContext::InlineFormattingContext):
1558         * layout/inlineformatting/InlineFormattingContext.h:
1559
1560 2018-04-27  Zalan Bujtas  <zalan@apple.com>
1561
1562         [LFC] Add layout tree iterators.
1563         https://bugs.webkit.org/show_bug.cgi?id=185058
1564
1565         Reviewed by Antti Koivisto.
1566
1567         They work exactly like the renderer tree iterators.
1568
1569         * WebCore.xcodeproj/project.pbxproj:
1570         * layout/layouttree/LayoutAncestorIterator.h: Added.
1571         (WebCore::Layout::LayoutAncestorIterator<T>::LayoutAncestorIterator):
1572         (WebCore::Layout::LayoutAncestorIterator<T>::operator):
1573         (WebCore::Layout::LayoutAncestorIteratorAdapter<T>::LayoutAncestorIteratorAdapter):
1574         (WebCore::Layout::LayoutAncestorIteratorAdapter<T>::begin const):
1575         (WebCore::Layout::LayoutAncestorIteratorAdapter<T>::end const):
1576         (WebCore::Layout::LayoutAncestorIteratorAdapter<T>::first const):
1577         (WebCore::Layout::ancestorsOfType):
1578         (WebCore::Layout::lineageOfType):
1579         * layout/layouttree/LayoutBox.cpp:
1580         * layout/layouttree/LayoutChildIterator.h: Added.
1581         (WebCore::Layout::LayoutChildtIterator<T>::LayoutChildtIterator):
1582         (WebCore::Layout::LayoutChildtIterator<T>::operator):
1583         (WebCore::Layout::LayoutChildtIteratorAdapter<T>::LayoutChildtIteratorAdapter):
1584         (WebCore::Layout::LayoutChildtIteratorAdapter<T>::begin const):
1585         (WebCore::Layout::LayoutChildtIteratorAdapter<T>::end const):
1586         (WebCore::Layout::LayoutChildtIteratorAdapter<T>::first const):
1587         (WebCore::Layout::LayoutChildtIteratorAdapter<T>::last const):
1588         (WebCore::Layout::childrenOfType):
1589         * layout/layouttree/LayoutIterator.h: Added.
1590         (WebCore::Layout::isLayoutBoxOfType):
1591         (WebCore::Layout::Traversal::firstChild):
1592         (WebCore::Layout::Traversal::lastChild):
1593         (WebCore::Layout::Traversal::nextSibling):
1594         (WebCore::Layout::Traversal::previousSibling):
1595         (WebCore::Layout::Traversal::findAncestorOfType):
1596         (WebCore::Layout::Traversal::nextAncestorSibling):
1597         (WebCore::Layout::Traversal::nextWithin):
1598         (WebCore::Layout::Traversal::firstWithin):
1599         (WebCore::Layout::Traversal::next):
1600         (WebCore::Layout::LayoutIterator<T>::LayoutIterator):
1601         (WebCore::Layout::LayoutIterator<T>::traverseNextSibling):
1602         (WebCore::Layout::LayoutIterator<T>::traverseNext):
1603         (WebCore::Layout::LayoutIterator<T>::traversePreviousSibling):
1604         (WebCore::Layout::LayoutIterator<T>::traverseAncestor):
1605         (WebCore::Layout::LayoutIterator<T>::operator const):
1606         (WebCore::Layout:: const):
1607         (WebCore::Layout::= const):
1608
1609 2018-04-27  Commit Queue  <commit-queue@webkit.org>
1610
1611         Unreviewed, rolling out r231089.
1612         https://bugs.webkit.org/show_bug.cgi?id=185071
1613
1614         Broke and made crash some WPE EME tests (Requested by calvaris
1615         on #webkit).
1616
1617         Reverted changeset:
1618
1619         "[EME][GStreamer] Move the decryptor from AppendPipeline to
1620         PlaybackPipeline."
1621         https://bugs.webkit.org/show_bug.cgi?id=181855
1622         https://trac.webkit.org/changeset/231089
1623
1624 2018-04-27  Yacine Bandou  <yacine.bandou_ext@softathome.com>
1625
1626         [EME][GStreamer] Move the decryptor from AppendPipeline to PlaybackPipeline.
1627         https://bugs.webkit.org/show_bug.cgi?id=181855
1628
1629         Reviewed by Xabier Rodriguez-Calvar.
1630
1631         The goal of this move is to handle the limitation of SVP (Secure Video Path) memory size.
1632
1633         When the decryptor is in the AppendPipeline and we use SVP, we buffer in MediaSource queue
1634         the decrypted GstBuffers that are in SVP memory.
1635         This behavior cause an out-of-memory error, because we are limited in SVP memory size.
1636
1637         By moving the decryptor in PlaybackPipeline, we avoid to buffer the decrypted GstBuffers
1638         which use the SVP memory and we buffer the encrypted GstBuffers that are in system memory.
1639
1640         This new architecture also allows to start the buffering before obtaining the DRM license
1641         and it makes easier to manage dynamic change of the license or Key.
1642
1643         The decryptor is auto plugged by GStreamer playbin in PlaybackPipeline.
1644
1645         SVP: Secure Video Path also named trusted or protected video path, it is a memory which is
1646         protected by a hardware access control engine, it is not accessible to other unauthorised
1647         software or hardware components.
1648
1649         Tests:
1650             media/encrypted-media/clearKey/clearKey-cenc-audio-playback-mse.html
1651             media/encrypted-media/clearKey/clearKey-cenc-video-playback-mse.html
1652
1653         * platform/graphics/gstreamer/eme/WebKitCommonEncryptionDecryptorGStreamer.cpp:
1654         (webkitMediaCommonEncryptionDecryptSinkEventHandler):
1655         * platform/graphics/gstreamer/mse/AppendPipeline.cpp:
1656         (WebCore::dumpAppendState):
1657         (WebCore::AppendPipeline::AppendPipeline):
1658         (WebCore::AppendPipeline::handleNeedContextSyncMessage):
1659         (WebCore::AppendPipeline::handleAppsrcNeedDataReceived):
1660         (WebCore::AppendPipeline::setAppendState):
1661         (WebCore::AppendPipeline::parseDemuxerSrcPadCaps):
1662         (WebCore::AppendPipeline::appsinkNewSample):
1663         (WebCore::AppendPipeline::connectDemuxerSrcPadToAppsinkFromAnyThread):
1664         (WebCore::AppendPipeline::disconnectDemuxerSrcPadFromAppsinkFromAnyThread):
1665         (WebCore::appendPipelineElementMessageCallback): Deleted.
1666         (WebCore::AppendPipeline::handleElementMessage): Deleted.
1667         (WebCore::AppendPipeline::dispatchPendingDecryptionStructure): Deleted.
1668         (WebCore::AppendPipeline::dispatchDecryptionStructure): Deleted.
1669         * platform/graphics/gstreamer/mse/AppendPipeline.h:
1670         * platform/graphics/gstreamer/mse/MediaPlayerPrivateGStreamerMSE.cpp:
1671         (WebCore::MediaPlayerPrivateGStreamerMSE::attemptToDecryptWithInstance):
1672         * platform/graphics/gstreamer/mse/PlaybackPipeline.cpp:
1673
1674 2018-04-27  Yacine Bandou  <yacine.bandou_ext@softathome.com>
1675
1676         [EME][GStreamer] Add a new message "decrypt-key-needed" send from the decryptor to the application.
1677         https://bugs.webkit.org/show_bug.cgi?id=181858
1678
1679         Reviewed by Xabier Rodriguez-Calvar.
1680
1681         Add a new message "decrypt-key-needed" that the decryptor can send when it doesn't have an available key.
1682         This message should be handled by the application in order to dispatch or send the key to the decryptor.
1683         This patch is a preparation for the patch 181855.
1684         With the patch 181855, the decryptor will be in the PlaybackPipeline instead of AppendPipeline, thus we can
1685         get the DRM license or key before to instantiate or load the decryptor plugin in PlaybackPipeline.
1686         When the decryptor plugin is instantiated or loaded, it should able to ask the application to resend
1687         the DRM license or key by using this new message "decrypt-key-needed".
1688
1689
1690         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:
1691         (WebCore::MediaPlayerPrivateGStreamer::handleMessage):
1692         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp:
1693         (WebCore::MediaPlayerPrivateGStreamerBase::dispatchCDMInstance):
1694         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.h:
1695         * platform/graphics/gstreamer/eme/WebKitCommonEncryptionDecryptorGStreamer.cpp:
1696         (webkitMediaCommonEncryptionDecryptTransformInPlace):
1697
1698 2018-04-26  Justin Fan  <justin_fan@apple.com>
1699
1700         tex[Sub]Image2D slow when passing in a <canvas>, faster with ImageData.
1701         https://bugs.webkit.org/show_bug.cgi?id=184843
1702         <rdar://problem/34898868>
1703
1704         Reviewed by Simon Fraser.
1705
1706         On certain test pages passing 2d canvas objects to gl.texSubImage2D, we spend significant time doing an alpha unpremultiplication in FormatConverter::convert on a single thread. 
1707         For now, I am introducing use of the Accelerate framework to do canvas alpha unpremultiplication, specifically for RGBA8 > RGBA8.
1708         This improves this rendering path by a factor of ~4. The rest of FormatConverter could use similar improvements; filed https://bugs.webkit.org/show_bug.cgi?id=185064 for these. 
1709
1710         * platform/graphics/FormatConverter.cpp:
1711         (WebCore::FormatConverter::convert):
1712
1713 2018-04-26  Simon Fraser  <simon.fraser@apple.com>
1714
1715         Implement rendering support for the color-filter CSS property
1716         https://bugs.webkit.org/show_bug.cgi?id=185047
1717         rdar://problem/39664967
1718
1719         Reviewed by Tim Horton.
1720         
1721         The color-filter property transforms CSS colors just before painting. To support this,
1722         add to RenderStyle colorByApplyingColorFilter() and visitedDependentColorWithColorFilter().
1723         At most calls sites that transform colors for rendering, replace calls to
1724         visitedDependentColor() with visitedDependentColorWithColorFilter(). The few locations
1725         that don't use visitedDependentColor() (e.g. for shadows) call colorByApplyingColorFilter().
1726         
1727         Color transformation is implemented via a new virtual function on FilterOperation;
1728         BasicColorMatrixFilterOperation overrides this to use a new ColorMatrix class to
1729         do color math, and BasicComponentTransferFilterOperation to do the equivalent of component
1730         transfer operations. The math in both cases matches that for SVG filters, with the exception
1731         that color components are stored as floats through multiple filters and then mapped to
1732         normal 0-255 color components at the end.
1733
1734         Tests: css3/color-filters/color-filter-backgrounds-borders.html
1735                css3/color-filters/color-filter-box-shadow.html
1736                css3/color-filters/color-filter-brightness.html
1737                css3/color-filters/color-filter-color-property-list-item.html
1738                css3/color-filters/color-filter-color-property.html
1739                css3/color-filters/color-filter-color-text-decorations.html
1740                css3/color-filters/color-filter-column-rule.html
1741                css3/color-filters/color-filter-contrast.html
1742                css3/color-filters/color-filter-current-color.html
1743                css3/color-filters/color-filter-filter-list.html
1744                css3/color-filters/color-filter-grayscale.html
1745                css3/color-filters/color-filter-hue-rotate.html
1746                css3/color-filters/color-filter-inherits.html
1747                css3/color-filters/color-filter-invert.html
1748                css3/color-filters/color-filter-opacity.html
1749                css3/color-filters/color-filter-outline.html
1750                css3/color-filters/color-filter-saturate.html
1751                css3/color-filters/color-filter-sepia.html
1752                css3/color-filters/color-filter-text-emphasis.html
1753
1754         * html/HTMLTextFormControlElement.cpp:
1755         (WebCore::HTMLTextFormControlElement::adjustInnerTextStyle const):
1756         * page/FrameView.cpp:
1757         (WebCore::FrameView::documentBackgroundColor const):
1758         * platform/graphics/ColorUtilities.cpp:
1759         (WebCore::ColorMatrix::ColorMatrix):
1760         (WebCore::ColorMatrix::makeIdentity):
1761         (WebCore::ColorMatrix::grayscaleMatrix):
1762         (WebCore::ColorMatrix::saturationMatrix):
1763         (WebCore::ColorMatrix::hueRotateMatrix):
1764         (WebCore::ColorMatrix::sepiaMatrix):
1765         (WebCore::ColorMatrix::transformColorComponents const):
1766         * platform/graphics/ColorUtilities.h:
1767         * platform/graphics/filters/FilterOperation.cpp:
1768         (WebCore::BasicColorMatrixFilterOperation::transformColor const):
1769         (WebCore::BasicComponentTransferFilterOperation::transformColor const):
1770         * platform/graphics/filters/FilterOperation.h:
1771         (WebCore::FilterOperation::transformColor const):
1772         * platform/graphics/filters/FilterOperations.cpp:
1773         (WebCore::FilterOperations::transformColor const):
1774         * platform/graphics/filters/FilterOperations.h:
1775         * rendering/BorderEdge.cpp:
1776         (WebCore::BorderEdge::getBorderEdgeInfo):
1777         * rendering/EllipsisBox.cpp:
1778         (WebCore::EllipsisBox::paint):
1779         (WebCore::EllipsisBox::paintSelection):
1780         * rendering/InlineFlowBox.cpp:
1781         (WebCore::InlineFlowBox::paintBoxDecorations):
1782         * rendering/InlineTextBox.cpp:
1783         (WebCore::InlineTextBox::paintMarkedTextForeground):
1784         (WebCore::InlineTextBox::paintMarkedTextDecoration):
1785         (WebCore::InlineTextBox::paintCompositionUnderline const):
1786         * rendering/RenderBox.cpp:
1787         (WebCore::RenderBox::paintRootBoxFillLayers):
1788         (WebCore::RenderBox::paintBackground):
1789         (WebCore::RenderBox::getBackgroundPaintedExtent const):
1790         (WebCore::RenderBox::backgroundIsKnownToBeOpaqueInRect const):
1791         (WebCore::RenderBox::backgroundHasOpaqueTopLayer const):
1792         * rendering/RenderBoxModelObject.cpp:
1793         (WebCore::applyBoxShadowForBackground):
1794         (WebCore::RenderBoxModelObject::paintFillLayerExtended):
1795         (WebCore::RenderBoxModelObject::boxShadowShouldBeAppliedToBackground const):
1796         (WebCore::RenderBoxModelObject::paintBoxShadow):
1797         * rendering/RenderDetailsMarker.cpp:
1798         (WebCore::RenderDetailsMarker::paint):
1799         * rendering/RenderElement.cpp:
1800         (WebCore::RenderElement::selectionColor const):
1801         (WebCore::RenderElement::selectionBackgroundColor const):
1802         (WebCore::RenderElement::paintFocusRing):
1803         (WebCore::RenderElement::paintOutline):
1804         * rendering/RenderFileUploadControl.cpp:
1805         (WebCore::RenderFileUploadControl::paintObject):
1806         * rendering/RenderFrameSet.cpp:
1807         (WebCore::RenderFrameSet::paintColumnBorder):
1808         (WebCore::RenderFrameSet::paintRowBorder):
1809         * rendering/RenderImage.cpp:
1810         (WebCore::RenderImage::paintReplaced):
1811         (WebCore::RenderImage::paintAreaElementFocusRing):
1812         * rendering/RenderInline.cpp:
1813         (WebCore::RenderInline::paintOutline):
1814         * rendering/RenderLayerBacking.cpp:
1815         (WebCore::canDirectlyCompositeBackgroundBackgroundImage):
1816         (WebCore::RenderLayerBacking::rendererBackgroundColor const):
1817         * rendering/RenderLayerCompositor.cpp:
1818         (WebCore::RenderLayerCompositor::rootOrBodyStyleChanged):
1819         * rendering/RenderListBox.cpp:
1820         (WebCore::RenderListBox::paintItemForeground):
1821         (WebCore::RenderListBox::paintItemBackground):
1822         * rendering/RenderListMarker.cpp:
1823         (WebCore::RenderListMarker::paint):
1824         * rendering/RenderMenuList.cpp:
1825         (RenderMenuList::itemStyle const):
1826         (RenderMenuList::getItemBackgroundColor const):
1827         (RenderMenuList::menuStyle const):
1828         * rendering/RenderMultiColumnSet.cpp:
1829         (WebCore::RenderMultiColumnSet::paintColumnRules):
1830         * rendering/RenderSearchField.cpp:
1831         (WebCore::RenderSearchField::menuStyle const):
1832         * rendering/RenderTable.h:
1833         (WebCore::RenderTable::bgColor const):
1834         * rendering/RenderTableCell.cpp:
1835         (WebCore::RenderTableCell::computeCollapsedStartBorder const):
1836         (WebCore::RenderTableCell::computeCollapsedEndBorder const):
1837         (WebCore::RenderTableCell::computeCollapsedBeforeBorder const):
1838         (WebCore::RenderTableCell::computeCollapsedAfterBorder const):
1839         (WebCore::RenderTableCell::paintBackgroundsBehindCell):
1840         * rendering/RenderTableSection.cpp:
1841         (WebCore::RenderTableSection::paintRowGroupBorder):
1842         * rendering/RenderTheme.cpp:
1843         (WebCore::RenderTheme::paintSliderTicks):
1844         * rendering/TextDecorationPainter.cpp:
1845         (WebCore::decorationColor):
1846         * rendering/TextPaintStyle.cpp:
1847         (WebCore::computeTextPaintStyle):
1848         * rendering/mathml/MathOperator.cpp:
1849         (WebCore::MathOperator::paint):
1850         * rendering/mathml/RenderMathMLFraction.cpp:
1851         (WebCore::RenderMathMLFraction::paint):
1852         * rendering/mathml/RenderMathMLMenclose.cpp:
1853         (WebCore::RenderMathMLMenclose::paint):
1854         * rendering/mathml/RenderMathMLRoot.cpp:
1855         (WebCore::RenderMathMLRoot::paint):
1856         * rendering/mathml/RenderMathMLToken.cpp:
1857         (WebCore::RenderMathMLToken::paint):
1858         * rendering/style/RenderStyle.cpp:
1859         (WebCore::RenderStyle::visitedDependentColorWithColorFilter const):
1860         (WebCore::RenderStyle::colorByApplyingColorFilter const):
1861         * rendering/style/RenderStyle.h:
1862
1863 2018-04-26  Mark Lam  <mark.lam@apple.com>
1864
1865         Gardening: Speculative build fix for Windows.
1866         https://bugs.webkit.org/show_bug.cgi?id=184976
1867         <rdar://problem/39723901>
1868
1869         Not reviewed.
1870
1871         * cssjit/CSSPtrTag.h:
1872
1873 2018-04-26  Brent Fulgham  <bfulgham@apple.com>
1874
1875         Show punycode if URL contains Latin small letter o with dot below character
1876         https://bugs.webkit.org/show_bug.cgi?id=185051
1877         <rdar://problem/39459297>
1878
1879         Reviewed by David Kilzer.
1880
1881         Revise our "lookalike character" logic to include the small Latin o
1882         with dot below character.
1883
1884         Test: fast/url/host.html
1885
1886         * platform/mac/WebCoreNSURLExtras.mm:
1887         (WebCore::isLookalikeCharacter):
1888
1889 2018-04-26  Daniel Bates  <dabates@apple.com>
1890
1891         Fix the build following r231068
1892         (https://bugs.webkit.org/show_bug.cgi?id=185002)
1893
1894         Substitute mainResourceRequest.resourceRequest().url() for mainResourceRequest.url() as the
1895         latter does not exist.
1896
1897         * loader/DocumentLoader.cpp:
1898         (WebCore::DocumentLoader::loadMainResource):
1899
1900 2018-04-26  Daniel Bates  <dabates@apple.com>
1901
1902         DocumentLoader::loadMainResource() should WTFMove() the passed ResourceRequest
1903         https://bugs.webkit.org/show_bug.cgi?id=185002
1904
1905         Reviewed by Youenn Fablet and Alex Christensen.
1906
1907         In r224852 we extracted logic from DocumentLoader::startLoadingMainResource() into a new
1908         function DocumentLoader::loadMainResource() that could be shared by both DocumentLoader::startLoadingMainResource()
1909         and the service worker code. As part of this extraction, DocumentLoader::loadMainResource()
1910         takes a ResourceRequest by rvalue reference, but it never actually takes ownership of this
1911         ResourceRequest and subsequently makes a copy of it when instantiating a CachedResourceRequest.
1912         Instead we should WTFMove() the passed request into the CachedResourceRequest.
1913
1914         * loader/DocumentLoader.cpp:
1915         (WebCore::DocumentLoader::loadMainResource):
1916
1917 2018-04-26  Sihui Liu  <sihui_liu@apple.com>
1918
1919         -[WKHTTPCookieStore deleteCookie:completionHandler:] doesn't delete cookies
1920         https://bugs.webkit.org/show_bug.cgi?id=184938
1921         <rdar://problem/34737395>
1922
1923         Reviewed by Geoffrey Garen.
1924
1925         When a Cookie object was converted to NSHTTPCookie object, the HTTPOnly property information
1926         was lost so the delete function cannot find the proper cookie to delete.
1927         This patch implements a workaround that compares Cookie object instead of NSHTTPCookie 
1928         object. We might want to add the ability to set HTTPOnly header during conversion if there
1929         is an easy way to do it later.
1930         
1931         New API test: WebKit.WKHTTPCookieStoreHttpOnly
1932
1933         * platform/network/cocoa/CookieCocoa.mm:
1934         (WebCore::Cookie::operator== const):
1935         * platform/network/cocoa/NetworkStorageSessionCocoa.mm:
1936         (WebCore::NetworkStorageSession::deleteCookie):
1937
1938 2018-04-26  Commit Queue  <commit-queue@webkit.org>
1939
1940         Unreviewed, rolling out r231052.
1941         https://bugs.webkit.org/show_bug.cgi?id=185044
1942
1943         Broke test http/tests/security/credentials-main-resource.html
1944         (Requested by dydz on #webkit).
1945
1946         Reverted changeset:
1947
1948         "DocumentLoader::loadMainResource() should WTFMove() the
1949         passed ResourceRequest"
1950         https://bugs.webkit.org/show_bug.cgi?id=185002
1951         https://trac.webkit.org/changeset/231052
1952
1953 2018-04-26  Jer Noble  <jer.noble@apple.com>
1954
1955         WK_COCOA_TOUCH all the things.
1956         https://bugs.webkit.org/show_bug.cgi?id=185006
1957
1958         Reviewed by Tim Horton.
1959
1960         * Configurations/WebCore.xcconfig:
1961
1962 2018-04-26  David Kilzer  <ddkilzer@apple.com>
1963
1964         Make WAKScrollView delegate a weak property
1965         <https://webkit.org/b/184799>
1966         <rdar://problem/39469669>
1967
1968         Reviewed by Simon Fraser.
1969
1970         * platform/ios/wak/WAKScrollView.h:
1971         - Remove `delegate` instance variable declaration.
1972         - Declare `delegate` property as weak.
1973         (-[WAKScrollView setDelegate:]): Delete declaration.
1974         (-[WAKScrollView delegate]): Ditto.
1975         * platform/ios/wak/WAKScrollView.mm:
1976         - Synthesize getter/setter methods for `delegate` property.
1977         (-[WAKScrollView setDelegate:]): Delete implementation.
1978         (-[WAKScrollView delegate]): Ditto.
1979
1980 2018-04-26  Youenn Fablet  <youenn@apple.com>
1981
1982         CORS preflight checker should add a console message when preflight load is blocked
1983         https://bugs.webkit.org/show_bug.cgi?id=185021
1984
1985         Reviewed by Chris Dumez.
1986
1987         No change of behavior, adding a JS console message when preflight load is blocked.
1988         This mirrors what is being done in preflighting done from NetworkProcess.
1989         Covered by existing tests.
1990
1991         * loader/CrossOriginPreflightChecker.cpp:
1992         (WebCore::CrossOriginPreflightChecker::notifyFinished):
1993         (WebCore::CrossOriginPreflightChecker::doPreflight):
1994
1995 2018-04-26  Daniel Bates  <dabates@apple.com>
1996
1997         DocumentLoader::loadMainResource() should WTFMove() the passed ResourceRequest
1998         https://bugs.webkit.org/show_bug.cgi?id=185002
1999
2000         Reviewed by Youenn Fablet and Alex Christensen.
2001
2002         In r224852 we extracted logic from DocumentLoader::startLoadingMainResource() into a new
2003         function DocumentLoader::loadMainResource() that could be shared by both DocumentLoader::startLoadingMainResource()
2004         and the service worker code. As part of this extraction, DocumentLoader::loadMainResource()
2005         takes a ResourceRequest by rvalue reference, but it never actually takes ownership of this
2006         ResourceRequest and subsequently makes a copy of it when instantiating a CachedResourceRequest.
2007         Instead we should WTFMove() the passed request into the CachedResourceRequest.
2008
2009         * loader/DocumentLoader.cpp:
2010         (WebCore::DocumentLoader::loadMainResource):
2011
2012 2018-04-26  Per Arne Vollan  <pvollan@apple.com>
2013
2014         Disable content filtering in minimal simulator mode
2015         https://bugs.webkit.org/show_bug.cgi?id=185027
2016         <rdar://problem/39736091>
2017
2018         Reviewed by Jer Noble.
2019
2020         * Configurations/FeatureDefines.xcconfig:
2021
2022 2018-04-25  Brent Fulgham  <bfulgham@apple.com>
2023
2024         Add port 548 (afpovertcp) to port blacklist
2025         https://bugs.webkit.org/show_bug.cgi?id=185000
2026         <rdar://problem/39540481>
2027
2028         Reviewed by David Kilzer.
2029
2030         Tested by security/block-test.html.
2031
2032         * platform/URL.cpp:
2033         (WebCore::portAllowed):Also block port 548.
2034
2035 2018-04-26  Andy VanWagoner  <thetalecrafter@gmail.com>
2036
2037         [INTL] Implement Intl.PluralRules
2038         https://bugs.webkit.org/show_bug.cgi?id=184312
2039
2040         Reviewed by JF Bastien.
2041
2042         Added Intl.PluralRules feature flag.
2043
2044         Test: js/intl-pluralrules.html
2045
2046         * Configurations/FeatureDefines.xcconfig:
2047
2048 2018-04-15  Darin Adler  <darin@apple.com>
2049
2050         [Cocoa] Adopt CCRSAGetCRTComponents and stop using CCBigNum
2051         https://bugs.webkit.org/show_bug.cgi?id=184637
2052
2053         Reviewed by Alexey Proskuryakov.
2054
2055         * crypto/CommonCryptoUtilities.cpp: Compile out WebCore::CCBigNum class if
2056         HAVE(CCRSAGetCRTComponents) is true.
2057
2058         * crypto/CommonCryptoUtilities.h: Define HAVE(CCRSAGetCRTComponents) on new
2059         enough versions of iOS and macOS that have it and add declarations of the
2060         function for the non-Apple-internal-SDK case. Also don't define the
2061         WebCore::CCBigNum class if HAVE(CCRSAGetCRTComponents) is true.
2062
2063         * crypto/mac/CryptoKeyRSAMac.cpp:
2064         (WebCore::getPrivateKeyComponents): Use CCRSAGetCRTComponents if present.
2065
2066 2018-04-26  Per Arne Vollan  <pvollan@apple.com>
2067
2068         Add lazy initialization of caption display mode for videos.
2069         https://bugs.webkit.org/show_bug.cgi?id=184993
2070
2071         The call to MACaptionAppearanceGetDisplayType in CaptionUserPreferencesMediaAF::captionDisplayMode()
2072         is showing up in samples when called from HTMLMediaElement::finishInitialization().
2073
2074         Reviewed by Eric Carlson.
2075
2076         No new tests, covered by existing tests.
2077
2078         * html/HTMLMediaElement.cpp:
2079         (WebCore::HTMLMediaElement::finishInitialization):
2080         (WebCore::HTMLMediaElement::setSelectedTextTrack):
2081         (WebCore::HTMLMediaElement::mediaPlayerCharacteristicChanged):
2082         (WebCore::HTMLMediaElement::captionPreferencesChanged):
2083         (WebCore::HTMLMediaElement::captionDisplayMode):
2084         * html/HTMLMediaElement.h:
2085
2086 2018-04-26  Zan Dobersek  <zdobersek@igalia.com>
2087
2088         [GTK][WPE] Initial ASYNC_SCROLLING support
2089         https://bugs.webkit.org/show_bug.cgi?id=184961
2090
2091         Reviewed by Carlos Garcia Campos.
2092
2093         Add CoordinatedGraphics-specific code that will be required for async
2094         scrolling support. The ScrollingCoordinatorCoordinatedGraphics and
2095         ScrollingTreeCoordinatedGraphics classes are mostly complete already,
2096         but the new ScrollingTreeNode-inheriting classes will need further
2097         work that will have to be done in parallel with other improvements
2098         planned for the CoordinatedGraphics subsystem.
2099
2100         While the build-time flag is enabled, the feature is still not enabled
2101         at runtime due to being marked as unsupported by the DrawingArea
2102         implementation in the WebKit layer. It would also not work yet if it
2103         were enabled due to the before-mentioned pending changes.
2104
2105         Various build fixes that address non-Cocoa usage of ASYNC_SCROLLING
2106         code are included.
2107
2108         * Sources.txt: Add AsyncScrollingCoordinator.cpp to build.
2109         * SourcesCocoa.txt:
2110         * SourcesGTK.txt: Add new files to build.
2111         * SourcesWPE.txt: Ditto.
2112         * page/scrolling/AsyncScrollingCoordinator.cpp:
2113         Guard setStateScrollingNodeSnapOffsetsAsFloat() with CSS_SCROLL_SNAP.
2114         * page/scrolling/ScrollingTree.h:
2115         * page/scrolling/ThreadedScrollingTree.cpp:
2116         * page/scrolling/ThreadedScrollingTree.h:
2117         currentSnapPointIndicesDidChange() method is only invoked in
2118         Cocoa-specific code, and its implementation calls Cocoa-specific method
2119         on the AsyncScrollingCoordinator class.
2120         * page/scrolling/coordinatedgraphics/ScrollingCoordinatorCoordinatedGraphics.cpp:
2121         (WebCore::ScrollingCoordinator::create):
2122         (WebCore::ScrollingCoordinatorCoordinatedGraphics::ScrollingCoordinatorCoordinatedGraphics):
2123         (WebCore::ScrollingCoordinatorCoordinatedGraphics::~ScrollingCoordinatorCoordinatedGraphics):
2124         (WebCore::ScrollingCoordinatorCoordinatedGraphics::pageDestroyed):
2125         (WebCore::ScrollingCoordinatorCoordinatedGraphics::commitTreeStateIfNeeded):
2126         (WebCore::ScrollingCoordinatorCoordinatedGraphics::handleWheelEvent):
2127         (WebCore::ScrollingCoordinatorCoordinatedGraphics::scheduleTreeStateCommit):
2128         (WebCore::ScrollingCoordinatorCoordinatedGraphics::commitTreeState):
2129         * page/scrolling/coordinatedgraphics/ScrollingCoordinatorCoordinatedGraphics.h: Added.
2130         * page/scrolling/coordinatedgraphics/ScrollingTreeCoordinatedGraphics.cpp: Added.
2131         (WebCore::ScrollingTreeCoordinatedGraphics::create):
2132         (WebCore::ScrollingTreeCoordinatedGraphics::ScrollingTreeCoordinatedGraphics):
2133         (WebCore::ScrollingTreeCoordinatedGraphics::createScrollingTreeNode):
2134         * page/scrolling/coordinatedgraphics/ScrollingTreeCoordinatedGraphics.h: Added.
2135         * page/scrolling/coordinatedgraphics/ScrollingTreeFixedNode.cpp: Added.
2136         (WebCore::ScrollingTreeFixedNode::create):
2137         (WebCore::ScrollingTreeFixedNode::ScrollingTreeFixedNode):
2138         (WebCore::ScrollingTreeFixedNode::~ScrollingTreeFixedNode):
2139         (WebCore::ScrollingTreeFixedNode::commitStateBeforeChildren):
2140         (WebCore::ScrollingTreeFixedNode::updateLayersAfterAncestorChange):
2141         * page/scrolling/coordinatedgraphics/ScrollingTreeFixedNode.h: Added.
2142         * page/scrolling/coordinatedgraphics/ScrollingTreeFrameScrollingNodeCoordinatedGraphics.cpp: Added.
2143         (WebCore::ScrollingTreeFrameScrollingNodeCoordinatedGraphics::create):
2144         (WebCore::ScrollingTreeFrameScrollingNodeCoordinatedGraphics::ScrollingTreeFrameScrollingNodeCoordinatedGraphics):
2145         (WebCore::ScrollingTreeFrameScrollingNodeCoordinatedGraphics::handleWheelEvent):
2146         (WebCore::ScrollingTreeFrameScrollingNodeCoordinatedGraphics::scrollPosition const):
2147         (WebCore::ScrollingTreeFrameScrollingNodeCoordinatedGraphics::setScrollPosition):
2148         (WebCore::ScrollingTreeFrameScrollingNodeCoordinatedGraphics::setScrollPositionWithoutContentEdgeConstraints):
2149         (WebCore::ScrollingTreeFrameScrollingNodeCoordinatedGraphics::setScrollLayerPosition):
2150         (WebCore::ScrollingTreeFrameScrollingNodeCoordinatedGraphics::updateLayersAfterViewportChange):
2151         * page/scrolling/coordinatedgraphics/ScrollingTreeFrameScrollingNodeCoordinatedGraphics.h: Added.
2152         * page/scrolling/coordinatedgraphics/ScrollingTreeStickyNode.cpp: Added.
2153         (WebCore::ScrollingTreeStickyNode::create):
2154         (WebCore::ScrollingTreeStickyNode::ScrollingTreeStickyNode):
2155         (WebCore::ScrollingTreeStickyNode::~ScrollingTreeStickyNode):
2156         (WebCore::ScrollingTreeStickyNode::commitStateBeforeChildren):
2157         (WebCore::ScrollingTreeStickyNode::updateLayersAfterAncestorChange):
2158         * page/scrolling/coordinatedgraphics/ScrollingTreeStickyNode.h: Added.
2159         * platform/PlatformWheelEvent.h: Enable PlatformWheelEventPhase code
2160         for WPE. Guard latching-specific methods under ASYNC_SCROLLING.
2161         * platform/TextureMapper.cmake: Two build targets have been moved to
2162         SourcesGTK.txt and SourcesWPE.txt.
2163
2164 2018-04-25  Michael Catanzaro  <mcatanzaro@igalia.com>
2165
2166         [WPE] Build and link against latest WPEBackend and WPEBackend-fdo
2167         https://bugs.webkit.org/show_bug.cgi?id=184643
2168
2169         Reviewed by Žan Doberšek.
2170
2171         Adapt to single-header WPE includes.
2172
2173         * platform/graphics/egl/GLContextEGLWPE.cpp:
2174         * platform/graphics/wpe/PlatformDisplayWPE.cpp:
2175         * platform/wpe/PlatformPasteboardWPE.cpp:
2176
2177 2018-04-25  Youenn Fablet  <youenn@apple.com>
2178
2179         Use NetworkLoadChecker for all subresource loads except fetch/XHR
2180         https://bugs.webkit.org/show_bug.cgi?id=184870
2181         <rdar://problem/39370034>
2182
2183         Reviewed by Chris Dumez.
2184
2185         No change of behavior.
2186         Update CachedResourceLoader error messages to match NetworkProcess error messages.
2187
2188         * loader/cache/CachedResourceLoader.cpp:
2189         (WebCore::CachedResourceLoader::printAccessDeniedMessage const):
2190
2191 2018-04-25  Zalan Bujtas  <zalan@apple.com>
2192
2193         [LFC] Add support for is<> and downcast<>
2194         https://bugs.webkit.org/show_bug.cgi?id=185016
2195
2196         Reviewed by Antti Koivisto.
2197
2198         * layout/layouttree/LayoutBlockContainer.cpp:
2199         (WebCore::Layout::BlockContainer::BlockContainer):
2200         * layout/layouttree/LayoutBlockContainer.h:
2201         * layout/layouttree/LayoutBox.cpp:
2202         (WebCore::Layout::Box::Box):
2203         * layout/layouttree/LayoutBox.h:
2204         (WebCore::Layout::Box::isContainer const):
2205         (WebCore::Layout::Box::isBlockContainer const):
2206         (WebCore::Layout::Box::isInlineBox const):
2207         (WebCore::Layout::Box::isInlineContainer const):
2208         * layout/layouttree/LayoutContainer.cpp:
2209         (WebCore::Layout::Container::Container):
2210         * layout/layouttree/LayoutContainer.h:
2211         * layout/layouttree/LayoutInlineBox.cpp:
2212         (WebCore::Layout::InlineBox::InlineBox):
2213         * layout/layouttree/LayoutInlineBox.h:
2214         * layout/layouttree/LayoutInlineContainer.cpp:
2215         (WebCore::Layout::InlineContainer::InlineContainer):
2216         * layout/layouttree/LayoutInlineContainer.h:
2217
2218 2018-04-25  Chris Dumez  <cdumez@apple.com>
2219
2220         window.postMessage() / focus() / blur() throw a TypeError when called on a RemoteDOMWindow
2221         https://bugs.webkit.org/show_bug.cgi?id=184981
2222
2223         Reviewed by Sam Weinig.
2224
2225         window.postMessage() / focus() / blur() was throwing a TypeError when called on a RemoteDOMWindow,
2226         complaining that |this| is not a Window. This was caused by a copy & paste mistake in
2227         JSDOMWindowCustom where we were calling the JSDOMWindow methods instead of the JSRemoteDOMWindow
2228         ones.
2229
2230         No new tests, updated existing tests.
2231
2232         * bindings/js/JSDOMWindowCustom.cpp:
2233         (WebCore::jsDOMWindowGetOwnPropertySlotRestrictedAccess):
2234         * page/RemoteDOMWindow.cpp:
2235         (WebCore::RemoteDOMWindow::postMessage):
2236         * page/RemoteDOMWindow.h:
2237         * page/RemoteDOMWindow.idl:
2238
2239 2018-04-25  Simon Fraser  <simon.fraser@apple.com>
2240
2241         brightness() filter should default to 1, and not allow negative values
2242         https://bugs.webkit.org/show_bug.cgi?id=184937
2243
2244         Reviewed by Dean Jackson.
2245
2246         Remove the special-casing for brightness() in consumeFilterFunction(), so it now
2247         follows the same logic as the other color-related filters in not allowing negative
2248         values.
2249
2250         Removed the special-casing for brightness() in createFilterOperations() so its default
2251         value is now 1.
2252
2253         Modified existing tests.
2254
2255         * css/StyleResolver.cpp:
2256         (WebCore::StyleResolver::createFilterOperations):
2257         * css/parser/CSSPropertyParserHelpers.cpp:
2258         (WebCore::CSSPropertyParserHelpers::allowsValuesGreaterThanOne):
2259         (WebCore::CSSPropertyParserHelpers::consumeFilterFunction):
2260
2261 2018-04-25  Wenson Hsieh  <wenson_hsieh@apple.com>
2262
2263         Missing closing parenthesis when determining INSTALL_PATH build setting in WebCore.xcconfig
2264         https://bugs.webkit.org/show_bug.cgi?id=184999
2265
2266         Reviewed by Tim Horton.
2267
2268         Tweaks a line in WebCore.xcconfig that computes INSTALL_PATH, so that it doesn't use WK_NOT or WK_EMPTY.
2269
2270         * Configurations/WebCore.xcconfig:
2271
2272 2018-04-25  Zalan Bujtas  <zalan@apple.com>
2273
2274         [LFC] Implement LayoutContexet::layout() and its dependencies.
2275         https://bugs.webkit.org/show_bug.cgi?id=184951
2276
2277         Reviewed by Antti Koivisto.
2278
2279         * layout/FormattingContext.cpp:
2280         (WebCore::Layout::FormattingContext::FormattingContext):
2281         (WebCore::Layout::FormattingContext::~FormattingContext):
2282         (WebCore::Layout::FormattingContext::computeStaticPosition):
2283         (WebCore::Layout::FormattingContext::computeInFlowPositionedPosition):
2284         (WebCore::Layout::FormattingContext::computeOutOfFlowPosition):
2285         (WebCore::Layout::FormattingContext::computeWidth):
2286         (WebCore::Layout::FormattingContext::computeHeight):
2287         (WebCore::Layout::FormattingContext::marginTop):
2288         (WebCore::Layout::FormattingContext::marginLeft):
2289         (WebCore::Layout::FormattingContext::marginBottom):
2290         (WebCore::Layout::FormattingContext::marginRight):
2291         * layout/FormattingContext.h:
2292         * layout/FormattingState.cpp:
2293         (WebCore::Layout::FormattingState::FormattingState):
2294         * layout/FormattingState.h:
2295         * layout/LayoutContext.cpp:
2296         (WebCore::Layout::LayoutContext::LayoutContext):
2297         (WebCore::Layout::LayoutContext::updateLayout):
2298         (WebCore::Layout::LayoutContext::formattingState):
2299         (WebCore::Layout::LayoutContext::formattingContext):
2300         * layout/LayoutContext.h:
2301         * layout/blockformatting/BlockFormattingContext.cpp:
2302         (WebCore::Layout::BlockFormattingContext::BlockFormattingContext):
2303         (WebCore::Layout::BlockFormattingContext::layout):
2304         (WebCore::Layout::BlockFormattingContext::formattingState const):
2305         (WebCore::Layout::BlockFormattingContext::computeStaticPosition):
2306         (WebCore::Layout::BlockFormattingContext::computeWidth):
2307         (WebCore::Layout::BlockFormattingContext::computeHeight):
2308         (WebCore::Layout::BlockFormattingContext::marginTop):
2309         (WebCore::Layout::BlockFormattingContext::marginBottom):
2310         * layout/blockformatting/BlockFormattingContext.h:
2311         * layout/blockformatting/BlockFormattingState.cpp:
2312         (WebCore::Layout::BlockFormattingState::BlockFormattingState):
2313         * layout/blockformatting/BlockFormattingState.h:
2314         * layout/inlineformatting/InlineFormattingContext.cpp:
2315         (WebCore::Layout::InlineFormattingContext::InlineFormattingContext):
2316         (WebCore::Layout::InlineFormattingContext::layout):
2317         (WebCore::Layout::InlineFormattingContext::formattingState const):
2318         * layout/inlineformatting/InlineFormattingContext.h:
2319         * layout/inlineformatting/InlineFormattingState.cpp:
2320         (WebCore::Layout::InlineFormattingState::InlineFormattingState):
2321         * layout/inlineformatting/InlineFormattingState.h:
2322
2323 2018-04-25  Mark Lam  <mark.lam@apple.com>
2324
2325         Push the definition of PtrTag down to the WTF layer.
2326         https://bugs.webkit.org/show_bug.cgi?id=184976
2327         <rdar://problem/39723901>
2328
2329         Reviewed by Saam Barati.
2330
2331         No new tests needed.  This is covered by existing tests.
2332
2333         * cssjit/CSSPtrTag.h:
2334         * cssjit/SelectorCompiler.h:
2335         (WebCore::SelectorCompiler::ruleCollectorSimpleSelectorCheckerFunction):
2336         (WebCore::SelectorCompiler::querySelectorSimpleSelectorCheckerFunction):
2337         (WebCore::SelectorCompiler::ruleCollectorSelectorCheckerFunctionWithCheckingContext):
2338         (WebCore::SelectorCompiler::querySelectorSelectorCheckerFunctionWithCheckingContext):
2339
2340 2018-04-25  Eric Carlson  <eric.carlson@apple.com>
2341
2342         [iOS] remove media element parameter from MediaElementSession methods
2343         https://bugs.webkit.org/show_bug.cgi?id=184992
2344         <rdar://problem/39731624>
2345
2346         Reviewed by Jon Lee.
2347
2348         No new tests, no behavior change.
2349
2350         * Modules/mediacontrols/MediaControlsHost.cpp:
2351         (WebCore::MediaControlsHost::allowsInlineMediaPlayback const):
2352         (WebCore::MediaControlsHost::userGestureRequired const):
2353         * accessibility/AccessibilityMediaObject.cpp:
2354         (WebCore::AccessibilityMediaObject::isPlayingInline const):
2355         * html/HTMLMediaElement.cpp:
2356         (WebCore::HTMLMediaElement::~HTMLMediaElement):
2357         (WebCore::HTMLMediaElement::parseAttribute):
2358         (WebCore::HTMLMediaElement::prepareForLoad):
2359         (WebCore::HTMLMediaElement::selectMediaResource):
2360         (WebCore::HTMLMediaElement::loadResource):
2361         (WebCore::HTMLMediaElement::canTransitionFromAutoplayToPlay const):
2362         (WebCore::HTMLMediaElement::setReadyState):
2363         (WebCore::HTMLMediaElement::play):
2364         (WebCore::HTMLMediaElement::pause):
2365         (WebCore::HTMLMediaElement::pauseInternal):
2366         (WebCore::HTMLMediaElement::setVolume):
2367         (WebCore::HTMLMediaElement::mediaPlayerDidAddAudioTrack):
2368         (WebCore::HTMLMediaElement::sourceWasAdded):
2369         (WebCore::HTMLMediaElement::mediaEngineWasUpdated):
2370         (WebCore::HTMLMediaElement::mediaPlayerCharacteristicChanged):
2371         (WebCore::HTMLMediaElement::updatePlayState):
2372         (WebCore::HTMLMediaElement::clearMediaPlayer):
2373         (WebCore::HTMLMediaElement::resume):
2374         (WebCore::HTMLMediaElement::webkitShowPlaybackTargetPicker):
2375         (WebCore::HTMLMediaElement::addEventListener):
2376         (WebCore::HTMLMediaElement::removeEventListener):
2377         (WebCore::HTMLMediaElement::enqueuePlaybackTargetAvailabilityChangedEvent):
2378         (WebCore::HTMLMediaElement::exitFullscreen):
2379         (WebCore::HTMLMediaElement::configureMediaControls):
2380         (WebCore::HTMLMediaElement::createMediaPlayer):
2381         (WebCore::HTMLMediaElement::mediaPlayerIsFullscreenPermitted const):
2382         (WebCore::HTMLMediaElement::updateMediaState):
2383         (WebCore::HTMLMediaElement::mediaState const):
2384         (WebCore::HTMLMediaElement::allowsMediaDocumentInlinePlaybackChanged):
2385         (WebCore::HTMLMediaElement::updateShouldPlay):
2386         * html/HTMLVideoElement.cpp:
2387         (WebCore::HTMLVideoElement::parseAttribute):
2388         (WebCore::HTMLVideoElement::supportsFullscreen const):
2389         (WebCore::HTMLVideoElement::webkitEnterFullscreen):
2390         (WebCore::HTMLVideoElement::webkitWirelessVideoPlaybackDisabled const):
2391         (WebCore::HTMLVideoElement::webkitSupportsPresentationMode const):
2392         (WebCore::HTMLVideoElement::setFullscreenMode):
2393         * html/MediaElementSession.cpp:
2394         (WebCore::MediaElementSession::playbackPermitted const):
2395         (WebCore::MediaElementSession::dataLoadingPermitted const):
2396         (WebCore::MediaElementSession::fullscreenPermitted const):
2397         (WebCore::MediaElementSession::pageAllowsDataLoading const):
2398         (WebCore::MediaElementSession::pageAllowsPlaybackAfterResuming const):
2399         (WebCore::MediaElementSession::canShowControlsManager const):
2400         (WebCore::MediaElementSession::showPlaybackTargetPicker):
2401         (WebCore::MediaElementSession::hasWirelessPlaybackTargets const):
2402         (WebCore::MediaElementSession::wirelessVideoPlaybackDisabled const):
2403         (WebCore::MediaElementSession::setWirelessVideoPlaybackDisabled):
2404         (WebCore::MediaElementSession::setHasPlaybackTargetAvailabilityListeners):
2405         (WebCore::MediaElementSession::mediaStateDidChange):
2406         (WebCore::MediaElementSession::effectivePreloadForElement const):
2407         (WebCore::MediaElementSession::requiresFullscreenForVideoPlayback const):
2408         (WebCore::MediaElementSession::allowsAutomaticMediaDataLoading const):
2409         (WebCore::MediaElementSession::mediaEngineUpdated):
2410         (WebCore::MediaElementSession::allowsPictureInPicture const):
2411         * html/MediaElementSession.h:
2412         * platform/cocoa/PlaybackSessionModelMediaElement.mm:
2413         (WebCore::PlaybackSessionModelMediaElement::wirelessVideoPlaybackDisabled const):
2414
2415 2018-04-25  Jiewen Tan  <jiewen_tan@apple.com>
2416
2417         Remove access to keychain from the WebContent process
2418         https://bugs.webkit.org/show_bug.cgi?id=184428
2419         <rdar://problem/13150903>
2420
2421         Reviewed by Brent Fulgham.
2422
2423         Part 2.
2424
2425         This patch move the operation of HTMLKeygenElement from WebContent Process to UI Process.
2426         Function signedPublicKeyAndChallengeString is therefore marked as WEBCORE_EXPORT. Also, a
2427         localized string is marked WEBCORE_EXPORT as well to support the API test.
2428
2429         Covered by existing tests and api tests.
2430
2431         * WebCore.xcodeproj/project.pbxproj:
2432         * dom/Document.cpp:
2433         (WebCore::Document::signedPublicKeyAndChallengeString):
2434         * dom/Document.h:
2435         * html/HTMLKeygenElement.cpp:
2436         (WebCore::HTMLKeygenElement::appendFormData):
2437         * page/ChromeClient.h:
2438         * platform/LocalizedStrings.h:
2439         * platform/SSLKeyGenerator.h:
2440
2441 2018-04-25  Ryosuke Niwa  <rniwa@webkit.org>
2442
2443         PSON: Don't create a new process when navigating to a blob URL, data URL, and about:blank
2444         https://bugs.webkit.org/show_bug.cgi?id=184962
2445
2446         Reviewed by Youenn Fablet.
2447
2448         Added NavigationAction::treatAsSameOriginNavigation, which signifies WebKit code to avoid creating
2449         a new WebContent process when navigating to a blob URL, data URL, and about:blank.
2450
2451         Tests: ProcessSwap.SameOriginBlobNavigation
2452                ProcessSwap.CrossOriginBlobNavigation
2453                ProcessSwap.NavigateToAboutBlank
2454                ProcessSwap.NavigateToDataURL
2455
2456         * loader/NavigationAction.cpp:
2457         (WebCore::treatAsSameOriginNavigation):
2458         * loader/NavigationAction.h:
2459         (WebCore::NavigationAction::treatAsSameOriginNavigation const):
2460
2461 2018-04-25  Zalan Bujtas  <zalan@apple.com>
2462
2463         [LFC] Implement Layout::BlockContainer functions.
2464         https://bugs.webkit.org/show_bug.cgi?id=184994
2465
2466         Reviewed by Antti Koivisto.
2467
2468         * layout/layouttree/LayoutBlockContainer.cpp:
2469         (WebCore::Layout::BlockContainer::BlockContainer):
2470         (WebCore::Layout::BlockContainer::establishesInlineFormattingContext const):
2471
2472 2018-04-25  Zalan Bujtas  <zalan@apple.com>
2473
2474         [LFC] Implement Layout::Container functions.
2475         https://bugs.webkit.org/show_bug.cgi?id=184988
2476
2477         Reviewed by Antti Koivisto.
2478
2479         * layout/layouttree/LayoutContainer.cpp:
2480         (WebCore::Layout::Container::Container):
2481         (WebCore::Layout::Container::firstInFlowChild const):
2482         (WebCore::Layout::Container::firstInFlowOrFloatingChild const):
2483         (WebCore::Layout::Container::lastInFlowChild const):
2484         (WebCore::Layout::Container::lastInFlowOrFloatingChild const):
2485         (WebCore::Layout::Container::setFirstChild):
2486         (WebCore::Layout::Container::setLastChild):
2487         (WebCore::Layout::Container::setOutOfFlowDescendants):
2488         * layout/layouttree/LayoutContainer.h:
2489         (WebCore::Layout::Container::firstChild const):
2490         (WebCore::Layout::Container::lastChild const):
2491         (WebCore::Layout::Container::hasChild const):
2492         (WebCore::Layout::Container::hasInFlowChild const):
2493         (WebCore::Layout::Container::hasInFlowOrFloatingChild const):
2494         (WebCore::Layout::Container::outOfFlowDescendants):
2495
2496 2018-04-25  Brent Fulgham  <bfulgham@apple.com>
2497
2498         Don't Block First Party Cookies on Redirects
2499         https://bugs.webkit.org/show_bug.cgi?id=184948
2500         <rdar://problem/39534099>
2501
2502         Reviewed by Youenn Fablet.
2503
2504         The Navigation scheduler looses the 'requester' value when performing a ScheduledRedirect.
2505
2506         Test: http/tests/resourceLoadStatistics/do-not-block-top-level-navigation-redirect.html
2507
2508         * loader/NavigationScheduler.cpp:
2509
2510 2018-04-25  Youenn Fablet  <youenn@apple.com>
2511
2512         CachedRawResource is not handling incremental data computation correctly
2513         https://bugs.webkit.org/show_bug.cgi?id=184936
2514
2515         Reviewed by Chris Dumez.
2516
2517         Covered by updated test.
2518
2519         The previous logic was handling the case of only one additional segment being added to the SharedBuffer.
2520         In service worker case, a SharedBuffer may contain more than one segment.
2521         This is fixed by iterating until all new data is sent to clients.
2522
2523         * loader/cache/CachedRawResource.cpp:
2524         (WebCore::CachedRawResource::updateBuffer):
2525
2526 2018-04-25  Andy Estes  <aestes@apple.com>
2527
2528         [Mac] Number of drop items is always 0 when performing a DHTML drag
2529         https://bugs.webkit.org/show_bug.cgi?id=184943
2530
2531         Reviewed by Ryosuke Niwa.
2532
2533         New API test: DragAndDropPasteboardTests.NumberOfValidItemsForDrop
2534
2535         DragController tracks the number of items to be accepted by a file input element, taking
2536         into account whether the control is disabled or accepts multiple files. When this number
2537         changes, WebKit informs the NSDraggingInfo-conforming object passed to -draggingUpdated by
2538         calling -setNumberOfValidItemsForDrop:. This number is presented to the user in a badge
2539         rendered next to the dragging item thumbnails.
2540
2541         When performing a DHTML drag, we don't know how many items the page will accept, so prior
2542         to this patch we would render a "0" in the badge. This is misleading, because the page is
2543         more likely to accept all the items (or at least one of them) rather than none of them.
2544
2545         Let's do the straightforward thing and set numberOfValidItemsForDrop to equal the number of
2546         files in the drag operation when performing a DHTML file drag.
2547
2548         * page/DragController.cpp:
2549         (WebCore::DragController::tryDocumentDrag):
2550
2551 2018-04-25  Eric Carlson  <eric.carlson@apple.com>
2552
2553         [iOS] Set route sharing policy when setting audio session category
2554         https://bugs.webkit.org/show_bug.cgi?id=184979
2555         <rdar://problem/39709577>
2556
2557         Reviewed by Jer Noble.
2558
2559         * platform/audio/ios/AudioSessionIOS.mm:
2560         (WebCore::AudioSession::setCategory):
2561
2562 2018-04-25  Basuke Suzuki  <Basuke.Suzuki@sony.com>
2563
2564         [Curl] Fix wrong schema checking on r230973
2565         https://bugs.webkit.org/show_bug.cgi?id=184977
2566
2567         Did write a wrong condition when making a string.
2568
2569         Reviewed by Alex Christensen.
2570
2571         No new tests because test interface is not ready.
2572
2573         * platform/network/curl/CurlProxySettings.cpp:
2574         (WebCore::createProxyUrl):
2575
2576 2018-04-25  Youenn Fablet  <youenn@apple.com>
2577
2578         Make DocumentThreadableLoader error logging more consistent
2579         https://bugs.webkit.org/show_bug.cgi?id=184853
2580
2581         Reviewed by Chris Dumez.
2582
2583         Covered by rebased tests.
2584         Make EventSource, XHR and Fetch log error messages consistently.
2585         This patch also prepares consistent error logging between WK1 and WK2 as WK2 NetworkProcess
2586         will issue more and more errors in places different from WK1.
2587         This is the reason for SubresourceLoader changes in this patch and DTL/didFail/preflightFailure changes.
2588
2589         Update ImageLoader error message to be more general than CORS.
2590
2591         * loader/CrossOriginPreflightChecker.cpp:
2592         (WebCore::CrossOriginPreflightChecker::doPreflight): Add some more logging for consistency between WK1 and WK2.
2593         (WebCore::CrossOriginPreflightChecker::validatePreflightResponse): Ditto.
2594         * loader/DocumentThreadableLoader.cpp:
2595         (WebCore::DocumentThreadableLoader::didFail):
2596         (WebCore::DocumentThreadableLoader::preflightFailure):
2597         (WebCore::DocumentThreadableLoader::logErrorAndFail):
2598         * loader/ImageLoader.cpp:
2599         (WebCore::ImageLoader::notifyFinished):
2600         * loader/SubresourceLoader.cpp:
2601         (WebCore::SubresourceLoader::didFail):
2602         * loader/ThreadableLoader.cpp:
2603         (WebCore::ThreadableLoader::logError):
2604         * loader/cache/CachedResource.cpp:
2605         (WebCore::CachedResource::load):
2606         * loader/cache/CachedResourceRequestInitiators.cpp:
2607         (WebCore::CachedResourceRequestInitiators::CachedResourceRequestInitiators):
2608         * loader/cache/CachedResourceRequestInitiators.h:
2609         * page/EventSource.cpp:
2610         (WebCore::EventSource::connect):
2611         (WebCore::EventSource::didFail):
2612         * xml/XMLHttpRequest.cpp:
2613         (WebCore::XMLHttpRequest::didFail):
2614
2615 2018-04-25  Zalan Bujtas  <zalan@apple.com>
2616
2617         [LFC] Implement Layout::Box functions.
2618         https://bugs.webkit.org/show_bug.cgi?id=184974
2619
2620         Reviewed by Antti Koivisto.
2621
2622         * layout/layouttree/LayoutBlockContainer.h:
2623         * layout/layouttree/LayoutBox.cpp:
2624         (WebCore::Layout::Box::Box):
2625         (WebCore::Layout::Box::~Box):
2626         (WebCore::Layout::Box::establishesFormattingContext const):
2627         (WebCore::Layout::Box::establishesBlockFormattingContext const):
2628         (WebCore::Layout::Box::isRelativelyPositioned const):
2629         (WebCore::Layout::Box::isStickyPositioned const):
2630         (WebCore::Layout::Box::isAbsolutelyPositioned const):
2631         (WebCore::Layout::Box::isFixedPositioned const):
2632         (WebCore::Layout::Box::isFloatingPositioned const):
2633         (WebCore::Layout::Box::containingBlock const):
2634         (WebCore::Layout::Box::isDescendantOf const):
2635         (WebCore::Layout::Box::isAnonymous const):
2636         (WebCore::Layout::Box::isInlineBlockBox const):
2637         (WebCore::Layout::Box::isBlockLevelBox const):
2638         (WebCore::Layout::Box::isInlineLevelBox const):
2639         (WebCore::Layout::Box::isBlockContainerBox const):
2640         (WebCore::Layout::Box::isInitialContainingBlock const):
2641         (WebCore::Layout::Box::nextInFlowSibling const):
2642         (WebCore::Layout::Box::nextInFlowOrFloatingSibling const):
2643         (WebCore::Layout::Box::previousInFlowSibling const):
2644         (WebCore::Layout::Box::previousInFlowOrFloatingSibling const):
2645         (WebCore::Layout::Box::setParent):
2646         (WebCore::Layout::Box::setNextSibling):
2647         (WebCore::Layout::Box::setPreviousSibling):
2648         (WebCore::Layout::Box::isOverflowVisible const):
2649         * layout/layouttree/LayoutBox.h:
2650         (WebCore::Layout::Box::establishesInlineFormattingContext const):
2651         (WebCore::Layout::Box::isInFlow const):
2652         (WebCore::Layout::Box::isPositioned const):
2653         (WebCore::Layout::Box::isInFlowPositioned const):
2654         (WebCore::Layout::Box::isOutOfFlowPositioned const):
2655         (WebCore::Layout::Box::isFloatingOrOutOfFlowPositioned const):
2656         (WebCore::Layout::Box::parent const):
2657         (WebCore::Layout::Box::nextSibling const):
2658         (WebCore::Layout::Box::previousSibling const):
2659         (WebCore::Layout::Box::weakPtrFactory const):
2660         * layout/layouttree/LayoutContainer.h:
2661         * layout/layouttree/LayoutInlineBox.h:
2662         * layout/layouttree/LayoutInlineContainer.h:
2663
2664 2018-04-25  Per Arne Vollan  <pvollan@apple.com>
2665
2666         [Win] Crash under WebCore::SimpleLineLayout::generateLineBoxTree
2667         https://bugs.webkit.org/show_bug.cgi?id=184953
2668
2669         This is possibly a MSVC compiler bug, since a simple rearrangement of the code fixes the crash.
2670         The crash is only happening in release builds, which also is an indication of this being a
2671         compiler issue.
2672
2673         Reviewed by Zalan Bujtas.
2674
2675         No new tests, covered by existing tests.
2676
2677         * rendering/SimpleLineLayoutFunctions.cpp:
2678         (WebCore::SimpleLineLayout::generateLineBoxTree):
2679
2680 2018-04-25  Dean Jackson  <dino@apple.com>
2681
2682         Make a better flag for system preview, and disable it where necessary
2683         https://bugs.webkit.org/show_bug.cgi?id=184968
2684         <rdar://problem/39686506>
2685
2686         Reviewed by Eric Carlson.
2687
2688         Use USE(SYSTEM_PREVIEW).
2689
2690         * html/HTMLAnchorElement.cpp:
2691         (WebCore::HTMLAnchorElement::isSystemPreviewLink const):
2692         * html/HTMLAnchorElement.h:
2693         * html/HTMLImageElement.cpp:
2694         * html/HTMLImageElement.h:
2695         * html/HTMLPictureElement.cpp:
2696         * html/HTMLPictureElement.h:
2697         * rendering/RenderImage.cpp:
2698         (WebCore::RenderImage::paintIntoRect):
2699         * rendering/RenderTheme.cpp:
2700         * rendering/RenderTheme.h:
2701         * testing/Internals.cpp:
2702         (WebCore::Internals::systemPreviewRelType):
2703         (WebCore::Internals::isSystemPreviewLink const):
2704         (WebCore::Internals::isSystemPreviewImage const):
2705
2706 2018-04-25  Zalan Bujtas  <zalan@apple.com>
2707
2708         Fix project file after r230931.
2709
2710         * WebCore.xcodeproj/project.pbxproj:
2711
2712 2018-04-25  Miguel Gomez  <magomez@igalia.com>
2713
2714         [GTK] fast/repaint/fixed-scale.html failing since r230479 "[TexMap] TextureMapperLayer unnecessarily duplicates state in GraphicsLayerTransform"
2715         https://bugs.webkit.org/show_bug.cgi?id=184780
2716
2717         Reviewed by Žan Doberšek.
2718
2719         Initialize the anchorPoint to (0.5, 0.5, 0) in TextureMapperLayer::State.
2720
2721         Covered by existent tests.
2722
2723         * platform/graphics/texmap/TextureMapperLayer.h:
2724
2725 2018-04-25  Carlos Garcia Campos  <cgarcia@igalia.com>
2726
2727         [GTK] Implement MouseEvent.buttons
2728         https://bugs.webkit.org/show_bug.cgi?id=184913
2729
2730         Reviewed by Žan Doberšek.
2731
2732         Add helper function to get the state modifier of a GDK button.
2733
2734         * platform/gtk/GtkUtilities.cpp:
2735         (WebCore::stateModifierForGdkButton):
2736         * platform/gtk/GtkUtilities.h:
2737
2738 2018-04-24  Ryosuke Niwa  <rniwa@webkit.org>
2739
2740         Release assert in ScriptController::canExecuteScripts via CachedSVGFont::ensureCustomFontData during
2741         Document::updateStyleIfNeeded
2742         https://bugs.webkit.org/show_bug.cgi?id=184950
2743
2744         Reviewed by Zalan Bujtas.
2745
2746         Convert an existing ScriptDisallowedScope::EventAllowedScope which only disables the debug assertions
2747         by ScriptDisallowedScope::DisableAssertionsInScope which also disables the release assertion.
2748
2749         Because SVG font is loaded in a document isolated from the rest of the page (m_externalSVGDocument),
2750         there is no security implication to execute scripts in this isolated document.
2751
2752         Unfortunately, no new tests. I could never make CachedSVGFont::ensureCustomFontData to get called inside
2753         style resolution with m_externalSVGDocument set to nullptr after many attempts. Even EventAllowedScope
2754         I added 13 months ago in r211965, which this patch replaces by DisableAssertionsInScope, is not utilized
2755         by the existing layout tests since removing the assertion doesn't cause any layout test to hit an assertion.
2756
2757         * dom/ScriptDisallowedScope.h: Updated the comment.
2758         * loader/cache/CachedSVGFont.cpp:
2759         (WebCore::CachedSVGFont::ensureCustomFontData): Replaced the asssertion.
2760
2761 2018-04-24  Simon Fraser  <simon.fraser@apple.com>
2762
2763         visitedDependentColor() should take a CSSPropertyID
2764         https://bugs.webkit.org/show_bug.cgi?id=184949
2765
2766         Reviewed by Sam Weinig.
2767         
2768         Change RenderStyle::colorIncludingFallback(), RenderStyle::visitedDependentColor()
2769         and RenderElement::selectionColor() to take CSSPropertyID rather than int.
2770
2771         No behavior change.
2772
2773         * rendering/RenderElement.cpp:
2774         (WebCore::RenderElement::selectionColor const):
2775         * rendering/RenderElement.h:
2776         * rendering/RenderTableCell.cpp:
2777         (WebCore::RenderTableCell::computeCollapsedStartBorder const):
2778         (WebCore::RenderTableCell::computeCollapsedEndBorder const):
2779         (WebCore::RenderTableCell::computeCollapsedBeforeBorder const):
2780         (WebCore::RenderTableCell::computeCollapsedAfterBorder const):
2781         * rendering/style/RenderStyle.cpp:
2782         (WebCore::RenderStyle::colorIncludingFallback const):
2783         (WebCore::RenderStyle::visitedDependentColor const):
2784         * rendering/style/RenderStyle.h:
2785
2786 2018-04-24  Simon Fraser  <simon.fraser@apple.com>
2787
2788         Add a new "color-filter" CSS property as an experimental feature
2789         https://bugs.webkit.org/show_bug.cgi?id=184940
2790         rdar://problem/39664904
2791
2792         Reviewed by Jon Lee.
2793         
2794         Add a new CSS property called "color-filter" as an experimental feature (off by default).
2795         
2796         This property specifies a list of filter functions (as specified in https://drafts.fxtf.org/filter-effects/#supported-filter-functions)
2797         to CSS colors, allowing authors to modify the provided page colors, for example to improve accessibility.
2798         Filters that move pixels (i.e. blur() and drop-shadow()) are invalid in this property.
2799         
2800         Colors will be mapped through the filter functions just before paint time, and gradient stop colors will also be mapped.
2801         
2802         This patch adds support for parsing color-filter.
2803
2804         Test: css3/color-filters/color-filter-parsing.html
2805
2806         * css/CSSComputedStyleDeclaration.cpp:
2807         (WebCore::ComputedStyleExtractor::valueForPropertyinStyle):
2808         * css/CSSProperties.json:
2809         * css/parser/CSSParser.cpp:
2810         (WebCore::CSSParserContext::CSSParserContext):
2811         (WebCore::operator==):
2812         * css/parser/CSSParserMode.h:
2813         * css/parser/CSSPropertyParser.cpp:
2814         (WebCore::CSSPropertyParser::parseSingleValue):
2815         * css/parser/CSSPropertyParserHelpers.cpp:
2816         (WebCore::CSSPropertyParserHelpers::isColorFilterFunction):
2817         (WebCore::CSSPropertyParserHelpers::consumeFilterFunction):
2818         (WebCore::CSSPropertyParserHelpers::consumeFilter):
2819         * css/parser/CSSPropertyParserHelpers.h:
2820         * page/Settings.yaml:
2821         * rendering/style/RenderStyle.cpp:
2822         (WebCore::RenderStyle::changeRequiresRepaint const):
2823         * rendering/style/RenderStyle.h:
2824         (WebCore::RenderStyle::mutableColorFilter):
2825         (WebCore::RenderStyle::colorFilter const):
2826         (WebCore::RenderStyle::hasColorFilter const):
2827         (WebCore::RenderStyle::setColorFilter):
2828         (WebCore::RenderStyle::initialColorFilter):
2829         * rendering/style/StyleRareInheritedData.cpp:
2830         (WebCore::StyleRareInheritedData::StyleRareInheritedData):
2831         (WebCore::StyleRareInheritedData::operator== const):
2832         (WebCore::StyleRareInheritedData::hasColorFilters const):
2833         * rendering/style/StyleRareInheritedData.h:
2834
2835 2018-04-24  Simon Fraser  <simon.fraser@apple.com>
2836
2837         shape-outside and filter styles occur twice in the result of getComputedStyle
2838         https://bugs.webkit.org/show_bug.cgi?id=184931
2839
2840         Reviewed by Antti Koivisto.
2841
2842         CSSPropertyShapeOutside and CSSPropertyFilter were duplicated in the list of computedProperties[]
2843         used by getComputedStyle. Remove the duplication.
2844         
2845         Tested by existing tests.
2846
2847         * css/CSSComputedStyleDeclaration.cpp:
2848
2849 2018-04-24  Basuke Suzuki  <Basuke.Suzuki@sony.com>
2850
2851         [Curl] Extract proxy settings into a separate class to hold advanced information.
2852         https://bugs.webkit.org/show_bug.cgi?id=184714
2853
2854         It was simplely structure to hold proxy setting. To support advanced feature of proxy
2855         such as authentication, more inteligent object is required to store intermediate state
2856         or errors. That's why we've introduced new class for that purpose.
2857
2858         Reviewed by Youenn Fablet.
2859
2860         No new tests because there's no new behavior.
2861
2862         * platform/Curl.cmake:
2863         * platform/network/curl/CurlContext.cpp:
2864         (WebCore::CurlHandle::enableProxyIfExists):
2865         (WebCore::CurlContext::ProxyInfo::url const): Deleted.
2866         (WebCore::CurlContext::setProxyInfo): Deleted.
2867         * platform/network/curl/CurlContext.h:
2868         (WebCore::CurlContext::proxySettings const):
2869         (WebCore::CurlContext::setProxySettings):
2870         (WebCore::CurlContext::setProxyUserPass):
2871         (WebCore::CurlContext::proxyInfo const): Deleted.
2872         (WebCore::CurlContext::setProxyInfo): Deleted.
2873         * platform/network/curl/CurlProxySettings.cpp: Added.
2874         (WebCore::CurlProxySettings::CurlProxySettings):
2875         (WebCore::CurlProxySettings::rebuildUrl):
2876         (WebCore::CurlProxySettings::setUserPass):
2877         (WebCore::protocolIsInSocksFamily):
2878         (WebCore::getProxyPort):
2879         (WebCore::createProxyUrl):
2880         * platform/network/curl/CurlProxySettings.h: Added.
2881         (WebCore::CurlProxySettings::CurlProxySettings):
2882         (WebCore::CurlProxySettings::isEmpty const):
2883         (WebCore::CurlProxySettings::mode const):
2884         (WebCore::CurlProxySettings::url const):
2885         (WebCore::CurlProxySettings::ignoreHosts const):
2886         (WebCore::CurlProxySettings::user const):
2887         (WebCore::CurlProxySettings::password const):
2888         * platform/network/curl/CurlRequest.cpp:
2889         (WebCore::CurlRequest::didReceiveHeader):
2890         * platform/network/curl/CurlResponse.h:
2891         (WebCore::CurlResponse::isolatedCopy const):
2892         * platform/network/curl/ResourceResponseCurl.cpp:
2893         (WebCore::ResourceResponse::ResourceResponse):
2894
2895 2018-04-24  Youenn Fablet  <youenn@apple.com>
2896
2897         Throw in case of PeerConnection created for detached documents
2898         https://bugs.webkit.org/show_bug.cgi?id=184921
2899         <rdar://problem/39629216>
2900
2901         Reviewed by Eric Carlson.
2902
2903         Add a check to ensure that page is not null when creating a peer connection backend.
2904         In that case, the peer connection constructor will later on throw.
2905         The same for setConfiguration is done.
2906         Behavior is consistent with Chrome.
2907
2908         Test: webrtc/pc-detached-document.html
2909
2910         * Modules/mediastream/libwebrtc/LibWebRTCPeerConnectionBackend.cpp:
2911         (WebCore::createLibWebRTCPeerConnectionBackend):
2912         (WebCore::LibWebRTCPeerConnectionBackend::LibWebRTCPeerConnectionBackend):
2913         (WebCore::LibWebRTCPeerConnectionBackend::setConfiguration):
2914         (WebCore::libWebRTCProvider): Deleted.
2915         * Modules/mediastream/libwebrtc/LibWebRTCPeerConnectionBackend.h:
2916
2917 2018-04-24  John Wilander  <wilander@apple.com>
2918
2919         From-Origin: Support for 'same' and 'same-site' response header, nested frame origin check
2920         https://bugs.webkit.org/show_bug.cgi?id=184560
2921         <rdar://problem/38901344>
2922
2923         Reviewed by Youenn Fablet and Daniel Bates.
2924
2925         Tests: http/tests/from-origin/document-from-origin-same-accepted.html
2926                http/tests/from-origin/document-from-origin-same-blocked.html
2927                http/tests/from-origin/document-from-origin-same-site-accepted.html
2928                http/tests/from-origin/document-from-origin-same-site-blocked.html
2929                http/tests/from-origin/document-nested-from-origin-same-accepted.html
2930                http/tests/from-origin/document-nested-from-origin-same-blocked.html
2931                http/tests/from-origin/fetch-data-iframe-from-origin-same-blocked.html
2932                http/tests/from-origin/fetch-from-origin-same-accepted.html
2933                http/tests/from-origin/fetch-from-origin-same-blocked.html
2934                http/tests/from-origin/fetch-from-origin-same-site-accepted.html
2935                http/tests/from-origin/fetch-from-origin-same-site-blocked.html
2936                http/tests/from-origin/fetch-iframe-from-origin-same-accepted.html
2937                http/tests/from-origin/fetch-iframe-from-origin-same-blocked.html
2938                http/tests/from-origin/image-about-blank-from-origin-same-blocked.html
2939                http/tests/from-origin/image-from-origin-same-accepted.html
2940                http/tests/from-origin/image-from-origin-same-blocked.html
2941                http/tests/from-origin/image-from-origin-same-site-accepted.html
2942                http/tests/from-origin/image-from-origin-same-site-blocked.html
2943                http/tests/from-origin/redirect-document-from-origin-same-blocked.html
2944                http/tests/from-origin/redirect-fetch-from-origin-same-blocked.html
2945                http/tests/from-origin/redirect-image-from-origin-same-blocked.html
2946                http/tests/from-origin/redirect-script-from-origin-same-blocked.html
2947                http/tests/from-origin/redirect-xhr-from-origin-same-blocked.html
2948                http/tests/from-origin/sandboxed-sub-frame-from-origin-same-blocked.html
2949                http/tests/from-origin/sandboxed-sub-frame-nested-cross-origin-from-origin-same-blocked.html
2950                http/tests/from-origin/sandboxed-sub-frame-nested-same-origin-from-origin-same-blocked.html
2951                http/tests/from-origin/script-from-origin-same-accepted.html
2952                http/tests/from-origin/script-from-origin-same-blocked.html
2953                http/tests/from-origin/script-from-origin-same-site-accepted.html
2954                http/tests/from-origin/script-from-origin-same-site-blocked.html
2955                http/tests/from-origin/top-frame-document-from-origin-same-accepted.php
2956                http/tests/from-origin/xhr-from-origin-same-accepted.html
2957                http/tests/from-origin/xhr-from-origin-same-blocked.html
2958                http/tests/from-origin/xhr-from-origin-same-site-accepted.html
2959                http/tests/from-origin/xhr-from-origin-same-site-blocked.html
2960
2961         * loader/SubresourceLoader.cpp:
2962         (WebCore::SubresourceLoader::didFail):
2963             Outputs the error's localized description in a console message except when the destination
2964             is FetchOptions::Destination::Serviceworker or FetchOptions::Destination::EmptyString.
2965         * page/RuntimeEnabledFeatures.h:
2966         (WebCore::RuntimeEnabledFeatures::setFromOriginResponseHeaderEnabled):
2967         (WebCore::RuntimeEnabledFeatures::fromOriginResponseHeaderEnabled const):
2968             Added From-Origin support as an experimental feature.
2969         * platform/network/HTTPHeaderNames.in:
2970             Added From-Origin.
2971         * platform/network/HTTPParsers.cpp:
2972         (WebCore::parseFromOriginHeader):
2973             Parses the From-Origin header, currently supporting 'Same' and 'Same-Site.'
2974         * platform/network/HTTPParsers.h:
2975
2976 2018-04-24  Antti Koivisto  <antti@apple.com>
2977
2978         Rename LayoutCtx.h/cpp to LayoutContext.h/cpp
2979         https://bugs.webkit.org/show_bug.cgi?id=184922
2980
2981         Reviewed by Zalan Bujtas.
2982
2983         To achieve this the existing LayoutContext class is renamed to FrameViewLayoutContext.
2984
2985         * Sources.txt:
2986         * WebCore.xcodeproj/project.pbxproj:
2987         * layout/LayoutContext.cpp: Copied from Source/WebCore/layout/LayoutCtx.cpp.
2988         * layout/LayoutContext.h: Copied from Source/WebCore/layout/LayoutCtx.h.
2989         * layout/LayoutCtx.cpp: Removed.
2990         * layout/LayoutCtx.h: Removed.
2991         * page/FrameView.cpp:
2992         (WebCore::FrameView::shouldDeferScrollUpdateAfterContentSizeChange):
2993         (WebCore::FrameView::updateLayoutViewport):
2994         (WebCore::FrameView::updateLayerPositionsAfterScrolling):
2995         (WebCore::FrameView::updateCompositingLayersAfterScrolling):
2996         (WebCore::FrameView::availableContentSizeChanged):
2997         * page/FrameView.h:
2998         * page/FrameViewLayoutContext.cpp: Copied from Source/WebCore/page/LayoutContext.cpp.
2999         (WebCore::LayoutScope::LayoutScope):
3000         (WebCore::FrameViewLayoutContext::FrameViewLayoutContext):
3001         (WebCore::FrameViewLayoutContext::~FrameViewLayoutContext):
3002         (WebCore::FrameViewLayoutContext::layout):
3003         (WebCore::FrameViewLayoutContext::runOrScheduleAsynchronousTasks):
3004         (WebCore::FrameViewLayoutContext::runAsynchronousTasks):
3005         (WebCore::FrameViewLayoutContext::flushAsynchronousTasks):
3006         (WebCore::FrameViewLayoutContext::reset):
3007         (WebCore::FrameViewLayoutContext::needsLayout const):
3008         (WebCore::FrameViewLayoutContext::setNeedsLayout):
3009         (WebCore::FrameViewLayoutContext::enableSetNeedsLayout):
3010         (WebCore::FrameViewLayoutContext::disableSetNeedsLayout):
3011         (WebCore::FrameViewLayoutContext::scheduleLayout):
3012         (WebCore::FrameViewLayoutContext::unscheduleLayout):
3013         (WebCore::FrameViewLayoutContext::scheduleSubtreeLayout):
3014         (WebCore::FrameViewLayoutContext::layoutTimerFired):
3015         (WebCore::FrameViewLayoutContext::convertSubtreeLayoutToFullLayout):
3016         (WebCore::FrameViewLayoutContext::setSubtreeLayoutRoot):
3017         (WebCore::FrameViewLayoutContext::canPerformLayout const):
3018         (WebCore::FrameViewLayoutContext::applyTextSizingIfNeeded):
3019         (WebCore::FrameViewLayoutContext::updateStyleForLayout):
3020         (WebCore::FrameViewLayoutContext::handleLayoutWithFrameFlatteningIfNeeded):
3021         (WebCore::FrameViewLayoutContext::startLayoutAtMainFrameViewIfNeeded):
3022         (WebCore::FrameViewLayoutContext::layoutDelta const):
3023         (WebCore::FrameViewLayoutContext::addLayoutDelta):
3024         (WebCore::FrameViewLayoutContext::layoutDeltaMatches):
3025         (WebCore::FrameViewLayoutContext::layoutState const):
3026         (WebCore::FrameViewLayoutContext::pushLayoutState):
3027         (WebCore::FrameViewLayoutContext::pushLayoutStateForPaginationIfNeeded):
3028         (WebCore::FrameViewLayoutContext::popLayoutState):
3029         (WebCore::FrameViewLayoutContext::checkLayoutState):
3030         (WebCore::FrameViewLayoutContext::frame const):
3031         (WebCore::FrameViewLayoutContext::view const):
3032         (WebCore::FrameViewLayoutContext::renderView const):
3033         (WebCore::FrameViewLayoutContext::document const):
3034         (WebCore::LayoutContext::LayoutContext): Deleted.
3035         (WebCore::LayoutContext::~LayoutContext): Deleted.
3036         (WebCore::LayoutContext::layout): Deleted.
3037         (WebCore::LayoutContext::runOrScheduleAsynchronousTasks): Deleted.
3038         (WebCore::LayoutContext::runAsynchronousTasks): Deleted.
3039         (WebCore::LayoutContext::flushAsynchronousTasks): Deleted.
3040         (WebCore::LayoutContext::reset): Deleted.
3041         (WebCore::LayoutContext::needsLayout const): Deleted.
3042         (WebCore::LayoutContext::setNeedsLayout): Deleted.
3043         (WebCore::LayoutContext::enableSetNeedsLayout): Deleted.
3044         (WebCore::LayoutContext::disableSetNeedsLayout): Deleted.
3045         (WebCore::LayoutContext::scheduleLayout): Deleted.
3046         (WebCore::LayoutContext::unscheduleLayout): Deleted.
3047         (WebCore::LayoutContext::scheduleSubtreeLayout): Deleted.
3048         (WebCore::LayoutContext::layoutTimerFired): Deleted.
3049         (WebCore::LayoutContext::convertSubtreeLayoutToFullLayout): Deleted.
3050         (WebCore::LayoutContext::setSubtreeLayoutRoot): Deleted.
3051         (WebCore::LayoutContext::canPerformLayout const): Deleted.
3052         (WebCore::LayoutContext::applyTextSizingIfNeeded): Deleted.
3053         (WebCore::LayoutContext::updateStyleForLayout): Deleted.
3054         (WebCore::LayoutContext::handleLayoutWithFrameFlatteningIfNeeded): Deleted.
3055         (WebCore::LayoutContext::startLayoutAtMainFrameViewIfNeeded): Deleted.
3056         (WebCore::LayoutContext::layoutDelta const): Deleted.
3057         (WebCore::LayoutContext::addLayoutDelta): Deleted.
3058         (WebCore::LayoutContext::layoutDeltaMatches): Deleted.
3059         (WebCore::LayoutContext::layoutState const): Deleted.
3060         (WebCore::LayoutContext::pushLayoutState): Deleted.
3061         (WebCore::LayoutContext::pushLayoutStateForPaginationIfNeeded): Deleted.
3062         (WebCore::LayoutContext::popLayoutState): Deleted.
3063         (WebCore::LayoutContext::checkLayoutState): Deleted.
3064         (WebCore::LayoutContext::frame const): Deleted.
3065         (WebCore::LayoutContext::view const): Deleted.
3066         (WebCore::LayoutContext::renderView const): Deleted.
3067         (WebCore::LayoutContext::document const): Deleted.
3068         * page/FrameViewLayoutContext.h: Copied from Source/WebCore/page/LayoutContext.h.
3069         (WebCore::LayoutContext::startDisallowingLayout): Deleted.
3070         (WebCore::LayoutContext::endDisallowingLayout): Deleted.
3071         (WebCore::LayoutContext::layoutPhase const): Deleted.
3072         (WebCore::LayoutContext::isLayoutNested const): Deleted.
3073         (WebCore::LayoutContext::isLayoutPending const): Deleted.
3074         (WebCore::LayoutContext::isInLayout const): Deleted.
3075         (WebCore::LayoutContext::isInRenderTreeLayout const): Deleted.
3076         (WebCore::LayoutContext::inPaintableState const): Deleted.
3077         (WebCore::LayoutContext::layoutCount const): Deleted.
3078         (WebCore::LayoutContext::subtreeLayoutRoot const): Deleted.
3079         (WebCore::LayoutContext::clearSubtreeLayoutRoot): Deleted.
3080         (WebCore::LayoutContext::resetFirstLayoutFlag): Deleted.
3081         (WebCore::LayoutContext::didFirstLayout const): Deleted.
3082         (WebCore::LayoutContext::setNeedsFullRepaint): Deleted.
3083         (WebCore::LayoutContext::needsFullRepaint const): Deleted.
3084         (WebCore::LayoutContext::isPaintOffsetCacheEnabled const): Deleted.
3085         (WebCore::LayoutContext::layoutDisallowed const): Deleted.
3086         (WebCore::LayoutContext::isLayoutSchedulingEnabled const): Deleted.
3087         (WebCore::LayoutContext::inAsynchronousTasks const): Deleted.
3088         (WebCore::LayoutContext::disablePaintOffsetCache): Deleted.
3089         (WebCore::LayoutContext::enablePaintOffsetCache): Deleted.
3090         * page/LayoutContext.cpp: Removed.
3091         * page/LayoutContext.h: Removed.
3092         * rendering/LayoutState.cpp:
3093         (WebCore::LayoutState::LayoutState):
3094         (WebCore::LayoutState::computePaginationInformation):
3095         (WebCore::LayoutState::establishLineGrid):
3096         (WebCore::LayoutStateDisabler::LayoutStateDisabler):
3097         * rendering/LayoutState.h:
3098
3099 2018-04-24  Mark Lam  <mark.lam@apple.com>
3100
3101         Need to acquire the VM lock before calling toNumber on a JSValue.
3102         https://bugs.webkit.org/show_bug.cgi?id=184924
3103         <rdar://problem/39690679>
3104
3105         Reviewed by Saam Barati.
3106
3107         * bridge/objc/objc_utility.mm:
3108         (JSC::Bindings::convertValueToObjcValue):
3109
3110 2018-04-24  Tadeu Zagallo  <tzagallo@apple.com>
3111
3112         REGRESSION(r221839): Fix requests with FormData containing empty files
3113         https://bugs.webkit.org/show_bug.cgi?id=184490
3114         <rdar://problem/39385169>
3115
3116         Reviewed by Geoffrey Garen.
3117
3118         We should not append the blob to the FormData when it is a file but has no path. It broke
3119         the submission since the request was failing to read the file in FormDataStreamCFNet.h:156
3120
3121         Test: http/tests/local/formdata/send-form-data-with-empty-file.html
3122
3123         * platform/network/FormData.cpp:
3124         (WebCore::FormData::appendMultiPartFileValue):
3125
3126 2018-04-24  Zalan Bujtas  <zalan@apple.com>
3127
3128         Fix project file after r230931.
3129
3130         * WebCore.xcodeproj/project.pbxproj:
3131
3132 2018-04-24  Jer Noble  <jer.noble@apple.com>
3133
3134         Don't add system framework paths to FRAMEWORK_SEARCH_PATHS
3135         https://bugs.webkit.org/show_bug.cgi?id=184786
3136
3137         Reviewed by Tim Horton.
3138
3139         * Configurations/WebCore.xcconfig:
3140         * DerivedSources.make:
3141         * WebCore.xcodeproj/project.pbxproj:
3142
3143 2018-04-24  Zan Dobersek  <zdobersek@igalia.com>
3144
3145         [CoordGraphics] Remove dead fixed layer code
3146         https://bugs.webkit.org/show_bug.cgi?id=184912
3147
3148         Reviewed by Michael Catanzaro.
3149
3150         Remove CoordinatedGraphicsLayer::setFixedToViewport() and the
3151         corresponding attribute on the CoordinatedGraphicsLayerState struct.
3152         The method is not called anywhere since r230952.
3153
3154         CoordinatedGraphicsState struct also loses the scrollPosition attribute
3155         that also isn't used anymore.
3156
3157         Changes to GraphicsLayerTextureMapper class mirror those made to
3158         CoordinatedGraphicsLayer, removing support for the fixed-to-viewport
3159         attribute. This too was not called from anywhere.
3160
3161         All that enables us removing fixed-to-viewport handling in the
3162         TextureMapperLayer class. Along with related changes in the
3163         CoordinatedGraphicsScene class, we're able to remove a bunch of methods
3164         and member variables that are not used or needed anymore.
3165
3166         * platform/graphics/texmap/GraphicsLayerTextureMapper.cpp:
3167         (WebCore::GraphicsLayerTextureMapper::GraphicsLayerTextureMapper):
3168         (WebCore::GraphicsLayerTextureMapper::commitLayerChanges):
3169         (WebCore::GraphicsLayerTextureMapper::setFixedToViewport): Deleted.
3170         * platform/graphics/texmap/GraphicsLayerTextureMapper.h:
3171         * platform/graphics/texmap/TextureMapperLayer.cpp:
3172         (WebCore::TextureMapperLayer::computeTransformsRecursive):
3173         (WebCore::TextureMapperLayer::setFixedToViewport): Deleted.
3174         (WebCore::TextureMapperLayer::isAncestorFixedToViewport const): Deleted.
3175         (WebCore::TextureMapperLayer::setScrollPositionDeltaIfNeeded): Deleted.
3176         * platform/graphics/texmap/TextureMapperLayer.h:
3177         * platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.cpp:
3178         (WebCore::CoordinatedGraphicsLayer::CoordinatedGraphicsLayer):
3179         (WebCore::CoordinatedGraphicsLayer::syncLayerState):
3180         (WebCore::CoordinatedGraphicsLayer::setFixedToViewport): Deleted.
3181         * platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.h:
3182         * platform/graphics/texmap/coordinated/CoordinatedGraphicsState.h:
3183         (WebCore::CoordinatedGraphicsLayerState::CoordinatedGraphicsLayerState):
3184
3185 2018-04-24  Zan Dobersek  <zdobersek@igalia.com>
3186
3187         [CoordGraphics] Remove unused fixed layout functionality
3188         https://bugs.webkit.org/show_bug.cgi?id=184908
3189
3190         Reviewed by Carlos Garcia Campos.
3191
3192         Ports using the CoordinatedGraphics subsystem don't expose fixed layout
3193         support. As such, we're able to remove a lot of unused code and
3194         unnecessary USE(COORDINATED_GRAPHICS) special cases in generic sections
3195         in both WebCore and WebKit.
3196
3197         With fixed layout not available for use to users of the GTK+ and WPE
3198         ports, we can remove the ScrollingCoordinatorCoordinatedGraphics
3199         implementation, making room for an implementation that inherits from
3200         AsyncScrollingCoordinator in the future. For that purpose the
3201         ScrollingCoordinator::create() function is moved into the
3202         ScrollingCoordinatorCoordinatedGraphics.cpp file already.
3203
3204         This also enables removing delegatedScrollRequested() method from
3205         HostWindow and the inheriting ChromeClient interface.
3206
3207         * loader/EmptyClients.h:
3208         * page/Chrome.cpp:
3209         (WebCore::Chrome::delegatedScrollRequested): Deleted.
3210         * page/Chrome.h:
3211         * page/ChromeClient.h:
3212         * page/scrolling/ScrollingCoordinator.cpp:
3213         (WebCore::ScrollingCoordinator::create):
3214         * page/scrolling/coordinatedgraphics/ScrollingCoordinatorCoordinatedGraphics.cpp:
3215         (WebCore::ScrollingCoordinator::create):
3216         (WebCore::ScrollingCoordinatorCoordinatedGraphics::ScrollingCoordinatorCoordinatedGraphics): Deleted.
3217         (WebCore::ScrollingCoordinatorCoordinatedGraphics::attachToStateTree): Deleted.
3218         (WebCore::ScrollingCoordinatorCoordinatedGraphics::detachFromStateTree): Deleted.
3219         (WebCore::ScrollingCoordinatorCoordinatedGraphics::clearStateTree): Deleted.
3220         (WebCore::ScrollingCoordinatorCoordinatedGraphics::updateNodeLayer): Deleted.
3221         (WebCore::ScrollingCoordinatorCoordinatedGraphics::updateNodeViewportConstraints): Deleted.
3222         (WebCore::ScrollingCoordinatorCoordinatedGraphics::requestScrollPositionUpdate): Deleted.
3223         * page/scrolling/coordinatedgraphics/ScrollingCoordinatorCoordinatedGraphics.h: Removed.
3224         * platform/HostWindow.h:
3225
3226 2018-04-24  Daniel Bates  <dabates@apple.com>
3227
3228         Attempt to fix the Apple Internal build following r230922
3229         (https://bugs.webkit.org/show_bug.cgi?id=184737)
3230
3231         Cast the return value of std::map::size() to a size_t before logging it with format specifier
3232         "%zu". std::map::size() returns a size_type. According to <http://en.cppreference.com/w/cpp/container/map>
3233         size_type is "usually a size_t", but it may not be. An Apple Internal debug builder reports
3234         that size_type = unsigned int != unsigned long = size_t.
3235
3236         * Modules/mediasource/SourceBuffer.cpp:
3237         (WebCore::SourceBuffer::provideMediaData):
3238
3239 2018-04-24  Zan Dobersek  <zdobersek@igalia.com>
3240
3241         [CoordGraphics] Avoid painting backing stores for zero-opacity layers
3242         https://bugs.webkit.org/show_bug.cgi?id=184143
3243
3244         Reviewed by Carlos Garcia Campos.
3245
3246         Skip generating backing stores for layers that have zero opacity and do
3247         not animate the opacity value. In the current CoordinatedGraphics system
3248         this can end up saving loads of memory on Web content that deploys a
3249         large number of such elements.
3250
3251         * platform/graphics/texmap/TextureMapperLayer.h:
3252         * platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.cpp:
3253         (WebCore::CoordinatedGraphicsLayer::shouldHaveBackingStore const):
3254
3255 2018-04-24  Daniel Bates  <dabates@apple.com>
3256
3257         Attempt to fix the Apple Internal build following r230944
3258         (https://bugs.webkit.org/show_bug.cgi?id=159464)
3259
3260         * platform/network/mac/CookieJarMac.mm:
3261
3262 2018-04-24  Daniel Bates  <dabates@apple.com>
3263
3264         Another attempt to fix the Mac and iOS build following r230944
3265         (https://bugs.webkit.org/show_bug.cgi?id=159464)
3266
3267         * platform/network/mac/CookieJarMac.mm:
3268         (WebCore::policyProperties):
3269
3270 2018-04-24  Daniel Bates  <dabates@apple.com>
3271
3272         Attempt to fix the Mac and iOS build following r230944
3273         (https://bugs.webkit.org/show_bug.cgi?id=159464)
3274
3275         * platform/network/mac/CookieJarMac.mm:
3276         (WebCore::policyProperties):
3277
3278 2018-04-23  Daniel Bates  <dabates@apple.com>
3279
3280         Implement Same-Site cookies
3281         https://bugs.webkit.org/show_bug.cgi?id=159464
3282         <rdar://problem/27196358>
3283
3284         Reviewed by Brent Fulgham.
3285
3286         Implements support for Same-Site cookies as per <https://tools.ietf.org/html/draft-ietf-httpbis-cookie-same-site-00>.
3287         The implementation is materially consistent with the spec. though implements the computation
3288         for a document's "site for cookies" indirectly as part of loading its frame. This is done to
3289         avoid traversing the frame tree on each subresource request initiated by the document or one
3290         of its workers. We take advantage of the fact that Web Workers and Service Workers use their
3291         host document's loader to load resources on their behalf to use the correct "site for cookies"
3292         for requests (e.g. fetch()) initiating by them without the need to duplicate and store the
3293         host document's "site for cookies" in the worker's script execution context.
3294
3295         The implementation differs from the spec. in the handling of about: URLs and the empty URL
3296         and makes the implementation in WebKit match the behavior of Chrome and Firefox as well as
3297         consistent with origin inheritance as described in <https://html.spec.whatwg.org/multipage/browsers.html#origin>
3298         (16 April 2018). Specifically, requests to about:blank, about:srcdoc and the empty URL ("")
3299         are treated as same-site because these URLs inherit their origin from their owner.
3300
3301         Tests: http/tests/cookies/same-site/fetch-after-navigating-iframe-in-cross-origin-page.html
3302                http/tests/cookies/same-site/fetch-after-top-level-navigation-from-cross-origin-page.html
3303                http/tests/cookies/same-site/fetch-after-top-level-navigation-initiated-from-iframe-in-cross-origin-page.html
3304                http/tests/cookies/same-site/fetch-cookies-set-in-about-blank-iframe.html
3305                http/tests/cookies/same-site/fetch-in-about-blank-page.html
3306                http/tests/cookies/same-site/fetch-in-cross-origin-iframe.html
3307                http/tests/cookies/same-site/fetch-in-cross-origin-page.html
3308                http/tests/cookies/same-site/fetch-in-cross-origin-service-worker.html
3309                http/tests/cookies/same-site/fetch-in-cross-origin-worker.html
3310                http/tests/cookies/same-site/fetch-in-same-origin-page.html
3311                http/tests/cookies/same-site/fetch-in-same-origin-service-worker.html
3312                http/tests/cookies/same-site/fetch-in-same-origin-srcdoc-iframe.html
3313                http/tests/cookies/same-site/fetch-in-same-origin-worker.html
3314                http/tests/cookies/same-site/popup-cross-site-post.html
3315                http/tests/cookies/same-site/popup-cross-site.html
3316                http/tests/cookies/same-site/popup-same-site-post.html
3317                http/tests/cookies/same-site/popup-same-site-via-cross-site-redirect.html
3318                http/tests/cookies/same-site/popup-same-site-via-same-site-redirect.html
3319                http/tests/cookies/same-site/popup-same-site.html
3320
3321         * Sources.txt: Add source file SameSiteInfo.cpp.
3322         * WebCore.xcodeproj/project.pbxproj: Add source files SameSiteInfo.{cpp, h}.
3323         * dom/Document.cpp:
3324         (WebCore::Document::initSecurityContext): Modified to call SecurityPolicy::shouldInheritSecurityOriginFromOwner().
3325         (WebCore::Document::shouldInheritContentSecurityPolicyFromOwner const): Ditto.
3326         (WebCore::shouldInheritSecurityOriginFromOwner): Deleted; moved to SecurityPolicy.
3327         * dom/Document.h:
3328         (WebCore::Document::firstPartyForSameSiteCookies const): Added.
3329         (WebCore::Document::setFirstPartyForSameSiteCookies): Added.
3330         * loader/CookieJar.cpp:
3331         (WebCore::sameSiteInfo): Returns the same-site info for the request used to load the specified document.
3332         (WebCore::cookies): Pass the same-site info down to the platform.
3333         (WebCore::cookieRequestHeaderFieldProxy): Ditto.
3334         (WebCore::setCookies): Ditto.
3335         (WebCore::cookieRequestHeaderFieldValue): Ditto.
3336         (WebCore::getRawCookies): Ditto.
3337         * loader/DocumentLoader.cpp:
3338         (WebCore::DocumentLoader::willSendRequest): Add same-site info to the request.
3339         (WebCore::DocumentLoader::startLoadingMainResource): Update a FIXME comment to explain that
3340         we can simplify ResourceRequestBase if we can remove the call to addExtraFieldsToMainResourceRequest()
3341         here. Specifically, we would not need to differentiate between a request with an unspecified
3342         same-site state (default state of a new request) from a request whose same-site state has
3343         been explicitly set if we can assume that the same-site state of a request is set exactly
3344         once. In absence of this guarantee we need an "unspecified" state to avoid overriding existing
3345         same-site information computed with a null initiating document (the case of a new address bar
3346         initiated load) from a load initiated by the document associated with this loader.
3347         * loader/FrameLoader.cpp:
3348         (WebCore::FrameLoader::setFirstPartyForCookies): Modified to also update the first party for
3349         same-site cookies ("site for cookies").
3350         (WebCore::FrameLoader::load): Add same-site info to the request.
3351         (WebCore::FrameLoader::reload): Ditto.
3352         (WebCore::FrameLoader::setOriginalURLForDownloadRequest): Ditto.
3353         (WebCore::FrameLoader::addExtraFieldsToRequest): If the request does not already have
3354         same-site info then compute it and add it to the request. Mark main frame main resource
3355         requests as a "top-site".
3356         (WebCore::FrameLoader::addSameSiteInfoToRequestIfNeeded): Implements the "'Same-site' and 'cross-site'
3357         Requests" algorithm from <https://tools.ietf.org/html/draft-ietf-httpbis-cookie-same-site-00#section-2.1>.
3358         (WebCore::createWindow): Add same-site info to the request.
3359         * loader/FrameLoader.h:
3360         * loader/ResourceLoader.cpp:
3361         (WebCore::ResourceLoader::init): Ditto.
3362         * page/DOMWindow.cpp:
3363         (WebCore::DOMWindow::createWindow): Ditto.
3364         * page/SecurityPolicy.cpp:
3365         (WebCore::SecurityPolicy::shouldInheritSecurityOriginFromOwner): Moved from Document.cpp.
3366         * page/SecurityPolicy.h:
3367         * platform/CookiesStrategy.h:
3368         * platform/network/CacheValidation.cpp:
3369         (WebCore::headerValueForVary): Pass the same-site info down to the platform.
3370         * platform/network/CookieRequestHeaderFieldProxy.h:
3371         (WebCore::CookieRequestHeaderFieldProxy::encode const): Encode same-site bits.
3372         (WebCore::CookieRequestHeaderFieldProxy::decode): Decode same-site bits.
3373         * platform/network/PlatformCookieJar.h:
3374         * platform/network/ResourceRequestBase.cpp:
3375         (WebCore::ResourceRequestBase::setAsIsolatedCopy): Added.
3376         (WebCore::ResourceRequestBase::isSameSite const): Added.
3377         (WebCore::ResourceRequestBase::setIsSameSite): Added.
3378         (WebCore::ResourceRequestBase::isTopSite const): Added.
3379         (WebCore::ResourceRequestBase::setIsTopSite): Added.
3380         (WebCore::equalIgnoringHeaderFields):
3381         * platform/network/ResourceRequestBase.h:
3382         (WebCore::ResourceRequestBase::isSameSiteUnspecified const): Added. See comment for DocumentLoader::startLoadingMainResource()
3383         for more details.
3384         (WebCore::registrableDomainsAreEqual): Added.
3385         (WebCore::ResourceRequestBase::encodeBase const): Encode same-site bits.
3386         (WebCore::ResourceRequestBase::decodeBase): Decode same-site bits.
3387         * platform/network/SameSiteInfo.cpp: Added.
3388         (WebCore::SameSiteInfo::create):
3389         * platform/network/SameSiteInfo.h: Added.
3390         (WebCore::SameSiteInfo::encode const):
3391         (WebCore::SameSiteInfo::decode):
3392         * platform/network/cf/CookieJarCFNet.cpp:
3393         (WebCore::setCookiesFromDOM): Pass Same-Site info down.
3394         (WebCore::cookiesForDOM): Ditto.
3395         (WebCore::cookieRequestHeaderFieldValue): Ditto.
3396         (WebCore::getRawCookies): Ditto.
3397         * platform/network/cf/ResourceRequestCFNet.cpp:
3398         (WebCore::siteForCookies): Added.
3399         (WebCore::ResourceRequest::doUpdatePlatformRequest): Update platform request with same-site info.
3400         (WebCore::ResourceRequest::doUpdateResourceRequest): Ditto.
3401         * platform/network/cocoa/ResourceRequestCocoa.mm:
3402         (WebCore::ResourceRequest::doUpdateResourceRequest): Ditto.
3403         (WebCore::siteForCookies): Added.
3404         (WebCore::ResourceRequest::doUpdatePlatformRequest): Update platform request with same-site info.
3405         * platform/network/curl/CookieJarCurl.cpp:
3406         (WebCore::cookiesForDOM): Pass Same-Site info down.
3407         (WebCore::setCookiesFromDOM): Ditto.
3408         (WebCore::cookieRequestHeaderFieldValue): Ditto.
3409         (WebCore::getRawCookies): Ditto.
3410         * platform/network/curl/CookieJarCurl.h:
3411         * platform/network/curl/CookieJarCurlDatabase.cpp:
3412         (WebCore::CookieJarCurlDatabase::setCookiesFromDOM const): Ditto.
3413         (WebCore::CookieJarCurlDatabase::cookiesForDOM const): Ditto.
3414         (WebCore::CookieJarCurlDatabase::cookieRequestHeaderFieldValue const): Ditto.
3415         (WebCore::CookieJarCurlDatabase::getRawCookies const): Ditto.
3416         * platform/network/curl/CookieJarCurlDatabase.h:
3417         * platform/network/curl/ResourceHandleCurl.cpp:
3418         (WebCore::ResourceHandle::createCurlRequest): Ditto.
3419         * platform/network/mac/CookieJarMac.mm:
3420         (WebCore::cookiesForURL): Added; shared function to return the cookies based on the specified criterion. 
3421         (WebCore::setHTTPCookiesForURL): Moved from the bottom of the file to top to be closer to the other
3422         CFNetwork helper functions. Modified to support fetching same-site cookies.
3423         (WebCore::httpCookiesForURL): Moved to be under setHTTPCookiesForURL(). Modified to call cookiesForURL().
3424         Note the SPI used in cookiesForURL() apply the same criterion for whether to fetch secure cookies as we
3425         were computing here. That is, the CFNetwork SPI only returns secure cookies if the specified URL's scheme
3426         case-insensitively matches "https".
3427         (WebCore::cookiesInPartitionForURL): Wrote in terms of cookiesForURL().
3428         (WebCore::cookiesForSession): Pass the Same-Site info.
3429         (WebCore::cookiesForDOM): Ditto.
3430         (WebCore::cookieRequestHeaderFieldValue): Ditto.
3431         (WebCore::setCookiesFromDOM): Ditto.
3432         (WebCore::getRawCookies): Ditto.
3433         (WebCore::deleteCookie): Pass std::nullopt for the Same-Site info so that we do not consider the SameSite
3434         attribute when fetching cookies to delete.
3435         * platform/network/soup/CookieJarSoup.cpp:
3436         (WebCore::setCookiesFromDOM): Pass the Same-Site info.
3437         (WebCore::cookiesForDOM): Ditto.
3438         (WebCore::cookieRequestHeaderFieldValue): Ditto.
3439         (WebCore::getRawCookies): Ditto.
3440         * workers/service/context/ServiceWorkerThreadProxy.cpp:
3441         (WebCore::createPageForServiceWorker): Set the first party for same site cookies ("site for cookies") to
3442         the script URL.
3443         * xml/XSLTProcessor.cpp:
3444         (WebCore::XSLTProcessor::createDocumentFromSource): Copy the first party for same-site cookies to the
3445         new document.
3446
3447 2018-04-23  Youenn Fablet  <youenn@apple.com>
3448
3449         Make WebLoaderStrategy send to NetworkResourceLoader necessary parameters to handle full loads in NetworkProcess
3450         https://bugs.webkit.org/show_bug.cgi?id=184763
3451
3452         Reviewed by Chris Dumez.
3453
3454         No change of behavior yet since we do not use these parameters in NetworkProcess yet.
3455
3456         Add PreflightPolicy and CSP response headers as ResourceLoaderOptions.
3457         This allows passing them from DocumentThreadableLoader to WebLoaderStrategy.
3458
3459         Allow getting the original headers from a SubresourceLoader.
3460         This allows passing them from DocumentThreadableLoader down to WebLoaderStrategy.
3461
3462         * Modules/fetch/FetchLoader.cpp:
3463         (WebCore::FetchLoader::startLoadingBlobURL):
3464         (WebCore::FetchLoader::start):
3465         * loader/DocumentThreadableLoader.cpp:
3466         (WebCore::DocumentThreadableLoader::DocumentThreadableLoader):
3467         (WebCore::DocumentThreadableLoader::makeCrossOriginAccessRequest):
3468         (WebCore::DocumentThreadableLoader::makeSimpleCrossOriginAccessRequest):
3469         * loader/ResourceLoaderOptions.h:
3470         * loader/SubresourceLoader.cpp:
3471         (WebCore::SubresourceLoader::originalHeaders const):
3472         * loader/SubresourceLoader.h:
3473         * loader/ThreadableLoader.cpp:
3474         (WebCore::ThreadableLoaderOptions::ThreadableLoaderOptions):
3475         (WebCore::ThreadableLoaderOptions::isolatedCopy const):
3476         * loader/ThreadableLoader.h:
3477         * page/EventSource.cpp:
3478         (WebCore::EventSource::connect):
3479         * xml/XMLHttpRequest.cpp:
3480         (WebCore::XMLHttpRequest::createRequest):
3481
3482 2018-04-23  Michael Catanzaro  <mcatanzaro@igalia.com>
3483
3484         [WPE][GTK] Remove WlUniquePtr<wl_display> footgun
3485         https://bugs.webkit.org/show_bug.cgi?id=184405
3486
3487         Reviewed by Carlos Garcia Campos.
3488
3489         WlUniquePtr<wl_display> is a pretty big footgun because there are two different destruction
3490         functions -- wl_display_disconnect() and wl_display_destroy() -- and which one you need to
3491         use depends on how the wl_display() was created, and WebKit uses both in different places.
3492         So WlUniquePtr<wl_display> is pretty unsafe. See bug #176490 for an example of fun caused
3493         by using it incorrectly.
3494
3495         Let's use std::unique_ptr with custom deleter functors instead.
3496
3497         * platform/graphics/wayland/WlUniquePtr.h:
3498
3499 2018-04-23  Antti Koivisto  <antti@apple.com>
3500
3501         REGRESSION (r220112): reCAPTCHA images render off screen on Twitch.tv app Log In or Sign Up
3502         https://bugs.webkit.org/show_bug.cgi?id=182859
3503         <rdar://problem/37595065>
3504
3505         Reviewed by Zalan Bujtas.
3506
3507         Roll out this change from the trunk as the issue it fixed no longer occurs.
3508
3509         * css/MediaQueryEvaluator.cpp:
3510         (WebCore::orientationEvaluate):
3511         (WebCore::aspectRatioEvaluate):
3512         (WebCore::heightEvaluate):
3513         (WebCore::widthEvaluate):
3514         * page/FrameView.cpp:
3515         (WebCore::FrameView::layoutSizeForMediaQuery const): Deleted.
3516         * page/FrameView.h:
3517         * page/LayoutContext.cpp:
3518         (WebCore::LayoutContext::handleLayoutWithFrameFlatteningIfNeeded):
3519
3520 2018-04-23  Daniel Bates  <dabates@apple.com>
3521
3522         Another attempt to fix the Windows build following r230921
3523         (https://bugs.webkit.org/show_bug.cgi?id=159464)
3524
3525         Pass dictionary key name using a string instead of a constant and pass CFURL* to
3526         siteForCookies().
3527
3528         * platform/network/cf/ResourceRequestCFNet.cpp:
3529         (WebCore::ResourceRequest::doUpdatePlatformRequest):
3530         (WebCore::ResourceRequest::doUpdateResourceRequest):
3531
3532 2018-04-23  Zalan Bujtas  <zalan@apple.com>
3533
3534         [LayoutFormattingContext] Initial commit.
3535         https://bugs.webkit.org/show_bug.cgi?id=184896
3536
3537         Reviewed by Antti Koivisto.
3538
3539         This is the initial commit of the new layout component -class definitions only (and mostly public functions).
3540         See the header files (and Tools/LayoutReloaded project) for more information.
3541
3542         // Top level layout.
3543         rootContainer = TreeBuilder::createLayoutTree(document);
3544         rootDisplayBox = new Display::Box();
3545         rootDisplayBox->setSize(viewportSize);
3546         layoutContext = new LayoutContext(rootContainer, rootDisplayBox);
3547         layoutContext->layout(rootContainer);
3548
3549         Driven by build time flag (currently off). Not testable yet.
3550
3551         * Configurations/FeatureDefines.xcconfig:
3552         * Sources.txt:
3553         * WebCore.xcodeproj/project.pbxproj:
3554         * layout/BlockFormatting/BlockFormattingContext.cpp: Added.
3555         * layout/BlockFormatting/BlockFormattingContext.h: Added.
3556         * layout/BlockFormatting/BlockFormattingState.cpp: Added.
3557         * layout/BlockFormatting/BlockFormattingState.h: Added.
3558         * layout/BlockFormatting/BlockMarginCollapse.cpp: Added.
3559         * layout/BlockFormatting/BlockMarginCollapse.h: Added.
3560         * layout/DisplayTree/DisplayBox.cpp: Added.
3561         * layout/DisplayTree/DisplayBox.h: Added.
3562         * layout/FloatingContext.cpp: Added.
3563         * layout/FloatingContext.h: Added.
3564         * layout/FloatingState.cpp: Added.
3565         * layout/FloatingState.h: Added.
3566         * layout/FormattingContext.cpp: Added.
3567         * layout/FormattingContext.h: Added.
3568         * layout/FormattingState.cpp: Added.
3569         * layout/FormattingState.h: Added.
3570         * layout/InlineFormatting/InlineFormattingContext.cpp: Added.
3571         * layout/InlineFormatting/InlineFormattingContext.h: Added.
3572         * layout/InlineFormatting/InlineFormattingState.cpp: Added.
3573         * layout/InlineFormatting/InlineFormattingState.h: Added.
3574         * layout/LayoutCtx.cpp: Added.
3575         * layout/LayoutCtx.h: Added.
3576         * layout/LayoutTree/LayoutBlockContainer.cpp: Added.
3577         * layout/LayoutTree/LayoutBlockContainer.h: Added.
3578         * layout/LayoutTree/LayoutBox.cpp: Added.
3579         * layout/LayoutTree/LayoutBox.h: Added.
3580         * layout/LayoutTree/LayoutContainer.cpp: Added.
3581         * layout/LayoutTree/LayoutContainer.h: Added.
3582         * layout/LayoutTree/LayoutCtx.h: Added.
3583         * layout/LayoutTree/LayoutInlineBox.cpp: Added.
3584         * layout/LayoutTree/LayoutInlineBox.h: Added.
3585         * layout/LayoutTree/LayoutInlineContainer.cpp: Added.
3586         * layout/LayoutTree/LayoutInlineContainer.h: Added.
3587
3588 2018-04-23  Daniel Bates  <dabates@apple.com>
3589
3590         Attempt to fix the Mac and iOS build after r230921
3591         (https://bugs.webkit.org/show_bug.cgi?id=159464)
3592
3593         Pass strings for the dictionary key names instead of using an extern constant as the
3594         latter may not be available on all systems.
3595
3596         * platform/network/mac/CookieJarMac.mm:
3597         (WebCore::setHTTPCookiesForURL):
3598
3599 2018-04-23  Daniel Bates  <dabates@apple.com>
3600
3601         Attempt to fix the build after r230921
3602         (https://bugs.webkit.org/show_bug.cgi?id=159464)
3603
3604         Pass Same-Site info through.
3605
3606         * platform/network/cf/CookieJarCFNet.cpp:
3607         (WebCore::cookieRequestHeaderFieldValue):
3608         * platform/network/curl/CookieJarCurl.cpp:
3609         (WebCore::cookieRequestHeaderFieldValue):
3610         * platform/network/curl/CookieJarCurlDatabase.cpp:
3611         (WebCore::CookieJarCurlDatabase::cookieRequestHeaderFieldValue const):
3612         * platform/network/soup/CookieJarSoup.cpp:
3613         (WebCore::cookieRequestHeaderFieldValue):
3614
3615 2018-04-23  Ryan Haddad  <ryanhaddad@apple.com>
3616
3617         Unreviewed, speculative macOS build fix attempt.
3618
3619         * Modules/mediasource/SourceBuffer.cpp:
3620         (WebCore::SourceBuffer::provideMediaData):
3621
3622 2018-04-23  Daniel Bates  <dabates@apple.com>
3623
3624         Implement Same-Site cookies
3625         https://bugs.webkit.org/show_bug.cgi?id=159464
3626         <rdar://problem/27196358>
3627
3628         Reviewed by Brent Fulgham.
3629
3630         Implements support for Same-Site cookies as per <https://tools.ietf.org/html/draft-ietf-httpbis-cookie-same-site-00>.
3631         The implementation is materially consistent with the spec. though implements the computation
3632         for a document's "site for cookies" indirectly as part of loading its frame. This is done to
3633         avoid traversing the frame tree on each subresource request initiated by the document or one
3634         of its workers. We take advantage of the fact that Web Workers and Service Workers use their
3635         host document's loader to load resources on their behalf to use the correct "site for cookies"
3636         for requests (e.g. fetch()) initiating by them without the need to duplicate and store the
3637         host document's "site for cookies" in the worker's script execution context.
3638
3639         The implementation differs from the spec. in the handling of about: URLs and the empty URL
3640         and makes the implementation in WebKit match the behavior of Chrome and Firefox as well as
3641         consistent with origin inheritance as described in <https://html.spec.whatwg.org/multipage/browsers.html#origin>
3642         (16 April 2018). Specifically, requests to about:blank, about:srcdoc and the empty URL ("")
3643         are treated as same-site because these URLs inherit their origin from their owner.
3644
3645         Tests: http/tests/cookies/same-site/fetch-after-navigating-iframe-in-cross-origin-page.html
3646                http/tests/cookies/same-site/fetch-after-top-level-navigation-from-cross-origin-page.html
3647                http/tests/cookies/same-site/fetch-after-top-level-navigation-initiated-from-iframe-in-cross-origin-page.html
3648                http/tests/cookies/same-site/fetch-cookies-set-in-about-blank-iframe.html
3649                http/tests/cookies/same-site/fetch-in-about-blank-page.html
3650                http/tests/cookies/same-site/fetch-in-cross-origin-iframe.html
3651                http/tests/cookies/same-site/fetch-in-cross-origin-page.html
3652                http/tests/cookies/same-site/fetch-in-cross-origin-service-worker.html
3653                http/tests/cookies/same-site/fetch-in-cross-origin-worker.html
3654                http/tests/cookies/same-site/fetch-in-same-origin-page.html
3655                http/tests/cookies/same-site/fetch-in-same-origin-service-worker.html
3656                http/tests/cookies/same-site/fetch-in-same-origin-srcdoc-iframe.html
3657                http/tests/cookies/same-site/fetch-in-same-origin-worker.html
3658                http/tests/cookies/same-site/popup-cross-site-post.html
3659                http/tests/cookies/same-site/popup-cross-site.html
3660                http/tests/cookies/same-site/popup-same-site-post.html
3661                http/tests/cookies/same-site/popup-same-site-via-cross-site-redirect.html
3662                http/tests/cookies/same-site/popup-same-site-via-same-site-redirect.html
3663                http/tests/cookies/same-site/popup-same-site.html
3664
3665         * Sources.txt: Add source file SameSiteInfo.cpp.
3666         * WebCore.xcodeproj/project.pbxproj: Add source files SameSiteInfo.{cpp, h}.
3667         * dom/Document.cpp:
3668         (WebCore::Document::initSecurityContext): Modified to call SecurityPolicy::shouldInheritSecurityOriginFromOwner().
3669         (WebCore::Document::shouldInheritContentSecurityPolicyFromOwner const): Ditto.
3670         (WebCore::shouldInheritSecurityOriginFromOwner): Deleted; moved to SecurityPolicy.
3671         * dom/Document.h:
3672         (WebCore::Document::firstPartyForSameSiteCookies const): Added.
3673         (WebCore::Document::setFirstPartyForSameSiteCookies): Added.
3674         * loader/CookieJar.cpp:
3675         (WebCore::sameSiteInfo): Returns the same-site info for the request used to load the specified document.
3676         (WebCore::cookies): Pass the same-site info down to the platform.
3677         (WebCore::cookieRequestHeaderFieldProxy): Ditto.
3678         (WebCore::setCookies): Ditto.
3679         (WebCore::cookieRequestHeaderFieldValue): Ditto.
3680         (WebCore::getRawCookies): Ditto.
3681         * loader/DocumentLoader.cpp:
3682         (WebCore::DocumentLoader::willSendRequest): Add same-site info to the request.
3683         (WebCore::DocumentLoader::startLoadingMainResource): Update a FIXME comment to explain that
3684         we can simplify ResourceRequestBase if we can remove the call to addExtraFieldsToMainResourceRequest()
3685         here. Specifically, we would not need to differentiate between a request with an unspecified
3686         same-site state (default state of a new request) from a request whose same-site state has
3687         been explicitly set if we can assume that the same-site state of a request is set exactly
3688         once. In absence of this guarantee we need an "unspecified" state to avoid overriding existing
3689         same-site information computed with a null initiating document (the case of a new address bar
3690         initiated load) from a load initiated by the document associated with this loader.
3691         * loader/FrameLoader.cpp:
3692         (WebCore::FrameLoader::setFirstPartyForCookies): Modified to also update the first party for
3693         same-site cookies ("site for cookies").
3694         (WebCore::FrameLoader::load): Add same-site info to the request.
3695         (WebCore::FrameLoader::reload): Ditto.
3696         (WebCore::FrameLoader::setOriginalURLForDownloadRequest): Ditto.
3697         (WebCore::FrameLoader::addExtraFieldsToRequest): If the request does not already have
3698         same-site info then compute it and add it to the request. Mark main frame main resource
3699         requests as a "top-site".
3700         (WebCore::FrameLoader::addSameSiteInfoToRequestIfNeeded): Implements the "'Same-site' and 'cross-site'
3701         Requests" algorithm from <https://tools.ietf.org/html/draft-ietf-httpbis-cookie-same-site-00#section-2.1>.
3702         (WebCore::createWindow): Add same-site info to the request.
3703         * loader/FrameLoader.h:
3704         * loader/ResourceLoader.cpp:
3705         (WebCore::ResourceLoader::init): Ditto.
3706         * page/DOMWindow.cpp:
3707         (WebCore::DOMWindow::createWindow): Ditto.
3708         * page/SecurityPolicy.cpp:
3709         (WebCore::SecurityPolicy::shouldInheritSecurityOriginFromOwner): Moved from Document.cpp.
3710         * page/SecurityPolicy.h:
3711         * platform/CookiesStrategy.h:
3712         * platform/network/CacheValidation.cpp:
3713         (WebCore::headerValueForVary): Pass the same-site info down to the platform.
3714         * platform/network/CookieRequestHeaderFieldProxy.h:
3715         (WebCore::CookieRequestHeaderFieldProxy::encode const): Encode same-site bits.
3716         (WebCore::CookieRequestHeaderFieldProxy::decode): Decode same-site bits.
3717         * platform/network/PlatformCookieJar.h:
3718         * platform/network/ResourceRequestBase.cpp:
3719         (WebCore::ResourceRequestBase::setAsIsolatedCopy): Added.
3720         (WebCore::ResourceRequestBase::isSameSite const): Added.
3721         (WebCore::ResourceRequestBase::setIsSameSite): Added.
3722         (WebCore::ResourceRequestBase::isTopSite const): Added.
3723         (WebCore::ResourceRequestBase::setIsTopSite): Added.
3724         (WebCore::equalIgnoringHeaderFields):
3725         * platform/network/ResourceRequestBase.h:
3726         (WebCore::ResourceRequestBase::isSameSiteUnspecified const): Added. See comment for DocumentLoader::startLoadingMainResource()
3727         for more details.
3728         (WebCore::registrableDomainsAreEqual): Added.
3729         (WebCore::ResourceRequestBase::encodeBase const): Encode same-site bits.
3730         (WebCore::ResourceRequestBase::decodeBase): Decode same-site bits.
3731         * platform/network/SameSiteInfo.cpp: Added.
3732         (WebCore::SameSiteInfo::create):
3733         * platform/network/SameSiteInfo.h: Added.
3734         (WebCore::SameSiteInfo::encode const):
3735         (WebCore::SameSiteInfo::decode):
3736         * platform/network/cf/CookieJarCFNet.cpp:
3737         (WebCore::setCookiesFromDOM): Pass Same-Site info down.
3738         (WebCore::cookiesForDOM): Ditto.
3739         (WebCore::cookieRequestHeaderFieldValue): Ditto.
3740         (WebCore::getRawCookies): Ditto.
3741         * platform/network/cf/ResourceRequestCFNet.cpp:
3742         (WebCore::siteForCookies): Added.
3743         (WebCore::ResourceRequest::doUpdatePlatformRequest): Update platform request with same-site info.
3744         (WebCore::ResourceRequest::doUpdateResourceRequest): Ditto.
3745         * platform/network/cocoa/ResourceRequestCocoa.mm:
3746         (WebCore::ResourceRequest::doUpdateResourceRequest): Ditto.
3747         (WebCore::siteForCookies): Added.
3748         (WebCore::ResourceRequest::doUpdatePlatformRequest): Update platform request with same-site info.
3749         * platform/network/curl/CookieJarCurl.cpp:
3750         (WebCore::cookiesForDOM): Pass Same-Site info down.
3751         (WebCore::setCookiesFromDOM): Ditto.
3752         (WebCore::cookieRequestHeaderFieldValue): Ditto.
3753         (WebCore::getRawCookies): Ditto.
3754         * platform/network/curl/CookieJarCurl.h:
3755         * platform/network/curl/CookieJarCurlDatabase.cpp:
3756         (WebCore::CookieJarCurlDatabase::setCookiesFromDOM const): Ditto.
3757         (WebCore::CookieJarCurlDatabase::cookiesForDOM const): Ditto.
3758         (WebCore::CookieJarCurlDatabase::cookieRequestHeaderFieldValue const): Ditto.
3759         (WebCore::CookieJarCurlDatabase::getRawCookies const): Ditto.
3760         * platform/network/curl/CookieJarCurlDatabase.h:
3761         * platform/network/curl/ResourceHandleCurl.cpp:
3762         (WebCore::ResourceHandle::createCurlRequest): Ditto.
3763         * platform/network/mac/CookieJarMac.mm:
3764         (WebCore::cookiesForURL): Added; shared function to return the cookies based on the specified criterion.
3765         (WebCore::setHTTPCookiesForURL): Moved from the bottom of the file to top to be closer to the other
3766         CFNetwork helper functions. Modified to support fetching same-site cookies.
3767         (WebCore::httpCookiesForURL): Moved to be under setHTTPCookiesForURL(). Modified to call cookiesForURL().
3768         Note the SPI used in cookiesForURL() apply the same criterion for whether to fetch secure cookies as we
3769         were computing here. That is, the CFNetwork SPI only returns secure cookies if the specified URL's scheme
3770         case-insensitively matches "https".
3771         (WebCore::cookiesInPartitionForURL): Wrote in terms of cookiesForURL().
3772         (WebCore::cookiesForSession): Pass the Same-Site info.
3773         (WebCore::cookiesForDOM): Ditto.
3774         (WebCore::cookieRequestHeaderFieldValue): Ditto.
3775         (WebCore::setCookiesFromDOM): Ditto.
3776         (WebCore::getRawCookies): Ditto.
3777         (WebCore::deleteCookie): Pass std::nullopt for the Same-Site info so that we do not consider the SameSite
3778         attribute when fetching cookies to delete.
3779         * platform/network/soup/CookieJarSoup.cpp:
3780         (WebCore::setCookiesFromDOM): Pass the Same-Site info.
3781         (WebCore::cookiesForDOM): Ditto.
3782         (WebCore::cookieRequestHeaderFieldValue): Ditto.
3783         (WebCore::getRawCookies): Ditto.
3784         * workers/service/context/ServiceWorkerThreadProxy.cpp:
3785         (WebCore::createPageForServiceWorker): Set the first party for same site cookies ("site for cookies") to
3786         the script URL.
3787         * xml/XSLTProcessor.cpp:
3788         (WebCore::XSLTProcessor::createDocumentFromSource): Copy the first party for same-site cookies to the
3789         new document.
3790
3791 2018-04-23  Chris Dumez  <cdumez@apple.com>
3792
3793         HTML String load cannot be prevented by responding 'Cancel' asynchronously in decidePolicyForNavigationAction
3794         https://bugs.webkit.org/show_bug.cgi?id=184848
3795         <rdar://problem/39145306>
3796
3797         Reviewed by Brady Eidson.
3798
3799         When calling loadHTMLString on a WebView, we end up doing a load for 'about:blank'
3800         with substitute data. In such case, we want to do a regular asynchronous policy
3801         delegate check, there is no reason we need it to be synchronous. Update our check
3802         to make sure we only do a synchronous policy check for initial 'about:blank' loads
3803         that do not have substitute data.
3804
3805         * loader/PolicyChecker.cpp:
3806         (WebCore::PolicyChecker::checkNavigationPolicy):
3807
3808 2018-04-23  Wenson Hsieh  <wenson_hsieh@apple.com>
3809
3810         [Extra zoom mode] 100vw is roughly half of the viewport width in extra zoom mode
3811         https://bugs.webkit.org/show_bug.cgi?id=184871
3812         <rdar://problem/39477595>
3813
3814         Reviewed by Andy Estes.
3815
3816         Currently, when computing CSS viewport units, we use ViewportConfiguration::initialScaleIgnoringContentSize().
3817         This method computes an initial scale from the layout width and height without relying on any information
3818         derived from the current content size. This is done to ensure that the content size and viewport dimensions for
3819         CSS viewport units should not be simultaneously dependent on each other.
3820
3821         Since shrink-to-fit heuristics depend on content size, we currently assume that shrink-to-fit is disabled when
3822         computing initialScaleIgnoringContentSize, by always passing in `false` for `shouldIgnoreScalingConstraints`.
3823         However, in extra zoom mode, the opposite is true: since we force both `m_canIgnoreScalingConstraints` and
3824         `m_forceHorizontalShrinkToFit` to be `true` in this mode, we will always try to shrink-to-fit regardless of
3825         content size.
3826
3827         Because of this shrink-to-fit disparity between `initialScale` and `initialScaleIgnoringContentSize`, viewport
3828         units in extra zoom mode are currently computed assuming an initial scale set by the page, whereas the real
3829         viewport is scaled to fit, which causes any lengths computed in terms of vw and vh to be incorrect. To fix this,
3830         we introduce a version of shouldIgnoreScalingConstraints() that returns `true` iff scaling constraints are
3831         always ignored, regardless of content size. We then use this in initialScaleIgnoringContentSize, instead of
3832         always passing in `false` for `shouldIgnoreScalingConstraints`.
3833
3834         Test: fast/css/extrazoom/viewport-units-shrink-to-fit.html
3835
3836         * page/ViewportConfiguration.cpp:
3837         (WebCore::ViewportConfiguration::shouldIgnoreScalingConstraintsRegardlessOfContentSize const):
3838         (WebCore::ViewportConfiguration::initialScaleIgnoringContentSize const):
3839         * page/ViewportConfiguration.h:
3840
3841 2018-04-23  Zalan Bujtas  <zalan@apple.com>
3842
3843         [Simple line layout] Generate inline boxtree using simple line layout runs.
3844         https://bugs.webkit.org/show_bug.cgi?id=184833
3845
3846         Reviewed by Antti Koivisto.
3847
3848         RenderBlockFlow::ensureLineBoxes triggers line layout on the block content to replace
3849         the simple line layout runs with an inline boxtree. The runs generated by the fast path
3850         should always match the inline tree boxes.
3851         In this patch instead of triggering layout, we just convert the simple line runs to
3852         inline boxes.
3853         Currently, it works with only one, non-paginated text renderer, but we should be
3854         able to extend it to all the simple line layout content.   
3855
3856         Covered by existing tests.
3857
3858         * rendering/InlineBox.h:
3859         (WebCore::InlineBox::setHasHyphen):
3860         (WebCore::InlineBox::setCanHaveLeadingExpansion):
3861         (WebCore::InlineBox::setCanHaveTrailingExpansion):
3862         (WebCore::InlineBox::setForceTrailingExpansion):
3863         (WebCore::InlineBox::setForceLeadingExpansion):
3864         (WebCore::InlineBox::hasHyphen const):
3865         (WebCore::InlineBox::canHaveLeadingExpansion const):
3866         (WebCore::InlineBox::canHaveTrailingExpansion const):
3867         (WebCore::InlineBox::forceTrailingExpansion const):
3868         * rendering/RenderBlockFlow.cpp:
3869         (WebCore::RenderBlockFlow::ensureLineBoxes):
3870         * rendering/RenderBlockFlow.h:
3871         * rendering/SimpleLineLayoutFlowContents.h:
3872         (WebCore::SimpleLineLayout::FlowContents::segmentForRun const):
3873         * rendering/SimpleLineLayoutFunctions.cpp:
3874         (WebCore::SimpleLineLayout::canUseForLineBoxTree):
3875         (WebCore::SimpleLineLayout::initializeInlineBox):
3876         (WebCore::SimpleLineLayout::generateLineBoxTree):
3877         * rendering/SimpleLineLayoutFunctions.h:
3878         * rendering/SimpleLineLayoutResolver.cpp:
3879         (WebCore::SimpleLineLayout::RunResolver::rangeForLine const):
3880         * rendering/SimpleLineLayoutResolver.h:
3881
3882 2018-04-23  Zan Dobersek  <zdobersek@igalia.com>
3883
3884         [CoordGraphics] Remove unused trajectory cruft in CoordinatedLayerTreeHost, CoordinatedGraphicsLayer
3885         https://bugs.webkit.org/show_bug.cgi?id=184881
3886
3887         Reviewed by Michael Catanzaro.
3888
3889         Remove the redundant findFirstDescendantWithContentsRecursively() and
3890         setVisibleContentRectTrajectoryVector() methods on the
3891         CoordinatedGraphicsLayer class.
3892
3893         * platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.cpp:
3894         (WebCore::CoordinatedGraphicsLayer::findFirstDescendantWithContentsRecursively): Deleted.
3895         (WebCore::CoordinatedGraphicsLayer::setVisibleContentRectTrajectoryVector): Deleted.
3896         * platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.h:
3897
3898 2018-04-23  Zan Dobersek  <zdobersek@igalia.com>
3899
3900         [CoordGraphics] TiledBackingStore unnecessarily tracks alpha support value
3901         https://bugs.webkit.org/show_bug.cgi?id=184880
3902
3903         Reviewed by Michael Catanzaro.
3904
3905         Drop the m_supportsAlpha member from the TiledBackingStore class. The
3906         member value was unused. TiledBackingStore::setSupportsAlpha() method
3907         is removed.
3908
3909         TiledBackingStore::setSupportsAlpha() invalidated the backing store,
3910         so CoordinatedGraphicsLayer::setContentsOpaque() now enforces the same
3911         behavior by manually updating the m_needsDisplay struct. This means
3912         that during the following layer flush the backing store is repainted
3913         in its entirety.
3914
3915         * platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.cpp:
3916         (WebCore::CoordinatedGraphicsLayer::setContentsOpaque):
3917         (WebCore::CoordinatedGraphicsLayer::createBackingStore):
3918         * platform/graphics/texmap/coordinated/TiledBackingStore.cpp:
3919         (WebCore::TiledBackingStore::TiledBackingStore):
3920         (WebCore::TiledBackingStore::setSupportsAlpha): Deleted.
3921         * platform/graphics/texmap/coordinated/TiledBackingStore.h:
3922
3923 2018-04-23  Thibault Saunier  <tsaunier@igalia.com>
3924
3925         [GStreamer] Start implementing Audio/VideoTrackPrivateGSTreamer::kind method
3926         https://bugs.webkit.org/show_bug.cgi?id=184650
3927
3928         Reviewed by Philippe Normand.
3929
3930         In the playbin3 case we can assume that if the GstStream is selected by default,
3931         it is the Main track of that kind.
3932
3933         No new tests are added as:
3934             * It relies on playbin3 case which support might be compiled out
3935             * we already have a few test that are currently disabled in the mediastream
3936               testsuite. This patch is part of the work to enable them.
3937
3938         * platform/graphics/gstreamer/AudioTrackPrivateGStreamer.cpp:
3939         (WebCore::AudioTrackPrivateGStreamer::kind const):
3940         * platform/graphics/gstreamer/AudioTrackPrivateGStreamer.h:
3941         * platform/graphics/gstreamer/VideoTrackPrivateGStreamer.cpp:
3942         (WebCore::VideoTrackPrivateGStreamer::kind const):
3943         * platform/graphics/gstreamer/VideoTrackPrivateGStreamer.h:
3944
3945 2018-04-23  Alicia Boya García  <aboya@igalia.com>
3946
3947         [MSE] Add allSamplesInTrackEnqueued event
3948         https://bugs.webkit.org/show_bug.cgi?id=184737
3949
3950         MediaSource has a .endOfStream() method to signal when there are no more frames
3951         after the ones currently buffered.
3952
3953         This bit of data is important for some multimedia frameworks. For instance, in
3954         GStreamer a stream of frames being decoded should be terminated by a
3955         'end-of-stream' (EOS) event that has a similar meaning. Some GStreamer elements
3956         will expect this event in order to work properly under some circumstances.
3957
3958         Unfortunately currently WebKit provides no mechanism for this: an event of
3959         sorts should be emitted after no more frames are going to be enqueued to signal
3960         the end of the stream. The closest mechanism WebKit has for this is
3961         `markEndOfStream()`, but it's not exactly the same: markEndOfStream() informs
3962         that -- as far as network buffering is concerned -- we are done; but at that