[GStreamer] GstStructure shouldn't be handled through GRefPtr
[WebKit-https.git] / Source / WebCore / ChangeLog
1 2017-08-17  Zan Dobersek  <zdobersek@igalia.com>
2
3         [GStreamer] GstStructure shouldn't be handled through GRefPtr
4         https://bugs.webkit.org/show_bug.cgi?id=175673
5
6         Reviewed by Xabier Rodriguez-Calvar.
7
8         * platform/graphics/gstreamer/eme/WebKitCommonEncryptionDecryptorGStreamer.cpp:
9         (webkitMediaCommonEncryptionDecryptTransformCaps): GstStructure isn't
10         ref-counted, so it should be handled through the GUniquePtr<GstStructure>
11         smart pointer.
12
13 2017-08-17  Youenn Fablet  <youenn@apple.com>
14
15         [Mac/iOS] Increase the audio buffer size when audio capture is on but web audio is not used
16         https://bugs.webkit.org/show_bug.cgi?id=175631
17
18         Reviewed by Eric Carlson.
19
20         * platform/audio/cocoa/MediaSessionManagerCocoa.cpp:
21         (PlatformMediaSessionManager::updateSessionState): Change value from 128 to the equivalent of 20ms when audio capture happens but not web audio.
22
23 2017-08-17  Antti Koivisto  <antti@apple.com>
24
25         RenderListItem - Avoid render tree mutation during layout
26         https://bugs.webkit.org/show_bug.cgi?id=175666
27
28         Reviewed by Andreas Kling.
29
30         Mutations should be done by RenderTreeUpdater only.
31
32         * rendering/RenderListItem.cpp:
33         (WebCore::RenderListItem::updateMarkerRenderer):
34
35             This is now called by RenderTreeUpdater only.
36             Remove code dealing with this being called at layout time.
37             Merged marker construction code from styleDidChange here and renamed for clarity.
38
39         (WebCore::RenderListItem::layout):
40         (WebCore::RenderListItem::computePreferredLogicalWidths):
41
42             Remove mutating calls.
43
44         (WebCore::RenderListItem::styleDidChange): Deleted.
45         (WebCore::RenderListItem::insertOrMoveMarkerRendererIfNeeded): Deleted.
46         * rendering/RenderListItem.h:
47         * rendering/TextAutoSizing.cpp:
48         (WebCore::TextAutoSizingValue::adjustTextNodeSizes):
49
50             Call updateMarkerRenderer.
51
52         * style/RenderTreeUpdater.cpp:
53         (WebCore::RenderTreeUpdater::popParent):
54         (WebCore::RenderTreeUpdater::updateBeforeOrAfterPseudoElement):
55
56             Call updateMarkerRenderer.
57
58 2017-08-17  Don Olmstead  <don.olmstead@sony.com>
59
60         [PAL] Move SessionID into PAL
61         https://bugs.webkit.org/show_bug.cgi?id=174192
62
63         Reviewed by Antti Koivisto.
64
65         No new tests. No change in behavior.
66
67         * CMakeLists.txt:
68         * Modules/websockets/WebSocketChannel.cpp:
69         (WebCore::WebSocketChannel::connect):
70         * WebCore.xcodeproj/project.pbxproj:
71         * dom/Document.cpp:
72         (WebCore::Document::sessionID const):
73         * dom/Document.h:
74         * dom/ScriptExecutionContext.h:
75         * html/HTMLMediaElement.cpp:
76         (WebCore::HTMLMediaElement::elementWithID):
77         (WebCore::HTMLMediaElement::finishParsingChildren):
78         (WebCore::HTMLMediaElement::scheduleEvent):
79         (WebCore::HTMLMediaElement::canPlayType const):
80         (WebCore::HTMLMediaElement::load):
81         (WebCore::HTMLMediaElement::loadResource):
82         (WebCore::HTMLMediaElement::textTracksAreReady const):
83         (WebCore::HTMLMediaElement::textTrackModeChanged):
84         (WebCore::HTMLMediaElement::noneSupported):
85         (WebCore::HTMLMediaElement::mediaLoadingFailedFatally):
86         (WebCore::HTMLMediaElement::mediaLoadingFailed):
87         (WebCore::HTMLMediaElement::setReadyState):
88         (WebCore::HTMLMediaElement::addPlayedRange):
89         (WebCore::HTMLMediaElement::seekTask):
90         (WebCore::HTMLMediaElement::refreshCachedTime const):
91         (WebCore::HTMLMediaElement::currentMediaTime const):
92         (WebCore::HTMLMediaElement::setWebkitPreservesPitch):
93         (WebCore::HTMLMediaElement::ended const):
94         (WebCore::HTMLMediaElement::playInternal):
95         (WebCore::HTMLMediaElement::pause):
96         (WebCore::HTMLMediaElement::togglePlayState):
97         (WebCore::HTMLMediaElement::beginScrubbing):
98         (WebCore::HTMLMediaElement::playbackProgressTimerFired):
99         (WebCore::HTMLMediaElement::mediaPlayerDidAddTextTrack):
100         (WebCore::HTMLMediaElement::didAddTextTrack):
101         (WebCore::HTMLMediaElement::didRemoveTextTrack):
102         (WebCore::controllerJSValue):
103         (WebCore::HTMLMediaElement::configureTextTracks):
104         (WebCore::HTMLMediaElement::selectNextSourceChild):
105         (WebCore::HTMLMediaElement::sourceWasAdded):
106         (WebCore::HTMLMediaElement::sourceWasRemoved):
107         (WebCore::HTMLMediaElement::mediaPlayerTimeChanged):
108         (WebCore::HTMLMediaElement::mediaPlayerCharacteristicChanged):
109         (WebCore::HTMLMediaElement::potentiallyPlaying const):
110         (WebCore::HTMLMediaElement::endedPlayback const):
111         (WebCore::HTMLMediaElement::stoppedDueToErrors const):
112         (WebCore::HTMLMediaElement::updatePlayState):
113         (WebCore::HTMLMediaElement::userCancelledLoad):
114         (WebCore::HTMLMediaElement::canSuspendForDocumentSuspension const):
115         (WebCore::HTMLMediaElement::addEventListener):
116         (WebCore::HTMLMediaElement::isFullscreen const):
117         (WebCore::HTMLMediaElement::toggleStandardFullscreenState):
118         (WebCore::HTMLMediaElement::waitForPreparedForInlineThen):
119         (WebCore::HTMLMediaElement::setVideoFullscreenLayer):
120         (WebCore::HTMLMediaElement::updateTextTrackDisplay):
121         (WebCore::HTMLMediaElement::mediaControls const):
122         (WebCore::HTMLMediaElement::configureTextTrackDisplay):
123         (WebCore::HTMLMediaElement::setMediaGroup):
124         (WebCore::HTMLMediaElement::setControllerForBindings):
125         (WebCore::HTMLMediaElement::isBlockedOnMediaController const):
126         (WebCore::HTMLMediaElement::prepareMediaFragmentURI):
127         (WebCore::HTMLMediaElement::didAddUserAgentShadowRoot):
128         (WebCore::HTMLMediaElement::fileSize const):
129         (WebCore::HTMLMediaElement::mediaSessionTitle const):
130         (WebCore::needsSeekingSupportQuirk):
131         (WebCore::HTMLMediaElement::supportsSeeking const):
132         (WebCore::HTMLMediaElement::doesHaveAttribute const):
133         (WebCore::HTMLMediaElement::isVideoTooSmallForInlinePlayback):
134         * loader/DocumentLoader.cpp:
135         (WebCore::DocumentLoader::continueAfterContentPolicy):
136         * loader/EmptyClients.cpp:
137         * loader/FrameLoaderClient.h:
138         * loader/cache/CachedCSSStyleSheet.cpp:
139         (WebCore::CachedCSSStyleSheet::CachedCSSStyleSheet):
140         * loader/cache/CachedCSSStyleSheet.h:
141         * loader/cache/CachedFont.cpp:
142         (WebCore::CachedFont::CachedFont):
143         * loader/cache/CachedFont.h:
144         * loader/cache/CachedImage.cpp:
145         (WebCore::CachedImage::CachedImage):
146         * loader/cache/CachedImage.h:
147         * loader/cache/CachedRawResource.cpp:
148         (WebCore::CachedRawResource::CachedRawResource):
149         * loader/cache/CachedRawResource.h:
150         * loader/cache/CachedResource.cpp:
151         (WebCore::CachedResource::CachedResource):
152         * loader/cache/CachedResource.h:
153         (WebCore::CachedResource::sessionID const):
154         * loader/cache/CachedResourceLoader.cpp:
155         (WebCore::createResource):
156         (WebCore::CachedResourceLoader::sessionID const):
157         * loader/cache/CachedResourceLoader.h:
158         * loader/cache/CachedSVGDocument.cpp:
159         (WebCore::CachedSVGDocument::CachedSVGDocument):
160         * loader/cache/CachedSVGDocument.h:
161         * loader/cache/CachedSVGFont.cpp:
162         (WebCore::CachedSVGFont::CachedSVGFont):
163         * loader/cache/CachedSVGFont.h:
164         * loader/cache/CachedScript.cpp:
165         (WebCore::CachedScript::CachedScript):
166         * loader/cache/CachedScript.h:
167         * loader/cache/CachedTextTrack.cpp:
168         (WebCore::CachedTextTrack::CachedTextTrack):
169         * loader/cache/CachedTextTrack.h:
170         * loader/cache/CachedXSLStyleSheet.cpp:
171         (WebCore::CachedXSLStyleSheet::CachedXSLStyleSheet):
172         * loader/cache/CachedXSLStyleSheet.h:
173         * loader/cache/MemoryCache.cpp:
174         (WebCore::MemoryCache::sessionResourceMap const):
175         (WebCore::MemoryCache::ensureSessionResourceMap):
176         (WebCore::MemoryCache::resourceForRequest):
177         (WebCore::MemoryCache::addImageToCache):
178         (WebCore::MemoryCache::removeImageFromCache):
179         (WebCore::MemoryCache::forEachSessionResource):
180         (WebCore::MemoryCache::removeResourcesWithOrigins):
181         (WebCore::MemoryCache::originsWithCache const):
182         (WebCore::MemoryCache::evictResources):
183         * loader/cache/MemoryCache.h:
184         * loader/cocoa/DiskCacheMonitorCocoa.h:
185         (WebCore::DiskCacheMonitor::sessionID const):
186         * loader/cocoa/DiskCacheMonitorCocoa.mm:
187         (WebCore::DiskCacheMonitor::monitorFileBackingStoreCreation):
188         (WebCore::DiskCacheMonitor::DiskCacheMonitor):
189         * page/CacheStorageProvider.h:
190         * page/DatabaseProvider.h:
191         * page/Page.cpp:
192         (WebCore::Page::Page):
193         (WebCore::Page::enableLegacyPrivateBrowsing):
194         (WebCore::Page::sessionID const):
195         (WebCore::Page::setSessionID):
196         * page/Page.h:
197         * page/PlugInClient.h:
198         * page/SocketProvider.cpp:
199         (WebCore::SocketProvider::createSocketStreamHandle):
200         * page/SocketProvider.h:
201         * platform/CookiesStrategy.h:
202         * platform/WebCoreCrossThreadCopier.cpp:
203         (WTF::PAL::SessionID>::copy):
204         (WTF::WebCore::SessionID>::copy): Deleted.
205         * platform/WebCoreCrossThreadCopier.h:
206         * platform/network/CacheValidation.cpp:
207         (WebCore::headerValueForVary):
208         (WebCore::collectVaryingRequestHeaders):
209         (WebCore::verifyVaryingRequestHeaders):
210         * platform/network/CacheValidation.h:
211         * platform/network/NetworkStorageSession.cpp:
212         (WebCore::NetworkStorageSession::globalSessionMap):
213         (WebCore::NetworkStorageSession::storageSession):
214         (WebCore::NetworkStorageSession::destroySession):
215         * platform/network/NetworkStorageSession.h:
216         (WebCore::NetworkStorageSession::sessionID const):
217         * platform/network/NetworkStorageSessionStub.cpp:
218         (WebCore::NetworkStorageSession::NetworkStorageSession):
219         (WebCore::NetworkStorageSession::ensurePrivateBrowsingSession):
220         (WebCore::NetworkStorageSession::ensureSession):
221         (WebCore::NetworkStorageSession::defaultStorageSession):
222         * platform/network/cf/NetworkStorageSessionCFNet.cpp:
223         (WebCore::NetworkStorageSession::NetworkStorageSession):
224         (WebCore::NetworkStorageSession::switchToNewTestingSession):
225         (WebCore::NetworkStorageSession::defaultStorageSession):
226         (WebCore::NetworkStorageSession::ensurePrivateBrowsingSession):
227         (WebCore::NetworkStorageSession::ensureSession):
228         * platform/network/cf/SocketStreamHandleImpl.h:
229         (WebCore::SocketStreamHandleImpl::create):
230         * platform/network/cf/SocketStreamHandleImplCFNet.cpp:
231         (WebCore::SocketStreamHandleImpl::SocketStreamHandleImpl):
232         * platform/network/curl/SocketStreamHandleImpl.h:
233         (WebCore::SocketStreamHandleImpl::create):
234         * platform/network/soup/NetworkStorageSessionSoup.cpp:
235         (WebCore::NetworkStorageSession::NetworkStorageSession):
236         (WebCore::NetworkStorageSession::defaultStorageSession):
237         (WebCore::NetworkStorageSession::ensurePrivateBrowsingSession):
238         (WebCore::NetworkStorageSession::ensureSession):
239         (WebCore::NetworkStorageSession::switchToNewTestingSession):
240         * platform/network/soup/SocketStreamHandleImpl.h:
241         * platform/network/soup/SocketStreamHandleImplSoup.cpp:
242         (WebCore::SocketStreamHandleImpl::create):
243         * workers/DedicatedWorkerGlobalScope.cpp:
244         (WebCore::DedicatedWorkerGlobalScope::create):
245         (WebCore::DedicatedWorkerGlobalScope::DedicatedWorkerGlobalScope):
246         * workers/DedicatedWorkerGlobalScope.h:
247         * workers/DedicatedWorkerThread.cpp:
248         (WebCore::DedicatedWorkerThread::DedicatedWorkerThread):
249         (WebCore::DedicatedWorkerThread::createWorkerGlobalScope):
250         * workers/DedicatedWorkerThread.h:
251         * workers/Worker.cpp:
252         (WebCore::Worker::notifyFinished):
253         * workers/WorkerGlobalScope.cpp:
254         (WebCore::WorkerGlobalScope::WorkerGlobalScope):
255         * workers/WorkerGlobalScope.h:
256         * workers/WorkerGlobalScopeProxy.h:
257         * workers/WorkerMessagingProxy.cpp:
258         (WebCore::WorkerMessagingProxy::startWorkerGlobalScope):
259         * workers/WorkerMessagingProxy.h:
260         * workers/WorkerThread.cpp:
261         (WebCore::WorkerThreadStartupData::WorkerThreadStartupData):
262         (WebCore::WorkerThread::WorkerThread):
263         * workers/WorkerThread.h:
264         * workers/service/ServiceWorkerContainer.h:
265         * workers/service/ServiceWorkerRegistrationParameters.h:
266
267 2017-08-17  Carlos Garcia Campos  <cgarcia@igalia.com>
268
269         [GTK][WPE] Add NTLM authentication enabled API
270         https://bugs.webkit.org/show_bug.cgi?id=122952
271
272         Reviewed by Michael Catanzaro.
273
274         Add/remove NTLM feature to/from soup session depending on whether the feature is enabled or disabled.
275
276         * platform/network/soup/SoupNetworkSession.cpp:
277         (WebCore::SoupNetworkSession::SoupNetworkSession):
278         (WebCore::SoupNetworkSession::setInitialNTLMAuthenticationEnabled):
279         (WebCore::SoupNetworkSession::setNTLMAuthenticationEnabled):
280         * platform/network/soup/SoupNetworkSession.h:
281
282 2017-08-16  Ryosuke Niwa  <rniwa@webkit.org>
283
284         Add the support for mutating clipboard data via DataTransferItemList
285         https://bugs.webkit.org/show_bug.cgi?id=175639
286
287         Reviewed by Wenson Hsieh.
288
289         Added the support for adding plaintext data via dataTransfer.items.add, clearing data via clear,
290         and removing an entry via remove. When DataTransferItem is removed from DataTransferItemList,
291         we must put into the disabled mode.
292
293         To support the removal of DataTransferItem, this patch replaces a reference to DataTransfer by
294         a WeakPtr to DataTransferItemList, and stops forwarding ref from DataTransferItem to DataTransfer.
295         This means that DataTransfer can now be GC'ed before DataTransferItem is GC'ed.
296
297         Because the identify and the order of DataTransferItems need to be preserved, we can't simply
298         re-popluate m_itemList in DataTransferItemList. Instead, whenever the clipboard content is mutated,
299         we make the parallel modifications to m_itemList. This includes changes made via DataTransfer
300         methods such as setData and clearData.
301
302         Test: editing/pasteboard/datatransfer-items-copy-plaintext.html
303
304         * dom/DataTransfer.cpp:
305         (WebCore::DataTransfer::clearData): Invoke didClearStringData when m_itemList exists.
306         (WebCore::DataTransfer::setData): Ditto.
307         (WebCore::DataTransfer::createForInputEvent):
308         (WebCore::DataTransfer::createForDrag):
309         (WebCore::DataTransfer::createForDrop):
310         * dom/DataTransferItem.cpp:
311         (WebCore::DataTransferItem::create):
312         (WebCore::DataTransferItem::DataTransferItem):
313         (WebCore::DataTransferItem::clearListAndPutIntoDisabledMode): Added.
314         (WebCore::DataTransferItem::type const): Moved from the header.
315         (WebCore::DataTransferItem::getAsString const):
316         (WebCore::DataTransferItem::getAsFile const):
317         * dom/DataTransferItem.h:
318         (WebCore::DataTransferItem::ref): Deleted.
319         (WebCore::DataTransferItem::deref): Deleted.
320         (WebCore::DataTransferItem::isFile const): Added.
321         (WebCore::DataTransferItem::type const): Move to the cpp file.
322         * dom/DataTransferItemList.cpp:
323         (WebCore::isSupportedType): Moved.
324         (WebCore::DataTransferItemList::DataTransferItemList): Moved from the header.
325         (WebCore::DataTransferItemList::~DataTransferItemList): Added.
326         (WebCore::DataTransferItemList::item):
327         (WebCore::DataTransferItemList::add): Implemented the variant to add string data.
328         (WebCore::DataTransferItemList::remove): Implemented. For now, we don't have to deal with removing
329         a file since a writable dataTransfer never contains a File object.
330         (WebCore::DataTransferItemList::clear): Implemented.
331         (WebCore::DataTransferItemList::ensureItems const):
332         (WebCore::removeStringItemOfLowercasedType): Added.
333         (WebCore::DataTransferItemList::didClearStringData): Called when dataTransfer.clear is called.
334         (WebCore::DataTransferItemList::didSetStringData): Ditto for 
335         * dom/DataTransferItemList.h:
336         (WebCore::DataTransferItemList): Added a WeakPtrFactory. Also use a vector of Ref<DataTransferItem>
337         instead of unique_ptr<DataTransferItem> since DataTransferItem can outlive DataTransferItemList.
338         (WebCore::DataTransferItemList::dataTransfer): Added.
339         * dom/DataTransferItemList.idl:
340
341 2017-08-16  Andy Estes  <aestes@apple.com>
342
343         [Apple Pay] Rename PaymentRequest to ApplePaySessionPaymentRequest
344         https://bugs.webkit.org/show_bug.cgi?id=175648
345
346         Reviewed by Tim Horton.
347
348         The W3C Payment Request API defines an interface called PaymentRequest, which conflicts with
349         an existing Apple Pay class. This patch renames PaymentRequest to
350         ApplePaySessionPaymentRequest so that a follow-on patch can introduce PaymentRequest for the
351         W3C API.
352
353         * Modules/applepay/ApplePayError.h:
354         * Modules/applepay/ApplePayLineItem.h:
355         * Modules/applepay/ApplePayPaymentRequest.h:
356         * Modules/applepay/ApplePaySession.cpp:
357         (WebCore::convertAndValidateTotal):
358         (WebCore::convertAndValidate):
359         (WebCore::ApplePaySession::ApplePaySession):
360         (WebCore::ApplePaySession::didSelectShippingMethod):
361         * Modules/applepay/ApplePaySession.h:
362         * Modules/applepay/ApplePaySessionPaymentRequest.cpp: Renamed from Source/WebCore/Modules/applepay/PaymentRequest.cpp.
363         (WebCore::ApplePaySessionPaymentRequest::ApplePaySessionPaymentRequest):
364         (WebCore::ApplePaySessionPaymentRequest::~ApplePaySessionPaymentRequest):
365         (WebCore::ApplePaySessionPaymentRequest::isValidSupportedNetwork):
366         * Modules/applepay/ApplePaySessionPaymentRequest.h: Renamed from Source/WebCore/Modules/applepay/PaymentRequest.h.
367         * Modules/applepay/ApplePayShippingMethodSelectedEvent.cpp:
368         (WebCore::convert):
369         (WebCore::ApplePayShippingMethodSelectedEvent::ApplePayShippingMethodSelectedEvent):
370         * Modules/applepay/ApplePayShippingMethodSelectedEvent.h:
371         * Modules/applepay/PaymentCoordinator.cpp:
372         (WebCore::PaymentCoordinator::beginPaymentSession):
373         (WebCore::PaymentCoordinator::didSelectShippingMethod):
374         * Modules/applepay/PaymentCoordinator.h:
375         * Modules/applepay/PaymentCoordinatorClient.h:
376         * Modules/applepay/PaymentHeaders.h:
377         * Modules/applepay/PaymentRequestValidator.cpp:
378         (WebCore::PaymentRequestValidator::validate):
379         (WebCore::PaymentRequestValidator::validateTotal):
380         (WebCore::validateMerchantCapabilities):
381         (WebCore::validateShippingMethod):
382         (WebCore::validateShippingMethods):
383         * Modules/applepay/PaymentRequestValidator.h:
384         * WebCore.xcodeproj/project.pbxproj:
385         * loader/EmptyClients.cpp:
386
387 2017-08-16  Chris Dumez  <cdumez@apple.com>
388
389         Cross origin Beacon requests with a ArrayBuffer / ArrayBufferView payload should not do a CORS preflight
390         https://bugs.webkit.org/show_bug.cgi?id=175628
391         <rdar://problem/33919278>
392
393         Reviewed by Geoffrey Garen.
394
395         Cross origin Beacon requests with a ArrayBuffer / ArrayBufferView payload should not do a CORS preflight.
396         To achieve this, the following changes were made:
397         1. Revert r220779 which caused us to use a non CORS-safelisted Content-Type header for such payload
398         2. Teach PingLoad how to deal with "simple" cross origin requests (i.e. Don't assume we need a CORS
399            preflight merely because the fetch mode is set to "cors").
400
401         Test: http/wpt/beacon/cors/crossorigin-arraybufferview-no-preflight.html
402
403         * Modules/fetch/FetchBody.cpp:
404         (WebCore::FetchBody::extract):
405         * loader/CrossOriginAccessControl.h:
406         * loader/LoaderStrategy.h:
407         * loader/PingLoader.cpp:
408         (WebCore::PingLoader::loadImage):
409         (WebCore::PingLoader::sendPing):
410         (WebCore::PingLoader::sendViolationReport):
411         (WebCore::PingLoader::startPingLoad):
412         * loader/PingLoader.h:
413         * loader/cache/CachedResource.cpp:
414         (WebCore::CachedResource::CachedResource):
415         (WebCore::CachedResource::load):
416         * loader/cache/CachedResource.h:
417         * loader/cache/CachedResourceRequest.cpp:
418         (WebCore::CachedResourceRequest::CachedResourceRequest):
419         * loader/cache/CachedResourceRequest.h:
420         (WebCore::CachedResourceRequest::releaseOriginalRequestHeaders):
421         * platform/network/HTTPHeaderValues.cpp:
422         * platform/network/HTTPHeaderValues.h:
423
424 2017-08-16  Matt Baker  <mattbaker@apple.com>
425
426         Web Inspector: capture async stack trace when workers/main context posts a message
427         https://bugs.webkit.org/show_bug.cgi?id=167084
428         <rdar://problem/30033673>
429
430         Reviewed by Brian Burg.
431
432         Add instrumentation to DOMWindow to support showing asynchronous
433         stack traces when the debugger pauses in a MessageEvent handler.
434
435         Test: inspector/debugger/async-stack-trace.html
436
437         * inspector/InspectorInstrumentation.cpp:
438         (WebCore::InspectorInstrumentation::didPostMessageImpl):
439         (WebCore::InspectorInstrumentation::didFailPostMessageImpl):
440         (WebCore::InspectorInstrumentation::willDispatchPostMessageImpl):
441         (WebCore::InspectorInstrumentation::didDispatchPostMessageImpl):
442
443         * inspector/InspectorInstrumentation.h:
444         (WebCore::InspectorInstrumentation::didPostMessage):
445         (WebCore::InspectorInstrumentation::didFailPostMessage):
446         (WebCore::InspectorInstrumentation::willDispatchPostMessage):
447         (WebCore::InspectorInstrumentation::didDispatchPostMessage):
448
449         * inspector/PageDebuggerAgent.cpp:
450         (WebCore::PageDebuggerAgent::didClearAsyncStackTraceData):
451         (WebCore::PageDebuggerAgent::didPostMessage):
452         (WebCore::PageDebuggerAgent::didFailPostMessage):
453         (WebCore::PageDebuggerAgent::willDispatchPostMessage):
454         (WebCore::PageDebuggerAgent::didDispatchPostMessage):
455         * inspector/PageDebuggerAgent.h:
456
457         * page/DOMWindow.cpp:
458         (WebCore::DOMWindow::postMessage):
459         (WebCore::DOMWindow::postMessageTimerFired):
460
461 2017-08-16  Timothy Horton  <timothy_horton@apple.com>
462
463         Try to fix the build
464
465         * platform/ios/PlatformPasteboardIOS.mm:
466
467 2017-08-16  Simon Fraser  <simon.fraser@apple.com>
468
469         Build fix after r220812
470
471         Fix builds where LOG_DISABLED is defined.
472
473         * css/MediaQueryEvaluator.cpp:
474
475 2017-08-16  Simon Fraser  <simon.fraser@apple.com>
476
477         Add a log channel for media queries
478         https://bugs.webkit.org/show_bug.cgi?id=175591
479
480         Reviewed by Zalan Bujtas.
481
482         Add a "MediaQueries" log channel which logs data about media query evaluation.
483
484         * css/MediaList.cpp:
485         (WebCore::MediaQuerySet::MediaQuerySet):
486         (WebCore::operator<<):
487         * css/MediaList.h:
488         * css/MediaQuery.cpp:
489         (WebCore::operator<<):
490         * css/MediaQuery.h:
491         * css/MediaQueryEvaluator.cpp:
492         (WebCore::operator<<):
493         (WebCore::MediaQueryEvaluator::evaluate const):
494         (WebCore::aspectRatioValueAsString):
495         (WebCore::orientationEvaluate):
496         (WebCore::aspectRatioEvaluate):
497         (WebCore::deviceAspectRatioEvaluate):
498         (WebCore::evaluateResolution):
499         (WebCore::deviceHeightEvaluate):
500         (WebCore::deviceWidthEvaluate):
501         (WebCore::heightEvaluate):
502         (WebCore::widthEvaluate):
503         * css/MediaQueryExpression.cpp:
504         (WebCore::operator<<):
505         * css/MediaQueryExpression.h:
506         * css/MediaQueryMatcher.cpp:
507         (WebCore::MediaQueryMatcher::styleResolverChanged):
508         * css/StyleResolver.cpp:
509         (WebCore::StyleResolver::hasMediaQueriesAffectedByViewportChange const):
510         (WebCore::StyleResolver::hasMediaQueriesAffectedByAccessibilitySettingsChange const):
511         * dom/InlineStyleSheetOwner.cpp:
512         (WebCore::InlineStyleSheetOwner::createSheet):
513         * html/HTMLImageElement.cpp:
514         (WebCore::HTMLImageElement::bestFitSourceFromPictureElement):
515         * html/HTMLLinkElement.cpp:
516         (WebCore::HTMLLinkElement::process):
517         * html/HTMLMediaElement.cpp:
518         (WebCore::HTMLMediaElement::selectNextSourceChild):
519         * html/HTMLPictureElement.cpp:
520         (WebCore::HTMLPictureElement::viewportChangeAffectedPicture const):
521         * html/parser/HTMLPreloadScanner.cpp:
522         (WebCore::TokenPreloadScanner::StartTagScanner::processAttribute):
523         * page/FrameView.cpp:
524         (WebCore::FrameView::layout):
525         * platform/Logging.cpp:
526         (WebCore::initializeLogChannelsIfNecessary):
527         * platform/Logging.h:
528         * platform/URL.cpp:
529         (WebCore::isSchemeFirstChar):
530         (WebCore::operator<<):
531         * platform/URL.h:
532
533 2017-08-16  Sam Weinig  <sam@webkit.org>
534
535         [WebIDL] Remove the need for JSSubtleCryptoCustom.cpp
536         https://bugs.webkit.org/show_bug.cgi?id=175526
537
538         Reviewed by Chris Dumez.
539
540         - Generates bindings for all of SubtleCrypto except AlgorithmIdentifier normalization, 
541           which is defined in the WebCrypto spec to happen after normal IDL operations.
542         - Adds initial support for IDL object types in unions (some, unneeded at the moment,
543           edge cases remain).
544
545         * CMakeLists.txt:
546         * WebCore.xcodeproj/project.pbxproj:
547         * bindings/js/JSSubtleCryptoCustom.cpp: Removed.
548
549             Remove JSSubtleCryptoCustom.cpp, added CryptoKeyFormat.h
550
551         * bindings/js/JSDOMConvertObject.h:
552
553             Add needed, when included in generated code, #include of StrongInlines.h
554
555         * bindings/js/JSDOMConvertUnion.h:
556         
557             Add initial support for object (needed for AlgorithmIdentifier which is 
558             (object or DOMString)). Remaining support will be handled by https://webkit.org/b/175616
559
560             Also add remaining spec comments while in the area.
561
562         * bindings/js/JSDOMPromiseDeferred.cpp:
563         (WebCore::DeferredPromise::reject):
564
565             Add support for the special ExistingExceptionError error code. Capturing
566             the current exception and using it as the rejection value.
567
568         * crypto/SubtleCrypto.cpp:
569         (WebCore::SubtleCrypto::~SubtleCrypto):
570         (WebCore::toHashIdentifier):
571         (WebCore::normalizeCryptoAlgorithmParameters):
572         (WebCore::toCryptoKeyUsageBitmap):
573         (WebCore::rejectWithException):
574         (WebCore::normalizeJsonWebKey):
575         (WebCore::toKeyData):
576         (WebCore::copyToVector):
577         (WebCore::isSupportedExportKey):
578         (WebCore::SubtleCrypto::encrypt):
579         (WebCore::SubtleCrypto::decrypt):
580         (WebCore::SubtleCrypto::sign):
581         (WebCore::SubtleCrypto::verify):
582         (WebCore::SubtleCrypto::digest):
583         (WebCore::SubtleCrypto::generateKey):
584         (WebCore::SubtleCrypto::deriveKey):
585         (WebCore::SubtleCrypto::deriveBits):
586         (WebCore::SubtleCrypto::importKey):
587         (WebCore::SubtleCrypto::exportKey):
588         (WebCore::SubtleCrypto::wrapKey):
589         (WebCore::SubtleCrypto::unwrapKey):
590         * crypto/SubtleCrypto.h:
591         * crypto/SubtleCrypto.idl:
592
593             Moves implementation from JSSubtleCryptoCustom.cpp -> here. Important changes that come
594             with that are:
595             - All parameters are now converted / type checked for us.
596             - Rather than throwing exceptions and expecting the bindings layer to convert
597               them to promise rejections, all rejections are now explicitly made.
598             - Algorithms are no longer checked for being supported twice, once in normalizeCryptoAlgorithmParameters
599               and then again in the operation. We instead rely on normalizeCryptoAlgorithmParameters to return
600               an Exception if its not supported.
601             - Shaves 251 lines off the file.
602
603         * crypto/CryptoKeyFormat.h: Added.
604
605             Add new header for unified key format enum. (For bindings purposes, SubtleCrypto
606             re aliases it to SubtleCrypto::KeyFormat).
607
608         * bindings/js/JSWebKitSubtleCryptoCustom.cpp:
609         * crypto/CryptoAlgorithm.cpp:
610         * crypto/CryptoAlgorithm.h:
611         * crypto/algorithms/CryptoAlgorithmAES_CBC.cpp:
612         * crypto/algorithms/CryptoAlgorithmAES_CBC.h:
613         * crypto/algorithms/CryptoAlgorithmAES_CFB.cpp:
614         * crypto/algorithms/CryptoAlgorithmAES_CFB.h:
615         * crypto/algorithms/CryptoAlgorithmAES_CTR.cpp:
616         * crypto/algorithms/CryptoAlgorithmAES_CTR.h:
617         * crypto/algorithms/CryptoAlgorithmAES_GCM.cpp:
618         * crypto/algorithms/CryptoAlgorithmAES_GCM.h:
619         * crypto/algorithms/CryptoAlgorithmAES_KW.cpp:
620         * crypto/algorithms/CryptoAlgorithmAES_KW.h:
621         * crypto/algorithms/CryptoAlgorithmECDH.cpp:
622         * crypto/algorithms/CryptoAlgorithmECDH.h:
623         * crypto/algorithms/CryptoAlgorithmECDSA.cpp:
624         * crypto/algorithms/CryptoAlgorithmECDSA.h:
625         * crypto/algorithms/CryptoAlgorithmHKDF.cpp:
626         * crypto/algorithms/CryptoAlgorithmHKDF.h:
627         * crypto/algorithms/CryptoAlgorithmHMAC.cpp:
628         * crypto/algorithms/CryptoAlgorithmHMAC.h:
629         * crypto/algorithms/CryptoAlgorithmPBKDF2.cpp:
630         * crypto/algorithms/CryptoAlgorithmPBKDF2.h:
631         * crypto/algorithms/CryptoAlgorithmRSAES_PKCS1_v1_5.cpp:
632         * crypto/algorithms/CryptoAlgorithmRSAES_PKCS1_v1_5.h:
633         * crypto/algorithms/CryptoAlgorithmRSASSA_PKCS1_v1_5.cpp:
634         * crypto/algorithms/CryptoAlgorithmRSASSA_PKCS1_v1_5.h:
635         * crypto/algorithms/CryptoAlgorithmRSA_OAEP.cpp:
636         * crypto/algorithms/CryptoAlgorithmRSA_OAEP.h:
637         * crypto/algorithms/CryptoAlgorithmRSA_PSS.cpp:
638         * crypto/algorithms/CryptoAlgorithmRSA_PSS.h:
639
640             Use CryptoKeyFormat enum directly, rather than SubtleCrypto::KeyFormat,
641             to allow not including SubtleCrypto.h.
642
643         * crypto/parameters/CryptoAlgorithmEcdsaParams.h:
644         * crypto/parameters/CryptoAlgorithmHkdfParams.h:
645         * crypto/parameters/CryptoAlgorithmHmacKeyParams.h:
646         * crypto/parameters/CryptoAlgorithmPbkdf2Params.h:
647         * crypto/parameters/CryptoAlgorithmRsaHashedImportParams.h:
648         * crypto/parameters/CryptoAlgorithmRsaHashedKeyGenParams.h:
649         * crypto/parameters/EcdsaParams.idl:
650         * crypto/parameters/HkdfParams.idl:
651         * crypto/parameters/HmacKeyParams.idl:
652         * crypto/parameters/Pbkdf2Params.idl:
653         * crypto/parameters/RsaHashedImportParams.idl:
654         * crypto/parameters/RsaHashedKeyGenParams.idl:
655
656             Update IDLs and implementations to use the correct definition of HashAlgorithmIdentifier,
657             which is (object or DOMString), now that it is supported.
658
659 2017-08-16  Youenn Fablet  <youenn@apple.com>
660
661         [Cache API] Implement Worker connection to the Cache storage engine
662         https://bugs.webkit.org/show_bug.cgi?id=175599
663
664         Reviewed by Chris Dumez.
665
666         Covered by existing tests.
667
668         Adding a WorkerCacheStorageConnection to connect workers Cache/CacheStorage
669         to the cache storage engine.
670         WorkerCacheStorageConnection does this by hopping to the main thread to call the document cache storage connection to do the actual job.
671         Doing some CacheStorageConnection refactoring to share code with WK2 implementation of the cache storage connection. 
672
673         * Modules/cache/CacheQueryOptions.h:
674         (WebCore::CacheQueryOptions::isolatedCopy const):
675         * Modules/cache/CacheStorageConnection.cpp:
676         (WebCore::CacheStorageConnection::open):
677         (WebCore::CacheStorageConnection::remove):
678         (WebCore::CacheStorageConnection::retrieveCaches):
679         (WebCore::CacheStorageConnection::retrieveRecords):
680         (WebCore::CacheStorageConnection::batchDeleteOperation):
681         (WebCore::CacheStorageConnection::batchPutOperation):
682         (WebCore::CacheStorageConnection::openOrRemoveCompleted):
683         (WebCore::CacheStorageConnection::updateCaches):
684         (WebCore::CacheStorageConnection::updateRecords):
685         (WebCore::CacheStorageConnection::removeRecordsCompleted):
686         (WebCore::CacheStorageConnection::putRecordsCompleted):
687         * Modules/cache/CacheStorageConnection.h:
688         (WebCore::CacheStorageConnection::openCompleted):
689         (WebCore::CacheStorageConnection::removeCompleted):
690         (WebCore::CacheStorageConnection::doOpen):
691         (WebCore::CacheStorageConnection::doRemove):
692         (WebCore::CacheStorageConnection::doRetrieveCaches):
693         (WebCore::CacheStorageConnection::doRetrieveRecords):
694         (WebCore::CacheStorageConnection::doBatchDeleteOperation):
695         (WebCore::CacheStorageConnection::doBatchPutOperation):
696         * Modules/cache/WorkerCacheStorageConnection.cpp: Added.
697         (WebCore::toCrossThreadRecordData):
698         (WebCore::fromCrossThreadRecordData):
699         (WebCore::WorkerCacheStorageConnection::create):
700         (WebCore::WorkerCacheStorageConnection::WorkerCacheStorageConnection):
701         (WebCore::WorkerCacheStorageConnection::doOpen):
702         (WebCore::WorkerCacheStorageConnection::doRemove):
703         (WebCore::WorkerCacheStorageConnection::doRetrieveCaches):
704         (WebCore::WorkerCacheStorageConnection::doRetrieveRecords):
705         (WebCore::WorkerCacheStorageConnection::doBatchDeleteOperation):
706         (WebCore::WorkerCacheStorageConnection::doBatchPutOperation):
707         * Modules/cache/WorkerCacheStorageConnection.h: Added.
708         * Modules/cache/WorkerGlobalScopeCaches.cpp:
709         (WebCore::WorkerGlobalScopeCaches::caches const):
710         * WebCore.xcodeproj/project.pbxproj:
711         * loader/FetchOptions.h:
712         (WebCore::FetchOptions::isolatedCopy const):
713         * workers/WorkerGlobalScope.cpp:
714         (WebCore::WorkerGlobalScope::cacheStorageConnection):
715         * workers/WorkerGlobalScope.h:
716
717 2017-08-16  Yoshiaki Jitsukawa  <Yoshiaki.Jitsukawa@sony.com>
718
719         [PAL] Move spi/ios and spi/win directories into PAL
720         https://bugs.webkit.org/show_bug.cgi?id=175171
721
722         Reviewed by Antti Koivisto.
723
724         * PlatformWin.cmake:
725         * WebCore.xcodeproj/project.pbxproj:
726         * editing/cocoa/DataDetection.mm:
727         * loader/ios/PreviewLoader.mm:
728         * page/CaptionUserPreferencesMediaAF.cpp:
729         * page/cocoa/MemoryReleaseCocoa.mm:
730         * page/cocoa/SettingsCocoa.mm:
731         * page/ios/UserAgentIOS.mm:
732         * platform/audio/ios/MediaSessionManagerIOS.mm:
733         * platform/graphics/ca/PlatformCALayer.cpp:
734         * platform/graphics/cocoa/FontCascadeCocoa.mm:
735         * platform/graphics/cocoa/GraphicsContext3DCocoa.mm:
736         * platform/graphics/opentype/OpenTypeCG.h:
737         * platform/graphics/win/SimpleFontDataCGWin.cpp:
738         * platform/graphics/win/SimpleFontDataDirect2D.cpp:
739         * platform/ios/Device.h:
740         * platform/ios/PlatformPasteboardIOS.mm:
741         * platform/ios/PlatformScreenIOS.mm:
742         * platform/ios/QuickLookSoftLink.h:
743         * platform/ios/QuickLookSoftLink.mm:
744         * platform/ios/ValidationBubbleIOS.mm:
745         * platform/ios/WebItemProviderPasteboard.mm:
746         * platform/network/ios/PreviewConverter.mm:
747         * platform/sql/SQLiteFileSystem.cpp:
748         * rendering/RenderThemeIOS.mm:
749
750 2017-08-16  Tim Horton  <timothy_horton@apple.com>
751
752         2-3% of main thread time under UTTypeCreatePreferredIdentifierForTag on wunderground map
753         https://bugs.webkit.org/show_bug.cgi?id=175618
754
755         Reviewed by Simon Fraser.
756
757         No new tests, just a perf win.
758
759         UTTypeCreatePreferredIdentifierForTag is fairly expensive, and is called
760         under every toDataURL, which the Wunderground wundermap does a /lot/.
761
762         Keep a 16-item LRU cache of MIMEType->UTI mappings.
763
764         Also, make other callers of UTTypeCreatePreferredIdentifierForTag use
765         the UTIUtilities version so they can share in the caching.
766
767         Also, as a drive-by, add and make other callers use mimeTypeFromUTI too,
768         and make the UTIUtilities operate on Strings for a slightly more WebCore-y feel.
769
770         * editing/ios/EditorIOS.mm:
771         (WebCore::Editor::WebContentReader::readImage):
772         * platform/MIMETypeRegistry.cpp:
773         (WebCore::initializeSupportedImageMIMETypes):
774         (WebCore::initializeSupportedImageMIMETypesForEncoding):
775         * platform/graphics/mac/MediaPlayerPrivateQTKit.mm:
776         (WebCore::createFileTypesSet):
777         * platform/graphics/cg/ImageSourceCGMac.mm:
778         (WebCore::MIMETypeForImageSourceType):
779         Adopt newly-added MIMETypeFromUTI().
780
781         * platform/graphics/cg/ImageBufferCG.cpp:
782         (WebCore::utiFromImageBufferMIMEType):
783         (WebCore::ImageBuffer::toCFData const):
784         (WebCore::cfData):
785         (WebCore::utiFromMIMEType): Deleted.
786         Adopt UTIFromMIMEType, and rename the local helper that does something
787         different (a small static map) on iOS and Windows to not have an overlapping name.
788
789         * platform/ios/PasteboardIOS.mm:
790         (WebCore::Pasteboard::resourceMIMEType):
791         (WebCore::utiTypeFromCocoaType):
792         Adopt UTIFromMIMEType().
793
794         * platform/ios/PlatformPasteboardIOS.mm:
795         (WebCore::PlatformPasteboard::writeObjectRepresentations):
796         * platform/mac/PasteboardMac.mm:
797         (WebCore::cocoaTypeFromHTMLClipboardType):
798         Adopt isDeclaredUTI and UTIFromMIMEType().
799
800         * platform/graphics/avfoundation/objc/WebCoreAVFResourceLoader.mm:
801         (WebCore::WebCoreAVFResourceLoader::responseReceived):
802         * platform/network/ios/WebCoreURLResponseIOS.mm:
803         (WebCore::adjustMIMETypeIfNecessary):
804         * platform/network/mac/WebCoreURLResponse.mm:
805         (WebCore::adjustMIMETypeIfNecessary):
806         * rendering/RenderThemeIOS.mm:
807         (WebCore::iconForAttachment):
808         * rendering/RenderThemeMac.mm:
809         (WebCore::iconForAttachment):
810         Deal with the fact that UTI utilities deal in Strings now.
811
812         * platform/network/mac/UTIUtilities.h:
813         * platform/network/mac/UTIUtilities.mm:
814         (WebCore::MIMETypeFromUTI):
815         Added. This doesn't crawl up the UTI tree if the first conversion fails,
816         which is what most of the existing code does. It's possible we want to
817         use MIMETypeFromUTITree's logic everywhere, but I didn't want to change
818         that in this patch.
819
820         (WebCore::MIMETypeFromUTITree):
821         (WebCore::isDeclaredUTI):
822         Take and return strings.
823
824         (WebCore::UTIFromMIMETypeCachePolicy::createValueForKey):
825         (WebCore::UTIFromMIMEType):
826         Add the aforementioned cache.
827
828 2017-08-16  Simon Fraser  <simon.fraser@apple.com>
829
830         Make RenderLayer and RenderLayerBacking TextStream-loggable, and clean up compositing logging
831         https://bugs.webkit.org/show_bug.cgi?id=175634
832
833         Reviewed by Zalan Bujtas.
834
835         Add operator<<(TextStream&) for RenderLayer and RenderLayer backing, and use them for compositing logging.
836
837         Convert CompositingUpdateType to an enum class.
838
839         * page/FrameView.cpp:
840         (WebCore::FrameView::updateCompositingLayersAfterLayout):
841         (WebCore::FrameView::updateCompositingLayersAfterScrolling):
842         * page/ios/FrameIOS.mm:
843         (WebCore::Frame::viewportOffsetChanged):
844         * rendering/RenderLayer.cpp:
845         (WebCore::RenderLayer::updateLayerPositionsAfterLayout):
846         (WebCore::RenderLayer::updateCompositingLayersAfterScroll):
847         (WebCore::RenderLayer::calculateClipRects const):
848         * rendering/RenderLayer.h:
849         * rendering/RenderLayerBacking.cpp:
850         (WebCore::RenderLayerBacking::updateAfterLayout):
851         (WebCore::RenderLayerBacking::updateGeometry):
852         (WebCore::operator<<):
853         * rendering/RenderLayerBacking.h:
854         * rendering/RenderLayerCompositor.cpp:
855         (WebCore::RenderLayerCompositor::didRecalcStyleWithNoPendingLayout):
856         (WebCore::RenderLayerCompositor::flushPendingLayerChanges):
857         (WebCore::RenderLayerCompositor::updateCompositingLayersTimerFired):
858         (WebCore::RenderLayerCompositor::updateCompositingLayers):
859         (WebCore::RenderLayerCompositor::layerTreeAsText):
860         (WebCore::operator<<):
861         * rendering/RenderLayerCompositor.h:
862
863 2017-08-16  Eric Carlson  <eric.carlson@apple.com>
864
865         Consider allow gUM to be called from localhost without https
866         https://bugs.webkit.org/show_bug.cgi?id=173457
867         <rdar://problem/33900527>
868
869         Reviewed by Youenn Fablet.
870
871         Tests: http/tests/media/media-stream/get-user-media-localhost.html
872                http/tests/media/media-stream/get-user-media-loopback-ip.html
873
874         * Modules/mediastream/UserMediaRequest.cpp:
875         (WebCore::isSecure): Call SchemeRegistry::shouldTreatURLSchemeAsSecure instead of looking for
876         the string 'https'.
877         (WebCore::canCallGetUserMedia): Allow localhost or loopback address.
878
879         * page/SecurityOrigin.cpp:
880         (WebCore::isLoopbackIPAddress): Add a comment.
881         (WebCore::shouldTreatAsPotentionallyTrustworthy): Move tests for localhost and loopback address
882         to isLocalHostOrLoopbackIPAddress, call it.
883         (WebCore::SecurityOrigin::isLocalHostOrLoopbackIPAddress): 
884         * page/SecurityOrigin.h:
885
886 2017-08-16  Chris Dumez  <cdumez@apple.com>
887
888         EventSource: ignore IDs with U+0000
889         https://bugs.webkit.org/show_bug.cgi?id=175178
890
891         Reviewed by Darin Adler.
892
893         EventSource: ignore IDs with U+0000 as per:
894         https://github.com/whatwg/html/pull/2849
895
896         Test: imported/w3c/web-platform-tests/eventsource/format-field-id-null.htm
897
898         * page/EventSource.cpp:
899         (WebCore::EventSource::parseEventStreamLine):
900
901 2017-08-16  Fujii Hironori  <Hironori.Fujii@sony.com>
902
903         [HarfBuzz] Decomposed Vietnamese characters are rendered incorrectly
904         https://bugs.webkit.org/show_bug.cgi?id=174418
905
906         Reviewed by Michael Catanzaro.
907
908         HarfBuzzShaper should normalize the input text before collecting
909         HarfBuzzRuns. Actually, HarfBuzzShaper::setNormalizedBuffer does
910         the task. But, this function hasn't been called from anywhere
911         since Bug 90951.
912
913         Test: fast/text/international/vietnamese-nfd.html
914               imported/blink/fast/text/international/text-shaping-arabic-diffs.html
915
916         * platform/graphics/harfbuzz/HarfBuzzShaper.cpp:
917         (WebCore::HarfBuzzShaper::HarfBuzzShaper):
918         Call setNormalizedBuffer instead of normalizeCharacters.
919         (WebCore::normalizeCharacters): Deleted.
920         (WebCore::normalizeSpacesAndMirrorChars) Use
921         FontCascade::treatAsZeroWidthSpaceInComplexScript instead of
922         FontCascade::treatAsZeroWidthSpace to preserve ZWJ and ZWNJ.
923
924 2017-08-16  Antti Koivisto  <antti@apple.com>
925
926         Move first-letter renderer mutation code out of RenderBlock and into RenderTreeUpdater
927         https://bugs.webkit.org/show_bug.cgi?id=175627
928
929         Reviewed by Andreas Kling.
930
931         Render tree should not mutate itself. We already fixed this for first-letter, supporting code
932         can now move to RenderTreeUpdater too.
933
934         * CMakeLists.txt:
935         * WebCore.xcodeproj/project.pbxproj:
936         * rendering/RenderBlock.cpp:
937         (WebCore::styleForFirstLetter): Deleted.
938         (WebCore::isPunctuationForFirstLetter): Deleted.
939         (WebCore::shouldSkipForFirstLetter): Deleted.
940         (WebCore::RenderBlock::updateFirstLetterStyle): Deleted.
941         (WebCore::RenderBlock::createFirstLetterRenderer): Deleted.
942         (WebCore::RenderBlock::updateFirstLetter): Deleted.
943         * rendering/RenderBlock.h:
944         * rendering/RenderRubyRun.cpp:
945         (WebCore::RenderRubyRun::updateFirstLetter): Deleted.
946         * rendering/RenderRubyRun.h:
947         * rendering/RenderTable.cpp:
948         (WebCore::RenderTable::updateFirstLetter): Deleted.
949         * rendering/RenderTable.h:
950
951             Virtual overrides just disabled first letter for some RenderBlock subclasses. This is now achieved via
952             supportsFirstLetter test in the first letter updater.
953
954         * rendering/TextAutoSizing.cpp:
955         (WebCore::TextAutoSizingValue::adjustTextNodeSizes):
956         * rendering/svg/RenderSVGText.cpp:
957         (WebCore::RenderSVGText::updateFirstLetter): Deleted.
958         * rendering/svg/RenderSVGText.h:
959         * style/RenderTreeUpdater.cpp:
960         (WebCore::RenderTreeUpdater::popParent):
961         * style/RenderTreeUpdater.h:
962         * style/RenderTreeUpdaterFirstLetter.cpp: Added.
963         (WebCore::styleForFirstLetter):
964         (WebCore::isPunctuationForFirstLetter):
965         (WebCore::shouldSkipForFirstLetter):
966         (WebCore::updateFirstLetterStyle):
967         (WebCore::createFirstLetterRenderer):
968         (WebCore::supportsFirstLetter):
969         (WebCore::RenderTreeUpdater::FirstLetter::update):
970         * style/RenderTreeUpdaterFirstLetter.h: Added.
971
972 2017-08-16  Xabier Rodriguez Calvar  <calvaris@igalia.com>
973
974         [GStreamer][EME] Rework handling key systems and UUIDs
975         https://bugs.webkit.org/show_bug.cgi?id=175567
976
977         Reviewed by Žan Doberšek.
978
979         The UUIDs and key system strings were moved to the
980         GStreamerEMEUtilities class because so far they were managed by
981         the decryptors and that was ugly.
982
983         * platform/GStreamer.cmake:
984         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp:
985         (WebCore::MediaPlayerPrivateGStreamerBase::supportsKeySystem):
986         * platform/graphics/gstreamer/eme/GStreamerEMEUtilities.cpp: Added.
987         * platform/graphics/gstreamer/eme/GStreamerEMEUtilities.h: Added.
988         (WebCore::GStreamerEMEUtilities::isClearKeyKeySystem):
989         (WebCore::GStreamerEMEUtilities::keySystemToUuid):
990         * platform/graphics/gstreamer/eme/WebKitClearKeyDecryptorGStreamer.cpp:
991         (webkit_media_clear_key_decrypt_class_init):
992         * platform/graphics/gstreamer/eme/WebKitClearKeyDecryptorGStreamer.h:
993
994 2017-08-16  Andy Estes  <aestes@apple.com>
995
996         [Payment Request] Add an ENABLE flag and an experimental feature preference
997         https://bugs.webkit.org/show_bug.cgi?id=175622
998
999         Reviewed by Tim Horton.
1000
1001         * Configurations/FeatureDefines.xcconfig:
1002         * page/Settings.in:
1003
1004 2017-08-15  Ryosuke Niwa  <rniwa@webkit.org>
1005
1006         Make DataTransferItemList work with plain text entries
1007         https://bugs.webkit.org/show_bug.cgi?id=175596
1008
1009         Reviewed by Wenson Hsieh.
1010
1011         Added the basic machinery to get the list of plain text items to DataTransferItemList and DataTransferItem.
1012
1013         Each DataTransferItem now depends on DataTransfer so it does ref-forwarding like DataTransferItemList to make
1014         DataTransfer alive as long as any DataTransferItem is alive.
1015
1016         Specifications: https://html.spec.whatwg.org/multipage/dnd.html#the-datatransferitem-interface
1017                         https://html.spec.whatwg.org/multipage/dnd.html#the-datatransferitemlist-interface
1018
1019         Tests: editing/pasteboard/datatransfer-items-drop-plaintext-file.html
1020                editing/pasteboard/datatransfer-items-paste-plaintext.html
1021
1022         * dom/DataTransferItem.cpp:
1023         (WebCore::DataTransferItem::DataTransferItem): Added two variants one for plain text and another one for a file.
1024         (WebCore::DataTransferItem::kind const): Rewritten.
1025         (WebCore::DataTransferItem::getAsString const): Implemented.
1026         (WebCore::DataTransferItem::getAsFile const): Implemented.
1027         * dom/DataTransferItem.h:
1028         (WebCore::DataTransferItem::ref): Added.
1029         (WebCore::DataTransferItem::deref): Added.
1030         (WebCore::DataTransferItem::type const): Returns String instead of AtomicString.
1031         (WebCore::DataTransferItem::kind const): Moved to cpp.
1032         * dom/DataTransferItem.idl: Removed NoInterfaceObject since the interface object should exist on DOMWindow.
1033         * dom/DataTransferItemList.cpp:
1034         (WebCore::DataTransferItemList::length): Implemented.
1035         (WebCore::DataTransferItemList::item): Ditto.
1036         (WebCore::isSupportedType): Added. For now, we only support text/plain.
1037         (WebCore::DataTransferItemList::ensureItems): Added. Constructs the list of DataTransferItems.
1038         * dom/DataTransferItemList.h:
1039         (DataTransferItemList): Added m_items. The list is filled lazily by ensureItems.
1040         * dom/DataTransferItemList.idl: Removed NoInterfaceObject since the interface object should exist on DOMWindow.
1041
1042 2017-08-15  Simon Fraser  <simon.fraser@apple.com>
1043
1044         Remove ScrollView::clipsRepaints() which was only used by Chromium
1045         https://bugs.webkit.org/show_bug.cgi?id=175594
1046
1047         Reviewed by Tim Horton.
1048
1049         clipsRepaints() was added in r74568 but was only used by Chromium. It's always
1050         true for other platforms, so remove conditionals that test for it and assume true.
1051
1052         * page/FrameView.cpp:
1053         (WebCore::FrameView::scrollContentsFastPath):
1054         * platform/ScrollView.cpp:
1055         (WebCore::ScrollView::repaintContentRectangle):
1056         (WebCore::ScrollView::setClipsRepaints): Deleted.
1057         * platform/ScrollView.h:
1058         (WebCore::ScrollView::clipsRepaints const): Deleted.
1059
1060 2017-08-15  Simon Fraser  <simon.fraser@apple.com>
1061
1062         Allow WebCore logging channels to be set from the UI process
1063         https://bugs.webkit.org/show_bug.cgi?id=175608
1064
1065         Reviewed by Tim Horton.
1066
1067         Change initializeLogChannelsIfNecessary() to take an optional String, which can
1068         be a list of log channels passed from the UI process.
1069
1070         * platform/LogInitialization.h:
1071         * platform/Logging.cpp:
1072         (WebCore::initializeLogChannelsIfNecessary):
1073
1074 2017-08-15  Chris Dumez  <cdumez@apple.com>
1075
1076         Fetch / Beacon: Use "application/octet-stream" Content-Type for payloads of type ArrayBuffer / ArrayBufferView
1077         https://bugs.webkit.org/show_bug.cgi?id=175600
1078
1079         Reviewed by Youenn Fablet.
1080
1081         Use "application/octet-stream" Content-Type for payloads of type ArrayBuffer / ArrayBufferView in Fetch & Beacon.
1082         If we don't set a Content-Type header, our underlying network stack is going to add a "application/x-www-form-urlencoded"
1083         Content-Type header, which is worse.
1084
1085         Chrome is already using "application/octet-stream" Content-Type in Beacon, but use no Content-Type in Fetch.
1086         The Fetch/Beacon specification says we should have no Content-Type header in this case but this is unfortunately
1087         not something we can support at the moment. Using "application/octet-stream" Content-Type for now seems like the
1088         lesser evil.
1089
1090         Test: http/wpt/fetch/fetch-request-arraybuffer-content-type.html
1091
1092         * Modules/fetch/FetchBody.cpp:
1093         (WebCore::FetchBody::extract):
1094         * platform/network/HTTPHeaderValues.cpp:
1095         (WebCore::HTTPHeaderValues::octetStreamContentType):
1096         * platform/network/HTTPHeaderValues.h:
1097
1098 2017-08-15  Robin Morisset  <rmorisset@apple.com>
1099
1100         Change the order of arguments of JSWithScope::create() for consistency
1101         https://bugs.webkit.org/show_bug.cgi?id=175585
1102
1103         Reviewed by Saam Barati.
1104
1105         No change of behavior.
1106
1107         * bindings/js/JSHTMLElementCustom.cpp:
1108         (WebCore::JSHTMLElement::pushEventHandlerScope const):
1109
1110 2017-08-15  Youenn Fablet  <youenn@apple.com>
1111
1112         [Cache API] Ensure ResourceResponse is not null when redirected/tainting/type fields are set
1113         https://bugs.webkit.org/show_bug.cgi?id=175538
1114
1115         Reviewed by Chris Dumez.
1116
1117         No change of behavior.
1118         This change ensures that response type is preserved when encoding/decoding ResourceResponse, in particular the error type.
1119         This will allow Cache API to preserve responses when reading them from a different process.
1120
1121         * platform/network/ResourceResponseBase.cpp:
1122         (WebCore::ResourceResponseBase::setType):
1123         * platform/network/ResourceResponseBase.h:
1124         (WebCore::ResourceResponseBase::setType):
1125
1126 2017-08-15  Chris Dumez  <cdumez@apple.com>
1127
1128         Update CachedResourceLoader::requestResource() to return a WTF::Expected
1129         https://bugs.webkit.org/show_bug.cgi?id=175505
1130
1131         Reviewed by Youenn Fablet.
1132
1133         Update CachedResourceLoader::requestResource() to return a WTF::Expected
1134         type instead of using an out parameter for the ResourceError in case of
1135         synchronous failure.
1136
1137         * Modules/beacon/NavigatorBeacon.cpp:
1138         (WebCore::NavigatorBeacon::sendBeacon):
1139         * bindings/js/CachedScriptFetcher.cpp:
1140         (WebCore::CachedScriptFetcher::requestScriptWithCache const):
1141         * css/CSSFontFaceSrcValue.cpp:
1142         (WebCore::CSSFontFaceSrcValue::cachedFont):
1143         * css/CSSImageSetValue.cpp:
1144         (WebCore::CSSImageSetValue::loadBestFitImage):
1145         * css/CSSImageValue.cpp:
1146         (WebCore::CSSImageValue::loadImage):
1147         * css/StyleRuleImport.cpp:
1148         (WebCore::StyleRuleImport::requestStyleSheet):
1149         * dom/ProcessingInstruction.cpp:
1150         (WebCore::ProcessingInstruction::checkStyleSheet):
1151         * html/HTMLLinkElement.cpp:
1152         (WebCore::HTMLLinkElement::process):
1153         * loader/CrossOriginPreflightChecker.cpp:
1154         (WebCore::CrossOriginPreflightChecker::startPreflight):
1155         * loader/DocumentLoader.cpp:
1156         (WebCore::DocumentLoader::startLoadingMainResource):
1157         * loader/DocumentThreadableLoader.cpp:
1158         (WebCore::DocumentThreadableLoader::loadRequest):
1159         * loader/FrameLoader.cpp:
1160         (WebCore::FrameLoader::loadedResourceFromMemoryCache):
1161         * loader/FrameLoader.h:
1162         * loader/ImageLoader.cpp:
1163         (WebCore::ImageLoader::updateFromElement):
1164         * loader/LinkLoader.cpp:
1165         (WebCore::LinkLoader::preloadIfNeeded):
1166         * loader/MediaResourceLoader.cpp:
1167         (WebCore::MediaResourceLoader::requestResource):
1168         * loader/TextTrackLoader.cpp:
1169         (WebCore::TextTrackLoader::load):
1170         * loader/cache/CachedResourceLoader.cpp:
1171         (WebCore::castCachedResourceTo):
1172         (WebCore::CachedResourceLoader::requestImage):
1173         (WebCore::CachedResourceLoader::requestFont):
1174         (WebCore::CachedResourceLoader::requestTextTrack):
1175         (WebCore::CachedResourceLoader::requestCSSStyleSheet):
1176         (WebCore::CachedResourceLoader::requestUserCSSStyleSheet):
1177         (WebCore::CachedResourceLoader::requestScript):
1178         (WebCore::CachedResourceLoader::requestXSLStyleSheet):
1179         (WebCore::CachedResourceLoader::requestSVGDocument):
1180         (WebCore::CachedResourceLoader::requestLinkResource):
1181         (WebCore::CachedResourceLoader::requestMedia):
1182         (WebCore::CachedResourceLoader::requestIcon):
1183         (WebCore::CachedResourceLoader::requestRawResource):
1184         (WebCore::CachedResourceLoader::requestBeaconResource):
1185         (WebCore::CachedResourceLoader::requestMainResource):
1186         (WebCore::CachedResourceLoader::shouldContinueAfterNotifyingLoadedFromMemoryCache):
1187         (WebCore::CachedResourceLoader::requestResource):
1188         (WebCore::CachedResourceLoader::preload):
1189         * loader/cache/CachedResourceLoader.h:
1190         * loader/cache/CachedSVGDocumentReference.cpp:
1191         (WebCore::CachedSVGDocumentReference::load):
1192         * loader/icon/IconLoader.cpp:
1193         (WebCore::IconLoader::startLoading):
1194         * platform/graphics/avfoundation/objc/WebCoreAVFResourceLoader.mm:
1195         (WebCore::WebCoreAVFResourceLoader::startLoading):
1196         * svg/SVGFEImageElement.cpp:
1197         (WebCore::SVGFEImageElement::requestImageResource):
1198         * svg/SVGFontFaceUriElement.cpp:
1199         (WebCore::SVGFontFaceUriElement::loadFont):
1200         * svg/SVGUseElement.cpp:
1201         (WebCore::SVGUseElement::updateExternalDocument):
1202         * xml/XSLImportRule.cpp:
1203         (WebCore::XSLImportRule::loadSheet):
1204
1205 2017-08-15  Don Olmstead  <don.olmstead@sony.com>
1206
1207         [PAL] Move Sleep classes into PAL
1208         https://bugs.webkit.org/show_bug.cgi?id=175456
1209
1210         Reviewed by Ryosuke Niwa.
1211
1212         No new tests. No change in behavior.
1213
1214         * CMakeLists.txt:
1215         * PlatformMac.cmake:
1216         * WebCore.xcodeproj/project.pbxproj:
1217         * html/HTMLMediaElement.cpp:
1218         * html/HTMLMediaElement.h:
1219         * platform/audio/PlatformMediaSessionManager.cpp:
1220         * platform/audio/PlatformMediaSessionManager.h:
1221         * platform/mac/WebVideoFullscreenController.h:
1222         * platform/mac/WebVideoFullscreenController.mm:
1223
1224 2017-08-15  Youenn Fablet  <youenn@apple.com>
1225
1226         [Cache API] Adding generic support for CacheStorage and Cache methods
1227         https://bugs.webkit.org/show_bug.cgi?id=175455
1228
1229         Reviewed by Chris Dumez.
1230
1231         Covered by existing tests.
1232
1233         Adding a CacheStorageProvider abstraction that creates a CacheStorageConnection.
1234         The CacheStorageProvider is accessed from the page for Document calls.
1235         The CacheStorageConnection is responsible to implement the read/write operations on the cache database.
1236         At the moment, it does nothing but return not implemented errors.
1237
1238         Implementing CacheStorage APIs and Cache APIs based on the CacheStorageConnection except for Cache add and addAll which will be implemented later on.
1239         CacheStoragConnection is responsible to read/write CacheStorage list of caches and each individual cache.
1240         The CacheStorageConnection is a generic connection and not tied to any document/context.
1241         CacheStorage objects are manipulated by providing to the connection the origin of the context.
1242         CacheStorage are global to all contexts with the same origin.
1243         Cache objects are manipulated by an ID that is given initially by the CacheStorageEngine when opening the Cache object.
1244
1245         Adding various accessors and constructors for Fetch constructs as needed by the Cache API implementation.
1246
1247         * Modules/cache/Cache.cpp:
1248         (WebCore::Cache::Cache):
1249         (WebCore::Cache::~Cache):
1250         The CacheStorageConnection is a generic connection and not tied to any document/context.
1251         (WebCore::Cache::match): Implementation of https://www.w3.org/TR/service-workers-1/#cache-match.
1252         Redirect to matchAll as per spec.
1253         (WebCore::Cache::matchAll): Implementation of https://www.w3.org/TR/service-workers-1/#cache-matchAll.
1254         Checks for request as per spec. Then either refresh the request to response map and return all responses.
1255         Or call the query cache algorithm and return copies of the responses (using clone).
1256         (WebCore::Cache::put):
1257         Check the request and response as per spec.
1258         Add temporary rejection cases (being loaded responses, responses with ReadableStream) as there is no support for them right now.
1259         Call the batch put operation.
1260         (WebCore::Cache::remove):
1261         Check the request and response as per spec.
1262         Call the batch delete operation.
1263         (WebCore::Cache::keys):
1264         Refresh the request to response map and return corresponding requests.
1265         Making sure to reuse the same request objects as per spec.
1266         As per spec, the request to response map is ordered. We implement it as a Vector.
1267         (WebCore::Cache::refreshRequestToResponseMap):
1268         Use the cache storage connection to get an up-to-date list of cached records.
1269         (WebCore::Cache::queryCacheMatch):
1270         Implements the match algorithm defined in https://www.w3.org/TR/service-workers-1/#query-cache-algorithm.
1271         This is split for queryCache as cache storage engine will need to use it when implementing the delete operation.
1272         (WebCore::Cache::queryCache):
1273         Full implementation of https://www.w3.org/TR/service-workers-1/#query-cache-algorithm with no targetStorage argument.
1274         (WebCore::Cache::queryCacheWithTargetStorage):
1275         Full implementation of https://www.w3.org/TR/service-workers-1/#query-cache-algorithm with a provided targetStorage argument.
1276         (WebCore::Cache::batchDeleteOperation):
1277         Implementation of https://www.w3.org/TR/service-workers-1/#batch-cache-operations-algorithm but dedicated to a delete operation.
1278         Delete operation are always done one at a time.
1279         (WebCore::Cache::batchPutOperation):
1280         Implementation of https://www.w3.org/TR/service-workers-1/#batch-cache-operations-algorithm dedicated to a put operation.
1281         Put operation takes one record for put but can take several records in the case of addAll, hence the current design.
1282         (WebCore::Cache::updateRequestToResponseMap):
1283         Update the cache request to response map based on the records retrieved from the cache storage connection.
1284         * Modules/cache/Cache.h:
1285         (WebCore::Cache::create):
1286         (WebCore::Cache::name const):
1287         * Modules/cache/Cache.idl:
1288         * Modules/cache/CacheStorage.cpp:
1289         (WebCore::CacheStorage::origin const):
1290         Computing the cache origin that is passed to the CacheStorageConnection.
1291         (WebCore::CacheStorage::has):
1292         Implementation of https://www.w3.org/TR/service-workers-1/#cache-storage-has.
1293         Call the cache storage connection to refresh its cache map.
1294         Then use it to check whether a cache exists.
1295         (WebCore::CacheStorage::refreshCacheMap):
1296         Use the cache storage connection to get the list of existing caches.
1297         (WebCore::CacheStorage::open):
1298         Implementation of https://www.w3.org/TR/service-workers-1/#cache-storage-open.
1299         Refreshing the cache map so as to return a pre-existing cache if any.
1300         (WebCore::CacheStorage::remove):
1301         Implementation of https://www.w3.org/TR/service-workers-1/#cache-storage-delete-method.
1302         Refreshing the cache map so as to do nothing if there is no cache to remove.
1303         (WebCore::CacheStorage::keys):
1304         Implementation of https://www.w3.org/TR/service-workers-1/#cache-storage-keys-method.
1305         Refreshing the cache map and returnin its keys.
1306         As per spec, the cache map is ordered. We implement it as a Vector.
1307         (WebCore::CacheStorage::cacheMap):
1308         Get the list of cache objects, used as a private accessor for JS built-ins.
1309         * Modules/cache/CacheStorage.h:
1310         (WebCore::CacheStorage::create):
1311         (WebCore::CacheStorage::CacheStorage):
1312         * Modules/cache/CacheStorageConnection.cpp: Added.
1313         (WebCore::CacheStorageConnection::exceptionFromError):
1314         * Modules/cache/CacheStorageConnection.h: Added.
1315         Makes the link between Web facing Cache API and the cache storage engine.
1316         Envisioned implementation are:
1317         - One main thread connection used by all documents in the given process.
1318         - One connection per worker that forwards the calls to the main thread and use the main thread connection afterwards.
1319         (WebCore::CacheStorageConnection::create):
1320         (WebCore::CacheStorageConnection::open):
1321         (WebCore::CacheStorageConnection::remove):
1322         (WebCore::CacheStorageConnection::refreshCacheMap):
1323         (WebCore::CacheStorageConnection::refreshRequestToResponseMap):
1324         (WebCore::CacheStorageConnection::batchDeleteOperation):
1325         (WebCore::CacheStorageConnection::batchPutOperation):
1326         * Modules/cache/CacheStorageRecord.h: Added. A fetch record from the Web facing cache API perspective.
1327         * Modules/cache/DOMWindowCaches.cpp:
1328         (WebCore::DOMWindowCaches::caches const):
1329         * Modules/cache/WorkerGlobalScopeCaches.cpp:
1330         (WebCore::WorkerGlobalScopeCaches::from):
1331         (WebCore::WorkerGlobalScopeCaches::caches const):
1332         * Modules/cache/WorkerGlobalScopeCaches.h:
1333         (WebCore::WorkerGlobalScopeCaches::WorkerGlobalScopeCaches):
1334         * Modules/fetch/FetchBodyOwner.h:
1335         (WebCore::FetchBodyOwner::isReadableStreamBody const): Added getter as it is used by cache API.
1336         * Modules/fetch/FetchHeaders.h:
1337         (WebCore::FetchHeaders::create): Add another create as used by the cache API.
1338         (WebCore::FetchHeaders::guard const): Added getter and IPC serializer as this is something that will be stored by the cache engine.
1339         * Modules/fetch/FetchLoader.cpp:
1340         (WebCore::FetchLoader::start):
1341         * Modules/fetch/FetchRequest.cpp:
1342         (WebCore::buildOptions): In case FetchRequest::create is called from C++, there is no need to set init.window to a null value.
1343         Add a check so that no value at all is the same as a null/undefined value.
1344         (WebCore::FetchRequest::resourceRequest const):
1345         * Modules/fetch/FetchRequest.h:
1346         * Modules/fetch/FetchResponse.h:
1347         * WebCore.xcodeproj/project.pbxproj:
1348         * inspector/InspectorOverlay.cpp:
1349         (WebCore::InspectorOverlay::overlayPage):
1350         * page/CacheStorageProvider.h: Added.
1351         Interface to create main thread cache storage connection for the given page.
1352         There will be one provider for each process.
1353         Passing a sessionID so that we will create a connection per session.
1354         * page/Page.cpp:
1355         (WebCore::Page::Page):
1356         * page/Page.h:
1357         (WebCore::Page::cacheStorageProvider):
1358         * page/PageConfiguration.cpp:
1359         (WebCore::PageConfiguration::PageConfiguration):
1360         * page/PageConfiguration.h:
1361         * svg/graphics/SVGImage.cpp:
1362         (WebCore::SVGImage::dataChanged):
1363
1364 2017-08-15  Chris Dumez  <cdumez@apple.com>
1365
1366         Implement quota limitation for keepalive Fetch requests
1367         https://bugs.webkit.org/show_bug.cgi?id=175482
1368
1369         Reviewed by Sam Weinig and Youenn Fablet.
1370
1371         Implement quota limitation for keepalive Fetch requests as per:
1372         - https://fetch.spec.whatwg.org/#http-network-or-cache-fetch (Step 9)
1373
1374         This partly works for Beacon as well, meaning that no Beacon with a body
1375         over 64Kb can be sent. However, we don't keep track about wether or not
1376         beacon loads are inflight or not.
1377
1378         Also update CachedResourceLoader::requestResource() so that the caller
1379         can get a ResourceError when it returns null. This is useful for both
1380         Fetch and Beacon to return better error messages.
1381
1382         Test: http/wpt/beacon/beacon-quota.html
1383
1384         * CMakeLists.txt:
1385         * Modules/beacon/NavigatorBeacon.cpp:
1386         (WebCore::NavigatorBeacon::sendBeacon):
1387         * Modules/fetch/FetchBodyOwner.cpp:
1388         (WebCore::FetchBodyOwner::BlobLoader::didReceiveResponse):
1389         (WebCore::FetchBodyOwner::BlobLoader::didFail):
1390         * Modules/fetch/FetchBodyOwner.h:
1391         * Modules/fetch/FetchLoader.cpp:
1392         (WebCore::FetchLoader::start):
1393         (WebCore::FetchLoader::didFail):
1394         * Modules/fetch/FetchLoaderClient.h:
1395         * Modules/fetch/FetchResponse.cpp:
1396         (WebCore::FetchResponse::BodyLoader::didFail):
1397         * Modules/fetch/FetchResponse.h:
1398         * WebCore.xcodeproj/project.pbxproj:
1399         * loader/DocumentThreadableLoader.cpp:
1400         (WebCore::DocumentThreadableLoader::loadRequest):
1401         * loader/cache/CachedResource.cpp:
1402         (WebCore::CachedResource::load):
1403         * loader/cache/CachedResource.h:
1404         (WebCore::CachedResource::isMainOrMediaOrIconOrRawResource const):
1405         * loader/cache/CachedResourceLoader.cpp:
1406         (WebCore::createResource):
1407         (WebCore::CachedResourceLoader::requestImage):
1408         (WebCore::CachedResourceLoader::requestFont):
1409         (WebCore::CachedResourceLoader::requestTextTrack):
1410         (WebCore::CachedResourceLoader::requestCSSStyleSheet):
1411         (WebCore::CachedResourceLoader::requestUserCSSStyleSheet):
1412         (WebCore::CachedResourceLoader::requestScript):
1413         (WebCore::CachedResourceLoader::requestXSLStyleSheet):
1414         (WebCore::CachedResourceLoader::requestSVGDocument):
1415         (WebCore::CachedResourceLoader::requestLinkResource):
1416         (WebCore::CachedResourceLoader::requestMedia):
1417         (WebCore::CachedResourceLoader::requestIcon):
1418         (WebCore::CachedResourceLoader::requestRawResource):
1419         (WebCore::CachedResourceLoader::requestBeaconResource):
1420         (WebCore::CachedResourceLoader::requestMainResource):
1421         (WebCore::CachedResourceLoader::requestResource):
1422         (WebCore::CachedResourceLoader::preload):
1423         * loader/cache/CachedResourceLoader.h:
1424         * loader/cache/KeepaliveRequestTracker.cpp: Added.
1425         (WebCore::KeepaliveRequestTracker::~KeepaliveRequestTracker):
1426         (WebCore::KeepaliveRequestTracker::canLoadRequest):
1427         (WebCore::KeepaliveRequestTracker::registerRequest):
1428         (WebCore::KeepaliveRequestTracker::responseReceived):
1429         (WebCore::KeepaliveRequestTracker::notifyFinished):
1430         (WebCore::KeepaliveRequestTracker::unregisterRequest):
1431         * loader/cache/KeepaliveRequestTracker.h: Added.
1432         * platform/network/FormData.cpp:
1433         (WebCore::FormDataElement::lengthInBytes const):
1434         (WebCore::FormData::lengthInBytes const):
1435         * platform/network/FormData.h:
1436
1437 2017-08-15  Darin Adler  <darin@apple.com>
1438
1439         REGRESSION(r220052): http/tests/appcache/deferred-events-delete-while-raising-timer.html is crashing.
1440         https://bugs.webkit.org/show_bug.cgi?id=175107
1441
1442         Reviewed by Alexey Proskuryakov.
1443
1444         * loader/FrameLoader.cpp:
1445         (WebCore::FrameLoader::checkLoadComplete): Moved the assertion to after the null page check.
1446
1447 2017-08-15  Commit Queue  <commit-queue@webkit.org>
1448
1449         Unreviewed, rolling out r219504.
1450         https://bugs.webkit.org/show_bug.cgi?id=175580
1451
1452         Broke Arabic text shaping (Requested by mcatanzaro on
1453         #webkit).
1454
1455         Reverted changeset:
1456
1457         "[HarfBuzz] Decomposed Vietnamese characters are rendered
1458         incorrectly"
1459         https://bugs.webkit.org/show_bug.cgi?id=174418
1460         http://trac.webkit.org/changeset/219504
1461
1462 2017-08-14  Carlos Garcia Campos  <cgarcia@igalia.com>
1463
1464         WebDriver: handle click events on option elements
1465         https://bugs.webkit.org/show_bug.cgi?id=174710
1466         <rdar://problem/33459305>
1467
1468         Reviewed by Brian Burg.
1469
1470         Export WebCore symbols required by WebKit layer.
1471
1472         * html/HTMLOptGroupElement.h:
1473         * html/HTMLOptionElement.h:
1474
1475 2017-08-14  Simon Fraser  <simon.fraser@apple.com>
1476
1477         Remove Proximity Events and related code
1478         https://bugs.webkit.org/show_bug.cgi?id=175545
1479
1480         Reviewed by Daniel Bates.
1481
1482         No platform enables Proximity Events, so remove code inside ENABLE(PROXIMITY_EVENTS)
1483         and other related code.
1484
1485         * CMakeLists.txt:
1486         * Configurations/FeatureDefines.xcconfig:
1487         * DerivedSources.cpp:
1488         * Modules/proximity/DeviceProximityClient.h: Removed.
1489         * Modules/proximity/DeviceProximityController.cpp: Removed.
1490         * Modules/proximity/DeviceProximityController.h: Removed.
1491         * Modules/proximity/DeviceProximityEvent.cpp: Removed.
1492         * Modules/proximity/DeviceProximityEvent.h: Removed.
1493         * Modules/proximity/DeviceProximityEvent.idl: Removed.
1494         * dom/EventNames.h:
1495         * dom/EventNames.in:
1496         * history/PageCache.cpp:
1497         (WebCore::canCachePage):
1498         * page/DOMWindow.cpp:
1499         (WebCore::DOMWindow::addEventListener):
1500         (WebCore::DOMWindow::removeEventListener):
1501         (WebCore::DOMWindow::removeAllEventListeners):
1502         * page/DOMWindow.idl:
1503         * page/DiagnosticLoggingKeys.cpp:
1504         (WebCore::DiagnosticLoggingKeys::deviceProximityKey): Deleted.
1505         * page/DiagnosticLoggingKeys.h:
1506         * testing/Internals.cpp:
1507         (WebCore::Internals::setDeviceProximity): Deleted.
1508         * testing/Internals.h:
1509         * testing/Internals.idl:
1510
1511 2017-08-14  Simon Fraser  <simon.fraser@apple.com>
1512
1513         Remove ENABLE(REQUEST_AUTOCOMPLETE) code, which was disabled everywhere
1514         https://bugs.webkit.org/show_bug.cgi?id=175504
1515
1516         Reviewed by Sam Weinig.
1517         
1518         REQUEST_AUTOCOMPLETE was added in r133396 then removed in r148731, but brought back in r173596,
1519         however no further work was done, and it was left disabled. So remove the code.
1520
1521         * Configurations/FeatureDefines.xcconfig:
1522         * DerivedSources.make:
1523         * WebCore.xcodeproj/project.pbxproj:
1524         * dom/AutocompleteErrorEvent.h: Removed.
1525         * dom/AutocompleteErrorEvent.idl: Removed.
1526         * dom/EventNames.in:
1527         * dom/GlobalEventHandlers.idl:
1528         * html/HTMLFormElement.cpp:
1529         (WebCore::HTMLFormElement::HTMLFormElement):
1530         (WebCore::HTMLFormElement::requestAutocomplete): Deleted.
1531         (WebCore::HTMLFormElement::finishRequestAutocomplete): Deleted.
1532         (WebCore::HTMLFormElement::requestAutocompleteTimerFired): Deleted.
1533         * html/HTMLFormElement.h:
1534         * html/HTMLFormElement.idl:
1535         * loader/EmptyClients.cpp:
1536         * loader/FrameLoaderClient.h:
1537
1538 2017-08-14  Chris Dumez  <cdumez@apple.com>
1539
1540         XHR should only fire an abort event if the cancellation was requested by the client
1541         https://bugs.webkit.org/show_bug.cgi?id=175546
1542
1543         Reviewed by Youenn Fablet.
1544
1545         XHR should only fire an abort event if the cancellation was requested by the client, otherwise it should fire an error event.
1546         Blink and Gecko already match the specification.
1547
1548         Specification:
1549         - https://xhr.spec.whatwg.org/#handle-errors
1550         - https://xhr.spec.whatwg.org/#the-abort()-method
1551
1552         Test: http/tests/navigation/page-cache-xhr-in-pagehide.html
1553
1554         * xml/XMLHttpRequest.cpp:
1555         (WebCore::XMLHttpRequest::open):
1556         (WebCore::XMLHttpRequest::abort):
1557         (WebCore::XMLHttpRequest::abortError):
1558         (WebCore::XMLHttpRequest::didFail):
1559         * xml/XMLHttpRequest.h:
1560
1561 2017-08-14  Simon Fraser  <simon.fraser@apple.com>
1562
1563         Remove ENABLE_VIEW_MODE_CSS_MEDIA and related code
1564         https://bugs.webkit.org/show_bug.cgi?id=175557
1565
1566         Reviewed by Jon Lee.
1567
1568         No port cares about the ENABLE(VIEW_MODE_CSS_MEDIA) feature, so remove it.
1569
1570         * Configurations/FeatureDefines.xcconfig:
1571         * css/CSSValueKeywords.in:
1572         * css/MediaFeatureNames.h:
1573         * css/MediaQueryEvaluator.cpp:
1574         (WebCore::viewModeEvaluate): Deleted.
1575         * css/MediaQueryExpression.cpp:
1576         (WebCore::featureWithValidIdent):
1577         (WebCore::isFeatureValidWithoutValue):
1578         * page/Page.cpp:
1579         (WebCore::Page::stringToViewMode): Deleted.
1580         (WebCore::Page::setViewMode): Deleted.
1581         * page/Page.h:
1582         (WebCore::Page::viewMode const): Deleted.
1583
1584 2017-08-14  Myles C. Maxfield  <mmaxfield@apple.com>
1585
1586         Parse font-display
1587         https://bugs.webkit.org/show_bug.cgi?id=175382
1588
1589         Reviewed by Simon Fraser.
1590
1591         The syntax is very simple: font-display: auto | block | swap | fallback | optional.
1592         So, parsing support is quite straightfoward.
1593
1594         Test: fast/text/font-display/parse.html
1595
1596         * css/CSSComputedStyleDeclaration.cpp:
1597         (WebCore::ComputedStyleExtractor::propertyValue):
1598         * css/CSSFontFace.cpp:
1599         (WebCore::CSSFontFace::setLoadingBehavior):
1600         * css/CSSFontFace.h:
1601         * css/CSSFontSelector.cpp:
1602         (WebCore::CSSFontSelector::addFontFaceRule):
1603         * css/CSSPrimitiveValueMappings.h:
1604         (WebCore::CSSPrimitiveValue::CSSPrimitiveValue):
1605         (WebCore::CSSPrimitiveValue::operator FontLoadingBehavior const):
1606         * css/CSSProperties.json:
1607         * css/CSSProperty.cpp:
1608         (WebCore::CSSProperty::isDescriptorOnly):
1609         * css/CSSValueKeywords.in:
1610         * css/parser/CSSPropertyParser.cpp:
1611         (WebCore::consumeFontFaceFontDisplay):
1612         (WebCore::CSSPropertyParser::parseFontFaceDescriptor):
1613         * rendering/style/RenderStyleConstants.h:
1614
1615 2017-08-14  Jer Noble  <jer.noble@apple.com>
1616
1617         Obj-C exception crash in AVStreamSession when using EME in Private Browsing mode
1618         https://bugs.webkit.org/show_bug.cgi?id=175547
1619
1620         Reviewed by Eric Carlson.
1621
1622         When the storagePath() is empty, do not use those AVStreamSession APIs which require a valid file path to stored
1623         proof-of-key-release data.
1624
1625         Drive-by fix: return emptyString() from HTMLMediaElement::mediaPlayerMediaKeysStorageDirectory() when in Private
1626         Browsing mode, to match the behavior of WebKitMediaKeySession.
1627
1628         * html/HTMLMediaElement.cpp:
1629         (WebCore::HTMLMediaElement::mediaPlayerMediaKeysStorageDirectory const):
1630         * platform/graphics/avfoundation/objc/CDMSessionAVStreamSession.mm:
1631         (WebCore::CDMSessionAVStreamSession::releaseKeys):
1632         (WebCore::CDMSessionAVStreamSession::update):
1633         (WebCore::CDMSessionAVStreamSession::generateKeyReleaseMessage):
1634
1635 2017-08-14  Andy Estes  <aestes@apple.com>
1636
1637         REGRESSION (r220456): Crash in PreviewLoader::shouldCreateForMIMEType() when a ResourceResponse has a null MIME type
1638         https://bugs.webkit.org/show_bug.cgi?id=175548
1639         <rdar://problem/33866206>
1640
1641         Reviewed by Brady Eidson.
1642
1643         New API test: QuickLook.ShouldCreateForMIMEType
1644
1645         * WebCore.xcodeproj/project.pbxproj:
1646         * loader/ios/PreviewLoader.h:
1647         * loader/ios/PreviewLoader.mm:
1648         (WebCore::PreviewLoader::shouldCreateForMIMEType): Check if mimeType is a null String before
1649         calling HashSet::contains().
1650
1651 2017-08-14  Andy Estes  <aestes@apple.com>
1652
1653         [Apple Pay] Add support for phonetic contact names
1654         https://bugs.webkit.org/show_bug.cgi?id=175537
1655         <rdar://problem/32002644>
1656
1657         Reviewed by Tim Horton.
1658
1659         * Modules/applepay/ApplePayError.idl: Defined "phoneticName" in ApplePayErrorContactField.
1660         * Modules/applepay/ApplePayPaymentContact.h: Defined phoneticGivenName and phoneticFamilyName
1661         in ApplePayPaymentContact.
1662         * Modules/applepay/ApplePayPaymentContact.idl: Ditto.
1663         * Modules/applepay/ApplePayPaymentRequest.h: Defined PhoneticName in
1664         ApplePayPaymentRequest::ContactField.
1665         * Modules/applepay/ApplePayPaymentRequest.idl: Defined "phoneticName" in ApplePayContactField.
1666         * Modules/applepay/ApplePaySession.cpp:
1667         (WebCore::convertAndValidate): Added a version parameter. Added code to convert
1668         ContactField::PhoneticName, throwing an exception if version is less than 3.
1669         * Modules/applepay/PaymentContact.h: Added a version parameter to fromApplePayPaymentContact().
1670         * Modules/applepay/PaymentRequest.h: Defined phoneticName in PaymentRequest::ContactFields
1671         and defined PhoneticName in PaymentError::ContactField.
1672         * Modules/applepay/cocoa/PaymentContactCocoa.mm:
1673         (WebCore::convert): Added a version parameter. Set a phoneticRepresentation on the
1674         PKContact's name if there are non-empty phonetic names and version is 3 or greater.
1675         (WebCore::PaymentContact::fromApplePayPaymentContact): Passed version to convert().
1676
1677 2017-08-14  Said Abou-Hallawa  <sabouhallawa@apple.com>
1678
1679         The none smooth stroke applied to an SVG shape breaks its hit testing
1680         https://bugs.webkit.org/show_bug.cgi?id=175506
1681
1682         Reviewed by Simon Fraser.
1683
1684         Clear RenderSVGShape::m_path when calling RenderSVGRect::updateShapeFromElement().
1685         The m_path will be recalculated when RenderSVGShape::updateShapeFromElement()
1686         is called from RenderSVGRect::shapeDependentStrokeContains().
1687
1688         Test: svg/stroke/stroke-linejoin-click.html
1689
1690         * rendering/svg/RenderSVGRect.cpp:
1691         (WebCore::RenderSVGRect::updateShapeFromElement):
1692         * rendering/svg/RenderSVGShape.h:
1693         (WebCore::RenderSVGShape::clearPath):
1694
1695 2017-08-14  Adrian Perez de Castro  <aperez@igalia.com>
1696
1697         [WPE] Implement WebCore::standardUserAgent()
1698         https://bugs.webkit.org/show_bug.cgi?id=175507
1699
1700         Reviewed by Michael Catanzaro.
1701
1702         Remove "_GLIB" from user-agent version macros.
1703
1704         * platform/glib/UserAgentGLib.cpp:
1705         (WebCore::versionForUAString):
1706
1707 2017-08-14  Chris Dumez  <cdumez@apple.com>
1708
1709         Unreviewed, rollout r220622 & r220696
1710         https://bugs.webkit.org/show_bug.cgi?id=175482
1711         <rdar://problem/33860695>
1712
1713         Seems to have caused failures on iOS.
1714
1715         * CMakeLists.txt:
1716         * Modules/beacon/NavigatorBeacon.cpp:
1717         (WebCore::NavigatorBeacon::sendBeacon):
1718         * Modules/fetch/FetchBodyOwner.cpp:
1719         (WebCore::FetchBodyOwner::BlobLoader::didReceiveResponse):
1720         (WebCore::FetchBodyOwner::BlobLoader::didFail):
1721         * Modules/fetch/FetchBodyOwner.h:
1722         * Modules/fetch/FetchLoader.cpp:
1723         (WebCore::FetchLoader::start):
1724         (WebCore::FetchLoader::didFail):
1725         * Modules/fetch/FetchLoaderClient.h:
1726         * Modules/fetch/FetchResponse.cpp:
1727         (WebCore::FetchResponse::BodyLoader::didFail):
1728         * Modules/fetch/FetchResponse.h:
1729         * WebCore.xcodeproj/project.pbxproj:
1730         * loader/DocumentThreadableLoader.cpp:
1731         (WebCore::DocumentThreadableLoader::loadRequest):
1732         * loader/cache/CachedRawResource.cpp:
1733         (WebCore::CachedRawResource::finishLoading):
1734         * loader/cache/CachedResource.cpp:
1735         (WebCore::CachedResource::load):
1736         * loader/cache/CachedResource.h:
1737         (WebCore::CachedResource::isMainOrMediaOrIconOrRawResource const):
1738         * loader/cache/CachedResourceLoader.cpp:
1739         (WebCore::createResource):
1740         (WebCore::CachedResourceLoader::requestImage):
1741         (WebCore::CachedResourceLoader::requestFont):
1742         (WebCore::CachedResourceLoader::requestTextTrack):
1743         (WebCore::CachedResourceLoader::requestCSSStyleSheet):
1744         (WebCore::CachedResourceLoader::requestUserCSSStyleSheet):
1745         (WebCore::CachedResourceLoader::requestScript):
1746         (WebCore::CachedResourceLoader::requestXSLStyleSheet):
1747         (WebCore::CachedResourceLoader::requestSVGDocument):
1748         (WebCore::CachedResourceLoader::requestLinkResource):
1749         (WebCore::CachedResourceLoader::requestMedia):
1750         (WebCore::CachedResourceLoader::requestIcon):
1751         (WebCore::CachedResourceLoader::requestRawResource):
1752         (WebCore::CachedResourceLoader::requestBeaconResource):
1753         (WebCore::CachedResourceLoader::requestMainResource):
1754         (WebCore::CachedResourceLoader::requestResource):
1755         (WebCore::CachedResourceLoader::preload):
1756         * loader/cache/CachedResourceLoader.h:
1757         * loader/cache/KeepaliveRequestTracker.cpp: Removed.
1758         * loader/cache/KeepaliveRequestTracker.h: Removed.
1759         * platform/network/FormData.cpp:
1760         (WebCore::FormData::appendFile):
1761         (WebCore::FormData::appendFileRange):
1762         (WebCore::FormData::appendBlob):
1763         (WebCore::FormData::expandDataStore):
1764         * platform/network/FormData.h:
1765
1766 2017-08-14  Daniel Bates  <dabates@apple.com>
1767
1768         [css-ui] Implement caret-color support
1769         https://bugs.webkit.org/show_bug.cgi?id=166572
1770         <rdar://problem/33852589>
1771
1772         Reviewed by David Hyatt.
1773
1774         Add support for the CSS property caret-color as per <https://www.w3.org/TR/css-ui-3/#caret-color> (02 March 2017).
1775         The property caret-color specifies the color of the text insertion caret in an editable element,
1776         say an HTML textarea element.
1777
1778         Unlike other CSS color properties caret-color can have value "auto" and this is its initial
1779         value. Internally we treat value "auto" as an invalid caret color to simplify the code.
1780
1781         Tests: editing/pasteboard/preserve-caret-color.html
1782                fast/css/caret-color-auto.html
1783                fast/css/caret-color-fallback-to-color.html
1784                fast/css/caret-color-inherit.html
1785                fast/css/caret-color-span-inside-editable-parent.html
1786                fast/css/caret-color.html
1787                fast/history/visited-link-caret-color.html
1788
1789         * css/CSSComputedStyleDeclaration.cpp:
1790         (WebCore::ComputedStyleExtractor::propertyValue):
1791         * css/CSSProperties.json: Add property caret-color. We represent the initial  "auto" Also, fix up
1792         wording in a comment while I am here.
1793         * css/StyleResolver.cpp:
1794         (WebCore::isValidVisitedLinkProperty): Add caret-color to the list of properties that can be
1795         applied to visited hyperlinks.
1796         * css/parser/CSSParserFastPaths.cpp:
1797         (WebCore::parseCaretColor): Added.
1798         (WebCore::CSSParserFastPaths::maybeParseValue): Unlike other CSS color properties caret-color
1799         can be defined to be "auto". We explicitly check if the property is caret-color and use
1800         parseCaretColor() to parse its value.
1801         * css/parser/CSSPropertyParser.cpp:
1802         (WebCore::consumeCaretColor): Added.
1803         (WebCore::CSSPropertyParser::parseSingleValue): Similar to the change to CSSParserFastPaths::maybeParseValue()
1804         use a dedicated code path to parse caret-color.
1805         * editing/EditingStyle.cpp: Preserve caret-color during editing operations.
1806         * editing/FrameSelection.cpp:
1807         (WebCore::CaretBase::paintCaret const): Modified code to query property caret-color instead of
1808         color for the color of the text insertion caret. Always honor the caret-color of the editable
1809         element if it is valid color. Note that "caret-color: auto" is treated as an invalid color
1810         internally. A caret-color can have an invalid color if its inherits from the CSS color property
1811         with an invalid color. If caret-color is a valid color then we take it to be the color of the
1812         text insertion caret. Otherwise, we do what we do today and use a heuristic to determine the
1813         color of the text-insertion caret.
1814         (WebCore::disappearsIntoBackground): Deleted; moved logic into CaretBase::paintCaret().
1815         * page/animation/CSSPropertyAnimation.cpp:
1816         (WebCore::CSSPropertyAnimationWrapperMap::CSSPropertyAnimationWrapperMap): Add property wrapper
1817         to support animating caret-color.
1818         * rendering/style/RenderStyle.cpp:
1819         (WebCore::RenderStyle::changeRequiresRepaintIfTextOrBorderOrOutline const): Modified to consider
1820         changes to caret color.
1821         (WebCore::RenderStyle::colorIncludingFallback const): Modified to compute the appropriate
1822         color for property caret-color with respect to an unvisited or visited link.
1823         * rendering/style/RenderStyle.h:
1824         (WebCore::RenderStyle::setCaretColor): Added.
1825         (WebCore::RenderStyle::setVisitedLinkCaretColor): Added.
1826         (WebCore::RenderStyle::caretColor const): Added.
1827         (WebCore::RenderStyle::visitedLinkCaretColor const): Added.
1828         * rendering/style/StyleRareInheritedData.cpp:
1829         (WebCore::StyleRareInheritedData::StyleRareInheritedData): Modified to consider caret color.
1830         (WebCore::StyleRareInheritedData::operator== const): Ditto.
1831         * rendering/style/StyleRareInheritedData.h:
1832
1833 2017-08-14  Zan Dobersek  <zdobersek@igalia.com>
1834
1835         REGRESSION(r220517-r220521) [GTK] Various compositing tests fail
1836         https://bugs.webkit.org/show_bug.cgi?id=175478
1837
1838         Reviewed by Sergio Villar Senin.
1839
1840         Fix a regression introduced in r220519. Move a framebuffer binding in TextureMapperGL
1841         away from GraphicsContext3D and onto the OpenGL API to work around the framebuffer
1842         binding state that's kept in the GraphicsContext3D class. This mismatch in how the
1843         framebuffer was bound was causing a couple of test failures in compositing tests.
1844
1845         No new tests -- regressed tests have their failure expectations removed.
1846
1847         * platform/graphics/texmap/TextureMapperGL.cpp:
1848         (WebCore::TextureMapperGL::bindDefaultSurface): Don't use GraphicsContext3D for the
1849         glBindFramebuffer() call. This would be done in subsequent patches that would move
1850         TextureMapperGL off the GraphicsContext3D usage, but this specific use case clashes
1851         with the framebuffer binding that's done in BitmapTextureGL and was causing test
1852         failures.
1853
1854 2017-08-14  Chris Dumez  <cdumez@apple.com>
1855
1856         Unreviewed fix after r220622 to address crashes on iOS.
1857
1858         * loader/cache/CachedRawResource.cpp:
1859         (WebCore::CachedRawResource::finishLoading):
1860
1861 2017-08-14  Antti Koivisto  <antti@apple.com>
1862
1863         Factor text autosizing into a class
1864         https://bugs.webkit.org/show_bug.cgi?id=175530
1865
1866         Reviewed by Andreas Kling.
1867
1868         Move the remaining parts out of Document.
1869
1870         * css/StyleBuilderCustom.h:
1871         (WebCore::computeLineHeightMultiplierDueToFontSize):
1872         * dom/Document.cpp:
1873         (WebCore::Document::destroyRenderTree):
1874         (WebCore::Document::textAutoSizing):
1875         (WebCore::TextAutoSizingTraits::constructDeletedValue): Deleted.
1876         (WebCore::TextAutoSizingTraits::isDeletedValue): Deleted.
1877         (WebCore::Document::addAutoSizedNode): Deleted.
1878         (WebCore::Document::updateAutoSizedNodes): Deleted.
1879         (WebCore::Document::clearAutoSizedNodes): Deleted.
1880         * dom/Document.h:
1881         * rendering/RenderBlockFlow.cpp:
1882         (WebCore::RenderBlockFlow::adjustComputedFontSizes):
1883         * rendering/RenderElement.cpp:
1884         (WebCore::RenderElement::adjustComputedFontSizesOnBlocks):
1885         (WebCore::RenderElement::resetTextAutosizing):
1886         * rendering/TextAutoSizing.cpp:
1887         (WebCore::TextAutoSizingTraits::constructDeletedValue):
1888         (WebCore::TextAutoSizingTraits::isDeletedValue):
1889         (WebCore::TextAutoSizing::addTextNode):
1890         (WebCore::TextAutoSizing::updateRenderTree):
1891         (WebCore::TextAutoSizing::reset):
1892         * rendering/TextAutoSizing.h:
1893
1894 2017-08-14  Antti Koivisto  <antti@apple.com>
1895
1896         [Render Tree Mutation] First letter should not mutate the render tree while in layout.
1897         https://bugs.webkit.org/show_bug.cgi?id=163848
1898
1899         Reviewed by Zalan Bujtas.
1900
1901         RenderBlock::updateFirstLetter shouldn't be called during layout. Instead it should
1902         be invoked by the RenderTreeUpdater.
1903
1904         With this future patches can move updateFirstLetter() and the related functions
1905         completely out of the render tree.
1906
1907         * rendering/RenderBlock.cpp:
1908         (WebCore::RenderBlock::layout):
1909
1910             No more updateFirstLetter calls during layout...
1911
1912         (WebCore::RenderBlock::computePreferredLogicalWidths):
1913
1914             ...or preferred width computation.
1915
1916         (WebCore::RenderBlock::updateFirstLetter):
1917         * rendering/RenderBlock.h:
1918         * rendering/RenderRubyRun.cpp:
1919         (WebCore::RenderRubyRun::updateFirstLetter):
1920         * rendering/RenderRubyRun.h:
1921         * rendering/RenderTable.cpp:
1922         (WebCore::RenderTable::updateFirstLetter):
1923         * rendering/RenderTable.h:
1924         * rendering/svg/RenderSVGText.cpp:
1925         (WebCore::RenderSVGText::updateFirstLetter):
1926         * rendering/svg/RenderSVGText.h:
1927         * style/RenderTreeUpdater.cpp:
1928         (WebCore::RenderTreeUpdater::popParent):
1929
1930             Call updateFirstLetter when closing the element. All of of descedant renderers are known here
1931             so this can be resolved correctly.
1932
1933 2017-08-13  Manuel Rego Casasnovas  <rego@igalia.com>
1934
1935         Composition underline color is always black
1936         https://bugs.webkit.org/show_bug.cgi?id=174675
1937
1938         Reviewed by Ryosuke Niwa.
1939
1940         This patch uses the current color of the text instead of black
1941         for the composition underline marker.
1942         This makes it visible in the case we have a black/dark background.
1943
1944         Test: editing/composition-underline-color.html
1945
1946         * editing/CompositionUnderline.h:
1947         (WebCore::CompositionUnderline::CompositionUnderline):
1948         Added new attribute compositionUnderlineColor.
1949         * rendering/InlineTextBox.cpp:
1950         (WebCore::InlineTextBox::paintCompositionUnderline):
1951         Use the text color if compositionUnderlineColor is TextColor.
1952
1953 2017-08-13  Carlos Garcia Campos  <cgarcia@igalia.com>
1954
1955         [GTK] stop kinetic scrolling when a zero movement is reached
1956         https://bugs.webkit.org/show_bug.cgi?id=175468
1957
1958         Reviewed by Michael Catanzaro.
1959
1960         This is GTK+ change by Christian Hergert.
1961         https://git.gnome.org/browse/gtk+/commit/?h=gtk-3-22&id=4f63d839550f7a9038b391e7d3e1e6fc8bdfafa6
1962
1963         When the kinetic scrolling reduces its speed, there can be multiple frames where the movement is zero pixels,
1964         followed by a 1 pixel movement later on. This causes a "jitter" right at the end of the scroll which makes it
1965         feel less quality than other platforms. Instead, we should just clamp it as soon as we get a zero movement.
1966
1967         * platform/ScrollAnimationKinetic.cpp:
1968         (WebCore::ScrollAnimationKinetic::PerAxisData::animateScroll):
1969
1970 2017-08-13  Chris Dumez  <cdumez@apple.com>
1971
1972         Drop non-const getter for CachedResource::resourceRequest()
1973         https://bugs.webkit.org/show_bug.cgi?id=175524
1974
1975         Reviewed by Youenn Fablet.
1976
1977         Drop non-const getter for CachedResource::resourceRequest(). It would be unsafe to modify the request of a CachedResource
1978         after it has been cached. Exposing such a getter is therefore a footgun.
1979
1980         * loader/LinkLoader.cpp:
1981         (WebCore::LinkLoader::preloadIfNeeded):
1982         * loader/cache/CachedImage.cpp:
1983         (WebCore::CachedImage::CachedImage):
1984         * loader/cache/CachedImage.h:
1985         * loader/cache/CachedResource.cpp:
1986         (WebCore::CachedResource::CachedResource):
1987         * loader/cache/CachedResource.h:
1988         (WebCore::CachedResource::resourceRequest const):
1989         (WebCore::CachedResource::ignoreForRequestCount const):
1990         (WebCore::CachedResource::setIgnoreForRequestCount):
1991         * loader/cache/CachedResourceLoader.cpp:
1992         (WebCore::CachedResourceLoader::requestResource):
1993         * loader/cache/CachedResourceRequest.h:
1994         (WebCore::CachedResourceRequest::ignoreForRequestCount const):
1995         (WebCore::CachedResourceRequest::setIgnoreForRequestCount):
1996         * loader/cache/MemoryCache.cpp:
1997         (WebCore::MemoryCache::addImageToCache):
1998         * platform/network/ResourceRequestBase.h:
1999
2000 2017-08-13  Adrian Perez de Castro  <aperez@igalia.com>
2001
2002         [WPE] Implement WebCore::standardUserAgent()
2003         https://bugs.webkit.org/show_bug.cgi?id=175507
2004
2005         Reviewed by Carlos Alberto Lopez Perez.
2006
2007         Implement missing User-Agent handling for the WPE port by sharing the code with the GTK+ port.
2008
2009         * PlatformGTK.cmake: Handlde renaming of UserAgentGtk.cpp to UserAgentGLib.cpp.
2010         * PlatformWPE.cmake: Add UserAgentGLib.cpp and UserAgentQuirks.cpp to the list of built WebCore sources.
2011         * platform/glib/UserAgentGLib.cpp: Renamed from Source/WebCore/platform/gtk/UserAgentGtk.cpp.
2012         (WebCore::versionForUAString): Change "GTK" in UA version macros to "GLIB".
2013
2014 2017-08-11  Ryosuke Niwa  <rniwa@webkit.org>
2015
2016         Replace DATA_TRANSFER_ITEMS by a runtime flag and add a stub implementation
2017         https://bugs.webkit.org/show_bug.cgi?id=175474
2018         <rdar://problem/33844628>
2019
2020         Reviewed by Wenson Hsieh.
2021
2022         Replaced the build flag by a runtime flag and added a stub implementation for DataTransferItemList
2023         and DataTransferItem to make it compile. DataTransferItemList is created lazily by DataTransfer.items,
2024         and its lifetime is tied to DataTransfer by forwarding ref and deref.
2025
2026         See https://html.spec.whatwg.org/multipage/dnd.html#the-datatransferitemlist-interface
2027
2028         Tests: editing/pasteboard/datatransfer-idl.html
2029
2030         * CMakeLists.txt:
2031         * Configurations/FeatureDefines.xcconfig:
2032         * WebCore.xcodeproj/project.pbxproj:
2033         * dom/DataTransfer.cpp:
2034         (WebCore::DataTransfer::items): Added. Create DataTransferItemList lazily
2035         * dom/DataTransfer.h:
2036         * dom/DataTransfer.idl:
2037         * dom/DataTransferItem.cpp:
2038         (WebCore::DataTransferItem::DataTransferItem): Added a stub implementation.
2039         (WebCore::DataTransferItem::~DataTransferItem): Ditto.
2040         (WebCore::DataTransferItem::getAsString const): Ditto.
2041         (WebCore::DataTransferItem::getAsFile const): Ditto.
2042         * dom/DataTransferItem.h:
2043         (WebCore::DataTransferItemList): Devirtualized functions.
2044         (WebCore::DataTransferItemList::kind const):
2045         (WebCore::DataTransferItemList::type const):
2046         * dom/DataTransferItem.idl:
2047         * dom/DataTransferItemList.cpp: Added.
2048         (WebCore::DataTransferItemList::length const): Added a stub implementation.
2049         (WebCore::DataTransferItemList::item): Ditto.
2050         (WebCore::DataTransferItemList::add): Ditto.
2051         (WebCore::DataTransferItemList::remove): Ditto.
2052         (WebCore::DataTransferItemList::clear): Ditto.
2053         * dom/DataTransferItemList.h:
2054         (WebCore::DataTransferItemList::DataTransferItemList):
2055         (WebCore::DataTransferItemList::~DataTransferItemList): Deleted.
2056         (WebCore::DataTransferItemList::ref): Forwards to DataTransfer's ref.
2057         (WebCore::DataTransferItemList::deref): Ditto.
2058         * dom/DataTransferItemList.idl: Updated to match the latest specification.
2059         * page/RuntimeEnabledFeatures.h:
2060         (WebCore::RuntimeEnabledFeatures::setDataTransferItemsEnabled): Added.
2061         (WebCore::RuntimeEnabledFeatures::dataTransferItemsEnabled const): Added.
2062
2063 2017-08-11  Brady Eidson  <beidson@apple.com>
2064
2065         Move files inside WebCore/workers to WebCore/workers/service.
2066         https://bugs.webkit.org/show_bug.cgi?id=175495
2067
2068         Rubberstamped by Tim Horton.
2069
2070         * CMakeLists.txt:
2071         * DerivedSources.make:
2072         * WebCore.xcodeproj/project.pbxproj:
2073
2074         * workers/service/ServiceWorker.cpp: Renamed from Source/WebCore/workers/ServiceWorker.cpp.
2075         * workers/service/ServiceWorker.h: Renamed from Source/WebCore/workers/ServiceWorker.h.
2076         * workers/service/ServiceWorker.idl: Renamed from Source/WebCore/workers/ServiceWorker.idl.
2077         * workers/service/ServiceWorkerContainer.cpp: Renamed from Source/WebCore/workers/ServiceWorkerContainer.cpp.
2078         * workers/service/ServiceWorkerContainer.h: Renamed from Source/WebCore/workers/ServiceWorkerContainer.h.
2079         * workers/service/ServiceWorkerContainer.idl: Renamed from Source/WebCore/workers/ServiceWorkerContainer.idl.
2080         * workers/service/ServiceWorkerGlobalScope.cpp: Renamed from Source/WebCore/workers/ServiceWorkerGlobalScope.cpp.
2081         * workers/service/ServiceWorkerGlobalScope.h: Renamed from Source/WebCore/workers/ServiceWorkerGlobalScope.h.
2082         * workers/service/ServiceWorkerGlobalScope.idl: Renamed from Source/WebCore/workers/ServiceWorkerGlobalScope.idl.
2083         * workers/service/ServiceWorkerJob.cpp: Renamed from Source/WebCore/workers/ServiceWorkerJob.cpp.
2084         * workers/service/ServiceWorkerJob.h: Renamed from Source/WebCore/workers/ServiceWorkerJob.h.
2085         * workers/service/ServiceWorkerJobClient.h: Renamed from Source/WebCore/workers/ServiceWorkerJobClient.h.
2086         * workers/service/ServiceWorkerProvider.cpp: Renamed from Source/WebCore/workers/ServiceWorkerProvider.cpp.
2087         * workers/service/ServiceWorkerProvider.h: Renamed from Source/WebCore/workers/ServiceWorkerProvider.h.
2088         * workers/service/ServiceWorkerRegistration.cpp: Renamed from Source/WebCore/workers/ServiceWorkerRegistration.cpp.
2089         * workers/service/ServiceWorkerRegistration.h: Renamed from Source/WebCore/workers/ServiceWorkerRegistration.h.
2090         * workers/service/ServiceWorkerRegistration.idl: Renamed from Source/WebCore/workers/ServiceWorkerRegistration.idl.
2091         * workers/service/ServiceWorkerRegistrationOptions.h: Renamed from Source/WebCore/workers/ServiceWorkerRegistrationOptions.h.
2092         * workers/service/ServiceWorkerRegistrationParameters.cpp: Renamed from Source/WebCore/workers/ServiceWorkerRegistrationParameters.cpp.
2093         * workers/service/ServiceWorkerRegistrationParameters.h: Renamed from Source/WebCore/workers/ServiceWorkerRegistrationParameters.h.
2094         * workers/service/ServiceWorkerUpdateViaCache.h: Renamed from Source/WebCore/workers/ServiceWorkerUpdateViaCache.h.
2095         * workers/service/ServiceWorkerUpdateViaCache.idl: Renamed from Source/WebCore/workers/ServiceWorkerUpdateViaCache.idl.
2096
2097 2017-08-11  Chris Dumez  <cdumez@apple.com>
2098
2099         Implement quota limitation for keepalive Fetch requests
2100         https://bugs.webkit.org/show_bug.cgi?id=175482
2101
2102         Reviewed by Sam Weinig and Youenn Fablet.
2103
2104         Implement quota limitation for keepalive Fetch requests as per:
2105         - https://fetch.spec.whatwg.org/#http-network-or-cache-fetch (Step 9)
2106
2107         This partly works for Beacon as well, meaning that no Beacon with a body
2108         over 64Kb can be sent. However, we don't keep track about wether or not
2109         beacon loads are inflight or not.
2110
2111         Also update CachedResourceLoader::requestResource() so that the caller
2112         can get a ResourceError when it returns null. This is useful for both
2113         Fetch and Beacon to return better error messages.
2114
2115         Test: http/wpt/beacon/beacon-quota.html
2116
2117         * CMakeLists.txt:
2118         * Modules/beacon/NavigatorBeacon.cpp:
2119         (WebCore::NavigatorBeacon::sendBeacon):
2120         * Modules/fetch/FetchBodyOwner.cpp:
2121         (WebCore::FetchBodyOwner::BlobLoader::didReceiveResponse):
2122         (WebCore::FetchBodyOwner::BlobLoader::didFail):
2123         * Modules/fetch/FetchBodyOwner.h:
2124         * Modules/fetch/FetchLoader.cpp:
2125         (WebCore::FetchLoader::start):
2126         (WebCore::FetchLoader::didFail):
2127         * Modules/fetch/FetchLoaderClient.h:
2128         * Modules/fetch/FetchResponse.cpp:
2129         (WebCore::FetchResponse::BodyLoader::didFail):
2130         * Modules/fetch/FetchResponse.h:
2131         * WebCore.xcodeproj/project.pbxproj:
2132         * loader/DocumentThreadableLoader.cpp:
2133         (WebCore::DocumentThreadableLoader::loadRequest):
2134         * loader/cache/CachedResource.cpp:
2135         (WebCore::CachedResource::load):
2136         * loader/cache/CachedResource.h:
2137         (WebCore::CachedResource::isMainOrMediaOrIconOrRawResource const):
2138         * loader/cache/CachedResourceLoader.cpp:
2139         (WebCore::createResource):
2140         (WebCore::CachedResourceLoader::requestImage):
2141         (WebCore::CachedResourceLoader::requestFont):
2142         (WebCore::CachedResourceLoader::requestTextTrack):
2143         (WebCore::CachedResourceLoader::requestCSSStyleSheet):
2144         (WebCore::CachedResourceLoader::requestUserCSSStyleSheet):
2145         (WebCore::CachedResourceLoader::requestScript):
2146         (WebCore::CachedResourceLoader::requestXSLStyleSheet):
2147         (WebCore::CachedResourceLoader::requestSVGDocument):
2148         (WebCore::CachedResourceLoader::requestLinkResource):
2149         (WebCore::CachedResourceLoader::requestMedia):
2150         (WebCore::CachedResourceLoader::requestIcon):
2151         (WebCore::CachedResourceLoader::requestRawResource):
2152         (WebCore::CachedResourceLoader::requestBeaconResource):
2153         (WebCore::CachedResourceLoader::requestMainResource):
2154         (WebCore::CachedResourceLoader::requestResource):
2155         (WebCore::CachedResourceLoader::preload):
2156         * loader/cache/CachedResourceLoader.h:
2157         * loader/cache/KeepaliveRequestTracker.cpp: Added.
2158         (WebCore::KeepaliveRequestTracker::~KeepaliveRequestTracker):
2159         (WebCore::KeepaliveRequestTracker::canLoadRequest):
2160         (WebCore::KeepaliveRequestTracker::registerRequest):
2161         (WebCore::KeepaliveRequestTracker::responseReceived):
2162         (WebCore::KeepaliveRequestTracker::notifyFinished):
2163         (WebCore::KeepaliveRequestTracker::unregisterRequest):
2164         * loader/cache/KeepaliveRequestTracker.h: Added.
2165         * platform/network/FormData.cpp:
2166         (WebCore::FormDataElement::lengthInBytes const):
2167         (WebCore::FormData::lengthInBytes const):
2168         * platform/network/FormData.h:
2169
2170 2017-08-11  Don Olmstead  <don.olmstead@sony.com>
2171
2172         [WTF] Move ValueToString into WTF
2173         https://bugs.webkit.org/show_bug.cgi?id=175469
2174
2175         Reviewed by Sam Weinig.
2176
2177         No new tests. No change in behavior.
2178
2179         * WebCore.xcodeproj/project.pbxproj:
2180         * html/HTMLMediaElement.h:
2181         (WTF::ValueToString<WebCore::TextTrackCue::string):
2182         (WebCore::ValueToString<TextTrackCue::string): Deleted.
2183         (WebCore::ValueToString<MediaTime>::string): Deleted.
2184         * platform/LayoutUnit.h:
2185         (WTF::ValueToString<WebCore::LayoutUnit>::string):
2186         (WebCore::ValueToString<LayoutUnit>::string): Deleted.
2187         * platform/PODInterval.h:
2188         * platform/PODIntervalTree.h:
2189         * platform/PODRedBlackTree.h:
2190         * platform/graphics/FloatPolygon.h:
2191         (WTF::ValueToString<WebCore::FloatPolygonEdge::string):
2192         (WebCore::ValueToString<FloatPolygonEdge::string): Deleted.
2193         * rendering/FloatingObjects.h:
2194         (WTF::ValueToString<WebCore::FloatingObject::string):
2195         (WebCore::ValueToString<FloatingObject::string): Deleted.
2196         * rendering/RenderFlowThread.h:
2197         (WTF::ValueToString<WebCore::RenderRegion::string):
2198         (WebCore::ValueToString<RenderRegion::string): Deleted.
2199
2200 2017-08-11  Sam Weinig  <sam@webkit.org>
2201
2202         [Bindings] Simplify DOMPromiseProxy now that WTF::Function can return references
2203         https://bugs.webkit.org/show_bug.cgi?id=175394
2204
2205         Reviewed by Chris Dumez.
2206
2207         * bindings/IDLTypes.h:
2208         (WebCore::IDLWrapper::convertToParameterType): Deleted.
2209
2210             Remove no longer used convertToParameterType.
2211
2212         * bindings/js/DOMPromiseProxy.h:
2213
2214             - Replace Variant<Value, Exception> with ExceptionOr<Value> / ExceptionOr<void>.
2215             - Update ResolveCallback to have a return type of IDLType::ParameterType, rather than
2216               IDLType::ImplementationType, now that WTF::Function supports references as the 
2217               return type. This is needed, since the IDLType::ParameterType for an interface T
2218               is T&.
2219
2220         * css/FontFace.cpp:
2221         * css/FontFace.h:
2222         * css/FontFaceSet.cpp:
2223         * css/FontFaceSet.h:
2224
2225             Update resolve callbacks to return a reference rather than a RefPtr, matching
2226             the new signature requirement.
2227
2228 2017-08-11  Sam Weinig  <sam@webkit.org>
2229
2230         [WebIDL] Replace JSCryptoKeyCustom and JSCryptoAlgorithmBuilder with generated code
2231         https://bugs.webkit.org/show_bug.cgi?id=175457
2232
2233         Reviewed by Chris Dumez.
2234
2235         * CMakeLists.txt:
2236         * DerivedSources.make:
2237         * WebCore.xcodeproj/project.pbxproj:
2238         * bindings/js/JSCryptoAlgorithmBuilder.cpp: Removed.
2239         * bindings/js/JSCryptoAlgorithmBuilder.h: Removed.
2240         * bindings/js/JSCryptoKeyCustom.cpp: Removed.
2241
2242             Remove JSCryptoAlgorithmBuilder and JSCryptoKeyCustom, add KeyAlgorithm
2243             IDLs and headers.
2244
2245         * crypto/CryptoKey.cpp:
2246         * crypto/CryptoKey.h:
2247         * crypto/CryptoKey.idl:
2248         
2249             Replace custom algorithm attribute with a union of the supported key algorithms.
2250         
2251         * crypto/keys/CryptoAesKeyAlgorithm.h: Added.
2252         * crypto/keys/CryptoAesKeyAlgorithm.idl: Added.
2253         * crypto/keys/CryptoEcKeyAlgorithm.h: Added.
2254         * crypto/keys/CryptoEcKeyAlgorithm.idl: Added.
2255         * crypto/keys/CryptoHmacKeyAlgorithm.h: Added.
2256         * crypto/keys/CryptoHmacKeyAlgorithm.idl: Added.
2257         * crypto/keys/CryptoKeyAlgorithm.h: Added.
2258         * crypto/keys/CryptoKeyAlgorithm.idl: Added.
2259         * crypto/keys/CryptoRsaHashedKeyAlgorithm.h: Added.
2260         * crypto/keys/CryptoRsaHashedKeyAlgorithm.idl: Added.
2261         * crypto/keys/CryptoRsaKeyAlgorithm.h: Added.
2262         * crypto/keys/CryptoRsaKeyAlgorithm.idl: Added.
2263
2264             Add IDLs and headers fo the supported key algorithms.
2265
2266         * crypto/keys/CryptoKeyAES.h:
2267         * crypto/keys/CryptoKeyEC.h:
2268         * crypto/keys/CryptoKeyHMAC.h:
2269         * crypto/keys/CryptoKeyRSA.h:
2270         * crypto/keys/CryptoKeyRaw.h:
2271
2272             Give each of the existing KeyAlgorithm subclasses a dictionary() function
2273             that returns the populated corresponding spec'd dictionary.
2274
2275 2017-08-11  Simon Fraser  <simon.fraser@apple.com>
2276
2277         Some RenderSVGResource cleanup
2278         https://bugs.webkit.org/show_bug.cgi?id=175494
2279
2280         Reviewed by Zalan Bujtas.
2281
2282         Use more initializers. Remove spurious use of bitfields that didn't save any space at all.
2283         0 -> nullptr.
2284
2285         No behavior change.
2286
2287         * rendering/svg/RenderSVGResourceContainer.cpp:
2288         (WebCore::RenderSVGResourceContainer::RenderSVGResourceContainer):
2289         * rendering/svg/RenderSVGResourceContainer.h:
2290         * rendering/svg/RenderSVGResourceGradient.cpp:
2291         (WebCore::RenderSVGResourceGradient::RenderSVGResourceGradient):
2292         (WebCore::RenderSVGResourceGradient::applyResource):
2293         * rendering/svg/RenderSVGResourceGradient.h:
2294         * rendering/svg/RenderSVGResourcePattern.cpp:
2295         (WebCore::RenderSVGResourcePattern::RenderSVGResourcePattern):
2296         * rendering/svg/RenderSVGResourcePattern.h:
2297         * rendering/svg/RenderSVGShape.cpp:
2298         (WebCore::RenderSVGShape::fillShape):
2299         (WebCore::RenderSVGShape::strokeShape):
2300         * rendering/svg/SVGRenderingContext.cpp:
2301         (WebCore::SVGRenderingContext::~SVGRenderingContext):
2302         (WebCore::SVGRenderingContext::prepareToRenderSVGContent):
2303         * rendering/svg/SVGRenderingContext.h:
2304         (WebCore::SVGRenderingContext::SVGRenderingContext):
2305
2306 2017-08-11  Tim Horton  <timothy_horton@apple.com>
2307
2308         Fix the build with modern Clang's -Wexpansion-to-defined
2309         https://bugs.webkit.org/show_bug.cgi?id=175467
2310         <rdar://problem/33667497>
2311
2312         Reviewed by Simon Fraser.
2313
2314         * crypto/mac/SerializedCryptoKeyWrapMac.mm:
2315
2316 2017-08-11  Brady Eidson  <beidson@apple.com>
2317
2318         Crash under ServiceWorkerJob::failedWithException.
2319         https://bugs.webkit.org/show_bug.cgi?id=175488
2320
2321         Reviewed by Tim Horton.
2322
2323         Covered by existing tests.
2324
2325         * workers/ServiceWorkerJob.cpp:
2326         (WebCore::ServiceWorkerJob::failedWithException): jobDidFinish might cause the Job to be deleted, so make it last.
2327
2328 2017-08-10  Sam Weinig  <sam@webkit.org>
2329
2330         WTF::Function does not allow for reference / non-default constructible return types
2331         https://bugs.webkit.org/show_bug.cgi?id=175244
2332
2333         Reviewed by Chris Dumez.
2334
2335         * bindings/js/JSCustomElementInterface.h:
2336         (WebCore::JSCustomElementInterface::invokeCallback):
2337         Update the default value for the addArguments parameter to be an empty lambda, rather than
2338         default initialization, which leads to a null WTF::Function. This allows us to remove support
2339         for calling null WTF::Function. No change in behavior.
2340
2341 2017-08-11  Antti Koivisto  <antti@apple.com>
2342
2343         Remove RenderQuote collection from RenderView
2344         https://bugs.webkit.org/show_bug.cgi?id=175479
2345
2346         Reviewed by Andreas Kling.
2347
2348         We can do it well enough without maintaining this pointer structure.
2349
2350         Global updating doesn't work well with future direction for first-letter and similar anyway.
2351         We need to update quote immediately when updating its style.
2352
2353         * rendering/RenderQuote.cpp:
2354         (WebCore::RenderQuote::insertedIntoTree):
2355         (WebCore::RenderQuote::willBeRemovedFromTree):
2356
2357             Just tell the view that there are renderers to update.
2358
2359         (WebCore::RenderQuote::styleDidChange):
2360         (WebCore::RenderQuote::isOpen const):
2361         (WebCore::RenderQuote::updateRenderer):
2362         (WebCore::RenderQuote::updateRenderers): Deleted.
2363
2364             Update single renderer only. RenderTreeUpdater provides the previous renderer to compute the depth.
2365
2366         * rendering/RenderQuote.h:
2367         * rendering/RenderView.cpp:
2368         (WebCore::RenderView::registerQuote): Deleted.
2369         (WebCore::RenderView::unregisterQuote): Deleted.
2370         (WebCore::RenderView::updateSpecialRenderers): Deleted.
2371
2372             Remove the quote list.
2373
2374         * rendering/RenderView.h:
2375         * style/RenderTreeUpdater.cpp:
2376         (WebCore::RenderTreeUpdater::commit):
2377
2378             Ensure that all quotes are updated.
2379
2380         (WebCore::RenderTreeUpdater::updateBeforeOrAfterPseudoElement):
2381         (WebCore::RenderTreeUpdater::updateQuotesUpTo):
2382
2383             Traverse render tree to find quotes to update starting from the previous updated quote.
2384
2385         * style/RenderTreeUpdater.h:
2386
2387 2017-08-11  Adrian Perez de Castro  <aperez@igalia.com>
2388
2389         [CMake] Many warning about missing “override” keywords in ANGLE with Clang
2390         https://bugs.webkit.org/show_bug.cgi?id=175475
2391
2392         Reviewed by Michael Catanzaro.
2393
2394         * CMakeLists.txt: Add "-Wno-inconsistent-missing-override" to the
2395         compiler flags using for building the ANGLE sources.
2396
2397 2017-08-11  Adrian Perez de Castro  <aperez@igalia.com>
2398
2399         [GTK][WPE] Overriden virtual function not marked “override” in ImageBufferDataCairo.h
2400         https://bugs.webkit.org/show_bug.cgi?id=175476
2401
2402         Reviewed by Carlos Garcia Campos.
2403
2404         * platform/graphics/cairo/ImageBufferDataCairo.h: Add missing "override" qualifier.
2405
2406 2017-08-11  Carlos Garcia Campos  <cgarcia@igalia.com>
2407
2408         [Soup] Cannot access HTTPS sites using a HTTP proxy that requires authentication
2409         https://bugs.webkit.org/show_bug.cgi?id=175378
2410
2411         Reviewed by Sergio Villar Senin.
2412
2413         Bring back part of the code removed in r206732, to keep a reference to the SoupMessage in the
2414         AuthenticationChallenge since it can be different to the resource message.
2415
2416         * platform/network/soup/AuthenticationChallenge.h:
2417         (WebCore::AuthenticationChallenge::AuthenticationChallenge): Deleted.
2418         (WebCore::AuthenticationChallenge::authenticationClient const): Deleted.
2419         (WebCore::AuthenticationChallenge::soupAuth const): Deleted.
2420         (WebCore::AuthenticationChallenge::setProposedCredential): Deleted.
2421         * platform/network/soup/AuthenticationChallengeSoup.cpp:
2422         (WebCore::AuthenticationChallenge::AuthenticationChallenge):
2423         (WebCore::AuthenticationChallenge::platformCompare):
2424
2425 2017-08-10  Dan Bernstein  <mitz@apple.com>
2426
2427         Fixed building for macOS 10.12 with the macOS 10.13 SDK.
2428
2429         Suppressed the unguarded-availability-new warning around uses of AVSampleBufferAudioRenderer
2430         and AVSampleBufferRenderSynchronizer. Even though the 10.13 SDK declares them as available
2431         starting in that release, they have been available as SPI earlier.
2432
2433         * platform/graphics/avfoundation/objc/CDMSessionMediaSourceAVFObjC.h:
2434         * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.h:
2435         * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.mm:
2436         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::setHasAvailableAudioSample):
2437         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::addAudioRenderer):
2438         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::removeAudioRenderer):
2439         * platform/graphics/avfoundation/objc/SourceBufferPrivateAVFObjC.h:
2440         * platform/graphics/avfoundation/objc/SourceBufferPrivateAVFObjC.mm:
2441         (-[WebAVSampleBufferErrorListener beginObservingRenderer:]):
2442         (-[WebAVSampleBufferErrorListener stopObservingRenderer:]):
2443         (-[WebAVSampleBufferErrorListener observeValueForKeyPath:ofObject:change:context:]):
2444         (WebCore::SourceBufferPrivateAVFObjC::trackDidChangeEnabled):
2445         (WebCore::SourceBufferPrivateAVFObjC::rendererDidReceiveError):
2446         (WebCore::SourceBufferPrivateAVFObjC::flush):
2447
2448 2017-08-10  Brady Eidson  <beidson@apple.com>
2449
2450         Rename the source files for the WTF persistent coders.
2451         https://bugs.webkit.org/show_bug.cgi?id=175441
2452
2453         Reviewed by Tim Horton.
2454
2455         * platform/network/NetworkLoadMetrics.h:
2456
2457 2017-08-10  Yusuke Suzuki  <utatane.tea@gmail.com>
2458
2459         Make ThreadGlobalData RefCounted for web thread
2460         https://bugs.webkit.org/show_bug.cgi?id=175439
2461
2462         Reviewed by Mark Lam.
2463
2464         When the web thread is enabled, we share ThreadGlobalData between the web thread and the main thread.
2465         The problem happens when the main thread is dying. It could start deallocating TLS and the web
2466         thread may see the destructed ThreadGlobalData.
2467
2468         Even though, the current implementation is safe because the main thread do not perform TLS deallocation
2469         in the Darwin environment. But this is not true in Windows. And we should not rely on this condition
2470         that depends on the platforms.
2471
2472         In this patch, we make ThreadGlobalData ThreadSafeRefCounted. This type verbosely describes that
2473         ThreadGlobalData could be shared between threads when the web thread enabled. And make the life time
2474         management simple instead of relying on the platform dependent TLS implementation.
2475
2476         * platform/ThreadGlobalData.cpp:
2477         (WebCore::ThreadGlobalData::setWebCoreThreadData):
2478         (WebCore::threadGlobalData):
2479         * platform/ThreadGlobalData.h:
2480         (WebCore::ThreadGlobalData::cachedResourceRequestInitiators): Deleted.
2481         (WebCore::ThreadGlobalData::eventNames): Deleted.
2482         (WebCore::ThreadGlobalData::threadTimers): Deleted.
2483         (WebCore::ThreadGlobalData::qualifiedNameCache): Deleted.
2484         (WebCore::ThreadGlobalData::cachedConverterICU): Deleted.
2485         (WebCore::ThreadGlobalData::cachedConverterTEC): Deleted.
2486
2487 2017-08-10  Yusuke Suzuki  <utatane.tea@gmail.com>
2488
2489         [JSC] Use @toNumber in builtins
2490         https://bugs.webkit.org/show_bug.cgi?id=172692
2491
2492         Reviewed by Sam Weinig.
2493
2494         Use @toNumber bytecode intrinsic. It emits op_to_number, which efficiently converts
2495         a given argument to a number.
2496
2497         * Modules/streams/ReadableByteStreamInternals.js:
2498         (privateInitializeReadableByteStreamController):
2499         (readableByteStreamControllerRespond):
2500         * Modules/streams/StreamInternals.js:
2501         (validateAndNormalizeQueuingStrategy):
2502         (enqueueValueWithSize):
2503
2504 2017-08-10  Nan Wang  <n_wang@apple.com>
2505
2506         AX: crash at WebCore::AccessibilityObject::supportsARIALiveRegion() const + 24
2507         https://bugs.webkit.org/show_bug.cgi?id=175340
2508         <rdar://problem/33782159>
2509
2510         Reviewed by Chris Fleizach.
2511
2512         The issue here is that we manualy set the parent object of the AccessibilitySVGRoot object
2513         and there are chances that the parent doesn't detach it properly during the parent's destroying
2514         process. Accessing the stale parent object will lead to a crash.
2515         Fixed this by making the parent object a weak pointer so we don't access an invalid memory. 
2516
2517         Test: accessibility/add-children-pseudo-element.html
2518
2519         * accessibility/AccessibilityRenderObject.cpp:
2520         (WebCore::AccessibilityRenderObject::AccessibilityRenderObject):
2521         * accessibility/AccessibilityRenderObject.h:
2522         (WebCore::AccessibilityRenderObject::createWeakPtr):
2523         * accessibility/AccessibilitySVGRoot.cpp:
2524         (WebCore::AccessibilitySVGRoot::AccessibilitySVGRoot):
2525         (WebCore::AccessibilitySVGRoot::setParent):
2526         (WebCore::AccessibilitySVGRoot::parentObject const):
2527         * accessibility/AccessibilitySVGRoot.h:
2528
2529 2017-08-10  Chris Dumez  <cdumez@apple.com>
2530
2531         [Beacon] Do connect-src CSP check on redirects as well
2532         https://bugs.webkit.org/show_bug.cgi?id=175410
2533         <rdar://problem/33815470>
2534
2535         Reviewed by Youenn Fablet.
2536
2537         Pass ContentSecurityPolicy object to createPingHandle so that we can send
2538         enough data to the NetworkProcess so do CSP checks for Ping loads such
2539         as Beacon. For the IPC, we serialize the ContentSecurityPolicy's response
2540         headers. Those headers are now cached in ContentSecurityPolicy for
2541         performance reasons. CSP headers are rarely updated in practice but
2542         sendBeacon() may get called repeatedly for a given document.
2543
2544         Tests: http/wpt/beacon/connect-src-beacon-redirect-allowed.sub.html
2545                http/wpt/beacon/connect-src-beacon-redirect-blocked.sub.html
2546
2547         * loader/LoaderStrategy.h:
2548         * loader/PingLoader.cpp:
2549         (WebCore::PingLoader::loadImage):
2550         (WebCore::PingLoader::sendPing):
2551         (WebCore::PingLoader::sendViolationReport):
2552         (WebCore::PingLoader::startPingLoad):
2553         * loader/PingLoader.h:
2554         * loader/cache/CachedResource.cpp:
2555         (WebCore::CachedResource::load):
2556         * page/csp/ContentSecurityPolicy.cpp:
2557         (WebCore::ContentSecurityPolicy::responseHeaders const):
2558         (WebCore::ContentSecurityPolicy::didReceiveHeader):
2559         * page/csp/ContentSecurityPolicy.h:
2560         * page/csp/ContentSecurityPolicyResponseHeaders.h:
2561         (WebCore::ContentSecurityPolicyResponseHeaders::encode const):
2562         (WebCore::ContentSecurityPolicyResponseHeaders::decode):
2563
2564 2017-08-09  Yusuke Suzuki  <utatane.tea@gmail.com>
2565
2566         [WTF] ThreadSpecific should not introduce additional indirection
2567         https://bugs.webkit.org/show_bug.cgi?id=175187
2568
2569         Reviewed by Mark Lam.
2570
2571         We drop ThreadSpecific::replace feature which is only used by
2572         Web thread. Instead, we use ThreadSpecific<std::unique_ptr<T>> here.
2573
2574         While this std::unique_ptr<T> shares one instance between main thread
2575         and web thread, this is the same to the current implementation. It is
2576         safe because the web thread never finishes.
2577
2578         And for non-web thread implementation, we just use ThreadSpecific<T>,
2579         since it is the most efficient.
2580
2581         * platform/ThreadGlobalData.cpp:
2582         (WebCore::ThreadGlobalData::ThreadGlobalData):
2583         (WebCore::ThreadGlobalData::setWebCoreThreadData):
2584         (WebCore::threadGlobalData):
2585         We also drop StringImpl::empty() call since it is not necessary now:
2586         StringImpl::empty data is statically initialized by using constexpr.
2587
2588         * platform/ThreadGlobalData.h:
2589         We make it FAST_ALLOCATED since it is previously allocated by fast malloc
2590         in ThreadSpecific.
2591
2592 2017-08-10  Michael Catanzaro  <mcatanzaro@igalia.com>
2593
2594         REGRESSION(r220515) [GTK][CMake] Build with ENABLE_GEOLOCATION fails on Debian Jessie
2595         https://bugs.webkit.org/show_bug.cgi?id=175426
2596
2597         Reviewed by Carlos Alberto Lopez Perez.
2598
2599         Also stop using GEOCLUE_LIBRARIES and GEOCLUE_INCLUDE_DIRS, since they are empty. Apparently
2600         we have not actually been using the client library at all this whole time, only the D-Bus
2601         interface.
2602
2603         * PlatformGTK.cmake:
2604
2605 2017-08-10  Brady Eidson  <beidson@apple.com>
2606
2607         Add ServiceWorkerJob.
2608         https://bugs.webkit.org/show_bug.cgi?id=175241
2609
2610         Reviewed by Tim Horton.
2611
2612         Test: http/tests/workers/service/basic-register.html
2613
2614         This patch does a few things:
2615         - Adds the spec concept of a ServiceWorkerJob (in the WebProcess, at least)
2616         - Adds a ServiceWorkerProvider interface for WebKit to implement
2617         - Actually creates a job for service worker registration and "schedules" it,
2618           though it always immediately errors out the promise.
2619
2620         Actually queuing jobs and executing asynchronously is coming up soon.
2621
2622         * CMakeLists.txt:
2623         * WebCore.xcodeproj/project.pbxproj:
2624
2625         * dom/Document.cpp:
2626         (WebCore::Document::sessionID const):
2627         * dom/Document.h:
2628
2629         * workers/ServiceWorkerContainer.cpp:
2630         (WebCore::ServiceWorkerContainer::~ServiceWorkerContainer):
2631         (WebCore::ServiceWorkerContainer::addRegistration):
2632         (WebCore::ServiceWorkerContainer::scheduleJob):
2633         (WebCore::ServiceWorkerContainer::jobDidFinish):
2634         * workers/ServiceWorkerContainer.h:
2635
2636         * workers/ServiceWorkerJob.cpp: Added.
2637         (WebCore::ServiceWorkerJob::ServiceWorkerJob):
2638         (WebCore::ServiceWorkerJob::~ServiceWorkerJob):
2639         (WebCore::ServiceWorkerJob::failedWithException):
2640         * workers/ServiceWorkerJob.h: Copied from Source/WebCore/workers/ServiceWorkerContainer.h.
2641         (WebCore::ServiceWorkerJob::createRegisterJob):
2642         (WebCore::ServiceWorkerJob::identifier const):
2643
2644         * workers/ServiceWorkerJobClient.h: Added.
2645         (WebCore::ServiceWorkerJobClient::~ServiceWorkerJobClient):
2646
2647         * workers/ServiceWorkerProvider.cpp: Added.
2648         (WebCore::ServiceWorkerProvider::singleton):
2649         (WebCore::ServiceWorkerProvider::setSharedProvider):
2650         * workers/ServiceWorkerProvider.h: Added.
2651         * workers/ServiceWorkerRegistrationOptions.h: Copied from Source/WebCore/workers/ServiceWorkerContainer.h.
2652         * workers/ServiceWorkerRegistrationParameters.cpp: Added.
2653         * workers/ServiceWorkerRegistrationParameters.h: Added.
2654
2655 2017-08-10  Tim Horton  <timothy_horton@apple.com>
2656
2657         Remove some unused lambda captures so that WebKit builds with -Wunused-lambda-capture
2658         https://bugs.webkit.org/show_bug.cgi?id=175436
2659         <rdar://problem/33667497>
2660
2661         Reviewed by Simon Fraser.
2662
2663         * platform/audio/cocoa/MediaSessionManagerCocoa.cpp:
2664         (PlatformMediaSessionManager::updateSessionState):
2665         * platform/graphics/cocoa/WebCoreDecompressionSession.mm:
2666         (WebCore::WebCoreDecompressionSession::handleDecompressionOutput):
2667
2668 2017-08-10  Commit Queue  <commit-queue@webkit.org>
2669
2670         Unreviewed, rolling out r220463.
2671         https://bugs.webkit.org/show_bug.cgi?id=175435
2672
2673         unaccepted fix (Requested by n_wang on #webkit).
2674
2675         Reverted changeset:
2676
2677         "AX: crash at
2678         WebCore::AccessibilityObject::supportsARIALiveRegion() const +
2679         24"
2680         https://bugs.webkit.org/show_bug.cgi?id=175340
2681         http://trac.webkit.org/changeset/220463
2682
2683 2017-08-10  Michael Catanzaro  <mcatanzaro@igalia.com>
2684
2685         Remove ENABLE_GAMEPAD_DEPRECATED
2686         https://bugs.webkit.org/show_bug.cgi?id=175361
2687
2688         Reviewed by Carlos Garcia Campos.
2689
2690         * CMakeLists.txt:
2691         * Configurations/FeatureDefines.xcconfig:
2692         * PlatformGTK.cmake:
2693         * PlatformWPE.cmake:
2694         * platform/Linux.cmake: Removed.
2695         * platform/gamepad/deprecated/Gamepads.h: Removed.
2696         * platform/gamepad/glib/GamepadsGlib.cpp: Removed.
2697         * platform/gamepad/linux/GamepadDeviceLinux.cpp: Removed.
2698         * platform/gamepad/linux/GamepadDeviceLinux.h: Removed.
2699
2700 2017-08-10  Myles C. Maxfield  <mmaxfield@apple.com>
2701
2702         Addressing post-review comments after r219173.
2703         https://bugs.webkit.org/show_bug.cgi?id=174149
2704
2705         Unreviewed.
2706
2707         * css/CSSFontStyleValue.h:
2708         * editing/EditingStyle.cpp:
2709         (WebCore::identifierForStyleProperty):
2710
2711 2017-08-10  Antti Koivisto  <antti@apple.com>
2712
2713         Try to fix windows build.
2714
2715         * style/StyleUpdate.h:
2716         (WebCore::Style::TextUpdate::TextUpdate):
2717
2718 2017-08-10  Carlos Garcia Campos  <cgarcia@igalia.com>
2719
2720         [GTK] Crashes in WebCore::PasteboardHelper::fillSelectionData when source file of drag is unavailable
2721         https://bugs.webkit.org/show_bug.cgi?id=174161
2722
2723         Reviewed by Xabier Rodriguez-Calvar.
2724
2725         In r219385 we changed the early return in fillSelectionData() to check the selection data length instead of the
2726         data pointer. However, the gtk_selection_data_get_length() can return -1, so we need to check also if the value
2727         less than 0. The case of setting an empty string could be valid depending on the target type, so it's better to
2728         return early only when data lenght is less than 0 and handle the 0 length case in each target.
2729
2730         * platform/gtk/PasteboardHelper.cpp:
2731         (WebCore::PasteboardHelper::fillSelectionData):
2732
2733 2017-08-10  Antti Koivisto  <antti@apple.com>
2734
2735         Text renderer updates should be done by RenderTreeUpdater
2736         https://bugs.webkit.org/show_bug.cgi?id=175417
2737
2738         Reviewed by Andreas Kling.
2739
2740         All render tree mutations should be done by RenderTreeUpdater. Currently
2741         Text::updateRendererAfterContentChange calls RenderText::setTextWithOffset directly.
2742
2743         * dom/Document.cpp:
2744         (WebCore::Document::updateTextRenderer):
2745
2746             Add range argument.
2747
2748         * dom/Document.h:
2749         * dom/Text.cpp:
2750         (WebCore::Text::updateRendererAfterContentChange):
2751
2752             Remove call to setTextWithOffset and pass the range to updateTextRenderer
2753
2754         * style/RenderTreeUpdater.cpp:
2755         (WebCore::RenderTreeUpdater::updateRenderTree):
2756         (WebCore::RenderTreeUpdater::updateTextRenderer):
2757
2758             Call setTextWithOffset here.
2759
2760         * style/RenderTreeUpdater.h:
2761         * style/StyleTreeResolver.cpp:
2762         (WebCore::Style::TreeResolver::resolveComposedTree):
2763         * style/StyleUpdate.cpp:
2764         (WebCore::Style::Update::textUpdate const):
2765         (WebCore::Style::Update::addText):
2766
2767             Add TextUpdate struct similar to ElementUpdate to pass the range to the RenderTreeUpdater.
2768
2769         * style/StyleUpdate.h:
2770
2771 2017-08-10  Zan Dobersek  <zdobersek@igalia.com>
2772
2773         Unreviewed GTK+ build fix for ENABLE_GLES2=ON.
2774
2775         * platform/graphics/texmap/TextureMapperGLHeaders.h:
2776         Define various GL constants that are not provided in GLES2 headers
2777         but are only leveraged in OpenGL calls if at runtime the underlying
2778         OpenGL is GLES2-capable.
2779
2780 2017-08-10  Zan Dobersek  <zdobersek@igalia.com>
2781
2782         [TexMap] Remove GraphicsContext3D usage from BitmapTexturePool
2783         https://bugs.webkit.org/show_bug.cgi?id=175319
2784
2785         Reviewed by Carlos Garcia Campos.
2786
2787         Drop the GraphicsContext3D reference in BitmapTexturePool now
2788         that the BitmapTextureGL doesn't require it anymore.
2789
2790         No new tests -- no change in behavior.
2791
2792         * platform/graphics/texmap/BitmapTexturePool.cpp:
2793         (WebCore::BitmapTexturePool::BitmapTexturePool):
2794         * platform/graphics/texmap/BitmapTexturePool.h:
2795         * platform/graphics/texmap/TextureMapperGL.cpp:
2796         (WebCore::TextureMapperGL::TextureMapperGL):
2797
2798 2017-08-10  Zan Dobersek  <zdobersek@igalia.com>
2799
2800         [TexMap] Drop GraphicsContext3D usage from BitmapTextureGL
2801         https://bugs.webkit.org/show_bug.cgi?id=175317
2802
2803         Reviewed by Carlos Garcia Campos.
2804
2805         Have BitmapTextureGL use direct OpenGL API entrypoints and constants
2806         instead of leveraging the GraphicsContext3D class. Any GraphicsContext3D
2807         object passed to BitmapTextureGL would assume rendering to the GL context
2808         that's current on that thread, translating method invocations to the
2809         OpenGL API. We can do this by ourselves and benefit by avoiding allocating
2810         GraphicsContext3D resources like the ANGLE compiler that are by most useful
2811         for WebGL.
2812
2813         BitmapTextureGL::create() call sites are adjusted to stop passing a
2814         GraphicsContext3D reference. BitmapTextureGL::bindAsSurface() doesn't need
2815         a replacement for the passed-in GraphicsContext3D object since that object
2816         originated from the TextureMapperGL instance, whose GraphicsContext3D is by
2817         default of the render-to-current-context nature. Other changes are direct
2818         translations of GraphicsContext3D methods to OpenGL API calls, or of
2819         GraphicsContext3D values to OpenGL API constants.
2820
2821         No new tests -- no change in behavior.
2822
2823         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp:
2824         (WebCore::MediaPlayerPrivateGStreamerBase::pushTextureToCompositor):
2825         * platform/graphics/texmap/BitmapTextureGL.cpp:
2826         Also remove an unnecessary GraphicsContext.h header inclusion.
2827         (WebCore::BitmapTextureGL::BitmapTextureGL):
2828         (WebCore::BitmapTextureGL::didReset):
2829         (WebCore::BitmapTextureGL::updateContentsNoSwizzle):
2830         (WebCore::BitmapTextureGL::updateContents):
2831         (WebCore::BitmapTextureGL::initializeStencil):
2832         (WebCore::BitmapTextureGL::initializeDepthBuffer):
2833         (WebCore::BitmapTextureGL::clearIfNeeded):
2834         (WebCore::BitmapTextureGL::createFboIfNeeded):
2835         (WebCore::BitmapTextureGL::bindAsSurface):
2836         (WebCore::BitmapTextureGL::~BitmapTextureGL):
2837         (WebCore::BitmapTextureGL::copyFromExternalTexture):
2838         * platform/graphics/texmap/BitmapTextureGL.h:
2839         (WebCore::BitmapTextureGL::create):
2840         (WebCore::BitmapTextureGL::textureTarget const):
2841         (WebCore::BitmapTextureGL::internalFormat const):
2842         * platform/graphics/texmap/BitmapTexturePool.cpp:
2843         (WebCore::BitmapTexturePool::createTexture):
2844         * platform/graphics/texmap/TextureMapperGL.cpp:
2845         (WebCore::TextureMapperGL::bindSurface):
2846         (WebCore::TextureMapperGL::createTexture):
2847
2848 2017-08-09  Michael Catanzaro  <mcatanzaro@igalia.com>
2849
2850         [GTK] Remove support for geoclue1
2851         https://bugs.webkit.org/show_bug.cgi?id=164205
2852
2853         Reviewed by Carlos Garcia Campos.
2854
2855         * PlatformGTK.cmake:
2856         * platform/geoclue/GeolocationProviderGeoclue.h:
2857         * platform/geoclue/GeolocationProviderGeoclue1.cpp: Removed.
2858         * platform/geoclue/GeolocationProviderGeoclue2.cpp: Removed.
2859
2860 2017-08-09  Yoshiaki Jitsukawa  <Yoshiaki.Jitsukawa@sony.com>
2861
2862         [PAL] Move spi/cocoa and spi/cg directories into PAL
2863         https://bugs.webkit.org/show_bug.cgi?id=175175
2864
2865         Reviewed by Myles C. Maxfield.
2866
2867         * Modules/applepay/cocoa/PaymentCocoa.mm:
2868         * Modules/applepay/cocoa/PaymentContactCocoa.mm:
2869         * Modules/applepay/cocoa/PaymentMerchantSessionCocoa.mm:
2870         * Modules/applepay/cocoa/PaymentMethodCocoa.mm:
2871         * PlatformAppleWin.cmake:
2872         * WebCore.xcodeproj/project.pbxproj:
2873         * editing/cocoa/EditorCocoa.mm:
2874         * editing/cocoa/HTMLConverter.mm:
2875         * editing/ios/EditorIOS.mm:
2876         * page/cocoa/ResourceUsageThreadCocoa.mm:
2877         * page/mac/TextIndicatorWindow.mm:
2878         * platform/cocoa/ContentFilterUnblockHandlerCocoa.mm:
2879         * platform/cocoa/DataDetectorsCoreSoftLink.h:
2880         * platform/cocoa/MIMETypeRegistryCocoa.mm:
2881         * platform/cocoa/NetworkExtensionContentFilter.mm:
2882         * platform/cocoa/ParentalControlsContentFilter.mm:
2883         * platform/cocoa/SleepDisablerCocoa.cpp:
2884         * platform/graphics/Font.cpp:
2885         * platform/graphics/Font.h:
2886         * platform/graphics/avfoundation/objc/AVAssetTrackUtilities.mm:
2887         * platform/graphics/avfoundation/objc/MediaPlaybackTargetPickerMac.mm:
2888         * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
2889         * platform/graphics/avfoundation/objc/VideoFullscreenLayerManager.mm:
2890         * platform/graphics/ca/cocoa/PlatformCAAnimationCocoa.mm:
2891         * platform/graphics/ca/cocoa/PlatformCAFiltersCocoa.mm:
2892         * platform/graphics/ca/cocoa/PlatformCALayerCocoa.mm:
2893         * platform/graphics/cg/ColorCG.cpp:
2894         * platform/graphics/cg/GraphicsContextCG.cpp:
2895         * platform/graphics/cg/ImageBufferCG.cpp:
2896         * platform/graphics/cg/ImageBufferDataCG.cpp:
2897         * platform/graphics/cg/ImageDecoderCG.cpp:
2898         * platform/graphics/cg/NativeImageCG.cpp:
2899         * platform/graphics/cocoa/FontCacheCoreText.cpp:
2900         * platform/graphics/cocoa/FontCascadeCocoa.mm:
2901         * platform/graphics/cocoa/FontCocoa.mm:
2902         * platform/graphics/cocoa/FontDescriptionCocoa.cpp:
2903         * platform/graphics/cocoa/FontPlatformDataCocoa.mm:
2904         * platform/graphics/cocoa/IOSurface.mm:
2905         * platform/graphics/cocoa/TextTrackRepresentationCocoa.mm:
2906         * platform/graphics/cocoa/WebActionDisablingCALayerDelegate.h:
2907         * platform/graphics/ios/FontAntialiasingStateSaver.h:
2908         * platform/graphics/ios/FontCacheIOS.mm:
2909         * platform/graphics/mac/ComplexTextControllerCoreText.mm:
2910         * platform/graphics/mac/FontCacheMac.mm:
2911         * platform/graphics/mac/GlyphPageMac.cpp:
2912         * platform/graphics/win/FontCacheWin.cpp:
2913         * platform/ios/LegacyTileCache.mm:
2914         * platform/ios/LegacyTileGrid.mm:
2915         * platform/ios/LegacyTileGridTile.mm:
2916         * platform/ios/PlaybackSessionInterfaceAVKit.mm:
2917         * platform/ios/QuickLook.mm:
2918         * platform/ios/VideoFullscreenInterfaceAVKit.mm:
2919         * platform/ios/WebAVPlayerController.h:
2920         * platform/ios/WebAVPlayerController.mm:
2921         * platform/ios/WebVideoFullscreenControllerAVKit.mm:
2922         * platform/ios/wak/WKGraphics.mm:
2923         * platform/mac/DragImageMac.mm:
2924         * platform/mac/PlatformScreenMac.mm:
2925         * platform/mac/PlaybackSessionInterfaceMac.mm:
2926         * platform/mac/ThemeMac.mm:
2927         * platform/mac/VideoFullscreenInterfaceMac.mm:
2928         * platform/mac/WebPlaybackControlsManager.h:
2929         * platform/mac/WebVideoFullscreenHUDWindowController.mm:
2930         * platform/network/cocoa/CookieStorageObserver.mm:
2931         * platform/network/cocoa/NetworkLoadMetrics.mm:
2932         * platform/network/mac/AuthenticationMac.mm:
2933         * platform/network/mac/ResourceHandleMac.mm:
2934         * platform/spi/ios/DataDetectorsUISPI.h:
2935         * platform/spi/mac/DataDetectorsSPI.h:
2936         * platform/spi/mac/NSViewSPI.h:
2937         * rendering/RenderThemeCocoa.mm:
2938         * rendering/RenderThemeIOS.mm:
2939         * rendering/RenderThemeMac.mm:
2940
2941 2017-08-09  Don Olmstead  <don.olmstead@sony.com>
2942
2943         [WTF] Move TextStream into WTF
2944         https://bugs.webkit.org/show_bug.cgi?id=175211
2945
2946         Reviewed by Myles C. Maxfield.
2947
2948         No new tests. No change in behavior.
2949
2950         * CMakeLists.txt:
2951         * WebCore.xcodeproj/project.pbxproj:
2952         * dom/ComposedTreeIterator.cpp:
2953         * dom/Position.cpp:
2954         * dom/Position.h:
2955         * dom/Range.cpp:
2956         (WebCore::operator<<):
2957         * dom/Range.h:
2958         * dom/ViewportArguments.cpp:
2959         * dom/ViewportArguments.h:
2960         * editing/VisiblePosition.cpp:
2961         * editing/VisiblePosition.h:
2962         * editing/VisibleSelection.cpp:
2963         * editing/VisibleSelection.h:
2964         * html/HTMLVideoElement.cpp:
2965         * html/canvas/CanvasRenderingContext2D.cpp:
2966         * page/FrameView.cpp:
2967         * page/ViewportConfiguration.cpp:
2968         * page/ViewportConfiguration.h:
2969         * page/WheelEventDeltaFilter.cpp:
2970         * page/animation/CSSPropertyAnimation.cpp:
2971         * page/scrolling/AsyncScrollingCoordinator.cpp:
2972         * page/scrolling/ScrollingConstraints.cpp:
2973         * page/scrolling/ScrollingConstraints.h:
2974         * page/scrolling/ScrollingCoordinator.cpp:
2975         * page/scrolling/ScrollingCoordinator.h:
2976         * page/scrolling/ScrollingStateFixedNode.cpp:
2977         * page/scrolling/ScrollingStateFixedNode.h:
2978         * page/scrolling/ScrollingStateFrameScrollingNode.cpp:
2979         * page/scrolling/ScrollingStateFrameScrollingNode.h:
2980         * page/scrolling/ScrollingStateNode.cpp:
2981         * page/scrolling/ScrollingStateNode.h:
2982         * page/scrolling/ScrollingStateOverflowScrollingNode.cpp:
2983         * page/scrolling/ScrollingStateOverflowScrollingNode.h:
2984         * page/scrolling/ScrollingStateScrollingNode.cpp:
2985         * page/scrolling/ScrollingStateScrollingNode.h:
2986         * page/scrolling/ScrollingStateStickyNode.cpp:
2987         * page/scrolling/ScrollingStateStickyNode.h:
2988         * page/scrolling/ScrollingTree.cpp:
2989         * page/scrolling/ScrollingTreeFrameScrollingNode.cpp:
2990         * page/scrolling/ScrollingTreeFrameScrollingNode.h:
2991         * page/scrolling/ScrollingTreeNode.cpp:
2992         * page/scrolling/ScrollingTreeNode.h:
2993         * page/scrolling/ScrollingTreeScrollingNode.cpp:
2994         * page/scrolling/ScrollingTreeScrollingNode.h:
2995         * page/scrolling/mac/ScrollingTreeFixedNode.h:
2996         * page/scrolling/mac/ScrollingTreeFixedNode.mm:
2997         * page/scrolling/mac/ScrollingTreeFrameScrollingNodeMac.mm:
2998         * page/scrolling/mac/ScrollingTreeStickyNode.h:
2999         * page/scrolling/mac/ScrollingTreeStickyNode.mm:
3000         * platform/CalculationValue.cpp:
3001         * platform/CalculationValue.h:
3002         * platform/LayoutUnit.cpp:
3003         * platform/LayoutUnit.h:
3004         * platform/Length.cpp:
3005         * platform/Length.h:
3006         * platform/LengthBox.cpp:
3007         * platform/LengthBox.h:
3008         * platform/LengthPoint.cpp:
3009         * platform/LengthPoint.h:
3010         * platform/LengthSize.cpp:
3011         * platform/LengthSize.h:
3012         * platform/LogMacros.h:
3013         * platform/ScrollView.cpp:
3014         * platform/ScrollableArea.cpp:
3015         * platform/animation/TimingFunction.cpp:
3016         * platform/animation/TimingFunction.h:
3017         * platform/graphics/BitmapImage.cpp:
3018         * platform/graphics/BitmapImage.h:
3019         * platform/graphics/Color.cpp:
3020         * platform/graphics/Color.h:
3021         * platform/graphics/CrossfadeGeneratedImage.cpp:
3022         * platform/graphics/CrossfadeGeneratedImage.h:
3023         * platform/graphics/FloatPoint.cpp:
3024         * platform/graphics/FloatPoint.h:
3025         * platform/graphics/FloatPoint3D.cpp:
3026         * platform/graphics/FloatPoint3D.h:
3027         * platform/graphics/FloatRect.cpp:
3028         * platform/graphics/FloatRect.h:
3029         * platform/graphics/FloatRoundedRect.cpp:
3030         * platform/graphics/FloatRoundedRect.h:
3031         * platform/graphics/FloatSize.cpp:
3032         * platform/graphics/FloatSize.h:
3033         * platform/graphics/FontTaggedSettings.cpp:
3034         * platform/graphics/FontTaggedSettings.h:
3035         * platform/graphics/GradientImage.cpp:
3036         (WebCore::GradientImage::dump const):
3037         * platform/graphics/GradientImage.h:
3038         * platform/graphics/GraphicsContext.cpp:
3039         * platform/graphics/GraphicsContext.h:
3040         * platform/graphics/GraphicsLayer.cpp:
3041         * platform/graphics/GraphicsLayer.h:
3042         (WebCore::GraphicsLayer::dumpAdditionalProperties const):
3043         * platform/graphics/GraphicsTypes.cpp:
3044         * platform/graphics/GraphicsTypes.h:
3045         * platform/graphics/Image.cpp:
3046         * platform/graphics/Image.h:
3047         * platform/graphics/ImageSource.h:
3048         * platform/graphics/IntPoint.cpp:
3049         * platform/graphics/IntPoint.h:
3050         * platform/graphics/IntRect.cpp:
3051         * platform/graphics/IntRect.h:
3052         * platform/graphics/IntSize.cpp:
3053         * platform/graphics/IntSize.h:
3054         * platform/graphics/LayoutPoint.cpp:
3055         * platform/graphics/LayoutPoint.h:
3056         * platform/graphics/LayoutRect.cpp:
3057         * platform/graphics/LayoutRect.h:
3058         * platform/graphics/LayoutSize.cpp:
3059         * platform/graphics/LayoutSize.h:
3060         * platform/graphics/NamedImageGeneratedImage.cpp:
3061         * platform/graphics/NamedImageGeneratedImage.h:
3062         * platform/graphics/Path.cpp:
3063         * platform/graphics/Path.h:
3064         * platform/graphics/ca/GraphicsLayerCA.cpp:
3065         * platform/graphics/ca/GraphicsLayerCA.h:
3066         * platform/graphics/ca/PlatformCAAnimation.cpp:
3067         * platform/graphics/ca/PlatformCAAnimation.h:
3068         * platform/graphics/ca/PlatformCALayer.cpp:
3069         * platform/graphics/ca/PlatformCALayer.h:
3070         * platform/graphics/ca/TileController.cpp:
3071         * platform/graphics/ca/TileGrid.cpp:
3072         * platform/graphics/cg/GraphicsContextCG.cpp:
3073         * platform/graphics/cg/PDFDocumentImage.cpp:
3074         * platform/graphics/cg/PDFDocumentImage.h:
3075         * platform/graphics/cocoa/IOSurface.h:
3076         * platform/graphics/cocoa/IOSurface.mm:
3077         * platform/graphics/displaylists/DisplayList.cpp:
3078         (WebCore::DisplayList::DisplayList::description const):
3079         * platform/graphics/displaylists/DisplayList.h:
3080         * platform/graphics/displaylists/DisplayListItems.cpp:
3081         * platform/graphics/displaylists/DisplayListItems.h:
3082         * platform/graphics/displaylists/DisplayListRecorder.cpp:
3083         * platform/graphics/displaylists/DisplayListReplayer.cpp:
3084         * platform/graphics/filters/DistantLightSource.cpp:
3085         * platform/graphics/filters/DistantLightSource.h:
3086         * platform/graphics/filters/FEBlend.cpp:
3087         * platform/graphics/filters/FEBlend.h:
3088         * platform/graphics/filters/FEColorMatrix.cpp:
3089         * platform/graphics/filters/FEColorMatrix.h:
3090         * platform/graphics/filters/FEComponentTransfer.cpp:
3091         * platform/graphics/filters/FEComponentTransfer.h:
3092         * platform/graphics/filters/FEComposite.cpp:
3093         * platform/graphics/filters/FEComposite.h:
3094         * platform/graphics/filters/FEConvolveMatrix.cpp:
3095         * platform/graphics/filters/FEConvolveMatrix.h:
3096         * platform/graphics/filters/FEDiffuseLighting.cpp:
3097         * platform/graphics/filters/FEDiffuseLighting.h:
3098         * platform/graphics/filters/FEDisplacementMap.cpp:
3099         * platform/graphics/filters/FEDisplacementMap.h:
3100         * platform/graphics/filters/FEDropShadow.cpp:
3101         * platform/graphics/filters/FEDropShadow.h:
3102         * platform/graphics/filters/FEFlood.cpp:
3103         * platform/graphics/filters/FEFlood.h:
3104         * platform/graphics/filters/FEGaussianBlur.cpp:
3105         * platform/graphics/filters/FEGaussianBlur.h:
3106         * platform/graphics/filters/FEMerge.cpp:
3107         * platform/graphics/filters/FEMerge.h:
3108         * platform/graphics/filters/FEMorphology.cpp:
3109         * platform/graphics/filters/FEMorphology.h:
3110         * platform/graphics/filters/FEOffset.cpp:
3111         * platform/graphics/filters/FEOffset.h:
3112         * platform/graphics/filters/FESpecularLighting.cpp:
3113         * platform/graphics/filters/FESpecularLighting.h:
3114         * platform/graphics/filters/FETile.cpp:
3115         * platform/graphics/filters/FETile.h:
3116         * platform/graphics/filters/FETurbulence.cpp:
3117         * platform/graphics/filters/FETurbulence.h:
3118         * platform/graphics/filters/FilterEffect.cpp:
3119         * platform/graphics/filters/FilterEffect.h:
3120         * platform/graphics/filters/FilterOperation.cpp:
3121         * platform/graphics/filters/FilterOperation.h:
3122         * platform/graphics/filters/FilterOperations.cpp:
3123         * platform/graphics/filters/FilterOperations.h:
3124         * platform/graphics/filters/LightSource.h:
3125         * platform/graphics/filters/PointLightSource.cpp:
3126         * platform/graphics/filters/PointLightSource.h:
3127         * platform/graphics/filters/SourceAlpha.cpp:
3128         * platform/graphics/filters/SourceAlpha.h:
3129         * platform/graphics/filters/SourceGraphic.cpp:
3130         * platform/graphics/filters/SourceGraphic.h:
3131         * platform/graphics/filters/SpotLightSource.cpp:
3132         * platform/graphics/filters/SpotLightSource.h:
3133         * platform/graphics/transforms/AffineTransform.cpp:
3134         * platform/graphics/transforms/AffineTransform.h:
3135         * platform/graphics/transforms/IdentityTransformOperation.h:
3136         * platform/graphics/transforms/Matrix3DTransformOperation.cpp:
3137         * platform/graphics/transforms/Matrix3DTransformOperation.h:
3138         * platform/graphics/transforms/MatrixTransformOperation.cpp:
3139         * platform/graphics/transforms/MatrixTransformOperation.h:
3140         * platform/graphics/transforms/PerspectiveTransformOperation.cpp:
3141         * platform/graphics/transforms/PerspectiveTransformOperation.h:
3142         * platform/graphics/transforms/RotateTransformOperation.cpp:
3143         * platform/graphics/transforms/RotateTransformOperation.h:
3144         * platform/graphics/transforms/ScaleTransformOperation.cpp:
3145         * platform/graphics/transforms/ScaleTransformOperation.h:
3146         * platform/graphics/transforms/SkewTransformOperation.cpp:
3147         * platform/graphics/transforms/SkewTransformOperation.h:
3148         * platform/graphics/transforms/TransformOperation.cpp:
3149         * platform/graphics/transforms/TransformOperation.h:
3150         * platform/graphics/transforms/TransformOperations.cpp:
3151         * platform/graphics/transforms/TransformOperations.h:
3152         * platform/graphics/transforms/TransformationMatrix.cpp:
3153         * platform/graphics/transforms/TransformationMatrix.h:
3154         * platform/graphics/transforms/TranslateTransformOperation.cpp:
3155         * platform/graphics/transforms/TranslateTransformOperation.h:
3156         * platform/ios/SelectionRect.cpp:
3157         (WebCore::operator<<):
3158         * platform/ios/SelectionRect.h:
3159         * platform/mac/ScrollAnimatorMac.mm:
3160         * platform/text/TextAllInOne.cpp:
3161         * rendering/InlineBox.cpp:
3162         * rendering/InlineBox.h:
3163         * rendering/InlineFlowBox.cpp:
3164         (WebCore::InlineFlowBox::outputLineTreeAndMark const):
3165         * rendering/InlineFlowBox.h:
3166         * rendering/InlineTextBox.cpp:
3167         * rendering/InlineTextBox.h:
3168         * rendering/RenderBlockFlow.cpp:
3169         (WebCore::RenderBlockFlow::outputLineTreeAndMark const):
3170         * rendering/RenderBlockFlow.h:
3171         * rendering/RenderLayer.cpp:
3172         * rendering/RenderLayerCompositor.cpp:
3173         * rendering/RenderObject.cpp:
3174         * rendering/RenderObject.h:
3175         * rendering/RenderTreeAsText.cpp:
3176         * rendering/RenderTreeAsText.h:
3177         * rendering/ScrollAlignment.cpp:
3178         * rendering/ScrollAlignment.h:
3179         * rendering/SimpleLineLayoutCoverage.cpp:
3180         * rendering/SimpleLineLayoutFunctions.cpp:
3181         * rendering/SimpleLineLayoutFunctions.h:
3182         * rendering/style/FillLayer.cpp:
3183         * rendering/style/FillLayer.h:
3184         * rendering/style/NinePieceImage.cpp:
3185         * rendering/style/NinePieceImage.h:
3186         * rendering/style/RenderStyleConstants.cpp:
3187         * rendering/style/RenderStyleConstants.h:
3188         * rendering/svg/SVGRenderTreeAsText.cpp:
3189         (WebCore::operator<<):
3190         * rendering/svg/SVGRenderTreeAsText.h:
3191         (WebCore::operator<<):
3192         * svg/SVGLengthValue.cpp:
3193         * svg/SVGLengthValue.h:
3194         * svg/graphics/SVGImage.cpp:
3195         * svg/graphics/SVGImage.h:
3196         * svg/graphics/filters/SVGFEImage.cpp:
3197         * svg/graphics/filters/SVGFEImage.h:
3198
3199 2017-08-09  Commit Queue  <commit-queue@webkit.org>
3200
3201         Unreviewed, rolling out r220466, r220477, and r220487.
3202         https://bugs.webkit.org/show_bug.cgi?id=175411
3203
3204         This change broke existing API tests and follow up fixes did
3205         not resolve all the issues. (Requested by ryanhaddad on
3206         #webkit).
3207
3208         Reverted changesets:
3209
3210         https://bugs.webkit.org/show_bug.cgi?id=175244
3211         http://trac.webkit.org/changeset/220466
3212
3213         "WTF::Function does not allow for reference / non-default
3214         constructible return types"
3215         https://bugs.webkit.org/show_bug.cgi?id=175244
3216         http://trac.webkit.org/changeset/220477
3217
3218         https://bugs.webkit.org/show_bug.cgi?id=175244
3219         http://trac.webkit.org/changeset/220487
3220
3221 2017-08-09  Chris Dumez  <cdumez@apple.com>
3222
3223         [Beacon][NetworkSession] Support CORS-preflighting on redirects
3224         https://bugs.webkit.org/show_bug.cgi?id=175386
3225         <rdar://problem/33801370>
3226
3227         Reviewed by Youenn Fablet.
3228
3229         Export a couple of WebCore symbols so I can use them in WebKit2.
3230
3231         Tests: http/wpt/beacon/cors/cors-preflight-redirect-failure.html
3232                http/wpt/beacon/cors/cors-preflight-redirect-from-crossorigin-to-sameorigin.html
3233                http/wpt/beacon/cors/cors-preflight-redirect-success.html
3234
3235         * loader/CrossOriginAccessControl.h:
3236         * page/SecurityOrigin.h:
3237
3238 2017-08-09  Jeremy Jones  <jeremyj@apple.com>
3239
3240         Use MPAVRoutingController instead of deprecated versions.
3241         https://bugs.webkit.org/show_bug.cgi?id=175063
3242
3243         Reviewed by Tim Horton.
3244
3245         No new tests because no behavior change. This uses a different platform class to present
3246         an interface.
3247
3248         Remove deprecated MPAudioVideoRoutingPopoverController and MPAVRoutingSheet
3249         Add MPMediaControlsViewController.
3250
3251         * platform/spi/ios/MediaPlayerSPI.h:
3252
3253 2017-08-09  Myles C. Maxfield  <mmaxfield@apple.com>
3254
3255         Mark font-display as in development
3256         https://bugs.webkit.org/show_bug.cgi?id=175387
3257
3258         Unreviewed.
3259
3260         * features.json:
3261
3262 2017-08-09  Commit Queue  <commit-queue@webkit.org>
3263
3264         Unreviewed, rolling out r219334.
3265         https://bugs.webkit.org/show_bug.cgi?id=175398
3266
3267         Caused bug 175023 (Requested by ap on #webkit).
3268
3269         Reverted changeset:
3270
3271         "[SVG] Leak in SVGAnimatedListPropertyTearOff"
3272         https://bugs.webkit.org/show_bug.cgi?id=172545
3273         http://trac.webkit.org/changeset/219334
3274
3275 2017-08-09  Dave Hyatt  <hyatt@apple.com>
3276
3277         [Repaint from Layout Removal] Move layer repaint rects into a map
3278         https://bugs.webkit.org/show_bug.cgi?id=175393
3279
3280         Reviewed by Zalan Bujtas.
3281
3282         Move the two repaint rects held by RenderLayer into a RenderLayerModelObject -> RepaintLayoutRects hash map.
3283         RepaintLayoutRects is a new struct that holds both rects.
3284
3285         Eventually more objects than just self painting layers will be caching repaint rects, so this takes a first
3286         step towards having a common cache for these repaint rects. In addition this change saves memory, since
3287         layers that aren't self-painting no longer have empty repaint rects taking up space in RenderLayer.
3288
3289         * rendering/RenderBlockLineLayout.cpp:
3290         (WebCore::RenderBlockFlow::layoutRunsAndFloats):
3291         * rendering/RenderLayer.cpp:
3292         (WebCore::RenderLayer::RenderLayer):
3293         (WebCore::RenderLayer::updateLayerPositions):
3294         (WebCore::RenderLayer::repaintRectIncludingNonCompositingDescendants):
3295         (WebCore::RenderLayer::computeRepaintRects):
3296         (WebCore::RenderLayer::clearRepaintRects):
3297         (WebCore::RenderLayer::updateLayerPositionsAfterScroll):
3298         (WebCore::RenderLayer::scrollTo):
3299         * rendering/RenderLayer.h:
3300         * rendering/RenderLayerModelObject.cpp:
3301         (WebCore::RepaintLayoutRects::RepaintLayoutRects):
3302         (WebCore::RenderLayerModelObject::willBeDestroyed):
3303         (WebCore::RenderLayerModelObject::destroyLayer):
3304         (WebCore::RenderLayerModelObject::styleDidChange):
3305         (WebCore::RenderLayerModelObject::hasRepaintLayoutRects):
3306         (WebCore::RenderLayerModelObject::setRepaintLayoutRects):
3307         (WebCore::RenderLayerModelObject::clearRepaintLayoutRects):
3308         (WebCore::RenderLayerModelObject::repaintLayoutRects):
3309         (WebCore::RenderLayerModelObject::computeRepaintLayoutRects):
3310         * rendering/RenderLayerModelObject.h:
3311         (WebCore::RepaintLayoutRects::RepaintLayoutRects):
3312
3313 2017-08-09  Sam Weinig  <sam@webkit.org>
3314
3315         WTF::Function does not allow for reference / non-default constructible return types
3316         https://bugs.webkit.org/show_bug.cgi?id=175244
3317
3318         Reviewed by Chris Dumez.
3319
3320         * bindings/js/JSCustomElementInterface.h:
3321         (WebCore::JSCustomElementInterface::invokeCallback):
3322         Update the default value for the addArguments parameter to be an empty lambda, rather than
3323         default initialization, which leads to a null WTF::Function. This allows us to remove support
3324         for calling null WTF::Function. No change in behavior.
3325
3326 2017-08-09  Brady Eidson  <beidson@apple.com>
3327
3328         Teach ScriptExecutionContexts about their SessionID.
3329         https://bugs.webkit.org/show_bug.cgi?id=175391
3330
3331         Reviewed by Andy Estes.
3332
3333         No new tests (No current change in behavior).
3334
3335         Turns out that Workers need to know their SessionID for future feature development.
3336         So let's teach it to them.
3337
3338         * dom/ScriptExecutionContext.h: Expose a pure virtual SessionID accessor.
3339
3340         * dom/Document.cpp:
3341         (WebCore::Document::sessionID const):
3342         * dom/Document.h:
3343
3344         * page/SessionID.cpp:
3345         (WebCore::SessionID::isolatedCopy const):
3346         * page/SessionID.h:
3347
3348         * workers/DedicatedWorkerGlobalScope.cpp:
3349         (WebCore::DedicatedWorkerGlobalScope::create):
3350         (WebCore::DedicatedWorkerGlobalScope::DedicatedWorkerGlobalScope):
3351         * workers/DedicatedWorkerGlobalScope.h:
3352
3353         * workers/DedicatedWorkerThread.cpp:
3354         (WebCore::DedicatedWorkerThread::DedicatedWorkerThread):
3355         (WebCore::DedicatedWorkerThread::createWorkerGlobalScope):
3356         * workers/DedicatedWorkerThread.h:
3357
3358         * workers/Worker.cpp:
3359         (WebCore::Worker::notifyFinished):
3360
3361         * workers/WorkerGlobalScope.cpp:
3362         (WebCore::WorkerGlobalScope::WorkerGlobalScope):
3363         * workers/WorkerGlobalScope.h:
3364
3365         * workers/WorkerGlobalScopeProxy.h:
3366
3367         * workers/WorkerMessagingProxy.cpp:
3368         (WebCore::WorkerMessagingProxy::startWorkerGlobalScope):
3369         * workers/WorkerMessagingProxy.h:
3370
3371         * workers/WorkerThread.cpp:
3372         (WebCore::WorkerThreadStartupData::WorkerThreadStartupData):
3373         (WebCore::WorkerThread::WorkerThread):
3374         (WebCore::WorkerThread::workerThread):
3375         * workers/WorkerThread.h:
3376
3377 2017-08-09  Wenson Hsieh  <wenson_hsieh@apple.com>
3378
3379         [iOS DnD] ENABLE_DRAG_SUPPORT should be turned off for iOS 10 and enabled by default
3380         https://bugs.webkit.org/show_bug.cgi?id=175392
3381         <rdar://problem/33783207>
3382
3383         Reviewed by Tim Horton and Megan Gardner.
3384
3385         Tweak FeatureDefines to enable drag and drop by default, and disable only on unsupported platforms (i.e. iOS 10).
3386         No change in behavior.
3387
3388         * Configurations/FeatureDefines.xcconfig:
3389
3390 2017-08-09  Kirill Ovchinnikov  <kirill.ovchinnikov@lge.com>
3391
3392         Old subtitle track is not deleted on 'src' attribute change event
3393         https://bugs.webkit.org/show_bug.cgi?id=175031
3394
3395         Reviewed by Eric Carlson.
3396
3397         Test: media/track/text-track-src-change.html
3398
3399         * html/HTMLMediaElement.cpp:
3400         (WebCore::HTMLMediaElement::textTrackReadyStateChanged):
3401         * html/HTMLTrackElement.cpp:
3402         (WebCore::HTMLTrackElement::loadTimerFired):
3403         * html/shadow/MediaControls.cpp:
3404         (WebCore::MediaControls::clearTextDisplayContainer):
3405         * html/shadow/MediaControls.h:
3406
3407 2017-08-09  Ryan Haddad  <ryanhaddad@apple.com>
3408
3409         Unreviewed, rolling out r220457.
3410
3411         This change introduced API test failures.
3412
3413         Reverted changeset:
3414
3415         "WTF::Function does not allow for reference / non-default
3416         constructible return types"
3417         https://bugs.webkit.org/show_bug.cgi?id=175244
3418         http://trac.webkit.org/changeset/220457
3419
3420 2017-08-09  Don Olmstead  <don.olmstead@sony.com>
3421
3422         [WinCairo] Fix build after rev 220399
3423         https://bugs.webkit.org/show_bug.cgi?id=175360
3424
3425         Reviewed by Žan Doberšek.
3426
3427         No new tests. No change in behavior.
3428
3429         * platform/graphics/texmap/TextureMapperGLHeaders.h:
3430
3431 2017-08-09  Nan Wang  <n_wang@apple.com>
3432
3433         AX: crash at WebCore::AccessibilityObject::supportsARIALiveRegion() const + 24
3434         https://bugs.webkit.org/show_bug.cgi?id=175340
3435         <rdar://problem/33782159>
3436
3437         Reviewed by Chris Fleizach.
3438
3439         When adding a psuedo element child to a RenderBlockFlow element, there might be a chance where
3440         the element has already been layed out but we are still holding onto its stale children. Fixed it
3441         by notifying AX correctly when inserting/removing children during layout.
3442
3443         Test: accessibility/add-children-pseudo-element.html
3444
3445         * rendering/RenderBlockFlow.cpp:
3446         (WebCore::RenderBlockFlow::insertFloatingObject):
3447         (WebCore::RenderBlockFlow::removeFloatingObject):
3448
3449 2017-08-09  Charlie Turner  <cturner@igalia.com>
3450
3451         [GStreamer][MSE] Add missing lock around getStreamByTrackId
3452         https://bugs.webkit.org/show_bug.cgi?id=175323
3453
3454         Reviewed by Xabier Rodriguez-Calvar.
3455
3456         Covered by existing tests.
3457
3458         * platform/graphics/gstreamer/mse/PlaybackPipeline.cpp:
3459         (WebCore::PlaybackPipeline::enqueueSample): Ensure the media source
3460         lock is taken before modifiying the track queues indirectly via the
3461         iterator use in getTrackId.
3462
3463 2017-08-09  Daniel Bates  <dabates@apple.com>
3464
3465         REGRESSION (r219013): OAuth flows are broken when redirecting back to application after authentication
3466         https://bugs.webkit.org/show_bug.cgi?id=175247
3467         <rdar://problem/33679804>
3468
3469         Reviewed by Brady Eidson.
3470
3471         Add SPI so that Safari can differentiate between a form submission and a redirected form submission
3472         and have PolicyCheck notify the frame loader client if the navigation was in response to receiving a
3473         redirect response. This is the WebKit portion to fix an issue when a native app makes use of an OAuth
3474         OAuth flow that bounces to Safari for user login and then bounce back to the app. Microsoft Graph's
3475         OAuth flow is one example.
3476
3477         Safari was differentiating between a form submission and a redirected form submission based on the
3478         nullity of WKNavigationAction.sourceFrame because in both cases the navigation type was WKNavigationTypeFormSubmitted.
3479         The navigation type is the same for both navigations because WebKit always used the navigation
3480         action from the original request for the redirect request when the original request redirected.
3481         Prior to r219013, WKNavigationAction.sourceFrame would be nil for a form submission that redirects.
3482         Following r219013, WKNavigationAction.sourceFrame is non-nil unless the navigation was initiated by
3483         API. In particular, WKNavigationAction.sourceFrame is non-nil for the redirect navigation corresponding
3484         to a form submission that redirects.
3485
3486         * loader/EmptyClients.cpp:
3487         (WebCore::EmptyFrameLoaderClient::dispatchDecidePolicyForNavigationAction):
3488         * loader/FrameLoaderClient.h:
3489         Have dispatchDecidePolicyForNavigationAction() take a boolean as to whether the navigation was in
3490         response to receiving a redirect response.
3491         * loader/PolicyChecker.cpp:
3492         (WebCore::PolicyChecker::checkNavigationPolicy): Notify the frame loader client whether the navigation
3493         is in response to receiving a redirect response.
3494
3495 2017-08-09  Sam Weinig  <sam@webkit.org>
3496
3497         WTF::Function does not allow for reference / non-default constructible return types
3498         https://bugs.webkit.org/show_bug.cgi?id=175244
3499
3500         Reviewed by Chris Dumez.
3501
3502         * bindings/js/JSCustomElementInterface.h:
3503         (WebCore::JSCustomElementInterface::invokeCallback):
3504         Update the default value for the addArguments parameter to be an empty lambda, rather than
3505         default initialization, which leads to a null WTF::Function. This allows us to remove support
3506         for calling null WTF::Function. No change in behavior.
3507
3508 2017-08-09  Andy Estes  <aestes@apple.com>
3509
3510         [QuickLook] Use case-insensitive comparison of preview MIME types
3511         https://bugs.webkit.org/show_bug.cgi?id=175350
3512         <rdar://problem/33761159>
3513
3514         Reviewed by Brady Eidson.
3515
3516         MIME types are case-insensitive, but PreviewLoader was using a case-sensitive comparison to
3517         determine if a MIME type was supported by QLPreviewConverter. As a result we would fail to
3518         preview Excel macro-enabled workbooks, since CFNetwork would sniff a MIME type of
3519         "application/vnd.ms-excel.sheet.macroEnabled.12" but QuickLook contained
3520         "application/vnd.ms-excel.sheet.macroenabled.12" in its set of supported MIME type strings.
3521
3522         Fix this by copying the QuickLook supported MIME type set into a HashSet using
3523         ASCIICaseInsensitiveHash and using that HashSet for MIME type checks.
3524
3525         Test: quicklook/excel-macro-enabled.html
3526
3527         * loader/ios/PreviewLoader.mm:
3528         (WebCore::PreviewLoader::shouldCreateForMIMEType):
3529
3530 2017-08-09  Ms2ger  <Ms2ger@igalia.com>
3531
3532         Remove unnecessary copies of PlatformMediaSessionManager::m_sessions
3533         https://bugs.webkit.org/show_bug.cgi?id=175375
3534
3535         Reviewed by Sam Weinig.
3536
3537         Remove unnecessary copies of PlatformMediaSessionManager::m_sessions.
3538
3539         These should have been removed in r207688.
3540
3541         No new tests: no behavior change.
3542
3543         * platform/audio/PlatformMediaSessionManager.cpp:
3544         (WebCore::PlatformMediaSessionManager::applicationWillBecomeInactive const):
3545         (WebCore::PlatformMediaSessionManager::applicationDidBecomeActive const):
3546         (WebCore::PlatformMediaSessionManager::applicationDidEnterBackground const):
3547         (WebCore::PlatformMediaSessionManager::applicationWillEnterForeground const):
3548
3549 2017-08-09  Chris Dumez  <cdumez@apple.com>
3550
3551         Reinstate active flag for iterators
3552         https://bugs.webkit.org/show_bug.cgi?id=175312
3553
3554         Reviewed by Sam Weinig.
3555
3556         NodeIterator / TreeWalker should no longer allow recursive filters
3557         after the following change to the DOM specification:
3558         - https://github.com/whatwg/dom/pull/359
3559
3560         This patch aligns our behavior with the latest specification.
3561
3562         No new tests, updated existing tests.
3563
3564         * dom/NodeIterator.cpp:
3565         (WebCore::NodeIterator::nextNode):
3566         (WebCore::NodeIterator::previousNode):
3567         Note that we now also call m_candidateNode.clear() before returning an
3568         exception. This was a pre-existing bug that we failed to do so in the
3569         exception case but it became more obvious after this change now that
3570         we throw. This was causing traversal/moz-bug559526.html to fail
3571         otherwise (the filter was called one too many times). The test case
3572         is passing in Firefox (The filter is called 4 times and they throw
3573         each time).
3574
3575         * dom/Traversal.cpp:
3576         (WebCore::NodeIteratorBase::NodeIteratorBase):
3577         (WebCore::NodeIteratorBase::acceptNode):
3578         * dom/Traversal.h:
3579         * dom/TreeWalker.cpp:
3580
3581 2017-08-09  Antti Koivisto  <antti@apple.com>
3582
3583         RenderQuote should not mutate render tree
3584         https://bugs.webkit.org/show_bug.cgi?id=175328
3585
3586         Reviewed by Zalan Bujtas.
3587
3588         RenderQuote text renderers are currently created and deleted in a quirky fashion using a linked list.
3589         This patch moves to a simpler model that guarantees the mutations are always done in controlled fashion
3590         during render tree update.
3591
3592         * dom/Document.cpp:
3593         (WebCore::Document::updateTextRenderer):
3594
3595             Move text renderer updating to Document so we can set the inRenderTreeUpdate bit for it too.
3596
3597         * dom/Document.h:
3598         * dom/Text.cpp:
3599         (WebCore::Text::updateRendererAfterContentChange):
3600         * rendering/RenderDescendantIterator.h:
3601         (WebCore::RenderDescendantIteratorAdapter<T>::at):
3602         (WebCore::RenderDescendantConstIteratorAdapter<T>::at const):
3603
3604             Add at() function for starting iteration from a specified renderer.
3605
3606         * rendering/RenderQuote.cpp:
3607         (WebCore::RenderQuote::insertedIntoTree):
3608         (WebCore::RenderQuote::willBeRemovedFromTree):
3609
3610             Register and unregister quotes to RenderView.
3611             Don't do any mutations.
3612
3613         (WebCore::RenderQuote::styleDidChange):
3614
3615             Invalidate the text renderer but don't mutate it.
3616
3617         (WebCore::RenderQuote::updateTextRenderer):
3618         (WebCore::RenderQuote::computeText const):
3619         (WebCore::RenderQuote::updateRenderers):
3620
3621             Compute depth of all render quotes and update the text renderer as needed.
3622
3623         (WebCore::RenderQuote::willBeDestroyed): Deleted.
3624         (WebCore::RenderQuote::attachQuote): Deleted.
3625         (WebCore::RenderQuote::detachQuote): Deleted.
3626         (WebCore::RenderQuote::updateDepth): Deleted.
3627
3628             Get rid of the linked list.
3629
3630         * rendering/RenderQuote.h:
3631         * rendering/RenderView.cpp:
3632         (WebCore::RenderView::registerQuote):
3633         (WebCore::RenderView::unregisterQuote):
3634
3635             Maintain a render tree order ListHashSet of RenderQuotes.
3636
3637         (WebCore::RenderView::updateSpecialRenderers):
3638
3639             Add a function for making additional render tree mutations at the end of a render tree update.
3640             Currently this just invokes RenderQuote::updateRenderers.
3641
3642         * rendering/RenderView.h:
3643         * style/RenderTreeUpdater.cpp:
3644         (WebCore::RenderTreeUpdater::commit):
3645
3646             Call RenderView::updateSpecialRenderers after committing all other changes.
3647
3648 2017-08-09  Zan Dobersek  <zdobersek@igalia.com>
3649
3650         [Soup] Incorrect conversion in msToSoupDate()
3651         https://bugs.webkit.org/show_bug.cgi?id=175320
3652
3653         Reviewed by Carlos Garcia Campos.
3654
3655         Original patch by VaL Doroshchuk.
3656
3657         * platform/network/soup/NetworkStorageSessionSoup.cpp:
3658         (WebCore::msToSoupDate): monthFromDayInYear() returns a value in the [0,11] range,
3659         while soup_date_new() expects a month value in the [1,12] range. The return value
3660         must be thus incremented by one to match that expectation.
3661
3662 2017-08-08  Wenson Hsieh  <wenson_hsieh@apple.com>
3663
3664         Unreviewed, rolling out r220393.
3665
3666         This patch regresses the performance of WebPage::editorState.
3667
3668         Reverted changeset:
3669
3670         "[iOS WK2] WKWebView schedules nonstop layout after pressing
3671         cmb+b,i,u inside a contenteditable div"
3672         https://bugs.webkit.org/show_bug.cgi?id=175116
3673         http://trac.webkit.org/changeset/220393
3674
3675 2017-08-08  Chris Dumez  <cdumez@apple.com>
3676
3677         [Beacon] Add support for CORS-preflighting for WK2 / NETWORK_SESSION
3678         https://bugs.webkit.org/show_bug.cgi?id=175264
3679         <rdar://problem/33547793>
3680
3681         Reviewed by Youenn Fablet.
3682
3683         Pass additional information when creating a PingHandle so that the PingLoad
3684         can deal with CORS-preflighting on Network process side.
3685
3686         Tests: http/wpt/beacon/cors/cors-preflight-arraybufferview-failure.html
3687                http/wpt/beacon/cors/cors-preflight-arraybufferview-success.html
3688                http/wpt/beacon/cors/cors-preflight-blob-failure.html
3689                http/wpt/beacon/cors/cors-preflight-blob-success.html
3690                http/wpt/beacon/cors/cors-preflight-cookie.html
3691
3692         * WebCore.xcodeproj/project.pbxproj:
3693         * loader/CrossOriginAccessControl.cpp:
3694         (WebCore::validatePreflightResponse):
3695         * loader/CrossOriginAccessControl.h:
3696         * loader/CrossOriginPreflightChecker.cpp:
3697         (WebCore::CrossOriginPreflightChecker::validatePreflightResponse):
3698         * loader/CrossOriginPreflightResultCache.h:
3699         * loader/LoaderStrategy.h:
3700         * loader/PingLoader.cpp:
3701         (WebCore::PingLoader::loadImage):
3702         (WebCore::PingLoader::sendPing):
3703         (WebCore::PingLoader::sendViolationReport):
3704         (WebCore::PingLoader::startPingLoad):
3705         * loader/PingLoader.h:
3706         * loader/cache/CachedResource.cpp:
3707         (WebCore::CachedResource::load):
3708         * page/SecurityOrigin.h:
3709
3710 2017-08-08  Sam Weinig  <sam@webkit.org>
3711
3712         Address review feedback from https://bugs.webkit.org/show_bug.cgi?id=175246.
3713
3714         * bindings/js/DOMPromiseProxy.h:
3715         * css/FontFaceSet.cpp:
3716         * css/FontFaceSet.h:
3717
3718 2017-08-08  Devin Rousso  <drousso@apple.com>
3719
3720         Web Inspector: Canvas: support editing WebGL shaders
3721         https://bugs.webkit.org/show_bug.cgi?id=124211
3722         <rdar://problem/15448958>
3723
3724         Reviewed by Matt Baker.
3725
3726         Test: inspector/canvas/updateShader.html
3727
3728         * inspector/InspectorCanvasAgent.h:
3729         * inspector/InspectorCanvasAgent.cpp:
3730         (WebCore::InspectorCanvasAgent::updateShader):
3731
3732         * html/canvas/WebGLRenderingContextBase.h:
3733         * html/canvas/WebGLRenderingContextBase.cpp:
3734         (WebCore::WebGLRenderingContextBase::linkProgram):
3735         (WebCore::WebGLRenderingContextBase::linkProgramWithoutInvalidatingAttribLocations):
3736         Normally, when a program is linked, it invalidates any WebGLUniformLocation associated with
3737         the program by incrementing its `linkCount`. In order to allow live editing of shaders, we
3738         need to be able to compile and link a shader without invalidating these locations. This
3739         patch moves the shader linking logic to its own function that is called by `linkProgram` so
3740         that InspectorCanvasAgent can compile and link without invalidation.
3741
3742 2017-08-08  Sam Weinig  <sam@webkit.org>
3743
3744         [WebIDL] Add support for Promise<> attributes
3745         https://bugs.webkit.org/show_bug.cgi?id=175246
3746
3747         Reviewed by Yusuke Suzuki.
3748
3749         Introduces and adopts DOMPromiseProxy, a new class for binding promises in a more
3750         straightforward and safe (from a wrapper world perspective) way.
3751
3752         * CMakeLists.txt:
3753         * WebCore.xcodeproj/project.pbxproj:
3754         * bindings/js/JSFontFaceCustom.cpp: Removed.
3755         * bindings/js/JSFontFaceSetCustom.cpp: Removed.
3756         * bindings/js/JSMediaKeySessionCustom.cpp: Removed.
3757         * bindings/js/JSServiceWorkerContainerCustom.cpp: Removed.
3758         * bindings/js/JSWebGPUCommandBufferCustom.cpp: Removed.
3759
3760             Remove custom bindings only needed for promise attributes. Add DOMPromiseProxy.h
3761
3762         * Modules/encryptedmedia/MediaKeySession.cpp:
3763         (WebCore::MediaKeySession::sessionClosed):
3764         (WebCore::MediaKeySession::registerClosedPromise): Deleted.
3765         * Modules/encryptedmedia/MediaKeySession.h:
3766         * Modules/encryptedmedia/MediaKeySession.idl:
3767
3768             Replace custom promise code using the registerPromise idiom with DOMPromiseProxy.
3769
3770         * bindings/IDLTypes.h:
3771
3772             Add StorageType type alias to allow specifying a specific form for storage. This allows
3773             use to use Ref<> for interfaces in DOMPromiseProxy.
3774
3775         (WebCore::IDLWrapper::convertToParameterType):
3776             
3777             Also add convertToParameterType, an annoying hack to workaround the fact WTF::Function
3778             can't return references / no
3779
3780         * bindings/js/DOMPromiseProxy.h: Added.
3781         (WebCore::DOMPromiseProxy<IDLType>):
3782         
3783             DOMPromiseProxy is a new class (set of classes) to represent promises that works with the 
3784             standard toJS<> / JSDOMConvert infrastructure used by the bindings generator. From the
3785             implementation perspective, it is similar to DOMPromiseDeferred, but instead of receiving
3786             one as a parameter, you can initialize it directly in your constructor and start using it.
3787
3788             From the bindings perspective, a DOMPromiseProxy can be converted into a JS Promise by calling
3789             its promise function, which will either create a new promise, or return a cached one.
3790
3791             To make this work, DOMPromiseProxy maintains a Vector of DeferredPromises that hold onto those
3792             actualized promises. The reason it has a Vector, is that we need one DeferredPromises per
3793             DOMWrapperWorld, just like we need one wrapper for an interface per DOMWrapperWorld in the 
3794             wrapper cache. In most cases, only the normal world will be in play, so the Vector has an inline
3795             capacity of one.
3796             
3797             In addition, DOMPromiseProxy maintains a Variant of either an Exception or the result value type.
3798             This allows the DOMPromiseProxy to be resolved or rejected at anytime. Then, when the bindings
3799             request the promise, the stored result / exception can be resolved / rejected into the promise.
3800
3801         (WebCore::DOMPromiseProxy<IDLVoid>):
3802
3803             For void promises, we need slightly different semantics (resolve takes no parameters, Value is
3804             a bit indicating resolved state), so it is specialized.
3805
3806         (WebCore::DOMPromiseProxyWithResolveCallback<IDLType>):
3807
3808             In addition to the void specialization, we have DOMPromiseProxyWithResolveCallback. Instead of
3809             storing the value of the resolution directly, this specialization allows the owner to specify
3810             callback to be called when the resolved value is needed. This is needed to avoid reference
3811             cycles when the resolved value is the owner such as is the case with FontFace and FontFaceSet.
3812
3813         * bindings/js/JSDOMConvertPromise.h:
3814         (WebCore::JSConverter<IDLPromise<T>>::convert):
3815         Add converter that calls through to the DOMPromiseProxy function promise.
3816
3817         * bindings/js/JSDOMPromiseDeferred.cpp:
3818         (WebCore::DeferredPromise::callFunction):
3819         (WebCore::DeferredPromise::reject):
3820         * bindings/js/JSDOMPromiseDeferred.h:
3821         (WebCore::DeferredPromise::create):
3822         (WebCore::DeferredPromise::DeferredPromise):
3823
3824             Add a new create function for DeferredPromise that creates the JSPromiseDeferred for you.
3825             Also adds a mode to DeferredPromise to allow keeping the promise after resolution. Maintain
3826             the old behavior as the default.
3827
3828             Change reject to take an Exception as sink rather than an r-value, to allow DOMPromiseProxy
3829             to copy a Exception into multiple DeferredPromises. For callers already moving into reject,
3830             this should be no change.
3831
3832         * bindings/scripts/CodeGeneratorJS.pm:
3833         (AddToIncludesForIDLType):
3834         (GenerateParametersCheck):
3835         (GenerateImplementationFunctionCall):
3836         (NativeToJSValueDOMConvertNeedsState):
3837         (NativeToJSValueDOMConvertNeedsGlobalObject):
3838
3839             Add support DOMPromiseProxy. For now, this means a new extended attribute, [PromiseProxy],
3840             but once I convert all the existing promises over to using DOMPromiseProxy, it will be removed.
3841             
3842             Also specify the right #includes for promises and necessary parameters for conversion.
3843
3844         * bindings/scripts/IDLAttributes.json:
3845         
3846             Add [PromiseProxy], a temporary extended attribute for using DOMPromiseProxy.
3847
3848         * css/FontFace.cpp:
3849         * css/FontFace.h:
3850         * css/FontFace.idl:
3851         * css/FontFaceSet.cpp:
3852         * css/FontFaceSet.h:
3853         * css/FontFaceSet.idl:
3854
3855             Replace custom promise code using the registerPromise idiom with DOMPromiseProxyWithResolveCallback.
3856             The callback is necessary for these two classes since the value the resolve is themselves, and using
3857             a normal resolve would create a cycle.
3858
3859         * html/canvas/WebGPUCommandBuffer.cpp:
3860         * html/canvas/WebGPUCommandBuffer.h:
3861         * html/canvas/WebGPUCommandBuffer.idl:
3862         * platform/graphics/cocoa/GPUCommandBufferMetal.mm:
3863         * platform/graphics/gpu/GPUCommandBuffer.cpp:
3864         * platform/graphics/gpu/GPUCommandBuffer.h:
3865
3866             Replace custom promise code using the registerPromise idiom with DOMPromiseProxy.
3867
3868         * page/NavigatorBase.cpp:
3869         (WebCore::NavigatorBase::NavigatorBase):
3870         * page/NavigatorBase.h:
3871
3872             Forward declare ServiceWorkerContainer and add an explicit constructor to allow
3873             removing #include of ServiceWorkerContainer.h in the header, avoiding an #include cycle.
3874
3875         * workers/ServiceWorkerContainer.cpp:
3876         * workers/ServiceWorkerContainer.h:
3877         * workers/ServiceWorkerContainer.idl:
3878
3879             Replace custom promise code using the registerPromise idiom with DOMPromiseProxy.
3880
3881         * bindings/scripts/test/JS/JSTestObj.cpp:
3882         * bindings/scripts/test/JS/JSTestPromiseRejectionEvent.cpp:
3883         * bindings/scripts/test/TestObj.idl:
3884
3885             Add / update tests.
3886
3887 2017-08-08  John Wilander  <wilander@apple.com>
3888
3889         Resource Load Statistics: Merge of dataRecordsRemoved should use std::max()
3890         https://bugs.webkit.org/show_bug.cgi?id=175348
3891         <rdar://problem/33785695>
3892
3893         Reviewed by Chris Dumez.
3894
3895         No new tests. Online change of a statistic that doesn't affect logic flow.
3896
3897         * loader/ResourceLoadStatistics.cpp:
3898         (WebCore::ResourceLoadStatistics::merge):
3899             Now uses std::max() instead of addition.
3900
3901 2017-08-08  Brent Fulgham  <bfulgham@apple.com>
3902
3903         Sandbox flags do not support document.domain control
3904         https://bugs.webkit.org/show_bug.cgi?id=175281
3905         <rdar://problem/33778936>
3906
3907         Reviewed by Chris Dumez.
3908
3909         Update the 'setDomain' logic to honor the sandbox properties as defined in the current
3910         HTML5 specification. This brings us in line with how Chrome and other browsers have
3911         worked for some time.
3912
3913         Test: fast/frames/sandboxed-iframe-domain.html
3914
3915         * dom/Document.cpp:
3916         (WebCore::Document::setDomain): Add check for sandbox flag (with appropriate error message)
3917         * dom/SecurityContext.h:
3918
3919 2017-08-08  Jeremy Jones  <jeremyj@apple.com>
3920
3921         Change fast seek logic to prevent ping-ponging.
3922         https://bugs.webkit.org/show_bug.cgi?id=175167
3923         rdar://problem/32936116
3924
3925         Reviewed by Jer Noble.
3926
3927         Updated test: media/video-fast-seek.html
3928
3929         Changed fast seek behavior to always seek early than seek time; and after current time when seeking forward.
3930         This prevents ping-ponging, where a fast seek overshoots the target looking for a keyframe.
3931         A subsequent seek will suddenly be on the other side of current time and
3932         will search in the opposite direction for a key frame; repeat.
3933
3934         * html/HTMLMediaElement.cpp:
3935         (WebCore::HTMLMediaElement::fastSeek):
3936
3937 2017-08-08  Ms2ger  <Ms2ger@igalia.com>
3938
3939         Unreviewed. Correct the function name in a debug message.
3940         https://bugs.webkit.org/show_bug.cgi?id=175262
3941
3942         No new tests: debug logs are not tested.
3943
3944         * platform/audio/PlatformMediaSessionManager.cpp:
3945         (WebCore::PlatformMediaSessionManager::applicationDidBecomeActive const):
3946
3947 2017-08-08  Brent Fulgham  <bfulgham@apple.com>
3948
3949         Unreviewed build fix after r220376.
3950
3951         Don't attempt to use isPublicSuffix when building without that
3952         feature enabled.
3953
3954         * dom/Document.cpp:
3955         (WebCore::Document::domainIsRegisterable const):
3956
3957 2017-08-08  Michael Catanzaro  <mcatanzaro@igalia.com>
3958
3959         [CMake] Properly test if compiler supports compiler flags
3960         https://bugs.webkit.org/show_bug.cgi?id=174490
3961
3962         Reviewed by Konstantin Tokarev.
3963
3964         * CMakeLists.txt:
3965         * PlatformGTK.cmake:
3966         * PlatformWPE.cmake:
3967
3968 2017-08-08  Zan Dobersek  <zdobersek@igalia.com>
3969
3970         [GStreamer] Don't use GraphicsContext3D in VideoTextureCoperGStreamer
3971         https://bugs.webkit.org/show_bug.cgi?id=174774
3972
3973         Reviewed by Carlos Garcia Campos.
3974
3975         VideoTextureCoperGStreamer class creates a new GraphicsContext3D internally
3976         that's used to render to whichever OpenGL context is current. Such usage
3977         doesn't add anything to the user since there's no underlying offscreen-based
3978         OpenGL context created, and instead all GraphicsContext3D calls are directly
3979         translated to usual OpenGL API calls. We should avoid using GraphicsContext3D
3980         in such cases and instead use direct OpenGL API calls.
3981
3982         This patch achieves that for the VideoTextureCoperGStreamer class. A
3983         GraphicsContext3D object is still created because it's needed to construct an
3984         instance of the TextureMapperShaderProgram class, but this will be removed as
3985         soon as TextureMapperShaderProgram drops the GraphicsContext3D dependence.
3986
3987         No new tests -- no change in behavior.
3988
3989         * platform/graphics/gstreamer/VideoTextureCopierGStreamer.cpp:
3990         (WebCore::VideoTextureCopierGStreamer::VideoTextureCopierGStreamer):
3991         (WebCore::VideoTextureCopierGStreamer::~VideoTextureCopierGStreamer):
3992         (WebCore::VideoTextureCopierGStreamer::copyVideoTextureToPlatformTexture):
3993         * platform/graphics/gstreamer/VideoTextureCopierGStreamer.h:
3994         (WebCore::VideoTextureCopierGStreamer::resultTexture):
3995