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