Update frame-ancestor directive to match Content Security Policy Level 3
[WebKit-https.git] / Source / WebCore / ChangeLog
1 2018-01-19  Daniel Bates  <dabates@apple.com>
2
3         Update frame-ancestor directive to match Content Security Policy Level 3
4         https://bugs.webkit.org/show_bug.cgi?id=178891
5         <rdar://problem/35209458>
6
7         Reviewed by Alex Christensen.
8
9         Derived from Blink e667cc2e501fabab3605b838e4ee0d642a9c4a59:
10         <https://chromium.googlesource.com/chromium/src.git/+/e667cc2e501fabab3605b838e4ee0d642a9c4a59>
11
12         Update frame-ancestor directive to match against the origin of the ancestor document per the
13         Content Security Policy Level 3 spec.: <https://w3c.github.io/webappsec-csp/> (15 January 2018).
14         Specifically this change in behavior was made to CSP 3 in <https://github.com/w3c/webappsec/issues/311>.
15         In earlier versions of the spec, the frame-ancestor directive matched against the URL of the
16         ancestor document.
17
18         Disregarding allow-same-origin sandboxed iframes, a document with policy "frame-ancestor 'self'"
19         will be blocked from loading in a sandboxed iframe as a result of this change.
20
21         Tests: http/tests/security/contentSecurityPolicy/1.1/frame-ancestors/frame-ancestors-nested-cross-in-allow-same-origin-sandboxed-cross-url-allow.html
22                http/tests/security/contentSecurityPolicy/1.1/frame-ancestors/frame-ancestors-nested-cross-in-sandboxed-cross-url-block.html
23
24         * page/csp/ContentSecurityPolicyDirectiveList.cpp:
25         (WebCore::checkFrameAncestors):
26
27 2018-01-19  Basuke Suzuki  <Basuke.Suzuki@sony.com>
28
29         [Curl] Add timeout support to XMLHttpRequest
30         https://bugs.webkit.org/show_bug.cgi?id=181876
31
32         Reviewed by Alex Christensen 
33
34         * platform/network/ResourceRequestBase.cpp:
35         * platform/network/curl/CurlContext.cpp:
36         (WebCore::CurlHandle::setTimeout):
37         * platform/network/curl/CurlContext.h:
38         * platform/network/curl/CurlRequest.cpp:
39         (WebCore::CurlRequest::setupTransfer):
40         (WebCore::CurlRequest::didCompleteTransfer):
41         * platform/network/curl/ResourceError.h:
42         * platform/network/curl/ResourceErrorCurl.cpp:
43         (WebCore::ResourceError::httpError):
44
45 2018-01-19  Yoav Weiss  <yoav@yoav.ws>
46
47         Support for preconnect Link headers
48         https://bugs.webkit.org/show_bug.cgi?id=181657
49
50         Reviewed by Darin Adler.
51
52         Move the preconnect functionality into its own function, and
53         also call this function when Link headers are processed.
54
55         Test: http/tests/preconnect/link-header-rel-preconnect-http.php
56
57         * loader/LinkLoader.cpp:
58         (WebCore::LinkLoader::loadLinksFromHeader): Call preconnectIfNeeded.
59         (WebCore::LinkLoader::preconnectIfNeeded): Preconnect to a host functionality moved here.
60         (WebCore::LinkLoader::loadLink): Call preconnectIfNeeded.
61         * loader/LinkLoader.h:
62
63 2018-01-19  Joseph Pecoraro  <pecoraro@apple.com>
64
65         AppCache: Log a Deprecation warning to the Console when AppCache is used
66         https://bugs.webkit.org/show_bug.cgi?id=181778
67
68         Reviewed by Alex Christensen.
69
70         * html/HTMLHtmlElement.cpp:
71         (WebCore::HTMLHtmlElement::insertedByParser):
72
73 2018-01-19  Chris Dumez  <cdumez@apple.com>
74
75         ASSERT(registration || isTerminating()) hit in SWServerWorker::skipWaiting()
76         https://bugs.webkit.org/show_bug.cgi?id=181761
77         <rdar://problem/36594564>
78
79         Reviewed by Youenn Fablet.
80
81         There is a short period of time, early in the registration process where a
82         SWServerWorker object exists for a registration but is not in the registration's
83         installing/waiting/active slots yet. As a result, if a registration is cleared
84         during this period (for e.g. due to the user clearing all website data), that
85         SWServerWorker will not be terminated. We then hit assertion later on when this
86         worker is trying to do things (like call skipWaiting).
87
88         To address the issue, we now keep a reference this SWServerWorker on the
89         registration, via a new SWServerRegistration::m_preInstallationWorker data member.
90         When the registration is cleared, we now take care of terminating this worker.
91
92         No new tests, covered by existing tests that crash flakily in debug builds.
93
94         * workers/WorkerThread.cpp:
95         (WebCore::WorkerThread::stop):
96         if the mutex is locked, then the worker thread is still starting. We spin the
97         runloop and try to stop again later. This avoids the deadlock shown in
98         Bug 181763 as the worker thread may need to interact with the main thread
99         during startup.
100
101         * workers/service/server/SWServer.cpp:
102         (WebCore::SWServer::installContextData):
103         * workers/service/server/SWServerJobQueue.cpp:
104         (WebCore::SWServerJobQueue::scriptContextFailedToStart):
105         (WebCore::SWServerJobQueue::install):
106         * workers/service/server/SWServerRegistration.cpp:
107         (WebCore::SWServerRegistration::~SWServerRegistration):
108         (WebCore::SWServerRegistration::setPreInstallationWorker):
109         (WebCore::SWServerRegistration::clear):
110         * workers/service/server/SWServerRegistration.h:
111         (WebCore::SWServerRegistration::preInstallationWorker const):
112
113 2018-01-19  Chris Dumez  <cdumez@apple.com>
114
115         Service worker registrations restored from disk may not be reused when the JS calls register() again
116         https://bugs.webkit.org/show_bug.cgi?id=181810
117         <rdar://problem/36591711>
118
119         Reviewed by Youenn Fablet.
120
121         The issue was that when restoring a registration from disk, we would not set its active worker right
122         away. We only set it later in installContextData(). installContextData() is only called after we’ve
123         launched the service worker process and established a connection to it.
124
125         However, we would start processing jobs (such as registrations) before we’ve established the connection
126         to the service worker process. SWServerJobQueue::runRegisterJob(), in order to reuse an existing
127         registration checks the registration’s active worker has the right script URL. The issue was that when
128         this code would execute, we may not have set the registration’s active service worker yet, in which case,
129         we would update the existing registration instead of reusing it as-is.
130
131         To address the issue, we now delay the processing of jobs until the connection to the service worker
132         process has been established and we've installed all pending contexts via installContextData().
133
134         Changed is covered by new API test.
135
136         * workers/service/server/SWServer.cpp:
137         (WebCore::SWServer::Connection::scheduleJobInServer):
138         (WebCore::SWServer::scheduleJob):
139         (WebCore::SWServer::serverToContextConnectionCreated):
140         * workers/service/server/SWServer.h:
141
142 2018-01-19  James Craig  <jcraig@apple.com>
143
144         AX: when invert colors is on, double-invert image and picture elements in UserAgentStyleSheet
145         https://bugs.webkit.org/show_bug.cgi?id=181281
146         <rdar://problem/36291776>
147
148         Reviewed by Simon Fraser.
149
150         Updated "Smart Invert" to include img and picture element inversion and tests.
151
152         Tests: accessibility/smart-invert-reference.html
153                accessibility/smart-invert.html
154
155         * css/html.css:
156         (@media (inverted-colors)):
157         (img:not(picture>img), picture, video):
158
159 2018-01-19  Chris Dumez  <cdumez@apple.com>
160
161         The WebContent process should not process incoming IPC while waiting for a sync IPC reply
162         https://bugs.webkit.org/show_bug.cgi?id=181560
163
164         Reviewed by Ryosuke Niwa.
165
166         Add internals API for testing purposes.
167
168         Test: fast/misc/testIncomingSyncIPCMessageWhileWaitingForSyncReply.html
169
170         * page/ChromeClient.h:
171         * testing/Internals.cpp:
172         (WebCore::Internals::testIncomingSyncIPCMessageWhileWaitingForSyncReply):
173         * testing/Internals.h:
174         * testing/Internals.idl:
175
176 2018-01-19  Keith Miller  <keith_miller@apple.com>
177
178         HaveInternalSDK includes should be "#include?"
179         https://bugs.webkit.org/show_bug.cgi?id=179670
180
181         Reviewed by Dan Bernstein.
182
183         * Configurations/Base.xcconfig:
184
185 2018-01-19  Daniel Bates  <dabates@apple.com>
186
187         Fix misspelling; substitute willDetachRenderer for willDetatchRenderer.
188
189         * html/HTMLPlugInImageElement.cpp:
190         (WebCore::HTMLPlugInImageElement::willDetachRenderers):
191         * plugins/PluginViewBase.h:
192         (WebCore::PluginViewBase::willDetachRenderer):
193         (WebCore::PluginViewBase::willDetatchRenderer): Deleted.
194
195 2018-01-19  Jonathan Bedard  <jbedard@apple.com>
196
197         Unreviewed build fix, remove unused lambda captures.
198
199         * dom/messageports/MessagePortChannel.cpp:
200         (WebCore::MessagePortChannel::takeAllMessagesForPort):
201         * dom/messageports/MessagePortChannelRegistry.cpp:
202         (WebCore::MessagePortChannelRegistry::messagePortChannelCreated):
203
204 2018-01-19  Antoine Quint  <graouts@apple.com>
205
206         [Web Animations] Expose timing properties (delay, endDelay, fill, iterationStart, iterations, direction) and getComputedTiming()
207         https://bugs.webkit.org/show_bug.cgi?id=181857
208         <rdar://problem/36660081>
209
210         Reviewed by Dean Jackson.
211
212         We start the work to implement the rest of the Web Animations timing and animation model by exposing more properties on
213         AnimationEffectTiming to control delay (delay, endDelay), looping (iterationStart, iterations), fill and direction.
214         Additionally, we expose the getComputedTiming() method on AnimationEffect, although it currently lacks some computed
215         properties that will come in later patch as we implement various processes defined by the spec. We also update the
216         existing duration() method on AnimationEffectTiming to be called iterationDuration() to match the terms used in the
217         specification.
218
219         Finally, we make all new properties, and update existing ones, that expose a time value go through the new utility
220         function secondsToWebAnimationsAPITime() to guarantee rounded values with microseconds precision, as advised by
221         the Web Animations specification.
222
223         * CMakeLists.txt:
224         * DerivedSources.make:
225         * Sources.txt:
226         * WebCore.xcodeproj/project.pbxproj:
227         * animation/AnimationEffect.cpp:
228         (WebCore::AnimationEffect::localTime const):
229         (WebCore::AnimationEffect::getComputedTiming):
230         * animation/AnimationEffect.h:
231         * animation/AnimationEffect.idl:
232         * animation/AnimationEffectTiming.cpp:
233         (WebCore::AnimationEffectTiming::AnimationEffectTiming):
234         (WebCore::AnimationEffectTiming::setIterationStart):
235         (WebCore::AnimationEffectTiming::setIterations):
236         (WebCore::AnimationEffectTiming::bindingsDuration const):
237         (WebCore::AnimationEffectTiming::setBindingsDuration):
238         (WebCore::AnimationEffectTiming::endTime const):
239         (WebCore::AnimationEffectTiming::activeDuration const):
240         * animation/AnimationEffectTiming.h:
241         * animation/AnimationEffectTiming.idl:
242         * animation/AnimationPlaybackEvent.cpp:
243         (WebCore::AnimationPlaybackEvent::bindingsCurrentTime const):
244         (WebCore::AnimationPlaybackEvent::bindingsTimelineTime const):
245         * animation/AnimationTimeline.cpp:
246         (WebCore::AnimationTimeline::bindingsCurrentTime):
247         * animation/ComputedTimingProperties.h: Added.
248         * animation/ComputedTimingProperties.idl: Added. We set nullable double values to a default value of "null" since
249         otherwise setting those properties to a null value would not set the properties in the converted JS dictionary.
250         * animation/KeyframeEffect.cpp:
251         (WebCore::KeyframeEffect::create): Handle new timing properties passed in the KeyframeEffectOptions dictionary.
252         (WebCore::KeyframeEffect::applyAtLocalTime):
253         (WebCore::KeyframeEffect::getAnimatedStyle):
254         (WebCore::KeyframeEffect::startOrStopAccelerated):
255         * animation/WebAnimation.cpp:
256         (WebCore::WebAnimation::bindingsStartTime const):
257         (WebCore::WebAnimation::bindingsCurrentTime const):
258         (WebCore::WebAnimation::effectEndTime const):
259         (WebCore::WebAnimation::timeToNextRequiredTick const):
260         * animation/WebAnimationUtilities.h: Added.
261         (WebCore::secondsToWebAnimationsAPITime):
262
263 2018-01-19  Alex Christensen  <achristensen@webkit.org>
264
265         Remove dead networking code
266         https://bugs.webkit.org/show_bug.cgi?id=181813
267
268         Reviewed by Tim Horton.
269
270         CFURLConnection is only used on Windows.
271
272         * platform/network/cf/ResourceError.h:
273         * platform/network/cf/ResourceRequest.h:
274         (WebCore::ResourceRequest::encodingRequiresPlatformData const):
275         * platform/network/cf/ResourceRequestCFNet.cpp:
276         (WebCore::findCFURLRequestCopyContentDispositionEncodingFallbackArrayFunction):
277         (WebCore::ResourceRequest::doUpdatePlatformRequest):
278         (WebCore::ResourceRequest::doUpdatePlatformHTTPBody):
279         (WebCore::ResourceRequest::doUpdateResourceRequest):
280         (WebCore::ResourceRequest::setStorageSession):
281         * platform/network/cf/ResourceResponse.h:
282         (WebCore::ResourceResponse::ResourceResponse):
283
284 2018-01-19  Alex Christensen  <achristensen@webkit.org>
285
286         Remove unused WebViewPrivate _allowCookies
287         https://bugs.webkit.org/show_bug.cgi?id=181812
288
289         Reviewed by Tim Horton.
290
291         This SPI was in the original iOS upstreaming and has not been used in many years.
292
293         * platform/network/ResourceRequestBase.cpp:
294         (WebCore::ResourceRequestBase::setDefaultAllowCookies): Deleted.
295         (WebCore::ResourceRequestBase::defaultAllowCookies): Deleted.
296         * platform/network/ResourceRequestBase.h:
297         (WebCore::ResourceRequestBase::ResourceRequestBase):
298
299 2018-01-18  Brady Eidson  <beidson@apple.com>
300
301         Make in-process MessagePorts be (mostly) asynchronous
302         https://bugs.webkit.org/show_bug.cgi?id=181454
303
304         Reviewed by Alex Christensen.
305
306         No new tests (Covered *brutally* by existing tests)
307
308         Part of making MessagePorts be a thing we can pass across processes is making them work async.
309         
310         The existing "MessagePortChannel" method of abstraction was not cut out for this.
311         This patch gets rid of MessagePortChannel and adds a new MessagePortChannelProvider abstraction.
312         It then gets the new machinery working in-process (with some pieces of out-of-process in place)
313
314         One synchronous behavior this patch maintains is the hasPendingActivity() check used to support GC.
315         That will (creatively) be made async in the next followup.
316         
317         More generally from MessagePorts, this patch also adds a "MessageWithMessagePorts" object to be used
318         with all forms of postMessage(). Much better.
319         
320         * CMakeLists.txt:
321         * Sources.txt:
322         * WebCore.xcodeproj/project.pbxproj:
323
324         * dom/InProcessMessagePortChannel.cpp: Removed.
325         * dom/InProcessMessagePortChannel.h: Removed.
326         * dom/MessagePortChannel.cpp: Removed.
327         * dom/MessagePortChannel.h: Removed.
328
329         * dom/MessageChannel.cpp:
330         (WebCore::MessageChannel::create):
331         (WebCore::MessageChannel::MessageChannel):
332         (WebCore::m_port2): Deleted.
333         * dom/MessageChannel.h:
334         (WebCore::MessageChannel::create): Deleted.
335
336         * dom/MessagePort.cpp:
337         (WebCore::MessagePort::create):
338         (WebCore::MessagePort::MessagePort):
339         (WebCore::MessagePort::~MessagePort):
340         (WebCore::MessagePort::entangle):
341         (WebCore::MessagePort::postMessage):
342         (WebCore::MessagePort::disentangle):
343         (WebCore::MessagePort::messageAvailable):
344         (WebCore::MessagePort::start):
345         (WebCore::MessagePort::close):
346         (WebCore::MessagePort::contextDestroyed):
347         (WebCore::MessagePort::dispatchMessages):
348         (WebCore::MessagePort::hasPendingActivity const):
349         (WebCore::MessagePort::locallyEntangledPort const):
350         (WebCore::MessagePort::disentanglePorts):
351         (WebCore::MessagePort::entanglePorts):
352         (WebCore::MessagePort::entangleWithRemote): Deleted.
353         * dom/MessagePort.h:
354
355         * dom/MessagePortIdentifier.h:
356         (WebCore::MessagePortIdentifier::logString const):
357
358         * dom/ScriptExecutionContext.cpp:
359         (WebCore::ScriptExecutionContext::processMessageWithMessagePortsSoon):
360         (WebCore::ScriptExecutionContext::dispatchMessagePortEvents):
361         (WebCore::ScriptExecutionContext::processMessagePortMessagesSoon): Deleted.
362         * dom/ScriptExecutionContext.h:
363
364         Add a single object that represents two intertwined ports, tracks their pending
365         messages, tracks which process they're in, etc etc:
366         * dom/messageports/MessagePortChannel.cpp: Added.
367         (WebCore::MessagePortChannel::create):
368         (WebCore::MessagePortChannel::MessagePortChannel):
369         (WebCore::MessagePortChannel::~MessagePortChannel):
370         (WebCore::MessagePortChannel::includesPort):
371         (WebCore::MessagePortChannel::entanglePortWithProcess):
372         (WebCore::MessagePortChannel::disentanglePort):
373         (WebCore::MessagePortChannel::closePort):
374         (WebCore::MessagePortChannel::postMessageToRemote):
375         (WebCore::MessagePortChannel::takeAllMessagesForPort):
376         (WebCore::MessagePortChannel::hasAnyMessagesPendingOrInFlight const):
377         * dom/messageports/MessagePortChannel.h: Added.
378         (WebCore::MessagePortChannel::port1 const):
379         (WebCore::MessagePortChannel::port2 const):
380         (WebCore::MessagePortChannel::logString const):
381
382         Abstraction for creating and operating on MessagePorts in a potentially cross-process way:
383         * dom/messageports/MessagePortChannelProvider.cpp: Added.
384         (WebCore::MessagePortChannelProvider::singleton):
385         (WebCore::MessagePortChannelProvider::setSharedProvider):
386         * dom/messageports/MessagePortChannelProvider.h: Added.
387         (WebCore::MessagePortChannelProvider::~MessagePortChannelProvider):
388
389         Adds a concrete implementation of that provider to be used in-process (e.g. WK1):
390         * dom/messageports/MessagePortChannelProviderImpl.cpp: Added.
391         (WebCore::MessagePortChannelProviderImpl::~MessagePortChannelProviderImpl):
392         (WebCore::MessagePortChannelProviderImpl::performActionOnAppropriateThread):
393         (WebCore::MessagePortChannelProviderImpl::createNewMessagePortChannel):
394         (WebCore::MessagePortChannelProviderImpl::entangleLocalPortInThisProcessToRemote):
395         (WebCore::MessagePortChannelProviderImpl::messagePortDisentangled):
396         (WebCore::MessagePortChannelProviderImpl::messagePortClosed):
397         (WebCore::MessagePortChannelProviderImpl::postMessageToRemote):
398         (WebCore::MessagePortChannelProviderImpl::takeAllMessagesForPort):
399         (WebCore::MessagePortChannelProviderImpl::hasMessagesForPorts_temporarySync):
400         * dom/messageports/MessagePortChannelProviderImpl.h: Added.
401
402         Adds a main thread object to handle the set of all MessagePortChannels that are open.
403         For now it lives in the WebProcess, but for out-of-process it will live in the UIProcess:
404         * dom/messageports/MessagePortChannelRegistry.cpp: Added.
405         (WebCore::MessagePortChannelRegistry::~MessagePortChannelRegistry):
406         (WebCore::MessagePortChannelRegistry::didCreateMessagePortChannel):
407         (WebCore::MessagePortChannelRegistry::messagePortChannelCreated):
408         (WebCore::MessagePortChannelRegistry::messagePortChannelDestroyed):
409         (WebCore::MessagePortChannelRegistry::didEntangleLocalToRemote):
410         (WebCore::MessagePortChannelRegistry::didDisentangleMessagePort):
411         (WebCore::MessagePortChannelRegistry::didCloseMessagePort):
412         (WebCore::MessagePortChannelRegistry::didPostMessageToRemote):
413         (WebCore::MessagePortChannelRegistry::takeAllMessagesForPort):
414         (WebCore::MessagePortChannelRegistry::hasMessagesForPorts_temporarySync): This is named against style
415           and weird on purpose - to call attention to how bad it is and how it's temporary.
416         (WebCore::MessagePortChannelRegistry::existingChannelContainingPort):
417         * dom/messageports/MessagePortChannelRegistry.h: Added.
418
419         Add an object that represents a "SerializedScriptValue for the message payload and the ports
420         that are being transferred along with that payload". This is used in all forms of postMessage():
421         * dom/messageports/MessageWithMessagePorts.cpp: Added.
422         * dom/messageports/MessageWithMessagePorts.h: Added.
423
424         * page/DOMWindow.cpp:
425         (WebCore::PostMessageTimer::PostMessageTimer):
426         (WebCore::PostMessageTimer::event):
427         (WebCore::DOMWindow::postMessage):
428
429         * platform/Logging.h:
430
431         * workers/DedicatedWorkerGlobalScope.cpp:
432         (WebCore::DedicatedWorkerGlobalScope::postMessage):
433
434         * workers/Worker.cpp:
435         (WebCore::Worker::postMessage):
436
437         * workers/WorkerGlobalScopeProxy.h:
438
439         * workers/WorkerMessagingProxy.cpp:
440         (WebCore::WorkerMessagingProxy::postMessageToWorkerObject):
441         (WebCore::WorkerMessagingProxy::postMessageToWorkerGlobalScope):
442         * workers/WorkerMessagingProxy.h:
443
444         * workers/WorkerObjectProxy.h:
445
446         * workers/service/ServiceWorker.cpp:
447         (WebCore::ServiceWorker::postMessage):
448
449         * workers/service/ServiceWorkerClient.cpp:
450         (WebCore::ServiceWorkerClient::postMessage):
451
452         * workers/service/context/SWContextManager.cpp:
453         (WebCore::SWContextManager::postMessageToServiceWorker):
454
455         * workers/service/context/ServiceWorkerThread.cpp:
456         (WebCore::fireMessageEvent):
457         (WebCore::ServiceWorkerThread::postMessageToServiceWorker):
458         * workers/service/context/ServiceWorkerThread.h:
459
460 2018-01-18  Ryan Haddad  <ryanhaddad@apple.com>
461
462         Unreviewed build fix, removed unused lambda capture.
463
464         * workers/service/context/SWContextManager.cpp:
465         (WebCore::SWContextManager::ServiceWorkerTerminationRequest::ServiceWorkerTerminationRequest):
466
467 2018-01-18  Chris Dumez  <cdumez@apple.com>
468
469         We should be able to terminate service workers that are unresponsive
470         https://bugs.webkit.org/show_bug.cgi?id=181563
471         <rdar://problem/35280031>
472
473         Reviewed by Alex Christensen.
474
475         Test: http/tests/workers/service/postmessage-after-terminating-hung-worker.html
476
477         * workers/service/context/SWContextManager.cpp:
478         (WebCore::SWContextManager::terminateWorker):
479         Before calling WorkerThread::stop(), set a timer with the given timeout parameter.
480         If the worker thread has not stopped when the timer fires, forcefully exit the
481         service worker process. The StorageProcess will take care of relaunching the
482         service worker process if it exits abruptly.
483
484         (WebCore::SWContextManager::serviceWorkerFailedToTerminate):
485         Log error message if we failed to terminate a service worker and call exit().
486
487         (WebCore::SWContextManager::ServiceWorkerTerminationRequest::ServiceWorkerTerminationRequest):
488
489         * workers/service/context/SWContextManager.h:
490
491 2018-01-18  Youenn Fablet  <youenn@apple.com>
492
493         Do not go to the storage process when loading a main resource if there is no service worker registered
494         https://bugs.webkit.org/show_bug.cgi?id=181395
495
496         Reviewed by Chris Dumez.
497
498         No observable behavior change.
499         Instead of creating a connection to know whether there is a potential service worker,
500         Ask the service worker provider that will use the connection if needed.
501         Otherwise, it will use a default value provided by the UIProcess.
502
503         Tested by cleaning all service workers and checking the computed value of the default value,
504         then observing whether pages registering service workers work well.
505
506         * loader/DocumentLoader.cpp:
507         (WebCore::DocumentLoader::startLoadingMainResource):
508         * workers/service/ServiceWorkerProvider.cpp:
509         (WebCore::ServiceWorkerProvider::mayHaveServiceWorkerRegisteredForOrigin):
510         * workers/service/ServiceWorkerProvider.h:
511
512 2018-01-18  Dan Bernstein  <mitz@apple.com>
513
514         [Xcode] Streamline and future-proof target-macOS-version-dependent build setting definitions
515         https://bugs.webkit.org/show_bug.cgi?id=181803
516
517         Reviewed by Tim Horton.
518
519         * Configurations/Base.xcconfig: Updated.
520         * Configurations/DebugRelease.xcconfig: Ditto.
521         * Configurations/FeatureDefines.xcconfig: Adopted macOSTargetConditionals helpers.
522         * Configurations/Version.xcconfig: Updated.
523         * Configurations/macOSTargetConditionals.xcconfig: Added. Defines helper build settings
524           useful for defining settings that depend on the target macOS version.
525
526 2018-01-18  Chris Dumez  <cdumez@apple.com>
527
528         Service Workers restored from persistent storage have 'redundant' state
529         https://bugs.webkit.org/show_bug.cgi?id=181749
530         <rdar://problem/36556486>
531
532         Reviewed by Youenn Fablet.
533
534         Tested by new API test.
535
536         * workers/service/server/SWServer.cpp:
537         (WebCore::SWServer::installContextData):
538         Make sure the SWServerWorker's state is set to "activated" after it is assigned to
539         the registrations' active slot. Otherwise, it stays in its default state (redundant).
540
541 2018-01-18  Antti Koivisto  <antti@apple.com>
542
543         REGRESSION(r225650): The scores of MotionMark tests Multiply and Leaves dropped by 8%
544         https://bugs.webkit.org/show_bug.cgi?id=181460
545         <rdar://problem/36379776>
546
547         Reviewed by Ryosuke Niwa.
548
549         * css/parser/CSSParser.cpp:
550         (WebCore::CSSParserContext::CSSParserContext):
551
552         Don't do the expensive security origin test if the supplied sheet base URL is null. This
553         is true for rules coming from the same document.
554
555 2018-01-18  Antti Koivisto  <antti@apple.com>
556
557         REGRESSION (r223604): Setting :before/after pseudo element on <noscript> asserts
558         https://bugs.webkit.org/show_bug.cgi?id=181795
559         <rdar://problem/36334524>
560
561         Reviewed by David Kilzer.
562
563         <noscript> disallows renderer generation outside CSS mechanisms, however we would still construct
564         PseudoElements for them during style resolution. These were never removed properly because the
565         pseudo element removal was tied to render tree teardown. Without proper removal the associated
566         animations were also not canceled.
567
568         Test: fast/css-generated-content/noscript-pseudo-anim-crash.html
569
570         * dom/Element.cpp:
571         (WebCore::Element::removedFromAncestor):
572
573         Take care to get rid of PseudoElements when the element is removed from the tree.
574         This also cancels any associated animations.
575
576 2018-01-18  Chris Fleizach  <cfleizach@apple.com>
577
578         AX: Aria-activedescendant not supported
579         https://bugs.webkit.org/show_bug.cgi?id=161734
580         <rdar://problem/28202679>
581
582         Reviewed by Joanmarie Diggs.
583
584         When a combo-box owns/controls a list/listbox/grid/tree, the owned element needs to check the active-descendant of the combobox when
585         checking if it has selected children. 
586         The target of the selection change notification should also be the owned element in these cases.
587
588         Test: accessibility/aria-combobox-controlling-list.html
589
590         * accessibility/AccessibilityObject.cpp:
591         (WebCore::AccessibilityObject::selectedListItem):
592         * accessibility/AccessibilityObject.h:
593         * accessibility/AccessibilityRenderObject.cpp:
594         (WebCore::AccessibilityRenderObject::targetElementForActiveDescendant const):
595         (WebCore::AccessibilityRenderObject::handleActiveDescendantChanged):
596         (WebCore::AccessibilityRenderObject::canHaveSelectedChildren const):
597         (WebCore::AccessibilityRenderObject::selectedChildren):
598         * accessibility/AccessibilityRenderObject.h:
599         * accessibility/mac/AXObjectCacheMac.mm:
600         (WebCore::AXObjectCache::postPlatformNotification):
601
602 2018-01-17  Per Arne Vollan  <pvollan@apple.com>
603
604         REGRESSION (r224780): Text stroke not applied to video captions.
605         https://bugs.webkit.org/show_bug.cgi?id=181743
606         <rdar://problem/35874338>
607
608         Reviewed by Simon Fraser.
609
610         Tests: media/track/track-css-visible-stroke-expected.html
611                media/track/track-css-visible-stroke.html
612
613         After r224780, it is no longer possible to mix text stroke styles with webkit
614         legacy text stroke styles.
615
616         * css/StyleResolver.cpp:
617         (WebCore::isValidCueStyleProperty):
618         * page/CaptionUserPreferencesMediaAF.cpp:
619         (WebCore::CaptionUserPreferencesMediaAF::captionsTextEdgeCSS const):
620
621 2018-01-18  Andy Estes  <aestes@apple.com>
622
623         [Payment Request] Support a default shipping address for Apple Pay
624         https://bugs.webkit.org/show_bug.cgi?id=181754
625         <rdar://problem/36009733>
626
627         Reviewed by Brady Eidson.
628
629         Move shippingContact from ApplePayPaymentRequest to ApplePayRequestBase. This allows
630         merchants to specify a default shipping address when using Apple Pay with Payment Request.
631
632         This also fixes a bug found during testing where
633         +[NSPersonNameComponentsFormatter localizedStringFromPersonNameComponents:style:options:]
634         would throw an exception when passed a nil NSPersonNameComponents.
635
636         Test: http/tests/ssl/applepay/ApplePayRequestShippingContact.https.html
637
638         * Modules/applepay/ApplePayPaymentRequest.h:
639         * Modules/applepay/ApplePayPaymentRequest.idl:
640         * Modules/applepay/ApplePayRequestBase.cpp:
641         (WebCore::convertAndValidate):
642         * Modules/applepay/ApplePayRequestBase.h:
643         * Modules/applepay/ApplePayRequestBase.idl:
644         * Modules/applepay/ApplePaySession.cpp:
645         (WebCore::convertAndValidate):
646         * Modules/applepay/ApplePaySessionPaymentRequest.h:
647         (WebCore::ApplePaySessionPaymentRequest::version const):
648         (WebCore::ApplePaySessionPaymentRequest::setVersion):
649         * Modules/applepay/cocoa/PaymentContactCocoa.mm:
650         (WebCore::convert):
651         * Modules/applepay/paymentrequest/ApplePayRequest.idl:
652         * testing/MockPaymentCoordinator.cpp:
653         (WebCore::MockPaymentCoordinator::showPaymentUI):
654         (WebCore::MockPaymentCoordinator::completeMerchantValidation):
655         * testing/MockPaymentCoordinator.h:
656
657 2018-01-18  Wenson Hsieh  <wenson_hsieh@apple.com>
658
659         [iOS] Specify -[NSURL _title] for the associated URL when copying an image element
660         https://bugs.webkit.org/show_bug.cgi?id=181783
661         <rdar://problem/35785445>
662
663         Reviewed by Ryosuke Niwa.
664
665         Always specify the -[NSURL _title] to be either the title specified in a PasteboardImage's inner PasteboardURL,
666         or if no title is specified, fall back to the user-visible URL string. This is because at least one internal
667         client always tries to use the -_title property to determine the title of a pasted URL, or if none is specified,
668         the -suggestedName. Since we need to set suggestedName to the preferred file name of the copied image and we
669         don't want the suggested name to become the title of the link, we need to explicitly set the link title.
670
671         In doing so, this patch also fixes a bug wherein we forget to set the _title of the NSURL we're registering to
672         an NSItemProvider.
673
674         Tests:  ActionSheetTests.CopyImageElementWithHREFAndTitle (new)
675                 ActionSheetTests.CopyImageElementWithHREF (modified)
676
677         * platform/ios/PlatformPasteboardIOS.mm:
678         (WebCore::PlatformPasteboard::write):
679
680 2018-01-17  Jer Noble  <jer.noble@apple.com>
681
682         WebVTT served via HLS never results in cues
683         https://bugs.webkit.org/show_bug.cgi?id=181773
684
685         Reviewed by Eric Carlson.
686
687         Test: http/tests/media/hls/hls-webvtt-tracks.html
688
689         Three independant errors conspired to keep in-band WebVTT samples from parsing:
690
691         - The definition of ISOWebVTTCue::boxTypeName() was incorrect.
692         - ISOWebVTTCue::parse() didn't call it's superclass's parse() method (leading to an incorrect size and offset).
693         - Use String::fromUTF8() rather than String.adopt(StringVector&&).
694
695         * platform/graphics/iso/ISOVTTCue.cpp:
696         (WebCore::ISOWebVTTCue::parse):
697         * platform/graphics/iso/ISOVTTCue.h:
698         (WebCore::ISOWebVTTCue::boxTypeName):
699
700 2018-01-17  John Wilander  <wilander@apple.com>
701
702         Resource Load Statistics: Block cookies for prevalent resources without user interaction
703         https://bugs.webkit.org/show_bug.cgi?id=177394
704         <rdar://problem/34613960>
705
706         Reviewed by Alex Christensen.
707
708         Tests: http/tests/resourceLoadStatistics/add-blocking-to-redirect.html
709                http/tests/resourceLoadStatistics/non-prevalent-resources-can-access-cookies-in-a-third-party-context.html
710                http/tests/resourceLoadStatistics/remove-blocking-in-redirect.html
711                http/tests/resourceLoadStatistics/remove-partitioning-in-redirect.html
712
713         * platform/network/NetworkStorageSession.h:
714             Now exports NetworkStorageSession::nsCookieStorage().
715         * platform/network/cf/NetworkStorageSessionCFNet.cpp:
716         (WebCore::NetworkStorageSession::setPrevalentDomainsToPartitionOrBlockCookies):
717             Fixes the FIXME.
718
719 2018-01-17  Dean Jackson  <dino@apple.com>
720
721         Remove linked-on test for Snow Leopard
722         https://bugs.webkit.org/show_bug.cgi?id=181770
723
724         Reviewed by Eric Carlson.
725
726         Remove a very old linked-on-or-after test.
727
728         * platform/graphics/ca/GraphicsLayerCA.cpp:
729
730 2018-01-17  Matt Lewis  <jlewis3@apple.com>
731
732         Unreviewed, rolling out r227098.
733
734         This broke the build.
735
736         Reverted changeset:
737
738         "Remove linked-on test for Snow Leopard"
739         https://bugs.webkit.org/show_bug.cgi?id=181770
740         https://trac.webkit.org/changeset/227098
741
742 2018-01-17  Dean Jackson  <dino@apple.com>
743
744         Remove linked-on test for Snow Leopard
745         https://bugs.webkit.org/show_bug.cgi?id=181770
746
747         Reviewed by Eric Carlson.
748
749         Remove a very old linked-on-or-after test.
750
751         * platform/graphics/ca/GraphicsLayerCA.cpp:
752
753 2018-01-17  Stephan Szabo  <stephan.szabo@sony.com>
754
755         [Curl] Use ResourceRequest::encodeWithPlatformData()
756         https://bugs.webkit.org/show_bug.cgi?id=181768
757
758         Reviewed by Alex Christensen.
759
760         No new tests, assertion hit in downstream port, should be covered by
761         existing tests.
762
763         * platform/network/curl/ResourceRequest.h:
764         (WebCore::ResourceRequest::encodeWithPlatformData const):
765         (WebCore::ResourceRequest::decodeWithPlatformData):
766
767 2018-01-17  Eric Carlson  <eric.carlson@apple.com>
768
769         Use existing RGB colorspace instead of creating a new one
770         https://bugs.webkit.org/show_bug.cgi?id=181765
771         <rdar://problem/36595753>
772
773         Reviewed by Dean Jackson.
774
775         * platform/mediastream/mac/ScreenDisplayCaptureSourceMac.mm:
776         (WebCore::ScreenDisplayCaptureSourceMac::createDisplayStream): Use sRGBColorSpaceRef instead
777         of creating a new static colorspace.
778
779 2018-01-17  Matt Lewis  <jlewis3@apple.com>
780
781         Unreviewed, rolling out r227076.
782
783         This breaks internal builds
784
785         Reverted changeset:
786
787         "Resource Load Statistics: Block cookies for prevalent
788         resources without user interaction"
789         https://bugs.webkit.org/show_bug.cgi?id=177394
790         https://trac.webkit.org/changeset/227076
791
792 2018-01-17  Ryosuke Niwa  <rniwa@webkit.org>
793
794         input and textarea elements should reveal selection in setSelection when focused
795         https://bugs.webkit.org/show_bug.cgi?id=181715
796         <rdar://problem/36570546>
797
798         Reviewed by Zalan Bujtas.
799
800         Made input and textarea elements reveal selection in FrameSelection::setSelection instead of by directly
801         invoking FrameSelection::revealSelection in their respective updateFocusAppearance to unify code paths.
802
803         Also added options to reveal selection up to the main frame to SetSelectionOption to be used in iOS.
804
805         * editing/FrameSelection.cpp:
806         (WebCore::FrameSelection::FrameSelection):
807         (WebCore::FrameSelection::moveWithoutValidationTo): Takes SelectionRevealMode as an argument and converts
808         sets appropriate selection options.
809         (WebCore::FrameSelection::setSelection): Reconstruct SelectionRevealMode out of selection option sets.
810         (WebCore::FrameSelection::updateAndRevealSelection):
811         * editing/FrameSelection.h:
812         (WebCore::FrameSelection): Added RevealSelectionUpToMainFrame as a SelectionRevealMode and replaced
813         m_shouldRevealSelection by m_selectionRevealMode.
814         * html/HTMLInputElement.cpp:
815         (WebCore::HTMLInputElement::updateFocusAppearance): Pass SelectionRevealMode to HTMLTextFormControlElement's
816         select and restoreCachedSelection instead of directly invoking FrameSelection::revealSelection.
817         * html/HTMLTextAreaElement.cpp:
818         (WebCore::HTMLTextAreaElement::updateFocusAppearance): Ditto.
819         * html/HTMLTextFormControlElement.cpp:
820         (WebCore::HTMLTextFormControlElement::select):
821         (WebCore::HTMLTextFormControlElement::setSelectionRange):
822         (WebCore::HTMLTextFormControlElement::restoreCachedSelection):
823         * html/HTMLTextFormControlElement.h:
824
825 2018-01-17  Michael Catanzaro  <mcatanzaro@igalia.com>
826
827         WEBKIT_FRAMEWORK should not modify file-global include directories
828         https://bugs.webkit.org/show_bug.cgi?id=181656
829
830         Reviewed by Konstantin Tokarev.
831
832         * CMakeLists.txt:
833         * PlatformWPE.cmake:
834
835 2018-01-17  Michael Catanzaro  <mcatanzaro@igalia.com>
836
837         [GTK] Try even harder not to static link WTF into libwebkit2gtk
838         https://bugs.webkit.org/show_bug.cgi?id=181751
839
840         Reviewed by Alex Christensen.
841
842         We don't want two copies of WTF. It should only be in libjavascriptcoregtk.
843
844         * PlatformGTK.cmake:
845
846 2018-01-17  Zalan Bujtas  <zalan@apple.com>
847
848         Multicol: RenderMultiColumnFlow should not inherit the flow state
849         https://bugs.webkit.org/show_bug.cgi?id=181762
850         <rdar://problem/35448565>
851
852         Reviewed by Simon Fraser.
853
854         Do not compute the inherited flow state flag for RenderMultiColumnFlow.
855         It is (by definition) always inside a fragmented flow.
856
857         Test: fast/multicol/crash-when-out-of-flow-positioned-becomes-in-flow.html
858
859         * rendering/RenderObject.cpp:
860         (WebCore::RenderObject::computedFragmentedFlowState):
861
862 2018-01-17  Alex Christensen  <achristensen@webkit.org>
863
864         Deprecate Application Cache
865         https://bugs.webkit.org/show_bug.cgi?id=181764
866
867         Reviewed by Geoffrey Garen.
868
869         * features.json:
870
871 2018-01-17  Wenson Hsieh  <wenson_hsieh@apple.com>
872
873         [iOS simulator] API test WKAttachmentTests.InjectedBundleReplaceURLWhenPastingImage is failing
874         https://bugs.webkit.org/show_bug.cgi?id=181758
875
876         Reviewed by Tim Horton.
877
878         This test is failing because Editor::clientReplacementURLForResource expects a MIME type, but on iOS, the type
879         paramter passed into WebContentReader::readImage is a UTI; subsequently, the bundle editing delegate receives
880         a MIME type that's actually a UTI, which is incorrect. To address this, ensure that a MIME type is passed to
881         bundle SPI by converting the type in WebContentReader::readImage to a MIME type.
882
883         * editing/cocoa/WebContentReaderCocoa.mm:
884         (WebCore::WebContentReader::readImage):
885
886 2018-01-17  Antti Koivisto  <antti@apple.com>
887
888         REGRESSION (r226385?): Crash in com.apple.WebCore: WebCore::MediaQueryEvaluator::evaluate const + 32
889         https://bugs.webkit.org/show_bug.cgi?id=181742
890         <rdar://problem/36334726>
891
892         Reviewed by David Kilzer.
893
894         Test: fast/media/mediaqueryevaluator-crash.html
895
896         * css/MediaQueryEvaluator.cpp:
897         (WebCore::MediaQueryEvaluator::MediaQueryEvaluator):
898
899         Use WeakPtr<Document> instead of a plain Frame pointer.
900
901         (WebCore::MediaQueryEvaluator::evaluate const):
902
903         Get the frame via document.
904
905         * css/MediaQueryEvaluator.h:
906         * dom/Document.cpp:
907         (WebCore::Document::prepareForDestruction):
908
909         Take care to clear style resolver.
910
911 2018-01-17  Youenn Fablet  <youenn@apple.com>
912
913         Put fetch request keepAlive behind a runtime flag
914         https://bugs.webkit.org/show_bug.cgi?id=181592
915
916         Reviewed by Chris Dumez.
917
918         No change of behavior.
919
920         * Modules/fetch/FetchRequest.idl:
921         * page/RuntimeEnabledFeatures.h:
922         (WebCore::RuntimeEnabledFeatures::fetchAPIKeepAliveEnabled const):
923         (WebCore::RuntimeEnabledFeatures::setFetchAPIKeepAliveEnabled):
924
925 2018-01-17  Per Arne Vollan  <pvollan@apple.com>
926
927         [Win] Use switch when converting from ResourceRequestCachePolicy to platform cache policy.
928         https://bugs.webkit.org/show_bug.cgi?id=181686
929
930         Reviewed by Alex Christensen.
931
932         No new tests, covered by existing tests.
933
934         A switch will make the function easier on the eyes. Also, use the function in places where the ResourceRequestCachePolicy
935         is just casted to a platform cache policy.
936
937         * platform/network/cf/ResourceRequestCFNet.cpp:
938         (WebCore::toPlatformRequestCachePolicy):
939
940 2018-01-17  John Wilander  <wilander@apple.com>
941
942         Resource Load Statistics: Block cookies for prevalent resources without user interaction
943         https://bugs.webkit.org/show_bug.cgi?id=177394
944         <rdar://problem/34613960>
945
946         Reviewed by Alex Christensen.
947
948         Tests: http/tests/resourceLoadStatistics/add-blocking-to-redirect.html
949                http/tests/resourceLoadStatistics/non-prevalent-resources-can-access-cookies-in-a-third-party-context.html
950                http/tests/resourceLoadStatistics/remove-blocking-in-redirect.html
951                http/tests/resourceLoadStatistics/remove-partitioning-in-redirect.html
952
953         * platform/network/NetworkStorageSession.h:
954             Now exports NetworkStorageSession::nsCookieStorage().
955         * platform/network/cf/NetworkStorageSessionCFNet.cpp:
956         (WebCore::NetworkStorageSession::setPrevalentDomainsToPartitionOrBlockCookies):
957             Fixes the FIXME.
958
959 2018-01-17  Daniel Bates  <dabates@apple.com>
960
961         REGRESSION (r222795): Cardiogram never signs in
962         https://bugs.webkit.org/show_bug.cgi?id=181693
963         <rdar://problem/36286293>
964
965         Reviewed by Ryosuke Niwa.
966
967         Exempt Cardiogram from the XHR header restrictions in r222795.
968
969         Following r222795 only Dashboard widgets are allowed to set arbitrary XHR headers.
970         However Cardiogram also depends on such functionality.
971
972         Test: fast/xmlhttprequest/set-dangerous-headers-from-file-when-setting-enabled.html
973
974         * page/Settings.yaml:
975         * platform/RuntimeApplicationChecks.h:
976         * platform/cocoa/RuntimeApplicationChecksCocoa.mm:
977         (WebCore::IOSApplication::isCardiogram):
978         * xml/XMLHttpRequest.cpp:
979         (WebCore::XMLHttpRequest::setRequestHeader):
980
981 2018-01-17  Daniel Bates  <dabates@apple.com>
982
983         ASSERTION FAILED: !m_completionHandler in PingHandle::~PingHandle()
984         https://bugs.webkit.org/show_bug.cgi?id=181746
985         <rdar://problem/36586248>
986
987         Reviewed by Chris Dumez.
988
989         Call PingHandle::pingLoadComplete() with an error when NSURLConnection queries
990         whether the ping is able to respond to an authentication request. (Pings do not
991         respond to authenticate requests.) It will call the completion handler, nullify
992         the completion handler, and deallocate the PingHandle. Nullifying the completion
993         handler is necessary to avoid the assertion failure in ~PingHandle().
994
995         Test: http/tests/misc/before-unload-load-image.html
996
997         * platform/network/PingHandle.h:
998
999 2018-01-17  Daniel Bates  <dabates@apple.com>
1000
1001         WebCoreResourceHandleAsOperationQueueDelegate/ResourceHandleCFURLConnectionDelegateWithOperationQueue may
1002         be deleted in main thread callback
1003         https://bugs.webkit.org/show_bug.cgi?id=181747
1004         <rdar://problem/36588120>
1005
1006         Reviewed by Alex Christensen.
1007
1008         Retain the delegate (e.g. WebCoreResourceHandleAsOperationQueueDelegate) before scheduling
1009         a main thread callback and blocking on a semaphore for its reply because the main thread
1010         callback can do anything, including deleting the delegate, before the non-main thread
1011         has a chance to execute. For instance, a PingHandle will delete itself (and hence delete
1012         its resource handle delegate) in most of the code paths invoked by the delegate.
1013
1014         * platform/network/cf/ResourceHandleCFURLConnectionDelegateWithOperationQueue.cpp:
1015         (WebCore::ResourceHandleCFURLConnectionDelegateWithOperationQueue::willSendRequest):
1016         (WebCore::ResourceHandleCFURLConnectionDelegateWithOperationQueue::didReceiveResponse):
1017         (WebCore::ResourceHandleCFURLConnectionDelegateWithOperationQueue::willCacheResponse):
1018         (WebCore::ResourceHandleCFURLConnectionDelegateWithOperationQueue::canRespondToProtectionSpace):
1019         * platform/network/mac/WebCoreResourceHandleAsOperationQueueDelegate.mm:
1020         (-[WebCoreResourceHandleAsOperationQueueDelegate connection:willSendRequest:redirectResponse:]):
1021         (-[WebCoreResourceHandleAsOperationQueueDelegate connection:canAuthenticateAgainstProtectionSpace:]):
1022         (-[WebCoreResourceHandleAsOperationQueueDelegate connection:didReceiveResponse:]):
1023         (-[WebCoreResourceHandleAsOperationQueueDelegate connection:willCacheResponse:]):
1024
1025 2018-01-17  Chris Dumez  <cdumez@apple.com>
1026
1027         'fetch' event may be sent to a service worker before its state is set to 'activated'
1028         https://bugs.webkit.org/show_bug.cgi?id=181698
1029         <rdar://problem/36554856>
1030
1031         Reviewed by Youenn Fablet.
1032
1033         'fetch' event may be sent to a service worker before its state is set to 'activated'.
1034         When the registration's active worker needs to intercept a load, and its state is 'activating',
1035         we queue the request to send the fetch event in SWServerWorker::m_whenActivatedHandlers.
1036         Once the SWServerWorker::setState() is called with 'activated' state, we then call the
1037         handlers in m_whenActivatedHandlers to make send the fetch event now that the worker is
1038         activated. The issue is that even though the worker is activated and its state was set to
1039         'activated' on Storage process side, we had not yet notified the ServiceWorker process
1040         of the service worker's new state yet.
1041
1042         To address the issue, we now make sure that SWServerWorker::m_whenActivatedHandlers are
1043         called *after* we've sent the IPC to the ServiceWorker process to update the worker's
1044         state to 'activated'. Also, we now call ServiceWorkerFetch::dispatchFetchEvent()
1045         asynchronously in a postTask() as the service worker's state is also updated asynchronously
1046         in a postTask. This is as per specification [1], which says to "queue a task" to fire
1047         the fetch event.
1048
1049         [1] https://w3c.github.io/ServiceWorker/#on-fetch-request-algorithm (step 18)
1050
1051         No new tests, covered by imported/w3c/web-platform-tests/service-workers/service-worker/fetch-waits-for-activate.https.html
1052         which hits the new assertion without the fix.
1053
1054         * workers/service/context/ServiceWorkerFetch.cpp:
1055         (WebCore::ServiceWorkerFetch::dispatchFetchEvent):
1056         Add assertions to make sure that we dispatch the fetch event on the right worker and
1057         that the worker is in 'activated' state.
1058
1059         * workers/service/context/ServiceWorkerThread.cpp:
1060         (WebCore::ServiceWorkerThread::postFetchTask):
1061         Queue a task to fire the fetch event as per:
1062         - https://w3c.github.io/ServiceWorker/#on-fetch-request-algorithm (step 18)
1063         We need to match the specification exactly here or things will happen in the wrong
1064         order. In particular, things like "update registration state" and "update worker state"
1065         might happen *after* firing the fetch event, even though the IPC for "update registration/worker
1066         state" was sent before the "fire fetch event" one, because the code for updating a registration/
1067         worker state already queues a task, as per the specification.
1068
1069         * workers/service/server/SWServerRegistration.cpp:
1070         (WebCore::SWServerRegistration::updateWorkerState):
1071         * workers/service/server/SWServerRegistration.h:
1072         * workers/service/server/SWServerWorker.cpp:
1073         (WebCore::SWServerWorker::setState):
1074         Move code to send the IPC to the Service Worker process whenever the service worker's state
1075         needs to be updated from SWServerRegistration::updateWorkerState() to SWServerWorker::setState().
1076         This way, we can make sure the IPC is sent *before* we call the m_whenActivatedHandlers handlers,
1077         as they may also send IPC to the Service Worker process, and we need to make sure this IPC happens
1078         after so that the service worker is in the right state.
1079
1080 2018-01-17  Stephan Szabo  <stephan.szabo@sony.com>
1081
1082         Page.cpp only sees forward declaration of ApplicationStateChangeListener when ENABLE(VIDEO) is off
1083         https://bugs.webkit.org/show_bug.cgi?id=181713
1084
1085         Reviewed by Darin Adler.
1086
1087         No new tests (build fix).
1088
1089         * page/Page.cpp: Add include for ApplicationStateChangeListener
1090
1091 2018-01-17  Wenson Hsieh  <wenson_hsieh@apple.com>
1092
1093         Add injected bundle SPI to replace subresource URLs when dropping or pasting rich content
1094         https://bugs.webkit.org/show_bug.cgi?id=181637
1095         <rdar://problem/36508471>
1096
1097         Reviewed by Tim Horton.
1098
1099         Before carrying out blob URL conversion for pasted or dropped rich content, let the editor client replace
1100         subresource URLs in WebKit2 by calling out to new injected bundle SPI. See comments below for more detail.
1101
1102         Tests:  WKAttachmentTests.InjectedBundleReplaceURLsWhenPastingAttributedString
1103                 WKAttachmentTests.InjectedBundleReplaceURLWhenPastingImage
1104
1105         * editing/Editor.cpp:
1106         (WebCore::Editor::clientReplacementURLForResource):
1107         * editing/Editor.h:
1108
1109         Add a new helper to call out to the editor client for a URL string to replace a given ArchiveResource. In
1110         WebKit2, this calls out to the injected bundle's new `replacementURLForResource` SPI hook.
1111
1112         * editing/cocoa/WebContentReaderCocoa.mm:
1113         (WebCore::shouldReplaceSubresourceURL):
1114         (WebCore::replaceRichContentWithAttachments):
1115         (WebCore::replaceSubresourceURLsWithURLsFromClient):
1116
1117         Add a new static helper to replace subresource URLs in the given DocumentFragment with URLs supplied by the
1118         editor client. Additionally builds a list of ArchiveResources that have not been replaced, for use at call sites
1119         so that we don't unnecessarily create more Blobs for ArchiveResources that have already been replaced.
1120
1121         (WebCore::createFragmentAndAddResources):
1122         (WebCore::sanitizeMarkupWithArchive):
1123
1124         Tweak web content reading codepaths to first replace subresource URLs with editor-client-supplied URLs.
1125
1126         (WebCore::WebContentReader::readImage):
1127         (WebCore::shouldConvertToBlob): Deleted.
1128
1129         Rename this helper to shouldReplaceSubresourceURL, blob URL replacement is no longer the only scenario in which
1130         we replace resource URLs, but in both cases, we still want to ignore `http:`-family and `data:` URLs.
1131
1132         * loader/EmptyClients.cpp:
1133         * page/EditorClient.h:
1134
1135 2018-01-17  Yacine Bandou  <yacine.bandou_ext@softathome.com>
1136         [EME][GStreamer] Add the full-sample encryption support in the GStreamer ClearKey decryptor
1137         https://bugs.webkit.org/show_bug.cgi?id=180080
1138
1139         Reviewed by Xabier Rodriguez-Calvar.
1140
1141         Currently the GStreamer clearKey decryptor doesn't support the full-sample encryption,
1142         where the buffer is entirely encrypted, it supports only the sub-sample encryption.
1143
1144         Test: media/encrypted-media/clearKey/clearKey-cenc-audio-playback-mse.html
1145
1146         * platform/graphics/gstreamer/eme/WebKitClearKeyDecryptorGStreamer.cpp:
1147         (webKitMediaClearKeyDecryptorDecrypt):
1148
1149 2018-01-17  Zan Dobersek  <zdobersek@igalia.com>
1150
1151         Unreviewed follow-up to r227051.
1152
1153         * platform/graphics/cairo/CairoOperations.h: Fix declaration of the
1154         fillRoundedRect() function by removing the bool parameter that's not
1155         used at all in the definition. This went unspotted due to the unified
1156         source build including the implementation file before fillRoundedRect()
1157         usage in GrapihcsContextCairo.cpp, leaving the declaration undefined
1158         and instead using the definition directly.
1159
1160 2018-01-17  Zan Dobersek  <zdobersek@igalia.com>
1161
1162         [Cairo] Don't mirror global alpha and image interpolation quality state values in PlatformContextCairo
1163         https://bugs.webkit.org/show_bug.cgi?id=181725
1164
1165         Reviewed by Carlos Garcia Campos.
1166
1167         Don't duplicate global alpha and image interpolation quality state
1168         values on the PlatformContextCairo. Instead, retrieve them from
1169         the managing GraphicsContextState when necessary.
1170
1171         For Cairo operations, the FillSource and StrokeSource containers now
1172         store the global alpha value, using it during the operation executions.
1173         For drawNativeImage(), the global alpha and interpolation quality values
1174         are passed through arguments.
1175
1176         In PlatformContextCairo, the two values are no longer stored on the
1177         internally-managed stack, and the getter-setter pairs for the two values
1178         are removed. In drawSurfaceToContext(), the two values are now expected
1179         to be passed through the method arguments.
1180
1181         No new tests -- no change in behavior.
1182
1183         * platform/graphics/cairo/CairoOperations.cpp:
1184         (WebCore::Cairo::prepareForFilling):
1185         (WebCore::Cairo::prepareForStroking):
1186         (WebCore::Cairo::drawPathShadow):
1187         (WebCore::Cairo::fillCurrentCairoPath):
1188         (WebCore::Cairo::FillSource::FillSource):
1189         (WebCore::Cairo::StrokeSource::StrokeSource):
1190         (WebCore::Cairo::strokeRect):
1191         (WebCore::Cairo::strokePath):
1192         (WebCore::Cairo::drawGlyphs):
1193         (WebCore::Cairo::drawNativeImage):
1194         (WebCore::Cairo::State::setGlobalAlpha): Deleted.
1195         (WebCore::Cairo::State::setImageInterpolationQuality): Deleted.
1196         * platform/graphics/cairo/CairoOperations.h:
1197         * platform/graphics/cairo/GraphicsContextCairo.cpp:
1198         (WebCore::GraphicsContext::drawNativeImage):
1199         (WebCore::GraphicsContext::setPlatformAlpha):
1200         (WebCore::GraphicsContext::setPlatformImageInterpolationQuality):
1201         * platform/graphics/cairo/PlatformContextCairo.cpp:
1202         (WebCore::PlatformContextCairo::save):
1203         (WebCore::PlatformContextCairo::drawSurfaceToContext):
1204         (WebCore::PlatformContextCairo::State::State): Deleted.
1205         (WebCore::PlatformContextCairo::setImageInterpolationQuality): Deleted.
1206         (WebCore::PlatformContextCairo::imageInterpolationQuality const): Deleted.
1207         (WebCore::PlatformContextCairo::globalAlpha const): Deleted.
1208         (WebCore::PlatformContextCairo::setGlobalAlpha): Deleted.
1209         * platform/graphics/cairo/PlatformContextCairo.h:
1210         * platform/graphics/win/MediaPlayerPrivateMediaFoundation.cpp:
1211         (WebCore::MediaPlayerPrivateMediaFoundation::Direct3DPresenter::paintCurrentFrame):
1212
1213 2018-01-17  Philippe Normand  <pnormand@igalia.com>
1214
1215         REGRESSION(r226973/r226974): Four multimedia tests failing
1216         https://bugs.webkit.org/show_bug.cgi?id=181696
1217
1218         Reviewed by Carlos Garcia Campos.
1219
1220         This patch reverts some of the changes of the above revisions so as to fix layout test failures.
1221
1222         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:
1223         (WebCore::MediaPlayerPrivateGStreamer::handleMessage): Properly
1224         prepare stalled event when an error was detected.
1225         (WebCore::MediaPlayerPrivateGStreamer::processBufferingStats): Revert to previous version.
1226         (WebCore::MediaPlayerPrivateGStreamer::fillTimerFired): Ditto.
1227         (WebCore::MediaPlayerPrivateGStreamer::didLoadingProgress const):
1228         Emit progress event also when streaming but not when an error was
1229         detected.
1230         (WebCore::MediaPlayerPrivateGStreamer::totalBytes const): use isLiveStream like everywhere else.
1231         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.h:
1232         * platform/graphics/gstreamer/WebKitWebSourceGStreamer.cpp:
1233         (webkit_web_src_init): Revert to keep-alive FALSE by default.
1234
1235 2018-01-17  Zan Dobersek  <zdobersek@igalia.com>
1236
1237         [Cairo] Move prepareForFilling(), prepareForStroking() code to CairoOperations
1238         https://bugs.webkit.org/show_bug.cgi?id=181721
1239
1240         Reviewed by Carlos Garcia Campos.
1241
1242         Move the prepareForFilling() and prepareForStroking() code off of the
1243         PlatformContextCairo class and into static functions inside the
1244         CairoOperations implementation files. The original methods weren't
1245         called from any place other than the Cairo operations, and they only
1246         operated with the cairo_t object that's stored in and retrievable from
1247         the PlatformContextCairo object.
1248
1249         No new tests -- no change in behavior.
1250
1251         * platform/graphics/cairo/CairoOperations.cpp:
1252         (WebCore::Cairo::reduceSourceByAlpha):
1253         (WebCore::Cairo::prepareCairoContextSource):
1254         (WebCore::Cairo::clipForPatternFilling):
1255         (WebCore::Cairo::prepareForFilling):
1256         (WebCore::Cairo::prepareForStroking):
1257         (WebCore::Cairo::drawPathShadow):
1258         (WebCore::Cairo::fillCurrentCairoPath):
1259         (WebCore::Cairo::strokeRect):
1260         (WebCore::Cairo::strokePath):
1261         (WebCore::Cairo::drawGlyphs):
1262         * platform/graphics/cairo/PlatformContextCairo.cpp:
1263         (WebCore::reduceSourceByAlpha): Deleted.
1264         (WebCore::prepareCairoContextSource): Deleted.
1265         (WebCore::PlatformContextCairo::prepareForFilling): Deleted.
1266         (WebCore::PlatformContextCairo::prepareForStroking): Deleted.
1267         (WebCore::PlatformContextCairo::clipForPatternFilling): Deleted.
1268         * platform/graphics/cairo/PlatformContextCairo.h:
1269
1270 2018-01-17  Zan Dobersek  <zdobersek@igalia.com>
1271
1272         [Cairo] Use one-time ShadowBlur objects when performing shadowing
1273         https://bugs.webkit.org/show_bug.cgi?id=181720
1274
1275         Reviewed by Carlos Garcia Campos.
1276
1277         Don't maintain a ShadowBlur object in the PlatformContextCairo class.
1278         Instead, use temporary ShadowBlur objects whenever shadowing is needed,
1279         providing all the shadow state information to it and drawing shadow into
1280         the given GraphicsContext object.
1281
1282         ShadowBlur constructors are cleaned up. The 'shadows ignored' argument
1283         can now also be provided to the variant that accepts explicit shadow
1284         attributes, but the argument is false by default.
1285
1286         In CairoOperations, the ShadowBlurUsage functionality is rolled into the
1287         new ShadowState class. ShadowState parameter is now used for operations
1288         that might need to perform shadow painting. Call sites are modified
1289         accordingly.
1290
1291         Cairo::State::setShadowValues() and Cairo::State::clearShadow() are
1292         removed, since the ShadowBlur object that was modified through those is
1293         being removed from the PlatformContextCairo class. We still have to flip
1294         the Y-axis of the shadow offset in GraphicsContext::setPlatformShadow()
1295         when shadows are ignoring transformations.
1296
1297         No new tests -- no change in behavior.
1298
1299         * platform/graphics/ShadowBlur.cpp:
1300         (WebCore::ShadowBlur::ShadowBlur):
1301         * platform/graphics/ShadowBlur.h:
1302         * platform/graphics/cairo/CairoOperations.cpp:
1303         (WebCore::Cairo::drawPathShadow):
1304         (WebCore::Cairo::drawGlyphsShadow):
1305         (WebCore::Cairo::ShadowState::ShadowState):
1306         (WebCore::Cairo::ShadowState::isVisible const):
1307         (WebCore::Cairo::ShadowState::isRequired const):
1308         (WebCore::Cairo::fillRect):
1309         (WebCore::Cairo::fillRoundedRect):
1310         (WebCore::Cairo::fillRectWithRoundedHole):
1311         (WebCore::Cairo::fillPath):
1312         (WebCore::Cairo::strokeRect):
1313         (WebCore::Cairo::strokePath):
1314         (WebCore::Cairo::drawGlyphs):
1315         (WebCore::Cairo::drawNativeImage):
1316         (WebCore::Cairo::State::setShadowValues): Deleted.
1317         (WebCore::Cairo::State::clearShadow): Deleted.
1318         (WebCore::Cairo::ShadowBlurUsage::ShadowBlurUsage): Deleted.
1319         (WebCore::Cairo::ShadowBlurUsage::required const): Deleted.
1320         * platform/graphics/cairo/CairoOperations.h:
1321         * platform/graphics/cairo/FontCairo.cpp:
1322         (WebCore::FontCascade::drawGlyphs):
1323         * platform/graphics/cairo/GraphicsContextCairo.cpp:
1324         (WebCore::GraphicsContext::restorePlatformState):
1325         (WebCore::GraphicsContext::drawNativeImage):
1326         (WebCore::GraphicsContext::fillPath):
1327         (WebCore::GraphicsContext::strokePath):
1328         (WebCore::GraphicsContext::fillRect):
1329         (WebCore::GraphicsContext::setPlatformShadow):
1330         (WebCore::GraphicsContext::clearPlatformShadow):
1331         (WebCore::GraphicsContext::strokeRect):
1332         (WebCore::GraphicsContext::platformFillRoundedRect):
1333         (WebCore::GraphicsContext::fillRectWithRoundedHole):
1334         * platform/graphics/cairo/PlatformContextCairo.cpp:
1335         (WebCore::PlatformContextCairo::drawSurfaceToContext):
1336         * platform/graphics/cairo/PlatformContextCairo.h:
1337         (WebCore::PlatformContextCairo::shadowBlur): Deleted.
1338         * platform/graphics/win/MediaPlayerPrivateMediaFoundation.cpp:
1339         (WebCore::MediaPlayerPrivateMediaFoundation::Direct3DPresenter::paintCurrentFrame):
1340
1341 2018-01-17  Zan Dobersek  <zdobersek@igalia.com>
1342
1343         CanvasImageData: createImageData() parameter should not be nullable
1344         https://bugs.webkit.org/show_bug.cgi?id=181670
1345
1346         Reviewed by Sam Weinig.
1347
1348         createImageData() method on the CanvasImageData interface should not
1349         treat the ImageData parameter as nullable, but should instead reject any
1350         null values with a TypeError, as demanded by the specification.
1351
1352         No new tests -- current tests covering createImageData(null) are updated
1353         to properly cover new behavior of throwing a TypeError exception.
1354
1355         * html/canvas/CanvasImageData.idl:
1356         * html/canvas/CanvasRenderingContext2DBase.cpp:
1357         (WebCore::CanvasRenderingContext2DBase::createImageData const):
1358         * html/canvas/CanvasRenderingContext2DBase.h:
1359
1360 2018-01-16  Fujii Hironori  <Hironori.Fujii@sony.com>
1361
1362         [CMake] Remove WebCoreDerivedSources library target
1363         https://bugs.webkit.org/show_bug.cgi?id=181664
1364
1365         Reviewed by Carlos Garcia Campos.
1366
1367         After unified source build has been introduced, CMake Visual
1368         Studio build suffers complicated unnecessary recompilation issues
1369         because Visual Studio invokes scripts twice in both WebCore and
1370         WebCoreDerivedSources projects (Bug 181117).
1371
1372         WebCoreDerivedSources library has been introduced in r198766 to
1373         avoid command line length limit of CMake Ninja build on macOS.
1374         Fortunately, unified source build has reduced the number of source
1375         files to compile, WebCore doesn't need to be split anymore.
1376
1377         No new tests (No behavior change)
1378
1379         * CMakeLists.txt: Replaced WebCore_DERIVED_SOURCES with WebCore_SOURCES. Removed WebCoreDerivedSources library target.
1380         Do not compile each JavaScript Builtins.cpp files because the unified source WebCoreJSBuiltins.cpp is already included.
1381         * PlatformGTK.cmake: Replaced WebCore_DERIVED_SOURCES with WebCore_SOURCES.
1382         * PlatformWin.cmake: Ditto.
1383
1384 2018-01-16  Simon Fraser  <simon.fraser@apple.com>
1385
1386         Can't scroll iframe after toggling it to display:none and back
1387         https://bugs.webkit.org/show_bug.cgi?id=181708
1388         rdar://problem/13234778
1389
1390         Reviewed by Tim Horton.
1391
1392         Nothing updated the FrameView's set of scrollable areas when a subframe came back from display:none.
1393         Mirror the existing virtual removeChild() by making addChild() virtual, and using it to mark
1394         the FrameView's scrollable area set as dirty.
1395
1396         Test: tiled-drawing/scrolling/non-fast-region/non-fast-scrollable-region-hide-show-iframe.html
1397
1398         * page/FrameView.cpp:
1399         (WebCore::FrameView::addChild):
1400         * page/FrameView.h:
1401         * platform/ScrollView.h:
1402
1403 2018-01-16  Chris Dumez  <cdumez@apple.com>
1404
1405         SWServerWorker::m_contextConnectionIdentifier may get out of date
1406         https://bugs.webkit.org/show_bug.cgi?id=181687
1407         <rdar://problem/36548111>
1408
1409         Reviewed by Brady Eidson.
1410
1411         SWServerWorker::m_contextConnectionIdentifier may get out of date. This happens when the
1412         context process crashes and is relaunched.
1413
1414         No new tests, added assertion in terminateWorkerInternal() that hits without this fix.
1415
1416         * workers/service/server/SWServer.cpp:
1417         (WebCore::SWServer::runServiceWorker):
1418         (WebCore::SWServer::terminateWorkerInternal):
1419         (WebCore::SWServer::unregisterServiceWorkerClient):
1420         * workers/service/server/SWServerWorker.h:
1421         (WebCore::SWServerWorker::setContextConnectionIdentifier):
1422
1423 2018-01-16  Jer Noble  <jer.noble@apple.com>
1424
1425         Reset MediaSourcePrivateAVFObjC's m_sourceBufferWithSelectedVideo when the underlying SourceBufferPrivate is removed.
1426         https://bugs.webkit.org/show_bug.cgi?id=181707
1427         <rdar://problem/34809474>
1428
1429         Reviewed by Eric Carlson.
1430
1431         Test: media/media-source/media-source-remove-unload-crash.html
1432
1433         * platform/graphics/avfoundation/objc/MediaSourcePrivateAVFObjC.mm:
1434         (WebCore::MediaSourcePrivateAVFObjC::removeSourceBuffer):
1435
1436 2018-01-12  Jiewen Tan  <jiewen_tan@apple.com>
1437
1438         [WebAuthN] Implement dummy WebAuthN IDLs
1439         https://bugs.webkit.org/show_bug.cgi?id=181627
1440         <rdar://problem/36459864>
1441
1442         Reviewed by Alex Christensen.
1443
1444         This patch implements dummy WebAuthN IDLs and connect them with Credential Management as well.
1445         All implementations in this patch are subject to change when real implementations land. The
1446         purpose here on the other hand is to have IDLs, bindings and implementations connected. This
1447         patch should handle all IDLs that we need.
1448
1449         No tests.
1450
1451         * CMakeLists.txt:
1452         * DerivedSources.make:
1453         * Modules/credentialmanagement/CredentialCreationOptions.h:
1454         * Modules/credentialmanagement/CredentialCreationOptions.idl:
1455         * Modules/credentialmanagement/CredentialRequestOptions.h:
1456         * Modules/credentialmanagement/CredentialRequestOptions.idl:
1457         * Modules/webauthn/AuthenticatorAssertionResponse.cpp: Copied from Source/WebCore/Modules/webauthn/PublicKeyCredential.cpp.
1458         (WebCore::AuthenticatorAssertionResponse::AuthenticatorAssertionResponse):
1459         (WebCore::AuthenticatorAssertionResponse::~AuthenticatorAssertionResponse):
1460         (WebCore::AuthenticatorAssertionResponse::authenticatorData):
1461         (WebCore::AuthenticatorAssertionResponse::signature):
1462         (WebCore::AuthenticatorAssertionResponse::userHandle):
1463         * Modules/webauthn/AuthenticatorAssertionResponse.h: Copied from Source/WebCore/Modules/credentialmanagement/CredentialRequestOptions.h.
1464         * Modules/webauthn/AuthenticatorAssertionResponse.idl: Copied from Source/WebCore/Modules/webauthn/PublicKeyCredential.idl.
1465         * Modules/webauthn/AuthenticatorAttestationResponse.cpp: Copied from Source/WebCore/Modules/credentialmanagement/CredentialCreationOptions.h.
1466         (WebCore::AuthenticatorAttestationResponse::AuthenticatorAttestationResponse):
1467         (WebCore::AuthenticatorAttestationResponse::~AuthenticatorAttestationResponse):
1468         (WebCore::AuthenticatorAttestationResponse::attestationObject):
1469         * Modules/webauthn/AuthenticatorAttestationResponse.h: Copied from Source/WebCore/Modules/credentialmanagement/CredentialRequestOptions.h.
1470         * Modules/webauthn/AuthenticatorAttestationResponse.idl: Copied from Source/WebCore/Modules/webauthn/PublicKeyCredential.idl.
1471         * Modules/webauthn/AuthenticatorResponse.cpp: Copied from Source/WebCore/Modules/credentialmanagement/CredentialCreationOptions.h.
1472         (WebCore::AuthenticatorResponse::AuthenticatorResponse):
1473         (WebCore::AuthenticatorResponse::~AuthenticatorResponse):
1474         (WebCore::AuthenticatorResponse::clientDataJSON):
1475         * Modules/webauthn/AuthenticatorResponse.h: Copied from Source/WebCore/Modules/credentialmanagement/CredentialRequestOptions.h.
1476         * Modules/webauthn/AuthenticatorResponse.idl: Copied from Source/WebCore/Modules/webauthn/PublicKeyCredential.idl.
1477         * Modules/webauthn/PublicKeyCredential.cpp:
1478         (WebCore::PublicKeyCredential::rawId):
1479         (WebCore::PublicKeyCredential::response):
1480         (WebCore::PublicKeyCredential::getClientExtensionResults):
1481         (WebCore::PublicKeyCredential::isUserVerifyingPlatformAuthenticatorAvailable):
1482         * Modules/webauthn/PublicKeyCredential.h:
1483         * Modules/webauthn/PublicKeyCredential.idl:
1484         * Modules/webauthn/PublicKeyCredentialCreationOptions.h: Copied from Source/WebCore/Modules/credentialmanagement/CredentialRequestOptions.h.
1485         * Modules/webauthn/PublicKeyCredentialCreationOptions.idl: Added.
1486         * Modules/webauthn/PublicKeyCredentialDescriptor.h: Copied from Source/WebCore/Modules/credentialmanagement/CredentialCreationOptions.h.
1487         * Modules/webauthn/PublicKeyCredentialDescriptor.idl: Copied from Source/WebCore/Modules/webauthn/PublicKeyCredential.idl.
1488         * Modules/webauthn/PublicKeyCredentialRequestOptions.h: Copied from Source/WebCore/Modules/credentialmanagement/CredentialCreationOptions.h.
1489         * Modules/webauthn/PublicKeyCredentialRequestOptions.idl: Copied from Source/WebCore/Modules/credentialmanagement/CredentialRequestOptions.h.
1490         * Modules/webauthn/PublicKeyCredentialType.h: Copied from Source/WebCore/Modules/webauthn/PublicKeyCredential.idl.
1491         * Modules/webauthn/PublicKeyCredentialType.idl: Copied from Source/WebCore/Modules/webauthn/PublicKeyCredential.idl.
1492         * Sources.txt:
1493         * WebCore.xcodeproj/project.pbxproj:
1494         * bindings/js/WebCoreBuiltinNames.h:
1495
1496 2018-01-16  Zalan Bujtas  <zalan@apple.com>
1497
1498         AX: Do not trigger layout in updateBackingStore() unless it is safe to do so
1499         https://bugs.webkit.org/show_bug.cgi?id=181703
1500         <rdar://problem/36365706>
1501
1502         Reviewed by Ryosuke Niwa.
1503
1504         Document::isSafeToUpdateStyleOrLayout() can tell whether it is safe to run layout.
1505
1506         Unable to create test with WebInspector involved. 
1507
1508         * accessibility/AccessibilityObject.cpp:
1509         (WebCore::AccessibilityObject::updateBackingStore):
1510         * dom/Document.cpp:
1511         (WebCore::Document::isSafeToUpdateStyleOrLayout const):
1512         (WebCore::Document::updateStyleIfNeeded):
1513         (WebCore::Document::updateLayout):
1514         (WebCore::isSafeToUpdateStyleOrLayout): Deleted.
1515         * dom/Document.h:
1516
1517 2018-01-16  Ryan Haddad  <ryanhaddad@apple.com>
1518
1519         Unreviewed, rolling out r226962.
1520
1521         The LayoutTest added with this change is a flaky timeout.
1522
1523         Reverted changeset:
1524
1525         "Support for preconnect Link headers"
1526         https://bugs.webkit.org/show_bug.cgi?id=181657
1527         https://trac.webkit.org/changeset/226962
1528
1529 2018-01-16  Simon Fraser  <simon.fraser@apple.com>
1530
1531         Text looks bad on some CSS spec pages
1532         https://bugs.webkit.org/show_bug.cgi?id=181700
1533         rdar://problem/36552107
1534
1535         Reviewed by Tim Horton.
1536
1537         When making new tiles in a TileController, we failed to set their "supports antialiased layer text"
1538         setting, so tile caches could end up with a mixture of layers that do and do not support
1539         antialiased layer text.
1540
1541         No tests because the tiled drawing tests don't dump out tiles inside of tile caches.
1542
1543         * platform/graphics/ca/TileController.cpp:
1544         (WebCore::TileController::createTileLayer):
1545
1546 2018-01-16  Said Abou-Hallawa  <sabouhallawa@apple.com>
1547
1548         REGRESSION(r221292): svg/animations/animateTransform-pattern-transform.html crashes with security assertion
1549         https://bugs.webkit.org/show_bug.cgi?id=179986
1550
1551         Reviewed by Simon Fraser.
1552
1553         This patch reverts all or parts of the following changes-sets
1554             <http://trac.webkit.org/changeset/221292>
1555             <http://trac.webkit.org/changeset/197967>
1556             <http://trac.webkit.org/changeset/196670>
1557
1558         A JS statement like this:
1559             var item = text.x.animVal.getItem(0);
1560
1561         Creates the following C++ objects:
1562             SVGAnimatedListPropertyTearOff<SVGLengthListValues> for 'text.x'
1563             SVGListPropertyTearOff<SVGLengthListValues> for 'text.x.animVal'
1564             SVGPropertyTearOff<SVGLengthValue> for 'text.x.animVal.getItem(0)'
1565
1566         If 'item' changes, the attribute 'x' of the element '<text>' will change
1567         as well. But this binding works only in one direction. If the attribute
1568         'x' of the element '<text>' changes, e.g.:
1569
1570             text.setAttribute('x', '10,20,30');
1571
1572         This will detach 'item' from the element <text> and any further changes 
1573         in 'item' won't affect the attribute 'x' of element <text>.
1574
1575         The one direction binding can only work if this chain of tear-off objects
1576         is kept connected. This is implemented by RefCounted back pointers from
1577         SVGPropertyTearOff and SVGListPropertyTearOff to SVGAnimatedListPropertyTearOff.
1578
1579         The security crashes and the memory leaks are happening because of the
1580         raw forward pointers:
1581             -- SVGAnimatedListPropertyTearOff maintains raw pointers of type
1582                SVGListPropertyTearOff for m_baseVal and m_animVal
1583             -- The m_wrappers and m_animatedWrappers of SVGAnimatedListPropertyTearOff
1584                are vectors of raw pointer Vector<SVGLength*>
1585
1586         To control the life cycle of the raw pointers, SVGListPropertyTearOff and
1587         SVGPropertyTearOff call SVGAnimatedListPropertyTearOff::propertyWillBeDeleted()
1588         to notify it they are going to be deleted. In propertyWillBeDeleted(), we
1589         clear the pointers so they are not used after being freed. This mechanism
1590         has been error-prone and we've never got it 100% right.
1591
1592         The solution we need to adopt with SVG tear-off objects is the following:
1593             -- All the forward pointers should be weak pointers.
1594             -- All the back pointers should be ref pointers.
1595
1596         This solution may not look intuitive but it solves the bugs and keeps the
1597         one direction binding. The forward weak pointers allows the tear-off
1598         objects to go aways if no reference from JS exists. The back ref pointers
1599         maintains the chain of objects and guarantees the correct binding.
1600
1601         * svg/SVGPathSegList.h:
1602         * svg/SVGTransformList.h:
1603         * svg/properties/SVGAnimatedListPropertyTearOff.h:
1604         (WebCore::SVGAnimatedListPropertyTearOff::baseVal):
1605         (WebCore::SVGAnimatedListPropertyTearOff::animVal):
1606         * svg/properties/SVGAnimatedPathSegListPropertyTearOff.h:
1607         * svg/properties/SVGAnimatedProperty.h:
1608         (WebCore::SVGAnimatedProperty::isAnimatedListTearOff const):
1609         (WebCore::SVGAnimatedProperty::propertyWillBeDeleted): Deleted.
1610         * svg/properties/SVGAnimatedPropertyTearOff.h:
1611         * svg/properties/SVGAnimatedTransformListPropertyTearOff.h:
1612         * svg/properties/SVGListProperty.h:
1613         (WebCore::SVGListProperty::initializeValuesAndWrappers):
1614         (WebCore::SVGListProperty::getItemValuesAndWrappers):
1615         (WebCore::SVGListProperty::insertItemBeforeValuesAndWrappers):
1616         (WebCore::SVGListProperty::replaceItemValuesAndWrappers):
1617         (WebCore::SVGListProperty::removeItemValuesAndWrappers):
1618         (WebCore::SVGListProperty::appendItemValuesAndWrappers):
1619         (WebCore::SVGListProperty::createWeakPtr const):
1620         * svg/properties/SVGListPropertyTearOff.h:
1621         (WebCore::SVGListPropertyTearOff::removeItemFromList):
1622         (WebCore::SVGListPropertyTearOff::~SVGListPropertyTearOff): Deleted.
1623         * svg/properties/SVGPropertyTearOff.h:
1624         (WebCore::SVGPropertyTearOff::createWeakPtr const):
1625         (WebCore::SVGPropertyTearOff::~SVGPropertyTearOff):
1626
1627 2018-01-16  Eric Carlson  <eric.carlson@apple.com>
1628
1629         AVSampleBufferDisplayLayer should be flushed when application activates
1630         https://bugs.webkit.org/show_bug.cgi?id=181623
1631         <rdar://problem/36487738>
1632
1633         Reviewed by Darin Adler.
1634
1635         No new tests, I wasn't able to reproduce it in a test.
1636
1637         * WebCore.xcodeproj/project.pbxproj:
1638         * dom/Document.cpp:
1639         (WebCore::Document::addApplicationStateChangeListener): New.
1640         (WebCore::Document::removeApplicationStateChangeListener): Ditto.
1641         (WebCore::Document::forEachApplicationStateChangeListener): Ditto.
1642         * dom/Document.h:
1643
1644         * html/HTMLMediaElement.cpp:
1645         (WebCore::HTMLMediaElement::registerWithDocument): Register for application state changes.
1646         (WebCore::HTMLMediaElement::unregisterWithDocument): Unregister.
1647         (WebCore::HTMLMediaElement::applicationWillResignActive): Pass through to the player.
1648         (WebCore::HTMLMediaElement::applicationDidBecomeActive): Ditto.
1649         * html/HTMLMediaElement.h:
1650
1651         * page/ApplicationStateChangeListener.h: Added.
1652         (WebCore::ApplicationStateChangeListener::applicationWillResignActive):
1653         (WebCore::ApplicationStateChangeListener::applicationDidBecomeActive):
1654         * page/Page.cpp:
1655         (WebCore::Page::forEachDocument):
1656         (WebCore::Page::applicationWillResignActive):
1657         (WebCore::Page::applicationDidEnterBackground):
1658         (WebCore::Page::applicationWillEnterForeground):
1659         (WebCore::Page::applicationDidBecomeActive):
1660         * page/Page.h:
1661         * platform/graphics/MediaPlayer.cpp:
1662         (WebCore::MediaPlayer::applicationWillResignActive):
1663         (WebCore::MediaPlayer::applicationDidBecomeActive):
1664         * platform/graphics/MediaPlayer.h:
1665         * platform/graphics/MediaPlayerPrivate.h:
1666         (WebCore::MediaPlayerPrivateInterface::applicationWillResignActive):
1667         (WebCore::MediaPlayerPrivateInterface::applicationDidBecomeActive):
1668
1669         * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.h:
1670         * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.mm:
1671         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::MediaPlayerPrivateMediaStreamAVFObjC): Switch
1672         to release logging.
1673         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::~MediaPlayerPrivateMediaStreamAVFObjC): Ditto.
1674         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::enqueueCorrectedVideoSample): Split out of enqueueVideoSample.
1675         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::enqueueVideoSample): Move code that updates
1676         the display later to enqueueCorrectedVideoSample. Rearrange logic to the image painter sample
1677         buffer has the correct timestamp.
1678         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::layerErrorDidChange): Switch to release logging.
1679         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::layerStatusDidChange): Ditto.
1680         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::applicationDidBecomeActive): f the display
1681         layer is in the "failed" state, flush the renderer and update the display mode.
1682         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::ensureLayers): Switch to release logging.
1683         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::load): Ditto.
1684         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::cancelLoad): Ditto.
1685         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::prepareToPlay): Ditto.
1686         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::updateDisplayMode): Ditto.
1687         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::play): Ditto.
1688         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::pause): Ditto.
1689         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::setVolume): Ditto.
1690         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::setMuted): Ditto.
1691         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::updateReadyState) Ditto.:
1692         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::logChannel const): Ditto.
1693         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::updateSampleTimes): Deleted.
1694
1695 2018-01-16  Michael Catanzaro  <mcatanzaro@igalia.com>
1696
1697         PAL should link to JavaScriptCore rather than WTF
1698         https://bugs.webkit.org/show_bug.cgi?id=181683
1699
1700         Reviewed by Konstantin Tokarev.
1701
1702         Do not link directly to JavaScriptCore. Get it via PAL.
1703
1704         * CMakeLists.txt:
1705
1706 2018-01-16  Zach Li  <zachli@apple.com>
1707
1708         Add pop-up policy support in website policies.
1709         https://bugs.webkit.org/show_bug.cgi?id=181544.
1710         rdar://problem/30521400.
1711
1712         Reviewed by Alex Christensen.
1713
1714         * loader/DocumentLoader.h:
1715         Introduce pop-up policy getter and setter. Initialize
1716         the policy as Default.
1717         (WebCore::DocumentLoader::popUpPolicy const):
1718         (WebCore::DocumentLoader::setPopUpPolicy):
1719         * page/DOMWindow.cpp:
1720         (WebCore::DOMWindow::allowPopUp):
1721         Pop-up policy specified on a per-page basis holds
1722         precedence over the global policy. If no pop-up policy
1723         is specified during navigation, global policy is used.
1724
1725 2018-01-16  Jer Noble  <jer.noble@apple.com>
1726
1727         Crash playing audio-only HLS stream via hls.js (MSE)
1728         https://bugs.webkit.org/show_bug.cgi?id=181691
1729         <rdar://problem/32967295>
1730
1731         Reviewed by Eric Carlson.
1732
1733         Add a weak-link check to the block called by -[AVSampleBufferDisplayLayer requestMediaDataWhenReadyOnQueue:usingBlock:].
1734
1735         * platform/graphics/avfoundation/objc/SourceBufferPrivateAVFObjC.mm:
1736         (WebCore::SourceBufferPrivateAVFObjC::trackDidChangeEnabled):
1737         (WebCore::SourceBufferPrivateAVFObjC::notifyClientWhenReadyForMoreSamples):
1738         (WebCore::SourceBufferPrivateAVFObjC::setVideoLayer):
1739
1740 2018-01-16  Simon Fraser  <simon.fraser@apple.com>
1741
1742         Rename applyHorizontalScale/applyVerticalScale in SVG filters, and related cleanup
1743         https://bugs.webkit.org/show_bug.cgi?id=181684
1744
1745         Reviewed by Alex Christensen.
1746
1747         Rename the confusing applyHorizontalScale/applyVerticalScale to scaledByFilterResolution(),
1748         and have it take and return a FloatSize. Change callers to do math in terms of FloatSizes.
1749
1750         Add inflate(size) to each of the rect classes.
1751
1752         * platform/graphics/FloatRect.h:
1753         (WebCore::FloatRect::inflate):
1754         * platform/graphics/IntRect.h:
1755         (WebCore::IntRect::inflate):
1756         * platform/graphics/LayoutRect.h:
1757         (WebCore::LayoutRect::inflate):
1758         * platform/graphics/filters/FEDisplacementMap.cpp:
1759         (WebCore::FEDisplacementMap::platformApplySoftware):
1760         * platform/graphics/filters/FEDropShadow.cpp:
1761         (WebCore::FEDropShadow::determineAbsolutePaintRect):
1762         (WebCore::FEDropShadow::platformApplySoftware):
1763         * platform/graphics/filters/FEGaussianBlur.cpp:
1764         (WebCore::FEGaussianBlur::calculateUnscaledKernelSize):
1765         (WebCore::FEGaussianBlur::calculateKernelSize):
1766         (WebCore::FEGaussianBlur::determineAbsolutePaintRect):
1767         (WebCore::FEGaussianBlur::platformApplySoftware):
1768         * platform/graphics/filters/FEGaussianBlur.h:
1769         * platform/graphics/filters/FEMorphology.cpp:
1770         (WebCore::FEMorphology::determineAbsolutePaintRect):
1771         (WebCore::FEMorphology::platformApplySoftware):
1772         * platform/graphics/filters/FEOffset.cpp:
1773         (WebCore::FEOffset::determineAbsolutePaintRect):
1774         (WebCore::FEOffset::platformApplySoftware):
1775         * platform/graphics/filters/Filter.h:
1776         (WebCore::Filter::setSourceImage):
1777         (WebCore::Filter::scaledByFilterResolution const):
1778         (WebCore::Filter::applyHorizontalScale const): Deleted.
1779         (WebCore::Filter::applyVerticalScale const): Deleted.
1780         * platform/graphics/filters/FilterOperations.cpp:
1781         (WebCore::outsetSizeForBlur):
1782         * rendering/FilterEffectRenderer.h:
1783         * svg/graphics/filters/SVGFilter.cpp:
1784         (WebCore::SVGFilter::scaledByFilterResolution const):
1785         (WebCore::SVGFilter::applyHorizontalScale const): Deleted.
1786         (WebCore::SVGFilter::applyVerticalScale const): Deleted.
1787         * svg/graphics/filters/SVGFilter.h:
1788
1789 2018-01-16  Fujii Hironori  <Hironori.Fujii@sony.com>
1790
1791         [CMake][Mac] Fix the build errors
1792         https://bugs.webkit.org/show_bug.cgi?id=181665
1793
1794         Reviewed by Alex Christensen.
1795
1796         No new tests (No behavior change)
1797
1798         * CMakeLists.txt: Added Modules/paymentrequest/MerchantValidationEvent.idl to compile.
1799         * PlatformMac.cmake: Added Modules/paymentrequest/MerchantValidationEvent.cpp to compile.
1800         Added workers/service/context and Modules/applicationmanifest as forwarding header paths.
1801
1802 2018-01-16  Wenson Hsieh  <wenson_hsieh@apple.com>
1803
1804         [Attachment Support] Provide the `src` of an attachment to the UI delegate when an attachment is inserted
1805         https://bugs.webkit.org/show_bug.cgi?id=181638
1806         <rdar://problem/36508702>
1807
1808         Reviewed by Dan Bernstein.
1809
1810         Adjust the `didInsertAttachment` codepath to additionally propagate the attachment element's `src`.
1811         Additionally, fix an issue with insertion and removal client notifications wherein the client can receive
1812         insertion calls without corresponding removal calls, or vice versa. This is an existing issue, but matters more
1813         now because we actually need to access the attachment element for its `src` when propagating changes to the
1814         client. See below for details.
1815
1816         Test: WKAttachmentTests.AttachmentUpdatesWhenInsertingRichMarkup
1817
1818         * dom/Document.h:
1819         (WebCore::Document::attachmentElementsByIdentifier const):
1820         * editing/Editor.cpp:
1821         (WebCore::Editor::notifyClientOfAttachmentUpdates):
1822         * page/EditorClient.h:
1823         (WebCore::EditorClient::didInsertAttachment):
1824         * page/Frame.cpp:
1825         (WebCore::Frame::setDocument):
1826
1827         When a Frame's document changes, inform the client that the attachments in the previous document are going away.
1828         For each attachment currently connected to the document, we have either (1) already informed the client that it
1829         was inserted, or (2) the attachment is pending an insertion call to the client. If (1) is the case, then we'll
1830         tell the client that the attachment is removed, which will balance out the earlier insertion call. If (2) is the
1831         case, then we'll remove the previously inserted attachment identifier from the set of attachment identifiers
1832         pending insertion, and the client won't be informed of insertions or removals.
1833
1834 2018-01-16  Antoine Quint  <graouts@apple.com>
1835
1836         Use traits for animation timing functions
1837         https://bugs.webkit.org/show_bug.cgi?id=181651
1838
1839         Reviewed by Dean Jackson.
1840
1841         Cleaning up Dean's previous patch as suggested by Darin's post-commit review comments. The
1842         downcast function can match const automatically and it's a better style to put the * inside
1843         the downcast call rather than outside.
1844
1845         * css/CSSComputedStyleDeclaration.cpp:
1846         (WebCore::createTimingFunctionValue):
1847         * platform/animation/TimingFunction.cpp:
1848         (WebCore::operator<<):
1849         (WebCore::TimingFunction::transformTime const):
1850         * platform/animation/TimingFunction.h:
1851         * platform/graphics/ca/cocoa/PlatformCAAnimationCocoa.mm:
1852         (WebCore::toCAMediaTimingFunction):
1853
1854 2018-01-16  Philippe Normand  <pnormand@igalia.com>
1855
1856         [GStreamer] Live streaming cleanups
1857         https://bugs.webkit.org/show_bug.cgi?id=181672
1858
1859         Reviewed by Michael Catanzaro.
1860
1861         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:
1862         (WebCore::MediaPlayerPrivateGStreamer::handleMessage): Switch to
1863         streaming code path when no content-length was reported by the
1864         http source element.
1865         (WebCore::MediaPlayerPrivateGStreamer::totalBytes const): Return early when streaming.
1866         * platform/graphics/gstreamer/WebKitWebSourceGStreamer.cpp:
1867         (CachedResourceStreamingClient::responseReceived): Emit headers as
1868         an element message, like souphttpsrc.
1869
1870 2018-01-15  Philippe Normand  <pnormand@igalia.com>
1871
1872         [GStreamer] misc fixes and cleanups
1873         https://bugs.webkit.org/show_bug.cgi?id=181647
1874
1875         Reviewed by Michael Catanzaro.
1876
1877         * platform/graphics/MediaPlayer.cpp:
1878         (WebCore::convertEnumerationToString): New utility function to convert preload enum to string.
1879         * platform/graphics/MediaPlayerEnums.h: Ditto.
1880         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:
1881         (WebCore::MediaPlayerPrivateGStreamer::load): Debug tweak
1882         (WebCore::MediaPlayerPrivateGStreamer::prepareToPlay): Ditto
1883         (WebCore::MediaPlayerPrivateGStreamer::play): Ditto
1884         (WebCore::MediaPlayerPrivateGStreamer::paused const): Ditto
1885         (WebCore::MediaPlayerPrivateGStreamer::processBufferingStats): Prevent useless state update.
1886         (WebCore::MediaPlayerPrivateGStreamer::fillTimerFired): Ditto.
1887         (WebCore::MediaPlayerPrivateGStreamer::updateStates): Debug tweak.
1888         (WebCore::MediaPlayerPrivateGStreamer::setDownloadBuffering): Ditto.
1889         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.h:
1890         Remove useless handlesSyncMessage method.
1891         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp:
1892         (WebCore::MediaPlayerPrivateGStreamerBase::setMuted): Prevent useless state update.
1893         (WebCore::MediaPlayerPrivateGStreamerBase::muted const): Debug tweak.
1894         (WebCore::MediaPlayerPrivateGStreamerBase::setStreamVolumeElement): Ditto.
1895         * platform/graphics/gstreamer/WebKitWebSourceGStreamer.cpp:
1896         (webkit_web_src_init): Enable keepAlive by default like in souphttpsrc.
1897         (webKitWebSrcStart): Debug tweak.
1898         (webKitWebSrcQueryWithParent): Ditto.
1899         (webKitWebSrcNeedData): Ditto.
1900         (CachedResourceStreamingClient::responseReceived): Change appsrc
1901         stream-type when we wan't seek. Also update caps like souphttpsrc
1902         does.
1903         * platform/graphics/gstreamer/WebKitWebSourceGStreamer.h: Add forward declaration of MediaPlayer.
1904         * platform/graphics/gstreamer/mse/MediaSourceClientGStreamerMSE.cpp:
1905         (WebCore::MediaSourceClientGStreamerMSE::append): Fix compilation warning.
1906
1907 2018-01-16  Yacine Bandou  <yacine.bandou_ext@softathome.com>
1908
1909         [WPE] Two clearkey tests failing since r226621
1910         https://bugs.webkit.org/show_bug.cgi?id=181532
1911
1912         Reviewed by Xabier Rodriguez-Calvar.
1913
1914         Whith a fake initData, we can have a pssh size nul, thus we should check it.
1915         We saw this issue in the subtest "initData longer than 64Kb characters" in
1916         the clearkey-generate-request-disallowed-input layout test.
1917
1918         * platform/encryptedmedia/clearkey/CDMClearKey.cpp:
1919         (WebCore::extractKeyidsLocationFromCencInitData):
1920
1921 2018-01-15  Yoav Weiss  <yoav@yoav.ws>
1922
1923         Support for preconnect Link headers
1924         https://bugs.webkit.org/show_bug.cgi?id=181657
1925
1926         Reviewed by Darin Adler.
1927
1928         Move the preconnect functionality into its own function, and
1929         also call this function when Link headers are processed.
1930
1931         Test: http/tests/preconnect/link-header-rel-preconnect-http.php
1932
1933         * loader/LinkLoader.cpp:
1934         (WebCore::LinkLoader::loadLinksFromHeader): Call preconnect.
1935         (WebCore::LinkLoader::preconnect): Preconnect to a host functionality moved here.
1936         (WebCore::LinkLoader::preload): Renamed `preloadIfNeeded` to `preload`.
1937         (WebCore::LinkLoader::loadLink): Call preconnect.
1938         * loader/LinkLoader.h:
1939
1940 2018-01-15  Michael Catanzaro  <mcatanzaro@igalia.com>
1941
1942         Improve use of ExportMacros
1943         https://bugs.webkit.org/show_bug.cgi?id=181652
1944
1945         Reviewed by Konstantin Tokarev.
1946
1947         Remove a comment.
1948
1949         * platform/PlatformExportMacros.h:
1950
1951 2018-01-15  Konstantin Tokarev  <annulen@yandex.ru>
1952
1953         image-rendering should affect scaling of border-image
1954         https://bugs.webkit.org/show_bug.cgi?id=169440
1955
1956         Reviewed by Michael Catanzaro.
1957
1958         Test: fast/borders/border-image-pixelated.html
1959
1960         * rendering/style/NinePieceImage.cpp:
1961         (WebCore::NinePieceImage::paint):
1962
1963 2018-01-15  Tomas Popela  <tpopela@redhat.com>
1964
1965         2.19.3 ACCELERATED_2D_CANVAS support is broken
1966         https://bugs.webkit.org/show_bug.cgi?id=180799
1967
1968         Reviewed by Michael Catanzaro.
1969
1970         * html/canvas/CanvasRenderingContext2DBase.cpp:
1971         (WebCore::CanvasRenderingContext2DBase::didDraw):
1972
1973 2018-01-15  Basuke Suzuki  <Basuke.Suzuki@sony.com>
1974
1975         [Curl] Enable HTTP/2
1976         https://bugs.webkit.org/show_bug.cgi?id=181551
1977
1978         Reviewed by Michael Catanzaro.
1979
1980         Start supporting HTTP/2 protocol. The first step is just enabling the HTTP/2 on Curl backend.
1981         Next step will be to enable multiplexing feature.
1982
1983         No new tests because we don't have HTTP/2 test backend yet.
1984
1985         * platform/network/curl/CurlContext.cpp:
1986         (WebCore::CurlContext::isHttp2Enabled const):
1987         (WebCore::CurlHandle::enableHttp):
1988         (WebCore::CurlHandle::enableHttpGetRequest):
1989         (WebCore::CurlHandle::enableHttpHeadRequest):
1990         (WebCore::CurlHandle::enableHttpPostRequest):
1991         (WebCore::CurlHandle::enableHttpPutRequest):
1992         (WebCore::CurlHandle::setHttpCustomRequest):
1993         * platform/network/curl/CurlContext.h:
1994
1995 2018-01-15  Dean Jackson  <dino@apple.com>
1996
1997         Use a helper function for checked arithmetic in WebGL validation
1998         https://bugs.webkit.org/show_bug.cgi?id=181620
1999         <rdar://problem/36485879>
2000
2001         Reviewed by Eric Carlson.
2002
2003         Eric recommended using a templated helper function to do
2004         a common arithmetic check in WebGL validation.
2005
2006         * html/canvas/WebGL2RenderingContext.cpp:
2007         (WebCore::WebGL2RenderingContext::validateIndexArrayConservative):
2008         * html/canvas/WebGLRenderingContext.cpp:
2009         (WebCore::WebGLRenderingContext::validateIndexArrayConservative):
2010         * html/canvas/WebGLRenderingContextBase.cpp:
2011         (WebCore::WebGLRenderingContextBase::validateIndexArrayPrecise):
2012         (WebCore::WebGLRenderingContextBase::validateDrawArrays):
2013         (WebCore::WebGLRenderingContextBase::validateSimulatedVertexAttrib0):
2014         (WebCore::WebGLRenderingContextBase::simulateVertexAttrib0):
2015         * html/canvas/WebGLRenderingContextBase.h:
2016         (WebCore::WebGLRenderingContextBase::checkedAddAndMultiply): New helper.
2017
2018 2018-01-15  Dean Jackson  <dino@apple.com>
2019
2020         Use traits for animation timing functions
2021         https://bugs.webkit.org/show_bug.cgi?id=181651
2022         <rdar://problem/36525328>
2023
2024         Reviewed by Antoine Quint.
2025
2026         Use the type traits for TimingFunction classes, so
2027         we can is<> and downcast<>.
2028
2029         * css/CSSComputedStyleDeclaration.cpp:
2030         (WebCore::createTimingFunctionValue):
2031         * platform/animation/TimingFunction.cpp:
2032         (WebCore::TimingFunction::transformTime const):
2033         * platform/animation/TimingFunction.h:
2034         * platform/graphics/ca/GraphicsLayerCA.cpp:
2035         (WebCore::animationHasStepsTimingFunction):
2036         (WebCore::animationHasFramesTimingFunction):
2037         * platform/graphics/ca/cocoa/PlatformCAAnimationCocoa.mm:
2038         (WebCore::toCAMediaTimingFunction):
2039
2040 2018-01-15  Youenn Fablet  <youenn@apple.com>
2041
2042         RealtimeMediaSource should be ThreadSafeRefCounted
2043         https://bugs.webkit.org/show_bug.cgi?id=181649
2044
2045         Reviewed by Eric Carlson.
2046
2047         Difficult to write a test as this is really racy.
2048         RealtimeIncomingVideoSourceCocoa::OnFrame is taking a reference on a background thread
2049         to send a task to the main thread.
2050         This requires it to be thread safe ref counted.
2051
2052         * platform/mediastream/RealtimeMediaSource.h:
2053
2054 2018-01-15  Philippe Normand  <pnormand@igalia.com>
2055
2056         Prevent useless MediaPlayer mute state notifications
2057         https://bugs.webkit.org/show_bug.cgi?id=181646
2058
2059         Reviewed by Carlos Garcia Campos.
2060
2061         On GTK port the mute change notification was triggering the test
2062         runner to think the whole page mute state had changed and that
2063         media elements were muted. The simplest solution is to propagate
2064         the notification only if the state actually changed.
2065
2066         * platform/graphics/MediaPlayer.cpp:
2067         (WebCore::MediaPlayer::muteChanged): Propagate mute notification
2068         only if the mute state actually changed.
2069
2070 2018-01-15  Sebastian Dröge  <sebastian@centricular.com>
2071
2072         [GStreamer] Don't wait for draw condition variable when shutting down.
2073         https://bugs.webkit.org/show_bug.cgi?id=180978
2074
2075         Reviewed by Carlos Garcia Campos.
2076
2077         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp:
2078         (WebCore::MediaPlayerPrivateGStreamerBase::triggerRepaint):
2079         (WebCore::MediaPlayerPrivateGStreamerBase::cancelRepaint):
2080         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.h:
2081         By also waiting for the draw condition variable while shutting down,
2082         it is possible that the GStreamer video sink is waiting for the main
2083         thread to actually render the current frame, while at the same time
2084         the main thread is waiting for the GStreamer video sink to shut down,
2085         resulting in a deadlock.
2086
2087 2018-01-13  Minsheng Liu  <lambda@liu.ms>
2088
2089         MathML Lengths should take zoom level into account
2090         https://bugs.webkit.org/show_bug.cgi?id=180029
2091
2092         Reviewed by Frédéric Wang.
2093
2094         The patch applies the effective zoom factor to physical units in toUserUnits().
2095
2096         Test: mathml/presentation/mspace-units-with-zoom.html
2097
2098         * rendering/mathml/RenderMathMLBlock.cpp:
2099         (WebCore::toUserUnits):
2100
2101 2018-01-12  Chris Dumez  <cdumez@apple.com>
2102
2103         ASSERTION FAILED: registration || isTerminating() in WebCore::SWServerWorker::skipWaiting()
2104         https://bugs.webkit.org/show_bug.cgi?id=181603
2105         <rdar://problem/36476050>
2106
2107         Reviewed by Youenn Fablet.
2108
2109         No new tests, covered by existing tests that crash flakily.
2110
2111         * workers/service/server/SWServer.cpp:
2112         (WebCore::SWServer::terminateWorkerInternal):
2113         If the connection to the context process is gone, make sure we make the worker as terminated
2114         so that it does not stay in Running state and in SWServer::m_runningOrTerminatingWorkers.
2115
2116         * workers/service/server/SWServerRegistration.cpp:
2117         (WebCore::SWServerRegistration::~SWServerRegistration):
2118         Add assertions to make sure none of the registration's workers are still running when
2119         the registration is destroyed.
2120
2121         (WebCore::SWServerRegistration::updateRegistrationState):
2122         Make sure registration workers that are overwritten are not still running.
2123
2124         * workers/service/server/SWServerWorker.cpp:
2125         (WebCore::SWServerWorker::setState):
2126         If a worker's state is set to redundant, make sure we also terminate it.
2127
2128 2018-01-12  Commit Queue  <commit-queue@webkit.org>
2129
2130         Unreviewed, rolling out r226927.
2131         https://bugs.webkit.org/show_bug.cgi?id=181621
2132
2133         Breaks 32-bit and iOS release for some reason that i don't
2134         understand yet (Requested by dino on #webkit).
2135
2136         Reverted changeset:
2137
2138         "Use a helper function for checked arithmetic in WebGL
2139         validation"
2140         https://bugs.webkit.org/show_bug.cgi?id=181620
2141         https://trac.webkit.org/changeset/226927
2142
2143 2018-01-12  Myles C. Maxfield  <mmaxfield@apple.com>
2144
2145         Data URL fonts split in the middle of an alphabet cause random letters to disappear
2146         https://bugs.webkit.org/show_bug.cgi?id=175845
2147         <rdar://problem/33996578>
2148
2149         Reviewed by Brent Fulgham.
2150
2151         It is fairly common practice for a font foundry to split a font up into two files such that a semi-random
2152         half of the alphabet is present in one of the files, and the other half is present in the other file. This
2153         practice involves representing the files as data URLs, so as to minimize the time it takes to load them.
2154
2155         Because resource loading is asynchronous (even for data URLs), it is possible today to get a paint after
2156         the first file is loaded but before the second file is loaded. Indeed, because of the way font fallback
2157         works, we will never start loading the second file until a layout has occurred with the first font.
2158
2159         Because a site usually only uses this pattern for a handful of fonts, and I've never seen this pattern
2160         being used for CJK fonts, it isn't very expensive to opportunistically decode these data URLs eagerly.
2161         Using this method doesn't actually guarantee that the two fonts will load in between successive paints,
2162         but it at least makes this much more likely. This patch implements this strategy, along with a size
2163         threshold to make sure that we won't decode any super large data URLs when it isn't necessary.
2164
2165         Test: fast/text/font-load-data-partitioned-alphabet.html
2166
2167         * css/CSSFontFace.cpp:
2168         (WebCore::CSSFontFace::opportunisticallyStartFontDataURLLoading):
2169         * css/CSSFontFace.h:
2170         * css/CSSFontFaceSource.cpp:
2171         (WebCore::CSSFontFaceSource::opportunisticallyStartFontDataURLLoading):
2172         * css/CSSFontFaceSource.h:
2173         * css/CSSFontSelector.cpp:
2174         (WebCore::CSSFontSelector::opportunisticallyStartFontDataURLLoading):
2175         * css/CSSFontSelector.h:
2176         * platform/graphics/FontCascadeFonts.cpp:
2177         (WebCore::opportunisticallyStartFontDataURLLoading):
2178         (WebCore::FontCascadeFonts::glyphDataForVariant):
2179         * platform/graphics/FontSelector.h:
2180
2181 2018-01-12  Alex Christensen  <achristensen@webkit.org>
2182
2183         History state should be updated during client redirects with asynchronous policy decisions
2184         https://bugs.webkit.org/show_bug.cgi?id=181358
2185         <rdar://problem/35547689>
2186
2187         Reviewed by Andy Estes.
2188
2189         When decidePolicyForNavigationAction is responded to asynchronously during a client redirect, 
2190         HistoryController::updateForRedirectWithLockedBackForwardList does not update the history because
2191         the document loader has not been marked as a client redirect because the FrameLoader only looks
2192         at its provisional document loader to mark it as a client redirect.  When decidePolicyForNavigationAction
2193         is responded to asynchronously, though, the FrameLoader's provisional document loader has moved to 
2194         its policy document loader.  To get both asynchronous and synchronous cases, let's just mark the document
2195         loader as a client redirect whether it's the provisional or policy document loader.
2196
2197         Covered by a new API test.
2198
2199         * loader/FrameLoader.cpp:
2200         (WebCore::FrameLoader::loadURL):
2201         (WebCore::FrameLoader::loadPostRequest):
2202
2203 2018-01-12  Dean Jackson  <dino@apple.com>
2204
2205         Use a helper function for checked arithmetic in WebGL validation
2206         https://bugs.webkit.org/show_bug.cgi?id=181620
2207         <rdar://problem/36485879>
2208
2209         Reviewed by Eric Carlson.
2210
2211         Eric recommended using a templated helper function to do
2212         a common arithmetic check in WebGL validation.
2213
2214         * html/canvas/WebGL2RenderingContext.cpp:
2215         (WebCore::WebGL2RenderingContext::validateIndexArrayConservative):
2216         * html/canvas/WebGLRenderingContext.cpp:
2217         (WebCore::WebGLRenderingContext::validateIndexArrayConservative):
2218         * html/canvas/WebGLRenderingContextBase.cpp:
2219         (WebCore::WebGLRenderingContextBase::checkedAddAndMultiply): New helper.
2220         (WebCore::WebGLRenderingContextBase::validateIndexArrayPrecise):
2221         (WebCore::WebGLRenderingContextBase::validateDrawArrays):
2222         (WebCore::WebGLRenderingContextBase::validateSimulatedVertexAttrib0):
2223         (WebCore::WebGLRenderingContextBase::simulateVertexAttrib0):
2224         * html/canvas/WebGLRenderingContextBase.h:
2225
2226 2018-01-12  Myles C. Maxfield  <mmaxfield@apple.com>
2227
2228         [Cocoa] CTFontCopyDefaultCascadeListForLanguages() can return nullptr
2229         https://bugs.webkit.org/show_bug.cgi?id=181615
2230         <rdar://problem/36334637>
2231
2232         Reviewed by Jon Lee.
2233
2234         Speculative fix. We are getting crash reports saying that this call can return nullptr, and we
2235         don't check for it.
2236
2237         No new tests because I couldn't find the specific input that causes it to return nullptr. (I
2238         tried running this code with every 0, 1, and 2 length locale string, every weight value, and
2239         every italic value, and couldn't get it to crash. I also inspected the code to figure out what
2240         values would cause it to return nullptr, and I couldn't find anything other than if the system
2241         has a totally busted font setup.)
2242
2243         * platform/graphics/cocoa/FontDescriptionCocoa.cpp:
2244         (WebCore::SystemFontDatabase::computeCascadeList):
2245
2246 2018-01-11  Dean Jackson  <dino@apple.com>
2247
2248         [WebGL] Simulated vertexAttrib0 can sometimes cause OUT_OF_MEMORY errors
2249         https://bugs.webkit.org/show_bug.cgi?id=181558
2250         <rdar://problem/36189833>
2251
2252         Reviewed by Eric Carlson.
2253
2254         Very large element indices in the ELEMENT_ARRAY_BUFFER meant that
2255         our simulated vertexAttrib0 buffer might be too large. We need
2256         to check for out-of-memory, but we can also detect some of the issues
2257         earlier in our validation code. Additionally, make sure that we don't
2258         accidentally cast an unsigned to a signed.
2259
2260         Test: fast/canvas/webgl/simulated-vertexAttrib0-invalid-indicies.html
2261
2262         * html/canvas/WebGL2RenderingContext.cpp:
2263         (WebCore::WebGL2RenderingContext::validateIndexArrayConservative): Update validation
2264         code to look for overflow, rather than relying on looking for sign changes.
2265         * html/canvas/WebGLRenderingContext.cpp:
2266         (WebCore::WebGLRenderingContext::validateIndexArrayConservative): Ditto.
2267         * html/canvas/WebGLRenderingContextBase.cpp:
2268         (WebCore::WebGLRenderingContextBase::validateIndexArrayPrecise):
2269         (WebCore::WebGLRenderingContextBase::drawArrays): Check that we were able to simulate.
2270         (WebCore::WebGLRenderingContextBase::drawElements):
2271         (WebCore::WebGLRenderingContextBase::validateSimulatedVertexAttrib0): Update validation code, and
2272         use GC3Duint, since that's what the indicies are.
2273         (WebCore::WebGLRenderingContextBase::simulateVertexAttrib0): Ditto.
2274         (WebCore::WebGLRenderingContextBase::drawArraysInstanced): Check that we were able to simulate.
2275         (WebCore::WebGLRenderingContextBase::drawElementsInstanced):
2276         * html/canvas/WebGLRenderingContextBase.h:
2277
2278 2018-01-12  Wenson Hsieh  <wenson_hsieh@apple.com>
2279
2280         Large in-place attachment elements cause the document width to expand when inserted
2281         https://bugs.webkit.org/show_bug.cgi?id=181614
2282
2283         Reviewed by Dan Bernstein.
2284
2285         Make in-place images and videos have a max-width of 100%, so that large attachments aren't inserted with full
2286         display size, causing the document and viewport width to expand.
2287
2288         * html/HTMLAttachmentElement.cpp:
2289         (WebCore::HTMLAttachmentElement::populateShadowRootIfNecessary):
2290
2291 2018-01-12  Keith Rollin  <krollin@apple.com>
2292
2293         Logged JSON should escape "'s and \'s in strings.
2294         https://bugs.webkit.org/show_bug.cgi?id=181608
2295
2296         Reviewed by Brent Fulgham.
2297
2298         No new tests -- no new functionality, just changed logging. The
2299         efficacy of the logging was verified by inspecting its output.
2300
2301         * loader/ResourceLoadObserver.cpp:
2302         (WebCore::ResourceLoadObserver::logUserInteractionWithReducedTimeResolution):
2303
2304 2018-01-12  Dean Jackson  <dino@apple.com>
2305
2306         drawElements should be invalid if vertexAttrib0 doesn't have data
2307         https://bugs.webkit.org/show_bug.cgi?id=181609
2308         <rdar://problem/36392883>
2309
2310         Reviewed by Antoine Quint.
2311
2312         If a vertex attribute has been enabled, but no data provided, then
2313         draw validation should fail.
2314
2315         Test: fast/canvas/webgl/drawElements-empty-vertex-data.html
2316
2317         * html/canvas/WebGLRenderingContextBase.cpp:
2318         (WebCore::WebGLRenderingContextBase::validateVertexAttributes): If there were
2319         never any data in the vertex buffer, then we incorrectly compared with 0.
2320
2321 2018-01-12  Youenn Fablet  <youenn@apple.com>
2322
2323         FormDataElement::lengthInBytes should use ThreadableBlobRegistry
2324         https://bugs.webkit.org/show_bug.cgi?id=181554
2325
2326         Reviewed by Chris Dumez.
2327
2328         Covered by updated test.
2329
2330         Fix blobRegistry() use and add support for creating a response that may trigger the issue.
2331
2332
2333         * platform/network/FormData.cpp:
2334         (WebCore::FormDataElement::lengthInBytes const): Was using directly blobRegistry() while ThreadableBlobRegistry is more appropriate
2335         in case this is called from workers.
2336         * Modules/fetch/FetchBody.h:
2337         * Modules/fetch/FetchResponse.h:
2338         * fileapi/Blob.h:
2339         * testing/ServiceWorkerInternals.cpp:
2340         (WebCore::ServiceWorkerInternals::createOpaqueWithBlobBodyResponse):
2341         * testing/ServiceWorkerInternals.h:
2342         * testing/ServiceWorkerInternals.idl:
2343
2344 2018-01-12  Jer Noble  <jer.noble@apple.com>
2345
2346         Wrap CDMFairPlayStreaming and related classes in ENABLE(ENCRYPTED_MEDIA) checks
2347         https://bugs.webkit.org/show_bug.cgi?id=181602
2348
2349         Reviewed by Maciej Stachowiak.
2350
2351         * platform/graphics/avfoundation/CDMFairPlayStreaming.h:
2352         * platform/graphics/avfoundation/objc/CDMInstanceFairPlayStreamingAVFObjC.h:
2353         * platform/graphics/avfoundation/objc/CDMInstanceFairPlayStreamingAVFObjC.mm:
2354
2355 2018-01-12  Youenn Fablet  <youenn@apple.com>
2356
2357         WebProcess should pass the registration identifier and not the worker identifier for fetch events
2358         https://bugs.webkit.org/show_bug.cgi?id=181591
2359
2360         Reviewed by Chris Dumez.
2361
2362         Test: http/wpt/service-workers/update-service-worker.https.html
2363
2364         Store service worker registration identifier in ResourceLoaderOptions instead of service worker identifier.
2365
2366         * loader/DocumentThreadableLoader.cpp:
2367         (WebCore::DocumentThreadableLoader::DocumentThreadableLoader):
2368         (WebCore::DocumentThreadableLoader::makeCrossOriginAccessRequest):
2369         * loader/ResourceLoaderOptions.h:
2370         * loader/WorkerThreadableLoader.cpp:
2371         (WebCore::WorkerThreadableLoader::MainThreadBridge::MainThreadBridge):
2372         * loader/cache/CachedResourceLoader.cpp:
2373         (WebCore::CachedResourceLoader::prepareFetch):
2374         (WebCore::CachedResourceLoader::determineRevalidationPolicy const):
2375         * loader/cache/CachedResourceRequest.cpp:
2376         (WebCore::CachedResourceRequest::setSelectedServiceWorkerRegistrationIdentifierIfNeeded):
2377         (WebCore::CachedResourceRequest::setNavigationServiceWorkerRegistrationData):
2378         (WebCore::CachedResourceRequest::setSelectedServiceWorkerIdentifierIfNeeded): Deleted.
2379         * loader/cache/CachedResourceRequest.h:
2380         * workers/WorkerScriptLoader.cpp:
2381         (WebCore::WorkerScriptLoader::loadSynchronously):
2382         (WebCore::WorkerScriptLoader::loadAsynchronously):
2383         * workers/service/server/SWServer.cpp:
2384         (WebCore::SWServer::activeWorkerFromRegistrationID):
2385         * workers/service/server/SWServer.h:
2386
2387 2018-01-12  Fujii Hironori  <Hironori.Fujii@sony.com>
2388
2389         [Win][CMake] Remove all-in-one file for WebCore DerivedSources
2390         https://bugs.webkit.org/show_bug.cgi?id=181582
2391
2392         Reviewed by Alex Christensen.
2393
2394         Those source files are compiled in unified source build nowadays.
2395
2396         No new tests (No behavior change)
2397
2398         * CMakeLists.txt: Removed calling PROCESS_ALLINONE_FILE.
2399         * DerivedSources.cpp: Removed.
2400         * WebCoreMacros.cmake: Removed a macro PROCESS_ALLINONE_FILE.
2401
2402 2018-01-12  Fujii Hironori  <Hironori.Fujii@sony.com>
2403
2404         [WinCairo][CMake] Use ${CURL_LIBRARY} instead of specifying the library name libcurl_imp explicitly
2405         https://bugs.webkit.org/show_bug.cgi?id=181578
2406
2407         Reviewed by Alex Christensen.
2408
2409         vcpkg has libcurl.lib, not libcurl_imp.lib.
2410
2411         No new tests because no behavior change.
2412
2413         * PlatformWinCairo.cmake: Link ${CURL_LIBRARY} instead of libcurl_imp.
2414
2415 2018-01-12  Jer Noble  <jer.noble@apple.com>
2416
2417         WebGL video texture black in Safari 11.0.2 and wrong colored in Safari Preview 11.1
2418         https://bugs.webkit.org/show_bug.cgi?id=181445
2419         <rdar://problem/36383183>
2420
2421         Reviewed by Dean Jackson.
2422
2423         Tests: added compile-time correctness tests for YCbCrMatrix values.
2424
2425         Perform the derivation from YCbCr coefficients into matrices in constexpr expressions
2426         at compile-time. This allows us to also perform compile-time correctness checks to catch
2427         regressions which may cause incorrect color conversions.
2428
2429         Since we now have general-purpose derivation of matrix values from coefficients,
2430         adding missing specificed matrices is trivial, so add support for SMPTE 240M and BT.2020
2431         matrices.
2432
2433         * platform/graphics/cv/VideoTextureCopierCV.cpp:
2434         (WebCore::GLfloatColor::GLfloatColor):
2435         (WebCore::GLfloatColor::abs):
2436         (WebCore::GLfloatColor::isApproximatelyEqualTo const):
2437         (WebCore::YCbCrMatrix::operator Vector<GLfloat> const):
2438         (WebCore::YCbCrMatrix::YCbCrMatrix):
2439         (WebCore::YCbCrMatrix::operator* const):
2440         (WebCore::YCbCrToRGBMatrixForRangeAndTransferFunction):
2441
2442 2018-01-12  Antoine Quint  <graouts@apple.com>
2443
2444         Add support for the frames() timing function
2445         https://bugs.webkit.org/show_bug.cgi?id=181585
2446         <rdar://problem/36463317>
2447
2448         Reviewed by Dean.
2449
2450         Implement the frames() timing function as specified in the CSS Timing Functions Level 1
2451         specification, specifically https://www.w3.org/TR/css-timing-1/#frames-timing-functions.
2452         A frames timing function is a type of timing function that divides the input time into a
2453         specified number of intervals of equal length.
2454
2455         Test: transitions/frames-timing-function.html
2456
2457         * css/CSSComputedStyleDeclaration.cpp:
2458         (WebCore::createTimingFunctionValue):
2459         * css/CSSTimingFunctionValue.cpp:
2460         (WebCore::CSSFramesTimingFunctionValue::customCSSText const):
2461         (WebCore::CSSFramesTimingFunctionValue::equals const):
2462         * css/CSSTimingFunctionValue.h:
2463         * css/CSSToStyleMap.cpp:
2464         (WebCore::CSSToStyleMap::mapAnimationTimingFunction):
2465         * css/CSSValue.cpp:
2466         (WebCore::CSSValue::equals const):
2467         (WebCore::CSSValue::cssText const):
2468         (WebCore::CSSValue::destroy):
2469         * css/CSSValue.h:
2470         (WebCore::CSSValue::isFramesTimingFunctionValue const):
2471         * css/CSSValueKeywords.in:
2472         * css/parser/CSSPropertyParser.cpp:
2473         (WebCore::consumeSteps):
2474         (WebCore::consumeFrames):
2475         (WebCore::consumeAnimationTimingFunction):
2476         * platform/animation/TimingFunction.cpp:
2477         (WebCore::operator<<):
2478         (WebCore::TimingFunction::transformTime const):
2479         * platform/animation/TimingFunction.h:
2480         (WebCore::TimingFunction::isFramesTimingFunction const):
2481         * platform/graphics/ca/GraphicsLayerCA.cpp:
2482         (WebCore::animationHasFramesTimingFunction):
2483         (WebCore::GraphicsLayerCA::animationCanBeAccelerated const):
2484
2485 2018-01-12  Commit Queue  <commit-queue@webkit.org>
2486
2487         Unreviewed, rolling out r226721.
2488         https://bugs.webkit.org/show_bug.cgi?id=181583
2489
2490         Lets do a slightly different fix (Requested by anttik on
2491         #webkit).
2492
2493         Reverted changeset:
2494
2495         "REGRESSION(r225650): The scores of MotionMark tests Multiply
2496         and Leaves dropped by 8%"
2497         https://bugs.webkit.org/show_bug.cgi?id=181460
2498         https://trac.webkit.org/changeset/226721
2499
2500 2018-01-11  Keith Miller  <keith_miller@apple.com>
2501
2502         Rename ENABLE_ASYNC_ITERATION to ENABLE_JS_ASYNC_ITERATION
2503         https://bugs.webkit.org/show_bug.cgi?id=181573
2504
2505         Reviewed by Simon Fraser.
2506
2507         * Configurations/FeatureDefines.xcconfig:
2508
2509 2018-01-11  Jiewen Tan  <jiewen_tan@apple.com>
2510
2511         [WebAuthN] Import a CBOR coder from Chromium
2512         https://bugs.webkit.org/show_bug.cgi?id=181522
2513         <rdar://problem/36055729>
2514
2515         Reviewed by Brent Fulgham.
2516
2517         This patch imports a CBOR coder including encoder and decoder from Chromium. CBOR encoder
2518         is needed for WebAuthN to encode attestation object into binaries. When supporting extensions
2519         in the future, CBOR encoder/decoder will be needed as well. Implementating and maintaining
2520         a fully-fledged CBOR coder doesn't seem to align with WebKit's best interests. Therefore,
2521         importing a most suitable third party implementation will be wise.
2522
2523         In this patch, it fully integrate the whole coder into our codebase. Those changes includes:
2524             1. Substitute data structures that enjoy a better WTF version.
2525             2. Replacing marcos.
2526             3. Implementating workarounds for some functionalities that we lack fundamental types' support.
2527             4. Changing the coding style to match ours.
2528
2529         This patch doesn't intend to improve the logic of the original codebase. Hence some of the
2530         coding logic might not match what WebKit ususally has.
2531
2532         Here is a full list of Chromium changes that constructed this CBOR coder in chronological order:
2533         6efcf495521d18d060027762f48bb292d6979136,
2534         9eb43fd347890b4c6cf54c4bd7ec1bbb88e381e1,
2535         31c85e74fd567772f18e0a41be468d04af721f21,
2536         68672fdcad280a8ff69b91927d38d0eabf2c87f2,
2537         0ca8667c0584fb21c0748ebd7468d32889759a07,
2538         df763d790d7e45d70116bdefacbfd4f9faa8995e,
2539         6d30c4a621c65314db63eb56e87c19ab75627b26,
2540         50fe92953f4739f17a62303fedbf8db9234317c8,
2541         47be22c3603424d1832d046a348ff3f982500288,
2542         98a59e46948b2c71608926004fac8192b0ff2208,
2543         07540c6d850ed6e0fa508d63c20a8ce96d751de6,
2544         06ae32d640c8e4b86ea8914a80ee419ea16e56d8.
2545
2546         Covered by API tests.
2547
2548         * Modules/webauthn/cbor/CBORBinary.h: Added.
2549         * Modules/webauthn/cbor/CBORReader.cpp: Added.
2550         (cbor::CBORReader::CBORReader):
2551         (cbor::CBORReader::~CBORReader):
2552         (cbor::CBORReader::read):
2553         (cbor::CBORReader::decodeCBOR):
2554         (cbor::CBORReader::readVariadicLengthInteger):
2555         (cbor::CBORReader::decodeValueToNegative):
2556         (cbor::CBORReader::decodeValueToUnsigned):
2557         (cbor::CBORReader::readSimpleValue):
2558         (cbor::CBORReader::readString):
2559         Workarounds applied.
2560         (cbor::CBORReader::readBytes):
2561         (cbor::CBORReader::readCBORArray):
2562         (cbor::CBORReader::readCBORMap):
2563         (cbor::CBORReader::canConsume):
2564         (cbor::CBORReader::checkMinimalEncoding):
2565         (cbor::CBORReader::checkExtraneousData):
2566         (cbor::CBORReader::checkDuplicateKey):
2567         (cbor::CBORReader::hasValidUTF8Format):
2568         Workarounds applied.
2569         (cbor::CBORReader::checkOutOfOrderKey):
2570         (cbor::CBORReader::getErrorCode):
2571         (cbor::CBORReader::errorCodeToString):
2572         * Modules/webauthn/cbor/CBORReader.h: Added.
2573         * Modules/webauthn/cbor/CBORValue.cpp: Added.
2574         (cbor::CBORValue::CBORValue):
2575         (cbor::CBORValue::operator=):
2576         (cbor::CBORValue::~CBORValue):
2577         (cbor::CBORValue::clone const):
2578         (cbor::CBORValue::getInteger const):
2579         (cbor::CBORValue::getUnsigned const):
2580         (cbor::CBORValue::getNegative const):
2581         (cbor::CBORValue::getString const):
2582         (cbor::CBORValue::getByteString const):
2583         (cbor::CBORValue::getArray const):
2584         (cbor::CBORValue::getMap const):
2585         (cbor::CBORValue::getSimpleValue const):
2586         (cbor::CBORValue::internalMoveConstructFrom):
2587         (cbor::CBORValue::internalCleanup):
2588         * Modules/webauthn/cbor/CBORValue.h: Added.
2589         * Modules/webauthn/cbor/CBORWriter.cpp: Added.
2590         (cbor::CBORWriter::~CBORWriter):
2591         (cbor::CBORWriter::write):
2592         (cbor::CBORWriter::CBORWriter):
2593         (cbor::CBORWriter::encodeCBOR):
2594         Workarounds applied.
2595         (cbor::CBORWriter::startItem):
2596         (cbor::CBORWriter::setAdditionalInformation):
2597         (cbor::CBORWriter::setUint):
2598         (cbor::CBORWriter::getNumUintBytes):
2599         * Modules/webauthn/cbor/CBORWriter.h: Added.
2600         * Sources.txt:
2601         * WebCore.xcodeproj/project.pbxproj:
2602
2603 2018-01-11  Chris Dumez  <cdumez@apple.com>
2604
2605         Setting Window.opener to null should disown its opener
2606         https://bugs.webkit.org/show_bug.cgi?id=181505
2607         <rdar://problem/36443151>
2608
2609         Reviewed by Ryosuke Niwa.
2610
2611         Setting Window.opener to null should disown its opener as per:
2612         - https://html.spec.whatwg.org/#dom-opener
2613
2614         With this change, tabs opened by clicking link inside Gmail no
2615         longer have the Gmail window as opener.
2616
2617         Tests: fast/dom/Window/window-opener-set-to-null.html
2618                fast/dom/Window/window-opener-shadowing.html
2619
2620         * bindings/js/JSDOMWindowCustom.cpp:
2621         (WebCore::JSDOMWindow::setOpener):
2622         * page/DOMWindow.cpp:
2623         (WebCore::DOMWindow::disownOpener):
2624         * page/DOMWindow.h:
2625         * page/DOMWindow.idl:
2626
2627 2018-01-11  Myles C. Maxfield  <mmaxfield@apple.com>
2628
2629         [Cocoa] Star character disappears when bolded
2630         https://bugs.webkit.org/show_bug.cgi?id=181568
2631         <rdar://problem/18755569>
2632
2633         Reviewed by Simon Fraser.
2634
2635         We had some code in ComplexTextController to ask the FontCache for a font, given the name
2636         of a particular font CoreText used inside a CTRun. This is wrong for two reasons: fonts
2637         are not identifiable by PostScript name (in the general case), and because the lookup
2638         procedure requires a FontDescription, the result may yield a font that is not the one
2639         looked up. The goal of this code was simply to preserve the rendering mode of the font,
2640         but we removed support for these rendering modes years ago. So the solution is to skip
2641         that lookup and use the CoreText font directly.
2642
2643         Test: fast/text/unknown-font.html
2644
2645         * platform/graphics/mac/ComplexTextControllerCoreText.mm:
2646         (WebCore::ComplexTextController::collectComplexTextRunsForCharacters):
2647
2648 2018-01-11  Keith Rollin  <krollin@apple.com>
2649
2650         Add optional logging of ITP-related user interaction information
2651         https://bugs.webkit.org/show_bug.cgi?id=181556
2652
2653         Reviewed by Brent Fulgham.
2654
2655         In order to support the tracking of the efficacy of Intelligent
2656         Tracking Protection, add some logging indicating when the user
2657         interacts with a page in a way that affects cookie partitioning. This
2658         logging is off by default, and is enabled with `defaults write -g
2659         WebKitLogCookieInformation -bool true`.
2660
2661         No new tests -- no changed functionality.
2662
2663         * loader/ResourceLoadObserver.cpp:
2664         (WebCore::ResourceLoadObserver::logUserInteractionWithReducedTimeResolution):
2665         * loader/ResourceLoadObserver.h:
2666         (WebCore::ResourceLoadObserver::shouldLogUserInteraction const):
2667         (WebCore::ResourceLoadObserver::setShouldLogUserInteraction):
2668
2669 2018-01-11  James Craig  <jcraig@apple.com>
2670
2671         AX: when invert colors is on, double-invert video elements in UserAgentStyleSheet
2672         https://bugs.webkit.org/show_bug.cgi?id=168447
2673         <rdar://problem/30559874>
2674
2675         Reviewed by Simon Fraser.
2676
2677         Double-invert video when platform "invert colors" setting is enabled. Behavior matches 
2678         current "Smart Invert" feature of Safari Reader on macOS/iOS and other iOS native apps.
2679
2680         Tests: accessibility/smart-invert-reference.html
2681                accessibility/smart-invert.html
2682
2683         * Modules/modern-media-controls/controls/media-controls.css:
2684         (@media (inverted-colors)):
2685         (:host):
2686         (picture):
2687         * css/html.css:
2688         (@media (inverted-colors)):
2689         (video):
2690
2691 2018-01-11  Wenson Hsieh  <wenson_hsieh@apple.com>
2692
2693         Don't load inline data when requesting info for an attachment element backed by a file path
2694         https://bugs.webkit.org/show_bug.cgi?id=181550
2695
2696         Reviewed by Tim Horton.
2697
2698         When requesting data for an attachment element that is backed by a file path, we currently trigger a load in the
2699         web process to fetch contents of the attachment data as inline data in the AttachmentInfo. This is unnecessary,
2700         since the file path of the attachment element must have come from the UI process anyways, so it is sufficient to
2701         simply send the file path to the UI process and have the UI process read the contents of the path as a memory-
2702         mapped NSData.
2703
2704         This patch lets HTMLAttachmentElement skip over resource loading codepaths when creating an AttachmentInfo for
2705         the client, and also teaches _WKAttachment to read a AttachmentInfo's filepath as memory-mapped data if a file
2706         path is present, and no inline data was specified.
2707
2708         Covered by existing API tests.
2709
2710         * html/HTMLAttachmentElement.cpp:
2711         (WebCore::HTMLAttachmentElement::requestInfo):
2712
2713 2018-01-10  Ryosuke Niwa  <rniwa@webkit.org>
2714
2715         Make elements of zero width or height focusable
2716         https://bugs.webkit.org/show_bug.cgi?id=181516
2717
2718         Reviewed by Chris Dumez.
2719
2720         Don't check render box's size or bounding rect when deciding whether an element is focusable.
2721         New behavior matches that of Firefox and Chrome.
2722
2723         Test: fast/events/focus-zero-size-element.html
2724
2725         * dom/Element.cpp:
2726         (WebCore::Element::isFocusable): Only update the style.
2727         * html/HTMLFormControlElement.cpp:
2728         (WebCore::HTMLFormControlElement::isFocusable const): Deleted.
2729         * html/HTMLFormControlElement.h:
2730         * mathml/MathMLElement.cpp:
2731         (WebCore::MathMLElement::isFocusable const): Deleted. As far as I can tell, no math ml element is focusable.
2732         * mathml/MathMLElement.h:
2733         * svg/SVGAElement.cpp:
2734         (WebCore::SVGAElement::isFocusable const): Deleted.
2735         * svg/SVGAElement.h:
2736
2737 2018-01-11  Filip Pizlo  <fpizlo@apple.com>
2738
2739         Rename MarkedAllocator to BlockDirectory and AllocatorAttributes to CellAttributes
2740         https://bugs.webkit.org/show_bug.cgi?id=181543
2741
2742         Rubber stamped by Michael Saboff.
2743
2744         No new tests because I'm just renaming things.
2745
2746         * ForwardingHeaders/heap/BlockDirectoryInlines.h: Copied from Source/WebCore/ForwardingHeaders/heap/MarkedAllocatorInlines.h.
2747         * ForwardingHeaders/heap/MarkedAllocatorInlines.h: Removed.
2748         * bindings/js/DOMGCOutputConstraint.cpp:
2749
2750 2018-01-11  Alex Christensen  <achristensen@webkit.org>
2751
2752         REGRESSION(r225003): Loading hangs in environments where dispatch_async does not work
2753         https://bugs.webkit.org/show_bug.cgi?id=181553
2754         <rdar://problem/35733938>
2755
2756         Reviewed by Eric Carlson.
2757
2758         There is an environment where dispatch_async does not work, but performSelectorOnMainThread works.
2759         r225003 broke loading in this environment.  This fixes it and updates the test that r225003 fixed.
2760         It failed sometimes because loading was happening in a different order than html parsing, so I made
2761         the test not depend on html parsing timing by updating media/video-src-remove.html.
2762
2763         * platform/network/mac/WebCoreResourceHandleAsOperationQueueDelegate.mm:
2764         (-[WebCoreResourceHandleAsOperationQueueDelegate callFunctionOnMainThread:]):
2765
2766 2018-01-11  Dean Jackson  <dino@apple.com>
2767
2768         Rolling out 226814. It crashes on some bots.
2769
2770 2018-01-11  Dean Jackson  <dino@apple.com>
2771
2772         [WebGL] Simulated vertexAttrib0 can sometimes cause OUT_OF_MEMORY errors
2773         https://bugs.webkit.org/show_bug.cgi?id=181558
2774         <rdar://problem/36189833>
2775
2776         Reviewed by Eric Carlson.
2777
2778         Very large element indices in the ELEMENT_ARRAY_BUFFER meant that
2779         our simulated vertexAttrib0 buffer might be too large. We need
2780         to check for out-of-memory, but we can also detect some of the issues
2781         earlier in our validation code. Additionally, make sure that we don't
2782         accidentally cast an unsigned to a signed.
2783
2784         Test: fast/canvas/webgl/simulated-vertexAttrib0-invalid-indicies.html
2785
2786         * html/canvas/WebGL2RenderingContext.cpp:
2787         (WebCore::WebGL2RenderingContext::validateIndexArrayConservative): Update validation
2788         code to look for overflow, rather than relying on looking for sign changes.
2789         * html/canvas/WebGLRenderingContext.cpp:
2790         (WebCore::WebGLRenderingContext::validateIndexArrayConservative): Ditto.
2791         * html/canvas/WebGLRenderingContextBase.cpp:
2792         (WebCore::WebGLRenderingContextBase::validateIndexArrayPrecise):
2793         (WebCore::WebGLRenderingContextBase::drawArrays): Check that we were able to simulate.
2794         (WebCore::WebGLRenderingContextBase::drawElements):
2795         (WebCore::WebGLRenderingContextBase::validateSimulatedVertexAttrib0): Update validation code, and
2796         use GC3Duint, since that's what the indicies are.
2797         (WebCore::WebGLRenderingContextBase::simulateVertexAttrib0): Ditto.
2798         (WebCore::WebGLRenderingContextBase::drawArraysInstanced): Check that we were able to simulate.
2799         (WebCore::WebGLRenderingContextBase::drawElementsInstanced):
2800         * html/canvas/WebGLRenderingContextBase.h:
2801
2802 2018-01-11  Chris Dumez  <cdumez@apple.com>
2803
2804         ASSERTION FAILED: registration in WebCore::SWServerWorker::skipWaiting()
2805         https://bugs.webkit.org/show_bug.cgi?id=181222
2806         <rdar://problem/36332686>
2807
2808         Reviewed by Youenn Fablet.
2809
2810         Replace assertion in SWServerWorker::skipWaiting() that assumes the worker
2811         has a registration. Nowadays, a SWServerWorker can stay alive for a short
2812         period without having a registration, while it is terminating.
2813
2814         No new tests, unskipped existing test.
2815
2816         * workers/service/server/SWServerWorker.cpp:
2817         (WebCore::SWServerWorker::skipWaiting):
2818
2819 2018-01-11  Antti Koivisto  <antti@apple.com>
2820
2821         Don't call RenderElement::setStyle when nothing changes
2822         https://bugs.webkit.org/show_bug.cgi?id=181530
2823
2824         Reviewed by Zalan Bujtas.
2825
2826         * style/StyleChange.h:
2827
2828         Remove 'Force' value. This essentially meant 'compute style for all descendants and call setStyle unconditionally'.
2829         Using this value lost information about whether anything actually changed in a particular style as it was automatically
2830         inherited by all descendants. The 'compute all descendants' part of the behavior is what is actually needed.
2831
2832         Instead add separate DescendantsToResolve enum for communicating what else to compute.
2833
2834         * style/StyleTreeResolver.cpp:
2835         (WebCore::Style::TreeResolver::Parent::Parent):
2836         (WebCore::Style::computeDescendantsToResolve):
2837
2838             Figure out which descendants will need resolving based on how the current elements style changed.
2839
2840         (WebCore::Style::TreeResolver::resolveElement):
2841         (WebCore::Style::TreeResolver::createAnimatedElementUpdate):
2842         (WebCore::Style::TreeResolver::pushParent):
2843         (WebCore::Style::shouldResolveElement):
2844
2845             Use DescendantsToResolve as input.
2846
2847         (WebCore::Style::TreeResolver::resolveComposedTree):
2848         * style/StyleTreeResolver.h:
2849         * style/StyleUpdate.h:
2850         (WebCore::Style::ElementUpdates::ElementUpdates):
2851
2852             Add DescendantsToResolve.
2853
2854 2018-01-11  Wenson Hsieh  <wenson_hsieh@apple.com>
2855
2856         Send PromisedBlobInfo to the client through DragItem instead of DragClient::prepareToDragPromisedBlob
2857         https://bugs.webkit.org/show_bug.cgi?id=181497
2858
2859         Reviewed by Tim Horton.
2860
2861         Refactor drag initiation with DOMFile-backed attachment elements. See WebKit ChangeLog for more information. No
2862         change in behavior; promised blob dragging covered by WKAttachment API tests.
2863
2864         * loader/EmptyClients.cpp:
2865         * page/DragClient.h:
2866         (WebCore::DragClient::prepareToDragPromisedBlob): Deleted.
2867         * page/DragController.cpp:
2868         (WebCore::DragController::startDrag):
2869         (WebCore::DragController::doImageDrag):
2870         (WebCore::DragController::doSystemDrag):
2871         (WebCore::DragController::promisedBlobInfo):
2872         (WebCore::DragController::dragAttachmentElement): Deleted.
2873         * page/DragController.h:
2874         * platform/DragItem.h:
2875         (WebCore::DragItem::encode const):
2876         (WebCore::DragItem::decode):
2877
2878 2018-01-11  Youenn Fablet  <youenn@apple.com>
2879
2880         RTCController should disable ICE candidate filtering in case of getUserMedia based on the RTCPerrConnection origin
2881         https://bugs.webkit.org/show_bug.cgi?id=180851
2882
2883         Reviewed by Eric Carlson.
2884
2885         Test: http/wpt/webrtc/third-party-frame-ice-candidate-filtering.html
2886
2887         RTCController now stores all the client origins (top+frame origins) of frames that got access to camera/microphone access.
2888         For any such client origin, PeerConnection objects ICE candidate filtering is disabled.
2889         ICE candidate filtering is reset whenever navigating/reloading the page.
2890
2891         * Modules/mediastream/RTCController.cpp:
2892         (WebCore::RTCController::reset):
2893         (WebCore::matchDocumentOrigin):
2894         (WebCore::RTCController::shouldDisableICECandidateFiltering):
2895         (WebCore::RTCController::add):
2896         (WebCore::RTCController::disableICECandidateFilteringForAllOrigins):
2897         (WebCore::RTCController::disableICECandidateFiltering):
2898         (WebCore::RTCController::enableICECandidateFiltering):
2899         * Modules/mediastream/RTCController.h:
2900         * Modules/mediastream/RTCPeerConnection.cpp:
2901         (WebCore::RTCPeerConnection::create):
2902         * Modules/mediastream/UserMediaRequest.cpp:
2903         (WebCore::UserMediaRequest::allow):
2904         * page/Page.cpp:
2905         (WebCore::Page::disableICECandidateFiltering):
2906         * testing/Internals.cpp:
2907         (WebCore::Internals::setICECandidateFiltering):
2908
2909 2018-01-11  Ali Juma  <ajuma@chromium.org>
2910
2911         window.visualViewport should behave as [SameObject]
2912         https://bugs.webkit.org/show_bug.cgi?id=181548
2913
2914         Reviewed by Chris Dumez.
2915
2916         Add 'GenerateIsReachable' to VisualViewport so that window.visualViewport's
2917         JS wrapper object doesn't get garbage collected too soon.
2918
2919         Test: fast/visual-viewport/visual-viewport-same-object.html
2920
2921         * page/VisualViewport.idl:
2922
2923 2018-01-11  Basuke Suzuki  <Basuke.Suzuki@sony.com>
2924
2925         [Curl] Extract multipart handling from ResourceHandle to CurlRequest.
2926         https://bugs.webkit.org/show_bug.cgi?id=181506
2927
2928         Reviewed by Alex Christensen.
2929
2930         Rename old MultipartHandle class to CurlMultipartHandle and modernize it. Also move the responsibility 
2931         of handling multi part from ResourceHandle to CurlRequest. This is required for upcoming NetworkLoadTask.
2932
2933         No new tests because no new behavior.
2934
2935         * platform/Curl.cmake:
2936         * platform/network/curl/CurlMultipartHandle.cpp: Renamed from Source/WebCore/platform/network/curl/MultipartHandle.cpp.
2937         (WebCore::CurlMultipartHandle::createIfNeeded):
2938         (WebCore::CurlMultipartHandle::extractBoundary):
2939         (WebCore::CurlMultipartHandle::extractBoundaryFromContentType):
2940         (WebCore::CurlMultipartHandle::CurlMultipartHandle):
2941         (WebCore::CurlMultipartHandle::didReceiveData):
2942         (WebCore::CurlMultipartHandle::didComplete):
2943         (WebCore::CurlMultipartHandle::processContent):
2944         (WebCore::CurlMultipartHandle::checkForBoundary):
2945         (WebCore::CurlMultipartHandle::matchedLength):
2946         (WebCore::CurlMultipartHandle::parseHeadersIfPossible):
2947         * platform/network/curl/CurlMultipartHandle.h: Renamed from Source/WebCore/platform/network/curl/MultipartHandle.h.
2948         (WebCore::CurlMultipartHandle::~CurlMultipartHandle):
2949         * platform/network/curl/CurlMultipartHandleClient.h: Added.
2950         (WebCore::CurlMultipartHandleClient::~CurlMultipartHandleClient):
2951         * platform/network/curl/CurlRequest.cpp:
2952         (WebCore::CurlRequest::CurlRequest):
2953         (WebCore::CurlRequest::didReceiveHeader):
2954         (WebCore::CurlRequest::didReceiveData):
2955         (WebCore::CurlRequest::didReceiveHeaderFromMultipart):
2956         (WebCore::CurlRequest::didReceiveDataFromMultipart):
2957         (WebCore::CurlRequest::didCompleteTransfer):
2958         (WebCore::CurlRequest::finalizeTransfer):
2959         (WebCore::CurlRequest::invokeDidReceiveResponseForFile):
2960         (WebCore::CurlRequest::invokeDidReceiveResponse):
2961         (WebCore::CurlRequest::completeDidReceiveResponse):
2962         * platform/network/curl/CurlRequest.h:
2963         (WebCore::CurlRequest::create):
2964         * platform/network/curl/ResourceHandleCurlDelegate.cpp:
2965         (WebCore::ResourceHandleCurlDelegate::createCurlRequest):
2966         (WebCore::ResourceHandleCurlDelegate::curlDidReceiveResponse):
2967         (WebCore::ResourceHandleCurlDelegate::curlDidReceiveBuffer):
2968         (WebCore::ResourceHandleCurlDelegate::curlDidComplete):
2969         * platform/network/curl/ResourceHandleCurlDelegate.h:
2970
2971 2018-01-11  Zalan Bujtas  <zalan@apple.com>
2972
2973         RenderTreeUpdater::current() returns null_ptr when mutation is done through Document::resolveStyle.
2974         https://bugs.webkit.org/show_bug.cgi?id=181513
2975         <rdar://problem/36367085>
2976
2977         Reviewed by Antti Koivisto.
2978
2979         This patch ensures that we use a valid RenderTreeBuilder even when
2980         Document::resolveStyle (incorrectly) triggers tree mutation.
2981         It can be reverted soon after the incorrect mutations are taken care of.
2982
2983         Test: fast/forms/button-set-text-crash.html
2984
2985         * rendering/RenderButton.cpp:
2986         (WebCore::RenderButton::setText):
2987         * rendering/RenderMenuList.cpp:
2988         (RenderMenuList::setText):
2989
2990 2018-01-11  Antoine Quint  <graouts@apple.com>
2991
2992         Only listen to webkitplaybacktargetavailabilitychanged when media controls are visible to the user
2993         https://bugs.webkit.org/show_bug.cgi?id=181547
2994         <rdar://problem/35947650>
2995
2996         Reviewed by Eric Carlson.
2997
2998         Because listening to "webkitplaybacktargetavailabilitychanged" events incurs some higher power usage on iOS,
2999         we only listen to such events when controls are visible to the user. In other words, the MediaControls need to
3000         have both "visible" set to "true" and "faded" set to "false". To support this, we add a delegate method on
3001         MediaControls such that it can tell the MediaController that the "visible" property changed. With this message,
3002         MediaController can inform its MediaControllerSupport objects that user visibility of the controls changed, which
3003         lets AirplaySupport disable itself when controls are no longer visible.
3004
3005         Test: media/modern-media-controls/airplay-support/airplay-support-disable-event-listeners-with-hidden-controls.html
3006
3007         * Modules/modern-media-controls/controls/media-controls.js:
3008         (MediaControls.prototype.set visible):
3009         * Modules/modern-media-controls/media/airplay-support.js:
3010         (AirplaySupport.prototype.controlsUserVisibilityDidChange):
3011         * Modules/modern-media-controls/media/media-controller-support.js:
3012         (MediaControllerSupport.prototype.controlsUserVisibilityDidChange):
3013         * Modules/modern-media-controls/media/media-controller.js:
3014         (MediaController.prototype.mediaControlsVisibilityDidChange):
3015         (MediaController.prototype.mediaControlsFadedStateDidChange):
3016         (MediaController.prototype._controlsUserVisibilityDidChange):
3017
3018 2018-01-11  Antoine Quint  <graouts@apple.com>
3019
3020         [iOS] There should be no controls markup generated in fullscreen
3021         https://bugs.webkit.org/show_bug.cgi?id=181540
3022         <rdar://problem/35060379>
3023
3024         Reviewed by Eric Carlson.
3025
3026         We completely forgo the display of any content when fullscreen on iOS by setting the
3027         "visible" flag to "false" on the MediaControls, which will prevent any DOM content from
3028         being added.
3029
3030         * Modules/modern-media-controls/media/media-controller.js:
3031         (MediaController.prototype.handleEvent):
3032         (MediaController.prototype._updateiOSFullscreenProperties):
3033         (MediaController):
3034         (MediaController.prototype._updateSupportingObjectsEnabledState): Deleted.
3035
3036 2018-01-11  Alex Christensen  <achristensen@webkit.org>
3037
3038         Revert changes accidentally committed with r226789.
3039         https://bugs.webkit.org/show_bug.cgi?id=181423
3040
3041         I had some local changes I did not mean to commit.
3042
3043         * platform/network/mac/WebCoreResourceHandleAsOperationQueueDelegate.mm:
3044         (scheduledWithCustomRunLoopMode):
3045         (-[WebCoreResourceHandleAsOperationQueueDelegate callFunctionOnMainThread:]):
3046         (WebCore::if): Deleted.
3047         (WebCore::>::fromCallable): Deleted.
3048
3049 2018-01-10  Simon Fraser  <simon.fraser@apple.com>
3050
3051         On macOS, getBoundingClientRect gives incorrect values when pinch-zoomed
3052         https://bugs.webkit.org/show_bug.cgi?id=181511
3053         rdar://problem/33741427
3054
3055         Reviewed by Zalan Bujtas.
3056         
3057         When reverting "client coordinates are relative to layout viewport" in r219829
3058         I broke documentToClientOffset() on macOS by failing to take pinch zoom scale into
3059         account (frameScaleFactor() is always 1 on iOs, so this bug doesn't manifest there).
3060
3061         Covered by existing tests.
3062
3063         * page/FrameView.cpp:
3064         (WebCore::FrameView::documentToClientOffset const):
3065
3066 2018-01-11  Youenn Fablet  <youenn@apple.com>
3067
3068         Replace WebRTCLegacyAPIDisabled by WebRTCLegacyAPIEnabled and switch off WebRTC legacy flag by default
3069         https://bugs.webkit.org/show_bug.cgi?id=181480
3070
3071         Reviewed by Eric Carlson.
3072
3073         No change of behavior.
3074
3075         * page/RuntimeEnabledFeatures.h: Set default value to false.
3076
3077 2018-01-11  Wenson Hsieh  <wenson_hsieh@apple.com>
3078
3079         [Attachment Support] Support moving attachment elements in editable areas using drag and drop
3080         https://bugs.webkit.org/show_bug.cgi?id=181337
3081         <rdar://problem/36324813>
3082
3083         Reviewed by Tim Horton.
3084
3085         Makes slight adjustments to attachment-specific drag and drop logic to ensure that moving attachments via drag
3086         and drop behaves correctly. See per-change comments for more detail.
3087
3088         Tests:  WKAttachmentTests.DragInPlaceVideoAttachmentElement
3089                 WKAttachmentTests.MoveAttachmentElementAsIconByDragging
3090                 WKAttachmentTests.MoveInPlaceAttachmentElementByDragging
3091
3092         * editing/cocoa/EditorCocoa.mm:
3093         (WebCore::Editor::getPasteboardTypesAndDataForAttachment):
3094
3095         Stop vending the private web archive pasteboard type for attachments, for now. This works around issues where an
3096         attachment element that is dragged and dropped within the same page may lose its blob backing data if we try to
3097         remove and insert it as a fragment from the archive. Providing a web archive would allow us to avoid destroying
3098         and recreating an attachment element when dragging within the same page, but this is a nice-to-have optimization
3099         we can re-enable after investigation in a subsequent patch.
3100
3101         * html/HTMLAttachmentElement.cpp:
3102         (WebCore::HTMLAttachmentElement::populateShadowRootIfNecessary):
3103
3104         Add `draggable=false` to the image element of an in-place attachment element.
3105
3106         * page/DragController.cpp:
3107         (WebCore::enclosingAttachmentElement):
3108         (WebCore::DragController::draggableElement const):
3109
3110         Tweak single-selected-attachment handling to account for in-place attachments. Since the hit-tested node is
3111         inside the shadow subtree of the attachment element, the condition needs to check for the startElement as well
3112         as the startElement's shadow host.
3113
3114         (WebCore::DragController::startDrag):
3115
3116         Make two tweaks here. First, don't require a RenderAttachment to drag an attachment element (this is required
3117         for dragging in-place attachments). This was added in r217083 to address <rdar://problem/32282831>, but is no
3118         longer correct, since attachments may now be displayed in-place.
3119
3120         Secondly, only restore the previous selection if the attachment is in a richly contenteditable area. This was
3121         added to prevent the selection highlight from appearing in when dragging non-editable attachment elements in the
3122         Mail viewer. However, to allow drag moves to occur, we need the selection to persist after drag start.
3123
3124 2018-01-04  Filip Pizlo  <fpizlo@apple.com>
3125
3126         CodeBlocks should be in IsoSubspaces
3127         https://bugs.webkit.org/show_bug.cgi?id=180884
3128
3129         Reviewed by Saam Barati.
3130
3131         No new tests because no new behavior.
3132         
3133         Adopting new parallel constraint API, so that more of the logic of doing parallel
3134         constraint solving is shared between the DOM's output constraints and JSC's output
3135         constraints.
3136
3137         * bindings/js/DOMGCOutputConstraint.cpp:
3138         (WebCore::DOMGCOutputConstraint::executeImpl):
3139         (WebCore::DOMGCOutputConstraint::doParallelWorkImpl): Deleted.
3140         (WebCore::DOMGCOutputConstraint::finishParallelWorkImpl): Deleted.
3141         * bindings/js/DOMGCOutputConstraint.h:
3142
3143 2018-01-11  Wenson Hsieh  <wenson_hsieh@apple.com>
3144
3145         [Attachment Support] Support dragging attachment elements out as files on iOS
3146         https://bugs.webkit.org/show_bug.cgi?id=181199
3147         <rdar://problem/36299316>
3148
3149         Reviewed by Tim Horton, Andy Estes and Joseph Pecoraro.
3150
3151         Adds support for dragging "files" (i.e. creating item providers with preferred attachment presentation styles)
3152         from attachment elements on iOS for Mail. See below for more detail.
3153
3154         Tests:  WKAttachmentTestsIOS.DragAttachmentInsertedAsData
3155                 WKAttachmentTestsIOS.DragAttachmentInsertedAsFile
3156
3157         * page/DragController.cpp:
3158         (WebCore::DragController::platformContentTypeForBlobType const):
3159         (WebCore::DragController::dragAttachmentElement):
3160         * page/DragController.h:
3161         * page/mac/DragControllerMac.mm:
3162         (WebCore::DragController::platformContentTypeForBlobType const):
3163
3164         Add a private method to convert the type of a promised blob to a platform type. For Cocoa platforms, this
3165         converts the blob type (either a UTI or a MIME type) to a UTI for the platform to consume.
3166
3167         * platform/ios/WebItemProviderPasteboard.h:
3168         * platform/ios/WebItemProviderPasteboard.mm:
3169
3170         Refactor WebItemProviderRegistrationInfo. WebItemProviderRegistrationInfo currently encapsulates a single item
3171         provider registration call, and contains either a type identifier and data buffer, or an NSItemProviderWriting-
3172         conformant object. To register an item provider using a WebItemProviderRegistrationInfo, the item provider
3173         pasteboard currently checks to see whether the info contains an object or a type and data.
3174
3175         This patch removes WebItemProviderRegistrationInfo and replaces it with WebItemProviderDataRegistrar. Objects
3176         that implement this protocol know how to take an NSItemProvider and register data to it. So far, there are
3177         three implementations below.
3178
3179         (-[WebItemProviderDataRegistrar initWithData:type:]):
3180         (-[WebItemProviderDataRegistrar typeIdentifier]):
3181         (-[WebItemProviderDataRegistrar data]):
3182         (-[WebItemProviderDataRegistrar typeIdentifierForClient]):
3183         (-[WebItemProviderDataRegistrar dataForClient]):
3184         (-[WebItemProviderDataRegistrar registerItemProvider:]):
3185         (-[WebItemProviderDataRegistrar description]):
3186
3187         A data registrar takes a UTI and data buffer, and registers the UTI to the data. This replaces a
3188         WebItemProviderRegistrationInfo with both a type and data, but no representing object.
3189
3190         (-[WebItemProviderWritableObjectRegistrar initWithObject:]):
3191         (-[WebItemProviderWritableObjectRegistrar representingObjectForClient]):
3192         (-[WebItemProviderWritableObjectRegistrar registerItemProvider:]):
3193         (-[WebItemProviderWritableObjectRegistrar description]):
3194
3195         The writable object registrar writes an NSItemProviderWriting-conformant object to an item provider. This
3196         replaces a WebItemProviderRegistrationInfo with only a representing object.
3197
3198         (-[WebItemProviderPromisedFileRegistrar initWithType:callback:]):
3199         (-[WebItemProviderPromisedFileRegistrar registerItemProvider:]):
3200         (-[WebItemProviderPromisedFileRegistrar description]):
3201         (-[WebItemProviderRegistrationInfoList addData:forType:]):
3202         (-[WebItemProviderRegistrationInfoList addRepresentingObject:]):
3203         (-[WebItemProviderRegistrationInfoList addPromisedType:fileCallback:]):
3204
3205         Helper methods to add new registrars to a registration info list.
3206
3207         (-[WebItemProviderRegistrationInfoList itemAtIndex:]):
3208         (-[WebItemProviderRegistrationInfoList enumerateItems:]):
3209         (-[WebItemProviderRegistrationInfoList itemProvider]):
3210         (-[WebItemProviderRegistrationInfoList description]):
3211         (-[WebItemProviderRegistrationInfo initWithRepresentingObject:typeIdentifier:data:]): Deleted.
3212         (-[WebItemProviderRegistrationInfo representingObject]): Deleted.
3213         (-[WebItemProviderRegistrationInfo typeIdentifier]): Deleted.
3214
3215 2018-01-11  Michael Saboff  <msaboff@apple.com>
3216
3217         Add a DOM gadget for Spectre testing
3218         https://bugs.webkit.org/show_bug.cgi?id=181351
3219
3220         Reviewed by Ryosuke Niwa.
3221
3222         This change is used to test Spectre mitigations.
3223
3224         Added a new DOM class to test for Spectre issues in the DOM layer.
3225         This additional functionality is disabled by default and must be enabled
3226         through the JSC option "enableSpectreGadgets".
3227
3228         * CMakeLists.txt:
3229         * DerivedSources.make:
3230         * Sources.txt:
3231         * WebCore.xcodeproj/project.pbxproj:
3232         * bindings/js/WebCoreBuiltinNames.h:
3233         * dom/SpectreGadget.cpp: Added.
3234         (WebCore::SpectreGadget::SpectreGadget):
3235         (WebCore::SpectreGadget::create):
3236         (WebCore::SpectreGadget::setReadLength):
3237         (WebCore::SpectreGadget::charCodeAt):
3238         (WebCore::SpectreGadget::clflushReadLength):
3239         * dom/SpectreGadget.h: Added.
3240         * dom/SpectreGadget.idl: Added.
3241         * page/RuntimeEnabledFeatures.cpp:
3242         (WebCore::RuntimeEnabledFeatures::spectreGadgetsEnabled const):
3243         * page/RuntimeEnabledFeatures.h:
3244
3245 2018-01-11  Philippe Normand  <pnormand@igalia.com>
3246
3247         [GTK] media/muted-video-is-playing-audio.html is timing out
3248         https://bugs.webkit.org/show_bug.cgi?id=163781
3249
3250         Reviewed by Carlos Garcia Campos.
3251
3252         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:
3253         (WebCore::MediaPlayerPrivateGStreamer::notifyPlayerOfVideo): Sprinkle some debugging.
3254         (WebCore::MediaPlayerPrivateGStreamer::notifyPlayerOfAudio): Ditto.
3255         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp:
3256         (WebCore::MediaPlayerPrivateGStreamerBase::setMuted): Ditto.
3257
3258 2018-01-10  Andy Estes  <aestes@apple.com>
3259
3260         [Payment Request] Rename ApplePayMerchantValidationEvent to MerchantValidationEvent
3261         https://bugs.webkit.org/show_bug.cgi?id=181437
3262         <rdar://problem/36376481>
3263
3264         Reviewed by Tim Horton.
3265         
3266         Renamed ApplePayMerchantValidationEvent to MerchantValidationEvent and changed complete() to accept a Promise.
3267
3268         Test: http/tests/paymentrequest/payment-request-merchant-validation.https.html
3269
3270         * DerivedSources.make:
3271         * Modules/applepay/paymentrequest/ApplePayPaymentHandler.cpp:
3272         (WebCore::ApplePayPaymentHandler::merchantValidationCompleted):
3273         (WebCore::ApplePayPaymentHandler::validateMerchant):
3274         * Modules/applepay/paymentrequest/ApplePayPaymentHandler.h:
3275         * Modules/paymentrequest/MerchantValidationEvent.cpp: Renamed from Source/WebCore/Modules/applepay/paymentrequest/ApplePayMerchantValidationEvent.cpp.
3276         (WebCore::MerchantValidationEvent::create):
3277         (WebCore::MerchantValidationEvent::MerchantValidationEvent):
3278         (WebCore::MerchantValidationEvent::eventInterface const):
3279         (WebCore::MerchantValidationEvent::complete):
3280         * Modules/paymentrequest/MerchantValidationEvent.h: Renamed from Source/WebCore/Modules/applepay/paymentrequest/ApplePayMerchantValidationEvent.h.
3281         * Modules/paymentrequest/MerchantValidationEvent.idl: Renamed from Source/WebCore/Modules/applepay/paymentrequest/ApplePayMerchantValidationEvent.idl.
3282         * Modules/paymentrequest/PaymentHandler.h:
3283         * Modules/paymentrequest/PaymentRequest.cpp:
3284         (WebCore::PaymentRequest::completeMerchantValidation):
3285         * Modules/paymentrequest/PaymentRequest.h:
3286         * Modules/paymentrequest/PaymentRequest.idl:
3287         * WebCore.xcodeproj/project.pbxproj:
3288         * dom/EventNames.h:
3289         * dom/EventNames.in:
3290
3291 2018-01-10  Basuke Suzuki  <Basuke.Suzuki@sony.com>
3292
3293         [Curl] Cross-protocol, cross-site scripting (XPXSS) using HTML forms
3294         Nhttps://bugs.webkit.org/show_bug.cgi?id=153088
3295
3296         Reviewed by Alex Christensen.
3297
3298         No new tests because it's covered by existing tests.
3299
3300         * platform/network/curl/CurlContext.cpp:
3301         (WebCore::CurlHandle::getHttpVersion):
3302         * platform/network/curl/CurlContext.h:
3303         * platform/network/curl/CurlRequest.cpp:
3304         (WebCore::CurlRequest::didReceiveHeader):
3305         * platform/network/curl/CurlResponse.h:
3306         (WebCore::CurlResponse::isolatedCopy const):
3307         * platform/network/curl/ResourceResponseCurl.cpp:
3308         (WebCore::ResourceResponse::ResourceResponse):
3309         (WebCore::ResourceResponse::setStatusLine):
3310
3311 2018-01-10  Wenson Hsieh  <wenson_hsieh@apple.com>
3312
3313         REGRESSION(r222507): Composition highlight doesn't render when using IME
3314         https://bugs.webkit.org/show_bug.cgi?id=181485
3315         <rdar://problem/35896516>
3316
3317         Reviewed by Ryosuke Niwa.
3318
3319         Fixes the order of arguments passed to paintTextSubrangeBackground from paintCompositionBackground.
3320
3321         Test: editing/marked-text-appearance.html
3322
3323         * rendering/InlineTextBox.cpp:
3324         (WebCore::InlineTextBox::paintCompositionBackground):
3325
3326 2018-01-10  Youenn Fablet  <youenn@apple.com>
3327
3328         Use no-cache fetch mode when loading main documents with location.reload()
3329         https://bugs.webkit.org/show_bug.cgi?id=181285
3330
3331         Reviewed by Alex Christensen.
3332
3333         Covered by rebased tests.
3334
3335         Start to translate cache policy used for navigation as FetchOptions::Cache.
3336         This allows ensuring service workers receive the right cache mode when intercepting navigation loads.
3337         To not change current navigation behavior, ReturnCacheDataElseLoad and ReturnCacheDataDontLoad still trigger default fetch cache mode.
3338
3339         For Reload and ReloadExpiredOnly frame load types, using no-cache mode is more efficient than reload mode,
3340         as a conditional request will be sent if possible. This applies to location.reload which is consistent with other browsers.
3341         Keep reload mode for ReloadFromOrigin.
3342
3343         * loader/DocumentLoader.cpp:
3344         (WebCore::toFetchOptionsCache):
3345         (WebCore::DocumentLoader::loadMainResource):
3346         * loader/FrameLoader.cpp:
3347         (WebCore::FrameLoader::loadFrameRequest):
3348         (WebCore::FrameLoader::loadURL):
3349         (WebCore::FrameLoader::load):
3350         (WebCore::FrameLoader::reload):
3351         (WebCore::FrameLoader::defaultRequestCachingPolicy):
3352         (WebCore::FrameLoader::loadDifferentDocumentItem):
3353         * loader/NavigationScheduler.cpp:
3354
3355 2018-01-10  Commit Queue  <commit-queue@webkit.org>
3356
3357         Unreviewed, rolling out r226667 and r226673.
3358         https://bugs.webkit.org/show_bug.cgi?id=181488
3359
3360         This caused a flaky crash. (Requested by mlewis13 on #webkit).
3361
3362         Reverted changesets:
3363
3364         "CodeBlocks should be in IsoSubspaces"
3365         https://bugs.webkit.org/show_bug.cgi?id=180884
3366         https://trac.webkit.org/changeset/226667
3367
3368         "REGRESSION (r226667): CodeBlocks should be in IsoSubspaces"
3369         https://bugs.webkit.org/show_bug.cgi?id=180884
3370         https://trac.webkit.org/changeset/226673
3371
3372 2018-01-10  Antti Koivisto  <antti@apple.com>
3373
3374         REGRESSION(r225650): The scores of MotionMark tests Multiply and Leaves dropped by 8%
3375         https://bugs.webkit.org/show_bug.cgi?id=181460
3376         <rdar://problem/36379776>
3377
3378         Reviewed by Ryosuke Niwa.
3379
3380         * css/parser/CSSParser.cpp:
3381         (WebCore::CSSParserContext::CSSParserContext):
3382
3383         Don't do the expensive security origin test if the sheet base URL and document URL are identical.
3384         This is true for inline style and inline stylesheets.
3385
3386 2018-01-10  Antti Koivisto  <antti@apple.com>
3387
3388         Try to fix windows build.
3389
3390         * css/RuleFeature.cpp:
3391         (WebCore::RuleFeatureSet::computeNextMatchElement):
3392
3393 2018-01-10  Zalan Bujtas  <zalan@apple.com>
3394
3395         [RenderTreeBuilder] Move RenderRuby's moveChildren logic to RenderTreeBuilder
3396         https://bugs.webkit.org/show_bug.cgi?id=181470
3397         <rdar://problem/36397683>
3398
3399         Reviewed by Antti Koivisto.
3400
3401         This is about moving code, no cleanup and/or normalization (unfortunately it also means
3402         some temporary changes).  
3403
3404         No change in functionality.
3405
3406         * rendering/RenderBlockFlow.h:
3407         * rendering/RenderRubyBase.cpp:
3408         (WebCore::RenderRubyBase::moveChildren): Deleted.
3409         (WebCore::RenderRubyBase::mergeChildrenWithBase): Deleted.
3410         (WebCore::RenderRubyBase::moveInlineChildren): Deleted.
3411         (WebCore::RenderRubyBase::moveBlockChildren): Deleted.
3412         * rendering/RenderRubyBase.h:
3413         * rendering/RenderRubyRun.cpp:
3414         (WebCore::RenderRubyRun::takeChild):
3415         * rendering/updating/RenderTreeBuilder.cpp:
3416         (WebCore::RenderTreeBuilder::moveRubyChildren):
3417         * rendering/updating/RenderTreeBuilder.h:
3418         * rendering/updating/RenderTreeBuilderRuby.cpp:
3419         (WebCore::RenderTreeBuilder::Ruby::moveInlineChildren):
3420         (WebCore::RenderTreeBuilder::Ruby::moveBlockChildren):
3421         (WebCore::RenderTreeBuilder::Ruby::moveChildren):
3422         (WebCore::RenderTreeBuilder::Ruby::moveChildrenInternal):
3423         (WebCore::RenderTreeBuilder::Ruby::insertChild):
3424         * rendering/updating/RenderTreeBuilderRuby.h:
3425
3426 2018-01-10  Philippe Normand  <pnormand@igalia.com>