Add support for unregistering a service worker
[WebKit-https.git] / Source / WebCore / ChangeLog
1 2017-10-25  Chris Dumez  <cdumez@apple.com>
2
3         Add support for unregistering a service worker
4         https://bugs.webkit.org/show_bug.cgi?id=178735
5
6         Reviewed by Brady Eidson.
7
8         Add support for unregistering a service worker:
9         - https://w3c.github.io/ServiceWorker/#navigator-service-worker-unregister
10
11         Test: http/tests/workers/service/basic-unregister.https.html
12
13         * workers/service/ServiceWorkerContainer.cpp:
14         (WebCore::ServiceWorkerContainer::addRegistration):
15         (WebCore::ServiceWorkerContainer::removeRegistration):
16         (WebCore::ServiceWorkerContainer::jobResolvedWithUnregistrationResult):
17         * workers/service/ServiceWorkerContainer.h:
18         * workers/service/ServiceWorkerJob.cpp:
19         (WebCore::ServiceWorkerJob::resolvedWithUnregistrationResult):
20         * workers/service/ServiceWorkerJob.h:
21         * workers/service/ServiceWorkerJobClient.h:
22         * workers/service/ServiceWorkerJobData.h:
23         (WebCore::ServiceWorkerJobData::encode const):
24         (WebCore::ServiceWorkerJobData::decode):
25         * workers/service/ServiceWorkerJobType.h:
26         * workers/service/ServiceWorkerRegistration.cpp:
27         (WebCore::containerForScriptExecutionContext):
28         (WebCore::ServiceWorkerRegistration::unregister):
29         * workers/service/server/SWClientConnection.cpp:
30         (WebCore::SWClientConnection::registrationJobResolvedInServer):
31         (WebCore::SWClientConnection::unregistrationJobResolvedInServer):
32         * workers/service/server/SWClientConnection.h:
33         * workers/service/server/SWServer.cpp:
34         (WebCore::SWServer::resolveRegistationJob):
35         (WebCore::SWServer::resolveUnregistrationJob):
36         * workers/service/server/SWServer.h:
37         * workers/service/server/SWServerRegistration.cpp:
38         (WebCore::SWServerRegistration::scriptContextStarted):
39         (WebCore::SWServerRegistration::startNextJob):
40         (WebCore::SWServerRegistration::runUnregisterJob):
41         (WebCore::SWServerRegistration::resolveWithRegistrationOnMainThread):
42         (WebCore::SWServerRegistration::resolveWithUnregistrationResultOnMainThread):
43         (WebCore::SWServerRegistration::resolveCurrentRegistrationJob):
44         (WebCore::SWServerRegistration::resolveCurrentUnregistrationJob):
45         * workers/service/server/SWServerRegistration.h:
46
47 2017-10-25  Simon Fraser  <simon.fraser@apple.com>
48
49         MediaSessionManager* needs to catch Obj-C exceptions
50         https://bugs.webkit.org/show_bug.cgi?id=178813
51
52         Reviewed by Tim Horton.
53
54         Wrap all calls out to Objective-C with BEGIN_BLOCK_OBJC_EXCEPTIONS/END_BLOCK_OBJC_EXCEPTIONS.
55
56         * platform/audio/ios/MediaSessionManagerIOS.mm:
57         (WebCore::MediaSessionManageriOS::MediaSessionManageriOS):
58         (WebCore::MediaSessionManageriOS::~MediaSessionManageriOS):
59         (WebCore::MediaSessionManageriOS::hasWirelessTargetsAvailable):
60         (WebCore::MediaSessionManageriOS::configureWireLessTargetMonitoring):
61         (WebCore::MediaSessionManageriOS::updateNowPlayingInfo):
62         (WebCore::MediaSessionManageriOS::externalOutputDeviceAvailableDidChange):
63         (-[WebMediaSessionHelper allocateVolumeView]):
64         (-[WebMediaSessionHelper initWithCallback:]):
65         * platform/audio/mac/MediaSessionManagerMac.mm:
66         (WebCore::MediaSessionManagerMac::updateNowPlayingInfo):
67
68 2017-10-25  Andy Estes  <aestes@apple.com>
69
70         [Payment Request] Implement the "user aborts the payment request" algorithm
71         https://bugs.webkit.org/show_bug.cgi?id=178810
72
73         Reviewed by Tim Horton.
74
75         * Modules/applepay/paymentrequest/ApplePayPaymentHandler.cpp:
76         (WebCore::ApplePayPaymentHandler::didCancelPaymentSession):
77         * Modules/applepay/paymentrequest/ApplePayPaymentHandler.h:
78         * Modules/paymentrequest/PaymentRequest.cpp:
79         (WebCore::PaymentRequest::cancel):
80         * Modules/paymentrequest/PaymentRequest.h:
81         * testing/MockPaymentCoordinator.cpp:
82         (WebCore::MockPaymentCoordinator::cancelPayment):
83         * testing/MockPaymentCoordinator.h:
84         * testing/MockPaymentCoordinator.idl:
85
86 2017-10-25  Jer Noble  <jer.noble@apple.com>
87
88         Autoplay muted videos still stop playback of other streaming apps in the background
89         https://bugs.webkit.org/show_bug.cgi?id=177920
90
91         Reviewed by Eric Carlson.
92
93         When creating a new <video> or <audio> element, the global AudioSession can sometimes have
94         its sessionCategory() set to "MediaPlayback", even if the element does not yet have a
95         source. This is because the constructor for the MediaElementSession is called before
96         m_isPlayingToWirelessTarget is initialized, and so in the MediaElementSession constructor,
97         the media element's m_isPlayingToWirelessTarget ivar is sometimes (uninitialized) true.
98
99         We could move the MediaElementSession ivar to the very end of the header, so it's
100         initialized last, but that still leaves the possibility of the MediaElementSession et. all
101         calling into the HTMLMediaElement before it's subclass's constructors have a chance to
102         initialize their own ivars (much less their vtables). So instead, we'll create and set the
103         MediaElementSession in a finishInitialization() method called from the HTMLVideoElement and
104         HTMLAudioElement's create() factory methods.
105
106         * html/HTMLAudioElement.cpp:
107         (WebCore::HTMLAudioElement::create):
108         * html/HTMLMediaElement.cpp:
109         (WebCore::HTMLMediaElement::HTMLMediaElement):
110         (WebCore::HTMLMediaElement::finishInitialization):
111         * html/HTMLMediaElement.h:
112         * html/HTMLVideoElement.cpp:
113         (WebCore::HTMLVideoElement::create):
114
115 2017-10-25  Javier Fernandez  <jfernandez@igalia.com>
116
117         [css-grid] Avoid clearing the overrideContainingBlockWidth if possible
118         https://bugs.webkit.org/show_bug.cgi?id=178260
119
120         Reviewed by Sergio Villar Senin.
121
122         Since the intrinsic width computation uses the same logic than the
123         track sizing algorithm we are clearing the overrideContainingBlockWidth
124         of some grid items that are required to laid out them properly.
125
126         It's very uncommon that any intrinsic size computation isn't performed
127         as part of a layout process. However, if it happens, once cleared the
128         overrideContainingBlockWidth it may lead to an incorrect layout of the
129         affected grid items.
130
131         This change is a defensive approach to avoid the issues caused by
132         such off-layout preferred size requests, which may imply recomputing
133         the grid container intrinsic size.
134
135         No new tests, because we are only removing some redundant logic.
136
137         * rendering/GridTrackSizingAlgorithm.cpp:
138         (WebCore::GridTrackSizingAlgorithmStrategy::minContentForChild const):
139         (WebCore::GridTrackSizingAlgorithmStrategy::maxContentForChild const):
140         (WebCore::GridTrackSizingAlgorithmStrategy::minSizeForChild const):
141         (WebCore::GridTrackSizingAlgorithmStrategy::updateOverrideContainingBlockContentSizeForChild const):
142         (WebCore::IndefiniteSizeStrategy::minLogicalWidthForChild const):
143         (WebCore::DefiniteSizeStrategy::minLogicalWidthForChild const):
144         * rendering/GridTrackSizingAlgorithm.h:
145
146 2017-10-25  Gustavo Noronha Silva  <gustavo.noronha@collabora.co.uk>
147
148         Unreviewed follow up changing one more enum value as discussed in the bug
149         https://bugs.webkit.org/show_bug.cgi?id=177810
150
151         * platform/glib/LowPowerModeNotifierGLib.cpp:
152         (WebCore::LowPowerModeNotifier::updateState): use NONE instead of DISCHARGING, to ensure
153         it will build even with older upower.
154
155 2017-10-25  Zan Dobersek  <zdobersek@igalia.com>
156
157         Make SERVICE_WORKER feature buildable on GTK, WPE
158         https://bugs.webkit.org/show_bug.cgi?id=178574
159
160         Reviewed by Carlos Garcia Campos.
161
162         * CMakeLists.txt: Add missing include paths and files to the build.
163         * Sources.txt: Add missing files to the build.
164         * WebCore.xcodeproj/project.pbxproj: Remove the JSDOMPromise.cpp and
165         JSFetchEventCustom.cpp targets, they're now built via unified sources.
166         * bindings/js/JSFetchEventCustom.cpp: Guard custom JSFetchEvent code
167         with the ENABLE(SERVICE_WORKER) guards.
168
169 2017-10-24  Alejandro G. Castro  <alex@igalia.com>
170
171         Clean up gcc build warnings about reaching the end of a non void function for webrtc classes
172         https://bugs.webkit.org/show_bug.cgi?id=178721
173
174         Reviewed by Youenn Fablet.
175
176         Assert when we reach those situations and return some value after that to avoid warning.
177
178         No new tests, this is a clean up.
179
180         * Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.cpp:
181         (WebCore::sessionDescriptionType):
182         (WebCore::signalingState):
183         (WebCore::toRTCIceConnectionState):
184         * Modules/mediastream/libwebrtc/LibWebRTCPeerConnectionBackend.cpp:
185         (WebCore::bundlePolicyfromConfiguration):
186         (WebCore::iceTransportPolicyfromConfiguration):
187
188 2017-10-24  Ryosuke Niwa  <rniwa@webkit.org>
189
190         RenderSVGModelObject::checkIntersection triggers layout
191         https://bugs.webkit.org/show_bug.cgi?id=178710
192
193         Reviewed by Simon Fraser.
194
195         Fixed the bug that checkIntersection and checkEnclosure no longer updates the layout after r223882.
196
197         Test: svg/custom/check-intersection-basic.svg
198
199         * svg/SVGSVGElement.cpp:
200         (WebCore::SVGSVGElement::collectIntersectionOrEnclosureList):
201         (WebCore::SVGSVGElement::checkIntersection):
202         (WebCore::SVGSVGElement::checkEnclosure):
203         * svg/SVGSVGElement.h:
204
205 2017-10-24  Andy Estes  <aestes@apple.com>
206
207         [Apple Pay] Implement a paymentmethodselected event for PaymentRequest
208         https://bugs.webkit.org/show_bug.cgi?id=178765
209
210         Reviewed by Tim Horton.
211
212         When the Apple Pay payment method changes, fire an applepaypaymentmethodchanged event on the
213         PaymentRequest object. The event has a paymentMethod property and an updateWith() method
214         which behaves identically to PaymentRequestUpdateEvent.updateWith().
215
216         Test: http/tests/ssl/applepay/ApplePayPaymentMethodUpdateEvent.https.html
217
218         * DerivedSources.make:
219         * Modules/applepay/ApplePayPaymentMethod.idl:
220         * Modules/applepay/ApplePayPaymentMethodSelectedEvent.h:
221         * Modules/applepay/PaymentMethod.h:
222         (WebCore::PaymentMethod::PaymentMethod): Deleted.
223         (WebCore::PaymentMethod::pkPaymentMethod const): Deleted.
224         * Modules/applepay/paymentrequest/ApplePayPaymentHandler.cpp:
225         (WebCore::ApplePayPaymentHandler::detailsUpdated):
226         (WebCore::ApplePayPaymentHandler::paymentMethodUpdated):
227         (WebCore::ApplePayPaymentHandler::didSelectPaymentMethod):
228         * Modules/applepay/paymentrequest/ApplePayPaymentHandler.h:
229         * Modules/applepay/paymentrequest/ApplePayPaymentMethodUpdateEvent.cpp: Added.
230         (WebCore::ApplePayPaymentMethodUpdateEvent::ApplePayPaymentMethodUpdateEvent):
231         (WebCore::ApplePayPaymentMethodUpdateEvent::eventInterface const):
232         * Modules/applepay/paymentrequest/ApplePayPaymentMethodUpdateEvent.h: Added.
233         * Modules/applepay/paymentrequest/ApplePayPaymentMethodUpdateEvent.idl: Added.
234         * Modules/paymentrequest/PaymentHandler.h:
235         * Modules/paymentrequest/PaymentRequest.cpp:
236         (WebCore::PaymentRequest::shippingAddressChanged):
237         (WebCore::PaymentRequest::shippingOptionChanged):
238         (WebCore::PaymentRequest::dispatchEvent):
239         (WebCore::PaymentRequest::updateWith):
240         (WebCore::PaymentRequest::settleDetailsPromise):
241         (WebCore::PaymentRequest::dispatchUpdateEvent): Deleted.
242         * Modules/paymentrequest/PaymentRequest.h:
243         * Modules/paymentrequest/PaymentRequest.idl:
244         * Modules/paymentrequest/PaymentRequestUpdateEvent.cpp:
245         (WebCore::PaymentRequestUpdateEvent::updateWith):
246         * Modules/paymentrequest/PaymentRequestUpdateEvent.h:
247         * WebCore.xcodeproj/project.pbxproj:
248         * dom/EventNames.h:
249         * dom/EventNames.in:
250         * testing/MockPaymentCoordinator.cpp:
251         (WebCore::MockPaymentCoordinator::changePaymentMethod):
252         * testing/MockPaymentCoordinator.h:
253         * testing/MockPaymentCoordinator.idl:
254         * testing/MockPaymentMethod.h: Added.
255
256 2017-10-24  Youenn Fablet  <youenn@apple.com>
257
258         ServiceWorkerClientFetch should return an error that is not null in case of failure
259         https://bugs.webkit.org/show_bug.cgi?id=178761
260
261         Reviewed by Geoffrey Garen.
262
263         Covered by existing tests.
264
265         As per spec, ServiceWorkerJob should not go through Service Worker Handle Fetch
266         for fetching scripts.
267
268         * workers/WorkerScriptLoader.cpp:
269         (WebCore::WorkerScriptLoader::loadAsynchronously):
270         * workers/WorkerScriptLoaderClient.h:
271         (WebCore::WorkerScriptLoaderClient::isServiceWorkerClient const):
272         * workers/service/ServiceWorkerJob.h:
273
274 2017-10-24  Keith Miller  <keith_miller@apple.com>
275
276         Move inspector and loader to unified sources.
277         https://bugs.webkit.org/show_bug.cgi?id=178760
278
279         Rubber-stamped by Tim Horton.
280
281         * CMakeLists.txt:
282         * Sources.txt:
283         * WebCore.xcodeproj/project.pbxproj:
284
285 2017-10-24  Alex Christensen  <achristensen@webkit.org>
286
287         Fix build after r223940
288
289         * inspector/WebConsoleAgent.cpp:
290
291 2017-10-24  Alex Christensen  <achristensen@webkit.org>
292
293         Fix Windows build after r223929.
294         https://bugs.webkit.org/show_bug.cgi?id=177027
295
296         * inspector/WebConsoleAgent.cpp:
297         (WebCore::WebConsoleAgent::getLoggingChannels):
298         Always initialize the variable "level".  Visual studio was complaining about the possibility of not initializing it
299         but this is only possible if logChannel->level is an invalid enum value.
300
301 2017-10-24  Alex Christensen  <achristensen@webkit.org>
302
303         Fix Windows build after r223925
304         https://bugs.webkit.org/show_bug.cgi?id=178687
305
306         * html/ImageBitmap.cpp:
307         (WebCore::interpolationQualityForResizeQuality):
308         Visual Studio was complaining that not all control paths returned a value.
309
310 2017-10-24  Youenn Fablet  <youenn@apple.com>
311
312         Enable service worker to use cache storage api
313         https://bugs.webkit.org/show_bug.cgi?id=178684
314
315         Reviewed by Brady Eidson.
316
317         Test: http/tests/workers/service/service-worker-cache-api.https.html
318
319         Updated WorkerLoaderProxy so that it can create a CacheStorageConnection.
320         Update WorkerCacheStorageConnection to take benefit of that.
321         This allows creating a CacheStorageConnection based on the page for regular workers and differently for Service Worker context.
322
323         Added ServiceWorkerThreadProxy as a proxy to ServiceWorkerThread.
324         It is in particular responsible to do proxy for loading tasks.
325         It implements cache API support for service worker by creating a dedicated CacheStorageConnection.
326
327         * Modules/cache/WorkerCacheStorageConnection.cpp:
328         (WebCore::WorkerCacheStorageConnection::create):
329         (WebCore::WorkerCacheStorageConnection::~WorkerCacheStorageConnection):
330         (WebCore::WorkerCacheStorageConnection::doOpen):
331         (WebCore::WorkerCacheStorageConnection::doRemove):
332         (WebCore::WorkerCacheStorageConnection::doRetrieveCaches):
333         (WebCore::WorkerCacheStorageConnection::reference):
334         (WebCore::WorkerCacheStorageConnection::dereference):
335         (WebCore::WorkerCacheStorageConnection::doRetrieveRecords):
336         (WebCore::WorkerCacheStorageConnection::doBatchDeleteOperation):
337         (WebCore::WorkerCacheStorageConnection::doBatchPutOperation):
338         * WebCore.xcodeproj/project.pbxproj:
339         * workers/WorkerLoaderProxy.h:
340         * workers/WorkerMessagingProxy.cpp:
341         (WebCore::WorkerMessagingProxy::createCacheStorageConnection):
342         * workers/WorkerMessagingProxy.h:
343         * workers/service/context/ServiceWorkerThread.cpp:
344         (WebCore::ServiceWorkerThread::ServiceWorkerThread):
345         * workers/service/context/ServiceWorkerThread.h:
346         * workers/service/context/ServiceWorkerThreadProxy.cpp: Added.
347         (WebCore::ServiceWorkerThreadProxy::create):
348         (WebCore::ServiceWorkerThreadProxy::ServiceWorkerThreadProxy):
349         (WebCore::ServiceWorkerThreadProxy::postTaskForModeToWorkerGlobalScope):
350         (WebCore::ServiceWorkerThreadProxy::postTaskToLoader):
351         (WebCore::ServiceWorkerThreadProxy::createCacheStorageConnection):
352         * workers/service/context/ServiceWorkerThreadProxy.h: Added.
353
354 2017-10-24  Alex Christensen  <achristensen@webkit.org>
355
356         Optionally store entire ResourceRequest for ping loads
357         https://bugs.webkit.org/show_bug.cgi?id=178756
358
359         Reviewed by Tim Horton.
360
361         No change in behavior.
362         This uses less memory in the common loading case.
363         This will be needed for moving appcache loading to the Networking Process.
364         See https://bugs.webkit.org/show_bug.cgi?id=178540
365
366         * loader/cache/CachedResource.cpp:
367         (WebCore::CachedResource::load):
368         * loader/cache/CachedResource.h:
369         (WebCore::CachedResource::setOriginalRequest):
370         (WebCore::CachedResource::originalRequest const):
371         (WebCore::CachedResource::setOriginalRequestHeaders): Deleted.
372         * loader/cache/CachedResourceLoader.cpp:
373         (WebCore::CachedResourceLoader::requestResource):
374
375 2017-10-24  Andy Estes  <aestes@apple.com>
376
377         [WebIDL] Support the ExportMacro attribute for dictionaries
378         https://bugs.webkit.org/show_bug.cgi?id=178752
379
380         Reviewed by Sam Weinig.
381
382         * bindings/scripts/CodeGeneratorJS.pm:
383         (GenerateDictionaryHeaderContent):
384         * bindings/scripts/test/JS/JSTestStandaloneDictionary.h:
385         * bindings/scripts/test/TestStandaloneDictionary.idl:
386
387 2017-10-24  Eric Carlson  <eric.carlson@apple.com>
388
389         Web Inspector: Enable WebKit logging configuration and display
390         https://bugs.webkit.org/show_bug.cgi?id=177027
391         <rdar://problem/33964767>
392
393         Reviewed by Joseph Pecoraro.
394
395         Test: inspector/console/webcore-logging.html
396
397         * dom/Document.cpp:
398         (WebCore::Document::~Document): Stop observing the logger.
399         (WebCore::Document::logger): Observe the logger.
400         (WebCore::Document::didLogMessage): Forward logging messages to the inspector.
401         * dom/Document.h:
402
403         * inspector/WebConsoleAgent.cpp:
404         (WebCore::WebConsoleAgent::getLoggingChannels): New, return the state of log runtime channels.
405         (WebCore::WebConsoleAgent::setLoggingChannelLevel): New, set the state of a channel.
406         * inspector/WebConsoleAgent.h:
407
408         * platform/Logging.cpp:
409         (WebCore::getLogChannel): New, get a log channel by name.
410         * platform/Logging.h:
411
412 2017-10-24  Dean Jackson  <dino@apple.com>
413
414         Attempted build fix for Sierra.
415
416         * html/ImageBitmap.cpp:
417         (WebCore::croppedSourceRectangleWithFormatting):
418
419 2017-10-24  Dean Jackson  <dino@apple.com>
420
421         Implement resizing options for ImageBitmap rendering
422         https://bugs.webkit.org/show_bug.cgi?id=178687
423         <rdar://problem/35135417>
424
425         Reviewed by Sam Weinig.
426
427         Implement many of the sizing options for createImageBitmap.
428
429         Test: http/wpt/2dcontext/imagebitmap/createImageBitmap-sizing.html
430
431         * html/ImageBitmap.cpp:
432         (WebCore::croppedSourceRectangleWithFormatting):
433
434             Implement the first bit of the algorithm from
435             the HTML specification.
436
437         (WebCore::outputSizeForSourceRectangle):
438
439             ... and then the second bit. Leave the rest in
440             comments for now.
441
442         (WebCore::interpolationQualityForResizeQuality):
443
444             Helper function to map ImageBitmapOptions to
445             GraphicsContext.
446
447         (WebCore::ImageBitmap::createPromise):
448
449             Implement more of the sizing algorithm.
450
451         * html/ImageBitmap.h: Origin tainting is defined to be false by default.
452
453 2017-10-24  Chris Dumez  <cdumez@apple.com>
454
455         Add initial implementation for serviceWorker.postMessage()
456         https://bugs.webkit.org/show_bug.cgi?id=178534
457
458         Reviewed by Youenn Fablet.
459
460         Add initial implementation for serviceWorker.postMessage():
461         - https://w3c.github.io/ServiceWorker/#service-worker-postmessage
462
463         Test: http/tests/workers/service/basic-ServiceWorker-postMessage.https.html
464
465         * CMakeLists.txt:
466         * DerivedSources.make:
467         * Sources.txt:
468         * WebCore.xcodeproj/project.pbxproj:
469         * bindings/js/JSBindingsAllInOne.cpp:
470         * bindings/js/JSExtendableMessageEvent.cpp: Added.
471         (WebCore::JSExtendableMessageEvent::data const):
472         * bindings/js/WebCoreBuiltinNames.h:
473         * dom/Document.h:
474         * dom/EventNames.in:
475         * dom/MessagePortChannel.h:
476         * dom/ScriptExecutionContext.h:
477         * workers/WorkerGlobalScope.h:
478         * workers/service/ExtendableEvent.cpp:
479         (WebCore::ExtendableEvent::ExtendableEvent):
480         (WebCore::ExtendableEvent::~ExtendableEvent):
481         * workers/service/ExtendableEvent.h:
482         * workers/service/ExtendableMessageEvent.cpp: Added.
483         (WebCore::ExtendableMessageEvent::create):
484         (WebCore::ExtendableMessageEvent::ExtendableMessageEvent):
485         (WebCore::ExtendableMessageEvent::~ExtendableMessageEvent):
486         * workers/service/ExtendableMessageEvent.h: Added.
487         * workers/service/ExtendableMessageEvent.idl: Added.
488         * workers/service/ServiceWorker.cpp:
489         (WebCore::ServiceWorker::ServiceWorker):
490         (WebCore::ServiceWorker::postMessage):
491         (WebCore::ServiceWorker::state const):
492         (WebCore::ServiceWorker::scriptExecutionContext const):
493         * workers/service/ServiceWorker.h:
494         * workers/service/ServiceWorkerContainer.cpp:
495         (WebCore::ServiceWorkerContainer::controller const):
496         * workers/service/ServiceWorkerContainer.h:
497         * workers/service/ServiceWorkerGlobalScope.cpp:
498         (WebCore::ServiceWorkerGlobalScope::thread):
499         * workers/service/ServiceWorkerGlobalScope.h:
500         (isType):
501         * workers/service/context/ServiceWorkerThread.cpp:
502         (WebCore::ServiceWorkerThread::postMessageToServiceWorkerGlobalScope):
503         * workers/service/context/ServiceWorkerThread.h:
504         * workers/service/server/SWClientConnection.h:
505
506 2017-10-24  Andy Estes  <aestes@apple.com>
507
508         [Payment Request] Implement the "PaymentRequest updated" algorithm
509         https://bugs.webkit.org/show_bug.cgi?id=178689
510
511         Reviewed by Alex Christensen.
512
513         Implemented the "PaymentRequest updated" algorithm by firing shippingaddresschange and
514         shippingoptionchange events at the right times and implementing
515         PaymentRequestUpdateEvent.updateWith().
516
517         Tests: http/tests/paymentrequest/payment-request-change-shipping-address.https.html
518                http/tests/paymentrequest/payment-request-change-shipping-option.https.html
519                http/tests/paymentrequest/updateWith-method-pmi-handling.https.html
520
521         * Modules/applepay/paymentrequest/ApplePayPaymentHandler.cpp:
522         (WebCore::convertAndValidate): Added. Converts a PaymentDetailsInit to a
523         ApplePaySessionPaymentRequest::TotalAndLineItems.
524         (WebCore::ApplePayPaymentHandler::shippingAddressUpdated): Created a ShippingContactUpdate
525         and passed it to PaymentCoordinator::completeShippingContactSelection().
526         (WebCore::ApplePayPaymentHandler::shippingOptionUpdated): Created a ShippingMethodUpdate and
527         passed it to PaymentCoordinator::completeShippingMethodSelection().
528         * Modules/applepay/paymentrequest/ApplePayPaymentHandler.h:
529         * Modules/paymentrequest/PaymentHandler.h:
530         * Modules/paymentrequest/PaymentRequest.cpp:
531         (WebCore::checkAndCanonicalizeDetails): Moved the logic for checking and canonicalizing a
532         PaymentDetailsBase from PaymentRequest::create() to here.
533         (WebCore::PaymentRequest::create): Called checkAndCanonicalizeDetails().
534         (WebCore::PaymentRequest::abortWithException): Moved the body of stop() to here and
535         parameterized the Exception with which to abort m_showPromise.
536         (WebCore::PaymentRequest::stop): Called abortWithException() with an AbortError.
537         (WebCore::PaymentRequest::shippingAddressChanged): Called dispatchUpdateEvent() with
538         shippingaddresschangeEvent.
539         (WebCore::PaymentRequest::shippingOptionChanged): Ditto with shippingoptionchangeEvent.
540         (WebCore::PaymentRequest::dispatchUpdateEvent): Created a PaymentRequestUpdateEvent and
541         dispatched it.
542         (WebCore::PaymentRequest::updateWith): Added a settle handler to m_detailsPromise.
543         (WebCore::PaymentRequest::settleDetailsPromise): Updated the PaymentRequest with the new
544         details and called PaymentHandler::shippingAddressUpdated() or
545         PaymentHandler::shippingOptionUpdated().
546         * Modules/paymentrequest/PaymentRequest.h:
547         * Modules/paymentrequest/PaymentRequestUpdateEvent.cpp:
548         (WebCore::PaymentRequestUpdateEvent::PaymentRequestUpdateEvent):
549         (WebCore::PaymentRequestUpdateEvent::updateWith): Called PaymentRequest::updateWith().
550         (WebCore::PaymentRequestUpdateEvent::eventInterface const): Returned
551         PaymentRequestUpdateEventInterfaceType.
552         * Modules/paymentrequest/PaymentRequestUpdateEvent.h:
553         * Modules/paymentrequest/PaymentRequestUpdateEvent.idl:
554         * testing/MockPaymentCoordinator.cpp:
555         (WebCore::MockPaymentCoordinator::canMakePaymentsWithActiveCard):
556         (WebCore::MockPaymentCoordinator::openPaymentSetup):
557         (WebCore::MockPaymentCoordinator::completeMerchantValidation): Stopped calling
558         PaymentCoordinator::didAuthorizePayment().
559         (WebCore::MockPaymentCoordinator::changeShippingOption): Called
560         PaymentCoordinator::didSelectShippingMethod().
561         (WebCore::MockPaymentCoordinator::acceptPayment): Called
562         PaymentCoordinator::didAuthorizePayment().
563         * testing/MockPaymentCoordinator.h:
564         * testing/MockPaymentCoordinator.idl:
565
566 2017-10-24  Alex Christensen  <achristensen@webkit.org>
567
568         Apply custom header fields from WebsitePolicies to same-domain requests
569         https://bugs.webkit.org/show_bug.cgi?id=178356
570         <rdar://problem/31073436>
571
572         Reviewed by Brady Eidson.
573
574         Covered by new API tests.
575
576         * loader/cache/CachedResourceLoader.cpp:
577         (WebCore::CachedResourceLoader::requestResource):
578         * platform/network/ResourceRequestBase.cpp:
579         (WebCore::ResourceRequestBase::setCachePolicy):
580         (WebCore::ResourceRequestBase::setTimeoutInterval):
581         (WebCore::ResourceRequestBase::setHTTPMethod):
582         (WebCore::ResourceRequestBase::setHTTPHeaderField):
583         (WebCore::ResourceRequestBase::clearHTTPAuthorization):
584         (WebCore::ResourceRequestBase::clearHTTPContentType):
585         (WebCore::ResourceRequestBase::clearHTTPReferrer):
586         (WebCore::ResourceRequestBase::clearHTTPOrigin):
587         (WebCore::ResourceRequestBase::clearHTTPUserAgent):
588         (WebCore::ResourceRequestBase::clearHTTPAccept):
589         (WebCore::ResourceRequestBase::clearHTTPAcceptEncoding):
590         (WebCore::ResourceRequestBase::setResponseContentDispositionEncodingFallbackArray):
591         (WebCore::ResourceRequestBase::setHTTPBody):
592         (WebCore::ResourceRequestBase::setAllowCookies):
593         (WebCore::ResourceRequestBase::setPriority):
594         (WebCore::ResourceRequestBase::addHTTPHeaderFieldIfNotPresent):
595         (WebCore::ResourceRequestBase::addHTTPHeaderField):
596         (WebCore::ResourceRequestBase::setHTTPHeaderFields):
597         If we only update the platform request when headers are added (or other changes) for HTTP requests,
598         then the changes will not affect the NSURLRequest that is sent over IPC or visible to the API.
599         This is necessary for these new tests to work, but it's also of growing importance since our
600         introduction of WKURLSchemeHandler.
601
602 2017-10-24  Brent Fulgham  <bfulgham@apple.com>
603
604         Adopt new secure coding APIs
605         https://bugs.webkit.org/show_bug.cgi?id=178484
606         <rdar://problem/34837193>
607
608         Reviewed by Tim Horton.
609
610         Switch to new NSKeyed[Un]Archiver methods that active and use
611         NSSecureCoding by default.
612
613         Most of the new API is wrapped in a set of convenience methods so we can
614         build without the new API on older systems.
615
616         No change in behavior.
617
618         * editing/cocoa/EditorCocoa.mm:
619         (WebCore::archivedDataForAttributedString): Use new convenience method
620         to archive the string object.
621         * loader/archive/cf/LegacyWebArchiveMac.mm:
622         (WebCore::LegacyWebArchive::createResourceResponseFromMacArchivedData): Update to
623         use secure coding where possible.
624         (WebCore::LegacyWebArchive::createPropertyListRepresentation): Ditto.
625         * platform/ios/PlatformPasteboardIOS.mm:
626         (WebCore::PlatformPasteboard::write): Use new secure API.
627         (WebCore::PlatformPasteboard::typesSafeForDOMToReadAndWrite const): Ditto.
628         * testing/cocoa/WebArchiveDumpSupport.mm:
629         (WebCoreTestSupport::createCFURLResponseFromResponseData): Update to
630         secure coding API where possible.
631
632 2017-10-24  Jeremy Jones  <jeremyj@apple.com>
633
634         HTMLMediaElement should iterate HTMLTrackElements consistently.
635         https://bugs.webkit.org/show_bug.cgi?id=178423
636         rdar://problem/35044967
637
638         Reviewed by Eric Carlson.
639
640         No new tests because no expected behavior change.
641
642         HTMLMediaElement iterates HTMLTrackElements as children in every place but one, where it iterates them
643         as descendants. It should always iterate them as children.
644
645         * html/HTMLMediaElement.cpp:
646         (WebCore::HTMLMediaElement::finishParsingChildren):
647
648 2017-10-24  Chris Dumez  <cdumez@apple.com>
649
650         SerializedScriptValue::deserialize() should take ports as a const Vector&
651         https://bugs.webkit.org/show_bug.cgi?id=178727
652
653         Reviewed by Alex Christensen.
654
655         SerializedScriptValue::deserialize() should take ports as a const Vector&, not a Vector&.
656         It does not modify the input vector.
657
658         * bindings/js/JSMessageEventCustom.cpp:
659         (WebCore::JSMessageEvent::data const):
660         * bindings/js/SerializedScriptValue.cpp:
661         (WebCore::CloneDeserializer::deserialize):
662         (WebCore::CloneDeserializer::CloneDeserializer):
663         (WebCore::SerializedScriptValue::deserialize):
664         * bindings/js/SerializedScriptValue.h:
665
666 2017-10-24  Konstantin Tokarev  <annulen@yandex.ru>
667
668         [MediaFoundation] Videos are always autoplaying for local files
669         https://bugs.webkit.org/show_bug.cgi?id=178693
670
671         Patch by Doug Massay.
672         Reviewed by Alex Christensen.
673
674         r199114 fixes autoplay issue only if starting session invokes
675         buffering stage. However when local files are played, onBufferingStarted
676         and onBufferingStopped are not called, and video is not paused.
677
678         * platform/graphics/win/MediaPlayerPrivateMediaFoundation.cpp:
679         (WebCore::MediaPlayerPrivateMediaFoundation::endGetEvent):
680         (WebCore::MediaPlayerPrivateMediaFoundation::onSessionStarted):
681         * platform/graphics/win/MediaPlayerPrivateMediaFoundation.h:
682
683 2017-10-24  Matt Lewis  <jlewis3@apple.com>
684
685         Unreviewed, rolling out r223889.
686
687         This caused multiple crashes on all platforms
688
689         Reverted changeset:
690
691         "Adopt new secure coding APIs"
692         https://bugs.webkit.org/show_bug.cgi?id=178484
693         https://trac.webkit.org/changeset/223889
694
695 2017-10-24  Antti Koivisto  <antti@apple.com>
696
697         Create inline wrappers for before/after pseudo elements that have display:contents
698         https://bugs.webkit.org/show_bug.cgi?id=178722
699
700         Reviewed by Ryosuke Niwa.
701
702         We can handle before and after pseudo elements with display:contents by giving them
703         inline renderers with style inherited from display:contents style. This removes
704         need for complicated logic for this case and handles everything correctly.
705
706         This is a better approach and replaces the one taken in bug 178584.
707         It also fixes two display:contents WPTs.
708
709         * dom/PseudoElement.h:
710
711             There is no need to track content renderers separately anymore. They always descendants of
712             pseudo element's renderer (which is an inline wrapper in case of display:contents).
713
714         * rendering/style/RenderStyle.cpp:
715         (WebCore::RenderStyle::copyContentFrom):
716         * rendering/style/RenderStyle.h:
717         * style/RenderTreeUpdaterGeneratedContent.cpp:
718         (WebCore::createContentRenderers):
719         (WebCore::updateStyleForContentRenderers):
720         (WebCore::RenderTreeUpdater::GeneratedContent::updatePseudoElement):
721         (WebCore::removeAndDestroyContentRenderers): Deleted.
722
723             Since content renderers are now always descendants of the pseudo renderer
724             there is no need for a separate destruction path.
725
726         * style/StyleTreeResolver.cpp:
727         (WebCore::Style::TreeResolver::resolvePseudoStyle):
728
729             Create ElementUpdate with a style that will produce an inline wrapper.
730
731 2017-10-24  Wenson Hsieh  <wenson_hsieh@apple.com>
732
733         [iOS] MediaPlayer::isAvailable() takes ~150 ms during web process initialization
734         https://bugs.webkit.org/show_bug.cgi?id=178713
735         <rdar://problem/35115906>
736
737         Reviewed by Eric Carlson.
738
739         Loading AVFoundation should not be required to answer the question of MediaPlayer::isAvailable() on iOS, where
740         both AVFoundation and CoreMedia frameworks should always exist. As such, we can bail early and return true to
741         avoid always dynamically loading AVFoundation and CoreMedia.
742
743         * platform/graphics/MediaPlayer.cpp:
744         (WebCore::MediaPlayer::isAvailable):
745
746 2017-10-24  Antoine Quint  <graouts@apple.com>
747
748         RenderThemeCocoa::mediaControlsFormattedStringForDuration may cause a crash due to unhandled Obj-C exception
749         https://bugs.webkit.org/show_bug.cgi?id=178716
750         <rdar://problem/35112900>
751
752         Reviewed by Dean Jackson.
753
754         * rendering/RenderThemeCocoa.mm:
755         (WebCore::RenderThemeCocoa::mediaControlsFormattedStringForDuration):
756
757 2017-10-24  Ryosuke Niwa  <rniwa@webkit.org>
758
759         SizesAttributeParser::SizesAttributeParser triggers layout
760         https://bugs.webkit.org/show_bug.cgi?id=178712
761
762         Reviewed by Antti Koivisto.
763
764         Revert r213711 as this change introduced an unwated synchronous layout inside Node::insertedIntoAncestor.
765
766         The test had been marked as timing out since r191379 and changed to failing expectation in r199225
767         as the test result's error message changes from run to run.
768
769         Disabled Tests: imported/w3c/web-platform-tests/html/semantics/embedded-content/the-img-element/environment-changes/viewport-change.html
770                         had been marked failing since r199225, prior to which it was marked as timeout in r191379.
771                         imported/w3c/web-platform-tests/html/semantics/embedded-content/the-img-element/sizes/parse-a-sizes-attribute.html
772                         is now marked as flaky.
773
774         * css/parser/SizesAttributeParser.cpp:
775         (WebCore::SizesAttributeParser::SizesAttributeParser):
776
777 2017-10-24  Keith Miller  <keith_miller@apple.com>
778
779         Unreviewed, fix internal iOS build.
780
781         * Sources.txt:
782
783 2017-10-24  Brent Fulgham  <bfulgham@apple.com>
784
785         Adopt new secure coding APIs
786         https://bugs.webkit.org/show_bug.cgi?id=178484
787         <rdar://problem/34837193>
788
789         Reviewed by Tim Horton.
790
791         Switch to new NSKeyed[Un]Archiver methods that active and use
792         NSSecureCoding by default.
793
794         Most of the new API is wrapped in a set of convenience methods so we can
795         build without the new API on older systems.
796
797         No change in behavior.
798
799         * editing/cocoa/EditorCocoa.mm:
800         (WebCore::archivedDataForAttributedString): Use new convenience method
801         to archive the string object.
802         * loader/archive/cf/LegacyWebArchiveMac.mm:
803         (WebCore::LegacyWebArchive::createResourceResponseFromMacArchivedData): Update to
804         use secure coding where possible.
805         (WebCore::LegacyWebArchive::createPropertyListRepresentation): Ditto.
806         * platform/ios/PlatformPasteboardIOS.mm:
807         (WebCore::PlatformPasteboard::write): Use new secure API.
808         (WebCore::PlatformPasteboard::typesSafeForDOMToReadAndWrite const): Ditto.
809         * testing/cocoa/WebArchiveDumpSupport.mm:
810         (WebCoreTestSupport::createCFURLResponseFromResponseData): Update to
811         secure coding API where possible.
812
813 2017-10-24  Miguel Gomez  <magomez@igalia.com>
814
815         [GTK][X11] Windy.com shows always straight wind lines
816         https://bugs.webkit.org/show_bug.cgi?id=176718
817
818         Reviewed by Carlos Garcia Campos.
819
820         WebGL's GL_LUMINANCE_ALPHA format is not available in OpenGL when using a version >= 3.2
821         and a core profile. In that case, we need to replace it with GL_RG and swizzle the color
822         components appropriately.
823
824         No new behavior.
825
826         * platform/graphics/opengl/GraphicsContext3DOpenGL.cpp:
827         (WebCore::GraphicsContext3D::texImage2D):
828         * platform/graphics/opengl/GraphicsContext3DOpenGLCommon.cpp:
829         (WebCore::GraphicsContext3D::texSubImage2D):
830
831 2017-10-24  Ryosuke Niwa  <rniwa@webkit.org>
832
833         DocumentOrderedMap::add should release assert that tree scopes match
834         https://bugs.webkit.org/show_bug.cgi?id=178708
835
836         Reviewed by Antti Koivisto.
837
838         Assert that the tree scope of element matches the given tree scope instead of asserting that
839         element is in tree scope, and replaced the use of RELEASE_ASSERT by the newly added
840         RELEASE_ASSERT_WITH_SECURITY_IMPLICATION to clarify the semantics of these assertions.
841
842         Also removed now redudnant early exits which would never execute due to release assertions.
843
844         * dom/DocumentOrderedMap.cpp:
845         (WebCore::DocumentOrderedMap::add):
846         (WebCore::DocumentOrderedMap::remove):
847         (WebCore::DocumentOrderedMap::get const):
848
849 2017-10-24  Michael Catanzaro  <mcatanzaro@igalia.com>
850
851         -Wsubobject-linkage warning in InspectorIndexedDBAgent.cpp
852         https://bugs.webkit.org/show_bug.cgi?id=178698
853
854         Reviewed by Joseph Pecoraro.
855
856         * inspector/InspectorIndexedDBAgent.cpp:
857
858 2017-10-24  Antoine Quint  <graouts@apple.com>
859
860         [Web Animations] Add basic timing and target properties
861         https://bugs.webkit.org/show_bug.cgi?id=178674
862
863         Reviewed by Dean Jackson.
864
865         We add three new interfaces to expose enough properties to establish basic timing properties,
866         a start time and duration, and the target of an animation. The startTime property is set on
867         the Animation object, the target is set on the KeyframeEffect set as the effect property on
868         the Animation object, and the duration is set on the AnimationEffectTiming set on the effect.
869
870         Tests: webanimations/animation-effect-timing.html
871                webanimations/animation-effect.html
872                webanimations/animation-interface-effect-property.html
873                webanimations/animation-interface-start-time-property.html
874                webanimations/keyframe-effect-interface-timing-duration.html
875                webanimations/keyframe-effect.html
876
877         * CMakeLists.txt:
878         * DerivedSources.make:
879         * Sources.txt:
880         * WebCore.xcodeproj/project.pbxproj:
881         * animation/AnimationEffect.cpp: Copied from Source/WebCore/animation/WebAnimation.idl.
882         (WebCore::AnimationEffect::AnimationEffect):
883         (WebCore::AnimationEffect::~AnimationEffect):
884         * animation/AnimationEffect.h: Copied from Source/WebCore/animation/WebAnimation.h.
885         (WebCore::AnimationEffect::isKeyframeEffect const):
886         (WebCore::AnimationEffect::timing const):
887         (WebCore::AnimationEffect::classType const):
888         * animation/AnimationEffect.idl: Copied from Source/WebCore/animation/WebAnimation.idl.
889         * animation/AnimationEffectTiming.cpp: Copied from Source/WebCore/animation/WebAnimation.idl.
890         (WebCore::AnimationEffectTiming::create):
891         (WebCore::AnimationEffectTiming::AnimationEffectTiming):
892         (WebCore::AnimationEffectTiming::~AnimationEffectTiming):
893         * animation/AnimationEffectTiming.h: Copied from Source/WebCore/animation/WebAnimation.h.
894         * animation/AnimationEffectTiming.idl: Copied from Source/WebCore/animation/WebAnimation.idl.
895         * animation/KeyframeEffect.cpp: Copied from Source/WebCore/animation/WebAnimation.idl.
896         (WebCore::KeyframeEffect::create):
897         (WebCore::KeyframeEffect::KeyframeEffect):
898         * animation/KeyframeEffect.h: Copied from Source/WebCore/animation/WebAnimation.h.
899         * animation/KeyframeEffect.idl: Copied from Source/WebCore/animation/WebAnimation.idl.
900         * animation/WebAnimation.cpp:
901         (WebCore::WebAnimation::setEffect):
902         * animation/WebAnimation.h:
903         * animation/WebAnimation.idl:
904         * bindings/js/JSAnimationEffectCustom.cpp: Copied from Source/WebCore/animation/WebAnimation.cpp.
905         (WebCore::toJSNewlyCreated):
906         (WebCore::toJS):
907         * bindings/js/WebCoreBuiltinNames.h:
908
909 2017-10-24  Ryosuke Niwa  <rniwa@webkit.org>
910
911         RenderSVGModelObject::checkIntersection triggers layout
912         https://bugs.webkit.org/show_bug.cgi?id=178710
913
914         Reviewed by Antti Koivisto.
915
916         Don't trigger a layout inside getElementCTM. Update the layout upfront in getEnclosureList.
917
918         * rendering/svg/RenderSVGModelObject.cpp:
919         (WebCore::getElementCTM):
920         * svg/SVGSVGElement.cpp:
921         (WebCore::SVGSVGElement::getEnclosureList):
922
923 2017-10-24  Nan Wang  <n_wang@apple.com>
924
925         AX: Crash at -[WebAccessibilityObjectWrapper _accessibilityMinValue] + 24
926         https://bugs.webkit.org/show_bug.cgi?id=178697
927
928         Reviewed by Chris Fleizach.
929
930         When we are calling _accessibilityMinValue and _accessibilityMaxValue on iOS, 
931         it might cause crash if the AX object has already been detached. Fixed this 
932         by adding the necessary checks.
933
934         Test: accessibility/ios-simulator/slider-min-value-crash.html
935
936         * accessibility/ios/WebAccessibilityObjectWrapperIOS.mm:
937         (-[WebAccessibilityObjectWrapper _accessibilityMinValue]):
938         (-[WebAccessibilityObjectWrapper _accessibilityMaxValue]):
939
940 2017-10-23  Keith Miller  <keith_miller@apple.com>
941
942         Unreviewed, restore unneeded all in ones.
943
944         * CMakeLists.txt:
945
946 2017-10-23  Commit Queue  <commit-queue@webkit.org>
947
948         Unreviewed, rolling out r223870 and r223871.
949         https://bugs.webkit.org/show_bug.cgi?id=178702
950
951         broke the windows build (Requested by keith_miller on
952         #webkit).
953
954         Reverted changesets:
955
956         "Add html, inspector, loader to unified sources"
957         https://bugs.webkit.org/show_bug.cgi?id=178695
958         https://trac.webkit.org/changeset/223870
959
960         "Unrievwed, fix windows build."
961         https://trac.webkit.org/changeset/223871
962
963 2017-10-23  Michael Catanzaro  <mcatanzaro@igalia.com>
964
965         Unreviewed, attempt to fix initializeSupportedImageMIMETypes after r223860
966         https://bugs.webkit.org/show_bug.cgi?id=178618
967         <rdar://problem/35108852>
968
969         * platform/MIMETypeRegistry.cpp:
970         (WebCore::initializeSupportedImageMIMETypes):
971
972 2017-10-23  Keith Miller  <keith_miller@apple.com>
973
974         Unrievwed, fix windows build.
975
976         * CMakeLists.txt:
977
978 2017-10-23  Keith Miller  <keith_miller@apple.com>
979
980         Add html, inspector, loader to unified sources
981         https://bugs.webkit.org/show_bug.cgi?id=178695
982
983         Rubber-stamped by Tim Horton.
984
985         * CMakeLists.txt:
986         * Sources.txt:
987         * WebCore.xcodeproj/project.pbxproj:
988
989 2017-10-23  Joseph Pecoraro  <pecoraro@apple.com>
990
991         Web Inspector: Remove unused Console.setMonitoringXHREnabled
992         https://bugs.webkit.org/show_bug.cgi?id=178617
993
994         Reviewed by Sam Weinig.
995
996         * inspector/InspectorInstrumentation.cpp:
997         (WebCore::InspectorInstrumentation::didFinishXHRLoadingImpl):
998         * inspector/InspectorInstrumentation.h:
999         (WebCore::InspectorInstrumentation::didFinishXHRLoading):
1000         * inspector/WebConsoleAgent.cpp:
1001         (WebCore::WebConsoleAgent::setMonitoringXHREnabled): Deleted.
1002         (WebCore::WebConsoleAgent::didFinishXHRLoading): Deleted.
1003         * inspector/WebConsoleAgent.h:
1004         Remove XHR monitoring code.
1005
1006         * xml/XMLHttpRequest.h:
1007         * xml/XMLHttpRequest.cpp:
1008         (WebCore::XMLHttpRequest::send):
1009         (WebCore::XMLHttpRequest::didFinishLoading):
1010         (WebCore::XMLHttpRequest::setLastSendLineAndColumnNumber): Deleted.
1011         * xml/XMLHttpRequest.idl:
1012         Remove now unused state on XHR and ExecState requirement for send().
1013
1014 2017-10-23  Keith Miller  <keith_miller@apple.com>
1015
1016         Add dom, editing, fileapi, and history to unified sources
1017         https://bugs.webkit.org/show_bug.cgi?id=178694
1018
1019         Rubber-stamped by Tim Horton.
1020
1021         * CMakeLists.txt:
1022         * Sources.txt:
1023         * WebCore.xcodeproj/project.pbxproj:
1024
1025 2017-10-23  Keith Miller  <keith_miller@apple.com>
1026
1027         Move bridge, contentextensions, crypto, and css to unified sources.
1028         https://bugs.webkit.org/show_bug.cgi?id=178691
1029
1030         Reviewed by Tim Horton.
1031
1032         * CMakeLists.txt:
1033         * Sources.txt:
1034         * WebCore.xcodeproj/project.pbxproj:
1035
1036 2017-10-23  Wenson Hsieh  <wenson_hsieh@apple.com>
1037
1038         Unreviewed, fix the Windows build after r223860
1039
1040         UTIUtilities only exists on Cocoa platforms, so we need to guard it accordingly.
1041
1042         * platform/MIMETypeRegistry.cpp:
1043         (WebCore::initializeSupportedImageMIMETypes):
1044
1045 2017-10-23  Wenson Hsieh  <wenson_hsieh@apple.com>
1046
1047         [iOS] DocumentWriter::createDocument can spend ~100ms unnecessarily converting image UTIs to MIME types
1048         https://bugs.webkit.org/show_bug.cgi?id=178618
1049         <rdar://problem/35108852>
1050
1051         Reviewed by Said Abou-Hallawa.
1052
1053         Currently, in setting up a new Document, DocumentWriter::createDocument() always asks whether or not the
1054         Document should be a PDF document by calling MIMETypeRegistry::isPDFMIMEType(), which forces lazy initialization
1055         of every MIME type dictionary (e.g. image types, PDF types, JavaScript types, etc.). As evidenced by traces,
1056         this can be an expensive operation on certain devices.
1057
1058         This patch implements two optimizations. First, we refactor the initializeSupportedImageMIMETypes() helper to
1059         stop asking for MIMETypeForImageSourceType for each of the supported UTIs. This is because the known MIME types
1060         corresponding to these hard-coded UTI types is a fixed set anyways, so we can simply iterate over a constant
1061         array of MIME types and populate the supported image (and image resource) types. Also, add assertions to ensure
1062         that we keep allowed image MIME types in sync with allowed image UTIs.
1063
1064         The second optimization removes initializeMIMETypeRegistry() altogether in favor of calling just the
1065         initialize*MIMETypes() functions needed to ensure the information required. For instance, getPDFMIMETypes()
1066         currently calls initializeMIMETypeRegistry() if the pdfMIMETypes dictionary doesn't exist, when it really only
1067         needs to ensure that the pdfMIMETypes is initialized, for which initializePDFMIMETypes() is sufficient.
1068
1069         * platform/MIMETypeRegistry.cpp:
1070         (WebCore::initializeSupportedImageMIMETypes):
1071         (WebCore::initializeSupportedJavaScriptMIMETypes):
1072         (WebCore::initializePDFMIMETypes):
1073         (WebCore::initializeSupportedNonImageMimeTypes):
1074         (WebCore::initializeUnsupportedTextMIMETypes):
1075
1076         Move MIME type dictionary creation into initialize*MIMETypes() helpers. Additionally, remove
1077         initializePDFAndPostScriptMIMETypes, which is no longer necessary.
1078
1079         (WebCore::MIMETypeRegistry::isSupportedImageMIMEType):
1080         (WebCore::MIMETypeRegistry::isSupportedImageResourceMIMEType):
1081         (WebCore::MIMETypeRegistry::isSupportedJavaScriptMIMEType):
1082         (WebCore::MIMETypeRegistry::isSupportedNonImageMIMEType):
1083         (WebCore::MIMETypeRegistry::isUnsupportedTextMIMEType):
1084         (WebCore::MIMETypeRegistry::isPDFOrPostScriptMIMEType):
1085
1086         Tweak to check that the type isPDFMIMEType(), or that it's otherwise "application/postscript".
1087
1088         (WebCore::MIMETypeRegistry::isPDFMIMEType):
1089         (WebCore::MIMETypeRegistry::getSupportedImageMIMETypes):
1090         (WebCore::MIMETypeRegistry::getSupportedImageResourceMIMETypes):
1091         (WebCore::MIMETypeRegistry::getSupportedNonImageMIMETypes):
1092         (WebCore::MIMETypeRegistry::getPDFMIMETypes):
1093         (WebCore::MIMETypeRegistry::getUnsupportedTextMIMETypes):
1094
1095         Call only the relevant MIME type initializers when needed.
1096
1097         (WebCore::initializePostScriptMIMETypes): Deleted.
1098         (WebCore::initializeMIMETypeRegistry): Deleted.
1099         (WebCore::MIMETypeRegistry::getPDFAndPostScriptMIMETypes): Deleted.
1100
1101         Remove an unused and unexported function.
1102
1103         * platform/MIMETypeRegistry.h:
1104
1105 2017-10-23  Andy Estes  <aestes@apple.com>
1106
1107         [Payment Request] Take the JSC API lock before creating the PaymentResponse.details object
1108         https://bugs.webkit.org/show_bug.cgi?id=178686
1109
1110         Reviewed by Keith Miller.
1111
1112         This fixes several flaky crashes in http/tests/paymentrequest/ after r223855.
1113
1114         * Modules/applepay/paymentrequest/ApplePayPaymentHandler.cpp:
1115         (WebCore::ApplePayPaymentHandler::didAuthorizePayment):
1116
1117 2017-10-23  Joseph Pecoraro  <pecoraro@apple.com>
1118
1119         Web Inspector: Please support HAR Export for network traffic
1120         https://bugs.webkit.org/show_bug.cgi?id=146692
1121         <rdar://problem/7463672>
1122
1123         Reviewed by Brian Burg.
1124
1125         Tests: http/tests/inspector/network/har/har-basic.html
1126                http/tests/inspector/network/har/har-page.html
1127
1128         * inspector/InspectorNetworkAgent.cpp:
1129         (WebCore::InspectorNetworkAgent::willSendRequest):
1130         Include the wall time when sending a request. This is needed for HAR to
1131         include a wall time, and can be used for Cookie expiration time calculation
1132         as well.
1133
1134 2017-10-23  Andy Estes  <aestes@apple.com>
1135
1136         [Payment Request] Resolve PaymentRequest.show()'s accept promise when a payment is authorized
1137         https://bugs.webkit.org/show_bug.cgi?id=178609
1138         <rdar://problem/33542813>
1139
1140         Reviewed by Alex Christensen.
1141
1142         This patch implements the logic for resolving PaymentRequest.show()'s accept promise when
1143         the user authorizes a payment, and implements PaymentResponse.complete().
1144
1145         Tests: http/tests/paymentrequest/payment-address-attributes-and-toJSON-method.https.html
1146                http/tests/paymentrequest/payment-response-complete-method.https.html
1147                http/tests/paymentrequest/payment-response-methodName-attribute.https.html
1148                http/tests/paymentrequest/payment-response-payerEmail-attribute.https.html
1149                http/tests/paymentrequest/payment-response-payerName-attribute.https.html
1150                http/tests/paymentrequest/payment-response-payerPhone-attribute.https.html
1151
1152         * DerivedSources.make:
1153         * Modules/applepay/ApplePayPaymentContact.h:
1154         * Modules/applepay/Payment.h:
1155         (WebCore::Payment::Payment): Deleted.
1156         (WebCore::Payment::pkPayment const): Deleted.
1157         * Modules/applepay/PaymentContact.h:
1158         (WebCore::PaymentContact::PaymentContact): Deleted.
1159         (WebCore::PaymentContact::pkContact const): Deleted.
1160         * Modules/applepay/cocoa/PaymentContactCocoa.mm:
1161         (WebCore::convert):
1162         * Modules/applepay/paymentrequest/ApplePayPaymentHandler.cpp:
1163         (WebCore::ApplePayPaymentHandler::hasActiveSession):
1164         (WebCore::ApplePayPaymentHandler::ApplePayPaymentHandler):
1165         (WebCore::ApplePayPaymentHandler::document):
1166         (WebCore::ApplePayPaymentHandler::paymentCoordinator):
1167         (WebCore::ApplePayPaymentHandler::convertData):
1168         (WebCore::ApplePayPaymentHandler::show):
1169         (WebCore::ApplePayPaymentHandler::hide):
1170         (WebCore::ApplePayPaymentHandler::canMakePayment):
1171         (WebCore::ApplePayPaymentHandler::complete):
1172         (WebCore::convert):
1173         (WebCore::ApplePayPaymentHandler::didAuthorizePayment):
1174         (WebCore::ApplePayPaymentHandler::didSelectShippingMethod):
1175         (WebCore::ApplePayPaymentHandler::didSelectShippingContact):
1176         * Modules/applepay/paymentrequest/ApplePayPaymentHandler.h:
1177         * Modules/paymentrequest/PaymentAddress.h:
1178         * Modules/paymentrequest/PaymentAddress.idl:
1179         * Modules/paymentrequest/PaymentHandler.cpp:
1180         (WebCore::PaymentHandler::create):
1181         * Modules/paymentrequest/PaymentHandler.h:
1182         * Modules/paymentrequest/PaymentRequest.cpp:
1183         (WebCore::PaymentRequest::show):
1184         (WebCore::PaymentRequest::stop):
1185         (WebCore::PaymentRequest::canMakePayment):
1186         (WebCore::PaymentRequest::canSuspendForDocumentSuspension const):
1187         (WebCore::PaymentRequest::shippingAddressChanged):
1188         (WebCore::PaymentRequest::shippingOptionChanged):
1189         (WebCore::PaymentRequest::accept):
1190         (WebCore::PaymentRequest::complete):
1191         * Modules/paymentrequest/PaymentRequest.h:
1192         * Modules/paymentrequest/PaymentResponse.cpp:
1193         (WebCore::PaymentResponse::PaymentResponse):
1194         (WebCore::PaymentResponse::complete):
1195         * Modules/paymentrequest/PaymentResponse.h:
1196         * WebCore.xcodeproj/project.pbxproj:
1197         * testing/Internals.cpp:
1198         (WebCore::Internals::Internals):
1199         (WebCore::Internals::mockPaymentCoordinator const):
1200         * testing/Internals.h:
1201         * testing/Internals.idl:
1202         * testing/MockPayment.h: Added.
1203         * testing/MockPaymentAddress.h: Added.
1204         * testing/MockPaymentAddress.idl: Added.
1205         * testing/MockPaymentContact.h: Added.
1206         * testing/MockPaymentCoordinator.cpp:
1207         (WebCore::MockPaymentCoordinator::canMakePaymentsWithActiveCard):
1208         (WebCore::MockPaymentCoordinator::openPaymentSetup):
1209         (WebCore::dispatchIfShowing):
1210         (WebCore::MockPaymentCoordinator::showPaymentUI):
1211         (WebCore::MockPaymentCoordinator::completeMerchantValidation):
1212         (WebCore::MockPaymentCoordinator::completePaymentSession):
1213         (WebCore::MockPaymentCoordinator::abortPaymentSession):
1214         (WebCore::MockPaymentCoordinator::cancelPaymentSession):
1215         (WebCore::MockPaymentCoordinator::paymentCoordinatorDestroyed):
1216         * testing/MockPaymentCoordinator.h:
1217         * testing/MockPaymentCoordinator.idl: Added.
1218
1219 2017-10-23  Dean Jackson  <dino@apple.com>
1220
1221         Attempt to stop iOS Simulator tests from failing because
1222         we don't support Accelerated ImageBuffer.
1223
1224         * html/ImageBitmap.cpp:
1225
1226 2017-10-23  Zalan Bujtas  <zalan@apple.com>
1227
1228         [FrameView::layout cleanup] Make m_subtreeLayoutRoot weak.
1229         https://bugs.webkit.org/show_bug.cgi?id=178621
1230         <rdar://problem/35110321>
1231
1232         Reviewed by Simon Fraser.
1233
1234         This patch turn m_subtreeLayoutRoot into a weak pointer to handle both the optional and the mutation cases.
1235
1236         Covered by existing cases.
1237
1238         * page/FrameView.cpp:
1239         (WebCore::FrameView::reset):
1240         (WebCore::FrameView::willDestroyRenderTree):
1241         (WebCore::FrameView::didDestroyRenderTree):
1242         (WebCore::FrameView::calculateScrollbarModesForLayout):
1243         (WebCore::FrameView::handleLayoutWithFrameFlatteningIfNeeded):
1244         (WebCore::FrameView::canPerformLayout const):
1245         (WebCore::FrameView::layout): WeakPtr<RenderElement> protects us from recursive layouts triggering UAF on layoutRoot.
1246         (WebCore::FrameView::convertSubtreeLayoutToFullLayout):
1247         (WebCore::FrameView::scheduleRelayout):
1248         (WebCore::FrameView::scheduleRelayoutOfSubtree):
1249         (WebCore::FrameView::needsLayout const):
1250         (WebCore::FrameView::autoSizeIfEnabled):
1251         * page/FrameView.h:
1252
1253 2017-10-23  Keith Miller  <keith_miller@apple.com>
1254
1255         Unreviewed, fix windows build.
1256
1257         * CMakeLists.txt:
1258
1259 2017-10-23  Keith Miller  <keith_miller@apple.com>
1260
1261         Move shared accessibility and animiations files to unified sources.
1262         https://bugs.webkit.org/show_bug.cgi?id=178677
1263
1264         Reviewed by Tim Horton.
1265
1266         * Sources.txt:
1267         * WebCore.xcodeproj/project.pbxproj:
1268
1269 2017-10-23  Chris Dumez  <cdumez@apple.com>
1270
1271         Drop confusing Event::dispatched() method
1272         https://bugs.webkit.org/show_bug.cgi?id=178670
1273
1274         Reviewed by Youenn Fablet.
1275
1276         Drop confusing Event::dispatched() method. What the call sites want to do is check
1277         that the Event's "dispatch" flag is set:
1278         - https://dom.spec.whatwg.org/#dispatch-flag
1279
1280         This flag gets set at the beginning of dispatchEvent() and unset at the end of
1281         dispatchEvent():
1282         - https://dom.spec.whatwg.org/#ref-for-dispatch-flag③
1283
1284         See as an example event.initEvent():
1285         - https://dom.spec.whatwg.org/#dom-event-initevent
1286
1287         The right way to check the Event's "dispatch" flag is the Event::isBeingDispatched()
1288         method, so use this instead. One side effect of this change is that it is now
1289         possible to call the init*Event() method on events that have already been dispatched
1290         in order to dispatch them again, as per the specification.
1291
1292         Test: fast/events/initEvent-after-dispatching.html
1293
1294         * dom/CompositionEvent.cpp:
1295         (WebCore::CompositionEvent::initCompositionEvent):
1296         * dom/DeviceMotionEvent.cpp:
1297         (WebCore::DeviceMotionEvent::initDeviceMotionEvent):
1298         * dom/DeviceOrientationEvent.cpp:
1299         (WebCore::DeviceOrientationEvent::initDeviceOrientationEvent):
1300         * dom/Event.h:
1301         * dom/HashChangeEvent.h:
1302         * dom/KeyboardEvent.cpp:
1303         (WebCore::KeyboardEvent::initKeyboardEvent):
1304         * dom/MessageEvent.cpp:
1305         (WebCore::MessageEvent::initMessageEvent):
1306         * dom/MouseEvent.cpp:
1307         (WebCore::MouseEvent::initMouseEvent):
1308         * dom/OverflowEvent.cpp:
1309         (WebCore::OverflowEvent::initOverflowEvent):
1310         * dom/TextEvent.cpp:
1311         (WebCore::TextEvent::initTextEvent):
1312         * dom/TouchEvent.cpp:
1313         (WebCore::TouchEvent::initTouchEvent):
1314         * dom/UIEvent.cpp:
1315         (WebCore::UIEvent::initUIEvent):
1316         * dom/WheelEvent.cpp:
1317         (WebCore::WheelEvent::initWheelEvent):
1318         * storage/StorageEvent.cpp:
1319         (WebCore::StorageEvent::initStorageEvent):
1320
1321 2017-10-23  Antti Koivisto  <antti@apple.com>
1322
1323         Remember previous child renderer during render tree update
1324         https://bugs.webkit.org/show_bug.cgi?id=178659
1325
1326         Reviewed by Zalan Bujtas.
1327
1328         We shouldn't need to recompute the previous renderer, we know it already.
1329
1330         * style/RenderTreePosition.cpp:
1331         (WebCore::RenderTreePosition::previousSiblingRenderer const): Deleted.
1332
1333             No longer needed. This was also subtly wrong as doesn't take display:contents into account.
1334
1335         * style/RenderTreePosition.h:
1336         * style/RenderTreeUpdater.cpp:
1337         (WebCore::RenderTreeUpdater::updateRenderTree):
1338         (WebCore::RenderTreeUpdater::textRendererIsNeeded):
1339
1340             Use the saved previous renderer.
1341
1342         (WebCore::RenderTreeUpdater::updateTextRenderer):
1343         (WebCore::RenderTreeUpdater::storePreviousRenderer):
1344
1345             Save the previous renderere as we walk the tree.
1346
1347         (WebCore::textRendererIsNeeded): Deleted.
1348         * style/RenderTreeUpdater.h:
1349
1350 2017-10-23  Keith Miller  <keith_miller@apple.com>
1351
1352         Add Shared Modules files to the unified source build.
1353         https://bugs.webkit.org/show_bug.cgi?id=178675
1354
1355         Reviewed by Tim Horton.
1356
1357         This patch all the Modules sources files shared across all ports to
1358         unified sources.
1359
1360         * CMakeLists.txt:
1361         * Sources.txt:
1362         * WebCore.xcodeproj/project.pbxproj:
1363
1364 2017-10-22  Dean Jackson  <dino@apple.com>
1365
1366         Implement drawImage(ImageBitmap) on 2d canvas
1367         https://bugs.webkit.org/show_bug.cgi?id=178653
1368         <rdar://problem/35104360>
1369
1370         Reviewed by Antoine Quint.
1371
1372         Implement CanvasRenderingContext2D::drawImage with ImageBitmap.
1373         It's probably not going to be a very common operation, but
1374         it importantly allows us to test the ImageBitmap creation
1375         code.
1376
1377         Test: http/wpt/2dcontext/imagebitmap/drawImage-ImageBitmap.html
1378
1379         * html/ImageBitmap.cpp:
1380         (WebCore::taintsOrigin): New helper function to determine if a
1381         CachedImage would provide a clean origin.
1382         (WebCore::ImageBitmap::createPromise): Set the flag that records
1383         if this ImageBitmap has a clean origin.
1384         * html/ImageBitmap.h:
1385         (WebCore::ImageBitmap::buffer): Exposes the ImageBuffer backing
1386         store, allowing access to the data for drawing.
1387         (WebCore::ImageBitmap::originClean const): Is this ImageBitmap
1388         going to taint a destination.
1389         * html/canvas/CanvasRenderingContext.cpp:
1390         (WebCore::CanvasRenderingContext::wouldTaintOrigin): Implement
1391         the ImageBitmap version of this template function.
1392         * html/canvas/CanvasRenderingContext.h:
1393         * html/canvas/CanvasRenderingContext2D.cpp:
1394         (WebCore::CanvasRenderingContext2D::drawImage): Implement the
1395         actual drawing of an ImageBitmap.
1396
1397 2017-10-23  Daniel Bates  <dabates@apple.com>
1398
1399         Unreviewed, rolling out r223699.
1400
1401         Caused regressions with right-to-left text selection and
1402         painting of markers in flipped writing mode and in overlapping
1403         lines. Will investigate offline.
1404
1405         Reverted changeset:
1406
1407         "Share logic in InlineTextBox to compute selection rect"
1408         https://bugs.webkit.org/show_bug.cgi?id=178232
1409         https://trac.webkit.org/changeset/223699
1410
1411 2017-10-23  Youenn Fablet  <youenn@apple.com>
1412
1413         Create a Fetch event when ServiceWorker has to handle a fetch
1414         https://bugs.webkit.org/show_bug.cgi?id=178491
1415
1416         Reviewed by Chris Dumez.
1417
1418         Covered by existing test.
1419
1420         Updating FetchEvent to pass a FetchResponse* within its onResponse callback.
1421         Making it a CompletionHandler.
1422         Fixing a check on respondWith to ensure that event is dispatched when respondWith is called.
1423
1424         Adding ServiceWorkerFetch class to handle the creation of the fetch event, waiting for the fetch event to be responded
1425         and processing when fetch event is responded.
1426         ServiceWorkerFetchTask takes a client to which will be sent the response body or the error.
1427         WebKit implementation of it will be to send the related IPC message back to the WebProcess that made the fetch request.
1428
1429         Adding a method to ServiceWorkerThread to create the fetch event on worker thread and dispatch on the global scope.
1430
1431         * WebCore.xcodeproj/project.pbxproj:
1432         * platform/network/ResourceResponseBase.h:
1433         * testing/Internals.cpp:
1434         (WebCore::Internals::waitForFetchEventToFinish):
1435         * workers/service/FetchEvent.cpp:
1436         (WebCore::FetchEvent::~FetchEvent):
1437         (WebCore::FetchEvent::respondWith):
1438         (WebCore::FetchEvent::onResponse):
1439         (WebCore::FetchEvent::respondWithError):
1440         (WebCore::FetchEvent::processResponse):
1441         (WebCore::FetchEvent::promiseIsSettled):
1442         * workers/service/FetchEvent.h:
1443         * workers/service/context/ServiceWorkerFetch.cpp: Added.
1444         (WebCore::ServiceWorkerFetch::dispatchFetchTask):
1445         (WebCore::ServiceWorkerFetch::processResponse):
1446         * workers/service/context/ServiceWorkerFetch.h: Added.
1447         * workers/service/context/ServiceWorkerThread.cpp:
1448         (WebCore::m_workerObjectProxy):
1449         (WebCore::ServiceWorkerThread::dispatchFetchEvent):
1450         * workers/service/context/ServiceWorkerThread.h:
1451
1452 2017-10-23  Basuke Suzuki  <Basuke.Suzuki@sony.com>
1453
1454         [Curl] Fix authentication related bugs
1455         https://bugs.webkit.org/show_bug.cgi?id=178652
1456
1457         Reviewed by Alex Christensen.
1458
1459         * platform/network/curl/AuthenticationChallengeCurl.cpp:
1460         (WebCore::AuthenticationChallenge::protectionSpaceFromHandle):
1461         * platform/network/curl/CurlContext.cpp:
1462         (WebCore::CurlHandle::setHttpAuthUserPass):
1463         * platform/network/curl/CurlRequest.cpp:
1464         (WebCore::CurlRequest::setUserPass):
1465         (WebCore::CurlRequest::setupTransfer):
1466         (WebCore::CurlRequest::didReceiveHeader):
1467         * platform/network/curl/CurlRequest.h:
1468
1469 2017-10-23  Matt Lewis  <jlewis3@apple.com>
1470
1471         Unreviewed, rolling out r223820.
1472
1473         This caused a build break on Windows.
1474
1475         Reverted changeset:
1476
1477         "Web Inspector: Remove unused Console.setMonitoringXHREnabled"
1478         https://bugs.webkit.org/show_bug.cgi?id=178617
1479         https://trac.webkit.org/changeset/223820
1480
1481 2017-10-23  Zalan Bujtas  <zalan@apple.com>
1482
1483         Call FrameView::scheduleSelectionUpdate when selection needs repainting after layout instead of setting the RenderView dirty.
1484         https://bugs.webkit.org/show_bug.cgi?id=178651
1485         <rdar://problem/35117448>
1486
1487         Reviewed by Antti Koivisto.
1488
1489         Calling setNeedsLayout() on the RenderView to trigger selection update is problematic in 2 different ways:
1490         1. marking the root renderer dirty does not trigger layout (this is very specific to the root,
1491         other renderers do trigger layout). It means that it works as long as someone else schedules a layout.
1492         2. when a subtree layout is already scheduled and we mark the root renderer dirty, the root gets stuck with
1493         the dirty flag (since the entry point for the subsequent layout is a descendant of the root and not the root itself).
1494
1495         This patch addresses these issues by scheduling/converting subtree layout when needed.  
1496
1497         Covered by fast/dynamic/remove-invisible-node-inside-selection.html/remove-node-inside-selection.html
1498
1499         * editing/FrameSelection.cpp:
1500         (WebCore::FrameSelection::respondToNodeModification):
1501         * page/FrameView.cpp:
1502         (WebCore::FrameView::scheduleSelectionUpdate):
1503         * page/FrameView.h:
1504
1505 2017-10-23  Miguel Gomez  <magomez@igalia.com>
1506
1507         [TexMap] Remove GraphicsContext3D usage from TextureMapperShaderProgram
1508         https://bugs.webkit.org/show_bug.cgi?id=175425
1509
1510         Reviewed by Žan Doberšek.
1511
1512         Remove usage of the GraphicsContext3D class in TextureMapperShaderProgram.
1513         Direct OpenGL API calls, types and constants are used instead.
1514
1515         By removing GraphicsContext3D, we don't use ANGLE anymore to perform the
1516         shader adaptation to the used OpenGL/GLES2 version, so we need to do that
1517         inside TextureMapperShaderProgram. The main changes required for this are
1518         adding the #version directive and use in/out to define input/output parameters
1519         when using OpenGL >= 3.2, and defining the default precision only when using
1520         GLES2.
1521
1522         Besides that, now that VideoTextureCopierGStreamer doesn't have its own
1523         GraphicsContext3D, we need to add a VAO to it when using OpenGL >= 3.2.
1524
1525         Based on a previous patch by Žan Doberšek <zdobersek@igalia.com>.
1526
1527         No behavior change.
1528
1529         * platform/graphics/gstreamer/VideoTextureCopierGStreamer.cpp:
1530         (WebCore::VideoTextureCopierGStreamer::VideoTextureCopierGStreamer):
1531         (WebCore::VideoTextureCopierGStreamer::~VideoTextureCopierGStreamer):
1532         (WebCore::VideoTextureCopierGStreamer::copyVideoTextureToPlatformTexture):
1533         * platform/graphics/gstreamer/VideoTextureCopierGStreamer.h:
1534         * platform/graphics/texmap/TextureMapperGL.cpp:
1535         (WebCore::TextureMapperGLData::getShaderProgram):
1536         (WebCore::prepareFilterProgram):
1537         (WebCore::TextureMapperGL::drawTexture):
1538         (WebCore::TextureMapperGL::drawFiltered):
1539         * platform/graphics/texmap/TextureMapperShaderProgram.cpp:
1540         (WebCore::TextureMapperShaderProgram::create):
1541         (WebCore::getShaderLog):
1542         (WebCore::getProgramLog):
1543         (WebCore::TextureMapperShaderProgram::TextureMapperShaderProgram):
1544         (WebCore::TextureMapperShaderProgram::~TextureMapperShaderProgram):
1545         (WebCore::TextureMapperShaderProgram::setMatrix):
1546         (WebCore::TextureMapperShaderProgram::getLocation):
1547         * platform/graphics/texmap/TextureMapperShaderProgram.h:
1548         (WebCore::TextureMapperShaderProgram::programID const):
1549
1550 2017-10-22  Sam Weinig  <sam@webkit.org>
1551
1552         [Settings] Replace current Settings generation with template file based approach
1553         https://bugs.webkit.org/show_bug.cgi?id=178634
1554
1555         Reviewed by Joseph Pecoraro.
1556
1557         This replaces the recently added python based Settings generation with a generator
1558         built in ruby, so we can take advantage of ERB for templating. The result has much
1559         of the logic in the templates and as a result feels much easier to follow and cleaner.
1560
1561         Since I was moving things to ruby, I took the opertunity to switch the Settings definition
1562         file from our .in format to yaml, which is quite a bit easier to read.
1563
1564         * CMakeLists.txt:
1565         * DerivedSources.make:
1566         * Scripts/GenerateSettings: Removed.
1567         * Scripts/GenerateSettings.py: Removed.
1568         * Scripts/GenerateSettings.rb: Added.
1569         * Scripts/GenerateSettings/GenerateInternalSettingsHeaderFile.py: Removed.
1570         * Scripts/GenerateSettings/GenerateInternalSettingsIDLFile.py: Removed.
1571         * Scripts/GenerateSettings/GenerateInternalSettingsImplementationFile.py: Removed.
1572         * Scripts/GenerateSettings/GenerateSettings.py: Removed.
1573         * Scripts/GenerateSettings/GenerateSettingsHeaderFile.py: Removed.
1574         * Scripts/GenerateSettings/GenerateSettingsImplementationFile.py: Removed.
1575         * Scripts/GenerateSettings/Settings.py: Removed.
1576         * Scripts/GenerateSettings/__init__.py: Removed.
1577         * Scripts/SettingsTemplates: Added.
1578         * Scripts/SettingsTemplates/InternalSettingsGenerated.cpp.erb: Added.
1579         * Scripts/SettingsTemplates/InternalSettingsGenerated.h.erb: Added.
1580         * Scripts/SettingsTemplates/InternalSettingsGenerated.idl.erb: Added.
1581         * Scripts/SettingsTemplates/Settings.cpp.erb: Added.
1582         * Scripts/SettingsTemplates/Settings.h.erb: Added.
1583         * WebCore.xcodeproj/project.pbxproj:
1584         * WebCoreMacros.cmake:
1585         * page/Settings.in: Removed.
1586         * page/Settings.yaml: Added.
1587
1588 2017-10-22  Joseph Pecoraro  <pecoraro@apple.com>
1589
1590         REGRESSION(r219675): Web Inspector: CommandLineAPI getEventListeners does not work
1591         https://bugs.webkit.org/show_bug.cgi?id=178650
1592         <rdar://problem/35116347>
1593
1594         Reviewed by Sam Weinig.
1595
1596         Test: inspector/console/command-line-api-getEventListeners.html
1597
1598         * inspector/CommandLineAPIHost.cpp:
1599         (WebCore::listenerEntriesFromListenerInfo):
1600         Fix typo.
1601
1602         (WebCore::CommandLineAPIHost::getEventListeners):
1603         Fix incorrect early return.
1604
1605         * inspector/CommandLineAPIHost.h:
1606         * inspector/CommandLineAPIHost.idl:
1607         Add more attributes about the listener. These new attributes match output from Chrome.
1608
1609 2017-10-22  Antoine Quint  <graouts@apple.com>
1610
1611         [Web Animations] Add animations to the timeline
1612         https://bugs.webkit.org/show_bug.cgi?id=178643
1613
1614         Reviewed by Dean Jackson.
1615
1616         If a timeline is provided as a parameter to the Animation constructor,
1617         add it to the timeline, and remove it when the object is destroyed.
1618
1619         We also start the basic mechanism to dump the contents of a timeline
1620         as text for testing purposes, currently only logging the number of
1621         animations in a timeline and just logging the class name for animation
1622         themselves.
1623
1624         Test: webanimations/animation-creation-addition.html
1625
1626         * animation/AnimationTimeline.cpp:
1627         (WebCore::AnimationTimeline::description):
1628         * animation/AnimationTimeline.h:
1629         * animation/AnimationTimeline.idl:
1630         * animation/WebAnimation.cpp:
1631         (WebCore::WebAnimation::create):
1632         (WebCore::WebAnimation::~WebAnimation):
1633         (WebCore::WebAnimation::description):
1634         * animation/WebAnimation.h:
1635         * testing/Internals.cpp:
1636         (WebCore::Internals::timelineDescription):
1637         * testing/Internals.h:
1638         * testing/Internals.idl:
1639
1640 2017-10-21  Zalan Bujtas  <zalan@apple.com>
1641
1642         [FrameView::layout cleanup] Drop allowSubtree parameter
1643         https://bugs.webkit.org/show_bug.cgi?id=178623
1644         <rdar://problem/35111012>
1645
1646         Reviewed by Sam Weinig.
1647
1648         This flag is only set through ::forceLayout(). Let's just convert the subtree layout
1649         to full layout right before calling ::layout().
1650
1651         No change in functionality.
1652
1653         * page/FrameView.cpp:
1654         (WebCore::FrameView::handleLayoutWithFrameFlatteningIfNeeded):
1655         (WebCore::FrameView::layout):
1656         (WebCore::FrameView::startLayoutAtMainFrameViewIfNeeded):
1657         (WebCore::FrameView::forceLayout):
1658         * page/FrameView.h:
1659
1660 2017-10-21  Joseph Pecoraro  <pecoraro@apple.com>
1661
1662         Web Inspector: Remove unused Console.setMonitoringXHREnabled
1663         https://bugs.webkit.org/show_bug.cgi?id=178617
1664
1665         Reviewed by Sam Weinig.
1666
1667         * inspector/InspectorInstrumentation.cpp:
1668         (WebCore::InspectorInstrumentation::didFinishXHRLoadingImpl):
1669         * inspector/InspectorInstrumentation.h:
1670         (WebCore::InspectorInstrumentation::didFinishXHRLoading):
1671         * inspector/WebConsoleAgent.cpp:
1672         (WebCore::WebConsoleAgent::setMonitoringXHREnabled): Deleted.
1673         (WebCore::WebConsoleAgent::didFinishXHRLoading): Deleted.
1674         * inspector/WebConsoleAgent.h:
1675         Remove XHR monitoring code.
1676
1677         * xml/XMLHttpRequest.h:
1678         * xml/XMLHttpRequest.cpp:
1679         (WebCore::XMLHttpRequest::send):
1680         (WebCore::XMLHttpRequest::didFinishLoading):
1681         (WebCore::XMLHttpRequest::setLastSendLineAndColumnNumber): Deleted.
1682         * xml/XMLHttpRequest.idl:
1683         Remove now unused state on XHR and ExecState requirement for send().
1684
1685 2017-10-21  Dean Jackson  <dino@apple.com>
1686
1687         createImageBitmap with basic HTMLImageElement
1688         https://bugs.webkit.org/show_bug.cgi?id=178619
1689         <rdar://problem/35104118>
1690
1691         Reviewed by Antoine Quint.
1692
1693         Implement the basic infrastructure for creating
1694         an ImageBitmap from an HTMLImageElement.
1695
1696         Test: http/wpt/2dcontext/imagebitmap/createImageBitmap.html
1697
1698         * html/ImageBitmap.cpp:
1699         (WebCore::ImageBitmap::createPromise): Create the image buffer
1700         and draw the image into its backing store.
1701         * html/ImageBitmap.h:
1702
1703 2017-10-21  Antoine Quint  <graouts@apple.com>
1704
1705         [Web Animations] Add bindings to unified sources
1706         https://bugs.webkit.org/show_bug.cgi?id=178620
1707
1708         Reviewed by Dean Jackson.
1709
1710         Removing the Web Animations bindings from the WebCore target and adding them to the unified sources list instead.
1711
1712         * Sources.txt:
1713         * WebCore.xcodeproj/project.pbxproj:
1714
1715 2017-10-21  Tim Horton  <timothy_horton@apple.com>
1716
1717         Fix the Mac CMake build
1718
1719         * PlatformMac.cmake:
1720
1721 2017-10-21  Antti Koivisto  <antti@apple.com>
1722
1723         Support ::before/::after pseudo elements with display:contents
1724         https://bugs.webkit.org/show_bug.cgi?id=178584
1725
1726         Reviewed by Ryosuke Niwa.
1727
1728         This is cases like
1729
1730         ::before { display:contents; content:'foo' }
1731
1732         * css/StyleResolver.cpp:
1733         (WebCore::StyleResolver::adjustDisplayContentsStyle): Added.
1734
1735             Allow display:contents on pseudo elements.
1736             Factor into function.
1737
1738         (WebCore::StyleResolver::adjustRenderStyle):
1739         * dom/PseudoElement.h:
1740
1741             Add a weak vector of content renderers.
1742
1743         * style/RenderTreePosition.h:
1744         (WebCore::RenderTreePosition::moveToLastChild):
1745
1746             Add a way to set a valid render tree position without a node.
1747
1748         * style/RenderTreeUpdaterGeneratedContent.cpp:
1749         (WebCore::createContentRenderers):
1750
1751             Take RenderTreePosition.
1752
1753         (WebCore::updateStyleForContentRenderers):
1754
1755             Update based on the content renderer vector instead of doing a tree walk.
1756
1757         (WebCore::removeAndDestroyContentRenderers):
1758
1759             Helper for destroying content renderers.
1760
1761         (WebCore::RenderTreeUpdater::GeneratedContent::updatePseudoElement):
1762
1763             In the normal case create a render tree position for the pseudo element renderer and
1764             use RenderTreePosition::moveToLastChild to make it a valid position. (The existing
1765             RenderTreePosition interface didn't have way to move to positions in anonymous boxes)
1766
1767             In the case of a non box generating display:contents pseudo element, use the current
1768             render tree position instead.
1769
1770             Ensure that pseudo element renderers are destroyed before creating the new ones since in
1771             display:contents case they are not descendants of the pseudo renderer and don't get cleared
1772             automatically.
1773
1774 2017-10-20  Zalan Bujtas  <zalan@apple.com>
1775
1776         [FrameView::layout cleanup] Use SetForScope to ensure layout state correctness
1777         https://bugs.webkit.org/show_bug.cgi?id=178604
1778         <rdar://problem/35101890>
1779
1780         Reviewed by Simon Fraser.
1781
1782         SetForScope guarantees state correctness even with nested layouts. This is a lot less
1783         error prone than resetting the state value after each potential recursive call.
1784
1785         Covered by existing tests.
1786
1787         * page/FrameView.cpp:
1788         (WebCore::FrameView::handleDeferredScrollbarsUpdateAfterDirectionChange): This layout state does
1789         not look too useful.
1790         (WebCore::FrameView::layout):
1791         * page/FrameView.h: While performPostLayoutTasks() is somewhat special since it can either be sync or async,
1792         so painting should be allowed in both cases.
1793
1794 2017-10-20  Said Abou-Hallawa  <sabouhallawa@apple.com>
1795
1796         SVGPathElement should cache the built-up Path of its non animating pathByteStream()
1797         https://bugs.webkit.org/show_bug.cgi?id=178248
1798
1799         Reviewed by Simon Fraser.
1800
1801         Instead of creating a Path object from the non animating pathByteStream()
1802         every time we need to updatePathFromPathElement(), the Path object can be
1803         cached once it is created and used for later calls.
1804
1805         * html/canvas/Path2D.h: buildPathFromString() now returns a Path.
1806
1807         * platform/graphics/Path.h:
1808         * platform/graphics/cairo/PathCairo.cpp:
1809         (WebCore::Path::Path):
1810         (WebCore::Path::operator=):
1811         * platform/graphics/cg/PathCG.cpp:
1812         (WebCore::Path::Path):
1813         (WebCore::Path::operator=):
1814         * platform/graphics/win/PathDirect2D.cpp:
1815         (WebCore::Path::Path):
1816         (WebCore::Path::operator=):
1817         Define the move constructor and the move assignment operator for the the
1818         Path class so a statement like "Path path = buildPathFromString()" won't 
1819         go through the copy constructor and the copy assignment operator.
1820
1821         * rendering/style/BasicShapes.cpp:
1822         (WebCore::SVGPathTranslatedByteStream::path const):
1823         * rendering/svg/RenderSVGResourceClipper.cpp:
1824         (WebCore::RenderSVGResourceClipper::pathOnlyClipping):
1825         * rendering/svg/RenderSVGShape.cpp:
1826         (WebCore::RenderSVGShape::updateShapeFromElement):
1827         * rendering/svg/RenderSVGTextPath.cpp:
1828         (WebCore::RenderSVGTextPath::layoutPath const):
1829         * rendering/svg/SVGPathData.cpp:
1830         (WebCore::pathFromCircleElement):
1831         (WebCore::pathFromEllipseElement):
1832         (WebCore::pathFromLineElement):
1833         (WebCore::pathFromPathElement):
1834         (WebCore::pathFromPolygonElement):
1835         (WebCore::pathFromPolylineElement):
1836         (WebCore::pathFromRectElement):
1837         (WebCore::pathFromGraphicsElement):
1838         (WebCore::updatePathFromCircleElement): Deleted.
1839         (WebCore::updatePathFromEllipseElement): Deleted.
1840         (WebCore::updatePathFromLineElement): Deleted.
1841         (WebCore::updatePathFromPathElement): Deleted.
1842         (WebCore::updatePathFromPolygonElement): Deleted.
1843         (WebCore::updatePathFromPolylineElement): Deleted.
1844         (WebCore::updatePathFromRectElement): Deleted.
1845         (WebCore::updatePathFromGraphicsElement): Deleted.
1846         * rendering/svg/SVGPathData.h:
1847         * svg/SVGAnimateMotionElement.cpp:
1848         (WebCore::SVGAnimateMotionElement::parseAttribute):
1849         (WebCore::SVGAnimateMotionElement::updateAnimationPath):
1850         * svg/SVGGraphicsElement.cpp:
1851         (WebCore::SVGGraphicsElement::toClipPath):
1852         * svg/SVGGraphicsElement.h:
1853         Rename updatePathFromElement() to pathFromGraphicsElement().
1854
1855         * svg/SVGPathElement.cpp:
1856         (WebCore::SVGPathElement::parseAttribute): Clear the cache when
1857         m_pathByteStream changes.
1858         (WebCore::SVGPathElement::pathForByteStream const): Caches the m_cachedPath
1859         if it is null.
1860         (WebCore::SVGPathElement::pathSegListChanged): Clear the cache when
1861         m_pathByteStream changes.
1862
1863         * svg/SVGPathElement.h:
1864         * svg/SVGPathUtilities.cpp:
1865         (WebCore::buildPathFromString):
1866         (WebCore::buildPathFromByteStream):
1867         * svg/SVGPathUtilities.h:
1868         Make thes buildPathFromString() and buildPathFromByteStream() return Paths.
1869
1870         * svg/SVGUseElement.cpp:
1871         (WebCore::SVGUseElement::toClipPath):
1872         * svg/SVGUseElement.h:
1873         Make these toClipPath() return Path.
1874
1875 2017-10-20  Ryosuke Niwa  <rniwa@webkit.org>
1876
1877         Rename insertedInto and removedFrom to insertedIntoAncestor and removedFromAncestor
1878         https://bugs.webkit.org/show_bug.cgi?id=178605
1879
1880         Reviewed by Andy Estes.
1881
1882         Renamed insertedInto and removedFrom to insertedIntoAncestor and removedFromAncestor respectively
1883         to make it clear that these functions can be called even when node's immediate parent didn't change.
1884
1885         * dom/ContainerNodeAlgorithms.cpp:
1886         (WebCore::notifyNodeInsertedIntoDocument):
1887         (WebCore::notifyNodeInsertedIntoTree):
1888         (WebCore::notifyNodeRemovedFromDocument):
1889         (WebCore::notifyNodeRemovedFromTree):
1890         (WebCore::notifyChildNodeRemoved):
1891         * dom/ContainerNodeAlgorithms.h:
1892         * dom/Element.cpp:
1893         (WebCore::Element::insertedIntoAncestor): Renamed from insertedInto.
1894         (WebCore::Element::removedFromAncestor): Renamed from removedFrom.
1895         * dom/Element.h:
1896         * dom/Node.cpp:
1897         (WebCore::Node::insertedIntoAncestor): 
1898         (WebCore::Node::removedFromAncestor):
1899         (WebCore::Node::removedFrom): Deleted.
1900         * dom/Node.h:
1901         * dom/ProcessingInstruction.cpp:
1902         (WebCore::ProcessingInstruction::insertedIntoAncestor): Renamed from insertedInto.
1903         (WebCore::ProcessingInstruction::removedFromAncestor): Renamed from removedFrom.
1904         * dom/ProcessingInstruction.h:
1905         * dom/ScriptElement.h:
1906         (WebCore::ScriptElement::insertedIntoAncestor const): Renamed from insertedInto.
1907         * dom/ShadowRoot.cpp:
1908         (WebCore::ShadowRoot::insertedIntoAncestor): Renamed from insertedInto.
1909         (WebCore::ShadowRoot::removedFromAncestor): Renamed from removedFrom.
1910         * dom/ShadowRoot.h:
1911         * html/FormAssociatedElement.cpp:
1912         (WebCore::FormAssociatedElement::insertedIntoAncestor): Renamed from insertedInto.
1913         (WebCore::FormAssociatedElement::removedFromAncestor): Renamed from removedFrom.
1914         * html/FormAssociatedElement.h:
1915         * html/HTMLBaseElement.cpp:
1916         (WebCore::HTMLBaseElement::insertedIntoAncestor): Renamed from insertedInto.
1917         (WebCore::HTMLBaseElement::removedFromAncestor): Renamed from removedFrom.
1918         * html/HTMLBaseElement.h:
1919         * html/HTMLBodyElement.cpp:
1920         (WebCore::HTMLBodyElement::insertedIntoAncestor): Renamed from insertedInto.
1921         * html/HTMLBodyElement.h:
1922         * html/HTMLFormControlElement.cpp:
1923         (WebCore::HTMLFormControlElement::insertedIntoAncestor): Renamed from insertedInto.
1924         (WebCore::HTMLFormControlElement::removedFromAncestor): Renamed from removedFrom.
1925         * html/HTMLFormControlElement.h:
1926         * html/HTMLFormControlElementWithState.cpp:
1927         (WebCore::HTMLFormControlElementWithState::insertedIntoAncestor): Renamed from insertedInto.
1928         (WebCore::HTMLFormControlElementWithState::removedFromAncestor): Renamed from removedFrom.
1929         * html/HTMLFormControlElementWithState.h:
1930         * html/HTMLFormElement.cpp:
1931         (WebCore::HTMLFormElement::insertedIntoAncestor): Renamed from insertedInto.
1932         (WebCore::HTMLFormElement::removedFromAncestor): Renamed from removedFrom.
1933         * html/HTMLFormElement.h:
1934         * html/HTMLFrameElementBase.cpp:
1935         (WebCore::HTMLFrameElementBase::insertedIntoAncestor): Renamed from insertedInto.
1936         * html/HTMLFrameElementBase.h:
1937         * html/HTMLFrameSetElement.cpp:
1938         (WebCore::HTMLFrameSetElement::insertedIntoAncestor): Renamed from insertedInto.
1939         (WebCore::HTMLFrameSetElement::removedFromAncestor): Renamed from removedFrom.
1940         * html/HTMLFrameSetElement.h:
1941         * html/HTMLImageElement.cpp:
1942         (WebCore::HTMLImageElement::insertedIntoAncestor): Renamed from insertedInto.
1943         (WebCore::HTMLImageElement::removedFromAncestor): Renamed from removedFrom.
1944         * html/HTMLImageElement.h:
1945         * html/HTMLInputElement.cpp:
1946         (WebCore::HTMLInputElement::insertedIntoAncestor): Renamed from insertedInto.
1947         (WebCore::HTMLInputElement::removedFromAncestor): Renamed from removedFrom.
1948         * html/HTMLInputElement.h:
1949         * html/HTMLLinkElement.cpp:
1950         (WebCore::HTMLLinkElement::insertedIntoAncestor): Renamed from insertedInto.
1951         (WebCore::HTMLLinkElement::removedFromAncestor): Renamed from removedFrom.
1952         * html/HTMLLinkElement.h:
1953         * html/HTMLMapElement.cpp:
1954         (WebCore::HTMLMapElement::insertedIntoAncestor): Renamed from insertedInto.
1955         (WebCore::HTMLMapElement::removedFromAncestor): Renamed from removedFrom.
1956         * html/HTMLMapElement.h:
1957         * html/HTMLMediaElement.cpp:
1958         (WebCore::HTMLMediaElement::insertedIntoAncestor): Renamed from insertedInto.
1959         (WebCore::HTMLMediaElement::removedFromAncestor): Renamed from removedFrom.
1960         * html/HTMLMediaElement.h:
1961         * html/HTMLMetaElement.cpp:
1962         (WebCore::HTMLMetaElement::insertedIntoAncestor): Renamed from insertedInto.
1963         * html/HTMLMetaElement.h:
1964         * html/HTMLObjectElement.cpp:
1965         (WebCore::HTMLObjectElement::insertedIntoAncestor): Renamed from insertedInto.
1966         (WebCore::HTMLObjectElement::removedFromAncestor): Renamed from removedFrom.
1967         * html/HTMLObjectElement.h:
1968         * html/HTMLOptionElement.cpp:
1969         (WebCore::HTMLOptionElement::insertedIntoAncestor): Renamed from insertedInto.
1970         * html/HTMLOptionElement.h:
1971         * html/HTMLScriptElement.cpp:
1972         (WebCore::HTMLScriptElement::insertedIntoAncestor): Renamed from insertedInto.
1973         * html/HTMLScriptElement.h:
1974         * html/HTMLSelectElement.cpp:
1975         (WebCore::HTMLSelectElement::insertedIntoAncestor): Renamed from insertedInto.
1976         * html/HTMLSelectElement.h:
1977         * html/HTMLSlotElement.cpp:
1978         (WebCore::HTMLSlotElement::insertedIntoAncestor): Renamed from insertedInto.
1979         (WebCore::HTMLSlotElement::removedFromAncestor): Renamed from removedFrom.
1980         * html/HTMLSlotElement.h:
1981         * html/HTMLSourceElement.cpp:
1982         (WebCore::HTMLSourceElement::insertedIntoAncestor): Renamed from insertedInto.
1983         (WebCore::HTMLSourceElement::removedFromAncestor): Renamed from removedFrom.
1984         * html/HTMLSourceElement.h:
1985         * html/HTMLStyleElement.cpp:
1986         (WebCore::HTMLStyleElement::insertedIntoAncestor): Renamed from insertedInto.
1987         (WebCore::HTMLStyleElement::removedFromAncestor): Renamed from removedFrom.
1988         * html/HTMLStyleElement.h:
1989         * html/HTMLTextFormControlElement.cpp:
1990         (WebCore::HTMLTextFormControlElement::insertedIntoAncestor): Renamed from insertedInto.
1991         * html/HTMLTextFormControlElement.h:
1992         * html/HTMLTitleElement.cpp:
1993         (WebCore::HTMLTitleElement::insertedIntoAncestor): Renamed from insertedInto.
1994         (WebCore::HTMLTitleElement::removedFromAncestor): Renamed from removedFrom.
1995         * html/HTMLTitleElement.h:
1996         * html/HTMLTrackElement.cpp:
1997         (WebCore::HTMLTrackElement::insertedIntoAncestor): Renamed from insertedInto.
1998         (WebCore::HTMLTrackElement::removedFromAncestor): Renamed from removedFrom.
1999         * html/HTMLTrackElement.h:
2000         * svg/SVGElement.cpp:
2001         (WebCore::SVGElement::removedFromAncestor): Renamed from removedFrom.
2002         (WebCore::SVGElement::insertedIntoAncestor): Renamed from insertedInto.
2003         (WebCore::SVGElement::updateRelativeLengthsInformation):
2004         * svg/SVGElement.h:
2005         * svg/SVGFEImageElement.cpp:
2006         (WebCore::SVGFEImageElement::insertedIntoAncestor): Renamed from insertedInto.
2007         (WebCore::SVGFEImageElement::removedFromAncestor): Renamed from removedFrom.
2008         * svg/SVGFEImageElement.h:
2009         * svg/SVGFontFaceElement.cpp:
2010         (WebCore::SVGFontFaceElement::insertedIntoAncestor): Renamed from insertedInto.
2011         (WebCore::SVGFontFaceElement::removedFromAncestor): Renamed from removedFrom.
2012         * svg/SVGFontFaceElement.h:
2013         * svg/SVGFontFaceUriElement.cpp:
2014         (WebCore::SVGFontFaceUriElement::insertedIntoAncestor): Renamed from insertedInto.
2015         * svg/SVGFontFaceUriElement.h:
2016         * svg/SVGImageElement.cpp:
2017         (WebCore::SVGImageElement::insertedIntoAncestor): Renamed from insertedInto.
2018         * svg/SVGImageElement.h:
2019         * svg/SVGMPathElement.cpp:
2020         (WebCore::SVGMPathElement::insertedIntoAncestor): Renamed from insertedInto.
2021         (WebCore::SVGMPathElement::removedFromAncestor): Renamed from removedFrom.
2022         * svg/SVGMPathElement.h:
2023         * svg/SVGPathElement.cpp:
2024         (WebCore::SVGPathElement::insertedIntoAncestor): Renamed from insertedInto.
2025         (WebCore::SVGPathElement::removedFromAncestor): Renamed from removedFrom.
2026         * svg/SVGPathElement.h:
2027         * svg/SVGSVGElement.cpp:
2028         (WebCore::SVGSVGElement::insertedIntoAncestor): Renamed from insertedInto.
2029         (WebCore::SVGSVGElement::removedFromAncestor): Renamed from removedFrom.
2030         * svg/SVGSVGElement.h:
2031         * svg/SVGScriptElement.cpp:
2032         (WebCore::SVGScriptElement::insertedIntoAncestor): Renamed from insertedInto.
2033         * svg/SVGScriptElement.h:
2034         * svg/SVGStyleElement.cpp:
2035         (WebCore::SVGStyleElement::insertedIntoAncestor): Renamed from insertedInto.
2036         (WebCore::SVGStyleElement::removedFromAncestor): Renamed from removedFrom.
2037         * svg/SVGStyleElement.h:
2038         * svg/SVGTRefElement.cpp:
2039         (WebCore::SVGTRefElement::buildPendingResource):
2040         (WebCore::SVGTRefElement::insertedIntoAncestor): Renamed from insertedInto.
2041         (WebCore::SVGTRefElement::removedFromAncestor): Renamed from removedFrom.
2042         * svg/SVGTRefElement.h:
2043         * svg/SVGTextPathElement.cpp:
2044         (WebCore::SVGTextPathElement::insertedIntoAncestor): Renamed from insertedInto.
2045         (WebCore::SVGTextPathElement::removedFromAncestor): Renamed from removedFrom.
2046         * svg/SVGTextPathElement.h:
2047         * svg/SVGTitleElement.cpp:
2048         (WebCore::SVGTitleElement::insertedIntoAncestor): Renamed from insertedInto.
2049         (WebCore::SVGTitleElement::removedFromAncestor): Renamed from removedFrom.
2050         * svg/SVGTitleElement.h:
2051         * svg/SVGUseElement.cpp:
2052         (WebCore::SVGUseElement::insertedIntoAncestor): Renamed from insertedInto.
2053         (WebCore::SVGUseElement::removedFromAncestor): Renamed from removedFrom.
2054         * svg/SVGUseElement.h:
2055         * svg/animation/SVGSMILElement.cpp:
2056         (WebCore::SVGSMILElement::insertedIntoAncestor): Renamed from insertedInto.
2057         (WebCore::SVGSMILElement::removedFromAncestor): Renamed from removedFrom.
2058         * svg/animation/SVGSMILElement.h:
2059
2060 2017-10-20  Ryosuke Niwa  <rniwa@webkit.org>
2061
2062         Fix conditions in HTMLSourceElement and HTMLTrackElement's insertedInto and removedFrom
2063         https://bugs.webkit.org/show_bug.cgi?id=178607
2064
2065         Reviewed by Eric Carlson.
2066
2067         Fixed the conditions in insertedInto and removedFrom of HTMLSourceElement and HTMLTrackElement to be
2068         semantically sensisble. Since these elements are only functional when their immediate parents are
2069         HTMLMediaElement and HTMLPictureElement, we have to check that its immediate parent changed, not when
2070         some of its ancestor had changed by insertion or removal.
2071
2072         * html/HTMLSourceElement.cpp:
2073         (WebCore::HTMLSourceElement::insertedInto):
2074         (WebCore::HTMLSourceElement::removedFrom):
2075         * html/HTMLTrackElement.cpp:
2076         (WebCore::HTMLTrackElement::insertedInto):
2077         (WebCore::HTMLTrackElement::removedFrom):
2078
2079 2017-10-20  Keith Miller  <keith_miller@apple.com>
2080
2081         Unreviewed, fix windows build.
2082
2083         * Sources.txt:
2084         * WebCore.xcodeproj/project.pbxproj:
2085
2086 2017-10-20  Daniel Bates  <dabates@apple.com>
2087
2088         Use "= default" for more default constructors and destructors in WebCore
2089         https://bugs.webkit.org/show_bug.cgi?id=178585
2090
2091         Reviewed by Alex Christensen.
2092
2093         Also remove some destructors that would be implicitly generated.
2094
2095         * Modules/applepay/PaymentMerchantSession.h:
2096         (WebCore::PaymentMerchantSession::~PaymentMerchantSession): Deleted.
2097         * platform/ControlStates.h:
2098         (WebCore::ControlStates::~ControlStates): Deleted.
2099         * platform/PlatformEvent.h:
2100         (WebCore::PlatformEvent::~PlatformEvent): Use default.
2101         * platform/PlatformStrategies.h:
2102         (WebCore::PlatformStrategies::PlatformStrategies): Ditto.
2103         * platform/image-decoders/gif/GIFImageReader.h:
2104         (GIFFrameContext::GIFFrameContext):
2105         (GIFFrameContext::~GIFFrameContext): Deleted.
2106         (GIFImageReader::~GIFImageReader): Deleted.
2107         * rendering/RenderBlockFlow.h:
2108         (WebCore::RenderBlockFlow::RenderBlockFlowRareData::~RenderBlockFlowRareData): Deleted.
2109
2110 2017-10-20  Zalan Bujtas  <zalan@apple.com>
2111
2112         [FrameView::layout cleanup] Scheduling layout should be disabled for FrameView::layout
2113         https://bugs.webkit.org/show_bug.cgi?id=178562
2114         <rdar://problem/35089015>
2115
2116         Reviewed by Simon Fraser.
2117
2118         This patch extends the scope of m_layoutSchedulingEnabled. Now layout scheduling is disabled for the entire FrameView::layout(). 
2119         A scheduled layout at the end of FrameView::layout would indicated dirty tree (which is against FrameView::layout's contract).
2120
2121         Covered by existing tests.
2122
2123         * page/FrameView.cpp:
2124         (WebCore::FrameView::layout):
2125
2126 2017-10-20  Said Abou-Hallawa  <sabouhallawa@apple.com>
2127
2128         When destroying a resource, register "only" the clients who are losing their resource as having pending resources
2129         https://bugs.webkit.org/show_bug.cgi?id=178567
2130         <rdar://problem/35064781>
2131
2132         Reviewed by Simon Fraser.
2133
2134         SVGResources::resourceDestroyed() will return a bool indicating whether 
2135         it had a reference to the destroyed resource or not. If it returns true
2136         SVGResourcesCache::resourceDestroyed() will register the client Element
2137         as having pending resources.
2138
2139         * rendering/svg/SVGResources.cpp:
2140         (WebCore::paintingResourceFromSVGPaint):
2141         (WebCore::SVGResources::removeClientFromCache const):
2142         (WebCore::SVGResources::resourceDestroyed):
2143         (WebCore::SVGResources::buildSetOfResources):
2144         (WebCore::SVGResources::resetClipper):
2145         (WebCore::SVGResources::resetFilter):
2146         (WebCore::SVGResources::resetMarkerStart):
2147         (WebCore::SVGResources::resetMarkerMid):
2148         (WebCore::SVGResources::resetMarkerEnd):
2149         (WebCore::SVGResources::resetMasker):
2150         (WebCore::SVGResources::resetFill):
2151         (WebCore::SVGResources::resetStroke):
2152         (WebCore::SVGResources::resetLinkedResource):
2153         * rendering/svg/SVGResources.h:
2154         (WebCore::SVGResources::isEmpty const):
2155         (WebCore::SVGResources::ClipperFilterMaskerData::ClipperFilterMaskerData): Deleted.
2156         (WebCore::SVGResources::MarkerData::MarkerData): Deleted.
2157         (WebCore::SVGResources::FillStrokeData::FillStrokeData): Deleted.
2158         * rendering/svg/SVGResourcesCache.cpp:
2159         (WebCore::SVGResourcesCache::resourceDestroyed):
2160
2161 2017-10-20  Ryosuke Niwa  <rniwa@webkit.org>
2162
2163         Unify the node removal code in ContainerNode and expand the coverage of NoEventDispatchAssertion
2164         https://bugs.webkit.org/show_bug.cgi?id=178568
2165
2166         Reviewed by Antti Koivisto.
2167
2168         Consolidated the code to remove a child node in ContainerNode into removeAllChildrenWithScriptAssertion
2169         and removeNodeWithScriptAssertion to share code and make the semantics of when it becomes unsafe to run scripts.
2170
2171         Also renamed getChildNodes to collectChildNodes, and made it return NodeVector instead of taking an out argument.
2172
2173         No new tests since there should be no behavioral changes.
2174
2175         * dom/ContainerNode.cpp:
2176         (WebCore::ContainerNode::removeAllChildrenWithScriptAssertion): Added.
2177         (WebCore::ContainerNode::removeNodeWithScriptAssertion): Added.
2178         (WebCore::collectChildrenAndRemoveFromOldParent):
2179         (WebCore::ContainerNode::takeAllChildrenFrom): Deployed removeAllChildrenWithScriptAssertion.
2180         (WebCore::ContainerNode::notifyChildRemoved): Deleted. Merged into removeNodeWithScriptAssertion.
2181         (WebCore::willRemoveChild): Deleted. Ditto.
2182         (WebCore::willRemoveChildren): Deleted. Merged into removeAllChildrenWithScriptAssertion.
2183         (WebCore::ContainerNode::removeChild): Deployed removeNodeWithScriptAssertion.
2184         (WebCore::ContainerNode::parserRemoveChild): Ditto.
2185         (WebCore::ContainerNode::replaceAllChildren): Deployed removeAllChildrenWithScriptAssertion. Now removes the node
2186         outside executeNodeInsertionWithScriptAssertion but that's okay since executeNodeInsertionWithScriptAssertion
2187         doesn't execute any code with a side effect before invoking the callback.
2188         (WebCore::ContainerNode::removeChildren):
2189         (WebCore::dispatchChildRemovalEvents): Refactored to take Ref<Node>&.
2190         * dom/ContainerNode.h:
2191         (WebCore::collectChildNodes): Renamed from getChildNodes. Also removed the useless comment about NodeVector's
2192         initial size and instead prefer to webkit.org/b/80706 where the number 11 was picked.
2193         * editing/ApplyStyleCommand.cpp:
2194         (WebCore::ApplyStyleCommand::pushDownInlineStyleAroundNode):
2195         * editing/ReplaceNodeWithSpanCommand.cpp:
2196         (WebCore::swapInNodePreservingAttributesAndChildren):
2197         * svg/SVGUseElement.cpp:
2198         (WebCore::SVGUseElement::clearShadowTree): Added an assertion exception while tearing down the UA shadow tree.
2199
2200 2017-10-20  Youenn Fablet  <youenn@apple.com>
2201
2202         ResourceResponse should have a ServiceWorker source
2203         https://bugs.webkit.org/show_bug.cgi?id=178593
2204
2205         Reviewed by Alex Christensen.
2206
2207         Covered by updated tests.
2208
2209         Added ResourceResponse::Source::ServiceWorker.
2210         Added internals to get FetchResponse source.
2211
2212         * inspector/InspectorNetworkAgent.cpp:
2213         (WebCore::responseSource):
2214         * loader/ResourceLoader.cpp:
2215         (WebCore::logResourceResponseSource):
2216         * page/DiagnosticLoggingKeys.cpp:
2217         (WebCore::DiagnosticLoggingKeys::serviceWorkerKey):
2218         * page/DiagnosticLoggingKeys.h:
2219         * platform/network/ResourceResponseBase.h:
2220         * testing/Internals.cpp:
2221         (WebCore::responseSourceToString):
2222         (WebCore::Internals::fetchResponseSource):
2223         * testing/Internals.h:
2224         * testing/Internals.idl:
2225
2226 2017-10-20  Andy Estes  <aestes@apple.com>
2227
2228         Generated serializers do not properly handle optional interface attributes
2229         https://bugs.webkit.org/show_bug.cgi?id=178542
2230
2231         Reviewed by Sam Weinig.
2232
2233         * bindings/scripts/CodeGeneratorJS.pm:
2234         (GenerateSerializerDefinition):
2235         * bindings/scripts/test/JS/JSTestSerialization.cpp:
2236         (WebCore::JSTestSerialization::serialize):
2237
2238 2017-10-20  Antoine Quint  <graouts@apple.com>
2239
2240         [Web Animations] Provide basic timeline and animation interfaces
2241         https://bugs.webkit.org/show_bug.cgi?id=178526
2242
2243         Reviewed by Dean Jackson.
2244
2245         We're getting Web Animations work started by implementing a very minimal codebase which provides
2246         a DocumentTimeline class which has an instance created for each Document. The parent class,
2247         AnimationTimeline, allows for animations to be added and removed, and animations can be created
2248         using the Animation class, with an optional timeline as parameter.
2249
2250         Tests: webanimations/animation-creation-basic.html
2251                webanimations/document-timeline.html
2252
2253         * CMakeLists.txt:
2254         * Configurations/FeatureDefines.xcconfig:
2255         * DerivedSources.make:
2256         * PlatformWin.cmake:
2257         * WebCore.xcodeproj/project.pbxproj:
2258         * animation/AnimationTimeline.cpp: Added.
2259         (WebCore::AnimationTimeline::AnimationTimeline):
2260         (WebCore::AnimationTimeline::~AnimationTimeline):
2261         (WebCore::AnimationTimeline::addAnimation):
2262         (WebCore::AnimationTimeline::removeAnimation):
2263         * animation/AnimationTimeline.h: Added.
2264         (WebCore::AnimationTimeline::isDocumentTimeline const):
2265         (WebCore::AnimationTimeline::classType const):
2266         * animation/AnimationTimeline.idl: Added.
2267         * animation/DocumentTimeline.cpp: Added.
2268         (WebCore::DocumentTimeline::create):
2269         (WebCore::DocumentTimeline::DocumentTimeline):
2270         * animation/DocumentTimeline.h: Added.
2271         * animation/DocumentTimeline.idl: Added.
2272         * animation/WebAnimation.cpp: Added.
2273         (WebCore::WebAnimation::create):
2274         (WebCore::WebAnimation::WebAnimation):
2275         (WebCore::WebAnimation::~WebAnimation):
2276         * animation/WebAnimation.h: Added.
2277         * animation/WebAnimation.idl: Added.
2278         * bindings/js/JSAnimationTimelineCustom.cpp: Added.
2279         (WebCore::toJSNewlyCreated):
2280         (WebCore::toJS):
2281         * bindings/js/WebCoreBuiltinNames.h:
2282         * dom/Document.cpp:
2283         (WebCore::Document::timeline):
2284         * dom/Document.h:
2285         * dom/Document.idl:
2286         * page/RuntimeEnabledFeatures.h:
2287         (WebCore::RuntimeEnabledFeatures::webAnimationsEnabled const):
2288
2289 2017-10-20  Commit Queue  <commit-queue@webkit.org>
2290
2291         Unreviewed, rolling out r223744, r223750, and r223751.
2292         https://bugs.webkit.org/show_bug.cgi?id=178594
2293
2294         These caused consistent failures in test that existed and were
2295         added in the patches. (Requested by mlewis13 on #webkit).
2296
2297         Reverted changesets:
2298
2299         "[JSC] ScriptFetcher should be notified directly from module
2300         pipeline"
2301         https://bugs.webkit.org/show_bug.cgi?id=178340
2302         https://trac.webkit.org/changeset/223744
2303
2304         "Unreviewed, fix changed line number in test expect files"
2305         https://bugs.webkit.org/show_bug.cgi?id=178340
2306         https://trac.webkit.org/changeset/223750
2307
2308         "Unreviewed, follow up to reflect comments"
2309         https://bugs.webkit.org/show_bug.cgi?id=178340
2310         https://trac.webkit.org/changeset/223751
2311
2312 2017-10-20  Zalan Bujtas  <zalan@apple.com>
2313
2314         [FrameView::layout cleanup] Move can-enter-layout logic to a separate function
2315         https://bugs.webkit.org/show_bug.cgi?id=178546
2316         <rdar://problem/35083894>
2317
2318         Reviewed by Antti Koivisto.
2319
2320         No change in functionality.
2321
2322         * page/FrameView.cpp:
2323         (WebCore::FrameView::canPerformLayout const):
2324         (WebCore::FrameView::layout): We already assert on certain reentrancy conditions, loggig the reason
2325         does not seem to have high value.
2326         * page/FrameView.h:
2327
2328 2017-10-20  Dean Jackson  <dino@apple.com>
2329
2330         Add createImageBitmap to Window and Worker
2331         https://bugs.webkit.org/show_bug.cgi?id=178573
2332         <rdar://problem/35092692>
2333
2334         Reviewed by Sam Weinig.
2335
2336         Implement the createImageBitmap functions that are exposed on the Window
2337         and Worker objects.
2338
2339         Covered by the Web Platform Tests.
2340
2341         * html/ImageBitmap.cpp: Make sure to call suspendIfNeeded since this is
2342         an ActiveDOMObject.
2343         * html/ImageBitmap.h: Change the order of the classes in the Variant
2344         to match the order of definitions in the IDL.
2345         * page/DOMWindow.cpp:
2346         (WebCore::DOMWindow::createImageBitmap): Call ImageBitmap::createPromise.
2347         * page/DOMWindow.h:
2348         * page/WindowOrWorkerGlobalScope.idl: Add the createImageBitmap methods.
2349         * workers/WorkerGlobalScope.cpp:
2350         (WebCore::WorkerGlobalScope::createImageBitmap): Call ImageBitmap::createPromise.
2351         * workers/WorkerGlobalScope.h:
2352
2353 2017-10-20  Joanmarie Diggs  <jdiggs@igalia.com>
2354
2355         AX: [ATK] Events missing and state incorrect for aria-activedescendant
2356         https://bugs.webkit.org/show_bug.cgi?id=178523
2357
2358         Reviewed by Chris Fleizach.
2359
2360         When the aria-activedescendant of an element changes, emit object:state-changed:focused.
2361         When a focused element has a valid active descendant, do not expose the focused state on
2362         the element, but rather on the active descendant. Also expose the focusable state on the
2363         active descendant.
2364
2365         Tests: accessibility/gtk/aria-activedescendant-changed-notification.html
2366                accessibility/gtk/aria-activedescendant.html
2367
2368         * accessibility/AccessibilityObject.cpp:
2369         (WebCore::AccessibilityObject::isActiveDescendantOfFocusedContainer const):
2370         (WebCore::AccessibilityObject::ariaActiveDescendantReferencingElements const):
2371         * accessibility/AccessibilityObject.h:
2372         * accessibility/AccessibilityRenderObject.cpp:
2373         (WebCore::AccessibilityRenderObject::shouldNotifyActiveDescendant const):
2374         * accessibility/atk/AXObjectCacheAtk.cpp:
2375         (WebCore::AXObjectCache::postPlatformNotification):
2376         * accessibility/atk/WebKitAccessibleWrapperAtk.cpp:
2377         (setAtkStateSetFromCoreObject):
2378
2379 2017-10-20  Ms2ger  <Ms2ger@igalia.com>
2380
2381         Add the MAX_CLIENT_WAIT_TIMEOUT_WEBGL constant to WebGL2RenderingContext.
2382         https://bugs.webkit.org/show_bug.cgi?id=178572
2383
2384         Reviewed by Žan Doberšek.
2385
2386         Test: fast/canvas/webgl/webgl2/constants.html
2387
2388         * html/canvas/WebGL2RenderingContext.idl:
2389
2390 2017-10-20  Miguel Gomez  <magomez@igalia.com>
2391
2392         [GTK][WPE] Fix review comments on WEBPImageDecoder
2393         https://bugs.webkit.org/show_bug.cgi?id=178080
2394
2395         Reviewed by Said Abou-Hallawa.
2396
2397         Properly free the demuxer in case of error, improve the code to detect the first
2398         required frame to decode, fix the usage of the DecodingStatus and some styling
2399         changes.
2400
2401         Covered by existent tests.
2402
2403         * platform/image-decoders/webp/WEBPImageDecoder.cpp:
2404         (WebCore::webpFrameAtIndex):
2405         (WebCore::WEBPImageDecoder::findFirstRequiredFrameToDecode):
2406         (WebCore::WEBPImageDecoder::decode):
2407         (WebCore::WEBPImageDecoder::decodeFrame):
2408         (WebCore::WEBPImageDecoder::initFrameBuffer):
2409         (WebCore::WEBPImageDecoder::clearFrameBufferCache):
2410
2411 2017-10-20  Basuke Suzuki  <Basuke.Suzuki@sony.com>
2412
2413         [Curl] Clean up old style code in old curl files.
2414         https://bugs.webkit.org/show_bug.cgi?id=178569
2415
2416         Reviewed by Ryosuke Niwa.
2417
2418         * platform/network/curl/AuthenticationChallenge.h:
2419         * platform/network/curl/CertificateInfo.h:
2420         * platform/network/curl/CookieJarCurl.h:
2421         * platform/network/curl/CurlCacheEntry.h:
2422         * platform/network/curl/CurlCacheManager.cpp:
2423         (WebCore::CurlCacheManager::singleton):
2424         (WebCore::CurlCacheManager::getInstance): Deleted.
2425         * platform/network/curl/CurlCacheManager.h:
2426         * platform/network/curl/CurlContext.cpp:
2427         (WebCore::CurlContext::singleton):
2428         * platform/network/curl/CurlContext.h:
2429         (WebCore::CurlContext::singleton): Deleted.
2430         * platform/network/curl/CurlJobManager.cpp:
2431         (WebCore::CurlJobManager::singleton):
2432         * platform/network/curl/CurlJobManager.h:
2433         (WebCore::CurlJobManager::singleton): Deleted.
2434         * platform/network/curl/CurlRequest.cpp:
2435         (WebCore::CurlRequest::setupTransfer):
2436         * platform/network/curl/CurlRequest.h:
2437         * platform/network/curl/CurlRequestDelegate.h:
2438         * platform/network/curl/CurlResponse.h:
2439         (WebCore::CurlResponse::isolatedCopy const):
2440         * platform/network/curl/CurlSSLHandle.h:
2441         * platform/network/curl/CurlSSLVerifier.h:
2442         * platform/network/curl/DownloadBundle.h:
2443         * platform/network/curl/MultipartHandle.h:
2444         * platform/network/curl/ResourceError.h:
2445         * platform/network/curl/ResourceHandleCurlDelegate.cpp:
2446         (WebCore::ResourceHandleCurlDelegate::createCurlRequest):
2447         (WebCore::ResourceHandleCurlDelegate::curlDidReceiveResponse):
2448         (WebCore::ResourceHandleCurlDelegate::curlDidReceiveBuffer):
2449         (WebCore::ResourceHandleCurlDelegate::curlDidComplete):
2450         (WebCore::ResourceHandleCurlDelegate::curlDidFailWithError):
2451         * platform/network/curl/ResourceRequest.h:
2452         (WebCore::ResourceRequest::ResourceRequest):
2453         (WebCore::ResourceRequest::updateFromDelegatePreservingOldProperties):
2454         (WebCore::ResourceRequest::cfURLRequest const):
2455         (WebCore::ResourceRequest::httpPipeliningEnabled):
2456         (WebCore::ResourceRequest::setHTTPPipeliningEnabled):
2457         (WebCore::ResourceRequest::doUpdatePlatformRequest):
2458         (WebCore::ResourceRequest::doUpdateResourceRequest):
2459         (WebCore::ResourceRequest::doUpdatePlatformHTTPBody):
2460         (WebCore::ResourceRequest::doUpdateResourceHTTPBody):
2461         (WebCore::ResourceRequest::doPlatformSetAsIsolatedCopy):
2462         * platform/network/curl/ResourceResponseCurl.cpp:
2463         (WebCore::ResourceResponse::isAppendableHeader):
2464         (WebCore::ResourceResponse::ResourceResponse):
2465
2466 2017-10-20  Frederic Wang  <fwang@igalia.com>
2467
2468         RenderLayerCompositor: Move implementation of simple methods into the header file.
2469         https://bugs.webkit.org/show_bug.cgi?id=178514
2470
2471         Reviewed by Darin Adler.
2472
2473         No new tests, behavior unchanged.
2474
2475 2017-10-19  Antti Koivisto  <antti@apple.com>
2476
2477         Support ::before/::after pseudo elements on elements with display:contents
2478         https://bugs.webkit.org/show_bug.cgi?id=178513
2479
2480         Reviewed by Ryosuke Niwa.
2481
2482         Add support for
2483
2484             div { display:contents }
2485             div::after { content:'foo' }
2486
2487         That is support non-box generating elements with generated content.
2488
2489         * style/RenderTreePosition.cpp:
2490         (WebCore::RenderTreePosition::nextSiblingRenderer const):
2491
2492             Implement full pseudo-inclusive traversal starting from any element (including pseudo)
2493             to locate the next rendering sibling. In case of display:content this may need to look
2494             into descendants.
2495
2496         * style/RenderTreeUpdater.cpp:
2497         (WebCore::textRendererIsNeeded):
2498
2499             RenderTreePosition::nextSiblingRenderer can no longer be called with a node that already has a renderer.
2500             Maintain the existing behavior.
2501
2502         * style/RenderTreeUpdaterGeneratedContent.cpp:
2503         (WebCore::RenderTreeUpdater::GeneratedContent::updatePseudoElement):
2504         (WebCore::RenderTreeUpdater::GeneratedContent::needsPseudoElement):
2505
2506             Don't require for host to have a renderer.
2507
2508         * style/RenderTreeUpdaterGeneratedContent.h:
2509         * style/StyleTreeResolver.cpp:
2510         (WebCore::Style::TreeResolver::resolvePseudoStyle):
2511
2512 2017-10-20  Keith Miller  <keith_miller@apple.com>
2513
2514         Move common bindings files to unified sources
2515         https://bugs.webkit.org/show_bug.cgi?id=178561
2516
2517         Rubber-stamped by Ryosuke Niwa.
2518
2519         This patch moves most of the common bindings files to unified sources.
2520
2521         Additionally, it adds a change to make_names to unique a struct
2522         name that caused name conflicts that I missed when I made the
2523         source changes before.
2524
2525         Lastly, add missing reference to WebCoreJSBuiltins.cpp in CMake build.
2526
2527         No new behavior no tests.
2528
2529         * CMakeLists.txt:
2530         * Sources.txt:
2531         * WebCore.xcodeproj/project.pbxproj:
2532         * dom/make_names.pl:
2533         (printFactoryCppFile):
2534
2535 2017-10-20  Saam Barati  <sbarati@apple.com>
2536
2537         Optimize accesses to how we get the direct prototype
2538         https://bugs.webkit.org/show_bug.cgi?id=178548
2539
2540         Reviewed by Yusuke Suzuki.
2541
2542         No new tests: no functionality change.
2543
2544         * bindings/js/JSDOMAbstractOperations.h:
2545         (WebCore::isVisibleNamedProperty):
2546         (WebCore::accessVisibleNamedProperty):
2547         * bindings/js/JSDOMWindowBase.cpp:
2548         (WebCore::toJSDOMWindow):
2549         * bindings/js/JSDOMWindowProperties.cpp:
2550         (WebCore::JSDOMWindowProperties::getOwnPropertySlot):
2551         * bindings/js/JSPluginElementFunctions.cpp:
2552         (WebCore::pluginElementCustomGetOwnPropertySlot):
2553         * bindings/js/WorkerScriptController.cpp:
2554         (WebCore::WorkerScriptController::initScript):
2555         * bindings/scripts/CodeGeneratorJS.pm:
2556         (GeneratePut):
2557         (GeneratePutByIndex):
2558         (GenerateConstructorHelperMethods):
2559         * bindings/scripts/test/JS/JSTestGlobalObject.cpp:
2560         (WebCore::JSTestGlobalObjectConstructor::initializeProperties):
2561         * bindings/scripts/test/JS/JSTestNamedAndIndexedSetterNoIdentifier.cpp:
2562         (WebCore::JSTestNamedAndIndexedSetterNoIdentifier::put):
2563         (WebCore::JSTestNamedAndIndexedSetterNoIdentifier::putByIndex):
2564         * bindings/scripts/test/JS/JSTestNamedAndIndexedSetterThrowingException.cpp:
2565         (WebCore::JSTestNamedAndIndexedSetterThrowingException::put):
2566         (WebCore::JSTestNamedAndIndexedSetterThrowingException::putByIndex):
2567         * bindings/scripts/test/JS/JSTestNamedAndIndexedSetterWithIdentifier.cpp:
2568         (WebCore::JSTestNamedAndIndexedSetterWithIdentifier::put):
2569         (WebCore::JSTestNamedAndIndexedSetterWithIdentifier::putByIndex):
2570         * bindings/scripts/test/JS/JSTestNamedSetterNoIdentifier.cpp:
2571         (WebCore::JSTestNamedSetterNoIdentifier::put):
2572         (WebCore::JSTestNamedSetterNoIdentifier::putByIndex):
2573         * bindings/scripts/test/JS/JSTestNamedSetterThrowingException.cpp:
2574         (WebCore::JSTestNamedSetterThrowingException::put):
2575         (WebCore::JSTestNamedSetterThrowingException::putByIndex):
2576         * bindings/scripts/test/JS/JSTestNamedSetterWithIdentifier.cpp:
2577         (WebCore::JSTestNamedSetterWithIdentifier::put):
2578         (WebCore::JSTestNamedSetterWithIdentifier::putByIndex):
2579         * bindings/scripts/test/JS/JSTestNamedSetterWithIndexedGetter.cpp:
2580         (WebCore::JSTestNamedSetterWithIndexedGetter::put):
2581         (WebCore::JSTestNamedSetterWithIndexedGetter::putByIndex):
2582         * bindings/scripts/test/JS/JSTestNamedSetterWithIndexedGetterAndSetter.cpp:
2583         (WebCore::JSTestNamedSetterWithIndexedGetterAndSetter::put):
2584         (WebCore::JSTestNamedSetterWithIndexedGetterAndSetter::putByIndex):
2585         * bindings/scripts/test/JS/JSTestNamedSetterWithUnforgableProperties.cpp:
2586         (WebCore::JSTestNamedSetterWithUnforgableProperties::put):
2587         (WebCore::JSTestNamedSetterWithUnforgableProperties::putByIndex):
2588
2589 2017-10-20  Yusuke Suzuki  <utatane.tea@gmail.com>
2590
2591         [JSC] ScriptFetcher should be notified directly from module pipeline
2592         https://bugs.webkit.org/show_bug.cgi?id=178340
2593
2594         Reviewed by Sam Weinig.
2595
2596         No behavior change.
2597
2598         * bindings/js/JSMainThreadExecState.h:
2599         (WebCore::JSMainThreadExecState::loadModule):
2600         * bindings/js/ScriptController.cpp:
2601         (WebCore::ScriptController::loadModuleScriptInWorld):
2602         (WebCore::jsValueToModuleKey): Deleted.
2603         (WebCore::ScriptController::setupModuleScriptHandlers): Deleted.
2604         * bindings/js/ScriptController.h:
2605         * dom/LoadableModuleScript.cpp:
2606         (WebCore::LoadableModuleScript::notifyLoadFailed):
2607         * dom/LoadableModuleScript.h:
2608
2609 2017-10-19  Ms2ger  <Ms2ger@igalia.com>
2610
2611         Remove proprietary constants from WebGL2RenderingContext.
2612         https://bugs.webkit.org/show_bug.cgi?id=178511
2613
2614         Reviewed by Ryosuke Niwa.
2615
2616         As far as I can tell, these constants are not in the specification,
2617         and no other browser supports them.
2618
2619         No new tests: just code removal.
2620
2621         * html/canvas/WebGL2RenderingContext.idl:
2622
2623 2017-10-19  Zalan Bujtas  <zalan@apple.com>
2624
2625         [FrameView::layout cleanup] Move style update related logic to a separate function
2626         https://bugs.webkit.org/show_bug.cgi?id=178558
2627         <rdar://problem/35088218>
2628
2629         Reviewed by Simon Fraser.
2630
2631         No change in functionality.
2632
2633         * page/FrameView.cpp:
2634         (WebCore::FrameView::ensureStyleIsUpToDateForLayout):
2635         (WebCore::FrameView::layout):
2636         * page/FrameView.h:
2637
2638 2017-10-19  JF Bastien  <jfbastien@apple.com>
2639
2640         WebAssembly: no VM / JS version of everything but Instance
2641         https://bugs.webkit.org/show_bug.cgi?id=177473
2642
2643         Reviewed by Filip Pizlo, Saam Barati.
2644
2645         * ForwardingHeaders/wasm/WasmModule.h: Added. This used to be
2646         included in JSWebAssemblyModule.h.
2647         * bindings/js/SerializedScriptValue.cpp: Update postMessage code
2648         according to C++ API changes.
2649
2650 2017-10-19  Chris Dumez  <cdumez@apple.com>
2651
2652         SerializedScriptValue passed to postMessage() cannot be null
2653         https://bugs.webkit.org/show_bug.cgi?id=178550
2654
2655         Reviewed by Youenn Fablet.
2656
2657         SerializedScriptValue passed to postMessage() cannot be null. Therefore, we
2658         should use Ref<> type, not RefPtr<>.
2659
2660         * dom/MessagePortChannel.h:
2661         * dom/default/PlatformMessagePortChannel.cpp:
2662         (WebCore::MessagePortChannel::postMessageToRemote):
2663         * workers/WorkerGlobalScopeProxy.h:
2664         * workers/WorkerMessagingProxy.cpp:
2665         (WebCore::WorkerMessagingProxy::postMessageToWorkerObject):
2666         (WebCore::WorkerMessagingProxy::postMessageToWorkerGlobalScope):
2667         * workers/WorkerMessagingProxy.h:
2668         * workers/WorkerObjectProxy.h:
2669         * workers/service/context/ServiceWorkerThread.cpp:
2670
2671 2017-10-19  Daniel Bates  <dabates@apple.com>
2672
2673         Use "= default" to denote default constructor or destructor
2674         https://bugs.webkit.org/show_bug.cgi?id=178528
2675
2676         Rubber-stamped by Andy Estes.
2677
2678         * Modules/airplay/WebKitPlaybackTargetAvailabilityEvent.h:
2679         * Modules/applepay/ApplePayError.cpp:
2680         * Modules/applepay/ApplePayPaymentAuthorizedEvent.cpp:
2681         * Modules/applepay/ApplePayPaymentMethodSelectedEvent.cpp:
2682         * Modules/applepay/ApplePaySession.cpp:
2683         * Modules/applepay/ApplePaySessionPaymentRequest.cpp:
2684         * Modules/applepay/ApplePayShippingContactSelectedEvent.cpp:
2685         * Modules/applepay/ApplePayShippingMethodSelectedEvent.cpp:
2686         * Modules/applepay/ApplePayValidateMerchantEvent.cpp:
2687         * Modules/applepay/Payment.h:
2688         * Modules/applepay/PaymentCoordinatorClient.h:
2689         * Modules/credentials/BasicCredential.cpp:
2690         * Modules/credentials/FederatedCredential.cpp:
2691         * Modules/credentials/NavigatorCredentials.cpp:
2692         * Modules/credentials/PasswordCredential.cpp:
2693         * Modules/encryptedmedia/CDMClient.h:
2694         * Modules/encryptedmedia/legacy/LegacyCDM.cpp:
2695         * Modules/encryptedmedia/legacy/LegacyCDM.h:
2696         * Modules/encryptedmedia/legacy/LegacyCDMPrivate.h:
2697         * Modules/encryptedmedia/legacy/LegacyCDMPrivateClearKey.h:
2698         * Modules/encryptedmedia/legacy/LegacyCDMPrivateMediaPlayer.h:
2699         * Modules/encryptedmedia/legacy/LegacyCDMSessionClearKey.cpp:
2700         * Modules/encryptedmedia/legacy/WebKitMediaKeyMessageEvent.cpp:
2701         * Modules/encryptedmedia/legacy/WebKitMediaKeyNeededEvent.cpp:
2702         * Modules/entriesapi/DOMFileSystem.cpp:
2703         * Modules/entriesapi/FileSystemDirectoryReader.cpp:
2704         * Modules/entriesapi/FileSystemEntry.cpp:
2705         * Modules/fetch/FetchLoaderClient.h:
2706         * Modules/gamepad/Gamepad.cpp:
2707         * Modules/gamepad/GamepadEvent.h:
2708         * Modules/gamepad/deprecated/Gamepad.cpp:
2709         [ truncated ]
2710
2711 2017-10-19  Sam Weinig  <sam@webkit.org>
2712
2713         [Bindings] Standardize on DOMPromise as the way to store passed in promises
2714         https://bugs.webkit.org/show_bug.cgi?id=178533
2715
2716         Reviewed by Youenn Fablet.
2717
2718         This standardizes on RefPtr<DOMPromise> as the canonical way to store a promise
2719         that has been passed in from JS. This does not change promises that start off in
2720         WebCore and are passed to JS; they remain using DOMPromiseDeferred and DOMPromiseProxy.
2721
2722         * Modules/paymentrequest/PaymentRequestUpdateEvent.cpp:
2723         * Modules/paymentrequest/PaymentRequestUpdateEvent.h:
2724         * dom/PromiseRejectionEvent.cpp:
2725         * dom/PromiseRejectionEvent.h:
2726         * dom/RejectedPromiseTracker.cpp:
2727
2728             Use a RefPtr<DOMPromise> rather than a JSPromise* to hold onto the promise.
2729
2730         * bindings/IDLTypes.h:
2731
2732             Use IDLWrapper to get better defaults, since DOMPromise is refcounted.
2733
2734         * bindings/js/JSDOMConvertPromise.h:
2735         (WebCore::Converter<IDLPromise<T>>::convert):
2736
2737             Switch default conversion to return a RefPtr<DOMPromise> rather than a JSPromise*
2738
2739         (WebCore::JSConverter<IDLPromise<T>>::convert):
2740
2741             Add support for converting from a DOMPromise to a JSValue.
2742
2743         * bindings/js/JSDOMPromise.cpp:
2744         * bindings/js/JSDOMPromise.h:
2745         (WebCore::DOMPromise::create): Deleted.
2746
2747             Remove now unused constructor.    
2748
2749         * workers/service/ExtendableEvent.cpp:
2750         (WebCore::ExtendableEvent::waitUntil):
2751         * workers/service/ExtendableEvent.h:
2752         * workers/service/ExtendableEvent.idl:
2753         * workers/service/FetchEvent.cpp:
2754         (WebCore::FetchEvent::respondWith):
2755         (WebCore::FetchEvent::promiseIsSettled):
2756         * workers/service/FetchEvent.h:
2757         * workers/service/FetchEvent.idl:
2758
2759             Address FIXMEs and remove need for passing an ExecState to ExtendableEvent
2760             and FetchEvent by using the new default conversion to DOMPromise.
2761
2762 2017-10-19  Sam Weinig  <sam@webkit.org>
2763
2764         [Settings] Move global settings into their own file
2765         https://bugs.webkit.org/show_bug.cgi?id=178512
2766
2767         Reviewed by Darin Adler.
2768
2769         Moves all global settigns out of SettingsBase and into the new DeprecatedGlobalSettings.
2770         It's called DeprecatedGlobalSettings to indicate that this is an anti-pattern we would
2771         like to discourage, as WebCore can operate in a process with multiple clients, each of
2772         which should be able to set their own preferences.
2773
2774         * WebCore.xcodeproj/project.pbxproj:
2775         * CMakeLists.txt:
2776
2777             Add new files.
2778         
2779         * page/DeprecatedGlobalSettings.cpp: Copied from Source/WebCore/page/SettingsBase.cpp.
2780         * page/DeprecatedGlobalSettings.h: Copied from Source/WebCore/page/SettingsBase.h.
2781         * page/SettingsBase.cpp:
2782         * page/SettingsBase.h:
2783         
2784             Move all global settings out of SettingsBase and into the new DeprecatedGlobalSettings.
2785         
2786         * Modules/mediastream/UserMediaRequest.cpp:
2787         * bindings/js/CommonVM.cpp:
2788         * css/CSSStyleDeclaration.cpp:
2789         * dom/DataTransfer.cpp:
2790         * dom/DataTransferItemList.cpp:
2791         * editing/Editor.cpp:
2792         * loader/ResourceLoadObserver.cpp:
2793         * page/FrameView.cpp:
2794         * page/PerformanceMonitor.cpp:
2795         * platform/ScrollbarTheme.cpp:
2796         (WebCore::ScrollbarTheme::theme):
2797         * platform/audio/cocoa/MediaSessionManagerCocoa.cpp:
2798         * platform/graphics/MediaPlayer.cpp:
2799         * platform/graphics/avfoundation/MediaPlayerPrivateAVFoundation.cpp:
2800         * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
2801         * platform/mac/NSScrollerImpDetails.mm:
2802         * platform/mock/ScrollbarThemeMock.cpp:
2803         * platform/network/cf/SocketStreamHandleImplCFNet.cpp:
2804         * platform/network/ios/NetworkStateNotifierIOS.mm:
2805         * platform/network/soup/SocketStreamHandleImplSoup.cpp:
2806         * platform/win/MainThreadSharedTimerWin.cpp:
2807         * rendering/RenderLayer.cpp:
2808         * rendering/RenderListBox.cpp:
2809         * testing/InternalSettings.cpp:
2810         * testing/Internals.cpp:
2811
2812             Update users of global settings to reference the new class name.
2813
2814 2017-10-19  Youenn Fablet  <youenn@apple.com>
2815
2816         Add preliminary support for ServiceWorker Handle Fetch
2817         https://bugs.webkit.org/show_bug.cgi?id=178475
2818         <rdar://problem/35066424>
2819
2820         Reviewed by Chris Dumez.
2821
2822         Test: http/tests/workers/service/basic-fetch.https.html
2823
2824         Adding parameters to allow WebKit to do loading through Service Worker or through regular networking.
2825         A script context is now storing its selected service worker identifier. This should be fully implemented later on.
2826         This selected service worker identifier is passed to loading code as a ResourceLoaderOptions field.
2827         Service workers mode is also added as a ResourceLoaderOptions field so that the service worker can be bypassed.
2828
2829         * WebCore.xcodeproj/project.pbxproj:
2830         * dom/ScriptExecutionContext.h:
2831         (WebCore::ScriptExecutionContext::selectedServiceWorkerIdentifier const):
2832         (WebCore::ScriptExecutionContext::setSelectedServiceWorkerIdentifier):
2833         * loader/DocumentThreadableLoader.cpp:
2834         (WebCore::DocumentThreadableLoader::DocumentThreadableLoader):
2835         * loader/FetchOptions.h:
2836         (WebCore::isPotentialNavigationOrSubresourceRequest):
2837         (WebCore::isNonSubresourceRequest):
2838         * loader/ResourceLoaderOptions.h:
2839         * loader/WorkerThreadableLoader.cpp:
2840         (WebCore::WorkerThreadableLoader::WorkerThreadableLoader):
2841         (WebCore::WorkerThreadableLoader::MainThreadBridge::MainThreadBridge):
2842         * loader/WorkerThreadableLoader.h:
2843         * platform/network/ResourceRequestBase.h:
2844         * platform/network/ResourceResponseBase.h:
2845         * workers/WorkerThread.h:
2846         * workers/service/ServiceWorkerContainer.cpp:
2847         (WebCore::ServiceWorkerContainer::jobResolvedWithRegistration):
2848         * workers/service/context/SWContextManager.cpp: Removed.
2849         * workers/service/context/ServiceWorkerThread.h:
2850
2851 2017-10-19  Zalan Bujtas  <zalan@apple.com>
2852
2853         [FrameView::layout cleanup] Move post layout task scheduling logic to a separate function
2854         https://bugs.webkit.org/show_bug.cgi?id=178538
2855         <rdar://problem/35080743>
2856
2857         Reviewed by Simon Fraser.
2858
2859         Move and reorganize post layout task scheduling code.
2860         
2861         Covered by existing tests.
2862
2863         * page/FrameView.cpp:
2864         (WebCore::FrameView::layout):
2865         (WebCore::FrameView::runOrSchedulePostLayoutTasks):
2866         * page/FrameView.h:
2867
2868 2017-10-19  Zalan Bujtas  <zalan@apple.com>
2869
2870         [FrameView::layout cleanup] Move scrollbars setup logic to a separate function
2871         https://bugs.webkit.org/show_bug.cgi?id=178394
2872         <rdar://problem/35031066>
2873
2874         Reviewed by Antti Koivisto.
2875
2876         Decouple scrollbars setup and the unrelated first-layout logic.
2877         FIXME: find out why m_firstLayout depends on the subtree flag (I'd assume we issue full layout the very first time). 
2878
2879         Covered by existing test cases.
2880
2881         * page/FrameView.cpp:
2882         (WebCore::FrameView::adjustScrollbarsForLayout):
2883         (WebCore::FrameView::layout):
2884         * page/FrameView.h:
2885
2886 2017-10-19  Tim Horton  <timothy_horton@apple.com>
2887
2888         Expand r209943 to suppress paste during provisional navigation as well
2889         https://bugs.webkit.org/show_bug.cgi?id=178429
2890         <rdar://problem/33952830>
2891
2892         Reviewed by Dean Jackson.
2893
2894         No new tests; adjusted an existing test to cover this case.
2895
2896         * editing/Editor.cpp:
2897         (WebCore::Editor::canPaste const):
2898         Disable pasting during provisional navigation, like r209943 did for
2899         various other forms of text input.
2900
2901         (WebCore::Editor::shouldInsertText const):
2902         * dom/EventDispatcher.cpp:
2903         (WebCore::shouldSuppressEventDispatchInDOM):
2904         * loader/FrameLoader.cpp:
2905         (WebCore::FrameLoader::shouldSuppressTextInputFromEditing const):
2906         (WebCore::FrameLoader::shouldSuppressKeyboardInput const): Deleted.
2907         * loader/FrameLoader.h:
2908         * page/Settings.in:
2909         Rename the setting to be about editing-related text input, not "keyboard" input.
2910
2911         * editing/EditorCommand.cpp:
2912         (WebCore::allowExecutionWhenDisabled):
2913         (WebCore::doNotAllowExecutionWhenDisabled):
2914         (WebCore::allowExecutionWhenDisabledCopyCut):
2915         (WebCore::allowExecutionWhenDisabledPaste):
2916         (WebCore::createCommandMap):
2917         (WebCore::Editor::Command::allowExecutionWhenDisabled const):
2918         Completely disable execution of paste events when in no-text-input-from-editing mode.
2919         Otherwise, even though canPaste was false and we wouldn't do a default paste action,
2920         we would still dispatch the paste event to the DOM.
2921
2922 2017-10-19  Dean Jackson  <dino@apple.com>
2923
2924         Avoid duplicate multisample resolve before WebGL compositing
2925         https://bugs.webkit.org/show_bug.cgi?id=178537
2926         <rdar://problem/35080724>
2927
2928         Fix iOS build.
2929
2930         * platform/graphics/opengl/GraphicsContext3DOpenGLCommon.cpp:
2931         (WebCore::GraphicsContext3D::paintRenderingResultsToCanvas):
2932
2933 2017-10-19  Dean Jackson  <dino@apple.com>
2934
2935         Avoid duplicate multisample resolve before WebGL compositing
2936         https://bugs.webkit.org/show_bug.cgi?id=178537
2937         <rdar://problem/35080724>
2938
2939         Reviewed by Jer Noble.
2940
2941         Both endPaint and prepareTexture were doing the MSAA resolve
2942         into the renderbuffer, and being called on macOS before compositing.
2943         Without that step, endPaint became unnecessary on iOS so I renamed
2944         it presentRenderbuffer.
2945
2946         Covered by existing tests.
2947
2948         * platform/graphics/GraphicsContext3D.h:
2949         * platform/graphics/cocoa/GraphicsContext3DCocoa.mm:
2950         (WebCore::GraphicsContext3D::presentRenderbuffer):
2951         (WebCore::GraphicsContext3D::endPaint): Deleted.
2952         * platform/graphics/cocoa/WebGLLayer.mm:
2953         (-[WebGLLayer display]):
2954
2955 2017-10-19  Andy Estes  <aestes@apple.com>
2956
2957         [Payment Request] Only process shipping options if shipping is requested, and throw an exception on duplicate shipping option IDs
2958         https://bugs.webkit.org/show_bug.cgi?id=178535
2959
2960         Reviewed by Alex Christensen.
2961
2962         Progresses four tests in web-platform-tests/payment-request/payment-request-constructor.https.html.
2963
2964         * Modules/paymentrequest/PaymentRequest.cpp:
2965         (WebCore::PaymentRequest::create):
2966
2967 2017-10-19  Daniel Bates  <dabates@apple.com>
2968
2969         Share logic in InlineTextBox to compute selection rect
2970         https://bugs.webkit.org/show_bug.cgi?id=178232
2971         <rdar://problem/34963452>
2972
2973         Reviewed by Zalan Bujtas.
2974
2975         Currently each paint routine in InlineTextBox duplicates similar code to compute the selection
2976         rect it will paint. This change consolidates all the duplication into localSelectionRectWithClampedPositions()
2977         and writes all of the paint operations, except for paintCompositionUnderline(), in terms of it.
2978         We will write paintCompositionUnderline() in terms of localSelectionRectWithClampedPositions()
2979         in a subsequent patch.
2980
2981         We also write localSelectionRect() in terms of localSelectionRectWithClampedPositions(). Ideally
2982         we would have one way to compute the selection rect. However, localSelectionRect() and paintDocumentMarker()
2983         currently expect the enclosing integral rectangle of the selection rectangle. The function
2984         paintDocumentMarker() needs the enclosing integral rectangle to avoid truncating the dot pattern
2985         drawn under marked words (e.g. a spelling error) on Cocoa platforms. With regards to localSelectionRect()
2986         we should look to have it return the actual selection rectangle. See <https://bugs.webkit.org/show_bug.cgi?id=138913>
2987         for more details.
2988
2989         * rendering/InlineTextBox.cpp:
2990         (WebCore::InlineTextBox::localSelectionRect const): Move logic in common with paintSelection() into
2991         localSelectionRectWithClampedPositions() and modified code to use it.
2992         (WebCore::InlineTextBox::localSelectionRectWithClampedPositions const): Added.
2993         (WebCore::InlineTextBox::paint): Store the local paint offset as a LayoutPoint as it is the canonical
2994         data type for representing an offset when painting. Pass the local paint offset instead of the analagous boxOrigin value.
2995         (WebCore::InlineTextBox::paintSelection): Write in terms of localSelectionRectWithClampedPositions().
2996         (WebCore::InlineTextBox::paintTextSubrangeBackground): Ditto.
2997         (WebCore::InlineTextBox::paintCompositionBackground): Ditto.
2998         (WebCore::InlineTextBox::paintTextMatchMarker): Ditto.
2999         (WebCore::InlineTextBox::paintDocumentMarker): Ditto.
3000         (WebCore::InlineTextBox::paintDocumentMarkers): Pass paint offset instead of the analogous boxOrigin value.
3001         * rendering/InlineTextBox.h:
3002
3003 2017-10-19  Daniel Bates  <dabates@apple.com>
3004
3005         Referrer policy should be inherited from creator
3006         https://bugs.webkit.org/show_bug.cgi?id=178403
3007         <rdar://problem/31546136>
3008
3009         Reviewed by Andy Estes.
3010
3011         As per section Browsing contexts of the the HTML standard, <https://html.spec.whatwg.org/multipage/browsers.html>
3012         (17 October 2017), the referrer policy of a document should initially be inherited from its
3013         creator.
3014
3015         Tests: http/tests/security/referrer-policy-nested-subframe.html
3016                http/tests/security/referrer-policy-nested-window-open.html
3017                http/tests/security/referrer-policy-subframe-window-open.html
3018                http/tests/security/referrer-policy-window-open-subframe.html
3019
3020         * dom/Document.cpp:
3021         (WebCore::Document::initSecurityContext): Ask the loader for the effective referrer policy.
3022         * loader/FrameLoader.cpp:
3023         (WebCore::FrameLoader::effectiveReferrerPolicy const): Added. Returns the referrer policy
3024         of the creator document. The creator document is document of the parent frame or the document
3025         of the opener for a subframe or child window, respectively. If we do not have a creator frame
3026         then we return the default referrer policy, non-referrer-when-downgrade, by <https://www.w3.org/TR/2017/CR-referrer-policy-20170126/#referrer-policy-empty-string>.
3027         * loader/FrameLoader.h:
3028
3029 2017-10-19  Zalan Bujtas  <zalan@apple.com>
3030
3031         [FrameView::layout cleanup] Do not reenter FrameView::performPostLayoutTasks
3032         https://bugs.webkit.org/show_bug.cgi?id=178518
3033         <rdar://problem/35075409>
3034
3035         Reviewed by Antti Koivisto.
3036
3037         This patch tightens existing reentrancy policy on performPostLayoutTasks.
3038
3039         Covered by existing test cases.
3040
3041         * page/FrameView.cpp:
3042         (WebCore::FrameView::FrameView):
3043         (WebCore::FrameView::reset):
3044         (WebCore::FrameView::layout):
3045         (WebCore::FrameView::performPostLayoutTasks):
3046         * page/FrameView.h:
3047
3048 2017-10-19  Chris Dumez  <cdumez@apple.com>
3049
3050         Unreviewed, revert r223650 as it caused crashes on the bots.
3051
3052         * WebCore.xcodeproj/project.pbxproj:
3053         * dom/ScriptExecutionContext.h:
3054         * loader/DocumentThreadableLoader.cpp:
3055         (WebCore::DocumentThreadableLoader::DocumentThreadableLoader):
3056         * loader/FetchOptions.h:
3057         * loader/ResourceLoaderOptions.h:
3058         * loader/WorkerThreadableLoader.cpp:
3059         (WebCore::WorkerThreadableLoader::WorkerThreadableLoader):
3060         (WebCore::WorkerThreadableLoader::MainThreadBridge::MainThreadBridge):
3061         * loader/WorkerThreadableLoader.h:
3062         * platform/network/ResourceRequestBase.h:
3063         * platform/network/ResourceResponseBase.h:
3064         * workers/WorkerThread.h:
3065         * workers/service/ServiceWorkerContainer.cpp:
3066         (WebCore::ServiceWorkerContainer::jobResolvedWithRegistration):
3067         * workers/service/context/SWContextManager.cpp: Copied from Source/WebKit/WebProcess/Storage/ServiceWorkerContextManager.h.
3068         (WebCore::SWContextManager::singleton):
3069         (WebCore::SWContextManager::SWContextManager):
3070         (WebCore::SWContextManager::startServiceWorkerContext):
3071         * workers/service/context/SWContextManager.h: Renamed from Source/WebKit/WebProcess/Storage/ServiceWorkerContextManager.h.
3072         * workers/service/context/ServiceWorkerThread.h:
3073
3074 2017-10-19  Zalan Bujtas  <zalan@apple.com>
3075
3076         [FrameView::layout cleanup] Replace m_nestedLayoutCount with isLayoutNested()
3077         https://bugs.webkit.org/show_bug.cgi?id=178503
3078         <rdar://problem/35066561>
3079
3080         Reviewed by Antti Koivisto.
3081
3082         Covered by existing tests.
3083
3084         * page/FrameView.cpp:
3085         (WebCore::FrameView::reset):
3086         (WebCore::FrameView::layout):
3087         (WebCore::FrameView::updateLayerPositionsAfterScrolling):
3088         (WebCore::FrameView::updateCompositingLayersAfterScrolling):
3089         (WebCore::FrameView::updateEmbeddedObjects):
3090         (WebCore::FrameView::flushPostLayoutTasksQueue):
3091         (WebCore::FrameView::performPostLayoutTasks):
3092         (WebCore::FrameView::startLayoutAtMainFrameViewIfNeeded):
3093         * page/FrameView.h:
3094
3095 2017-10-19  Antti Koivisto  <antti@apple.com>
3096
3097         Overlapping text on all CSS fonts specs
3098         https://bugs.webkit.org/show_bug.cgi?id=177585
3099         <rdar://problem/34704078>
3100
3101         Reviewed by Daniel Bates.
3102
3103         We were resetting StyleResolver::overrideDocumentElementStyle too early when resolving slot elements.
3104         This resulted in 'rem' units being miscomputed.
3105
3106         Reduction by Zalan.
3107
3108         Test: fast/html/details-line-height-overlap.html
3109
3110         * style/StyleTreeResolver.cpp:
3111         (WebCore::Style::TreeResolver::Scope::Scope):
3112         (WebCore::Style::TreeResolver::Scope::~Scope):
3113
3114             Only reset overrideDocumentElementStyle when destroying the scope.
3115
3116         (WebCore::Style::TreeResolver::pushScope):
3117         (WebCore::Style::TreeResolver::pushEnclosingScope):
3118         (WebCore::Style::TreeResolver::popScope):
3119
3120             A scope can show up multiple times in scope stack.
3121
3122         * style/StyleTreeResolver.h:
3123
3124 2017-10-19  Ryosuke Niwa  <rniwa@webkit.org>
3125
3126         Consolidate calls to insertedInto and expand the coverage of NoEventDispatchAssertion
3127         https://bugs.webkit.org/show_bug.cgi?id=178504
3128
3129         Reviewed by Antti Koivisto.
3130
3131         Consolidated calls to notifyChildNodeInserted, childrenChanged, didFinishInsertingNode, and
3132         dispatchChildInsertionEvents for inserting a node by executeNodeInsertionWithScriptAssertion,
3133         a new templatefunction which takes a closure to do the node insertion to make exactly when
3134         the script becomes runnable clear.
3135
3136         Added an exception to SVGTRefElement::updateReferencedText since this code mutates user agent
3137         shadow root during insertedInto, and turned ChildChangeSource into an enum class.
3138
3139         * dom/CharacterData.cpp:
3140         (WebCore::CharacterData::parserAppendData):
3141         (WebCore::CharacterData::setDataAndUpdate):
3142         * dom/ContainerNode.cpp:
3143         (WebCore::executeNodeInsertionWithScriptAssertion): Extracted.
3144         (WebCore::ContainerNode::takeAllChildrenFrom): Deployed executeNodeInsertionWithScriptAssertion.
3145         (WebCore::ContainerNode::insertBefore): Ditto.
3146         (WebCore::ContainerNode::changeForChildInsertion): Deleted.
3147         (WebCore::ContainerNode::notifyChildInserted): Deleted.
3148         (WebCore::ContainerNode::parserInsertBefore): Deployed executeNodeInsertionWithScriptAssertion. 
3149         (WebCore::ContainerNode::replaceChild): Ditto.
3150         (WebCore::ContainerNode::removeChild):
3151         (WebCore::ContainerNode::parserRemoveChild):
3152         (WebCore::ContainerNode::replaceAllChildren): Ditto.
3153         (WebCore::ContainerNode::removeChildren):
3154         (WebCore::ContainerNode::appendChildWithoutPreInsertionValidityCheck): Ditto.
3155         (WebCore::ContainerNode::parserAppendChild): Ditto.
3156         (WebCore::ContainerNode::childrenChanged):
3157         (WebCore::ContainerNode::updateTreeAfterInsertion): Deleted.
3158         * dom/ContainerNode.h:
3159         * dom/Element.cpp:
3160         (WebCore::Element::childrenChanged):
3161         * html/HTMLOutputElement.cpp:
3162         (WebCore::HTMLOutputElement::childrenChanged):
3163         * svg/SVGClipPathElement.cpp:
3164         (WebCore::SVGClipPathElement::childrenChanged):
3165         * svg/SVGElement.cpp:
3166         (WebCore::SVGElement::childrenChanged):
3167         * svg/SVGFELightElement.cpp:
3168         (WebCore::SVGFELightElement::childrenChanged):
3169         * svg/SVGFilterElement.cpp:
3170         (WebCore::SVGFilterElement::childrenChanged):
3171         * svg/SVGFilterPrimitiveStandardAttributes.cpp:
3172         (WebCore::SVGFilterPrimitiveStandardAttributes::childrenChanged):
3173         * svg/SVGGradientElement.cpp:
3174         (WebCore::SVGGradientElement::childrenChanged):
3175         * svg/SVGMarkerElement.cpp:
3176         (WebCore::SVGMarkerElement::childrenChanged):
3177         * svg/SVGMaskElement.cpp:
3178         (WebCore::SVGMaskElement::childrenChanged):
3179         * svg/SVGPatternElement.cpp:
3180         (WebCore::SVGPatternElement::childrenChanged):
3181         * svg/SVGTRefElement.cpp:
3182         (WebCore::SVGTRefElement::updateReferencedText): Allow DOM mutations inside the user agent shadow tree here.
3183
3184 2017-10-19  Ryosuke Niwa  <rniwa@webkit.org>
3185
3186         Add an argument indicating the type of removal to Node::removedFrom
3187         https://bugs.webkit.org/show_bug.cgi?id=178505
3188
3189         Reviewed by Antti Koivisto.
3190
3191         Like r223628, added RemovalType as the first argument to Node::removedFrom, which contains two booleans indicating
3192         whether the node just become disconnected from a document, and whether node's tree scope had changed or not.
3193
3194         These boolean flags simplifies the logic in removedFrom implementations, and are required to have a better
3195         guarantee about the correctness of node flags during calls to removedFrom. Right now, Node::isConnected() and
3196         Node::isInShadowTree() are both outdated until Node::removedFrom is called.
3197
3198         Also renamed the second argument of removedFrom to parentOfRemovedTree to make the semantics clear.
3199
3200         Note that in some implementations of removedFrom, we check whether isConnected() was true to decide whether
3201         the node had already been disconnected from a document prior to calls to this particular call of removedFrom.
3202         This extra check is no longer necessary since no node will be removed from a document without first being inserted
3203         completely somewhere after r223458.
3204
3205         No new tests since there should be no behavioral changes.
3206
3207         * dom/ContainerNodeAlgorithms.cpp:
3208         (WebCore::notifyNodeInsertedIntoDocument): Replaced RELEASE_ASSERT with RELEASE_ASSERT_WITH_SECURITY_IMPLICATION.
3209         (WebCore::notifyNodeRemovedFromDocument): Replaced the check that the node had not been re-connected by scripts
3210         by a release assert now that we believe we've eliminated all causes of these unwanted DOM mutations in r223458.
3211         Also moved the code to call setCSSTarget to Element::removedFrom. This random call to setCSSTarget predates r114351,
3212         as well as r40475. It was originally introduced by r29311 into Node::removedFromDocument() ten years ago.
3213         (WebCore::notifyNodeRemovedFromTree): Moved NoEventDispatchAssertion to notifyChildNodeRemoved.
3214         (WebCore::notifyChildNodeRemoved): Added NoEventDispatchAssertion.
3215         * dom/ContainerNodeAlgorithms.h:
3216         * dom/Element.cpp:
3217         (WebCore::Element::removedFrom): Replaced the complicated code to detect when this element is removed from a document
3218         and its tree scope had changed by removalType.disconnectedFromDocument and removalType.treeScopeChanged.
3219         * dom/Element.h:
3220         * dom/Node.cpp:
3221         (WebCore::Node::removedFrom):
3222         * dom/Node.h: Replaced a long block of comments above insertedInto by two lines of concise comments now that
3223         the semantics of insertedInto and didFinishInsertingNode are more clear, and enforced by assertions.
3224         (WebCore::Node::RemovalType::RemovalType): Addedl
3225         * dom/ProcessingInstruction.cpp:
3226         (WebCore::ProcessingInstruction::removedFrom):
3227         * dom/ProcessingInstruction.h:
3228         * dom/ShadowRoot.cpp:
3229         (WebCore::ShadowRoot::removedFrom): The extra !isConnected() check is no longer needed. See the description above.
3230         * dom/ShadowRoot.h:
3231         * html/FormAssociatedElement.cpp:
3232         (WebCore::FormAssociatedElement::removedFrom):
3233         * html/FormAssociatedElement.h:
3234         * html/HTMLBaseElement.cpp:
3235         (WebCore::HTMLBaseElement::removedFrom):
3236         * html/HTMLBaseElement.h:
3237         * html/HTMLFormControlElement.cpp:
3238         (WebCore::HTMLFormControlElement::removedFrom):
3239         * html/HTMLFormControlElement.h:
3240         * html/HTMLFormControlElementWithState.cpp:
3241         (WebCore::HTMLFormControlElementWithState::removedFrom):
3242         * html/HTMLFormControlElementWithState.h:
3243         * html/HTMLFormElement.cpp:
3244         (WebCore::HTMLFormElement::removedFrom):
3245         * html/HTMLFormElement.h:
3246         * html/HTMLFrameSetElement.cpp:
3247         (WebCore::HTMLFrameSetElement::removedFrom):
3248         * html/HTMLFrameSetElement.h:
3249         * html/HTMLImageElement.cpp:
3250         (WebCore::HTMLImageElement::removedFrom):
3251         * html/HTMLImageElement.h:
3252         * html/HTMLInputElement.cpp:
3253         (WebCore::HTMLInputElement::removedFrom):
3254         * html/HTMLInputElement.h:
3255         * html/HTMLLinkElement.cpp:
3256         (WebCore::HTMLLinkElement::removedFrom): The extra !isConnected() check is no longer needed. See above.
3257         * html/HTMLLinkElement.h:
3258         * html/HTMLMapElement.cpp:
3259         (WebCore::HTMLMapElement::removedFrom):
3260         * html/HTMLMapElement.h:
3261         * html/HTMLMediaElement.cpp:
3262         (WebCore::HTMLMediaElement::removedFrom):
3263         * html/HTMLMediaElement.h:
3264         * html/HTMLObjectElement.cpp:
3265         (WebCore::HTMLObjectElement::removedFrom):
3266         * html/HTMLObjectElement.h:
3267         * html/HTMLSlotElement.cpp:
3268         (WebCore::HTMLSlotElement::removedFrom): Simplifies the logic to detect when this slot element is being
3269         removed from a shadow tree using removalType.treeScopeChanged.
3270         * html/HTMLSlotElement.h:
3271         * html/HTMLSourceElement.cpp:
3272         (WebCore::HTMLSourceElement::insertedInto): Added a FIXME for an obvious bug.
3273         (WebCore::HTMLSourceElement::removedFrom): Ditto.
3274         * html/HTMLSourceElement.h:
3275         * html/HTMLStyleElement.cpp:
3276         (WebCore::HTMLStyleElement::removedFrom):
3277         * html/HTMLStyleElement.h:
3278         * html/HTMLTitleElement.cpp:
3279         (WebCore::HTMLTitleElement::removedFrom):
3280         * html/HTMLTitleElement.h:
3281         * html/HTMLTrackElement.cpp:
3282         (WebCore::HTMLTrackElement::removedFrom): Ditto.
3283         * html/HTMLTrackElement.h:
3284         * svg/SVGElement.cpp:
3285         (WebCore::SVGElement::removedFrom): Replaced isConnected() check before calling Node::removedFrom by the check of
3286         removalType.disconnectedFromDocument.
3287         * svg/SVGElement.h:
3288         * svg/SVGFEImageElement.cpp:
3289         (WebCore::SVGFEImageElement::removedFrom):
3290         * svg/SVGFEImageElement.h:
3291         * svg/SVGFontFaceElement.cpp:
3292         (WebCore::SVGFontFaceElement::removedFrom):
3293         * svg/SVGFontFaceElement.h:
3294         * svg/SVGMPathElement.cpp:
3295         (WebCore::SVGMPathElement::removedFrom):
3296         * svg/SVGMPathElement.h:
3297         * svg/SVGPathElement.cpp:
3298         (WebCore::SVGPathElement::removedFrom):
3299         * svg/SVGPathElement.h:
3300         * svg/SVGSVGElement.cpp:
3301         (WebCore::SVGSVGElement::removedFrom):
3302         * svg/SVGSVGElement.h:
3303         * svg/SVGStyleElement.cpp:
3304         (WebCore::SVGStyleElement::removedFrom): The extra !isConnected() check is no longer needed. See above.
3305         * svg/SVGStyleElement.h:
3306         * svg/SVGTRefElement.cpp:
3307         (WebCore::SVGTRefElement::removedFrom):
3308         * svg/SVGTRefElement.h:
3309         * svg/SVGTextPathElement.cpp:
3310         (WebCore::SVGTextPathElement::removedFrom):
3311         * svg/SVGTextPathElement.h:
3312         * svg/SVGTitleElement.cpp:
3313         (WebCore::SVGTitleElement::removedFrom):
3314         * svg/SVGTitleElement.h:
3315         * svg/SVGUseElement.cpp:
3316         (WebCore::SVGUseElement::removedFrom):
3317         * svg/SVGUseElement.h:
3318         * svg/animation/SVGSMILElement.cpp:
3319         (WebCore::SVGSMILElement::removedFrom):
3320         * svg/animation/SVGSMILElement.h:
3321
3322 2017-10-19  Ms2ger  <Ms2ger@igalia.com>
3323
3324         Update the signatures of compressedTexSubImage3D.
3325         https://bugs.webkit.org/show_bug.cgi?id=178507
3326
3327         Reviewed by Ryosuke Niwa.
3328
3329         No new tests: not much point in adding tests now; this method doesn't
3330         do anything anyway.
3331
3332         * html/canvas/WebGL2RenderingContext.cpp:
3333         (WebCore::WebGL2RenderingContext::compressedTexSubImage3D):
3334         * html/canvas/WebGL2RenderingContext.h:
3335         * html/canvas/WebGL2RenderingContext.idl:
3336
3337 2017-10-19  Basuke Suzuki  <Basuke.Suzuki@sony.com>
3338
3339         [curl] Segfault in WebCore::CurlRequest::setupPOST
3340         https://bugs.webkit.org/show_bug.cgi?id=178434
3341
3342         Reviewed by Ryosuke Niwa.
3343
3344         * platform/network/curl/CurlRequest.cpp:
3345         (WebCore::CurlRequest::resolveBlobReferences):
3346         (WebCore::CurlRequest::setupPOST):
3347
3348 2017-10-18  Ryosuke Niwa  <rniwa@webkit.org>
3349
3350         Don't expose raw HTML in pasteboard to the web content
3351         https://bugs.webkit.org/show_bug.cgi?id=178422
3352         <rdar://problem/34567052>
3353
3354         Reviewed by Wenson Hsieh.
3355
3356         This patch enables HTML sanitization added in r223440 when WebKit pastes & concludes edit drag as opposed to
3357         just when dataTransfer.get is used. This is important to avoid leaking privacy sensitive information such as
3358         local file paths and pasting potentially harmful content such as scripts in event handler serialized by
3359         WebKit prior to r223462. In addition, we start using blob URLs in the pasted content instead of retaining
3360         the original URL and overriding the document loader like r222839 for RTFD and r222119 for image files.
3361
3362         To do this, a new superclass FrameWebContentReader of PasteboardWebContentReader and WebContentMarkupReader
3363         is introduced, and helper functions are extracted out of WebContentMarkupReader in WebContentReaderCocoa.mm
3364         to be also used in WebContentReader.
3365
3366         Tests: http/tests/security/clipboard/copy-paste-html-cross-origin-iframe-across-origin.html
3367                http/tests/security/clipboard/copy-paste-html-cross-origin-iframe-in-same-origin.html
3368                http/tests/security/clipboard/drag-drop-html-cross-origin-iframe-in-same-origin.html
3369                PasteWebArchive.SanitizesHTML
3370
3371         * editing/WebContentReader.cpp:
3372         (WebCore::FrameWebContentReader::shouldSanitize const): Moved from WebContentMarkupReader.
3373         * editing/WebContentReader.h:
3374         (WebCore::FrameWebContentReader): Added to share code between WebContentReader and WebContentMarkupReader.
3375         (WebCore::FrameWebContentReader::FrameWebContentReader): Added.
3376         * editing/cocoa/EditorCocoa.mm:
3377         (WebCore::Editor::writeSelectionToPasteboard): Store the content's origin in the pasteboard so that we can
3378         avoid sanitizing the content when pasting into the same document. This is important since converting all URLs
3379         into blob URLs would break editors on the Web which tracks images, etc... in the content using URLs.
3380         (WebCore::Editor::writeSelection): Ditto.
3381         * editing/cocoa/WebContentReaderCocoa.mm:
3382         (WebCore::MarkupAndArchive): Replaced FragmentAndArchive. Now returns the markup string in the archive
3383         instead of the parsed fragment.
3384         (WebCore::extractMarkupAndArchive): Renamed from createFragmentFromWebArchive. Now returns the markup string.
3385         (WebCore::sanitizeMarkupWithArchive): Extracted out of WebContentMarkupReader::readWebArchive to share code
3386         between WebContentReader and WebContentMarkupReader, and added the code to handle subframes recursively.
3387         As inefficient as this code is, we can't delay the conversion of subframes' marksup until later time since
3388         the main frame's markup would contain blob URLs to refer to those subframes. 
3389         (WebCore::WebContentReader::readWebArchive): Use sanitizeMarkupWithArchive when shouldSanitize() is true.
3390         Don't add the subresources to the document loader when the content will be loaded into the same origin since
3391         subresouces are mostly likely available in the document anyway.
3392         (WebCore::WebContentMarkupReader::readWebArchive):
3393         * platform/Pasteboard.h:
3394         (WebCore::PasteboardWebContent): Added contentOrigin.
3395         * platform/PasteboardWriterData.h:
3396         (WebCore::PasteboardWriterData): Ditto.
3397         * platform/ios/PasteboardIOS.mm:
3398         (WebCore::Pasteboard::read): Read the origin before branching out to readRespectingUTIFidelities.
3399         * platform/ios/PlatformPasteboardIOS.mm:
3400         (WebCore::PlatformPasteboard::write): Record the content origin into the pasteboard.
3401         * platform/mac/PasteboardMac.mm:
3402         (WebCore::Pasteboard::write): Ditto.
3403         * platform/mac/PasteboardWriter.mm:
3404         (WebCore::createPasteboardWriter): Ditto.
3405
3406 2017-10-18  Sam Weinig  <sam@webkit.org>
3407
3408         Another attempt to fix the windows build.
3409
3410         * page/SettingsBase.cpp:
3411         (WebCore::SettingsBase::resourceUsageOverlayVisibleChanged):
3412         * page/SettingsBase.h:
3413
3414 2017-10-18  Sam Weinig  <sam@webkit.org>
3415
3416         Attempt to fix the windows build.
3417
3418         * page/SettingsBase.cpp:
3419         (WebCore::SettingsBase::resourceUsageOverlayVisibleChanged):
3420         * page/SettingsBase.h:
3421
3422 2017-10-18  Sam Weinig  <sam@webkit.org>
3423
3424         [Settings] Convert more settings to be generated
3425         https://bugs.webkit.org/show_bug.cgi?id=177766
3426
3427         Reviewed by Dean Jackson.
3428
3429         - Replaces setNeedsStyleRecalcInAllFrames option in Settings.in
3430           with a more generic, onChange, which allows you to specify a function
3431           in SettingsBase that will be called when the setting changes. 
3432           setNeedsStyleRecalcInAllFrames is then reimplemented in terms of
3433           onChange.
3434         - Moves most (all but two) of the remaining non-static settings from
3435           SettingsBase to Settings.in
3436
3437         * Scripts/GenerateSettings/GenerateSettingsImplementationFile.py:
3438         (printSetterBody):
3439         * Scripts/GenerateSettings/Settings.py:
3440         (Setting.__init__):
3441         (Setting.__str__):
3442         (Setting.typeIsValueType):
3443         (Setting.setterFunctionName):
3444         (Setting.setterChangeFunctionName):
3445         (Setting.hasComplexSetter):
3446         (parseInput):
3447         
3448             Add sup