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