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