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