3c62ace5e5176803c5b41f9890763cc5486253b1
[WebKit-https.git] / Source / WebCore / ChangeLog
1 2018-05-10  Thibault Saunier  <tsaunier@igalia.com>
2
3         [GTK] Implement ImageBuffer::toBGRAData
4         https://bugs.webkit.org/show_bug.cgi?id=185511
5
6         Reviewed by Michael Catanzaro.
7
8         This was never implemented but will be required for the MediaStream API
9         tests.
10
11         * platform/graphics/ImageBuffer.cpp:
12         (WebCore::ImageBuffer::toBGRAData const):
13         * platform/graphics/cg/ImageBufferCG.cpp:
14         (WebCore::ImageBuffer::toBGRAData const):
15         * platform/graphics/gtk/ImageBufferGtk.cpp:
16         (WebCore::ImageBuffer::toBGRAData const):
17
18 2018-05-10  Yacine Bandou  <yacine.bandou_ext@softathome.com>
19
20         [EME][GStreamer] Add a handler for GStreamer protection event
21         https://bugs.webkit.org/show_bug.cgi?id=185245
22
23         Reviewed by Xabier Rodriguez-Calvar.
24
25         Qtdemux sends the protection event when encountered a new PSSH box (encrypted content).
26
27         The Decryptor is moved from AppendPipeline to PlaybackPipeline (see https://bugs.webkit.org/show_bug.cgi?id=181855),
28         thus the protection event is no longer handled because the Decryptor is not in the same pipeline as qtdemux.
29
30         AppendPipeline: httpsrc-->qtdemux-->appsink
31         PlaybackPipeline: appsrc-->parser--> decryptor-->decoder-->sink
32
33         This patch attaches a probe to the sink pad of the appsink in the appendPipeline in order to
34         catch and manage the protection event.
35
36         * platform/graphics/gstreamer/mse/AppendPipeline.cpp:
37         (WebCore::AppendPipeline::AppendPipeline):
38         (WebCore::AppendPipeline::~AppendPipeline):
39         (WebCore::appendPipelineAppsinkPadEventProbe):
40         * platform/graphics/gstreamer/mse/AppendPipeline.h:
41         (WebCore::AppendPipeline::playerPrivate):
42
43 2018-05-10  Yacine Bandou  <yacine.bandou_ext@softathome.com>
44
45         [EME][GStreamer] Move the decryptor from AppendPipeline to PlaybackPipeline.
46         https://bugs.webkit.org/show_bug.cgi?id=181855
47
48         Reviewed by Xabier Rodriguez-Calvar.
49
50         The goal of this move is to handle the limitation of SVP (Secure Video Path) memory size.
51
52         When the decryptor is in the AppendPipeline and we use SVP, we buffer in MediaSource queue
53         the decrypted GstBuffers that are in SVP memory.
54         This behavior cause an out-of-memory error, because we are limited in SVP memory size.
55
56         By moving the decryptor in PlaybackPipeline, we avoid to buffer the decrypted GstBuffers
57         which use the SVP memory and we buffer the encrypted GstBuffers that are in system memory.
58
59         This new architecture also allows to start the buffering before obtaining the DRM license
60         and it makes easier to manage dynamic change of the license or Key.
61
62         The decryptor is auto plugged by GStreamer playbin in PlaybackPipeline.
63
64         SVP: Secure Video Path also named trusted or protected video path, it is a memory which is
65         protected by a hardware access control engine, it is not accessible to other unauthorised
66         software or hardware components.
67
68         Tests:
69             media/encrypted-media/clearKey/clearKey-cenc-audio-playback-mse.html
70             media/encrypted-media/clearKey/clearKey-cenc-video-playback-mse.html
71
72         * platform/graphics/gstreamer/eme/WebKitCommonEncryptionDecryptorGStreamer.cpp:
73         (webkitMediaCommonEncryptionDecryptSinkEventHandler):
74         * platform/graphics/gstreamer/mse/AppendPipeline.cpp:
75         (WebCore::dumpAppendState):
76         (WebCore::AppendPipeline::AppendPipeline):
77         (WebCore::AppendPipeline::handleNeedContextSyncMessage):
78         (WebCore::AppendPipeline::handleAppsrcNeedDataReceived):
79         (WebCore::AppendPipeline::setAppendState):
80         (WebCore::AppendPipeline::parseDemuxerSrcPadCaps):
81         (WebCore::AppendPipeline::appsinkNewSample):
82         (WebCore::AppendPipeline::connectDemuxerSrcPadToAppsinkFromAnyThread):
83         (WebCore::AppendPipeline::disconnectDemuxerSrcPadFromAppsinkFromAnyThread):
84         (WebCore::appendPipelineElementMessageCallback): Deleted.
85         (WebCore::AppendPipeline::handleElementMessage): Deleted.
86         (WebCore::AppendPipeline::dispatchPendingDecryptionStructure): Deleted.
87         (WebCore::AppendPipeline::dispatchDecryptionStructure): Deleted.
88         * platform/graphics/gstreamer/mse/AppendPipeline.h:
89         * platform/graphics/gstreamer/mse/MediaPlayerPrivateGStreamerMSE.cpp:
90         (WebCore::MediaPlayerPrivateGStreamerMSE::attemptToDecryptWithInstance):
91         * platform/graphics/gstreamer/mse/PlaybackPipeline.cpp:
92
93 2018-05-09  Nan Wang  <n_wang@apple.com>
94
95         AX: VoiceOver iframe scrolling focus jumping bug
96         https://bugs.webkit.org/show_bug.cgi?id=176615
97         <rdar://problem/34333067>
98
99         Reviewed by Chris Fleizach.
100
101         Scrolling to make elements visible is not working correctly for elements inside an
102         offscreen iframe. Fixed it by using RenderLayer::scrollRectToVisible() to handle
103         scrolling more properly.
104
105         Test: accessibility/scroll-to-make-visible-iframe-offscreen.html
106
107         * accessibility/AccessibilityObject.cpp:
108         (WebCore::AccessibilityObject::scrollToMakeVisible const):
109
110 2018-05-09  Joanmarie Diggs  <jdiggs@igalia.com>
111
112         AX: accessibleNameForNode should simplify whitespace when using innerText
113         https://bugs.webkit.org/show_bug.cgi?id=185498
114
115         Reviewed by Chris Fleizach.
116
117         Test: accessibility/text-alternative-calculation-from-unrendered-table.html
118
119         Call simplifyWhiteSpace() before returning the innerText value.
120
121         * accessibility/AccessibilityNodeObject.cpp:
122         (WebCore::accessibleNameForNode):
123
124 2018-05-09  Chris Dumez  <cdumez@apple.com>
125
126         Add initial support for 'Cross-Origin-Options' HTTP response header
127         https://bugs.webkit.org/show_bug.cgi?id=184996
128         <rdar://problem/39664620>
129
130         Reviewed by Geoff Garen.
131
132         Add initial support for 'Cross-Origin-Options' HTTP response header behind an experimental
133         feature flag, on by default. When the HTTP server services this HTTP response header for a
134         main resource, we'll set these options on the corresponding Document. This will impact the
135         behavior of the Document's associated Window API when cross-origin.
136
137         The HTTP header has 3 possible values:
138         - allow: This is the default. Regular cross-origin Window API is available.
139         - allow-postmessage: Only postMessage() is available on a cross-origin window, trying to
140           access anything else will throw a SecurityError.
141         - deny: Trying to do anything with a cross-origin window will throw a SecurityError.
142
143         The header has no effect when accessing same origin windows.
144
145         Note that on cross-origin access from Window A to Window B, we check the cross-origin
146         options for both Window A and Window B and use the lowest common denominator as effective
147         cross-origin options for the access. So if Window A has 'Cross-Origin-Options: deny' and
148         tries to call postMessage() on Window B which has 'Cross-Origin-Options: allow-postmessage',
149         we will throw a SecurityError. This is because Window A's more restrictive options (deny)
150         apply.
151
152         Tests: http/wpt/cross-origin-options/allow-postmessage-from-deny.html
153                http/wpt/cross-origin-options/allow-postmessage.html
154                http/wpt/cross-origin-options/cross-origin-options-header.html
155
156         * bindings/js/JSDOMBindingSecurity.cpp:
157         (WebCore::BindingSecurity::shouldAllowAccessToDOMWindowGivenMinimumCrossOriginOptions):
158         * bindings/js/JSDOMBindingSecurity.h:
159         * bindings/js/JSDOMWindowCustom.cpp:
160         (WebCore::effectiveCrossOriginOptionsForAccess):
161         (WebCore::jsDOMWindowGetOwnPropertySlotRestrictedAccess):
162         (WebCore::JSDOMWindow::getOwnPropertySlot):
163         (WebCore::JSDOMWindow::getOwnPropertySlotByIndex):
164         (WebCore::addCrossOriginWindowPropertyNames):
165         (WebCore::addScopedChildrenIndexes):
166         (WebCore::addCrossOriginWindowOwnPropertyNames):
167         (WebCore::JSDOMWindow::getOwnPropertyNames):
168         * bindings/js/JSDOMWindowCustom.h:
169         * bindings/js/JSRemoteDOMWindowCustom.cpp:
170         (WebCore::JSRemoteDOMWindow::getOwnPropertySlot):
171         (WebCore::JSRemoteDOMWindow::getOwnPropertySlotByIndex):
172         (WebCore::JSRemoteDOMWindow::getOwnPropertyNames):
173         * bindings/scripts/CodeGeneratorJS.pm:
174         (GenerateAttributeGetterBodyDefinition):
175         (GetCrossOriginsOptionsFromExtendedAttributeValue):
176         (GenerateAttributeSetterBodyDefinition):
177         (GenerateOperationBodyDefinition):
178         * bindings/scripts/IDLAttributes.json:
179         * dom/Document.cpp:
180         (WebCore::Document::setCrossOriginOptions):
181         * dom/Document.h:
182         (WebCore::Document::crossOriginOptions const):
183         * loader/FrameLoader.cpp:
184         (WebCore::FrameLoader::didBeginDocument):
185         * page/AbstractDOMWindow.cpp:
186         (WebCore::AbstractDOMWindow::AbstractDOMWindow):
187         * page/AbstractDOMWindow.h:
188         (WebCore::AbstractDOMWindow::crossOriginOptions):
189         (WebCore::AbstractDOMWindow::setCrossOriginOptions):
190         * page/DOMWindow.cpp:
191         (WebCore::DOMWindow::DOMWindow):
192         (WebCore::DOMWindow::didSecureTransitionTo):
193         * page/DOMWindow.idl:
194         * page/Frame.h:
195         * page/RemoteDOMWindow.cpp:
196         (WebCore::RemoteDOMWindow::RemoteDOMWindow):
197         * page/RemoteDOMWindow.h:
198         * page/Settings.yaml:
199         * platform/network/HTTPHeaderNames.in:
200         * platform/network/HTTPParsers.cpp:
201         (WebCore::parseCrossOriginOptionsHeader):
202         * platform/network/HTTPParsers.h:
203
204 2018-05-09  Ryosuke Niwa  <rniwa@webkit.org>
205
206         Release assert in TreeScopeOrderedMap::remove via HTMLImageElement::removedFromAncestor
207         https://bugs.webkit.org/show_bug.cgi?id=185493
208
209         Reviewed by Brent Fulgham.
210
211         Fixed the bug that HTMLImageElement::removedFromAncestor and HTMLMapElement::removedFromAncestor
212         were calling removeImageElementByUsemap on the document instead of the shadow tree from which it was removed.
213
214         Test: fast/images/imagemap-in-shadow-tree-removed.html
215
216         * html/HTMLImageElement.cpp:
217         (WebCore::HTMLImageElement::removedFromAncestor):
218         * html/HTMLMapElement.cpp:
219         (WebCore::HTMLMapElement::removedFromAncestor):
220
221 2018-05-09  Joanmarie Diggs  <jdiggs@igalia.com>
222
223         AX: Hidden nodes which are not directly referenced should not participate name/description from content
224         https://bugs.webkit.org/show_bug.cgi?id=185478
225
226         Reviewed by Chris Fleizach.
227
228         Add a check to AccessibilityNodeObject::textUnderElement() and return early
229         if the node is hidden, not referenced by aria-labelledby or aria-describedby,
230         not an HTMLLabelElement, and not fallback content for an HTMLCanvasElement.
231
232         Test: accessibility/text-alternative-calculation-hidden-nodes.html
233
234         * accessibility/AccessibilityNodeObject.cpp:
235         (WebCore::AccessibilityNodeObject::textUnderElement const):
236
237 2018-05-09  Eric Carlson  <eric.carlson@apple.com>
238
239         Update MediaSession to use release logging
240         https://bugs.webkit.org/show_bug.cgi?id=185376
241         <rdar://problem/40022203>
242
243         Reviewed by Youenn Fablet.
244
245         No new tests, tested manually.
246
247         * Modules/mediastream/MediaStream.h: hostingDocument() doesn't need to return a const Document.
248         * Modules/webaudio/AudioContext.cpp:
249         (WebCore::AudioContext::hostingDocument const): Ditto.
250         * Modules/webaudio/AudioContext.h:
251
252         * html/HTMLMediaElement.h: Ditto.
253
254         * html/MediaElementSession.cpp:
255         (WebCore::MediaElementSession::MediaElementSession):
256         (WebCore::MediaElementSession::addBehaviorRestriction):
257         (WebCore::MediaElementSession::removeBehaviorRestriction):
258         (WebCore::MediaElementSession::dataLoadingPermitted const):
259         (WebCore::MediaElementSession::fullscreenPermitted const):
260         (WebCore::MediaElementSession::pageAllowsDataLoading const):
261         (WebCore::MediaElementSession::pageAllowsPlaybackAfterResuming const):
262         (WebCore::MediaElementSession::canShowControlsManager const):
263         (WebCore::MediaElementSession::showPlaybackTargetPicker):
264         (WebCore::MediaElementSession::hasWirelessPlaybackTargets const):
265         (WebCore::MediaElementSession::wirelessVideoPlaybackDisabled const):
266         (WebCore::MediaElementSession::setWirelessVideoPlaybackDisabled):
267         (WebCore::MediaElementSession::setHasPlaybackTargetAvailabilityListeners):
268         (WebCore::MediaElementSession::externalOutputDeviceAvailableDidChange):
269         (WebCore::MediaElementSession::setShouldPlayToPlaybackTarget):
270         (WebCore::MediaElementSession::mediaEngineUpdated):
271         (WebCore::MediaElementSession::willLog const): Deleted.
272         (WebCore::MediaElementSession::logger const): Deleted.
273         (WebCore::MediaElementSession::logIdentifier const): Deleted.
274         (WebCore::MediaElementSession::logChannel const): Deleted.
275         * html/MediaElementSession.h:
276
277         * platform/audio/PlatformMediaSession.cpp:
278         (WebCore::nextLogIdentifier):
279         (WebCore::convertEnumerationToString):
280         (WebCore::PlatformMediaSession::PlatformMediaSession):
281         (WebCore::PlatformMediaSession::setState):
282         (WebCore::PlatformMediaSession::beginInterruption):
283         (WebCore::PlatformMediaSession::endInterruption):
284         (WebCore::PlatformMediaSession::clientWillBeginAutoplaying):
285         (WebCore::PlatformMediaSession::clientWillPausePlayback):
286         (WebCore::PlatformMediaSession::pauseSession):
287         (WebCore::PlatformMediaSession::stopSession):
288         (WebCore::PlatformMediaSession::clientDataBufferingTimerFired):
289         (WebCore::PlatformMediaSession::logChannel const):
290         (WebCore::stateName): Deleted.
291         (WebCore::interruptionName): Deleted.
292         * platform/audio/PlatformMediaSession.h:
293         (WTF::LogArgument<WebCore::PlatformMediaSession::State>::toString):
294         (WTF::LogArgument<WebCore::PlatformMediaSession::InterruptionType>::toString):
295
296 2018-05-09  Thibault Saunier  <tsaunier@igalia.com>
297
298         [GStreamer] Never call updateTracks if running on legacy pipeline
299         https://bugs.webkit.org/show_bug.cgi?id=184581
300
301         This makes sure failling code path is never reached in the conditions where it should not have been reached.
302
303         Reviewed by Philippe Normand.
304
305         Re enables all tests that were disabled after fixing.
306
307         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:
308         (WebCore::MediaPlayerPrivateGStreamer::handleMessage):
309
310 2018-05-09  Daniel Bates  <dabates@apple.com>
311
312         REGRESSION (r231479): http/tests/appcache/x-frame-options-prevents-framing.php is timing out
313         https://bugs.webkit.org/show_bug.cgi?id=185443
314         <rdar://problem/40100660>
315
316         Reviewed by Andy Estes.
317
318         Following r231479 when using WebKit2 and Restricted HTTP Response Access is enabled (enabled in
319         WebKitTestRunner) we only check the CSP frame-ancestors directive and X-Frame-Options in
320         NetworkProcess. We need to check these security requirements in WebContent process whenever
321         we are performing a substitute data load, such as for app cache, as these loads do not go
322         through NetworkProcess.
323
324         * loader/DocumentLoader.cpp:
325         (WebCore::DocumentLoader::responseReceived):
326
327 2018-05-09  Justin Fan  <justin_fan@apple.com>
328
329         Hooked up ASTC support in WebGL; requires OpenGL ES 3 context to work. 
330         https://bugs.webkit.org/show_bug.cgi?id=185272
331         <rdar://problem/15745737>
332
333         Reviewed by Dean Jackson.
334
335         Also added in Khronos' ASTC test from version 1.0.4 beta of their conformance test suite,
336         although again, this requires OpenGL ES 3 context for WebKit to detect proper support.
337
338         Test: fast/canvas/webgl/webgl-compressed-texture-astc.html
339
340         * DerivedSources.make:
341         * Sources.txt:
342         * WebCore.xcodeproj/project.pbxproj:
343         * bindings/js/JSDOMConvertWebGL.cpp:
344         (WebCore::convertToJSValue):
345         * html/canvas/WebGL2RenderingContext.cpp:
346         (WebCore::WebGL2RenderingContext::getExtension):
347         (WebCore::WebGL2RenderingContext::getSupportedExtensions):
348         * html/canvas/WebGLCompressedTextureASTC.cpp: Added.
349         (WebCore::WebGLCompressedTextureASTC::WebGLCompressedTextureASTC):
350         (WebCore::WebGLCompressedTextureASTC::getName const):
351         (WebCore::WebGLCompressedTextureASTC::supported):
352         (WebCore::WebGLCompressedTextureASTC::getSupportedProfiles):
353         * html/canvas/WebGLCompressedTextureASTC.h: Added.
354         * html/canvas/WebGLCompressedTextureASTC.idl: Added.
355         * html/canvas/WebGLExtension.h:
356         * html/canvas/WebGLRenderingContext.cpp:
357         (WebCore::WebGLRenderingContext::getExtension):
358         (WebCore::WebGLRenderingContext::getSupportedExtensions):
359         * html/canvas/WebGLRenderingContextBase.cpp:
360         (WebCore::WebGLRenderingContextBase::validateCompressedTexFuncData):
361         (WebCore::WebGLRenderingContextBase::validateCompressedTexDimensions):
362         * html/canvas/WebGLRenderingContextBase.h:
363         * platform/graphics/Extensions3D.h:
364
365 2018-05-09  Youenn Fablet  <youenn@apple.com>
366
367         Allow WebResourceLoader to cancel a load served from a service worker
368         https://bugs.webkit.org/show_bug.cgi?id=185274
369
370         Reviewed by Chris Dumez.
371
372         Add support for cancelling a fetch from WebProcess to service worker process.
373         Use FetchIdentifier instead of uint64_t.
374
375         * Modules/fetch/FetchIdentifier.h: Added.
376         * WebCore.xcodeproj/project.pbxproj:
377         * workers/service/context/ServiceWorkerFetch.h:
378         * workers/service/context/ServiceWorkerThreadProxy.cpp:
379         (WebCore::ServiceWorkerThreadProxy::startFetch):
380         (WebCore::ServiceWorkerThreadProxy::cancelFetch):
381         * workers/service/context/ServiceWorkerThreadProxy.h:
382
383 2018-05-09  Thibault Saunier  <tsaunier@igalia.com>
384
385         [GStreamer] Fix style issue in MediaPlayerPrivateGStreamer
386         https://bugs.webkit.org/show_bug.cgi?id=185479
387
388         Reviewed by Philippe Normand.
389
390         ERROR: Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:114:  Multi line control clauses should use braces.  [whitespace/braces] [4]
391         ERROR: Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:194:  Multi line control clauses should use braces.  [whitespace/braces] [4]
392         ERROR: Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:398:  One line control clauses should not use braces.  [whitespace/braces] [4]
393         ERROR: Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:440:  One line control clauses should not use braces.  [whitespace/braces] [4]
394         ERROR: Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:806:  More than one command on the same line  [whitespace/newline] [4]
395         ERROR: Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:869:  More than one command on the same line  [whitespace/newline] [4]
396         ERROR: Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:880:  More than one command on the same line  [whitespace/newline] [4]
397         ERROR: Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:940:  More than one command on the same line  [whitespace/newline] [4]
398         ERROR: Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:1102:  Multi line control clauses should use braces.  [whitespace/braces] [4]
399         ERROR: Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:1109:  Multi line control clauses should use braces.  [whitespace/braces] [4]
400
401         Indentation and style issue fixed only.
402
403         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:
404         (WebCore::MediaPlayerPrivateGStreamer::registerMediaEngine):
405         (WebCore::MediaPlayerPrivateGStreamer::~MediaPlayerPrivateGStreamer):
406         (WebCore::MediaPlayerPrivateGStreamer::changePipelineState):
407         (WebCore::MediaPlayerPrivateGStreamer::play):
408         (WebCore::MediaPlayerPrivateGStreamer::videoChangedCallback):
409         (WebCore::MediaPlayerPrivateGStreamer::videoSinkCapsChangedCallback):
410         (WebCore::MediaPlayerPrivateGStreamer::audioChangedCallback):
411         (WebCore::MediaPlayerPrivateGStreamer::textChangedCallback):
412         (WebCore::MediaPlayerPrivateGStreamer::buffered const):
413         (WebCore::MediaPlayerPrivateGStreamer::loadNextLocation):
414
415 2018-05-09  Daniel Bates  <dabates@apple.com>
416
417         REGRESSION (r231479): com.apple.WebCore crash in WebCore::DocumentLoader::stopLoadingAfterXFrameOptionsOrContentSecurityPolicyDenied()
418         https://bugs.webkit.org/show_bug.cgi?id=185475
419         <rdar://problem/40093853>
420
421         Reviewed by Andy Estes.
422
423         DocumentLoader::stopLoadingAfterXFrameOptionsOrContentSecurityPolicyDenied() must extends its lifetime
424         until completion as dispatching a DOM load event at the associated frame can cause JavaScript execution
425         that can do anything, including destroying the loader that dispatched the event.
426
427         Following r231479 DocumentLoader::stopLoadingAfterXFrameOptionsOrContentSecurityPolicyDenied() is now
428         invoked by both DocumentLoader::responseReceived() and WebResourceLoader::stopLoadingAfterXFrameOptionsOrContentSecurityPolicyDenied().
429         The latter only can happen when using WebKit2 and the experimental feature Restricted HTTP Response Access
430         is enabled (RuntimeEnabledFeatures::sharedFeatures().restrictedHTTPResponseAccess()). Unlike DocumentLoader::responseReceived()
431         WebResourceLoader::stopLoadingAfterXFrameOptionsOrContentSecurityPolicyDenied() does not take out a ref
432         on the DocumentLoader before invoking DocumentLoader::stopLoadingAfterXFrameOptionsOrContentSecurityPolicyDenied().
433         Therefore, DocumentLoader::stopLoadingAfterXFrameOptionsOrContentSecurityPolicyDenied() can cause its
434         own destruction as a result of dispatching a DOM load event at the frame. We should take out a ref on
435         the DocumentLoader when executing DocumentLoader::stopLoadingAfterXFrameOptionsOrContentSecurityPolicyDenied().
436
437         * loader/DocumentLoader.cpp:
438         (WebCore::DocumentLoader::stopLoadingAfterXFrameOptionsOrContentSecurityPolicyDenied):
439
440 2018-05-09  Tim Horton  <timothy_horton@apple.com>
441
442         Fix the build by ignoring some deprecation warnings
443
444         * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
445         (WebCore::MediaPlayerPrivateAVFoundationObjC::setShouldDisableSleep):
446
447 2018-05-09  Michael Catanzaro  <mcatanzaro@igalia.com>
448
449         [WPE] Build cleanly with GCC 8 and ICU 60
450         https://bugs.webkit.org/show_bug.cgi?id=185462
451
452         Reviewed by Carlos Alberto Lopez Perez.
453
454         * PlatformGTK.cmake: Include directories are in the wrong place.
455         * accessibility/AXObjectCache.cpp: Silence -Wclass-memaccess problems and leave warnings.
456         (WebCore::AXObjectCache::startOrEndTextMarkerDataForRange):
457         (WebCore::AXObjectCache::textMarkerDataForCharacterOffset):
458         (WebCore::AXObjectCache::textMarkerDataForVisiblePosition):
459         (WebCore::AXObjectCache::textMarkerDataForFirstPositionInTextControl):
460         * css/CSSFontFace.cpp: Silence -Wfallthrough
461         (WebCore::CSSFontFace::fontLoadTiming const):
462         * css/CSSSelectorList.cpp: Silence -Wclass-memaccess, this one is intentional.
463         (WebCore::CSSSelectorList::adoptSelectorVector):
464         * editing/TextIterator.cpp: Silence ICU deprecation warnings.
465         * platform/Length.h:
466         (WebCore::Length::operator=): More -Wclass-memaccess, looks benign.
467         * platform/graphics/Gradient.cpp:
468         (WebCore::Gradient::hash const): -Wclass-memaccess again. Leave a warning.
469         * platform/graphics/SurrogatePairAwareTextIterator.cpp: Silence ICU deprecation warnings.
470         * platform/graphics/cairo/FontCairoHarfbuzzNG.cpp:
471         (WebCore::FontCascade::fontForCombiningCharacterSequence const): Silence ICU deprecation.
472         * platform/graphics/freetype/FontCustomPlatformDataFreeType.cpp:
473         (WebCore::FontCustomPlatformData::FontCustomPlatformData): Silence -Wcast-function-type.
474         * platform/graphics/freetype/SimpleFontDataFreeType.cpp:
475         (WebCore::Font::canRenderCombiningCharacterSequence const): Silence ICU deprecation.
476         * platform/graphics/gstreamer/GstAllocatorFastMalloc.cpp:
477         (gstAllocatorFastMallocMemUnmap): Fix -Wcast-function-type.
478         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:
479         (WebCore::MediaPlayerPrivateGStreamer::updateTracks): Fix bad printf.
480         (WebCore::MediaPlayerPrivateGStreamer::enableTrack): Another bad printf.
481         (WebCore::findHLSQueue): Fix -Wcast-function-type.
482         * platform/graphics/gstreamer/eme/WebKitClearKeyDecryptorGStreamer.cpp:
483         (webKitMediaClearKeyDecryptorDecrypt): Fix another bad printf.
484         * platform/network/soup/SocketStreamHandleImplSoup.cpp: Silence -Wcast-function-type.
485         (WebCore::SocketStreamHandleImpl::beginWaitingForSocketWritability):
486         * platform/text/TextEncoding.cpp: Silence ICU deprecration.
487
488 2018-05-08  Simon Fraser  <simon.fraser@apple.com>
489
490         SVG lighting colors need to be converted into linearSRGB
491         https://bugs.webkit.org/show_bug.cgi?id=181196
492
493         Reviewed by Darin Adler.
494
495         Address post-commit comments. Don't make a Color that contains linearRGB components,
496         but use FloatComponents instead. Since these FloatComponents are in the 0-1 range,
497         FELighting::setPixelInternal() needs to multiply by 255 since the output pixels are
498         8-bit 0-255.
499         
500         Change linearToSRGBColorComponent() and sRGBToLinearColorComponent() to do math in
501         floats without promoting to doubles.
502
503         * platform/graphics/ColorUtilities.cpp:
504         (WebCore::FloatComponents::FloatComponents):
505         (WebCore::linearToSRGBColorComponent):
506         (WebCore::sRGBToLinearColorComponent):
507         (WebCore::sRGBColorToLinearComponents):
508         (WebCore::linearToSRGBColor): Deleted.
509         (WebCore::sRGBToLinearColor): Deleted.
510         * platform/graphics/ColorUtilities.h:
511         * platform/graphics/filters/FELighting.cpp:
512         (WebCore::FELighting::setPixelInternal):
513         (WebCore::FELighting::drawLighting):
514
515 2018-05-09  Timothy Hatcher  <timothy@apple.com>
516
517         Use StyleColor::Options in more places.
518
519         https://bugs.webkit.org/show_bug.cgi?id=185458
520         rdar://problem/39853798
521
522         Add UseDefaultAppearance to StyleColor::Options, to avoid passing yet another
523         boolean on some of these functions.
524
525         Reviewed by Tim Horton.
526
527         * css/MediaQueryEvaluator.cpp:
528         * css/StyleColor.h:
529         * dom/Document.cpp:
530         (WebCore::Document::useDefaultAppearance const):
531         (WebCore::Document::styleColorOptions const):
532         * dom/Document.h:
533         * platform/Theme.cpp:
534         (WebCore::Theme::paint):
535         * platform/Theme.h:
536         * platform/mac/LocalDefaultSystemAppearance.h:
537         * platform/mac/LocalDefaultSystemAppearance.mm:
538         (WebCore::LocalDefaultSystemAppearance::LocalDefaultSystemAppearance):
539         (WebCore::LocalDefaultSystemAppearance::~LocalDefaultSystemAppearance):
540         * platform/mac/ThemeMac.h:
541         * platform/mac/ThemeMac.mm:
542         (WebCore::paintToggleButton):
543         (WebCore::paintButton):
544         (WebCore::ThemeMac::ensuredView):
545         (WebCore::ThemeMac::drawCellOrFocusRingWithViewIntoContext):
546         (WebCore::ThemeMac::paint):
547         (-[WebCoreThemeView initWithUseSystemAppearance:]): Deleted.
548         * platform/wpe/ThemeWPE.cpp:
549         (WebCore::ThemeWPE::paint):
550         * platform/wpe/ThemeWPE.h:
551         * rendering/RenderListBox.cpp:
552         (WebCore::RenderListBox::paintItemBackground):
553         * rendering/RenderTheme.cpp:
554         (WebCore::RenderTheme::paint):
555         (WebCore::RenderTheme::inactiveListBoxSelectionBackgroundColor const):
556         (WebCore::RenderTheme::platformInactiveListBoxSelectionBackgroundColor const):
557         * rendering/RenderTheme.h:
558         * rendering/RenderThemeGtk.cpp:
559         (WebCore::RenderThemeGtk::platformInactiveListBoxSelectionBackgroundColor const):
560         * rendering/RenderThemeGtk.h:
561         * rendering/RenderThemeMac.h:
562         * rendering/RenderThemeMac.mm:
563         (WebCore::RenderThemeMac::documentViewFor const):
564         (WebCore::RenderThemeMac::platformInactiveListBoxSelectionBackgroundColor const):
565         (WebCore::RenderThemeMac::systemColor const):
566         (WebCore::RenderThemeMac::paintCellAndSetFocusedElementNeedsRepaintIfNecessary):
567         (WebCore::RenderThemeMac::paintSliderThumb):
568
569 2018-05-09  Yacine Bandou  <yacine.bandou_ext@softathome.com>
570
571         [EME][GStreamer] Crash when the mediaKeys are created before loading the media in debug conf
572         https://bugs.webkit.org/show_bug.cgi?id=185244
573
574         Reviewed by Xabier Rodriguez-Calvar.
575
576         The function "MediaPlayerPrivateGStreamerBase::cdmInstanceAttached" is expected to be called once,
577         so there is an ASSERT(!m_cdmInstance).
578         But when the MediaKeys are created before loading the media, the cdminstance is created and attached
579         to the MediaPlayerPrivate via "MediaPlayerPrivateGStreamerBase::cdmInstanceAttached" before loading
580         the media, then when the media is loading, the function "MediaPlayerPrivateGStreamerBase::cdmInstanceAttached"
581         will be called several times via the function "mediaEngineWasUpdated" wich is called for each change
582         in the MediaElement state, thus the WebProcess crashes in the ASSERT(!m_cdmInstance).
583
584         This commit avoid the crash by replacing the assert with a simple check.
585
586         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp:
587         (WebCore::MediaPlayerPrivateGStreamerBase::cdmInstanceAttached):
588         (WebCore::MediaPlayerPrivateGStreamerBase::cdmInstanceDetached):
589
590 2018-05-09  Antti Koivisto  <antti@apple.com>
591
592         Add OptionSet::operator& and operator bool
593         https://bugs.webkit.org/show_bug.cgi?id=185306
594
595         Reviewed by Anders Carlsson.
596
597         Use it in a few places.
598
599         * loader/FrameLoader.cpp:
600         (WebCore::FrameLoader::reload):
601         * rendering/RenderLayerCompositor.cpp:
602         (WebCore::RenderLayerCompositor::logReasonsForCompositing):
603         (WebCore::RenderLayerCompositor::updateScrollCoordinatedLayer):
604
605 2018-05-08  Dean Jackson  <dino@apple.com>
606
607         Disable system preview link fetching
608         https://bugs.webkit.org/show_bug.cgi?id=185463
609
610         Reviewed by Jon Lee.
611
612         Temporarily disable system preview detection when a link
613         is clicked.
614
615         * html/HTMLAnchorElement.cpp:
616         (WebCore::HTMLAnchorElement::handleClick):
617
618 2018-05-08  Wenson Hsieh  <wenson_hsieh@apple.com>
619
620         Unreviewed, fix the internal iOS build
621
622         Add a missing import statement in an implementation file.
623
624         * editing/cocoa/WebContentReaderCocoa.mm:
625
626 2018-05-08  Ryan Haddad  <ryanhaddad@apple.com>
627
628         Unreviewed, rolling out r231486.
629
630         Caused service worker LayoutTest failures on macOS Debug WK2.
631
632         Reverted changeset:
633
634         "Allow WebResourceLoader to cancel a load served from a
635         service worker"
636         https://bugs.webkit.org/show_bug.cgi?id=185274
637         https://trac.webkit.org/changeset/231486
638
639 2018-05-08  Wenson Hsieh  <wenson_hsieh@apple.com>
640
641         Consolidate WebContentReaderIOS and WebContentReaderMac into WebContentReaderCocoa
642         https://bugs.webkit.org/show_bug.cgi?id=185340
643
644         Reviewed by Tim Horton.
645
646         WebContentReader::readURL is currently the only method implemented separately in iOS and macOS platform
647         WebContentReader files. The implementation across macOS and iOS is nearly identical (with some exceptions with
648         the way iOS handles file URLs and plain text editing), so we can merge these into a single method
649         WebContentReaderCocoa and delete WebContentReaderIOS and WebContentReaderMac.
650
651         This also has the added bonus of fixing a latent bug in WebContentReaderMac, wherein URLs written to the
652         pasteboard using -[NSPasteboard writeObjects:] are currently pasted as empty anchor elements. In this case, the
653         link title isn't made explicit, so the `title` passed in to WebContentReader::readURL is empty. On iOS, we have
654         code to fall back to pasting the absolute string of the URL if the title is empty, but on macOS, we'll just use
655         this empty string as the title of the anchor.
656
657         Test: PasteMixedContent.PasteURLWrittenToPasteboardUsingWriteObjects
658
659         * SourcesCocoa.txt:
660         * WebCore.xcodeproj/project.pbxproj:
661         * editing/cocoa/WebContentReaderCocoa.mm:
662         (WebCore::WebContentReader::readURL):
663         * editing/ios/WebContentReaderIOS.mm: Removed.
664         * editing/mac/WebContentReaderMac.mm: Removed.
665
666 2018-05-08  Zalan Bujtas  <zalan@apple.com>
667
668         [Simple line layout] Cache run resolver.
669         https://bugs.webkit.org/show_bug.cgi?id=185411
670
671         Reviewed by Antti Koivisto.
672
673         This patch caches the run resolver on the [SimpleLine]Layout object. 
674         In certain cases, when the block container has thousands of elements (foobar1<br>foobar2<br>.....foobar9999<br>),
675         constructing the resolver (and its dependencies) in a repeating fashion could hang the WebProcess.
676
677         Covered by existing tests.
678
679         * rendering/SimpleLineLayout.cpp:
680         (WebCore::SimpleLineLayout::create):
681         (WebCore::SimpleLineLayout::Layout::create):
682         (WebCore::SimpleLineLayout::Layout::Layout):
683         * rendering/SimpleLineLayout.h:
684         (WebCore::SimpleLineLayout::Layout::runResolver const):
685         * rendering/SimpleLineLayoutFunctions.cpp:
686         (WebCore::SimpleLineLayout::paintFlow):
687         (WebCore::SimpleLineLayout::hitTestFlow):
688         (WebCore::SimpleLineLayout::collectFlowOverflow):
689         (WebCore::SimpleLineLayout::computeBoundingBox):
690         (WebCore::SimpleLineLayout::computeFirstRunLocation):
691         (WebCore::SimpleLineLayout::collectAbsoluteRects):
692         (WebCore::SimpleLineLayout::collectAbsoluteQuads):
693         (WebCore::SimpleLineLayout::textOffsetForPoint):
694         (WebCore::SimpleLineLayout::collectAbsoluteQuadsForRange):
695         (WebCore::SimpleLineLayout::generateLineBoxTree):
696         * rendering/SimpleLineLayoutResolver.cpp:
697         (WebCore::SimpleLineLayout::LineResolver::LineResolver):
698         * rendering/SimpleLineLayoutResolver.h:
699         (WebCore::SimpleLineLayout::lineResolver):
700
701 2018-05-08  Brent Fulgham  <bfulgham@apple.com>
702
703         Switch some RELEASE_ASSERTS to plain debug ASSERTS in PlatformScreenMac.mm
704         https://bugs.webkit.org/show_bug.cgi?id=185451
705         <rdar://problem/39620348>
706
707         Reviewed by Zalan Bujtas.
708
709         Change a set of RELEASE_ASSERTS used to prevent accessing NSScreen related functions in the
710         PlatformScreenMac implementation to less expensive Debug ASSERTS.
711
712         No change in behavior.
713
714         * platform/mac/PlatformScreenMac.mm:
715         (WebCore::screenHasInvertedColors):
716         (WebCore::screenDepth):
717         (WebCore::screenDepthPerComponent):
718         (WebCore::screenRectForDisplay):
719         (WebCore::screenRect):
720         (WebCore::screenAvailableRect):
721         (WebCore::screenColorSpace):
722         (WebCore::screenSupportsExtendedColor):
723
724 2018-05-08  Daniel Bates  <dabates@apple.com>
725
726         Resign Strong Password appearance when text field value changes
727         https://bugs.webkit.org/show_bug.cgi?id=185433
728         <rdar://problem/39958508>
729
730         Reviewed by Ryosuke Niwa.
731
732         Remove the Strong Password decoration when the text field's value changes to avoid interfering
733         with web sites that allow a person to clear the password field.
734
735         Tests: fast/forms/auto-fill-button/auto-fill-strong-password-button-when-maxlength-changes.html
736                fast/forms/auto-fill-button/auto-fill-strong-password-button-when-minlength-changes.html
737                fast/forms/auto-fill-button/hide-auto-fill-strong-password-button-when-value-changes.html
738
739         * html/HTMLInputElement.cpp:
740         (WebCore::HTMLInputElement::resignStrongPasswordAppearance): Extracted from HTMLInputElement::updateType().
741         (WebCore::HTMLInputElement::updateType): Extract out logic to resign the Strong Password appearance
742         into a function that can be shared by this function and HTMLInputElement::setValue().
743         (WebCore::HTMLInputElement::setValue): Resign the Strong Password appearance if this field was
744         changed programmatically (i.e. no DOM change event was dispatched).
745         * html/HTMLInputElement.h:
746
747 2018-05-08  Jer Noble  <jer.noble@apple.com>
748
749         Unreviewed build fix; add missing function definition.
750
751         * html/HTMLMediaElement.h:
752         (WebCore::HTMLMediaElement::didPassCORSAccessCheck const):
753
754 2018-05-08  Jer Noble  <jer.noble@apple.com>
755
756         Mute MediaElementSourceNode when tainted.
757         https://bugs.webkit.org/show_bug.cgi?id=184866
758
759         Reviewed by Eric Carlson.
760
761         Test: http/tests/security/webaudio-render-remote-audio-blocked-no-crossorigin.html
762
763         * Modules/webaudio/AudioContext.cpp:
764         (WebCore::AudioContext::wouldTaintOrigin const):
765         * Modules/webaudio/AudioContext.h:
766         * Modules/webaudio/MediaElementAudioSourceNode.cpp:
767         (WebCore::MediaElementAudioSourceNode::setFormat):
768         (WebCore::MediaElementAudioSourceNode::wouldTaintOrigin):
769         (WebCore::MediaElementAudioSourceNode::process):
770         * Modules/webaudio/MediaElementAudioSourceNode.h:
771
772 2018-05-08  Eric Carlson  <eric.carlson@apple.com>
773
774         Log rtcstats as JSON
775         https://bugs.webkit.org/show_bug.cgi?id=185437
776         <rdar://problem/40065332>
777
778         Reviewed by Youenn Fablet.
779
780         * Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.cpp:
781         (WebCore::RTCStatsLogger::RTCStatsLogger): Create a wrapper class so we don't have to add a
782         toJSONString method to libwebrtc.
783         (WebCore::RTCStatsLogger::toJSONString const): Log stats as JSON.
784         (WebCore::LibWebRTCMediaEndpoint::OnStatsDelivered): Don't use the LOGIDENTIFIER macro because
785         it doesn't work well inside of a lambda.
786         (WTF::LogArgument<WebCore::RTCStatsLogger>::toString): Move into .cpp file because it is only
787         used here.
788         * Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.h:
789         (WTF::LogArgument<webrtc::RTCStats>::toString): Deleted. Move to .cpp file.
790
791 2018-05-08  Dean Jackson  <dino@apple.com>
792
793         System Preview links should trigger a download
794         https://bugs.webkit.org/show_bug.cgi?id=185439
795         <rdar://problem/40065545>
796
797         Reviewed by Jon Lee.
798
799         Add a new field to FrameLoadRequest, which then is copied
800         into ResourceRequest, identifying if the link clicked
801         is a system preview.
802
803         * html/HTMLAnchorElement.cpp:
804         (WebCore::HTMLAnchorElement::handleClick): Look for isSystemPreviewLink().
805         * loader/FrameLoadRequest.cpp:
806         (WebCore::FrameLoadRequest::FrameLoadRequest):
807         * loader/FrameLoadRequest.h: New property.
808         (WebCore::FrameLoadRequest::FrameLoadRequest):
809         (WebCore::FrameLoadRequest::isSystemPreview const):
810         * loader/FrameLoader.cpp:
811         (WebCore::FrameLoader::urlSelected):
812         (WebCore::FrameLoader::loadURL):
813         * loader/FrameLoader.h:
814         * platform/network/ResourceRequestBase.cpp:
815         (WebCore::ResourceRequestBase::isSystemPreview const):
816         (WebCore::ResourceRequestBase::setSystemPreview):
817         * platform/network/ResourceRequestBase.h:
818
819 2018-05-08  Commit Queue  <commit-queue@webkit.org>
820
821         Unreviewed, rolling out r231491.
822         https://bugs.webkit.org/show_bug.cgi?id=185434
823
824         Setting the Created key on a cookie does not work yet, due a
825         bug in CFNetwork (Requested by ggaren on #webkit).
826
827         Reverted changeset:
828
829         "[WKHTTPCookieStore getAllCookies] returns inconsistent
830         creation time"
831         https://bugs.webkit.org/show_bug.cgi?id=185041
832         https://trac.webkit.org/changeset/231491
833
834 2018-05-08  Sihui Liu  <sihui_liu@apple.com>
835
836         [WKHTTPCookieStore getAllCookies] returns inconsistent creation time
837         https://bugs.webkit.org/show_bug.cgi?id=185041
838         <rdar://problem/34684214>
839
840         Reviewed by Geoffrey Garen.
841
842         Set creationtime property when creating Cookie object to keep consistency after conversion.
843
844         New API test: WebKit.WKHTTPCookieStoreCreationTime.
845
846         * platform/network/cocoa/CookieCocoa.mm:
847         (WebCore::Cookie::operator NSHTTPCookie * const):
848
849 2018-05-08  Eric Carlson  <eric.carlson@apple.com>
850
851         Text track cue logging should include cue text
852         https://bugs.webkit.org/show_bug.cgi?id=185353
853         <rdar://problem/40003565>
854
855         Reviewed by Brent Fulgham.
856
857         No new tests, tested manually.
858
859         * html/track/VTTCue.cpp:
860         (WebCore::VTTCue::toJSON const):
861         * platform/graphics/InbandTextTrackPrivateClient.h:
862         (WebCore::GenericCueData::toJSONString const):
863         * platform/graphics/iso/ISOVTTCue.cpp:
864         (WebCore::ISOWebVTTCue::toJSONString const):
865
866 2018-05-08  Sam Weinig  <sam@webkit.org>
867
868         More cleanup of XMLHttpRequestUpload
869         https://bugs.webkit.org/show_bug.cgi?id=185409
870
871         Reviewed by Alex Christensen.
872
873         - Remove unneeded #includes
874         - Rename m_xmlHttpRequest to m_request
875         - Make some overloaded some methods private, and mark them as final rather
876           than override.
877
878         * xml/XMLHttpRequestUpload.cpp:
879         (WebCore::XMLHttpRequestUpload::XMLHttpRequestUpload):
880         * xml/XMLHttpRequestUpload.h:
881
882 2018-05-08  Zalan Bujtas  <zalan@apple.com>
883
884         [LFC] Start using BlockMarginCollapse
885         https://bugs.webkit.org/show_bug.cgi?id=185424
886
887         Reviewed by Antti Koivisto.
888
889         BlockMarginCollapse could be all static.
890
891         * layout/blockformatting/BlockFormattingContext.cpp:
892         (WebCore::Layout::BlockFormattingContext::marginTop const):
893         (WebCore::Layout::BlockFormattingContext::marginBottom const):
894         * layout/blockformatting/BlockMarginCollapse.cpp:
895         (WebCore::Layout::isMarginTopCollapsedWithSibling):
896         (WebCore::Layout::isMarginBottomCollapsedWithSibling):
897         (WebCore::Layout::isMarginTopCollapsedWithParent):
898         (WebCore::Layout::isMarginBottomCollapsedWithParent):
899         (WebCore::Layout::collapsedMarginTopFromFirstChild):
900         (WebCore::Layout::collapsedMarginBottomFromLastChild):
901         (WebCore::Layout::nonCollapsedMarginTop):
902         (WebCore::Layout::nonCollapsedMarginBottom):
903         (WebCore::Layout::BlockMarginCollapse::marginTop):
904         (WebCore::Layout::BlockMarginCollapse::marginBottom):
905         (WebCore::Layout::BlockMarginCollapse::BlockMarginCollapse): Deleted.
906         (WebCore::Layout::BlockMarginCollapse::marginTop const): Deleted.
907         (WebCore::Layout::BlockMarginCollapse::marginBottom const): Deleted.
908         (WebCore::Layout::BlockMarginCollapse::isMarginTopCollapsedWithSibling const): Deleted.
909         (WebCore::Layout::BlockMarginCollapse::isMarginBottomCollapsedWithSibling const): Deleted.
910         (WebCore::Layout::BlockMarginCollapse::isMarginTopCollapsedWithParent const): Deleted.
911         (WebCore::Layout::BlockMarginCollapse::isMarginBottomCollapsedWithParent const): Deleted.
912         (WebCore::Layout::BlockMarginCollapse::nonCollapsedMarginTop const): Deleted.
913         (WebCore::Layout::BlockMarginCollapse::nonCollapsedMarginBottom const): Deleted.
914         (WebCore::Layout::BlockMarginCollapse::collapsedMarginTopFromFirstChild const): Deleted.
915         (WebCore::Layout::BlockMarginCollapse::collapsedMarginBottomFromLastChild const): Deleted.
916         (WebCore::Layout::BlockMarginCollapse::hasAdjoiningMarginTopAndBottom const): Deleted.
917         * layout/blockformatting/BlockMarginCollapse.h:
918
919 2018-05-08  Youenn Fablet  <youenn@apple.com>
920
921         Allow WebResourceLoader to cancel a load served from a service worker
922         https://bugs.webkit.org/show_bug.cgi?id=185274
923
924         Reviewed by Chris Dumez.
925
926         Add support for cancelling a fetch from WebProcess to service worker process.
927         Use FetchIdentifier instead of uint64_t.
928
929         * Modules/fetch/FetchIdentifier.h: Added.
930         * WebCore.xcodeproj/project.pbxproj:
931         * workers/service/context/ServiceWorkerFetch.h:
932         * workers/service/context/ServiceWorkerThreadProxy.cpp:
933         (WebCore::ServiceWorkerThreadProxy::startFetch):
934         (WebCore::ServiceWorkerThreadProxy::cancelFetch):
935         * workers/service/context/ServiceWorkerThreadProxy.h:
936
937 2018-05-08  Said Abou-Hallawa  <sabouhallawa@apple.com>
938
939         feTurbulence is not rendered correctly on Retina display
940         https://bugs.webkit.org/show_bug.cgi?id=183798
941
942         Reviewed by Simon Fraser.
943
944         On 2x display the feTurbulence filter creates a scaled ImageBuffer but
945         processes only the unscaled size. This is a remaining work of r168577 and
946         is very similar to what was done for the feMorphology filter in r188271.
947
948         Test: fast/hidpi/filters-turbulence.html
949
950         * platform/graphics/filters/FETurbulence.cpp:
951         (WebCore::FETurbulence::fillRegion const):
952         (WebCore::FETurbulence::platformApplySoftware):
953
954 2018-05-07  Zalan Bujtas  <zalan@apple.com>
955
956         [LFC] Add FormattingContext::layoutOutOfFlowDescendants implementation
957         https://bugs.webkit.org/show_bug.cgi?id=185377
958
959         Reviewed by Antti Koivisto.
960
961         Also, remove FormattingContext's m_layoutContext member and pass it in to ::layout() instead.
962         In theory LayoutContext is needed only during ::layout() call. 
963
964         * layout/FormattingContext.cpp:
965         (WebCore::Layout::FormattingContext::layoutOutOfFlowDescendants const):
966         * layout/FormattingContext.h:
967         (WebCore::Layout::FormattingContext::layoutContext const):
968         * layout/LayoutContext.cpp:
969         (WebCore::Layout::LayoutContext::updateLayout):
970         * layout/blockformatting/BlockFormattingContext.cpp:
971         (WebCore::Layout::BlockFormattingContext::layout const):
972         * layout/blockformatting/BlockFormattingContext.h:
973         * layout/inlineformatting/InlineFormattingContext.cpp:
974         (WebCore::Layout::InlineFormattingContext::layout const):
975         * layout/inlineformatting/InlineFormattingContext.h:
976
977 2018-05-07  Daniel Bates  <dabates@apple.com>
978
979         Check X-Frame-Options and CSP frame-ancestors in network process
980         https://bugs.webkit.org/show_bug.cgi?id=185410
981         <rdar://problem/37733934>
982
983         Reviewed by Ryosuke Niwa.
984
985         * WebCore.xcodeproj/project.pbxproj: Make PingLoader.h a private header so that we can include it in WebKit.
986         * loader/DocumentLoader.cpp:
987         (WebCore::DocumentLoader::responseReceived): Only check CSP frame-ancestors and X-Frame-Options here if
988         we are not checking them in the NetworkProcess and HTTP response access is restricted. I code is otherwise kept
989         unchanged. There may be opportunities to clean this code up more and share more of it. We should look into this
990         in subsequent bugs.
991         * loader/DocumentLoader.h: Change visibility of stopLoadingAfterXFrameOptionsOrContentSecurityPolicyDenied() from
992         private to public and export it so that we can call it from the WebKit.
993         * loader/PingLoader.h:
994         * page/Settings.yaml: Add a new setting called networkProcessCSPFrameAncestorsCheckingEnabled (defaults: false)
995         and is hardcoded in WebPage.cpp to be enabled. This setting is used to determine if we will be using the NetworkProcess.
996         Ideally we wouldn't have this setting and just key off RuntimeEnabledFeatures::sharedFeatures().restrictedHTTPResponseAccess().
997         However RuntimeEnabledFeatures::sharedFeatures().restrictedHTTPResponseAccess() is always enabled in WebKit Legacy
998         at the time of writing (why?). And, strangely, RuntimeEnabledFeatures::sharedFeatures().restrictedHTTPResponseAccess()
999         is conditionally enabled in WebKit. For now, we add a new setting, networkProcessCSPFrameAncestorsCheckingEnabled,
1000         to determine if CSP checking should be performed in NetworkProcess. For checking to actually happen in NetworkProcess
1001         and not in DocumentLoader::responseReceived() RuntimeEnabledFeatures::sharedFeatures().restrictedHTTPResponseAccess()
1002         will also need to be enabled.
1003         * page/csp/ContentSecurityPolicy.cpp:
1004         (WebCore::ContentSecurityPolicy::allowFrameAncestors const): Added a variant that takes a vector of ancestor origins.
1005         * page/csp/ContentSecurityPolicy.h:
1006         * page/csp/ContentSecurityPolicyDirectiveList.cpp:
1007         (WebCore::checkFrameAncestors): Ditto.
1008         (WebCore::ContentSecurityPolicyDirectiveList::violatedDirectiveForFrameAncestorOrigins const): Ditto.
1009         * page/csp/ContentSecurityPolicyDirectiveList.h: Export constructor so that we can invoke it from NetworkResourceLoader::shouldInterruptLoadForCSPFrameAncestorsOrXFrameOptions().
1010         * page/csp/ContentSecurityPolicyResponseHeaders.h:
1011         * platform/network/HTTPParsers.h: Export XFrameOptionsDisposition() so that we can use in WebKit.
1012
1013 2018-05-07  Daniel Bates  <dabates@apple.com>
1014
1015         Abstract logic to log console messages and send CSP violation reports into a client
1016         https://bugs.webkit.org/show_bug.cgi?id=185393
1017         <rdar://problem/40036053>
1018
1019         Reviewed by Brent Fulgham.
1020
1021         First pass at adding infrastructure to supporting CSP reporting from NetworkProcess and workers.
1022         Replaces the existing ContentSecurityPolicy constructor that takes a Frame with one that
1023         takes a ContentSecurityPolicyClient to delegate to for logging and sending reports. We will look
1024         to remove ContentSecurityPolicy constructor that takes a ScriptExecutionContext in a follow up.
1025
1026         Standardize on instantiating a ContentSecurityPolicy with the full URL to resource that it protects
1027         instead of taking only the SecurityOrigin of this URL. By taking the full URL the ContentSecurityPolicy
1028         object is now capable of resolving a relative report URL without needing a Document/ScriptExecutionContext.
1029
1030         We are underutilizing the CSPInfo struct and ContentSecurityPolicyClient::willSendCSPViolationReport()
1031         delegate callback in this patch. We will make use of this functionality in a subsequent patch to
1032         support collecting script state (e.g. source line number) when reporting CSP violations in worker
1033         threads. We also no longer go through the unnecessary motions to try to collect script state for a
1034         frame-ancestors violation (since DocumentLoader extends ContentSecurityPolicyClient and does not
1035         implement ContentSecurityPolicyClient::willSendCSPViolationReport()). The frame-ancestors directive
1036         is checked before a document is parsed and executes script; => there will never be any script state
1037         to collect; => it is not necessary to try to collect it as we currently do.
1038
1039         * Sources.txt: Add file ContentSecurityPolicyClient.cpp. See the remarks for ContentSecurityPolicyClient.cpp
1040         below on why we have this file.
1041         * WebCore.xcodeproj/project.pbxproj: Add files ContentSecurityPolicyClient.{h, cpp}.
1042         * dom/Document.cpp:
1043         (WebCore::Document::initSecurityContext): Pass the URL of the protected document.
1044         * loader/DocumentLoader.cpp:
1045         (WebCore::DocumentLoader::responseReceived): Ditto.
1046         (WebCore::DocumentLoader::addConsoleMessage): Added.
1047         (WebCore::DocumentLoader::sendCSPViolationReport): Added.
1048         (WebCore::DocumentLoader::dispatchSecurityPolicyViolationEvent): Added.
1049         * loader/DocumentLoader.h:
1050         * loader/FrameLoaderClient.h: Fix typo in comment.
1051         * loader/WorkerThreadableLoader.cpp:
1052         (WebCore::WorkerThreadableLoader::MainThreadBridge::MainThreadBridge): Pass the URL of the worker script.
1053         * page/csp/ContentSecurityPolicy.cpp:
1054         (WebCore::ContentSecurityPolicy::ContentSecurityPolicy): Added overload that takes a URL&& and an optional
1055         ContentSecurityPolicyClient*.
1056         (WebCore::ContentSecurityPolicy::deprecatedURLForReporting const): Extracted and simplified stripURLForUseInReport()
1057         into this member function.
1058         (WebCore::ContentSecurityPolicy::reportViolation const): Modified to make use of the client, if we have
1059         one and removed code for handling a ContentSecurityPolicy that was instantiated with a Frame.
1060         (WebCore::ContentSecurityPolicy::logToConsole const): Ditto.
1061         (WebCore::stripURLForUseInReport): Deleted; incorporated into ContentSecurityPolicy::deprecatedURLForReporting().
1062         * page/csp/ContentSecurityPolicy.h:
1063         * page/csp/ContentSecurityPolicyClient.cpp: Added. This file exists so that we can define the virtual
1064         destructor out-of-line and export this abstract class so as to avoid the need for the vtable to be
1065         defined in the translation unit of each derived class.
1066         * page/csp/ContentSecurityPolicyClient.h: Added.
1067         * page/csp/ContentSecurityPolicySource.cpp:
1068         (WebCore::ContentSecurityPolicySource::operator SecurityOriginData const): Added.
1069         * page/csp/ContentSecurityPolicySource.h:
1070         * workers/WorkerGlobalScope.cpp:
1071         (WebCore::WorkerGlobalScope::WorkerGlobalScope): Instantiate the ContentSecurityPolicy object with the
1072         URL of the worker script.
1073
1074 2018-05-07  Simon Fraser  <simon.fraser@apple.com>
1075
1076         CSS filters which reference SVG filters fail to respect the "color-interpolation-filters" of the filter
1077         https://bugs.webkit.org/show_bug.cgi?id=185343
1078
1079         Reviewed by Dean Jackson.
1080
1081         Test: css3/filters/color-interpolation-filters.html
1082         
1083         When applying CSS reference filters, apply the value of "color-interpolation-filters" for the
1084         referenced filter effect element, just as we do for SVG filters.
1085
1086         * rendering/FilterEffectRenderer.cpp:
1087         (WebCore::FilterEffectRenderer::buildReferenceFilter):
1088
1089 2018-05-07  Daniel Bates  <dabates@apple.com>
1090
1091         CSP status-code incorrect for document blocked due to violation of its frame-ancestors directive
1092         https://bugs.webkit.org/show_bug.cgi?id=185366
1093         <rdar://problem/40035116>
1094
1095         Reviewed by Brent Fulgham.
1096
1097         Fixes an issue where the status-code in the sent CSP report for an HTTP document blocked because
1098         its frame-ancestors directive was violated would be the status code of the previously loaded
1099         document in the frame. If the previously loaded document was about:blank then this would be 0.
1100
1101         Currently whenever we send a CSP report we ask the document's loader (Document::loader()) for the
1102         HTTP status code for the last response. Document::loader() returns the loader for the last committed
1103         document its frame. For a frame-ancestors violation, a CSP report is sent before the document
1104         that had the frame-ancestors directive has been committed and after it has been associate with a frame.
1105         As a result we are in are in a transient transition state for the frame and hence the last response
1106         for new document's loader (Document::loader()) is actually the last response of the previously loaded
1107         document in the frame. Instead we need to take care to tell CSP about the HTTP status code for the
1108         response associated with the document the CSP came from.
1109
1110         * dom/Document.cpp:
1111         (WebCore::Document::processHttpEquiv):
1112         (WebCore::Document::initSecurityContext):
1113         Pass the HTTP status code to CSP.
1114
1115         * page/csp/ContentSecurityPolicy.cpp:
1116         (WebCore::ContentSecurityPolicy::copyStateFrom):
1117         (WebCore::ContentSecurityPolicy::responseHeaders const):
1118         (WebCore::ContentSecurityPolicy::didReceiveHeaders):
1119         (WebCore::ContentSecurityPolicy::didReceiveHeader):
1120         (WebCore::ContentSecurityPolicy::reportViolation const):
1121         * page/csp/ContentSecurityPolicy.h:
1122         Modify existing functions to take the HTTP status code, store it in a instance variable,
1123         and reference this variable when reporting a violation.
1124
1125         * page/csp/ContentSecurityPolicyResponseHeaders.cpp:
1126         (WebCore::ContentSecurityPolicyResponseHeaders::ContentSecurityPolicyResponseHeaders):
1127         (WebCore::ContentSecurityPolicyResponseHeaders::isolatedCopy const):
1128         * page/csp/ContentSecurityPolicyResponseHeaders.h:
1129         (WebCore::ContentSecurityPolicyResponseHeaders::encode const):
1130         (WebCore::ContentSecurityPolicyResponseHeaders::decode):
1131         Store the HTTP status code along with the response headers.
1132
1133 2018-05-07  Daniel Bates  <dabates@apple.com>
1134
1135         CSP referrer incorrect for document blocked due to violation of its frame-ancestors directive
1136         https://bugs.webkit.org/show_bug.cgi?id=185380
1137
1138         Reviewed by Brent Fulgham.
1139
1140         Similar to <https://bugs.webkit.org/show_bug.cgi?id=185366>, fixes an issue where the referrer
1141         in the sent CSP report for an HTTP document blocked because its frame-ancestors directive was
1142         violated would be the referrer of the previously loaded document in the frame.
1143
1144         Currently whenever we send a CSP report we ask the document's loader (Document::loader()) for
1145         the referrer for the last request. Document::loader() returns the loader for the last committed
1146         document in its frame. For a frame-ancestors violation, a CSP report is sent before the document
1147         that had the frame-ancestors directive has been committed and after it has been associate with a
1148         frame. As a result we are in a transient transition state for the frame and hence the last request
1149         for the new document's loader (Document::loader()) is actually the last request of the previously
1150         loaded document in the frame. Instead we need to take care to tell CSP about the referrer for the
1151         request associated with the document the CSP came from.
1152
1153         * loader/DocumentLoader.cpp:
1154         (WebCore::DocumentLoader::responseReceived):
1155
1156 2018-05-07  Brent Fulgham  <bfulgham@apple.com>
1157
1158         Add experimental feature to prompt for Storage Access API use
1159         https://bugs.webkit.org/show_bug.cgi?id=185335
1160         <rdar://problem/39994649>
1161
1162         Reviewed by Alex Christensen and Youenn Fablet.
1163
1164         Create a new experimental feature that gates the ability of WebKit clients to prompt the user when
1165         Storage Access API is invoked.
1166
1167         Currently this feature doesn't have any user-visible impact.
1168
1169         * page/RuntimeEnabledFeatures.h:
1170         (WebCore::RuntimeEnabledFeatures::setStorageAccessPromptsEnabled):
1171         (WebCore::RuntimeEnabledFeatures::storageAccessPromptsEnabled const):
1172         * testing/InternalSettings.cpp:
1173         (WebCore::InternalSettings::Backup::Backup):
1174         (WebCore::InternalSettings::Backup::restoreTo):
1175         (WebCore::InternalSettings::setStorageAccessPromptsEnabled):
1176         * testing/InternalSettings.h:
1177         * testing/InternalSettings.idl:
1178
1179 2018-05-07  Chris Dumez  <cdumez@apple.com>
1180
1181         Stop using an iframe's id as fallback if its name attribute is not set
1182         https://bugs.webkit.org/show_bug.cgi?id=11388
1183
1184         Reviewed by Geoff Garen.
1185
1186         WebKit had logic to use an iframe's id as fallback name when its name
1187         content attribute is not set. This behavior was not standard and did not
1188         match other browsers:
1189         - https://html.spec.whatwg.org/#attr-iframe-name
1190
1191         Gecko / Trident never behaved this way. Blink was aligned with us until
1192         they started to match the specification in:
1193         - https://bugs.chromium.org/p/chromium/issues/detail?id=347169
1194
1195         This WebKit quirk was causing some Web-compatibility issues because it
1196         would affect the behavior of Window's name property getter when trying
1197         to look up an iframe by id. Because of Window's named property getter
1198         behavior [1], we would return the frame's contentWindow instead of the
1199         iframe element itself.
1200
1201         [1] https://html.spec.whatwg.org/multipage/window-object.html#named-access-on-the-window-object
1202
1203         Test: fast/dom/Window/named-getter-frame-id.html
1204
1205         * html/HTMLFrameElementBase.cpp:
1206         (WebCore::HTMLFrameElementBase::openURL):
1207         (WebCore::HTMLFrameElementBase::parseAttribute):
1208         (WebCore::HTMLFrameElementBase::didFinishInsertingNode):
1209         * html/HTMLFrameElementBase.h:
1210
1211 2018-05-07  Chris Dumez  <cdumez@apple.com>
1212
1213         ASSERT(!childItemWithTarget(child->target())) is hit in HistoryItem::addChildItem()
1214         https://bugs.webkit.org/show_bug.cgi?id=185322
1215
1216         Reviewed by Geoff Garen.
1217
1218         We generate unique names for Frame to be used in HistoryItem. Those names not only
1219         need to be unique, they also need to be repeatable to avoid layout tests flakiness
1220         and for things like restoring form state from a HistoryItem.
1221
1222         The previously generated frame names were relying on the Frame's index among a
1223         parent Frame's children. The issue was that we could end up with duplicate names
1224         because one could insert a Frame *before* an existing one. This is because the code
1225         would not take care of updating existing Frames' unique name on frame tree mutation.
1226
1227         Updating frame tree names on mutation would be inefficient and is also not necessary.
1228         The approach chosen in this patch is to stop using the Frame's index and instead rely
1229         on an increasing counter stored on the top-frame's FrameTree. To make the names
1230         repeatable, we reset the counter on page navigation.
1231
1232         * page/Frame.cpp:
1233         (WebCore::Frame::setDocument):
1234         * page/FrameTree.cpp:
1235         (WebCore::FrameTree::uniqueChildName const):
1236         (WebCore::FrameTree::generateUniqueName const):
1237         * page/FrameTree.h:
1238         (WebCore::FrameTree::resetFrameIdentifiers):
1239
1240 2018-05-07  Yacine Bandou  <yacine.bandou_ext@softathome.com>
1241
1242         [EME][GStreamer] Fix wrong subsample parsing on r227067
1243         https://bugs.webkit.org/show_bug.cgi?id=185382
1244
1245         Reviewed by Philippe Normand.
1246
1247         The initialization of sampleIndex should be moved outside of the loop.
1248         Without this patch we will have a bad log and the check of the subsample
1249         count will be useless.
1250
1251         * platform/graphics/gstreamer/eme/WebKitClearKeyDecryptorGStreamer.cpp:
1252         (webKitMediaClearKeyDecryptorDecrypt):
1253
1254 2018-05-07  Daniel Bates  <dabates@apple.com>
1255
1256         CSP should be passed the referrer
1257         https://bugs.webkit.org/show_bug.cgi?id=185367
1258
1259         Reviewed by Per Arne Vollan.
1260
1261         As a step towards formalizing a CSP delegate object and removing the dependencies
1262         on ScriptExecutionContext and Frame, we should pass the document's referrer directly
1263         instead of indirectly obtaining it from the ScriptExecutionContext or Frame used
1264         to instantiate the ContentSecurityPolicy object.
1265
1266         * dom/Document.cpp:
1267         (WebCore::Document::processHttpEquiv): Pass the document's referrer.
1268         (WebCore::Document::initSecurityContext): Ditto.
1269         (WebCore::Document::applyQuickLookSandbox): Ditto.
1270         * loader/DocumentLoader.cpp:
1271         (WebCore::DocumentLoader::responseReceived): Ditto.
1272         * loader/FrameLoader.cpp:
1273         (WebCore::FrameLoader::didBeginDocument): Ditto.
1274         * page/csp/ContentSecurityPolicy.cpp:
1275         (WebCore::ContentSecurityPolicy::copyStateFrom): We pass a null string for the referrer
1276         to didReceiveHeader() as a placeholder since it requires the referrer be given to it. We
1277         fix up the referrer (m_referrer) after copying all the policy headers.
1278         (WebCore::ContentSecurityPolicy::didReceiveHeaders): Ditto.
1279         (WebCore::ContentSecurityPolicy::didReceiveHeader): Modified to take a referrer and WTFMove()s
1280         it into an instance variable (m_referrer).
1281         (WebCore::ContentSecurityPolicy::reportViolation const): Modified to use the stored referrer.
1282         * page/csp/ContentSecurityPolicy.h:
1283         * workers/WorkerGlobalScope.cpp:
1284         (WebCore::WorkerGlobalScope::applyContentSecurityPolicyResponseHeaders): Pass a null string
1285         for the referrer as a worker does not have a referrer.
1286
1287 2018-05-07  Daniel Bates  <dabates@apple.com>
1288
1289         CSP should only notify Inspector to pause the debugger on the first policy to violate a directive
1290         https://bugs.webkit.org/show_bug.cgi?id=185364
1291
1292         Reviewed by Brent Fulgham.
1293
1294         Notify Web Inspector that a script was blocked on the first enforced CSP policy that it
1295         violates.
1296
1297         A page can have more than one enforced Content Security Policy. Currently for inline
1298         scripts, inline event handlers, JavaScript URLs, and eval() that are blocked by CSP
1299         we notify Web Inspector that it was blocked for each CSP policy that blocked it. When
1300         Web Inspector is notified it pauses script execution. It does not seem very meaningful
1301         to pause script execution on the same script for each CSP policy that blocked it.
1302         Therefore, only tell Web Inspector that a script was blocked for the first enforced CSP
1303         policy that blocked it.
1304
1305         * page/csp/ContentSecurityPolicy.cpp:
1306         (WebCore::ContentSecurityPolicy::allowJavaScriptURLs const):
1307         (WebCore::ContentSecurityPolicy::allowInlineEventHandlers const):
1308         (WebCore::ContentSecurityPolicy::allowInlineScript const):
1309         (WebCore::ContentSecurityPolicy::allowEval const):
1310
1311 2018-05-07  Daniel Bates  <dabates@apple.com>
1312
1313         Substitute CrossOriginPreflightResultCache::clear() for CrossOriginPreflightResultCache::empty()
1314         https://bugs.webkit.org/show_bug.cgi?id=185170
1315
1316         Reviewed by Per Arne Vollan.
1317
1318         Rename CrossOriginPreflightResultCache::empty() to CrossOriginPreflightResultCache::clear() make
1319         it consistent with the terminology we use in WebKit to signify a function that clears a collection.
1320         A member function named "empty" is expected to return an instance of a class in its "empty state".
1321         For example, StringImpl::empty() returns a StringImpl instance that represents the empty string.
1322         However CrossOriginPreflightResultCache::empty() clears out the cache in-place. We should rename
1323         this function to better describe its purpose.
1324
1325         * loader/CrossOriginPreflightResultCache.cpp:
1326         (WebCore::CrossOriginPreflightResultCache::clear):
1327         (WebCore::CrossOriginPreflightResultCache::empty): Deleted.
1328         * loader/CrossOriginPreflightResultCache.h:
1329
1330 2018-05-06  Dean Jackson  <dino@apple.com>
1331
1332         WebGL: Reset simulated values after validation fails
1333         https://bugs.webkit.org/show_bug.cgi?id=185363
1334         <rdar://problem/39733417>
1335
1336         Reviewed by Anders Carlsson.
1337
1338         While fixing a previous bug, I forgot to reset some values
1339         when validation fails. This caused a bug where a subsequent
1340         invalid call might use those values and escape detection.
1341
1342         Test: fast/canvas/webgl/index-validation-with-subsequent-draws.html
1343
1344         * html/canvas/WebGLRenderingContextBase.cpp:
1345         (WebCore::WebGLRenderingContextBase::simulateVertexAttrib0): Reset the
1346         sizes when validation fails.
1347         * html/canvas/WebGLRenderingContextBase.h:
1348
1349 2018-05-07  Ms2ger  <Ms2ger@igalia.com>
1350
1351         Support negative sw/sh values in createImageBitmap().
1352         https://bugs.webkit.org/show_bug.cgi?id=184449
1353
1354         Reviewed by Dean Jackson.
1355
1356         Tests: LayoutTests/imported/w3c/web-platform-tests/2dcontext/imagebitmap/createImageBitmap-drawImage.html
1357                LayoutTests/http/wpt/2dcontext/imagebitmap/createImageBitmap.html
1358
1359         * html/ImageBitmap.cpp:
1360         (WebCore::ImageBitmap::createPromise): handle negative values per spec.
1361
1362 2018-05-07  Brian Burg  <bburg@apple.com>
1363
1364         Web Inspector: opt out of process swap on navigation if a Web Inspector frontend is connected
1365         https://bugs.webkit.org/show_bug.cgi?id=184861
1366         <rdar://problem/39153768>
1367
1368         Reviewed by Timothy Hatcher.
1369
1370         Notify the client of the current connection count whenever a frontend connects or disconnects.
1371
1372         Covered by new API test.
1373
1374         * inspector/InspectorClient.h:
1375         (WebCore::InspectorClient::frontendCountChanged):
1376         * inspector/InspectorController.cpp:
1377         (WebCore::InspectorController::connectFrontend):
1378         (WebCore::InspectorController::disconnectFrontend):
1379         (WebCore::InspectorController::disconnectAllFrontends):
1380         * inspector/InspectorController.h:
1381
1382 2018-05-07  Eric Carlson  <eric.carlson@apple.com>
1383
1384         Text track cue logging should include cue text
1385         https://bugs.webkit.org/show_bug.cgi?id=185353
1386         <rdar://problem/40003565>
1387
1388         Reviewed by Youenn Fablet.
1389
1390         No new tests, tested manually.
1391
1392         * html/track/VTTCue.cpp:
1393         (WebCore::VTTCue::toJSONString const): Use toJSON.
1394         (WebCore::VTTCue::toJSON const): New.
1395         * html/track/VTTCue.h:
1396
1397         * platform/graphics/InbandTextTrackPrivateClient.h:
1398         (WebCore::GenericCueData::toJSONString const): Log m_content.
1399
1400         * platform/graphics/iso/ISOVTTCue.cpp:
1401         (WebCore::ISOWebVTTCue::toJSONString const): Log m_cueText.
1402
1403 2018-05-06  Zalan Bujtas  <zalan@apple.com>
1404
1405         [LFC] Add assertions for stale Display::Box geometry
1406         https://bugs.webkit.org/show_bug.cgi?id=185357
1407
1408         Reviewed by Antti Koivisto.
1409
1410         Ensure that we don't access stale geometry of other boxes during layout.
1411         For example, in order to layout a block child we need the containing block's content box top/left and width (but not the height)
1412
1413         * layout/displaytree/DisplayBox.h:
1414         (WebCore::Display::Box::invalidateTop):
1415         (WebCore::Display::Box::invalidateLeft):
1416         (WebCore::Display::Box::invalidateWidth):
1417         (WebCore::Display::Box::invalidateHeight):
1418         (WebCore::Display::Box::hasValidPosition const):
1419         (WebCore::Display::Box::hasValidSize const):
1420         (WebCore::Display::Box::hasValidGeometry const):
1421         (WebCore::Display::Box::invalidatePosition):
1422         (WebCore::Display::Box::invalidateSize):
1423         (WebCore::Display::Box::setHasValidPosition):
1424         (WebCore::Display::Box::setHasValidSize):
1425         (WebCore::Display::Box::setHasValidGeometry):
1426         (WebCore::Display::Box::rect const):
1427         (WebCore::Display::Box::top const):
1428         (WebCore::Display::Box::left const):
1429         (WebCore::Display::Box::bottom const):
1430         (WebCore::Display::Box::right const):
1431         (WebCore::Display::Box::topLeft const):
1432         (WebCore::Display::Box::bottomRight const):
1433         (WebCore::Display::Box::size const):
1434         (WebCore::Display::Box::width const):
1435         (WebCore::Display::Box::height const):
1436         (WebCore::Display::Box::setRect):
1437         (WebCore::Display::Box::setTopLeft):
1438         (WebCore::Display::Box::setTop):
1439         (WebCore::Display::Box::setLeft):
1440         (WebCore::Display::Box::setSize):
1441         (WebCore::Display::Box::setWidth):
1442         (WebCore::Display::Box::setHeight):
1443
1444 2018-05-06  Zalan Bujtas  <zalan@apple.com>
1445
1446         [LFC] Add BlockFormattingContext::computeStaticPosition
1447         https://bugs.webkit.org/show_bug.cgi?id=185352
1448
1449         Reviewed by Antti Koivisto.
1450
1451         This is the core logic for positioning inflow boxes in a block formatting context (very naive though).
1452
1453         * layout/blockformatting/BlockFormattingContext.cpp:
1454         (WebCore::Layout::BlockFormattingContext::computeStaticPosition const):
1455         * layout/displaytree/DisplayBox.h:
1456
1457 2018-05-05  Sam Weinig  <sam@webkit.org>
1458
1459         Cleanup XMLHttpRequestUpload a little
1460         https://bugs.webkit.org/show_bug.cgi?id=185344
1461
1462         Reviewed by Yusuke Suzuki.
1463
1464         * bindings/js/JSXMLHttpRequestCustom.cpp:
1465         (WebCore::JSXMLHttpRequest::visitAdditionalChildren):
1466         Use auto to reduce redundancy.
1467
1468         * xml/XMLHttpRequest.cpp:
1469         (WebCore::XMLHttpRequest::upload):
1470         * xml/XMLHttpRequest.h:
1471         Switch upload() to return a reference.
1472         
1473         * xml/XMLHttpRequestUpload.cpp:
1474         (WebCore::XMLHttpRequestUpload::XMLHttpRequestUpload):
1475         (WebCore::XMLHttpRequestUpload::dispatchProgressEvent):
1476         * xml/XMLHttpRequestUpload.h:
1477         Cleanup formatting, modernize and switch XMLHttpRequest member from a pointer
1478         to a reference.
1479
1480 2018-05-05  Dean Jackson  <dino@apple.com>
1481
1482         Draw a drop-shadow behind the system preview badge
1483         https://bugs.webkit.org/show_bug.cgi?id=185356
1484         <rdar://problem/40004936>
1485
1486         Reviewed by Wenson Hsieh.
1487
1488         Draw a very subtle drop-shadow under the system
1489         preview badge so that it is more visible on a pure
1490         white background.
1491
1492         I also moved some code around to make it more clear
1493         and improved comments.
1494
1495         * rendering/RenderThemeIOS.mm:
1496         (WebCore::RenderThemeIOS::paintSystemPreviewBadge):
1497
1498 2018-05-04  Wenson Hsieh  <wenson_hsieh@apple.com>
1499
1500         [iOS] Multiple links in Mail are dropped in a single line, and are difficult to tell apart
1501         https://bugs.webkit.org/show_bug.cgi?id=185289
1502         <rdar://problem/35756912>
1503
1504         Reviewed by Tim Horton and Darin Adler.
1505
1506         When inserting multiple URLs as individual items in a single drop, we currently separate each item with a space
1507         (see r217284). However, it still seems difficult to tell dropped links apart. This patch makes some slight
1508         tweaks to WebContentReader::readURL so that it inserts line breaks before dropped URLs, if the dropped URL isn't
1509         the first item to be inserted in the resulting document fragment.
1510
1511         Augments existing API tests in DataInteractionTests.
1512
1513         * editing/ios/WebContentReaderIOS.mm:
1514
1515         Additionally remove some extraneous header imports from this implementation file.
1516
1517         (WebCore::WebContentReader::readURL):
1518
1519 2018-05-02  Dean Jackson  <dino@apple.com>
1520
1521         Use IOSurfaces for CoreImage operations where possible
1522         https://bugs.webkit.org/show_bug.cgi?id=185230
1523         <rdar://problem/39926929>
1524
1525         Reviewed by Jon Lee.
1526
1527         On iOS hardware, we can use IOSurfaces as a rendering destination
1528         for CoreImage, which means we're keeping data on the GPU
1529         for rendering.
1530
1531         As a drive-by fix, I used a convenience method for Gaussian blurs.
1532
1533         * rendering/RenderThemeIOS.mm:
1534         (WebCore::RenderThemeIOS::paintSystemPreviewBadge):
1535
1536 2018-05-04  Tim Horton  <timothy_horton@apple.com>
1537
1538         Shift to a lower-level framework for simplifying URLs
1539         https://bugs.webkit.org/show_bug.cgi?id=185334
1540
1541         Reviewed by Dan Bernstein.
1542
1543         * Configurations/WebCore.xcconfig:
1544         * platform/mac/DragImageMac.mm:
1545         (WebCore::LinkImageLayout::LinkImageLayout):
1546
1547 2018-05-03  Ryosuke Niwa  <rniwa@webkit.org>
1548
1549         Release assert in ScriptController::canExecuteScripts via HTMLMediaElement::~HTMLMediaElement()
1550         https://bugs.webkit.org/show_bug.cgi?id=185288
1551
1552         Reviewed by Jer Noble.
1553
1554         The crash is caused by HTMLMediaElement::~HTMLMediaElement canceling the resource load via CachedResource
1555         which ends up calling FrameLoader::checkCompleted() and fire load event on the document synchronously.
1556         Speculatively fix the crash by scheduling the check instead.
1557
1558         In long term, ResourceLoader::cancel should never fire load event synchronously: webkit.org/b/185284.
1559
1560         Unfortunately, no new tests since I can't get MediaResource to get destructed at the right time.
1561
1562         * html/HTMLMediaElement.cpp:
1563         (WebCore::HTMLMediaElement::isRunningDestructor): Added to detect this specific case.
1564         (WebCore::HTMLMediaElementDestructorScope): Added.
1565         (WebCore::HTMLMediaElementDestructorScope::HTMLMediaElementDestructorScope): Added.
1566         (WebCore::HTMLMediaElementDestructorScope::~HTMLMediaElementDestructorScope): Added.
1567         (WebCore::HTMLMediaElement::~HTMLMediaElement): Instantiate HTMLMediaElement.
1568         * html/HTMLMediaElement.h:
1569         * loader/FrameLoader.cpp:
1570         (WebCore::FrameLoader::checkCompleted): Call scheduleCheckCompleted instead of synchronously calling
1571         checkCompleted if we're in the middle of destructing a HTMLMediaElement.
1572
1573 2018-05-04  Ryosuke Niwa  <rniwa@webkit.org>
1574
1575         Rename DocumentOrderedMap to TreeScopeOrderedMap
1576         https://bugs.webkit.org/show_bug.cgi?id=185290
1577
1578         Reviewed by Zalan Bujtas.
1579
1580         Renamed the class since it's almost always a mistake to use this class as a member variable of Document.
1581
1582         * Sources.txt:
1583         * WebCore.xcodeproj/project.pbxproj:
1584         * dom/MouseRelatedEvent.cpp: Include the forgotten DOMWindow.h. Unified build files bit us here.
1585         * dom/TreeScope.cpp:
1586         (WebCore::TreeScope::addElementById):
1587         (WebCore::TreeScope::addElementByName):
1588         (WebCore::TreeScope::addImageMap):
1589         (WebCore::TreeScope::addImageElementByUsemap):
1590         (WebCore::TreeScope::labelElementForId):
1591         * dom/TreeScope.h:
1592         * dom/TreeScopeOrderedMap.cpp: Renamed from DocumentOrderedMap.cpp
1593         * dom/TreeScopeOrderedMap.h: Renamed from DocumentOrderedMap.h
1594         * html/HTMLDocument.h:
1595
1596 2018-05-04  Don Olmstead  <don.olmstead@sony.com>
1597
1598         [Win][WebKit] Fix forwarding headers for Windows build
1599         https://bugs.webkit.org/show_bug.cgi?id=184412
1600
1601         Reviewed by Alex Christensen.
1602
1603         No new tests. No change in behavior.
1604
1605         * PlatformWin.cmake:
1606
1607 2018-05-04  Zalan Bujtas  <zalan@apple.com>
1608
1609         [Simple line layout] Add support for line layout box generation with multiple text renderers.
1610         https://bugs.webkit.org/show_bug.cgi?id=185276
1611
1612         Reviewed by Antti Koivisto.
1613
1614         Covered by existing tests.
1615
1616         * rendering/SimpleLineLayoutFunctions.cpp:
1617         (WebCore::SimpleLineLayout::canUseForLineBoxTree):
1618         (WebCore::SimpleLineLayout::generateLineBoxTree):
1619         * rendering/SimpleLineLayoutResolver.cpp:
1620         (WebCore::SimpleLineLayout::RunResolver::Run::renderer const):
1621         (WebCore::SimpleLineLayout::RunResolver::Run::localStart const):
1622         (WebCore::SimpleLineLayout::RunResolver::Run::localEnd const):
1623         * rendering/SimpleLineLayoutResolver.h:
1624
1625 2018-05-04  Timothy Hatcher  <timothy@apple.com>
1626
1627         Deprecate legacy WebView and friends
1628         https://bugs.webkit.org/show_bug.cgi?id=185279
1629         rdar://problem/33268700
1630
1631         Reviewed by Tim Horton.
1632
1633         * Configurations/WebCore.xcconfig:
1634         Added BUILDING_WEBKIT define to disable the deprecation macros.
1635         * bridge/objc/WebScriptObject.h:
1636         Added deprecation macros to WebScriptObject and WebUndefined.
1637         * platform/cocoa/WebKitAvailability.h:
1638         Added more macros and a way to disable deprecation warnings for
1639         WebKit build and in clients like Safari.
1640
1641 2018-05-04  Eric Carlson  <eric.carlson@apple.com>
1642
1643         Log media time range as JSON
1644         https://bugs.webkit.org/show_bug.cgi?id=185321
1645         <rdar://problem/39986746>
1646
1647         Reviewed by Youenn Fablet.
1648
1649         No new tests, tested manually.
1650
1651         * html/HTMLMediaElement.cpp:
1652         (WebCore::HTMLMediaElement::addPlayedRange): Log as time range.
1653         (WebCore::HTMLMediaElement::visibilityStateChanged): Cleanup.
1654
1655         * platform/graphics/MediaPlayer.h:
1656         (WTF::LogArgument<MediaTime>::toString):
1657         (WTF::LogArgument<MediaTimeRange>::toString):
1658
1659         * platform/graphics/avfoundation/InbandTextTrackPrivateAVF.cpp:
1660         (WebCore::InbandTextTrackPrivateAVF::processAttributedStrings): Log error as time range.
1661
1662 2018-05-04  Zalan Bujtas  <zalan@apple.com>
1663
1664         Use the containing block to compute the pagination gap when the container is inline.
1665         https://bugs.webkit.org/show_bug.cgi?id=184724
1666         <rdar://problem/39521800>
1667
1668         Reviewed by Simon Fraser.
1669
1670         Test: fast/overflow/page-overflow-with-inline-body-crash.html
1671
1672         * page/FrameView.cpp:
1673         (WebCore::FrameView::applyPaginationToViewport):
1674
1675 2018-05-04  Tim Horton  <timothy_horton@apple.com>
1676
1677         Don't use GSFont* in minimal simulator mode
1678         https://bugs.webkit.org/show_bug.cgi?id=185320
1679         <rdar://problem/39734478>
1680
1681         Reviewed by Beth Dakin.
1682
1683         * page/cocoa/MemoryReleaseCocoa.mm:
1684         (WebCore::platformReleaseMemory):
1685
1686 2018-05-04  Chris Dumez  <cdumez@apple.com>
1687
1688         Unreviewed, rolling out r231331.
1689
1690         Caused a few tests to assert
1691
1692         Reverted changeset:
1693
1694         "Stop using an iframe's id as fallback if its name attribute
1695         is not set"
1696         https://bugs.webkit.org/show_bug.cgi?id=11388
1697         https://trac.webkit.org/changeset/231331
1698
1699 2018-05-04  Youenn Fablet  <youenn@apple.com>
1700
1701         Use more references in updateTracksOfType
1702         https://bugs.webkit.org/show_bug.cgi?id=185305
1703
1704         Reviewed by Eric Carlson.
1705
1706         No change of behavior.
1707
1708         * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.mm:
1709         (WebCore::updateTracksOfType):
1710         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::updateTracks):
1711
1712 2018-05-04  Myles C. Maxfield  <mmaxfield@apple.com>
1713
1714         Text shaping in the simple path is flipped in the y direction
1715         https://bugs.webkit.org/show_bug.cgi?id=185062
1716         <rdar://problem/39778678>
1717
1718         Reviewed by Simon Fraser.
1719
1720         Shaping in our simple codepath occurs in an "increasing-y-goes-up" coordinate system, but our painting
1721         code uses an "increasing-y-goes-down" coordinate system. We weren't fixing up the coordinate systems
1722         because we never noticed. This is because the simple codepath is only designed for kerning and ligatures,
1723         neither of which move glyphs vertically in the common case.
1724
1725         Test: fast/text/vertical-displacement-simple-codepath.html
1726
1727         * platform/graphics/Font.cpp:
1728         (WebCore::Font::applyTransforms const):
1729         * platform/graphics/WidthIterator.cpp:
1730         (WebCore::WidthIterator::applyFontTransforms):
1731
1732 2018-05-04  Chris Nardi  <cnardi@chromium.org>
1733
1734         Serialize all URLs with double-quotes per CSSOM spec
1735         https://bugs.webkit.org/show_bug.cgi?id=184935
1736
1737         Reviewed by Antti Koivisto.
1738
1739         According to https://drafts.csswg.org/cssom/#serialize-a-url, all URLs should be serialized as strings,
1740         which means they should have double quotes around the text of the URL. Update our implementation to match
1741         this (and Firefox/Chrome). Also remove isCSSTokenizerURL() as this method is no longer needed.
1742
1743         Tests: Many LayoutTests updated to use double quotes.
1744
1745         * css/CSSMarkup.cpp:
1746         (WebCore::serializeString): Remove FIXME as this was already fixed in a previous patch.
1747         (WebCore::serializeURL): Remove FIXME and update implementation.
1748
1749 2018-05-04  Youenn Fablet  <youenn@apple.com>
1750
1751         LayoutTests/fast/mediastream/change-tracks-media-stream-being-played.html is crashing after r231304
1752         https://bugs.webkit.org/show_bug.cgi?id=185303
1753
1754         Reviewed by Eric Carlson.
1755
1756         We need to stop observing the audio track like we do for video track once we are no longer interested in it.
1757         Covered by test no longer crashing.
1758
1759         * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.mm:
1760         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::updateTracks):
1761
1762 2018-05-04  Zalan Bujtas  <zalan@apple.com>
1763
1764         [LFC] Set the invalidation root as the result of style change.
1765         https://bugs.webkit.org/show_bug.cgi?id=185301
1766
1767         Reviewed by Antti Koivisto.
1768
1769         Compute/propagate the update type on the ancestor chain and return the invalidation root
1770         so that LayoutContext could use it as the entry point for the next layout frame.
1771
1772         * layout/LayoutContext.cpp:
1773         (WebCore::Layout::LayoutContext::updateLayout):
1774         (WebCore::Layout::LayoutContext::styleChanged):
1775         * layout/LayoutContext.h: order is not important.
1776         * layout/blockformatting/BlockInvalidation.cpp:
1777         (WebCore::Layout::invalidationStopsAtFormattingContextBoundary):
1778         (WebCore::Layout::computeUpdateType):
1779         (WebCore::Layout::computeUpdateTypeForAncestor):
1780         (WebCore::Layout::BlockInvalidation::invalidate):
1781         * layout/blockformatting/BlockInvalidation.h:
1782         * layout/inlineformatting/InlineInvalidation.cpp:
1783         (WebCore::Layout::InlineInvalidation::invalidate):
1784         * layout/inlineformatting/InlineInvalidation.h:
1785
1786 2018-05-04  Youenn Fablet  <youenn@apple.com>
1787
1788         PeerConnection should have its connectionState closed even if doing gathering
1789         https://bugs.webkit.org/show_bug.cgi?id=185267
1790
1791         Reviewed by Darin Adler.
1792
1793         Test: webrtc/addICECandidate-closed.html
1794
1795         In case m_iceConnectionState is closed, m_connectionState should also be set to closed
1796         and RTCPeerConnection should be closed so as to reject any other call.
1797
1798         * Modules/mediastream/RTCPeerConnection.cpp:
1799         (WebCore::RTCPeerConnection::close):
1800         (WebCore::RTCPeerConnection::updateConnectionState):
1801
1802 2018-05-04  Yacine Bandou  <yacine.bandou_ext@softathome.com>
1803
1804         [MSE][GStreamer] Delete properly the stream from the WebKitMediaSource
1805         https://bugs.webkit.org/show_bug.cgi?id=185242
1806
1807         Reviewed by Xabier Rodriguez-Calvar.
1808
1809         When the sourceBuffer is removed from mediasource, the appropriate stream is not
1810         properly deleted from WebKitMediaSource, because the appsrc and parser elements
1811         of the stream are not removed from the WebKitMediaSource bin.
1812
1813         This patch avoids the regression of r231089, see https://bugs.webkit.org/show_bug.cgi?id=185071
1814
1815         * platform/graphics/gstreamer/mse/WebKitMediaSourceGStreamer.cpp:
1816         (webKitMediaSrcFreeStream):
1817
1818 2018-05-04  Carlos Garcia Campos  <cgarcia@igalia.com>
1819
1820         [GTK] Epiphany (GNOME Web) says "Error downloading: Service Unavailable." when trying to download an image from discogs.com
1821         https://bugs.webkit.org/show_bug.cgi?id=174730
1822
1823         Reviewed by Michael Catanzaro.
1824
1825         Export ResourceRequestBase::hasHTTPHeaderField().
1826
1827         * platform/network/ResourceRequestBase.h:
1828
1829 2018-05-03  Yusuke Suzuki  <utatane.tea@gmail.com>
1830
1831         Use subprocess.call instead of os.system to handle path with spaces
1832         https://bugs.webkit.org/show_bug.cgi?id=185291
1833
1834         Reviewed by Darin Adler.
1835
1836         If gperf path includes spaces, these python scripts fail to execute gperf.
1837         We use subprocess module instead of os.system to invoke gperf.
1838
1839         * css/makeSelectorPseudoClassAndCompatibilityElementMap.py:
1840         * css/makeSelectorPseudoElementsMap.py:
1841         * platform/network/create-http-header-name-table:
1842
1843 2018-05-03  Yusuke Suzuki  <utatane.tea@gmail.com>
1844
1845         Unreviewed, attempt to fix WinCairo build failure
1846         https://bugs.webkit.org/show_bug.cgi?id=185218
1847
1848         * platform/text/win/LocaleWin.cpp:
1849         (WebCore::LocaleWin::getLocaleInfoString):
1850
1851 2018-05-03  Filip Pizlo  <fpizlo@apple.com>
1852
1853         Strings should not be allocated in a gigacage
1854         https://bugs.webkit.org/show_bug.cgi?id=185218
1855
1856         Reviewed by Saam Barati.
1857
1858         No new tests because no new behavior.
1859
1860         * Modules/indexeddb/server/IDBSerialization.cpp:
1861         (WebCore::decodeKey):
1862         * bindings/js/SerializedScriptValue.cpp:
1863         (WebCore::CloneDeserializer::readString):
1864         * html/canvas/CanvasRenderingContext2D.cpp:
1865         (WebCore::normalizeSpaces):
1866         * html/parser/HTMLTreeBuilder.cpp:
1867         (WebCore::HTMLTreeBuilder::ExternalCharacterTokenBuffer::takeRemainingWhitespace):
1868         * platform/URLParser.cpp:
1869         (WebCore::percentEncodeByte):
1870         (WebCore::serializeURLEncodedForm):
1871         (WebCore::URLParser::serialize):
1872         * platform/URLParser.h:
1873         * platform/graphics/FourCC.cpp:
1874         (WebCore::FourCC::toString const):
1875         * platform/graphics/ca/GraphicsLayerCA.cpp:
1876         (WebCore::GraphicsLayerCA::ReplicaState::cloneID const):
1877         * platform/text/LocaleICU.cpp:
1878         (WebCore::LocaleICU::decimalSymbol):
1879         (WebCore::LocaleICU::decimalTextAttribute):
1880         (WebCore::getDateFormatPattern):
1881         (WebCore::LocaleICU::createLabelVector):
1882         (WebCore::getFormatForSkeleton):
1883         * platform/win/FileSystemWin.cpp:
1884         (WebCore::FileSystem::getFinalPathName):
1885         (WebCore::FileSystem::pathByAppendingComponent):
1886         (WebCore::FileSystem::storageDirectory):
1887
1888 2018-05-02  Brent Fulgham  <bfulgham@apple.com>
1889
1890         Widgets should hold a WeakPtr to their parents
1891         https://bugs.webkit.org/show_bug.cgi?id=185239
1892         <rdar://problem/39741250>
1893
1894         Reviewed by Zalan Bujtas.
1895
1896         * platform/ScrollView.h:
1897         (WebCore::ScrollView::weakPtrFactory): Added.
1898         * platform/Widget.cpp:
1899         (WebCore::Widget::init): Don't perform an unnecessary assignment.
1900         (WebCore::Widget::setParent): Grab a WeakPtr to the parent ScrollView.
1901         * platform/Widget.h:
1902         (WebCore::Widget::parent const): Change type to a WeakPtr.
1903
1904 2018-05-03  Yusuke Suzuki  <utatane.tea@gmail.com>
1905
1906         Use pointer instead of std::optional<T&>
1907         https://bugs.webkit.org/show_bug.cgi?id=185186
1908
1909         Reviewed by Alex Christensen.
1910
1911         std::optional<T&> is not accepted in C++17 spec.
1912         In this patch, we replace it with T*, which is well-aligned to
1913         WebKit's convention.
1914
1915         * Modules/mediastream/RTCPeerConnection.cpp:
1916         (WebCore::iceServersFromConfiguration):
1917         (WebCore::RTCPeerConnection::initializeConfiguration):
1918         (WebCore::RTCPeerConnection::setConfiguration):
1919         * css/parser/CSSParser.cpp:
1920         (WebCore::CSSParser::parseSystemColor):
1921         * css/parser/CSSParser.h:
1922         * dom/DatasetDOMStringMap.cpp:
1923         (WebCore::DatasetDOMStringMap::item const):
1924         (WebCore::DatasetDOMStringMap::namedItem const):
1925         (WebCore:: const): Deleted.
1926         * dom/DatasetDOMStringMap.h:
1927         * dom/Element.cpp:
1928         (WebCore::Element::insertAdjacentHTML):
1929         * dom/Element.h:
1930         * html/canvas/CanvasStyle.cpp:
1931         (WebCore::parseColor):
1932         * inspector/DOMEditor.cpp:
1933         * platform/network/curl/CurlFormDataStream.cpp:
1934         (WebCore::CurlFormDataStream::getPostData):
1935         (): Deleted.
1936         * platform/network/curl/CurlFormDataStream.h:
1937         * platform/network/curl/CurlRequest.cpp:
1938         (WebCore::CurlRequest::setupPOST):
1939         * testing/MockCDMFactory.cpp:
1940         (WebCore::MockCDMFactory::keysForSessionWithID const):
1941         (WebCore::MockCDMInstance::updateLicense):
1942         (WebCore:: const): Deleted.
1943         * testing/MockCDMFactory.h:
1944
1945 2018-05-03  Chris Dumez  <cdumez@apple.com>
1946
1947         Stop using an iframe's id as fallback if its name attribute is not set
1948         https://bugs.webkit.org/show_bug.cgi?id=11388
1949
1950         Reviewed by Geoff Garen.
1951
1952         WebKit had logic to use an iframe's id as fallback name when its name
1953         content attribute is not set. This behavior was not standard and did not
1954         match other browsers:
1955         - https://html.spec.whatwg.org/#attr-iframe-name
1956
1957         Gecko / Trident never behaved this way. Blink was aligned with us until
1958         they started to match the specification in:
1959         - https://bugs.chromium.org/p/chromium/issues/detail?id=347169
1960
1961         This WebKit quirk was causing some Web-compatibility issues because it
1962         would affect the behavior of Window's name property getter when trying
1963         to look up an iframe by id. Because of Window's named property getter
1964         behavior [1], we would return the frame's contentWindow instead of the
1965         iframe element itself.
1966
1967         [1] https://html.spec.whatwg.org/multipage/window-object.html#named-access-on-the-window-object
1968
1969         Test: fast/dom/Window/named-getter-frame-id.html
1970
1971         * html/HTMLFrameElementBase.cpp:
1972         (WebCore::HTMLFrameElementBase::openURL):
1973         (WebCore::HTMLFrameElementBase::parseAttribute):
1974         (WebCore::HTMLFrameElementBase::didFinishInsertingNode):
1975         * html/HTMLFrameElementBase.h:
1976
1977 2018-05-03  Eric Carlson  <eric.carlson@apple.com>
1978
1979         [iOS] Internal text and audio tracks not in fullscreen menu
1980         https://bugs.webkit.org/show_bug.cgi?id=185268
1981         <rdar://problem/38673440>
1982
1983         Reviewed by Jer Noble.
1984
1985         * platform/cocoa/PlaybackSessionModelMediaElement.mm:
1986         (WebCore::PlaybackSessionModelMediaElement::setMediaElement): 'addtrack' and 'removetrack'
1987         events are fired at the track lists, not the media element.
1988
1989 2018-05-03  Ryosuke Niwa  <rniwa@webkit.org>
1990
1991         Using image map inside a shadow tree results hits a release assert in DocumentOrderedMap::add
1992         https://bugs.webkit.org/show_bug.cgi?id=185238
1993
1994         Reviewed by Antti Koivisto.
1995
1996         The bug was caused by DocumentOrderedMap for the image elements with usemap being stored in Document
1997         even if those image elements were in a shadow tree. Fixed the bug by moving the map to TreeScope.
1998
1999         Test: fast/images/imagemap-in-nested-shadow-tree.html
2000               fast/images/imagemap-in-shadow-tree.html
2001
2002         * dom/Document.cpp:
2003         (WebCore::Document::addImageElementByUsemap): Moved to TreeScope.
2004         (WebCore::Document::removeImageElementByUsemap): Ditto.
2005         (WebCore::Document::imageElementByUsemap const): Ditto.
2006         * dom/Document.h:
2007         * dom/TreeScope.cpp:
2008         (WebCore::TreeScope::destroyTreeScopeData): Clear m_imagesByUsemap as well as m_elementsByName.
2009         (WebCore::TreeScope::getImageMap const): Removed the code to parse usemap. RenderImage::imageMap()
2010         which used to call this function with the raw value of the usemap content attribute now calls it
2011         via HTMLImageElement::associatedMapElement(), which uses the parsed usemap.
2012         (WebCore::TreeScope::addImageElementByUsemap): Moved from Document.
2013         (WebCore::TreeScope::removeImageElementByUsemap): Ditto.
2014         (WebCore::TreeScope::imageElementByUsemap const): Ditto.
2015         * dom/TreeScope.h:
2016         * html/HTMLImageElement.cpp:
2017         (WebCore::HTMLImageElement::parseAttribute):
2018         (WebCore::HTMLImageElement::insertedIntoAncestor): This image element can be associated with a map element
2019         if it's connected to a document.
2020         (WebCore::HTMLImageElement::removedFromAncestor):
2021         (WebCore::HTMLImageElement::associatedMapElement const):
2022         * html/HTMLImageElement.h:
2023         * html/HTMLMapElement.cpp:
2024         (WebCore::HTMLMapElement::imageElement):
2025         * rendering/RenderImage.cpp:
2026         (WebCore::RenderImage::imageMap const):
2027
2028 2018-05-03  Justin Fan  <justin_fan@apple.com>
2029
2030         [WebGL] Add runtime flag for enabling ASTC support in WebGL
2031         https://bugs.webkit.org/show_bug.cgi?id=184840
2032
2033         Reviewed by Myles C. Maxfield.
2034
2035         Added runtime flag for ASTC support in WebGL, to turn on/off when extension is implemented.
2036
2037         * page/RuntimeEnabledFeatures.h:
2038         (WebCore::RuntimeEnabledFeatures::setWebGLCompressedTextureASTCSupportEnabled):
2039         (WebCore::RuntimeEnabledFeatures::webGLCompressedTextureASTCSupportEnabled const):
2040
2041 2018-05-03  Chris Nardi  <cnardi@chromium.org>
2042
2043         Remove [NoInterfaceObject] from DOMRectList
2044         https://bugs.webkit.org/show_bug.cgi?id=185255
2045
2046         Reviewed by Chris Dumez.
2047
2048         In https://github.com/w3c/fxtf-drafts/issues/233, [NoInterfaceObject] was removed
2049         from DOMRectList. Remove it from our implementation to match the spec, as well as
2050         Chrome and Firefox.
2051
2052         Updated web platform tests IDL test for the Geometry spec.
2053
2054         * dom/DOMRectList.idl:
2055
2056 2018-05-03  Chris Dumez  <cdumez@apple.com>
2057
2058         REGRESSION(iOS 11.3): Crashes in TimerBase::~TimerBase() in Tencent x5gamehelper
2059         https://bugs.webkit.org/show_bug.cgi?id=185073
2060         <rdar://problem/39821223>
2061
2062         Reviewed by Alexey Proskuryakov.
2063
2064         The following changes were made:
2065         - Make sure SocketStream callbacks are always scheduled on the right runloop:
2066           WebThreadRunLoop() on WebKitLegacy iOS, loaderRunLoop() on Windows and
2067           main runloop otherwise.
2068         - When the SocketStream callbacks are called, unconditionally call callOnMainThreadAndWait()
2069           before calling methods on the SocketStream client. Previously, this code path
2070           was specific to Windows but there is no reason to have platform-specific code here.
2071           callOnMainThreadAndWait() calls the function right away if we're already on the main
2072           thread, which will be the case on other platform than Windows.
2073
2074         * platform/network/cf/SocketStreamHandleImplCFNet.cpp:
2075         (WebCore::callbacksRunLoop):
2076         (WebCore::callbacksRunLoopMode):
2077         (WebCore::SocketStreamHandleImpl::scheduleStreams):
2078         (WebCore::SocketStreamHandleImpl::pacExecutionCallback):
2079         (WebCore::SocketStreamHandleImpl::executePACFileURL):
2080         (WebCore::SocketStreamHandleImpl::removePACRunLoopSource):
2081         (WebCore::SocketStreamHandleImpl::readStreamCallback):
2082         (WebCore::SocketStreamHandleImpl::writeStreamCallback):
2083         (WebCore::SocketStreamHandleImpl::platformClose):
2084
2085 2018-05-03  Zalan Bujtas  <zalan@apple.com>
2086
2087         [LFC] Enable multiple layout roots for incremental layout.
2088         https://bugs.webkit.org/show_bug.cgi?id=185185
2089
2090         Reviewed by Antti Koivisto.
2091
2092         With certain type of style changes, we can stop the box invalidation at the formatting context boundary.
2093         When multiple boxes need updating in different formatting contexts, instead of marking the parent containing block chain all
2094         the way up to a common ancestor, we could just work with a list of layout entry points per layout frame.
2095
2096         * layout/FormattingState.h:
2097         * layout/LayoutContext.cpp:
2098         (WebCore::Layout::LayoutContext::updateLayout):
2099         (WebCore::Layout::LayoutContext::addLayoutEntryPoint):
2100         * layout/LayoutContext.h:
2101
2102 2018-05-03  Zalan Bujtas  <zalan@apple.com>
2103
2104         [LFC] Box invalidation logic should go to dedicated classes.
2105         https://bugs.webkit.org/show_bug.cgi?id=185249
2106
2107         Reviewed by Antti Koivisto.
2108
2109         Each formatting context can initiate a different type of invalidation when
2110         style attribute changes in a box.
2111
2112         * Sources.txt:
2113         * WebCore.xcodeproj/project.pbxproj:
2114         * layout/FormattingState.cpp:
2115         (WebCore::Layout::FormattingState::FormattingState):
2116         * layout/FormattingState.h:
2117         (WebCore::Layout::FormattingState::isBlockFormattingState const):
2118         (WebCore::Layout::FormattingState::isInlineFormattingState const):
2119         * layout/LayoutContext.cpp:
2120         (WebCore::Layout::LayoutContext::styleChanged):
2121         (WebCore::Layout::LayoutContext::markNeedsUpdate):
2122         * layout/LayoutContext.h:
2123         * layout/blockformatting/BlockFormattingState.cpp:
2124         (WebCore::Layout::BlockFormattingState::BlockFormattingState):
2125         * layout/blockformatting/BlockFormattingState.h:
2126         * layout/blockformatting/BlockInvalidation.cpp: Copied from Source/WebCore/layout/blockformatting/BlockFormattingState.cpp.
2127         (WebCore::Layout::BlockInvalidation::invalidate):
2128         * layout/blockformatting/BlockInvalidation.h: Copied from Source/WebCore/layout/inlineformatting/InlineFormattingState.h.
2129         * layout/inlineformatting/InlineFormattingState.cpp:
2130         (WebCore::Layout::InlineFormattingState::InlineFormattingState):
2131         * layout/inlineformatting/InlineFormattingState.h:
2132         * layout/inlineformatting/InlineInvalidation.cpp: Copied from Source/WebCore/layout/inlineformatting/InlineFormattingState.cpp.
2133         (WebCore::Layout::InlineInvalidation::invalidate):
2134         * layout/inlineformatting/InlineInvalidation.h: Copied from Source/WebCore/layout/blockformatting/BlockFormattingState.h.
2135
2136 2018-05-03  Michael Catanzaro  <mcatanzaro@igalia.com>
2137
2138         WebKit should send fake macOS user agent to docs.google.com
2139         https://bugs.webkit.org/show_bug.cgi?id=185165
2140
2141         Reviewed by Carlos Garcia Campos.
2142
2143         * platform/UserAgentQuirks.cpp:
2144         (WebCore::urlRequiresMacintoshPlatform):
2145         (WebCore::urlRequiresLinuxDesktopPlatform):
2146
2147 2018-05-03  Commit Queue  <commit-queue@webkit.org>
2148
2149         Unreviewed, rolling out r231223 and r231288.
2150         https://bugs.webkit.org/show_bug.cgi?id=185256
2151
2152         The change in r231223 breaks internal builds, and r231288 is a
2153         dependent change. (Requested by ryanhaddad on #webkit).
2154
2155         Reverted changesets:
2156
2157         "Use default std::optional if it is provided"
2158         https://bugs.webkit.org/show_bug.cgi?id=185159
2159         https://trac.webkit.org/changeset/231223
2160
2161         "Use pointer instead of
2162         std::optional<std::reference_wrapper<>>"
2163         https://bugs.webkit.org/show_bug.cgi?id=185186
2164         https://trac.webkit.org/changeset/231288
2165
2166 2018-05-03  Ryan Haddad  <ryanhaddad@apple.com>
2167
2168         Unreviewed, rolling out r231253.
2169
2170         The API test added with this change is crashing on the bots.
2171
2172         Reverted changeset:
2173
2174         "Web Inspector: opt out of process swap on navigation if a Web
2175         Inspector frontend is connected"
2176         https://bugs.webkit.org/show_bug.cgi?id=184861
2177         https://trac.webkit.org/changeset/231253
2178
2179 2018-05-03  Youenn Fablet  <youenn@apple.com>
2180
2181         A MediaStream being played should allow removing some of its tracks
2182         https://bugs.webkit.org/show_bug.cgi?id=185233
2183
2184         Reviewed by Eric Carlson.
2185
2186         Update the tracks out of the for loop.
2187         Test: fast/mediastream/change-tracks-media-stream-being-played.html
2188
2189         * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.mm:
2190         (WebCore::updateTracksOfType):
2191
2192 2018-05-03  Miguel Gomez  <magomez@igalia.com>
2193
2194         WebCore::TextureMapperLayer object used after freed
2195         https://bugs.webkit.org/show_bug.cgi?id=184729
2196
2197         Reviewed by Michael Catanzaro.
2198
2199         Replace the raw pointers with WeakPtr for effectTarget, maskLayer and replicaLayer
2200         inside TextureMapperLayer.
2201
2202         * platform/graphics/texmap/TextureMapperLayer.cpp:
2203         (WebCore::TextureMapperLayer::~TextureMapperLayer):
2204         (WebCore::TextureMapperLayer::setMaskLayer):
2205         (WebCore::TextureMapperLayer::setReplicaLayer):
2206         * platform/graphics/texmap/TextureMapperLayer.h:
2207
2208 2018-05-03  Basuke Suzuki  <Basuke.Suzuki@sony.com>
2209
2210         [Curl] Add OpenSSL/LibreSSL multi-threading support
2211         https://bugs.webkit.org/show_bug.cgi?id=185138
2212
2213         The older OpenSSL manual says the locking_function and threadid_function should
2214         be set when use it in multi-threading environment. This applies to LibreSSL also.
2215         https://www.openssl.org/docs/man1.0.2/crypto/threads.html
2216
2217         For unix and other similar os, the default threadId_function implementation is
2218         good enough. We'll set custom callback only for Windows OS.
2219
2220         Note it's not required for OpenSSL 1.1.0 and after.
2221         https://www.openssl.org/blog/blog/2017/02/21/threads/
2222
2223         Reviewed by Per Arne Vollan.
2224
2225         * platform/network/curl/CurlSSLHandle.cpp:
2226         (WebCore::CurlSSLHandle::CurlSSLHandle):
2227         (WebCore::CurlSSLHandle::ThreadSupport::ThreadSupport):
2228         (WebCore::CurlSSLHandle::ThreadSupport::lockingCallback):
2229         (WebCore::CurlSSLHandle::ThreadSupport::threadIdCallback):
2230         * platform/network/curl/CurlSSLHandle.h:
2231         (WebCore::CurlSSLHandle::ThreadSupport::setup):
2232         (WebCore::CurlSSLHandle::ThreadSupport::singleton):
2233         (WebCore::CurlSSLHandle::ThreadSupport::lock):
2234         (WebCore::CurlSSLHandle::ThreadSupport::unlock):
2235
2236 2018-05-02  Ryosuke Niwa  <rniwa@webkit.org>
2237
2238         Remove superfluous check for a null attribute value check in Element::removeAttributeInternal
2239         https://bugs.webkit.org/show_bug.cgi?id=185227
2240
2241         Reviewed by Chris Dumez.
2242
2243         Removed the check. The attribute value string can never be null.
2244
2245         * dom/Element.cpp:
2246         (WebCore::Element::removeAttributeInternal):
2247
2248 2018-05-02  Zalan Bujtas  <zalan@apple.com>
2249
2250         [LFC] Implement LayoutContext::createDisplayBox
2251         https://bugs.webkit.org/show_bug.cgi?id=185158
2252
2253         Reviewed by Antti Koivisto.
2254
2255         Now compute*() functions take both the const layout and the corresponding non-const display boxes.
2256         Display boxes are owned by the LayoutContext and they don't form a tree structure (only implicitly through the layout tree).
2257         (This might need to change in the future if we decide to arrange them in some sort of painting order)
2258
2259         * layout/FloatingContext.cpp:
2260         (WebCore::Layout::FloatingContext::computePosition):
2261         * layout/FloatingContext.h:
2262         * layout/FormattingContext.cpp:
2263         (WebCore::Layout::FormattingContext::computeStaticPosition const):
2264         (WebCore::Layout::FormattingContext::computeInFlowPositionedPosition const):
2265         (WebCore::Layout::FormattingContext::computeOutOfFlowPosition const):
2266         (WebCore::Layout::FormattingContext::computeWidth const):
2267         (WebCore::Layout::FormattingContext::computeHeight const):
2268         (WebCore::Layout::FormattingContext::computeOutOfFlowWidth const):
2269         (WebCore::Layout::FormattingContext::computeFloatingWidth const):
2270         (WebCore::Layout::FormattingContext::computeOutOfFlowHeight const):
2271         (WebCore::Layout::FormattingContext::computeFloatingHeight const):
2272         * layout/FormattingContext.h:
2273         * layout/LayoutContext.cpp:
2274         (WebCore::Layout::LayoutContext::createDisplayBox):
2275         * layout/LayoutContext.h:
2276         (WebCore::Layout::LayoutContext::displayBoxForLayoutBox const):
2277         * layout/blockformatting/BlockFormattingContext.cpp:
2278         (WebCore::Layout::BlockFormattingContext::layout const):
2279         (WebCore::Layout::BlockFormattingContext::computeStaticPosition const):
2280         (WebCore::Layout::BlockFormattingContext::computeInFlowWidth const):
2281         (WebCore::Layout::BlockFormattingContext::computeInFlowHeight const):
2282         * layout/blockformatting/BlockFormattingContext.h:
2283         * layout/displaytree/DisplayBox.h:
2284         (WebCore::Display::Box::parent const): Deleted.
2285         (WebCore::Display::Box::nextSibling const): Deleted.
2286         (WebCore::Display::Box::previousSibling const): Deleted.
2287         (WebCore::Display::Box::firstChild const): Deleted.
2288         (WebCore::Display::Box::lastChild const): Deleted.
2289         (WebCore::Display::Box::setParent): Deleted.
2290         (WebCore::Display::Box::setNextSibling): Deleted.
2291         (WebCore::Display::Box::setPreviousSibling): Deleted.
2292         (WebCore::Display::Box::setFirstChild): Deleted.
2293         (WebCore::Display::Box::setLastChild): Deleted.
2294         (): Deleted.
2295         * layout/inlineformatting/InlineFormattingContext.cpp:
2296         (WebCore::Layout::InlineFormattingContext::computeInFlowWidth const):
2297         (WebCore::Layout::InlineFormattingContext::computeInFlowHeight const):
2298         * layout/inlineformatting/InlineFormattingContext.h:
2299
2300 2018-05-02  Said Abou-Hallawa  <sabouhallawa@apple.com>
2301
2302         Hiding then showing an <object> of type image makes the underlaying image disappear
2303         https://bugs.webkit.org/show_bug.cgi?id=185216
2304         <rdar://problem/39055630>
2305
2306         Reviewed by Youenn Fablet.
2307
2308         Ensure the HTMLPlugInImageElement updates the RenderImageResource of its
2309         RenderImage with the CachedImage of its ImageLoader when the RenderImage
2310         is recreated.
2311
2312         Test: fast/images/object-image-hide-show.html
2313
2314         * html/HTMLPlugInImageElement.cpp:
2315         (WebCore::HTMLPlugInImageElement::didAttachRenderers):
2316         This is very similar to what we do in HTMLImageElement::didAttachRenderers().
2317
2318
2319 2018-05-02  Brent Fulgham  <bfulgham@apple.com>
2320
2321         Use RetainPtr for form input type
2322         https://bugs.webkit.org/show_bug.cgi?id=185210
2323         <rdar://problem/39734040>
2324
2325         Reviewed by Ryosuke Niwa.
2326
2327         Refactor our HTMLInputElement class to store its InputType member as a RefPtr.
2328
2329         Test: fast/forms/access-key-mutation-2.html.
2330
2331         * html/HTMLInputElement.cpp:
2332         (WebCore::HTMLInputElement::HTMLInputElement):
2333         (WebCore::HTMLInputElement::didAddUserAgentShadowRoot):
2334         (WebCore::HTMLInputElement::accessKeyAction):
2335         (WebCore::HTMLInputElement::parseAttribute):
2336         (WebCore::HTMLInputElement::appendFormData):
2337         * html/HTMLInputElement.h:
2338         * html/InputType.cpp:
2339         (WebCore::createInputType):
2340         (WebCore::InputType::create):
2341         (WebCore::InputType::createText):
2342         * html/InputType.h:
2343
2344 2018-05-01  Yusuke Suzuki  <utatane.tea@gmail.com>
2345
2346         Use pointer instead of std::optional<std::reference_wrapper<>>
2347         https://bugs.webkit.org/show_bug.cgi?id=185186
2348
2349         Reviewed by Alex Christensen.
2350
2351         std::optional<T&> is not accepted in C++17 spec. So we replaced it
2352         with std::optional<std::reference_wrapper<T>>.
2353
2354         In this patch, we replace it with T*, which is well-aligned to
2355         WebKit's convention.
2356
2357         * Modules/mediastream/RTCPeerConnection.cpp:
2358         (WebCore::iceServersFromConfiguration):
2359         (WebCore::RTCPeerConnection::initializeConfiguration):
2360         (WebCore::RTCPeerConnection::setConfiguration):
2361         * css/parser/CSSParser.cpp:
2362         (WebCore::CSSParser::parseSystemColor):
2363         * css/parser/CSSParser.h:
2364         * dom/DatasetDOMStringMap.cpp:
2365         (WebCore::DatasetDOMStringMap::item const):
2366         (WebCore::DatasetDOMStringMap::namedItem const):
2367         * dom/DatasetDOMStringMap.h:
2368         * dom/Element.cpp:
2369         (WebCore::Element::insertAdjacentHTML):
2370         * dom/Element.h:
2371         * html/canvas/CanvasStyle.cpp:
2372         (WebCore::parseColor):
2373         * inspector/DOMEditor.cpp:
2374         * platform/network/curl/CurlFormDataStream.cpp:
2375         (WebCore::CurlFormDataStream::getPostData):
2376         * platform/network/curl/CurlFormDataStream.h:
2377         * platform/network/curl/CurlRequest.cpp:
2378         (WebCore::CurlRequest::setupPOST):
2379         * testing/MockCDMFactory.cpp:
2380         (WebCore::MockCDMFactory::keysForSessionWithID const):
2381         (WebCore::MockCDMInstance::updateLicense):
2382         * testing/MockCDMFactory.h:
2383
2384 2018-05-02  Keith Rollin  <krollin@apple.com>
2385
2386         Add facility for tracking times and results of page and resource loading
2387         https://bugs.webkit.org/show_bug.cgi?id=184838
2388         <rdar://problem/36548974>
2389
2390         Reviewed by Brent Fulgham.
2391
2392         Update FrameProgressTracker to send the necessary page load start/stop
2393         signals so that we can track the entire page load at a network level.
2394         Add an empty override of the pure virtual
2395         LoaderStrategy::pageLoadCompleted method.
2396
2397         No new tests. There is no testable effect from these changes. On
2398         Cocoa, measurable changes take place in another (non-WebKit) process.
2399         On non-Cocoa systems, this facility is currently disabled.
2400
2401         * loader/FrameLoader.cpp:
2402         (WebCore::FrameLoader::FrameProgressTracker::progressCompleted):
2403         * loader/LoaderStrategy.h:
2404
2405 2018-05-02  Aditya Keerthi  <akeerthi@apple.com>
2406
2407         Can't copy and paste URLs that have no title into Mail (macOS)
2408         https://bugs.webkit.org/show_bug.cgi?id=185205
2409         <rdar://problem/36352406>
2410
2411         Reviewed by Tim Horton.
2412
2413         The pasteboardURL generated has an empty title for URLs without titles. Currently, the pasteboardURL.title is being saved to the pasteboard.
2414
2415         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.
2416
2417         Augmented WebKitLegacy.ContextMenuCanCopyURL test
2418
2419         * platform/mac/PasteboardMac.mm:
2420         (WebCore::writeURLForTypes):
2421
2422 2018-05-01  Ryosuke Niwa  <rniwa@webkit.org>
2423
2424         REGRESSION(r225868): Release assert when removing an SVGUseElement from Document::m_svgUseElements
2425         https://bugs.webkit.org/show_bug.cgi?id=182188
2426         <rdar://problem/36689240>
2427
2428         Reviewed by Antti Koivisto.
2429
2430         Fixed the crash by removing up the release assert.
2431
2432         The crash is likely caused by re-entrancy to Document::resolveStyle during SVGUseElement::updateShadowTree.
2433         Because Document::resolveStyle invokes updateShadowTree on SVG use elements in Document::m_svgUseElements
2434         without clearing the map, the nested call to resolveStyle ends up calling updateShadowTree() for all elements
2435         in m_svgUseElements and removing them all from the map. When the stack frame eventually comes back to the outer
2436         invocation of Document::resolveStyle, updateShadowTree gets invoked for the second time on SVG use elements
2437         whose shadow tree had already been updated within the inner invocation to updateShadowTree, and release-asserts.
2438
2439         There is an alternative fix: avoid calling updateShadowTree on a svg element when shadowTreeNeedsUpdate returns
2440         true on the element in resolveStyle. However, removing the release assert is a sure way to fix the crash so
2441         this patch opts for that fix instead especially since we don't have any reproducible test case for this crash.
2442
2443         This release assertion was added in r225868 as a cautious measure to catch any use-after-frees of SVGUseElement's
2444         since m_svgUseElements stored raw pointes to SVG use elements but this crash is not an indicative of any UAF,
2445         and there is no evidence that r225868 has led to new UAFs even after five months.
2446
2447         No new tests. I couldn't find a way to trigger a nested style update inside SVGUseElement::updateShadowTree.
2448
2449         * dom/Document.cpp:
2450         (WebCore::Document::removeSVGUseElement):
2451
2452 2018-05-02  Dirk Schulze  <dschulze@chromium.org>
2453
2454         getCharNumAtPosition should take DOMPointInit as argument
2455         https://bugs.webkit.org/show_bug.cgi?id=184695
2456
2457         Reviewed by Antti Koivisto.
2458
2459         Extend existing tests for getCharNumAtPosition.
2460
2461         * svg/SVGTextContentElement.cpp:
2462         (WebCore::SVGTextContentElement::getCharNumAtPosition):
2463         * svg/SVGTextContentElement.h:
2464         * svg/SVGTextContentElement.idl: Use DOMPointInit argument.
2465
2466 2018-05-02  Youenn Fablet  <youenn@apple.com>
2467
2468         Use NetworkLoadChecker for navigation loads
2469         https://bugs.webkit.org/show_bug.cgi?id=184892
2470         <rdar://problem/39652686>
2471
2472         Reviewed by Chris Dumez.
2473
2474         Sanitize headers according response tainting.
2475         If tainting is basic, it means same origin load in which case we only filter Cookie related headers.
2476         If tainting is Opaque, we filter all uncommon headers.
2477         If tainting is CORS, we filter all uncommon headers except the one explicitely allowed by CORS headers.
2478         Covered by updated test.
2479
2480         * platform/network/ResourceResponseBase.cpp:
2481         (WebCore::ResourceResponseBase::sanitizeHTTPHeaderFieldsAccordingToTainting):
2482         (WebCore::ResourceResponseBase::sanitizeHTTPHeaderFields):
2483         * platform/network/ResourceResponseBase.h:
2484
2485 2018-05-02  Myles C. Maxfield  <mmaxfield@apple.com>
2486
2487         Collection fragment identifiers don't use PostScript names
2488         https://bugs.webkit.org/show_bug.cgi?id=184624
2489         <rdar://problem/39432089>
2490
2491         Reviewed by Simon Fraser.
2492
2493         In a previous version of the CSS Fonts spec, there was text saying that items in font collections
2494         should be 1-indexed (so the first item would be MyFonts.ttc#1). However, this is unfortunate because
2495         inserting an item into the middle of a collection would throw off all content that uses the file.
2496         Instead, the spec has since changed to use PostScript names (so the content instead would say
2497         MyFonts.ttc#MyFont-Regular).
2498
2499         Test: fast/text/font-collection.html
2500
2501         * css/CSSFontFaceSource.cpp:
2502         (WebCore::CSSFontFaceSource::load):
2503         * loader/cache/CachedFont.cpp:
2504         (WebCore::CachedFont::calculateItemInCollection const):
2505         (WebCore::CachedFont::ensureCustomFontData):
2506         (WebCore::CachedFont::createCustomFontData):
2507         (WebCore::CachedFont::calculateIndex const): Deleted.
2508         * loader/cache/CachedFont.h:
2509         * platform/graphics/mac/FontCustomPlatformData.cpp:
2510         (WebCore::createFontCustomPlatformData):
2511         * platform/graphics/mac/FontCustomPlatformData.h:
2512
2513 2018-05-02  Brian Burg  <bburg@apple.com>
2514
2515         Web Inspector: opt out of process swap on navigation if a Web Inspector frontend is connected
2516         https://bugs.webkit.org/show_bug.cgi?id=184861
2517         <rdar://problem/39153768>
2518
2519         Reviewed by Ryosuke Niwa.
2520
2521         Notify the client of the current connection count whenever a frontend connects or disconnects.
2522
2523         Covered by new API test.
2524
2525         * inspector/InspectorClient.h:
2526         (WebCore::InspectorClient::frontendCountChanged):
2527         * inspector/InspectorController.cpp:
2528         (WebCore::InspectorController::connectFrontend):
2529         (WebCore::InspectorController::disconnectFrontend):
2530         (WebCore::InspectorController::disconnectAllFrontends):
2531         * inspector/InspectorController.h:
2532
2533 2018-05-02  Carlos Alberto Lopez Perez  <clopez@igalia.com>
2534
2535         [GStreamer] Remove unneeded include of gstgldisplay_wayland.h after r228866 and r229022
2536         https://bugs.webkit.org/show_bug.cgi?id=185207
2537
2538         Reviewed by Michael Catanzaro.
2539
2540         Remove unneeded include of gstgldisplay_wayland.h
2541
2542         No new tests, no change in behaviour.
2543
2544         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp:
2545
2546 2018-05-02  Chris Dumez  <cdumez@apple.com>
2547
2548         document.open() event listener removal is not immediate
2549         https://bugs.webkit.org/show_bug.cgi?id=185191
2550
2551         Reviewed by Darin Adler.
2552
2553         We need to make sure we set the 'wasremoved' flag on RegisteredEventListeners
2554         whenever they get removed from the EventListenerMap. We were doing so correctly
2555         in EventListenerMap:remove() but not EventListenerMap::clear(). This patch
2556         updates clear() accordingly.
2557
2558         The reason we need to set this flag is that RegisteredEventListeners is RefCounted
2559         and EventTarget::fireEventListeners() may be currently running and calling
2560         each listener one by one, holding a reference to all listener of a given event.
2561
2562         Test: fast/dom/Document/document-open-removes-all-listeners.html
2563
2564         * dom/EventListenerMap.cpp:
2565         (WebCore::EventListenerMap::clear):
2566
2567 2018-05-02  Zalan Bujtas <zalan@apple.com>
2568
2569         Use WeakPtr in GridCell
2570         https://bugs.webkit.org/show_bug.cgi?id=185180
2571         <rdar://problem/39432165>
2572
2573         Reviewed by Antti Koivisto.
2574
2575         Since GridCell does not own the renderers, it should
2576         construct weak pointers.
2577
2578         Unable to create a reliably reproducible test case.
2579
2580         * rendering/Grid.cpp:
2581         (WebCore::Grid::insert):
2582         (WebCore::GridIterator::nextGridItem):
2583         * rendering/Grid.h:
2584         * rendering/RenderGrid.cpp:
2585         (WebCore::RenderGrid::firstLineBaseline const):
2586
2587 2018-05-02  Eric Carlson  <eric.carlson@apple.com>
2588
2589         [iOS] Provide audio route information when invoking AirPlay picker
2590         https://bugs.webkit.org/show_bug.cgi?id=185199
2591         <rdar://problem/39853103>
2592
2593         Reviewed by Jer Noble.
2594
2595         No new tests, this requires a specific hardware setup.
2596
2597         * dom/Document.cpp:
2598         (WebCore::Document::showPlaybackTargetPicker): Pass route sharing policy and routing context UID.
2599         * dom/Document.h:
2600
2601         * html/MediaElementSession.cpp:
2602         (WebCore::MediaElementSession::showPlaybackTargetPicker): Ditto.
2603
2604         * loader/EmptyClients.h:
2605         * page/ChromeClient.h:
2606
2607         * page/Page.cpp:
2608         (WebCore::Page::showPlaybackTargetPicker): Ditto.
2609         * page/Page.h:
2610
2611         * platform/audio/AudioSession.cpp:
2612         (WebCore::AudioSession::routeSharingPolicy const): Empty implementation for non-iOS ports.
2613         (WebCore::routingContextUID const): Ditto.
2614         * platform/audio/AudioSession.h:
2615
2616         * platform/audio/ios/AudioSessionIOS.mm:
2617         (WebCore::AudioSession::routeSharingPolicy const): Return the route sharing policy.
2618         (WebCore::AudioSession::routingContextUID const): Return the route context UID.
2619
2620 2018-05-02  Dean Jackson  <dino@apple.com>
2621
2622         Draw SystemPreview badge to specification on iOS
2623         https://bugs.webkit.org/show_bug.cgi?id=185203
2624         <rdar://problem/39908855>
2625
2626         Reviewed by Tim Horton.
2627
2628         Use CoreImage to render a badge with a blurred background,
2629         at particular sizes.
2630
2631         This will be tested internally while we're getting artwork
2632         from WebKitAdditions.
2633
2634         * Configurations/WebCore.xcconfig: Link against CoreImage.
2635         * rendering/RenderThemeIOS.h:
2636         * rendering/RenderThemeIOS.mm:
2637         (WebCore::RenderThemeIOS::paintSystemPreviewBadge): New function
2638         in the iOS platform RenderTheme that draws the system preview.
2639
2640 2018-05-01  Brent Fulgham  <bfulgham@apple.com>
2641
2642         Prevent Debug ASSERT when changing forms
2643         https://bugs.webkit.org/show_bug.cgi?id=185173
2644         <rdar://problem/39738669>
2645
2646         Reviewed by Ryosuke Niwa.
2647
2648         Form submission could trigger a debug assertion during validation when
2649         a form is changed during an input submission. Fix this by cleaning up
2650         the event handling logic and make it more consistent with modern WebKit
2651         coding style.
2652
2653         Test: fast/forms/form-submission-crash-3.html
2654
2655         * html/HTMLButtonElement.cpp:
2656         (WebCore::HTMLButtonElement::defaultEventHandler): Make sure layout runs before
2657         attempting to perform event handling.
2658         * html/HTMLFormElement.cpp:
2659         (WebCore::HTMLFormElement::reportValidity): Ditto.
2660         (WebCore::HTMLFormElement::validateInteractively): Remove call to perform layout here,
2661         since we expect this to happen earlier in the layout pass. Add an assertion that the
2662         tree is not dirty.
2663         * html/ImageInputType.cpp:
2664         (WebCore::ImageInputType::handleDOMActivateEvent): Make sure layout runs before
2665         attempting to perform event handling.
2666         * html/SubmitInputType.cpp:
2667         (WebCore::SubmitInputType::handleDOMActivateEvent): Ditto.
2668
2669 2018-05-02  Jer Noble  <jer.noble@apple.com>
2670
2671         Unreviewed; address review comments made before landing r231231.
2672
2673         * platform/ios/WebVideoFullscreenControllerAVKit.mm:
2674         (VideoFullscreenControllerContext::volume const):
2675
2676 2018-05-02  Jer Noble  <jer.noble@apple.com>
2677
2678         Pipe volume through PlaybackSessionManager/Proxy.
2679         https://bugs.webkit.org/show_bug.cgi?id=185182
2680
2681         Reviewed by Eric Carlson.
2682
2683         Add support for the volume property to PlaybackSessionModel, and all its clients.
2684
2685         * platform/cocoa/PlaybackSessionModel.h:
2686         (WebCore::PlaybackSessionModelClient::volumeChanged):
2687         * platform/cocoa/PlaybackSessionModelMediaElement.h:
2688         * platform/cocoa/PlaybackSessionModelMediaElement.mm:
2689         (WebCore::PlaybackSessionModelMediaElement::updateForEventName):
2690         (WebCore::PlaybackSessionModelMediaElement::setVolume):
2691         (WebCore::PlaybackSessionModelMediaElement::volume const):
2692         * platform/ios/PlaybackSessionInterfaceAVKit.h:
2693         * platform/ios/PlaybackSessionInterfaceAVKit.mm:
2694         (WebCore::PlaybackSessionInterfaceAVKit::volumeChanged):
2695         * platform/ios/WebAVPlayerController.h:
2696         * platform/ios/WebAVPlayerController.mm:
2697         (-[WebAVPlayerController volume]):
2698         (-[WebAVPlayerController setVolume:]):
2699         (-[WebAVPlayerController volumeChanged:]):
2700         (-[WebAVPlayerController resetMediaState]):
2701         * platform/ios/WebVideoFullscreenControllerAVKit.mm:
2702         (VideoFullscreenControllerContext::volumeChanged):
2703         (VideoFullscreenControllerContext::volume const):
2704         (VideoFullscreenControllerContext::setVolume):
2705
2706 2018-05-01  Yusuke Suzuki  <utatane.tea@gmail.com>
2707
2708         Unreviewed, fix build in WinCairo
2709         https://bugs.webkit.org/show_bug.cgi?id=185169
2710
2711         * bindings/js/JSDOMWindowBase.cpp:
2712         (WebCore::JSDOMWindowBase::instantiateStreaming):
2713         * bindings/js/JSDOMWindowBase.h:
2714
2715 2018-05-01  Yusuke Suzuki  <utatane.tea@gmail.com>
2716
2717         Use default std::optional if it is provided
2718         https://bugs.webkit.org/show_bug.cgi?id=185159
2719
2720         Reviewed by JF Bastien.
2721
2722         * Modules/mediastream/RTCPeerConnection.cpp:
2723         (WebCore::iceServersFromConfiguration):
2724         (WebCore::RTCPeerConnection::setConfiguration):
2725         * css/parser/CSSParser.cpp:
2726         (WebCore::CSSParser::parseSystemColor):
2727         * css/parser/CSSParser.h:
2728         * dom/DatasetDOMStringMap.cpp:
2729         (WebCore::DatasetDOMStringMap::item const):
2730         (WebCore::DatasetDOMStringMap::namedItem const):
2731         (WebCore:: const): Deleted.
2732         * dom/DatasetDOMStringMap.h:
2733         * dom/Element.cpp:
2734         (WebCore::Element::insertAdjacentHTML):
2735         * dom/Element.h:
2736         * inspector/DOMEditor.cpp:
2737         * platform/network/curl/CurlFormDataStream.cpp:
2738         (WebCore::CurlFormDataStream::getPostData):
2739         (): Deleted.
2740         * platform/network/curl/CurlFormDataStream.h:
2741         * testing/MockCDMFactory.cpp:
2742         (WebCore::MockCDMFactory::keysForSessionWithID const):
2743         (WebCore::MockCDMInstance::updateLicense):
2744         (WebCore:: const): Deleted.
2745         * testing/MockCDMFactory.h:
2746
2747 2018-05-01  Chris Dumez  <cdumez@apple.com>
2748
2749         Add release assertions in CFNetwork's SocketStreamHandleImpl to help debug a threading issue
2750         https://bugs.webkit.org/show_bug.cgi?id=185181
2751
2752         Reviewed by Geoffrey Garen.
2753
2754         Add release assertions in CFNetwork's SocketStreamHandleImpl to help debug a threading issue
2755         on iOS WebKitLegacy (Bug 185073). It appears readStreamCallback() can get called on the UIThread,
2756         which should not be possible if scheduleStreams() was called on the WebThread, as it is supposed
2757         to. The new release assertion in scheduleStreams() should tell us if somebody is calling it from
2758         the UIthread instead of the WebThread on iOS WebKitLegacy.
2759
2760         * platform/network/cf/SocketStreamHandleImplCFNet.cpp:
2761         (WebCore::SocketStreamHandleImpl::scheduleStreams):
2762         (WebCore::SocketStreamHandleImpl::readStreamCallback):
2763
2764 2018-05-01  Wenson Hsieh  <wenson_hsieh@apple.com>
2765
2766         Unreviewed, remove an unused variable in RuntimeEnabledFeatures.h
2767
2768         * page/RuntimeEnabledFeatures.h:
2769
2770 2018-05-01  Oleksandr Skachkov  <gskachkov@gmail.com>
2771
2772         Fix build error after r231194
2773         https://bugs.webkit.org/show_bug.cgi?id=185169
2774
2775         Reviewed by JF Bastien.
2776
2777         Prevent compile error in iOS Simulator debug build
2778         by tagging function
2779
2780         * bindings/js/JSDOMWindowBase.cpp:
2781         (WebCore::JSDOMWindowBase::compileStreaming):
2782         (WebCore::JSDOMWindowBase::instantiateStreaming):
2783
2784 2018-05-01  Oleksandr Skachkov  <gskachkov@gmail.com>
2785
2786         WebAssembly: add support for stream APIs - JavaScript API
2787         https://bugs.webkit.org/show_bug.cgi?id=183442
2788
2789         Reviewed by Yusuke Suzuki and JF Bastien.
2790
2791         Add WebAssembly streaming API to WebCore.
2792
2793         * Configurations/FeatureDefines.xcconfig:
2794         * bindings/js/JSDOMWindowBase.cpp:
2795         (WebCore::tryAllocate):
2796         (WebCore::isResponseCorrect):
2797         (WebCore::handleResponseOnStreamingAction):
2798         (WebCore::JSDOMWindowBase::compileStreaming):
2799         (WebCore::JSDOMWindowBase::instantiateStreaming):
2800         * bindings/js/JSDOMWindowBase.h:
2801         * bindings/js/JSRemoteDOMWindowBase.cpp:
2802         * bindings/js/JSWorkerGlobalScopeBase.cpp:
2803
2804 2018-04-30  Myles C. Maxfield  <mmaxfield@apple.com>
2805
2806         Improve the performance of FontCascadeDescription's effectiveFamilies
2807         https://bugs.webkit.org/show_bug.cgi?id=184720
2808         <rdar://problem/38970927>
2809
2810         Reviewed by Simon Fraser.
2811
2812         The page that had the performance problem renders many different Chinese characters in system-ui
2813         with only a small number of individual fonts. It turns out we were calling into the system-ui
2814         machinery for each character in order to opportunistically start loading data URLs (see also:
2815         https://bugs.webkit.org/show_bug.cgi?id=175845). These data URLS will never represent the system
2816         font, so we don't need to invoke the system-ui machinery at all.
2817
2818         This patch makes a 92x performance improvement on the associated performance test. This test is
2819         designed to test Chinese text rendered with system-ui.
2820
2821         Performance test: Layout/system-ui.html
2822
2823         * platform/graphics/FontCascadeFonts.cpp:
2824         (WebCore::opportunisticallyStartFontDataURLLoading):
2825
2826 2018-04-30  Jer Noble  <jer.noble@apple.com>
2827
2828         <img src=mp4> does not display on ios despite Accept: video/* advertisement
2829         https://bugs.webkit.org/show_bug.cgi?id=185029
2830         <rdar://problem/39771989>
2831
2832         Reviewed by Eric Carlson.
2833
2834         Returning "NO" from resourceLoader:shouldWaitForLoadingOfResource: signals that the load failed,
2835         even if the resource request is successfully fulfilled prior to the return. Always return YES in
2836         the case that loading succeeded.
2837
2838         * platform/graphics/avfoundation/objc/ImageDecoderAVFObjC.mm:
2839         (-[WebCoreSharedBufferResourceLoaderDelegate resourceLoader:shouldWaitForLoadingOfRequestedResource:]):
2840
2841 2018-04-30  Zalan Bujtas  <zalan@apple.com>
2842
2843         REGRESSION(r230914) Selecting text on this apple.com page makes it vanish
2844         https://bugs.webkit.org/show_bug.cgi?id=185142
2845         <rdar://problem/39821446>
2846
2847         Reviewed by Simon Fraser.
2848
2849         Set the overflow rect on the inline textbox when needed.
2850
2851         Test: fast/text/simple-line-layout-selection-with-overflow.html
2852
2853         * rendering/SimpleLineLayoutFunctions.cpp:
2854         (WebCore::SimpleLineLayout::initializeInlineTextBox):
2855         (WebCore::SimpleLineLayout::generateLineBoxTree):
2856         (WebCore::SimpleLineLayout::initializeInlineBox): Deleted.
2857
2858 2018-04-30  JF Bastien  <jfbastien@apple.com>
2859
2860         Use some C++17 features
2861         https://bugs.webkit.org/show_bug.cgi?id=185135
2862
2863         Reviewed by Alex Christensen.
2864
2865         As discussed here [0] let's move WebKit to a subset of C++17. We
2866         now require GCC 6 [1] which means that, according to [2] we can
2867         use the following C++17 language features (I removed some
2868         uninteresting ones):
2869
2870          - New auto rules for direct-list-initialization
2871          - static_assert with no message
2872          - typename in a template template parameter
2873          - Nested namespace definition
2874          - Attributes for namespaces and enumerators
2875          - u8 character literals
2876          - Allow constant evaluation for all non-type template arguments
2877          - Fold Expressions
2878          - Unary fold expressions and empty parameter packs
2879          - __has_include in preprocessor conditional
2880          - Differing begin and end types in range-based for
2881          - Improving std::pair and std::tuple
2882
2883         Consult the Tony Tables [3] to see before / after examples.
2884
2885         Of course we can use any library feature if we're willing to
2886         import them to WTF (and they don't require language support).
2887
2888
2889           [0]: https://lists.webkit.org/pipermail/webkit-dev/2018-March/029922.html
2890           [1]: https://trac.webkit.org/changeset/231152/webkit
2891           [2]: https://en.cppreference.com/w/cpp/compiler_support
2892           [3]: https://github.com/tvaneerd/cpp17_in_TTs/blob/master/ALL_IN_ONE.md
2893
2894         * DerivedSources.make:
2895         * platform/URLParser.cpp: work around an odd GCC 6 bug with class
2896           static value as a template parameter.
2897         (WebCore::URLParser::percentDecode):
2898         (WebCore::URLParser::domainToASCII):
2899         (WebCore::URLParser::hasForbiddenHostCodePoint):
2900         (WebCore::URLParser::parseHostAndPort):
2901         * platform/URLParser.h:
2902
2903 2018-04-30  Wenson Hsieh  <wenson_hsieh@apple.com>
2904
2905         [Extra zoom mode] Respect the existing shrink-to-fit attribute instead of using min-device-width
2906         https://bugs.webkit.org/show_bug.cgi?id=185132
2907         <rdar://problem/39834562>
2908
2909         Reviewed by Tim Horton.
2910
2911         Removes the `min-device-width` attribute added in r231095. Instead, we key this behavior off of the
2912         `shrink-to-fit` attribute introduced for multitasking on iPad, such that `shrink-to-fit=no` achieves the same
2913         behavior as `min-device-width=0` in extra zoom mode. See comments below for more detail.
2914
2915         Adjusted an existing layout test: fast/viewport/extrazoom/viewport-change-min-device-width.html.
2916
2917         * dom/ViewportArguments.cpp:
2918         (WebCore::setViewportFeature):
2919         (WebCore::operator<<):
2920         * dom/ViewportArguments.h:
2921
2922         Removes the `minDeviceWidth` viewport argument.
2923
2924         * page/RuntimeEnabledFeatures.h:
2925         (WebCore::RuntimeEnabledFeatures::setMinDeviceWidthEnabled): Deleted.
2926         (WebCore::RuntimeEnabledFeatures::minDeviceWidthEnabled const): Deleted.
2927
2928         Removes the runtime switch for `min-device-width`.
2929
2930         * page/ViewportConfiguration.cpp:
2931         (WebCore::platformDeviceWidthOverride):
2932
2933         Hard-code the override device width in extra zoom mode.
2934
2935         (WebCore::ViewportConfiguration::shouldOverrideDeviceWidthAndShrinkToFit const):
2936
2937         In extra zoom mode, override the device width only if shrink-to-fit has not been expliticly disabled, and the
2938         device width is less than the override device width.
2939
2940         (WebCore::ViewportConfiguration::shouldIgnoreHorizontalScalingConstraints const):
2941         (WebCore::ViewportConfiguration::shouldIgnoreScalingConstraintsRegardlessOfContentSize const):
2942         (WebCore::ViewportConfiguration::updateConfiguration):
2943         (WebCore::ViewportConfiguration::updateMinimumLayoutSize):
2944
2945         Do not override the minimum layout size if `shrink-to-fit` has been explicitly explicitly disabled, or if the
2946         device width is greater than the override device width.
2947
2948         (WebCore::computedMinDeviceWidth): Deleted.
2949         (WebCore::ViewportConfiguration::shouldOverrideDeviceWidthWithMinDeviceWidth const): Deleted.
2950         * page/ViewportConfiguration.h:
2951
2952 2018-04-30  Chris Nardi  <cnardi@chromium.org>
2953
2954         Serialize font-variation-settings with double-quotes per spec
2955         https://bugs.webkit.org/show_bug.cgi?id=182542
2956
2957         Reviewed by Myles C. Maxfield.
2958
2959         According to the CSSOM spec [1], all strings should be serialized with double-quotes.
2960         The axis name in font-variation-settings was previously serialized with single-quotes;
2961         change this to double-quotes to match the spec and non-WebKit browsers.
2962
2963         [1]: https://drafts.csswg.org/cssom/#common-serializing-idioms
2964
2965         Updated fast/text/variations/getComputedStyle.html to test the change.
2966
2967         * css/CSSFontVariationValue.cpp:
2968         (WebCore::CSSFontVariationValue::customCSSText const):
2969
2970 2018-04-30  Chris Dumez  <cdumez@apple.com>
2971
2972         Fix bad use of RunLoop::main().dispatch() in MessagePort::dispatchMessages()
2973         https://bugs.webkit.org/show_bug.cgi?id=185134
2974
2975         Reviewed by Geoffrey Garen.
2976
2977         Fix bad use of RunLoop::main().dispatch() in MessagePort::dispatchMessages(). This code runs on iOS WebKitLegacy
2978         and it is therefore unsafe to use RunLoop::main() here. We want to use callOnMainThread() instead to run code on
2979         the WebThread.
2980
2981         * dom/MessagePort.cpp:
2982         (WebCore::MessagePort::dispatchMessages):
2983
2984 2018-04-30  Simon Fraser  <simon.fraser@apple.com>
2985
2986         Make color-filter affect caret-color
2987         https://bugs.webkit.org/show_bug.cgi?id=185129
2988         rdar://problem/39829066
2989
2990         Reviewed by Tim Horton.
2991         
2992         Transform the colors used to compare the caret color with the background through
2993         color-filter (since we want contrasting colors after filters are applied), and
2994         transform caret-color itself.
2995
2996         Test: css3/color-filters/color-filter-caret-color.html
2997
2998         * editing/FrameSelection.cpp:
2999         (WebCore::CaretBase::paintCaret const):
3000
3001 2018-04-30  Michael Catanzaro  <mcatanzaro@igalia.com>
3002
3003         [GTK] Webkit should spoof as Safari on a Mac when on Chase.com
3004         https://bugs.webkit.org/show_bug.cgi?id=185103
3005
3006         Reviewed by Carlos Garcia Campos.
3007
3008         Send a fake user agent to chase.com to make it work.
3009
3010         * platform/UserAgentQuirks.cpp:
3011         (WebCore::urlRequiresMacintoshPlatform):
3012         (WebCore::UserAgentQuirks::stringForQuirk): Also, remove this stale comment.
3013
3014 2018-04-29  Simon Fraser  <simon.fraser@apple.com>
3015
3016         Make color-filter affect <attachment>
3017         https://bugs.webkit.org/show_bug.cgi?id=185122
3018         rdar://problem/39818763
3019
3020         Reviewed by Tim Horton.
3021         
3022         Convert the colors used to render <attachment> through color-filter, except
3023         for those parts that render over the icon (like the progress bar).
3024
3025         Not easily testable.
3026
3027         * rendering/RenderThemeMac.mm:
3028         (WebCore::titleTextColorForAttachment):
3029         (WebCore::AttachmentLayout::layOutTitle):
3030         (WebCore::AttachmentLayout::layOutSubtitle):
3031         (WebCore::paintAttachmentIconBackground):
3032         (WebCore::paintAttachmentTitleBackground):
3033         (WebCore::paintAttachmentPlaceholderBorder):
3034
3035 2018-04-28  Simon Fraser  <simon.fraser@apple.com>
3036
3037         Fix color-filter to apply to SVG colors
3038         https://bugs.webkit.org/show_bug.cgi?id=185113
3039         rdar://problem/39665082
3040
3041         Reviewed by Dean Jackson.
3042         
3043         Convert SVG colors through color-filter operations for the places in SVG
3044         that use color, namely fill and stroke, gradients, lighting colors and
3045         drop-shadow.
3046
3047         Test: css3/color-filters/svg/color-filter-inline-svg.html
3048
3049         * rendering/svg/RenderSVGResourceGradient.cpp:
3050         (WebCore::RenderSVGResourceGradient::applyResource):
3051         * rendering/svg/RenderSVGResourceGradient.h:
3052         * rendering/svg/RenderSVGResourceLinearGradient.cpp:
3053         (WebCore::RenderSVGResourceLinearGradient::buildGradient const):
3054         * rendering/svg/RenderSVGResourceLinearGradient.h:
3055         * rendering/svg/RenderSVGResourceRadialGradient.cpp:
3056         (WebCore::RenderSVGResourceRadialGradient::buildGradient const):
3057         * rendering/svg/RenderSVGResourceRadialGradient.h:
3058         * rendering/svg/RenderSVGResourceSolidColor.cpp:
3059         (WebCore::RenderSVGResourceSolidColor::applyResource):
3060         * svg/SVGFEDiffuseLightingElement.cpp:
3061         (WebCore::SVGFEDiffuseLightingElement::setFilterEffectAttribute):
3062         (WebCore::SVGFEDiffuseLightingElement::build):
3063         * svg/SVGFEDropShadowElement.cpp:
3064         (WebCore::SVGFEDropShadowElement::build):
3065         * svg/SVGFEFloodElement.cpp:
3066         (WebCore::SVGFEFloodElement::build):
3067         * svg/SVGFESpecularLightingElement.cpp:
3068         (WebCore::SVGFESpecularLightingElement::setFilterEffectAttribute):
3069         (WebCore::SVGFESpecularLightingElement::build):
3070
3071 2018-04-29  Michael Catanzaro  <mcatanzaro@igalia.com>
3072
3073         [CMake] Require GCC 6
3074         https://bugs.webkit.org/show_bug.cgi?id=184985
3075
3076         Reviewed by Alex Christensen.
3077
3078         Remove a GCC 5 fallback path. This seems to be the only such fallback path in WebKit.
3079
3080         * platform/graphics/FourCC.h:
3081         (WebCore::FourCC::FourCC):
3082
3083 2018-04-29  Zalan Bujtas  <zalan@apple.com>
3084
3085         [LFC] Implement Display::Box functions
3086         https://bugs.webkit.org/show_bug.cgi?id=185116
3087
3088         Reviewed by Antti Koivisto.
3089
3090         * layout/displaytree/DisplayBox.cpp:
3091         (WebCore::Display::Box::Box):
3092         (WebCore::Display::Box::~Box):
3093         (WebCore::Display::Box::marginBox const):
3094         (WebCore::Display::Box::borderBox const):
3095         (WebCore::Display::Box::paddingBox const):
3096         (WebCore::Display::Box::contentBox const):
3097         * layout/displaytree/DisplayBox.h:
3098         (WebCore::Display::Box::rect const):
3099         (WebCore::Display::Box::top const):
3100         (WebCore::Display::Box::left const):
3101         (WebCore::Display::Box::bottom const):
3102         (WebCore::Display::Box::right const):
3103         (WebCore::Display::Box::topLeft const):
3104         (WebCore::Display::Box::bottomRight const):
3105         (WebCore::Display::Box::size const):
3106         (WebCore::Display::Box::width const):
3107         (WebCore::Display::Box::height const):
3108         (WebCore::Display::Box::marginTop const):
3109         (WebCore::Display::Box::marginLeft const):
3110         (WebCore::Display::Box::marginBottom const):
3111         (WebCore::Display::Box::marginRight const):
3112         (WebCore::Display::Box::parent const):
3113         (WebCore::Display::Box::nextSibling const):
3114         (WebCore::Display::Box::previousSibling const):
3115         (WebCore::Display::Box::firstChild const):
3116         (WebCore::Display::Box::lastChild const):
3117         (WebCore::Display::Box::setRect):
3118         (WebCore::Display::Box::setTopLeft):
3119         (WebCore::Display::Box::setTop):
3120         (WebCore::Display::Box::setLeft):
3121         (WebCore::Display::Box::setSize):
3122         (WebCore::Display::Box::setWidth):
3123         (WebCore::Display::Box::setHeight):
3124         (WebCore::Display::Box::setMarginTop):
3125         (WebCore::Display::Box::setMarginLeft):
3126         (WebCore::Display::Box::setMarginBottom):
3127         (WebCore::Display::Box::setMarginRight):
3128         (WebCore::Display::Box::setBorderTop):
3129         (WebCore::Display::Box::setBorderLeft):
3130         (WebCore::Display::Box::setBorderBottom):
3131         (WebCore::Display::Box::setBorderRight):
3132         (WebCore::Display::Box::setPaddingTop):
3133         (WebCore::Display::Box::setPaddingLeft):
3134         (WebCore::Display::Box::setPaddingBottom):
3135         (WebCore::Display::Box::setPaddingRight):
3136         (WebCore::Display::Box::setParent):
3137         (WebCore::Display::Box::setNextSibling):
3138         (WebCore::Display::Box::setPreviousSibling):
3139         (WebCore::Display::Box::setFirstChild):
3140         (WebCore::Display::Box::setLastChild):
3141
3142 2018-04-29  Youenn Fablet  <youenn@apple.com>
3143
3144         Make RestrictedHTTPResponseAccess flag true by default
3145         https://bugs.webkit.org/show_bug.cgi?id=185089
3146
3147         Reviewed by Geoffrey Garen.
3148
3149         * page/RuntimeEnabledFeatures.h:
3150
3151 2018-04-28  Sihui Liu  <sihui_liu@apple.com>
3152
3153         [Cocoa] Set HTTPOnly flag when converting Cookie to NSHTTPCookie
3154         https://bugs.webkit.org/show_bug.cgi?id=185052
3155
3156         Reviewed by Geoffrey Garen.
3157
3158         Set HTTPOnly for NSHTTPCookie when it's converted from Cookie, so the WebKit APIs could 
3159         create NSHTTPCookie with correct HTTPOnly flag. Also, reverted the change made to operator
3160         function because we want the Cookie class to act as a wrapper for NSHTTPCookie and leverage
3161         its equal function. 
3162
3163         Modified API test: WebKit.WKHTTPCookieStoreHttpOnly
3164
3165         * platform/network/cocoa/CookieCocoa.mm:
3166         (WebCore::Cookie::operator NSHTTPCookie * const):
3167         (WebCore::Cookie::operator== const):
3168         * platform/network/cocoa/NetworkStorageSessionCocoa.mm:
3169         (WebCore::NetworkStorageSession::deleteCookie):
3170
3171 2018-04-28  Zalan Bujtas  <zalan@apple.com>
3172
3173         [LFC] Add LayoutTreeBuilder class to generate the layout tree
3174         https://bugs.webkit.org/show_bug.cgi?id=185108
3175
3176         Reviewed by Antti Koivisto.
3177
3178         This is for testing purposes.
3179
3180         * WebCore.xcodeproj/project.pbxproj:
3181         * layout/FormattingState.cpp:
3182         (WebCore::Layout::FormattingState::~FormattingState):
3183         * layout/FormattingState.h:
3184         * layout/LayoutContext.h:
3185         * layout/blockformatting/BlockFormattingState.cpp:
3186         (WebCore::Layout::BlockFormattingState::~BlockFormattingState):
3187         * layout/blockformatting/BlockFormattingState.h:
3188         * layout/inlineformatting/InlineFormattingState.cpp:
3189         (WebCore::Layout::InlineFormattingState::~InlineFormattingState):
3190         * layout/inlineformatting/InlineFormattingState.h:
3191         * layout/layouttree/LayoutBlockContainer.h:
3192         * layout/layouttree/LayoutBox.h:
3193         * layout/layouttree/LayoutContainer.h:
3194         * layout/layouttree/LayoutInlineContainer.h:
3195         * layout/layouttree/LayoutTreeBuilder.cpp: Added.
3196         (WebCore::Layout::TreeBuilder::createLayoutTree):
3197         (WebCore::Layout::TreeBuilder::createSubTree):
3198         (WebCore::Layout::outputLayoutBox):
3199         (WebCore::Layout::outputLayoutTree):
3200         (WebCore::Layout::TreeBuilder::showLayoutTree):
3201         (WebCore::Layout::printLayoutTreeForLiveDocuments):
3202         * layout/layouttree/LayoutTreeBuilder.h: Copied from Source/WebCore/layout/layouttree/LayoutBlockContainer.h.
3203         * page/mac/PageMac.mm:
3204         (WebCore::Page::platformInitialize):
3205
3206 2018-04-28  Zalan Bujtas  <zalan@apple.com>
3207
3208         [LFC] Implement BlockMarginCollapse functions.
3209         https://bugs.webkit.org/show_bug.cgi?id=185036
3210
3211         Reviewed by Antti Koivisto.
3212
3213         * layout/blockformatting/BlockMarginCollapse.cpp:
3214         (WebCore::Layout::marginValue):
3215         (WebCore::Layout::BlockMarginCollapse::BlockMarginCollapse):
3216         (WebCore::Layout::BlockMarginCollapse::marginTop const):
3217         (WebCore::Layout::BlockMarginCollapse::marginBottom const):
3218         (WebCore::Layout::BlockMarginCollapse::isMarginTopCollapsedWithSibling const):
3219         (WebCore::Layout::BlockMarginCollapse::isMarginBottomCollapsedWithSibling const):
3220         (WebCore::Layout::BlockMarginCollapse::isMarginTopCollapsedWithParent const):
3221         (WebCore::Layout::BlockMarginCollapse::isMarginBottomCollapsedWithParent const):
3222         (WebCore::Layout::BlockMarginCollapse::nonCollapsedMarginTop const):
3223         (WebCore::Layout::BlockMarginCollapse::nonCollapsedMarginBottom const):
3224         (WebCore::Layout::BlockMarginCollapse::collapsedMarginTopFromFirstChild const):
3225         (WebCore::Layout::BlockMarginCollapse::collapsedMarginBottomFromLastChild const):
3226         (WebCore::Layout::BlockMarginCollapse::hasAdjoiningMarginTopAndBottom const):
3227         * layout/blockformatting/BlockMarginCollapse.h:
3228         * layout/layouttree/LayoutBox.h:
3229         (WebCore::Layout::Box::style const):
3230
3231 2018-04-27  David Kilzer  <ddkilzer@apple.com>
3232
3233         Add logging when SpringBoard enables WebThread
3234         <https://webkit.org/b/185100>
3235         <rdar://problem/39746542>
3236
3237         Reviewed by Daniel Bates.
3238
3239         * platform/RuntimeApplicationChecks.h:
3240         (WebCore::IOSApplication::isSpringBoard): Add declaration.
3241         * platform/cocoa/RuntimeApplicationChecksCocoa.mm:
3242         (WebCore::IOSApplication::isSpringBoard): Add implementation.
3243         * platform/ios/wak/WebCoreThread.mm:
3244         (WebThreadEnable): Call RELEASE_LOG_FAULT() if this is called by
3245         SpringBoard.
3246
3247 2018-04-27  Keith Rollin  <krollin@apple.com>
3248
3249         Fix crash in DocumentLoader::startLoadingMainResource
3250         https://bugs.webkit.org/show_bug.cgi?id=185088
3251         rdar://problem/39689263
3252
3253         Reviewed by Chris Dumez.
3254
3255         Add a "protectedThis" to address a case where a deleted "this" was
3256         accessed in a RELEASE_LOG statement.
3257
3258         No new tests -- covered by existing tests, which now pass.
3259
3260         * loader/DocumentLoader.cpp:
3261         (WebCore::DocumentLoader::startLoadingMainResource):
3262
3263 2018-04-27  Simon Fraser  <simon.fraser@apple.com>
3264
3265         Implement color-filter for text stroke
3266         https://bugs.webkit.org/show_bug.cgi?id=185098
3267
3268         Reviewed by Alan Bujtas.
3269         
3270         Transform the text stroke color through color-filter.
3271
3272         Test: css3/color-filters/color-filter-text-stroke.html
3273
3274         * rendering/TextPaintStyle.cpp:
3275         (WebCore::computeTextPaintStyle):
3276
3277 2018-04-27  Simon Fraser  <simon.fraser@apple.com>
3278
3279         Implement animation for color-filter
3280         https://bugs.webkit.org/show_bug.cgi?id=185092
3281         rdar://problem/39773810
3282
3283         Reviewed by Tim Horton.
3284         
3285         Implement animation of color-filter.
3286         
3287         This requires tracking whether the color-filter function lists match for both old and new
3288         animation code paths.
3289         
3290         The filter-related ProperyWappers in CSSPropertyAnimation are cleaned up to use a single wrapper,
3291         which has to pass the propertyID to the blend function so we know which "lists match" to check.
3292         This wrapper reports that its accelerated for filter and backdrop-filter, but not color-filter.
3293
3294         Test: css3/color-filters/color-filter-animation.html
3295
3296         * animation/CSSPropertyBlendingClient.h:
3297         * animation/KeyframeEffectReadOnly.cpp:
3298         (WebCore::KeyframeEffectReadOnly::setBlendingKeyframes):
3299         (WebCore::KeyframeEffectReadOnly::checkForMatchingColorFilterFunctionLists):
3300         * animation/KeyframeEffectReadOnly.h:
3301         * page/animation/AnimationBase.h:
3302         * page/animation/CSSPropertyAnimation.cpp:
3303         (WebCore::blendFunc):
3304         (WebCore::PropertyWrapperFilter::PropertyWrapperFilter):
3305         (WebCore::CSSPropertyAnimationWrapperMap::CSSPropertyAnimationWrapperMap):
3306         (WebCore::PropertyWrapperAcceleratedFilter::PropertyWrapperAcceleratedFilter): Deleted.
3307         (WebCore::PropertyWrapperAcceleratedBackdropFilter::PropertyWrapperAcceleratedBackdropFilter): Deleted.
3308         (WebCore::PropertyWrapperAcceleratedBackdropFilter::animationIsAccelerated const): Deleted.
3309         (WebCore::PropertyWrapperAcceleratedBackdropFilter::blend const): Deleted.
3310         * page/animation/ImplicitAnimation.cpp:
3311         (WebCore::ImplicitAnimation::reset):
3312         (WebCore::ImplicitAnimation::checkForMatchingColorFilterFunctionLists):
3313         * page/animation/ImplicitAnimation.h:
3314         * page/animation/KeyframeAnimation.cpp:
3315         (WebCore::KeyframeAnimation::KeyframeAnimation):
3316         (WebCore::KeyframeAnimation::checkForMatchingColorFilterFunctionLists):
3317         * page/animation/KeyframeAnimation.h:
3318
3319 2018-04-27  Zalan Bujtas  <zalan@apple.com>
3320
3321         [LFC] Add FormattingContext::computeWidth/computeHeight logic.
3322         https://bugs.webkit.org/show_bug.cgi?id=185091
3323
3324         Reviewed by Antti Koivisto.
3325
3326         Inflow width and height can't really be computed without knowing the exact context. 
3327
3328         * layout/FormattingContext.cpp:
3329         (WebCore::Layout::FormattingContext::computeWidth const):
3330         (WebCore::Layout::FormattingContext::computeHeight const):
3331         (WebCore::Layout::FormattingContext::computeOutOfFlowWidth const):
3332         (WebCore::Layout::FormattingContext::computeFloatingWidth const):
3333         (WebCore::Layout::FormattingContext::computeOutOfFlowHeight const):
3334         (WebCore::Layout::FormattingContext::computeFloatingHeight const):
3335         * layout/FormattingContext.h:
3336         * layout/blockformatting/BlockFormattingContext.cpp:
3337         (WebCore::Layout::BlockFormattingContext::computeInFlowWidth const):
3338         (WebCore::Layout::BlockFormattingContext::computeInFlowHeight const):
3339         (WebCore::Layout::BlockFormattingContext::computeWidth const): Deleted.
3340         (WebCore::Layout::BlockFormattingContext::computeHeight const): Deleted.
3341         * layout/blockformatting/BlockFormattingContext.h:
3342         * layout/inlineformatting/InlineFormattingContext.cpp:
3343         (WebCore::Layout::InlineFormattingContext::computeInFlowWidth const):
3344         (WebCore::Layout::InlineFormattingContext::computeInFlowHeight const):
3345         * layout/inlineformatting/InlineFormattingContext.h:
3346
3347 2018-04-27  Chris Dumez  <cdumez@apple.com>
3348
3349         Use WindowProxy instead of DOMWindow in our IDL
3350         https://bugs.webkit.org/show_bug.cgi?id=185022
3351
3352         Reviewed by Sam Weinig.
3353
3354         Stop using DOMWindow in all of our IDL files and use WindowProxy as
3355         per their respective specifications. As a result, the implementation
3356         as also updated to use WindowProxy type instead of DOMWindow.
3357
3358         * WebCore.xcodeproj/project.pbxproj:
3359         * bindings/js/JSDOMConvertWindowProxy.h: Removed.
3360         * bindings/js/JSWindowProxy.cpp:
3361         (WebCore::JSWindowProxy::windowProxy const):
3362         (WebCore::JSWindowProxy::toWrapped):
3363         * bindings/js/JSWindowProxy.h:
3364         (WebCore::window):
3365         Use static_cast<>() instead of jsCast<>() because jsCast<>()
3366         relies on classInfo() which is not allowed to be called during
3367         JS sweep due to an assertion inside classInfo(). The JSWindowProxy
3368         objects are held strongly by the WindowProxy so we know the JSWindowProxy
3369         object is not getting destroyed here.
3370
3371         (WebCore::toJS):
3372         * bindings/js/WindowProxy.cpp:
3373         (WebCore::WindowProxy::globalObject):
3374         * bindings/js/WindowProxy.h:
3375         (WebCore::WindowProxy::frame const):
3376         * bindings/scripts/CodeGenerator.pm:
3377         (IsBuiltinType):
3378         (ComputeIsCallbackInterface):
3379         (ComputeIsCallbackFunction):
3380         * bindings/scripts/CodeGeneratorJS.pm:
3381         (AddToIncludesForIDLType):
3382         (GetBaseIDLType):
3383         (NativeToJSValueDOMConvertNeedsState):
3384         * bindings/scripts/test/JS/JSTestObj.cpp:
3385         (WebCore::jsTestObjPrototypeFunctionOverloadedMethod9Body):
3386         (WebCore::jsTestObjPrototypeFunctionOverloadedMethodOverloadDispatcher):
3387         * bindings/scripts/test/TestObj.idl:
3388         * dom/CompositionEvent.cpp:
3389         (WebCore::CompositionEvent::CompositionEvent):
3390         (WebCore::CompositionEvent::initCompositionEvent):
3391         * dom/CompositionEvent.h:
3392         * dom/CompositionEvent.idl:
3393         * dom/Document.cpp:
3394         (WebCore::Document::defaultView const):
3395         * dom/Document.h:
3396         * dom/Document.idl:
3397         * dom/DocumentTouch.cpp:
3398         (WebCore::DocumentTouch::createTouch):
3399         * dom/DocumentTouch.h:
3400         * dom/DocumentTouch.idl:
3401         * dom/FocusEvent.cpp:
3402         (WebCore::FocusEvent::FocusEvent):
3403         * dom/FocusEvent.h:
3404         * dom/InputEvent.cpp:
3405         (WebCore::InputEvent::create):
3406         (WebCore::InputEvent::InputEvent):
3407         * dom/InputEvent.h:
3408         * dom/KeyboardEvent.cpp:
3409         (WebCore::KeyboardEvent::KeyboardEvent):
3410         (WebCore::KeyboardEvent::create):
3411         (WebCore::KeyboardEvent::initKeyboardEvent):
3412         (WebCore::KeyboardEvent::charCode const):
3413         * dom/KeyboardEvent.h:
3414         * dom/KeyboardEvent.idl:
3415         * dom/MessageEvent.h:
3416         * dom/MessageEvent.idl:
3417         * dom/MouseEvent.cpp:
3418         (WebCore::MouseEvent::create):
3419         (WebCore::MouseEvent::MouseEvent):
3420         (WebCore::MouseEvent::initMouseEvent):
3421         (WebCore::MouseEvent::initMouseEventQuirk):
3422         * dom/MouseEvent.h:
3423         * dom/MouseEvent.idl:
3424         * dom/MouseRelatedEvent.cpp:
3425         (WebCore::MouseRelatedEvent::MouseRelatedEvent):
3426         (WebCore::MouseRelatedEvent::init):
3427         (WebCore::MouseRelatedEvent::frameViewFromWindowProxy):
3428         (WebCore::MouseRelatedEvent::initCoordinates):
3429         (WebCore::MouseRelatedEvent::documentToAbsoluteScaleFactor const):
3430         (WebCore::MouseRelatedEvent::computePageLocation):
3431         (WebCore::MouseRelatedEvent::locationInRootViewCoordinates const):
3432         * dom/MouseRelatedEvent.h:
3433         * dom/Node.cpp:
3434         * dom/SimulatedClick.cpp:
3435         * dom/TextEvent.cpp:
3436         (WebCore::TextEvent::create):
3437         (WebCore::TextEvent::createForPlainTextPaste):
3438         (WebCore::TextEvent::createForFragmentPaste):
3439         (WebCore::TextEvent::createForDrop):
3440         (WebCore::TextEvent::createForDictation):
3441         (WebCore::TextEvent::TextEvent):
3442         (WebCore::TextEvent::initTextEvent):
3443         * dom/TextEvent.h:
3444         * dom/TextEvent.idl:
3445         * dom/TouchEvent.idl:
3446         * dom/UIEvent.cpp:
3447         (WebCore::UIEvent::UIEvent):
3448         (WebCore::UIEvent::initUIEvent):
3449         * dom/UIEvent.h:
3450         (WebCore::UIEvent::create):
3451         (WebCore::UIEvent::view const):
3452         * dom/UIEvent.idl:
3453         * dom/UIEventInit.h:
3454         * dom/UIEventInit.idl:
3455         * dom/UIEventWithKeyState.h:
3456         (WebCore::UIEventWithKeyState::UIEventWithKeyState):
3457         * dom/WheelEvent.cpp:
3458         (WebCore::WheelEvent::WheelEvent):
3459         (WebCore::WheelEvent::create):
3460         (WebCore::WheelEvent::initWebKitWheelEvent):
3461         * dom/WheelEvent.h:
3462         * dom/WheelEvent.idl:
3463         * editing/AlternativeTextController.cpp:
3464         (WebCore::AlternativeTextController::insertDictatedText):
3465         * editing/Editor.cpp:
3466         (WebCore::Editor::pasteAsPlainText):
3467         (WebCore::Editor::pasteAsFragment):
3468         (WebCore::Editor::setComposition):
3469         * html/HTMLDocument.cpp:
3470         (WebCore::HTMLDocument::namedItem):
3471         * html/HTMLDocument.h:
3472         * html/HTMLDocument.idl:
3473         * html/HTMLFrameElement.idl:
3474         * html/HTMLFrameOwnerElement.cpp:
3475         (WebCore::HTMLFrameOwnerElement::contentWindow const):
3476         * html/HTMLFrameOwnerElement.h:
3477         * html/HTMLFrameSetElement.cpp:
3478         (WebCore::HTMLFrameSetElement::namedItem):
3479         * html/HTMLFrameSetElement.h:
3480         * html/HTMLFrameSetElement.idl:
3481         * html/HTMLIFrameElement.idl:
3482         * html/ImageDocument.cpp:
3483         * page/DOMWindow.cpp:
3484         (WebCore::PostMessageTimer::PostMessageTimer):
3485         (WebCore::PostMessageTimer::event):
3486         (WebCore::DOMWindow::postMessage):
3487         * page/DragController.cpp:
3488         (WebCore::DragController::dispatchTextInputEventFor):
3489         * page/EventHandler.cpp:
3490         (WebCore::EventHandler::handleTextInputEvent):
3491
3492 2018-04-27  Nan Wang  <n_wang@apple.com>
3493
3494         AX: Accessibility needs to know which part of the content view is visible on iOS
3495         https://bugs.webkit.org/show_bug.cgi?id=185085
3496         <rdar://problem/39801363>
3497
3498         Reviewed by Chris Fleizach.
3499
3500         Exposed unobscuredContentRect() to iOS accessibility object wrapper.
3501
3502         Test: accessibility/ios-simulator/unobscured-content-rect.html
3503
3504         * accessibility/ios/WebAccessibilityObjectWrapperIOS.mm:
3505         (-[WebAccessibilityObjectWrapper accessibilityVisibleContentRect]):
3506
3507 2018-04-27  Simon Fraser  <simon.fraser@apple.com>
3508
3509         Refactor filter list checking code
3510         https://bugs.webkit.org/show_bug.cgi?id=185087
3511
3512         Reviewed by Alan Bujtas.
3513
3514         Deduplicate code between filter and backdrop-filter for checking whether function lists
3515         match, by making a shared function that takes a std::function.
3516         
3517         The call sites have to declare the return type (-> const FilterOperations&) to avoid std::function
3518         converting the return type into a value.
3519
3520         * animation/KeyframeEffectReadOnly.cpp:
3521         (WebCore::KeyframeEffectReadOnly::checkForMatchingFilterFunctionLists const):
3522         (WebCore::KeyframeEffectReadOnly::checkForMatchingFilterFunctionLists):
3523         (WebCore::KeyframeEffectReadOnly::checkForMatchingBackdropFilterFunctionLists):
3524         * animation/KeyframeEffectReadOnly.h:
3525         * page/animation/KeyframeAnimation.cpp:
3526         (WebCore::KeyframeAnimation::checkForMatchingFilterFunctionLists const):
3527         (WebCore::KeyframeAnimation::checkForMatchingFilterFunctionLists):
3528         (WebCore::KeyframeAnimation::checkForMatchingBackdropFilterFunctionLists):
3529         * page/animation/KeyframeAnimation.h:
3530
3531 2018-04-27  Chris Dumez  <cdumez@apple.com>
3532
3533         Regression(r222392?): Events can have a negative timestamp which causes app breakage
3534         https://bugs.webkit.org/show_bug.cgi?id=185040
3535         <rdar://problem/39638051>
3536
3537         Reviewed by Wenson Hsieh.
3538
3539         The real fix is in UIKit when generating the touch timestamps. However, this patch
3540         does some hardening to make sure that Event.timestamp can never return a negative
3541         value even if something goes wrong.
3542
3543         * dom/Event.cpp:
3544         (WebCore::Event::timeStampForBindings const):
3545
3546 2018-04-27  Christopher Reid  <chris.reid@sony.com>
3547
3548         URL::appendEncodedHostName is using the deprecated uidna_IDNToASCII function
3549         https://bugs.webkit.org/show_bug.cgi?id=184836
3550
3551         Reviewed by Alex Christensen.
3552
3553         Update URL::appendEncodedHostName to use uidna_nameToASCII as done in r208902.
3554
3555         Test: LayoutTests\fast\url\url-hostname-encoding.html
3556
3557         * platform/URL.cpp:
3558
3559 2018-04-27  Youenn Fablet  <youenn@apple.com>
3560
3561         CachedRawResource is not handling incremental data computation correctly
3562         https://bugs.webkit.org/show_bug.cgi?id=184936
3563         <rdar://problem/38798141>
3564
3565         Reviewed by Darin Adler.
3566
3567         * loader/cache/CachedRawResource.cpp:
3568         (WebCore::CachedRawResource::updateBuffer): Fixing style.
3569
3570 2018-04-27  Zalan Bujtas  <zalan@apple.com>
3571
3572         [LFC] Implement BlockFormattingContext::layout logic and its dependencies
3573         https://bugs.webkit.org/show_bug.cgi?id=185024
3574
3575         Reviewed by Antti Koivisto.
3576
3577         This patch implements the logic for block formatting context according to
3578         https://www.w3.org/TR/CSS22/visuren.html#block-formatting
3579
3580         1. Traverse the tree iteratively (in post-order fashion) and compute the width/static position for the containers as
3581         we visit the descendant nodes until we hit a leaf node.
3582         2. Compute the position/geometry of the leaf node and move over to its sibling(s).
3583         3. Finalize the container's height/final position as we climb back on the tree.
3584         4. Run layout on the out-of-flow descendants.  
3585
3586         Note that subtrees with a formatting context root need to be laid out completely before moving on to the next box.
3587         The formatting root box is laid out in the formatting context it lives in, however its descendants get laid out
3588         in a separate formatting context (excluding out-of-flow boxes that don't belong to the root). 
3589
3590         * layout/FloatingContext.cpp:
3591         (WebCore::Layout::FloatingContext::FloatingContext):
3592         (WebCore::Layout::FloatingContext::computePosition):
3593         * layout/FormattingContext.cpp:
3594         (WebCore::Layout::FormattingContext::placeInFlowPositionedChildren const):
3595         (WebCore::Layout::FormattingContext::layoutOutOfFlowDescendants const):
3596         * layout/FormattingContext.h:
3597         * layout/LayoutContext.cpp:
3598         (WebCore::Layout::LayoutContext::updateLayout):
3599         (WebCore::Layout::LayoutContext::establishedFormattingState):
3600         * layout/LayoutContext.h:
3601         * layout/blockformatting/BlockFormattingContext.cpp:
3602         (WebCore::Layout::BlockFormattingContext::layout const):
3603         (WebCore::Layout::BlockFormattingContext::layout): Deleted.
3604         * layout/blockformatting/BlockFormattingContext.h:
3605         * layout/inlineformatting/InlineFormattingContext.cpp:
3606         (WebCore::Layout::InlineFormattingContext::layout const):
3607         (WebCore::Layout::InlineFormattingContext::layout): Deleted.
3608         * layout/inlineformatting/InlineFormattingContext.h:
3609
3610 2018-04-27  Youenn Fablet  <youenn@apple.com>
3611
3612         Use NetworkLoadChecker for XHR/fetch loads
3613         https://bugs.webkit.org/show_bug.cgi?id=184741
3614
3615         Reviewed by Chris Dumez.
3616
3617         Covered by existing tests.
3618
3619         * loader/DocumentThreadableLoader.cpp:
3620         (WebCore::DocumentThreadableLoader::shouldSetHTTPHeadersToKeep const):
3621         We need to set this option for CORS done in NetworkProcess.
3622         (WebCore::DocumentThreadableLoader::DocumentThreadableLoader):
3623         Set httpHeadersTokeep when needed (service worker or CORS loads).
3624         Remove the synchronous disabling of preflight since this is now also done for asynchronous loads.
3625         (WebCore::DocumentThreadableLoader::checkURLSchemeAsCORSEnabled):
3626         Helper routine to make the same check for both simple and preflight case.
3627         This allows more consistent error logging between WK1 and WK2.
3628         (WebCore::DocumentThreadableLoader::makeCrossOriginAccessRequest):
3629         Skip preflight in case this is done in NetworkProcess.
3630         (WebCore::DocumentThreadableLoader::makeSimpleCrossOriginAccessRequest):
3631         (WebCore::isResponseComingFromNetworkProcess):
3632         (WebCore::DocumentThreadableLoader::redirectReceived):
3633         Bypass security checks when they are already done in NetworkProcess.
3634         (WebCore::DocumentThreadableLoader::didFail):
3635         In case of AccessControl error, it might be due to a CSP check done in NetworkProcess.
3636         Check it again to enable specific CSP console logging and error reporting.
3637         (WebCore::DocumentThreadableLoader::loadRequest):
3638         Recreating the error in case of synchronous loads to be able to log it adequately.
3639         (WebCore::DocumentThreadableLoader::isDoingSecurityChecksInNetworkProcess const):
3640         * loader/DocumentThreadableLoader.h:
3641         * loader/SubresourceLoader.cpp:
3642         (WebCore::SubresourceLoader::checkResponseCrossOriginAccessControl):
3643         Specific handling of SameOrigin credential mode for which cross-origin load will not use any credential.
3644         (WebCore::SubresourceLoader::checkRedirectionCrossOriginAccessControl):
3645         We keep the application headers so that DocumentThreadableLoader does not have to restart a brand new load.
3646         * loader/cache/CachedResourceLoader.cpp:
3647         (WebCore::CachedResourceLoader::requestResource):
3648         DocumentThreadableLoader is setting referrer and origin directly. Until we fix that, we remove them from the original requests
3649         as applications are not supposed to set these headers.
3650
3651 2018-04-27  Wenson Hsieh  <wenson_hsieh@apple.com>
3652
3653         Add an experimental feature flag for viewport "min-device-width"
3654         https://bugs.webkit.org/show_bug.cgi?id=185050
3655         <rdar://problem/39624038>
3656
3657         Reviewed by Tim Horton.
3658
3659         Add MinDeviceWidthEnabled as a new runtime-enabled feature.
3660
3661         * dom/ViewportArguments.cpp:
3662         (WebCore::setViewportFeature):
3663
3664         Gate the parsing of "min-device-width" on the runtime-enabled feature being flipped on.
3665
3666         * page/RuntimeEnabledFeatures.h:
3667         (WebCore::RuntimeEnabledFeatures::setMinDeviceWidthEnabled):
3668         (WebCore::RuntimeEnabledFeatures::minDeviceWidthEnabled const):
3669
3670 2018-04-27  Simon Fraser  <simon.fraser@apple.com>
3671
3672         Make color-filter transform gradient colors
3673         https://bugs.webkit.org/show_bug.cgi?id=185080
3674
3675         Reviewed by Zalan Bujtas.
3676         
3677         In CSSGradientValue::computeStops(), transform the color of each gradient color
3678         stop through the color filter. Having a color filter makes the gradient uncacheable.
3679         
3680         Color filters can add alpha, so we also have to fix up CSSGradientValue::knownToBeOpaque()
3681         to take a RenderStyle and convert the colors before testing opaqueness. Clean up some related
3682         functions to take const RenderStyle&.
3683
3684         Test: css3/color-filters/color-filter-gradients.html
3685
3686         * css/CSSCrossfadeValue.cpp:
3687         (WebCore::subimageKnownToBeOpaque):
3688         * css/CSSFilterImageValue.cpp:
3689         (WebCore::CSSFilterImageValue::knownToBeOpaque const):
3690         * css/CSSFilterImageValue.h:
3691         * css/CSSGradientValue.cpp:
3692         (WebCore::CSSGradientValue::image):
3693         (WebCore::CSSGradientValue::computeStops):
3694         (WebCore::CSSGradientValue::knownToBeOpaque const):
3695         (WebCore::CSSLinearGradientValue::createGradient):
3696         (WebCore::CSSRadialGradientValue::createGradient):
3697         * css/CSSGradientValue.h:
3698         * css/CSSImageGeneratorValue.cpp:
3699         (WebCore::CSSImageGeneratorValue::knownToBeOpaque const):
3700         * css/CSSImageValue.cpp:
3701         (WebCore::CSSImageValue::knownToBeOpaque const):
3702         * css/CSSImageValue.h:
3703
3704 2018-04-26  Simon Fraser  <simon.fraser@apple.com>
3705
3706         Fix color-filter to apply to text decorations
3707         https://bugs.webkit.org/show_bug.cgi?id=185068
3708         <rdar://problem/39782136>
3709
3710         Reviewed by Alan Bujtas.
3711         
3712         Transform the colors of text shadows, and the shadows of text-decorations through
3713         the color-filter.
3714         
3715         Rather than clone the ShadowData stored on TextPainter and TextDecorationPainter
3716         (which would have awkward ownership implications) we pass the color filters through
3717         and just map the color through it before painting.
3718         
3719         Re-order the members of TextPainter a little to optimize padding.
3720         
3721         Also fix a bug where FilterOperations::transformColor() could transform an invalid
3722         color to a valid one; we never want this.
3723
3724         Tests: css3/color-filters/color-filter-text-decoration-shadow.html
3725                css3/color-filters/color-filter-text-shadow.html
3726
3727         * platform/graphics/filters/FilterOperations.cpp:
3728         (WebCore::FilterOperations::transformColor const):
3729         * rendering/InlineTextBox.cpp:
3730         (WebCore::InlineTextBox::paintMarkedTextForeground):
3731         (WebCore::InlineTextBox::paintMarkedTextDecoration):
3732         * rendering/TextDecorationPainter.cpp:
3733         (WebCore::TextDecorationPainter::paintTextDecoration):
3734         * rendering/TextDecorationPainter.h:
3735         (WebCore::TextDecorationPainter::setTextShadow):
3736         (WebCore::TextDecorationPainter::setShadowColorFilter):
3737         (WebCore::TextDecorationPainter::addTextShadow): Deleted.
3738         * rendering/TextPainter.cpp:
3739         (WebCore::ShadowApplier::ShadowApplier):
3740         (WebCore::TextPainter::paintTextWithShadows):
3741         (WebCore::TextPainter::paintTextAndEmphasisMarksIfNeeded): Simplify the logic that only paints the shadow
3742         on the first iteration.
3743         (WebCore::TextPainter::paintRange):
3744         * rendering/TextPainter.h:
3745         (WebCore::TextPainter::setShadowColorFilter):
3746         * rendering/svg/SVGInlineTextBox.cpp:
3747         (WebCore::SVGInlineTextBox::paintTextWithShadows):
3748
3749 2018-04-27  Wenson Hsieh  <wenson_hsieh@apple.com>
3750
3751         Rename minimumLayoutSize to viewLayoutSize
3752         https://bugs.webkit.org/show_bug.cgi?id=185050
3753         <rdar://problem/39624038>
3754
3755         Reviewed by Tim Horton.
3756
3757         See WebKit/ChangeLog for more information. No change in behavior.
3758
3759         * page/ViewportConfiguration.cpp:
3760         (WebCore::ViewportConfiguration::ViewportConfiguration):
3761         (WebCore::ViewportConfiguration::setViewLayoutSize):
3762
3763         Remove a FIXME comment that is addressed by this refactoring.
3764
3765         (WebCore::ViewportConfiguration::shouldOverrideDeviceWidthWithMinDeviceWidth const):
3766         (WebCore::ViewportConfiguration::initialScaleFromSize const):
3767         (WebCore::ViewportConfiguration::minimumScale const):
3768         (WebCore::ViewportConfiguration::updateMinimumLayoutSize):
3769         (WebCore::ViewportConfiguration::setMinimumLayoutSize): Deleted.
3770         * page/ViewportConfiguration.h:
3771         (WebCore::ViewportConfiguration::viewLayoutSize const):
3772         (WebCore::ViewportConfiguration::viewSize const): Deleted.
3773
3774 2018-04-27  Zalan Bujtas  <zalan@apple.com>
3775
3776         [LFC] Formatting contexts should create floating states.
3777         https://bugs.webkit.org/show_bug.cgi?id=185032
3778
3779         Reviewed by Antti Koivisto.
3780
3781         This patch implements the logic for sharing floating states across multiple formatting contexts.
3782         At this point this is mostly about inline formatting contexts. They either create a new floating state
3783         or inherit it from the parent formatting context.
3784
3785         * layout/FloatingState.cpp:
3786         (WebCore::Layout::FloatingState::FloatingState):
3787         * layout/FloatingState.h:
3788         (WebCore::Layout::FloatingState::create):
3789         * layout/FormattingContext.cpp:
3790         (WebCore::Layout::FormattingContext::FormattingContext):
3791         * layout/FormattingContext.h:
3792         (WebCore::Layout::FormattingContext::layoutContext const):
3793         * layout/FormattingState.cpp:
3794         (WebCore::Layout::FormattingState::FormattingState):
3795         * layout/FormattingState.h:
3796         (WebCore::Layout::FormattingState::floatingState const):
3797         * layout/LayoutContext.cpp:
3798         (WebCore::Layout::LayoutContext::updateLayout):
3799         (WebCore::Layout::LayoutContext::formattingStateForBox const):
3800         (WebCore::Layout::LayoutContext::establishedFormattingState):
3801         (WebCore::Layout::LayoutContext::formattingContext):
3802         (WebCore::Layout::LayoutContext::formattingState): Deleted.
3803         * layout/LayoutContext.h:
3804         * layout/blockformatting/BlockFormattingContext.cpp:
3805         (WebCore::Layout::BlockFormattingContext::BlockFormattingContext):
3806         (WebCore::Layout::BlockFormattingContext::createFormattingState const):
3807         (WebCore::Layout::BlockFormattingContext::createOrFindFloatingState const):
3808         (WebCore::Layout::BlockFormattingContext::formattingState const): Deleted.
3809         * layout/blockformatting/BlockFormattingContext.h:
3810         * layout/blockformatting/BlockFormattingState.cpp:
3811         (WebCore::Layout::BlockFormattingState::BlockFormattingState):
3812         * layout/blockformatting/BlockFormattingState.h:
3813         * layout/inlineformatting/InlineFormattingContext.cpp:
3814         (WebCore::Layout::InlineFormattingContext::InlineFormattingContext):
3815         (WebCore::Layout::InlineFormattingContext::createFormattingState const):
3816         (WebCore::Layout::InlineFormattingContext::createOrFindFloatingState const):
3817         (WebCore::Layout::InlineFormattingContext::formattingState const): Deleted.
3818         * layout/inlineformatting/InlineFormattingContext.h:
3819         * layout/inlineformatting/InlineFormattingState.cpp:
3820         (WebCore::Layout::InlineFormattingState::InlineFormattingState):
3821         * layout/inlineformatting/InlineFormattingState.h:
3822         * layout/layouttree/LayoutBox.cpp:
3823         (WebCore::Layout::Box::formattingContextRoot const):
3824         * layout/layouttree/LayoutBox.h:
3825
3826 2018-04-27  Wenson Hsieh  <wenson_hsieh@apple.com>
3827
3828         [Extra zoom mode] Add a mechanism to override default viewport behaviors in extra zoom mode
3829         https://bugs.webkit.org/show_bug.cgi?id=185050
3830         <rdar://problem/39624038>
3831
3832         Reviewed by Tim Horton.
3833
3834         Currently, in extra zoom mode, there's no way for web pages to opt out of the default viewport behaviors
3835         (namely, laying out at a larger width and shrinking to fit) when the web view is very tall and narrow. This
3836         patch adds a new experimental viewport attribute, "min-device-width", that can be used to prevent WebKit from
3837         automatically clamping the web view width to a greater value for the device width in this scenario.
3838
3839         Note that after this patch, logic that plumbs a minimumLayoutSize from WKWebView to the viewport configuration
3840         will need to be renamed to reflect that this size is no longer the minimum layout size, but rather, the view
3841         size that is used for viewport device dimensions by default. This refactoring will be done in a followup part.
3842
3843         See per-method comments below for more detail.
3844
3845         Test: fast/viewport/extrazoom/viewport-change-min-device-width.html
3846
3847         * dom/ViewportArguments.cpp:
3848         (WebCore::setViewportFeature):
3849         (WebCore::operator<<):
3850         * dom/ViewportArguments.h:
3851
3852         Removes `m_forceHorizontalShrinkToFit` (more detail below).
3853
3854         * page/ViewportConfiguration.cpp:
3855         (WebCore::computedMinDeviceWidth):
3856         (WebCore::ViewportConfiguration::ViewportConfiguration):
3857         (WebCore::ViewportConfiguration::setMinimumLayoutSize):
3858
3859         Instead of directly setting the minimum layout size, setMinimumLayoutSize now first sets the view size (i.e. the
3860         size we use for `device-width` in the viewport meta tag), and then updates the minimum layout size.
3861
3862         (WebCore::ViewportConfiguration::shouldOverrideDeviceWidthWithMinDeviceWidth const):
3863
3864         Replaces `m_forceHorizontalShrinkToFit`. Whether or not we shrink to fit is now determined by whether the
3865         min-device-width attribute is actively clamping the width of the view.
3866
3867         (WebCore::ViewportConfiguration::shouldIgnoreHorizontalScalingConstraints const):
3868         (WebCore::ViewportConfiguration::shouldIgnoreScalingConstraintsRegardlessOfContentSize const):
3869         (WebCore::ViewportConfiguration::updateMinimumLayoutSize):
3870
3871         Computes and sets the minimum layout size using the view size, taking the minimum device width into account if
3872         needed.
3873
3874         (WebCore::ViewportConfiguration::description const):
3875         (WebCore::ViewportConfiguration::setForceHorizontalShrinkToFit): Deleted.
3876         * page/ViewportConfiguration.h:
3877
3878 2018-04-27  Zalan Bujtas  <zalan@apple.com>
3879
3880         [LFC] Formatting contexts should take const Box&
3881         https://bugs.webkit.org/show_bug.cgi?id=185031
3882
3883         Reviewed by Sam Weinig.
3884
3885         The formatting root boxes are supposed to be all const. The only reason why
3886         they are not is because WeakPtr<> does not support const objects yet.
3887         Use const_cast instead (remove it when WeakPtr<> gains const support).
3888
3889         * layout/FormattingContext.cpp:
3890         (WebCore::Layout::FormattingContext::FormattingContext):
3891         * layout/FormattingContext.h:
3892         * layout/LayoutContext.cpp:
3893         (WebCore::Layout::LayoutContext::LayoutContext):
3894         (WebCore::Layout::LayoutContext::formattingContext):
3895         * layout/LayoutContext.h:
3896         * layout/blockformatting/BlockFormattingContext.cpp:
3897         (WebCore::Layout::BlockFormattingContext::BlockFormattingContext):
3898         * layout/blockformatting/BlockFormattingContext.h:
3899         * layout/inlineformatting/InlineFormattingContext.cpp:
3900         (WebCore::Layout::InlineFormattingContext::InlineFormattingContext):
3901         * layout/inlineformatting/InlineFormattingContext.h:
3902
3903 2018-04-27  Zalan Bujtas  <zalan@apple.com>
3904
3905         [LFC] Add layout tree iterators.
3906         https://bugs.webkit.org/show_bug.cgi?id=185058
3907
3908         Reviewed by Antti Koivisto.
3909
3910         They work exactly like the renderer tree iterators.
3911
3912         * WebCore.xcodeproj/project.pbxproj:
3913         * layout/layouttree/LayoutAncestorIterator.h: Added.
3914         (WebCore::Layout::LayoutAncestorIterator<T>::LayoutAncestorIterator):
3915         (WebCore::Layout::LayoutAncestorIterator<T>::operator):
3916         (WebCore::Layout::LayoutAncestorIteratorAdapter<T>::LayoutAncestorIteratorAdapter):
3917         (WebCore::Layout::LayoutAncestorIteratorAdapter<T>::begin const):
3918         (WebCore::Layout::LayoutAncestorIteratorAdapter<T>::end const):
3919         (WebCore::Layout::LayoutAncestorIteratorAdapter<T>::first const):
3920         (WebCore::Layout::ancestorsOfType):
3921         (WebCore::Layout::lineageOfType):
3922         * layout/layouttree/LayoutBox.cpp:
3923         * layout/layouttree/LayoutChildIterator.h: Added.
3924         (WebCore::Layout::LayoutChildtIterator<T>::LayoutChildtIterator):
3925         (WebCore::Layout::LayoutChildtIterator<T>::operator):
3926         (WebCore::Layout::LayoutChildtIteratorAdapter<T>::LayoutChildtIteratorAdapter):
3927         (WebCore::Layout::LayoutChildtIteratorAdapter<T>::begin const):
3928         (WebCore::Layout::LayoutChildtIteratorAdapter<T>::end const):
3929         (WebCore::Layout::LayoutChildtIteratorAdapter<T>::first const):
3930         (WebCore::Layout::LayoutChildtIteratorAdapter<T>::last const):
3931         (WebCore::Layout::childrenOfType):
3932         * layout/layouttree/LayoutIterator.h: Added.
3933         (WebCore::Layout::isLayoutBoxOfType):
3934         (WebCore::Layout::Traversal::firstChild):
3935         (WebCore::Layout::Traversal::lastChild):
3936         (WebCore::Layout::Traversal::nextSibling):
3937         (WebCore::Layout::Traversal::previousSibling):
3938         (WebCore::Layout::Traversal::findAncestorOfType):
3939         (WebCore::Layout::Traversal::nextAncestorSibling):
3940         (WebCore::Layout::Traversal::nextWithin):
3941         (WebCore::Layout::Traversal::firstWithin):
3942         (WebCore::Layout::Traversal::next):
3943         (WebCore::Layout::LayoutIterator<T>::LayoutIterator):
3944         (WebCore::Layout::LayoutIterator<T>::traverseNextSibling):
3945         (WebCore::Layout::LayoutIterator<T>::traverseNext):
3946         (WebCore::Layout::LayoutIterator<T>::traversePreviousSibling):
3947         (WebCore::Layout::LayoutIterator<T>::traverseAncestor):
3948         (WebCore::Layout::LayoutIterator<T>::operator const):
3949         (WebCore::Layout:: const):
3950         (WebCore::Layout::= const):
3951
3952 2018-04-27  Commit Queue  <commit-queue@webkit.org>
3953
3954         Unreviewed, rolling out r231089.
3955         https://bugs.webkit.org/show_bug.cgi?id=185071
3956
3957         Broke and made crash some WPE EME tests (Requested by calvaris
3958         on #webkit).
3959
3960         Reverted changeset:
3961
3962         "[EME][GStreamer] Move the decryptor from AppendPipeline to
3963         PlaybackPipeline."
3964         https://bugs.webkit.org/show_bug.cgi?id=181855
3965         https://trac.webkit.org/changeset/231089
3966
3967 2018-04-27  Yacine Bandou  <yacine.bandou_ext@softathome.com>
3968
3969         [EME][GStreamer] Move the decryptor from AppendPipeline to PlaybackPipeline.
3970         https://bugs.webkit.org/show_bug.cgi?id=181855
3971
3972         Reviewed by Xabier Rodriguez-Calvar.
3973
3974         The goal of this move is to handle the limitation of SVP (Secure Video Path) memory size.
3975
3976         When the decryptor is in the AppendPipeline and we use SVP, we buffer in MediaSource queue
3977         the decrypted GstBuffers that are in SVP memory.
3978         This behavior cause an out-of-memory error, because we are limited in SVP memory size.
3979
3980         By moving the decryptor in PlaybackPipeline, we avoid to buffer the decrypted GstBuffers
3981         which use the SVP memory and we buffer the encrypted GstBuffers that are in system memory.
3982
3983         This new architecture also allows to start the buffering before obtaining the DRM license
3984         and it makes easier to manage dynamic change of the license or Key.
3985
3986         The decryptor is auto plugged by GStreamer playbin in PlaybackPipeline.
3987
3988         SVP: Secure Video Path also named trusted or protected video path, it is a memory which is
3989         protected by a hardware access control engine, it is not accessible to other unauthorised
3990         software or hardware components.
3991
3992         Tests:
3993             media/encrypted-media/clearKey/clearKey-cenc-audio-playback-mse.html
3994             media/encrypted-media/clearKey/clearKey-cenc-video-playback-mse.html
3995
3996         * platform/graphics/gstreamer/eme/WebKitCommonEncryptionDecryptorGStreamer.cpp:
3997         (webkitMediaCommonEncryptionDecryptSinkEventHandler):
3998         * platform/graphics/gstreamer/mse/AppendPipeline.cpp:
3999         (WebCore::dumpAppendState):
4000         (WebCore::AppendPipeline::AppendPipeline):
4001         (WebCore::AppendPipeline::handleNeedContextSyncMessage):
4002         (WebCore::AppendPipeline::handleAppsrcNeedDataReceived):
4003         (WebCore::AppendPipeline::setAppendState):
4004         (WebCore::AppendPipeline::parseDemuxerSrcPadCaps):
4005         (WebCore::AppendPipeline::appsinkNewSample):
4006         (WebCore::AppendPipeline::connectDemuxerSrcPadToAppsinkFromAnyThread):
4007         (WebCore::AppendPipeline::disconnectDemuxerSrcPadFromAppsinkFromAnyThread):
4008         (WebCore::appendPipelineElementMessageCallback): Deleted.
4009         (WebCore::AppendPipeline::handleElementMessage): Deleted.
4010         (WebCore::AppendPipeline::dispatchPendingDecryptionStructure): Deleted.
4011         (WebCore::AppendPipeline::dispatchDecryptionStructure): Deleted.
4012         * platform/graphics/gstreamer/mse/AppendPipeline.h:
4013         * platform/graphics/gstreamer/mse/MediaPlayerPrivateGStreamerMSE.cpp:
4014         (WebCore::MediaPlayerPrivateGStreamerMSE::attemptToDecryptWithInstance):
4015         * platform/graphics/gstreamer/mse/PlaybackPipeline.cpp:
4016
4017 2018-04-27  Yacine Bandou  <yacine.bandou_ext@softathome.com>
4018
4019         [EME][GStreamer] Add a new message "decrypt-key-needed" send from the decryptor to the application.
4020         https://bugs.webkit.org/show_bug.cgi?id=181858
4021
4022         Reviewed by Xabier Rodriguez-Calvar.
4023
4024         Add a new message "decrypt-key-needed" that the decryptor can send when it doesn't have an available key.