Unreviewed, rolling out r224860.
[WebKit-https.git] / Source / WebCore / ChangeLog
1 2017-11-14  Ryan Haddad  <ryanhaddad@apple.com>
2
3         Unreviewed, rolling out r224860.
4
5         This change broke the macOS and iOS builds.
6
7         Reverted changeset:
8
9         "Unreviewed, fix CMake debug builds after r224707"
10         https://bugs.webkit.org/show_bug.cgi?id=179499
11         https://trac.webkit.org/changeset/224860
12
13 2017-11-14  Antti Koivisto  <antti@apple.com>
14
15         Media query with :host inside a custom elements doesn't get updated on window resize
16         https://bugs.webkit.org/show_bug.cgi?id=176101
17         <rdar://problem/34163850>
18
19         Reviewed by Simon Fraser.
20
21         If a media query containing :host or ::slotted stops applying we fail to update the style.
22
23         * style/StyleScope.cpp:
24         (WebCore::Style::invalidateHostAndSlottedStyleIfNeeded):
25
26             Factor into function.
27
28         (WebCore::Style::Scope::updateActiveStyleSheets):
29         (WebCore::Style::Scope::scheduleUpdate):
30
31             Invalidate elements that may match :host and ::slotted before clearing style resolver for full update.
32
33 2017-11-14  Carlos Garcia Campos  <cgarcia@igalia.com>
34
35         Move JSONValues to WTF and convert uses of InspectorValues.h to JSONValues.h
36         https://bugs.webkit.org/show_bug.cgi?id=173793
37
38         Reviewed by Brian Burg.
39
40         Based on patch by Brian Burg.
41
42         * ForwardingHeaders/inspector/InspectorValues.h: Removed.
43         * Modules/encryptedmedia/InitDataRegistry.cpp:
44         (WebCore::extractKeyIDsKeyids):
45         (WebCore::sanitizeKeyids):
46         * html/parser/XSSAuditorDelegate.cpp:
47         (WebCore::XSSAuditorDelegate::generateViolationReport):
48         * inspector/CommandLineAPIHost.cpp:
49         (WebCore::CommandLineAPIHost::inspect):
50         * inspector/CommandLineAPIHost.h:
51         * inspector/InspectorCanvas.cpp:
52         (WebCore::InspectorCanvas::recordAction):
53         (WebCore::InspectorCanvas::releaseData):
54         (WebCore::InspectorCanvas::indexForData):
55         (WebCore::buildArrayForVector):
56         (WebCore::InspectorCanvas::buildInitialState):
57         (WebCore::InspectorCanvas::buildAction):
58         (WebCore::InspectorCanvas::buildArrayForCanvasGradient):
59         (WebCore::InspectorCanvas::buildArrayForCanvasPattern):
60         (WebCore::InspectorCanvas::buildArrayForImageData):
61         (WebCore::InspectorCanvas::buildArrayForImageBitmap):
62         * inspector/InspectorCanvas.h:
63         * inspector/InspectorDatabaseResource.cpp:
64         * inspector/InspectorOverlay.cpp:
65         (WebCore::evaluateCommandInOverlay):
66         (WebCore::InspectorOverlay::evaluateInOverlay):
67         * inspector/InspectorOverlay.h:
68         * inspector/InspectorShaderProgram.h:
69         * inspector/InspectorStyleSheet.h:
70         (WebCore::InspectorCSSId::InspectorCSSId):
71         * inspector/TimelineRecordFactory.cpp:
72         (WebCore::TimelineRecordFactory::createGenericRecord):
73         (WebCore::TimelineRecordFactory::createFunctionCallData):
74         (WebCore::TimelineRecordFactory::createConsoleProfileData):
75         (WebCore::TimelineRecordFactory::createProbeSampleData):
76         (WebCore::TimelineRecordFactory::createEventDispatchData):
77         (WebCore::TimelineRecordFactory::createGenericTimerData):
78         (WebCore::TimelineRecordFactory::createTimerInstallData):
79         (WebCore::TimelineRecordFactory::createEvaluateScriptData):
80         (WebCore::TimelineRecordFactory::createTimeStampData):
81         (WebCore::TimelineRecordFactory::createAnimationFrameData):
82         (WebCore::createQuad):
83         (WebCore::TimelineRecordFactory::createPaintData):
84         (WebCore::TimelineRecordFactory::appendLayoutRoot):
85         * inspector/TimelineRecordFactory.h:
86         * inspector/agents/InspectorApplicationCacheAgent.cpp:
87         * inspector/agents/InspectorApplicationCacheAgent.h:
88         * inspector/agents/InspectorCSSAgent.cpp:
89         (WebCore::computePseudoClassMask):
90         (WebCore::InspectorCSSAgent::setStyleText):
91         (WebCore::InspectorCSSAgent::setRuleSelector):
92         (WebCore::InspectorCSSAgent::forcePseudoState):
93         * inspector/agents/InspectorCSSAgent.h:
94         * inspector/agents/InspectorDOMAgent.cpp:
95         (WebCore::parseColor):
96         (WebCore::parseConfigColor):
97         (WebCore::parseQuad):
98         (WebCore::InspectorDOMAgent::performSearch):
99         (WebCore::InspectorDOMAgent::setSearchingForNode):
100         (WebCore::InspectorDOMAgent::highlightConfigFromInspectorObject):
101         (WebCore::InspectorDOMAgent::setInspectModeEnabled):
102         (WebCore::InspectorDOMAgent::highlightRect):
103         (WebCore::InspectorDOMAgent::highlightQuad):
104         (WebCore::InspectorDOMAgent::innerHighlightQuad):
105         (WebCore::InspectorDOMAgent::highlightSelector):
106         (WebCore::InspectorDOMAgent::highlightNode):
107         (WebCore::InspectorDOMAgent::highlightNodeList):
108         (WebCore::InspectorDOMAgent::highlightFrame):
109         * inspector/agents/InspectorDOMAgent.h:
110         * inspector/agents/InspectorDOMDebuggerAgent.cpp:
111         (WebCore::InspectorDOMDebuggerAgent::didInvalidateStyleAttr):
112         (WebCore::InspectorDOMDebuggerAgent::willInsertDOMNode):
113         (WebCore::InspectorDOMDebuggerAgent::willRemoveDOMNode):
114         (WebCore::InspectorDOMDebuggerAgent::willModifyDOMAttr):
115         (WebCore::InspectorDOMDebuggerAgent::descriptionForDOMEvent):
116         (WebCore::InspectorDOMDebuggerAgent::pauseOnNativeEventIfNeeded):
117         (WebCore::InspectorDOMDebuggerAgent::willSendXMLHttpRequest):
118         * inspector/agents/InspectorDOMDebuggerAgent.h:
119         * inspector/agents/InspectorDOMStorageAgent.cpp:
120         (WebCore::InspectorDOMStorageAgent::getDOMStorageItems):
121         (WebCore::InspectorDOMStorageAgent::setDOMStorageItem):
122         (WebCore::InspectorDOMStorageAgent::removeDOMStorageItem):
123         (WebCore::InspectorDOMStorageAgent::findStorageArea):
124         * inspector/agents/InspectorDOMStorageAgent.h:
125         * inspector/agents/InspectorDatabaseAgent.cpp:
126         * inspector/agents/InspectorIndexedDBAgent.cpp:
127         (WebCore::Inspector::idbKeyFromInspectorObject):
128         (WebCore::Inspector::idbKeyRangeFromKeyRange):
129         (WebCore::InspectorIndexedDBAgent::requestData):
130         * inspector/agents/InspectorIndexedDBAgent.h:
131         * inspector/agents/InspectorNetworkAgent.cpp:
132         (WebCore::buildObjectForHeaders):
133         (WebCore::InspectorNetworkAgent::buildObjectForResourceResponse):
134         (WebCore::InspectorNetworkAgent::setExtraHTTPHeaders):
135         * inspector/agents/InspectorNetworkAgent.h:
136         * inspector/agents/InspectorPageAgent.cpp:
137         * inspector/agents/InspectorPageAgent.h:
138         * inspector/agents/InspectorTimelineAgent.cpp:
139         (WebCore::InspectorTimelineAgent::setInstruments):
140         (WebCore::InspectorTimelineAgent::internalStart):
141         (WebCore::InspectorTimelineAgent::didInvalidateLayout):
142         (WebCore::InspectorTimelineAgent::willLayout):
143         (WebCore::InspectorTimelineAgent::didScheduleStyleRecalculation):
144         (WebCore::InspectorTimelineAgent::willRecalculateStyle):
145         (WebCore::InspectorTimelineAgent::willComposite):
146         (WebCore::InspectorTimelineAgent::willPaint):
147         (WebCore::InspectorTimelineAgent::addRecordToTimeline):
148         (WebCore::InspectorTimelineAgent::setFrameIdentifier):
149         (WebCore::InspectorTimelineAgent::appendRecord):
150         (WebCore::InspectorTimelineAgent::sendEvent):
151         (WebCore::InspectorTimelineAgent::createRecordEntry):
152         (WebCore::InspectorTimelineAgent::pushCurrentRecord):
153         * inspector/agents/InspectorTimelineAgent.h:
154         * page/csp/ContentSecurityPolicy.cpp:
155         (WebCore::ContentSecurityPolicy::reportViolation const):
156         * platform/encryptedmedia/clearkey/CDMClearKey.cpp:
157         (WebCore::parseJSONObject):
158         (WebCore::parseLicenseFormat):
159         (WebCore::parseLicenseReleaseAcknowledgementFormat):
160         (WebCore::CDMInstanceClearKey::updateLicense):
161         (WebCore::CDMInstanceClearKey::removeSessionData):
162         * platform/graphics/avfoundation/CDMFairPlayStreaming.cpp:
163         (WebCore::extractSinfData):
164         * testing/Internals.cpp:
165
166 2017-11-14  Michael Catanzaro  <mcatanzaro@igalia.com>
167
168         Unreviewed, fix CMake debug builds after r224707
169         https://bugs.webkit.org/show_bug.cgi?id=179499
170         <rdar://problem/35445033>
171
172         * PlatformWin.cmake:
173         * Sources.txt:
174
175 2017-11-14  Michael Catanzaro  <mcatanzaro@igalia.com>
176
177         Another attempt to fix GTK/WPE debug builds
178         https://bugs.webkit.org/show_bug.cgi?id=179660
179
180         * platform/graphics/cairo/NativeImageCairo.cpp:
181         (WebCore::drawNativeImage):
182
183 2017-11-14  Alex Christensen  <achristensen@webkit.org>
184
185         Fix Windows build.
186
187         * html/canvas/WebGLRenderingContext.h:
188
189 2017-11-14  Chris Dumez  <cdumez@apple.com>
190
191         [Service Workers] Implement container.getRegistrations()
192         https://bugs.webkit.org/show_bug.cgi?id=179672
193
194         Reviewed by Brady Eidson.
195
196         Implement container.getRegistrations():
197         - https://w3c.github.io/ServiceWorker/#dom-serviceworkercontainer-getregistrations
198
199         No new tests, rebaselined existing test.
200
201         * workers/service/ServiceWorkerContainer.cpp:
202         (WebCore::ServiceWorkerContainer::getRegistration):
203         (WebCore::ServiceWorkerContainer::getRegistrations):
204         (WebCore::ServiceWorkerContainer::jobResolvedWithRegistration):
205         * workers/service/ServiceWorkerContainer.h:
206         * workers/service/ServiceWorkerRegistration.cpp:
207         (WebCore::ServiceWorkerRegistration::getOrCreate):
208         * workers/service/ServiceWorkerRegistration.h:
209         * workers/service/ServiceWorkerRegistrationKey.cpp:
210         (WebCore::ServiceWorkerRegistrationKey::isMatching const):
211         (WebCore::ServiceWorkerRegistrationKey::originIsMatching const):
212         * workers/service/ServiceWorkerRegistrationKey.h:
213         * workers/service/server/SWClientConnection.h:
214         * workers/service/server/SWServer.cpp:
215         (WebCore::SWServer::getRegistrations):
216         * workers/service/server/SWServer.h:
217
218 2017-11-14  Alex Christensen  <achristensen@webkit.org>
219
220         Fix Windows build.
221
222         * html/canvas/WebGLRenderingContext.h:
223
224 2017-11-14  Michael Catanzaro  <mcatanzaro@igalia.com>
225
226         Unreviewed, fix GTK/WPE debug builds even better after r224813
227         https://bugs.webkit.org/show_bug.cgi?id=179660
228
229         * platform/graphics/cairo/NativeImageCairo.cpp:
230         (WebCore::drawNativeImage):
231
232 2017-11-14  Michael Catanzaro  <mcatanzaro@igalia.com>
233
234         Unreviewed, fix GTK/WPE debug builds after r224813
235         https://bugs.webkit.org/show_bug.cgi?id=179660
236
237         * platform/graphics/cairo/NativeImageCairo.cpp:
238         (WebCore::drawNativeImage):
239
240 2017-11-14  Youenn Fablet  <youenn@apple.com>
241
242         Implement ServiceWorker handle fetch for navigation loads
243         https://bugs.webkit.org/show_bug.cgi?id=179404
244
245         Reviewed by Alex Christensen and Chris Dumez.
246
247         Covered by rebased tests.
248
249         Step 11 of https://w3c.github.io/ServiceWorker/#on-fetch-request-algorithm is implemented in DocumentLoader as it centralizes main request loading
250         and knows about the context of it.
251
252         For each main resource load in document loader, we first check whether there is a matching service worker.
253         The fetch request is updated accordingly so that there is no difference in the handling of navigation vs. subresource requests after that point.
254
255         Updated DocumentThreadableLoader::didReceiveResponse since it can now receive responses from service worker with various response types.
256         A follow-up patch should properly handle cross origin responses.
257
258         * loader/DocumentLoader.cpp:
259         (WebCore::DocumentLoader::commitData):
260         (WebCore::DocumentLoader::startLoadingMainResource):
261         (WebCore::DocumentLoader::doLoadingMainResource):
262         * loader/DocumentLoader.h:
263         * loader/DocumentThreadableLoader.cpp:
264         (WebCore::DocumentThreadableLoader::didReceiveResponse):
265         * loader/cache/CachedResourceRequest.cpp:
266         (WebCore::CachedResourceRequest::setNavigationServiceWorkerRegistrationData):
267         * loader/cache/CachedResourceRequest.h:
268         * platform/MIMETypeRegistry.h:
269         * platform/network/cocoa/WebCoreNSURLSession.mm:
270         (-[WebCoreNSURLSessionDataTask resource:receivedResponse:]):
271
272 2017-11-14  Alex Christensen  <achristensen@webkit.org>
273
274         Log moveFile failure errors
275         https://bugs.webkit.org/show_bug.cgi?id=179695
276
277         Reviewed by Brady Eidson.
278
279         Content extension tests are flaky. In r224790 I added logs to find out why, and they indicate that moveFile is failing.
280         To further understand why, I'm adding logs to see what's happening sometimes on the bots.
281
282         * platform/cocoa/FileSystemCocoa.mm:
283         (WebCore::FileSystem::moveFile):
284
285 2017-11-14  Dean Jackson  <dino@apple.com>
286
287         Fix Windows build.
288
289         * html/OffscreenCanvas.cpp:
290         * html/OffscreenCanvas.h:
291         * html/OffscreenCanvas.idl:
292
293 2017-11-14  Alex Christensen  <achristensen@webkit.org>
294
295         Remove Cocoa CFURLConnection loading code
296         https://bugs.webkit.org/show_bug.cgi?id=179688
297
298         Reviewed by Antti Koivisto.
299
300         CFURLConnection is only used on the AppleWin port now.
301
302         * PlatformMac.cmake:
303         * SourcesCocoa.txt:
304         * SourcesIOS.txt:
305         * WebCore.xcodeproj/project.pbxproj:
306         * loader/DocumentLoader.h:
307         * loader/EmptyFrameLoaderClient.h:
308         * loader/FrameLoaderClient.h:
309         * loader/ResourceLoader.cpp:
310         * loader/ResourceLoader.h:
311         * loader/SubresourceLoader.h:
312         * loader/cf/ResourceLoaderCFNet.cpp:
313         * loader/cocoa/SubresourceLoaderCocoa.mm:
314         * loader/mac/DocumentLoaderMac.cpp:
315         * loader/mac/ResourceLoaderMac.mm:
316         * page/mac/PageMac.mm:
317         (WebCore::Page::platformInitialize):
318         (WebCore::Page::addSchedulePair):
319         (WebCore::Page::removeSchedulePair):
320         * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
321         (WebCore::MediaPlayerPrivateAVFoundationObjC::shouldWaitForResponseToAuthenticationChallenge):
322         (WebCore::WebCoreNSURLAuthenticationChallengeClient::create): Deleted.
323         (WebCore::WebCoreNSURLAuthenticationChallengeClient::WebCoreNSURLAuthenticationChallengeClient): Deleted.
324         (): Deleted.
325         * platform/network/ProtectionSpaceBase.cpp:
326         * platform/network/ResourceHandle.h:
327         * platform/network/ResourceHandleInternal.h:
328         * platform/network/cf/AuthenticationCF.cpp:
329         (WebCore::AuthenticationChallenge::AuthenticationChallenge):
330         (WebCore::createCF):
331         (WebCore::core):
332         (): Deleted.
333         * platform/network/cf/AuthenticationCF.h:
334         * platform/network/cf/CookieJarCFNet.cpp:
335         (WebCore::copyCookiesForURLWithFirstPartyURL):
336         (WebCore::createCookies):
337         (WebCore::deleteAllCookiesModifiedSince):
338         * platform/network/cf/CookieStorageCFNet.cpp:
339         * platform/network/cf/CredentialStorageCFNet.cpp:
340         (WebCore::CredentialStorage::getFromPersistentStorage):
341         * platform/network/cf/ResourceErrorCF.cpp:
342         (WebCore::ResourceError::setCertificate):
343         (WebCore::ResourceError::platformLazyInit):
344         (WebCore::ResourceError::doPlatformIsolatedCopy):
345         (WebCore::ResourceError::cfError const):
346         * platform/network/cf/ResourceHandleCFNet.cpp:
347         * platform/network/cf/ResourceHandleCFURLConnectionDelegate.cpp:
348         * platform/network/cf/ResourceHandleCFURLConnectionDelegateWithOperationQueue.cpp:
349         (WebCore::ResourceHandleCFURLConnectionDelegateWithOperationQueue::setupRequest):
350         (WebCore::installHookToRemoveCFNetworkMessageBlockingMainThread):
351         (WebCore::ResourceHandleCFURLConnectionDelegateWithOperationQueue::setupConnectionScheduling):
352         (WebCore::ResourceHandleCFURLConnectionDelegateWithOperationQueue::didReceiveResponse):
353         (WebCore::ResourceHandleCFURLConnectionDelegateWithOperationQueue::willCacheResponse):
354         (WebCore::ResourceHandleCFURLConnectionDelegateWithOperationQueue::canRespondToProtectionSpace):
355         * platform/network/cocoa/CredentialCocoa.mm:
356         (WebCore::Credential::cfCredential const): Deleted.
357         * platform/network/cocoa/ProtectionSpaceCocoa.mm:
358         (WebCore::ProtectionSpace::cfSpace const): Deleted.
359         * platform/network/cocoa/ResourceRequestCocoa.mm:
360         (WebCore::ResourceRequest::nsURLRequest const):
361         (WebCore::ResourceRequest::clearOrUpdateNSURLRequest): Deleted.
362         * platform/network/cocoa/ResourceResponseCocoa.mm:
363         (WebCore::ResourceResponse::platformCertificateInfo const):
364         (WebCore::ResourceResponse::ResourceResponse): Deleted.
365         * platform/network/ios/ResourceHandleIOS.mm: Removed.
366         * platform/network/mac/AuthenticationMac.mm:
367         (WebCore::AuthenticationChallenge::authenticationClient const):
368         (WebCore::mac):
369         (-[WebCoreAuthenticationClientAsChallengeSender setCFChallenge:]): Deleted.
370         (-[WebCoreAuthenticationClientAsChallengeSender cfChallenge]): Deleted.
371         * platform/network/mac/ResourceHandleMac.mm:
372         (WebCore::synchronousWillSendRequestEnabled):
373         * platform/network/mac/ResourceRequestMac.mm: Removed.
374
375 2017-11-14  Daniel Bates  <dabates@apple.com>
376
377         Update comment in FeatureDefines.xcconfig to reflect location of Visual Studio property files
378         for feature defines
379
380         Following r195498 and r201917 the Visual Studio property files for feature defines have
381         moved from directory WebKitLibraries/win/tools/vsprops to directory Source/cmake/tools/vsprops.
382         Update the comment in FeatureDefines.xcconfig to reflect the new location and names of these
383         files.
384
385         * Configurations/FeatureDefines.xcconfig:
386
387 2017-11-14  Antti Koivisto  <antti@apple.com>
388
389         Remove StyleResolver::State::document()
390         https://bugs.webkit.org/show_bug.cgi?id=179678
391
392         Reviewed by Antoine Quint.
393
394         We don't need both StyleResolver::document() and StyleResolver::State::document().
395
396         * css/StyleResolver.cpp:
397         (WebCore::StyleResolver::State::updateConversionData):
398         (WebCore::StyleResolver::resolvedVariableValue):
399         (WebCore::StyleResolver::colorFromPrimitiveValue const):
400         (WebCore::StyleResolver::createFilterOperations):
401         * css/StyleResolver.h:
402         (WebCore::StyleResolver::State::document const): Deleted.
403
404 2017-11-14  Dean Jackson  <dino@apple.com>
405
406         Stub implementations of OffscreenCanvas getContext and transferToImageBitmap
407         https://bugs.webkit.org/show_bug.cgi?id=179671
408         <rdar://problem/35534018>
409
410         Reviewed by Antoine Quint.
411
412         Empty implementations of getContext and transferToImageBitmap. At the moment
413         only return a WebGLRenderingContext from getContext, since we don't
414         have an Offscreen 2d context type yet.
415
416         Tests: http/wpt/offscreen-canvas/getContext-webgl.html
417                http/wpt/offscreen-canvas/transferToImageBitmap.html
418
419         * html/OffscreenCanvas.cpp:
420         (WebCore::OffscreenCanvas::getContext):
421         (WebCore::OffscreenCanvas::transferToImageBitmap):
422         * html/OffscreenCanvas.h:
423         * html/OffscreenCanvas.idl:
424         * html/canvas/GPUBasedCanvasRenderingContext.h: Drive-by parameter rename.
425         (WebCore::GPUBasedCanvasRenderingContext::GPUBasedCanvasRenderingContext):
426
427 2017-11-14  Youenn Fablet  <youenn@apple.com>
428
429         WebSWClientConnection should do IPC to StorageProcess if its WebSWOriginTable is not yet initialized
430         https://bugs.webkit.org/show_bug.cgi?id=179668
431
432         Reviewed by Chris Dumez.
433
434         Covered by existing updated tests.
435
436         Removing hasServiceWorkerRegisteredForOrigin and using hasServiceWorkerRegistration instead.
437         The former is only checking the shared map which might not be initialized at the time the function is called.
438         The latter is going to the StorageProcess if the map is not yet initialized.
439
440         * testing/Internals.cpp:
441         (WebCore::Internals::hasServiceWorkerRegisteredForOrigin): Deleted.
442         * testing/Internals.h:
443         * testing/Internals.idl:
444         * workers/service/server/SWClientConnection.h:
445
446 2017-11-14  Joseph Pecoraro  <pecoraro@apple.com>
447
448         Web Inspector: Add a ServiceWorker domain to get information about an inspected ServiceWorker
449         https://bugs.webkit.org/show_bug.cgi?id=179640
450         <rdar://problem/35517361>
451
452         Reviewed by Devin Rousso.
453
454         * Sources.txt:
455         * WebCore.xcodeproj/project.pbxproj:
456         * inspector/InspectorAllInOne.cpp:
457         New files.
458
459         * inspector/WorkerInspectorController.cpp:
460         (WebCore::WorkerInspectorController::createLazyAgents):
461         Add a ServiceWorkerAgent when the Worker is a ServiceWorker.
462
463         * inspector/agents/worker/ServiceWorkerAgent.h: Added.
464         * inspector/agents/worker/ServiceWorkerAgent.cpp: Added.
465         (WebCore::ServiceWorkerAgent::ServiceWorkerAgent):
466         (WebCore::ServiceWorkerAgent::didCreateFrontendAndBackend):
467         (WebCore::ServiceWorkerAgent::willDestroyFrontendAndBackend):
468         (WebCore::ServiceWorkerAgent::getInitializationInfo):
469         Populate initialization info.
470
471 2017-11-14  Brady Eidson  <beidson@apple.com>
472
473         Remove some accidentally checked-in commented-out code.
474
475         Unreviewed.
476
477         * workers/service/server/SWServer.cpp:
478         (WebCore::SWServer::fireInstallEvent):
479         (WebCore::SWServer::fireActivateEvent):
480
481 2017-11-14  Alex Christensen  <achristensen@webkit.org>
482
483         Clean up old URL parser remnants
484         https://bugs.webkit.org/show_bug.cgi?id=179573
485
486         Reviewed by Darin Adler.
487
488         When we transitioned to the new URLParser, we kept the old character tables which were less spec-conformant.
489         Removing them and transitioning to URLParser's table makes more web platform tests pass!
490
491         * fileapi/BlobURL.cpp:
492         (WebCore::BlobURL::createBlobURL):
493         There's no need to percent-encode an origin.  It's already ascii, and if it's not, then the URLParser will escape it.
494         * loader/appcache/ApplicationCacheHost.cpp:
495         (WebCore::ApplicationCacheHost::createFileURL):
496         Removed comment that no longer applies.
497         * platform/URL.cpp:
498         (WebCore::URL::setProtocol):
499         (WebCore::percentEncodeCharacters):
500         (WebCore::URL::setUser):
501         (WebCore::URL::setPass):
502         Percent encode the userinfo character set from the URLParser according to https://url.spec.whatwg.org/#set-the-username and https://url.spec.whatwg.org/#set-the-password
503         (WebCore::URL::setPath):
504         A ? or a # are the only two characters that need to be pre-encoded when setting the path because they indicate the
505         beginning of a query or fragment.  All other characters will be encoded if necessary during parsing.
506         (WebCore::protocolIsInternal):
507         (): Deleted.
508         (WebCore::isSchemeFirstChar): Deleted.
509         (WebCore::isSchemeChar): Deleted.
510         (WebCore::isBadChar): Deleted.
511         (WebCore::isTabNewline): Deleted.
512         (WebCore::appendEscapedChar): Deleted.
513         (WebCore::encodeWithURLEscapeSequences):
514         Encode characters needed.  I used the user info set of characters because that was most similar to the BadChar set of the old parser.
515         This isn't standardized, and it's only used for the search context menu item which certainly isn't standardized.
516         (WebCore::isValidProtocol): Deleted.
517         Remove a bunch of old unused functions.
518         * platform/URLParser.cpp:
519         (WebCore::URLParser::isInUserInfoEncodeSet):
520         (WebCore::URLParser::parseAuthority):
521         * platform/URLParser.h:
522         Expose a few functions for URL.cpp to use.
523
524 2017-11-14  Antti Koivisto  <antti@apple.com>
525
526         Enable display:contents by default
527         https://bugs.webkit.org/show_bug.cgi?id=179655
528
529         Reviewed by Sam Weinig.
530
531         * page/RuntimeEnabledFeatures.h:
532
533 2017-11-14  Zan Dobersek  <zdobersek@igalia.com>
534
535         [Cairo] Move drawLine operation from GraphicsContextCairo to CairoOperations
536         https://bugs.webkit.org/show_bug.cgi?id=179669
537
538         Reviewed by Carlos Garcia Campos.
539
540         Move the drawLine operation implementation into the CairoOperations
541         implementation file, with the Cairo::drawLine() function only expecting
542         a PlatformContextCairo object, two FloatingPoints, and a const reference
543         to a GraphicsContextState object.
544
545         As with drawLinesForText(), the drawLine() implementation utilized a few
546         private GraphicsContext methods that we for now reimplement in the
547         Cairo namespace as static functions, providing necessary state values to
548         perform the computations. The GraphicsContext methods should be changed
549         to become static public functions -- after that we'll be able to remove
550         the new duplicated helper functions.
551
552         No new tests -- no change in behavior.
553
554         * platform/graphics/cairo/CairoOperations.cpp:
555         (WebCore::Cairo::dashedLineCornerWidthForStrokeWidth):
556         (WebCore::Cairo::dashedLinePatternWidthForStrokeWidth):
557         (WebCore::Cairo::dashedLinePatternOffsetForPatternAndStrokeWidth):
558         (WebCore::Cairo::centerLineAndCutOffCorners):
559         (WebCore::Cairo::drawLine):
560         * platform/graphics/cairo/CairoOperations.h:
561         * platform/graphics/cairo/GraphicsContextCairo.cpp:
562         (WebCore::GraphicsContext::drawLine):
563
564 2017-11-14  Tim Horton  <timothy_horton@apple.com>
565
566         Long pressing a phone number with spaces in it results in a link sheet instead of a data detectors sheet
567         https://bugs.webkit.org/show_bug.cgi?id=179646
568         <rdar://problem/35337288>
569
570         Reviewed by Simon Fraser.
571
572         * editing/cocoa/DataDetection.h:
573         * editing/cocoa/DataDetection.mm:
574         (WebCore::DataDetection::canBePresentedByDataDetectors):
575         (WebCore::DataDetection::isDataDetectorLink):
576         Expose canBePresentedByDataDetectors, which tests if the URL's
577         scheme is one of Data Detectors' known long-press schemes.
578
579 2017-11-14  Michael Catanzaro  <mcatanzaro@igalia.com>
580
581         [GTK][WPE] Don't require brotli
582         https://bugs.webkit.org/show_bug.cgi?id=178122
583
584         Reviewed by Frédéric Wang.
585
586         Remove stray remaining use of brotli CMake variable.
587
588         * CMakeLists.txt:
589
590 2017-11-14  Zan Dobersek  <zdobersek@igalia.com>
591
592         [Cairo] Move drawLinesForText operation from GraphicsContextCairo to CairoOperations
593         https://bugs.webkit.org/show_bug.cgi?id=179661
594
595         Reviewed by Carlos Garcia Campos.
596
597         Encapsulate the drawLinesForText() operation in the WebCore::Cairo
598         namespace. Apart from moving gist of the code from GraphicsContextCairo
599         to CairoOperations, we also (for the moment) have to duplicate the
600         GraphicsContext::computeLineBoundsAndAntialiasingModeForText() code.
601         This is necessary because the given method is private on the
602         GraphicsContext class, and relies on an underlying GraphicsContext
603         object to retrieve the current CTM and stroke thickness values.
604
605         The adjusted reimplementation uses PlatformContextCairo to retrieve
606         the CTM (just like Cairo's GraphicsContext::getCTM() does), and
607         requires the stroke thickness value to be passed in as an argument.
608         Similar modifications will be proposed for the existing
609         GraphicsContext::computeLineBoundsAndAntialiasingModeForText() code,
610         and once that's approved the duplicated code will be eliminated.
611
612         No new tests -- no change in behavior.
613
614         * platform/graphics/cairo/CairoOperations.cpp:
615         (WebCore::Cairo::computeLineBoundsAndAntialiasingModeForText):
616         (WebCore::Cairo::drawLinesForText):
617         * platform/graphics/cairo/CairoOperations.h:
618         * platform/graphics/cairo/GraphicsContextCairo.cpp:
619         (WebCore::GraphicsContext::drawLinesForText):
620
621 2017-11-14  Zan Dobersek  <zdobersek@igalia.com>
622
623         [Cairo] Move native image drawing operation to CairoOperations
624         https://bugs.webkit.org/show_bug.cgi?id=179660
625
626         Reviewed by Carlos Garcia Campos.
627
628         Unify the native image drawing operation behavior between the
629         Cairo-specific GraphicsContext and drawNativeImage() implementations and
630         then move the code into the Cairo::drawNativeImage() function, inside
631         the CairoOperations implementation file.
632
633         No new tests -- no change in behavior.
634
635         * platform/graphics/cairo/CairoOperations.cpp:
636         (WebCore::Cairo::cairoSurfaceHasAlpha):
637         (WebCore::Cairo::drawNativeImage):
638         * platform/graphics/cairo/CairoOperations.h:
639         * platform/graphics/cairo/GraphicsContextCairo.cpp:
640         (WebCore::GraphicsContext::drawNativeImage):
641         * platform/graphics/cairo/NativeImageCairo.cpp:
642         (WebCore::drawNativeImage):
643
644 2017-11-14  Zan Dobersek  <zdobersek@igalia.com>
645
646         [Cairo] Perform GraphicsContextPlatformPrivate method calls from CairoOperations
647         https://bugs.webkit.org/show_bug.cgi?id=179657
648
649         Reviewed by Carlos Garcia Campos.
650
651         To enable encapsulating remaining Cairo operations in static functions
652         inside the WebCore::Cairo namespace, we have to work around the
653         GraphicsContextPlatformPrivate methods that are invoked in the current
654         GraphicsContext implementation for Cairo.
655
656         A pointer to the GraphicsContextPlatformPrivate object is now kept on
657         the PlatformContextCairo instance, and we take care of setting it up
658         and clearing it out appropriate to the GraphicsContextPlatformPrivate
659         lifetime (as managed in Cairo-specific GraphicsContext implementation).
660         The GraphicsContextPlatformPrivate method invocations are then moved
661         to the appropriate CairoOperations functions.
662
663         No new tests -- no change in behavior.
664
665         * platform/graphics/cairo/CairoOperations.cpp:
666         (WebCore::Cairo::State::setCTM):
667         (WebCore::Cairo::save):
668         (WebCore::Cairo::restore):
669         (WebCore::Cairo::translate):
670         (WebCore::Cairo::rotate):
671         (WebCore::Cairo::scale):
672         (WebCore::Cairo::concatCTM):
673         (WebCore::Cairo::clip):
674         (WebCore::Cairo::clipPath):
675         * platform/graphics/cairo/GraphicsContextCairo.cpp:
676         (WebCore::GraphicsContext::GraphicsContext):
677         (WebCore::GraphicsContext::platformInit):
678         (WebCore::GraphicsContext::platformDestroy):
679         (WebCore::GraphicsContext::savePlatformState):
680         (WebCore::GraphicsContext::restorePlatformState):
681         (WebCore::GraphicsContext::clip):
682         (WebCore::GraphicsContext::clipPath):
683         (WebCore::GraphicsContext::translate):
684         (WebCore::GraphicsContext::concatCTM):
685         (WebCore::GraphicsContext::setCTM):
686         (WebCore::GraphicsContext::rotate):
687         (WebCore::GraphicsContext::scale):
688         * platform/graphics/cairo/PlatformContextCairo.h:
689         (WebCore::PlatformContextCairo::graphicsContextPrivate):
690         (WebCore::PlatformContextCairo::setGraphicsContextPrivate):
691
692 2017-11-14  Zan Dobersek  <zdobersek@igalia.com>
693
694         [Cairo] Move simpler draw operations from GraphicsContextCairo to CairoOperations
695         https://bugs.webkit.org/show_bug.cgi?id=179614
696
697         Reviewed by Carlos Garcia Campos.
698
699         Move operations that perform simpler drawing to the CairoOperations
700         file. This isolates the Cairo code and encapsulates operation work
701         into a limited scope. This patch only covers drawing patterns,
702         rectangles, document marker lines and ellipses. A missing forward
703         declaration for the drawGlyphs() function is also added in the
704         CairoOperations header.
705
706         No new tests -- no change in behavior.
707
708         * platform/graphics/cairo/CairoOperations.cpp:
709         (WebCore::Cairo::drawPattern):
710         (WebCore::Cairo::drawRect):
711         (WebCore::Cairo::drawLineForDocumentMarker):
712         (WebCore::Cairo::drawEllipse):
713         * platform/graphics/cairo/CairoOperations.h:
714         * platform/graphics/cairo/GraphicsContextCairo.cpp:
715         (WebCore::GraphicsContext::drawRect):
716         (WebCore::GraphicsContext::drawEllipse):
717         (WebCore::GraphicsContext::drawLineForDocumentMarker):
718         (WebCore::GraphicsContext::drawPattern):
719
720 2017-11-13  Joseph Pecoraro  <pecoraro@apple.com>
721
722         Give a ServiceWorker WebContentProcess a different display name
723         https://bugs.webkit.org/show_bug.cgi?id=179653
724
725         Reviewed by Brady Eidson.
726
727         * English.lproj/Localizable.strings:
728
729 2017-11-13  Chris Dumez  <cdumez@apple.com>
730
731         Send ServiceWorkerData structs to the WebProcesses instead of ServiceWorkerIdentifiers
732         https://bugs.webkit.org/show_bug.cgi?id=179649
733
734         Reviewed by Brady Eidson.
735
736         Send ServiceWorkerData structs to the WebProcesses instead of ServiceWorkerIdentifiers so that the
737         WebProcesses can correctly construct ServiceWorker objects, with the right attributes / state.
738
739         No new tests, rebaselined existing tests.
740
741         * Sources.txt:
742         * WebCore.xcodeproj/project.pbxproj:
743         * workers/service/ServiceWorker.cpp:
744         (WebCore::ServiceWorker::getOrCreate):
745         (WebCore::ServiceWorker::ServiceWorker):
746         (WebCore::ServiceWorker::~ServiceWorker):
747         (WebCore::ServiceWorker::scheduleTaskToUpdateState):
748         (WebCore::ServiceWorker::postMessage):
749         * workers/service/ServiceWorker.h:
750         * workers/service/ServiceWorkerContainer.cpp:
751         (WebCore::ServiceWorkerContainer::scheduleTaskToUpdateRegistrationState):
752         * workers/service/ServiceWorkerContainer.h:
753         * workers/service/ServiceWorkerData.cpp: Copied from Source/WebCore/workers/service/ServiceWorkerRegistrationData.cpp.
754         (WebCore::ServiceWorkerData::isolatedCopy const):
755         * workers/service/ServiceWorkerData.h: Copied from Source/WebCore/workers/service/server/SWServerWorker.cpp.
756         (WebCore::ServiceWorkerData::encode const):
757         (WebCore::ServiceWorkerData::decode):
758         * workers/service/ServiceWorkerRegistration.cpp:
759         (WebCore::ServiceWorkerRegistration::ServiceWorkerRegistration):
760         (WebCore::ServiceWorkerRegistration::updateStateFromServer):
761         * workers/service/ServiceWorkerRegistration.h:
762         * workers/service/ServiceWorkerRegistrationData.cpp:
763         (WebCore::ServiceWorkerRegistrationData::isolatedCopy const):
764         * workers/service/ServiceWorkerRegistrationData.h:
765         (WebCore::ServiceWorkerRegistrationData::encode const):
766         (WebCore::ServiceWorkerRegistrationData::decode):
767         * workers/service/server/SWClientConnection.cpp:
768         (WebCore::SWClientConnection::postMessageToServiceWorkerClient):
769         (WebCore::SWClientConnection::updateRegistrationState):
770         * workers/service/server/SWClientConnection.h:
771         * workers/service/server/SWServer.h:
772         * workers/service/server/SWServerRegistration.cpp:
773         (WebCore::SWServerRegistration::updateRegistrationState):
774         (WebCore::SWServerRegistration::data const):
775         * workers/service/server/SWServerWorker.cpp:
776         (WebCore::SWServerWorker::SWServerWorker):
777         (WebCore::m_script):
778         * workers/service/server/SWServerWorker.h:
779         (WebCore::SWServerWorker::scriptURL const):
780         (WebCore::SWServerWorker::type const):
781         (WebCore::SWServerWorker::identifier const):
782         (WebCore::SWServerWorker::state const):
783         (WebCore::SWServerWorker::setState):
784         (WebCore::SWServerWorker::data const):
785
786 2017-11-13  Ryosuke Niwa  <rniwa@webkit.org>
787
788         iOS: Enable release asserts in updateStyleIfNeeded() and updateLayout() for WebKit2
789         https://bugs.webkit.org/show_bug.cgi?id=179651
790
791         Reviewed by Antti Koivisto.
792
793         r224604 disabled the release assertions on iOS entirely even though the underlying bug only affected iOS WebKit1 port
794         due to various time constraints. Enable them back on iOS WebKit2 port.
795
796         * dom/Document.cpp:
797         (WebCore::isSafeToUpdateStyleOrLayout):
798         (WebCore::Document::updateStyleIfNeeded):
799         (WebCore::Document::updateLayout):
800
801 2017-11-13  Brady Eidson  <beidson@apple.com>
802
803         Massive "Server-process-to-context-process" connection overhaul.
804         https://bugs.webkit.org/show_bug.cgi?id=179554
805
806         Reviewed by Chris Dumez.
807
808         No new tests (Refactor, no behavior change).
809
810         Having the SWServer::Connection object be overloaded to mean both client->server and server->context 
811         was the wrong design and was starting to crumble under its own weight.
812
813         So this patch introduces a SWServerToContextConnection to manage the StorageProcess-side of connections
814         to context processes.
815
816         Any message that is specifically about the connection between the StorageProcess and context process
817         should use this connection going forward.
818
819         Right now there is only one context process, but this design keeps us ready for that to change.
820
821         This patch also gets rid of a lot of "server connection identifier" integers being passed amongst processes
822         that were actually pointless.
823
824         This patch is also a prerequisite for many things that are coming up soon, such as termination.
825
826         * Sources.txt:
827         * WebCore.xcodeproj/project.pbxproj:
828
829         * workers/service/ServiceWorkerContextData.cpp:
830         (WebCore::ServiceWorkerContextData::isolatedCopy const):
831         * workers/service/ServiceWorkerContextData.h:
832         (WebCore::ServiceWorkerContextData::encode const):
833         (WebCore::ServiceWorkerContextData::decode):
834
835         * workers/service/ServiceWorkerGlobalScope.cpp:
836         (WebCore::ServiceWorkerGlobalScope::ServiceWorkerGlobalScope):
837         * workers/service/ServiceWorkerGlobalScope.h:
838         (WebCore::ServiceWorkerGlobalScope::serverConnectionIdentifier const): Deleted.
839
840         * workers/service/ServiceWorkerTypes.h:
841
842         * workers/service/context/ServiceWorkerThread.cpp:
843         (WebCore::ServiceWorkerThread::ServiceWorkerThread):
844         (WebCore::ServiceWorkerThread::createWorkerGlobalScope):
845         * workers/service/context/ServiceWorkerThread.h:
846         (WebCore::ServiceWorkerThread::serverConnectionIdentifier const): Deleted.
847
848         * workers/service/context/ServiceWorkerThreadProxy.cpp:
849         (WebCore::ServiceWorkerThreadProxy::ServiceWorkerThreadProxy):
850         (WebCore::ServiceWorkerThreadProxy::create): Deleted.
851         * workers/service/context/ServiceWorkerThreadProxy.h:
852
853         * workers/service/server/SWServer.cpp:
854         (WebCore::generateServiceWorkerIdentifier):
855         (WebCore::SWServer::~SWServer):
856         (WebCore::SWServer::SWServer):
857         (WebCore::SWServer::scriptContextFailedToStart):
858         (WebCore::SWServer::scriptContextStarted):
859         (WebCore::SWServer::didFinishInstall):
860         (WebCore::SWServer::didFinishActivation):
861         (WebCore::SWServer::didResolveRegistrationPromise):
862         (WebCore::SWServer::updateWorker):
863         (WebCore::SWServer::serverToContextConnectionCreated):
864         (WebCore::SWServer::installContextData):
865         (WebCore::SWServer::fireInstallEvent):
866         (WebCore::SWServer::fireActivateEvent):
867         (WebCore::SWServer::Connection::didFinishInstall): Deleted.
868         (WebCore::SWServer::Connection::didFinishActivation): Deleted.
869         (WebCore::SWServer::Connection::setServiceWorkerHasPendingEvents): Deleted.
870         (WebCore::SWServer::Connection::scriptContextFailedToStart): Deleted.
871         (WebCore::SWServer::Connection::scriptContextStarted): Deleted.
872         (WebCore::SWServer::setServiceWorkerHasPendingEvents): Deleted.
873         * workers/service/server/SWServer.h:
874
875         * workers/service/server/SWServerJobQueue.cpp:
876         (WebCore::SWServerJobQueue::scriptContextFailedToStart):
877         (WebCore::SWServerJobQueue::scriptContextStarted):
878         (WebCore::SWServerJobQueue::install):
879         (WebCore::SWServerJobQueue::didResolveRegistrationPromise):
880         (WebCore::SWServerJobQueue::didFinishInstall):
881         (WebCore::SWServerJobQueue::tryActivate):
882         (WebCore::SWServerJobQueue::activate):
883         * workers/service/server/SWServerJobQueue.h:
884
885         * workers/service/server/SWServerRegistration.cpp:
886         (WebCore::generateServiceWorkerRegistrationIdentifier):
887
888         * workers/service/server/SWServerToContextConnection.cpp: Added.
889         (WebCore::generateServerToContextConnectionIdentifier):
890         (WebCore::SWServerToContextConnection::SWServerToContextConnection):
891         (WebCore::SWServerToContextConnection::~SWServerToContextConnection):
892         (WebCore::SWServerToContextConnection::connectionForIdentifier):
893         (WebCore::SWServerToContextConnection::globalServerToContextConnection):
894         (WebCore::SWServerToContextConnection::scriptContextFailedToStart):
895         (WebCore::SWServerToContextConnection::scriptContextStarted):
896         (WebCore::SWServerToContextConnection::didFinishInstall):
897         (WebCore::SWServerToContextConnection::didFinishActivation):
898         (WebCore::SWServerToContextConnection::setServiceWorkerHasPendingEvents):
899         * workers/service/server/SWServerToContextConnection.h: Copied from Source/WebCore/workers/service/server/SWServerWorker.h.
900         (WebCore::SWServerToContextConnection::identifier const):
901
902         * workers/service/server/SWServerWorker.cpp:
903         (WebCore::SWServerWorker::existingWorkerForIdentifier):
904         (WebCore::SWServerWorker::SWServerWorker):
905         (WebCore::SWServerWorker::~SWServerWorker):
906         (WebCore::SWServerWorker::scriptContextFailedToStart):
907         (WebCore::SWServerWorker::scriptContextStarted):
908         (WebCore::SWServerWorker::didFinishInstall):
909         (WebCore::SWServerWorker::didFinishActivation):
910         * workers/service/server/SWServerWorker.h:
911         (WebCore::SWServerWorker::create):
912         (WebCore::SWServerWorker::registrationKey const):
913         (WebCore::SWServerWorker::contextConnectionIdentifier const):
914
915 2017-11-13  Don Olmstead  <don.olmstead@sony.com>
916
917         Unreviewed build fix after r224791.
918
919         * platform/network/NetworkStorageSessionStub.cpp:
920         (WebCore::NetworkStorageSession::ensurePrivateBrowsingSession): Deleted.
921
922 2017-11-13  Simon Fraser  <simon.fraser@apple.com>
923
924         Minor DisplayRefreshMonitor-related cleanup
925         https://bugs.webkit.org/show_bug.cgi?id=179648
926
927         Reviewed by Alex Christensen.
928
929         Use more "#pragma once" and C++ initializers.
930
931         Make more member functions of DisplayRefreshMonitor protected.
932
933         Improve the ordering of member variables.
934
935         Don't mix member variables and member functions in the declaration of ScriptedAnimationController.
936
937         * dom/ScriptedAnimationController.h:
938         * platform/graphics/DisplayRefreshMonitor.cpp:
939         (WebCore::DisplayRefreshMonitor::DisplayRefreshMonitor):
940         (WebCore::DisplayRefreshMonitor::displayDidRefresh):
941         * platform/graphics/DisplayRefreshMonitor.h:
942         (WebCore::DisplayRefreshMonitor::mutex):
943         * platform/graphics/DisplayRefreshMonitorManager.h:
944         * platform/graphics/mac/DisplayRefreshMonitorMac.cpp:
945         (WebCore::DisplayRefreshMonitorMac::DisplayRefreshMonitorMac):
946         * platform/graphics/mac/DisplayRefreshMonitorMac.h:
947
948 2017-11-13  Simon Fraser  <simon.fraser@apple.com>
949
950         When navigating back to a page, compositing layers may not use accelerated drawing
951         https://bugs.webkit.org/show_bug.cgi?id=178749
952         rdar://problem/35158946
953
954         Reviewed by Dean Jackson.
955
956         There were two issues with setting GraphicsLayerCA's "acceleratesDrawing" state which
957         occurred on back navigation, related to the ordering of style recalcs and layout.
958
959         First, at style recalc time, we created a RenderLayerCompositor but hadn't yet called
960         its cacheAcceleratedCompositingFlags(), so any layers created during style update
961         didn't get accelerated drawing. Fix by making cacheAcceleratedCompositingFlags() internal
962         to RenderLayerCompositor and calling it from willRecalcStyle() and updateCompositingLayers().
963
964         We have to be careful to avoid m_forceCompositingMode flip-flopping between cacheAcceleratedCompositingFlags()
965         and cacheAcceleratedCompositingFlagsAfterLayout(), since, for subframes, it depends on layout.
966
967         Secondly, GraphicsLayerCA::commitLayerChangesBeforeSublayers() needs to updateAcceleratesDrawing()
968         before updating tiles, so that new tiles fetch the right acceleratesDrawing state from
969         the TileController.
970
971         Test: compositing/accelerated-layers-after-back.html
972
973         * page/FrameView.cpp:
974         (WebCore::FrameView::updateCompositingLayersAfterLayout):
975         * platform/graphics/ca/GraphicsLayerCA.cpp:
976         (WebCore::GraphicsLayerCA::commitLayerChangesBeforeSublayers):
977         * rendering/RenderLayerCompositor.cpp:
978         (WebCore::RenderLayerCompositor::willRecalcStyle):
979         (WebCore::RenderLayerCompositor::didRecalcStyleWithNoPendingLayout):
980         (WebCore::RenderLayerCompositor::updateCompositingLayers):
981         * rendering/RenderLayerCompositor.h:
982
983 2017-11-13  Youenn Fablet  <youenn@apple.com>
984
985         matchRegistration does not need to go to StorageProcess if no service worker is registered
986         https://bugs.webkit.org/show_bug.cgi?id=179480
987
988         Reviewed by Chris Dumez.
989
990         Covered by existing tests.
991
992         Moving the origin store in SWServer since they share the same session ID.
993         This allows updating the origin store based on each registration map update.
994         This also allows clearing the origin store when clearing the SWServer.
995
996         * Sources.txt:
997         * WebCore.xcodeproj/project.pbxproj:
998         * workers/service/server/SWOriginStore.cpp: Added.
999         (WebCore::SWOriginStore::add):
1000         (WebCore::SWOriginStore::remove):
1001         (WebCore::SWOriginStore::clear):
1002         (WebCore::SWOriginStore::clearAll):
1003         * workers/service/server/SWOriginStore.h: Added.
1004         * workers/service/server/SWServer.cpp:
1005         (WebCore::SWServer::addRegistration):
1006         (WebCore::SWServer::removeRegistration):
1007         (WebCore::SWServer::OriginStore::add):
1008         (WebCore::SWServer::OriginStore::remove):
1009         (WebCore::SWServer::OriginStore::clear):
1010         (WebCore::SWServer::OriginStore::clearAll):
1011         (WebCore::SWServer::clearAll):
1012         (WebCore::SWServer::clear):
1013         (WebCore::SWServer::SWServer):
1014         * workers/service/server/SWServer.h:
1015         (WebCore::SWServer::originStore):
1016
1017 2017-11-13  Alex Christensen  <achristensen@webkit.org>
1018
1019         Merge NetworkProcess::EnsurePrivateBrowsingSession and NetworkProcess::AddWebsiteDataStore into one message type
1020         https://bugs.webkit.org/show_bug.cgi?id=178751
1021
1022         Reviewed by Brady Eidson.
1023
1024         The creation of private browsing sessions and persistent browsing sessions has evolved to be the same thing
1025         with differences in parameters, like no sandbox extensions or paths to persistent storage locations for private browsing.
1026         These should be united to simplify future development of WebsiteDataStore construction.
1027
1028         * platform/network/NetworkStorageSession.h:
1029         * platform/network/cf/NetworkStorageSessionCFNet.cpp:
1030         (WebCore::NetworkStorageSession::ensurePrivateBrowsingSession): Deleted.
1031         * platform/network/soup/NetworkStorageSessionSoup.cpp:
1032         (WebCore::NetworkStorageSession::ensureSession):
1033         (WebCore::NetworkStorageSession::ensurePrivateBrowsingSession): Deleted.
1034
1035 2017-11-07  Brian Burg  <bburg@apple.com>
1036
1037         Web Automation: inViewCenterPoint should not include topContentInset when computed in viewport coordinates
1038         https://bugs.webkit.org/show_bug.cgi?id=179129
1039         <rdar://problem/35297038>
1040
1041         Reviewed by Simon Fraser.
1042
1043         Add or export some helpers needed to compute element layout for WebDriver.
1044
1045         * dom/Element.h: Export the non-DOM version of getClientBounds().
1046         * page/FrameView.h:
1047         * page/FrameView.cpp:
1048         (WebCore::FrameView::clientToDocumentRect const):
1049         Added. This does the same thing as clientToDocumentPoint. Export it, too.
1050
1051 2017-11-13  Joseph Pecoraro  <pecoraro@apple.com>
1052
1053         Web Inspector: Include a NetworkAgent in ServiceWorkers for network debugging
1054         https://bugs.webkit.org/show_bug.cgi?id=179513
1055         <rdar://problem/35456402>
1056
1057         Reviewed by Brian Burg.
1058
1059         In order to show Network requests for a ServiceWorker, we need to add
1060         inspector networking hooks for Worker loads. While we show Network
1061         requests for DedicatedWorkers, we do that through the Page during Page
1062         inspection. In ServiceWorker inspection, the remote connection is
1063         connected to the ServiceWorkerThreadProxy, and interacts with the
1064         WorkerGlobalScope without making any assumptions about a Page existing.
1065         We don't want to make any assumptions about a Page/Document being needed
1066         for Network hooks, so we should add new hooks that will work in the
1067         WorkerGlobalScope's context.
1068
1069         This patch adds InspectorInstrumentation networking hooks for workers inside
1070         of the WorkerThreadableLoader bridge. This is where the majority of Worker
1071         initiated network requests happen (Fetch/XHR, but not WebSockets). The hooks
1072         are simpler versions of the existing network hooks for a Page, and allow for
1073         complete inspector networking information (will send, did receive response,
1074         did receive data, success, failure, and timing metrics).
1075
1076         This patch generalizes InspectorNetworkAgent to work for a Page and Worker.
1077         Some of the existing functionality was specific to a Page (frameId/loaderId)
1078         but did not make sense for a Worker. In order to handle these cases, all
1079         of the unique logic was extracted out into virtual methods that subclasses
1080         PageNetworkAgent and WorkerNetworkAgent provide as appropriate. The majority
1081         of NetworkAgent remains unchanged and algorithms are shared.
1082
1083         We needed to change the existing InspectorInstrumentation networking hooks
1084         to allow for an optional DocumentLoader. This way we can keep all of the
1085         same hooks leading inside of NetworkAgent, but loads for a Page will have a
1086         DocumentLoader, and loads for a ServiceWorker will not.
1087
1088         While the WorkerNetworkAgent would work for a DedicatedWorker, we still
1089         only create it for a ServiceWorker. The existing behavior of showing Network
1090         loads for a DedicatedWorker will continue to go through the Page inspector
1091         so we can avoid creating a NetworkAgent for DedicatedWorkers. If we created
1092         a way to directly inspect a DedicatedWorker we could look at making this
1093         always available, but it would require extra work to function perfectly.
1094
1095         * Sources.txt:
1096         * WebCore.xcodeproj/project.pbxproj:
1097         * inspector/InspectorAllInOne.cpp:
1098         Add new files.
1099
1100         * inspector/InspectorController.cpp:
1101         (WebCore::InspectorController::InspectorController):
1102         (WebCore::InspectorController::createLazyAgents):
1103         Switch from InspectorNetworkAgent to PageNetworkAgent.
1104
1105         * inspector/WorkerInspectorController.h:
1106         * inspector/WorkerInspectorController.cpp:
1107         (WebCore::WorkerInspectorController::WorkerInspectorController):
1108         (WebCore::WorkerInspectorController::workerAgentContext):
1109         (WebCore::WorkerInspectorController::createLazyAgents):
1110         Create a WorkerNetworkAgent when inside of a ServiceWorker.
1111         Also start the lazy agent pattern for agents that can defer
1112         creation until a frontend attached.
1113
1114         (WebCore::WorkerInspectorController::connectFrontend):
1115         (WebCore::WorkerInspectorController::disconnectFrontend):
1116         When frontends connect/disconnect toggle the necessary states.
1117         Also start the execution stopwatch, otherwise it will always be at 0.
1118
1119         * inspector/InspectorInstrumentation.cpp:
1120         (WebCore::InspectorInstrumentation::willSendRequestImpl):
1121         (WebCore::InspectorInstrumentation::willSendRequestOfTypeImpl):
1122         (WebCore::InspectorInstrumentation::didLoadResourceFromMemoryCacheImpl):
1123         (WebCore::InspectorInstrumentation::didReceiveResourceResponseImpl):
1124         (WebCore::InspectorInstrumentation::didFinishLoadingImpl):
1125         (WebCore::InspectorInstrumentation::didFailLoadingImpl):
1126         (WebCore::InspectorInstrumentation::frameDetachedFromParentImpl):
1127         * inspector/InspectorInstrumentation.h:
1128         (WebCore::InspectorInstrumentation::willSendRequest):
1129         (WebCore::InspectorInstrumentation::didReceiveResourceResponse):
1130         (WebCore::InspectorInstrumentation::didReceiveData):
1131         (WebCore::InspectorInstrumentation::didFinishLoading):
1132         (WebCore::InspectorInstrumentation::didFailLoading):
1133         Add Worker networking hooks that pass through to the same general hooks.
1134
1135         * loader/WorkerThreadableLoader.cpp:
1136         (WebCore::WorkerThreadableLoader::MainThreadBridge::MainThreadBridge):
1137         (WebCore::WorkerThreadableLoader::MainThreadBridge::didReceiveResponse):
1138         (WebCore::WorkerThreadableLoader::MainThreadBridge::didReceiveData):
1139         (WebCore::WorkerThreadableLoader::MainThreadBridge::didFinishLoading):
1140         (WebCore::WorkerThreadableLoader::MainThreadBridge::didFail):
1141         (WebCore::WorkerThreadableLoader::MainThreadBridge::didFinishTiming):
1142         * loader/WorkerThreadableLoader.h:
1143         Use the new worker networking instrumentation hooks.
1144
1145         * loader/ThreadableLoader.cpp:
1146         (WebCore::ThreadableLoader::create):
1147         Drive-by: use a move.
1148
1149         * inspector/agents/InspectorNetworkAgent.h:
1150         * inspector/agents/InspectorNetworkAgent.cpp:
1151         (WebCore::InspectorNetworkAgent::InspectorNetworkAgent):
1152         (WebCore::InspectorNetworkAgent::willSendRequest):
1153         (WebCore::InspectorNetworkAgent::willSendRequestOfType):
1154         (WebCore::InspectorNetworkAgent::didReceiveResponse):
1155         (WebCore::InspectorNetworkAgent::didFinishLoading):
1156         (WebCore::InspectorNetworkAgent::didFailLoading):
1157         (WebCore::InspectorNetworkAgent::didLoadResourceFromMemoryCache):
1158         (WebCore::InspectorNetworkAgent::buildInitiatorObject):
1159         (WebCore::InspectorNetworkAgent::enable):
1160         (WebCore::InspectorNetworkAgent::disable):
1161         (WebCore::InspectorNetworkAgent::setResourceCachingDisabled):
1162         (WebCore::InspectorNetworkAgent::loadResource):
1163         (WebCore::InspectorNetworkAgent::webSocketForRequestId):
1164         (WebCore::InspectorNetworkAgent::resolveWebSocket):
1165         (WebCore::InspectorNetworkAgent::mainFrameNavigated):
1166         Extract logic for subclasses. Transition to DocumentLoader being null.
1167
1168         * inspector/agents/page/PageNetworkAgent.h:
1169         * inspector/agents/page/PageNetworkAgent.cpp: Added.
1170         (WebCore::PageNetworkAgent::PageNetworkAgent):
1171         (WebCore::PageNetworkAgent::loaderIdentifier):
1172         (WebCore::PageNetworkAgent::frameIdentifier):
1173         (WebCore::PageNetworkAgent::setResourceCachingDisabled):
1174         (WebCore::PageNetworkAgent::scriptExecutionContext):
1175         Extracted Page implementation. This is just moving from the original.
1176
1177         * inspector/agents/worker/WorkerNetworkAgent.h:
1178         * inspector/agents/worker/WorkerNetworkAgent.cpp:
1179         (WebCore::WorkerNetworkAgent::WorkerNetworkAgent):
1180         (WebCore::WorkerNetworkAgent::loaderIdentifier):
1181         (WebCore::WorkerNetworkAgent::frameIdentifier):
1182         (WebCore::WorkerNetworkAgent::setResourceCachingDisabled):
1183         (WebCore::WorkerNetworkAgent::scriptExecutionContext):
1184         Implement for a worker.
1185         
1186         * inspector/agents/worker/WorkerDebuggerAgent.cpp:
1187         (WebCore::WorkerDebuggerAgent::WorkerDebuggerAgent):
1188         * inspector/agents/worker/WorkerConsoleAgent.cpp:
1189         (WebCore::WorkerConsoleAgent::WorkerConsoleAgent):
1190         * inspector/agents/worker/WorkerRuntimeAgent.cpp:
1191         (WebCore::WorkerRuntimeAgent::WorkerRuntimeAgent):
1192         Add some assertions for all Worker agents for clarify.
1193
1194         * workers/WorkerDebuggerProxy.h:
1195         * workers/WorkerGlobalScope.h:
1196         (WebCore::WorkerGlobalScope::identifier const):
1197         (WebCore::WorkerGlobalScope::createUniqueIdentifier):
1198         Provide a way to get unique identifiers in a worker. For the Page
1199         this is done through the Page's ProgressTracker. For a Worker we just
1200         put this on the WorkerGlobalScope. This is used for request ids.
1201
1202         * workers/WorkerMessagingProxy.h:
1203         * workers/WorkerMessagingProxy.cpp:
1204         (WebCore::WorkerMessagingProxy::setResourceCachingDisabled):
1205         * workers/service/context/ServiceWorkerThreadProxy.h:
1206         * workers/service/context/ServiceWorkerThreadProxy.cpp:
1207         (WebCore::ServiceWorkerThreadProxy::setResourceCachingDisabled):
1208         Add a debug method for disabling the resource cache from a worker.
1209         In service workers this sets the override flag on the hidden page.
1210
1211 2017-11-08  Keith Miller  <keith_miller@apple.com>
1212
1213         Async iteration should only fetch the next method once and add feature flag
1214         https://bugs.webkit.org/show_bug.cgi?id=179451
1215
1216         Reviewed by Geoffrey Garen.
1217
1218         Add feature flag for Async iteration.
1219
1220         * Configurations/FeatureDefines.xcconfig:
1221
1222 2017-11-13  Alex Christensen  <achristensen@webkit.org>
1223
1224         Call willPerformHTTPRedirection on WebCoreNSURLSession's delegate
1225         https://bugs.webkit.org/show_bug.cgi?id=179539
1226
1227         Reviewed by Jer Noble.
1228
1229         This is now possible!
1230         This will allow AVFoundation to fix redirect-related bugs.
1231
1232         * platform/network/cocoa/WebCoreNSURLSession.mm:
1233         (-[WebCoreNSURLSession addDelegateOperation:]):
1234         (-[WebCoreNSURLSession resetWithCompletionHandler:]):
1235         (-[WebCoreNSURLSession flushWithCompletionHandler:]):
1236         (WebCore::WebCoreNSURLSessionDataTaskClient::redirectReceived):
1237         (-[WebCoreNSURLSessionDataTask resource:shouldCacheResponse:]):
1238         (-[WebCoreNSURLSessionDataTask resource:receivedData:length:]):
1239         (-[WebCoreNSURLSessionDataTask resource:receivedRedirect:request:completionHandler:]):
1240         (-[WebCoreNSURLSessionDataTask resource:receivedRedirect:request:]): Deleted.
1241
1242 2017-11-13  Chris Dumez  <cdumez@apple.com>
1243
1244         Add some more assertions in SWServerJobQueue
1245         https://bugs.webkit.org/show_bug.cgi?id=179626
1246
1247         Reviewed by Alex Christensen.
1248
1249         Add some more assertions in SWServerJobQueue for extra safety.
1250
1251         * workers/service/server/SWServerJobQueue.cpp:
1252         (WebCore::SWServerJobQueue::didResolveRegistrationPromise):
1253         (WebCore::SWServerJobQueue::didFinishInstall):
1254
1255 2017-11-13  Per Arne Vollan  <pvollan@apple.com>
1256
1257         The css properties stroke-width/stroke-color and -webkit-text-stroke-width/-webkit-text-stroke-color should not be mixed.
1258         https://bugs.webkit.org/show_bug.cgi?id=174737
1259
1260         Reviewed by Antti Koivisto.
1261
1262         Previously, the stroke width and stroke color would independently fall back to the -webkit-text-stroke-width and
1263         -webkit-text-stroke-color values if stroke-width and/or stroke-color were not explicitly specified. This is
1264         problematic, since we might end up mixing the new stroke properties with the legacy Webkit stroke properties.
1265         The new strategy is to use the stroke-width and stroke-color value combination only if stroke-color has been
1266         explicitly specified. This should work well, since there will be no visible stroke when specifying only
1267         stroke-width (because stroke-color by default is transparent). We can then safely fall back to the legacy Webkit
1268         stroke value combination. In the case where only stroke-color is specified, we should use the stroke-width/
1269         stroke-color combination, since stroke-width by default is 1, and we will then have a visible stroke. 
1270
1271         No new tests, existing tests have been updated to reflect behavior changes.
1272
1273         * rendering/TextDecorationPainter.cpp:
1274         (WebCore::decorationColor):
1275         * rendering/TextPaintStyle.cpp:
1276         (WebCore::computeTextPaintStyle):
1277         (WebCore::computeTextSelectionPaintStyle):
1278         * rendering/style/RenderStyle.cpp:
1279         (WebCore::RenderStyle::computedStrokeWidth const):
1280         (WebCore::RenderStyle::hasPositiveStrokeWidth const):
1281         (WebCore::RenderStyle::computedStrokeColor const):
1282         * rendering/style/RenderStyle.h:
1283
1284 2017-11-13  Gabriel Ivascu  <givascu@igalia.com>
1285
1286         [GTK] Automatically adjust font size when gtk-xft-dpi changes
1287         https://bugs.webkit.org/show_bug.cgi?id=142673
1288
1289         Reviewed by Michael Catanzaro.
1290
1291         * platform/PlatformScreen.h:
1292         * platform/gtk/PlatformScreenGtk.cpp:
1293         (WebCore::gtkXftDPIChangedCallback):
1294         (WebCore::setScreenDPIObserverHandler):
1295         * platform/wpe/PlatformScreenWPE.cpp:
1296         (WebCore::setScreenDPIObserverHandler):
1297
1298 2017-11-13  Commit Queue  <commit-queue@webkit.org>
1299
1300         Unreviewed, rolling out r224763.
1301         https://bugs.webkit.org/show_bug.cgi?id=179632
1302
1303         test fails on iOS (Requested by alexchristensen on #webkit).
1304
1305         Reverted changeset:
1306
1307         "Add tests to ensure that <source> tags are only preloaded
1308         when the `type`"
1309         https://bugs.webkit.org/show_bug.cgi?id=179231
1310         https://trac.webkit.org/changeset/224763
1311
1312 2017-11-13  Antti Koivisto  <antti@apple.com>
1313
1314         Don't eliminate whitespace renderer if the previous sibling is a text renderer
1315         https://bugs.webkit.org/show_bug.cgi?id=179620
1316
1317         Reviewed by Zalan Bujtas.
1318
1319         Currently whitespace elimination code doesn't consider runs of text renderers. We should always make whitespace
1320         renderer if the previous renderer is a text renderer. The behavior should be the same as if those were a single
1321         renderer with merged text. This situation can happen easily with display:contents.
1322
1323         This fixes the remaining flexbox failures in display:contents tests.
1324
1325         * style/RenderTreeUpdater.cpp:
1326         (WebCore::RenderTreeUpdater::textRendererIsNeeded):
1327
1328         We need a renderer if the previous rendere is RenderText.
1329
1330 2017-11-13  Chris Dumez  <cdumez@apple.com>
1331
1332         Implement "Service Worker Has No Pending Events" / "Update Service Worker Extended Events Set" algorithms
1333         https://bugs.webkit.org/show_bug.cgi?id=179618
1334
1335         Reviewed by Brady Eidson.
1336
1337         Implement "Service Worker Has No Pending Events" / "Update Service Worker Extended Events Set" algorithms:
1338         - https://w3c.github.io/ServiceWorker/#service-worker-has-no-pending-events-algorithm
1339         - https://w3c.github.io/ServiceWorker/#update-service-worker-extended-events-set-algorithm
1340
1341         Test: http/tests/workers/service/basic-unregister-then-register-again-reuse.html
1342
1343         * workers/service/context/SWContextManager.h:
1344         * workers/service/context/ServiceWorkerFetch.cpp:
1345         (WebCore::ServiceWorkerFetch::dispatchFetchEvent):
1346         * workers/service/context/ServiceWorkerFetch.h:
1347         * workers/service/context/ServiceWorkerThread.cpp:
1348         (WebCore::ServiceWorkerThread::postFetchTask):
1349         (WebCore::ServiceWorkerThread::postMessageToServiceWorkerGlobalScope):
1350         (WebCore::ServiceWorkerThread::updateExtendedEventsSet):
1351         * workers/service/context/ServiceWorkerThread.h:
1352         * workers/service/server/SWServer.cpp:
1353         (WebCore::SWServer::Connection::setServiceWorkerHasPendingEvents):
1354         (WebCore::SWServer::setServiceWorkerHasPendingEvents):
1355         * workers/service/server/SWServer.h:
1356         * workers/service/server/SWServerJobQueue.cpp:
1357         (WebCore::SWServerJobQueue::tryActivate):
1358         (WebCore::SWServerJobQueue::tryClearRegistration):
1359         * workers/service/server/SWServerWorker.h:
1360         (WebCore::SWServerWorker::hasPendingEvents const):
1361         (WebCore::SWServerWorker::setHasPendingEvents):
1362
1363 2017-11-13  Colin Bendell  <colin@bendell.ca>
1364
1365         Added mime type check to the picture source preloader to avoid downloading incompatible resources.
1366         https://bugs.webkit.org/show_bug.cgi?id=179231
1367
1368         Reviewed by Alex Christensen.
1369
1370         Test: http/tests/loading/preload-picture-type.html
1371
1372         * html/parser/HTMLPreloadScanner.cpp:
1373         (WebCore::TokenPreloadScanner::StartTagScanner::processAttributes): include type match state when selecting candidate imgs
1374         (WebCore::TokenPreloadScanner::StartTagScanner::processAttribute): added type attribute evaluation and matching
1375
1376 2017-11-13  Antoine Quint  <graouts@apple.com>
1377
1378         [Web Animations] Implement getAnimations()
1379         https://bugs.webkit.org/show_bug.cgi?id=179535
1380         <rdar://problem/34932475>
1381
1382         Reviewed by Simon Fraser.
1383
1384         We now allow a list of animations for a document, with Document.getAnimations(), or for an
1385         element, with Animatable.getAnimations(), to be returned. In order to support this, we maintain
1386         a map on AnimationTimeline of all animations for a given element. This map is invalidated
1387         when an animation's timeline changes and when an animation's effect changes. Note that the
1388         Web Animations spec mandates that an AnimationEffect can only be a single animation's effect.
1389
1390         Tests: http/wpt/wk-web-animations/interfaces/document-get-animations.html
1391                http/wpt/wk-web-animations/interfaces/element-get-animations.html
1392                http/wpt/wk-web-animations/timing-model/animation-effect-unique-relationship.html
1393
1394         * CMakeLists.txt: Add Animatable.idl.
1395         * DerivedSources.make: Add Animatable.idl.
1396         * WebCore.xcodeproj/project.pbxproj: Add Animatable.idl.
1397         * animation/Animatable.idl: A new interface that Element implements and which currently only exposes
1398         getAnimations(), the animate() method will be added later.
1399         * animation/AnimationEffect.h: Add a new m_animation member to reference the animation using this
1400         effect. This relationship is required so we guarantee that an effect is associated with a single
1401         animation at most.
1402         (WebCore::AnimationEffect::animation const):
1403         (WebCore::AnimationEffect::setAnimation):
1404         * animation/AnimationTimeline.cpp:
1405         (WebCore::AnimationTimeline::animationWasAddedToElement): New method to notify the timeline that an
1406         animation registered with this timeline has been associated with a new element through its effect.
1407         (WebCore::AnimationTimeline::animationWasRemovedFromElement): New method to notify the timeline that an
1408         animation registered with this timeline has been disassociated with an element through its effect.
1409         (WebCore::AnimationTimeline::animationsForElement): New method returning all animations registered with
1410         this timeline for a given element.
1411         * animation/AnimationTimeline.h:
1412         (WebCore::AnimationTimeline::animations const): All animations registered with this timeline.
1413         * animation/DocumentTimeline.cpp:
1414         (WebCore::DocumentTimeline::DocumentTimeline):
1415         (WebCore::DocumentTimeline::detachFromDocument): Clear the reference between this timeline and its document.
1416         (WebCore::DocumentTimeline::currentTime): Protect against a null Document reference.
1417         (WebCore::DocumentTimeline::createDisplayRefreshMonitor const): Protect against a null Document reference.
1418         * animation/DocumentTimeline.h:
1419         * animation/WebAnimation.cpp:
1420         (WebCore::WebAnimation::create):
1421         (WebCore::WebAnimation::setEffect): As an animation's effect changes, we need to ensure that the old
1422         effect no longer has an associated animation, and that the new effect is associated with this animation.
1423         Additionally, we update the element-to-animations map on the animation's timeline.
1424         (WebCore::WebAnimation::setTimeline): Update the element-to-animations map on the former and new timeline.
1425         * dom/Document.cpp:
1426         (WebCore::Document::prepareForDestruction): Clear the relationship between this document and its timeline.
1427         (WebCore::Document::getAnimations): Obtain all animations associated with this document's timeline.
1428         * dom/Document.h:
1429         * dom/Document.idl:
1430         * dom/Element.cpp:
1431         (WebCore::Element::getAnimations): Obtain all animations associated with this element.
1432         * dom/Element.h:
1433         * dom/Element.idl:
1434         * testing/Internals.cpp:
1435
1436         * CMakeLists.txt:
1437         * DerivedSources.make:
1438         * WebCore.xcodeproj/project.pbxproj:
1439         * animation/Animatable.idl: 
1440         * animation/AnimationEffect.h:
1441         (WebCore::AnimationEffect::animation const):
1442         (WebCore::AnimationEffect::setAnimation):
1443         * animation/AnimationTimeline.cpp:
1444         (WebCore::AnimationTimeline::animationWasAddedToElement):
1445         (WebCore::AnimationTimeline::animationWasRemovedFromElement):
1446         (WebCore::AnimationTimeline::animationsForElement):
1447         * animation/AnimationTimeline.h:
1448         (WebCore::AnimationTimeline::animations const):
1449         * animation/DocumentTimeline.cpp:
1450         (WebCore::DocumentTimeline::DocumentTimeline):
1451         (WebCore::DocumentTimeline::detachFromDocument):
1452         (WebCore::DocumentTimeline::currentTime):
1453         (WebCore::DocumentTimeline::createDisplayRefreshMonitor const):
1454         * animation/DocumentTimeline.h:
1455         * animation/WebAnimation.cpp:
1456         (WebCore::WebAnimation::create):
1457         (WebCore::WebAnimation::setEffect):
1458         (WebCore::WebAnimation::setTimeline):
1459         * dom/Document.cpp:
1460         (WebCore::Document::prepareForDestruction):
1461         (WebCore::Document::getAnimations):
1462         * dom/Document.h:
1463         * dom/Document.idl:
1464         * dom/Element.cpp:
1465         (WebCore::Element::getAnimations):
1466         * dom/Element.h:
1467         * dom/Element.idl:
1468         * testing/Internals.cpp:
1469
1470 2017-11-13  Alex Christensen  <achristensen@webkit.org>
1471
1472         Make DocumentLoader::willSendRequest asynchronous
1473         https://bugs.webkit.org/show_bug.cgi?id=179549
1474
1475         Reviewed by Tim Horton.
1476
1477         No change in behavior, except now redirects will wait for PolicyChecker::checkNavigationPolicy's completion handler.
1478         Before, they would just continue in DocumentLoader::redirectReceived hoping the client had responded to 
1479         decidePolicyForNavigationAction synchronously or that the client would have been ok with continuing.
1480
1481         * loader/DocumentLoader.cpp:
1482         (WebCore::DocumentLoader::redirectReceived):
1483         (WebCore::DocumentLoader::willSendRequest):
1484         (WebCore::DocumentLoader::startLoadingMainResource):
1485         * loader/DocumentLoader.h:
1486         * loader/FrameLoader.cpp:
1487         (WebCore::FrameLoader::loadURL):
1488         (WebCore::FrameLoader::loadWithDocumentLoader):
1489         * loader/PolicyChecker.cpp:
1490         (WebCore::PolicyChecker::checkNavigationPolicy):
1491         * loader/PolicyChecker.h:
1492
1493 2017-11-13  Wenson Hsieh  <wenson_hsieh@apple.com>
1494
1495         [Attachment Support] Implement SPI for clients to request data for a given attachment
1496         https://bugs.webkit.org/show_bug.cgi?id=179586
1497         <rdar://problem/35355720>
1498
1499         Reviewed by Darin Adler.
1500
1501         Adds support in WebCore for fetching data for a given attachment element. See per-method comments below for
1502         more detail.
1503
1504         Test coverage by augmenting existing API tests in WKAttachmentTests, and adding 3 new tests.
1505
1506         * dom/Document.cpp:
1507         (WebCore::Document::didInsertAttachmentElement):
1508         (WebCore::Document::didRemoveAttachmentElement):
1509         (WebCore::Document::attachmentForIdentifier const):
1510
1511         Fetches an attachment element matching the given identifier. Using the identifier => attachment element map here
1512         allows us to avoid the cost of walking the DOM in search for HTMLAttachmentElements every time data is
1513         requested.
1514
1515         * dom/Document.h:
1516
1517         Add a map of attachment identifier => HTMLAttachmentElement in Document. This map is updated when attachment
1518         elements are connected to or disconnected from the document. Additionally, delegate attachment insertion and
1519         removal out to the Editor if possible.
1520
1521         * editing/Editor.cpp:
1522         (WebCore::Editor::insertAttachmentFromFile):
1523         * editing/mac/WebContentReaderMac.mm:
1524         (WebCore::WebContentReader::readFilenames):
1525         * editing/markup.cpp:
1526         (WebCore::createFragmentFromMarkup):
1527
1528         Tweak existing logic that transfers file-backed File objects when deserializing HTMLAttachmentElements from
1529         markup to handle the case where the attachment element is not file-backed. In this case, we construct a new
1530         File object using the deserializing constructor. To do this, we use the attachment element's blob URL to make
1531         sure that the new File references an existing blob matching that URL.
1532
1533         * html/HTMLAttachmentElement.cpp:
1534         (WebCore::AttachmentDataReader::create):
1535         (WebCore::AttachmentDataReader::AttachmentDataReader):
1536
1537         Introduce AttachmentDataReader, a helper class local to HTMLAttachmentElement that is responsible for loading
1538         an attachment element's file and invoking a given callback when loading has succeeded or failed.
1539         Each AttachmentDataReader is retained exclusively by its HTMLAttachmentElement, through the
1540         HTMLAttachmentElement's vector of unique_ptrs to AttachmentDataReaders.
1541
1542         (WebCore::HTMLAttachmentElement::~HTMLAttachmentElement):
1543         (WebCore::HTMLAttachmentElement::blobURL const):
1544
1545         Add a convenience getter for the blob URL of the attachment's backing File object.
1546
1547         (WebCore::HTMLAttachmentElement::setFile):
1548
1549         When setting an attachment element's file, set the blob URL attribute as well to the blob URL. Also, tweak this
1550         to take a RefPtr<File>&& instead of a raw File*.
1551
1552         (WebCore::HTMLAttachmentElement::insertedIntoAncestor):
1553         (WebCore::HTMLAttachmentElement::removedFromAncestor):
1554
1555         Instead of delegating attachment insertion and removal to the Editor, just call out to the Document, which will
1556         now call out to the Editor.
1557
1558         (WebCore::HTMLAttachmentElement::attachmentPath const):
1559
1560         Add a convenience getter for the attachment path attribute.
1561
1562         (WebCore::HTMLAttachmentElement::requestData):
1563         (WebCore::HTMLAttachmentElement::destroyReader):
1564
1565         Called when a AttachmentDataReader has completed (either with success or failure), and is ready to be removed
1566         from the attachment element's list of active data readers.
1567
1568         (WebCore::AttachmentDataReader::~AttachmentDataReader):
1569         (WebCore::AttachmentDataReader::didFinishLoading):
1570         (WebCore::AttachmentDataReader::didFail):
1571         (WebCore::AttachmentDataReader::invokeCallbackAndFinishReading):
1572
1573         When the reader is done loading, or has failed, or is about to be destroyed, fire the callback with loaded data
1574         (if any) and cancel the FileReaderLoader.
1575
1576         * html/HTMLAttachmentElement.h:
1577         * html/HTMLAttributeNames.in:
1578
1579         Adds a new "webkitattachmentbloburl" attribute that keeps track of an attachment element's file's blob URL. This
1580         is used to ensure that information about an attachment element's file is not lost between certain editing
1581         operations (for instance, deleting a line break) that involve serializing and then deserializing markup into
1582         DocumentFragments to then insert.
1583
1584 2017-11-13  Zan Dobersek  <zdobersek@igalia.com>
1585
1586         [Cairo] Remove GraphicsContext::mustUseShadowBlur()
1587         https://bugs.webkit.org/show_bug.cgi?id=179612
1588
1589         Reviewed by Michael Catanzaro.
1590
1591         Remove the Cairo-specific mustUseShadowBlur() method on the
1592         GraphicsContext class. It can now be implemented as a static function
1593         in CairoOperations, using only a PlatformContextCairo object and a
1594         const reference to the relevant GraphicsContextState.
1595
1596         No new tests -- no change in behavior.
1597
1598         * platform/graphics/GraphicsContext.cpp:
1599         (WebCore::GraphicsContext::mustUseShadowBlur const): Deleted.
1600         * platform/graphics/GraphicsContext.h:
1601         * platform/graphics/cairo/CairoOperations.cpp:
1602         (WebCore::Cairo::mustUseShadowBlur):
1603         (WebCore::Cairo::drawGlyphsShadow):
1604         (WebCore::Cairo::fillRectWithRoundedHole):
1605         (WebCore::Cairo::drawGlyphs):
1606         * platform/graphics/cairo/CairoOperations.h:
1607         * platform/graphics/cairo/FontCairo.cpp:
1608         (WebCore::FontCascade::drawGlyphs):
1609         * platform/graphics/cairo/GraphicsContextCairo.cpp:
1610         (WebCore::GraphicsContext::fillRectWithRoundedHole):
1611
1612 2017-11-13  Zan Dobersek  <zdobersek@igalia.com>
1613
1614         [Cairo] Move state change operations from GraphicsContextCairo to CairoOperations
1615         https://bugs.webkit.org/show_bug.cgi?id=179610
1616
1617         Reviewed by Carlos Garcia Campos.
1618
1619         Move operations that perform Cairo state changes to the CairoOperations
1620         file. This enforces only using the PlatformContextCairo object to
1621         achieve the state change, leveraging the cairo_t and ShadowBlur objects
1622         that are owned by PlatformContextCairo.
1623
1624         Along with state modification operations, various state query operations
1625         are also placed under the Cairo::State namespace, again limited to the
1626         PlatformContextCairo object.
1627
1628         No new tests -- no change in behavior.
1629
1630         * platform/graphics/cairo/CairoOperations.cpp:
1631         (WebCore::Cairo::State::setStrokeThickness):
1632         (WebCore::Cairo::State::setGlobalAlpha):
1633         (WebCore::Cairo::State::setCompositeOperation):
1634         (WebCore::Cairo::State::setShouldAntialias):
1635         (WebCore::Cairo::State::setImageInterpolationQuality):
1636         (WebCore::Cairo::State::setCTM):
1637         (WebCore::Cairo::State::getCTM):
1638         (WebCore::Cairo::State::setShadowValues):
1639         (WebCore::Cairo::State::clearShadow):
1640         (WebCore::Cairo::State::getClipBounds):
1641         (WebCore::Cairo::State::roundToDevicePixels):
1642         (WebCore::Cairo::State::isAcceleratedContext):
1643         * platform/graphics/cairo/CairoOperations.h:
1644         * platform/graphics/cairo/GraphicsContextCairo.cpp:
1645         (WebCore::GraphicsContext::getCTM const):
1646         (WebCore::GraphicsContext::restorePlatformState):
1647         (WebCore::GraphicsContext::clipBounds const):
1648         (WebCore::GraphicsContext::roundToDevicePixels):
1649         (WebCore::GraphicsContext::setPlatformStrokeThickness):
1650         (WebCore::GraphicsContext::setCTM):
1651         (WebCore::GraphicsContext::setPlatformShadow):
1652         (WebCore::GraphicsContext::clearPlatformShadow):
1653         (WebCore::GraphicsContext::setPlatformAlpha):
1654         (WebCore::GraphicsContext::setPlatformCompositeOperation):
1655         (WebCore::GraphicsContext::setPlatformShouldAntialias):
1656         (WebCore::GraphicsContext::setPlatformImageInterpolationQuality):
1657         (WebCore::GraphicsContext::isAcceleratedContext const):
1658
1659 2017-11-13  Zan Dobersek  <zdobersek@igalia.com>
1660
1661         [Cairo] Move glyph drawing operations from FontCairo to CairoOperations
1662         https://bugs.webkit.org/show_bug.cgi?id=179609
1663
1664         Reviewed by Carlos Garcia Campos.
1665
1666         Move operations that perform glyph drawing to the CairoOperations file.
1667         This limits operations to only work with a PlatformContextCairo object,
1668         along with other required parameters, and will help with future work
1669         that will rely on isolated Cairo-specific code.
1670
1671         Along with moving the drawGlyphs() code, the helper functions are moved
1672         and adjusted to work specifically on a PlatformContextCairo object and
1673         a const GraphicsContextState reference, only using a GraphicsContext
1674         reference for any required shadowed glyph drawing.
1675
1676         No new tests -- no change in behavior.
1677
1678         * platform/graphics/cairo/CairoOperations.cpp:
1679         (WebCore::Cairo::drawGlyphsToContext):
1680         (WebCore::Cairo::drawGlyphsShadow):
1681         (WebCore::Cairo::drawGlyphs):
1682         * platform/graphics/cairo/FontCairo.cpp:
1683         (WebCore::FontCascade::drawGlyphs):
1684         (WebCore::drawGlyphsToContext): Deleted.
1685         (WebCore::drawGlyphsShadow): Deleted.
1686
1687 2017-11-13  Zan Dobersek  <zdobersek@igalia.com>
1688
1689         [Cairo] Move focus ring drawing operations from GraphicsContextCairo to CairoOperations
1690         https://bugs.webkit.org/show_bug.cgi?id=179603
1691
1692         Reviewed by Carlos Garcia Campos.
1693
1694         Move operations that perform focus ring drawing to the CairoOperations
1695         file. This limits operations to only work with a PlatformContextCairo
1696         object, along with other required parameters, and will help with future
1697         work in this area.
1698
1699         The Cairo::State namespace is introduced, with the setStrokeStyle()
1700         function placed there. The namespace will be used for operations that
1701         only change an aspect of the Cairo state. More functions will be added
1702         soon, and existing line and miter operations will likely move there as
1703         well.
1704
1705         No new tests -- no change in behavior.
1706
1707         * platform/graphics/cairo/CairoOperations.cpp:
1708         (WebCore::Cairo::adjustFocusRingColor):
1709         (WebCore::Cairo::adjustFocusRingLineWidth):
1710         (WebCore::Cairo::focusRingStrokeStyle):
1711         (WebCore::Cairo::State::setStrokeStyle):
1712         (WebCore::Cairo::drawFocusRing):
1713         * platform/graphics/cairo/CairoOperations.h:
1714         * platform/graphics/cairo/GraphicsContextCairo.cpp:
1715         (WebCore::GraphicsContext::drawFocusRing):
1716         (WebCore::GraphicsContext::setPlatformStrokeStyle):
1717         (WebCore::adjustFocusRingColor): Deleted.
1718         (WebCore::adjustFocusRingLineWidth): Deleted.
1719         (WebCore::focusRingStrokeStyle): Deleted.
1720
1721 2017-11-13  Carlos Garcia Campos  <cgarcia@igalia.com>
1722
1723         Unreviewed. Fix debug build with Touch Events enabled after r224740.
1724
1725         * dom/EventContext.cpp:
1726         (WebCore::TouchEventContext::checkReachability const):
1727
1728 2017-11-12  Maciej Stachowiak  <mjs@apple.com>
1729
1730         Remove support for UTF-32 variant text encodings
1731         https://bugs.webkit.org/show_bug.cgi?id=179435
1732
1733         Reviewed by Darin Adler.
1734
1735         Non-support for these encodings is covered by WPT tests.
1736
1737         * platform/text/TextCodecICU.cpp: Remove UTF-32 variants.
1738         Technically, we should also ensure that UTF-32LE with a BOM
1739         gets sniffed as UTF-16LE instead of windows-1252. Chrome
1740         does this but Firefox doesn't yet. WPT tests cover it, and
1741         we can fix it later.
1742
1743 2017-11-12  Zan Dobersek  <zdobersek@igalia.com>
1744
1745         [Cairo] Move rectangle and path filling, stroking, clearing operations in GraphicsContextCairo to CairoOperations
1746         https://bugs.webkit.org/show_bug.cgi?id=179599
1747
1748         Reviewed by Carlos Garcia Campos.
1749
1750         Move operations that perform filling, stroking and clearing for
1751         specified rectangles and paths to the CairoOperations file. This limits
1752         operations to only work with a PlatformContextCairo object, along with
1753         any required parameter, and will help with future work in this area.
1754
1755         Helper functions are copied along for the time being, but will later be
1756         removed from the GraphicsContextCairo implementation file.
1757
1758         No new tests -- no change in behavior.
1759
1760         * platform/graphics/cairo/CairoOperations.cpp:
1761         (WebCore::Cairo::fillRectWithColor):
1762         (WebCore::Cairo::drawPathShadow):
1763         (WebCore::Cairo::fillCurrentCairoPath):
1764         (WebCore::Cairo::fillRect):
1765         (WebCore::Cairo::fillRoundedRect):
1766         (WebCore::Cairo::fillRectWithRoundedHole):
1767         (WebCore::Cairo::fillPath):
1768         (WebCore::Cairo::strokeRect):
1769         (WebCore::Cairo::strokePath):
1770         (WebCore::Cairo::clearRect):
1771         * platform/graphics/cairo/CairoOperations.h:
1772         * platform/graphics/cairo/GradientCairo.cpp:
1773         (WebCore::Gradient::fill):
1774         * platform/graphics/cairo/GraphicsContextCairo.cpp:
1775         (WebCore::GraphicsContext::fillPath):
1776         (WebCore::GraphicsContext::strokePath):
1777         (WebCore::GraphicsContext::fillRect):
1778         (WebCore::GraphicsContext::clearRect):
1779         (WebCore::GraphicsContext::strokeRect):
1780         (WebCore::GraphicsContext::platformFillRoundedRect):
1781         (WebCore::GraphicsContext::fillRectWithRoundedHole):
1782
1783 2017-11-12  Zan Dobersek  <zdobersek@igalia.com>
1784
1785         [Cairo] Move state stack, CTM, transparency layer operations in GraphicsContextCairo to CairoOperations
1786         https://bugs.webkit.org/show_bug.cgi?id=179598
1787
1788         Reviewed by Carlos Garcia Campos.
1789
1790         Move operations that save and restore state, adjust CTM and modify the
1791         transparency layer stack to the CairoOperations file. This limits
1792         operations to only work with a PlatformContextCairo object, along with
1793         any required parameter, and will help with future work in this area.
1794
1795         No new tests -- no change in behavior.
1796
1797         * platform/graphics/cairo/CairoOperations.cpp:
1798         (WebCore::Cairo::save):
1799         (WebCore::Cairo::restore):
1800         (WebCore::Cairo::translate):
1801         (WebCore::Cairo::rotate):
1802         (WebCore::Cairo::scale):
1803         (WebCore::Cairo::concatCTM):
1804         (WebCore::Cairo::beginTransparencyLayer):
1805         (WebCore::Cairo::endTransparencyLayer):
1806         * platform/graphics/cairo/CairoOperations.h:
1807         * platform/graphics/cairo/GraphicsContextCairo.cpp:
1808         (WebCore::GraphicsContext::savePlatformState):
1809         (WebCore::GraphicsContext::restorePlatformState):
1810         (WebCore::GraphicsContext::translate):
1811         (WebCore::GraphicsContext::concatCTM):
1812         (WebCore::GraphicsContext::beginPlatformTransparencyLayer):
1813         (WebCore::GraphicsContext::endPlatformTransparencyLayer):
1814         (WebCore::GraphicsContext::rotate):
1815         (WebCore::GraphicsContext::scale):
1816
1817 2017-11-12  Zan Dobersek  <zdobersek@igalia.com>
1818
1819         [Cairo] Move line, miter operations in GraphicsContextCairo to CairoOperations
1820         https://bugs.webkit.org/show_bug.cgi?id=179597
1821
1822         Reviewed by Carlos Garcia Campos.
1823
1824         Move operations that adjust line cap, line dash, line join and miter
1825         limit to the CairoOperations file. This limits operations to only work
1826         with a PlatformContextCairo object, along with any required parameter,
1827         and will help with future work in this area.
1828
1829         No new tests -- no change in behavior.
1830
1831         * platform/graphics/cairo/CairoOperations.cpp:
1832         (WebCore::Cairo::setLineCap):
1833         (WebCore::Cairo::setLineDash):
1834         (WebCore::Cairo::setLineJoin):
1835         (WebCore::Cairo::setMiterLimit):
1836         * platform/graphics/cairo/CairoOperations.h:
1837         * platform/graphics/cairo/GraphicsContextCairo.cpp:
1838         (WebCore::GraphicsContext::setLineCap):
1839         (WebCore::GraphicsContext::setLineDash):
1840         (WebCore::GraphicsContext::setLineJoin):
1841         (WebCore::GraphicsContext::setMiterLimit):
1842         (WebCore::isDashArrayAllZero): Deleted.
1843
1844 2017-11-12  Chris Dumez  <cdumez@apple.com>
1845
1846         [Service Workers] Activate algorithm says terminate the active worker if it exists
1847         https://bugs.webkit.org/show_bug.cgi?id=179559
1848
1849         Reviewed by Darin Adler.
1850
1851         Activate algorithm says terminate the active worker if it exists:
1852         - https://w3c.github.io/ServiceWorker/#activation-algorithm (Step 2.1)
1853
1854         No new tests, no-op for now as the terminate() function is not implemented
1855         yet.
1856
1857         * workers/service/server/SWServerJobQueue.cpp:
1858         (WebCore::SWServerJobQueue::activate):
1859
1860 2017-11-12  Darin Adler  <darin@apple.com>
1861
1862         More is<> and downcast<>, less static_cast<>
1863         https://bugs.webkit.org/show_bug.cgi?id=179600
1864
1865         Reviewed by Chris Dumez.
1866
1867         * Modules/fetch/FetchBody.cpp:
1868         (WebCore::FetchBody::extract): Use downcast instead of static_cast.
1869         (WebCore::FetchBody::bodyAsFormData const): Ditto.
1870         * Modules/indexeddb/IDBObjectStore.cpp:
1871         (WebCore::IDBObjectStore::putOrAdd): Ditto.
1872         * Modules/mediastream/CanvasCaptureMediaStreamTrack.cpp:
1873         (WebCore::CanvasCaptureMediaStreamTrack::Source::canvasChanged): Ditto.
1874         * Modules/mediastream/libwebrtc/LibWebRTCPeerConnectionBackend.cpp:
1875         (WebCore::libWebRTCProvider): Ditto.
1876
1877         * accessibility/AccessibilityMediaControls.cpp:
1878         (WebCore::AccessibilityMediaTimeDisplay::stringValue const): Got rid of local
1879         variable and used std::abs instead of fabsf. Did not use downcast here because
1880         it doesn't exist for this class.
1881
1882         * bindings/js/JSEventTargetCustom.h:
1883         (WebCore::IDLOperation<JSEventTarget>::call): Use downcast instead of toDOMWindow.
1884         * dom/DocumentEventQueue.cpp:
1885         (WebCore::DocumentEventQueue::dispatchEvent): Ditto.
1886
1887         * dom/Element.h: Added is/downcast for EventTarget.
1888
1889         * dom/EventContext.cpp:
1890         (WebCore::TouchEventContext::checkReachability const): Use downcast instead
1891         of toNode.
1892         * dom/EventContext.h:
1893         (WebCore::EventContext::isUnreachableNode const): Ditto.
1894         * dom/EventPath.cpp:
1895         (WebCore::shouldEventCrossShadowBoundary): Ditto.
1896         (WebCore::EventPath::setRelatedTarget): Ditto.
1897         (WebCore::EventPath::retargetTouch): Ditto.
1898         (WebCore::EventPath::EventPath): Ditto.
1899
1900         * dom/EventTarget.cpp:
1901         (WebCore::EventTarget::toNode): Deleted.
1902         (WebCore::EventTarget::isNode const): Added.
1903         (WebCore::EventTarget::toDOMWindow): Deleted.
1904         (WebCore::EventTarget::isMessagePort const): Deleted. This was not used.
1905         (WebCore::EventTarget::addEventListener): Use downcast instead of toDOMWindow
1906         and toNode.
1907         * dom/EventTarget.h: Updated for the above.
1908
1909         * dom/MessagePort.h: Deleted unused isMessagePort.
1910
1911         * dom/MouseEvent.cpp:
1912         (WebCore::MouseEvent::toElement const): Use downcast instead of toNode.
1913         Also refactored to make function a little smaller.
1914         (WebCore::MouseEvent::fromElement const): Ditto.
1915
1916         * dom/MouseRelatedEvent.cpp:
1917         (WebCore::MouseRelatedEvent::computeRelativePosition): Use downcast
1918         instead of toNode.
1919
1920         * dom/Node.cpp:
1921         (WebCore::Node::isNode const): Added.
1922         (WebCore::Node::toNode): Deleted.
1923         * dom/Node.h: Updated for the above. Also added SPECIALIZE_TYPE_TRAITS
1924         so we can do is/downcast.
1925
1926         * dom/ScopedEventQueue.cpp:
1927         (WebCore::ScopedEventQueue::enqueueEvent): Use is instead of toNode.
1928         (WebCore::ScopedEventQueue::dispatchEvent const): Use downcast instead of toNode.
1929
1930         * dom/make_names.pl:
1931         (printTypeHelpers): Added support for is/downcast from EventTarget.
1932
1933         * editing/Editor.cpp:
1934         (WebCore::Editor::selectionForCommand): Use is/downcast instead of toNode.
1935         * editing/EditorCommand.cpp:
1936         (WebCore::targetFrame): Ditto.
1937         * html/HTMLAnchorElement.cpp:
1938         (WebCore::appendServerMapMousePosition): Ditto.
1939
1940         * html/HTMLCanvasElement.cpp:
1941         (WebCore::HTMLCanvasElement::createContextWebGL): Use downcast instead of
1942         static_cast.
1943         (WebCore::HTMLCanvasElement::getContextWebGL): Ditto.
1944         (WebCore::HTMLCanvasElement::getImageData): Ditto.
1945
1946         * html/HTMLElement.h: Added support for is/downcast from EventTarget.
1947
1948         * html/HTMLFormElement.cpp:
1949         (WebCore::HTMLFormElement::handleLocalEvents): Use is instead of toNode.
1950         (WebCore::submitElementFromEvent): Deleted. Was a duplicate of findSubmitButton.
1951         (WebCore::HTMLFormElement::prepareForSubmission): Rewrote code that calls
1952         submitElementFromEvent to call findSubmitButton instead. Also don't bother
1953         finding the submit button unless we are going to validate, since all we do
1954         after finding it is reconsider whether we should validate.
1955         (WebCore::HTMLFormElement::findSubmitButton const): Rewrote to use is,
1956         downcast, and lineageOfType rather than a handwritten loop and toNode.
1957         Relies on the fact that the target is an element, never a text node.
1958
1959         * html/HTMLLabelElement.cpp:
1960         (WebCore::HTMLLabelElement::defaultEventHandler): Use is and downcast instead
1961         of toNode.
1962
1963         * html/HTMLPlugInImageElement.cpp:
1964         (WebCore::HTMLPlugInImageElement::partOfSnapshotOverlay const): Changed argument
1965         type to EventTarget so we can do the type checking and casting here instead of at
1966         each of the callers.
1967         * html/HTMLPlugInImageElement.h: Updated for the above.
1968
1969         * html/HTMLSummaryElement.cpp:
1970         (WebCore::isClickableControl): Changed argument type to EventTarget so we can do
1971         the type checking and casting here instead of at each of the callers.
1972         (WebCore::HTMLSummaryElement::defaultEventHandler): Removed call to toNode.
1973
1974         * html/HTMLTextFormControlElement.h: Added support for is/downcast from EventTarget.
1975
1976         * html/MediaDocument.cpp:
1977         (WebCore::MediaDocument::defaultEventHandler): Use is/downcast instead of toNode.
1978         * html/RangeInputType.cpp:
1979         (WebCore::RangeInputType::handleMouseDownEvent): Ditto.
1980         * html/shadow/MediaControlElements.cpp:
1981         (WebCore::MediaControlVolumeSliderContainerElement::defaultEventHandler): Ditto.
1982         (WebCore::MediaControlClosedCaptionsTrackListElement::defaultEventHandler): Ditto.
1983         Also use get instead of find/end.
1984
1985         * html/shadow/MediaControls.cpp:
1986         (WebCore::MediaControls::containsRelatedTarget): Use is/downcast instead of toNode.
1987         * inspector/InspectorFrontendHost.cpp:
1988         (WebCore::InspectorFrontendHost::dispatchEventAsContextMenuEvent): Ditto.
1989         * inspector/agents/InspectorDOMAgent.cpp:
1990         (WebCore::InspectorDOMAgent::didAddEventListener): Ditto.
1991         (WebCore::InspectorDOMAgent::willRemoveEventListener): Ditto.
1992         * page/ContextMenuController.cpp:
1993         (WebCore::ContextMenuController::maybeCreateContextMenu): Ditto.
1994
1995         * page/DOMWindow.cpp:
1996         (WebCore::DOMWindow::toDOMWindow): Deleted.
1997         * page/DOMWindow.h: Updated for the above. Also added SPECIALIZE_TYPE_TRAITS
1998         so we can do is/downcast.
1999
2000         * page/EventHandler.cpp:
2001         (WebCore::EventHandler::handleTouchEvent): Use is/downcast instead of toNode.
2002
2003         * platform/graphics/WidthCache.h:
2004         (WebCore::WidthCache::add): Removed unneeded static_cast; length already returns unsigned.
2005
2006         * rendering/RenderSnapshottedPlugIn.cpp:
2007         (WebCore::RenderSnapshottedPlugIn::handleEvent): Removed unneeded toNode now that
2008         partOfSnapshotOverlay takes an EventTarget.
2009
2010 2017-11-12  Gabriel Ivascu  <givascu@igalia.com>
2011
2012         [GTK] Add functionality to handle font sizes in points
2013         https://bugs.webkit.org/show_bug.cgi?id=179285
2014
2015         Reviewed by Carlos Garcia Campos and Michael Catanzaro.
2016
2017         * platform/PlatformScreen.h:
2018         * platform/gtk/PlatformScreenGtk.cpp:
2019         (WebCore::screenDPI):
2020         * platform/wpe/PlatformScreenWPE.cpp:
2021         (WebCore::screenDPI):
2022
2023 2017-11-12  Yusuke Suzuki  <utatane.tea@gmail.com>
2024
2025         [WebCore] Implement import.meta.url
2026         https://bugs.webkit.org/show_bug.cgi?id=178672
2027
2028         Reviewed by Darin Adler.
2029
2030         This patch implements `import.meta.url` field, which holds a base url
2031         of the currently executing module[1].
2032
2033         In the case of embedded modules, this field becomes the URL of the
2034         embedding HTML file. In the case of imported modules, the URL becomes
2035         the URL of the executed module script file.
2036
2037         [1]: https://github.com/whatwg/html/pull/3141
2038
2039         * bindings/js/JSDOMWindowBase.cpp:
2040         (WebCore::JSDOMWindowBase::moduleLoaderCreateImportMetaProperties):
2041         * bindings/js/JSDOMWindowBase.h:
2042         * bindings/js/ScriptModuleLoader.cpp:
2043         (WebCore::ScriptModuleLoader::moduleURL):
2044         (WebCore::ScriptModuleLoader::evaluate):
2045         (WebCore::ScriptModuleLoader::createImportMetaProperties):
2046         * bindings/js/ScriptModuleLoader.h:
2047
2048 2017-11-11  Dan Bernstein  <mitz@apple.com>
2049
2050         [Xcode] WebCore generates unified sources during installhdrs
2051         https://bugs.webkit.org/show_bug.cgi?id=179578
2052
2053         Reviewed by Anders Carlsson.
2054
2055         * WebCore.xcodeproj/project.pbxproj: Use GenerateUnifiedSources.xcconfig, which sets
2056           INSTALLHDRS_SCRIPT_PHASE to NO, for the Generate Unified Sources target.
2057
2058 2017-11-11  Simon Fraser  <simon.fraser@apple.com>
2059
2060         Remove redundant platform-specific implementations of Image::drawPattern()
2061         https://bugs.webkit.org/show_bug.cgi?id=179580
2062
2063         Reviewed by Sam Weinig.
2064
2065         Platform-specific Image files had implementations of Image::drawPattern() but they
2066         were all effectively identical, so put a single implementation into Image.cpp.
2067
2068         * SourcesCocoa.txt:
2069         * WebCore.xcodeproj/project.pbxproj:
2070         * platform/SourcesCairo.txt:
2071         * platform/graphics/Image.cpp:
2072         (WebCore::Image::drawPattern):
2073         * platform/graphics/cairo/ImageCairo.cpp: Removed.
2074         * platform/graphics/cg/ImageCG.cpp: Removed.
2075         * platform/graphics/win/ImageDirect2D.cpp:
2076         (WebCore::Image::drawPattern): Deleted.
2077
2078 2017-11-11  Devin Rousso  <webkit@devinrousso.com>
2079
2080         Web Inspector: Canvas tab: show detailed status during canvas recording
2081         https://bugs.webkit.org/show_bug.cgi?id=178185
2082         <rdar://problem/34939862>
2083
2084         Reviewed by Brian Burg.
2085
2086         Updated existing tests to assert that the correct number of progress events are fired.
2087
2088         * inspector/agents/InspectorCanvasAgent.cpp:
2089         (WebCore::InspectorCanvasAgent::didFinishRecordingCanvasFrame):
2090         After each recorded frame, fire a progress event with the recorded frames as data. This will
2091         release the frames from the associated InspectorCanvas, meaning that the frames must be
2092         aggregated in the frontend before a Recording can be created.
2093
2094         The protocol is designed with arrays so that if we decide to add throttling (e.g. one event
2095         per second) we are able to do so without modifying the protocol.
2096
2097         * inspector/InspectorCanvas.h:
2098         * inspector/InspectorCanvas.cpp:
2099         (WebCore::InspectorCanvas::hasRecordingData const):
2100         (WebCore::InspectorCanvas::currentFrameHasData const):
2101         (WebCore::InspectorCanvas::recordAction):
2102         (WebCore::InspectorCanvas::finalizeFrame):
2103         (WebCore::InspectorCanvas::markCurrentFrameIncomplete):
2104         Add additional checks that the list of recorded frames is not nullptr when finalizing or
2105         marking as incomplete.
2106
2107 2017-11-11  Helmut Grohne  <helmut@subdivi.de>
2108
2109         [GTK] PlatformGTK.cmake: use the PKG_CONFIG_EXECUTABLE variable
2110         https://bugs.webkit.org/show_bug.cgi?id=179547
2111
2112         Reviewed by Michael Catanzaro.
2113
2114         * PlatformGTK.cmake: Use PKG_CONFIG_EXECUTABLE instead of
2115         hardcoding the executable name.
2116
2117 2017-11-10  Chris Dumez  <cdumez@apple.com>
2118
2119         [Service Workers] Registration promise should be rejected when the service worker fails to start
2120         https://bugs.webkit.org/show_bug.cgi?id=179566
2121
2122         Reviewed by Brady Eidson.
2123
2124         Registration promise should be rejected when the service worker fails to start.
2125
2126         Though our code intended to do this, there were several issues:
2127         - Our code failed to properly detect when the script failed to evaluate. This is
2128           because it relied on the exception message being non-null but it was always
2129           null when same origin due to a bug.
2130         - Our scriptContextFailedToStart() handler failed to rejected the promise
2131           and finish the job as per:
2132           - https://w3c.github.io/ServiceWorker/#update-algorithm (step 9.7)
2133
2134         Test: http/tests/workers/service/worker-fails-to-start.html
2135
2136         * bindings/js/WorkerScriptController.cpp:
2137         (WebCore::WorkerScriptController::evaluate):
2138         * workers/service/server/SWServerJobQueue.cpp:
2139         (WebCore::SWServerJobQueue::scriptContextFailedToStart):
2140
2141 2017-11-10  Jer Noble  <jer.noble@apple.com>
2142
2143         Unreviewed Win Debug build fix; add FourCC.cpp to the cmake source list for Windows.
2144
2145         * PlatformWin.cmake:
2146
2147 2017-11-10  Said Abou-Hallawa  <sabouhallawa@apple.com>
2148
2149         [CG] PDF document cached image is regenerated every time the destination rectangle changes
2150         https://bugs.webkit.org/show_bug.cgi?id=179516
2151
2152         Reviewed by Tim Horton.
2153
2154         The PDF document cached image was regenerated if m_cachedImageRect didn't
2155         contain the dirty rectangle. When moving the image, its new rectangle is
2156         invalidated. This will set a new dirty rectangle outside m_cachedImageRect
2157         which may not be fully inside m_cachedImageRect.
2158
2159         The PDF document cached image should be reused if we still draw the same
2160         part of the image (srcRet did not change) and we use the same zooming factor        
2161         (dstSize did not change).
2162
2163         * platform/graphics/cg/PDFDocumentImage.cpp:
2164         (WebCore::PDFDocumentImage::cacheParametersMatch const): Remove a check
2165         that was added mainly to force recalculating m_cachedImageRect when the
2166         dirty rectangle changes. 
2167
2168         (WebCore::PDFDocumentImage::updateCachedImageIfNeeded): Recalculate
2169         m_cachedImageRect every time this function is called regardless the cached
2170         image will be regenerated or not.
2171
2172 2017-11-10  Simon Fraser  <simon.fraser@apple.com>
2173
2174         Compositing layers in UIWebView are often missing content after scrolling
2175         https://bugs.webkit.org/show_bug.cgi?id=179564
2176         rdar://problem/33885639
2177
2178         Reviewed by Tim Horton.
2179         
2180         When dropping backing store for layers outside the viewport, we rely on a compositing
2181         layer flush to compute layer visibility and bring the backing store back when necessary.
2182
2183         In UIWebView, we have a mechanism to trigger flushing on user scrolling but it only triggers
2184         when there are tiled layers. Remove that condition so it triggers always, now that
2185         backing store availability also depends on this.
2186
2187         * page/ios/FrameIOS.mm:
2188         (WebCore::Frame::viewportOffsetChanged):
2189         (WebCore::anyFrameHasTiledLayers): Deleted.
2190
2191 2017-11-10  Simon Fraser  <simon.fraser@apple.com>
2192
2193         Contents of composited overflow-scroll are missing when newly added
2194         https://bugs.webkit.org/show_bug.cgi?id=179556
2195         rdar://problem/20368294
2196
2197         Reviewed by Tim Horton.
2198
2199         When content is appended to an oveflow:scroll, we do a subtree layout. That triggered
2200         a compositing code path that failed to call updateAfterDescendants() which is where
2201         we compute whether we can be a simple composited layer without backing store. Fix to
2202         call that after the updateGeometry() call, as we do elsewhere.
2203
2204         Test: compositing/backing/overflow-gains-content.html
2205
2206         * rendering/RenderLayerBacking.cpp:
2207         (WebCore::RenderLayerBacking::updateAfterLayout):
2208
2209 2017-11-10  Simon Fraser  <simon.fraser@apple.com>
2210
2211         Remove the 'CompositingChildrenOnly' flag which was always on
2212         https://bugs.webkit.org/show_bug.cgi?id=179546
2213
2214         Reviewed by Antoine Quint.
2215
2216         All calls to updateAfterLayout() passed the CompositingChildrenOnly flag, so all calls
2217         to updateCompositingDescendantGeometry() had compositedChildrenOnly=true, so remove
2218         these flags.
2219
2220         Also use an OptionSet<>.
2221
2222         * rendering/RenderLayer.cpp:
2223         (WebCore::RenderLayer::updateLayerPositions):
2224         * rendering/RenderLayerBacking.cpp:
2225         (WebCore::RenderLayerBacking::updateAfterLayout):
2226         (WebCore::RenderLayerBacking::contentChanged):
2227         * rendering/RenderLayerBacking.h:
2228         * rendering/RenderLayerCompositor.cpp:
2229         (WebCore::RenderLayerCompositor::updateCompositingDescendantGeometry):
2230         * rendering/RenderLayerCompositor.h:
2231
2232 2017-11-10  Chris Dumez  <cdumez@apple.com>
2233
2234         Remove dead code from ServiceWorkerRegistration
2235         https://bugs.webkit.org/show_bug.cgi?id=179555
2236
2237         Reviewed by Ryosuke Niwa.
2238
2239         * workers/service/ServiceWorkerRegistration.cpp:
2240         (WebCore::ServiceWorkerRegistration::setInstallingWorker): Deleted.
2241         (WebCore::ServiceWorkerRegistration::setWaitingWorker): Deleted.
2242         (WebCore::ServiceWorkerRegistration::setActiveWorker): Deleted.
2243         * workers/service/ServiceWorkerRegistration.h:
2244
2245 2017-11-10  Chris Dumez  <cdumez@apple.com>
2246
2247         [Service Workers] Implement better support for "Clear Registration" algorithm
2248         https://bugs.webkit.org/show_bug.cgi?id=179441
2249
2250         Reviewed by Brady Eidson.
2251
2252         Implement better support for "Clear Registration" algorithm as per:
2253         - https://w3c.github.io/ServiceWorker/#clear-registration-algorithm
2254
2255         In particular, we now properly clear the service workers on the ServiceWorkerRegistration
2256         object and we properly update its service workers' state to "redundant".
2257
2258         Test: http/tests/workers/service/registration-clear-redundant-worker.html
2259
2260         * workers/service/server/SWServerJobQueue.cpp:
2261         (WebCore::SWServerJobQueue::clearRegistration):
2262
2263 2017-11-10  Ryan Haddad  <ryanhaddad@apple.com>
2264
2265         Unreviewed, rolling out r224705.
2266
2267         Introduced a LayoutTest crash on WK1.
2268
2269         Reverted changeset:
2270
2271         "[Web Animations] Implement getAnimations()"
2272         https://bugs.webkit.org/show_bug.cgi?id=179535
2273         https://trac.webkit.org/changeset/224705
2274
2275 2017-11-10  Jer Noble  <jer.noble@apple.com>
2276
2277         Add a FairPlay Streaming based CDM for Modern EME
2278         https://bugs.webkit.org/show_bug.cgi?id=179499
2279         <rdar://problem/35445033>
2280
2281         Reviewed by Eric Carlson.
2282
2283         Tests: platform/mac/media/encrypted-media/fps-createMediaKeys.html
2284                platform/mac/media/encrypted-media/fps-requestMediaKeySystemAccess.html
2285
2286         Add new CDMFairPlayStreaming and CDMInstanceFairPlayStreamingAVFObjC platform classes which implement
2287         the basics of FairPlay Streaming support in Modern EME.
2288
2289         Drive-by fixes:
2290
2291         - Add a != operator to FourCC
2292         - Add a virtual setStorageDirectory() method to CDMInstance (and default implementations to CDMClearKey
2293           and MockCDM)
2294         - Move ISOVTTCue into the platform/graphics/iso directory and update all the places where it is called.
2295
2296         * Modules/encryptedmedia/MediaKeySession.cpp:
2297         (WebCore::MediaKeySession::mediaKeysStorageDirectory const):
2298         * Modules/encryptedmedia/MediaKeySession.h:
2299         * Sources.txt:
2300         * WebCore.xcodeproj/project.pbxproj:
2301         * platform/encryptedmedia/CDMFactory.cpp:
2302         * platform/encryptedmedia/CDMInstance.h:
2303         * platform/encryptedmedia/CDMRestrictions.h:
2304         * platform/encryptedmedia/clearkey/CDMClearKey.cpp:
2305         (WebCore::CDMInstanceClearKey::setStorageDirectory):
2306         * platform/encryptedmedia/clearkey/CDMClearKey.h:
2307         * platform/graphics/FourCC.h:
2308         (WebCore::FourCC::operator!= const):
2309         * platform/graphics/iso/ISOBox.cpp: Added.
2310         (WebCore::ISOBox::peekBox):
2311         (WebCore::ISOBox::read):
2312         (WebCore::ISOBox::parse):
2313         (WebCore::ISOFullBox::parse):
2314         * platform/graphics/iso/ISOBox.h: Added.
2315         (WebCore::ISOBox::minimumBoxSize):
2316         (WebCore::ISOBox::size const):
2317         (WebCore::ISOBox::boxType const):
2318         (WebCore::ISOBox::extendedType const):
2319         (WebCore::ISOBox::checkedRead):
2320         (WebCore::ISOFullBox::version const):
2321         (WebCore::ISOFullBox::flags const):
2322         * platform/graphics/iso/ISOOriginalFormatBox.cpp: Added.
2323         (WebCore::ISOOriginalFormatBox::parse):
2324         * platform/graphics/iso/ISOOriginalFormatBox.h: Added.
2325         (WebCore::ISOOriginalFormatBox::boxTypeName):
2326         (WebCore::ISOOriginalFormatBox::dataFormat const):
2327         * platform/graphics/iso/ISOProtectionSchemeInfoBox.cpp: Added.
2328         (WebCore::ISOProtectionSchemeInfoBox::parse):
2329         * platform/graphics/iso/ISOProtectionSchemeInfoBox.h: Added.
2330         (WebCore::ISOProtectionSchemeInfoBox::boxTypeName):
2331         (WebCore::ISOProtectionSchemeInfoBox::schemeTypeBox const):
2332         (WebCore::ISOProtectionSchemeInfoBox::schemeInformationBox const):
2333         * platform/graphics/iso/ISOSchemeInformationBox.cpp: Added.
2334         (WebCore::ISOSchemeInformationBox::parse):
2335         * platform/graphics/iso/ISOSchemeInformationBox.h: Added.
2336         (WebCore::ISOSchemeInformationBox::boxTypeName):
2337         (WebCore::ISOSchemeInformationBox::schemeSpecificData const):
2338         * platform/graphics/iso/ISOSchemeTypeBox.cpp: Added.
2339         (WebCore::ISOSchemeTypeBox::parse):
2340         * platform/graphics/iso/ISOSchemeTypeBox.h: Added.
2341         (WebCore::ISOSchemeTypeBox::boxTypeName):
2342         (WebCore::ISOSchemeTypeBox::schemeType const):
2343         (WebCore::ISOSchemeTypeBox::schemeVersion const):
2344         * platform/graphics/iso/ISOTrackEncryptionBox.cpp: Added.
2345         (WebCore::ISOTrackEncryptionBox::parse):
2346         * platform/graphics/iso/ISOTrackEncryptionBox.h: Added.
2347         (WebCore::ISOTrackEncryptionBox::boxTypeName):
2348         (WebCore::ISOTrackEncryptionBox::defaultCryptByteBlock const):
2349         (WebCore::ISOTrackEncryptionBox::defaultSkipByteBlock const):
2350         (WebCore::ISOTrackEncryptionBox::defaultIsProtected const):
2351         (WebCore::ISOTrackEncryptionBox::defaultPerSampleIVSize const):
2352         (WebCore::ISOTrackEncryptionBox::defaultKID const):
2353         (WebCore::ISOTrackEncryptionBox::defaultConstantIV const):
2354         * platform/graphics/iso/ISOVTTCue.cpp: Added.
2355         (WebCore::ISOStringBox::contents):
2356         (WebCore::vttIdBoxType):
2357         (WebCore::vttSettingsBoxType):
2358         (WebCore::vttPayloadBoxType):
2359         (WebCore::vttCurrentTimeBoxType):
2360         (WebCore::vttCueSourceIDBoxType):
2361         (WebCore::ISOWebVTTCue::ISOWebVTTCue):
2362         (WebCore::ISOWebVTTCue::parse):
2363         * platform/graphics/iso/ISOVTTCue.h: Renamed from Source/WebCore/platform/graphics/ISOVTTCue.h.
2364         (WebCore::ISOWebVTTCue::boxTypeName):
2365         (WebCore::ISOWebVTTCue::presentationTime const):
2366         (WebCore::ISOWebVTTCue::duration const):
2367         (WebCore::ISOWebVTTCue::sourceID const):
2368         (WebCore::ISOWebVTTCue::id const):
2369         (WebCore::ISOWebVTTCue::originalStartTime const):
2370         (WebCore::ISOWebVTTCue::settings const):
2371         (WebCore::ISOWebVTTCue::cueText const):
2372         * platform/graphics/avfoundation/CDMFairPlayStreaming.cpp: Added.
2373         (WebCore::extractSinfData):
2374         (WebCore::extractSchemeAndKeyIdFromSinf):
2375         (WebCore::extractKeyIDsSinf):
2376         (WebCore::sanitizeSinf):
2377         (WebCore::CDMFactory::platformRegisterFactories):
2378         (WebCore::CDMFactoryFairPlayStreaming::singleton):
2379         (WebCore::CDMFactoryFairPlayStreaming::createCDM):
2380         (WebCore::CDMFactoryFairPlayStreaming::supportsKeySystem):
2381         (WebCore::CDMPrivateFairPlayStreaming::supportsInitDataType const):
2382         (WebCore::CDMPrivateFairPlayStreaming::supportsConfiguration const):
2383         (WebCore::CDMPrivateFairPlayStreaming::supportsConfigurationWithRestrictions const):
2384         (WebCore::CDMPrivateFairPlayStreaming::supportsSessionTypeWithConfiguration const):
2385         (WebCore::CDMPrivateFairPlayStreaming::supportsRobustness const):
2386         (WebCore::CDMPrivateFairPlayStreaming::distinctiveIdentifiersRequirement const):
2387         (WebCore::CDMPrivateFairPlayStreaming::persistentStateRequirement const):
2388         (WebCore::CDMPrivateFairPlayStreaming::distinctiveIdentifiersAreUniquePerOriginAndClearable const):
2389         (WebCore::CDMPrivateFairPlayStreaming::createInstance):
2390         (WebCore::CDMPrivateFairPlayStreaming::loadAndInitialize):
2391         (WebCore::CDMPrivateFairPlayStreaming::supportsServerCertificates const):
2392         (WebCore::CDMPrivateFairPlayStreaming::supportsSessions const):
2393         (WebCore::CDMPrivateFairPlayStreaming::supportsInitData const):
2394         (WebCore::CDMPrivateFairPlayStreaming::sanitizeResponse const):
2395         (WebCore::CDMPrivateFairPlayStreaming::sanitizeSessionId const):
2396         * platform/graphics/avfoundation/CDMFairPlayStreaming.h: Added.
2397         * platform/graphics/avfoundation/objc/CDMInstanceFairPlayStreamingAVFObjC.h: Added.
2398         * platform/graphics/avfoundation/objc/CDMInstanceFairPlayStreamingAVFObjC.mm: Added.
2399         (-[WebCoreFPSContentKeySessionDelegate initWithParent:]):
2400         (-[WebCoreFPSContentKeySessionDelegate invalidate]):
2401         (-[WebCoreFPSContentKeySessionDelegate contentKeySession:didProvideContentKeyRequest:]):
2402         (-[WebCoreFPSContentKeySessionDelegate contentKeySession:didProvideRenewingContentKeyRequest:]):
2403         (-[WebCoreFPSContentKeySessionDelegate contentKeySession:didProvidePersistableContentKeyRequest:]):
2404         (-[WebCoreFPSContentKeySessionDelegate contentKeySession:didUpdatePersistableContentKey:forContentKeyIdentifier:]):
2405         (-[WebCoreFPSContentKeySessionDelegate contentKeySession:contentKeyRequest:didFailWithError:]):
2406         (-[WebCoreFPSContentKeySessionDelegate contentKeySession:shouldRetryContentKeyRequest:reason:]):
2407         (-[WebCoreFPSContentKeySessionDelegate contentKeySessionContentProtectionSessionIdentifierDidChange:]):
2408         (WebCore::CDMInstanceFairPlayStreamingAVFObjC::CDMInstanceFairPlayStreamingAVFObjC):
2409         (WebCore::CDMInstanceFairPlayStreamingAVFObjC::~CDMInstanceFairPlayStreamingAVFObjC):
2410         (WebCore::CDMInstanceFairPlayStreamingAVFObjC::supportsPersistableState):
2411         (WebCore::CDMInstanceFairPlayStreamingAVFObjC::supportsPersistentKeys):
2412         (WebCore::CDMInstanceFairPlayStreamingAVFObjC::mimeTypeIsPlayable):
2413         (WebCore::CDMInstanceFairPlayStreamingAVFObjC::initializeWithConfiguration):
2414         (WebCore::CDMInstanceFairPlayStreamingAVFObjC::setDistinctiveIdentifiersAllowed):
2415         (WebCore::CDMInstanceFairPlayStreamingAVFObjC::setPersistentStateAllowed):
2416         (WebCore::CDMInstanceFairPlayStreamingAVFObjC::setServerCertificate):
2417         (WebCore::CDMInstanceFairPlayStreamingAVFObjC::setStorageDirectory):
2418         (WebCore::CDMInstanceFairPlayStreamingAVFObjC::isLicenseTypeSupported const):
2419         (WebCore::CDMInstanceFairPlayStreamingAVFObjC::requestLicense):
2420         (WebCore::CDMInstanceFairPlayStreamingAVFObjC::updateLicense):
2421         (WebCore::CDMInstanceFairPlayStreamingAVFObjC::loadSession):
2422         (WebCore::CDMInstanceFairPlayStreamingAVFObjC::closeSession):
2423         (WebCore::CDMInstanceFairPlayStreamingAVFObjC::removeSessionData):
2424         (WebCore::CDMInstanceFairPlayStreamingAVFObjC::storeRecordOfKeyUsage):
2425         (WebCore::CDMInstanceFairPlayStreamingAVFObjC::keySystem const):
2426         (WebCore::CDMInstanceFairPlayStreamingAVFObjC::didProvideRequest):
2427         (WebCore::CDMInstanceFairPlayStreamingAVFObjC::didProvideRenewingRequest):
2428         (WebCore::CDMInstanceFairPlayStreamingAVFObjC::didProvidePersistableRequest):
2429         (WebCore::CDMInstanceFairPlayStreamingAVFObjC::didFailToProvideRequest):
2430         (WebCore::CDMInstanceFairPlayStreamingAVFObjC::shouldRetryRequestForReason):
2431         (WebCore::CDMInstanceFairPlayStreamingAVFObjC::sessionIdentifierChanged):
2432         * platform/graphics/avfoundation/InbandTextTrackPrivateAVF.cpp:
2433         (WebCore::InbandTextTrackPrivateAVF::processNativeSamples):
2434         (WebCore::InbandTextTrackPrivateAVF::readNativeSampleBuffer):
2435         * testing/MockCDMFactory.cpp:
2436         (WebCore::MockCDMInstance::setStorageDirectory):
2437         * testing/MockCDMFactory.h:
2438
2439 2017-11-10  Antoine Quint  <graouts@apple.com>
2440
2441         [Web Animations] Implement getAnimations()
2442         https://bugs.webkit.org/show_bug.cgi?id=179535
2443         <rdar://problem/34932475>
2444
2445         Reviewed by Simon Fraser.
2446
2447         We now allow a list of animations for a document, with Document.getAnimations(), or for an
2448         element, with Animatable.getAnimations(), to be returned. In order to support this, we maintain
2449         a map on AnimationTimeline of all animations for a given element. This map is invalidated
2450         when an animation's timeline changes and when an animation's effect changes. Note that the
2451         Web Animations spec mandates that an AnimationEffect can only be a single animation's effect.
2452
2453         Additionally, we ensure that the Document-to-DocumentTimeline relationship is cleared when
2454         is being prepared for teardown to avoid a ref-cycle.
2455
2456         Tests: http/wpt/wk-web-animations/interfaces/document-get-animations.html
2457                http/wpt/wk-web-animations/interfaces/element-get-animations.html
2458                http/wpt/wk-web-animations/timing-model/animation-effect-unique-relationship.html
2459
2460         * CMakeLists.txt: Add Animatable.idl.
2461         * DerivedSources.make: Add Animatable.idl.
2462         * WebCore.xcodeproj/project.pbxproj: Add Animatable.idl.
2463         * animation/Animatable.idl: A new interface that Element implements and which currently only exposes
2464         getAnimations(), the animate() method will be added later.
2465         * animation/AnimationEffect.h: Add a new m_animation member to reference the animation using this
2466         effect. This relationship is required so we guarantee that an effect is associated with a single
2467         animation at most.
2468         (WebCore::AnimationEffect::animation const):
2469         (WebCore::AnimationEffect::setAnimation):
2470         * animation/AnimationTimeline.cpp:
2471         (WebCore::AnimationTimeline::animationWasAddedToElement): New method to notify the timeline that an
2472         animation registered with this timeline has been associated with a new element through its effect.
2473         (WebCore::AnimationTimeline::animationWasRemovedFromElement): New method to notify the timeline that an
2474         animation registered with this timeline has been disassociated with an element through its effect.
2475         (WebCore::AnimationTimeline::animationsForElement): New method returning all animations registered with
2476         this timeline for a given element.
2477         * animation/AnimationTimeline.h:
2478         (WebCore::AnimationTimeline::animations const): All animations registered with this timeline.
2479         * animation/DocumentTimeline.cpp:
2480         (WebCore::DocumentTimeline::DocumentTimeline):
2481         (WebCore::DocumentTimeline::detachFromDocument): Clear the reference between this timeline and its document.
2482         * animation/DocumentTimeline.h:
2483         * animation/WebAnimation.cpp:
2484         (WebCore::WebAnimation::create):
2485         (WebCore::WebAnimation::setEffect): As an animation's effect changes, we need to ensure that the old
2486         effect no longer has an associated animation, and that the new effect is associated with this animation.
2487         Additionally, we update the element-to-animations map on the animation's timeline.
2488         (WebCore::WebAnimation::setTimeline): Update the element-to-animations map on the former and new timeline.
2489         * dom/Document.cpp:
2490         (WebCore::Document::prepareForDestruction): Clear the relationship between this document and its timeline.
2491         (WebCore::Document::getAnimations): Obtain all animations associated with this document's timeline.
2492         * dom/Document.h:
2493         * dom/Document.idl:
2494         * dom/Element.cpp:
2495         (WebCore::Element::getAnimations): Obtain all animations associated with this element.
2496         * dom/Element.h:
2497         * dom/Element.idl:
2498         * testing/Internals.cpp:
2499
2500 2017-11-10  Joseph Pecoraro  <pecoraro@apple.com>
2501
2502         Web Inspector: Make http status codes be "integer" instead of "number" in protocol
2503         https://bugs.webkit.org/show_bug.cgi?id=179543
2504
2505         Reviewed by Antoine Quint.
2506
2507         * inspector/agents/InspectorNetworkAgent.cpp:
2508         (WebCore::InspectorNetworkAgent::buildObjectForResourceResponse):
2509         No need for the temporary or type change.
2510
2511 2017-11-10  Commit Queue  <commit-queue@webkit.org>
2512
2513         Unreviewed, rolling out r224602 and r224697.
2514         https://bugs.webkit.org/show_bug.cgi?id=179545
2515
2516         The LayoutTest for this change is flaky. (Requested by
2517         ryanhaddad on #webkit).
2518
2519         Reverted changesets:
2520
2521         "Add tests to ensure that <source> tags are only preloaded
2522         when the `type`"
2523         https://bugs.webkit.org/show_bug.cgi?id=179231
2524         https://trac.webkit.org/changeset/224602
2525
2526         "Fix race conditions with setBackingScaleFactor, page refresh
2527         and preloader"
2528         https://bugs.webkit.org/show_bug.cgi?id=179488
2529         https://trac.webkit.org/changeset/224697
2530
2531 2017-11-10  Chris Dumez  <cdumez@apple.com>
2532
2533         [Service Workers] Implement "Try Activate" / "Activate" algorithms
2534         https://bugs.webkit.org/show_bug.cgi?id=179436
2535
2536         Reviewed by Brady Eidson.
2537
2538         Implement proper "Try Activate" / "Activate" algorithms as per:
2539         - https://w3c.github.io/ServiceWorker/#try-activate-algorithm
2540         - https://w3c.github.io/ServiceWorker/#activation-algorithm
2541
2542         Test: http/tests/workers/service/basic-activate-event.html
2543
2544         * workers/service/context/SWContextManager.cpp:
2545         (WebCore::SWContextManager::fireActivateEvent):
2546         * workers/service/context/SWContextManager.h:
2547         * workers/service/context/ServiceWorkerThread.cpp:
2548         (WebCore::ServiceWorkerThread::fireActivateEvent):
2549         * workers/service/context/ServiceWorkerThread.h:
2550         * workers/service/server/SWServer.cpp:
2551         (WebCore::SWServer::Connection::didFinishActivation):
2552         (WebCore::SWServer::didFinishActivation):
2553         (WebCore::SWServer::fireActivateEvent):
2554         * workers/service/server/SWServer.h:
2555         * workers/service/server/SWServerJobQueue.cpp:
2556         (WebCore::SWServerJobQueue::didFinishInstall):
2557         (WebCore::SWServerJobQueue::tryActivate):
2558         (WebCore::SWServerJobQueue::activate):
2559         (WebCore::SWServerJobQueue::didFinishActivation):
2560         * workers/service/server/SWServerJobQueue.h:
2561
2562 2017-11-10  Alex Christensen  <achristensen@webkit.org>
2563
2564         Fix debug build after r224700
2565         https://bugs.webkit.org/show_bug.cgi?id=179460
2566
2567         * platform/text/TextEncodingRegistry.cpp:
2568         (WebCore::addToTextEncodingNameMap):
2569
2570 2017-11-10  Maciej Stachowiak  <mjs@apple.com>
2571
2572         Remove TEC decoders that duplicate ICU decoders
2573         https://bugs.webkit.org/show_bug.cgi?id=179460
2574
2575         Reviewed by Darin Adler.
2576
2577         Test: fast/encoding/duplicate-tec-encodings.html
2578
2579         * platform/text/TextEncodingRegistry.cpp:
2580         (WebCore::checkExistingName): Deleted.
2581         (WebCore::addToTextEncodingNameMap): Move the check from checkExistingName here,
2582         and make it an ASSERT, since we should now be guaranteed no duplicate encodings.
2583         * platform/text/mac/mac-encodings.txt: Remove encodings that duplicate ones we
2584         implement with ICU.
2585         * platform/text/TextCodecICU.cpp: Add some extra encoding aliases that only TEC 
2586         knew about.
2587
2588 2017-11-10  Alex Christensen  <achristensen@webkit.org>
2589
2590         Make CachedResource::redirectReceived asynchronous
2591         https://bugs.webkit.org/show_bug.cgi?id=179503
2592
2593         Reviewed by Antti Koivisto.
2594
2595         There were a few loops where we called redirectReceived many times in a row,
2596         and these are replaced with a completion handler that recursively calls the next
2597         redirectReceived or the code after the loop.
2598
2599         No change in behavior.
2600
2601         * loader/DocumentLoader.cpp:
2602         (WebCore::DocumentLoader::redirectReceived):
2603         * loader/DocumentLoader.h:
2604         (WebCore::DocumentLoader::setLastCheckedRequest):
2605         * loader/DocumentThreadableLoader.cpp:
2606         (WebCore::DocumentThreadableLoader::redirectReceived):
2607         * loader/DocumentThreadableLoader.h:
2608         * loader/MediaResourceLoader.cpp:
2609         (WebCore::MediaResource::redirectReceived):
2610         * loader/MediaResourceLoader.h:
2611         * loader/PolicyChecker.cpp:
2612         (WebCore::PolicyChecker::checkNavigationPolicy):
2613         * loader/SubresourceLoader.cpp:
2614         (WebCore::SubresourceLoader::willSendRequestInternal):
2615         * loader/cache/CachedRawResource.cpp:
2616         (WebCore::iterate):
2617         (WebCore::CachedRawResource::didAddClient):
2618         (WebCore::CachedRawResource::redirectReceived):
2619         * loader/cache/CachedRawResource.h:
2620         * loader/cache/CachedRawResourceClient.h:
2621         (WebCore::CachedRawResourceClient::redirectReceived):
2622         * loader/cache/CachedResource.cpp:
2623         (WebCore::CachedResource::redirectReceived):
2624         * loader/cache/CachedResource.h:
2625         * platform/graphics/PlatformMediaResourceLoader.h:
2626         (WebCore::PlatformMediaResourceClient::redirectReceived):
2627         * platform/network/cocoa/WebCoreNSURLSession.mm:
2628         (WebCore::WebCoreNSURLSessionDataTaskClient::redirectReceived):
2629
2630 2017-11-10  John Wilander  <wilander@apple.com>
2631
2632         Ignore HSTS for partitioned, cross-origin subresource requests
2633         https://bugs.webkit.org/show_bug.cgi?id=178993
2634         <rdar://problem/34962462>
2635
2636         Reviewed by Brent Fulgham.
2637
2638         No new tests. HSTS is not supported in layout tests.
2639         Tested manually.
2640
2641         * platform/network/mac/WebCoreURLResponse.mm:
2642         (WebCore::synthesizeRedirectResponseIfNecessary):
2643
2644 2017-11-10  Alex Christensen  <achristensen@webkit.org>
2645
2646         REGRESSION(r224267): WebViews scheduled with custom run loop modes don't load
2647         https://bugs.webkit.org/show_bug.cgi?id=179515
2648         <rdar://problem/35445245>
2649
2650         Reviewed by Andy Estes.
2651
2652         Covered by a new API test which would have timed out without this change.
2653
2654         * platform/network/mac/WebCoreResourceHandleAsOperationQueueDelegate.mm:
2655         (schedulePairHashSet):
2656         Collect run loop modes from the NetworkingContext similarly to how we did before https://trac.webkit.org/changeset/224267/webkit#file40
2657         (-[WebCoreResourceHandleAsOperationQueueDelegate connection:willSendRequest:redirectResponse:]):
2658         (-[WebCoreResourceHandleAsOperationQueueDelegate connection:didReceiveAuthenticationChallenge:]):
2659         (-[WebCoreResourceHandleAsOperationQueueDelegate connection:canAuthenticateAgainstProtectionSpace:]):
2660         (-[WebCoreResourceHandleAsOperationQueueDelegate connection:didReceiveResponse:]):
2661         (-[WebCoreResourceHandleAsOperationQueueDelegate connection:didReceiveData:lengthReceived:]):
2662         (-[WebCoreResourceHandleAsOperationQueueDelegate connection:didSendBodyData:totalBytesWritten:totalBytesExpectedToWrite:]):
2663         (-[WebCoreResourceHandleAsOperationQueueDelegate connectionDidFinishLoading:]):
2664         (-[WebCoreResourceHandleAsOperationQueueDelegate connection:didFailWithError:]):
2665         (-[WebCoreResourceHandleAsOperationQueueDelegate connection:willCacheResponse:]):
2666
2667 2017-11-10  Chris Dumez  <cdumez@apple.com>
2668
2669         Simplify SWServerRegistration::forEachConnection()
2670         https://bugs.webkit.org/show_bug.cgi?id=179523
2671
2672         Reviewed by Alex Christensen.
2673
2674         Simplify SWServerRegistration::forEachConnection() by dropping the hack
2675         introduced in r224590 to work around the fact that we had a race
2676         between Storage & WebProcess processes during registration. After
2677         r224652, we do an IPC handshake between those 2 processes after
2678         resolving the registration promise so we know for sure the
2679         ServiceWorkerRegistration object has registered itself with the
2680         Storage process before we keep going with the install steps.
2681
2682         No new tests, no expected Web-facing behavior change.
2683
2684         * workers/service/server/SWServerJobQueue.cpp:
2685         (WebCore::SWServerJobQueue::scriptFetchFinished):
2686         (WebCore::SWServerJobQueue::install):
2687         (WebCore::SWServerJobQueue::didResolveRegistrationPromise):
2688         (WebCore::SWServerJobQueue::didFinishInstall):
2689         (WebCore::SWServerJobQueue::runRegisterJob):
2690         (WebCore::SWServerJobQueue::runUnregisterJob):
2691         * workers/service/server/SWServerRegistration.cpp:
2692         (WebCore::SWServerRegistration::updateRegistrationState):
2693         (WebCore::SWServerRegistration::updateWorkerState):
2694         (WebCore::SWServerRegistration::fireUpdateFoundEvent):
2695         (WebCore::SWServerRegistration::forEachConnection):
2696         * workers/service/server/SWServerRegistration.h:
2697
2698 2017-11-10  Ms2ger  <Ms2ger@igalia.com>
2699
2700         Allow XHR to override the User-Agent header.
2701         https://bugs.webkit.org/show_bug.cgi?id=179527
2702
2703         Reviewed by Chris Dumez.
2704
2705         Also rename FrameLoader::applyUserAgent to FrameLoader::applyUserAgentIfNeeded
2706         for clarity.
2707
2708         Test: imported/w3c/web-platform-tests/XMLHttpRequest/setrequestheader-header-allowed.htm
2709
2710         * loader/FrameLoader.cpp:
2711         (WebCore::FrameLoader::addExtraFieldsToRequest):
2712         (WebCore::FrameLoader::applyUserAgentIfNeeded):
2713         * loader/FrameLoader.h:
2714         * loader/ResourceLoadNotifier.cpp:
2715         (WebCore::ResourceLoadNotifier::willSendRequest):
2716         * loader/appcache/ApplicationCacheGroup.cpp:
2717         (WebCore::ApplicationCacheGroup::createResourceHandle):
2718         * loader/cache/CachedResourceRequest.cpp:
2719         (WebCore::CachedResourceRequest::updateReferrerOriginAndUserAgentHeaders):
2720
2721 2017-11-10  Ms2ger  <Ms2ger@igalia.com>
2722
2723         [GTK] Use fallible allocation in ImageBuffer::ImageBuffer().
2724         https://bugs.webkit.org/show_bug.cgi?id=179051
2725
2726         Reviewed by Michael Catanzaro.
2727
2728         Test: imported/w3c/web-platform-tests/2dcontext/imagebitmap/createImageBitmap-invalid-args.html
2729
2730         * platform/graphics/cairo/ImageBufferCairo.cpp:
2731         (WebCore::ImageBuffer::ImageBuffer):
2732
2733 2017-11-10  Miguel Gomez  <magomez@igalia.com>
2734
2735         [GTK][WPE] CoordinatedGraphicsLayer::setNeedsDisplayInRect() converts FloatRect to IntRect erroneously
2736         https://bugs.webkit.org/show_bug.cgi?id=179476
2737
2738         Reviewed by Žan Doberšek.
2739
2740         Convert the passed FloatRect into an IntRect using enclosingIntRect(), so we are guaranteed that
2741         the rectangle to paint fits into the buffer that the backingStore will allocate.
2742
2743         No behaviour change.
2744
2745         * platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.cpp:
2746         (WebCore::CoordinatedGraphicsLayer::setNeedsDisplayInRect):
2747
2748 2017-11-10  Fujii Hironori  <Hironori.Fujii@sony.com>
2749
2750         WebInjectedScriptHost.cpp: warning: variable ‘scope’ set but not used
2751         https://bugs.webkit.org/show_bug.cgi?id=179524
2752
2753         Reviewed by Joseph Pecoraro.
2754
2755         r224606 has introduced a new compilation warning if not
2756         ENABLE(PAYMENT_REQUEST).
2757
2758         No new tests (No behavior change).
2759
2760         * inspector/WebInjectedScriptHost.cpp:
2761         (WebCore::WebInjectedScriptHost::getInternalProperties): Do not
2762         define the variable 'scope' if not ENABLE(PAYMENT_REQUEST). Marked
2763         a variable 'vm' with UNUSED_PARAM.
2764
2765 2017-11-10  Zan Dobersek  <zdobersek@igalia.com>
2766
2767         [Cairo] Start grouping Cairo GraphicsContext operations behind a separate interface
2768         https://bugs.webkit.org/show_bug.cgi?id=179467
2769
2770         Reviewed by Carlos Garcia Campos.
2771
2772         Start moving the Cairo operations in GraphicsContext into a separate
2773         translation unit, CairoOperations.cpp. This will ease leveraging these
2774         operations from a pre-recorded list of GraphicsContext commands, or
2775         from a Cairo-specific GraphicsContextImpl, without undermining the
2776         current GraphicsContext implementation that we'll want to maintain
2777         in a working state until necessary.
2778
2779         We start with the clipping operations. Each operation is encapsulated
2780         in a static function inside the WebCore::Cairo namespace that expects
2781         PlatformContextCairo reference as the first argument, which makes sense
2782         since we have to utilize the cairo_t state object that's kept there.
2783         Other parameters are passed as well, as required for some specific
2784         operation.
2785
2786         In the Cairo implementation of GraphicsContext, the affected methods
2787         are changed to assert presence of the platform context (i.e. this is a
2788         GraphicsContext that operates on a valid cairo_t object, and is not
2789         using an m_impl object or is in non-painting mode) before the
2790         PlatformContextCairo object is dereferenced and passed along with
2791         other arguments to the Cairo::clip*() function.
2792
2793         No new tests -- no change in behavior.
2794
2795         * platform/SourcesCairo.txt:
2796         * platform/graphics/cairo/CairoOperations.cpp: Added.
2797         (WebCore::Cairo::clip):
2798         (WebCore::Cairo::clipOut):
2799         (WebCore::Cairo::clipPath):
2800         (WebCore::Cairo::clipToImageBuffer):
2801         * platform/graphics/cairo/CairoOperations.h: Added.
2802         * platform/graphics/cairo/GraphicsContextCairo.cpp:
2803         (WebCore::GraphicsContext::clip):
2804         (WebCore::GraphicsContext::clipPath):
2805         (WebCore::GraphicsContext::clipToImageBuffer):
2806         (WebCore::GraphicsContext::clipOut):
2807
2808 2017-11-09  Chris Dumez  <cdumez@apple.com>
2809
2810         Unreviewed, rolling out r224661.
2811
2812         Broke build on several internal Mac/iOS bots
2813
2814         Reverted changeset:
2815
2816         "Ignore HSTS for partitioned, cross-origin subresource
2817         requests"
2818         https://bugs.webkit.org/show_bug.cgi?id=178993
2819         https://trac.webkit.org/changeset/224661
2820
2821 2017-11-09  Chris Dumez  <cdumez@apple.com>
2822
2823         ServiceWorkerRegistration objects may get recycled for different SWServerRegistration objects
2824         https://bugs.webkit.org/show_bug.cgi?id=179517
2825
2826         Reviewed by Brady Eidson.
2827
2828         ServiceWorkerRegistration objects could get recycled for different SWServerRegistration objects, leading to
2829         flakiness in the tests. We uses ServiceWorkerRegistrationKey as key in the m_registration map on WebProcess
2830         side. The lifetime of the ServiceWorkerRegistration objects is tied to the lifetime of their JS wrapper.
2831         When a test does a registration for a given scope, then unregisters, then registers again for the same scope,
2832         we would end up creating a new SWServerRegistration object on server side, but possibly reuse the same
2833         ServiceWorkerRegistration object on WebProcess side, if its wrapper has not yet been garbage collected.
2834         This is because the registrations have the same ServiceWorkerRegistrationKey in this case.
2835
2836         To address the issue, we now use the ServiceWorkerRegistrationIdentifier as key in the m_registration
2837         hash map. A SWServerRegistration has a unique ServiceWorkerRegistrationIdentifier on server side.
2838         All its clients ServiceWorkerRegistration also use the same ServiceWorkerRegistrationIdentifier.
2839
2840         Test: http/tests/workers/service/basic-unregister-then-register-again-no-reuse.html
2841
2842         * workers/service/ServiceWorkerContainer.cpp:
2843         (WebCore::ServiceWorkerContainer::getRegistration):
2844         (WebCore::ServiceWorkerContainer::scheduleTaskToUpdateRegistrationState):
2845         (WebCore::ServiceWorkerContainer::scheduleTaskToFireUpdateFoundEvent):
2846         (WebCore::ServiceWorkerContainer::jobResolvedWithRegistration):
2847         (WebCore::ServiceWorkerContainer::addRegistration):
2848         (WebCore::ServiceWorkerContainer::removeRegistration):
2849         * workers/service/ServiceWorkerContainer.h:
2850         * workers/service/ServiceWorkerRegistration.h:
2851         * workers/service/ServiceWorkerRegistrationData.h:
2852         (WebCore::ServiceWorkerRegistrationData::decode):
2853         * workers/service/server/SWClientConnection.cpp:
2854         (WebCore::SWClientConnection::updateRegistrationState):
2855         (WebCore::SWClientConnection::fireUpdateFoundEvent):
2856         * workers/service/server/SWClientConnection.h:
2857         * workers/service/server/SWServer.cpp:
2858         (WebCore::SWServer::Connection::addServiceWorkerRegistrationInServer):
2859         (WebCore::SWServer::Connection::removeServiceWorkerRegistrationInServer):
2860         (WebCore::SWServer::resolveRegistrationJob):
2861         (WebCore::SWServer::addClientServiceWorkerRegistration):
2862         (WebCore::SWServer::removeClientServiceWorkerRegistration):
2863         * workers/service/server/SWServer.h:
2864         * workers/service/server/SWServerRegistration.cpp:
2865         (WebCore::generateServiceWorkerRegistrationIdentifier):
2866         (WebCore::SWServerRegistration::SWServerRegistration):
2867         (WebCore::SWServerRegistration::updateRegistrationState):
2868         (WebCore::SWServerRegistration::fireUpdateFoundEvent):
2869         (WebCore::SWServerRegistration::forEachConnection):
2870         (WebCore::SWServerRegistration::addClientServiceWorkerRegistration):
2871         (WebCore::SWServerRegistration::removeClientServiceWorkerRegistration):
2872         * workers/service/server/SWServerRegistration.h:
2873         (WebCore::SWServerRegistration::identifier const):
2874
2875 2017-11-09  John Wilander  <wilander@apple.com>
2876
2877         Ignore HSTS for partitioned, cross-origin subresource requests
2878         https://bugs.webkit.org/show_bug.cgi?id=178993
2879         <rdar://problem/34962462>
2880
2881         Reviewed by Brent Fulgham.
2882
2883         No new tests. HSTS is not supported in layout tests.
2884         Tested manually.
2885
2886         * platform/network/mac/WebCoreURLResponse.mm:
2887         (WebCore::synthesizeRedirectResponseIfNecessary):
2888
2889 2017-11-09  Zalan Bujtas  <zalan@apple.com>
2890
2891         [LayoutState cleanup] Remove explicit pop from LayoutState
2892         https://bugs.webkit.org/show_bug.cgi?id=179509
2893         <rdar://problem/35454323>
2894
2895         Reviewed by Antti Koivisto.
2896
2897         Both relayoutForPagination()/relayoutToAvoidWidows() call layout recursively which requires
2898         manual layout state pop. This patch addresses this issue by constructing a new LayoutState object
2899         for the positioned descendants.
2900
2901         Covered by existing tests.
2902
2903         * rendering/LayoutState.cpp:
2904         (WebCore::LayoutStateMaintainer::~LayoutStateMaintainer):
2905         (WebCore::LayoutStateMaintainer::pop): Deleted.
2906         * rendering/LayoutState.h:
2907         * rendering/RenderBlockFlow.cpp:
2908         (WebCore::RenderBlockFlow::layoutBlock):
2909         (WebCore::RenderBlockFlow::relayoutToAvoidWidows):
2910         (WebCore::RenderBlockFlow::relayoutForPagination):
2911         * rendering/RenderBlockFlow.h:
2912
2913 2017-11-09  Chris Dumez  <cdumez@apple.com>
2914
2915         Implement real post 'install' event steps of the Install algorithm (steps 14+)
2916         https://bugs.webkit.org/show_bug.cgi?id=179401
2917
2918         Reviewed by Brady Eidson.
2919
2920         Implement step 14+ of Install algorithm, as per:
2921         - https://w3c.github.io/ServiceWorker/#installation-algorithm
2922
2923         * dom/Microtasks.h:
2924         * workers/service/ServiceWorker.cpp:
2925         (WebCore::ServiceWorker::ServiceWorker):
2926         (WebCore::ServiceWorker::scheduleTaskToUpdateState):
2927         * workers/service/ServiceWorker.h:
2928         * workers/service/ServiceWorkerContainer.cpp:
2929         (WebCore::ServiceWorkerContainer::scheduleTaskToUpdateRegistrationState):
2930         (WebCore::ServiceWorkerContainer::jobFailedWithException):
2931         (WebCore::ServiceWorkerContainer::scheduleTaskToFireUpdateFoundEvent):
2932         (WebCore::ServiceWorkerContainer::jobResolvedWithRegistration):
2933         (WebCore::ServiceWorkerContainer::jobResolvedWithUnregistrationResult):
2934         * workers/service/ServiceWorkerContainer.h:
2935         * workers/service/ServiceWorkerJob.cpp:
2936         (WebCore::ServiceWorkerJob::resolvedWithRegistration):
2937         * workers/service/ServiceWorkerJob.h:
2938         * workers/service/ServiceWorkerJobClient.h:
2939         * workers/service/ServiceWorkerRegistration.cpp:
2940         (WebCore::ServiceWorkerRegistration::ServiceWorkerRegistration):
2941         * workers/service/ServiceWorkerTypes.h:
2942         * workers/service/server/SWClientConnection.cpp:
2943         (WebCore::SWClientConnection::registrationJobResolvedInServer):
2944         (WebCore::SWClientConnection::forEachContainer):
2945         (WebCore::SWClientConnection::updateRegistrationState):
2946         (WebCore::SWClientConnection::updateWorkerState):
2947         (WebCore::SWClientConnection::fireUpdateFoundEvent):
2948         * workers/service/server/SWClientConnection.h:
2949         * workers/service/server/SWServer.cpp:
2950         (WebCore::SWServer::Connection::didResolveRegistrationPromise):
2951         (WebCore::SWServer::resolveRegistrationJob):
2952         (WebCore::SWServer::didResolveRegistrationPromise):
2953         * workers/service/server/SWServer.h:
2954         * workers/service/server/SWServerJobQueue.cpp:
2955         (WebCore::SWServerJobQueue::install):
2956         (WebCore::SWServerJobQueue::didResolveRegistrationPromise):
2957         (WebCore::SWServerJobQueue::didFinishInstall):
2958         (WebCore::SWServerJobQueue::runRegisterJob):
2959         * workers/service/server/SWServerJobQueue.h:
2960         * workers/service/server/SWServerRegistration.cpp:
2961         * workers/service/server/SWServerRegistration.h:
2962         (WebCore::SWServerRegistration::installingWorker const):
2963         (WebCore::SWServerRegistration::waitingWorker const):
2964         (WebCore::SWServerRegistration::activeWorker const):
2965         * workers/service/server/SWServerWorker.cpp:
2966         (WebCore::SWServerWorker::terminate):
2967         * workers/service/server/SWServerWorker.h:
2968
2969 2017-11-09  Doug Russell  <d_russell@apple.com>
2970
2971         Bug 179068 - AX: search predicate returns containing group for plain text instead of text element
2972         https://bugs.webkit.org/show_bug.cgi?id=179068
2973
2974         Reviewed by Darin Adler
2975
2976         Implement a check in AccessibilityRenderObject::hasPlainText(), AccessibilityObject::canHavePlainText(), to confirm the element is capable of providing text.
2977
2978         Tests: accessibility/mac/search-predicate-plaintext.html
2979                accessibility/mac/search-predicate-visible-button.html
2980                accessibility/mac/search-predicate-visited-links.html
2981
2982         * accessibility/AccessibilityNodeObject.cpp:
2983         (WebCore::AccessibilityNodeObject::text const):
2984         (WebCore::AccessibilityNodeObject::stringValue const):
2985         * accessibility/AccessibilityObject.h:
2986         (WebCore::AccessibilityObject::isARIAStaticText const):
2987         * accessibility/AccessibilityRenderObject.cpp:
2988         (WebCore::AccessibilityRenderObject::stringValue const):
2989         (WebCore::AccessibilityRenderObject::canHavePlainText const):
2990         (WebCore::AccessibilityRenderObject::hasPlainText const):
2991         * accessibility/AccessibilityRenderObject.h:
2992
2993 2017-11-09  Wenson Hsieh  <wenson_hsieh@apple.com>
2994
2995         Inserting an image, selecting, underlining, and then deleting leaves the typing style with both "-webkit-text-decorations-in-effect" and "text-decoration"
2996         https://bugs.webkit.org/show_bug.cgi?id=179431
2997
2998         Reviewed by Ryosuke Niwa.
2999
3000         When inserting an image element, selecting it, underlining the selection, deleting, and then inserting text, we
3001         crash on a debug assert. This codepath was exercised by an API test added in <https://trac.webkit.org/r224512>.
3002         This assertion happens due to the following sequence of events:
3003         1. DeleteSelectionCommand::saveTypingStyleState computes a typing style.
3004         2. In doing so, it calls into EditingStyle::init, which observes that "-webkit-text-decorations-in-effect" is
3005            present and appends "text-decoration" with an identical CSS value to the EditingStyle's mutable style
3006            properties.
3007         3. DeleteSelectionCommand::calculateTypingStyleAfterDelete sets the current selection's typing style to the
3008            above typing style.
3009         4. Later on, when we try to insert text, we compute the StyleChange using the above typing style, which calls
3010            into reconcileTextDecorationProperties.
3011         5. reconcileTextDecorationProperties debug asserts that "-webkit-text-decorations-in-effect" and
3012            "text-decoration" don't coexist on the EditingStyle's (i.e. the typing style's) mutable properties; since (2)
3013            added both properties, this assertion fires.
3014
3015         It appears that step (2) shouldn't be adding "text-decoration" in addition to EditingStyle's mutable style
3016         properties, since doing so would violate the requirements of reconcileTextDecorationProperties. As such, we can
3017         tweak EditingStyle::init to *replace* the "-webkit-text-decorations-in-effect" property with "text-decoration"
3018         instead; this matches the behavior of reconcileTextDecorationProperties, and ensures that we only have the
3019         "text-decorations" property when we try to insert text in step (4).
3020
3021         Test: editing/execCommand/underline-selection-containing-image.html
3022
3023         * editing/EditingStyle.cpp:
3024         (WebCore::EditingStyle::init):
3025
3026 2017-11-09  Devin Rousso  <webkit@devinrousso.com>
3027
3028         Web Inspector: support undo/redo of insertAdjacentHTML
3029         https://bugs.webkit.org/show_bug.cgi?id=179283
3030
3031         Reviewed by Joseph Pecoraro.
3032
3033         Test: inspector/dom/insertAdjacentHTML.html
3034
3035         Create another version of Element::insertAdjacentHTML that keeps track of the nodes that are
3036         added. This is necessary because the children of a DocumentFragment are removed when it is
3037         added to a ContainerNode. In this way, it is possible to remove those nodes during an undo.
3038
3039         * dom/Element.h:
3040         * dom/Element.cpp:
3041         (WebCore::Element::insertAdjacentHTML):
3042
3043         * inspector/DOMEditor.h:
3044         * inspector/DOMEditor.cpp:
3045         (WebCore::DOMEditor::insertAdjacentHTML):
3046         Drive-by fix: sort functions and class declarations.
3047
3048         * inspector/agents/InspectorDOMAgent.h:
3049         * inspector/agents/InspectorDOMAgent.cpp:
3050         (WebCore::InspectorDOMAgent::insertAdjacentHTML):
3051
3052 2017-11-09  Zalan Bujtas  <zalan@apple.com>
3053
3054         [LayoutState cleanup] Remove redundant LayoutState c'tor
3055         https://bugs.webkit.org/show_bug.cgi?id=179505
3056         <rdar://problem/35450650>
3057
3058         Reviewed by Antti Koivisto.
3059
3060         No change in functionality.
3061
3062         * rendering/LayoutState.cpp:
3063         * rendering/LayoutState.h:
3064
3065 2017-11-09  Youenn Fablet  <youenn@apple.com>
3066
3067         FetchResponse should set the mime type of its internal ResourceResponse
3068         https://bugs.webkit.org/show_bug.cgi?id=179487
3069
3070         Reviewed by Chris Dumez.
3071
3072         No observable change.
3073         Setting the mime type of the response as navigation loads use that field.
3074         This will be used for navigation loads served by service worker.
3075
3076         * Modules/fetch/FetchResponse.cpp:
3077         (WebCore::FetchResponse::create):
3078
3079 2017-11-09  Youenn Fablet  <youenn@apple.com>
3080
3081         ServiceWorker ResourceResponse should not assert in platformCertificateInfo()
3082         https://bugs.webkit.org/show_bug.cgi?id=179486
3083
3084         Reviewed by Chris Dumez.
3085
3086         No change of behavior.
3087         In case a Response is returned by Service Worker, there may be no related internal response.
3088         In that case, platformCertificateInfo is returning an empty CertificateInfo.
3089
3090         * platform/network/cocoa/ResourceResponseCocoa.mm:
3091         (WebCore::ResourceResponse::platformCertificateInfo const):
3092
3093 2017-11-09  Zalan Bujtas  <zalan@apple.com>
3094
3095         [LayoutState cleanup] Remove conditional push from RenderTableSection::calcRowLogicalHeight
3096         https://bugs.webkit.org/show_bug.cgi?id=179493
3097         <rdar://problem/35446631>
3098
3099         Reviewed by Antti Koivisto.
3100
3101         Pushing layout states is cheap and we do it for every container anyway.
3102
3103         Covered by existing tests.
3104
3105         * rendering/LayoutState.cpp:
3106         (WebCore::LayoutStateMaintainer::LayoutStateMaintainer):
3107         (WebCore::LayoutStateMaintainer::~LayoutStateMaintainer):
3108         (WebCore::LayoutStateMaintainer::pop):
3109         (WebCore::LayoutStateMaintainer::push): Deleted.
3110         * rendering/LayoutState.h:
3111         (WebCore::LayoutStateMaintainer::didPush const): Deleted.
3112         * rendering/RenderTableSection.cpp:
3113         (WebCore::RenderTableSection::calcRowLogicalHeight):
3114
3115 2017-11-09  Youenn Fablet  <youenn@apple.com>
3116
3117         CachedResourceLoader::requestRawResource should not assert when destination is set in the context of a service worker
3118         https://bugs.webkit.org/show_bug.cgi?id=179491
3119
3120         Reviewed by Chris Dumez.
3121
3122         No change of behavior.
3123         requestRawResource on web page should have the destination set as the empty string as per fetch spec.
3124         In the context of a service worker, requestRawResource may be used with any destination.
3125         Updating assertion accordingly.
3126
3127         * loader/cache/CachedResourceLoader.cpp:
3128         (WebCore::CachedResourceLoader::requestRawResource):
3129
3130 2017-11-09  Youenn Fablet  <youenn@apple.com>
3131
3132         ResourceErrorBase::setType should not ASSERT if it is a no op
3133         https://bugs.webkit.org/show_bug.cgi?id=179490
3134
3135         Reviewed by Chris Dumez.
3136
3137         No change of behavior.
3138
3139         * platform/network/ResourceErrorBase.cpp:
3140         (WebCore::ResourceErrorBase::setType):
3141
3142 2017-11-09  Zalan Bujtas  <zalan@apple.com>
3143
3144         [LayoutState cleanup] Remove renderer data members from state maintainers.
3145         https://bugs.webkit.org/show_bug.cgi?id=179483
3146         <rdar://problem/35442548>
3147
3148         Reviewed by Darin Adler.
3149
3150         Although layout is not supposed to mutate the tree anymore, it's safer to use LayoutContext instead.
3151
3152         No change in functionality.
3153
3154         * page/LayoutContext.cpp:
3155         * page/LayoutContext.h:
3156         * rendering/LayoutState.cpp:
3157         (WebCore::SubtreeLayoutStateMaintainer::SubtreeLayoutStateMaintainer):
3158         (WebCore::SubtreeLayoutStateMaintainer::~SubtreeLayoutStateMaintainer):
3159         (WebCore::PaginatedLayoutStateMaintainer::PaginatedLayoutStateMaintainer):
3160         (WebCore::PaginatedLayoutStateMaintainer::~PaginatedLayoutStateMaintainer):
3161         * rendering/LayoutState.h:
3162
3163 2017-11-09  Maciej Stachowiak  <mjs@apple.com>
3164
3165         Remove support for iOS-only softbank-sjis encoding if possible
3166         https://bugs.webkit.org/show_bug.cgi?id=179416
3167
3168         Reviewed by Darin Adler.
3169
3170         * platform/text/TextCodecICU.cpp:
3171         (WebCore::TextCodecICU::registerEncodingNames): Remove support for softbank-sjis
3172         codec, because by code inspection it couldn't have possibly worked.
3173         (WebCore::TextCodecICU::registerCodecs): Ditto.
3174
3175 2017-11-09  Christopher Reid  <chris.reid@sony.com>
3176
3177         Use enum classes within FileSystem
3178         https://bugs.webkit.org/show_bug.cgi?id=175172
3179
3180         Reviewed by Darin Adler.
3181
3182         No new tests, no change in behavior.
3183
3184         Further cleanup to FileSystem's enum classes.
3185         Shortening FileSystem's enum names now that they are enum classes.
3186         Adding OptionSet<FileLockMode> to functions using the FileLockMode enum.
3187
3188         * Modules/webdatabase/OriginLock.cpp:
3189         * loader/appcache/ApplicationCacheStorage.cpp:
3190         * platform/FileHandle.h:
3191         * platform/FileStream.cpp:
3192         * platform/FileSystem.cpp:
3193         * platform/FileSystem.h:
3194         * platform/cocoa/FileMonitorCocoa.mm:
3195         * platform/glib/FileSystemGlib.cpp:
3196         * platform/network/curl/CurlCacheEntry.cpp:
3197         * platform/network/curl/CurlCacheManager.cpp:
3198         * platform/posix/FileSystemPOSIX.cpp:
3199         * platform/win/FileSystemWin.cpp:
3200         * rendering/RenderThemeWin.cpp:
3201
3202 2017-11-09  Zalan Bujtas  <zalan@apple.com>
3203
3204         [LayoutState cleanup] LayouState::m_lineGrid should be a weak pointer
3205         https://bugs.webkit.org/show_bug.cgi?id=179484
3206         <rdar://problem/35442725>
3207
3208         Reviewed by Darin Adler.
3209
3210         Covered by existing tests.
3211
3212         * rendering/LayoutState.cpp:
3213         (WebCore::LayoutState::propagateLineGridInfo):
3214         (WebCore::LayoutState::establishLineGrid):
3215         * rendering/LayoutState.h:
3216         (WebCore::LayoutState::lineGrid const):
3217
3218 2017-11-09  Zalan Bujtas  <zalan@apple.com>
3219
3220         [LayoutState cleanup] Add pagination parameter to subtree LayoutState
3221         https://bugs.webkit.org/show_bug.cgi?id=179465
3222         <rdar://problem/35434096>
3223
3224         Reviewed by Antti Koivisto.
3225
3226         It enables us to remove the last setters from LayoutState.
3227
3228         No change in functionality.
3229
3230         * page/LayoutContext.cpp:
3231         (WebCore::LayoutContext::pushLayoutStateForPaginationIfNeeded):
3232         * rendering/LayoutState.cpp:
3233         (WebCore::LayoutState::LayoutState):
3234         (WebCore::LayoutState::layoutDeltaMatches const):
3235         (WebCore::LayoutState::layoutDeltaMatches): Deleted.
3236         * rendering/LayoutState.h:
3237         (WebCore::LayoutState::isPaginated const):
3238         (WebCore::LayoutState::setIsPaginated): Deleted.
3239         (WebCore::LayoutState::setPageLogicalHeight): Deleted.
3240
3241 2017-11-08  Joseph Pecoraro  <pecoraro@apple.com>
3242
3243         AVSampleBufferGenerator leaks seen on leaks bot
3244         https://bugs.webkit.org/show_bug.cgi?id=179464
3245
3246         Reviewed by Jer Noble.
3247
3248         * platform/graphics/avfoundation/objc/ImageDecoderAVFObjC.mm:
3249         (WebCore::ImageDecoderAVFObjC::readSampleMetadata):
3250         (WebCore::ImageDecoderAVFObjC::createFrameImageAtIndex):
3251         Adopt the allocation into our RetainPtr.
3252
3253 2017-11-08  Simon Fraser  <simon.fraser@apple.com>
3254
3255         Content not painted when scrolling an overflow node inside an iframe
3256         https://bugs.webkit.org/show_bug.cgi?id=179315
3257         rdar://problem/35364166
3258
3259         Reviewed by Tim Horton.
3260
3261         When scrolling overflow:scroll, we need to check for overlap updates just as we do
3262         for page scrolls.
3263
3264         Test: compositing/ios/overflow-scroll-update-overlap.html
3265
3266         * rendering/RenderLayerCompositor.cpp:
3267         (WebCore::RenderLayerCompositor::updateCompositingLayers):
3268
3269 2017-11-08  Simon Fraser  <simon.fraser@apple.com>
3270
3271         Cordova: elements with tag position:fixed disappears (flickering) when a long content is scrolling and appears again when the scroll is finished.
3272         https://bugs.webkit.org/show_bug.cgi?id=178066
3273
3274         Reviewed by Tim Horton.
3275
3276         In UIWebView, we were failing to call setIsViewportConstrained() on layers for position:fixed,
3277         causing us to detach their backing store sometimes on page scrolling.
3278         
3279         Fix by hoisting the call to RenderLayerBacking::setIsScrollCoordinatedWithViewportConstrainedRole()
3280         up the stack into code that runs for both UIWebView and WKWebView. This required moving some of
3281         the sanity check code up out of updateScrollCoordinatedLayer() into the caller.
3282
3283         Not testable because the bug only manifested in UIWebView.
3284
3285         * rendering/RenderLayerCompositor.cpp:
3286         (WebCore::canCoordinateScrollingForLayer):
3287         (WebCore::RenderLayerCompositor::updateScrollCoordinatedStatus):
3288         (WebCore::RenderLayerCompositor::updateScrollCoordinatedLayer):
3289
3290 2017-11-08  Zalan Bujtas  <zalan@apple.com>
3291
3292         [LayoutState cleanup] Move RenderMultiColumnFlow::computeLineGridPaginationOrigin to LayoutState
3293         https://bugs.webkit.org/show_bug.cgi?id=179462
3294
3295         Reviewed by Antti Koivisto.
3296
3297         This is in preparation for having no setters on LayoutState.
3298         Having all the related functions (pagination/line-grid) in one place also helps with moving
3299         them to a more appropriate place later.
3300
3301         No change in functionality.
3302
3303         * rendering/LayoutState.cpp:
3304         (WebCore::LayoutState::computePaginationInformation):
3305         (WebCore::LayoutState::computeLineGridPaginationOrigin):
3306         (WebCore::LayoutState::establishLineGrid):
3307         * rendering/LayoutState.h:
3308         (WebCore::LayoutState::setLineGridPaginationOrigin): Deleted.
3309         (WebCore::LayoutState::currentRenderFragmentedFlow const): Deleted.
3310         (WebCore::LayoutState::setCurrentRenderFragmentedFlow): Deleted.
3311         * rendering/RenderMultiColumnFlow.cpp:
3312         (WebCore::RenderMultiColumnFlow::computeLineGridPaginationOrigin const): Deleted.
3313
3314 2017-11-08  Jiewen Tan  <jiewen_tan@apple.com>
3315
3316         Replace some stack raw pointers with RefPtrs within WebCore/svg
3317         https://bugs.webkit.org/show_bug.cgi?id=179314
3318         <rdar://problem/34842204>
3319
3320         Reviewed by Ryosuke Niwa.
3321
3322         Besides replacing pointers directly, some of the methods are changed to return
3323         RefPtrs as well.
3324
3325         No changes in behaviors.
3326
3327         * accessibility/AccessibilityRenderObject.cpp:
3328         (WebCore::AccessibilityRenderObject::remoteSVGRootElement const):
3329         * dom/EventPath.h:
3330         (WebCore::EventPath::eventTargetRespectingTargetRules):
3331         * page/FrameView.cpp:
3332         (WebCore::FrameView::scrollToAnchor):
3333         * svg/SVGAElement.cpp:
3334         (WebCore::SVGAElement::defaultEventHandler):
3335         * svg/SVGAltGlyphElement.cpp:
3336         (WebCore::SVGAltGlyphElement::hasValidGlyphElements const):
3337         * svg/SVGAnimateElementBase.cpp:
3338         (WebCore::SVGAnimateElementBase::hasValidAttributeType):
3339         (WebCore::SVGAnimateElementBase::calculateAnimatedValue):
3340         (WebCore::SVGAnimateElementBase::calculateFromAndToValues):
3341         (WebCore::SVGAnimateElementBase::calculateFromAndByValues):
3342         (WebCore::SVGAnimateElementBase::resetAnimatedType):
3343         (WebCore::SVGAnimateElementBase::applyResultsToTarget):
3344         (WebCore::SVGAnimateElementBase::calculateDistance):
3345         * svg/SVGAnimateMotionElement.cpp:
3346         (WebCore::SVGAnimateMotionElement::hasValidAttributeType):
3347         (WebCore::SVGAnimateMotionElement::updateAnimationPath):
3348         (WebCore::SVGAnimateMotionElement::resetAnimatedType):
3349         (WebCore::SVGAnimateMotionElement::calculateAnimatedValue):
3350         (WebCore::SVGAnimateMotionElement::applyResultsToTarget):
3351         * svg/SVGAnimateTransformElement.cpp:
3352         (WebCore::SVGAnimateTransformElement::hasValidAttributeType):
3353         * svg/SVGAnimatedPath.cpp:
3354         (WebCore::SVGAnimatedPathAnimator::resetAnimValToBaseVal):
3355         * svg/SVGAnimationElement.cpp:
3356         (WebCore::SVGAnimationElement::adjustForInheritance):
3357         (WebCore::SVGAnimationElement::determinePropertyValueTypes):
3358         * svg/SVGDocument.cpp:
3359         (WebCore::SVGDocument::rootElement):
3360         (WebCore::SVGDocument::zoomAndPanEnabled const):
3361         (WebCore::SVGDocument::startPan):
3362         (WebCore::SVGDocument::updatePan const):
3363         * svg/SVGDocument.h:
3364         * svg/SVGDocumentExtensions.cpp:
3365         (WebCore::SVGDocumentExtensions::removeElementFromPendingResourcesForRemovalMap):
3366         * svg/SVGDocumentExtensions.h:
3367         * svg/SVGElement.cpp:
3368         (WebCore::SVGElement::~SVGElement):
3369         (WebCore::SVGElement::correspondingUseElement const):
3370         (WebCore::SVGElement::setCorrespondingElement):
3371         (WebCore::SVGElement::resolveCustomStyle):
3372         (WebCore::SVGElement::computedStyle):
3373         (WebCore::SVGElement::buildPendingResourcesIfNeeded):
3374         (WebCore::SVGElement::updateRelativeLengthsInformation):
3375         (WebCore::SVGElement::invalidateInstances):
3376         * svg/SVGElement.h:
3377         * svg/SVGFEBlendElement.cpp:
3378         (WebCore::SVGFEBlendElement::build):
3379         * svg/SVGFEColorMatrixElement.cpp:
3380         (WebCore::SVGFEColorMatrixElement::build):
3381         * svg/SVGFEComponentTransferElement.cpp:
3382         (WebCore::SVGFEComponentTransferElement::build):
3383         * svg/SVGFECompositeElement.cpp:
3384         (WebCore::SVGFECompositeElement::build):
3385         * svg/SVGFEConvolveMatrixElement.cpp:
3386         (WebCore::SVGFEConvolveMatrixElement::build):
3387         * svg/SVGFEDiffuseLightingElement.cpp:
3388         (WebCore::SVGFEDiffuseLightingElement::build):
3389         * svg/SVGFEDisplacementMapElement.cpp:
3390         (WebCore::SVGFEDisplacementMapElement::build):
3391         * svg/SVGFEDropShadowElement.cpp:
3392         (WebCore::SVGFEDropShadowElement::build):
3393         * svg/SVGFEGaussianBlurElement.cpp:
3394         (WebCore::SVGFEGaussianBlurElement::build):
3395         * svg/SVGFEImageElement.cpp:
3396         (WebCore::SVGFEImageElement::buildPendingResource):
3397         (WebCore::SVGFEImageElement::notifyFinished):
3398         * svg/SVGFELightElement.cpp:
3399         (WebCore::SVGFELightElement::findLightSource):
3400         (WebCore::SVGFELightElement::svgAttributeChanged):
3401         (WebCore::SVGFELightElement::childrenChanged):
3402         * svg/SVGFEMergeElement.cpp:
3403         (WebCore::SVGFEMergeElement::build):
3404         * svg/SVGFEMorphologyElement.cpp:
3405         (WebCore::SVGFEMorphologyElement::build):
3406         * svg/SVGFEOffsetElement.cpp:
3407         (WebCore::SVGFEOffsetElement::build):
3408         * svg/SVGFESpecularLightingElement.cpp:
3409         (WebCore::SVGFESpecularLightingElement::build):
3410         * svg/SVGFETileElement.cpp:
3411         (WebCore::SVGFETileElement::build):
3412         * svg/SVGFilterPrimitiveStandardAttributes.cpp:
3413         (WebCore::invalidateFilterPrimitiveParent):
3414         * svg/SVGFontFaceElement.cpp:
3415         (WebCore::SVGFontFaceElement::rebuildFontFace):
3416         * svg/SVGFontFaceFormatElement.cpp:
3417         (WebCore::SVGFontFaceFormatElement::childrenChanged):
3418         * svg/SVGFontFaceUriElement.cpp:
3419         (WebCore::SVGFontFaceUriElement::childrenChanged):
3420         * svg/SVGForeignObjectElement.cpp:
3421         (WebCore::SVGForeignObjectElement::rendererIsNeeded):
3422         * svg/SVGLengthContext.cpp:
3423         (WebCore::SVGLengt