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