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