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