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