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